@@ -224,10 +224,22 @@ impl <'input> Tokenizer<'input> {
224224
225225 fn process_number ( & mut self ) -> Result < TokenSpan , TokenizationError > {
226226 let ( start_idx, start_char) = self . lookahead . expect ( "Unexpected end of input, was expecting numeric char" ) ;
227+ let mut last_index = start_idx;
228+ let mut decimal_seen: bool = false ;
229+ let mut exponent_seen: bool = false ;
230+ let mut unary_seen: bool = false ;
231+ if start_char == '.' {
232+ decimal_seen = true
233+ }
227234
228235 let maybe_second_char = self . chars . peek ( ) ;
229236 match maybe_second_char {
230- None => return Ok ( ( start_idx, TokType :: Integer , start_idx + 1 ) ) ,
237+ None => {
238+ if decimal_seen {
239+ return Err ( self . make_error ( "Lone decimal is an invalid literal" . to_string ( ) , start_idx) )
240+ }
241+ return Ok ( ( start_idx, TokType :: Integer , start_idx + 1 ) )
242+ } ,
231243 Some ( ( _second_idx, second_char) ) if start_char == '0' => {
232244 match second_char {
233245 'x' | 'X' => { return self . process_hexadecimal ( ) }
@@ -240,15 +252,6 @@ impl <'input> Tokenizer<'input> {
240252 _ => { }
241253 }
242254
243- let mut last_index = start_idx;
244- let mut decimal_seen: bool = false ;
245- let mut exponent_seen: bool = false ;
246- let mut unary_seen: bool = false ;
247- match start_char {
248- '.' => { decimal_seen = true }
249- '+' | '-' => { unary_seen = true }
250- _ => { }
251- }
252255 loop {
253256 match self . chars . peek ( ) {
254257 None => {
0 commit comments