@dbml/parse 3.9.7-alpha.0 → 3.10.1

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.
@@ -1,4 +1,4 @@
1
- import I, { last as Xe, partition as zt, findLastIndex as Qt } from "lodash";
1
+ import I, { last as $e, partition as zt, findLastIndex as Qt } 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
3
  function qt(t) {
4
4
  switch (t.kind) {
@@ -12,7 +12,7 @@ function qt(t) {
12
12
  return !1;
13
13
  }
14
14
  }
15
- function ot(t) {
15
+ function lt(t) {
16
16
  if (!t)
17
17
  return !1;
18
18
  switch (t) {
@@ -33,31 +33,31 @@ function ot(t) {
33
33
  return !1;
34
34
  }
35
35
  }
36
- function lt(t) {
36
+ function ct(t) {
37
37
  return t !== void 0 && t.kind === "<op>";
38
38
  }
39
- class V {
39
+ class G {
40
40
  constructor(e, n, s, i, r) {
41
41
  this.kind = e, this.startPos = n, this.endPos = s, this.value = i, this.leadingTrivia = [], this.trailingTrivia = [], this.leadingInvalid = [], this.trailingInvalid = [], this.isInvalid = r, this.start = n.offset, this.end = s.offset;
42
42
  }
43
43
  static create(e, n, s, i, r) {
44
- return new V(e, n, s, i, r);
44
+ return new G(e, n, s, i, r);
45
45
  }
46
46
  }
47
- function Lt(t) {
47
+ function gt(t) {
48
48
  return t.trailingTrivia.find(({ kind: e }) => e === u.NEWLINE) !== void 0;
49
49
  }
50
- function ct(t, e) {
51
- return e.leadingTrivia.find(({ kind: s }) => s === u.NEWLINE) !== void 0 || Lt(t);
50
+ function ut(t, e) {
51
+ return e.leadingTrivia.find(({ kind: s }) => s === u.NEWLINE) !== void 0 || gt(t);
52
52
  }
53
- function $e(t) {
53
+ function We(t) {
54
54
  return t.trailingTrivia.find(({ kind: e }) => [u.SPACE, u.TAB].includes(e)) !== void 0;
55
55
  }
56
- function gt(t) {
57
- return t.trailingTrivia.length === 0 ? t.end : gt(Xe(t.trailingTrivia));
58
- }
59
56
  function _t(t) {
60
- return t.leadingTrivia.length === 0 ? t.start : _t(t.leadingTrivia[0]);
57
+ return t.trailingTrivia.length === 0 ? t.end : _t($e(t.trailingTrivia));
58
+ }
59
+ function At(t) {
60
+ return t.leadingTrivia.length === 0 ? t.start : At(t.leadingTrivia[0]);
61
61
  }
62
62
  function Ht(t) {
63
63
  return [u.SINGLE_LINE_COMMENT, u.MULTILINE_COMMENT].includes(
@@ -81,13 +81,13 @@ class k {
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 V ? _t(i) : i.fullStart) : (this.startPos = {
84
+ i ? (this.startPos = i.startPos, this.fullStart = i instanceof G ? At(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 V ? gt(r) : r.fullEnd) : (this.endPos = {
90
+ r ? (this.endPos = r.endPos, this.fullEnd = r instanceof G ? _t(r) : r.fullEnd) : (this.endPos = {
91
91
  offset: NaN,
92
92
  column: NaN,
93
93
  line: NaN
@@ -95,7 +95,7 @@ class k {
95
95
  }
96
96
  }
97
97
  var Ne = /* @__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))(Ne || {});
98
- class $ extends k {
98
+ class j extends k {
99
99
  constructor({ body: e = [], eof: n }, s) {
100
100
  super(s, "<program>", [...e, n]), this.body = e, this.eof = n;
101
101
  }
@@ -123,7 +123,7 @@ class A extends k {
123
123
  this.type = e, this.name = n, this.as = s, this.alias = i, this.attributeList = r, this.bodyColon = a, this.body = l;
124
124
  }
125
125
  }
126
- class z extends k {
126
+ class q extends k {
127
127
  constructor({ identifiers: e = [] }, n) {
128
128
  super(n, "<identifer-stream>", e || []), this.identifiers = e;
129
129
  }
@@ -137,12 +137,12 @@ class ie extends k {
137
137
  super(i, "<attribute>", [e, n, s]), this.name = e, this.value = s, this.colon = n;
138
138
  }
139
139
  }
140
- class q extends k {
140
+ class H extends k {
141
141
  constructor({ op: e, expression: n }, s) {
142
142
  super(s, "<prefix-expression>", [e, n]), this.op = e, this.expression = n;
143
143
  }
144
144
  }
145
- class H extends k {
145
+ class J extends k {
146
146
  constructor({
147
147
  op: e,
148
148
  leftExpression: n,
@@ -151,7 +151,7 @@ class H extends k {
151
151
  super(i, "<infix-expression>", [n, e, s]), this.op = e, this.leftExpression = n, this.rightExpression = s;
152
152
  }
153
153
  }
154
- class Ue extends k {
154
+ class Me extends k {
155
155
  constructor({ op: e, expression: n }, s) {
156
156
  super(s, "<postfix-expression>", [n, e]), this.op = e, this.expression = n;
157
157
  }
@@ -166,7 +166,7 @@ class v extends k {
166
166
  super(s, "<function-application>", [e, ...n]), this.callee = e, this.args = n;
167
167
  }
168
168
  }
169
- class Z extends k {
169
+ class K extends k {
170
170
  constructor({
171
171
  blockOpenBrace: e,
172
172
  body: n = [],
@@ -175,7 +175,7 @@ class Z extends k {
175
175
  super(i, "<block-expression>", [e, ...n, s]), this.blockOpenBrace = e, this.body = n, this.blockCloseBrace = s;
176
176
  }
177
177
  }
178
- class P extends k {
178
+ class R extends k {
179
179
  constructor({
180
180
  listOpenBracket: e,
181
181
  elementList: n = [],
@@ -184,12 +184,12 @@ class P extends k {
184
184
  }, r) {
185
185
  super(r, "<list-expression>", [
186
186
  e,
187
- ...At(n, s),
187
+ ...vt(n, s),
188
188
  i
189
189
  ]), this.listOpenBracket = e, this.elementList = n, this.commaList = s, this.listCloseBracket = i;
190
190
  }
191
191
  }
192
- class K extends k {
192
+ class ee extends k {
193
193
  constructor({
194
194
  tupleOpenParen: e,
195
195
  elementList: n = [],
@@ -198,12 +198,12 @@ class K extends k {
198
198
  }, r) {
199
199
  super(r, "<tuple-expression>", [
200
200
  e,
201
- ...At(n, s),
201
+ ...vt(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 Ye extends K {
206
+ class ze extends ee {
207
207
  constructor({
208
208
  groupOpenParen: e,
209
209
  expression: n,
@@ -220,7 +220,7 @@ class Ye extends K {
220
220
  ), this.kind = "<group-expression>";
221
221
  }
222
222
  }
223
- class J extends k {
223
+ class Z extends k {
224
224
  constructor({
225
225
  callee: e,
226
226
  argumentList: n
@@ -233,19 +233,19 @@ class be extends k {
233
233
  super(n, "<literal>", [e]), this.literal = e;
234
234
  }
235
235
  }
236
- class ee extends k {
236
+ class te extends k {
237
237
  constructor({ variable: e }, n) {
238
238
  super(n, "<variable>", [e]), this.variable = e;
239
239
  }
240
240
  }
241
- class F extends k {
241
+ class M extends k {
242
242
  constructor({ expression: e }, n) {
243
243
  super(n, "<primary-expression>", [e]), this.expression = e;
244
244
  }
245
245
  }
246
- class xe extends k {
246
+ class Se extends k {
247
247
  constructor({ pre: e }, n) {
248
- const s = V.create(u.SPACE, e.endPos, e.endPos, " ", !1);
248
+ const s = G.create(u.SPACE, e.endPos, e.endPos, " ", !1);
249
249
  super(n, "<dummy>", [s]);
250
250
  }
251
251
  }
@@ -254,7 +254,7 @@ class he extends k {
254
254
  super(s, "<array>", [e, n]), this.array = e, this.indexer = n;
255
255
  }
256
256
  }
257
- function At(t, e) {
257
+ function vt(t, e) {
258
258
  if (!t || t.length === 0)
259
259
  return e || [];
260
260
  if (!e || e.length === 0)
@@ -269,7 +269,7 @@ function hs(t, e = !1) {
269
269
  t,
270
270
  function(n, s) {
271
271
  var i;
272
- return !(this instanceof $) && n === "symbol" ? s == null ? void 0 : s.id : (
272
+ return !(this instanceof j) && n === "symbol" ? s == null ? void 0 : s.id : (
273
273
  /* this instanceof SyntaxNode && */
274
274
  n === "symbol" ? {
275
275
  symbolTable: s == null ? void 0 : s.symbolTable,
@@ -335,46 +335,46 @@ class y {
335
335
  }
336
336
  }
337
337
  var T = /* @__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))(T || {});
338
- function ze(t) {
338
+ function Qe(t) {
339
339
  return `Schema:${t}`;
340
340
  }
341
- function Oe(t) {
341
+ function De(t) {
342
342
  return `Table:${t}`;
343
343
  }
344
- function Qe(t) {
344
+ function qe(t) {
345
345
  return `Column:${t}`;
346
346
  }
347
- function qe(t) {
347
+ function He(t) {
348
348
  return `Enum:${t}`;
349
349
  }
350
- function He(t) {
350
+ function Je(t) {
351
351
  return `Enum field:${t}`;
352
352
  }
353
- function Je(t) {
353
+ function Ze(t) {
354
354
  return `TableGroup:${t}`;
355
355
  }
356
- function Ze(t) {
356
+ function Ke(t) {
357
357
  return `TableGroup field:${t}`;
358
358
  }
359
359
  function Zt(t) {
360
360
  return `Note:${t}`;
361
361
  }
362
- function Ge(t, e) {
362
+ function Ce(t, e) {
363
363
  switch (e) {
364
364
  case "Column":
365
- return Qe(t);
366
- case "Enum":
367
365
  return qe(t);
368
- case "Enum field":
366
+ case "Enum":
369
367
  return He(t);
368
+ case "Enum field":
369
+ return Je(t);
370
370
  case "Schema":
371
- return ze(t);
371
+ return Qe(t);
372
372
  case "Table":
373
- return Oe(t);
373
+ return De(t);
374
374
  case "TableGroup":
375
- return Je(t);
376
- case "TableGroup field":
377
375
  return Ze(t);
376
+ case "TableGroup field":
377
+ return Ke(t);
378
378
  default:
379
379
  throw new Error("Unreachable");
380
380
  }
@@ -395,36 +395,36 @@ function Kt(t) {
395
395
  }
396
396
  function en(t) {
397
397
  return [
398
- ze,
399
- Oe,
400
- qe,
401
- Je,
402
398
  Qe,
399
+ De,
403
400
  He,
404
- Ze
401
+ Ze,
402
+ qe,
403
+ Je,
404
+ Ke
405
405
  ].map((e) => e(t));
406
406
  }
407
- function Me(t) {
407
+ function Fe(t) {
408
408
  return !!t.match(/(\p{L}|_|\p{M})/gu);
409
409
  }
410
- function De(t) {
410
+ function Re(t) {
411
411
  const [e] = t;
412
412
  return e >= "0" && e <= "9";
413
413
  }
414
414
  function tn(t) {
415
415
  const [e] = t;
416
- return De(e) || Me(e) && e.toLowerCase() >= "a" && e.toLowerCase() <= "f";
416
+ return Re(e) || Fe(e) && e.toLowerCase() >= "a" && e.toLowerCase() <= "f";
417
417
  }
418
418
  function Ee(t) {
419
- return Me(t) || De(t);
419
+ return Fe(t) || Re(t);
420
420
  }
421
- function ut(t, e) {
421
+ function ht(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]);
425
425
  return n.push(...t.slice(s), ...e.slice(s)), n;
426
426
  }
427
- function ge(t, e) {
427
+ function _e(t, e) {
428
428
  return t >= e.start && t < e.end;
429
429
  }
430
430
  class nn {
@@ -438,7 +438,7 @@ class nn {
438
438
  return this.id++;
439
439
  }
440
440
  }
441
- class vt {
441
+ class wt {
442
442
  constructor({ symbolTable: e }, n) {
443
443
  this.references = [], this.id = n, this.symbolTable = e;
444
444
  }
@@ -453,7 +453,7 @@ class rn {
453
453
  this.references = [], this.id = n, this.declaration = e;
454
454
  }
455
455
  }
456
- class wt {
456
+ class yt {
457
457
  constructor({ symbolTable: e, declaration: n }, s) {
458
458
  this.references = [], this.id = s, this.symbolTable = e, this.declaration = n;
459
459
  }
@@ -479,7 +479,7 @@ class c extends Error {
479
479
  super(n), this.code = e, this.diagnostic = n, this.nodeOrToken = s, this.start = s.start, this.end = s.end, this.name = this.constructor.name, Object.setPrototypeOf(this, c.prototype);
480
480
  }
481
481
  }
482
- class G {
482
+ class X {
483
483
  constructor(e, n) {
484
484
  this.value = e, this.errors = n === void 0 ? [] : n;
485
485
  }
@@ -491,24 +491,24 @@ class G {
491
491
  }
492
492
  chain(e) {
493
493
  const n = e(this.value), s = [...this.errors, ...n.errors];
494
- return new G(n.value, s);
494
+ return new X(n.value, s);
495
495
  }
496
496
  map(e) {
497
- return new G(e(this.value), this.errors);
497
+ return new X(e(this.value), this.errors);
498
498
  }
499
499
  }
500
500
  function cn(t, e, n) {
501
501
  if (!t || !me(t) || e.length === 0)
502
502
  return new y();
503
- const s = [...e], i = Ce(t).unwrap(), r = s.pop();
504
- if (!(r instanceof Z))
503
+ const s = [...e], i = Xe(t).unwrap(), r = s.pop();
504
+ if (!(r instanceof K))
505
505
  return new y();
506
- const a = I.last(s) instanceof P ? s.pop() : void 0;
507
- return s.length === 3 && Ce(s[1]).unwrap().value === "as" ? new x(
506
+ const a = I.last(s) instanceof R ? s.pop() : void 0;
507
+ return s.length === 3 && Xe(s[1]).unwrap().value === "as" ? new x(
508
508
  n.create(A, {
509
509
  type: i,
510
510
  name: s[0],
511
- as: Ce(s[1]).unwrap(),
511
+ as: Xe(s[1]).unwrap(),
512
512
  alias: s[2],
513
513
  attributeList: a,
514
514
  body: r
@@ -528,11 +528,11 @@ function cn(t, e, n) {
528
528
  })
529
529
  ) : new y();
530
530
  }
531
- function ht(t) {
531
+ function ft(t) {
532
532
  return t.kind === u.IDENTIFIER && t.value === "as";
533
533
  }
534
534
  function N(t) {
535
- t && (t instanceof V ? un(t) : hn(t));
535
+ t && (t instanceof G ? un(t) : hn(t));
536
536
  }
537
537
  function un(t) {
538
538
  t.kind !== u.EOF && (t.isInvalid = !0);
@@ -540,45 +540,45 @@ function un(t) {
540
540
  function hn(t) {
541
541
  if (t instanceof A)
542
542
  N(t.type), N(t.name), N(t.as), N(t.alias), N(t.bodyColon), N(t.attributeList), N(t.body);
543
- else if (t instanceof z)
543
+ else if (t instanceof q)
544
544
  t.identifiers.forEach(N);
545
545
  else if (t instanceof ie)
546
546
  N(t.name), N(t.colon), N(t.value);
547
- else if (t instanceof q)
548
- N(t.op), N(t.expression);
549
547
  else if (t instanceof H)
548
+ N(t.op), N(t.expression);
549
+ else if (t instanceof J)
550
550
  N(t.leftExpression), N(t.op), N(t.rightExpression);
551
- else if (t instanceof Ue)
551
+ else if (t instanceof Me)
552
552
  N(t.op), N(t.expression);
553
- else if (t instanceof Z)
553
+ else if (t instanceof K)
554
554
  N(t.blockOpenBrace), t.body.forEach(N), N(t.blockCloseBrace);
555
- else if (t instanceof P)
555
+ else if (t instanceof R)
556
556
  N(t.listOpenBracket), t.commaList.forEach(N), t.elementList.forEach(N), N(t.listCloseBracket);
557
- else if (t instanceof K)
557
+ else if (t instanceof ee)
558
558
  N(t.tupleOpenParen), t.commaList.forEach(N), t.elementList.forEach(N), N(t.tupleCloseParen);
559
- else if (t instanceof J)
559
+ else if (t instanceof Z)
560
560
  N(t.callee), N(t.argumentList);
561
561
  else if (t instanceof v)
562
562
  N(t.callee), t.args.forEach(N);
563
- else if (t instanceof F)
563
+ else if (t instanceof M)
564
564
  N(t.expression);
565
565
  else if (t instanceof se)
566
566
  N(t.value);
567
- else if (t instanceof ee)
567
+ else if (t instanceof te)
568
568
  N(t.variable);
569
569
  else if (t instanceof be)
570
570
  N(t.literal);
571
571
  else
572
- throw t instanceof Ye ? new Error("This case is handled by the TupleExpressionNode case") : new Error("Unreachable case in markInvalidNode");
572
+ throw t instanceof ze ? new Error("This case is handled by the TupleExpressionNode case") : new Error("Unreachable case in markInvalidNode");
573
573
  }
574
- function yt(t) {
574
+ function kt(t) {
575
575
  return !!(t != null && t.isInvalid);
576
576
  }
577
577
  function U(...t) {
578
578
  return t.filter((e) => e !== void 0);
579
579
  }
580
580
  function fn(t) {
581
- if (t instanceof $)
581
+ if (t instanceof j)
582
582
  return U(...t.body, t.eof);
583
583
  if (t instanceof A)
584
584
  return U(
@@ -592,64 +592,64 @@ function fn(t) {
592
592
  );
593
593
  if (t instanceof ie)
594
594
  return U(t.name, t.colon, t.value);
595
- if (t instanceof z)
595
+ if (t instanceof q)
596
596
  return t.identifiers;
597
597
  if (t instanceof be)
598
598
  return t.literal ? [t.literal] : [];
599
- if (t instanceof ee)
599
+ if (t instanceof te)
600
600
  return U(t.variable);
601
- if (t instanceof q)
602
- return U(t.op, t.expression);
603
601
  if (t instanceof H)
602
+ return U(t.op, t.expression);
603
+ if (t instanceof J)
604
604
  return U(t.leftExpression, t.op, t.rightExpression);
605
- if (t instanceof Ue)
605
+ if (t instanceof Me)
606
606
  return U(t.expression, t.op);
607
607
  if (t instanceof se)
608
608
  return U(t.value);
609
609
  if (t instanceof v)
610
610
  return U(t.callee, ...t.args);
611
- if (t instanceof Z)
611
+ if (t instanceof K)
612
612
  return U(t.blockOpenBrace, ...t.body, t.blockCloseBrace);
613
- if (t instanceof P)
613
+ if (t instanceof R)
614
614
  return U(
615
615
  t.listOpenBracket,
616
- ...ut(t.elementList, t.commaList),
616
+ ...ht(t.elementList, t.commaList),
617
617
  t.listCloseBracket
618
618
  );
619
- if (t instanceof K)
619
+ if (t instanceof ee)
620
620
  return U(
621
621
  t.tupleOpenParen,
622
- ...ut(t.elementList, t.commaList),
622
+ ...ht(t.elementList, t.commaList),
623
623
  t.tupleCloseParen
624
624
  );
625
- if (t instanceof J)
625
+ if (t instanceof Z)
626
626
  return U(t.callee, t.argumentList);
627
- if (t instanceof F)
627
+ if (t instanceof M)
628
628
  return U(t.expression);
629
629
  if (t instanceof he)
630
630
  return U(
631
631
  t.array,
632
632
  t.indexer
633
633
  );
634
- throw t instanceof Ye ? new Error("This case is already handled by TupleExpressionNode") : new Error("Unreachable - no other possible cases");
634
+ throw t instanceof ze ? new Error("This case is already handled by TupleExpressionNode") : new Error("Unreachable - no other possible cases");
635
635
  }
636
- function Ce(t) {
637
- return B(t) ? new x(t.expression.variable) : new y();
636
+ function Xe(t) {
637
+ return V(t) ? new x(t.expression.variable) : new y();
638
638
  }
639
- function W(t) {
639
+ function Y(t) {
640
640
  var e;
641
- return t instanceof F && (t.expression instanceof ee && t.expression.variable instanceof V && t.expression.variable.kind === u.QUOTED_STRING || t.expression instanceof be && ((e = t.expression.literal) == null ? void 0 : e.kind) === u.STRING_LITERAL);
641
+ return t instanceof M && (t.expression instanceof te && t.expression.variable instanceof G && 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
  }
643
- function B(t) {
644
- return t instanceof F && t.expression instanceof ee && t.expression.variable instanceof V;
643
+ function V(t) {
644
+ return t instanceof M && t.expression instanceof te && t.expression.variable instanceof G;
645
645
  }
646
646
  function me(t) {
647
647
  var e;
648
- return t instanceof F && t.expression instanceof ee && ((e = t.expression.variable) == null ? void 0 : e.kind) === u.IDENTIFIER;
648
+ return t instanceof M && t.expression instanceof te && ((e = t.expression.variable) == null ? void 0 : e.kind) === u.IDENTIFIER;
649
649
  }
650
- function Ke(t) {
650
+ function et(t) {
651
651
  var e;
652
- return t instanceof H && t.leftExpression instanceof k && t.rightExpression instanceof k && ((e = t.op) == null ? void 0 : e.value) === ".";
652
+ return t instanceof J && t.leftExpression instanceof k && t.rightExpression instanceof k && ((e = t.op) == null ? void 0 : e.value) === ".";
653
653
  }
654
654
  function Te(t) {
655
655
  if (t === void 0)
@@ -697,7 +697,7 @@ class pn {
697
697
  this.tokens.push(this.createToken(e, n));
698
698
  }
699
699
  createToken(e, n = !1) {
700
- return V.create(
700
+ return G.create(
701
701
  e,
702
702
  this.start,
703
703
  this.current,
@@ -706,7 +706,7 @@ class pn {
706
706
  );
707
707
  }
708
708
  lex() {
709
- return this.scanTokens(), this.tokens.push(V.create(u.EOF, this.start, this.current, "", !1)), this.gatherTrivia(), this.gatherInvalid(), new G(this.tokens, this.errors);
709
+ return this.scanTokens(), this.tokens.push(G.create(u.EOF, this.start, this.current, "", !1)), this.gatherTrivia(), this.gatherInvalid(), new X(this.tokens, this.errors);
710
710
  }
711
711
  scanTokens() {
712
712
  for (; !this.isAtEnd(); ) {
@@ -767,15 +767,15 @@ class pn {
767
767
  this.match("/") ? this.singleLineComment() : this.match("*") ? this.multilineComment() : this.operator();
768
768
  break;
769
769
  default:
770
- if (ot(e)) {
770
+ if (lt(e)) {
771
771
  this.operator();
772
772
  break;
773
773
  }
774
- if (Me(e)) {
774
+ if (Fe(e)) {
775
775
  this.identifier();
776
776
  break;
777
777
  }
778
- if (De(e)) {
778
+ if (Re(e)) {
779
779
  this.numericLiteralOrIdentifier();
780
780
  break;
781
781
  }
@@ -801,7 +801,7 @@ class pn {
801
801
  gatherInvalid() {
802
802
  let e;
803
803
  const n = [], s = [];
804
- for (e = 0; e < this.tokens.length && yt(this.tokens[e]); e += 1)
804
+ for (e = 0; e < this.tokens.length && kt(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) {
@@ -843,7 +843,7 @@ class pn {
843
843
  );
844
844
  return;
845
845
  }
846
- a && this.match(n), this.tokens.push(V.create(e, this.start, this.current, l, !1));
846
+ a && this.match(n), this.tokens.push(G.create(e, this.start, this.current, l, !1));
847
847
  }
848
848
  singleLineStringLiteral() {
849
849
  this.consumeUntil(u.STRING_LITERAL, "'", {
@@ -895,7 +895,7 @@ class pn {
895
895
  this.addToken(u.IDENTIFIER);
896
896
  }
897
897
  operator() {
898
- for (; ot(this.peek()); )
898
+ for (; lt(this.peek()); )
899
899
  this.advance();
900
900
  this.addToken(u.OP);
901
901
  }
@@ -912,7 +912,7 @@ class pn {
912
912
  return this.advance(), this.addToken(u.NUMERIC_LITERAL);
913
913
  if (!n && !Ee(this.peek()))
914
914
  return this.addToken(u.NUMERIC_LITERAL);
915
- if (!n && !De(this.peek()))
915
+ if (!n && !Re(this.peek()))
916
916
  break;
917
917
  this.advance();
918
918
  }
@@ -971,7 +971,7 @@ class pn {
971
971
  let n = "";
972
972
  for (let s = 0; s <= 3; s += 1) {
973
973
  if (this.isAtEnd() || !Ee(this.peek()))
974
- return this.errors.push(new c(o.INVALID_ESCAPE_SEQUENCE, `Invalid unicode escape sequence '\\u${n}', only unicode escape sequences of the form '\\uHHHH' where H is a hexadecimal number are allowed`, V.create(u.STRING_LITERAL, e, this.current, `\\u${n}`, !0))), `\\u${n}`;
974
+ return this.errors.push(new c(o.INVALID_ESCAPE_SEQUENCE, `Invalid unicode escape sequence '\\u${n}', only unicode escape sequences of the form '\\uHHHH' where H is a hexadecimal number are allowed`, G.create(u.STRING_LITERAL, e, this.current, `\\u${n}`, !0))), `\\u${n}`;
975
975
  n += this.advance();
976
976
  }
977
977
  return String.fromCharCode(parseInt(n, 16));
@@ -981,7 +981,7 @@ class pn {
981
981
  }
982
982
  }
983
983
  }
984
- var Se = /* @__PURE__ */ ((t) => (t[t.ListExpression = 0] = "ListExpression", t[t.GroupExpression = 1] = "GroupExpression", t[t.BlockExpression = 2] = "BlockExpression", t))(Se || {});
984
+ var Oe = /* @__PURE__ */ ((t) => (t[t.ListExpression = 0] = "ListExpression", t[t.GroupExpression = 1] = "GroupExpression", t[t.BlockExpression = 2] = "BlockExpression", t))(Oe || {});
985
985
  class dn {
986
986
  constructor() {
987
987
  this.stack = [], this.numberOfNestedLParens = 0, this.numberOfNestedLBrackets = 0, this.numberOfNestedLBraces = 0;
@@ -1069,7 +1069,7 @@ class Nn {
1069
1069
  }, this.synchronizeElementDeclarationName = () => {
1070
1070
  for (; !this.isAtEnd(); ) {
1071
1071
  const s = this.peek();
1072
- if (ht(s) || this.check(u.COLON, u.LBRACE, u.LBRACKET))
1072
+ if (ft(s) || this.check(u.COLON, u.LBRACE, u.LBRACKET))
1073
1073
  break;
1074
1074
  N(s), this.advance();
1075
1075
  }
@@ -1080,8 +1080,8 @@ class Nn {
1080
1080
  break;
1081
1081
  N(s), this.advance();
1082
1082
  }
1083
- }, this.blockExpression = this.contextStack.withContextDo(Se.BlockExpression, () => {
1084
- const s = { body: [] }, i = () => this.nodeFactory.create(Z, s);
1083
+ }, this.blockExpression = this.contextStack.withContextDo(Oe.BlockExpression, () => {
1084
+ const s = { body: [] }, i = () => this.nodeFactory.create(K, s);
1085
1085
  try {
1086
1086
  this.consume("Expect an opening brace '{'", u.LBRACE), s.blockOpenBrace = this.previous();
1087
1087
  } catch (r) {
@@ -1115,16 +1115,16 @@ class Nn {
1115
1115
  if (!this.check(u.RBRACE))
1116
1116
  for (N(this.advance()); !this.isAtEnd(); ) {
1117
1117
  const s = this.peek();
1118
- if (this.check(u.RBRACE) || ct(this.previous(), s))
1118
+ if (this.check(u.RBRACE) || ut(this.previous(), s))
1119
1119
  break;
1120
1120
  N(s), this.advance();
1121
1121
  }
1122
- }, this.tupleExpression = this.contextStack.withContextDo(Se.GroupExpression, () => {
1123
- const s = { elementList: [], commaList: [] }, i = () => this.nodeFactory.create(Ye, {
1122
+ }, this.tupleExpression = this.contextStack.withContextDo(Oe.GroupExpression, () => {
1123
+ const s = { elementList: [], commaList: [] }, i = () => this.nodeFactory.create(ze, {
1124
1124
  groupOpenParen: s.tupleOpenParen,
1125
1125
  groupCloseParen: s.tupleCloseParen,
1126
1126
  expression: s.elementList[0]
1127
- }), r = () => this.nodeFactory.create(K, s);
1127
+ }), r = () => this.nodeFactory.create(ee, s);
1128
1128
  try {
1129
1129
  this.consume("Expect an opening parenthesis '('", u.LPAREN), s.tupleOpenParen = this.previous();
1130
1130
  } catch (a) {
@@ -1171,8 +1171,8 @@ class Nn {
1171
1171
  break;
1172
1172
  N(s), this.advance();
1173
1173
  }
1174
- }, this.listExpression = this.contextStack.withContextDo(Se.ListExpression, () => {
1175
- const s = { elementList: [], commaList: [] }, i = () => this.nodeFactory.create(P, s);
1174
+ }, this.listExpression = this.contextStack.withContextDo(Oe.ListExpression, () => {
1175
+ const s = { elementList: [], commaList: [] }, i = () => this.nodeFactory.create(R, s);
1176
1176
  try {
1177
1177
  this.consume("Expect an opening bracket '['", u.LBRACKET), s.listOpenBracket = this.previous();
1178
1178
  } catch (r) {
@@ -1289,8 +1289,8 @@ class Nn {
1289
1289
  this.tokens = e;
1290
1290
  }
1291
1291
  parse() {
1292
- const e = this.program(), n = this.advance(), s = this.nodeFactory.create($, { body: e, eof: n });
1293
- return this.gatherInvalid(), new G({ ast: s, tokens: this.tokens }, this.errors);
1292
+ const e = this.program(), n = this.advance(), s = this.nodeFactory.create(j, { body: e, eof: n });
1293
+ return this.gatherInvalid(), new X({ ast: s, tokens: this.tokens }, this.errors);
1294
1294
  }
1295
1295
  /* Parsing and synchronizing ProgramNode */
1296
1296
  program() {
@@ -1324,7 +1324,7 @@ class Nn {
1324
1324
  throw new d(s.token, n(), s.handlerContext);
1325
1325
  this.synchronizeElementDeclarationName();
1326
1326
  }
1327
- if (ht(this.peek()))
1327
+ if (ft(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
@@ -1400,7 +1400,7 @@ class Nn {
1400
1400
  return n();
1401
1401
  let s = e.callee;
1402
1402
  for (; !this.shouldStopExpression(); ) {
1403
- $e(this.previous()) || this.logError(s, o.MISSING_SPACES, "Expect a following space");
1403
+ We(this.previous()) || this.logError(s, o.MISSING_SPACES, "Expect a following space");
1404
1404
  try {
1405
1405
  s = this.normalExpression(), e.args.push(s);
1406
1406
  } catch (i) {
@@ -1410,7 +1410,7 @@ class Nn {
1410
1410
  return n();
1411
1411
  }
1412
1412
  shouldStopExpression() {
1413
- if (this.isAtEnd() || Lt(this.previous()))
1413
+ if (this.isAtEnd() || gt(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,26 +1424,26 @@ class Nn {
1424
1424
  for (; !this.isAtEnd(); ) {
1425
1425
  const s = this.peek();
1426
1426
  if (s.kind === u.LPAREN) {
1427
- const { left: i } = ft(s);
1427
+ const { left: i } = pt(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
- ct(this.previous(), s) && !this.contextStack.isWithinGroupExpressionContext() && !this.contextStack.isWithinListExpressionContext())
1432
+ ut(this.previous(), s) && !this.contextStack.isWithinGroupExpressionContext() && !this.contextStack.isWithinListExpressionContext())
1433
1433
  break;
1434
1434
  try {
1435
- n = this.nodeFactory.create(J, {
1435
+ n = this.nodeFactory.create(Z, {
1436
1436
  callee: n,
1437
1437
  argumentList: this.tupleExpression()
1438
1438
  });
1439
1439
  } catch (r) {
1440
- throw r instanceof d ? (n = this.nodeFactory.create(J, {
1440
+ throw r instanceof d ? (n = this.nodeFactory.create(Z, {
1441
1441
  callee: n,
1442
1442
  argumentList: r.partialNode
1443
1443
  }), new d(r.token, n, r.handlerContext)) : r;
1444
1444
  }
1445
1445
  } else if (s.kind === u.LBRACKET) {
1446
- if ($e(this.previous()))
1446
+ if (We(this.previous()))
1447
1447
  break;
1448
1448
  try {
1449
1449
  n = this.nodeFactory.create(he, {
@@ -1456,12 +1456,12 @@ class Nn {
1456
1456
  indexer: i.partialNode
1457
1457
  }), new d(i.token, n, i.handlerContext)) : i;
1458
1458
  }
1459
- } else if (lt(s)) {
1460
- const i = s, r = ft(i);
1459
+ } else if (ct(s)) {
1460
+ const i = s, r = pt(i);
1461
1461
  if (r.left !== null) {
1462
1462
  if (r.left <= e)
1463
1463
  break;
1464
- this.advance(), n = this.nodeFactory.create(Ue, {
1464
+ this.advance(), n = this.nodeFactory.create(Me, {
1465
1465
  expression: n,
1466
1466
  op: i
1467
1467
  });
@@ -1471,13 +1471,13 @@ class Nn {
1471
1471
  break;
1472
1472
  this.advance();
1473
1473
  try {
1474
- n = this.nodeFactory.create(H, {
1474
+ n = this.nodeFactory.create(J, {
1475
1475
  leftExpression: n,
1476
1476
  op: i,
1477
1477
  rightExpression: i.value === "." ? this.extractOperand() : this.expression_bp(a.right)
1478
1478
  });
1479
1479
  } catch (l) {
1480
- throw l instanceof d ? (n = this.nodeFactory.create(H, {
1480
+ throw l instanceof d ? (n = this.nodeFactory.create(J, {
1481
1481
  leftExpression: n,
1482
1482
  op: i,
1483
1483
  rightExpression: l.partialNode
@@ -1491,7 +1491,7 @@ class Nn {
1491
1491
  }
1492
1492
  leftExpression_bp() {
1493
1493
  let e;
1494
- if (lt(this.peek())) {
1494
+ if (ct(this.peek())) {
1495
1495
  const n = {};
1496
1496
  n.op = this.peek();
1497
1497
  const s = In(n.op);
@@ -1502,7 +1502,7 @@ class Nn {
1502
1502
  `Unexpected '${n.op.value}' in an expression`
1503
1503
  ), new d(
1504
1504
  n.op,
1505
- this.nodeFactory.create(xe, { pre: n.op }),
1505
+ this.nodeFactory.create(Se, { pre: n.op }),
1506
1506
  this.contextStack.findHandlerContext(this.tokens, this.current)
1507
1507
  );
1508
1508
  this.advance();
@@ -1511,15 +1511,15 @@ class Nn {
1511
1511
  } catch (i) {
1512
1512
  throw i instanceof d ? (n.expression = i.partialNode, new d(
1513
1513
  i.token,
1514
- this.nodeFactory.create(q, n),
1514
+ this.nodeFactory.create(H, n),
1515
1515
  i.handlerContext
1516
1516
  )) : i;
1517
1517
  }
1518
- e = this.nodeFactory.create(q, n);
1519
- } else if (e = this.extractOperand(), e instanceof xe)
1518
+ e = this.nodeFactory.create(H, n);
1519
+ } else if (e = this.extractOperand(), e instanceof Se)
1520
1520
  throw new d(
1521
1521
  this.peek(),
1522
- this.nodeFactory.create(xe, { pre: this.peek() }),
1522
+ this.nodeFactory.create(Se, { pre: this.peek() }),
1523
1523
  this.contextStack.findHandlerContext(this.tokens, this.current)
1524
1524
  );
1525
1525
  return e;
@@ -1543,7 +1543,7 @@ class Nn {
1543
1543
  this.peek(),
1544
1544
  o.INVALID_OPERAND,
1545
1545
  `Invalid start of operand "${this.peek().value}"`
1546
- ), this.nodeFactory.create(xe, { pre: this.previous() }));
1546
+ ), this.nodeFactory.create(Se, { pre: this.previous() }));
1547
1547
  }
1548
1548
  /* Parsing FunctionExpression */
1549
1549
  functionExpression() {
@@ -1569,12 +1569,12 @@ class Nn {
1569
1569
  u.STRING_LITERAL,
1570
1570
  u.NUMERIC_LITERAL
1571
1571
  ))
1572
- return this.nodeFactory.create(F, {
1572
+ return this.nodeFactory.create(M, {
1573
1573
  expression: this.nodeFactory.create(be, { literal: this.previous() })
1574
1574
  });
1575
1575
  if (this.match(u.QUOTED_STRING, u.IDENTIFIER))
1576
- return this.nodeFactory.create(F, {
1577
- expression: this.nodeFactory.create(ee, { variable: this.previous() })
1576
+ return this.nodeFactory.create(M, {
1577
+ expression: this.nodeFactory.create(te, { variable: this.previous() })
1578
1578
  });
1579
1579
  throw this.logError(this.peek(), o.UNEXPECTED_TOKEN, "Expect a variable or literal"), new d(
1580
1580
  this.peek(),
@@ -1590,7 +1590,7 @@ class Nn {
1590
1590
  n,
1591
1591
  o.EMPTY_ATTRIBUTE_NAME,
1592
1592
  "Expect a non-empty attribute name"
1593
- ), e.name = this.nodeFactory.create(z, { identifiers: [] });
1593
+ ), e.name = this.nodeFactory.create(q, { identifiers: [] });
1594
1594
  } else
1595
1595
  try {
1596
1596
  e.name = this.attributeName();
@@ -1628,11 +1628,11 @@ class Nn {
1628
1628
  } catch (n) {
1629
1629
  throw n instanceof d ? new d(
1630
1630
  n.token,
1631
- this.nodeFactory.create(z, { identifiers: e }),
1631
+ this.nodeFactory.create(q, { identifiers: e }),
1632
1632
  n.handlerContext
1633
1633
  ) : n;
1634
1634
  }
1635
- return this.nodeFactory.create(z, { identifiers: e });
1635
+ return this.nodeFactory.create(q, { identifiers: e });
1636
1636
  }
1637
1637
  logError(e, n, s) {
1638
1638
  this.errors.push(new c(n, s, e));
@@ -1671,11 +1671,11 @@ function In(t) {
1671
1671
  const Ln = {
1672
1672
  "(": { left: 14, right: null }
1673
1673
  };
1674
- function ft(t) {
1674
+ function pt(t) {
1675
1675
  return Ln[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 || {});
1678
- function ve(t) {
1678
+ function we(t) {
1679
1679
  var n;
1680
1680
  const e = (n = t == null ? void 0 : t.type) == null ? void 0 : n.value.toLowerCase();
1681
1681
  switch (e) {
@@ -1692,12 +1692,12 @@ function ve(t) {
1692
1692
  }
1693
1693
  }
1694
1694
  function pe(t) {
1695
- if (!Ke(t))
1695
+ if (!et(t))
1696
1696
  return new x([t]);
1697
1697
  const e = pe(t.leftExpression).unwrap_or(void 0);
1698
1698
  return e ? (e.push(t.rightExpression), new x(e)) : new y();
1699
1699
  }
1700
- function j(t) {
1700
+ function z(t) {
1701
1701
  if (t === void 0)
1702
1702
  return new y();
1703
1703
  const e = pe(t).unwrap_or(void 0);
@@ -1705,14 +1705,14 @@ function j(t) {
1705
1705
  return new y();
1706
1706
  const n = [];
1707
1707
  for (const s of e) {
1708
- const i = Y(s).unwrap_or(void 0);
1708
+ const i = Q(s).unwrap_or(void 0);
1709
1709
  if (!i)
1710
1710
  return new y();
1711
1711
  n.push(i);
1712
1712
  }
1713
1713
  return new x(n);
1714
1714
  }
1715
- function _e(t) {
1715
+ function Ae(t) {
1716
1716
  if (t === void 0)
1717
1717
  return new y();
1718
1718
  const e = pe(t).unwrap_or(void 0);
@@ -1720,17 +1720,17 @@ function _e(t) {
1720
1720
  return new y();
1721
1721
  const n = [];
1722
1722
  let s;
1723
- if (!B(I.last(e))) {
1723
+ if (!V(I.last(e))) {
1724
1724
  const i = e.pop();
1725
- if (Ot(i))
1725
+ if (Dt(i))
1726
1726
  s = i.elementList.map(
1727
- (r) => X(r).unwrap()
1727
+ (r) => W(r).unwrap()
1728
1728
  );
1729
1729
  else
1730
1730
  return new y();
1731
1731
  }
1732
1732
  for (const i of e) {
1733
- const r = Y(i).unwrap_or(void 0);
1733
+ const r = Q(i).unwrap_or(void 0);
1734
1734
  if (!r)
1735
1735
  return new y();
1736
1736
  n.push(r);
@@ -1740,41 +1740,41 @@ function _e(t) {
1740
1740
  tupleElements: s
1741
1741
  });
1742
1742
  }
1743
- function Y(t) {
1744
- return B(t) ? new x(t.expression.variable.value) : new y();
1743
+ function Q(t) {
1744
+ return V(t) ? new x(t.expression.variable.value) : new y();
1745
1745
  }
1746
- function We(t) {
1747
- if (pt(t))
1746
+ function je(t) {
1747
+ if (dt(t))
1748
1748
  return t instanceof se ? new x({ functional: [t], nonFunctional: [] }) : new x({ functional: [], nonFunctional: [t] });
1749
- if (t instanceof K && t.elementList.every(pt)) {
1749
+ if (t instanceof ee && t.elementList.every(dt)) {
1750
1750
  const e = t.elementList.filter(
1751
1751
  (s) => s instanceof se
1752
- ), n = t.elementList.filter(B);
1752
+ ), n = t.elementList.filter(V);
1753
1753
  return new x({ functional: e, nonFunctional: n });
1754
1754
  }
1755
1755
  return new y();
1756
1756
  }
1757
- function X(t) {
1757
+ function W(t) {
1758
1758
  var n;
1759
1759
  const e = (n = t == null ? void 0 : t.expression.variable) == null ? void 0 : n.value;
1760
1760
  return e === void 0 ? new y() : new x(e);
1761
1761
  }
1762
- function C(t) {
1763
- return W(t) ? t.expression instanceof ee ? new x(t.expression.variable.value) : new x(t.expression.literal.value) : new y();
1762
+ function $(t) {
1763
+ return Y(t) ? t.expression instanceof te ? new x(t.expression.variable.value) : new x(t.expression.literal.value) : new y();
1764
1764
  }
1765
1765
  function gn(t) {
1766
1766
  var e;
1767
- return !(t instanceof H) || !St((e = t.op) == null ? void 0 : e.value) ? !1 : _e(t.leftExpression).and_then(() => _e(t.rightExpression)).unwrap_or(void 0) !== void 0;
1767
+ return !(t instanceof J) || !Ot((e = t.op) == null ? void 0 : e.value) ? !1 : Ae(t.leftExpression).and_then(() => Ae(t.rightExpression)).unwrap_or(void 0) !== void 0;
1768
1768
  }
1769
1769
  function _n(t) {
1770
- const e = _e(t.leftExpression), n = _e(t.rightExpression);
1770
+ const e = Ae(t.leftExpression), n = Ae(t.rightExpression);
1771
1771
  if (!e.isOk() || !n.isOk())
1772
1772
  return !1;
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 pt(t) {
1777
- return t instanceof F && t.expression instanceof ee || t instanceof se;
1776
+ function dt(t) {
1777
+ return t instanceof M && t.expression instanceof te || t instanceof se;
1778
1778
  }
1779
1779
  function An(t, e) {
1780
1780
  var i, r, a, l;
@@ -1783,9 +1783,9 @@ function An(t, e) {
1783
1783
  for (; n; ) {
1784
1784
  if ((r = (i = n.symbol) == null ? void 0 : i.symbolTable) != null && r.has(t))
1785
1785
  return (a = n.symbol.symbolTable) == null ? void 0 : a.get(t);
1786
- if (((l = n.symbol) == null ? void 0 : l.declaration) instanceof $ && s)
1786
+ if (((l = n.symbol) == null ? void 0 : l.declaration) instanceof j && s)
1787
1787
  return n.symbol;
1788
- if (n instanceof $)
1788
+ if (n instanceof j)
1789
1789
  return;
1790
1790
  n = n.parent;
1791
1791
  }
@@ -1798,7 +1798,7 @@ class vn {
1798
1798
  return [...this.validateContext(), ...this.validateName(this.declarationNode.name), ...this.validateAlias(this.declarationNode.alias), ...this.validateSettingList(this.declarationNode.attributeList), ...this.validateBody(this.declarationNode.body)];
1799
1799
  }
1800
1800
  validateContext() {
1801
- return this.declarationNode.parent instanceof $ || ve(this.declarationNode.parent).unwrap_or(void 0) !== b.Project ? [new c(o.INVALID_CUSTOM_CONTEXT, "A custom element can only appear in a Project", this.declarationNode)] : [];
1801
+ return this.declarationNode.parent instanceof j || we(this.declarationNode.parent).unwrap_or(void 0) !== b.Project ? [new c(o.INVALID_CUSTOM_CONTEXT, "A custom element can only appear in a Project", this.declarationNode)] : [];
1802
1802
  }
1803
1803
  validateName(e) {
1804
1804
  return e ? [new c(o.UNEXPECTED_NAME, "A Custom element shouldn't have a name", e)] : [];
@@ -1812,13 +1812,13 @@ class vn {
1812
1812
  validateBody(e) {
1813
1813
  if (!e)
1814
1814
  return [];
1815
- if (e instanceof Z)
1815
+ if (e instanceof K)
1816
1816
  return [new c(o.UNEXPECTED_COMPLEX_BODY, "A Custom element can only have an inline field", e)];
1817
1817
  const n = [];
1818
- return W(e.callee) || n.push(new c(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 c(o.INVALID_CUSTOM_ELEMENT_VALUE, "A Custom element value can only be a string", s))), n;
1818
+ return Y(e.callee) || n.push(new c(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 c(o.INVALID_CUSTOM_ELEMENT_VALUE, "A Custom element value can only be a string", s))), n;
1819
1819
  }
1820
1820
  }
1821
- class we {
1821
+ class ye {
1822
1822
  constructor() {
1823
1823
  this.table = /* @__PURE__ */ new Map();
1824
1824
  }
@@ -1846,17 +1846,17 @@ class wn {
1846
1846
  return this.declarationNode.parent instanceof A ? [new c(o.INVALID_PROJECT_CONTEXT, "An Enum can only appear top-level", this.declarationNode)] : [];
1847
1847
  }
1848
1848
  validateName(e) {
1849
- return e ? xt(e) ? [] : [new c(o.INVALID_NAME, "An Enum name must be of the form <enum> or <schema>.<enum>", e)] : [new c(o.NAME_NOT_FOUND, "An Enum must have a name", this.declarationNode)];
1849
+ return e ? St(e) ? [] : [new c(o.INVALID_NAME, "An Enum name must be of the form <enum> or <schema>.<enum>", e)] : [new c(o.NAME_NOT_FOUND, "An Enum must have a name", this.declarationNode)];
1850
1850
  }
1851
1851
  validateAlias(e) {
1852
1852
  return e ? [new c(o.UNEXPECTED_ALIAS, "A Ref shouldn't have an alias", e)] : [];
1853
1853
  }
1854
1854
  registerElement() {
1855
1855
  const e = [];
1856
- this.declarationNode.symbol = this.symbolFactory.create(sn, { declaration: this.declarationNode, symbolTable: new we() });
1857
- const { name: n } = this.declarationNode, s = j(n);
1856
+ this.declarationNode.symbol = this.symbolFactory.create(sn, { declaration: this.declarationNode, symbolTable: new ye() });
1857
+ const { name: n } = this.declarationNode, s = z(n);
1858
1858
  if (s.isOk()) {
1859
- const i = s.unwrap(), r = i.pop(), a = et(i, this.publicSymbolTable, this.symbolFactory), l = qe(r);
1859
+ const i = s.unwrap(), r = i.pop(), a = tt(i, this.publicSymbolTable, this.symbolFactory), l = He(r);
1860
1860
  a.has(l) && e.push(new c(o.DUPLICATE_NAME, `Enum name ${r} already exists in schema '${i.join(".") || "public"}'`, n)), a.set(l, this.declarationNode.symbol);
1861
1861
  }
1862
1862
  return e;
@@ -1875,19 +1875,19 @@ class wn {
1875
1875
  validateFields(e) {
1876
1876
  return e.length === 0 ? [new c(o.EMPTY_ENUM, "An Enum must have at least one element", this.declarationNode)] : e.flatMap((n) => {
1877
1877
  const s = [];
1878
- n.callee && !B(n.callee) && s.push(new c(o.INVALID_ENUM_ELEMENT_NAME, "An enum field must be an identifier or a quoted identifier", n.callee));
1878
+ n.callee && !V(n.callee) && s.push(new c(o.INVALID_ENUM_ELEMENT_NAME, "An enum field must be an identifier or a quoted identifier", n.callee));
1879
1879
  const i = [...n.args];
1880
- return I.last(i) instanceof P ? (s.push(...this.validateFieldSettings(I.last(i))), i.pop()) : i[0] instanceof P && (s.push(...this.validateFieldSettings(i[0])), i.shift()), i.length > 0 && s.push(...i.map((r) => new c(o.INVALID_ENUM_ELEMENT, "An Enum must have only a field and optionally a setting list", r))), s.push(...this.registerField(n)), s;
1880
+ return I.last(i) instanceof R ? (s.push(...this.validateFieldSettings(I.last(i))), i.pop()) : i[0] instanceof R && (s.push(...this.validateFieldSettings(i[0])), i.shift()), i.length > 0 && s.push(...i.map((r) => new c(o.INVALID_ENUM_ELEMENT, "An Enum must have only a field and optionally a setting list", r))), s.push(...this.registerField(n)), s;
1881
1881
  });
1882
1882
  }
1883
1883
  validateFieldSettings(e) {
1884
- const n = M(e), s = n.getErrors(), i = n.getValue();
1884
+ const n = C(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((l) => s.push(new c(o.DUPLICATE_ENUM_ELEMENT_SETTING, "'note' can only appear once", l))), a.forEach((l) => {
1890
- W(l.value) || s.push(new c(o.INVALID_ENUM_ELEMENT_SETTING, "'note' must be a string", l));
1890
+ Y(l.value) || s.push(new c(o.INVALID_ENUM_ELEMENT_SETTING, "'note' must be a string", l));
1891
1891
  });
1892
1892
  break;
1893
1893
  default:
@@ -1905,8 +1905,8 @@ class wn {
1905
1905
  });
1906
1906
  }
1907
1907
  registerField(e) {
1908
- if (e.callee && B(e.callee)) {
1909
- const n = X(e.callee).unwrap(), s = He(n), i = this.symbolFactory.create(rn, { declaration: e });
1908
+ if (e.callee && V(e.callee)) {
1909
+ const n = W(e.callee).unwrap(), s = Je(n), i = this.symbolFactory.create(rn, { declaration: e });
1910
1910
  e.symbol = i;
1911
1911
  const r = this.declarationNode.symbol.symbolTable;
1912
1912
  if (r.has(s)) {
@@ -1929,7 +1929,7 @@ class yn {
1929
1929
  return [...this.validateContext(), ...this.validateName(this.declarationNode.name), ...this.validateAlias(this.declarationNode.alias), ...this.validateSettingList(this.declarationNode.attributeList), ...this.validateBody(this.declarationNode.body)];
1930
1930
  }
1931
1931
  validateContext() {
1932
- return this.declarationNode.parent instanceof $ || ve(this.declarationNode.parent).unwrap_or(void 0) !== b.Table ? [new c(o.INVALID_NOTE_CONTEXT, "An Indexes can only appear inside a Table", this.declarationNode)] : [];
1932
+ return this.declarationNode.parent instanceof j || we(this.declarationNode.parent).unwrap_or(void 0) !== b.Table ? [new c(o.INVALID_NOTE_CONTEXT, "An Indexes can only appear inside a Table", this.declarationNode)] : [];
1933
1933
  }
1934
1934
  validateName(e) {
1935
1935
  return e ? [new c(o.UNEXPECTED_NAME, "An Indexes shouldn't have a name", e)] : [];
@@ -1953,22 +1953,22 @@ class yn {
1953
1953
  if (!n.callee)
1954
1954
  return [];
1955
1955
  const s = [], i = [n.callee, ...n.args];
1956
- return I.last(i) instanceof P && s.push(...this.validateFieldSetting(i.pop())), i.forEach((r) => {
1957
- for (; r instanceof J; )
1958
- r.argumentList && !We(r.argumentList).isOk() && s.push(new c(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;
1959
- We(r).isOk() || s.push(new c(o.INVALID_INDEXES_FIELD, "An index field must be an identifier, a quoted identifier, a functional expression or a tuple of such", r));
1956
+ return I.last(i) instanceof R && s.push(...this.validateFieldSetting(i.pop())), i.forEach((r) => {
1957
+ for (; r instanceof Z; )
1958
+ r.argumentList && !je(r.argumentList).isOk() && s.push(new c(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;
1959
+ je(r).isOk() || s.push(new c(o.INVALID_INDEXES_FIELD, "An index field must be an identifier, a quoted identifier, a functional expression or a tuple of such", r));
1960
1960
  }), s;
1961
1961
  });
1962
1962
  }
1963
1963
  validateFieldSetting(e) {
1964
- const n = M(e), s = n.getErrors(), i = n.getValue();
1964
+ const n = C(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((l) => s.push(new c(o.DUPLICATE_INDEX_SETTING, `'${r}' can only appear once`, l))), a.forEach((l) => {
1971
- W(l.value) || s.push(new c(o.INVALID_INDEX_SETTING_VALUE, `'${r}' must be a string`, l));
1971
+ Y(l.value) || s.push(new c(o.INVALID_INDEX_SETTING_VALUE, `'${r}' must be a string`, l));
1972
1972
  });
1973
1973
  break;
1974
1974
  case "unique":
@@ -1979,7 +1979,7 @@ class yn {
1979
1979
  break;
1980
1980
  case "type":
1981
1981
  a.length > 1 && a.forEach((l) => s.push(new c(o.DUPLICATE_INDEX_SETTING, "'type' can only appear once", l))), a.forEach((l) => {
1982
- B(l.value) || s.push(new c(o.INVALID_INDEX_SETTING_VALUE, `'type' must be "btree" or "hash"`, l));
1982
+ V(l.value) || s.push(new c(o.INVALID_INDEX_SETTING_VALUE, `'type' must be "btree" or "hash"`, l));
1983
1983
  });
1984
1984
  break;
1985
1985
  default:
@@ -2011,22 +2011,22 @@ class kn {
2011
2011
  ];
2012
2012
  }
2013
2013
  validateContext() {
2014
- return !(this.declarationNode.parent instanceof $) && ![
2014
+ return !(this.declarationNode.parent instanceof j) && ![
2015
2015
  b.Table,
2016
2016
  b.TableGroup,
2017
2017
  b.Project
2018
- ].includes(ve(this.declarationNode.parent).unwrap_or(void 0)) ? [new c(
2018
+ ].includes(we(this.declarationNode.parent).unwrap_or(void 0)) ? [new c(
2019
2019
  o.INVALID_NOTE_CONTEXT,
2020
2020
  "A Note can only appear inside a Table, a Table Group or a Project. Sticky note can only appear at the global scope.",
2021
2021
  this.declarationNode
2022
2022
  )] : [];
2023
2023
  }
2024
2024
  validateName(e) {
2025
- if (!(this.declarationNode.parent instanceof $))
2025
+ if (!(this.declarationNode.parent instanceof j))
2026
2026
  return e ? [new c(o.UNEXPECTED_NAME, "A Note shouldn't have a name", e)] : [];
2027
2027
  if (!e)
2028
2028
  return [new c(o.INVALID_NAME, "Sticky note must have a name", this.declarationNode)];
2029
- const n = j(e);
2029
+ const n = z(e);
2030
2030
  if (!n.isOk())
2031
2031
  return [new c(o.INVALID_NAME, "Invalid name for sticky note ", this.declarationNode)];
2032
2032
  const i = n.unwrap().join("."), r = Zt(i);
@@ -2048,7 +2048,7 @@ class kn {
2048
2048
  }
2049
2049
  validateFields(e) {
2050
2050
  const n = [];
2051
- return e.length === 0 ? [new c(o.EMPTY_NOTE, "A Note must have a content", this.declarationNode)] : (e.length > 1 && e.slice(1).forEach((s) => n.push(new c(o.NOTE_CONTENT_REDEFINED, "A Note can only contain one string", s))), W(e[0].callee) || n.push(new c(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 c(o.INVALID_NOTE, "A Note can only contain one quoted string", s))), n);
2051
+ return e.length === 0 ? [new c(o.EMPTY_NOTE, "A Note must have a content", this.declarationNode)] : (e.length > 1 && e.slice(1).forEach((s) => n.push(new c(o.NOTE_CONTENT_REDEFINED, "A Note can only contain one string", s))), Y(e[0].callee) || n.push(new c(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 c(o.INVALID_NOTE, "A Note can only contain one quoted string", s))), n);
2052
2052
  }
2053
2053
  validateSubElements(e) {
2054
2054
  return e.flatMap((n) => {
@@ -2070,7 +2070,7 @@ class xn {
2070
2070
  return this.declarationNode.parent instanceof A ? [new c(o.INVALID_PROJECT_CONTEXT, "A Project can only appear top-level", this.declarationNode)] : [];
2071
2071
  }
2072
2072
  validateName(e) {
2073
- return e ? ye(e) ? [] : [new c(o.INVALID_NAME, "A Project's name is optional or must be an identifier or a quoted identifer", e)] : [];
2073
+ return e ? ke(e) ? [] : [new c(o.INVALID_NAME, "A Project's name is optional or must be an identifier or a quoted identifer", e)] : [];
2074
2074
  }
2075
2075
  validateAlias(e) {
2076
2076
  return e ? [new c(o.UNEXPECTED_ALIAS, "A Project shouldn't have an alias", e)] : [];
@@ -2106,31 +2106,16 @@ class Sn {
2106
2106
  return [...this.validateContext(), ...this.validateName(this.declarationNode.name), ...this.validateAlias(this.declarationNode.alias), ...this.validateSettingList(this.declarationNode.attributeList), ...this.validateBody(this.declarationNode.body)];
2107
2107
  }
2108
2108
  validateContext() {
2109
- return this.declarationNode.parent instanceof $ ? [] : [new c(o.INVALID_REF_CONTEXT, "A Ref must appear top-level", this.declarationNode)];
2109
+ return this.declarationNode.parent instanceof j ? [] : [new c(o.INVALID_REF_CONTEXT, "A Ref must appear top-level", this.declarationNode)];
2110
2110
  }
2111
2111
  validateName(e) {
2112
- return e ? ye(e) ? [] : [new c(o.INVALID_NAME, "A Ref's name is optional or must be an identifier or a quoted identifer", e)] : [];
2112
+ return e ? ke(e) ? [] : [new c(o.INVALID_NAME, "A Ref's name is optional or must be an identifier or a quoted identifer", e)] : [];
2113
2113
  }
2114
2114
  validateAlias(e) {
2115
2115
  return e ? [new c(o.UNEXPECTED_ALIAS, "A Ref shouldn't have an alias", e)] : [];
2116
2116
  }
2117
2117
  validateSettingList(e) {
2118
- if (!e)
2119
- return [];
2120
- const n = M(e), s = n.getErrors(), i = n.getValue();
2121
- for (const r in i) {
2122
- const a = i[r];
2123
- switch (r) {
2124
- case "color":
2125
- a.length > 1 && s.push(...a.map((l) => new c(o.DUPLICATE_REF_SETTING, "'color' can only appear once", l))), a.forEach((l) => {
2126
- tt(l.value) || s.push(new c(o.INVALID_TABLE_SETTING, "'color' must be a color literal", l.value || l.name));
2127
- });
2128
- break;
2129
- default:
2130
- s.push(...a.map((l) => new c(o.INVALID_TABLE_SETTING, `Unknown '${r}' setting`, l)));
2131
- }
2132
- }
2133
- return s;
2118
+ return e ? [new c(o.UNEXPECTED_SETTINGS, "A Ref shouldn't have a setting list", e)] : [];
2134
2119
  }
2135
2120
  validateBody(e) {
2136
2121
  if (!e)
@@ -2147,11 +2132,16 @@ class Sn {
2147
2132
  return e.length > 1 && n.push(...e.slice(1).map((s) => new c(o.REF_REDEFINED, "A Ref can only contain one binary relationship", s))), e.forEach((s) => {
2148
2133
  s.callee && !gn(s.callee) && n.push(new c(o.INVALID_REF_FIELD, "A Ref field must be a binary relationship", s.callee)), s.callee && !_n(s.callee) && n.push(new c(o.UNEQUAL_FIELDS_BINARY_REF, "Unequal fields in ref endpoints", s.callee));
2149
2134
  const i = [...s.args];
2150
- I.last(i) instanceof P ? (this.validateFieldSettings(I.last(i)), i.pop()) : i[0] instanceof P && (n.push(...this.validateFieldSettings(i[0])), i.shift()), i.length > 0 && n.push(...i.map((r) => new c(o.INVALID_REF_FIELD, "A Ref field should only have a single binary relationship", r)));
2135
+ if (I.last(i) instanceof R) {
2136
+ const r = this.validateFieldSettings(I.last(i));
2137
+ n.push(...r), i.pop();
2138
+ } else
2139
+ i[0] instanceof R && (n.push(...this.validateFieldSettings(i[0])), i.shift());
2140
+ i.length > 0 && n.push(...i.map((r) => new c(o.INVALID_REF_FIELD, "A Ref field should only have a single binary relationship", r)));
2151
2141
  }), n;
2152
2142
  }
2153
2143
  validateFieldSettings(e) {
2154
- const n = M(e), s = n.getErrors(), i = n.getValue();
2144
+ const n = C(e), s = n.getErrors(), i = n.getValue();
2155
2145
  for (const r in i) {
2156
2146
  const a = i[r];
2157
2147
  switch (r) {
@@ -2161,6 +2151,11 @@ class Sn {
2161
2151
  On(l.value) || s.push(new c(o.INVALID_REF_SETTING_VALUE, `'${r}' can only have values "cascade", "no action", "set null", "set default" or "restrict"`, l));
2162
2152
  });
2163
2153
  break;
2154
+ case "color":
2155
+ a.length > 1 && s.push(...a.map((l) => new c(o.DUPLICATE_REF_SETTING, "'color' can only appear once", l))), a.forEach((l) => {
2156
+ nt(l.value) || s.push(new c(o.INVALID_REF_SETTING_VALUE, "'color' must be a color literal", l));
2157
+ });
2158
+ break;
2164
2159
  default:
2165
2160
  a.forEach((l) => s.push(new c(o.UNKNOWN_REF_SETTING, `Unknown ref setting '${r}'`, l)));
2166
2161
  }
@@ -2177,10 +2172,10 @@ class Sn {
2177
2172
  }
2178
2173
  }
2179
2174
  function On(t) {
2180
- if (!(B(t) && t.expression.variable.kind !== u.QUOTED_STRING) && !(t instanceof z))
2175
+ if (!(V(t) && t.expression.variable.kind !== u.QUOTED_STRING) && !(t instanceof q))
2181
2176
  return !1;
2182
2177
  let e;
2183
- if (t instanceof z ? e = Te(t).unwrap_or("") : e = t.expression.variable.value, e)
2178
+ if (t instanceof q ? e = Te(t).unwrap_or("") : e = t.expression.variable.value, e)
2184
2179
  switch (e.toLowerCase()) {
2185
2180
  case "cascade":
2186
2181
  case "no action":
@@ -2204,24 +2199,24 @@ class Dn {
2204
2199
  return this.declarationNode.parent instanceof A ? [new c(o.INVALID_TABLE_CONTEXT, "Table must appear top-level", this.declarationNode)] : [];
2205
2200
  }
2206
2201
  validateName(e) {
2207
- return e ? e instanceof he ? [new c(o.INVALID_NAME, "Invalid array as Table name, maybe you forget to add a space between the name and the setting list?", e)] : xt(e) ? [] : [new c(o.INVALID_NAME, "A Table name must be of the form <table> or <schema>.<table>", e)] : [new c(o.NAME_NOT_FOUND, "A Table must have a name", this.declarationNode)];
2202
+ return e ? e instanceof he ? [new c(o.INVALID_NAME, "Invalid array as Table name, maybe you forget to add a space between the name and the setting list?", e)] : St(e) ? [] : [new c(o.INVALID_NAME, "A Table name must be of the form <table> or <schema>.<table>", e)] : [new c(o.NAME_NOT_FOUND, "A Table must have a name", this.declarationNode)];
2208
2203
  }
2209
2204
  validateAlias(e) {
2210
2205
  return e ? Mn(e) ? [] : [new c(o.INVALID_ALIAS, "Table aliases can only contains alphanumeric and underscore unless surrounded by double quotes", e)] : [];
2211
2206
  }
2212
2207
  validateSettingList(e) {
2213
- const n = M(e), s = n.getErrors(), i = n.getValue();
2208
+ const n = C(e), s = n.getErrors(), i = n.getValue();
2214
2209
  for (const r in i) {
2215
2210
  const a = i[r];
2216
2211
  switch (r) {
2217
2212
  case "headercolor":
2218
2213
  a.length > 1 && s.push(...a.map((l) => new c(o.DUPLICATE_TABLE_SETTING, "'headercolor' can only appear once", l))), a.forEach((l) => {
2219
- tt(l.value) || s.push(new c(o.INVALID_TABLE_SETTING, "'headercolor' must be a color literal", l.value || l.name));
2214
+ nt(l.value) || s.push(new c(o.INVALID_TABLE_SETTING, "'headercolor' must be a color literal", l.value || l.name));
2220
2215
  });
2221
2216
  break;
2222
2217
  case "note":
2223
2218
  a.length > 1 && s.push(...a.map((l) => new c(o.DUPLICATE_TABLE_SETTING, "'note' can only appear once", l))), a.forEach((l) => {
2224
- W(l.value) || s.push(new c(o.INVALID_TABLE_SETTING, "'note' must be a string literal", l.value || l.name));
2219
+ Y(l.value) || s.push(new c(o.INVALID_TABLE_SETTING, "'note' must be a string literal", l.value || l.name));
2225
2220
  });
2226
2221
  break;
2227
2222
  default:
@@ -2232,14 +2227,14 @@ class Dn {
2232
2227
  }
2233
2228
  registerElement() {
2234
2229
  const e = [];
2235
- this.declarationNode.symbol = this.symbolFactory.create(wt, { declaration: this.declarationNode, symbolTable: new we() });
2236
- const { name: n, alias: s } = this.declarationNode, i = j(n);
2230
+ this.declarationNode.symbol = this.symbolFactory.create(yt, { declaration: this.declarationNode, symbolTable: new ye() });
2231
+ const { name: n, alias: s } = this.declarationNode, i = z(n);
2237
2232
  if (i.isOk()) {
2238
- const r = [...i.unwrap()], a = r.pop(), l = et(r, this.publicSymbolTable, this.symbolFactory), p = Oe(a);
2233
+ const r = [...i.unwrap()], a = r.pop(), l = tt(r, this.publicSymbolTable, this.symbolFactory), p = De(a);
2239
2234
  l.has(p) && e.push(new c(o.DUPLICATE_NAME, `Table name '${a}' already exists in schema '${r.join(".") || "public"}'`, n)), l.set(p, this.declarationNode.symbol);
2240
2235
  }
2241
- if (s && ye(s) && !Pn(s.expression.variable.value, i.unwrap_or([]))) {
2242
- const r = X(s).unwrap(), a = Oe(r);
2236
+ if (s && ke(s) && !Pn(s.expression.variable.value, i.unwrap_or([]))) {
2237
+ const r = W(s).unwrap(), a = De(r);
2243
2238
  this.publicSymbolTable.has(a) && e.push(new c(o.DUPLICATE_NAME, `Table name '${r}' already exists`, n)), this.publicSymbolTable.set(a, this.declarationNode.symbol);
2244
2239
  }
2245
2240
  return e;
@@ -2257,14 +2252,14 @@ class Dn {
2257
2252
  if (!n.callee)
2258
2253
  return [];
2259
2254
  const s = [];
2260
- n.args.length === 0 && s.push(new c(o.INVALID_COLUMN, "A column must have a type", n.callee)), B(n.callee) || s.push(new c(o.INVALID_COLUMN_NAME, "A column name must be an identifier or a quoted identifier", n.callee)), n.args[0] && !Rn(n.args[0]) && s.push(new c(o.INVALID_COLUMN_TYPE, "Invalid column type", n.args[0]));
2255
+ n.args.length === 0 && s.push(new c(o.INVALID_COLUMN, "A column must have a type", n.callee)), V(n.callee) || s.push(new c(o.INVALID_COLUMN_NAME, "A column name must be an identifier or a quoted identifier", n.callee)), n.args[0] && !Rn(n.args[0]) && s.push(new c(o.INVALID_COLUMN_TYPE, "Invalid column type", n.args[0]));
2261
2256
  const i = n.args.slice(1);
2262
2257
  return s.push(...this.validateFieldSetting(i)), s.push(...this.registerField(n)), s;
2263
2258
  });
2264
2259
  }
2265
2260
  registerField(e) {
2266
- if (e.callee && B(e.callee)) {
2267
- const n = X(e.callee).unwrap(), s = Qe(n), i = this.symbolFactory.create(an, { declaration: e });
2261
+ if (e.callee && V(e.callee)) {
2262
+ const n = W(e.callee).unwrap(), s = qe(n), i = this.symbolFactory.create(an, { declaration: e });
2268
2263
  e.symbol = i;
2269
2264
  const r = this.declarationNode.symbol.symbolTable;
2270
2265
  if (r.has(s)) {
@@ -2280,15 +2275,15 @@ class Dn {
2280
2275
  }
2281
2276
  // This is needed to support legacy inline settings
2282
2277
  validateFieldSetting(e) {
2283
- if (!e.slice(0, -1).every(me) || !e.slice(-1).every((p) => me(p) || p instanceof P))
2278
+ if (!e.slice(0, -1).every(me) || !e.slice(-1).every((p) => me(p) || p instanceof R))
2284
2279
  return [...e.map((p) => new c(o.INVALID_COLUMN, "These fields must be some inline settings optionally ended with a setting list", p))];
2285
2280
  if (e.length === 0)
2286
2281
  return [];
2287
2282
  let n;
2288
- I.last(e) instanceof P && (n = e.pop());
2289
- const s = M(n), i = s.getErrors(), r = s.getValue();
2283
+ I.last(e) instanceof R && (n = e.pop());
2284
+ const s = C(n), i = s.getErrors(), r = s.getValue();
2290
2285
  for (const p of e) {
2291
- const f = X(p).unwrap_or("").toLowerCase();
2286
+ const f = W(p).unwrap_or("").toLowerCase();
2292
2287
  if (f !== "pk" && f !== "unique") {
2293
2288
  i.push(new c(o.INVALID_SETTINGS, "Inline column settings can only be `pk` or `unique`", p));
2294
2289
  continue;
@@ -2302,7 +2297,7 @@ class Dn {
2302
2297
  switch (p) {
2303
2298
  case "note":
2304
2299
  f.length > 1 && i.push(...f.map((h) => new c(o.DUPLICATE_COLUMN_SETTING, "note can only appear once", h))), f.forEach((h) => {
2305
- W(h.value) || i.push(new c(o.INVALID_COLUMN_SETTING_VALUE, "'note' must be a quoted string", h.value || h.name));
2300
+ Y(h.value) || i.push(new c(o.INVALID_COLUMN_SETTING_VALUE, "'note' must be a quoted string", h.value || h.name));
2306
2301
  });
2307
2302
  break;
2308
2303
  case "ref":
@@ -2367,10 +2362,10 @@ class Dn {
2367
2362
  }
2368
2363
  }
2369
2364
  function Rn(t) {
2370
- if (!(t instanceof J || Ke(t) || t instanceof F || t instanceof he))
2365
+ if (!(t instanceof Z || et(t) || t instanceof M || t instanceof he))
2371
2366
  return !1;
2372
- if (t instanceof J) {
2373
- if (t.callee === void 0 || t.argumentList === void 0 || !t.argumentList.elementList.every((n) => fe(n) || W(n) || me(n)))
2367
+ if (t instanceof Z) {
2368
+ if (t.callee === void 0 || t.argumentList === void 0 || !t.argumentList.elementList.every((n) => fe(n) || Y(n) || me(n)))
2374
2369
  return !1;
2375
2370
  t = t.callee;
2376
2371
  }
@@ -2379,7 +2374,7 @@ function Rn(t) {
2379
2374
  return !1;
2380
2375
  t = t.array;
2381
2376
  }
2382
- const e = j(t).unwrap_or(void 0);
2377
+ const e = z(t).unwrap_or(void 0);
2383
2378
  return e !== void 0 && e.length > 0;
2384
2379
  }
2385
2380
  function Pn(t, e) {
@@ -2407,7 +2402,7 @@ class Un {
2407
2402
  )] : [];
2408
2403
  }
2409
2404
  validateName(e) {
2410
- return e ? ye(e) ? [] : [new c(
2405
+ return e ? ke(e) ? [] : [new c(
2411
2406
  o.INVALID_NAME,
2412
2407
  "A TableGroup name must be a single identifier",
2413
2408
  e
@@ -2426,10 +2421,10 @@ class Un {
2426
2421
  }
2427
2422
  registerElement() {
2428
2423
  const { name: e } = this.declarationNode;
2429
- this.declarationNode.symbol = this.symbolFactory.create(on, { declaration: this.declarationNode, symbolTable: new we() });
2430
- const n = j(e);
2424
+ this.declarationNode.symbol = this.symbolFactory.create(on, { declaration: this.declarationNode, symbolTable: new ye() });
2425
+ const n = z(e);
2431
2426
  if (n.isOk()) {
2432
- const s = n.unwrap(), i = s.pop(), r = et(s, this.publicSymbolTable, this.symbolFactory), a = Je(i);
2427
+ const s = n.unwrap(), i = s.pop(), r = tt(s, this.publicSymbolTable, this.symbolFactory), a = Ze(i);
2433
2428
  if (r.has(a))
2434
2429
  return [new c(o.DUPLICATE_NAME, `TableGroup name '${i}' already exists`, e)];
2435
2430
  r.set(a, this.declarationNode.symbol);
@@ -2437,7 +2432,7 @@ class Un {
2437
2432
  return [];
2438
2433
  }
2439
2434
  validateSettingList(e) {
2440
- const n = M(e), s = n.getErrors(), i = n.getValue();
2435
+ const n = C(e), s = n.getErrors(), i = n.getValue();
2441
2436
  return I.forIn(i, (r, a) => {
2442
2437
  switch (a) {
2443
2438
  case "color":
@@ -2446,7 +2441,7 @@ class Un {
2446
2441
  "'color' can only appear once",
2447
2442
  l
2448
2443
  ))), r.forEach((l) => {
2449
- tt(l.value) || s.push(new c(
2444
+ nt(l.value) || s.push(new c(
2450
2445
  o.INVALID_TABLE_SETTING,
2451
2446
  "'color' must be a color literal",
2452
2447
  l.value || l.name
@@ -2458,7 +2453,7 @@ class Un {
2458
2453
  o.DUPLICATE_TABLE_SETTING,
2459
2454
  "'note' can only appear once",
2460
2455
  l
2461
- ))), r.filter((l) => !W(l.value)).forEach((l) => {
2456
+ ))), r.filter((l) => !Y(l.value)).forEach((l) => {
2462
2457
  s.push(new c(
2463
2458
  o.INVALID_TABLE_SETTING,
2464
2459
  "'note' must be a string literal",
@@ -2494,7 +2489,7 @@ class Un {
2494
2489
  validateFields(e) {
2495
2490
  return e.flatMap((n) => {
2496
2491
  const s = [];
2497
- return n.callee && !j(n.callee).isOk() && s.push(new c(o.INVALID_TABLEGROUP_FIELD, "A TableGroup field must be of the form <table> or <schema>.<table>", n.callee)), this.registerField(n), n.args.length > 0 && s.push(...n.args.map((i) => new c(o.INVALID_TABLEGROUP_FIELD, "A TableGroup field should only have a single Table name", i))), s;
2492
+ return n.callee && !z(n.callee).isOk() && s.push(new c(o.INVALID_TABLEGROUP_FIELD, "A TableGroup field must be of the form <table> or <schema>.<table>", n.callee)), this.registerField(n), n.args.length > 0 && s.push(...n.args.map((i) => new c(o.INVALID_TABLEGROUP_FIELD, "A TableGroup field should only have a single Table name", i))), s;
2498
2493
  });
2499
2494
  }
2500
2495
  validateSubElements(e) {
@@ -2510,8 +2505,8 @@ class Un {
2510
2505
  return s.length > 1 && n.push(...s.map((i) => new c(o.NOTE_REDEFINED, "Duplicate notes are defined", i))), n;
2511
2506
  }
2512
2507
  registerField(e) {
2513
- if (e.callee && B(e.callee)) {
2514
- const n = X(e.callee).unwrap(), s = Ze(n), i = this.symbolFactory.create(ln, { declaration: e });
2508
+ if (e.callee && V(e.callee)) {
2509
+ const n = W(e.callee).unwrap(), s = Ke(n), i = this.symbolFactory.create(ln, { declaration: e });
2515
2510
  e.symbol = i;
2516
2511
  const r = this.declarationNode.symbol.symbolTable;
2517
2512
  if (r.has(s)) {
@@ -2526,7 +2521,7 @@ class Un {
2526
2521
  return [];
2527
2522
  }
2528
2523
  }
2529
- const kt = ["-", "+"];
2524
+ const xt = ["-", "+"];
2530
2525
  function oe(t) {
2531
2526
  switch (t.type.value.toLowerCase()) {
2532
2527
  case b.Enum:
@@ -2547,40 +2542,40 @@ function oe(t) {
2547
2542
  return vn;
2548
2543
  }
2549
2544
  }
2550
- function xt(t) {
2551
- return !!j(t).unwrap_or(!1);
2545
+ function St(t) {
2546
+ return !!z(t).unwrap_or(!1);
2552
2547
  }
2553
2548
  function Mn(t) {
2554
- return ye(t);
2549
+ return ke(t);
2555
2550
  }
2556
- function ye(t) {
2557
- return t instanceof F && t.expression instanceof ee;
2551
+ function ke(t) {
2552
+ return t instanceof M && t.expression instanceof te;
2558
2553
  }
2559
- function et(t, e, n) {
2554
+ function tt(t, e, n) {
2560
2555
  var i;
2561
2556
  t[0] === "public" && (t = t.slice(1));
2562
2557
  let s = e;
2563
2558
  for (const r of t) {
2564
2559
  let a;
2565
- const l = ze(r);
2560
+ const l = Qe(r);
2566
2561
  if (s.has(l)) {
2567
2562
  if (a = (i = s.get(l)) == null ? void 0 : i.symbolTable, !a)
2568
2563
  throw new Error("Expect a symbol table in a schema symbol");
2569
2564
  } else {
2570
- a = new we();
2571
- const p = n.create(vt, { symbolTable: a });
2565
+ a = new ye();
2566
+ const p = n.create(wt, { symbolTable: a });
2572
2567
  s.set(l, p);
2573
2568
  }
2574
2569
  s = a;
2575
2570
  }
2576
2571
  return s;
2577
2572
  }
2578
- function St(t) {
2573
+ function Ot(t) {
2579
2574
  return t === "-" || t === "<>" || t === ">" || t === "<";
2580
2575
  }
2581
- function tt(t) {
2576
+ function nt(t) {
2582
2577
  var n;
2583
- if (!(t instanceof F) || !(t.expression instanceof be) || ((n = t.expression.literal) == null ? void 0 : n.kind) !== u.COLOR_LITERAL)
2578
+ if (!(t instanceof M) || !(t.expression instanceof be) || ((n = t.expression.literal) == null ? void 0 : n.kind) !== u.COLOR_LITERAL)
2584
2579
  return !1;
2585
2580
  const e = t.expression.literal.value;
2586
2581
  if (e.length !== 4 && e.length !== 7 || e[0] !== "#")
@@ -2595,43 +2590,43 @@ function ue(t) {
2595
2590
  }
2596
2591
  function Fn(t) {
2597
2592
  var e;
2598
- return !!(W(t) || fe(t) || me(t) && ["true", "false", "null"].includes(t.expression.variable.value.toLowerCase()) || t instanceof q && kt.includes((e = t.op) == null ? void 0 : e.value) && fe(t.expression) || t instanceof se);
2593
+ return !!(Y(t) || fe(t) || me(t) && ["true", "false", "null"].includes(t.expression.variable.value.toLowerCase()) || t instanceof H && xt.includes((e = t.op) == null ? void 0 : e.value) && fe(t.expression) || t instanceof se);
2599
2594
  }
2600
2595
  function fe(t) {
2601
2596
  var e;
2602
- return t instanceof F && t.expression instanceof be && ((e = t.expression.literal) == null ? void 0 : e.kind) === u.NUMERIC_LITERAL;
2597
+ return t instanceof M && t.expression instanceof be && ((e = t.expression.literal) == null ? void 0 : e.kind) === u.NUMERIC_LITERAL;
2603
2598
  }
2604
2599
  function Bn(t) {
2605
2600
  var n;
2606
- if (!(t instanceof q) || !St((n = t.op) == null ? void 0 : n.value))
2601
+ if (!(t instanceof H) || !Ot((n = t.op) == null ? void 0 : n.value))
2607
2602
  return !1;
2608
- const e = j(t.expression).unwrap_or(void 0);
2603
+ const e = z(t.expression).unwrap_or(void 0);
2609
2604
  return e !== void 0 && e.length > 0;
2610
2605
  }
2611
- function Ot(t) {
2612
- return t instanceof K && t.elementList.every(B);
2606
+ function Dt(t) {
2607
+ return t instanceof ee && t.elementList.every(V);
2613
2608
  }
2614
- function M(t) {
2609
+ function C(t) {
2615
2610
  var s;
2616
2611
  const e = {}, n = [];
2617
2612
  if (!t)
2618
- return new G({});
2613
+ return new X({});
2619
2614
  for (const i of t.elementList) {
2620
2615
  if (!i.name)
2621
2616
  continue;
2622
- if (i.name instanceof F) {
2617
+ if (i.name instanceof M) {
2623
2618
  n.push(new c(o.INVALID_SETTINGS, "A setting name must be a stream of identifiers", i.name));
2624
2619
  continue;
2625
2620
  }
2626
2621
  const r = (s = Te(i.name).unwrap_or(void 0)) == null ? void 0 : s.toLowerCase();
2627
2622
  r && (e[r] === void 0 ? e[r] = [i] : e[r].push(i));
2628
2623
  }
2629
- return new G(e, n);
2624
+ return new X(e, n);
2630
2625
  }
2631
- class dt {
2626
+ class Et {
2632
2627
  constructor(e, n) {
2633
- this.ast = e, this.symbolFactory = n, this.publicSchemaSymbol = this.symbolFactory.create(vt, {
2634
- symbolTable: new we()
2628
+ this.ast = e, this.symbolFactory = n, this.publicSchemaSymbol = this.symbolFactory.create(wt, {
2629
+ symbolTable: new ye()
2635
2630
  }), this.ast.symbol = this.publicSchemaSymbol, this.ast.symbol.declaration = this.ast;
2636
2631
  }
2637
2632
  validate() {
@@ -2646,8 +2641,8 @@ class dt {
2646
2641
  );
2647
2642
  e.push(...r.validate());
2648
2643
  });
2649
- const n = this.ast.body.filter((s) => ve(s).unwrap_or(void 0) === b.Project);
2650
- return n.length > 1 && n.forEach((s) => e.push(new c(o.PROJECT_REDEFINED, "Only one project can exist", s))), new G(this.ast, e);
2644
+ const n = this.ast.body.filter((s) => we(s).unwrap_or(void 0) === b.Project);
2645
+ return n.length > 1 && n.forEach((s) => e.push(new c(o.PROJECT_REDEFINED, "Only one project can exist", s))), new X(this.ast, e);
2651
2646
  }
2652
2647
  }
2653
2648
  class le {
@@ -2660,7 +2655,7 @@ class le {
2660
2655
  bindSettingList(e, n) {
2661
2656
  if (e)
2662
2657
  for (const s of e.elementList) {
2663
- if (s.name instanceof F)
2658
+ if (s.name instanceof M)
2664
2659
  continue;
2665
2660
  const i = Te(s.name).unwrap_or(void 0);
2666
2661
  if (!i)
@@ -2674,12 +2669,12 @@ class le {
2674
2669
  if (!e.body)
2675
2670
  return;
2676
2671
  const { body: n } = e;
2677
- if (n instanceof Z)
2672
+ if (n instanceof K)
2678
2673
  for (const s of n.body)
2679
2674
  if (s instanceof A) {
2680
2675
  if (!s.type)
2681
2676
  continue;
2682
- const i = Dt(s);
2677
+ const i = Rt(s);
2683
2678
  new i(s, this.errors).bind();
2684
2679
  } else
2685
2680
  this.bindSubfield(s);
@@ -2688,7 +2683,7 @@ class le {
2688
2683
  }
2689
2684
  bindSubfield(e) {
2690
2685
  const n = [e.callee, ...e.args], s = I.last(n);
2691
- s instanceof P && (n.pop(), this.bindSettingList(s, this.subfield.settingList));
2686
+ s instanceof R && (n.pop(), this.bindSettingList(s, this.subfield.settingList));
2692
2687
  const { argBinderRules: i } = this.subfield.arg;
2693
2688
  for (let r = 0; r < Math.min(n.length, i.length); r += 1)
2694
2689
  i[r].shouldBind && this.scanAndBind(n[r], i[r]);
@@ -2697,12 +2692,12 @@ class le {
2697
2692
  scanAndBind(e, n) {
2698
2693
  var s, i;
2699
2694
  if (e)
2700
- if (e instanceof F) {
2701
- if (e.expression instanceof ee && ((i = n.keywords) != null && i.includes((s = e.expression.variable) == null ? void 0 : s.value.toLowerCase())))
2695
+ if (e instanceof M) {
2696
+ if (e.expression instanceof te && ((i = n.keywords) != null && i.includes((s = e.expression.variable) == null ? void 0 : s.value.toLowerCase())))
2702
2697
  return;
2703
2698
  this.bindFragments([e], n);
2704
2699
  } else
2705
- e instanceof H ? Ke(e) ? this.bindFragments(pe(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 K && e.elementList.forEach((r) => this.scanAndBind(r, n));
2700
+ e instanceof J ? et(e) ? this.bindFragments(pe(e).unwrap_or([]), n) : (this.scanAndBind(e.leftExpression, n), this.scanAndBind(e.rightExpression, n)) : e instanceof H ? this.scanAndBind(e.expression, n) : e instanceof Me ? this.scanAndBind(e.expression, n) : e instanceof ee && e.elementList.forEach((r) => this.scanAndBind(r, n));
2706
2701
  }
2707
2702
  // Bind the fragments of a member access expression
2708
2703
  // which can be a simple expression like v1.User,
@@ -2710,7 +2705,7 @@ class le {
2710
2705
  bindFragments(e, n) {
2711
2706
  if (e.length === 0)
2712
2707
  return;
2713
- const s = [...n.topSubnamesSymbolKind], { remainingSubnamesSymbolKind: i } = n, r = e.findIndex((h) => !B(h)), l = r !== -1 && Ot(e[r]) ? e[r] : void 0, p = r >= 0 ? s.pop() : void 0, f = e.slice(
2708
+ const s = [...n.topSubnamesSymbolKind], { remainingSubnamesSymbolKind: i } = n, r = e.findIndex((h) => !V(h)), l = r !== -1 && Dt(e[r]) ? e[r] : void 0, p = r >= 0 ? s.pop() : void 0, f = e.slice(
2714
2709
  0,
2715
2710
  r === -1 ? void 0 : r
2716
2711
  );
@@ -2718,16 +2713,16 @@ class le {
2718
2713
  return;
2719
2714
  const E = [];
2720
2715
  for (; s.length && f.length; ) {
2721
- const h = s.pop(), m = f.pop(), g = X(m).unwrap();
2716
+ const h = s.pop(), m = f.pop(), g = W(m).unwrap();
2722
2717
  E.unshift({
2723
- index: Ge(g, h),
2718
+ index: Ce(g, h),
2724
2719
  referrer: m
2725
2720
  });
2726
2721
  }
2727
2722
  for (; f.length; ) {
2728
- const h = f.pop(), m = X(h).unwrap();
2723
+ const h = f.pop(), m = W(h).unwrap();
2729
2724
  E.unshift({
2730
- index: Ge(m, i),
2725
+ index: Ce(m, i),
2731
2726
  referrer: h
2732
2727
  });
2733
2728
  }
@@ -2736,8 +2731,8 @@ class le {
2736
2731
  [
2737
2732
  ...E,
2738
2733
  {
2739
- index: Ge(
2740
- X(h).unwrap(),
2734
+ index: Ce(
2735
+ W(h).unwrap(),
2741
2736
  p
2742
2737
  ),
2743
2738
  referrer: h
@@ -2916,7 +2911,7 @@ class Yn extends le {
2916
2911
  }, this.settingList = {};
2917
2912
  }
2918
2913
  }
2919
- function Dt(t) {
2914
+ function Rt(t) {
2920
2915
  switch (t.type.value.toLowerCase()) {
2921
2916
  case b.Enum:
2922
2917
  return Gn;
@@ -2943,10 +2938,10 @@ class zn {
2943
2938
  resolve() {
2944
2939
  for (const e of this.ast.body)
2945
2940
  if (e.type) {
2946
- const n = Dt(e);
2941
+ const n = Rt(e);
2947
2942
  new n(e, this.errors).bind();
2948
2943
  }
2949
- return new G(this.ast, this.errors);
2944
+ return new X(this.ast, this.errors);
2950
2945
  }
2951
2946
  }
2952
2947
  class Qn {
@@ -2963,15 +2958,15 @@ class qn {
2963
2958
  }
2964
2959
  // Analyzing: Invoking both the validator and binder
2965
2960
  analyze() {
2966
- return new dt(this.ast, this.symbolFactory).validate().chain((n) => new zn(n).resolve());
2961
+ return new Et(this.ast, this.symbolFactory).validate().chain((n) => new zn(n).resolve());
2967
2962
  }
2968
2963
  // For invoking the validator only
2969
2964
  validate() {
2970
- return new dt(this.ast, this.symbolFactory).validate().chain((n) => new G(n, []));
2965
+ return new Et(this.ast, this.symbolFactory).validate().chain((n) => new X(n, []));
2971
2966
  }
2972
2967
  }
2973
- function Et(t, e) {
2974
- const { variables: n, tupleElements: s } = _e(t).unwrap();
2968
+ function Nt(t, e) {
2969
+ const { variables: n, tupleElements: s } = Ae(t).unwrap();
2975
2970
  return s ? n.length === 0 ? {
2976
2971
  schemaName: e.schemaName,
2977
2972
  tableName: e.name,
@@ -2990,7 +2985,7 @@ function Et(t, e) {
2990
2985
  schemaName: n.pop() || null
2991
2986
  };
2992
2987
  }
2993
- function Rt(t) {
2988
+ function Pt(t) {
2994
2989
  switch (t) {
2995
2990
  case "<":
2996
2991
  return ["1", "*"];
@@ -3013,22 +3008,22 @@ function _(t) {
3013
3008
  end: { offset: t.endPos.offset, line: t.endPos.line + 1, column: t.endPos.column + 1 }
3014
3009
  };
3015
3010
  }
3016
- function je(t) {
3011
+ function Ye(t) {
3017
3012
  var n;
3018
3013
  const e = (n = pe(t).unwrap_or(void 0)) == null ? void 0 : n.pop();
3019
- return e instanceof K ? e.elementList.map((s) => s.referee) : [e.referee];
3014
+ return e instanceof ee ? e.elementList.map((s) => s.referee) : [e.referee];
3020
3015
  }
3021
3016
  function Ie(t) {
3022
- const e = j(t).unwrap();
3017
+ const e = z(t).unwrap();
3023
3018
  return {
3024
3019
  name: e.pop(),
3025
3020
  schemaName: e
3026
3021
  };
3027
3022
  }
3028
- function Fe(t) {
3023
+ function Be(t) {
3029
3024
  return t.expression.literal.value;
3030
3025
  }
3031
- function Pt(t, e) {
3026
+ function Ut(t, e) {
3032
3027
  if (Array.isArray(t)) {
3033
3028
  const i = t.map(({ id: a }) => a).sort().join(","), r = e.map(({ id: a }) => a).sort().join(",");
3034
3029
  return i < r ? `${i}-${r}` : `${r}-${i}`;
@@ -3036,7 +3031,7 @@ function Pt(t, e) {
3036
3031
  const n = t.id.toString(), s = e.id.toString();
3037
3032
  return n < s ? `${n}-${s}` : `${s}-${n}`;
3038
3033
  }
3039
- function Ut(t, e) {
3034
+ function Mt(t, e) {
3040
3035
  if (Array.isArray(t)) {
3041
3036
  const i = t.map(({ id: a }) => a).sort(), r = e.map(({ id: a }) => a).sort();
3042
3037
  return I.zip(i, r).every(([a, l]) => a === l);
@@ -3050,7 +3045,7 @@ function ae(t) {
3050
3045
  return n.map((r) => r.slice(i)).join(`
3051
3046
  `);
3052
3047
  }
3053
- class Mt {
3048
+ class Ft {
3054
3049
  constructor(e, n) {
3055
3050
  this.declarationNode = e, this.env = n, this.table = { name: void 0, schemaName: void 0, alias: null, fields: [], token: void 0, indexes: [] }, this.pkColumns = [];
3056
3051
  }
@@ -3080,7 +3075,7 @@ class Mt {
3080
3075
  interpretAlias(e) {
3081
3076
  if (!e)
3082
3077
  return [];
3083
- const n = X(e).unwrap_or(null);
3078
+ const n = W(e).unwrap_or(null);
3084
3079
  return n && (this.env.aliases.push({
3085
3080
  name: n,
3086
3081
  kind: "table",
@@ -3092,11 +3087,11 @@ class Mt {
3092
3087
  }
3093
3088
  interpretSettingList(e) {
3094
3089
  var i, r, a;
3095
- const n = M(e).getValue();
3096
- this.table.headerColor = (i = n.headercolor) != null && i.length ? Fe((a = (r = n.headercolor) == null ? void 0 : r.at(0)) == null ? void 0 : a.value) : void 0;
3090
+ const n = C(e).getValue();
3091
+ this.table.headerColor = (i = n.headercolor) != null && i.length ? Be((a = (r = n.headercolor) == null ? void 0 : r.at(0)) == null ? void 0 : a.value) : void 0;
3097
3092
  const [s] = n.note || [];
3098
3093
  return this.table.note = s && {
3099
- value: C(s == null ? void 0 : s.value).map(ae).unwrap(),
3094
+ value: $(s == null ? void 0 : s.value).map(ae).unwrap(),
3100
3095
  token: _(s)
3101
3096
  }, [];
3102
3097
  }
@@ -3110,7 +3105,7 @@ class Mt {
3110
3105
  switch ((s = n.type) == null ? void 0 : s.value.toLowerCase()) {
3111
3106
  case "note":
3112
3107
  return this.table.note = {
3113
- value: C(n.body instanceof Z ? n.body.body[0].callee : n.body.callee).map(ae).unwrap(),
3108
+ value: $(n.body instanceof K ? n.body.body[0].callee : n.body.callee).map(ae).unwrap(),
3114
3109
  token: _(n)
3115
3110
  }, [];
3116
3111
  case "indexes":
@@ -3123,26 +3118,26 @@ class Mt {
3123
3118
  return e.flatMap((n) => this.interpretColumn(n));
3124
3119
  }
3125
3120
  interpretColumn(e) {
3126
- var a, l, p, f, E, h, m, g, R;
3121
+ var a, l, p, f, E, h, m, g, P;
3127
3122
  const n = [], s = {};
3128
- s.name = X(e.callee).unwrap();
3123
+ s.name = W(e.callee).unwrap();
3129
3124
  const i = Hn(e.args[0]);
3130
3125
  s.type = i.getValue(), n.push(...i.getErrors()), s.token = _(e), s.inline_refs = [];
3131
3126
  const r = e.args.slice(1);
3132
- if (I.last(r) instanceof P) {
3133
- const S = M(r.pop()).getValue();
3127
+ if (I.last(r) instanceof R) {
3128
+ const S = C(r.pop()).getValue();
3134
3129
  s.pk = !!((a = S.pk) != null && a.length) || !!((l = S["primary key"]) != null && l.length), s.increment = !!((p = S.increment) != null && p.length), s.unique = !!((f = S.unique) != null && f.length), s.not_null = (E = S["not null"]) != null && E.length ? !0 : (h = S.null) != null && h.length ? !1 : void 0, s.dbdefault = Jn((g = (m = S.default) == null ? void 0 : m.at(0)) == null ? void 0 : g.value);
3135
- const te = (R = S.note) == null ? void 0 : R.at(0);
3136
- s.note = te && {
3137
- value: C(te.value).map(ae).unwrap(),
3138
- token: _(te)
3130
+ const F = (P = S.note) == null ? void 0 : P.at(0);
3131
+ s.note = F && {
3132
+ value: $(F.value).map(ae).unwrap(),
3133
+ token: _(F)
3139
3134
  };
3140
- const Yt = S.ref || [];
3141
- s.inline_refs = Yt.flatMap((Q) => {
3142
- const [it] = je(Q.value.expression);
3143
- if (Ut(it, e.symbol))
3144
- return n.push(new c(o.SAME_ENDPOINT, "Two endpoints are the same", Q)), [];
3145
- const ke = Q.value.op, ne = j(Q.value.expression).unwrap();
3135
+ const Le = S.ref || [];
3136
+ s.inline_refs = Le.flatMap((B) => {
3137
+ const [rt] = Ye(B.value.expression);
3138
+ if (Mt(rt, e.symbol))
3139
+ return n.push(new c(o.SAME_ENDPOINT, "Two endpoints are the same", B)), [];
3140
+ const xe = B.value.op, ne = z(B.value.expression).unwrap();
3146
3141
  let de;
3147
3142
  if (ne.length === 1) {
3148
3143
  const [ce] = ne;
@@ -3150,43 +3145,43 @@ class Mt {
3150
3145
  schemaName: this.table.schemaName,
3151
3146
  tableName: this.table.name,
3152
3147
  fieldNames: [ce],
3153
- relation: ke.value,
3154
- token: _(Q)
3148
+ relation: xe.value,
3149
+ token: _(B)
3155
3150
  };
3156
3151
  } else if (ne.length === 2) {
3157
- const [ce, Le] = ne;
3152
+ const [ce, ge] = ne;
3158
3153
  de = {
3159
3154
  schemaName: null,
3160
3155
  tableName: ce,
3161
- fieldNames: [Le],
3162
- relation: ke.value,
3163
- token: _(Q)
3156
+ fieldNames: [ge],
3157
+ relation: xe.value,
3158
+ token: _(B)
3164
3159
  };
3165
3160
  } else if (ne.length === 3) {
3166
- const [ce, Le, at] = ne;
3161
+ const [ce, ge, ot] = ne;
3167
3162
  de = {
3168
3163
  schemaName: ce,
3169
- tableName: Le,
3170
- fieldNames: [at],
3171
- relation: ke.value,
3172
- token: _(Q)
3164
+ tableName: ge,
3165
+ fieldNames: [ot],
3166
+ relation: xe.value,
3167
+ token: _(B)
3173
3168
  };
3174
3169
  } else {
3175
- n.push(new c(o.UNSUPPORTED, "Nested schema is not supported", Q));
3176
- const ce = ne.pop(), Le = ne.pop();
3170
+ n.push(new c(o.UNSUPPORTED, "Nested schema is not supported", B));
3171
+ const ce = ne.pop(), ge = ne.pop();
3177
3172
  de = {
3178
3173
  schemaName: ne.join("."),
3179
- tableName: Le,
3174
+ tableName: ge,
3180
3175
  fieldNames: [ce],
3181
- relation: ke.value,
3182
- token: _(Q)
3176
+ relation: xe.value,
3177
+ token: _(B)
3183
3178
  };
3184
3179
  }
3185
- const rt = this.registerInlineRefToEnv(e, it, de, Q);
3186
- return n.push(...rt), rt.length === 0 ? de : [];
3180
+ const at = this.registerInlineRefToEnv(e, rt, de, B);
3181
+ return n.push(...at), at.length === 0 ? de : [];
3187
3182
  });
3188
3183
  }
3189
- return s.pk || (s.pk = r.some((S) => Y(S).unwrap().toLowerCase() === "pk")), s.unique || (s.unique = r.some((S) => Y(S).unwrap().toLowerCase() === "unique")), this.table.fields.push(s), s.pk && this.pkColumns.push(s), n;
3184
+ return s.pk || (s.pk = r.some((S) => Q(S).unwrap().toLowerCase() === "pk")), s.unique || (s.unique = r.some((S) => Q(S).unwrap().toLowerCase() === "unique")), this.table.fields.push(s), s.pk && this.pkColumns.push(s), n;
3190
3185
  }
3191
3186
  interpretIndexes(e) {
3192
3187
  return this.table.indexes.push(...e.body.body.map((n) => {
@@ -3194,47 +3189,47 @@ class Mt {
3194
3189
  const s = { columns: [] }, i = n;
3195
3190
  s.token = _(i);
3196
3191
  const r = [i.callee, ...i.args];
3197
- if (I.last(r) instanceof P) {
3198
- const g = M(r.pop()).getValue();
3199
- s.pk = !!((a = g.pk) != null && a.length), s.unique = !!((l = g.unique) != null && l.length), s.name = C((f = (p = g.name) == null ? void 0 : p.at(0)) == null ? void 0 : f.value).unwrap_or(void 0);
3200
- const R = (E = g.note) == null ? void 0 : E.at(0);
3201
- s.note = R && {
3202
- value: C(R.value).unwrap(),
3203
- token: _(R)
3204
- }, s.type = Y((m = (h = g.type) == null ? void 0 : h.at(0)) == null ? void 0 : m.value).unwrap_or(void 0);
3192
+ if (I.last(r) instanceof R) {
3193
+ const g = C(r.pop()).getValue();
3194
+ s.pk = !!((a = g.pk) != null && a.length), s.unique = !!((l = g.unique) != null && l.length), s.name = $((f = (p = g.name) == null ? void 0 : p.at(0)) == null ? void 0 : f.value).unwrap_or(void 0);
3195
+ const P = (E = g.note) == null ? void 0 : E.at(0);
3196
+ s.note = P && {
3197
+ value: $(P.value).unwrap(),
3198
+ token: _(P)
3199
+ }, s.type = Q((m = (h = g.type) == null ? void 0 : h.at(0)) == null ? void 0 : m.value).unwrap_or(void 0);
3205
3200
  }
3206
3201
  return r.flatMap((g) => {
3207
- if (!(g instanceof J))
3202
+ if (!(g instanceof Z))
3208
3203
  return g;
3209
- const R = [];
3210
- for (; g instanceof J; )
3211
- R.push(g.argumentList), g = g.callee;
3212
- return R.push(g), R;
3204
+ const P = [];
3205
+ for (; g instanceof Z; )
3206
+ P.push(g.argumentList), g = g.callee;
3207
+ return P.push(g), P;
3213
3208
  }).forEach((g) => {
3214
- const { functional: R, nonFunctional: S } = We(g).unwrap();
3209
+ const { functional: P, nonFunctional: S } = je(g).unwrap();
3215
3210
  s.columns.push(
3216
- ...R.map((te) => ({
3217
- value: te.value.value,
3211
+ ...P.map((F) => ({
3212
+ value: F.value.value,
3218
3213
  type: "expression",
3219
- token: _(te)
3214
+ token: _(F)
3220
3215
  })),
3221
- ...S.map((te) => ({
3222
- value: X(te).unwrap(),
3216
+ ...S.map((F) => ({
3217
+ value: W(F).unwrap(),
3223
3218
  type: "column",
3224
- token: _(te)
3219
+ token: _(F)
3225
3220
  }))
3226
3221
  );
3227
3222
  }), s;
3228
3223
  })), [];
3229
3224
  }
3230
3225
  registerInlineRefToEnv(e, n, s, i) {
3231
- const r = Pt(e.symbol, n);
3226
+ const r = Ut(e.symbol, n);
3232
3227
  if (this.env.refIds[r])
3233
3228
  return [
3234
3229
  new c(o.CIRCULAR_REF, "References with same endpoints exist", i),
3235
3230
  new c(o.CIRCULAR_REF, "References with same endpoints exist", this.env.refIds[r])
3236
3231
  ];
3237
- const a = Rt(s.relation);
3232
+ const a = Pt(s.relation);
3238
3233
  return this.env.refIds[r] = i, this.env.ref.set(i, {
3239
3234
  name: null,
3240
3235
  schemaName: null,
@@ -3247,7 +3242,7 @@ class Mt {
3247
3242
  {
3248
3243
  schemaName: this.table.schemaName,
3249
3244
  tableName: this.table.name,
3250
- fieldNames: [Y(e.callee).unwrap()],
3245
+ fieldNames: [Q(e.callee).unwrap()],
3251
3246
  token: _(e),
3252
3247
  relation: a[0]
3253
3248
  }
@@ -3257,19 +3252,19 @@ class Mt {
3257
3252
  }
3258
3253
  function Hn(t) {
3259
3254
  let e = null;
3260
- t instanceof J && (e = t.argumentList.elementList.map((r) => fe(r) ? r.expression.literal.value : W(r) ? C(r).unwrap() : Y(r).unwrap()).join(","), t = t.callee);
3255
+ t instanceof Z && (e = t.argumentList.elementList.map((r) => fe(r) ? r.expression.literal.value : Y(r) ? $(r).unwrap() : Q(r).unwrap()).join(","), t = t.callee);
3261
3256
  let n = "";
3262
3257
  for (; t instanceof he; )
3263
3258
  n = `[${t.indexer.elementList.map((r) => r.name.expression.literal.value).join(",")}]${n}`, t = t.array;
3264
3259
  const { name: s, schemaName: i } = Ie(t);
3265
- return i.length > 1 ? new G(
3260
+ return i.length > 1 ? new X(
3266
3261
  {
3267
3262
  schemaName: i.length === 0 ? null : i[0],
3268
3263
  type_name: `${s}${n}${e ? `(${e})` : ""}`,
3269
3264
  args: e
3270
3265
  },
3271
3266
  [new c(o.UNSUPPORTED, "Nested schema is not supported", t)]
3272
- ) : new G({
3267
+ ) : new X({
3273
3268
  schemaName: i.length === 0 ? null : i[0],
3274
3269
  type_name: `${s}${n}${e ? `(${e})` : ""}`,
3275
3270
  args: e
@@ -3278,9 +3273,9 @@ function Hn(t) {
3278
3273
  function Jn(t) {
3279
3274
  var e, n, s;
3280
3275
  if (t) {
3281
- if (W(t))
3276
+ if (Y(t))
3282
3277
  return {
3283
- value: C(t).unwrap(),
3278
+ value: $(t).unwrap(),
3284
3279
  type: "string"
3285
3280
  };
3286
3281
  if (fe(t))
@@ -3293,7 +3288,7 @@ function Jn(t) {
3293
3288
  value: t.expression.variable.value.toLowerCase(),
3294
3289
  type: "boolean"
3295
3290
  };
3296
- if (t instanceof q && kt.includes((e = t.op) == null ? void 0 : e.value) && fe(t.expression)) {
3291
+ if (t instanceof H && xt.includes((e = t.op) == null ? void 0 : e.value) && fe(t.expression)) {
3297
3292
  const i = Number.parseFloat(t.expression.expression.literal.value);
3298
3293
  return {
3299
3294
  value: ((n = t.op) == null ? void 0 : n.value) === "-" ? 0 - i : i,
@@ -3325,8 +3320,8 @@ class Zn {
3325
3320
  }
3326
3321
  interpretSettingList(e) {
3327
3322
  var s, i, r;
3328
- const n = M(e).getValue();
3329
- return this.note.headerColor = (s = n.headercolor) != null && s.length ? Fe((r = (i = n.headercolor) == null ? void 0 : i.at(0)) == null ? void 0 : r.value) : void 0, [];
3323
+ const n = C(e).getValue();
3324
+ return this.note.headerColor = (s = n.headercolor) != null && s.length ? Be((r = (i = n.headercolor) == null ? void 0 : i.at(0)) == null ? void 0 : r.value) : void 0, [];
3330
3325
  }
3331
3326
  interpretBody(e) {
3332
3327
  const [n, s] = I.partition(e.body, (i) => i instanceof v);
@@ -3339,62 +3334,56 @@ class Zn {
3339
3334
  return this.note.content = ae(n), [];
3340
3335
  }
3341
3336
  }
3342
- class Ft {
3337
+ class Bt {
3343
3338
  constructor(e, n) {
3344
3339
  this.declarationNode = e, this.env = n, this.container = this.declarationNode.parent instanceof A ? this.env.tables.get(this.declarationNode.parent) : void 0, this.ref = {};
3345
3340
  }
3346
3341
  interpret() {
3347
3342
  return this.ref.token = _(this.declarationNode), this.env.ref.set(this.declarationNode, this.ref), [
3348
3343
  ...this.interpretName(this.declarationNode.name),
3349
- ...this.interpretSettingList(this.declarationNode.attributeList),
3350
3344
  ...this.interpretBody(this.declarationNode.body)
3351
3345
  ];
3352
3346
  }
3353
3347
  interpretName(e) {
3354
- const n = [], s = j(this.declarationNode.name).unwrap_or([]);
3348
+ const n = [], s = z(this.declarationNode.name).unwrap_or([]);
3355
3349
  return this.ref.name = s.pop() || null, s.length > 1 && n.push(new c(o.UNSUPPORTED, "Nested schema is not supported", this.declarationNode.name)), this.ref.schemaName = s.join(".") || null, n;
3356
3350
  }
3357
- interpretSettingList(e) {
3358
- var s, i, r;
3359
- const n = M(e).getValue();
3360
- return this.ref.color = (s = n.color) != null && s.length ? Fe((r = (i = n.color) == null ? void 0 : i.at(0)) == null ? void 0 : r.value) : void 0, [];
3361
- }
3362
3351
  interpretBody(e) {
3363
3352
  return e instanceof v ? this.interpretField(e) : this.interpretField(e.body[0]);
3364
3353
  }
3365
3354
  interpretField(e) {
3366
- var f, E, h, m;
3367
- const n = e.callee.op.value, { leftExpression: s, rightExpression: i } = e.callee, r = je(s), a = je(i);
3368
- if (Ut(r, a))
3355
+ var f, E, h, m, g, P, S;
3356
+ const n = e.callee.op.value, { leftExpression: s, rightExpression: i } = e.callee, r = Ye(s), a = Ye(i);
3357
+ if (Mt(r, a))
3369
3358
  return [new c(o.SAME_ENDPOINT, "Two endpoints are the same", e)];
3370
- const l = Pt(r, a);
3359
+ const l = Ut(r, a);
3371
3360
  if (this.env.refIds[l])
3372
3361
  return [
3373
3362
  new c(o.CIRCULAR_REF, "References with same endpoints exist", this.declarationNode),
3374
3363
  new c(o.CIRCULAR_REF, "References with same endpoints exist", this.env.refIds[l])
3375
3364
  ];
3376
3365
  if (e.args[0]) {
3377
- const g = M(e.args[0]).getValue(), R = (E = (f = g.delete) == null ? void 0 : f.at(0)) == null ? void 0 : E.value;
3378
- this.ref.onDelete = R instanceof z ? Te(R).unwrap_or(void 0) : Y(R).unwrap_or(void 0);
3379
- const S = (m = (h = g.update) == null ? void 0 : h.at(0)) == null ? void 0 : m.value;
3380
- this.ref.onUpdate = S instanceof z ? Te(S).unwrap_or(void 0) : Y(S).unwrap_or(void 0);
3366
+ const F = C(e.args[0]).getValue(), Le = (E = (f = F.delete) == null ? void 0 : f.at(0)) == null ? void 0 : E.value;
3367
+ this.ref.onDelete = Le instanceof q ? Te(Le).unwrap_or(void 0) : Q(Le).unwrap_or(void 0);
3368
+ const B = (m = (h = F.update) == null ? void 0 : h.at(0)) == null ? void 0 : m.value;
3369
+ this.ref.onUpdate = B instanceof q ? Te(B).unwrap_or(void 0) : Q(B).unwrap_or(void 0), this.ref.color = (g = F.color) != null && g.length ? Be((S = (P = F.color) == null ? void 0 : P.at(0)) == null ? void 0 : S.value) : void 0;
3381
3370
  }
3382
- const p = Rt(n);
3371
+ const p = Pt(n);
3383
3372
  return this.ref.endpoints = [
3384
3373
  {
3385
- ...Et(s, this.container),
3374
+ ...Nt(s, this.container),
3386
3375
  relation: p[0],
3387
3376
  token: _(s)
3388
3377
  },
3389
3378
  {
3390
- ...Et(i, this.container),
3379
+ ...Nt(i, this.container),
3391
3380
  relation: p[1],
3392
3381
  token: _(i)
3393
3382
  }
3394
3383
  ], this.env.refIds[l] = this.declarationNode, [];
3395
3384
  }
3396
3385
  }
3397
- class Bt {
3386
+ class Vt {
3398
3387
  constructor(e, n) {
3399
3388
  this.declarationNode = e, this.env = n, this.tableGroup = { tables: [] };
3400
3389
  }
@@ -3423,8 +3412,8 @@ class Bt {
3423
3412
  switch ((s = n.type) == null ? void 0 : s.value.toLowerCase()) {
3424
3413
  case "note":
3425
3414
  this.tableGroup.note = {
3426
- value: C(
3427
- n.body instanceof Z ? n.body.body[0].callee : n.body.callee
3415
+ value: $(
3416
+ n.body instanceof K ? n.body.body[0].callee : n.body.callee
3428
3417
  ).map(ae).unwrap(),
3429
3418
  token: _(n)
3430
3419
  };
@@ -3436,7 +3425,7 @@ class Bt {
3436
3425
  interpretFields(e) {
3437
3426
  const n = [];
3438
3427
  return this.tableGroup.tables = e.map((s) => {
3439
- const i = j(s.callee).unwrap();
3428
+ const i = z(s.callee).unwrap();
3440
3429
  i.length > 2 && n.push(new c(o.UNSUPPORTED, "Nested schema is not supported", s));
3441
3430
  const r = pe(s.callee).unwrap().pop().referee.id;
3442
3431
  if (this.env.groupOfTable[r]) {
@@ -3452,16 +3441,16 @@ class Bt {
3452
3441
  }
3453
3442
  interpretSettingList(e) {
3454
3443
  var i, r, a;
3455
- const n = M(e).getValue();
3456
- this.tableGroup.color = (i = n.color) != null && i.length ? Fe((a = (r = n.color) == null ? void 0 : r.at(0)) == null ? void 0 : a.value) : void 0;
3444
+ const n = C(e).getValue();
3445
+ this.tableGroup.color = (i = n.color) != null && i.length ? Be((a = (r = n.color) == null ? void 0 : r.at(0)) == null ? void 0 : a.value) : void 0;
3457
3446
  const [s] = n.note || [];
3458
3447
  return this.tableGroup.note = s && {
3459
- value: C(s == null ? void 0 : s.value).map(ae).unwrap(),
3448
+ value: $(s == null ? void 0 : s.value).map(ae).unwrap(),
3460
3449
  token: _(s)
3461
3450
  }, [];
3462
3451
  }
3463
3452
  }
3464
- class Vt {
3453
+ class Gt {
3465
3454
  constructor(e, n) {
3466
3455
  this.declarationNode = e, this.env = n, this.enum = { values: [] };
3467
3456
  }
@@ -3476,10 +3465,10 @@ class Vt {
3476
3465
  return e.body.flatMap((n) => {
3477
3466
  var l;
3478
3467
  const s = n, i = {};
3479
- i.token = _(s), i.name = Y(s.callee).unwrap();
3480
- const a = (l = M(s.args[0]).getValue().note) == null ? void 0 : l.at(0);
3468
+ i.token = _(s), i.name = Q(s.callee).unwrap();
3469
+ const a = (l = C(s.args[0]).getValue().note) == null ? void 0 : l.at(0);
3481
3470
  return i.note = a && {
3482
- value: C(a.value).map(ae).unwrap(),
3471
+ value: $(a.value).map(ae).unwrap(),
3483
3472
  token: _(a)
3484
3473
  }, this.enum.values.push(i), [];
3485
3474
  });
@@ -3504,28 +3493,28 @@ class Kn {
3504
3493
  const s = n;
3505
3494
  switch ((i = s.type) == null ? void 0 : i.value.toLowerCase()) {
3506
3495
  case "table": {
3507
- const r = new Mt(s, this.env).interpret();
3496
+ const r = new Ft(s, this.env).interpret();
3508
3497
  return this.project.tables.push(this.env.tables.get(s)), r;
3509
3498
  }
3510
3499
  case "ref": {
3511
- const r = new Ft(s, this.env).interpret();
3500
+ const r = new Bt(s, this.env).interpret();
3512
3501
  return this.project.refs.push(this.env.ref.get(s)), r;
3513
3502
  }
3514
3503
  case "tablegroup": {
3515
- const r = new Bt(s, this.env).interpret();
3504
+ const r = new Vt(s, this.env).interpret();
3516
3505
  return this.project.tableGroups.push(this.env.tableGroups.get(s)), r;
3517
3506
  }
3518
3507
  case "enum": {
3519
- const r = new Vt(s, this.env).interpret();
3508
+ const r = new Gt(s, this.env).interpret();
3520
3509
  return this.project.enums.push(this.env.enums.get(s)), r;
3521
3510
  }
3522
3511
  case "note":
3523
3512
  return this.project.note = {
3524
- value: C(s.body instanceof Z ? s.body.body[0].callee : s.body.callee).map(ae).unwrap(),
3513
+ value: $(s.body instanceof K ? s.body.body[0].callee : s.body.callee).map(ae).unwrap(),
3525
3514
  token: _(s)
3526
3515
  }, [];
3527
3516
  default:
3528
- return this.project[s.type.value.toLowerCase()] = C(s.body.callee).unwrap(), [];
3517
+ return this.project[s.type.value.toLowerCase()] = $(s.body.callee).unwrap(), [];
3529
3518
  }
3530
3519
  });
3531
3520
  }
@@ -3547,24 +3536,24 @@ class es {
3547
3536
  }
3548
3537
  interpret() {
3549
3538
  const e = this.ast.body.flatMap((n) => {
3550
- switch (ve(n).unwrap_or(void 0)) {
3539
+ switch (we(n).unwrap_or(void 0)) {
3551
3540
  case b.Table:
3552
- return new Mt(n, this.env).interpret();
3541
+ return new Ft(n, this.env).interpret();
3553
3542
  case b.Note:
3554
3543
  return new Zn(n, this.env).interpret();
3555
3544
  case b.Ref:
3556
- return new Ft(n, this.env).interpret();
3557
- case b.TableGroup:
3558
3545
  return new Bt(n, this.env).interpret();
3559
- case b.Enum:
3546
+ case b.TableGroup:
3560
3547
  return new Vt(n, this.env).interpret();
3548
+ case b.Enum:
3549
+ return new Gt(n, this.env).interpret();
3561
3550
  case b.Project:
3562
3551
  return new Kn(n, this.env).interpret();
3563
3552
  default:
3564
3553
  return [];
3565
3554
  }
3566
3555
  });
3567
- return new G(ts(this.env), e);
3556
+ return new X(ts(this.env), e);
3568
3557
  }
3569
3558
  }
3570
3559
  function ts(t) {
@@ -3580,7 +3569,7 @@ function ts(t) {
3580
3569
  };
3581
3570
  }
3582
3571
  var L = /* @__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))(L || {}), w = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.KeepWhitespace = 1] = "KeepWhitespace", t[t.InsertAsSnippet = 4] = "InsertAsSnippet", t))(w || {});
3583
- function Ae(t) {
3572
+ function ve(t) {
3584
3573
  switch (t) {
3585
3574
  case T.Schema:
3586
3575
  return L.Module;
@@ -3600,8 +3589,8 @@ function Ae(t) {
3600
3589
  return L.Text;
3601
3590
  }
3602
3591
  }
3603
- function Re(t, e) {
3604
- if (!t || $e(t))
3592
+ function Pe(t, e) {
3593
+ if (!t || We(t))
3605
3594
  return !1;
3606
3595
  for (const n of t.trailingTrivia) {
3607
3596
  if (n.start > e)
@@ -3616,7 +3605,7 @@ function D() {
3616
3605
  suggestions: []
3617
3606
  };
3618
3607
  }
3619
- function Pe(t) {
3608
+ function Ue(t) {
3620
3609
  return {
3621
3610
  ...t,
3622
3611
  suggestions: t.suggestions.map((e) => ({
@@ -3625,65 +3614,65 @@ function Pe(t) {
3625
3614
  }))
3626
3615
  };
3627
3616
  }
3628
- function Be(t) {
3617
+ function Ve(t) {
3629
3618
  return {
3630
3619
  ...t,
3631
3620
  suggestions: t.suggestions.map((e) => ({
3632
3621
  ...e,
3633
- insertText: e.insertText.split("").every(Me) ? e.insertText : `"${e.insertText}"`
3622
+ insertText: e.insertText.split("").every(Fe) ? e.insertText : `"${e.insertText}"`
3634
3623
  }))
3635
3624
  };
3636
3625
  }
3637
- function nt(t, e) {
3626
+ function st(t, e) {
3638
3627
  return t.getOffsetAt(e);
3639
3628
  }
3640
- class Gt {
3629
+ class Ct {
3641
3630
  constructor(e, n = []) {
3642
3631
  this.compiler = e, this.triggerCharacters = n;
3643
3632
  }
3644
3633
  provideCompletionItems(e, n) {
3645
3634
  var E, h;
3646
- const s = nt(e, n), i = this.compiler.token.flatStream(), { token: r, index: a } = this.compiler.container.token(s), l = a === void 0 ? i[0] : i[a + 1];
3635
+ const s = st(e, n), i = this.compiler.token.flatStream(), { token: r, index: a } = this.compiler.container.token(s), l = a === void 0 ? i[0] : i[a + 1];
3647
3636
  if ([
3648
3637
  ...(r == null ? void 0 : r.trailingTrivia) || [],
3649
3638
  ...(r == null ? void 0 : r.leadingTrivia) || [],
3650
3639
  ...(l == null ? void 0 : l.leadingTrivia) || []
3651
- ].find((m) => Ht(m) && ge(s, m)))
3640
+ ].find((m) => Ht(m) && _e(s, m)))
3652
3641
  return D();
3653
3642
  if (a === void 0)
3654
- return It();
3655
- if ([u.STRING_LITERAL, u.QUOTED_STRING].includes(r.kind) && ge(s, r))
3643
+ return Lt();
3644
+ if ([u.STRING_LITERAL, u.QUOTED_STRING].includes(r.kind) && _e(s, r))
3656
3645
  return D();
3657
3646
  const p = this.compiler.container.element(s);
3658
3647
  if (this.compiler.container.scopeKind(s) === O.TOPLEVEL || p instanceof A && p.type && p.type.start <= s && p.type.end >= s)
3659
- return It();
3648
+ return Lt();
3660
3649
  const f = [...this.compiler.container.stack(s)].reverse();
3661
3650
  for (const m of f)
3662
- if (m instanceof q)
3651
+ if (m instanceof H)
3663
3652
  switch ((E = m.op) == null ? void 0 : E.value) {
3664
3653
  case ">":
3665
3654
  case "<":
3666
3655
  case "<>":
3667
3656
  case "-":
3668
- return Nt(
3657
+ return mt(
3669
3658
  this.compiler,
3670
3659
  s,
3671
3660
  m
3672
3661
  );
3673
3662
  }
3674
- else if (m instanceof H)
3663
+ else if (m instanceof J)
3675
3664
  switch ((h = m.op) == null ? void 0 : h.value) {
3676
3665
  case ">":
3677
3666
  case "<":
3678
3667
  case "<>":
3679
3668
  case "-":
3680
- return Nt(
3669
+ return mt(
3681
3670
  this.compiler,
3682
3671
  s,
3683
3672
  m
3684
3673
  );
3685
3674
  case ".":
3686
- return Ct(
3675
+ return Xt(
3687
3676
  this.compiler,
3688
3677
  s,
3689
3678
  m
@@ -3691,32 +3680,32 @@ class Gt {
3691
3680
  }
3692
3681
  else {
3693
3682
  if (m instanceof ie)
3694
- return mt(this.compiler, s, m);
3695
- if (m instanceof P)
3696
- return mt(this.compiler, s, m);
3697
- if (m instanceof K)
3683
+ return Tt(this.compiler, s, m);
3684
+ if (m instanceof R)
3685
+ return Tt(this.compiler, s, m);
3686
+ if (m instanceof ee)
3698
3687
  return ns(this.compiler, s);
3699
3688
  if (m instanceof v)
3700
- return bt(this.compiler, s, m);
3701
- if (m instanceof A && (m.bodyColon && s >= m.bodyColon.end || m.body && ge(s, m.body)))
3702
- return bt(this.compiler, s, void 0);
3689
+ return It(this.compiler, s, m);
3690
+ if (m instanceof A && (m.bodyColon && s >= m.bodyColon.end || m.body && _e(s, m.body)))
3691
+ return It(this.compiler, s, void 0);
3703
3692
  }
3704
3693
  return D();
3705
3694
  }
3706
3695
  }
3707
- function Nt(t, e, n) {
3696
+ function mt(t, e, n) {
3708
3697
  const s = t.container.scopeKind(e);
3709
3698
  if ([O.REF, O.TABLE].includes(s)) {
3710
- const i = Ve(t, e, t.container.element(e), [
3699
+ const i = Ge(t, e, t.container.element(e), [
3711
3700
  T.Table,
3712
3701
  T.Schema,
3713
3702
  T.Column
3714
3703
  ]);
3715
- return Re(n.op, e) ? Pe(i) : i;
3704
+ return Pe(n.op, e) ? Ue(i) : i;
3716
3705
  }
3717
3706
  return D();
3718
3707
  }
3719
- function Ve(t, e, n, s) {
3708
+ function Ge(t, e, n, s) {
3720
3709
  var a;
3721
3710
  if (n === void 0)
3722
3711
  return D();
@@ -3730,61 +3719,61 @@ function Ve(t, e, n, s) {
3730
3719
  label: p,
3731
3720
  insertText: p,
3732
3721
  insertTextRules: w.KeepWhitespace,
3733
- kind: Ae(f),
3734
- sortText: Ae(f).toString().padStart(2, "0"),
3722
+ kind: ve(f),
3723
+ sortText: ve(f).toString().padStart(2, "0"),
3735
3724
  range: void 0
3736
3725
  }))
3737
3726
  );
3738
3727
  }
3739
3728
  i = i instanceof A ? i.parent : void 0;
3740
3729
  }
3741
- return Be(r);
3730
+ return Ve(r);
3742
3731
  }
3743
3732
  function ns(t, e) {
3744
3733
  var s;
3745
3734
  switch (t.container.scopeKind(e)) {
3746
3735
  case O.INDEXES:
3747
- return $t(t, e);
3736
+ return Wt(t, e);
3748
3737
  case O.REF:
3749
3738
  {
3750
3739
  const i = [...t.container.stack(e)];
3751
3740
  for (; i.length > 0; ) {
3752
3741
  const r = i.pop();
3753
- if (r instanceof H && ((s = r.op) == null ? void 0 : s.value) === ".")
3754
- return Ct(
3742
+ if (r instanceof J && ((s = r.op) == null ? void 0 : s.value) === ".")
3743
+ return Xt(
3755
3744
  t,
3756
3745
  e,
3757
3746
  r
3758
3747
  );
3759
3748
  }
3760
3749
  }
3761
- return Xt(t, e);
3750
+ return $t(t, e);
3762
3751
  }
3763
3752
  return D();
3764
3753
  }
3765
- function mt(t, e, n) {
3754
+ function Tt(t, e, n) {
3766
3755
  const { token: s } = t.container.token(e);
3767
3756
  if ([u.COMMA, u.LBRACKET].includes(s == null ? void 0 : s.kind)) {
3768
- const i = Tt(t, e);
3769
- return (s == null ? void 0 : s.kind) === u.COMMA && Re(s, e) ? Pe(i) : i;
3757
+ const i = bt(t, e);
3758
+ return (s == null ? void 0 : s.kind) === u.COMMA && Pe(s, e) ? Ue(i) : i;
3770
3759
  }
3771
3760
  if (n.name && n.name.start <= e && n.name.end >= e)
3772
- return Tt(t, e);
3773
- if (n.name instanceof z) {
3761
+ return bt(t, e);
3762
+ if (n.name instanceof q) {
3774
3763
  const i = ss(
3775
3764
  t,
3776
3765
  e,
3777
3766
  Te(n.name).unwrap_or("")
3778
3767
  );
3779
- return (s == null ? void 0 : s.kind) === u.COLON && Re(s, e) ? Pe(i) : i;
3768
+ return (s == null ? void 0 : s.kind) === u.COLON && Pe(s, e) ? Ue(i) : i;
3780
3769
  }
3781
3770
  return D();
3782
3771
  }
3783
- function Tt(t, e) {
3772
+ function bt(t, e) {
3784
3773
  const n = t.container.element(e), s = t.container.scopeKind(e);
3785
- if (n instanceof $)
3774
+ if (n instanceof j)
3786
3775
  return D();
3787
- if (n.body && !ge(e, n.body))
3776
+ if (n.body && !_e(e, n.body))
3788
3777
  switch (s) {
3789
3778
  case O.TABLE:
3790
3779
  return {
@@ -3906,21 +3895,21 @@ function ss(t, e, n) {
3906
3895
  }
3907
3896
  return D();
3908
3897
  }
3909
- function Ct(t, e, n) {
3898
+ function Xt(t, e, n) {
3910
3899
  const s = pe(n).unwrap_or([]);
3911
- if (s.pop(), s.some((r) => !B(r)))
3900
+ if (s.pop(), s.some((r) => !V(r)))
3912
3901
  return D();
3913
- const i = s.map((r) => Y(r).unwrap());
3914
- return Be({
3902
+ const i = s.map((r) => Q(r).unwrap());
3903
+ return Ve({
3915
3904
  suggestions: t.symbol.ofName({ nameStack: i, owner: t.container.element(e) }).flatMap(({ symbol: r }) => t.symbol.members(r)).map(({ kind: r, name: a }) => ({
3916
3905
  label: a,
3917
3906
  insertText: a,
3918
- kind: Ae(r),
3907
+ kind: ve(r),
3919
3908
  range: void 0
3920
3909
  }))
3921
3910
  });
3922
3911
  }
3923
- function bt(t, e, n) {
3912
+ function It(t, e, n) {
3924
3913
  var i;
3925
3914
  switch (t.container.scopeKind(e)) {
3926
3915
  case O.TABLE:
@@ -3932,8 +3921,8 @@ function bt(t, e, n) {
3932
3921
  case O.ENUM:
3933
3922
  return is(t, e, n);
3934
3923
  case O.REF: {
3935
- const r = Xt(t, e);
3936
- return ((i = t.container.token(e).token) == null ? void 0 : i.kind) === u.COLON && Re(t.container.token(e).token, e) ? Pe(r) : r;
3924
+ const r = $t(t, e);
3925
+ return ((i = t.container.token(e).token) == null ? void 0 : i.kind) === u.COLON && Pe(t.container.token(e).token, e) ? Ue(r) : r;
3937
3926
  }
3938
3927
  case O.TABLEGROUP:
3939
3928
  return os(t);
@@ -3941,7 +3930,7 @@ function bt(t, e, n) {
3941
3930
  return D();
3942
3931
  }
3943
3932
  }
3944
- function It() {
3933
+ function Lt() {
3945
3934
  return {
3946
3935
  suggestions: ["Table", "TableGroup", "Enum", "Project", "Ref"].map((t) => ({
3947
3936
  label: t,
@@ -3953,7 +3942,7 @@ function It() {
3953
3942
  };
3954
3943
  }
3955
3944
  function is(t, e, n) {
3956
- return n != null && n.callee && st(e, n) === 1 ? Ve(t, e, t.container.element(e), [
3945
+ return n != null && n.callee && it(e, n) === 1 ? Ge(t, e, t.container.element(e), [
3957
3946
  T.Schema,
3958
3947
  T.Table,
3959
3948
  T.Column
@@ -3970,7 +3959,7 @@ function rs(t, e, n) {
3970
3959
  range: void 0
3971
3960
  }))
3972
3961
  };
3973
- const s = st(e, n);
3962
+ const s = it(e, n);
3974
3963
  return s === 0 ? {
3975
3964
  suggestions: ["Note", "indexes"].map((i) => ({
3976
3965
  label: i,
@@ -3982,7 +3971,7 @@ function rs(t, e, n) {
3982
3971
  } : s === 1 ? cs(t, e) : D();
3983
3972
  }
3984
3973
  function as(t, e, n) {
3985
- return n != null && n.callee ? st(e, n) === 0 ? {
3974
+ return n != null && n.callee ? it(e, n) === 0 ? {
3986
3975
  suggestions: ["Table", "TableGroup", "Enum", "Note", "Ref"].map((i) => ({
3987
3976
  label: i,
3988
3977
  insertText: i,
@@ -4000,8 +3989,8 @@ function as(t, e, n) {
4000
3989
  }))
4001
3990
  };
4002
3991
  }
4003
- function Xt(t, e) {
4004
- return Ve(t, e, t.container.element(e), [
3992
+ function $t(t, e) {
3993
+ return Ge(t, e, t.container.element(e), [
4005
3994
  T.Schema,
4006
3995
  T.Table,
4007
3996
  T.Column
@@ -4010,7 +3999,7 @@ function Xt(t, e) {
4010
3999
  function os(t) {
4011
4000
  return {
4012
4001
  suggestions: [
4013
- ...Be({
4002
+ ...Ve({
4014
4003
  suggestions: [...t.parse.publicSymbolTable().entries()].flatMap(([e]) => {
4015
4004
  const n = re(e).unwrap_or(void 0);
4016
4005
  if (n === void 0)
@@ -4020,7 +4009,7 @@ function os(t) {
4020
4009
  label: i,
4021
4010
  insertText: i,
4022
4011
  insertTextRules: w.KeepWhitespace,
4023
- kind: Ae(s),
4012
+ kind: ve(s),
4024
4013
  range: void 0
4025
4014
  };
4026
4015
  })
@@ -4036,7 +4025,7 @@ function os(t) {
4036
4025
  };
4037
4026
  }
4038
4027
  function ls(t, e) {
4039
- return $t(t, e);
4028
+ return Wt(t, e);
4040
4029
  }
4041
4030
  function cs(t, e) {
4042
4031
  return {
@@ -4106,19 +4095,19 @@ function cs(t, e) {
4106
4095
  sortText: L.TypeParameter.toString().padStart(2, "0"),
4107
4096
  range: void 0
4108
4097
  })),
4109
- ...Ve(t, e, t.container.element(e), [
4098
+ ...Ge(t, e, t.container.element(e), [
4110
4099
  T.Enum,
4111
4100
  T.Schema
4112
4101
  ]).suggestions
4113
4102
  ]
4114
4103
  };
4115
4104
  }
4116
- function $t(t, e) {
4105
+ function Wt(t, e) {
4117
4106
  const n = t.container.element(e), s = n == null ? void 0 : n.parent;
4118
- if (!((s == null ? void 0 : s.symbol) instanceof wt))
4107
+ if (!((s == null ? void 0 : s.symbol) instanceof yt))
4119
4108
  return D();
4120
4109
  const { symbolTable: i } = s.symbol;
4121
- return Be({
4110
+ return Ve({
4122
4111
  suggestions: [...i.entries()].flatMap(([r]) => {
4123
4112
  const a = re(r).unwrap_or(void 0);
4124
4113
  if (a === void 0)
@@ -4128,25 +4117,25 @@ function $t(t, e) {
4128
4117
  label: l,
4129
4118
  insertText: l,
4130
4119
  insertTextRules: w.KeepWhitespace,
4131
- kind: Ae(T.Column),
4120
+ kind: ve(T.Column),
4132
4121
  range: void 0
4133
4122
  };
4134
4123
  })
4135
4124
  });
4136
4125
  }
4137
- function st(t, e) {
4126
+ function it(t, e) {
4138
4127
  if (!e.callee)
4139
4128
  return -1;
4140
4129
  const n = [e.callee, ...e.args], s = n.findIndex((i) => t <= i.end);
4141
4130
  return s === -1 ? n.length : s;
4142
4131
  }
4143
- class Wt {
4132
+ class jt {
4144
4133
  constructor(e) {
4145
4134
  this.compiler = e;
4146
4135
  }
4147
4136
  provideDefinition(e, n) {
4148
4137
  var a;
4149
- const { uri: s } = e, i = nt(e, n), r = [...this.compiler.container.stack(i)];
4138
+ const { uri: s } = e, i = st(e, n), r = [...this.compiler.container.stack(i)];
4150
4139
  for (; r.length !== 0; ) {
4151
4140
  const l = r.pop();
4152
4141
  if ((a = l == null ? void 0 : l.referee) != null && a.declaration && [Ne.PRIMARY_EXPRESSION, Ne.VARIABLE].includes(l == null ? void 0 : l.kind)) {
@@ -4167,12 +4156,12 @@ class Wt {
4167
4156
  return [];
4168
4157
  }
4169
4158
  }
4170
- class jt {
4159
+ class Yt {
4171
4160
  constructor(e) {
4172
4161
  this.compiler = e;
4173
4162
  }
4174
4163
  provideReferences(e, n) {
4175
- const { uri: s } = e, i = nt(e, n), r = [...this.compiler.container.stack(i)];
4164
+ const { uri: s } = e, i = st(e, n), r = [...this.compiler.container.stack(i)];
4176
4165
  for (; r.length !== 0; ) {
4177
4166
  const a = r.pop();
4178
4167
  if (a && [
@@ -4200,9 +4189,9 @@ const fs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4200
4189
  __proto__: null,
4201
4190
  CompletionItemInsertTextRule: w,
4202
4191
  CompletionItemKind: L,
4203
- DBMLCompletionItemProvider: Gt,
4204
- DBMLDefinitionProvider: Wt,
4205
- DBMLReferencesProvider: jt
4192
+ DBMLCompletionItemProvider: Ct,
4193
+ DBMLDefinitionProvider: jt,
4194
+ DBMLReferencesProvider: Yt
4206
4195
  }, Symbol.toStringTag, { value: "Module" }));
4207
4196
  var O = /* @__PURE__ */ ((t) => (t[t.TABLE = 0] = "TABLE", t[t.ENUM = 1] = "ENUM", t[t.TABLEGROUP = 2] = "TABLEGROUP", t[t.INDEXES = 3] = "INDEXES", t[t.NOTE = 4] = "NOTE", t[t.REF = 5] = "REF", t[t.PROJECT = 6] = "PROJECT", t[t.CUSTOM = 7] = "CUSTOM", t[t.TOPLEVEL = 8] = "TOPLEVEL", t))(O || {});
4208
4197
  class ps {
@@ -4213,7 +4202,7 @@ class ps {
4213
4202
  ).fill(null), this.nodeIdGenerator = new Jt(), this.symbolIdGenerator = new nn(), this.token = {
4214
4203
  invalidStream: this.createQuery(
4215
4204
  6,
4216
- () => this.parse.tokens().filter(yt)
4205
+ () => this.parse.tokens().filter(kt)
4217
4206
  ),
4218
4207
  // Valid + Invalid tokens (which are guarenteed to be non-trivials) are included in the stream
4219
4208
  flatStream: this.createQuery(
@@ -4257,8 +4246,8 @@ class ps {
4257
4246
  let l = this.parse.ast();
4258
4247
  const p = [l];
4259
4248
  for (; ; ) {
4260
- const E = fn(l).find((h) => ge(a, h));
4261
- if (E === void 0 || E instanceof V)
4249
+ const E = fn(l).find((h) => _e(a, h));
4250
+ if (E === void 0 || E instanceof G)
4262
4251
  break;
4263
4252
  p.push(E), l = E;
4264
4253
  }
@@ -4266,16 +4255,16 @@ class ps {
4266
4255
  return p;
4267
4256
  for (; p.length > 0; ) {
4268
4257
  let f = !1;
4269
- const E = Xe(p);
4258
+ const E = $e(p);
4270
4259
  if (E instanceof v) {
4271
4260
  const h = this.parse.source();
4272
4261
  for (let m = E.end; m < e; m += 1)
4273
4262
  h[m] === `
4274
4263
  ` && (p.pop(), f = !0);
4275
4264
  } else
4276
- E instanceof q || E instanceof H ? this.container.token(e).token !== E.op && (p.pop(), f = !0) : E instanceof P ? E.listCloseBracket && E.end <= e && (p.pop(), f = !0) : E instanceof K ? E.tupleCloseParen && E.end <= e && (p.pop(), f = !0) : E instanceof Z ? E.blockCloseBrace && E.end <= e && (p.pop(), f = !0) : E instanceof z || E.end < e && (p.pop(), f = !0);
4265
+ E instanceof H || E instanceof J ? this.container.token(e).token !== E.op && (p.pop(), f = !0) : E instanceof R ? E.listCloseBracket && E.end <= e && (p.pop(), f = !0) : E instanceof ee ? E.tupleCloseParen && E.end <= e && (p.pop(), f = !0) : E instanceof K ? E.blockCloseBrace && E.end <= e && (p.pop(), f = !0) : E instanceof q || E.end < e && (p.pop(), f = !0);
4277
4266
  if (f) {
4278
- const h = Xe(p);
4267
+ const h = $e(p);
4279
4268
  h instanceof A && h.end <= e && p.pop();
4280
4269
  }
4281
4270
  if (!f)
@@ -4313,7 +4302,7 @@ class ps {
4313
4302
  ),
4314
4303
  scopeKind: this.createQuery(15, (e) => {
4315
4304
  var s;
4316
- if (this.container.element(e) instanceof $)
4305
+ if (this.container.element(e) instanceof j)
4317
4306
  return 8;
4318
4307
  switch ((s = this.container.element(e).type) == null ? void 0 : s.value.toLowerCase()) {
4319
4308
  case "table":
@@ -4399,9 +4388,9 @@ class ps {
4399
4388
  }
4400
4389
  initMonacoServices() {
4401
4390
  return {
4402
- definitionProvider: new Wt(this),
4403
- referenceProvider: new jt(this),
4404
- autocompletionProvider: new Gt(this)
4391
+ definitionProvider: new jt(this),
4392
+ referenceProvider: new Yt(this),
4393
+ autocompletionProvider: new Ct(this)
4405
4394
  };
4406
4395
  }
4407
4396
  }