@dbml/parse 3.1.1 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dbml-parse.js +5 -5
- package/dist/dbml-parse.mjs +238 -238
- package/package.json +2 -2
package/dist/dbml-parse.mjs
CHANGED
|
@@ -75,7 +75,7 @@ class Wt {
|
|
|
75
75
|
return this.id++;
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
class
|
|
78
|
+
class v {
|
|
79
79
|
// The symbol that this syntax node refers to
|
|
80
80
|
// args must be passed in order of appearance in the node
|
|
81
81
|
constructor(e, s, n) {
|
|
@@ -94,13 +94,13 @@ class w {
|
|
|
94
94
|
}, this.fullEnd = NaN), this.start = this.startPos.offset, this.end = this.endPos.offset;
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
var
|
|
98
|
-
class
|
|
97
|
+
var he = /* @__PURE__ */ ((t) => (t.PROGRAM = "<program>", t.ELEMENT_DECLARATION = "<element-declaration>", t.ATTRIBUTE = "<attribute>", t.IDENTIFIER_STREAM = "<identifer-stream>", t.LITERAL = "<literal>", t.VARIABLE = "<variable>", t.PREFIX_EXPRESSION = "<prefix-expression>", t.INFIX_EXPRESSION = "<infix-expression>", t.POSTFIX_EXPRESSION = "<postfix-expression>", t.FUNCTION_EXPRESSION = "<function-expression>", t.FUNCTION_APPLICATION = "<function-application>", t.BLOCK_EXPRESSION = "<block-expression>", t.LIST_EXPRESSION = "<list-expression>", t.TUPLE_EXPRESSION = "<tuple-expression>", t.CALL_EXPRESSION = "<call-expression>", t.PRIMARY_EXPRESSION = "<primary-expression>", t.GROUP_EXPRESSION = "<group-expression>", t.DUMMY = "<dummy>", t.ARRAY = "<array>", t))(he || {});
|
|
98
|
+
class X extends v {
|
|
99
99
|
constructor({ body: e = [], eof: s }, n) {
|
|
100
100
|
super(n, "<program>", [...e, s]), this.body = e, this.eof = s;
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
class _ extends
|
|
103
|
+
class _ extends v {
|
|
104
104
|
constructor({
|
|
105
105
|
type: e,
|
|
106
106
|
name: s,
|
|
@@ -123,12 +123,12 @@ class _ extends w {
|
|
|
123
123
|
this.type = e, this.name = s, this.as = n, this.alias = i, this.attributeList = r, this.bodyColon = a, this.body = l;
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
class te extends
|
|
126
|
+
class te extends v {
|
|
127
127
|
constructor({ identifiers: e = [] }, s) {
|
|
128
128
|
super(s, "<identifer-stream>", e || []), this.identifiers = e;
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
class ne extends
|
|
131
|
+
class ne extends v {
|
|
132
132
|
constructor({
|
|
133
133
|
name: e,
|
|
134
134
|
colon: s,
|
|
@@ -137,12 +137,12 @@ class ne extends w {
|
|
|
137
137
|
super(i, "<attribute>", [e, s, n]), this.name = e, this.value = n, this.colon = s;
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
-
class
|
|
140
|
+
class Q extends v {
|
|
141
141
|
constructor({ op: e, expression: s }, n) {
|
|
142
142
|
super(n, "<prefix-expression>", [e, s]), this.op = e, this.expression = s;
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
class
|
|
145
|
+
class q extends v {
|
|
146
146
|
constructor({
|
|
147
147
|
op: e,
|
|
148
148
|
leftExpression: s,
|
|
@@ -151,22 +151,22 @@ class z extends w {
|
|
|
151
151
|
super(i, "<infix-expression>", [s, e, n]), this.op = e, this.leftExpression = s, this.rightExpression = n;
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
-
class Oe extends
|
|
154
|
+
class Oe extends v {
|
|
155
155
|
constructor({ op: e, expression: s }, n) {
|
|
156
156
|
super(n, "<postfix-expression>", [s, e]), this.op = e, this.expression = s;
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
|
-
class
|
|
159
|
+
class K extends v {
|
|
160
160
|
constructor({ value: e }, s) {
|
|
161
161
|
super(s, "<function-expression>", [e]), this.value = e;
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
-
class y extends
|
|
164
|
+
class y extends v {
|
|
165
165
|
constructor({ callee: e, args: s = [] }, n) {
|
|
166
166
|
super(n, "<function-application>", [e, ...s]), this.callee = e, this.args = s;
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
class ee extends
|
|
169
|
+
class ee extends v {
|
|
170
170
|
constructor({
|
|
171
171
|
blockOpenBrace: e,
|
|
172
172
|
body: s = [],
|
|
@@ -175,7 +175,7 @@ class ee extends w {
|
|
|
175
175
|
super(i, "<block-expression>", [e, ...s, n]), this.blockOpenBrace = e, this.body = s, this.blockCloseBrace = n;
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
|
-
class U extends
|
|
178
|
+
class U extends v {
|
|
179
179
|
constructor({
|
|
180
180
|
listOpenBracket: e,
|
|
181
181
|
elementList: s = [],
|
|
@@ -189,7 +189,7 @@ class U extends w {
|
|
|
189
189
|
]), this.listOpenBracket = e, this.elementList = s, this.commaList = n, this.listCloseBracket = i;
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
|
-
class
|
|
192
|
+
class J extends v {
|
|
193
193
|
constructor({
|
|
194
194
|
tupleOpenParen: e,
|
|
195
195
|
elementList: s = [],
|
|
@@ -203,7 +203,7 @@ class q extends w {
|
|
|
203
203
|
]), this.tupleOpenParen = e, this.elementList = s, this.commaList = n, this.tupleCloseParen = i;
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
|
-
class Xe extends
|
|
206
|
+
class Xe extends J {
|
|
207
207
|
constructor({
|
|
208
208
|
groupOpenParen: e,
|
|
209
209
|
expression: s,
|
|
@@ -220,7 +220,7 @@ class Xe extends q {
|
|
|
220
220
|
), this.kind = "<group-expression>";
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
|
-
class
|
|
223
|
+
class H extends v {
|
|
224
224
|
constructor({
|
|
225
225
|
callee: e,
|
|
226
226
|
argumentList: s
|
|
@@ -228,28 +228,28 @@ class Q extends w {
|
|
|
228
228
|
super(n, "<call-expression>", [e, s]), this.callee = e, this.argumentList = s;
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
|
-
class
|
|
231
|
+
class de extends v {
|
|
232
232
|
constructor({ literal: e }, s) {
|
|
233
233
|
super(s, "<literal>", [e]), this.literal = e;
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
|
-
class
|
|
236
|
+
class $ extends v {
|
|
237
237
|
constructor({ variable: e }, s) {
|
|
238
238
|
super(s, "<variable>", [e]), this.variable = e;
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
|
-
class D extends
|
|
241
|
+
class D extends v {
|
|
242
242
|
constructor({ expression: e }, s) {
|
|
243
243
|
super(s, "<primary-expression>", [e]), this.expression = e;
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
|
-
class
|
|
246
|
+
class we extends v {
|
|
247
247
|
constructor({ pre: e }, s) {
|
|
248
248
|
const n = V.create(c.SPACE, e.endPos, e.endPos, " ", !1);
|
|
249
249
|
super(s, "<dummy>", [n]);
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
|
-
class
|
|
252
|
+
class fe extends v {
|
|
253
253
|
constructor({ expression: e, indexer: s }, n) {
|
|
254
254
|
super(n, "<array>", [e, s]), this.array = e, this.indexer = s;
|
|
255
255
|
}
|
|
@@ -269,7 +269,7 @@ function ss(t, e = !1) {
|
|
|
269
269
|
t,
|
|
270
270
|
function(s, n) {
|
|
271
271
|
var i;
|
|
272
|
-
return !(this instanceof
|
|
272
|
+
return !(this instanceof X) && s === "symbol" ? n == null ? void 0 : n.id : (
|
|
273
273
|
/* this instanceof SyntaxNode && */
|
|
274
274
|
s === "symbol" ? {
|
|
275
275
|
symbolTable: n == null ? void 0 : n.symbolTable,
|
|
@@ -413,7 +413,7 @@ function zt(t) {
|
|
|
413
413
|
const [e] = t;
|
|
414
414
|
return xe(e) || qe(e) && e.toLowerCase() >= "a" && e.toLowerCase() <= "f";
|
|
415
415
|
}
|
|
416
|
-
function
|
|
416
|
+
function Te(t) {
|
|
417
417
|
return qe(t) || xe(t);
|
|
418
418
|
}
|
|
419
419
|
function lt(t, e) {
|
|
@@ -422,7 +422,7 @@ function lt(t, e) {
|
|
|
422
422
|
s.push(t[i], e[i]);
|
|
423
423
|
return s.push(...t.slice(n), ...e.slice(n)), s;
|
|
424
424
|
}
|
|
425
|
-
function
|
|
425
|
+
function be(t, e) {
|
|
426
426
|
return t >= e.start && t < e.end;
|
|
427
427
|
}
|
|
428
428
|
class Qt {
|
|
@@ -496,7 +496,7 @@ class B {
|
|
|
496
496
|
}
|
|
497
497
|
}
|
|
498
498
|
function en(t, e, s) {
|
|
499
|
-
if (!t || !
|
|
499
|
+
if (!t || !pe(t) || e.length === 0)
|
|
500
500
|
return new A();
|
|
501
501
|
const n = [...e], i = Be(t).unwrap(), r = n.pop();
|
|
502
502
|
if (!(r instanceof ee))
|
|
@@ -542,9 +542,9 @@ function nn(t) {
|
|
|
542
542
|
t.identifiers.forEach(E);
|
|
543
543
|
else if (t instanceof ne)
|
|
544
544
|
E(t.name), E(t.colon), E(t.value);
|
|
545
|
-
else if (t instanceof
|
|
545
|
+
else if (t instanceof Q)
|
|
546
546
|
E(t.op), E(t.expression);
|
|
547
|
-
else if (t instanceof
|
|
547
|
+
else if (t instanceof q)
|
|
548
548
|
E(t.leftExpression), E(t.op), E(t.rightExpression);
|
|
549
549
|
else if (t instanceof Oe)
|
|
550
550
|
E(t.op), E(t.expression);
|
|
@@ -552,31 +552,31 @@ function nn(t) {
|
|
|
552
552
|
E(t.blockOpenBrace), t.body.forEach(E), E(t.blockCloseBrace);
|
|
553
553
|
else if (t instanceof U)
|
|
554
554
|
E(t.listOpenBracket), t.commaList.forEach(E), t.elementList.forEach(E), E(t.listCloseBracket);
|
|
555
|
-
else if (t instanceof
|
|
555
|
+
else if (t instanceof J)
|
|
556
556
|
E(t.tupleOpenParen), t.commaList.forEach(E), t.elementList.forEach(E), E(t.tupleCloseParen);
|
|
557
|
-
else if (t instanceof
|
|
557
|
+
else if (t instanceof H)
|
|
558
558
|
E(t.callee), E(t.argumentList);
|
|
559
559
|
else if (t instanceof y)
|
|
560
560
|
E(t.callee), t.args.forEach(E);
|
|
561
561
|
else if (t instanceof D)
|
|
562
562
|
E(t.expression);
|
|
563
|
-
else if (t instanceof
|
|
563
|
+
else if (t instanceof K)
|
|
564
564
|
E(t.value);
|
|
565
|
-
else if (t instanceof
|
|
565
|
+
else if (t instanceof $)
|
|
566
566
|
E(t.variable);
|
|
567
|
-
else if (t instanceof
|
|
567
|
+
else if (t instanceof de)
|
|
568
568
|
E(t.literal);
|
|
569
569
|
else
|
|
570
570
|
throw t instanceof Xe ? new Error("This case is handled by the TupleExpressionNode case") : new Error("Unreachable case in markInvalidNode");
|
|
571
571
|
}
|
|
572
|
-
function
|
|
572
|
+
function wt(t) {
|
|
573
573
|
return !!(t != null && t.isInvalid);
|
|
574
574
|
}
|
|
575
575
|
function P(...t) {
|
|
576
576
|
return t.filter((e) => e !== void 0);
|
|
577
577
|
}
|
|
578
578
|
function sn(t) {
|
|
579
|
-
if (t instanceof
|
|
579
|
+
if (t instanceof X)
|
|
580
580
|
return P(...t.body, t.eof);
|
|
581
581
|
if (t instanceof _)
|
|
582
582
|
return P(
|
|
@@ -592,17 +592,17 @@ function sn(t) {
|
|
|
592
592
|
return P(t.name, t.colon, t.value);
|
|
593
593
|
if (t instanceof te)
|
|
594
594
|
return t.identifiers;
|
|
595
|
-
if (t instanceof
|
|
595
|
+
if (t instanceof de)
|
|
596
596
|
return t.literal ? [t.literal] : [];
|
|
597
|
-
if (t instanceof
|
|
597
|
+
if (t instanceof $)
|
|
598
598
|
return P(t.variable);
|
|
599
|
-
if (t instanceof
|
|
599
|
+
if (t instanceof Q)
|
|
600
600
|
return P(t.op, t.expression);
|
|
601
|
-
if (t instanceof
|
|
601
|
+
if (t instanceof q)
|
|
602
602
|
return P(t.leftExpression, t.op, t.rightExpression);
|
|
603
603
|
if (t instanceof Oe)
|
|
604
604
|
return P(t.expression, t.op);
|
|
605
|
-
if (t instanceof
|
|
605
|
+
if (t instanceof K)
|
|
606
606
|
return P(t.value);
|
|
607
607
|
if (t instanceof y)
|
|
608
608
|
return P(t.callee, ...t.args);
|
|
@@ -614,13 +614,13 @@ function sn(t) {
|
|
|
614
614
|
...lt(t.elementList, t.commaList),
|
|
615
615
|
t.listCloseBracket
|
|
616
616
|
);
|
|
617
|
-
if (t instanceof
|
|
617
|
+
if (t instanceof J)
|
|
618
618
|
return P(
|
|
619
619
|
t.tupleOpenParen,
|
|
620
620
|
...lt(t.elementList, t.commaList),
|
|
621
621
|
t.tupleCloseParen
|
|
622
622
|
);
|
|
623
|
-
if (t instanceof
|
|
623
|
+
if (t instanceof H)
|
|
624
624
|
return P(t.callee, t.argumentList);
|
|
625
625
|
if (t instanceof D)
|
|
626
626
|
return P(t.expression);
|
|
@@ -629,20 +629,20 @@ function sn(t) {
|
|
|
629
629
|
function Be(t) {
|
|
630
630
|
return M(t) ? new k(t.expression.variable) : new A();
|
|
631
631
|
}
|
|
632
|
-
function
|
|
632
|
+
function W(t) {
|
|
633
633
|
var e;
|
|
634
|
-
return t instanceof D && (t.expression instanceof
|
|
634
|
+
return t instanceof D && (t.expression instanceof $ && t.expression.variable instanceof V && t.expression.variable.kind === c.QUOTED_STRING || t.expression instanceof de && ((e = t.expression.literal) == null ? void 0 : e.kind) === c.STRING_LITERAL);
|
|
635
635
|
}
|
|
636
636
|
function M(t) {
|
|
637
|
-
return t instanceof D && t.expression instanceof
|
|
637
|
+
return t instanceof D && t.expression instanceof $ && t.expression.variable instanceof V;
|
|
638
638
|
}
|
|
639
|
-
function
|
|
639
|
+
function pe(t) {
|
|
640
640
|
var e;
|
|
641
|
-
return t instanceof D && t.expression instanceof
|
|
641
|
+
return t instanceof D && t.expression instanceof $ && ((e = t.expression.variable) == null ? void 0 : e.kind) === c.IDENTIFIER;
|
|
642
642
|
}
|
|
643
643
|
function He(t) {
|
|
644
644
|
var e;
|
|
645
|
-
return t instanceof
|
|
645
|
+
return t instanceof q && t.leftExpression instanceof v && t.rightExpression instanceof v && ((e = t.op) == null ? void 0 : e.value) === ".";
|
|
646
646
|
}
|
|
647
647
|
function De(t) {
|
|
648
648
|
if (t === void 0)
|
|
@@ -794,7 +794,7 @@ class rn {
|
|
|
794
794
|
gatherInvalid() {
|
|
795
795
|
let e;
|
|
796
796
|
const s = [], n = [];
|
|
797
|
-
for (e = 0; e < this.tokens.length &&
|
|
797
|
+
for (e = 0; e < this.tokens.length && wt(this.tokens[e]); e += 1)
|
|
798
798
|
n.push(this.tokens[e]);
|
|
799
799
|
let i = this.tokens[e];
|
|
800
800
|
for (i.leadingInvalid = [...n, ...i.leadingInvalid]; e < this.tokens.length; e += 1) {
|
|
@@ -883,7 +883,7 @@ class rn {
|
|
|
883
883
|
});
|
|
884
884
|
}
|
|
885
885
|
identifier() {
|
|
886
|
-
for (; !this.isAtEnd() &&
|
|
886
|
+
for (; !this.isAtEnd() && Te(this.peek()); )
|
|
887
887
|
this.advance();
|
|
888
888
|
this.addToken(c.IDENTIFIER);
|
|
889
889
|
}
|
|
@@ -902,19 +902,19 @@ class rn {
|
|
|
902
902
|
break;
|
|
903
903
|
if (!n && this.current.offset === this.text.length - 1)
|
|
904
904
|
return this.advance(), this.addToken(c.NUMERIC_LITERAL);
|
|
905
|
-
if (!n && !
|
|
905
|
+
if (!n && !Te(this.peek()))
|
|
906
906
|
return this.addToken(c.NUMERIC_LITERAL);
|
|
907
907
|
if (!n && !xe(this.peek()))
|
|
908
908
|
break;
|
|
909
909
|
this.advance();
|
|
910
910
|
}
|
|
911
|
-
for (; !this.isAtEnd() && (this.check(".") ||
|
|
911
|
+
for (; !this.isAtEnd() && (this.check(".") || Te(this.peek())); )
|
|
912
912
|
this.advance();
|
|
913
913
|
const s = this.createToken(c.NUMERIC_LITERAL, !0);
|
|
914
914
|
this.tokens.push(s), this.errors.push(new u(o.UNKNOWN_TOKEN, "Invalid number", s));
|
|
915
915
|
}
|
|
916
916
|
colorLiteral() {
|
|
917
|
-
for (; !this.isAtEnd() &&
|
|
917
|
+
for (; !this.isAtEnd() && Te(this.peek()); )
|
|
918
918
|
this.advance();
|
|
919
919
|
this.addToken(c.COLOR_LITERAL);
|
|
920
920
|
}
|
|
@@ -946,7 +946,7 @@ class rn {
|
|
|
946
946
|
case "u": {
|
|
947
947
|
let e = "";
|
|
948
948
|
for (let s = 0; s <= 3; s += 1) {
|
|
949
|
-
if (this.isAtEnd() || !
|
|
949
|
+
if (this.isAtEnd() || !Te(this.peek()))
|
|
950
950
|
return `\\u${e}`;
|
|
951
951
|
e += this.advance();
|
|
952
952
|
}
|
|
@@ -957,7 +957,7 @@ class rn {
|
|
|
957
957
|
}
|
|
958
958
|
}
|
|
959
959
|
}
|
|
960
|
-
var
|
|
960
|
+
var ve = /* @__PURE__ */ ((t) => (t[t.ListExpression = 0] = "ListExpression", t[t.GroupExpression = 1] = "GroupExpression", t[t.BlockExpression = 2] = "BlockExpression", t))(ve || {});
|
|
961
961
|
class an {
|
|
962
962
|
constructor() {
|
|
963
963
|
this.stack = [], this.numberOfNestedLParens = 0, this.numberOfNestedLBrackets = 0, this.numberOfNestedLBraces = 0;
|
|
@@ -1056,7 +1056,7 @@ class ln {
|
|
|
1056
1056
|
break;
|
|
1057
1057
|
E(n), this.advance();
|
|
1058
1058
|
}
|
|
1059
|
-
}, this.blockExpression = this.contextStack.withContextDo(
|
|
1059
|
+
}, this.blockExpression = this.contextStack.withContextDo(ve.BlockExpression, () => {
|
|
1060
1060
|
const n = { body: [] }, i = () => this.nodeFactory.create(ee, n);
|
|
1061
1061
|
try {
|
|
1062
1062
|
this.consume("Expect an opening brace '{'", c.LBRACE), n.blockOpenBrace = this.previous();
|
|
@@ -1095,12 +1095,12 @@ class ln {
|
|
|
1095
1095
|
break;
|
|
1096
1096
|
E(n), this.advance();
|
|
1097
1097
|
}
|
|
1098
|
-
}, this.tupleExpression = this.contextStack.withContextDo(
|
|
1098
|
+
}, this.tupleExpression = this.contextStack.withContextDo(ve.GroupExpression, () => {
|
|
1099
1099
|
const n = { elementList: [], commaList: [] }, i = () => this.nodeFactory.create(Xe, {
|
|
1100
1100
|
groupOpenParen: n.tupleOpenParen,
|
|
1101
1101
|
groupCloseParen: n.tupleCloseParen,
|
|
1102
1102
|
expression: n.elementList[0]
|
|
1103
|
-
}), r = () => this.nodeFactory.create(
|
|
1103
|
+
}), r = () => this.nodeFactory.create(J, n);
|
|
1104
1104
|
try {
|
|
1105
1105
|
this.consume("Expect an opening parenthesis '('", c.LPAREN), n.tupleOpenParen = this.previous();
|
|
1106
1106
|
} catch (a) {
|
|
@@ -1126,7 +1126,7 @@ class ln {
|
|
|
1126
1126
|
} catch (a) {
|
|
1127
1127
|
if (!(a instanceof d))
|
|
1128
1128
|
throw a;
|
|
1129
|
-
if (a.partialNode instanceof
|
|
1129
|
+
if (a.partialNode instanceof v && n.elementList.push(a.partialNode), !this.canHandle(a))
|
|
1130
1130
|
throw new d(a.token, r(), a.handlerContext);
|
|
1131
1131
|
this.synchronizeTuple();
|
|
1132
1132
|
}
|
|
@@ -1147,7 +1147,7 @@ class ln {
|
|
|
1147
1147
|
break;
|
|
1148
1148
|
E(n), this.advance();
|
|
1149
1149
|
}
|
|
1150
|
-
}, this.listExpression = this.contextStack.withContextDo(
|
|
1150
|
+
}, this.listExpression = this.contextStack.withContextDo(ve.ListExpression, () => {
|
|
1151
1151
|
const n = { elementList: [], commaList: [] }, i = () => this.nodeFactory.create(U, n);
|
|
1152
1152
|
try {
|
|
1153
1153
|
this.consume("Expect an opening bracket '['", c.LBRACKET), n.listOpenBracket = this.previous();
|
|
@@ -1174,7 +1174,7 @@ class ln {
|
|
|
1174
1174
|
} catch (r) {
|
|
1175
1175
|
if (!(r instanceof d))
|
|
1176
1176
|
throw r;
|
|
1177
|
-
if (r.partialNode instanceof
|
|
1177
|
+
if (r.partialNode instanceof v && n.elementList.push(r.partialNode), !this.canHandle(r))
|
|
1178
1178
|
throw new d(r.token, i(), r.handlerContext);
|
|
1179
1179
|
this.synchronizeList();
|
|
1180
1180
|
}
|
|
@@ -1265,7 +1265,7 @@ class ln {
|
|
|
1265
1265
|
this.tokens = e;
|
|
1266
1266
|
}
|
|
1267
1267
|
parse() {
|
|
1268
|
-
const e = this.program(), s = this.advance(), n = this.nodeFactory.create(
|
|
1268
|
+
const e = this.program(), s = this.advance(), n = this.nodeFactory.create(X, { body: e, eof: s });
|
|
1269
1269
|
return this.gatherInvalid(), new B({ ast: n, tokens: this.tokens }, this.errors);
|
|
1270
1270
|
}
|
|
1271
1271
|
/* Parsing and synchronizing ProgramNode */
|
|
@@ -1408,12 +1408,12 @@ class ln {
|
|
|
1408
1408
|
ot(this.previous(), n) && !this.contextStack.isWithinGroupExpressionContext() && !this.contextStack.isWithinListExpressionContext())
|
|
1409
1409
|
break;
|
|
1410
1410
|
try {
|
|
1411
|
-
s = this.nodeFactory.create(
|
|
1411
|
+
s = this.nodeFactory.create(H, {
|
|
1412
1412
|
callee: s,
|
|
1413
1413
|
argumentList: this.tupleExpression()
|
|
1414
1414
|
});
|
|
1415
1415
|
} catch (r) {
|
|
1416
|
-
throw r instanceof d ? (s = this.nodeFactory.create(
|
|
1416
|
+
throw r instanceof d ? (s = this.nodeFactory.create(H, {
|
|
1417
1417
|
callee: s,
|
|
1418
1418
|
argumentList: r.partialNode
|
|
1419
1419
|
}), new d(r.token, s, r.handlerContext)) : r;
|
|
@@ -1422,12 +1422,12 @@ class ln {
|
|
|
1422
1422
|
if (Ve(this.previous()))
|
|
1423
1423
|
break;
|
|
1424
1424
|
try {
|
|
1425
|
-
s = this.nodeFactory.create(
|
|
1425
|
+
s = this.nodeFactory.create(fe, {
|
|
1426
1426
|
expression: s,
|
|
1427
1427
|
indexer: this.listExpression()
|
|
1428
1428
|
});
|
|
1429
1429
|
} catch (i) {
|
|
1430
|
-
throw i instanceof d ? (s = this.nodeFactory.create(
|
|
1430
|
+
throw i instanceof d ? (s = this.nodeFactory.create(fe, {
|
|
1431
1431
|
expression: s,
|
|
1432
1432
|
indexer: i.partialNode
|
|
1433
1433
|
}), new d(i.token, s, i.handlerContext)) : i;
|
|
@@ -1447,13 +1447,13 @@ class ln {
|
|
|
1447
1447
|
break;
|
|
1448
1448
|
this.advance();
|
|
1449
1449
|
try {
|
|
1450
|
-
s = this.nodeFactory.create(
|
|
1450
|
+
s = this.nodeFactory.create(q, {
|
|
1451
1451
|
leftExpression: s,
|
|
1452
1452
|
op: i,
|
|
1453
1453
|
rightExpression: i.value === "." ? this.extractOperand() : this.expression_bp(a.right)
|
|
1454
1454
|
});
|
|
1455
1455
|
} catch (l) {
|
|
1456
|
-
throw l instanceof d ? (s = this.nodeFactory.create(
|
|
1456
|
+
throw l instanceof d ? (s = this.nodeFactory.create(q, {
|
|
1457
1457
|
leftExpression: s,
|
|
1458
1458
|
op: i,
|
|
1459
1459
|
rightExpression: l.partialNode
|
|
@@ -1478,7 +1478,7 @@ class ln {
|
|
|
1478
1478
|
`Unexpected '${s.op.value}' in an expression`
|
|
1479
1479
|
), new d(
|
|
1480
1480
|
s.op,
|
|
1481
|
-
this.nodeFactory.create(
|
|
1481
|
+
this.nodeFactory.create(we, { pre: s.op }),
|
|
1482
1482
|
this.contextStack.findHandlerContext(this.tokens, this.current)
|
|
1483
1483
|
);
|
|
1484
1484
|
this.advance();
|
|
@@ -1487,15 +1487,15 @@ class ln {
|
|
|
1487
1487
|
} catch (i) {
|
|
1488
1488
|
throw i instanceof d ? (s.expression = i.partialNode, new d(
|
|
1489
1489
|
i.token,
|
|
1490
|
-
this.nodeFactory.create(
|
|
1490
|
+
this.nodeFactory.create(Q, s),
|
|
1491
1491
|
i.handlerContext
|
|
1492
1492
|
)) : i;
|
|
1493
1493
|
}
|
|
1494
|
-
e = this.nodeFactory.create(
|
|
1495
|
-
} else if (e = this.extractOperand(), e instanceof
|
|
1494
|
+
e = this.nodeFactory.create(Q, s);
|
|
1495
|
+
} else if (e = this.extractOperand(), e instanceof we)
|
|
1496
1496
|
throw new d(
|
|
1497
1497
|
this.peek(),
|
|
1498
|
-
this.nodeFactory.create(
|
|
1498
|
+
this.nodeFactory.create(we, { pre: this.peek() }),
|
|
1499
1499
|
this.contextStack.findHandlerContext(this.tokens, this.current)
|
|
1500
1500
|
);
|
|
1501
1501
|
return e;
|
|
@@ -1519,7 +1519,7 @@ class ln {
|
|
|
1519
1519
|
this.peek(),
|
|
1520
1520
|
o.INVALID_OPERAND,
|
|
1521
1521
|
`Invalid start of operand "${this.peek().value}"`
|
|
1522
|
-
), this.nodeFactory.create(
|
|
1522
|
+
), this.nodeFactory.create(we, { pre: this.previous() }));
|
|
1523
1523
|
}
|
|
1524
1524
|
/* Parsing FunctionExpression */
|
|
1525
1525
|
functionExpression() {
|
|
@@ -1529,11 +1529,11 @@ class ln {
|
|
|
1529
1529
|
} catch (s) {
|
|
1530
1530
|
throw s instanceof d ? (e.value = s.partialNode, new d(
|
|
1531
1531
|
s.token,
|
|
1532
|
-
this.nodeFactory.create(
|
|
1532
|
+
this.nodeFactory.create(K, e),
|
|
1533
1533
|
s.handlerContext
|
|
1534
1534
|
)) : s;
|
|
1535
1535
|
}
|
|
1536
|
-
return this.nodeFactory.create(
|
|
1536
|
+
return this.nodeFactory.create(K, e);
|
|
1537
1537
|
}
|
|
1538
1538
|
canBeField() {
|
|
1539
1539
|
return this.peek().kind === c.IDENTIFIER && this.peek(1).kind === c.COLON;
|
|
@@ -1546,16 +1546,16 @@ class ln {
|
|
|
1546
1546
|
c.NUMERIC_LITERAL
|
|
1547
1547
|
))
|
|
1548
1548
|
return this.nodeFactory.create(D, {
|
|
1549
|
-
expression: this.nodeFactory.create(
|
|
1549
|
+
expression: this.nodeFactory.create(de, { literal: this.previous() })
|
|
1550
1550
|
});
|
|
1551
1551
|
if (this.match(c.QUOTED_STRING, c.IDENTIFIER))
|
|
1552
1552
|
return this.nodeFactory.create(D, {
|
|
1553
|
-
expression: this.nodeFactory.create(
|
|
1553
|
+
expression: this.nodeFactory.create($, { variable: this.previous() })
|
|
1554
1554
|
});
|
|
1555
1555
|
throw this.logError(this.peek(), o.UNEXPECTED_TOKEN, "Expect a variable or literal"), new d(
|
|
1556
1556
|
this.peek(),
|
|
1557
1557
|
this.nodeFactory.create(D, {
|
|
1558
|
-
expression: this.nodeFactory.create(
|
|
1558
|
+
expression: this.nodeFactory.create($, {})
|
|
1559
1559
|
}),
|
|
1560
1560
|
this.contextStack.findHandlerContext(this.tokens, this.current)
|
|
1561
1561
|
);
|
|
@@ -1653,7 +1653,7 @@ function ut(t) {
|
|
|
1653
1653
|
return pn[t.value] || { left: null, right: null };
|
|
1654
1654
|
}
|
|
1655
1655
|
var I = /* @__PURE__ */ ((t) => (t.Table = "table", t.Enum = "enum", t.Ref = "ref", t.Note = "note", t.Project = "project", t.Indexes = "indexes", t.TableGroup = "tablegroup", t))(I || {});
|
|
1656
|
-
function
|
|
1656
|
+
function Ee(t) {
|
|
1657
1657
|
var s;
|
|
1658
1658
|
const e = (s = t == null ? void 0 : t.type) == null ? void 0 : s.value.toLowerCase();
|
|
1659
1659
|
switch (e) {
|
|
@@ -1669,21 +1669,21 @@ function de(t) {
|
|
|
1669
1669
|
return new A();
|
|
1670
1670
|
}
|
|
1671
1671
|
}
|
|
1672
|
-
function
|
|
1672
|
+
function Ne(t) {
|
|
1673
1673
|
if (!He(t))
|
|
1674
1674
|
return new k([t]);
|
|
1675
|
-
const e =
|
|
1675
|
+
const e = Ne(t.leftExpression).unwrap_or(void 0);
|
|
1676
1676
|
return e ? (e.push(t.rightExpression), new k(e)) : new A();
|
|
1677
1677
|
}
|
|
1678
|
-
function
|
|
1678
|
+
function j(t) {
|
|
1679
1679
|
if (t === void 0)
|
|
1680
1680
|
return new A();
|
|
1681
|
-
const e =
|
|
1681
|
+
const e = Ne(t).unwrap_or(void 0);
|
|
1682
1682
|
if (!e)
|
|
1683
1683
|
return new A();
|
|
1684
1684
|
const s = [];
|
|
1685
1685
|
for (const n of e) {
|
|
1686
|
-
const i =
|
|
1686
|
+
const i = C(n).unwrap_or(void 0);
|
|
1687
1687
|
if (!i)
|
|
1688
1688
|
return new A();
|
|
1689
1689
|
s.push(i);
|
|
@@ -1693,7 +1693,7 @@ function $(t) {
|
|
|
1693
1693
|
function Ie(t) {
|
|
1694
1694
|
if (t === void 0)
|
|
1695
1695
|
return new A();
|
|
1696
|
-
const e =
|
|
1696
|
+
const e = Ne(t).unwrap_or(void 0);
|
|
1697
1697
|
if (!e || e.length === 0)
|
|
1698
1698
|
return new A();
|
|
1699
1699
|
const s = [];
|
|
@@ -1708,7 +1708,7 @@ function Ie(t) {
|
|
|
1708
1708
|
return new A();
|
|
1709
1709
|
}
|
|
1710
1710
|
for (const i of e) {
|
|
1711
|
-
const r =
|
|
1711
|
+
const r = C(i).unwrap_or(void 0);
|
|
1712
1712
|
if (!r)
|
|
1713
1713
|
return new A();
|
|
1714
1714
|
s.push(r);
|
|
@@ -1718,15 +1718,15 @@ function Ie(t) {
|
|
|
1718
1718
|
tupleElements: n
|
|
1719
1719
|
});
|
|
1720
1720
|
}
|
|
1721
|
-
function
|
|
1721
|
+
function C(t) {
|
|
1722
1722
|
return M(t) ? new k(t.expression.variable.value) : new A();
|
|
1723
1723
|
}
|
|
1724
1724
|
function Ge(t) {
|
|
1725
1725
|
if (ht(t))
|
|
1726
|
-
return t instanceof
|
|
1727
|
-
if (t instanceof
|
|
1726
|
+
return t instanceof K ? new k({ functional: [t], nonFunctional: [] }) : new k({ functional: [], nonFunctional: [t] });
|
|
1727
|
+
if (t instanceof J && t.elementList.every(ht)) {
|
|
1728
1728
|
const e = t.elementList.filter(
|
|
1729
|
-
(n) => n instanceof
|
|
1729
|
+
(n) => n instanceof K
|
|
1730
1730
|
), s = t.elementList.filter(M);
|
|
1731
1731
|
return new k({ functional: e, nonFunctional: s });
|
|
1732
1732
|
}
|
|
@@ -1737,12 +1737,12 @@ function G(t) {
|
|
|
1737
1737
|
const e = (s = t == null ? void 0 : t.expression.variable) == null ? void 0 : s.value;
|
|
1738
1738
|
return e === void 0 ? new A() : new k(e);
|
|
1739
1739
|
}
|
|
1740
|
-
function
|
|
1741
|
-
return
|
|
1740
|
+
function Y(t) {
|
|
1741
|
+
return W(t) ? t.expression instanceof $ ? new k(t.expression.variable.value) : new k(t.expression.literal.value) : new A();
|
|
1742
1742
|
}
|
|
1743
1743
|
function dn(t) {
|
|
1744
1744
|
var e;
|
|
1745
|
-
return !(t instanceof
|
|
1745
|
+
return !(t instanceof q) || !yt((e = t.op) == null ? void 0 : e.value) ? !1 : Ie(t.leftExpression).and_then(() => Ie(t.rightExpression)).unwrap_or(void 0) !== void 0;
|
|
1746
1746
|
}
|
|
1747
1747
|
function En(t) {
|
|
1748
1748
|
const e = Ie(t.leftExpression), s = Ie(t.rightExpression);
|
|
@@ -1752,7 +1752,7 @@ function En(t) {
|
|
|
1752
1752
|
return (n == null ? void 0 : n.length) === (i == null ? void 0 : i.length);
|
|
1753
1753
|
}
|
|
1754
1754
|
function ht(t) {
|
|
1755
|
-
return t instanceof D && t.expression instanceof
|
|
1755
|
+
return t instanceof D && t.expression instanceof $ || t instanceof K;
|
|
1756
1756
|
}
|
|
1757
1757
|
function Nn(t, e) {
|
|
1758
1758
|
var i, r, a, l;
|
|
@@ -1761,9 +1761,9 @@ function Nn(t, e) {
|
|
|
1761
1761
|
for (; s; ) {
|
|
1762
1762
|
if ((r = (i = s.symbol) == null ? void 0 : i.symbolTable) != null && r.has(t))
|
|
1763
1763
|
return (a = s.symbol.symbolTable) == null ? void 0 : a.get(t);
|
|
1764
|
-
if (((l = s.symbol) == null ? void 0 : l.declaration) instanceof
|
|
1764
|
+
if (((l = s.symbol) == null ? void 0 : l.declaration) instanceof X && n)
|
|
1765
1765
|
return s.symbol;
|
|
1766
|
-
if (s instanceof
|
|
1766
|
+
if (s instanceof X)
|
|
1767
1767
|
return;
|
|
1768
1768
|
s = s.parent;
|
|
1769
1769
|
}
|
|
@@ -1776,7 +1776,7 @@ class mn {
|
|
|
1776
1776
|
return [...this.validateContext(), ...this.validateName(this.declarationNode.name), ...this.validateAlias(this.declarationNode.alias), ...this.validateSettingList(this.declarationNode.attributeList), ...this.validateBody(this.declarationNode.body)];
|
|
1777
1777
|
}
|
|
1778
1778
|
validateContext() {
|
|
1779
|
-
return this.declarationNode.parent instanceof
|
|
1779
|
+
return this.declarationNode.parent instanceof X || Ee(this.declarationNode.parent).unwrap_or(void 0) !== I.Project ? [new u(o.INVALID_CUSTOM_CONTEXT, "A custom element can only appear in a Project", this.declarationNode)] : [];
|
|
1780
1780
|
}
|
|
1781
1781
|
validateName(e) {
|
|
1782
1782
|
return e ? [new u(o.UNEXPECTED_NAME, "A Custom element shouldn't have a name", e)] : [];
|
|
@@ -1793,7 +1793,7 @@ class mn {
|
|
|
1793
1793
|
if (e instanceof ee)
|
|
1794
1794
|
return [new u(o.UNEXPECTED_COMPLEX_BODY, "A Custom element can only have an inline field", e)];
|
|
1795
1795
|
const s = [];
|
|
1796
|
-
return
|
|
1796
|
+
return W(e.callee) || s.push(new u(o.INVALID_CUSTOM_ELEMENT_VALUE, "A Custom element value can only be a string", e)), e.args.length > 0 && s.push(...e.args.map((n) => new u(o.INVALID_CUSTOM_ELEMENT_VALUE, "A Custom element value can only be a string", n))), s;
|
|
1797
1797
|
}
|
|
1798
1798
|
}
|
|
1799
1799
|
class ge {
|
|
@@ -1832,7 +1832,7 @@ class Tn {
|
|
|
1832
1832
|
registerElement() {
|
|
1833
1833
|
const e = [];
|
|
1834
1834
|
this.declarationNode.symbol = this.symbolFactory.create(qt, { declaration: this.declarationNode, symbolTable: new ge() });
|
|
1835
|
-
const { name: s } = this.declarationNode, n =
|
|
1835
|
+
const { name: s } = this.declarationNode, n = j(s);
|
|
1836
1836
|
if (n.isOk()) {
|
|
1837
1837
|
const i = n.unwrap(), r = i.pop(), a = Ze(i, this.publicSymbolTable, this.symbolFactory), l = je(r);
|
|
1838
1838
|
a.has(l) && e.push(new u(o.DUPLICATE_NAME, `Enum name ${r} already exists in schema '${i.join(".") || "public"}'`, s)), a.set(l, this.declarationNode.symbol);
|
|
@@ -1857,13 +1857,13 @@ class Tn {
|
|
|
1857
1857
|
});
|
|
1858
1858
|
}
|
|
1859
1859
|
validateFieldSetting(e) {
|
|
1860
|
-
const s =
|
|
1860
|
+
const s = z(e), n = s.getErrors(), i = s.getValue();
|
|
1861
1861
|
for (const r in i) {
|
|
1862
1862
|
const a = i[r];
|
|
1863
1863
|
switch (r) {
|
|
1864
1864
|
case "note":
|
|
1865
1865
|
a.length > 1 && a.forEach((l) => n.push(new u(o.DUPLICATE_ENUM_ELEMENT_SETTING, "'note' can only appear once", l))), a.forEach((l) => {
|
|
1866
|
-
|
|
1866
|
+
W(l.value) || n.push(new u(o.INVALID_ENUM_ELEMENT_SETTING, "'note' must be a string", l));
|
|
1867
1867
|
});
|
|
1868
1868
|
break;
|
|
1869
1869
|
default:
|
|
@@ -1905,7 +1905,7 @@ class bn {
|
|
|
1905
1905
|
return [...this.validateContext(), ...this.validateName(this.declarationNode.name), ...this.validateAlias(this.declarationNode.alias), ...this.validateSettingList(this.declarationNode.attributeList), ...this.validateBody(this.declarationNode.body)];
|
|
1906
1906
|
}
|
|
1907
1907
|
validateContext() {
|
|
1908
|
-
return this.declarationNode.parent instanceof
|
|
1908
|
+
return this.declarationNode.parent instanceof X || Ee(this.declarationNode.parent).unwrap_or(void 0) !== I.Table ? [new u(o.INVALID_NOTE_CONTEXT, "An Indexes can only appear inside a Table", this.declarationNode)] : [];
|
|
1909
1909
|
}
|
|
1910
1910
|
validateName(e) {
|
|
1911
1911
|
return e ? [new u(o.UNEXPECTED_NAME, "An Indexes shouldn't have a name", e)] : [];
|
|
@@ -1930,21 +1930,21 @@ class bn {
|
|
|
1930
1930
|
return [];
|
|
1931
1931
|
const n = [], i = [s.callee, ...s.args];
|
|
1932
1932
|
return L.last(i) instanceof U && n.push(...this.validateFieldSetting(i.pop())), i.forEach((r) => {
|
|
1933
|
-
for (; r instanceof
|
|
1933
|
+
for (; r instanceof H; )
|
|
1934
1934
|
r.argumentList && !Ge(r.argumentList).isOk() && n.push(new u(o.INVALID_INDEXES_FIELD, "An index field must be an identifier, a quoted identifier, a functional expression or a tuple of such", r.argumentList)), r = r.callee;
|
|
1935
1935
|
Ge(r).isOk() || n.push(new u(o.INVALID_INDEXES_FIELD, "An index field must be an identifier, a quoted identifier, a functional expression or a tuple of such", r));
|
|
1936
1936
|
}), n;
|
|
1937
1937
|
});
|
|
1938
1938
|
}
|
|
1939
1939
|
validateFieldSetting(e) {
|
|
1940
|
-
const s =
|
|
1940
|
+
const s = z(e), n = s.getErrors(), i = s.getValue();
|
|
1941
1941
|
for (const r in i) {
|
|
1942
1942
|
const a = i[r];
|
|
1943
1943
|
switch (r) {
|
|
1944
1944
|
case "note":
|
|
1945
1945
|
case "name":
|
|
1946
1946
|
a.length > 1 && a.forEach((l) => n.push(new u(o.DUPLICATE_INDEX_SETTING, `'${r}' can only appear once`, l))), a.forEach((l) => {
|
|
1947
|
-
|
|
1947
|
+
W(l.value) || n.push(new u(o.INVALID_INDEX_SETTING_VALUE, `'${r}' must be a string`, l));
|
|
1948
1948
|
});
|
|
1949
1949
|
break;
|
|
1950
1950
|
case "unique":
|
|
@@ -1981,7 +1981,7 @@ class In {
|
|
|
1981
1981
|
return [...this.validateContext(), ...this.validateName(this.declarationNode.name), ...this.validateAlias(this.declarationNode.alias), ...this.validateSettingList(this.declarationNode.attributeList), ...this.validateBody(this.declarationNode.body)];
|
|
1982
1982
|
}
|
|
1983
1983
|
validateContext() {
|
|
1984
|
-
return this.declarationNode.parent instanceof
|
|
1984
|
+
return this.declarationNode.parent instanceof X || ![I.Table, I.Project].includes(Ee(this.declarationNode.parent).unwrap_or(void 0)) ? [new u(o.INVALID_NOTE_CONTEXT, "A Note can only appear inside a Table or a Project", this.declarationNode)] : [];
|
|
1985
1985
|
}
|
|
1986
1986
|
validateName(e) {
|
|
1987
1987
|
return e ? [new u(o.UNEXPECTED_NAME, "A Note shouldn't have a name", e)] : [];
|
|
@@ -2002,7 +2002,7 @@ class In {
|
|
|
2002
2002
|
}
|
|
2003
2003
|
validateFields(e) {
|
|
2004
2004
|
const s = [];
|
|
2005
|
-
return e.length === 0 ? [new u(o.EMPTY_NOTE, "A Note must have a content", this.declarationNode)] : (e.length > 1 && e.slice(1).forEach((n) => s.push(new u(o.NOTE_CONTENT_REDEFINED, "A Note can only contain one string", n))),
|
|
2005
|
+
return e.length === 0 ? [new u(o.EMPTY_NOTE, "A Note must have a content", this.declarationNode)] : (e.length > 1 && e.slice(1).forEach((n) => s.push(new u(o.NOTE_CONTENT_REDEFINED, "A Note can only contain one string", n))), W(e[0].callee) || s.push(new u(o.INVALID_NOTE, "A Note content must be a quoted string", e[0])), e[0].args.length > 0 && s.push(...e[0].args.map((n) => new u(o.INVALID_NOTE, "A Note can only contain one quoted string", n))), s);
|
|
2006
2006
|
}
|
|
2007
2007
|
validateSubElements(e) {
|
|
2008
2008
|
return e.flatMap((s) => {
|
|
@@ -2060,7 +2060,7 @@ class gn {
|
|
|
2060
2060
|
return [...this.validateContext(), ...this.validateName(this.declarationNode.name), ...this.validateAlias(this.declarationNode.alias), ...this.validateSettingList(this.declarationNode.attributeList), ...this.validateBody(this.declarationNode.body)];
|
|
2061
2061
|
}
|
|
2062
2062
|
validateContext() {
|
|
2063
|
-
return this.declarationNode.parent instanceof
|
|
2063
|
+
return this.declarationNode.parent instanceof X || Ee(this.declarationNode.parent).unwrap_or(void 0) === I.Table ? [] : [new u(o.INVALID_REF_CONTEXT, "A Ref must appear top-level or inside a table", this.declarationNode)];
|
|
2064
2064
|
}
|
|
2065
2065
|
validateName(e) {
|
|
2066
2066
|
return e ? Re(e) ? [] : [new u(o.INVALID_NAME, "A Ref's name is optional or must be an identifier or a quoted identifer", e)] : [];
|
|
@@ -2088,7 +2088,7 @@ class gn {
|
|
|
2088
2088
|
}), s;
|
|
2089
2089
|
}
|
|
2090
2090
|
validateFieldSettings(e) {
|
|
2091
|
-
const s =
|
|
2091
|
+
const s = z(e), n = s.getErrors(), i = s.getValue();
|
|
2092
2092
|
for (const r in i) {
|
|
2093
2093
|
const a = i[r];
|
|
2094
2094
|
switch (r) {
|
|
@@ -2141,13 +2141,13 @@ class An {
|
|
|
2141
2141
|
return this.declarationNode.parent instanceof _ ? [new u(o.INVALID_TABLE_CONTEXT, "Table must appear top-level", this.declarationNode)] : [];
|
|
2142
2142
|
}
|
|
2143
2143
|
validateName(e) {
|
|
2144
|
-
return e ? e instanceof
|
|
2144
|
+
return e ? e instanceof fe ? [new u(o.INVALID_NAME, "Invalid array as Table name, maybe you forget to add a space between the name and the setting list?", e)] : Je(e) ? [] : [new u(o.INVALID_NAME, "A Table name must be of the form <table> or <schema>.<table>", e)] : [new u(o.NAME_NOT_FOUND, "A Table must have a name", this.declarationNode)];
|
|
2145
2145
|
}
|
|
2146
2146
|
validateAlias(e) {
|
|
2147
2147
|
return e ? yn(e) ? [] : [new u(o.INVALID_ALIAS, "A Table alias must be of the form <alias>", e)] : [];
|
|
2148
2148
|
}
|
|
2149
2149
|
validateSettingList(e) {
|
|
2150
|
-
const s =
|
|
2150
|
+
const s = z(e), n = s.getErrors(), i = s.getValue();
|
|
2151
2151
|
for (const r in i) {
|
|
2152
2152
|
const a = i[r];
|
|
2153
2153
|
switch (r) {
|
|
@@ -2158,7 +2158,7 @@ class An {
|
|
|
2158
2158
|
break;
|
|
2159
2159
|
case "note":
|
|
2160
2160
|
a.length > 1 && n.push(...a.map((l) => new u(o.DUPLICATE_TABLE_SETTING, "'note' can only appear once", l))), a.forEach((l) => {
|
|
2161
|
-
|
|
2161
|
+
W(l.value) || n.push(new u(o.INVALID_TABLE_SETTING, "'note' must be a string literal", l.value || l.name));
|
|
2162
2162
|
});
|
|
2163
2163
|
break;
|
|
2164
2164
|
default:
|
|
@@ -2170,7 +2170,7 @@ class An {
|
|
|
2170
2170
|
registerElement() {
|
|
2171
2171
|
const e = [];
|
|
2172
2172
|
this.declarationNode.symbol = this.symbolFactory.create(At, { declaration: this.declarationNode, symbolTable: new ge() });
|
|
2173
|
-
const { name: s, alias: n } = this.declarationNode, i =
|
|
2173
|
+
const { name: s, alias: n } = this.declarationNode, i = j(s);
|
|
2174
2174
|
if (i.isOk()) {
|
|
2175
2175
|
const r = i.unwrap(), a = r.pop(), l = Ze(r, this.publicSymbolTable, this.symbolFactory), p = ye(a);
|
|
2176
2176
|
l.has(p) && e.push(new u(o.DUPLICATE_NAME, `Table name '${a}' already exists in schema '${r.join(".") || "public"}'`, s)), l.set(p, this.declarationNode.symbol);
|
|
@@ -2194,7 +2194,7 @@ class An {
|
|
|
2194
2194
|
if (!s.callee)
|
|
2195
2195
|
return [];
|
|
2196
2196
|
const n = [];
|
|
2197
|
-
s.args.length === 0 && n.push(new u(o.INVALID_COLUMN, "A column must have a type", s.callee)), M(s.callee) || n.push(new u(o.INVALID_COLUMN_NAME, "A column name must be an identifier or a quoted identifier", s.callee)), s.args[0] && !
|
|
2197
|
+
s.args.length === 0 && n.push(new u(o.INVALID_COLUMN, "A column must have a type", s.callee)), M(s.callee) || n.push(new u(o.INVALID_COLUMN_NAME, "A column name must be an identifier or a quoted identifier", s.callee)), s.args[0] && !wn(s.args[0]) && n.push(new u(o.INVALID_COLUMN_TYPE, "Invalid column type", s.args[0]));
|
|
2198
2198
|
const i = s.args.slice(1);
|
|
2199
2199
|
return n.push(...this.validateFieldSetting(i)), n.push(...this.registerField(s)), n;
|
|
2200
2200
|
});
|
|
@@ -2217,13 +2217,13 @@ class An {
|
|
|
2217
2217
|
}
|
|
2218
2218
|
// This is needed to support legacy inline settings
|
|
2219
2219
|
validateFieldSetting(e) {
|
|
2220
|
-
if (!e.slice(0, -1).every(
|
|
2220
|
+
if (!e.slice(0, -1).every(pe) || !e.slice(-1).every((p) => pe(p) || p instanceof U))
|
|
2221
2221
|
return [...e.map((p) => new u(o.INVALID_COLUMN, "These fields must be some inline settings optionally ended with a setting list", p))];
|
|
2222
2222
|
if (e.length === 0)
|
|
2223
2223
|
return [];
|
|
2224
2224
|
let s;
|
|
2225
2225
|
L.last(e) instanceof U && (s = e.pop());
|
|
2226
|
-
const n =
|
|
2226
|
+
const n = z(s), i = n.getErrors(), r = n.getValue();
|
|
2227
2227
|
for (const p of e) {
|
|
2228
2228
|
const h = G(p).unwrap_or("").toLowerCase();
|
|
2229
2229
|
if (h !== "pk" && h !== "unique") {
|
|
@@ -2239,7 +2239,7 @@ class An {
|
|
|
2239
2239
|
switch (p) {
|
|
2240
2240
|
case "note":
|
|
2241
2241
|
h.length > 1 && i.push(...h.map((f) => new u(o.DUPLICATE_COLUMN_SETTING, "note can only appear once", f))), h.forEach((f) => {
|
|
2242
|
-
|
|
2242
|
+
W(f.value) || i.push(new u(o.INVALID_COLUMN_SETTING_VALUE, "'note' must be a quoted string", f.value || f.name));
|
|
2243
2243
|
});
|
|
2244
2244
|
break;
|
|
2245
2245
|
case "ref":
|
|
@@ -2303,23 +2303,23 @@ class An {
|
|
|
2303
2303
|
return n.length > 1 && (s.push(...n.map((i) => new u(o.NOTE_REDEFINED, "Duplicate notes are defined", i))), s.push()), s;
|
|
2304
2304
|
}
|
|
2305
2305
|
}
|
|
2306
|
-
function
|
|
2307
|
-
if (!(t instanceof
|
|
2306
|
+
function wn(t) {
|
|
2307
|
+
if (!(t instanceof H || He(t) || t instanceof D || t instanceof fe))
|
|
2308
2308
|
return !1;
|
|
2309
|
-
if (t instanceof
|
|
2310
|
-
if (t.callee === void 0 || t.argumentList === void 0 || !t.argumentList.elementList.every(
|
|
2309
|
+
if (t instanceof H) {
|
|
2310
|
+
if (t.callee === void 0 || t.argumentList === void 0 || !t.argumentList.elementList.every((s) => le(s) || W(s) || pe(s)))
|
|
2311
2311
|
return !1;
|
|
2312
2312
|
t = t.callee;
|
|
2313
2313
|
}
|
|
2314
|
-
for (; t instanceof
|
|
2315
|
-
if (t.array === void 0 || t.indexer === void 0 || !t.indexer.elementList.every((s) => !s.colon && !s.value &&
|
|
2314
|
+
for (; t instanceof fe; ) {
|
|
2315
|
+
if (t.array === void 0 || t.indexer === void 0 || !t.indexer.elementList.every((s) => !s.colon && !s.value && le(s.name)))
|
|
2316
2316
|
return !1;
|
|
2317
2317
|
t = t.array;
|
|
2318
2318
|
}
|
|
2319
|
-
const e =
|
|
2319
|
+
const e = j(t).unwrap_or(void 0);
|
|
2320
2320
|
return e !== void 0 && e.length > 0;
|
|
2321
2321
|
}
|
|
2322
|
-
class
|
|
2322
|
+
class vn {
|
|
2323
2323
|
constructor(e, s, n) {
|
|
2324
2324
|
this.declarationNode = e, this.publicSymbolTable = s, this.symbolFactory = n;
|
|
2325
2325
|
}
|
|
@@ -2338,7 +2338,7 @@ class wn {
|
|
|
2338
2338
|
registerElement() {
|
|
2339
2339
|
const { name: e } = this.declarationNode;
|
|
2340
2340
|
this.declarationNode.symbol = this.symbolFactory.create(Zt, { declaration: this.declarationNode, symbolTable: new ge() });
|
|
2341
|
-
const s =
|
|
2341
|
+
const s = j(e);
|
|
2342
2342
|
if (s.isOk()) {
|
|
2343
2343
|
const n = s.unwrap(), i = n.pop(), r = Ze(n, this.publicSymbolTable, this.symbolFactory), a = ze(i);
|
|
2344
2344
|
if (r.has(a))
|
|
@@ -2361,7 +2361,7 @@ class wn {
|
|
|
2361
2361
|
validateFields(e) {
|
|
2362
2362
|
return e.flatMap((s) => {
|
|
2363
2363
|
const n = [];
|
|
2364
|
-
return s.callee &&
|
|
2364
|
+
return s.callee && !j(s.callee).isOk() && n.push(new u(o.INVALID_TABLEGROUP_FIELD, "A TableGroup field must be of the form <table> or <schema>.<table>", s.callee)), this.registerField(s), s.args.length > 0 && n.push(...s.args.map((i) => new u(o.INVALID_TABLEGROUP_FIELD, "A TableGroup field should only have a single Table name", i))), n;
|
|
2365
2365
|
});
|
|
2366
2366
|
}
|
|
2367
2367
|
validateSubElements(e) {
|
|
@@ -2389,7 +2389,7 @@ class wn {
|
|
|
2389
2389
|
return [];
|
|
2390
2390
|
}
|
|
2391
2391
|
}
|
|
2392
|
-
const
|
|
2392
|
+
const vt = ["-", "+"];
|
|
2393
2393
|
function ie(t) {
|
|
2394
2394
|
switch (t.type.value.toLowerCase()) {
|
|
2395
2395
|
case I.Enum:
|
|
@@ -2397,7 +2397,7 @@ function ie(t) {
|
|
|
2397
2397
|
case I.Table:
|
|
2398
2398
|
return An;
|
|
2399
2399
|
case I.TableGroup:
|
|
2400
|
-
return
|
|
2400
|
+
return vn;
|
|
2401
2401
|
case I.Project:
|
|
2402
2402
|
return Ln;
|
|
2403
2403
|
case I.Ref:
|
|
@@ -2411,13 +2411,13 @@ function ie(t) {
|
|
|
2411
2411
|
}
|
|
2412
2412
|
}
|
|
2413
2413
|
function Je(t) {
|
|
2414
|
-
return
|
|
2414
|
+
return !!j(t).unwrap_or(!1);
|
|
2415
2415
|
}
|
|
2416
2416
|
function yn(t) {
|
|
2417
2417
|
return Re(t);
|
|
2418
2418
|
}
|
|
2419
2419
|
function Re(t) {
|
|
2420
|
-
return t instanceof D && t.expression instanceof
|
|
2420
|
+
return t instanceof D && t.expression instanceof $;
|
|
2421
2421
|
}
|
|
2422
2422
|
function Ze(t, e, s) {
|
|
2423
2423
|
var i;
|
|
@@ -2443,7 +2443,7 @@ function yt(t) {
|
|
|
2443
2443
|
}
|
|
2444
2444
|
function xn(t) {
|
|
2445
2445
|
var s;
|
|
2446
|
-
if (!(t instanceof D) || !(t.expression instanceof
|
|
2446
|
+
if (!(t instanceof D) || !(t.expression instanceof de) || ((s = t.expression.literal) == null ? void 0 : s.kind) !== c.COLOR_LITERAL)
|
|
2447
2447
|
return !1;
|
|
2448
2448
|
const e = t.expression.literal.value;
|
|
2449
2449
|
if (e.length !== 4 && e.length !== 7 || e[0] !== "#")
|
|
@@ -2458,23 +2458,23 @@ function oe(t) {
|
|
|
2458
2458
|
}
|
|
2459
2459
|
function kn(t) {
|
|
2460
2460
|
var e;
|
|
2461
|
-
return !!(
|
|
2461
|
+
return !!(W(t) || le(t) || pe(t) && ["true", "false", "null"].includes(t.expression.variable.value.toLowerCase()) || t instanceof Q && vt.includes((e = t.op) == null ? void 0 : e.value) && le(t.expression) || t instanceof K);
|
|
2462
2462
|
}
|
|
2463
|
-
function
|
|
2463
|
+
function le(t) {
|
|
2464
2464
|
var e;
|
|
2465
|
-
return t instanceof D && t.expression instanceof
|
|
2465
|
+
return t instanceof D && t.expression instanceof de && ((e = t.expression.literal) == null ? void 0 : e.kind) === c.NUMERIC_LITERAL;
|
|
2466
2466
|
}
|
|
2467
2467
|
function Sn(t) {
|
|
2468
2468
|
var s;
|
|
2469
|
-
if (!(t instanceof
|
|
2469
|
+
if (!(t instanceof Q) || !yt((s = t.op) == null ? void 0 : s.value))
|
|
2470
2470
|
return !1;
|
|
2471
|
-
const e =
|
|
2471
|
+
const e = j(t.expression).unwrap_or(void 0);
|
|
2472
2472
|
return e !== void 0 && e.length > 0;
|
|
2473
2473
|
}
|
|
2474
2474
|
function xt(t) {
|
|
2475
|
-
return t instanceof
|
|
2475
|
+
return t instanceof J && t.elementList.every(M);
|
|
2476
2476
|
}
|
|
2477
|
-
function
|
|
2477
|
+
function z(t) {
|
|
2478
2478
|
var n;
|
|
2479
2479
|
const e = {}, s = [];
|
|
2480
2480
|
if (!t)
|
|
@@ -2509,7 +2509,7 @@ class ft {
|
|
|
2509
2509
|
);
|
|
2510
2510
|
e.push(...r.validate());
|
|
2511
2511
|
});
|
|
2512
|
-
const s = this.ast.body.filter((n) =>
|
|
2512
|
+
const s = this.ast.body.filter((n) => Ee(n).unwrap_or(void 0) === I.Project);
|
|
2513
2513
|
return s.length > 1 && s.forEach((n) => e.push(new u(o.PROJECT_REDEFINED, "Only one project can exist", n))), new B(this.ast, e);
|
|
2514
2514
|
}
|
|
2515
2515
|
}
|
|
@@ -2561,11 +2561,11 @@ class re {
|
|
|
2561
2561
|
var n, i;
|
|
2562
2562
|
if (e)
|
|
2563
2563
|
if (e instanceof D) {
|
|
2564
|
-
if (e.expression instanceof
|
|
2564
|
+
if (e.expression instanceof $ && ((i = s.keywords) != null && i.includes((n = e.expression.variable) == null ? void 0 : n.value.toLowerCase())))
|
|
2565
2565
|
return;
|
|
2566
2566
|
this.bindFragments([e], s);
|
|
2567
2567
|
} else
|
|
2568
|
-
e instanceof
|
|
2568
|
+
e instanceof q ? He(e) ? this.bindFragments(Ne(e).unwrap_or([]), s) : (this.scanAndBind(e.leftExpression, s), this.scanAndBind(e.rightExpression, s)) : e instanceof Q ? this.scanAndBind(e.expression, s) : e instanceof Oe ? this.scanAndBind(e.expression, s) : e instanceof J && e.elementList.forEach((r) => this.scanAndBind(r, s));
|
|
2569
2569
|
}
|
|
2570
2570
|
// Bind the fragments of a member access expression
|
|
2571
2571
|
// which can be a simple expression like v1.User,
|
|
@@ -2878,16 +2878,16 @@ function x(t) {
|
|
|
2878
2878
|
}
|
|
2879
2879
|
function Ce(t) {
|
|
2880
2880
|
var s;
|
|
2881
|
-
const e = (s =
|
|
2882
|
-
return e instanceof
|
|
2881
|
+
const e = (s = Ne(t).unwrap_or(void 0)) == null ? void 0 : s.pop();
|
|
2882
|
+
return e instanceof J ? e.elementList.map((n) => n.referee) : [e.referee];
|
|
2883
2883
|
}
|
|
2884
|
-
function
|
|
2884
|
+
function ue(t) {
|
|
2885
2885
|
return t.split(`
|
|
2886
2886
|
`).map((e) => e.trim()).join(`
|
|
2887
2887
|
`);
|
|
2888
2888
|
}
|
|
2889
2889
|
function _e(t) {
|
|
2890
|
-
const e =
|
|
2890
|
+
const e = j(t).unwrap();
|
|
2891
2891
|
return {
|
|
2892
2892
|
name: e.pop(),
|
|
2893
2893
|
schemaName: e
|
|
@@ -2920,7 +2920,7 @@ class Ke {
|
|
|
2920
2920
|
return this.ref.token = x(this.declarationNode), this.env.ref.set(this.declarationNode, this.ref), [...this.interpretName(this.declarationNode.name), ...this.interpretBody(this.declarationNode.body)];
|
|
2921
2921
|
}
|
|
2922
2922
|
interpretName(e) {
|
|
2923
|
-
const s = [], n =
|
|
2923
|
+
const s = [], n = j(this.declarationNode.name).unwrap_or([]);
|
|
2924
2924
|
return this.ref.name = n.pop() || null, n.length > 1 && s.push(new u(o.UNSUPPORTED, "Nested schema is not supported", this.declarationNode.name)), this.ref.schemaName = n.join(".") || null, s;
|
|
2925
2925
|
}
|
|
2926
2926
|
interpretBody(e) {
|
|
@@ -2938,8 +2938,8 @@ class Ke {
|
|
|
2938
2938
|
new u(o.CIRCULAR_REF, "References with same endpoints exist", this.env.refIds[l])
|
|
2939
2939
|
];
|
|
2940
2940
|
if (e.args[0]) {
|
|
2941
|
-
const b =
|
|
2942
|
-
this.ref.onDelete =
|
|
2941
|
+
const b = z(e.args[0]).getValue();
|
|
2942
|
+
this.ref.onDelete = C((T = (h = b.delete) == null ? void 0 : h.at(0)) == null ? void 0 : T.value).unwrap_or(void 0), this.ref.onDelete = C((N = (f = b.delete) == null ? void 0 : f.at(0)) == null ? void 0 : N.value).unwrap_or(void 0);
|
|
2943
2943
|
}
|
|
2944
2944
|
const p = St(s);
|
|
2945
2945
|
return this.ref.endpoints = [
|
|
@@ -2998,11 +2998,11 @@ class Rt {
|
|
|
2998
2998
|
}
|
|
2999
2999
|
interpretSettingList(e) {
|
|
3000
3000
|
var r, a, l;
|
|
3001
|
-
const s =
|
|
3001
|
+
const s = z(e).getValue();
|
|
3002
3002
|
this.table.headerColor = (r = s.headercolor) != null && r.length ? Xn((l = (a = s.headercolor) == null ? void 0 : a.at(0)) == null ? void 0 : l.value) : void 0;
|
|
3003
|
-
const [n] = s.note || [], i =
|
|
3003
|
+
const [n] = s.note || [], i = Y(n == null ? void 0 : n.value).unwrap_or(void 0);
|
|
3004
3004
|
return this.table.note = n && {
|
|
3005
|
-
value:
|
|
3005
|
+
value: ue(i),
|
|
3006
3006
|
token: x(n)
|
|
3007
3007
|
}, [];
|
|
3008
3008
|
}
|
|
@@ -3016,7 +3016,7 @@ class Rt {
|
|
|
3016
3016
|
switch ((n = s.type) == null ? void 0 : n.value.toLowerCase()) {
|
|
3017
3017
|
case "note":
|
|
3018
3018
|
return this.table.note = {
|
|
3019
|
-
value:
|
|
3019
|
+
value: ue(Y(s.body instanceof ee ? s.body.body[0].callee : s.body.callee).unwrap()),
|
|
3020
3020
|
token: x(s)
|
|
3021
3021
|
}, [];
|
|
3022
3022
|
case "indexes":
|
|
@@ -3038,11 +3038,11 @@ class Rt {
|
|
|
3038
3038
|
n.type = i.getValue(), s.push(...i.getErrors()), n.token = x(e), n.inline_refs = [];
|
|
3039
3039
|
const r = e.args.slice(1);
|
|
3040
3040
|
if (L.last(r) instanceof U) {
|
|
3041
|
-
const b =
|
|
3041
|
+
const b = z(r.pop()).getValue();
|
|
3042
3042
|
n.pk = !!((a = b.pk) != null && a.length), n.increment = !!((l = b.increment) != null && l.length), n.unique = !!((p = b.unique) != null && p.length), n.not_null = !!((h = b["not null"]) != null && h.length) && !0, n.dbdefault = Wn((f = (T = b.default) == null ? void 0 : T.at(0)) == null ? void 0 : f.value);
|
|
3043
3043
|
const F = (N = b.note) == null ? void 0 : N.at(0);
|
|
3044
3044
|
n.note = F && {
|
|
3045
|
-
value:
|
|
3045
|
+
value: ue(Y(F.value).unwrap()),
|
|
3046
3046
|
token: x(F)
|
|
3047
3047
|
};
|
|
3048
3048
|
const Me = b.ref || [];
|
|
@@ -3050,51 +3050,51 @@ class Rt {
|
|
|
3050
3050
|
const [nt] = Ce(R.value.expression);
|
|
3051
3051
|
if (Dt(nt, e.symbol))
|
|
3052
3052
|
return s.push(new u(o.SAME_ENDPOINT, "Two endpoints are the same", R)), [];
|
|
3053
|
-
const Ae = R.value.op,
|
|
3054
|
-
let
|
|
3055
|
-
if (
|
|
3056
|
-
const [ae] =
|
|
3057
|
-
|
|
3053
|
+
const Ae = R.value.op, Z = j(R.value.expression).unwrap();
|
|
3054
|
+
let ce;
|
|
3055
|
+
if (Z.length === 1) {
|
|
3056
|
+
const [ae] = Z;
|
|
3057
|
+
ce = {
|
|
3058
3058
|
schemaName: this.table.schemaName,
|
|
3059
3059
|
tableName: this.table.name,
|
|
3060
3060
|
fieldNames: [ae],
|
|
3061
3061
|
relation: Ae.value,
|
|
3062
3062
|
token: x(R)
|
|
3063
3063
|
};
|
|
3064
|
-
} else if (
|
|
3065
|
-
const [ae,
|
|
3066
|
-
|
|
3064
|
+
} else if (Z.length === 2) {
|
|
3065
|
+
const [ae, me] = Z;
|
|
3066
|
+
ce = {
|
|
3067
3067
|
schemaName: null,
|
|
3068
3068
|
tableName: ae,
|
|
3069
|
-
fieldNames: [
|
|
3069
|
+
fieldNames: [me],
|
|
3070
3070
|
relation: Ae.value,
|
|
3071
3071
|
token: x(R)
|
|
3072
3072
|
};
|
|
3073
|
-
} else if (
|
|
3074
|
-
const [ae,
|
|
3075
|
-
|
|
3073
|
+
} else if (Z.length === 3) {
|
|
3074
|
+
const [ae, me, it] = Z;
|
|
3075
|
+
ce = {
|
|
3076
3076
|
schemaName: ae,
|
|
3077
|
-
tableName:
|
|
3077
|
+
tableName: me,
|
|
3078
3078
|
fieldNames: [it],
|
|
3079
3079
|
relation: Ae.value,
|
|
3080
3080
|
token: x(R)
|
|
3081
3081
|
};
|
|
3082
3082
|
} else {
|
|
3083
3083
|
s.push(new u(o.UNSUPPORTED, "Nested schema is not supported", R));
|
|
3084
|
-
const ae =
|
|
3085
|
-
|
|
3086
|
-
schemaName:
|
|
3087
|
-
tableName:
|
|
3084
|
+
const ae = Z.pop(), me = Z.pop();
|
|
3085
|
+
ce = {
|
|
3086
|
+
schemaName: Z.join("."),
|
|
3087
|
+
tableName: me,
|
|
3088
3088
|
fieldNames: [ae],
|
|
3089
3089
|
relation: Ae.value,
|
|
3090
3090
|
token: x(R)
|
|
3091
3091
|
};
|
|
3092
3092
|
}
|
|
3093
|
-
const st = this.registerInlineRefToEnv(e, nt,
|
|
3094
|
-
return s.push(...st), st.length === 0 ?
|
|
3093
|
+
const st = this.registerInlineRefToEnv(e, nt, ce, R);
|
|
3094
|
+
return s.push(...st), st.length === 0 ? ce : [];
|
|
3095
3095
|
});
|
|
3096
3096
|
}
|
|
3097
|
-
return n.pk || (n.pk = r.some((b) =>
|
|
3097
|
+
return n.pk || (n.pk = r.some((b) => C(b).unwrap().toLowerCase() === "pk")), n.unique || (n.unique = r.some((b) => C(b).unwrap().toLowerCase() === "unique")), this.table.fields.push(n), n.pk && this.pkColumns.push(n), s;
|
|
3098
3098
|
}
|
|
3099
3099
|
interpretIndexes(e) {
|
|
3100
3100
|
return this.table.indexes.push(...e.body.body.map((s) => {
|
|
@@ -3103,19 +3103,19 @@ class Rt {
|
|
|
3103
3103
|
n.token = x(e);
|
|
3104
3104
|
const r = [i.callee, ...i.args];
|
|
3105
3105
|
if (L.last(r) instanceof U) {
|
|
3106
|
-
const b =
|
|
3107
|
-
n.pk = !!((a = b.pk) != null && a.length), n.unique = !!((l = b.unique) != null && l.length), n.name =
|
|
3106
|
+
const b = z(r.pop()).getValue();
|
|
3107
|
+
n.pk = !!((a = b.pk) != null && a.length), n.unique = !!((l = b.unique) != null && l.length), n.name = Y((h = (p = b.name) == null ? void 0 : p.at(0)) == null ? void 0 : h.value).unwrap_or(void 0);
|
|
3108
3108
|
const F = (T = b.note) == null ? void 0 : T.at(0);
|
|
3109
3109
|
n.note = F && {
|
|
3110
|
-
value:
|
|
3110
|
+
value: ue(Y(F.value).unwrap()),
|
|
3111
3111
|
token: x(F)
|
|
3112
|
-
}, n.type =
|
|
3112
|
+
}, n.type = C((N = (f = b.type) == null ? void 0 : f.at(0)) == null ? void 0 : N.value).unwrap_or(void 0);
|
|
3113
3113
|
}
|
|
3114
3114
|
return r.flatMap((b) => {
|
|
3115
|
-
if (!(b instanceof
|
|
3115
|
+
if (!(b instanceof H))
|
|
3116
3116
|
return b;
|
|
3117
3117
|
const F = [];
|
|
3118
|
-
for (; b instanceof
|
|
3118
|
+
for (; b instanceof H; )
|
|
3119
3119
|
F.push(b.argumentList), b = b.callee;
|
|
3120
3120
|
return F.push(b), F;
|
|
3121
3121
|
}).forEach((b) => {
|
|
@@ -3149,7 +3149,7 @@ class Rt {
|
|
|
3149
3149
|
{
|
|
3150
3150
|
schemaName: this.table.schemaName,
|
|
3151
3151
|
tableName: this.table.name,
|
|
3152
|
-
fieldNames: [
|
|
3152
|
+
fieldNames: [C(e.callee).unwrap()],
|
|
3153
3153
|
token: x(e),
|
|
3154
3154
|
relation: a[0]
|
|
3155
3155
|
},
|
|
@@ -3163,9 +3163,9 @@ class Rt {
|
|
|
3163
3163
|
}
|
|
3164
3164
|
function $n(t) {
|
|
3165
3165
|
let e = null;
|
|
3166
|
-
t instanceof
|
|
3166
|
+
t instanceof H && (e = t.argumentList.elementList.map((r) => le(r) ? r.expression.literal.value : W(r) ? Y(r).unwrap() : C(r).unwrap()).join(","), t = t.callee);
|
|
3167
3167
|
let s = "";
|
|
3168
|
-
for (; t instanceof
|
|
3168
|
+
for (; t instanceof fe; )
|
|
3169
3169
|
s = `[${t.indexer.elementList.map((r) => r.name.expression.literal.value).join(",")}]${s}`, t = t.array;
|
|
3170
3170
|
const { name: n, schemaName: i } = _e(t);
|
|
3171
3171
|
return i.length > 1 && new B(
|
|
@@ -3184,29 +3184,29 @@ function $n(t) {
|
|
|
3184
3184
|
function Wn(t) {
|
|
3185
3185
|
var e, s, n;
|
|
3186
3186
|
if (t) {
|
|
3187
|
-
if (
|
|
3187
|
+
if (W(t))
|
|
3188
3188
|
return {
|
|
3189
|
-
value:
|
|
3189
|
+
value: Y(t).unwrap(),
|
|
3190
3190
|
type: "string"
|
|
3191
3191
|
};
|
|
3192
|
-
if (
|
|
3192
|
+
if (le(t))
|
|
3193
3193
|
return {
|
|
3194
3194
|
type: "number",
|
|
3195
3195
|
value: Number.parseFloat(t.expression.literal.value)
|
|
3196
3196
|
};
|
|
3197
|
-
if (
|
|
3197
|
+
if (pe(t))
|
|
3198
3198
|
return {
|
|
3199
3199
|
value: t.expression.variable.value.toLowerCase(),
|
|
3200
3200
|
type: "boolean"
|
|
3201
3201
|
};
|
|
3202
|
-
if (t instanceof
|
|
3202
|
+
if (t instanceof Q && vt.includes((e = t.op) == null ? void 0 : e.value) && le(t.expression)) {
|
|
3203
3203
|
const i = Number.parseFloat(t.expression.expression.literal.value);
|
|
3204
3204
|
return {
|
|
3205
3205
|
value: ((s = t.op) == null ? void 0 : s.value) === "-" ? 0 - i : i,
|
|
3206
3206
|
type: "number"
|
|
3207
3207
|
};
|
|
3208
3208
|
}
|
|
3209
|
-
if (t instanceof
|
|
3209
|
+
if (t instanceof K)
|
|
3210
3210
|
return {
|
|
3211
3211
|
value: (n = t.value) == null ? void 0 : n.value,
|
|
3212
3212
|
type: "expression"
|
|
@@ -3223,7 +3223,7 @@ class Pt {
|
|
|
3223
3223
|
this.tableGroup.token = x(this.declarationNode), this.env.tableGroups.set(this.declarationNode, this.tableGroup);
|
|
3224
3224
|
const { name: s, schemaName: n } = _e(this.declarationNode.name);
|
|
3225
3225
|
return n.length >= 2 && (this.tableGroup.name = s, this.tableGroup.schemaName = n.join("."), e.push(new u(o.UNSUPPORTED, "Nested schema is not supported", this.declarationNode.name))), this.tableGroup.name = s, this.tableGroup.schemaName = n[0] || null, this.tableGroup.tables = this.declarationNode.body.body.map((i) => {
|
|
3226
|
-
const r =
|
|
3226
|
+
const r = j(i.callee).unwrap();
|
|
3227
3227
|
return r.length > 2 && e.push(new u(o.UNSUPPORTED, "Nested schema is not supported", i)), {
|
|
3228
3228
|
name: r.pop(),
|
|
3229
3229
|
schemaName: r.join(".")
|
|
@@ -3246,10 +3246,10 @@ class Ut {
|
|
|
3246
3246
|
return e.body.flatMap((s) => {
|
|
3247
3247
|
var l;
|
|
3248
3248
|
const n = s, i = {};
|
|
3249
|
-
i.token = x(n), i.name =
|
|
3250
|
-
const a = (l =
|
|
3249
|
+
i.token = x(n), i.name = C(n.callee).unwrap();
|
|
3250
|
+
const a = (l = z(n.args[0]).getValue().note) == null ? void 0 : l.at(0);
|
|
3251
3251
|
return i.note = a && {
|
|
3252
|
-
value:
|
|
3252
|
+
value: ue(Y(a.value).unwrap()),
|
|
3253
3253
|
token: x(a)
|
|
3254
3254
|
}, this.enum.values.push(i), [];
|
|
3255
3255
|
});
|
|
@@ -3291,11 +3291,11 @@ class jn {
|
|
|
3291
3291
|
}
|
|
3292
3292
|
case "note":
|
|
3293
3293
|
return this.project.note = {
|
|
3294
|
-
value:
|
|
3294
|
+
value: ue(Y(n.body instanceof ee ? n.body.body[0].callee : n.body.callee).unwrap()),
|
|
3295
3295
|
token: x(n)
|
|
3296
3296
|
}, [];
|
|
3297
3297
|
default:
|
|
3298
|
-
return this.project[n.type.value.toLowerCase()] =
|
|
3298
|
+
return this.project[n.type.value.toLowerCase()] = Y(n.body.callee).unwrap(), [];
|
|
3299
3299
|
}
|
|
3300
3300
|
});
|
|
3301
3301
|
}
|
|
@@ -3315,7 +3315,7 @@ class Yn {
|
|
|
3315
3315
|
}
|
|
3316
3316
|
interpret() {
|
|
3317
3317
|
const e = this.ast.body.flatMap((s) => {
|
|
3318
|
-
switch (
|
|
3318
|
+
switch (Ee(s).unwrap_or(void 0)) {
|
|
3319
3319
|
case I.Table:
|
|
3320
3320
|
return new Rt(s, this.env).interpret();
|
|
3321
3321
|
case I.Ref:
|
|
@@ -3344,7 +3344,7 @@ function zn(t) {
|
|
|
3344
3344
|
project: Array.from(t.project.values())[0] || {}
|
|
3345
3345
|
};
|
|
3346
3346
|
}
|
|
3347
|
-
var g = /* @__PURE__ */ ((t) => (t[t.Function = 1] = "Function", t[t.Constructor = 2] = "Constructor", t[t.Field = 3] = "Field", t[t.Variable = 4] = "Variable", t[t.Class = 5] = "Class", t[t.Struct = 6] = "Struct", t[t.Interface = 7] = "Interface", t[t.Module = 8] = "Module", t[t.Property = 9] = "Property", t[t.Event = 10] = "Event", t[t.Operator = 11] = "Operator", t[t.Unit = 12] = "Unit", t[t.Value = 13] = "Value", t[t.Constant = 14] = "Constant", t[t.Enum = 15] = "Enum", t[t.EnumMember = 16] = "EnumMember", t[t.Keyword = 17] = "Keyword", t[t.Text = 18] = "Text", t[t.Color = 19] = "Color", t[t.File = 20] = "File", t[t.Reference = 21] = "Reference", t[t.Customcolor = 22] = "Customcolor", t[t.Folder = 23] = "Folder", t[t.TypeParameter = 24] = "TypeParameter", t[t.User = 25] = "User", t[t.Issue = 26] = "Issue", t[t.Snippet = 27] = "Snippet", t))(g || {}),
|
|
3347
|
+
var g = /* @__PURE__ */ ((t) => (t[t.Function = 1] = "Function", t[t.Constructor = 2] = "Constructor", t[t.Field = 3] = "Field", t[t.Variable = 4] = "Variable", t[t.Class = 5] = "Class", t[t.Struct = 6] = "Struct", t[t.Interface = 7] = "Interface", t[t.Module = 8] = "Module", t[t.Property = 9] = "Property", t[t.Event = 10] = "Event", t[t.Operator = 11] = "Operator", t[t.Unit = 12] = "Unit", t[t.Value = 13] = "Value", t[t.Constant = 14] = "Constant", t[t.Enum = 15] = "Enum", t[t.EnumMember = 16] = "EnumMember", t[t.Keyword = 17] = "Keyword", t[t.Text = 18] = "Text", t[t.Color = 19] = "Color", t[t.File = 20] = "File", t[t.Reference = 21] = "Reference", t[t.Customcolor = 22] = "Customcolor", t[t.Folder = 23] = "Folder", t[t.TypeParameter = 24] = "TypeParameter", t[t.User = 25] = "User", t[t.Issue = 26] = "Issue", t[t.Snippet = 27] = "Snippet", t))(g || {}), w = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.KeepWhitespace = 1] = "KeepWhitespace", t[t.InsertAsSnippet = 4] = "InsertAsSnippet", t))(w || {});
|
|
3348
3348
|
function Le(t) {
|
|
3349
3349
|
switch (t) {
|
|
3350
3350
|
case m.Schema:
|
|
@@ -3413,18 +3413,18 @@ class Mt {
|
|
|
3413
3413
|
...(r == null ? void 0 : r.trailingTrivia) || [],
|
|
3414
3414
|
...(r == null ? void 0 : r.leadingTrivia) || [],
|
|
3415
3415
|
...(l == null ? void 0 : l.leadingTrivia) || []
|
|
3416
|
-
].find((N) => $t(N) &&
|
|
3416
|
+
].find((N) => $t(N) && be(n, N)))
|
|
3417
3417
|
return S();
|
|
3418
3418
|
if (a === void 0)
|
|
3419
3419
|
return Tt();
|
|
3420
|
-
if ([c.STRING_LITERAL, c.QUOTED_STRING].includes(r.kind) &&
|
|
3420
|
+
if ([c.STRING_LITERAL, c.QUOTED_STRING].includes(r.kind) && be(n, r))
|
|
3421
3421
|
return S();
|
|
3422
3422
|
const p = this.compiler.container.element(n);
|
|
3423
3423
|
if (this.compiler.container.scopeKind(n) === O.TOPLEVEL || p instanceof _ && p.type && p.type.start <= n && p.type.end >= n)
|
|
3424
3424
|
return Tt();
|
|
3425
3425
|
const h = [...this.compiler.container.stack(n)].reverse();
|
|
3426
3426
|
for (const N of h)
|
|
3427
|
-
if (N instanceof
|
|
3427
|
+
if (N instanceof Q)
|
|
3428
3428
|
switch ((T = N.op) == null ? void 0 : T.value) {
|
|
3429
3429
|
case ">":
|
|
3430
3430
|
case "<":
|
|
@@ -3436,7 +3436,7 @@ class Mt {
|
|
|
3436
3436
|
N
|
|
3437
3437
|
);
|
|
3438
3438
|
}
|
|
3439
|
-
else if (N instanceof
|
|
3439
|
+
else if (N instanceof q)
|
|
3440
3440
|
switch ((f = N.op) == null ? void 0 : f.value) {
|
|
3441
3441
|
case ">":
|
|
3442
3442
|
case "<":
|
|
@@ -3459,11 +3459,11 @@ class Mt {
|
|
|
3459
3459
|
return Et(this.compiler, n, N);
|
|
3460
3460
|
if (N instanceof U)
|
|
3461
3461
|
return Et(this.compiler, n, N);
|
|
3462
|
-
if (N instanceof
|
|
3462
|
+
if (N instanceof J)
|
|
3463
3463
|
return Qn(this.compiler, n);
|
|
3464
3464
|
if (N instanceof y)
|
|
3465
3465
|
return mt(this.compiler, n, N);
|
|
3466
|
-
if (N instanceof _ && (N.bodyColon && n >= N.bodyColon.end || N.body &&
|
|
3466
|
+
if (N instanceof _ && (N.bodyColon && n >= N.bodyColon.end || N.body && be(n, N.body)))
|
|
3467
3467
|
return mt(this.compiler, n, void 0);
|
|
3468
3468
|
}
|
|
3469
3469
|
return S();
|
|
@@ -3494,7 +3494,7 @@ function Ue(t, e, s, n) {
|
|
|
3494
3494
|
...t.symbol.members(l).filter(({ kind: p }) => n.includes(p)).map(({ name: p, kind: h }) => ({
|
|
3495
3495
|
label: p,
|
|
3496
3496
|
insertText: p,
|
|
3497
|
-
insertTextRules:
|
|
3497
|
+
insertTextRules: w.KeepWhitespace,
|
|
3498
3498
|
kind: Le(h),
|
|
3499
3499
|
sortText: Le(h).toString().padStart(2, "0"),
|
|
3500
3500
|
range: void 0
|
|
@@ -3515,7 +3515,7 @@ function Qn(t, e) {
|
|
|
3515
3515
|
const i = [...t.container.stack(e)];
|
|
3516
3516
|
for (; i.length > 0; ) {
|
|
3517
3517
|
const r = i.pop();
|
|
3518
|
-
if (r instanceof
|
|
3518
|
+
if (r instanceof q && ((n = r.op) == null ? void 0 : n.value) === ".")
|
|
3519
3519
|
return Ft(
|
|
3520
3520
|
t,
|
|
3521
3521
|
e,
|
|
@@ -3547,9 +3547,9 @@ function Et(t, e, s) {
|
|
|
3547
3547
|
}
|
|
3548
3548
|
function Nt(t, e) {
|
|
3549
3549
|
const s = t.container.element(e), n = t.container.scopeKind(e);
|
|
3550
|
-
if (s instanceof
|
|
3550
|
+
if (s instanceof X)
|
|
3551
3551
|
return S();
|
|
3552
|
-
if (s.body && !
|
|
3552
|
+
if (s.body && !be(e, s.body))
|
|
3553
3553
|
switch (n) {
|
|
3554
3554
|
case O.TABLE:
|
|
3555
3555
|
return {
|
|
@@ -3558,14 +3558,14 @@ function Nt(t, e) {
|
|
|
3558
3558
|
label: "headercolor",
|
|
3559
3559
|
insertText: "headercolor: ",
|
|
3560
3560
|
kind: g.Field,
|
|
3561
|
-
insertTextRules:
|
|
3561
|
+
insertTextRules: w.KeepWhitespace,
|
|
3562
3562
|
range: void 0
|
|
3563
3563
|
},
|
|
3564
3564
|
{
|
|
3565
3565
|
label: "note",
|
|
3566
3566
|
insertText: "note: ",
|
|
3567
3567
|
kind: g.Field,
|
|
3568
|
-
insertTextRules:
|
|
3568
|
+
insertTextRules: w.KeepWhitespace,
|
|
3569
3569
|
range: void 0
|
|
3570
3570
|
}
|
|
3571
3571
|
]
|
|
@@ -3581,21 +3581,21 @@ function Nt(t, e) {
|
|
|
3581
3581
|
label: i,
|
|
3582
3582
|
insertText: i,
|
|
3583
3583
|
kind: g.Property,
|
|
3584
|
-
insertTextRules:
|
|
3584
|
+
insertTextRules: w.KeepWhitespace,
|
|
3585
3585
|
range: void 0
|
|
3586
3586
|
})),
|
|
3587
3587
|
...["ref", "default"].map((i) => ({
|
|
3588
3588
|
label: i,
|
|
3589
3589
|
insertText: `${i}: `,
|
|
3590
3590
|
kind: g.Property,
|
|
3591
|
-
insertTextRules:
|
|
3591
|
+
insertTextRules: w.KeepWhitespace,
|
|
3592
3592
|
range: void 0
|
|
3593
3593
|
})),
|
|
3594
3594
|
{
|
|
3595
3595
|
label: "note",
|
|
3596
3596
|
insertText: "note: ",
|
|
3597
3597
|
kind: g.Property,
|
|
3598
|
-
insertTextRules:
|
|
3598
|
+
insertTextRules: w.KeepWhitespace,
|
|
3599
3599
|
range: void 0
|
|
3600
3600
|
}
|
|
3601
3601
|
]
|
|
@@ -3607,7 +3607,7 @@ function Nt(t, e) {
|
|
|
3607
3607
|
label: "note",
|
|
3608
3608
|
insertText: "note: ",
|
|
3609
3609
|
kind: g.Property,
|
|
3610
|
-
insertTextRules:
|
|
3610
|
+
insertTextRules: w.KeepWhitespace,
|
|
3611
3611
|
range: void 0
|
|
3612
3612
|
}
|
|
3613
3613
|
]
|
|
@@ -3618,7 +3618,7 @@ function Nt(t, e) {
|
|
|
3618
3618
|
...["unique", "pk"].map((i) => ({
|
|
3619
3619
|
label: i,
|
|
3620
3620
|
insertText: i,
|
|
3621
|
-
insertTextRules:
|
|
3621
|
+
insertTextRules: w.KeepWhitespace,
|
|
3622
3622
|
kind: g.Property,
|
|
3623
3623
|
range: void 0
|
|
3624
3624
|
})),
|
|
@@ -3626,7 +3626,7 @@ function Nt(t, e) {
|
|
|
3626
3626
|
label: i,
|
|
3627
3627
|
insertText: `${i}: `,
|
|
3628
3628
|
kind: g.Property,
|
|
3629
|
-
insertTextRules:
|
|
3629
|
+
insertTextRules: w.KeepWhitespace,
|
|
3630
3630
|
range: void 0
|
|
3631
3631
|
}))
|
|
3632
3632
|
]
|
|
@@ -3637,7 +3637,7 @@ function Nt(t, e) {
|
|
|
3637
3637
|
label: i,
|
|
3638
3638
|
insertText: `${i}: `,
|
|
3639
3639
|
kind: g.Property,
|
|
3640
|
-
insertTextRules:
|
|
3640
|
+
insertTextRules: w.KeepWhitespace,
|
|
3641
3641
|
range: void 0
|
|
3642
3642
|
}))
|
|
3643
3643
|
};
|
|
@@ -3653,7 +3653,7 @@ function qn(t, e, s) {
|
|
|
3653
3653
|
label: n,
|
|
3654
3654
|
insertText: n,
|
|
3655
3655
|
kind: g.Value,
|
|
3656
|
-
insertTextRules:
|
|
3656
|
+
insertTextRules: w.KeepWhitespace,
|
|
3657
3657
|
range: void 0
|
|
3658
3658
|
}))
|
|
3659
3659
|
};
|
|
@@ -3663,7 +3663,7 @@ function qn(t, e, s) {
|
|
|
3663
3663
|
label: n,
|
|
3664
3664
|
insertText: `${n}`,
|
|
3665
3665
|
kind: g.Value,
|
|
3666
|
-
insertTextRules:
|
|
3666
|
+
insertTextRules: w.KeepWhitespace,
|
|
3667
3667
|
range: void 0
|
|
3668
3668
|
}))
|
|
3669
3669
|
};
|
|
@@ -3671,10 +3671,10 @@ function qn(t, e, s) {
|
|
|
3671
3671
|
return S();
|
|
3672
3672
|
}
|
|
3673
3673
|
function Ft(t, e, s) {
|
|
3674
|
-
const n =
|
|
3674
|
+
const n = Ne(s).unwrap_or([]);
|
|
3675
3675
|
if (n.pop(), n.some((r) => !M(r)))
|
|
3676
3676
|
return S();
|
|
3677
|
-
const i = n.map((r) =>
|
|
3677
|
+
const i = n.map((r) => C(r).unwrap());
|
|
3678
3678
|
return Pe({
|
|
3679
3679
|
suggestions: t.symbol.ofName({ nameStack: i, owner: t.container.element(e) }).flatMap(({ symbol: r }) => t.symbol.members(r)).map(({ kind: r, name: a }) => ({
|
|
3680
3680
|
label: a,
|
|
@@ -3710,7 +3710,7 @@ function Tt() {
|
|
|
3710
3710
|
suggestions: ["Table", "TableGroup", "Enum", "Project", "Ref"].map((t) => ({
|
|
3711
3711
|
label: t,
|
|
3712
3712
|
insertText: t,
|
|
3713
|
-
insertTextRules:
|
|
3713
|
+
insertTextRules: w.KeepWhitespace,
|
|
3714
3714
|
kind: g.Keyword,
|
|
3715
3715
|
range: void 0
|
|
3716
3716
|
}))
|
|
@@ -3729,7 +3729,7 @@ function Jn(t, e, s) {
|
|
|
3729
3729
|
suggestions: ["Ref", "Note", "indexes"].map((i) => ({
|
|
3730
3730
|
label: i,
|
|
3731
3731
|
insertText: i,
|
|
3732
|
-
insertTextRules:
|
|
3732
|
+
insertTextRules: w.KeepWhitespace,
|
|
3733
3733
|
kind: g.Keyword,
|
|
3734
3734
|
range: void 0
|
|
3735
3735
|
}))
|
|
@@ -3739,7 +3739,7 @@ function Jn(t, e, s) {
|
|
|
3739
3739
|
suggestions: ["Ref", "Note", "indexes"].map((i) => ({
|
|
3740
3740
|
label: i,
|
|
3741
3741
|
insertText: i,
|
|
3742
|
-
insertTextRules:
|
|
3742
|
+
insertTextRules: w.KeepWhitespace,
|
|
3743
3743
|
kind: g.Keyword,
|
|
3744
3744
|
range: void 0
|
|
3745
3745
|
}))
|
|
@@ -3750,7 +3750,7 @@ function Zn(t, e, s) {
|
|
|
3750
3750
|
suggestions: ["Table", "TableGroup", "Enum", "Note", "Ref"].map((i) => ({
|
|
3751
3751
|
label: i,
|
|
3752
3752
|
insertText: i,
|
|
3753
|
-
insertTextRules:
|
|
3753
|
+
insertTextRules: w.KeepWhitespace,
|
|
3754
3754
|
kind: g.Keyword,
|
|
3755
3755
|
range: void 0
|
|
3756
3756
|
}))
|
|
@@ -3758,7 +3758,7 @@ function Zn(t, e, s) {
|
|
|
3758
3758
|
suggestions: ["Table", "TableGroup", "Enum", "Note", "Ref"].map((i) => ({
|
|
3759
3759
|
label: i,
|
|
3760
3760
|
insertText: i,
|
|
3761
|
-
insertTextRules:
|
|
3761
|
+
insertTextRules: w.KeepWhitespace,
|
|
3762
3762
|
kind: g.Keyword,
|
|
3763
3763
|
range: void 0
|
|
3764
3764
|
}))
|
|
@@ -3781,7 +3781,7 @@ function Kn(t) {
|
|
|
3781
3781
|
return n !== m.Table && n !== m.Schema ? [] : {
|
|
3782
3782
|
label: i,
|
|
3783
3783
|
insertText: i,
|
|
3784
|
-
insertTextRules:
|
|
3784
|
+
insertTextRules: w.KeepWhitespace,
|
|
3785
3785
|
kind: Le(n),
|
|
3786
3786
|
range: void 0
|
|
3787
3787
|
};
|
|
@@ -3854,7 +3854,7 @@ function ts(t, e) {
|
|
|
3854
3854
|
].map((s) => ({
|
|
3855
3855
|
label: s,
|
|
3856
3856
|
insertText: s,
|
|
3857
|
-
insertTextRules:
|
|
3857
|
+
insertTextRules: w.KeepWhitespace,
|
|
3858
3858
|
kind: g.TypeParameter,
|
|
3859
3859
|
sortText: g.TypeParameter.toString().padStart(2, "0"),
|
|
3860
3860
|
range: void 0
|
|
@@ -3880,7 +3880,7 @@ function Vt(t, e) {
|
|
|
3880
3880
|
return {
|
|
3881
3881
|
label: l,
|
|
3882
3882
|
insertText: l,
|
|
3883
|
-
insertTextRules:
|
|
3883
|
+
insertTextRules: w.KeepWhitespace,
|
|
3884
3884
|
kind: Le(m.Column),
|
|
3885
3885
|
range: void 0
|
|
3886
3886
|
};
|
|
@@ -3902,7 +3902,7 @@ class Gt {
|
|
|
3902
3902
|
const { uri: n } = e, i = et(e, s), r = [...this.compiler.container.stack(i)];
|
|
3903
3903
|
for (; r.length !== 0; ) {
|
|
3904
3904
|
const l = r.pop();
|
|
3905
|
-
if ((a = l == null ? void 0 : l.referee) != null && a.declaration && [
|
|
3905
|
+
if ((a = l == null ? void 0 : l.referee) != null && a.declaration && [he.PRIMARY_EXPRESSION, he.VARIABLE].includes(l == null ? void 0 : l.kind)) {
|
|
3906
3906
|
const { startPos: p, endPos: h } = l.referee.declaration;
|
|
3907
3907
|
return [
|
|
3908
3908
|
{
|
|
@@ -3929,9 +3929,9 @@ class Ct {
|
|
|
3929
3929
|
for (; r.length !== 0; ) {
|
|
3930
3930
|
const a = r.pop();
|
|
3931
3931
|
if (a && [
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3932
|
+
he.ELEMENT_DECLARATION,
|
|
3933
|
+
he.FUNCTION_APPLICATION,
|
|
3934
|
+
he.PRIMARY_EXPRESSION
|
|
3935
3935
|
].includes(a == null ? void 0 : a.kind)) {
|
|
3936
3936
|
const { symbol: l } = a;
|
|
3937
3937
|
if (l != null && l.references.length)
|
|
@@ -3951,7 +3951,7 @@ class Ct {
|
|
|
3951
3951
|
}
|
|
3952
3952
|
const is = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3953
3953
|
__proto__: null,
|
|
3954
|
-
CompletionItemInsertTextRule:
|
|
3954
|
+
CompletionItemInsertTextRule: w,
|
|
3955
3955
|
CompletionItemKind: g,
|
|
3956
3956
|
DBMLCompletionItemProvider: Mt,
|
|
3957
3957
|
DBMLDefinitionProvider: Gt,
|
|
@@ -3966,7 +3966,7 @@ class rs {
|
|
|
3966
3966
|
).fill(null), this.nodeIdGenerator = new Wt(), this.symbolIdGenerator = new Qt(), this.token = {
|
|
3967
3967
|
invalidStream: this.createQuery(
|
|
3968
3968
|
6,
|
|
3969
|
-
() => this.parse.tokens().filter(
|
|
3969
|
+
() => this.parse.tokens().filter(wt)
|
|
3970
3970
|
),
|
|
3971
3971
|
// Valid + Invalid tokens (which are guarenteed to be non-trivials) are included in the stream
|
|
3972
3972
|
flatStream: this.createQuery(
|
|
@@ -4016,7 +4016,7 @@ class rs {
|
|
|
4016
4016
|
let a = this.parse.ast();
|
|
4017
4017
|
const l = [a];
|
|
4018
4018
|
for (; ; ) {
|
|
4019
|
-
const h = sn(a).find((T) =>
|
|
4019
|
+
const h = sn(a).find((T) => be(r, T));
|
|
4020
4020
|
if (h === void 0 || h instanceof V)
|
|
4021
4021
|
break;
|
|
4022
4022
|
l.push(h), a = h;
|
|
@@ -4032,7 +4032,7 @@ class rs {
|
|
|
4032
4032
|
T[f] === `
|
|
4033
4033
|
` && (l.pop(), p = !0);
|
|
4034
4034
|
} else
|
|
4035
|
-
h instanceof
|
|
4035
|
+
h instanceof Q || h instanceof q ? this.container.token(e).token !== h.op && (l.pop(), p = !0) : h instanceof U ? h.listCloseBracket && h.end <= e && (l.pop(), p = !0) : h instanceof J ? h.tupleCloseParen && h.end <= e && (l.pop(), p = !0) : h instanceof ee ? h.blockCloseBrace && h.end <= e && (l.pop(), p = !0) : h instanceof te || h.end < e && (l.pop(), p = !0);
|
|
4036
4036
|
if (p) {
|
|
4037
4037
|
const T = L.last(l);
|
|
4038
4038
|
T instanceof _ && T.end <= e && l.pop();
|
|
@@ -4072,7 +4072,7 @@ class rs {
|
|
|
4072
4072
|
),
|
|
4073
4073
|
scopeKind: this.createQuery(15, (e) => {
|
|
4074
4074
|
var n;
|
|
4075
|
-
if (this.container.element(e) instanceof
|
|
4075
|
+
if (this.container.element(e) instanceof X)
|
|
4076
4076
|
return 8;
|
|
4077
4077
|
switch ((n = this.container.element(e).type) == null ? void 0 : n.value.toLowerCase()) {
|
|
4078
4078
|
case "table":
|