[antlr-interest] How to come up with catch-all rules?
Micheal J
open.zone at virgin.net
Fri Nov 17 16:25:33 PST 2006
Hi,
> > This is pretty good but still makes assumptions on the
> structure of
> > the hand-written code. For example, the number of { and }
> within the
> > outmost { and } need to match. It also makes assumptions on
> the syntax
> > of string, comments, and char literals. If I use perl style
> comments
> > in the hand-written code and write:
> >
> > # This will break ANTLR {{{
> >
> > It will cause syntax errors in ANTLR.
> >
> > Is there any even more general ways?
>
> In JavaCC there's something called Lexical States, which essentially
> allow wholesale swapping of one lexer for another. The transitions
> between which lexer state is in effect are driven by the
> lexical rules
> themselves.
[...]
> Is there any equivalent or counterpart to in ANTLR?
Island grammars in V3 and the TokenStreamSelector in V2.7.x are the closest
features.
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