@@ -842,7 +842,7 @@ public function parseNumber()
842
842
// or "E" causing wrongly interpreted scientific notation (".e[0 to 9]" is invalid). Such invalid notation could
843
843
// break the lexer when table names under a given database context starts with ".e[0-9]".
844
844
//
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
846
846
// state other than these is invalid.
847
847
// Also, negative states are invalid states.
848
848
$ iBak = $ this ->last ;
@@ -886,29 +886,25 @@ public function parseNumber()
886
886
$ state = 4 ;
887
887
} elseif ($ this ->str [$ this ->last ] === 'e ' || $ this ->str [$ this ->last ] === 'E ' ) {
888
888
$ 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 ;
896
889
} 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 _ or $
892
+ $ state = -$ state ;
893
+ }
894
+
897
895
// Just digits and `.`, `e` and `E` are valid characters.
898
896
break ;
899
897
}
900
898
} elseif ($ state === 4 ) {
901
899
$ flags |= Token::FLAG_NUMBER_FLOAT ;
902
900
if ($ this ->str [$ this ->last ] === 'e ' || $ this ->str [$ this ->last ] === 'E ' ) {
903
901
$ 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 ;
911
902
} elseif ($ this ->str [$ this ->last ] < '0 ' || $ this ->str [$ this ->last ] > '9 ' ) {
903
+ if (! Context::isSeparator ($ this ->str [$ this ->last ])) {
904
+ // A number can't be directly followed by a letter _ or $
905
+ $ state = -$ state ;
906
+ }
907
+
912
908
// Just digits, `e` and `E` are valid characters.
913
909
break ;
914
910
}
@@ -919,14 +915,12 @@ public function parseNumber()
919
915
|| ($ this ->str [$ this ->last ] >= '0 ' && $ this ->str [$ this ->last ] <= '9 ' )
920
916
) {
921
917
$ 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
- ) {
926
- // A number can't be directly followed by a letter
927
- $ state = -$ state ;
928
- break ;
929
918
} else {
919
+ if (! Context::isSeparator ($ this ->str [$ this ->last ])) {
920
+ // A number can't be directly followed by a letter _ or $
921
+ $ state = -$ state ;
922
+ }
923
+
930
924
break ;
931
925
}
932
926
} elseif ($ state === 6 ) {
0 commit comments