blob: db64107e111d6ea1826fb9a345f8542eba730f21 (
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
/*
* parser_state.cpp
*
* Created on: Nov 20, 2009
* Author: dejan
*/
#include "parser_state.h"
#include "parser_exception.h"
#include <sstream>
using namespace std;
namespace CVC4 {
namespace parser {
int ParserState::read(char* buffer, int size) {
if (d_input_stream) {
// Read the characters and count them in result
d_input_stream->read(buffer, size);
return d_input_stream->gcount();
} else return 0;
}
int ParserState::parseError(const std::string& s) {
throw new ParserException(s);
}
string ParserState::getNextUniqueID() {
ostringstream ss;
ss << d_uid++;
return ss.str();
}
string ParserState::getCurrentPrompt() const {
return d_prompt;
}
void ParserState::setPromptMain() {
d_prompt = d_prompt_main;
}
void ParserState::setPromptNextLine() {
d_prompt = d_prompt_continue;
}
void ParserState::increaseLineNumber() {
++d_input_line;
if (d_interactive) {
std::cout << getCurrentPrompt();
setPromptNextLine();
}
}
int ParserState::getLineNumber() const {
return d_input_line;
}
std::string ParserState::getFileName() const {
return d_file_name;
}
}/* CVC4::parser namespace */
}/* CVC4 namespace */
|