[antlr-interest] Re: Checking for expression end in Javascript
parser
Terence Parr
parrt at cs.usfca.edu
Wed Oct 26 07:39:23 PDT 2005
On Oct 26, 2005, at 1:33 AM, Tech wrote:
> 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?
Hi Mark,
remove the (...)? around the SEMI as semi is optional...probably not
waht you want.
Ter
More information about the antlr-interest
mailing list