Hi all,
Here's a small fragment of an AST grammar:
qualifiedNameList
: qnames+=qualifiedName (',' qnames+=qualifiedName )*
-> ^(TYPEREF[$qnames.text])+
;
qualifiedName
: IDENTIFIER ('.' IDENTIFIER )*
-> {new CommonTree(new CommonToken(QNAME, $qualifiedName.text))}
;
I'm trying to manipulate the tree so it's easy to process from Clojure, by
reducing some AST nodes down to text. ANTLR seems OK with this construct, but
the code that it generates won't compile:
/Users/mtnygard/work/atg-xref/indexer/src/gen-java/ImaginaryNodeBugParser.java:139:
illegal start of expression
if ( !() ) {
^
/Users/mtnygard/work/atg-xref/indexer/src/gen-java/ImaginaryNodeBugParser.java:142:
illegal start of expression
while ( ) {
^
Sure enough, when I check the generated code, I see conditionals that are
completely empty! Is this a bug in codegen for the Java runtime, or am I doing
something wrong with my cardinality?
The whole grammar, the generated parser source, and the errors are visible at
https://gist.github.com/867853.
Cheers,
-Michael Nygard
Michael T. Nygard
[email protected]
http://www.michaelnygard.com/
Release It! Design and Deploy Production-Ready Software
http://bit.ly/ReleaseIt
Beautiful Architecture
http://bit.ly/BeautifulArchitecture
97 Things Every Software Architect Should Know
http://bit.ly/97Things
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.