cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
cpp_parser.h
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module: C++ Parser
4
5
Author: Daniel Kroening, kroening@cs.cmu.edu
6
7
\*******************************************************************/
8
11
12
#ifndef CPROVER_CPP_CPP_PARSER_H
13
#define CPROVER_CPP_CPP_PARSER_H
14
15
#include <
util/parser.h
>
16
17
#include <
ansi-c/ansi_c_parser.h
>
18
19
#include "
cpp_parse_tree.h
"
20
#include "
cpp_token_buffer.h
"
21
22
#include <optional>
23
24
class
cpp_parsert
:
public
parsert
25
{
26
public
:
27
cpp_parse_treet
parse_tree
;
28
29
virtual
bool
parse
()
override
;
30
31
explicit
cpp_parsert
(
message_handlert
&message_handler)
32
:
parsert
(message_handler),
33
mode
(
configt
::ansi_ct::flavourt::ANSI),
34
recognize_wchar_t
(true),
35
token_buffer
(message_handler),
36
asm_block_following
(false),
37
support_float16
(
std
::nullopt)
38
{
39
}
40
41
public
:
42
// internal state
43
ansi_c_parsert::modet
mode
;
44
45
// We can furthermore twiddle the recognition of various
46
// keywords. This is honored in particular modes.
47
bool
recognize_wchar_t
;
48
49
cpp_token_buffert
token_buffer
;
50
51
cpp_tokent
&
current_token
()
52
{
53
return
token_buffer
.current_token();
54
}
55
56
void
add_location
()
57
{
58
token_buffer
.current_token().line_no=
get_line_no
()-1;
59
token_buffer
.current_token().filename =
source_location
().
get_file
();
60
}
61
62
// scanner
63
unsigned
parenthesis_counter
;
64
bool
asm_block_following
;
65
66
protected
:
67
std::optional<bool>
support_float16
;
68
};
69
70
#endif
// CPROVER_CPP_CPP_PARSER_H
ansi_c_parser.h
ansi_c_parsert::modet
configt::ansi_ct::flavourt modet
Definition
ansi_c_parser.h:61
configt
Globally accessible architectural configuration.
Definition
config.h:144
cpp_parse_treet
Definition
cpp_parse_tree.h:20
cpp_parsert::asm_block_following
bool asm_block_following
Definition
cpp_parser.h:64
cpp_parsert::current_token
cpp_tokent & current_token()
Definition
cpp_parser.h:51
cpp_parsert::token_buffer
cpp_token_buffert token_buffer
Definition
cpp_parser.h:49
cpp_parsert::parse_tree
cpp_parse_treet parse_tree
Definition
cpp_parser.h:27
cpp_parsert::add_location
void add_location()
Definition
cpp_parser.h:56
cpp_parsert::support_float16
std::optional< bool > support_float16
Definition
cpp_parser.h:67
cpp_parsert::parse
virtual bool parse() override
Definition
cpp_parser.cpp:20
cpp_parsert::mode
ansi_c_parsert::modet mode
Definition
cpp_parser.h:43
cpp_parsert::recognize_wchar_t
bool recognize_wchar_t
Definition
cpp_parser.h:47
cpp_parsert::cpp_parsert
cpp_parsert(message_handlert &message_handler)
Definition
cpp_parser.h:31
cpp_parsert::parenthesis_counter
unsigned parenthesis_counter
Definition
cpp_parser.h:63
cpp_token_buffert
Definition
cpp_token_buffer.h:25
cpp_tokent
Definition
cpp_token.h:20
message_handlert
Definition
message.h:27
parsert::parsert
parsert(message_handlert &message_handler)
Definition
parser.h:33
parsert::source_location
const source_locationt & source_location()
Definition
parser.h:111
parsert::get_line_no
unsigned get_line_no() const
Definition
parser.h:96
source_locationt::get_file
const irep_idt & get_file() const
Definition
source_location.h:36
cpp_parse_tree.h
C++ Parser.
cpp_token_buffer.h
C++ Parser: Token Buffer.
std
STL namespace.
parser.h
Parser utilities.
cpp
cpp_parser.h
Generated by
1.17.0