[antlr-interest] Java Grammar Question
Simon
cocoa at gmx.ch
Fri Nov 7 15:03:37 PST 2008
Hi
I've been studying the Java grammar from the Antlr page and stumbled
across the array access alternative in the identifierSuffix rule:
identifierSuffix
: ('[' ']')+ '.' 'class'
| ('[' expression ']')+ // can also be matched by selector, but
do here
...
;
What is the motivation behind matching stuff like [1][2] in the
identifer suffix and not in the selector rule?
selector
: '.' Identifier arguments?
| '.' 'this'
| '.' 'super' superSuffix
| '.' 'new' innerCreator
| '[' expression ']'
;
The two ways to match array accesses obviously introduces an ambiguity
into the grammar. Or am I missing something?
Thanks
Simon
More information about the antlr-interest
mailing list