From 8b96eb190c6ce292e7b7ee56796318cfdf6be2b4 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Wed, 5 Sep 2018 22:17:18 -0700 Subject: [PATCH] [lexer] Continue on to Digit state after lexing Prefix characters --- lexer/src/states/number/prefix.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lexer/src/states/number/prefix.rs b/lexer/src/states/number/prefix.rs index 6003b81..df6fe87 100644 --- a/lexer/src/states/number/prefix.rs +++ b/lexer/src/states/number/prefix.rs @@ -6,6 +6,7 @@ use chars::Lexable; use error::Error; use states::{State, StateResult}; use states::number::{Builder, Radix, Exact}; +use states::number::digit::Digit; use states::number::sign::Sign; use token::Token; @@ -42,8 +43,10 @@ impl State for Prefix { fn lex(&mut self, c: char) -> StateResult { if c.is_hash() { StateResult::advance(Box::new(Hash(self.0))) - } else if let Some(sn) = Sign::with_char(self.0, c) { - StateResult::advance(Box::new(sn)) + } else if let Some(st) = Sign::with_char(self.0, c) { + StateResult::advance(Box::new(st)) + } else if let Some(st) = Digit::with_char(self.0, c) { + StateResult::advance(Box::new(st)) } else { StateResult::fail(Error::invalid_char(c)) }