Parser modification to handle UAdd in front of int constant #215

Merged
sb10q merged 1 commits from uadd_int_parser_fix into master 2022-03-09 10:46:58 +08:00
1 changed files with 3 additions and 0 deletions
Showing only changes of commit e641fa6ebc - Show all commits

View File

@ -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 }
}
}