cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
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
17
#include "
statement_list_parse_tree.h
"
18
30
class
statement_list_parsert
:
public
parsert
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.
39
PRECONDITION
(++
instance_count
== 1);
40
}
41
42
statement_list_parsert
(
const
statement_list_parsert
&) =
delete
;
43
44
~statement_list_parsert
()
override
45
{
46
--
instance_count
;
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
75
void
swap_tree
(
statement_list_parse_treet
&other);
76
77
private
:
79
statement_list_parse_treet
parse_tree
;
80
81
static
int
instance_count
;
82
};
83
90
int
yystatement_listerror
(
91
statement_list_parsert
&parser,
92
void
*scanner,
93
const
std::string &error);
94
95
#endif
// CPROVER_STATEMENT_LIST_STATEMENT_LIST_PARSER_H
exprt
Base class for all expressions.
Definition
expr.h:57
message_handlert
Definition
message.h:27
parsert::parsert
parsert(message_handlert &message_handler)
Definition
parser.h:33
statement_list_parse_treet
Intermediate representation of a parsed Statement List file before converting it into a goto program.
Definition
statement_list_parse_tree.h:24
statement_list_parsert
Responsible for starting the parse process and to translate the result into a statement_list_parse_tr...
Definition
statement_list_parser.h:31
statement_list_parsert::parse_tree
statement_list_parse_treet parse_tree
Tree that is being filled by the parsing process.
Definition
statement_list_parser.h:79
statement_list_parsert::add_tag_list
void add_tag_list(const exprt &tag_list)
Adds a tag list to the parse tree by converting the tag_list expression tree.
Definition
statement_list_parser.cpp:41
statement_list_parsert::statement_list_parsert
statement_list_parsert(message_handlert &message_handler)
Constructor.
Definition
statement_list_parser.h:34
statement_list_parsert::add_function_block
void add_function_block(const exprt &block)
Adds a function block to the parse tree by converting the block expression tree.
Definition
statement_list_parser.cpp:302
statement_list_parsert::statement_list_parsert
statement_list_parsert(const statement_list_parsert &)=delete
statement_list_parsert::print_tree
void print_tree(std::ostream &out) const
Prints the parse tree of this instance to the given output stream.
Definition
statement_list_parser.cpp:355
statement_list_parsert::~statement_list_parsert
~statement_list_parsert() override
Definition
statement_list_parser.h:44
statement_list_parsert::add_function
void add_function(const exprt &function)
Adds a function to the parse tree by converting the function expression tree.
Definition
statement_list_parser.cpp:319
statement_list_parsert::swap_tree
void swap_tree(statement_list_parse_treet &other)
Swaps the contents of the parse tree of this instance with other.
Definition
statement_list_parser.cpp:360
statement_list_parsert::instance_count
static int instance_count
Definition
statement_list_parser.h:81
statement_list_parsert::parse
bool parse() override
Starts the parsing process and saves the result inside of this instance's parse tree.
Definition
statement_list_parser.cpp:343
parser.h
Parser utilities.
PRECONDITION
#define PRECONDITION(CONDITION)
Definition
invariant.h:463
statement_list_parse_tree.h
Statement List Language Parse Tree.
yystatement_listerror
int yystatement_listerror(statement_list_parsert &parser, void *scanner, const std::string &error)
Forwards any errors that are encountered during the parse process.
statement-list
statement_list_parser.h
Generated by
1.17.0