KDevelop API Documentation

TokenStreamSelector Class Reference

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>

Inheritance diagram for TokenStreamSelector:

TokenStream List of all members.

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.

 ~TokenStreamSelector ()
void addInputStream (TokenStream *stream, const std::string &key)
TokenStreamgetCurrentStream () const
 Return the stream from which tokens are being pulled at the moment.

TokenStreamgetStream (const std::string &sname) const
RefToken nextToken ()
TokenStreampop ()
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
TokenStreaminput
 The currently-selected token stream input.

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

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

The set of inputs to the MUX.

Definition at line 34 of file TokenStreamSelector.hpp.

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

Used to track stack of input streams.

Definition at line 45 of file TokenStreamSelector.hpp.


Constructor & Destructor Documentation

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::~TokenStreamSelector  ) 
 

Definition at line 27 of file TokenStreamSelector.cpp.


Member Function Documentation

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

Definition at line 31 of file TokenStreamSelector.cpp.

References addInputStream(), and inputStreamNames.

Referenced by addInputStream().

TokenStream * 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 * TokenStreamSelector::getStream const std::string &  sname  )  const
 

Definition at line 41 of file TokenStreamSelector.cpp.

References ANTLR_USE_NAMESPACE, getStream(), and inputStreamNames.

Referenced by getStream().

RefToken TokenStreamSelector::nextToken  )  [virtual]
 

Implements TokenStream.

Definition at line 50 of file TokenStreamSelector.cpp.

References input, and TokenStream::nextToken().

TokenStream * TokenStreamSelector::pop  ) 
 

Definition at line 64 of file TokenStreamSelector.cpp.

References select(), and streamStack.

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

Definition at line 78 of file TokenStreamSelector.cpp.

References input, push(), select(), and streamStack.

void TokenStreamSelector::push TokenStream stream  ) 
 

Definition at line 72 of file TokenStreamSelector.cpp.

References input, push(), select(), and streamStack.

Referenced by push().

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

Definition at line 84 of file TokenStreamSelector.cpp.

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

Definition at line 95 of file TokenStreamSelector.cpp.

References ANTLR_USE_NAMESPACE, input, inputStreamNames, and select().

void TokenStreamSelector::select TokenStream stream  ) 
 

Set the stream without pushing old stream.

Definition at line 90 of file TokenStreamSelector.cpp.

References input, and select().

Referenced by pop(), push(), and select().


Member Data Documentation

TokenStream* 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_coll TokenStreamSelector::inputStreamNames [protected]
 

Definition at line 36 of file TokenStreamSelector.hpp.

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

streamStack_coll 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:
KDE Logo
This file is part of the documentation for KDevelop Version 3.0.4.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Oct 19 08:02:07 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003