number.rs: Allow Plus-sign before radix marker
This commit is contained in:
parent
8c2f53f950
commit
8ea41b46f8
@ -16,7 +16,8 @@ impl Parsable for Number {
|
||||
fn parse<'text, T>(p: &Parser, stream: &mut T) -> Result<Self, Error>
|
||||
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()
|
||||
|
Loading…
Reference in New Issue
Block a user