spot 2.3.3

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List

All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
public.hh
1 // -*- coding: utf-8 -*-
2 // Copyright (C) 2013, 2014, 2015, 2016 Laboratoire de Recherche et
3 // Développement de l'Epita (LRDE).
4 //
5 // This file is part of Spot, a model checking library.
6 //
7 // Spot is free software; you can redistribute it and/or modify it
8 // under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // Spot is distributed in the hope that it will be useful, but WITHOUT
13 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 // License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19
20 #pragma once
21
22 #include <spot/twa/twagraph.hh>
23 #include <spot/kripke/kripkegraph.hh>
24 #include <spot/misc/location.hh>
25 #include <spot/tl/defaultenv.hh>
26 #include <string>
27 #include <list>
28 #include <utility>
29 #include <iosfwd>
30 #include <spot/misc/bitvect.hh>
31
32 namespace spot
33 {
36
37 #ifndef SWIG
38 typedef std::pair<spot::location, std::string> parse_aut_error;
41 typedef std::list<parse_aut_error> parse_aut_error_list;
42 #else
43 // Turn parse_aut_error_list into an opaque type for Swig.
44 struct parse_aut_error_list {};
45 #endif
46
47 enum class parsed_aut_type { HOA, NeverClaim, LBTT, DRA, DSA, Unknown };
48
50 struct SPOT_API parsed_aut final
51 {
58 twa_graph_ptr aut;
63 kripke_graph_ptr ks;
64
66 bool aborted = false;
68 spot::location loc;
70 parsed_aut_type type = parsed_aut_type::Unknown;
72 const std::string filename;
77 parse_aut_error_list errors;
78
79 parsed_aut(const std::string& str)
80 : filename(str)
81 {
82 }
86 bool format_errors(std::ostream& os);
87 };
88
89 typedef std::shared_ptr<parsed_aut> parsed_aut_ptr;
90 typedef std::shared_ptr<const parsed_aut> const_parsed_aut_ptr;
91
92 struct automaton_parser_options final
93 {
94 bool ignore_abort = false;
95 bool debug = false;
96 bool trust_hoa = true;
97 bool raise_errors = false;
98 bool want_kripke = false;
99 };
100
120 class SPOT_API automaton_stream_parser final
121 {
122 spot::location last_loc;
123 std::string filename_;
124 automaton_parser_options opts_;
125 public:
130 automaton_stream_parser(const std::string& filename,
131 automaton_parser_options opts = {});
132
140 automaton_stream_parser(int fd, const std::string& filename,
141 automaton_parser_options opts = {});
142
148 automaton_stream_parser(const char* data,
149 const std::string& filename,
150 automaton_parser_options opts = {});
151
152 ~automaton_stream_parser();
153
169 parsed_aut_ptr parse(const bdd_dict_ptr& dict,
170 environment& env =
171 default_environment::instance());
172 };
173
190 SPOT_API parsed_aut_ptr
191 parse_aut(const std::string& filename,
192 const bdd_dict_ptr& dict,
193 environment& env = default_environment::instance(),
194 automaton_parser_options opts = {});
196 }
spot
Definition: graph.hh:33
spot::default_environment::instance
static default_environment & instance()
Get the sole instance of spot::default_environment.
spot::parse_aut_error
std::pair< spot::location, std::string > parse_aut_error
A parse diagnostic with its location.
Definition: public.hh:39
spot::parsed_aut
Result of the automaton parser.
Definition: public.hh:50
spot::automaton_parser_options::want_kripke
bool want_kripke
Parse as a Kripke structure.
Definition: public.hh:98
spot::environment
An environment that describes atomic propositions.
Definition: environment.hh:32
spot::parsed_aut::aut
twa_graph_ptr aut
The parsed automaton.
Definition: public.hh:58
spot::automaton_parser_options::debug
bool debug
Run the parser in debug mode?
Definition: public.hh:95
spot::automaton_parser_options::trust_hoa
bool trust_hoa
Trust properties in HOA files.
Definition: public.hh:96
spot::parse_aut_error_list
std::list< parse_aut_error > parse_aut_error_list
A list of parser diagnostics, as filled by parse.
Definition: public.hh:41
spot::automaton_parser_options
Definition: public.hh:92
spot::automaton_parser_options::ignore_abort
bool ignore_abort
Skip aborted automata.
Definition: public.hh:94
spot::automaton_parser_options::raise_errors
bool raise_errors
Raise errors as exceptions.
Definition: public.hh:97
spot::parsed_aut::loc
spot::location loc
Location of the automaton in the stream.
Definition: public.hh:68
spot::parsed_aut::ks
kripke_graph_ptr ks
The parsed kripke structure.
Definition: public.hh:63
spot::parsed_aut::filename
const std::string filename
Name of the stream (used for displaying syntax errors)
Definition: public.hh:72
spot::parse_aut
parsed_aut_ptr parse_aut(const std::string &filename, const bdd_dict_ptr &dict, environment &env=default_environment::instance(), automaton_parser_options opts={})
Read the first spot::twa_graph from a file.
spot::parsed_aut::errors
parse_aut_error_list errors
Syntax errors that occurred during parsing.
Definition: public.hh:77
spot::automaton_stream_parser
Parse a stream of automata.
Definition: public.hh:120

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.