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

Ernest Pasour Ernest.Pasour at sas.com
Tue Dec 2 11:52:47 PST 2008


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>;

Or

//note the lack of semicolon
var x:XML=<a>
   </a>
var i:int;

What is the best Antlr strategy for running a second lexer ?  I'm not an Antlr expert, but I think I want a second lexer that will process the same input stream that the main lexer started with (as opposed to having to hand-code an XML lexer to consume text inside an action or creating a separate input stream from the rest of the input document).   Will a sub-lexer work if the input has "extra" input on the end?  Is there a standard strategy for this type of problem in Antlr?

Thanks,
Ernest




More information about the antlr-interest mailing list