OpenMD  2.5
Molecular Dynamics in the Open
antlr::TokenStreamSelector Class Reference

#include <TokenStreamSelector.hpp>

Inheritance diagram for antlr::TokenStreamSelector:
antlr::TokenStream

Public Member Functions

 TokenStreamSelector ()
 
 ~TokenStreamSelector ()
 
void addInputStream (TokenStream *stream, const std ::string &key)
 
TokenStreamgetCurrentStream () const
 Return the stream from which tokens are being pulled at the moment. More...
 
TokenStreamgetStream (const std ::string &sname) const
 
RefToken nextToken ()
 
TokenStreampop ()
 
void push (TokenStream *stream)
 
void push (const std ::string &sname)
 
void retry ()
 
void select (TokenStream *stream)
 
void select (const std ::string &sname)
 
- Public Member Functions inherited from antlr::TokenStream
virtual ~TokenStream ()
 

Protected Types

typedef std ::map< std ::string, TokenStream * > inputStreamNames_coll
 
typedef std ::stack< TokenStream * > streamStack_coll
 

Protected Attributes

inputStreamNames_coll inputStreamNames
 
TokenStreaminput
 
streamStack_coll streamStack
 

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.

Definition at line 27 of file TokenStreamSelector.hpp.

Member Typedef Documentation

◆ inputStreamNames_coll

typedef std ::map< std ::string,TokenStream*> antlr::TokenStreamSelector::inputStreamNames_coll
protected

The set of inputs to the MUX

Definition at line 34 of file TokenStreamSelector.hpp.

◆ streamStack_coll

Used to track stack of input streams

Definition at line 45 of file TokenStreamSelector.hpp.

Constructor & Destructor Documentation

◆ TokenStreamSelector()

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.

◆ ~TokenStreamSelector()

antlr::TokenStreamSelector::~TokenStreamSelector ( )

Definition at line 27 of file TokenStreamSelector.cpp.

Member Function Documentation

◆ addInputStream()

void antlr::TokenStreamSelector::addInputStream ( TokenStream stream,
const std ::string &  key 
)

Definition at line 31 of file TokenStreamSelector.cpp.

References inputStreamNames.

◆ getCurrentStream()

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.

◆ getStream()

TokenStream * antlr::TokenStreamSelector::getStream ( const std ::string &  sname) const

Definition at line 41 of file TokenStreamSelector.cpp.

References ANTLR_USE_NAMESPACE, and inputStreamNames.

◆ nextToken()

RefToken antlr::TokenStreamSelector::nextToken ( void  )
virtual

Implements antlr::TokenStream.

Definition at line 50 of file TokenStreamSelector.cpp.

References input, and antlr::TokenStream::nextToken().

◆ pop()

TokenStream * antlr::TokenStreamSelector::pop ( )

Definition at line 64 of file TokenStreamSelector.cpp.

References select(), and streamStack.

◆ push() [1/2]

void antlr::TokenStreamSelector::push ( TokenStream stream)

Definition at line 72 of file TokenStreamSelector.cpp.

References input, select(), and streamStack.

◆ push() [2/2]

void antlr::TokenStreamSelector::push ( const std ::string &  sname)

Definition at line 78 of file TokenStreamSelector.cpp.

References input, select(), and streamStack.

◆ retry()

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.

◆ select() [1/2]

void antlr::TokenStreamSelector::select ( TokenStream stream)

Set the stream without pushing old stream

Definition at line 90 of file TokenStreamSelector.cpp.

References input.

Referenced by pop(), and push().

◆ select() [2/2]

void antlr::TokenStreamSelector::select ( const std ::string &  sname)

Definition at line 95 of file TokenStreamSelector.cpp.

References ANTLR_USE_NAMESPACE, input, and inputStreamNames.

Member Data Documentation

◆ input

TokenStream* antlr::TokenStreamSelector::input
protected

The currently-selected token stream input

Definition at line 39 of file TokenStreamSelector.hpp.

Referenced by getCurrentStream(), nextToken(), push(), and select().

◆ inputStreamNames

inputStreamNames_coll antlr::TokenStreamSelector::inputStreamNames
protected

Definition at line 36 of file TokenStreamSelector.hpp.

Referenced by addInputStream(), getStream(), and select().

◆ streamStack

streamStack_coll antlr::TokenStreamSelector::streamStack
protected

Definition at line 47 of file TokenStreamSelector.hpp.

Referenced by pop(), and push().


The documentation for this class was generated from the following files: