File: ParserSharedInputState.cpp

package info (click to toggle)
grcompiler 4.2-7
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 11,108 kB
  • sloc: cpp: 45,565; sh: 4,425; ansic: 4,377; makefile: 188; xml: 175; perl: 127
file content (33 lines) | stat: -rw-r--r-- 610 bytes parent folder | download | duplicates (7)
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
#include "Antlr/ParserSharedInputState.hpp"

/** 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;
}