ANTLR Support Libraries 2.7.1+
Public Member Functions | Protected Types | Protected Attributes | List of all members
TokenStreamSelector Class Reference

#include <TokenStreamSelector.hpp>

Inheritance diagram for TokenStreamSelector:
Inheritance graph
[legend]
Collaboration diagram for TokenStreamSelector:
Collaboration graph
[legend]

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 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.

Member Typedef Documentation

◆ inputStreamNames_coll

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

The set of inputs to the MUX

◆ streamStack_coll

typedef std ::stack<TokenStream*> TokenStreamSelector::streamStack_coll
protected

Used to track stack of input streams

Constructor & Destructor Documentation

◆ TokenStreamSelector()

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.

◆ ~TokenStreamSelector()

TokenStreamSelector::~TokenStreamSelector ( )

Member Function Documentation

◆ addInputStream()

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

◆ getCurrentStream()

TokenStream * TokenStreamSelector::getCurrentStream ( ) const

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

◆ getStream()

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

◆ nextToken()

RefToken TokenStreamSelector::nextToken ( void  )
virtual

Implements TokenStream.

◆ pop()

TokenStream * TokenStreamSelector::pop ( )

◆ push() [1/2]

void TokenStreamSelector::push ( TokenStream stream)

◆ push() [2/2]

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

◆ retry()

void 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."

◆ select() [1/2]

void TokenStreamSelector::select ( TokenStream stream)

Set the stream without pushing old stream

◆ select() [2/2]

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

Member Data Documentation

◆ input

TokenStream* TokenStreamSelector::input
protected

The currently-selected token stream input

◆ inputStreamNames

inputStreamNames_coll TokenStreamSelector::inputStreamNames
protected

◆ streamStack

streamStack_coll TokenStreamSelector::streamStack
protected

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