From e641fa6ebcf785e5fb1951a1e744db437c7daa4b Mon Sep 17 00:00:00 2001 From: ychenfo Date: Tue, 8 Mar 2022 03:02:40 +0800 Subject: [PATCH] nac3parser: modify to handle UAdd in front of int constant --- nac3parser/src/python.lalrpop | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nac3parser/src/python.lalrpop b/nac3parser/src/python.lalrpop index 32775f18..f0ccb78a 100644 --- a/nac3parser/src/python.lalrpop +++ b/nac3parser/src/python.lalrpop @@ -923,6 +923,9 @@ Factor: ast::Expr = { kind: kind.clone() } } + (ast::Unaryop::UAdd, ast::ExprKind::Constant { value: Constant::Int(val), kind }) => { + ast::ExprKind::Constant { value: Constant::Int(*val), kind: kind.clone() } + } _ => ast::ExprKind::UnaryOp { operand: Box::new(e), op } } } -- 2.44.2