Skip to content

Commit

Permalink
Merge pull request antlr#369 from Dropsource/master
Browse files Browse the repository at this point in the history
- fixed the order of the try_operator to prevent a statement from par…
  • Loading branch information
parrt committed May 8, 2016
2 parents 926c54c + 0b9034e commit 8aa5939
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions swift/Swift.g4
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* Converted from Apple's doc, http://tinyurl.com/n8rkoue, to ANTLR's
* meta-language.
*/
grammar Swift; // 2.1
grammar Swift; // 2.2

top_level : statement* EOF ;

Expand Down Expand Up @@ -613,7 +613,7 @@ in_out_expression : '&' identifier ;

// GRAMMAR OF A TRY EXPRESSION

try_operator : 'try' | 'try' '?' | 'try' '!' ;
try_operator : 'try' '?' | 'try' '!' | 'try' ;

// GRAMMAR OF A BINARY EXPRESSION

Expand Down Expand Up @@ -738,6 +738,9 @@ postfix_expression
| postfix_expression '.' Pure_decimal_digits # explicit_member_expression1
| postfix_expression '.' identifier generic_argument_clause? # explicit_member_expression2
| postfix_expression '.' identifier '(' argument_names ')' # explicit_member_expression3
// This does't exist in the swift grammar, but this valid swift statement fails without it
// self.addTarget(self, action: #selector(nameOfAction(_:)))
| postfix_expression '(' argument_names ')' # explicit_member_expression4
| postfix_expression '.' 'self' # postfix_self_expression
| postfix_expression '.' 'dynamicType' # dynamic_type_expression
| postfix_expression '[' expression_list ']' # subscript_expression
Expand Down

0 comments on commit 8aa5939

Please sign in to comment.