[antlr-interest] matchRange in parser?

jrc at skylon.demon.co.uk jrc at skylon.demon.co.uk
Tue Jul 24 06:39:28 PDT 2007


Should the following work?
----------------------------------------------------------------------
grammar Simple;
line         : systemIdList NEWLINE ;
systemIdList : systemId | systemId ',' systemIdList ;
systemId     : '0'..'9' ;
NEWLINE      : '\r'? '\n' ;
----------------------------------------------------------------------
Here's what I get:
----------------------------------------------------------------------
$ java org.antlr.Tool Simple.g
ANTLR Parser Generator  Version 3.0 (May 17, 2007)  1989-2007
$ javac *.java
SimpleParser.java:119: cannot find symbol
symbol  : method matchRange(char,char)
location: class SimpleParser
            matchRange('0','9');
            ^
1 error
----------------------------------------------------------------------
Swapping 'systemId' (parser rule) to 'SystemId' (lexer rule) causes
matchRange() to be found ...
--
John Connett




More information about the antlr-interest mailing list