产生式和语法动作
#[rule(Expr -> Sub Expr)]
#[prec(UMinus)] // 可选
fn expr_neg(s: Token, r: Expr<'p>) -> Expr<'p> {
mk_expr(s.loc(), Unary { op: UnOp::Neg, r: Box::new(r) }.into())
}Last updated
Was this helpful?
#[rule(Expr -> Sub Expr)]
#[prec(UMinus)] // 可选
fn expr_neg(s: Token, r: Expr<'p>) -> Expr<'p> {
mk_expr(s.loc(), Unary { op: UnOp::Neg, r: Box::new(r) }.into())
}Last updated
Was this helpful?
Was this helpful?