[antlr-interest] question on java.g 1.6
Jeremy Long
jeremy.long at gmail.com
Wed Nov 16 07:08:24 PST 2011
I am still fairly new to antlr and when looking at the 1.6 Java grammar I
noticed the following statement rule:
statement
: block
| ('assert'
)
expression (':' expression)? ';'
| 'assert' expression (':' expression)? ';'
| 'if' parExpression statement ('else' statement)?
| forstatement
| 'while' parExpression statement
| 'do' statement 'while' parExpression ';'
| trystatement
| 'switch' parExpression '{' switchBlockStatementGroups '}'
| 'synchronized' parExpression block
| 'return' (expression )? ';'
| 'throw' expression ';'
| 'break'
(IDENTIFIER
)? ';'
| 'continue'
(IDENTIFIER
)? ';'
| expression ';'
| IDENTIFIER ':' statement
| ';'
;
My question is about the two lines for assert:
| ('assert'
)
expression (':' expression)? ';'
| 'assert' expression (':' expression)? ';'
To me those look identicle - am I missing something? Is there some nuance
to the parens that I don't understand?
Thanks,
jeremy
More information about the antlr-interest
mailing list