-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathParser.ih
38 lines (28 loc) · 910 Bytes
/
Parser.ih
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
// Generated by Bisonc++ V4.09.02 on Mon, 11 Jan 2016 01:06:14 +0100
// Include this file in the sources of the class Parser.
// $insert class.h
#include "Parser.h"
inline void Parser::error(char const *msg)
{
std::cerr << "[ERROR] " << msg << "\n" << "At line: " << d_loc__.first_line << std::endl;
exit(1);
}
// $insert lex
inline int Parser::lex()
{
int token = lexer.yylex();
d_loc__.first_line = lexer.lineno();
if(token == IDENTIFIER_I || token == IDENTIFIER_B_TRUE || token == IDENTIFIER_B_FALSE || token == IDENTIFIER)
{
d_val__.value = new std::string(lexer.YYText());
}
return token;
}
inline void Parser::print()
{
print__(); // displays tokens if --print was specified
}
inline void Parser::exceptionHandler__(std::exception const &exc)
{
throw; // re-implement to handle exceptions thrown by actions
}