spot  2.11.6
Public Member Functions | Public Attributes | List of all members
spot::parsed_formula Struct Referencefinal

The result of a formula parser. More...

#include <spot/tl/parse.hh>

Collaboration diagram for spot::parsed_formula:

Public Member Functions

 parsed_formula (const std::string &str="")
 
bool format_errors (std::ostream &os)
 Format diagnostics. More...
 
bool format_errors (std::ostream &os, const std::string &input, unsigned shift)
 Format shifted diagnostics. More...
 

Public Attributes

formula f = nullptr
 The parsed formula. More...
 
std::string input
 The input text, before parsing. More...
 
parse_error_list errors
 Syntax errors that occurred during parsing. More...
 

Detailed Description

The result of a formula parser.

Member Function Documentation

◆ format_errors() [1/2]

bool spot::parsed_formula::format_errors ( std::ostream &  os)

Format diagnostics.

Parameters
osWhere diagnostics should be output.
Returns
true iff any diagnostic was output.

◆ format_errors() [2/2]

bool spot::parsed_formula::format_errors ( std::ostream &  os,
const std::string &  input,
unsigned  shift 
)

Format shifted diagnostics.

If the user input was something like "formula = a U b;" but you only passed "a U b" to the parser, it might be convenient to display the diagnostic in the context of "formula = a U b;".

So pass the real input as input, and specify the number of character to skip before the actual text passed to the parser starts.

This procedure assumes that the text passed to the parser appears as-is in the input string. If you had to un-escape it in any way, the error locations will be wrong.

Parameters
osWhere diagnostics should be output.
inputthe real input string
shifthow many characters to add to the error locations
Returns
true iff any diagnostic was output.

Member Data Documentation

◆ errors

parse_error_list spot::parsed_formula::errors

Syntax errors that occurred during parsing.

Note that the parser does not print any diagnostic. Deciding how to output those errors is up to you.

See also
format_errors

◆ f

formula spot::parsed_formula::f = nullptr

The parsed formula.

This could be formula(nullptr) in case of a serious parse error.

◆ input

std::string spot::parsed_formula::input

The input text, before parsing.


The documentation for this struct was generated from the following file:

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