[antlr-interest] ANTLR3 Null variables in ST rewrite

Kailey Joanette kaileyjo at bigbluebubble.com
Fri Mar 23 07:41:38 PDT 2007


If I have a rule rewrite like:

 

^(CLASS_MEMBER accessModifier? (m+=modifier)* methodDeclaration)

                                -> classMember( access={$accessModifier.st},
mods={$m}, declare={$methodDeclaration.st} )

 

If accessModifier doesn't exist the .st will produce a null pointer
exception (correct?)  How do I avoid this?  Do I have to split the rule into
two?  One that has it and one that doesn't?  Same goes for the modifier* do
I need to split it into modifier+ and no modifier?

 

Kailey

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070323/c0881477/attachment.html 


More information about the antlr-interest mailing list