CBMC
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:
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
44 
45  // We can furthermore twiddle the recognition of various
46  // keywords. This is honored in particular modes.
48 
50 
52  {
53  return token_buffer.current_token();
54  }
55 
56  void add_location()
57  {
60  }
61 
62  // scanner
65 
66 protected:
67  std::optional<bool> support_float16;
68 };
69 
70 #endif // CPROVER_CPP_CPP_PARSER_H
Globally accessible architectural configuration.
Definition: config.h:132
bool asm_block_following
Definition: cpp_parser.h:64
cpp_token_buffert token_buffer
Definition: cpp_parser.h:49
cpp_parse_treet parse_tree
Definition: cpp_parser.h:27
void add_location()
Definition: cpp_parser.h:56
cpp_tokent & current_token()
Definition: cpp_parser.h:51
std::optional< bool > support_float16
Definition: cpp_parser.h:67
virtual bool parse() override
Definition: cpp_parser.cpp:20
ansi_c_parsert::modet mode
Definition: cpp_parser.h:43
bool recognize_wchar_t
Definition: cpp_parser.h:47
cpp_parsert(message_handlert &message_handler)
Definition: cpp_parser.h:31
unsigned parenthesis_counter
Definition: cpp_parser.h:63
cpp_tokent & current_token()
irep_idt filename
Definition: cpp_token.h:26
unsigned line_no
Definition: cpp_token.h:25
Definition: parser.h:25
source_locationt source_location
Definition: parser.h:143
unsigned get_line_no() const
Definition: parser.h:101
const irep_idt & get_file() const
C++ Parser.
C++ Parser: Token Buffer.
Parser utilities.