[antlr-interest] Token Streams, multiple lexers - how does le xer access selector?

mzukowski at yci.com mzukowski at yci.com
Thu Dec 19 08:05:23 PST 2002


Look at the examples\java\multiLexer example.  You have to create the
selector instance variable yourself or provide a public static class that
can hold it.

Monty

-----Original Message-----
From: David Penton [mailto:djplists at arrowsash.com]
Sent: Wednesday, December 18, 2002 8:53 PM
To: antlr-interest at yahoogroups.com
Subject: [antlr-interest] Token Streams, multiple lexers - how does
lexer access selector?


I am busy trying to set up multiple lexers to mimic lex/flex lexer
states.

In the antlr reference manual chapter on Token Streams, under Multiple
Lexers, the following example lexer fragment is given to "switch to the
JavaDoc lexer":

JAVADOC_OPEN
    :   "/**" {selector.push("doclexer");}
    ;

My question is: how does the lexer java class generated by antlr know
about selector, which is an antlr.TokenStreamSelector?  I mean, other
than editing the generated lexer class source files manually.  I don't
see anything that is intended to do this automatically, nor do I see a
way to embed code in the generated parser or lexer files. Thus the
reference the method call "selector.push(...)" prevents my lexer class
from compiling unless I edit it manually to have a selector instance
variable and an accessor method to set it.

Thanks.

- Dave Penton -






 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list