spot 2.11.4.dev
parse.hh
1// -*- coding: utf-8 -*-
2// Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017 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
33namespace spot
34{
37
38#ifndef SWIG
40 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
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 =
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 =
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 =
172 bool debug = false);
173
180 SPOT_API formula
181 parse_formula(const std::string& ltl_string,
183
201 SPOT_API
202 parsed_formula parse_infix_sere(const std::string& sere_string,
203 environment& env =
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}
static default_environment & instance()
Get the sole instance of spot::default_environment.
An environment that describes atomic propositions.
Definition: environment.hh:33
Main class for temporal logic formula.
Definition: formula.hh:728
LTL/PSL formula interface.
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.
std::pair< location, std::string > one_parse_error
A parse diagnostic with its location.
Definition: parse.hh:40
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.
formula parse_formula(const std::string &ltl_string, environment &env=default_environment::instance())
A simple wrapper to parse_infix_psl() and parse_prefix_ltl().
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.
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.
void fix_utf8_locations(const std::string &input_string, parse_error_list &error_list)
Fix location of diagnostics assuming the input is utf8.
std::list< one_parse_error > parse_error_list
A list of parser diagnostics, as filled by parse.
Definition: parse.hh:42
Definition: automata.hh:27
The result of a formula parser.
Definition: parse.hh:50
parse_error_list errors
Syntax errors that occurred during parsing.
Definition: parse.hh:65
std::string input
The input text, before parsing.
Definition: parse.hh:57
bool format_errors(std::ostream &os, const std::string &input, unsigned shift)
Format shifted diagnostics.
bool format_errors(std::ostream &os)
Format diagnostics.

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.4