@dbml/parse 3.4.3 → 3.5.0
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 +170 -170
- package/package.json +2 -2
package/dist/dbml-parse.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import I from "lodash";
|
|
2
2
|
var u = /* @__PURE__ */ ((t) => (t.SPACE = "<space>", t.TAB = "<tab>", t.NEWLINE = "<newline>", t.COMMA = "<comma>", t.LPAREN = "<lparen>", t.RPAREN = "<rparen>", t.LBRACE = "<lbrace>", t.RBRACE = "<rbrace>", t.LBRACKET = "<lbracket>", t.RBRACKET = "<rbracket>", t.LANGLE = "<langle>", t.RANGLE = "<rangle>", t.OP = "<op>", t.EOF = "<eof>", t.NUMERIC_LITERAL = "<number>", t.STRING_LITERAL = "<string>", t.COLOR_LITERAL = "<color>", t.FUNCTION_EXPRESSION = "<function-expression>", t.QUOTED_STRING = "<variable>", t.IDENTIFIER = "<identifier>", t.SEMICOLON = "<semicolon>", t.COLON = "<colon>", t.SINGLE_LINE_COMMENT = "<single-line-comment>", t.MULTILINE_COMMENT = "<multiline-comment>", t))(u || {});
|
|
3
|
-
function
|
|
3
|
+
function Wt(t) {
|
|
4
4
|
switch (t.kind) {
|
|
5
5
|
case "<newline>":
|
|
6
6
|
case "<space>":
|
|
@@ -12,7 +12,7 @@ function jt(t) {
|
|
|
12
12
|
return !1;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function it(t) {
|
|
16
16
|
if (!t)
|
|
17
17
|
return !1;
|
|
18
18
|
switch (t) {
|
|
@@ -33,7 +33,7 @@ function rt(t) {
|
|
|
33
33
|
return !1;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function rt(t) {
|
|
37
37
|
return t !== void 0 && t.kind === "<op>";
|
|
38
38
|
}
|
|
39
39
|
class F {
|
|
@@ -44,22 +44,22 @@ class F {
|
|
|
44
44
|
return new F(e, n, s, i, r);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function Tt(t) {
|
|
48
48
|
return t.trailingTrivia.find(({ kind: e }) => e === u.NEWLINE) !== void 0;
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
return e.leadingTrivia.find(({ kind: s }) => s === u.NEWLINE) !== void 0 ||
|
|
50
|
+
function at(t, e) {
|
|
51
|
+
return e.leadingTrivia.find(({ kind: s }) => s === u.NEWLINE) !== void 0 || Tt(t);
|
|
52
52
|
}
|
|
53
53
|
function Ce(t) {
|
|
54
54
|
return t.trailingTrivia.find(({ kind: e }) => e === u.SPACE) !== void 0;
|
|
55
55
|
}
|
|
56
|
-
function
|
|
57
|
-
return t.trailingTrivia.length === 0 ? t.end :
|
|
56
|
+
function bt(t) {
|
|
57
|
+
return t.trailingTrivia.length === 0 ? t.end : bt(I.last(t.trailingTrivia));
|
|
58
58
|
}
|
|
59
|
-
function
|
|
60
|
-
return t.leadingTrivia.length === 0 ? t.start :
|
|
59
|
+
function It(t) {
|
|
60
|
+
return t.leadingTrivia.length === 0 ? t.start : It(t.leadingTrivia[0]);
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function jt(t) {
|
|
63
63
|
return [u.SINGLE_LINE_COMMENT, u.MULTILINE_COMMENT].includes(
|
|
64
64
|
t.kind
|
|
65
65
|
);
|
|
@@ -81,13 +81,13 @@ class x {
|
|
|
81
81
|
constructor(e, n, s) {
|
|
82
82
|
this.id = e, this.kind = n;
|
|
83
83
|
const i = s.find((a) => a !== void 0 && !Number.isNaN(a.start));
|
|
84
|
-
i ? (this.startPos = i.startPos, this.fullStart = i instanceof F ?
|
|
84
|
+
i ? (this.startPos = i.startPos, this.fullStart = i instanceof F ? It(i) : i.fullStart) : (this.startPos = {
|
|
85
85
|
offset: NaN,
|
|
86
86
|
column: NaN,
|
|
87
87
|
line: NaN
|
|
88
88
|
}, this.fullStart = NaN);
|
|
89
89
|
const r = [...s].reverse().find((a) => a !== void 0 && !Number.isNaN(a.end));
|
|
90
|
-
r ? (this.endPos = r.endPos, this.fullEnd = r instanceof F ?
|
|
90
|
+
r ? (this.endPos = r.endPos, this.fullEnd = r instanceof F ? bt(r) : r.fullEnd) : (this.endPos = {
|
|
91
91
|
offset: NaN,
|
|
92
92
|
column: NaN,
|
|
93
93
|
line: NaN
|
|
@@ -151,7 +151,7 @@ class q extends x {
|
|
|
151
151
|
super(i, "<infix-expression>", [n, e, s]), this.op = e, this.leftExpression = n, this.rightExpression = s;
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
-
class
|
|
154
|
+
class Ue extends x {
|
|
155
155
|
constructor({ op: e, expression: n }, s) {
|
|
156
156
|
super(s, "<postfix-expression>", [n, e]), this.op = e, this.expression = n;
|
|
157
157
|
}
|
|
@@ -184,7 +184,7 @@ class D extends x {
|
|
|
184
184
|
}, r) {
|
|
185
185
|
super(r, "<list-expression>", [
|
|
186
186
|
e,
|
|
187
|
-
...
|
|
187
|
+
...Lt(n, s),
|
|
188
188
|
i
|
|
189
189
|
]), this.listOpenBracket = e, this.elementList = n, this.commaList = s, this.listCloseBracket = i;
|
|
190
190
|
}
|
|
@@ -198,12 +198,12 @@ class J extends x {
|
|
|
198
198
|
}, r) {
|
|
199
199
|
super(r, "<tuple-expression>", [
|
|
200
200
|
e,
|
|
201
|
-
...
|
|
201
|
+
...Lt(n, s),
|
|
202
202
|
i
|
|
203
203
|
]), this.tupleOpenParen = e, this.elementList = n, this.commaList = s, this.tupleCloseParen = i;
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
|
-
class
|
|
206
|
+
class We extends J {
|
|
207
207
|
constructor({
|
|
208
208
|
groupOpenParen: e,
|
|
209
209
|
expression: n,
|
|
@@ -243,7 +243,7 @@ class U extends x {
|
|
|
243
243
|
super(n, "<primary-expression>", [e]), this.expression = e;
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
|
-
class
|
|
246
|
+
class xe extends x {
|
|
247
247
|
constructor({ pre: e }, n) {
|
|
248
248
|
const s = F.create(u.SPACE, e.endPos, e.endPos, " ", !1);
|
|
249
249
|
super(n, "<dummy>", [s]);
|
|
@@ -254,7 +254,7 @@ class ue extends x {
|
|
|
254
254
|
super(s, "<array>", [e, n]), this.array = e, this.indexer = n;
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function Lt(t, e) {
|
|
258
258
|
if (!t || t.length === 0)
|
|
259
259
|
return e || [];
|
|
260
260
|
if (!e || e.length === 0)
|
|
@@ -335,10 +335,10 @@ class w {
|
|
|
335
335
|
}
|
|
336
336
|
}
|
|
337
337
|
var m = /* @__PURE__ */ ((t) => (t.Schema = "Schema", t.Table = "Table", t.Column = "Column", t.TableGroup = "TableGroup", t.TableGroupField = "TableGroup field", t.Enum = "Enum", t.EnumField = "Enum field", t.Note = "Note", t))(m || {});
|
|
338
|
-
function
|
|
338
|
+
function je(t) {
|
|
339
339
|
return `Schema:${t}`;
|
|
340
340
|
}
|
|
341
|
-
function
|
|
341
|
+
function Oe(t) {
|
|
342
342
|
return `Table:${t}`;
|
|
343
343
|
}
|
|
344
344
|
function Ye(t) {
|
|
@@ -368,9 +368,9 @@ function Ve(t, e) {
|
|
|
368
368
|
case "Enum field":
|
|
369
369
|
return Qe(t);
|
|
370
370
|
case "Schema":
|
|
371
|
-
return
|
|
371
|
+
return je(t);
|
|
372
372
|
case "Table":
|
|
373
|
-
return
|
|
373
|
+
return Oe(t);
|
|
374
374
|
case "TableGroup":
|
|
375
375
|
return qe(t);
|
|
376
376
|
case "TableGroup field":
|
|
@@ -395,8 +395,8 @@ function Qt(t) {
|
|
|
395
395
|
}
|
|
396
396
|
function qt(t) {
|
|
397
397
|
return [
|
|
398
|
-
|
|
399
|
-
|
|
398
|
+
je,
|
|
399
|
+
Oe,
|
|
400
400
|
ze,
|
|
401
401
|
qe,
|
|
402
402
|
Ye,
|
|
@@ -404,21 +404,21 @@ function qt(t) {
|
|
|
404
404
|
He
|
|
405
405
|
].map((e) => e(t));
|
|
406
406
|
}
|
|
407
|
-
function
|
|
407
|
+
function Me(t) {
|
|
408
408
|
return !!t.match(/(\p{L}|_|\p{M})/gu);
|
|
409
409
|
}
|
|
410
|
-
function
|
|
410
|
+
function Re(t) {
|
|
411
411
|
const [e] = t;
|
|
412
412
|
return e >= "0" && e <= "9";
|
|
413
413
|
}
|
|
414
414
|
function Ht(t) {
|
|
415
415
|
const [e] = t;
|
|
416
|
-
return
|
|
416
|
+
return Re(e) || Me(e) && e.toLowerCase() >= "a" && e.toLowerCase() <= "f";
|
|
417
417
|
}
|
|
418
418
|
function de(t) {
|
|
419
|
-
return
|
|
419
|
+
return Me(t) || Re(t);
|
|
420
420
|
}
|
|
421
|
-
function
|
|
421
|
+
function ot(t, e) {
|
|
422
422
|
const n = [], s = Math.min(t.length, e.length);
|
|
423
423
|
for (let i = 0; i < s; i += 1)
|
|
424
424
|
n.push(t[i], e[i]);
|
|
@@ -438,7 +438,7 @@ class Jt {
|
|
|
438
438
|
return this.id++;
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
|
-
class
|
|
441
|
+
class gt {
|
|
442
442
|
constructor({ symbolTable: e }, n) {
|
|
443
443
|
this.references = [], this.id = n, this.symbolTable = e;
|
|
444
444
|
}
|
|
@@ -453,7 +453,7 @@ class Kt {
|
|
|
453
453
|
this.references = [], this.id = n, this.declaration = e;
|
|
454
454
|
}
|
|
455
455
|
}
|
|
456
|
-
class
|
|
456
|
+
class _t {
|
|
457
457
|
constructor({ symbolTable: e, declaration: n }, s) {
|
|
458
458
|
this.references = [], this.id = s, this.symbolTable = e, this.declaration = n;
|
|
459
459
|
}
|
|
@@ -528,7 +528,7 @@ function sn(t, e, n) {
|
|
|
528
528
|
})
|
|
529
529
|
) : new w();
|
|
530
530
|
}
|
|
531
|
-
function
|
|
531
|
+
function ct(t) {
|
|
532
532
|
return t.kind === u.IDENTIFIER && t.value === "as";
|
|
533
533
|
}
|
|
534
534
|
function E(t) {
|
|
@@ -548,7 +548,7 @@ function an(t) {
|
|
|
548
548
|
E(t.op), E(t.expression);
|
|
549
549
|
else if (t instanceof q)
|
|
550
550
|
E(t.leftExpression), E(t.op), E(t.rightExpression);
|
|
551
|
-
else if (t instanceof
|
|
551
|
+
else if (t instanceof Ue)
|
|
552
552
|
E(t.op), E(t.expression);
|
|
553
553
|
else if (t instanceof ne)
|
|
554
554
|
E(t.blockOpenBrace), t.body.forEach(E), E(t.blockCloseBrace);
|
|
@@ -569,9 +569,9 @@ function an(t) {
|
|
|
569
569
|
else if (t instanceof be)
|
|
570
570
|
E(t.literal);
|
|
571
571
|
else
|
|
572
|
-
throw t instanceof
|
|
572
|
+
throw t instanceof We ? new Error("This case is handled by the TupleExpressionNode case") : new Error("Unreachable case in markInvalidNode");
|
|
573
573
|
}
|
|
574
|
-
function
|
|
574
|
+
function At(t) {
|
|
575
575
|
return !!(t != null && t.isInvalid);
|
|
576
576
|
}
|
|
577
577
|
function P(...t) {
|
|
@@ -602,7 +602,7 @@ function on(t) {
|
|
|
602
602
|
return P(t.op, t.expression);
|
|
603
603
|
if (t instanceof q)
|
|
604
604
|
return P(t.leftExpression, t.op, t.rightExpression);
|
|
605
|
-
if (t instanceof
|
|
605
|
+
if (t instanceof Ue)
|
|
606
606
|
return P(t.expression, t.op);
|
|
607
607
|
if (t instanceof te)
|
|
608
608
|
return P(t.value);
|
|
@@ -613,13 +613,13 @@ function on(t) {
|
|
|
613
613
|
if (t instanceof D)
|
|
614
614
|
return P(
|
|
615
615
|
t.listOpenBracket,
|
|
616
|
-
...
|
|
616
|
+
...ot(t.elementList, t.commaList),
|
|
617
617
|
t.listCloseBracket
|
|
618
618
|
);
|
|
619
619
|
if (t instanceof J)
|
|
620
620
|
return P(
|
|
621
621
|
t.tupleOpenParen,
|
|
622
|
-
...
|
|
622
|
+
...ot(t.elementList, t.commaList),
|
|
623
623
|
t.tupleCloseParen
|
|
624
624
|
);
|
|
625
625
|
if (t instanceof H)
|
|
@@ -631,12 +631,12 @@ function on(t) {
|
|
|
631
631
|
t.array,
|
|
632
632
|
t.indexer
|
|
633
633
|
);
|
|
634
|
-
throw t instanceof
|
|
634
|
+
throw t instanceof We ? new Error("This case is already handled by TupleExpressionNode") : new Error("Unreachable - no other possible cases");
|
|
635
635
|
}
|
|
636
636
|
function Ge(t) {
|
|
637
637
|
return M(t) ? new S(t.expression.variable) : new w();
|
|
638
638
|
}
|
|
639
|
-
function
|
|
639
|
+
function j(t) {
|
|
640
640
|
var e;
|
|
641
641
|
return t instanceof U && (t.expression instanceof Z && t.expression.variable instanceof F && t.expression.variable.kind === u.QUOTED_STRING || t.expression instanceof be && ((e = t.expression.literal) == null ? void 0 : e.kind) === u.STRING_LITERAL);
|
|
642
642
|
}
|
|
@@ -767,15 +767,15 @@ class cn {
|
|
|
767
767
|
this.match("/") ? this.singleLineComment() : this.match("*") ? this.multilineComment() : this.operator();
|
|
768
768
|
break;
|
|
769
769
|
default:
|
|
770
|
-
if (
|
|
770
|
+
if (it(e)) {
|
|
771
771
|
this.operator();
|
|
772
772
|
break;
|
|
773
773
|
}
|
|
774
|
-
if (
|
|
774
|
+
if (Me(e)) {
|
|
775
775
|
this.identifier();
|
|
776
776
|
break;
|
|
777
777
|
}
|
|
778
|
-
if (
|
|
778
|
+
if (Re(e)) {
|
|
779
779
|
this.numericLiteralOrIdentifier();
|
|
780
780
|
break;
|
|
781
781
|
}
|
|
@@ -795,13 +795,13 @@ class cn {
|
|
|
795
795
|
let e = !0, n = [], s;
|
|
796
796
|
const i = [];
|
|
797
797
|
for (const r of this.tokens)
|
|
798
|
-
|
|
798
|
+
Wt(r) ? (n.push(r), r.kind === u.NEWLINE && s && (s.trailingTrivia = n, e = !0, s = void 0, n = [])) : (e ? r.leadingTrivia = n : s.trailingTrivia = n, i.push(r), n = [], s = r, e = !1);
|
|
799
799
|
this.tokens = i;
|
|
800
800
|
}
|
|
801
801
|
gatherInvalid() {
|
|
802
802
|
let e;
|
|
803
803
|
const n = [], s = [];
|
|
804
|
-
for (e = 0; e < this.tokens.length &&
|
|
804
|
+
for (e = 0; e < this.tokens.length && At(this.tokens[e]); e += 1)
|
|
805
805
|
s.push(this.tokens[e]);
|
|
806
806
|
let i = this.tokens[e];
|
|
807
807
|
for (i.leadingInvalid = [...s, ...i.leadingInvalid]; e < this.tokens.length; e += 1) {
|
|
@@ -895,7 +895,7 @@ class cn {
|
|
|
895
895
|
this.addToken(u.IDENTIFIER);
|
|
896
896
|
}
|
|
897
897
|
operator() {
|
|
898
|
-
for (;
|
|
898
|
+
for (; it(this.peek()); )
|
|
899
899
|
this.advance();
|
|
900
900
|
this.addToken(u.OP);
|
|
901
901
|
}
|
|
@@ -912,7 +912,7 @@ class cn {
|
|
|
912
912
|
return this.advance(), this.addToken(u.NUMERIC_LITERAL);
|
|
913
913
|
if (!n && !de(this.peek()))
|
|
914
914
|
return this.addToken(u.NUMERIC_LITERAL);
|
|
915
|
-
if (!n && !
|
|
915
|
+
if (!n && !Re(this.peek()))
|
|
916
916
|
break;
|
|
917
917
|
this.advance();
|
|
918
918
|
}
|
|
@@ -981,7 +981,7 @@ class cn {
|
|
|
981
981
|
}
|
|
982
982
|
}
|
|
983
983
|
}
|
|
984
|
-
var
|
|
984
|
+
var Se = /* @__PURE__ */ ((t) => (t[t.ListExpression = 0] = "ListExpression", t[t.GroupExpression = 1] = "GroupExpression", t[t.BlockExpression = 2] = "BlockExpression", t))(Se || {});
|
|
985
985
|
class ln {
|
|
986
986
|
constructor() {
|
|
987
987
|
this.stack = [], this.numberOfNestedLParens = 0, this.numberOfNestedLBrackets = 0, this.numberOfNestedLBraces = 0;
|
|
@@ -1069,7 +1069,7 @@ class hn {
|
|
|
1069
1069
|
}, this.synchronizeElementDeclarationName = () => {
|
|
1070
1070
|
for (; !this.isAtEnd(); ) {
|
|
1071
1071
|
const s = this.peek();
|
|
1072
|
-
if (
|
|
1072
|
+
if (ct(s) || this.check(u.COLON, u.LBRACE, u.LBRACKET))
|
|
1073
1073
|
break;
|
|
1074
1074
|
E(s), this.advance();
|
|
1075
1075
|
}
|
|
@@ -1080,7 +1080,7 @@ class hn {
|
|
|
1080
1080
|
break;
|
|
1081
1081
|
E(s), this.advance();
|
|
1082
1082
|
}
|
|
1083
|
-
}, this.blockExpression = this.contextStack.withContextDo(
|
|
1083
|
+
}, this.blockExpression = this.contextStack.withContextDo(Se.BlockExpression, () => {
|
|
1084
1084
|
const s = { body: [] }, i = () => this.nodeFactory.create(ne, s);
|
|
1085
1085
|
try {
|
|
1086
1086
|
this.consume("Expect an opening brace '{'", u.LBRACE), s.blockOpenBrace = this.previous();
|
|
@@ -1115,12 +1115,12 @@ class hn {
|
|
|
1115
1115
|
if (!this.check(u.RBRACE))
|
|
1116
1116
|
for (E(this.advance()); !this.isAtEnd(); ) {
|
|
1117
1117
|
const s = this.peek();
|
|
1118
|
-
if (this.check(u.RBRACE) ||
|
|
1118
|
+
if (this.check(u.RBRACE) || at(this.previous(), s))
|
|
1119
1119
|
break;
|
|
1120
1120
|
E(s), this.advance();
|
|
1121
1121
|
}
|
|
1122
|
-
}, this.tupleExpression = this.contextStack.withContextDo(
|
|
1123
|
-
const s = { elementList: [], commaList: [] }, i = () => this.nodeFactory.create(
|
|
1122
|
+
}, this.tupleExpression = this.contextStack.withContextDo(Se.GroupExpression, () => {
|
|
1123
|
+
const s = { elementList: [], commaList: [] }, i = () => this.nodeFactory.create(We, {
|
|
1124
1124
|
groupOpenParen: s.tupleOpenParen,
|
|
1125
1125
|
groupCloseParen: s.tupleCloseParen,
|
|
1126
1126
|
expression: s.elementList[0]
|
|
@@ -1171,7 +1171,7 @@ class hn {
|
|
|
1171
1171
|
break;
|
|
1172
1172
|
E(s), this.advance();
|
|
1173
1173
|
}
|
|
1174
|
-
}, this.listExpression = this.contextStack.withContextDo(
|
|
1174
|
+
}, this.listExpression = this.contextStack.withContextDo(Se.ListExpression, () => {
|
|
1175
1175
|
const s = { elementList: [], commaList: [] }, i = () => this.nodeFactory.create(D, s);
|
|
1176
1176
|
try {
|
|
1177
1177
|
this.consume("Expect an opening bracket '['", u.LBRACKET), s.listOpenBracket = this.previous();
|
|
@@ -1324,7 +1324,7 @@ class hn {
|
|
|
1324
1324
|
throw new d(s.token, n(), s.handlerContext);
|
|
1325
1325
|
this.synchronizeElementDeclarationName();
|
|
1326
1326
|
}
|
|
1327
|
-
if (
|
|
1327
|
+
if (ct(this.peek()))
|
|
1328
1328
|
if (e.as = this.advance(), this.check(u.COLON, u.LBRACE, u.LBRACKET))
|
|
1329
1329
|
this.logError(this.peek(), o.UNEXPECTED_TOKEN, "Expect an alias");
|
|
1330
1330
|
else
|
|
@@ -1410,7 +1410,7 @@ class hn {
|
|
|
1410
1410
|
return n();
|
|
1411
1411
|
}
|
|
1412
1412
|
shouldStopExpression() {
|
|
1413
|
-
if (this.isAtEnd() ||
|
|
1413
|
+
if (this.isAtEnd() || Tt(this.previous()))
|
|
1414
1414
|
return !0;
|
|
1415
1415
|
const e = this.peek().kind;
|
|
1416
1416
|
return e === u.RBRACE || e === u.RBRACKET || e === u.RPAREN || e === u.COMMA || e === u.COLON;
|
|
@@ -1424,12 +1424,12 @@ class hn {
|
|
|
1424
1424
|
for (; !this.isAtEnd(); ) {
|
|
1425
1425
|
const s = this.peek();
|
|
1426
1426
|
if (s.kind === u.LPAREN) {
|
|
1427
|
-
const { left: i } =
|
|
1427
|
+
const { left: i } = lt(s);
|
|
1428
1428
|
if (i < e || // When '(' is encountered,
|
|
1429
1429
|
// consider it part of another expression if
|
|
1430
1430
|
// it's at the start of a new line
|
|
1431
1431
|
// and we're currently not having unmatched '(' or '['
|
|
1432
|
-
|
|
1432
|
+
at(this.previous(), s) && !this.contextStack.isWithinGroupExpressionContext() && !this.contextStack.isWithinListExpressionContext())
|
|
1433
1433
|
break;
|
|
1434
1434
|
try {
|
|
1435
1435
|
n = this.nodeFactory.create(H, {
|
|
@@ -1456,12 +1456,12 @@ class hn {
|
|
|
1456
1456
|
indexer: i.partialNode
|
|
1457
1457
|
}), new d(i.token, n, i.handlerContext)) : i;
|
|
1458
1458
|
}
|
|
1459
|
-
} else if (
|
|
1460
|
-
const i = s, r =
|
|
1459
|
+
} else if (rt(s)) {
|
|
1460
|
+
const i = s, r = lt(i);
|
|
1461
1461
|
if (r.left !== null) {
|
|
1462
1462
|
if (r.left <= e)
|
|
1463
1463
|
break;
|
|
1464
|
-
this.advance(), n = this.nodeFactory.create(
|
|
1464
|
+
this.advance(), n = this.nodeFactory.create(Ue, {
|
|
1465
1465
|
expression: n,
|
|
1466
1466
|
op: i
|
|
1467
1467
|
});
|
|
@@ -1491,7 +1491,7 @@ class hn {
|
|
|
1491
1491
|
}
|
|
1492
1492
|
leftExpression_bp() {
|
|
1493
1493
|
let e;
|
|
1494
|
-
if (
|
|
1494
|
+
if (rt(this.peek())) {
|
|
1495
1495
|
const n = {};
|
|
1496
1496
|
n.op = this.peek();
|
|
1497
1497
|
const s = En(n.op);
|
|
@@ -1502,7 +1502,7 @@ class hn {
|
|
|
1502
1502
|
`Unexpected '${n.op.value}' in an expression`
|
|
1503
1503
|
), new d(
|
|
1504
1504
|
n.op,
|
|
1505
|
-
this.nodeFactory.create(
|
|
1505
|
+
this.nodeFactory.create(xe, { pre: n.op }),
|
|
1506
1506
|
this.contextStack.findHandlerContext(this.tokens, this.current)
|
|
1507
1507
|
);
|
|
1508
1508
|
this.advance();
|
|
@@ -1516,10 +1516,10 @@ class hn {
|
|
|
1516
1516
|
)) : i;
|
|
1517
1517
|
}
|
|
1518
1518
|
e = this.nodeFactory.create(Q, n);
|
|
1519
|
-
} else if (e = this.extractOperand(), e instanceof
|
|
1519
|
+
} else if (e = this.extractOperand(), e instanceof xe)
|
|
1520
1520
|
throw new d(
|
|
1521
1521
|
this.peek(),
|
|
1522
|
-
this.nodeFactory.create(
|
|
1522
|
+
this.nodeFactory.create(xe, { pre: this.peek() }),
|
|
1523
1523
|
this.contextStack.findHandlerContext(this.tokens, this.current)
|
|
1524
1524
|
);
|
|
1525
1525
|
return e;
|
|
@@ -1543,7 +1543,7 @@ class hn {
|
|
|
1543
1543
|
this.peek(),
|
|
1544
1544
|
o.INVALID_OPERAND,
|
|
1545
1545
|
`Invalid start of operand "${this.peek().value}"`
|
|
1546
|
-
), this.nodeFactory.create(
|
|
1546
|
+
), this.nodeFactory.create(xe, { pre: this.previous() }));
|
|
1547
1547
|
}
|
|
1548
1548
|
/* Parsing FunctionExpression */
|
|
1549
1549
|
functionExpression() {
|
|
@@ -1671,7 +1671,7 @@ function En(t) {
|
|
|
1671
1671
|
const Nn = {
|
|
1672
1672
|
"(": { left: 14, right: null }
|
|
1673
1673
|
};
|
|
1674
|
-
function
|
|
1674
|
+
function lt(t) {
|
|
1675
1675
|
return Nn[t.value] || { left: null, right: null };
|
|
1676
1676
|
}
|
|
1677
1677
|
var b = /* @__PURE__ */ ((t) => (t.Table = "table", t.Enum = "enum", t.Ref = "ref", t.Note = "note", t.Project = "project", t.Indexes = "indexes", t.TableGroup = "tablegroup", t))(b || {});
|
|
@@ -1744,9 +1744,9 @@ function X(t) {
|
|
|
1744
1744
|
return M(t) ? new S(t.expression.variable.value) : new w();
|
|
1745
1745
|
}
|
|
1746
1746
|
function Xe(t) {
|
|
1747
|
-
if (
|
|
1747
|
+
if (ut(t))
|
|
1748
1748
|
return t instanceof te ? new S({ functional: [t], nonFunctional: [] }) : new S({ functional: [], nonFunctional: [t] });
|
|
1749
|
-
if (t instanceof J && t.elementList.every(
|
|
1749
|
+
if (t instanceof J && t.elementList.every(ut)) {
|
|
1750
1750
|
const e = t.elementList.filter(
|
|
1751
1751
|
(s) => s instanceof te
|
|
1752
1752
|
), n = t.elementList.filter(M);
|
|
@@ -1760,7 +1760,7 @@ function V(t) {
|
|
|
1760
1760
|
return e === void 0 ? new w() : new S(e);
|
|
1761
1761
|
}
|
|
1762
1762
|
function z(t) {
|
|
1763
|
-
return
|
|
1763
|
+
return j(t) ? t.expression instanceof Z ? new S(t.expression.variable.value) : new S(t.expression.literal.value) : new w();
|
|
1764
1764
|
}
|
|
1765
1765
|
function mn(t) {
|
|
1766
1766
|
var e;
|
|
@@ -1773,7 +1773,7 @@ function Tn(t) {
|
|
|
1773
1773
|
const { tupleElements: s } = e.unwrap(), { tupleElements: i } = n.unwrap();
|
|
1774
1774
|
return (s == null ? void 0 : s.length) === (i == null ? void 0 : i.length);
|
|
1775
1775
|
}
|
|
1776
|
-
function
|
|
1776
|
+
function ut(t) {
|
|
1777
1777
|
return t instanceof U && t.expression instanceof Z || t instanceof te;
|
|
1778
1778
|
}
|
|
1779
1779
|
function bn(t, e) {
|
|
@@ -1815,7 +1815,7 @@ class In {
|
|
|
1815
1815
|
if (e instanceof ne)
|
|
1816
1816
|
return [new l(o.UNEXPECTED_COMPLEX_BODY, "A Custom element can only have an inline field", e)];
|
|
1817
1817
|
const n = [];
|
|
1818
|
-
return
|
|
1818
|
+
return j(e.callee) || n.push(new l(o.INVALID_CUSTOM_ELEMENT_VALUE, "A Custom element value can only be a string", e)), e.args.length > 0 && n.push(...e.args.map((s) => new l(o.INVALID_CUSTOM_ELEMENT_VALUE, "A Custom element value can only be a string", s))), n;
|
|
1819
1819
|
}
|
|
1820
1820
|
}
|
|
1821
1821
|
class we {
|
|
@@ -1846,7 +1846,7 @@ class Ln {
|
|
|
1846
1846
|
return this.declarationNode.parent instanceof A ? [new l(o.INVALID_PROJECT_CONTEXT, "An Enum can only appear top-level", this.declarationNode)] : [];
|
|
1847
1847
|
}
|
|
1848
1848
|
validateName(e) {
|
|
1849
|
-
return e ?
|
|
1849
|
+
return e ? wt(e) ? [] : [new l(o.INVALID_NAME, "An Enum name must be of the form <enum> or <schema>.<enum>", e)] : [new l(o.NAME_NOT_FOUND, "An Enum must have a name", this.declarationNode)];
|
|
1850
1850
|
}
|
|
1851
1851
|
validateAlias(e) {
|
|
1852
1852
|
return e ? [new l(o.UNEXPECTED_ALIAS, "A Ref shouldn't have an alias", e)] : [];
|
|
@@ -1856,7 +1856,7 @@ class Ln {
|
|
|
1856
1856
|
this.declarationNode.symbol = this.symbolFactory.create(Zt, { declaration: this.declarationNode, symbolTable: new we() });
|
|
1857
1857
|
const { name: n } = this.declarationNode, s = C(n);
|
|
1858
1858
|
if (s.isOk()) {
|
|
1859
|
-
const i = s.unwrap(), r = i.pop(), a =
|
|
1859
|
+
const i = s.unwrap(), r = i.pop(), a = Ze(i, this.publicSymbolTable, this.symbolFactory), c = ze(r);
|
|
1860
1860
|
a.has(c) && e.push(new l(o.DUPLICATE_NAME, `Enum name ${r} already exists in schema '${i.join(".") || "public"}'`, n)), a.set(c, this.declarationNode.symbol);
|
|
1861
1861
|
}
|
|
1862
1862
|
return e;
|
|
@@ -1881,13 +1881,13 @@ class Ln {
|
|
|
1881
1881
|
});
|
|
1882
1882
|
}
|
|
1883
1883
|
validateFieldSettings(e) {
|
|
1884
|
-
const n =
|
|
1884
|
+
const n = W(e), s = n.getErrors(), i = n.getValue();
|
|
1885
1885
|
for (const r in i) {
|
|
1886
1886
|
const a = i[r];
|
|
1887
1887
|
switch (r) {
|
|
1888
1888
|
case "note":
|
|
1889
1889
|
a.length > 1 && a.forEach((c) => s.push(new l(o.DUPLICATE_ENUM_ELEMENT_SETTING, "'note' can only appear once", c))), a.forEach((c) => {
|
|
1890
|
-
|
|
1890
|
+
j(c.value) || s.push(new l(o.INVALID_ENUM_ELEMENT_SETTING, "'note' must be a string", c));
|
|
1891
1891
|
});
|
|
1892
1892
|
break;
|
|
1893
1893
|
default:
|
|
@@ -1961,14 +1961,14 @@ class gn {
|
|
|
1961
1961
|
});
|
|
1962
1962
|
}
|
|
1963
1963
|
validateFieldSetting(e) {
|
|
1964
|
-
const n =
|
|
1964
|
+
const n = W(e), s = n.getErrors(), i = n.getValue();
|
|
1965
1965
|
for (const r in i) {
|
|
1966
1966
|
const a = i[r];
|
|
1967
1967
|
switch (r) {
|
|
1968
1968
|
case "note":
|
|
1969
1969
|
case "name":
|
|
1970
1970
|
a.length > 1 && a.forEach((c) => s.push(new l(o.DUPLICATE_INDEX_SETTING, `'${r}' can only appear once`, c))), a.forEach((c) => {
|
|
1971
|
-
|
|
1971
|
+
j(c.value) || s.push(new l(o.INVALID_INDEX_SETTING_VALUE, `'${r}' must be a string`, c));
|
|
1972
1972
|
});
|
|
1973
1973
|
break;
|
|
1974
1974
|
case "unique":
|
|
@@ -2034,7 +2034,7 @@ class _n {
|
|
|
2034
2034
|
}
|
|
2035
2035
|
validateFields(e) {
|
|
2036
2036
|
const n = [];
|
|
2037
|
-
return e.length === 0 ? [new l(o.EMPTY_NOTE, "A Note must have a content", this.declarationNode)] : (e.length > 1 && e.slice(1).forEach((s) => n.push(new l(o.NOTE_CONTENT_REDEFINED, "A Note can only contain one string", s))),
|
|
2037
|
+
return e.length === 0 ? [new l(o.EMPTY_NOTE, "A Note must have a content", this.declarationNode)] : (e.length > 1 && e.slice(1).forEach((s) => n.push(new l(o.NOTE_CONTENT_REDEFINED, "A Note can only contain one string", s))), j(e[0].callee) || n.push(new l(o.INVALID_NOTE, "A Note content must be a quoted string", e[0])), e[0].args.length > 0 && n.push(...e[0].args.map((s) => new l(o.INVALID_NOTE, "A Note can only contain one quoted string", s))), n);
|
|
2038
2038
|
}
|
|
2039
2039
|
validateSubElements(e) {
|
|
2040
2040
|
return e.flatMap((n) => {
|
|
@@ -2056,7 +2056,7 @@ class An {
|
|
|
2056
2056
|
return this.declarationNode.parent instanceof A ? [new l(o.INVALID_PROJECT_CONTEXT, "A Project can only appear top-level", this.declarationNode)] : [];
|
|
2057
2057
|
}
|
|
2058
2058
|
validateName(e) {
|
|
2059
|
-
return e ?
|
|
2059
|
+
return e ? ye(e) ? [] : [new l(o.INVALID_NAME, "A Project's name is optional or must be an identifier or a quoted identifer", e)] : [];
|
|
2060
2060
|
}
|
|
2061
2061
|
validateAlias(e) {
|
|
2062
2062
|
return e ? [new l(o.UNEXPECTED_ALIAS, "A Project shouldn't have an alias", e)] : [];
|
|
@@ -2095,7 +2095,7 @@ class vn {
|
|
|
2095
2095
|
return this.declarationNode.parent instanceof G ? [] : [new l(o.INVALID_REF_CONTEXT, "A Ref must appear top-level", this.declarationNode)];
|
|
2096
2096
|
}
|
|
2097
2097
|
validateName(e) {
|
|
2098
|
-
return e ?
|
|
2098
|
+
return e ? ye(e) ? [] : [new l(o.INVALID_NAME, "A Ref's name is optional or must be an identifier or a quoted identifer", e)] : [];
|
|
2099
2099
|
}
|
|
2100
2100
|
validateAlias(e) {
|
|
2101
2101
|
return e ? [new l(o.UNEXPECTED_ALIAS, "A Ref shouldn't have an alias", e)] : [];
|
|
@@ -2122,7 +2122,7 @@ class vn {
|
|
|
2122
2122
|
}), n;
|
|
2123
2123
|
}
|
|
2124
2124
|
validateFieldSettings(e) {
|
|
2125
|
-
const n =
|
|
2125
|
+
const n = W(e), s = n.getErrors(), i = n.getValue();
|
|
2126
2126
|
for (const r in i) {
|
|
2127
2127
|
const a = i[r];
|
|
2128
2128
|
switch (r) {
|
|
@@ -2175,13 +2175,13 @@ class yn {
|
|
|
2175
2175
|
return this.declarationNode.parent instanceof A ? [new l(o.INVALID_TABLE_CONTEXT, "Table must appear top-level", this.declarationNode)] : [];
|
|
2176
2176
|
}
|
|
2177
2177
|
validateName(e) {
|
|
2178
|
-
return e ? e instanceof ue ? [new l(o.INVALID_NAME, "Invalid array as Table name, maybe you forget to add a space between the name and the setting list?", e)] :
|
|
2178
|
+
return e ? e instanceof ue ? [new l(o.INVALID_NAME, "Invalid array as Table name, maybe you forget to add a space between the name and the setting list?", e)] : wt(e) ? [] : [new l(o.INVALID_NAME, "A Table name must be of the form <table> or <schema>.<table>", e)] : [new l(o.NAME_NOT_FOUND, "A Table must have a name", this.declarationNode)];
|
|
2179
2179
|
}
|
|
2180
2180
|
validateAlias(e) {
|
|
2181
2181
|
return e ? On(e) ? [] : [new l(o.INVALID_ALIAS, "Table aliases can only contains alphanumeric and underscore unless surrounded by double quotes", e)] : [];
|
|
2182
2182
|
}
|
|
2183
2183
|
validateSettingList(e) {
|
|
2184
|
-
const n =
|
|
2184
|
+
const n = W(e), s = n.getErrors(), i = n.getValue();
|
|
2185
2185
|
for (const r in i) {
|
|
2186
2186
|
const a = i[r];
|
|
2187
2187
|
switch (r) {
|
|
@@ -2192,7 +2192,7 @@ class yn {
|
|
|
2192
2192
|
break;
|
|
2193
2193
|
case "note":
|
|
2194
2194
|
a.length > 1 && s.push(...a.map((c) => new l(o.DUPLICATE_TABLE_SETTING, "'note' can only appear once", c))), a.forEach((c) => {
|
|
2195
|
-
|
|
2195
|
+
j(c.value) || s.push(new l(o.INVALID_TABLE_SETTING, "'note' must be a string literal", c.value || c.name));
|
|
2196
2196
|
});
|
|
2197
2197
|
break;
|
|
2198
2198
|
default:
|
|
@@ -2203,14 +2203,14 @@ class yn {
|
|
|
2203
2203
|
}
|
|
2204
2204
|
registerElement() {
|
|
2205
2205
|
const e = [];
|
|
2206
|
-
this.declarationNode.symbol = this.symbolFactory.create(
|
|
2206
|
+
this.declarationNode.symbol = this.symbolFactory.create(_t, { declaration: this.declarationNode, symbolTable: new we() });
|
|
2207
2207
|
const { name: n, alias: s } = this.declarationNode, i = C(n);
|
|
2208
2208
|
if (i.isOk()) {
|
|
2209
|
-
const r = [...i.unwrap()], a = r.pop(), c =
|
|
2209
|
+
const r = [...i.unwrap()], a = r.pop(), c = Ze(r, this.publicSymbolTable, this.symbolFactory), p = Oe(a);
|
|
2210
2210
|
c.has(p) && e.push(new l(o.DUPLICATE_NAME, `Table name '${a}' already exists in schema '${r.join(".") || "public"}'`, n)), c.set(p, this.declarationNode.symbol);
|
|
2211
2211
|
}
|
|
2212
|
-
if (s &&
|
|
2213
|
-
const r = V(s).unwrap(), a =
|
|
2212
|
+
if (s && ye(s) && !xn(s.expression.variable.value, i.unwrap_or([]))) {
|
|
2213
|
+
const r = V(s).unwrap(), a = Oe(r);
|
|
2214
2214
|
this.publicSymbolTable.has(a) && e.push(new l(o.DUPLICATE_NAME, `Table name '${r}' already exists`, n)), this.publicSymbolTable.set(a, this.declarationNode.symbol);
|
|
2215
2215
|
}
|
|
2216
2216
|
return e;
|
|
@@ -2257,7 +2257,7 @@ class yn {
|
|
|
2257
2257
|
return [];
|
|
2258
2258
|
let n;
|
|
2259
2259
|
I.last(e) instanceof D && (n = e.pop());
|
|
2260
|
-
const s =
|
|
2260
|
+
const s = W(n), i = s.getErrors(), r = s.getValue();
|
|
2261
2261
|
for (const p of e) {
|
|
2262
2262
|
const h = V(p).unwrap_or("").toLowerCase();
|
|
2263
2263
|
if (h !== "pk" && h !== "unique") {
|
|
@@ -2273,7 +2273,7 @@ class yn {
|
|
|
2273
2273
|
switch (p) {
|
|
2274
2274
|
case "note":
|
|
2275
2275
|
h.length > 1 && i.push(...h.map((f) => new l(o.DUPLICATE_COLUMN_SETTING, "note can only appear once", f))), h.forEach((f) => {
|
|
2276
|
-
|
|
2276
|
+
j(f.value) || i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'note' must be a quoted string", f.value || f.name));
|
|
2277
2277
|
});
|
|
2278
2278
|
break;
|
|
2279
2279
|
case "ref":
|
|
@@ -2341,7 +2341,7 @@ function kn(t) {
|
|
|
2341
2341
|
if (!(t instanceof H || Je(t) || t instanceof U || t instanceof ue))
|
|
2342
2342
|
return !1;
|
|
2343
2343
|
if (t instanceof H) {
|
|
2344
|
-
if (t.callee === void 0 || t.argumentList === void 0 || !t.argumentList.elementList.every((n) => he(n) ||
|
|
2344
|
+
if (t.callee === void 0 || t.argumentList === void 0 || !t.argumentList.elementList.every((n) => he(n) || j(n) || me(n)))
|
|
2345
2345
|
return !1;
|
|
2346
2346
|
t = t.callee;
|
|
2347
2347
|
}
|
|
@@ -2367,7 +2367,7 @@ class Sn {
|
|
|
2367
2367
|
return this.declarationNode.parent instanceof A ? [new l(o.INVALID_TABLEGROUP_CONTEXT, "TableGroup must appear top-level", this.declarationNode)] : [];
|
|
2368
2368
|
}
|
|
2369
2369
|
validateName(e) {
|
|
2370
|
-
return e ?
|
|
2370
|
+
return e ? ye(e) ? [] : [new l(o.INVALID_NAME, "A TableGroup name must be a single identifier", e)] : [new l(o.NAME_NOT_FOUND, "A TableGroup must have a name", this.declarationNode)];
|
|
2371
2371
|
}
|
|
2372
2372
|
validateAlias(e) {
|
|
2373
2373
|
return e ? [new l(o.UNEXPECTED_ALIAS, "A TableGroup shouldn't have an alias", e)] : [];
|
|
@@ -2377,9 +2377,9 @@ class Sn {
|
|
|
2377
2377
|
this.declarationNode.symbol = this.symbolFactory.create(tn, { declaration: this.declarationNode, symbolTable: new we() });
|
|
2378
2378
|
const n = C(e);
|
|
2379
2379
|
if (n.isOk()) {
|
|
2380
|
-
const s = n.unwrap(), i = s.pop(), r =
|
|
2380
|
+
const s = n.unwrap(), i = s.pop(), r = Ze(s, this.publicSymbolTable, this.symbolFactory), a = qe(i);
|
|
2381
2381
|
if (r.has(a))
|
|
2382
|
-
return [new l(o.DUPLICATE_NAME, `TableGroup name '${i}' already exists
|
|
2382
|
+
return [new l(o.DUPLICATE_NAME, `TableGroup name '${i}' already exists`, e)];
|
|
2383
2383
|
r.set(a, this.declarationNode.symbol);
|
|
2384
2384
|
}
|
|
2385
2385
|
return [];
|
|
@@ -2426,7 +2426,7 @@ class Sn {
|
|
|
2426
2426
|
return [];
|
|
2427
2427
|
}
|
|
2428
2428
|
}
|
|
2429
|
-
const
|
|
2429
|
+
const vt = ["-", "+"];
|
|
2430
2430
|
function re(t) {
|
|
2431
2431
|
switch (t.type.value.toLowerCase()) {
|
|
2432
2432
|
case b.Enum:
|
|
@@ -2447,28 +2447,28 @@ function re(t) {
|
|
|
2447
2447
|
return In;
|
|
2448
2448
|
}
|
|
2449
2449
|
}
|
|
2450
|
-
function
|
|
2450
|
+
function wt(t) {
|
|
2451
2451
|
return !!C(t).unwrap_or(!1);
|
|
2452
2452
|
}
|
|
2453
2453
|
function On(t) {
|
|
2454
|
-
return
|
|
2454
|
+
return ye(t);
|
|
2455
2455
|
}
|
|
2456
|
-
function
|
|
2456
|
+
function ye(t) {
|
|
2457
2457
|
return t instanceof U && t.expression instanceof Z;
|
|
2458
2458
|
}
|
|
2459
|
-
function
|
|
2459
|
+
function Ze(t, e, n) {
|
|
2460
2460
|
var i;
|
|
2461
2461
|
t[0] === "public" && (t = t.slice(1));
|
|
2462
2462
|
let s = e;
|
|
2463
2463
|
for (const r of t) {
|
|
2464
2464
|
let a;
|
|
2465
|
-
const c =
|
|
2465
|
+
const c = je(r);
|
|
2466
2466
|
if (s.has(c)) {
|
|
2467
2467
|
if (a = (i = s.get(c)) == null ? void 0 : i.symbolTable, !a)
|
|
2468
2468
|
throw new Error("Expect a symbol table in a schema symbol");
|
|
2469
2469
|
} else {
|
|
2470
2470
|
a = new we();
|
|
2471
|
-
const p = n.create(
|
|
2471
|
+
const p = n.create(gt, { symbolTable: a });
|
|
2472
2472
|
s.set(c, p);
|
|
2473
2473
|
}
|
|
2474
2474
|
s = a;
|
|
@@ -2495,7 +2495,7 @@ function le(t) {
|
|
|
2495
2495
|
}
|
|
2496
2496
|
function Dn(t) {
|
|
2497
2497
|
var e;
|
|
2498
|
-
return !!(
|
|
2498
|
+
return !!(j(t) || he(t) || me(t) && ["true", "false", "null"].includes(t.expression.variable.value.toLowerCase()) || t instanceof Q && vt.includes((e = t.op) == null ? void 0 : e.value) && he(t.expression) || t instanceof te);
|
|
2499
2499
|
}
|
|
2500
2500
|
function he(t) {
|
|
2501
2501
|
var e;
|
|
@@ -2511,7 +2511,7 @@ function Pn(t) {
|
|
|
2511
2511
|
function kt(t) {
|
|
2512
2512
|
return t instanceof J && t.elementList.every(M);
|
|
2513
2513
|
}
|
|
2514
|
-
function
|
|
2514
|
+
function W(t) {
|
|
2515
2515
|
var s;
|
|
2516
2516
|
const e = {}, n = [];
|
|
2517
2517
|
if (!t)
|
|
@@ -2528,9 +2528,9 @@ function j(t) {
|
|
|
2528
2528
|
}
|
|
2529
2529
|
return new B(e, n);
|
|
2530
2530
|
}
|
|
2531
|
-
class
|
|
2531
|
+
class ht {
|
|
2532
2532
|
constructor(e, n) {
|
|
2533
|
-
this.ast = e, this.symbolFactory = n, this.publicSchemaSymbol = this.symbolFactory.create(
|
|
2533
|
+
this.ast = e, this.symbolFactory = n, this.publicSchemaSymbol = this.symbolFactory.create(gt, {
|
|
2534
2534
|
symbolTable: new we()
|
|
2535
2535
|
}), this.ast.symbol = this.publicSchemaSymbol, this.ast.symbol.declaration = this.ast;
|
|
2536
2536
|
}
|
|
@@ -2602,7 +2602,7 @@ class ae {
|
|
|
2602
2602
|
return;
|
|
2603
2603
|
this.bindFragments([e], n);
|
|
2604
2604
|
} else
|
|
2605
|
-
e instanceof q ? Je(e) ? this.bindFragments(fe(e).unwrap_or([]), n) : (this.scanAndBind(e.leftExpression, n), this.scanAndBind(e.rightExpression, n)) : e instanceof Q ? this.scanAndBind(e.expression, n) : e instanceof
|
|
2605
|
+
e instanceof q ? Je(e) ? this.bindFragments(fe(e).unwrap_or([]), n) : (this.scanAndBind(e.leftExpression, n), this.scanAndBind(e.rightExpression, n)) : e instanceof Q ? this.scanAndBind(e.expression, n) : e instanceof Ue ? this.scanAndBind(e.expression, n) : e instanceof J && e.elementList.forEach((r) => this.scanAndBind(r, n));
|
|
2606
2606
|
}
|
|
2607
2607
|
// Bind the fragments of a member access expression
|
|
2608
2608
|
// which can be a simple expression like v1.User,
|
|
@@ -2849,7 +2849,7 @@ class $n {
|
|
|
2849
2849
|
return new B(this.ast, this.errors);
|
|
2850
2850
|
}
|
|
2851
2851
|
}
|
|
2852
|
-
class
|
|
2852
|
+
class Wn {
|
|
2853
2853
|
constructor(e) {
|
|
2854
2854
|
this.generator = e;
|
|
2855
2855
|
}
|
|
@@ -2857,20 +2857,20 @@ class jn {
|
|
|
2857
2857
|
return new e(n, this.generator.nextId());
|
|
2858
2858
|
}
|
|
2859
2859
|
}
|
|
2860
|
-
class
|
|
2860
|
+
class jn {
|
|
2861
2861
|
constructor(e, n) {
|
|
2862
|
-
this.ast = e, this.symbolFactory = new
|
|
2862
|
+
this.ast = e, this.symbolFactory = new Wn(n);
|
|
2863
2863
|
}
|
|
2864
2864
|
// Analyzing: Invoking both the validator and binder
|
|
2865
2865
|
analyze() {
|
|
2866
|
-
return new
|
|
2866
|
+
return new ht(this.ast, this.symbolFactory).validate().chain((n) => new $n(n).resolve());
|
|
2867
2867
|
}
|
|
2868
2868
|
// For invoking the validator only
|
|
2869
2869
|
validate() {
|
|
2870
|
-
return new
|
|
2870
|
+
return new ht(this.ast, this.symbolFactory).validate().chain((n) => new B(n, []));
|
|
2871
2871
|
}
|
|
2872
2872
|
}
|
|
2873
|
-
function
|
|
2873
|
+
function ft(t, e) {
|
|
2874
2874
|
const { variables: n, tupleElements: s } = _e(t).unwrap();
|
|
2875
2875
|
return s ? n.length === 0 ? {
|
|
2876
2876
|
schemaName: e.schemaName,
|
|
@@ -2992,7 +2992,7 @@ class Pt {
|
|
|
2992
2992
|
}
|
|
2993
2993
|
interpretSettingList(e) {
|
|
2994
2994
|
var i, r, a;
|
|
2995
|
-
const n =
|
|
2995
|
+
const n = W(e).getValue();
|
|
2996
2996
|
this.table.headerColor = (i = n.headercolor) != null && i.length ? Ot((a = (r = n.headercolor) == null ? void 0 : r.at(0)) == null ? void 0 : a.value) : void 0;
|
|
2997
2997
|
const [s] = n.note || [];
|
|
2998
2998
|
return this.table.note = s && {
|
|
@@ -3030,7 +3030,7 @@ class Pt {
|
|
|
3030
3030
|
s.type = i.getValue(), n.push(...i.getErrors()), s.token = v(e), s.inline_refs = [];
|
|
3031
3031
|
const r = e.args.slice(1);
|
|
3032
3032
|
if (I.last(r) instanceof D) {
|
|
3033
|
-
const _ =
|
|
3033
|
+
const _ = W(r.pop()).getValue();
|
|
3034
3034
|
s.pk = !!((a = _.pk) != null && a.length) || !!((c = _["primary key"]) != null && c.length), s.increment = !!((p = _.increment) != null && p.length), s.unique = !!((h = _.unique) != null && h.length), s.not_null = !!((T = _["not null"]) != null && T.length) && !0, s.dbdefault = zn((N = (f = _.default) == null ? void 0 : f.at(0)) == null ? void 0 : N.value);
|
|
3035
3035
|
const K = (g = _.note) == null ? void 0 : g.at(0);
|
|
3036
3036
|
s.note = K && {
|
|
@@ -3039,10 +3039,10 @@ class Pt {
|
|
|
3039
3039
|
};
|
|
3040
3040
|
const oe = _.ref || [];
|
|
3041
3041
|
s.inline_refs = oe.flatMap((Y) => {
|
|
3042
|
-
const [
|
|
3043
|
-
if (Dt(
|
|
3042
|
+
const [tt] = $e(Y.value.expression);
|
|
3043
|
+
if (Dt(tt, e.symbol))
|
|
3044
3044
|
return n.push(new l(o.SAME_ENDPOINT, "Two endpoints are the same", Y)), [];
|
|
3045
|
-
const
|
|
3045
|
+
const ke = Y.value.op, ee = C(Y.value.expression).unwrap();
|
|
3046
3046
|
let pe;
|
|
3047
3047
|
if (ee.length === 1) {
|
|
3048
3048
|
const [ce] = ee;
|
|
@@ -3050,7 +3050,7 @@ class Pt {
|
|
|
3050
3050
|
schemaName: this.table.schemaName,
|
|
3051
3051
|
tableName: this.table.name,
|
|
3052
3052
|
fieldNames: [ce],
|
|
3053
|
-
relation:
|
|
3053
|
+
relation: ke.value,
|
|
3054
3054
|
token: v(Y)
|
|
3055
3055
|
};
|
|
3056
3056
|
} else if (ee.length === 2) {
|
|
@@ -3059,16 +3059,16 @@ class Pt {
|
|
|
3059
3059
|
schemaName: null,
|
|
3060
3060
|
tableName: ce,
|
|
3061
3061
|
fieldNames: [Le],
|
|
3062
|
-
relation:
|
|
3062
|
+
relation: ke.value,
|
|
3063
3063
|
token: v(Y)
|
|
3064
3064
|
};
|
|
3065
3065
|
} else if (ee.length === 3) {
|
|
3066
|
-
const [ce, Le,
|
|
3066
|
+
const [ce, Le, st] = ee;
|
|
3067
3067
|
pe = {
|
|
3068
3068
|
schemaName: ce,
|
|
3069
3069
|
tableName: Le,
|
|
3070
|
-
fieldNames: [
|
|
3071
|
-
relation:
|
|
3070
|
+
fieldNames: [st],
|
|
3071
|
+
relation: ke.value,
|
|
3072
3072
|
token: v(Y)
|
|
3073
3073
|
};
|
|
3074
3074
|
} else {
|
|
@@ -3078,12 +3078,12 @@ class Pt {
|
|
|
3078
3078
|
schemaName: ee.join("."),
|
|
3079
3079
|
tableName: Le,
|
|
3080
3080
|
fieldNames: [ce],
|
|
3081
|
-
relation:
|
|
3081
|
+
relation: ke.value,
|
|
3082
3082
|
token: v(Y)
|
|
3083
3083
|
};
|
|
3084
3084
|
}
|
|
3085
|
-
const
|
|
3086
|
-
return n.push(...
|
|
3085
|
+
const nt = this.registerInlineRefToEnv(e, tt, pe, Y);
|
|
3086
|
+
return n.push(...nt), nt.length === 0 ? pe : [];
|
|
3087
3087
|
});
|
|
3088
3088
|
}
|
|
3089
3089
|
return s.pk || (s.pk = r.some((_) => X(_).unwrap().toLowerCase() === "pk")), s.unique || (s.unique = r.some((_) => X(_).unwrap().toLowerCase() === "unique")), this.table.fields.push(s), s.pk && this.pkColumns.push(s), n;
|
|
@@ -3095,7 +3095,7 @@ class Pt {
|
|
|
3095
3095
|
s.token = v(e);
|
|
3096
3096
|
const r = [i.callee, ...i.args];
|
|
3097
3097
|
if (I.last(r) instanceof D) {
|
|
3098
|
-
const g =
|
|
3098
|
+
const g = W(r.pop()).getValue();
|
|
3099
3099
|
s.pk = !!((a = g.pk) != null && a.length), s.unique = !!((c = g.unique) != null && c.length), s.name = z((h = (p = g.name) == null ? void 0 : p.at(0)) == null ? void 0 : h.value).unwrap_or(void 0);
|
|
3100
3100
|
const _ = (T = g.note) == null ? void 0 : T.at(0);
|
|
3101
3101
|
s.note = _ && {
|
|
@@ -3157,7 +3157,7 @@ class Pt {
|
|
|
3157
3157
|
}
|
|
3158
3158
|
function Yn(t) {
|
|
3159
3159
|
let e = null;
|
|
3160
|
-
t instanceof H && (e = t.argumentList.elementList.map((r) => he(r) ? r.expression.literal.value :
|
|
3160
|
+
t instanceof H && (e = t.argumentList.elementList.map((r) => he(r) ? r.expression.literal.value : j(r) ? z(r).unwrap() : X(r).unwrap()).join(","), t = t.callee);
|
|
3161
3161
|
let n = "";
|
|
3162
3162
|
for (; t instanceof ue; )
|
|
3163
3163
|
n = `[${t.indexer.elementList.map((r) => r.name.expression.literal.value).join(",")}]${n}`, t = t.array;
|
|
@@ -3178,7 +3178,7 @@ function Yn(t) {
|
|
|
3178
3178
|
function zn(t) {
|
|
3179
3179
|
var e, n, s;
|
|
3180
3180
|
if (t) {
|
|
3181
|
-
if (
|
|
3181
|
+
if (j(t))
|
|
3182
3182
|
return {
|
|
3183
3183
|
value: z(t).unwrap(),
|
|
3184
3184
|
type: "string"
|
|
@@ -3193,7 +3193,7 @@ function zn(t) {
|
|
|
3193
3193
|
value: t.expression.variable.value.toLowerCase(),
|
|
3194
3194
|
type: "boolean"
|
|
3195
3195
|
};
|
|
3196
|
-
if (t instanceof Q &&
|
|
3196
|
+
if (t instanceof Q && vt.includes((e = t.op) == null ? void 0 : e.value) && he(t.expression)) {
|
|
3197
3197
|
const i = Number.parseFloat(t.expression.expression.literal.value);
|
|
3198
3198
|
return {
|
|
3199
3199
|
value: ((n = t.op) == null ? void 0 : n.value) === "-" ? 0 - i : i,
|
|
@@ -3225,7 +3225,7 @@ class Qn {
|
|
|
3225
3225
|
}
|
|
3226
3226
|
interpretSettingList(e) {
|
|
3227
3227
|
var s, i, r;
|
|
3228
|
-
const n =
|
|
3228
|
+
const n = W(e).getValue();
|
|
3229
3229
|
return this.note.headerColor = (s = n.headercolor) != null && s.length ? Ot((r = (i = n.headercolor) == null ? void 0 : i.at(0)) == null ? void 0 : r.value) : void 0, [];
|
|
3230
3230
|
}
|
|
3231
3231
|
interpretBody(e) {
|
|
@@ -3265,7 +3265,7 @@ class Ut {
|
|
|
3265
3265
|
new l(o.CIRCULAR_REF, "References with same endpoints exist", this.env.refIds[c])
|
|
3266
3266
|
];
|
|
3267
3267
|
if (e.args[0]) {
|
|
3268
|
-
const g =
|
|
3268
|
+
const g = W(e.args[0]).getValue(), _ = (T = (h = g.delete) == null ? void 0 : h.at(0)) == null ? void 0 : T.value;
|
|
3269
3269
|
this.ref.onDelete = _ instanceof $ ? Te(_).unwrap_or(void 0) : X(_).unwrap_or(void 0);
|
|
3270
3270
|
const K = (N = (f = g.update) == null ? void 0 : f.at(0)) == null ? void 0 : N.value;
|
|
3271
3271
|
this.ref.onUpdate = K instanceof $ ? Te(K).unwrap_or(void 0) : X(K).unwrap_or(void 0);
|
|
@@ -3273,12 +3273,12 @@ class Ut {
|
|
|
3273
3273
|
const p = St(n);
|
|
3274
3274
|
return this.ref.endpoints = [
|
|
3275
3275
|
{
|
|
3276
|
-
...
|
|
3276
|
+
...ft(s, this.container),
|
|
3277
3277
|
relation: p[0],
|
|
3278
3278
|
token: v(s)
|
|
3279
3279
|
},
|
|
3280
3280
|
{
|
|
3281
|
-
...
|
|
3281
|
+
...ft(i, this.container),
|
|
3282
3282
|
relation: p[1],
|
|
3283
3283
|
token: v(i)
|
|
3284
3284
|
}
|
|
@@ -3334,7 +3334,7 @@ class Ft {
|
|
|
3334
3334
|
var c;
|
|
3335
3335
|
const s = n, i = {};
|
|
3336
3336
|
i.token = v(s), i.name = X(s.callee).unwrap();
|
|
3337
|
-
const a = (c =
|
|
3337
|
+
const a = (c = W(s.args[0]).getValue().note) == null ? void 0 : c.at(0);
|
|
3338
3338
|
return i.note = a && {
|
|
3339
3339
|
value: z(a.value).map(Ne).unwrap(),
|
|
3340
3340
|
token: v(a)
|
|
@@ -3457,7 +3457,7 @@ function Ae(t) {
|
|
|
3457
3457
|
return L.Text;
|
|
3458
3458
|
}
|
|
3459
3459
|
}
|
|
3460
|
-
function
|
|
3460
|
+
function De(t, e) {
|
|
3461
3461
|
if (!t || Ce(t))
|
|
3462
3462
|
return !1;
|
|
3463
3463
|
for (const n of t.trailingTrivia) {
|
|
@@ -3473,7 +3473,7 @@ function O() {
|
|
|
3473
3473
|
suggestions: []
|
|
3474
3474
|
};
|
|
3475
3475
|
}
|
|
3476
|
-
function
|
|
3476
|
+
function Pe(t) {
|
|
3477
3477
|
return {
|
|
3478
3478
|
...t,
|
|
3479
3479
|
suggestions: t.suggestions.map((e) => ({
|
|
@@ -3487,11 +3487,11 @@ function Fe(t) {
|
|
|
3487
3487
|
...t,
|
|
3488
3488
|
suggestions: t.suggestions.map((e) => ({
|
|
3489
3489
|
...e,
|
|
3490
|
-
insertText: e.insertText.split("").every(
|
|
3490
|
+
insertText: e.insertText.split("").every(Me) ? e.insertText : `"${e.insertText}"`
|
|
3491
3491
|
}))
|
|
3492
3492
|
};
|
|
3493
3493
|
}
|
|
3494
|
-
function
|
|
3494
|
+
function Ke(t, e) {
|
|
3495
3495
|
return t.getOffsetAt(e);
|
|
3496
3496
|
}
|
|
3497
3497
|
class Bt {
|
|
@@ -3500,20 +3500,20 @@ class Bt {
|
|
|
3500
3500
|
}
|
|
3501
3501
|
provideCompletionItems(e, n) {
|
|
3502
3502
|
var T, f;
|
|
3503
|
-
const s =
|
|
3503
|
+
const s = Ke(e, n), i = this.compiler.token.flatStream(), { token: r, index: a } = this.compiler.container.token(s), c = a === void 0 ? i[0] : i[a + 1];
|
|
3504
3504
|
if ([
|
|
3505
3505
|
...(r == null ? void 0 : r.trailingTrivia) || [],
|
|
3506
3506
|
...(r == null ? void 0 : r.leadingTrivia) || [],
|
|
3507
3507
|
...(c == null ? void 0 : c.leadingTrivia) || []
|
|
3508
|
-
].find((N) =>
|
|
3508
|
+
].find((N) => jt(N) && ge(s, N)))
|
|
3509
3509
|
return O();
|
|
3510
3510
|
if (a === void 0)
|
|
3511
|
-
return
|
|
3511
|
+
return mt();
|
|
3512
3512
|
if ([u.STRING_LITERAL, u.QUOTED_STRING].includes(r.kind) && ge(s, r))
|
|
3513
3513
|
return O();
|
|
3514
3514
|
const p = this.compiler.container.element(s);
|
|
3515
3515
|
if (this.compiler.container.scopeKind(s) === R.TOPLEVEL || p instanceof A && p.type && p.type.start <= s && p.type.end >= s)
|
|
3516
|
-
return
|
|
3516
|
+
return mt();
|
|
3517
3517
|
const h = [...this.compiler.container.stack(s)].reverse();
|
|
3518
3518
|
for (const N of h)
|
|
3519
3519
|
if (N instanceof Q)
|
|
@@ -3522,7 +3522,7 @@ class Bt {
|
|
|
3522
3522
|
case "<":
|
|
3523
3523
|
case "<>":
|
|
3524
3524
|
case "-":
|
|
3525
|
-
return
|
|
3525
|
+
return pt(
|
|
3526
3526
|
this.compiler,
|
|
3527
3527
|
s,
|
|
3528
3528
|
N
|
|
@@ -3534,7 +3534,7 @@ class Bt {
|
|
|
3534
3534
|
case "<":
|
|
3535
3535
|
case "<>":
|
|
3536
3536
|
case "-":
|
|
3537
|
-
return
|
|
3537
|
+
return pt(
|
|
3538
3538
|
this.compiler,
|
|
3539
3539
|
s,
|
|
3540
3540
|
N
|
|
@@ -3548,20 +3548,20 @@ class Bt {
|
|
|
3548
3548
|
}
|
|
3549
3549
|
else {
|
|
3550
3550
|
if (N instanceof se)
|
|
3551
|
-
return
|
|
3551
|
+
return dt(this.compiler, s, N);
|
|
3552
3552
|
if (N instanceof D)
|
|
3553
|
-
return
|
|
3553
|
+
return dt(this.compiler, s, N);
|
|
3554
3554
|
if (N instanceof J)
|
|
3555
3555
|
return Zn(this.compiler, s);
|
|
3556
3556
|
if (N instanceof y)
|
|
3557
|
-
return
|
|
3557
|
+
return Nt(this.compiler, s, N);
|
|
3558
3558
|
if (N instanceof A && (N.bodyColon && s >= N.bodyColon.end || N.body && ge(s, N.body)))
|
|
3559
|
-
return
|
|
3559
|
+
return Nt(this.compiler, s, void 0);
|
|
3560
3560
|
}
|
|
3561
3561
|
return O();
|
|
3562
3562
|
}
|
|
3563
3563
|
}
|
|
3564
|
-
function
|
|
3564
|
+
function pt(t, e, n) {
|
|
3565
3565
|
const s = t.container.scopeKind(e);
|
|
3566
3566
|
if ([R.REF, R.TABLE].includes(s)) {
|
|
3567
3567
|
const i = Be(t, e, t.container.element(e), [
|
|
@@ -3569,7 +3569,7 @@ function dt(t, e, n) {
|
|
|
3569
3569
|
m.Schema,
|
|
3570
3570
|
m.Column
|
|
3571
3571
|
]);
|
|
3572
|
-
return
|
|
3572
|
+
return De(n.op, e) ? Pe(i) : i;
|
|
3573
3573
|
}
|
|
3574
3574
|
return O();
|
|
3575
3575
|
}
|
|
@@ -3619,25 +3619,25 @@ function Zn(t, e) {
|
|
|
3619
3619
|
}
|
|
3620
3620
|
return O();
|
|
3621
3621
|
}
|
|
3622
|
-
function
|
|
3622
|
+
function dt(t, e, n) {
|
|
3623
3623
|
const { token: s } = t.container.token(e);
|
|
3624
3624
|
if ([u.COMMA, u.LBRACKET].includes(s == null ? void 0 : s.kind)) {
|
|
3625
|
-
const i =
|
|
3626
|
-
return (s == null ? void 0 : s.kind) === u.COMMA &&
|
|
3625
|
+
const i = Et(t, e);
|
|
3626
|
+
return (s == null ? void 0 : s.kind) === u.COMMA && De(s, e) ? Pe(i) : i;
|
|
3627
3627
|
}
|
|
3628
3628
|
if (n.name && n.name.start <= e && n.name.end >= e)
|
|
3629
|
-
return
|
|
3629
|
+
return Et(t, e);
|
|
3630
3630
|
if (n.name instanceof $) {
|
|
3631
3631
|
const i = Kn(
|
|
3632
3632
|
t,
|
|
3633
3633
|
e,
|
|
3634
3634
|
Te(n.name).unwrap()
|
|
3635
3635
|
);
|
|
3636
|
-
return (s == null ? void 0 : s.kind) === u.COLON &&
|
|
3636
|
+
return (s == null ? void 0 : s.kind) === u.COLON && De(s, e) ? Pe(i) : i;
|
|
3637
3637
|
}
|
|
3638
3638
|
return O();
|
|
3639
3639
|
}
|
|
3640
|
-
function
|
|
3640
|
+
function Et(t, e) {
|
|
3641
3641
|
const n = t.container.element(e), s = t.container.scopeKind(e);
|
|
3642
3642
|
if (n instanceof G)
|
|
3643
3643
|
return O();
|
|
@@ -3776,7 +3776,7 @@ function Vt(t, e, n) {
|
|
|
3776
3776
|
}))
|
|
3777
3777
|
});
|
|
3778
3778
|
}
|
|
3779
|
-
function
|
|
3779
|
+
function Nt(t, e, n) {
|
|
3780
3780
|
var i;
|
|
3781
3781
|
switch (t.container.scopeKind(e)) {
|
|
3782
3782
|
case R.TABLE:
|
|
@@ -3789,7 +3789,7 @@ function mt(t, e, n) {
|
|
|
3789
3789
|
return es(t, e, n);
|
|
3790
3790
|
case R.REF: {
|
|
3791
3791
|
const r = Gt(t, e);
|
|
3792
|
-
return ((i = t.container.token(e).token) == null ? void 0 : i.kind) === u.COLON &&
|
|
3792
|
+
return ((i = t.container.token(e).token) == null ? void 0 : i.kind) === u.COLON && De(t.container.token(e).token, e) ? Pe(r) : r;
|
|
3793
3793
|
}
|
|
3794
3794
|
case R.TABLEGROUP:
|
|
3795
3795
|
return ss(t);
|
|
@@ -3797,7 +3797,7 @@ function mt(t, e, n) {
|
|
|
3797
3797
|
return O();
|
|
3798
3798
|
}
|
|
3799
3799
|
}
|
|
3800
|
-
function
|
|
3800
|
+
function mt() {
|
|
3801
3801
|
return {
|
|
3802
3802
|
suggestions: ["Table", "TableGroup", "Enum", "Project", "Ref"].map((t) => ({
|
|
3803
3803
|
label: t,
|
|
@@ -3809,7 +3809,7 @@ function Tt() {
|
|
|
3809
3809
|
};
|
|
3810
3810
|
}
|
|
3811
3811
|
function es(t, e, n) {
|
|
3812
|
-
return n != null && n.callee &&
|
|
3812
|
+
return n != null && n.callee && et(e, n) === 1 ? Be(t, e, t.container.element(e), [
|
|
3813
3813
|
m.Schema,
|
|
3814
3814
|
m.Table,
|
|
3815
3815
|
m.Column
|
|
@@ -3826,7 +3826,7 @@ function ts(t, e, n) {
|
|
|
3826
3826
|
range: void 0
|
|
3827
3827
|
}))
|
|
3828
3828
|
};
|
|
3829
|
-
const s =
|
|
3829
|
+
const s = et(e, n);
|
|
3830
3830
|
return s === 0 ? {
|
|
3831
3831
|
suggestions: ["Note", "indexes"].map((i) => ({
|
|
3832
3832
|
label: i,
|
|
@@ -3838,7 +3838,7 @@ function ts(t, e, n) {
|
|
|
3838
3838
|
} : s === 1 ? rs(t, e) : O();
|
|
3839
3839
|
}
|
|
3840
3840
|
function ns(t, e, n) {
|
|
3841
|
-
return n != null && n.callee ?
|
|
3841
|
+
return n != null && n.callee ? et(e, n) === 0 ? {
|
|
3842
3842
|
suggestions: ["Table", "TableGroup", "Enum", "Note", "Ref"].map((i) => ({
|
|
3843
3843
|
label: i,
|
|
3844
3844
|
insertText: i,
|
|
@@ -3960,7 +3960,7 @@ function rs(t, e) {
|
|
|
3960
3960
|
}
|
|
3961
3961
|
function Ct(t, e) {
|
|
3962
3962
|
const n = t.container.element(e), s = n == null ? void 0 : n.parent;
|
|
3963
|
-
if (!((s == null ? void 0 : s.symbol) instanceof
|
|
3963
|
+
if (!((s == null ? void 0 : s.symbol) instanceof _t))
|
|
3964
3964
|
return O();
|
|
3965
3965
|
const { symbolTable: i } = s.symbol;
|
|
3966
3966
|
return Fe({
|
|
@@ -3979,7 +3979,7 @@ function Ct(t, e) {
|
|
|
3979
3979
|
})
|
|
3980
3980
|
});
|
|
3981
3981
|
}
|
|
3982
|
-
function
|
|
3982
|
+
function et(t, e) {
|
|
3983
3983
|
if (!e.callee)
|
|
3984
3984
|
return -1;
|
|
3985
3985
|
const n = [e.callee, ...e.args], s = n.findIndex((i) => t <= i.end);
|
|
@@ -3991,7 +3991,7 @@ class Xt {
|
|
|
3991
3991
|
}
|
|
3992
3992
|
provideDefinition(e, n) {
|
|
3993
3993
|
var a;
|
|
3994
|
-
const { uri: s } = e, i =
|
|
3994
|
+
const { uri: s } = e, i = Ke(e, n), r = [...this.compiler.container.stack(i)];
|
|
3995
3995
|
for (; r.length !== 0; ) {
|
|
3996
3996
|
const c = r.pop();
|
|
3997
3997
|
if ((a = c == null ? void 0 : c.referee) != null && a.declaration && [Ee.PRIMARY_EXPRESSION, Ee.VARIABLE].includes(c == null ? void 0 : c.kind)) {
|
|
@@ -4017,7 +4017,7 @@ class $t {
|
|
|
4017
4017
|
this.compiler = e;
|
|
4018
4018
|
}
|
|
4019
4019
|
provideReferences(e, n) {
|
|
4020
|
-
const { uri: s } = e, i =
|
|
4020
|
+
const { uri: s } = e, i = Ke(e, n), r = [...this.compiler.container.stack(i)];
|
|
4021
4021
|
for (; r.length !== 0; ) {
|
|
4022
4022
|
const a = r.pop();
|
|
4023
4023
|
if (a && [
|
|
@@ -4058,7 +4058,7 @@ class ls {
|
|
|
4058
4058
|
).fill(null), this.nodeIdGenerator = new Yt(), this.symbolIdGenerator = new Jt(), this.token = {
|
|
4059
4059
|
invalidStream: this.createQuery(
|
|
4060
4060
|
6,
|
|
4061
|
-
() => this.parse.tokens().filter(
|
|
4061
|
+
() => this.parse.tokens().filter(At)
|
|
4062
4062
|
),
|
|
4063
4063
|
// Valid + Invalid tokens (which are guarenteed to be non-trivials) are included in the stream
|
|
4064
4064
|
flatStream: this.createQuery(
|
|
@@ -4070,7 +4070,7 @@ class ls {
|
|
|
4070
4070
|
_: this.createQuery(
|
|
4071
4071
|
0,
|
|
4072
4072
|
() => {
|
|
4073
|
-
const e = new cn(this.source).lex().chain((n) => new hn(n, this.nodeIdGenerator).parse()).chain(({ ast: n, tokens: s }) => new
|
|
4073
|
+
const e = new cn(this.source).lex().chain((n) => new hn(n, this.nodeIdGenerator).parse()).chain(({ ast: n, tokens: s }) => new jn(n, this.symbolIdGenerator).analyze().map(() => ({ ast: n, tokens: s })));
|
|
4074
4074
|
return e.getErrors().length > 0 ? e : e.chain(({ ast: n, tokens: s }) => new Hn(n).interpret().map((r) => ({ ast: n, tokens: s, rawDb: r })));
|
|
4075
4075
|
}
|
|
4076
4076
|
),
|