On Sat, Jan 15, 2011 at 11:43 AM, fikin <nikolai.fii...@gmail.com> wrote:

> most likely this is obviously stupid question, pardon me in advance please.
>
> what exactly is wrong with this grammar?
>
> lines   :       line (NEWLINE line)*;
> line    :       '\u0020'..'\u007F'*;
> NEWLINE :       '\r'? '\n';
>

The range operator works differently inside a parser-rule.
For example, the rule *foo*:

foo
  :  A..C
  ;

A : 'a';
Z : 'z';
C : 'c';


will match one of the tokens A, Z or C (not one of the characters 'a', 'b'
or 'c'!).

Just as the `.` (DOT meta character) that has a different meaning depending
in which rule it is used: it means 'any character' inside lexer rules, while
it means 'any token' inside parser rules.

Regards,

Bart.

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