// Parse a unary expression. // // unary-expr -> '+' unary-expr // | '-' unary-expr // | '!' unary-expr // | postfix-expr Expr* Parser::unary_expr() { if (match_if(plus_tok)) { Expr* e = unary_expr(); return on_pos(e); } else if (match_if(minus_tok)) { Expr* e = unary_expr(); return on_neg(e); } else if (match_if(not_tok)) { Expr* e = unary_expr(); return on_not(e); } else { return postfix_expr(); } }
std::shared_ptr<expr> postfix_operator::left( expr_parser & /*parser*/, const std::u32string &op, const std::shared_ptr<expr> &left ) { return std::make_shared<expr>( postfix_expr( op, left ) ); }