Skip to content

Commit

Permalink
Add missing token "WITH PARSER" in contexts and regenerate involved t…
Browse files Browse the repository at this point in the history
…est case, now without parsing errors.
  • Loading branch information
niconoe- committed Aug 26, 2024
1 parent 31dc0c6 commit f98d717
Show file tree
Hide file tree
Showing 19 changed files with 89 additions and 49 deletions.
1 change: 1 addition & 0 deletions src/Contexts/ContextMySql50100.php
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ class ContextMySql50100 extends Context
'UNION ALL' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'UNION DISTINCT' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'WITH CONSISTENT SNAPSHOT' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'WITH PARSER' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'WITH ROLLUP' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'ARRAY' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_DATA_TYPE,
'BIT' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_DATA_TYPE,
Expand Down
1 change: 1 addition & 0 deletions src/Contexts/ContextMySql50500.php
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ class ContextMySql50500 extends Context
'UNION ALL' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'UNION DISTINCT' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'WITH CONSISTENT SNAPSHOT' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'WITH PARSER' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'WITH ROLLUP' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'ARRAY' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_DATA_TYPE,
'BIT' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_DATA_TYPE,
Expand Down
1 change: 1 addition & 0 deletions src/Contexts/ContextMySql50600.php
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@ class ContextMySql50600 extends Context
'UNION ALL' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'UNION DISTINCT' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'WITH CONSISTENT SNAPSHOT' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'WITH PARSER' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'WITH ROLLUP' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'ARRAY' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_DATA_TYPE,
'BIT' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_DATA_TYPE,
Expand Down
1 change: 1 addition & 0 deletions src/Contexts/ContextMySql50700.php
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@ class ContextMySql50700 extends Context
'UNION ALL' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'UNION DISTINCT' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'WITH CONSISTENT SNAPSHOT' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'WITH PARSER' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'WITH ROLLUP' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'ARRAY' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_DATA_TYPE,
'BIT' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_DATA_TYPE,
Expand Down
1 change: 1 addition & 0 deletions src/Contexts/ContextMySql80000.php
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,7 @@ class ContextMySql80000 extends Context
'UNION ALL' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'UNION DISTINCT' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'WITH CONSISTENT SNAPSHOT' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'WITH PARSER' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'WITH ROLLUP' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'ARRAY' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_DATA_TYPE,
'BIT' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_DATA_TYPE,
Expand Down
1 change: 1 addition & 0 deletions src/Contexts/ContextMySql80100.php
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,7 @@ class ContextMySql80100 extends Context
'UNION ALL' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'UNION DISTINCT' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'WITH CONSISTENT SNAPSHOT' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'WITH PARSER' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'WITH ROLLUP' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'ARRAY' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_DATA_TYPE,
'BIT' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_DATA_TYPE,
Expand Down
1 change: 1 addition & 0 deletions src/Contexts/ContextMySql80200.php
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,7 @@ class ContextMySql80200 extends Context
'UNION ALL' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'UNION DISTINCT' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'WITH CONSISTENT SNAPSHOT' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'WITH PARSER' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'WITH ROLLUP' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'ARRAY' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_DATA_TYPE,
'BIT' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_DATA_TYPE,
Expand Down
1 change: 1 addition & 0 deletions src/Contexts/ContextMySql80300.php
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,7 @@ class ContextMySql80300 extends Context
'UNION ALL' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'UNION DISTINCT' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'WITH CONSISTENT SNAPSHOT' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'WITH PARSER' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'WITH ROLLUP' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'ARRAY' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_DATA_TYPE,
'BIT' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_DATA_TYPE,
Expand Down
1 change: 1 addition & 0 deletions src/Contexts/ContextMySql80400.php
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@ class ContextMySql80400 extends Context
'UNION ALL' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'UNION DISTINCT' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'WITH CONSISTENT SNAPSHOT' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'WITH PARSER' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'WITH ROLLUP' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
'ARRAY' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_DATA_TYPE,
'BIT' => Token::FLAG_KEYWORD | Token::FLAG_KEYWORD_DATA_TYPE,
Expand Down
120 changes: 71 additions & 49 deletions tests/data/parser/parseCreateTableWithParser.out
Original file line number Diff line number Diff line change
Expand Up @@ -271,31 +271,13 @@
},
{
"@type": "PhpMyAdmin\\SqlParser\\Token",
"token": "WITH",
"value": "WITH",
"keyword": "WITH",
"token": "WITH PARSER",
"value": "WITH PARSER",
"keyword": "WITH PARSER",
"type": 1,
"flags": 3,
"flags": 7,
"position": 128
},
{
"@type": "PhpMyAdmin\\SqlParser\\Token",
"token": " ",
"value": " ",
"keyword": null,
"type": 3,
"flags": 0,
"position": 132
},
{
"@type": "PhpMyAdmin\\SqlParser\\Token",
"token": "PARSER",
"value": "PARSER",
"keyword": "PARSER",
"type": 1,
"flags": 1,
"position": 133
},
{
"@type": "PhpMyAdmin\\SqlParser\\Token",
"token": " ",
Expand Down Expand Up @@ -612,8 +594,8 @@
"position": null
}
],
"count": 67,
"idx": 68
"count": 65,
"idx": 65
},
"delimiter": ";",
"delimiterLen": 1,
Expand Down Expand Up @@ -698,11 +680,73 @@
"expr": null,
"options": {
"@type": "PhpMyAdmin\\SqlParser\\Components\\OptionsArray",
"options": []
"options": {
"3": {
"name": "WITH PARSER",
"equals": false,
"expr": "`ngram`",
"value": "ngram"
}
}
}
},
"references": null,
"options": null
},
{
"@type": "PhpMyAdmin\\SqlParser\\Components\\CreateDefinition",
"name": "my_constraint_1",
"isConstraint": true,
"type": null,
"key": {
"@type": "PhpMyAdmin\\SqlParser\\Components\\Key",
"name": null,
"columns": [
{
"name": "column_one"
}
],
"type": "FOREIGN KEY",
"expr": null,
"options": {
"@type": "PhpMyAdmin\\SqlParser\\Components\\OptionsArray",
"options": []
}
},
"references": {
"@type": "PhpMyAdmin\\SqlParser\\Components\\Reference",
"table": {
"@type": "PhpMyAdmin\\SqlParser\\Components\\Expression",
"database": null,
"table": "other_table",
"column": null,
"expr": "`other_table`",
"alias": null,
"function": null,
"subquery": null
},
"columns": [
"column_two"
],
"options": {
"@type": "PhpMyAdmin\\SqlParser\\Components\\OptionsArray",
"options": {
"2": {
"name": "ON DELETE",
"equals": false,
"expr": "RESTRICT",
"value": "RESTRICT"
},
"3": {
"name": "ON UPDATE",
"equals": false,
"expr": "RESTRICT",
"value": "RESTRICT"
}
}
}
},
"options": null
}
],
"with": null,
Expand All @@ -724,7 +768,7 @@
}
},
"first": 0,
"last": 44
"last": 64
}
],
"brackets": 0,
Expand All @@ -733,28 +777,6 @@
},
"errors": {
"lexer": [],
"parser": [
[
"A comma or a closing bracket was expected.",
{
"@type": "@31"
},
0
],
[
"Unexpected beginning of statement.",
{
"@type": "@47"
},
0
],
[
"Unrecognized statement type.",
{
"@type": "@50"
},
0
]
]
"parser": []
}
}
1 change: 1 addition & 0 deletions tools/contexts/MySql50100.txt
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ WHEN (R)
WHERE (R)
WHILE (R)
WITH (R)
WITH PARSER
WORK
WRAPPER
WRITE (R)
Expand Down
1 change: 1 addition & 0 deletions tools/contexts/MySql50500.txt
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ WHEN (R)
WHERE (R)
WHILE (R)
WITH (R)
WITH PARSER
WORK
WRAPPER
WRITE (R)
Expand Down
1 change: 1 addition & 0 deletions tools/contexts/MySql50600.txt
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,7 @@ WHEN (R)
WHERE (R)
WHILE (R)
WITH (R)
WITH PARSER
WORK
WRAPPER
WRITE (R)
Expand Down
1 change: 1 addition & 0 deletions tools/contexts/MySql50700.txt
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,7 @@ WHEN (R)
WHERE (R)
WHILE (R)
WITH (R)
WITH PARSER
WITHOUT
WORK
WRAPPER
Expand Down
1 change: 1 addition & 0 deletions tools/contexts/MySql80000.txt
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ WHEN (R)
WHERE (R)
WHILE (R)
WITH (R)
WITH PARSER
WITHOUT
WORK
WRAPPER
Expand Down
1 change: 1 addition & 0 deletions tools/contexts/MySql80100.txt
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ WHEN (R)
WHERE (R)
WHILE (R)
WITH (R)
WITH PARSER
WITHOUT
WORK
WRAPPER
Expand Down
1 change: 1 addition & 0 deletions tools/contexts/MySql80200.txt
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ WHEN (R)
WHERE (R)
WHILE (R)
WITH (R)
WITH PARSER
WITHOUT
WORK
WRAPPER
Expand Down
1 change: 1 addition & 0 deletions tools/contexts/MySql80300.txt
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ WHEN (R)
WHERE (R)
WHILE (R)
WITH (R)
WITH PARSER
WITHOUT
WORK
WRAPPER
Expand Down
1 change: 1 addition & 0 deletions tools/contexts/MySql80400.txt
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ WHEN (R)
WHERE (R)
WHILE (R)
WITH (R)
WITH PARSER
WITHOUT
WORK
WRAPPER
Expand Down

0 comments on commit f98d717

Please sign in to comment.