23 #include <boost/spirit/include/qi.hpp> 24 #include <boost/spirit/include/phoenix_core.hpp> 25 #include <boost/spirit/include/phoenix_operator.hpp> 26 #include <boost/spirit/include/phoenix_fusion.hpp> 27 #include <boost/spirit/include/phoenix_object.hpp> 28 #include <boost/spirit/include/phoenix_stl.hpp> 29 #include <boost/spirit/include/phoenix_bind.hpp> 30 #include <boost/spirit/include/phoenix.hpp> 40 namespace phx = boost::phoenix;
47 struct Lvl1Operator :
public qi::symbols<char, op::BinaryOperationEnum>
64 struct Lvl2Operator :
public qi::symbols<char, op::BinaryOperationEnum>
75 struct Lvl3Operator :
public qi::symbols<char, op::BinaryOperationEnum>
85 struct Lvl4Operator :
public qi::symbols<char, op::BinaryOperationEnum>
125 :
EvalGrammer::base_type(rule_lvl1_expr,
"eval-MainGrammar")
128 using namespace qi::labels;
129 using boost::phoenix::new_;
130 using boost::phoenix::construct;
131 using boost::phoenix::val;
136 rule_string = ((
'\'' > *(qi::char_ -
'\'') >
'\'') | +qi::char_(
"a-zA-Z_0-9#"));
140 _val = phx::construct<STNode::node_ptr>(phx::new_<FunctionOperationNode>(_1, _2))
144 _val = phx::construct<STNode::node_ptr>(phx::new_<FunctionOperationNode>(_1))
149 _val = phx::construct<STNode::node_ptr>(phx::new_<BinaryOperationNode>(_1, _2, _3))
154 _val = phx::construct<STNode::node_ptr>(phx::new_<BinaryOperationNode>(phx::construct<STNode::node_ptr>(phx::new_<STLeaf>(_1)), _2, _3))
158 _val = phx::construct<STNode::node_ptr>(phx::new_<STLeaf>(_1))
163 _val = phx::construct<STNode::node_ptr>(phx::new_<BinaryOperationNode>(_1, _2, _3))
169 _val = phx::construct<STNode::node_ptr>(phx::new_<BinaryOperationNode>(_1, _2, _3))
176 _val = phx::construct<STNode::node_ptr>(phx::new_<BinaryOperationNode>(_1, _2, _3))
eval::Lvl4Operator Lvl4OpSymbols
Grammar used to parse eval expressions.
Symbol parser for level 3 operations.
eval::Lvl3Operator Lvl3OpSymbols
qi::rule< ItType, STNode::node_ptr(), Skipper > rule_lvl2_expr
rule for lvl 2 operations
qi::rule< ItType, string()> rule_string
rule for a simple string
eval::FunctionOperators FuncOpSymbols
qi::rule< ItType, STNode::node_ptr(), Skipper > rule_func_expr
rule for function expressions
qi::rule< ItType, STNode::node_ptr(), Skipper > rule_lvl1_expr
rule for lvl 1 operations
This file is part of alaCarte.
eval::Lvl1Operator Lvl1OpSymbols
qi::rule< ItType, STNode::node_ptr(), Skipper > rule_lvl4_expr
rule for lvl 4 operations
Symbol parser for level 1 operations.
Symbol parser for the function operations.
Symbol parser for level 2 operations.
qi::rule< ItType, STNode::node_ptr(), Skipper > rule_lvl3_expr
rule for lvl 3 operations
eval::Lvl2Operator Lvl2OpSymbols
EvalGrammer()
Creates an eval grammar.
Symbol parser for level 4 operations.