[antlr-interest] Found a BUG ! (maybe)

rigpa_man maswann at verizon.net
Fri Mar 19 16:54:08 PST 2004


Hi all,

I used ANTLR (PCCTS) a few years ago and loved it. I have a use for 
it again so I'm picking it up to play with one more time.

Here is my problem:
(bug appears in both antlr-2.7.2 and antlr-2.7.3rc2)

The following lex rule...

SCOLN
	:	';' (~'\n')* '\n'
	;

...gets converted to this... (parts removed for brevity)

	. . .
	match(';');
	{
	_loop6:
	do {
		if ((LA(1)==';')) {
			matchNot('\n');
		}
		else {
			break _loop6;
		}
	} while (true);
	}
	match('\n');
	. . .

...which does not work.

I changed one line as follows and it works great now.
I changed...
	if ((LA(1)==';')) {
to...
	if ((LA(1)!='\n'')) {

and it works as advertized.

The code that was generated cannot be right.

Please convince me that I am doing something wrong.

Thanks,

Mark Swann





 
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