@@ -853,7 +853,7 @@ public function parseNumber()
853853 // or "E" causing wrongly interpreted scientific notation (".e[0 to 9]" is invalid). Such invalid notation could
854854 // break the lexer when table names under a given database context starts with ".e[0-9]".
855855 //
856- // Valid final states are: 2, 3, 4 and 6 . Any parsing that finished in a
856+ // Valid final states are: 2, 3, 4, 6, and 9 . Any parsing that finished in a
857857 // state other than these is invalid.
858858 // Also, negative states are invalid states.
859859 $ iBak = $ this ->last ;
@@ -897,29 +897,25 @@ public function parseNumber()
897897 $ state = 4 ;
898898 } elseif ($ this ->str [$ this ->last ] === 'e ' || $ this ->str [$ this ->last ] === 'E ' ) {
899899 $ state = 5 ;
900- } elseif (
901- ($ this ->str [$ this ->last ] >= 'a ' && $ this ->str [$ this ->last ] <= 'z ' )
902- || ($ this ->str [$ this ->last ] >= 'A ' && $ this ->str [$ this ->last ] <= 'Z ' )
903- ) {
904- // A number can't be directly followed by a letter
905- $ state = -$ state ;
906- break ;
907900 } elseif ($ this ->str [$ this ->last ] < '0 ' || $ this ->str [$ this ->last ] > '9 ' ) {
901+ if (! Context::isSeparator ($ this ->str [$ this ->last ])) {
902+ // A number can't be directly followed by a letter _ or $
903+ $ state = -$ state ;
904+ }
905+
908906 // Just digits and `.`, `e` and `E` are valid characters.
909907 break ;
910908 }
911909 } elseif ($ state === 4 ) {
912910 $ flags |= Token::FLAG_NUMBER_FLOAT ;
913911 if ($ this ->str [$ this ->last ] === 'e ' || $ this ->str [$ this ->last ] === 'E ' ) {
914912 $ state = 5 ;
915- } elseif (
916- ($ this ->str [$ this ->last ] >= 'a ' && $ this ->str [$ this ->last ] <= 'z ' )
917- || ($ this ->str [$ this ->last ] >= 'A ' && $ this ->str [$ this ->last ] <= 'Z ' )
918- ) {
919- // A number can't be directly followed by a letter
920- $ state = -$ state ;
921- break ;
922913 } elseif ($ this ->str [$ this ->last ] < '0 ' || $ this ->str [$ this ->last ] > '9 ' ) {
914+ if (! Context::isSeparator ($ this ->str [$ this ->last ])) {
915+ // A number can't be directly followed by a letter _ or $
916+ $ state = -$ state ;
917+ }
918+
923919 // Just digits, `e` and `E` are valid characters.
924920 break ;
925921 }
@@ -930,14 +926,12 @@ public function parseNumber()
930926 || ($ this ->str [$ this ->last ] >= '0 ' && $ this ->str [$ this ->last ] <= '9 ' )
931927 ) {
932928 $ state = 6 ;
933- } elseif (
934- ($ this ->str [$ this ->last ] >= 'a ' && $ this ->str [$ this ->last ] <= 'z ' )
935- || ($ this ->str [$ this ->last ] >= 'A ' && $ this ->str [$ this ->last ] <= 'Z ' )
936- ) {
937- // A number can't be directly followed by a letter
938- $ state = -$ state ;
939- break ;
940929 } else {
930+ if (! Context::isSeparator ($ this ->str [$ this ->last ])) {
931+ // A number can't be directly followed by a letter _ or $
932+ $ state = -$ state ;
933+ }
934+
941935 break ;
942936 }
943937 } elseif ($ state === 6 ) {
0 commit comments