Line data Source code
1 : #ifndef MATHEVAL_IMPLEMENTATION 2 : #error "Do not include ast_adapted.hpp directly!" 3 : #endif 4 : 5 : #pragma once 6 : 7 : #include "ast.hpp" 8 : 9 : #include <boost/fusion/include/adapt_struct.hpp> 10 : 11 : typedef double (*unary_fn)(double); 12 : typedef double (*binary_fn)(double, double); 13 : typedef double (*ternary_fn)(double, double, double); 14 : 15 135 : BOOST_FUSION_ADAPT_STRUCT(matheval::ast::unary_op, 16 : (unary_fn, op)(matheval::ast::operand, rhs)) 17 : 18 57 : BOOST_FUSION_ADAPT_STRUCT(matheval::ast::binary_op, 19 : (binary_fn, op)(matheval::ast::operand, 20 : lhs)(matheval::ast::operand, rhs)) 21 : 22 59 : BOOST_FUSION_ADAPT_STRUCT(matheval::ast::ternary_op, 23 : (ternary_fn, op)(matheval::ast::operand, 24 : cond)(matheval::ast::operand, 25 : t)(matheval::ast::operand, f)) 26 : 27 1424 : BOOST_FUSION_ADAPT_STRUCT(matheval::ast::operation, 28 : (binary_fn, op)(matheval::ast::operand, rhs)) 29 : 30 2366 : BOOST_FUSION_ADAPT_STRUCT(matheval::ast::expression, 31 : (matheval::ast::operand, 32 : lhs)(std::list<matheval::ast::operation>, rhs))