com php-langspec: Support multiple catch: spec/11-statements.md spec/19-grammar.md

From: Date: Mon, 10 Sep 2018 12:02:25 +0000
Subject: com php-langspec: Support multiple catch: spec/11-statements.md spec/19-grammar.md
Groups: php.standards.cvs 
Request: Send a blank email to standards--cvs+get-418@lists.php.net to get a copy of this message
Commit: 15b92edd483df7f476e93fc7213cbba17bff10c6 Author: Nikita Popov <nikita.ppv@gmail.com> Mon, 10 Sep 2018 14:01:41 +0200 Parents: b5ca441040e2c6f8c38d3b7373f7c720af4b8f8c Branches: master Link: http://git.php.net/?p=php-langspec.git;a=commitdiff;h=15b92edd483df7f476e93fc7213cbba17bff10c6 Log: Support multiple catch Fixes #216. Bugs: https://bugs.php.net/216 Changed paths: M spec/11-statements.md M spec/19-grammar.md Diff: diff --git a/spec/11-statements.md b/spec/11-statements.md index 062a64e..6534929 100644 --- a/spec/11-statements.md +++ b/spec/11-statements.md @@ -1117,7 +1117,11 @@ catch-clauses: catch-clauses catch-clause catch-clause: - 'catch' '(' qualified-name variable-name ')' compound-statement + 'catch' '(' catch-name-list variable-name ')' compound-statement + +catch-name-list: + qualified-name + catch-name-list '|' qualified-name finally-clause: 'finally' compound-statement @@ -1134,7 +1138,11 @@ finally-clause: <i><a href="#grammar-catch-clauses">catch-clauses</a></i> <i><a href="#grammar-catch-clause">catch-clause</a></i> <i id="grammar-catch-clause">catch-clause:</i> - catch ( <i><a href="09-lexical-structure.md#grammar-qualified-name">qualified-name</a></i> <i><a href="09-lexical-structure.md#grammar-variable-name">variable-name</a></i> ) <i><a href="#grammar-compound-statement">compound-statement</a></i> + catch ( <i><a href="#grammar-catch-name-list">catch-name-list</a></i> <i><a href="09-lexical-structure.md#grammar-variable-name">variable-name</a></i> ) <i><a href="#grammar-compound-statement">compound-statement</a></i> + +<i id="grammar-catch-name-list">catch-name-list:</i> + <i><a href="09-lexical-structure.md#grammar-qualified-name">qualified-name</a></i> + <i><a href="#grammar-catch-name-list">catch-name-list</a></i> | <i><a href="09-lexical-structure.md#grammar-qualified-name">qualified-name</a></i> <i id="grammar-finally-clause">finally-clause:</i> finally <i><a href="#grammar-compound-statement">compound-statement</a></i> @@ -1142,9 +1150,8 @@ finally-clause: **Constraints** -In a *catch-clause*, *parameter-declaration-list* must contain only one -parameter, and its type must be [Exception](17-exception-handling.md#class-exception) or a type derived from -that class, and that parameter must not be passed byRef. +Each *qualified-name* inside a *catch-name-list* must name a type derivated from +[Exception](17-exception-handling.md#class-exception). **Semantics** @@ -1165,9 +1172,10 @@ try-block that encloses the call to the current function. This process continues until a catch-block is found that can handle the current exception. -The matching is done by considering the class specified by *qualified-name* -and comparing it to the type of the exception. If the exception is an -[instance of](10-expressions.md#instanceof-operator) this class then the clause matches. +The matching is done by considering the classes specified by *qualified-name* +in *catch-name-list* and comparing it to the type of the exception. If the +exception is an [instance of](10-expressions.md#instanceof-operator) one of +the specified classes then the clause matches. If a matching catch-block is located, the Engine prepares to transfer control to the first statement of that catch-block. However, before diff --git a/spec/19-grammar.md b/spec/19-grammar.md index 7deab0b..e647342 100644 --- a/spec/19-grammar.md +++ b/spec/19-grammar.md @@ -870,7 +870,11 @@ The grammar notation is described in [Grammars section](09-lexical-structure.md# <i><a href="#grammar-catch-clauses">catch-clauses</a></i> <i><a href="#grammar-catch-clause">catch-clause</a></i> <i id="grammar-catch-clause">catch-clause:</i> - catch ( <i><a href="#grammar-qualified-name">qualified-name</a></i> <i><a href="#grammar-variable-name">variable-name</a></i> ) <i><a href="#grammar-compound-statement">compound-statement</a></i> + catch ( <i><a href="#grammar-catch-name-list">catch-name-list</a></i> <i><a href="#grammar-variable-name">variable-name</a></i> ) <i><a href="#grammar-compound-statement">compound-statement</a></i> + +<i id="grammar-catch-name-list">catch-name-list:</i> + <i><a href="#grammar-qualified-name">qualified-name</a></i> + <i><a href="#grammar-catch-name-list">catch-name-list</a></i> | <i><a href="#grammar-qualified-name">qualified-name</a></i> <i id="grammar-finally-clause">finally-clause:</i> finally <i><a href="#grammar-compound-statement">compound-statement</a></i>

« previous php.standards.cvs (#418) next »