Hello Everyone,
I am hoping someone can set me straight on values from subrules.
I am working with the Java 1.5 grammar done by Terence Parr that
I downloaded from the grammar page. I have Terence's book, which
has been very helpful, and I am having fun doing my work.
At one point I am trying to capture the import statements in a class
file. I am working with this rule:
importDeclaration
: 'import' 'static'? qualifiedName ('.' '*')? ';'
I can tell whether the import is static and get the qualifiedName value
easily
doing this:
importDeclaration
: 'import' s='static'? name=qualifiedName ('.' '*')? ';'
Of course, I have some actions and I am using some scope variables to save
these values. I would also like to get the .* if present, but so far I have
only been
able to do that with something like this:
importDeclaration
: 'import' s='static'? name=qualifiedName ('.' '*'
{$importDeclaration::star=true;})? ';'
This works but feels a tad kludgy to me, so I am wondering what am I missing
to do this
as neatly as possible.
Any hints appreciated.
Will Tribbey
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address