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<'_, '_> {
190190
191191 fn  do_float_split ( & mut  self ,  has_pseudo_dot :  bool )  { 
192192 let  text = & self . lexed . range_text ( self . pos ..self . pos  + 1 ) ; 
193-   self . pos  +=  1 ; 
193+ 
194194 match  text. split_once ( '.' )  { 
195195 Some ( ( left,  right) )  => { 
196196 assert ! ( !left. is_empty( ) ) ; 
@@ -216,8 +216,26 @@ impl Builder<'_, '_> {
216216 self . state  = State :: PendingExit ; 
217217 } 
218218 } 
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+  } 
220236 } 
237+ 
238+  self . pos  += 1 ; 
221239 } 
222240} 
223241
                         You can’t perform that action at this time. 
           
                  
0 commit comments