Hi Patrick,

The range operator, `..`, only works in lexer rules, not in parser rules as
you're doing. Capitalize the `letter` rule to make it a lexer rule:

grammar failuretest;
start:          letter+;
Letter:         'A' .. 'B'; // or did you mean 'A'..'Z'?

and then try again.

Regards,

Bart.


On Sat, Nov 5, 2011 at 1:41 PM, Patrick Zimmermann <patr...@zakweb.de>wrote:

> Hello,
>
> I'm new to this mailing list, so hello everyone.
>
> I currently try to create a grammar to parse a textual wiki syntax.
> I'm using ANTLR 3.4 and the Java generator.
>
> I've reached a situation where ANTLR creates empty ifs in the generated
> Java
> code and I boiled it down to the following grammar:
>
> grammar failuretest;
> start:          letter+;
> letter:         'A' .. 'B';
>
> The resulting Java code contains the following statements:
> ...
> if ( () ) {
> ...
> if (  ) {
> ...
>
> As far as I know this is no legal Java. And the grammar looks fine to me,
> apart
> from that the second rule should probably be a lexer rule.
>
> So could this actually be a bug in antlr?
>
>
> Many thanks in advance,
> Patrick Zimmermann
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to