24#include <boost/phoenix.hpp>
25#include <boost/spirit/home/qi.hpp>
29namespace func_sketch::parser {
35 :
public boost::spirit::qi::grammar<std::string::const_iterator,
36 ParsedExpression(), boost::spirit::ascii::space_type> {
76 boost::spirit::ascii::space_type>;
const std::string & error_message() const noexcept
Get the error message from the last parse attempt.
Rule< ParsedFunctionCallExpression > function_call_expr_rule_
Rule of function call expressions.
Rule< ParsedLiteral > literal_rule_
Rule of literals.
boost::spirit::qi::rule< IteratorType, T(), boost::spirit::ascii::space_type > Rule
Type of rules.
ExpressionGrammar()
Constructor.
void clear_error_message() noexcept
Clear the error message.
Rule< ParsedExpression > term_expr_rule_
Rule of term expressions.
Rule< Complex > imaginary_number_rule_
Rule of imaginary numbers.
std::string::const_iterator IteratorType
Type of iterator.
Rule< ParsedExpression > expr_rule_
Rule of the whole expression.
ParsedExpression parse(const std::string &str)
Parse with error handling.
Rule< ParsedExpression > sum_expr_rule_
Rule of sum expressions.
Rule< ParsedExpression > value_expr_rule_
Rule of value expressions.
Rule< ParsedExpression > factor_expr_rule_
Rule of factor expressions.
Rule< ParsedExpression > atomic_value_expr_rule_
Rule of atomic value expressions.
Rule< ParsedExpression > unary_expr_rule_
Rule of unary expressions.
std::string error_message_
Error message from the last parse attempt.
Rule< ParsedIdentifier > identifier_rule_
Rule of identifiers.
std::complex< Real > Complex
Type of complex numbers in this project.
Definition of ParsedExpression structure.
boost::variant< ParsedLiteral, ParsedIdentifier, boost::recursive_wrapper< ParsedFunctionCallExpression >, boost::recursive_wrapper< ParsedUnaryExpression >, boost::recursive_wrapper< ParsedBinaryExpression > > ParsedExpression
Variant of parsed expressions.
Struct of parsed function call expressions.
Struct of parsed identifiers.
Struct of parsed literals.