[antlr-interest] Lexer predicates
Meena Moktali
mmoktali at bphx.dk
Tue Apr 12 03:33:56 PDT 2005
u have to define the character ':' for example as token COLON and then
setType as COLON.Have u done that?
See the examples provided along with the ANTLR installations.There are many examples.
regs,
Meena
-----Original Message-----
From: Marcel Cerveny [mailto:mcerveny at gmail.com]
Sent: 12. april 2005 12:14
To: antlr-interest at antlr.org
Subject: [antlr-interest] Lexer predicates
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