cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
xml_parser.h
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module:
4
5
Author: Daniel Kroening, kroening@kroening.com
6
7
\*******************************************************************/
8
9
10
#ifndef CPROVER_XMLLANG_XML_PARSER_H
11
#define CPROVER_XMLLANG_XML_PARSER_H
12
13
#include <
util/parser.h
>
14
15
#include "
xml_parse_tree.h
"
16
17
class
xml_parsert
:
public
parsert
18
{
19
public
:
20
explicit
xml_parsert
(
message_handlert
&message_handler)
21
:
parsert
(message_handler)
22
{
23
// Simplistic check that we don't attempt to do reentrant parsing as the
24
// Bison-generated parser has global state.
25
PRECONDITION
(++
instance_count
== 1);
26
stack
.push_back(&
parse_tree
.element);
27
}
28
29
xml_parsert
(
const
xml_parsert
&) =
delete
;
30
31
~xml_parsert
()
override
32
{
33
--
instance_count
;
34
}
35
36
xml_parse_treet
parse_tree
;
37
38
std::list<xmlt *>
stack
;
39
40
xmlt
&
current
()
41
{
42
return
*
stack
.back();
43
}
44
45
bool
parse
()
override
;
46
47
void
new_level
()
48
{
49
current
().
elements
.push_back(
xmlt
());
50
stack
.push_back(&
current
().elements.back());
51
}
52
53
protected
:
54
static
int
instance_count
;
55
};
56
57
int
yyxmlerror
(
xml_parsert
&,
void
*,
const
std::string &);
58
59
// 'do it all' functions
60
bool
parse_xml
(
61
std::istream &in,
62
const
std::string &filename,
63
message_handlert
&message_handler,
64
xmlt
&dest);
65
66
bool
parse_xml
(
67
const
std::string &filename,
68
message_handlert
&message_handler,
69
xmlt
&dest);
70
71
#endif
// CPROVER_XMLLANG_XML_PARSER_H
message_handlert
Definition
message.h:27
parsert::parsert
parsert(message_handlert &message_handler)
Definition
parser.h:33
xml_parse_treet
Definition
xml_parse_tree.h:16
xml_parsert
Definition
xml_parser.h:18
xml_parsert::xml_parsert
xml_parsert(const xml_parsert &)=delete
xml_parsert::instance_count
static int instance_count
Definition
xml_parser.h:54
xml_parsert::stack
std::list< xmlt * > stack
Definition
xml_parser.h:38
xml_parsert::parse
bool parse() override
Definition
xml_parser.cpp:19
xml_parsert::new_level
void new_level()
Definition
xml_parser.h:47
xml_parsert::current
xmlt & current()
Definition
xml_parser.h:40
xml_parsert::xml_parsert
xml_parsert(message_handlert &message_handler)
Definition
xml_parser.h:20
xml_parsert::parse_tree
xml_parse_treet parse_tree
Definition
xml_parser.h:36
xml_parsert::~xml_parsert
~xml_parsert() override
Definition
xml_parser.h:31
xmlt
Definition
xml.h:21
xmlt::elements
elementst elements
Definition
xml.h:42
parser.h
Parser utilities.
PRECONDITION
#define PRECONDITION(CONDITION)
Definition
invariant.h:463
xml_parse_tree.h
parse_xml
bool parse_xml(std::istream &in, const std::string &filename, message_handlert &message_handler, xmlt &dest)
Definition
xml_parser.cpp:29
yyxmlerror
int yyxmlerror(xml_parsert &, void *, const std::string &)
xmllang
xml_parser.h
Generated by
1.17.0