[antlr-interest] Getting rid of redundancy warning

Hendrik Maryns qwizv9b02 at sneakemail.com
Tue Nov 25 03:03:27 PST 2008


Hi,

I have a rule like follows:

formulaList : ( WHITESPACE? formula WHITESPACE? )* EOF ;

which gives me the following warning:

(200): Decision can match input such as "WHITESPACE" using multiple
alternatives: 1, 2 As a result,
 alternative(s) 2 were disabled for that input

WHITESPACE is defined as usual, and the formula rule works fine.

How can I get rid of this?

I want formulaList to match a file which contains a formula on each
line, optionally preceded/followed by whitespace and empty lines should
be allowed.  I have tried several things, but I cannot get rid of the
warning.

I have

NEWLINE
	: ( '\r\n' | '\r' | '\n' )
		{ $channel = HIDDEN; }
	;

but the interpreter does not seem to ignore them.  Doesn’t it know about
the hidden channel?

I do not want to make WHITESPACE hidden since it is meaningful as a
separator inside of ‘formula’.

Cheers, H.
-- 
Hendrik Maryns
http://tcl.sfs.uni-tuebingen.de/~hendrik/
==================
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 257 bytes
Desc: OpenPGP digital signature
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20081125/1cd792eb/attachment.bin 


More information about the antlr-interest mailing list