spot  1.99.5
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
public.hh
1 // -*- coding: utf-8 -*-
2 // Copyright (C) 2013, 2014, 2015 Laboratoire de Recherche et Développement
3 // 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 "twa/twagraph.hh"
23 #include "misc/location.hh"
24 #include "tl/defaultenv.hh"
25 #include <string>
26 #include <list>
27 #include <utility>
28 #include <iosfwd>
29 #include <misc/bitvect.hh>
30 
31 namespace spot
32 {
35 
36 #ifndef SWIG
37  typedef std::pair<spot::location, std::string> parse_aut_error;
40  typedef std::list<parse_aut_error> parse_aut_error_list;
41 #else
42  // Turn parse_aut_error_list into an opaque type for Swig.
43  struct parse_aut_error_list {};
44 #endif
45 
46  enum class parsed_aut_type { HOA, NeverClaim, LBTT, DRA, DSA, Unknown };
47 
49  struct SPOT_API parsed_aut final
50  {
55  twa_graph_ptr aut;
57  bool aborted = false;
59  spot::location loc;
61  parsed_aut_type type = parsed_aut_type::Unknown;
63  const std::string filename;
68  parse_aut_error_list errors;
69 
70  parsed_aut(const std::string& str)
71  : filename(str)
72  {
73  }
77  bool format_errors(std::ostream& os);
78  };
79 
80  typedef std::shared_ptr<parsed_aut> parsed_aut_ptr;
81  typedef std::shared_ptr<const parsed_aut> const_parsed_aut_ptr;
82 
84  {
85  bool ignore_abort = false;
86  bool debug = false;
87  bool trust_hoa = true;
88  bool raise_errors = false;
89  };
90 
110  class SPOT_API automaton_stream_parser final
111  {
112  spot::location last_loc;
113  std::string filename_;
115  public:
120  automaton_stream_parser(const std::string& filename,
121  automaton_parser_options opts = {});
122 
128  automaton_stream_parser(int fd, const std::string& filename,
129  automaton_parser_options opts = {});
130 
136  automaton_stream_parser(const char* data,
137  const std::string& filename,
138  automaton_parser_options opts = {});
139 
141 
157  parsed_aut_ptr parse(const bdd_dict_ptr& dict,
158  environment& env =
160  };
161 
178  SPOT_API parsed_aut_ptr
179  parse_aut(const std::string& filename,
180  const bdd_dict_ptr& dict,
182  automaton_parser_options opts = {});
184 }
Definition: graph.hh:32
static default_environment & instance()
Get the sole instance of spot::default_environment.
std::pair< spot::location, std::string > parse_aut_error
A parse diagnostic with its location.
Definition: public.hh:38
Result of the automaton parser.
Definition: public.hh:49
An environment that describes atomic propositions.
Definition: environment.hh:32
twa_graph_ptr aut
The parsed automaton.
Definition: public.hh:55
bool debug
Run the parser in debug mode?
Definition: public.hh:86
bool trust_hoa
Trust properties in HOA files.
Definition: public.hh:87
std::list< parse_aut_error > parse_aut_error_list
A list of parser diagnostics, as filled by parse.
Definition: public.hh:40
Definition: public.hh:83
bool ignore_abort
Skip aborted automata.
Definition: public.hh:85
bool raise_errors
Raise errors as exceptions.
Definition: public.hh:88
spot::location loc
Location of the automaton in the stream.
Definition: public.hh:59
const std::string filename
Name of the stream (used for displaying syntax errors)
Definition: public.hh:63
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.
parse_aut_error_list errors
Syntax errors that occurred during parsing.
Definition: public.hh:68
Parse a stream of automata.
Definition: public.hh:110

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Tue Nov 3 2015 13:13:26 for spot by doxygen 1.8.8