From e266d3c2b0842b10d34a5bc3f1cc73466ff08897 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 } } }