spot  2.12.2
public.hh
1 // -*- coding: utf-8 -*-
2 // Copyright (C) by the Spot authors, see the AUTHORS file for details.
3 //
4 // This file is part of Spot, a model checking library.
5 //
6 // Spot is free software; you can redistribute it and/or modify it
7 // under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // Spot is distributed in the hope that it will be useful, but WITHOUT
12 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
14 // License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
19 #pragma once
20 
21 #include <spot/twa/twagraph.hh>
22 #include <spot/kripke/kripkegraph.hh>
23 #include <spot/misc/location.hh>
24 #include <spot/tl/defaultenv.hh>
25 #include <string>
26 #include <list>
27 #include <utility>
28 #include <iosfwd>
29 #include <spot/misc/bitvect.hh>
30 
31 namespace spot
32 {
35 
36 #ifndef SWIG
38  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 {
47  HOA,
48  NeverClaim,
49  LBTT,
50  DRA, /* DSTAR format for Rabin */
51  DSA, /* DSTAR format for Streett */
52  PGAME, /* PG Solver Game */
53  Unknown };
54 
56  struct SPOT_API parsed_aut final
57  {
64  twa_graph_ptr aut;
69  kripke_graph_ptr ks;
70 
72  bool aborted = false;
74  spot::location loc;
76  parsed_aut_type type = parsed_aut_type::Unknown;
78  std::string filename;
84 
85  parsed_aut(const std::string& str)
86  : filename(str)
87  {
88  }
92  bool format_errors(std::ostream& os);
93  };
94 
95  typedef std::shared_ptr<parsed_aut> parsed_aut_ptr;
96  typedef std::shared_ptr<const parsed_aut> const_parsed_aut_ptr;
97 
99  {
100  bool ignore_abort = false;
101  bool debug = false;
102  bool trust_hoa = true;
103  bool raise_errors = false;
104  bool want_kripke = false;
105  bool drop_false_edges = true;
106  };
107 
133  class SPOT_API automaton_stream_parser final
134  {
135  spot::location last_loc;
136  std::string filename_;
138  void* scanner_;
139  public:
144  automaton_stream_parser(const std::string& filename,
145  automaton_parser_options opts = {});
146 
154  automaton_stream_parser(int fd, const std::string& filename,
155  automaton_parser_options opts = {});
156 
162  automaton_stream_parser(const char* data,
163  const std::string& filename,
164  automaton_parser_options opts = {});
165 
167 
183  parsed_aut_ptr parse(const bdd_dict_ptr& dict,
184  environment& env =
186  };
187 
204  SPOT_API parsed_aut_ptr
205  parse_aut(const std::string& filename,
206  const bdd_dict_ptr& dict,
208  automaton_parser_options opts = {});
210 }
Parse a stream of automata.
Definition: public.hh:134
automaton_stream_parser(int fd, const std::string &filename, automaton_parser_options opts={})
Parse from an already opened file descriptor.
automaton_stream_parser(const std::string &filename, automaton_parser_options opts={})
Parse from a file.
parsed_aut_ptr parse(const bdd_dict_ptr &dict, environment &env=default_environment::instance())
Parse the next automaton in the stream.
automaton_stream_parser(const char *data, const std::string &filename, automaton_parser_options opts={})
Parse from a buffer.
static default_environment & instance()
Get the sole instance of spot::default_environment.
An environment that describes atomic propositions.
Definition: environment.hh:29
std::list< parse_aut_error > parse_aut_error_list
A list of parser diagnostics, as filled by parse.
Definition: public.hh:40
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.
std::pair< spot::location, std::string > parse_aut_error
A parse diagnostic with its location.
Definition: public.hh:38
Definition: automata.hh:26
Definition: public.hh:99
bool trust_hoa
Trust properties in HOA files.
Definition: public.hh:102
bool debug
Run the parser in debug mode?
Definition: public.hh:101
bool want_kripke
Parse as a Kripke structure.
Definition: public.hh:104
bool ignore_abort
Skip aborted automata.
Definition: public.hh:100
bool drop_false_edges
Drop edges with false labels.
Definition: public.hh:105
bool raise_errors
Raise errors as exceptions.
Definition: public.hh:103
Result of the automaton parser.
Definition: public.hh:57
spot::location loc
Location of the automaton in the stream.
Definition: public.hh:74
kripke_graph_ptr ks
The parsed kripke structure.
Definition: public.hh:69
bool format_errors(std::ostream &os)
Format diagnostics produced by spot::parse_aut.
parse_aut_error_list errors
Syntax errors that occurred during parsing.
Definition: public.hh:83
std::string filename
Name of the stream (used for displaying syntax errors)
Definition: public.hh:78
twa_graph_ptr aut
The parsed automaton.
Definition: public.hh:64

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Fri Feb 27 2015 10:00:07 for spot by doxygen 1.9.1