[antlr-interest] Re: Automatic semicolon insertion

mzukowski at yci.com mzukowski at yci.com
Wed Dec 17 09:24:07 PST 2003


ANTLR is usually not too happy about predicates that predict matching
nothing.  Inspecting the generated code should convince you of whether it
will work right or not.  I don't think you'll be able to get rid of the
warnings.

Actually, how about inverting?

auto_semicolon:
  ( {!(LA(1) == RBRACE || LT(1).getLine() != lastTokenLine) }? SEMICOLON
    | /*epsilon*/
  )
;
You may get a message about a superfluous alternative, that can be ignored.

Let us know.

Monty

-----Original Message-----
From: whittaker55 at yahoo.com [mailto:whittaker55 at yahoo.com] 
Sent: Wednesday, December 17, 2003 9:16 AM
To: antlr-interest at yahoogroups.com
Subject: [antlr-interest] Re: Automatic semicolon insertion


> semicolon: SEMICOLON;
> 
> I replaced this with:
> 
> auto_semicolon:
> 	(SEMICOLON
>           { LA(1) == RBRACE || LT(1).getLine() != lastTokenLine }? 
> 	)
> 	;

My apologies for the typo - this should have read:
auto_semicolon:
(SEMICOLON
| { LA(1) == RBRACE || LT(1).getLine() != lastTokenLine }?
)
;

Note empty second option.

Thanks.



 

Yahoo! Groups Links

To visit your group on the web, go to:
 http://groups.yahoo.com/group/antlr-interest/

To unsubscribe from this group, send an email to:
 antlr-interest-unsubscribe at yahoogroups.com

Your use of Yahoo! Groups is subject to:
 http://docs.yahoo.com/info/terms/ 


 

Yahoo! Groups Links

To visit your group on the web, go to:
 http://groups.yahoo.com/group/antlr-interest/

To unsubscribe from this group, send an email to:
 antlr-interest-unsubscribe at yahoogroups.com

Your use of Yahoo! Groups is subject to:
 http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list