Want to help support the site? Donate Bitcoins @ 1BSyxQbLhq5vMijFZ3hrZQmNMrxC5dVEcM
struct Statement {
typedef boost::variant< boost::recursive_wrapper<CompoundStatement>,
boost::recursive_wrapper<IfStatement>,
VarStatement > Type0;
Type0 stmt;

Statement()
: stmt()
{}

Statement(const CompoundStatement& cs)
: stmt(cs)
{}

Statement(const IfStatement& is)
: stmt(is)
{}

Statement(const VarStatement& vs)
: stmt(vs)
{}
};

struct IfStatement {
typedef double Type0;
typedef Statement Type1;
typedef boost::optional<Statement> Type2;

Type0 expr;
Type1 trueStmt;
Type2 falseStmt;
};

BOOST_FUSION_ADAPT_STRUCT(
Lang::IfStatement,
(Lang::IfStatement::Type0, expr)
(Lang::IfStatement::Type1, trueStmt)
(Lang::IfStatement::Type2, falseStmt)
)

BOOST_FUSION_ADAPT_STRUCT(
Lang::Statement,
(Lang::Statement::Type0, stmt)
)

if_statement
%= "if"
> qi::double_
> statement
>> -("else" > statement)
;

statement
%= var_statement
| if_statement
| compound_statement
;

qi::rule<IterT, Lang::IfStatement(), ascii::space_type> if_statement;
qi::rule<IterT, Lang::Statement(), ascii::space_type> statement;
Dank Papes! Looking for dank papes?
It's a piece of cake to get a pape that's dank at dankpapes.com

Enjoy the site? All donations are appreciated. Paypal or BTC

Donate BTC: 1BSyxQbLhq5vMijFZ3hrZQmNMrxC5dVEcM

Free Text Host is brought to you by Dagon Design
This site contains no adware, spyware, or popups
Questions? Comments?     Privacy Policy     Report abuse here