Skip to content

Commit 7b6ce9d

Browse files
committed
Build deno [autogenerated commit]
1 parent 1ec7dcd commit 7b6ce9d

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

.deno/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ import { /* imports here */ } from 'https://deno.land/x/pgsql_ast_parser/mod.ts'
5050

5151
# 📖 Parsing SQL
5252

53-
⚠ I strongly recommand NOT using this parser without Typescript. It will work, but types are awesome.
53+
⚠ I strongly recommend NOT using this parser without Typescript. It will work, but types are awesome.
5454

5555
Parse sql to an AST like this:
5656

.deno/syntax/ast.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,7 @@ export interface SelectFromStatement extends PGNode {
636636
orderBy?: OrderByStatement[] | nil;
637637
distinct?: 'all' | 'distinct' | Expr[] | nil;
638638
for?: ForStatement;
639+
skip?: SkipClause;
639640
}
640641

641642
export interface SelectFromUnion extends PGNode {
@@ -654,6 +655,10 @@ export interface ForStatement extends PGNode {
654655
type: 'update' | 'no key update' | 'share' | 'key share';
655656
}
656657

658+
export interface SkipClause extends PGNode {
659+
type: 'nowait' | 'skip locked'
660+
}
661+
657662
export interface LimitStatement extends PGNode {
658663
limit?: Expr | nil;
659664
offset?: Expr | nil;

.deno/syntax/main.ne.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,9 @@ const grammar: Grammar = {
584584
{"name": "kw_continue", "symbols": [(lexerAny.has("word") ? {type: "word"} : word)], "postprocess": notReservedKw('continue')},
585585
{"name": "kw_share", "symbols": [(lexerAny.has("word") ? {type: "word"} : word)], "postprocess": notReservedKw('share')},
586586
{"name": "kw_refresh", "symbols": [(lexerAny.has("word") ? {type: "word"} : word)], "postprocess": notReservedKw('refresh')},
587+
{"name": "kw_nowait", "symbols": [(lexerAny.has("word") ? {type: "word"} : word)], "postprocess": notReservedKw('nowait')},
588+
{"name": "kw_skip", "symbols": [(lexerAny.has("word") ? {type: "word"} : word)], "postprocess": notReservedKw('skip')},
589+
{"name": "kw_locked", "symbols": [(lexerAny.has("word") ? {type: "word"} : word)], "postprocess": notReservedKw('locked')},
587590
{"name": "kw_ifnotexists", "symbols": ["kw_if", (lexerAny.has("kw_not") ? {type: "kw_not"} : kw_not), "kw_exists"]},
588591
{"name": "kw_ifexists", "symbols": ["kw_if", "kw_exists"]},
589592
{"name": "kw_withordinality", "symbols": [(lexerAny.has("kw_with") ? {type: "kw_with"} : kw_with), "kw_ordinality"]},
@@ -816,15 +819,21 @@ const grammar: Grammar = {
816819
{"name": "select_statement$ebnf$4", "symbols": [], "postprocess": () => null},
817820
{"name": "select_statement$ebnf$5", "symbols": ["select_limit_offset"], "postprocess": id},
818821
{"name": "select_statement$ebnf$5", "symbols": [], "postprocess": () => null},
819-
{"name": "select_statement$ebnf$6", "symbols": ["select_for"], "postprocess": id},
822+
{"name": "select_statement$ebnf$6$subexpression$1$ebnf$1", "symbols": ["select_skip"], "postprocess": id},
823+
{"name": "select_statement$ebnf$6$subexpression$1$ebnf$1", "symbols": [], "postprocess": () => null},
824+
{"name": "select_statement$ebnf$6$subexpression$1", "symbols": ["select_for", "select_statement$ebnf$6$subexpression$1$ebnf$1"]},
825+
{"name": "select_statement$ebnf$6", "symbols": ["select_statement$ebnf$6$subexpression$1"], "postprocess": id},
820826
{"name": "select_statement$ebnf$6", "symbols": [], "postprocess": () => null},
821827
{"name": "select_statement", "symbols": ["select_what", "select_statement$ebnf$1", "select_statement$ebnf$2", "select_statement$ebnf$3", "select_statement$ebnf$4", "select_statement$ebnf$5", "select_statement$ebnf$6"], "postprocess": x => {
822-
let [what, from, where, _groupBy, orderBy, limit, selectFor] = x;
828+
let [what, from, where, _groupBy, orderBy, limit, _selectFor] = x;
823829
from = unwrap(from);
824830
let groupBy = _groupBy && _groupBy[0];
825831
let having = _groupBy && _groupBy[1];
826832
groupBy = groupBy && (groupBy.length === 1 && groupBy[0].type === 'list' ? groupBy[0].expressions : groupBy);
827833
having = having && unwrap(having);
834+
let selectFor = _selectFor && _selectFor[0];
835+
let skip = _selectFor && _selectFor[1];
836+
skip = unwrap(skip);
828837
return track(x, {
829838
...what,
830839
...from ? { from: Array.isArray(from) ? from : [from] } : {},
@@ -834,6 +843,7 @@ const grammar: Grammar = {
834843
...orderBy ? { orderBy } : {},
835844
...where ? { where } : {},
836845
...selectFor ? { for: selectFor[1] } : {},
846+
...skip ? { skip } : {},
837847
type: 'select',
838848
});
839849
} },
@@ -1018,6 +1028,9 @@ const grammar: Grammar = {
10181028
{"name": "select_for$subexpression$1", "symbols": ["kw_share"], "postprocess": x => track(x, {type: 'share'})},
10191029
{"name": "select_for$subexpression$1", "symbols": ["kw_key", "kw_share"], "postprocess": x => track(x, {type: 'key share'})},
10201030
{"name": "select_for", "symbols": [(lexerAny.has("kw_for") ? {type: "kw_for"} : kw_for), "select_for$subexpression$1"]},
1031+
{"name": "select_skip$subexpression$1", "symbols": ["kw_nowait"], "postprocess": x => track(x, {type: 'nowait'})},
1032+
{"name": "select_skip$subexpression$1", "symbols": ["kw_skip", "kw_locked"], "postprocess": x => track(x, {type: 'skip locked'})},
1033+
{"name": "select_skip", "symbols": ["select_skip$subexpression$1"]},
10211034
{"name": "select_order_by$subexpression$1", "symbols": [(lexerAny.has("kw_order") ? {type: "kw_order"} : kw_order), "kw_by"]},
10221035
{"name": "select_order_by$ebnf$1", "symbols": []},
10231036
{"name": "select_order_by$ebnf$1$subexpression$1", "symbols": ["comma", "select_order_by_expr"], "postprocess": last},

.deno/to-sql.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,6 +1356,9 @@ const visitor = astVisitor<IAstFullVisitor>(m => ({
13561356

13571357
if (s.for) {
13581358
ret.push('FOR ', s.for.type.toUpperCase());
1359+
if (s.skip) {
1360+
ret.push(' ', s.skip.type.toUpperCase());
1361+
}
13591362
}
13601363
},
13611364

0 commit comments

Comments
 (0)