File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -174,6 +174,7 @@ impl<'a> Tokenizer<'a> {
174174 let mut num = num as f64 ;
175175
176176 if let Some ( b'.' ) = self . peek_byte ( ) {
177+ self . left_over = None ;
177178 let mut precision = -1 ;
178179
179180 read_num ! ( self , digit, {
@@ -182,7 +183,7 @@ impl<'a> Tokenizer<'a> {
182183 } ) ;
183184 }
184185
185- match self . next_byte ( ) {
186+ match self . checked_next_byte ( ) {
186187 Some ( b'e' ) | Some ( b'E' ) => {
187188 let mut e = 0 ;
188189 let sign = match self . next_byte ( ) {
@@ -194,7 +195,15 @@ impl<'a> Tokenizer<'a> {
194195 } ,
195196 } ;
196197
197- read_num ! ( self , digit, e = e * 10 + digit as i32 ) ;
198+ while let Some ( ch) = self . checked_next_byte ( ) {
199+ match ch {
200+ b'0' ... b'9' => e = e * 10 + ( ch - b'0' ) as i32 ,
201+ ch => {
202+ self . left_over = Some ( ch) ;
203+ break ;
204+ }
205+ }
206+ }
198207
199208 num *= 10f64 . powi ( e * sign) ;
200209 } ,
You can’t perform that action at this time.
0 commit comments