spot 2.12.2
|
The result of a formula parser. More...
#include <spot/tl/parse.hh>
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... | |
The result of a formula parser.
bool spot::parsed_formula::format_errors | ( | std::ostream & | os | ) |
Format diagnostics.
os | Where diagnostics should be output. |
true
iff any diagnostic was output. 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.
os | Where diagnostics should be output. |
input | the real input string |
shift | how many characters to add to the error locations |
true
iff any diagnostic was output. 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.
formula spot::parsed_formula::f = nullptr |
The parsed formula.
This could be formula(nullptr) in case of a serious parse error.
std::string spot::parsed_formula::input |
The input text, before parsing.