[antlr-interest] lexer woes
Matt Benson
gudnabrsam at yahoo.com
Wed Mar 5 08:07:51 PST 2008
--- Gavin Lambert <antlr at mirality.co.nz> wrote:
> At 11:35 5/03/2008, Loring Craymer wrote:
> >> 1) Whether backtracking mode is supported for
> lexers,
> >1.) Yes--see calls to prefixWithSynPred() in
> antlr.g
>
> I think that answer is a little misleading :)
>
> As far as I know, the "backtrack=true" option has no
> effect in the
> lexer. However, backtracking in general is
> supported through
> adding your own syntactic predicates.
>
> Note that syntactic predicates can only be used to
> disambiguate
> between alts in a single rule -- you can't use them
> to distinguish
> between tokens at the top level. (If you need to do
> that, you'll
> have to merge the rules.)
>
I tell you, with all due respect to Ter, writing the
lexer by hand is looking more and more attractive for
this admittedly fairly weird example. I am trying to
get into being able to support DWIM syntax in a couple
of project ideas, so (elegant) backtracking in the
lexer is going to be pretty important, I think.
Thanks,
Matt
>
____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping
More information about the antlr-interest
mailing list