Hi,
I am hoping someone can enlighten me on how ANTLR generates the TreeParser
java code from tree grammar. I have a tree grammar file with exactly the
same code for two different tokens, both of which must return the same
object type. The generated Java code for one returns the object type
expected, whereas the other does not! My tree grammar looks like :
token1 returns [ObjectA a]
: ^(C_ID (conId=classId {$a=evaluateAndReturnAsObjectA($conId.text); })
);
token2 returns [ObjectA m]
: ^(C_ID (id=classId {$m=evaluateAndReturnAsObjectA($id.text); }) );
The tokens token1, token2 and classId are part of my parser vocabulary.
Oddly, the Java methods generated for the methods have the following return
types :
--- MyTree.token1_return token1() { ... }
--- ObjectA token2() { .. }
I'm slightly at my wits end, understanding whats going on. What am I missing
here?
Many thanks in advance...
J
--
View this message in context:
http://n2.nabble.com/Tree-grammar-bizarre-behaviour-tp4531741p4531741.html
Sent from the ANTLR mailing list archive at Nabble.com.
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
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.