[antlr-interest] Re: Checking for expression end in Javascript parser

Tech tech at swingkid.fsnet.co.uk
Wed Oct 26 01:33:32 PDT 2005


I have overriden consume() in my parser to store the line number of the 
last token consumed:

    int currentLine = 0;

    public override void consume()
        {
            currentLine = LA(1);
            base.consume();
        }

I have then defined semi:

    semi
        :    {currentLine == LT(1).getLine()}? SEMI
        |    (SEMI)?
        ;

This seems to work, but gives me lots of disambiguation warnings. What 
do you think?

Mark



More information about the antlr-interest mailing list