summaryrefslogtreecommitdiffstats
path: root/poxml/antlr/src/ParserSharedInputState.cpp
blob: 102aba8756aec964d06137a7b4481df27dd02f5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "antlr/ParserSharedInputState.hpp"

ANTLR_BEGIN_NAMESPACE(antlr)

/** This object contains the data associated with an
 *  input stream of tokens.  Multiple parsers
 *  share a single ParserSharedInputState to parse
 *  the same stream of tokens.
 */

ParserInputState::ParserInputState(TokenBuffer* input_)
: guessing(0)
, input(input_)
, inputResponsible(true)
{
}

ParserInputState::ParserInputState(TokenBuffer& input_)
: guessing(0)
, input(&input_)
, inputResponsible(false)
{
}

ParserInputState::~ParserInputState()
{
	if (inputResponsible)
		delete input;
}

TokenBuffer& ParserInputState::getInput()
{
	return *input;
}

ANTLR_END_NAMESPACE