From 8ea41b46f83ba80eac5e4c26b75ab275897894fa Mon Sep 17 00:00:00 2001 From: John Breaux Date: Wed, 23 Aug 2023 00:16:39 -0500 Subject: [PATCH] number.rs: Allow Plus-sign before radix marker --- src/parser/instruction/encoding/number.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/parser/instruction/encoding/number.rs b/src/parser/instruction/encoding/number.rs index 18943b8..3f3671f 100644 --- a/src/parser/instruction/encoding/number.rs +++ b/src/parser/instruction/encoding/number.rs @@ -16,7 +16,8 @@ impl Parsable for Number { fn parse<'text, T>(p: &Parser, stream: &mut T) -> Result where T: TokenStream<'text> { use Type::*; - let negative = stream.expect(Minus).is_ok(); + // The number is negative when it begins with a Minus, but Plus is also acceptable. + let negative = stream.expect_any_of([Minus, Plus]).map_or(false, |t| t.is_variant(Minus)); let radix = match stream .expect_any_of([RadixMarkerHex, RadixMarkerDec, RadixMarkerOct, RadixMarkerBin]) .ok()