[antlr-interest] running a second lexer on unbounded input

Gavin Lambert antlr at mirality.co.nz
Tue Dec 2 12:15:38 PST 2008


At 08:52 3/12/2008, Ernest Pasour wrote:
 >I have been working with a grammar for ActionScript, which is a
 >rather freeform language.  One expression type that is allowed 
in
 >the source code is raw xml.  For instance, the following code is 

 >legal:
 >
 >var x:XML=<a>
 >   </a>;

If you can detect the use of XML purely at the lexer level, then 
you can use a lexer "island grammar" -- see the ANTLR example 
grammars for more info.

If you can't detect it until it reaches the parser, then things 
get a lot more complicated, but have a look here:
   <<http://www.antlr.org/wiki/display/ANTLR3/Island+Grammars+Under+Parser+Control>http://www.antlr.org/wiki/display/ANTLR3/Island+Grammars+Under+Parser+Control>



More information about the antlr-interest mailing list