[antlr-interest] expecting "class", found 'class'

Krishanu Debnath krishanu.debnath at gmail.com
Sun Jan 9 07:13:42 PST 2005


On Sat, 08 Jan 2005 19:42:38 +0000, clocKwize
<clockwize at blueyonder.co.uk> wrote:
> anyone know why this would happen, I totally new to antlr and I'm just
> playing, I have:
> 
> class_def        :    "class" IDENT ("extends" IDENT)? SEMI;
> 
> ...
> 
> IDENT options {testLiterals=true;}
>            : ('a'..'z' | 'A'..'Z') ('a'..'z'|'A'..'Z'|'_'| DIGIT)*;
> 
> protected
> DIGIT            :    '0'..'9';
> 
> WS            :    (' ' | '\t' | '\n' | '\r') { _ttype =
> ANTLR_USE_NAMESPACE(antlr)Token::SKIP; };
> 
> in my test file i have: "class ClassName extends Moo;"
> 
> Thanks,
> 
> Mike
> 

You need to declare the token "class" in token section of your lexer.

Krishanu

-- 
"When I have to rely on inadequacy, I prefer it to be my own."
--Richard Heathfield


More information about the antlr-interest mailing list