#include <TokenStreamSelector.hpp>
Inheritance diagram for TokenStreamSelector:
Public Methods | |
TokenStreamSelector () | |
~TokenStreamSelector () | |
void | addInputStream (TokenStream *stream, const ANTLR_USE_NAMESPACE(std) string &key) |
TokenStream * | getCurrentStream () const |
Return the stream from which tokens are being pulled at the moment. | |
TokenStream * | getStream (const ANTLR_USE_NAMESPACE(std) string &sname) const |
RefToken | nextToken () |
TokenStream * | pop () |
void | push (TokenStream *stream) |
void | push (const ANTLR_USE_NAMESPACE(std) string &sname) |
void | retry () |
void | select (TokenStream *stream) |
void | select (const ANTLR_USE_NAMESPACE(std) string &sname) |
Protected Types | |
typedef TokenStream * | inputStreamNames_coll |
Protected Methods | |
typedef | ANTLR_USE_NAMESPACE (std) map< ANTLR_USE_NAMESPACE(std) string |
typedef | ANTLR_USE_NAMESPACE (std) stack< TokenStream * > streamStack_coll |
Protected Attributes | |
inputStreamNames_coll | inputStreamNames |
TokenStream * | input |
streamStack_coll | streamStack |
|
|
|
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. |
|
|
|
|
|
Used to track stack of input streams |
|
The set of inputs to the MUX |
|
Return the stream from which tokens are being pulled at the moment.
|
|
|
|
Implements TokenStream. |
|
|
|
|
|
|
|
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." |
|
|
|
Set the stream without pushing old stream |
|
The currently-selected token stream input |
|
|
|
|