diff --git a/src/Contexts/ContextMySql50100.php b/src/Contexts/ContextMySql50100.php index 31e6c1cd..216192b2 100644 --- a/src/Contexts/ContextMySql50100.php +++ b/src/Contexts/ContextMySql50100.php @@ -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, diff --git a/src/Contexts/ContextMySql50500.php b/src/Contexts/ContextMySql50500.php index 5911bb9f..fb80b50b 100644 --- a/src/Contexts/ContextMySql50500.php +++ b/src/Contexts/ContextMySql50500.php @@ -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, diff --git a/src/Contexts/ContextMySql50600.php b/src/Contexts/ContextMySql50600.php index df1eb923..86fefaf3 100644 --- a/src/Contexts/ContextMySql50600.php +++ b/src/Contexts/ContextMySql50600.php @@ -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, diff --git a/src/Contexts/ContextMySql50700.php b/src/Contexts/ContextMySql50700.php index a1256dd7..8c740c67 100644 --- a/src/Contexts/ContextMySql50700.php +++ b/src/Contexts/ContextMySql50700.php @@ -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, diff --git a/src/Contexts/ContextMySql80000.php b/src/Contexts/ContextMySql80000.php index baaa2194..b157f04c 100644 --- a/src/Contexts/ContextMySql80000.php +++ b/src/Contexts/ContextMySql80000.php @@ -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, diff --git a/src/Contexts/ContextMySql80100.php b/src/Contexts/ContextMySql80100.php index 21765797..1a511548 100644 --- a/src/Contexts/ContextMySql80100.php +++ b/src/Contexts/ContextMySql80100.php @@ -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, diff --git a/src/Contexts/ContextMySql80200.php b/src/Contexts/ContextMySql80200.php index 2c7eb605..c658e009 100644 --- a/src/Contexts/ContextMySql80200.php +++ b/src/Contexts/ContextMySql80200.php @@ -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, diff --git a/src/Contexts/ContextMySql80300.php b/src/Contexts/ContextMySql80300.php index 9f9a131d..44012c01 100644 --- a/src/Contexts/ContextMySql80300.php +++ b/src/Contexts/ContextMySql80300.php @@ -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, diff --git a/src/Contexts/ContextMySql80400.php b/src/Contexts/ContextMySql80400.php index d0448040..e6166eab 100644 --- a/src/Contexts/ContextMySql80400.php +++ b/src/Contexts/ContextMySql80400.php @@ -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, diff --git a/tests/data/parser/parseCreateTableWithParser.out b/tests/data/parser/parseCreateTableWithParser.out index c0d3b035..1510a4aa 100644 --- a/tests/data/parser/parseCreateTableWithParser.out +++ b/tests/data/parser/parseCreateTableWithParser.out @@ -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": " ", @@ -612,8 +594,8 @@ "position": null } ], - "count": 67, - "idx": 68 + "count": 65, + "idx": 65 }, "delimiter": ";", "delimiterLen": 1, @@ -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, @@ -724,7 +768,7 @@ } }, "first": 0, - "last": 44 + "last": 64 } ], "brackets": 0, @@ -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": [] } } \ No newline at end of file diff --git a/tools/contexts/MySql50100.txt b/tools/contexts/MySql50100.txt index 10cfdb41..dd9829b5 100644 --- a/tools/contexts/MySql50100.txt +++ b/tools/contexts/MySql50100.txt @@ -548,6 +548,7 @@ WHEN (R) WHERE (R) WHILE (R) WITH (R) +WITH PARSER WORK WRAPPER WRITE (R) diff --git a/tools/contexts/MySql50500.txt b/tools/contexts/MySql50500.txt index 90ea585e..01ab86a5 100644 --- a/tools/contexts/MySql50500.txt +++ b/tools/contexts/MySql50500.txt @@ -557,6 +557,7 @@ WHEN (R) WHERE (R) WHILE (R) WITH (R) +WITH PARSER WORK WRAPPER WRITE (R) diff --git a/tools/contexts/MySql50600.txt b/tools/contexts/MySql50600.txt index 6a4eb38a..85dc73f3 100644 --- a/tools/contexts/MySql50600.txt +++ b/tools/contexts/MySql50600.txt @@ -584,6 +584,7 @@ WHEN (R) WHERE (R) WHILE (R) WITH (R) +WITH PARSER WORK WRAPPER WRITE (R) diff --git a/tools/contexts/MySql50700.txt b/tools/contexts/MySql50700.txt index 9341b5ba..f96ff0e2 100644 --- a/tools/contexts/MySql50700.txt +++ b/tools/contexts/MySql50700.txt @@ -608,6 +608,7 @@ WHEN (R) WHERE (R) WHILE (R) WITH (R) +WITH PARSER WITHOUT WORK WRAPPER diff --git a/tools/contexts/MySql80000.txt b/tools/contexts/MySql80000.txt index 59a79493..6661cdf8 100644 --- a/tools/contexts/MySql80000.txt +++ b/tools/contexts/MySql80000.txt @@ -612,6 +612,7 @@ WHEN (R) WHERE (R) WHILE (R) WITH (R) +WITH PARSER WITHOUT WORK WRAPPER diff --git a/tools/contexts/MySql80100.txt b/tools/contexts/MySql80100.txt index 59a79493..6661cdf8 100644 --- a/tools/contexts/MySql80100.txt +++ b/tools/contexts/MySql80100.txt @@ -612,6 +612,7 @@ WHEN (R) WHERE (R) WHILE (R) WITH (R) +WITH PARSER WITHOUT WORK WRAPPER diff --git a/tools/contexts/MySql80200.txt b/tools/contexts/MySql80200.txt index 59a79493..6661cdf8 100644 --- a/tools/contexts/MySql80200.txt +++ b/tools/contexts/MySql80200.txt @@ -612,6 +612,7 @@ WHEN (R) WHERE (R) WHILE (R) WITH (R) +WITH PARSER WITHOUT WORK WRAPPER diff --git a/tools/contexts/MySql80300.txt b/tools/contexts/MySql80300.txt index 59a79493..6661cdf8 100644 --- a/tools/contexts/MySql80300.txt +++ b/tools/contexts/MySql80300.txt @@ -612,6 +612,7 @@ WHEN (R) WHERE (R) WHILE (R) WITH (R) +WITH PARSER WITHOUT WORK WRAPPER diff --git a/tools/contexts/MySql80400.txt b/tools/contexts/MySql80400.txt index f670a778..832a52da 100644 --- a/tools/contexts/MySql80400.txt +++ b/tools/contexts/MySql80400.txt @@ -601,6 +601,7 @@ WHEN (R) WHERE (R) WHILE (R) WITH (R) +WITH PARSER WITHOUT WORK WRAPPER