I have a grammar in which i wish to create an imaginary AST node, and then have
an action treat that node. The most straightforward expression i have devised
is:
grammar Empty;
options {output=AST;}
tokens {Imaginary;}
@members {void treat(Object t){}}
parse: empty EOF! {treat($empty.tree);};
empty: ->^(Imaginary);
However, the generated EmptyParser.java fails to compile because empty()
catches RecognitionException, which is never thrown.
I am working around this by:
empty: ->^(Imaginary)|Imaginary;
which works because the imaginary token can never be produced by the lexer.
Is there some other way i should be going about this?
--
Trevor John Thompson (425) 246-4023
net: [email protected]
Quidquid Latine scriptum sit, altum videtur.
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.