public.hh 1.97 KB
Newer Older
1
2
3
#ifndef SPOT_LTLPARSE_PUBLIC_HH
# define SPOT_LTLPARSE_PUBLIC_HH

4
# include "ltlast/formula.hh"
5
# include "location.hh"
6
7
# include "ltlenv/defaultenv.hh"
# include <string>
8
9
# include <list>
# include <utility>
10
# include <iostream>
11
12
13
14
15

namespace spot 
{
  namespace ltl
  {
16
    /// \brief A parse diagnostic with its location.
17
    typedef std::pair<yy::Location, std::string> parse_error;
18
    /// \brief A list of parser diagnostics, as filled by parse.
19
20
    typedef std::list<parse_error> parse_error_list;

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
    /// \brief Build a formula from an LTL string.
    /// \param ltl_string The string to parse.
    /// \param error_list A list that will be filled with
    ///        parse errors that occured during parsing.
    /// \param env The environment into which parsing should take place.
    /// \param debug When true, causes the parser to trace its execution.
    /// \return A pointer to the formula built from \a ltl_string, or
    ///        0 if the input was unparsable.
    ///
    /// Note that the parser usually tries to recover from errors.  It can
    /// return an non zero value even if it encountered error during the
    /// parsing of \a ltl_string.  If you want to make sure \a ltl_string
    /// was parsed succesfully, check \a error_list for emptiness.
    ///
    /// \warning This function is not reentrant.
36
    formula* parse(const std::string& ltl_string, 
37
38
39
		   parse_error_list& error_list,
		   environment& env = default_environment::instance(),
		   bool debug = false);
40

41
42
43
44
45
46
47
    
    /// \brief Format diagnostics produced by spot::ltl::parse.
    /// \param os Where diagnostics should be output.
    /// \param ltl_string The string that were parsed.
    /// \param error_list The error list filled by spot::ltl::parse while
    ///        parsing \a ltl_string.
    /// \return \c true iff any diagnostic was output.
48
49
50
    bool format_parse_errors(std::ostream& os,
			     const std::string& ltl_string,
			     parse_error_list& error_list);
51
52
53
54
  }
}

#endif // SPOT_LTLPARSE_PUBLIC_HH