spot 2.2.2

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

- File List

All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
parse.hh
1 // -*- coding: utf-8 -*-
2 // Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016 Laboratoire
3 // de Recherche et Développement de l'Epita (LRDE).
4 // Copyright (C) 2003, 2004, 2005, 2006 Laboratoire d'Informatique de
5 // Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
6 // Université Pierre et Marie Curie.
7 //
8 // This file is part of Spot, a model checking library.
9 //
10 // Spot is free software; you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation; either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Spot is distributed in the hope that it will be useful, but WITHOUT
16 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
18 // License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with this program. If not, see <http://www.gnu.org/licenses/>.
22
23 #pragma once
24
25 #include <spot/tl/formula.hh>
26 #include <spot/misc/location.hh>
27 #include <spot/tl/defaultenv.hh>
28 #include <string>
29 #include <list>
30 #include <utility>
31 #include <iosfwd>
32
33 namespace spot
34 {
37
38 #ifndef SWIG
39 typedef std::pair<location, std::string> one_parse_error;
42 typedef std::list<one_parse_error> parse_error_list;
43 #else
44 // Turn parse_error_list into an opaque type for Swig.
45 struct parse_error_list {};
46 #endif
47
49 struct SPOT_API parsed_formula final
50 {
54 formula f = nullptr;
55
57 std::string input;
58
65 parse_error_list errors;
66
67 parsed_formula(const std::string& str = "")
68 : input(str)
69 {
70 }
71
76 bool format_errors(std::ostream& os);
77
96 bool format_errors(std::ostream& os,
97 const std::string& input,
98 unsigned shift);
99 };
100
101
120 SPOT_API
121 parsed_formula parse_infix_psl(const std::string& ltl_string,
122 environment& env =
123 default_environment::instance(),
124 bool debug = false,
125 bool lenient = false);
126
143 SPOT_API
144 parsed_formula parse_infix_boolean(const std::string& ltl_string,
145 environment& env =
146 default_environment::instance(),
147 bool debug = false,
148 bool lenient = false);
149
168 SPOT_API
169 parsed_formula parse_prefix_ltl(const std::string& ltl_string,
170 environment& env =
171 default_environment::instance(),
172 bool debug = false);
173
180 SPOT_API formula
181 parse_formula(const std::string& ltl_string,
182 environment& env = default_environment::instance());
183
201 SPOT_API
202 parsed_formula parse_infix_sere(const std::string& sere_string,
203 environment& env =
204 default_environment::instance(),
205 bool debug = false,
206 bool lenient = false);
207
230 SPOT_API
231 void
232 fix_utf8_locations(const std::string& input_string,
233 parse_error_list& error_list);
234
236 }
spot
Definition: graph.hh:32
spot::default_environment::instance
static default_environment & instance()
Get the sole instance of spot::default_environment.
spot::parse_formula
formula parse_formula(const std::string &ltl_string, environment &env=default_environment::instance())
A simple wrapper to parse_infix_psl() and parse_prefix_ltl().
spot::parse_infix_boolean
parsed_formula parse_infix_boolean(const std::string &ltl_string, environment &env=default_environment::instance(), bool debug=false, bool lenient=false)
Build a Boolean formula from a string.
spot::one_parse_error
std::pair< location, std::string > one_parse_error
A parse diagnostic with its location.
Definition: parse.hh:40
formula.hh
LTL/PSL formula interface.
spot::parse_infix_sere
parsed_formula parse_infix_sere(const std::string &sere_string, environment &env=default_environment::instance(), bool debug=false, bool lenient=false)
Build a formula from a string representing a SERE.
spot::formula
Main class for temporal logic formula.
Definition: formula.hh:669
spot::parse_error_list
std::list< one_parse_error > parse_error_list
A list of parser diagnostics, as filled by parse.
Definition: parse.hh:42
spot::parsed_formula
The result of a formula parser.
Definition: parse.hh:49
spot::fix_utf8_locations
void fix_utf8_locations(const std::string &input_string, parse_error_list &error_list)
Fix location of diagnostics assuming the input is utf8.
spot::parse_infix_psl
parsed_formula parse_infix_psl(const std::string &ltl_string, environment &env=default_environment::instance(), bool debug=false, bool lenient=false)
Build a formula from an LTL string.
spot::parsed_formula::errors
parse_error_list errors
Syntax errors that occurred during parsing.
Definition: parse.hh:65
spot::parsed_formula::input
std::string input
The input text, before parsing.
Definition: parse.hh:57
spot::parse_prefix_ltl
parsed_formula parse_prefix_ltl(const std::string &ltl_string, environment &env=default_environment::instance(), bool debug=false)
Build a formula from an LTL string in LBT's format.

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