CBMC
statement_list_parser.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Statement List Language Parser
4 
5 Author: Matthias Weiss, matthias.weiss@diffblue.com
6 
7 \*******************************************************************/
8 
11 
12 #ifndef CPROVER_STATEMENT_LIST_STATEMENT_LIST_PARSER_H
13 #define CPROVER_STATEMENT_LIST_STATEMENT_LIST_PARSER_H
14 
15 #include <util/parser.h>
16 
18 
31 {
32 public:
34  explicit statement_list_parsert(message_handlert &message_handler)
35  : parsert(message_handler)
36  {
37  // Simplistic check that we don't attempt to do reentrant parsing as the
38  // Bison-generated parser has global state.
40  }
41 
43 
45  {
47  }
48 
52  bool parse() override;
53 
57  void add_function_block(const exprt &block);
58 
62  void add_function(const exprt &function);
63 
67  void add_tag_list(const exprt &tag_list);
68 
71  void print_tree(std::ostream &out) const;
72 
76 
77 private:
80 
81  static int instance_count;
82 };
83 
91  statement_list_parsert &parser,
92  void *scanner,
93  const std::string &error);
94 
95 #endif // CPROVER_STATEMENT_LIST_STATEMENT_LIST_PARSER_H
Base class for all expressions.
Definition: expr.h:56
Definition: parser.h:24
Intermediate representation of a parsed Statement List file before converting it into a goto program.
Responsible for starting the parse process and to translate the result into a statement_list_parse_tr...
statement_list_parse_treet parse_tree
Tree that is being filled by the parsing process.
void add_tag_list(const exprt &tag_list)
Adds a tag list to the parse tree by converting the tag_list expression tree.
statement_list_parsert(message_handlert &message_handler)
Constructor.
void add_function_block(const exprt &block)
Adds a function block to the parse tree by converting the block expression tree.
statement_list_parsert(const statement_list_parsert &)=delete
void print_tree(std::ostream &out) const
Prints the parse tree of this instance to the given output stream.
void add_function(const exprt &function)
Adds a function to the parse tree by converting the function expression tree.
void swap_tree(statement_list_parse_treet &other)
Swaps the contents of the parse tree of this instance with other.
bool parse() override
Starts the parsing process and saves the result inside of this instance's parse tree.
Parser utilities.
#define PRECONDITION(CONDITION)
Definition: invariant.h:463
Statement List Language Parse Tree.
int yystatement_listerror(statement_list_parsert &parser, void *scanner, const std::string &error)
Forwards any errors that are encountered during the parse process.