Skip to content

Commit 30b5c95

Browse files
committed
Add a test for name starting with number followed by _
Signed-off-by: Maximilian Krög <maxi_kroeg@web.de>
1 parent 707e336 commit 30b5c95

File tree

3 files changed

+135
-0
lines changed

3 files changed

+135
-0
lines changed

tests/Lexer/LexerTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ public static function lexProvider(): array
7676
['lexer/lexKeyword'],
7777
['lexer/lexKeyword2'],
7878
['lexer/lexNumber'],
79+
['lexer/lexNumberAtStartOfName'],
7980
['lexer/lexOperator'],
8081
['lexer/lexOperatorStarIsArithmetic'],
8182
['lexer/lexOperatorStarIsWildcard'],
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
INSERT INTO 2_bar SELECT 1;
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
{
2+
"query": "INSERT INTO 2_bar SELECT 1;",
3+
"lexer": {
4+
"@type": "PhpMyAdmin\\SqlParser\\Lexer",
5+
"str": "INSERT INTO 2_bar SELECT 1;",
6+
"len": 27,
7+
"last": 27,
8+
"list": {
9+
"@type": "PhpMyAdmin\\SqlParser\\TokensList",
10+
"tokens": [
11+
{
12+
"@type": "PhpMyAdmin\\SqlParser\\Token",
13+
"token": "INSERT",
14+
"value": "INSERT",
15+
"keyword": "INSERT",
16+
"type": 1,
17+
"flags": 35,
18+
"position": 0
19+
},
20+
{
21+
"@type": "PhpMyAdmin\\SqlParser\\Token",
22+
"token": " ",
23+
"value": " ",
24+
"keyword": null,
25+
"type": 3,
26+
"flags": 0,
27+
"position": 6
28+
},
29+
{
30+
"@type": "PhpMyAdmin\\SqlParser\\Token",
31+
"token": "INTO",
32+
"value": "INTO",
33+
"keyword": "INTO",
34+
"type": 1,
35+
"flags": 3,
36+
"position": 7
37+
},
38+
{
39+
"@type": "PhpMyAdmin\\SqlParser\\Token",
40+
"token": " ",
41+
"value": " ",
42+
"keyword": null,
43+
"type": 3,
44+
"flags": 0,
45+
"position": 11
46+
},
47+
{
48+
"@type": "PhpMyAdmin\\SqlParser\\Token",
49+
"token": "2",
50+
"value": 2,
51+
"keyword": null,
52+
"type": 6,
53+
"flags": 0,
54+
"position": 12
55+
},
56+
{
57+
"@type": "PhpMyAdmin\\SqlParser\\Token",
58+
"token": "_bar",
59+
"value": "_bar",
60+
"keyword": null,
61+
"type": 0,
62+
"flags": 0,
63+
"position": 13
64+
},
65+
{
66+
"@type": "PhpMyAdmin\\SqlParser\\Token",
67+
"token": " ",
68+
"value": " ",
69+
"keyword": null,
70+
"type": 3,
71+
"flags": 0,
72+
"position": 17
73+
},
74+
{
75+
"@type": "PhpMyAdmin\\SqlParser\\Token",
76+
"token": "SELECT",
77+
"value": "SELECT",
78+
"keyword": "SELECT",
79+
"type": 1,
80+
"flags": 3,
81+
"position": 18
82+
},
83+
{
84+
"@type": "PhpMyAdmin\\SqlParser\\Token",
85+
"token": " ",
86+
"value": " ",
87+
"keyword": null,
88+
"type": 3,
89+
"flags": 0,
90+
"position": 24
91+
},
92+
{
93+
"@type": "PhpMyAdmin\\SqlParser\\Token",
94+
"token": "1",
95+
"value": 1,
96+
"keyword": null,
97+
"type": 6,
98+
"flags": 0,
99+
"position": 25
100+
},
101+
{
102+
"@type": "PhpMyAdmin\\SqlParser\\Token",
103+
"token": ";",
104+
"value": ";",
105+
"keyword": null,
106+
"type": 9,
107+
"flags": 0,
108+
"position": 26
109+
},
110+
{
111+
"@type": "PhpMyAdmin\\SqlParser\\Token",
112+
"token": null,
113+
"value": null,
114+
"keyword": null,
115+
"type": 9,
116+
"flags": 0,
117+
"position": null
118+
}
119+
],
120+
"count": 12,
121+
"idx": 0
122+
},
123+
"delimiter": ";",
124+
"delimiterLen": 1,
125+
"strict": false,
126+
"errors": []
127+
},
128+
"parser": null,
129+
"errors": {
130+
"lexer": [],
131+
"parser": []
132+
}
133+
}

0 commit comments

Comments
 (0)