File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -898,7 +898,7 @@ impl<'de, R: Read<'de>> Deserializer<R> {
898898 fn scan_number ( & mut self , buf : & mut String ) -> Result < ( ) > {
899899 match tri ! ( self . peek_or_null( ) ) {
900900 b'.' => self . scan_decimal ( buf) ,
901- b'e' | b'E' => self . scan_exponent ( buf) ,
901+ c @ ( b'e' | b'E' ) => self . scan_exponent ( c as char , buf) ,
902902 _ => Ok ( ( ) ) ,
903903 }
904904 }
@@ -923,19 +923,20 @@ impl<'de, R: Read<'de>> Deserializer<R> {
923923 }
924924
925925 match tri ! ( self . peek_or_null( ) ) {
926- b'e' | b'E' => self . scan_exponent ( buf) ,
926+ c @ ( b'e' | b'E' ) => self . scan_exponent ( c as char , buf) ,
927927 _ => Ok ( ( ) ) ,
928928 }
929929 }
930930
931931 #[ cfg( feature = "arbitrary_precision" ) ]
932- fn scan_exponent ( & mut self , buf : & mut String ) -> Result < ( ) > {
932+ fn scan_exponent ( & mut self , e : char , buf : & mut String ) -> Result < ( ) > {
933933 self . eat_char ( ) ;
934- buf. push ( 'e' ) ;
934+ buf. push ( e ) ;
935935
936936 match tri ! ( self . peek_or_null( ) ) {
937937 b'+' => {
938938 self . eat_char ( ) ;
939+ buf. push ( '+' ) ;
939940 }
940941 b'-' => {
941942 self . eat_char ( ) ;
Original file line number Diff line number Diff line change @@ -1007,8 +1007,14 @@ fn test_parse_number() {
10071007 #[ cfg( feature = "arbitrary_precision" ) ]
10081008 test_parse_ok ( vec ! [
10091009 ( "1e999" , Number :: from_string_unchecked( "1e999" . to_owned( ) ) ) ,
1010+ ( "1e+999" , Number :: from_string_unchecked( "1e+999" . to_owned( ) ) ) ,
10101011 ( "-1e999" , Number :: from_string_unchecked( "-1e999" . to_owned( ) ) ) ,
10111012 ( "1e-999" , Number :: from_string_unchecked( "1e-999" . to_owned( ) ) ) ,
1013+ ( "1E999" , Number :: from_string_unchecked( "1E999" . to_owned( ) ) ) ,
1014+ ( "1E+999" , Number :: from_string_unchecked( "1E+999" . to_owned( ) ) ) ,
1015+ ( "-1E999" , Number :: from_string_unchecked( "-1E999" . to_owned( ) ) ) ,
1016+ ( "1E-999" , Number :: from_string_unchecked( "1E-999" . to_owned( ) ) ) ,
1017+ ( "1E+000" , Number :: from_string_unchecked( "1E+000" . to_owned( ) ) ) ,
10121018 (
10131019 "2.3e999" ,
10141020 Number :: from_string_unchecked( "2.3e999" . to_owned( ) ) ,
You can’t perform that action at this time.
0 commit comments