[antlr-interest] NullPointerException in actions for recurring rules

Dariusz Dwornikowski dariusz.dwornikowski at cs.put.poznan.pl
Sun Jun 26 06:03:59 PDT 2011


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
-----------------------------------------------------------------------------


More information about the antlr-interest mailing list