[antlr-interest] Lexer predicates

Marcel Cerveny mcerveny at gmail.com
Tue Apr 12 02:13:41 PDT 2005


Hi,
I need to parse output of a custom made program. It can produce
messages consisting of arbitrary ascii chars. Thus, I tried to make my
lexer rule:

protected LETTER : (('!'..'~')) => ('a'..'z'|'A'..'Z')
                                   | (':')   { $setType(COLON); }
                                   | ('\\')  { $setType(BSLASH); }
                                   | ('(')   { $setType(LPAREN); }
                                   | (')')   { $setType(RPAREN); }
                                   | ('!'..'~') { $setType(ASCIISYM); }
;

Now, I still get error message:
error: Lexer rule COLON is not defined

I really do not know why is that. Anny suggestions?
Thanx in advance.


More information about the antlr-interest mailing list