[prev in list] [next in list] [prev in thread] [next in thread] 

List:       antlr-interest
Subject:    [antlr-interest] Multiple lexers with one parser
From:       easjolly () ix ! netcom ! com (Susan Jolly)
Date:       2007-06-30 20:25:04
Message-ID: E1I4jUW-0002Uc-Qh () elasmtp-curtail ! atl ! sa ! earthlink ! net
[Download RAW message or body]

I've just gotten my copy of the new ANTLR v3 book and am happy and amazed to
discover how much I will be able to simplify my current ANTLR v2
application.  

However I have a question about the best approach to using multiple lexers
with a single parser in v3.  (I know I could use lexer states in a single
lexer but I've found that my current use of multiple lexers considerably
simplifies maintenance for this lexer grammar.)

It appears that in v3 all that is required for multiple lexer instances to
share the same input is for them to each be created using the same instance
of the input stream. So my question is how to handle the multiplexing?

It looks as though subclassing nextToken() in the primary lexer so as to
obtain tokens from auxiliary lexers is one strategy.  Is this the best
approach?

Thanks! 



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic