TokenStreamSelector Class Reference

#include <TokenStreamSelector.hpp>

Inheritance diagram for TokenStreamSelector:

Inheritance graph
Collaboration diagram for TokenStreamSelector:

Collaboration graph

Public Member Functions

 TokenStreamSelector ()
 ~TokenStreamSelector ()
void addInputStream (TokenStream *stream, const ANTLR_USE_NAMESPACE(std) string &key)
TokenStreamgetCurrentStream () const
 Return the stream from which tokens are being pulled at the moment.
TokenStreamgetStream (const ANTLR_USE_NAMESPACE(std) string &sname) const
RefToken nextToken ()
TokenStreampop ()
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 TokenStreaminputStreamNames_coll

Protected Member Functions

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

Definition at line 34 of file TokenStreamSelector.hpp.

Constructor & Destructor Documentation

TokenStreamSelector::TokenStreamSelector (  ) 

TokenStreamSelector::~TokenStreamSelector (  ) 

Member Function Documentation

typedef TokenStreamSelector::ANTLR_USE_NAMESPACE ( std   )  [protected]

The set of inputs to the MUX

typedef TokenStreamSelector::ANTLR_USE_NAMESPACE ( std   )  [protected]

Used to track stack of input streams

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

TokenStream* TokenStreamSelector::getCurrentStream (  )  const

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

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

RefToken TokenStreamSelector::nextToken (  )  [virtual]

Implements TokenStream.

TokenStream* TokenStreamSelector::pop (  ) 

void TokenStreamSelector::push ( TokenStream stream  ) 

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

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

void TokenStreamSelector::select ( TokenStream stream  ) 

Set the stream without pushing old stream

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

Field Documentation

Definition at line 36 of file TokenStreamSelector.hpp.

The currently-selected token stream input

Definition at line 39 of file TokenStreamSelector.hpp.

streamStack_coll TokenStreamSelector::streamStack [protected]

Definition at line 47 of file TokenStreamSelector.hpp.

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

Generated on Tue Mar 31 20:19:28 2009 for ctrump by  doxygen 1.5.6