File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -190,7 +190,7 @@ impl Builder<'_, '_> {
190
190
191
191
fn do_float_split ( & mut self , has_pseudo_dot : bool ) {
192
192
let text = & self . lexed . range_text ( self . pos ..self . pos + 1 ) ;
193
- self . pos += 1 ;
193
+
194
194
match text. split_once ( '.' ) {
195
195
Some ( ( left, right) ) => {
196
196
assert ! ( !left. is_empty( ) ) ;
@@ -216,8 +216,26 @@ impl Builder<'_, '_> {
216
216
self . state = State :: PendingExit ;
217
217
}
218
218
}
219
- None => unreachable ! ( ) ,
219
+ None => {
220
+ // illegal float literal which doesn't have dot in form (like 1e0)
221
+ // we should emit an error node here
222
+ ( self . sink ) ( StrStep :: Error { msg : "illegal float literal" , pos : self . pos } ) ;
223
+ ( self . sink ) ( StrStep :: Enter { kind : SyntaxKind :: ERROR } ) ;
224
+ ( self . sink ) ( StrStep :: Token { kind : SyntaxKind :: FLOAT_NUMBER , text : text } ) ;
225
+ ( self . sink ) ( StrStep :: Exit ) ;
226
+
227
+ // move up
228
+ ( self . sink ) ( StrStep :: Exit ) ;
229
+
230
+ self . state = if has_pseudo_dot {
231
+ State :: Normal
232
+ } else {
233
+ State :: PendingExit
234
+ } ;
235
+ }
220
236
}
237
+
238
+ self . pos += 1 ;
221
239
}
222
240
}
223
241
You can’t perform that action at this time.
0 commit comments