[antlr-interest] Lexer question
Micheal J
open.zone at virgin.net
Thu Jul 27 07:59:49 PDT 2006
Hi,
> Thank you for your solution, it works very well.
> I have another one, it looks like the same ;)
>
> In the lexer -------------------
> INTORDOUBLE
> : (INTEGER '.') => DOUBLE { $setType(DOUBLE); }
> | INTEGER { $setType(INTEGER); }
> ;
Syntactic predicates (e.g. "(INTEGER '.') => DOUBLE" ) are expensive as they
can involve guessing/backtracking. Particularly bad in a lexer.
See how the KCSParse/csharp_v1 sample lexes numeric tokens. No synpreds
iirc.
Micheal
-----------------------
The best way to contact me is via the list/forum. My time is very limited.
More information about the antlr-interest
mailing list