OpenMD 3.1
Molecular Dynamics in the Open
|
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. More...
#include <TokenStreamSelector.hpp>
Public Member Functions | |
TokenStreamSelector () | |
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. | |
void | addInputStream (TokenStream *stream, const std ::string &key) |
TokenStream * | getCurrentStream () const |
Return the stream from which tokens are being pulled at the moment. | |
TokenStream * | getStream (const std ::string &sname) const |
RefToken | nextToken () |
TokenStream * | pop () |
void | push (TokenStream *stream) |
void | push (const std ::string &sname) |
void | retry () |
Abort recognition of current Token and try again. | |
void | select (TokenStream *stream) |
Set the stream without pushing old stream. | |
void | select (const std ::string &sname) |
Protected Types | |
typedef std ::map< std ::string, TokenStream * > | inputStreamNames_coll |
The set of inputs to the MUX. | |
typedef std ::stack< TokenStream * > | streamStack_coll |
Used to track stack of input streams. | |
Protected Attributes | |
inputStreamNames_coll | inputStreamNames |
TokenStream * | input |
The currently-selected token stream 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.
Definition at line 27 of file TokenStreamSelector.hpp.
|
protected |
The set of inputs to the MUX.
Definition at line 34 of file TokenStreamSelector.hpp.
|
protected |
Used to track stack of input streams.
Definition at line 45 of file TokenStreamSelector.hpp.
antlr::TokenStreamSelector::TokenStreamSelector | ( | ) |
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.
Definition at line 22 of file TokenStreamSelector.cpp.
antlr::TokenStreamSelector::~TokenStreamSelector | ( | ) |
Definition at line 27 of file TokenStreamSelector.cpp.
void antlr::TokenStreamSelector::addInputStream | ( | TokenStream * | stream, |
const std ::string & | key ) |
Definition at line 31 of file TokenStreamSelector.cpp.
TokenStream * antlr::TokenStreamSelector::getCurrentStream | ( | ) | const |
Return the stream from which tokens are being pulled at the moment.
Definition at line 36 of file TokenStreamSelector.cpp.
References input.
TokenStream * antlr::TokenStreamSelector::getStream | ( | const std ::string & | sname | ) | const |
Definition at line 41 of file TokenStreamSelector.cpp.
|
virtual |
Implements antlr::TokenStream.
Definition at line 50 of file TokenStreamSelector.cpp.
TokenStream * antlr::TokenStreamSelector::pop | ( | ) |
Definition at line 64 of file TokenStreamSelector.cpp.
void antlr::TokenStreamSelector::push | ( | const std ::string & | sname | ) |
Definition at line 78 of file TokenStreamSelector.cpp.
void antlr::TokenStreamSelector::push | ( | TokenStream * | stream | ) |
Definition at line 72 of file TokenStreamSelector.cpp.
void antlr::TokenStreamSelector::retry | ( | ) |
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."
Definition at line 84 of file TokenStreamSelector.cpp.
void antlr::TokenStreamSelector::select | ( | const std ::string & | sname | ) |
Definition at line 95 of file TokenStreamSelector.cpp.
void antlr::TokenStreamSelector::select | ( | TokenStream * | stream | ) |
Set the stream without pushing old stream.
Definition at line 90 of file TokenStreamSelector.cpp.
References input.
|
protected |
The currently-selected token stream input.
Definition at line 39 of file TokenStreamSelector.hpp.
Referenced by getCurrentStream(), and select().
|
protected |
Definition at line 36 of file TokenStreamSelector.hpp.
|
protected |
Definition at line 47 of file TokenStreamSelector.hpp.