@@ -842,7 +842,7 @@ public function parseNumber()
842842 // or "E" causing wrongly interpreted scientific notation (".e[0 to 9]" is invalid). Such invalid notation could
843843 // break the lexer when table names under a given database context starts with ".e[0-9]".
844844 //
845- // Valid final states are: 2, 3, 4 and 6 . Any parsing that finished in a
845+ // Valid final states are: 2, 3, 4, 6, and 9 . Any parsing that finished in a
846846 // state other than these is invalid.
847847 // Also, negative states are invalid states.
848848 $ iBak = $ this ->last ;
@@ -886,29 +886,23 @@ public function parseNumber()
886886 $ state = 4 ;
887887 } elseif ($ this ->str [$ this ->last ] === 'e ' || $ this ->str [$ this ->last ] === 'E ' ) {
888888 $ state = 5 ;
889- } elseif (
890- ($ this ->str [$ this ->last ] >= 'a ' && $ this ->str [$ this ->last ] <= 'z ' )
891- || ($ this ->str [$ this ->last ] >= 'A ' && $ this ->str [$ this ->last ] <= 'Z ' )
892- ) {
893- // A number can't be directly followed by a letter
894- $ state = -$ state ;
895- break ;
896889 } elseif ($ this ->str [$ this ->last ] < '0 ' || $ this ->str [$ this ->last ] > '9 ' ) {
890+ if (! Context::isSeparator ($ this ->str [$ this ->last ])) {
891+ // A number can't be directly followed by a letter
892+ $ state = -$ state ;
893+ }
897894 // Just digits and `.`, `e` and `E` are valid characters.
898895 break ;
899896 }
900897 } elseif ($ state === 4 ) {
901898 $ flags |= Token::FLAG_NUMBER_FLOAT ;
902899 if ($ this ->str [$ this ->last ] === 'e ' || $ this ->str [$ this ->last ] === 'E ' ) {
903900 $ state = 5 ;
904- } elseif (
905- ($ this ->str [$ this ->last ] >= 'a ' && $ this ->str [$ this ->last ] <= 'z ' )
906- || ($ this ->str [$ this ->last ] >= 'A ' && $ this ->str [$ this ->last ] <= 'Z ' )
907- ) {
908- // A number can't be directly followed by a letter
909- $ state = -$ state ;
910- break ;
911901 } elseif ($ this ->str [$ this ->last ] < '0 ' || $ this ->str [$ this ->last ] > '9 ' ) {
902+ if (! Context::isSeparator ($ this ->str [$ this ->last ])) {
903+ // A number can't be directly followed by a letter
904+ $ state = -$ state ;
905+ }
912906 // Just digits, `e` and `E` are valid characters.
913907 break ;
914908 }
@@ -919,10 +913,7 @@ public function parseNumber()
919913 || ($ this ->str [$ this ->last ] >= '0 ' && $ this ->str [$ this ->last ] <= '9 ' )
920914 ) {
921915 $ state = 6 ;
922- } elseif (
923- ($ this ->str [$ this ->last ] >= 'a ' && $ this ->str [$ this ->last ] <= 'z ' )
924- || ($ this ->str [$ this ->last ] >= 'A ' && $ this ->str [$ this ->last ] <= 'Z ' )
925- ) {
916+ } elseif (! Context::isSeparator ($ this ->str [$ this ->last ])) {
926917 // A number can't be directly followed by a letter
927918 $ state = -$ state ;
928919 break ;
0 commit comments