[antlr-interest] rulecatch in lexer
"Paul Bouché (NSN)"
paul.bouche at nsn.com
Mon Feb 16 03:07:58 PST 2009
Hi,
I would need a rulecatch statement support for lexers. I tried
@lexer::rulecatch {
catch (RecoginitionException e) {
System.out.println(huhu);
}
}
but it didn't work... it was ignored. I need this inorder to elegantly
include a backward compatible adoption to our lexer. It supports only
quoted strings, but now we need backward compatible behaviour. We need
to also understand unquoted strings. This would not be a problem, but we
have several tokens which are unquoted: identifiers, ipaddresses etc. Of
course I could build a rather complex lexer rule, i.e. making sure
anything else may not be matched, but the things I want.. Acutally I
failed and at one time I got a "code too large" error, so I conclude
upon lexical error and in the right context (via a gated syntactic
predicate) I would try to match an unquoted string. Currently I can only
do this by overrider nextToken() because in recover I cannot emit a
token or rather after recovery the while loop in nextToken starts over
overwriting the token. I would like to avoid overriding nextToken as
much as possible, but I need to do it.
BR,
Paul
--
Paul Bouché
Voice: +49 30 590080-1284
Nokia Siemens Networks GmbH & Co. KG, An den Treptowers 1, 12435 Berlin, Germany
Sitz der Gesellschaft: München / Registered office: Munich
Registergericht: München / Commercial registry: Munich, HRA 88537
WEEE-Reg.-Nr.: DE 52984304
Persönlich haftende Gesellschafterin / General Partner: Nokia Siemens Networks Management GmbH
Geschäftsleitung / Board of Directors: Lydia Sommer, Olaf Horsthemke
Vorsitzender des Aufsichtsrats / Chairman of supervisory board: Lauri Kivinen
Sitz der Gesellschaft: München / Registered office: Munich
Registergericht: München / Commercial registry: Munich, HRB 163416
More information about the antlr-interest
mailing list