Skip to content

Commit

Permalink
Fix #26: Support RECURSIVE keywords and deprecate non_recursive_cte
Browse files Browse the repository at this point in the history
  • Loading branch information
takegue committed May 5, 2023
1 parent 67ec14a commit ecb0450
Show file tree
Hide file tree
Showing 5 changed files with 529,532 additions and 529,335 deletions.
13 changes: 7 additions & 6 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ module.exports = grammar({
conflicts: (
$,
) => [
[$.query_expr],
[$.function_call],
// [$.function_call, $.argument],
],
[$.query_expr],
[$.function_call],
// [$.function_call, $.argument],
],
externals: ($) => [
$._string_start,
$._string_content,
Expand Down Expand Up @@ -913,9 +913,10 @@ module.exports = grammar({
cte_clause: ($) =>
seq(
kw('WITH'),
commaSep1($.non_recursive_cte),
optional(alias(kw('RECURSIVE'), $.with_recursive_keyword)),
commaSep1($.cte),
),
non_recursive_cte: ($) =>
cte: ($) =>
seq(
field('alias_name', $.identifier),
$._keyword_as,
Expand Down
28 changes: 25 additions & 3 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -6543,12 +6543,34 @@
"named": false,
"value": "WITH"
},
{
"type": "CHOICE",
"members": [
{
"type": "ALIAS",
"content": {
"type": "ALIAS",
"content": {
"type": "PATTERN",
"value": "[rR][eE][cC][uU][rR][sS][iI][vV][eE]"
},
"named": false,
"value": "RECURSIVE"
},
"named": true,
"value": "with_recursive_keyword"
},
{
"type": "BLANK"
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "non_recursive_cte"
"name": "cte"
},
{
"type": "REPEAT",
Expand All @@ -6561,7 +6583,7 @@
},
{
"type": "SYMBOL",
"name": "non_recursive_cte"
"name": "cte"
}
]
}
Expand All @@ -6570,7 +6592,7 @@
}
]
},
"non_recursive_cte": {
"cte": {
"type": "SEQ",
"members": [
{
Expand Down
Loading

0 comments on commit ecb0450

Please sign in to comment.