Public Member Functions | Protected Attributes

antlr.TokenStreamSelector Class Reference

Inheritance diagram for antlr.TokenStreamSelector:
antlr.TokenStream antlr.ASdebug.IASDebugStream

List of all members.

Public Member Functions

 TokenStreamSelector ()
void addInputStream (TokenStream stream, String key)
TokenStream getCurrentStream ()
TokenStream getStream (String sname)
Token nextToken () throws TokenStreamException
TokenStream pop ()
void push (TokenStream stream)
void push (String sname)
void retry () throws TokenStreamRetryException
void select (TokenStream stream)
void select (String sname) throws IllegalArgumentException
String getEntireText ()
TokenOffsetInfo getOffsetInfo (Token token)

Protected Attributes

Hashtable inputStreamNames
TokenStream input
Stack streamStack = new LList()

Detailed Description

A token stream MUX (multiplexor) knows about n token streams and can multiplex them onto the same channel for use by token stream consumer like a parser. This is a way to have multiple lexers break up the same input stream for a single parser. Or, you can have multiple instances of the same lexer handle multiple input streams; this works great for includes.


Constructor & Destructor Documentation

antlr.TokenStreamSelector.TokenStreamSelector (  ) 

Member Function Documentation

void antlr.TokenStreamSelector.addInputStream ( TokenStream  stream,
String  key 
)
TokenStream antlr.TokenStreamSelector.getCurrentStream (  ) 

Return the stream from tokens are being pulled at the moment.

References antlr.TokenStreamSelector.input.

String antlr.TokenStreamSelector.getEntireText (  ) 

Returns the entire text input to the lexer.

Returns:
The entire text or null, if error occured or System.in was used.

Implements antlr.ASdebug.IASDebugStream.

References antlr.TokenStreamSelector.input.

TokenOffsetInfo antlr.TokenStreamSelector.getOffsetInfo ( Token  token  ) 

Returns the offset information for the token

Parameters:
token the token whose information need to be retrieved
Returns:
offset info, or null

Implements antlr.ASdebug.IASDebugStream.

References antlr.TokenStreamSelector.input.

TokenStream antlr.TokenStreamSelector.getStream ( String  sname  ) 
Token antlr.TokenStreamSelector.nextToken (  )  throws TokenStreamException
void antlr.TokenStreamSelector.retry (  )  throws TokenStreamRetryException

Abort recognition of current Token and try again. A stream can push a new stream (for include files for example, and then retry(), which will cause the current stream to abort back to this.nextToken(). this.nextToken() then asks for a token from the current stream, which is the new "substream."

void antlr.TokenStreamSelector.select ( String  sname  )  throws IllegalArgumentException
void antlr.TokenStreamSelector.select ( TokenStream  stream  ) 

Set the stream without pushing old stream

References antlr.TokenStreamSelector.input.

Referenced by Main.main(), antlr.TokenStreamSelector.pop(), and antlr.TokenStreamSelector.push().


Member Data Documentation

Used to track stack of input streams

Referenced by antlr.TokenStreamSelector.pop(), and antlr.TokenStreamSelector.push().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties