forked from diffblue/cbmc
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcpp_parser.h
72 lines (53 loc) · 1.47 KB
/
cpp_parser.h
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
65
66
67
68
69
70
71
72
/*******************************************************************\
Module: C++ Parser
Author: Daniel Kroening, [email protected]
\*******************************************************************/
/// \file
/// C++ Parser
#ifndef CPROVER_CPP_CPP_PARSER_H
#define CPROVER_CPP_CPP_PARSER_H
#include <util/parser.h>
#include <ansi-c/ansi_c_parser.h>
#include "cpp_parse_tree.h"
#include "cpp_token_buffer.h"
class cpp_parsert:public parsert
{
public:
cpp_parse_treet parse_tree;
virtual bool parse() override;
virtual void clear() override
{
parsert::clear();
parse_tree.clear();
token_buffer.clear();
asm_block_following=false;
}
explicit cpp_parsert(message_handlert &message_handler)
: parsert(message_handler),
mode(configt::ansi_ct::flavourt::ANSI),
recognize_wchar_t(true),
token_buffer(message_handler),
asm_block_following(false)
{
}
public:
// internal state
ansi_c_parsert::modet mode;
// We can furthermore twiddle the recognition of various
// keywords. This is honored in particular modes.
bool recognize_wchar_t;
cpp_token_buffert token_buffer;
cpp_tokent ¤t_token()
{
return token_buffer.current_token();
}
void add_location()
{
token_buffer.current_token().line_no=get_line_no()-1;
token_buffer.current_token().filename=source_location.get_file();
}
// scanner
unsigned parenthesis_counter;
bool asm_block_following;
};
#endif // CPROVER_CPP_CPP_PARSER_H