[antlr-interest] tips on grammar subrules
William Tribbey
will at tribbey.net
Mon Jul 27 09:15:16 PDT 2009
Well, as I went back to the book and searched some sections, I decided to
change the action I was using for the subrule from this
importDeclaration
: 'import' s='static'? name=qualifiedName ('.' '*'
{$importDeclaration::star=true;})? ';'
to this
importDeclaration
: 'import' s='static'? name=qualifiedName ('.' s='*')? ';'
which does allow me simply to check the existence of the .* suffix by checking
the nullity of the text value for s.
This does remove a few lines of code and does the job, but if if
anyone has another
suggestion I would like to hear it, if only to learn.
Will Tribbey
More information about the antlr-interest
mailing list