ANTLR Support Libraries 2.7.1+
Loading...
Searching...
No Matches
TokenStreamSelector.hpp
Go to the documentation of this file.
1#ifndef INC_TokenStreamSelector_hpp__
2#define INC_TokenStreamSelector_hpp__
3
4/* ANTLR Translator Generator
5 * Project led by Terence Parr at http://www.jGuru.com
6 * Software rights: http://www.antlr.org/license.html
7 *
8 * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/TokenStreamSelector.hpp#2 $
9 */
10
11#include <antlr/config.hpp>
12#include <antlr/TokenStream.hpp>
13#include <map>
14#include <stack>
15
16#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
17namespace antlr {
18#endif
19
28protected:
30#ifdef OS_NO_ALLOCATOR
31 typedef ANTLR_USE_NAMESPACE(std)less<ANTLR_USE_NAMESPACE(std)string> lessp;
33#else
35#endif
37
40
42#ifdef OS_NO_ALLOCATOR
43 typedef ANTLR_USE_NAMESPACE(std)stack<TokenStream*, ANTLR_USE_NAMESPACE(std)deque<TokenStream*> > streamStack_coll;
44#else
45 typedef ANTLR_USE_NAMESPACE(std)stack<TokenStream*> streamStack_coll;
46#endif
48
49public:
52
53 void addInputStream(TokenStream* stream, const ANTLR_USE_NAMESPACE(std)string& key);
54
57
58 TokenStream* getStream(const ANTLR_USE_NAMESPACE(std)string& sname) const;
59
61
63
64 void push(TokenStream* stream);
65
66 void push(const ANTLR_USE_NAMESPACE(std)string& sname);
67
75 void retry();
76
78 void select(TokenStream* stream);
79
80 void select(const ANTLR_USE_NAMESPACE(std)string& sname);
81};
82
83#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
84}
85#endif
86
87#endif //INC_TokenStreamSelector_hpp__
TokenRefCount< Token > RefToken
Definition TokenRefCount.hpp:92
void push(TokenStream *stream)
Definition TokenStreamSelector.cpp:72
RefToken nextToken()
Definition TokenStreamSelector.cpp:50
streamStack_coll streamStack
Definition TokenStreamSelector.hpp:47
std ::stack< TokenStream * > streamStack_coll
Definition TokenStreamSelector.hpp:45
inputStreamNames_coll inputStreamNames
Definition TokenStreamSelector.hpp:36
std ::map< std ::string, TokenStream * > inputStreamNames_coll
Definition TokenStreamSelector.hpp:34
TokenStream * input
Definition TokenStreamSelector.hpp:39
TokenStreamSelector()
Definition TokenStreamSelector.cpp:22
void retry()
Definition TokenStreamSelector.cpp:84
TokenStream * getStream(const std ::string &sname) const
Definition TokenStreamSelector.cpp:41
void addInputStream(TokenStream *stream, const std ::string &key)
Definition TokenStreamSelector.cpp:31
TokenStream * getCurrentStream() const
Return the stream from which tokens are being pulled at the moment.
Definition TokenStreamSelector.cpp:36
void select(TokenStream *stream)
Definition TokenStreamSelector.cpp:90
TokenStream * pop()
Definition TokenStreamSelector.cpp:64
Definition TokenStream.hpp:22
#define ANTLR_USE_NAMESPACE(_x_)
Definition config.hpp:18
#define ANTLR_API
Definition config.hpp:22
Definition ANTLRException.hpp:15