[antlr-interest] question on java.g 1.6

Eric researcher0x00 at gmail.com
Wed Nov 16 14:04:37 PST 2011


Hi Jeremy,

This is not an answer but my thoughts after reading it.

It looks like the first option originally had some other text with it that
was removed and the second option was valid as originally written.

If it was me, I would try and find earlier versions from either antlr 2.x
or something or see if something turns up at ANTLR repository on github.

Eric

On Wed, Nov 16, 2011 at 10:08 AM, Jeremy Long <jeremy.long at gmail.com> wrote:

> 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
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>


More information about the antlr-interest mailing list