[antlr-interest] NullPointerException in actions for recurring rules

Terence Parr parrt at cs.usfca.edu
Sun Jun 26 09:57:34 PDT 2011


did you give token stream to the tree parser?
Ter
On Jun 26, 2011, at 6:03 AM, Dariusz Dwornikowski wrote:

> Hello Again,
> 
> What is the proper way to handle expression on abstract symbols (instead of
> 1+2+3+4, ive got only a+b+c etc)
> 
> 
> rmdef returns [ProcessDef process]
>    :    ^(PEPADEF pan=IDENT a=expression)
>        {
>        process = new ProcessDef();
>        process.setLHS($pan.text);
>        }
>    ;
> 
> expression
>    :    ^(COOP a=expression b=expression)
>    |    ^(PREFIX a=expression b=expression) { print($a.text); }
>    |    ^(CHOICE a=expression b=expression)
>    |    procek=IDENT
>    ;
> 
> 
> 
> In this case print($a.text); causes NullPointerException,
> 
> 
> -- 
> Pozdrawiam,
> -----------------------------------------------------------------------------
> Dariusz Dwornikowski,
> Institute of Computing Science, Poznań University of Technology
> www.cs.put.poznan.pl/ddwornikowski/
> room 421 WE | tel. +48 61 665 21 24   | mobile: +48 533 890 600
> -----------------------------------------------------------------------------
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address



More information about the antlr-interest mailing list