1 #ifndef INC_ParserSharedInputState_hpp__
2 #define INC_ParserSharedInputState_hpp__
4 /* ANTLR Translator Generator
5 * Project led by Terence Parr at http://www.jGuru.com
6 * Software rights: http://www.antlr.org/license.html
8 * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/ParserSharedInputState.hpp#2 $
11 #include <antlr/config.hpp>
12 #include <antlr/TokenBuffer.hpp>
13 #include <antlr/RefCount.hpp>
16 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
20 /** This object contains the data associated with an
21 * input stream of tokens. Multiple parsers
22 * share a single ParserSharedInputState to parse
23 * the same stream of tokens.
25 class ANTLR_API ParserInputState {
27 /** Construct a new ParserInputState
28 * @param in the TokenBuffer to read from. The object is deleted together
29 * with the ParserInputState object.
31 ParserInputState( TokenBuffer* in )
35 , inputResponsible(true)
38 /** Construct a new ParserInputState
39 * @param in the TokenBuffer to read from.
41 ParserInputState( TokenBuffer& in )
45 , inputResponsible(false)
49 virtual ~ParserInputState()
55 TokenBuffer& getInput( void )
60 /// Reset the ParserInputState and the underlying TokenBuffer
68 /** Are we guessing (guessing>0)? */
70 /** What file (if known) caused the problem?
71 * @todo wrap this one..
73 ANTLR_USE_NAMESPACE(std)string filename;
75 /** Where to get token objects */
77 /// Do we need to free the TokenBuffer or is it owned by another..
78 bool inputResponsible;
80 // we don't want these:
81 ParserInputState(const ParserInputState&);
82 ParserInputState& operator=(const ParserInputState&);
85 /// A reference counted ParserInputState
86 typedef RefCount<ParserInputState> ParserSharedInputState;
88 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
92 #endif //INC_ParserSharedInputState_hpp__