@@ -812,7 +812,7 @@ public function parseNumber()
812812 // 1 --------------------[ + or - ]-------------------> 1
813813 // 1 -------------------[ 0x or 0X ]------------------> 2
814814 // 1 --------------------[ 0 to 9 ]-------------------> 3
815- // 1 -----------------------[ . ]---------------------> 4
815+ // 1 -----------------------[ . ]---------------------> 10
816816 // 1 -----------------------[ b ]---------------------> 7
817817 //
818818 // 2 --------------------[ 0 to F ]-------------------> 2
@@ -831,11 +831,16 @@ public function parseNumber()
831831 // 8 --------------------[ 0 or 1 ]-------------------> 8
832832 // 8 -----------------------[ ' ]---------------------> 9
833833 //
834+ // 10 -------------------[ 0 to 9 ]-------------------> 4
835+ //
834836 // State 1 may be reached by negative numbers.
835837 // State 2 is reached only by hex numbers.
836838 // State 4 is reached only by float numbers.
837839 // State 5 is reached only by numbers in approximate form.
838840 // State 7 is reached only by numbers in bit representation.
841+ // State 10 is a forced proxy to state 4 ensuring a starting dot (= "0.something") precedes a digit, and not "e"
842+ // or "E" causing wrongly interpreted scientific notation (".e[0 to 9]" is invalid). Such invalid notation could
843+ // break the lexer when table names under a given database context starts with ".e[0-9]".
839844 //
840845 // Valid final states are: 2, 3, 4 and 6. Any parsing that finished in a
841846 // state other than these is invalid.
@@ -858,7 +863,7 @@ public function parseNumber()
858863 } elseif ($ this ->str [$ this ->last ] >= '0 ' && $ this ->str [$ this ->last ] <= '9 ' ) {
859864 $ state = 3 ;
860865 } elseif ($ this ->str [$ this ->last ] === '. ' ) {
861- $ state = 4 ;
866+ $ state = 10 ;
862867 } elseif ($ this ->str [$ this ->last ] === 'b ' ) {
863868 $ state = 7 ;
864869 } elseif ($ this ->str [$ this ->last ] !== '+ ' ) {
@@ -885,7 +890,7 @@ public function parseNumber()
885890 ($ this ->str [$ this ->last ] >= 'a ' && $ this ->str [$ this ->last ] <= 'z ' )
886891 || ($ this ->str [$ this ->last ] >= 'A ' && $ this ->str [$ this ->last ] <= 'Z ' )
887892 ) {
888- // A number can't be directly followed by a letter
893+ // A number can't be directly followed by a letter
889894 $ state = -$ state ;
890895 } elseif ($ this ->str [$ this ->last ] < '0 ' || $ this ->str [$ this ->last ] > '9 ' ) {
891896 // Just digits and `.`, `e` and `E` are valid characters.
@@ -899,7 +904,7 @@ public function parseNumber()
899904 ($ this ->str [$ this ->last ] >= 'a ' && $ this ->str [$ this ->last ] <= 'z ' )
900905 || ($ this ->str [$ this ->last ] >= 'A ' && $ this ->str [$ this ->last ] <= 'Z ' )
901906 ) {
902- // A number can't be directly followed by a letter
907+ // A number can't be directly followed by a letter
903908 $ state = -$ state ;
904909 } elseif ($ this ->str [$ this ->last ] < '0 ' || $ this ->str [$ this ->last ] > '9 ' ) {
905910 // Just digits, `e` and `E` are valid characters.
@@ -916,7 +921,7 @@ public function parseNumber()
916921 ($ this ->str [$ this ->last ] >= 'a ' && $ this ->str [$ this ->last ] <= 'z ' )
917922 || ($ this ->str [$ this ->last ] >= 'A ' && $ this ->str [$ this ->last ] <= 'Z ' )
918923 ) {
919- // A number can't be directly followed by a letter
924+ // A number can't be directly followed by a letter
920925 $ state = -$ state ;
921926 } else {
922927 break ;
@@ -941,6 +946,13 @@ public function parseNumber()
941946 }
942947 } elseif ($ state === 9 ) {
943948 break ;
949+ } elseif ($ state === 10 ) {
950+ $ flags |= Token::FLAG_NUMBER_FLOAT ;
951+ if ($ this ->str [$ this ->last ] < '0 ' || $ this ->str [$ this ->last ] > '9 ' ) {
952+ break ;
953+ }
954+
955+ $ state = 4 ;
944956 }
945957
946958 $ token .= $ this ->str [$ this ->last ];
0 commit comments