@dbml/parse 3.4.2 → 3.4.3

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.
@@ -94,7 +94,7 @@ class x {
94
94
  }, this.fullEnd = NaN), this.start = this.startPos.offset, this.end = this.endPos.offset;
95
95
  }
96
96
  }
97
- var de = /* @__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))(de || {});
97
+ var Ee = /* @__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))(Ee || {});
98
98
  class G extends x {
99
99
  constructor({ body: e = [], eof: n }, s) {
100
100
  super(s, "<program>", [...e, n]), this.body = e, this.eof = n;
@@ -118,7 +118,7 @@ class A extends x {
118
118
  r,
119
119
  a,
120
120
  c
121
- ]), c && a && !(c instanceof w || c instanceof A))
121
+ ]), c && a && !(c instanceof y || c instanceof A))
122
122
  throw new Error("If an element has a simple body, it must be a function application node");
123
123
  this.type = e, this.name = n, this.as = s, this.alias = i, this.attributeList = r, this.bodyColon = a, this.body = c;
124
124
  }
@@ -161,7 +161,7 @@ class te extends x {
161
161
  super(n, "<function-expression>", [e]), this.value = e;
162
162
  }
163
163
  }
164
- class w extends x {
164
+ class y extends x {
165
165
  constructor({ callee: e, args: n = [] }, s) {
166
166
  super(s, "<function-application>", [e, ...n]), this.callee = e, this.args = n;
167
167
  }
@@ -228,7 +228,7 @@ class H extends x {
228
228
  super(s, "<call-expression>", [e, n]), this.callee = e, this.argumentList = n;
229
229
  }
230
230
  }
231
- class Te extends x {
231
+ class be extends x {
232
232
  constructor({ literal: e }, n) {
233
233
  super(n, "<literal>", [e]), this.literal = e;
234
234
  }
@@ -249,7 +249,7 @@ class ke extends x {
249
249
  super(n, "<dummy>", [s]);
250
250
  }
251
251
  }
252
- class le extends x {
252
+ class ue extends x {
253
253
  constructor({ expression: e, indexer: n }, s) {
254
254
  super(s, "<array>", [e, n]), this.array = e, this.indexer = n;
255
255
  }
@@ -312,7 +312,7 @@ class S {
312
312
  return !0;
313
313
  }
314
314
  }
315
- class v {
315
+ class w {
316
316
  // eslint-disable-next-line class-methods-use-this
317
317
  unwrap() {
318
318
  throw new Error("Trying to unwrap a None value");
@@ -323,11 +323,11 @@ class v {
323
323
  }
324
324
  // eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this
325
325
  and_then(e) {
326
- return new v();
326
+ return new w();
327
327
  }
328
328
  // eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this
329
329
  map(e) {
330
- return new v();
330
+ return new w();
331
331
  }
332
332
  // eslint-disable-next-line class-methods-use-this
333
333
  isOk() {
@@ -384,7 +384,7 @@ function ie(t) {
384
384
  return Object.values(m).includes(e) ? new S({
385
385
  name: n,
386
386
  kind: e
387
- }) : new v();
387
+ }) : new w();
388
388
  }
389
389
  function Qt(t) {
390
390
  const e = ie(t).unwrap_or(void 0);
@@ -415,7 +415,7 @@ function Ht(t) {
415
415
  const [e] = t;
416
416
  return Oe(e) || Ue(e) && e.toLowerCase() >= "a" && e.toLowerCase() <= "f";
417
417
  }
418
- function pe(t) {
418
+ function de(t) {
419
419
  return Ue(t) || Oe(t);
420
420
  }
421
421
  function ct(t, e) {
@@ -498,11 +498,11 @@ class B {
498
498
  }
499
499
  }
500
500
  function sn(t, e, n) {
501
- if (!t || !Ne(t) || e.length === 0)
502
- return new v();
501
+ if (!t || !me(t) || e.length === 0)
502
+ return new w();
503
503
  const s = [...e], i = Ge(t).unwrap(), r = s.pop();
504
504
  if (!(r instanceof ne))
505
- return new v();
505
+ return new w();
506
506
  const a = I.last(s) instanceof D ? s.pop() : void 0;
507
507
  return s.length === 3 && Ge(s[1]).unwrap().value === "as" ? new S(
508
508
  n.create(A, {
@@ -526,7 +526,7 @@ function sn(t, e, n) {
526
526
  attributeList: a,
527
527
  body: r
528
528
  })
529
- ) : new v();
529
+ ) : new w();
530
530
  }
531
531
  function lt(t) {
532
532
  return t.kind === u.IDENTIFIER && t.value === "as";
@@ -558,7 +558,7 @@ function an(t) {
558
558
  E(t.tupleOpenParen), t.commaList.forEach(E), t.elementList.forEach(E), E(t.tupleCloseParen);
559
559
  else if (t instanceof H)
560
560
  E(t.callee), E(t.argumentList);
561
- else if (t instanceof w)
561
+ else if (t instanceof y)
562
562
  E(t.callee), t.args.forEach(E);
563
563
  else if (t instanceof U)
564
564
  E(t.expression);
@@ -566,7 +566,7 @@ function an(t) {
566
566
  E(t.value);
567
567
  else if (t instanceof Z)
568
568
  E(t.variable);
569
- else if (t instanceof Te)
569
+ else if (t instanceof be)
570
570
  E(t.literal);
571
571
  else
572
572
  throw t instanceof je ? new Error("This case is handled by the TupleExpressionNode case") : new Error("Unreachable case in markInvalidNode");
@@ -594,7 +594,7 @@ function on(t) {
594
594
  return P(t.name, t.colon, t.value);
595
595
  if (t instanceof $)
596
596
  return t.identifiers;
597
- if (t instanceof Te)
597
+ if (t instanceof be)
598
598
  return t.literal ? [t.literal] : [];
599
599
  if (t instanceof Z)
600
600
  return P(t.variable);
@@ -606,7 +606,7 @@ function on(t) {
606
606
  return P(t.expression, t.op);
607
607
  if (t instanceof te)
608
608
  return P(t.value);
609
- if (t instanceof w)
609
+ if (t instanceof y)
610
610
  return P(t.callee, ...t.args);
611
611
  if (t instanceof ne)
612
612
  return P(t.blockOpenBrace, ...t.body, t.blockCloseBrace);
@@ -626,7 +626,7 @@ function on(t) {
626
626
  return P(t.callee, t.argumentList);
627
627
  if (t instanceof U)
628
628
  return P(t.expression);
629
- if (t instanceof le)
629
+ if (t instanceof ue)
630
630
  return P(
631
631
  t.array,
632
632
  t.indexer
@@ -634,16 +634,16 @@ function on(t) {
634
634
  throw t instanceof je ? new Error("This case is already handled by TupleExpressionNode") : new Error("Unreachable - no other possible cases");
635
635
  }
636
636
  function Ge(t) {
637
- return M(t) ? new S(t.expression.variable) : new v();
637
+ return M(t) ? new S(t.expression.variable) : new w();
638
638
  }
639
639
  function W(t) {
640
640
  var e;
641
- return t instanceof U && (t.expression instanceof Z && t.expression.variable instanceof F && t.expression.variable.kind === u.QUOTED_STRING || t.expression instanceof Te && ((e = t.expression.literal) == null ? void 0 : e.kind) === u.STRING_LITERAL);
641
+ return t instanceof U && (t.expression instanceof Z && t.expression.variable instanceof F && t.expression.variable.kind === u.QUOTED_STRING || t.expression instanceof be && ((e = t.expression.literal) == null ? void 0 : e.kind) === u.STRING_LITERAL);
642
642
  }
643
643
  function M(t) {
644
644
  return t instanceof U && t.expression instanceof Z && t.expression.variable instanceof F;
645
645
  }
646
- function Ne(t) {
646
+ function me(t) {
647
647
  var e;
648
648
  return t instanceof U && t.expression instanceof Z && ((e = t.expression.variable) == null ? void 0 : e.kind) === u.IDENTIFIER;
649
649
  }
@@ -651,11 +651,11 @@ function Je(t) {
651
651
  var e;
652
652
  return t instanceof q && t.leftExpression instanceof x && t.rightExpression instanceof x && ((e = t.op) == null ? void 0 : e.value) === ".";
653
653
  }
654
- function me(t) {
654
+ function Te(t) {
655
655
  if (t === void 0)
656
- return new v();
656
+ return new w();
657
657
  const e = t.identifiers.map((n) => n.value).join(" ");
658
- return e === "" ? new v() : new S(e);
658
+ return e === "" ? new w() : new S(e);
659
659
  }
660
660
  class cn {
661
661
  // list of errors during lexing
@@ -890,7 +890,7 @@ class cn {
890
890
  });
891
891
  }
892
892
  identifier() {
893
- for (; !this.isAtEnd() && pe(this.peek()); )
893
+ for (; !this.isAtEnd() && de(this.peek()); )
894
894
  this.advance();
895
895
  this.addToken(u.IDENTIFIER);
896
896
  }
@@ -910,26 +910,26 @@ class cn {
910
910
  break;
911
911
  if (!n && this.current.offset === this.text.length - 1)
912
912
  return this.advance(), this.addToken(u.NUMERIC_LITERAL);
913
- if (!n && !pe(this.peek()))
913
+ if (!n && !de(this.peek()))
914
914
  return this.addToken(u.NUMERIC_LITERAL);
915
915
  if (!n && !Oe(this.peek()))
916
916
  break;
917
917
  this.advance();
918
918
  }
919
919
  if (e > 0) {
920
- for (; !this.isAtEnd() && (this.check(".") || pe(this.peek())); )
920
+ for (; !this.isAtEnd() && (this.check(".") || de(this.peek())); )
921
921
  this.advance();
922
922
  const n = this.createToken(u.NUMERIC_LITERAL, !0);
923
923
  this.tokens.push(n), this.errors.push(new l(o.UNKNOWN_TOKEN, "Invalid number", n));
924
924
  } else {
925
- for (; !this.isAtEnd() && pe(this.peek()); )
925
+ for (; !this.isAtEnd() && de(this.peek()); )
926
926
  this.advance();
927
927
  const n = this.createToken(u.IDENTIFIER, !1);
928
928
  this.tokens.push(n);
929
929
  }
930
930
  }
931
931
  colorLiteral() {
932
- for (; !this.isAtEnd() && pe(this.peek()); )
932
+ for (; !this.isAtEnd() && de(this.peek()); )
933
933
  this.advance();
934
934
  this.addToken(u.COLOR_LITERAL);
935
935
  }
@@ -970,7 +970,7 @@ class cn {
970
970
  case "u": {
971
971
  let n = "";
972
972
  for (let s = 0; s <= 3; s += 1) {
973
- if (this.isAtEnd() || !pe(this.peek()))
973
+ if (this.isAtEnd() || !de(this.peek()))
974
974
  return this.errors.push(new l(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`, F.create(u.STRING_LITERAL, e, this.current, `\\u${n}`, !0))), `\\u${n}`;
975
975
  n += this.advance();
976
976
  }
@@ -1389,7 +1389,7 @@ class hn {
1389
1389
  /* Parsing any ExpressionNode, including non-NormalExpression */
1390
1390
  expression() {
1391
1391
  const e = { args: [] }, n = () => sn(e.callee, e.args, this.nodeFactory).unwrap_or(
1392
- this.nodeFactory.create(w, e)
1392
+ this.nodeFactory.create(y, e)
1393
1393
  );
1394
1394
  try {
1395
1395
  e.callee = this.normalExpression();
@@ -1446,12 +1446,12 @@ class hn {
1446
1446
  if (Ce(this.previous()))
1447
1447
  break;
1448
1448
  try {
1449
- n = this.nodeFactory.create(le, {
1449
+ n = this.nodeFactory.create(ue, {
1450
1450
  expression: n,
1451
1451
  indexer: this.listExpression()
1452
1452
  });
1453
1453
  } catch (i) {
1454
- throw i instanceof d ? (n = this.nodeFactory.create(le, {
1454
+ throw i instanceof d ? (n = this.nodeFactory.create(ue, {
1455
1455
  expression: n,
1456
1456
  indexer: i.partialNode
1457
1457
  }), new d(i.token, n, i.handlerContext)) : i;
@@ -1570,7 +1570,7 @@ class hn {
1570
1570
  u.NUMERIC_LITERAL
1571
1571
  ))
1572
1572
  return this.nodeFactory.create(U, {
1573
- expression: this.nodeFactory.create(Te, { literal: this.previous() })
1573
+ expression: this.nodeFactory.create(be, { literal: this.previous() })
1574
1574
  });
1575
1575
  if (this.match(u.QUOTED_STRING, u.IDENTIFIER))
1576
1576
  return this.nodeFactory.create(U, {
@@ -1688,36 +1688,36 @@ function ve(t) {
1688
1688
  case b.TableGroup:
1689
1689
  return new S(e);
1690
1690
  default:
1691
- return new v();
1691
+ return new w();
1692
1692
  }
1693
1693
  }
1694
- function he(t) {
1694
+ function fe(t) {
1695
1695
  if (!Je(t))
1696
1696
  return new S([t]);
1697
- const e = he(t.leftExpression).unwrap_or(void 0);
1698
- return e ? (e.push(t.rightExpression), new S(e)) : new v();
1697
+ const e = fe(t.leftExpression).unwrap_or(void 0);
1698
+ return e ? (e.push(t.rightExpression), new S(e)) : new w();
1699
1699
  }
1700
1700
  function C(t) {
1701
1701
  if (t === void 0)
1702
- return new v();
1703
- const e = he(t).unwrap_or(void 0);
1702
+ return new w();
1703
+ const e = fe(t).unwrap_or(void 0);
1704
1704
  if (!e)
1705
- return new v();
1705
+ return new w();
1706
1706
  const n = [];
1707
1707
  for (const s of e) {
1708
1708
  const i = X(s).unwrap_or(void 0);
1709
1709
  if (!i)
1710
- return new v();
1710
+ return new w();
1711
1711
  n.push(i);
1712
1712
  }
1713
1713
  return new S(n);
1714
1714
  }
1715
1715
  function _e(t) {
1716
1716
  if (t === void 0)
1717
- return new v();
1718
- const e = he(t).unwrap_or(void 0);
1717
+ return new w();
1718
+ const e = fe(t).unwrap_or(void 0);
1719
1719
  if (!e || e.length === 0)
1720
- return new v();
1720
+ return new w();
1721
1721
  const n = [];
1722
1722
  let s;
1723
1723
  if (!M(I.last(e))) {
@@ -1727,12 +1727,12 @@ function _e(t) {
1727
1727
  (r) => V(r).unwrap()
1728
1728
  );
1729
1729
  else
1730
- return new v();
1730
+ return new w();
1731
1731
  }
1732
1732
  for (const i of e) {
1733
1733
  const r = X(i).unwrap_or(void 0);
1734
1734
  if (!r)
1735
- return new v();
1735
+ return new w();
1736
1736
  n.push(r);
1737
1737
  }
1738
1738
  return new S({
@@ -1741,7 +1741,7 @@ function _e(t) {
1741
1741
  });
1742
1742
  }
1743
1743
  function X(t) {
1744
- return M(t) ? new S(t.expression.variable.value) : new v();
1744
+ return M(t) ? new S(t.expression.variable.value) : new w();
1745
1745
  }
1746
1746
  function Xe(t) {
1747
1747
  if (ht(t))
@@ -1752,15 +1752,15 @@ function Xe(t) {
1752
1752
  ), n = t.elementList.filter(M);
1753
1753
  return new S({ functional: e, nonFunctional: n });
1754
1754
  }
1755
- return new v();
1755
+ return new w();
1756
1756
  }
1757
1757
  function V(t) {
1758
1758
  var n;
1759
1759
  const e = (n = t == null ? void 0 : t.expression.variable) == null ? void 0 : n.value;
1760
- return e === void 0 ? new v() : new S(e);
1760
+ return e === void 0 ? new w() : new S(e);
1761
1761
  }
1762
1762
  function z(t) {
1763
- return W(t) ? t.expression instanceof Z ? new S(t.expression.variable.value) : new S(t.expression.literal.value) : new v();
1763
+ return W(t) ? t.expression instanceof Z ? new S(t.expression.variable.value) : new S(t.expression.literal.value) : new w();
1764
1764
  }
1765
1765
  function mn(t) {
1766
1766
  var e;
@@ -1867,9 +1867,9 @@ class Ln {
1867
1867
  validateBody(e) {
1868
1868
  if (!e)
1869
1869
  return [];
1870
- if (e instanceof w)
1870
+ if (e instanceof y)
1871
1871
  return this.validateFields([e]);
1872
- const [n, s] = I.partition(e.body, (i) => i instanceof w);
1872
+ const [n, s] = I.partition(e.body, (i) => i instanceof y);
1873
1873
  return [...this.validateFields(n), ...this.validateSubElements(s)];
1874
1874
  }
1875
1875
  validateFields(e) {
@@ -1943,9 +1943,9 @@ class gn {
1943
1943
  validateBody(e) {
1944
1944
  if (!e)
1945
1945
  return [];
1946
- if (e instanceof w)
1946
+ if (e instanceof y)
1947
1947
  return [new l(o.UNEXPECTED_SIMPLE_BODY, "An Indexes must have a complex body", e)];
1948
- const [n, s] = I.partition(e.body, (i) => i instanceof w);
1948
+ const [n, s] = I.partition(e.body, (i) => i instanceof y);
1949
1949
  return [...this.validateFields(n), ...this.validateSubElements(s)];
1950
1950
  }
1951
1951
  validateFields(e) {
@@ -1974,7 +1974,7 @@ class gn {
1974
1974
  case "unique":
1975
1975
  case "pk":
1976
1976
  a.length > 1 && a.forEach((c) => s.push(new l(o.DUPLICATE_INDEX_SETTING, `'${r}' can only appear once`, c))), a.forEach((c) => {
1977
- ce(c.value) || s.push(new l(o.INVALID_INDEX_SETTING_VALUE, `'${r}' must not have a value`, c));
1977
+ le(c.value) || s.push(new l(o.INVALID_INDEX_SETTING_VALUE, `'${r}' must not have a value`, c));
1978
1978
  });
1979
1979
  break;
1980
1980
  case "type":
@@ -2027,9 +2027,9 @@ class _n {
2027
2027
  validateBody(e) {
2028
2028
  if (!e)
2029
2029
  return [];
2030
- if (e instanceof w)
2030
+ if (e instanceof y)
2031
2031
  return this.validateFields([e]);
2032
- const [n, s] = I.partition(e.body, (i) => i instanceof w);
2032
+ const [n, s] = I.partition(e.body, (i) => i instanceof y);
2033
2033
  return [...this.validateFields(n), ...this.validateSubElements(s)];
2034
2034
  }
2035
2035
  validateFields(e) {
@@ -2067,9 +2067,9 @@ class An {
2067
2067
  validateBody(e) {
2068
2068
  if (!e)
2069
2069
  return [];
2070
- if (e instanceof w)
2070
+ if (e instanceof y)
2071
2071
  return [new l(o.UNEXPECTED_SIMPLE_BODY, "A Project's body must be a block", e)];
2072
- const [n, s] = I.partition(e.body, (i) => i instanceof w);
2072
+ const [n, s] = I.partition(e.body, (i) => i instanceof y);
2073
2073
  return [
2074
2074
  ...n.map((i) => new l(o.INVALID_PROJECT_FIELD, "A Project can not have inline fields", i)),
2075
2075
  ...this.validateSubElements(s)
@@ -2106,9 +2106,9 @@ class vn {
2106
2106
  validateBody(e) {
2107
2107
  if (!e)
2108
2108
  return [];
2109
- if (e instanceof w)
2109
+ if (e instanceof y)
2110
2110
  return this.validateFields([e]);
2111
- const [n, s] = I.partition(e.body, (i) => i instanceof w);
2111
+ const [n, s] = I.partition(e.body, (i) => i instanceof y);
2112
2112
  return [...this.validateFields(n), ...this.validateSubElements(s)];
2113
2113
  }
2114
2114
  validateFields(e) {
@@ -2151,7 +2151,7 @@ function wn(t) {
2151
2151
  if (!(M(t) && t.expression.variable.kind !== u.QUOTED_STRING) && !(t instanceof $))
2152
2152
  return !1;
2153
2153
  let e;
2154
- if (t instanceof $ ? e = me(t).unwrap_or("") : e = t.expression.variable.value, e)
2154
+ if (t instanceof $ ? e = Te(t).unwrap_or("") : e = t.expression.variable.value, e)
2155
2155
  switch (e.toLowerCase()) {
2156
2156
  case "cascade":
2157
2157
  case "no action":
@@ -2175,7 +2175,7 @@ class yn {
2175
2175
  return this.declarationNode.parent instanceof A ? [new l(o.INVALID_TABLE_CONTEXT, "Table must appear top-level", this.declarationNode)] : [];
2176
2176
  }
2177
2177
  validateName(e) {
2178
- return e ? e instanceof le ? [new l(o.INVALID_NAME, "Invalid array as Table name, maybe you forget to add a space between the name and the setting list?", e)] : Ze(e) ? [] : [new l(o.INVALID_NAME, "A Table name must be of the form <table> or <schema>.<table>", e)] : [new l(o.NAME_NOT_FOUND, "A Table must have a name", this.declarationNode)];
2178
+ return e ? e instanceof ue ? [new l(o.INVALID_NAME, "Invalid array as Table name, maybe you forget to add a space between the name and the setting list?", e)] : Ze(e) ? [] : [new l(o.INVALID_NAME, "A Table name must be of the form <table> or <schema>.<table>", e)] : [new l(o.NAME_NOT_FOUND, "A Table must have a name", this.declarationNode)];
2179
2179
  }
2180
2180
  validateAlias(e) {
2181
2181
  return e ? On(e) ? [] : [new l(o.INVALID_ALIAS, "Table aliases can only contains alphanumeric and underscore unless surrounded by double quotes", e)] : [];
@@ -2218,9 +2218,9 @@ class yn {
2218
2218
  validateBody(e) {
2219
2219
  if (!e)
2220
2220
  return [];
2221
- if (e instanceof w)
2221
+ if (e instanceof y)
2222
2222
  return [new l(o.UNEXPECTED_SIMPLE_BODY, "A Table's body must be a block", e)];
2223
- const [n, s] = I.partition(e.body, (i) => i instanceof w);
2223
+ const [n, s] = I.partition(e.body, (i) => i instanceof y);
2224
2224
  return [...this.validateFields(n), ...this.validateSubElements(s)];
2225
2225
  }
2226
2226
  validateFields(e) {
@@ -2251,7 +2251,7 @@ class yn {
2251
2251
  }
2252
2252
  // This is needed to support legacy inline settings
2253
2253
  validateFieldSetting(e) {
2254
- if (!e.slice(0, -1).every(Ne) || !e.slice(-1).every((p) => Ne(p) || p instanceof D))
2254
+ if (!e.slice(0, -1).every(me) || !e.slice(-1).every((p) => me(p) || p instanceof D))
2255
2255
  return [...e.map((p) => new l(o.INVALID_COLUMN, "These fields must be some inline settings optionally ended with a setting list", p))];
2256
2256
  if (e.length === 0)
2257
2257
  return [];
@@ -2283,34 +2283,34 @@ class yn {
2283
2283
  break;
2284
2284
  case "primary key":
2285
2285
  h.length > 1 && i.push(...h.map((f) => new l(o.DUPLICATE_COLUMN_SETTING, "primary key can only appear once", f))), h.forEach((f) => {
2286
- ce(f.value) || i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'primary key' must not have a value", f.value || f.name));
2286
+ le(f.value) || i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'primary key' must not have a value", f.value || f.name));
2287
2287
  });
2288
2288
  break;
2289
2289
  case "pk":
2290
2290
  h.length > 1 && i.push(...h.map((f) => new l(o.DUPLICATE_COLUMN_SETTING, "'pk' can only appear once", f))), h.forEach((f) => {
2291
- f instanceof se && !ce(f.value) && i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'pk' must not have a value", f.value || f.name));
2291
+ f instanceof se && !le(f.value) && i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'pk' must not have a value", f.value || f.name));
2292
2292
  });
2293
2293
  break;
2294
2294
  case "not null":
2295
2295
  h.length > 1 && i.push(...h.map((f) => new l(o.DUPLICATE_COLUMN_SETTING, "'not null' can only appear once", f)));
2296
2296
  const T = r.null || [];
2297
2297
  h.length >= 1 && T.length >= 1 && i.push(...[...h, ...T].map((f) => new l(o.CONFLICTING_SETTING, "'not null' and 'null' can not be set at the same time", f))), h.forEach((f) => {
2298
- ce(f.value) || i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'not null' must not have a value", f.value || f.name));
2298
+ le(f.value) || i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'not null' must not have a value", f.value || f.name));
2299
2299
  });
2300
2300
  break;
2301
2301
  case "null":
2302
2302
  h.length > 1 && i.push(...h.map((f) => new l(o.DUPLICATE_COLUMN_SETTING, "'null' can only appear once", f))), h.forEach((f) => {
2303
- ce(f.value) || i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'null' must not have a value", f.value || f.name));
2303
+ le(f.value) || i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'null' must not have a value", f.value || f.name));
2304
2304
  });
2305
2305
  break;
2306
2306
  case "unique":
2307
2307
  h.length > 1 && i.push(...h.map((f) => new l(o.DUPLICATE_COLUMN_SETTING, "'unique' can only appear once", f))), h.forEach((f) => {
2308
- f instanceof se && !ce(f.value) && i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'unique' must not have a value", f.value || f.name));
2308
+ f instanceof se && !le(f.value) && i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'unique' must not have a value", f.value || f.name));
2309
2309
  });
2310
2310
  break;
2311
2311
  case "increment":
2312
2312
  h.length > 1 && i.push(...h.map((f) => new l(o.DUPLICATE_COLUMN_SETTING, "'increment' can only appear once", f))), h.forEach((f) => {
2313
- f instanceof se && !ce(f.value) && i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'increment' must not have a value", f.value || f.name));
2313
+ f instanceof se && !le(f.value) && i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'increment' must not have a value", f.value || f.name));
2314
2314
  });
2315
2315
  break;
2316
2316
  case "default":
@@ -2338,15 +2338,15 @@ class yn {
2338
2338
  }
2339
2339
  }
2340
2340
  function kn(t) {
2341
- if (!(t instanceof H || Je(t) || t instanceof U || t instanceof le))
2341
+ if (!(t instanceof H || Je(t) || t instanceof U || t instanceof ue))
2342
2342
  return !1;
2343
2343
  if (t instanceof H) {
2344
- if (t.callee === void 0 || t.argumentList === void 0 || !t.argumentList.elementList.every((n) => ue(n) || W(n) || Ne(n)))
2344
+ if (t.callee === void 0 || t.argumentList === void 0 || !t.argumentList.elementList.every((n) => he(n) || W(n) || me(n)))
2345
2345
  return !1;
2346
2346
  t = t.callee;
2347
2347
  }
2348
- for (; t instanceof le; ) {
2349
- if (t.array === void 0 || t.indexer === void 0 || !t.indexer.elementList.every((n) => !n.colon && !n.value && ue(n.name)))
2348
+ for (; t instanceof ue; ) {
2349
+ if (t.array === void 0 || t.indexer === void 0 || !t.indexer.elementList.every((n) => !n.colon && !n.value && he(n.name)))
2350
2350
  return !1;
2351
2351
  t = t.array;
2352
2352
  }
@@ -2390,9 +2390,9 @@ class Sn {
2390
2390
  validateBody(e) {
2391
2391
  if (!e)
2392
2392
  return [];
2393
- if (e instanceof w)
2393
+ if (e instanceof y)
2394
2394
  return [new l(o.UNEXPECTED_SIMPLE_BODY, "A TableGroup's body must be a block", e)];
2395
- const [n, s] = I.partition(e.body, (i) => i instanceof w);
2395
+ const [n, s] = I.partition(e.body, (i) => i instanceof y);
2396
2396
  return [...this.validateFields(n), ...this.validateSubElements(s)];
2397
2397
  }
2398
2398
  validateFields(e) {
@@ -2480,7 +2480,7 @@ function yt(t) {
2480
2480
  }
2481
2481
  function Rn(t) {
2482
2482
  var n;
2483
- if (!(t instanceof U) || !(t.expression instanceof Te) || ((n = t.expression.literal) == null ? void 0 : n.kind) !== u.COLOR_LITERAL)
2483
+ if (!(t instanceof U) || !(t.expression instanceof be) || ((n = t.expression.literal) == null ? void 0 : n.kind) !== u.COLOR_LITERAL)
2484
2484
  return !1;
2485
2485
  const e = t.expression.literal.value;
2486
2486
  if (e.length !== 4 && e.length !== 7 || e[0] !== "#")
@@ -2490,16 +2490,16 @@ function Rn(t) {
2490
2490
  return !1;
2491
2491
  return !0;
2492
2492
  }
2493
- function ce(t) {
2493
+ function le(t) {
2494
2494
  return t === void 0;
2495
2495
  }
2496
2496
  function Dn(t) {
2497
2497
  var e;
2498
- return !!(W(t) || ue(t) || Ne(t) && ["true", "false", "null"].includes(t.expression.variable.value.toLowerCase()) || t instanceof Q && wt.includes((e = t.op) == null ? void 0 : e.value) && ue(t.expression) || t instanceof te);
2498
+ return !!(W(t) || he(t) || me(t) && ["true", "false", "null"].includes(t.expression.variable.value.toLowerCase()) || t instanceof Q && wt.includes((e = t.op) == null ? void 0 : e.value) && he(t.expression) || t instanceof te);
2499
2499
  }
2500
- function ue(t) {
2500
+ function he(t) {
2501
2501
  var e;
2502
- return t instanceof U && t.expression instanceof Te && ((e = t.expression.literal) == null ? void 0 : e.kind) === u.NUMERIC_LITERAL;
2502
+ return t instanceof U && t.expression instanceof be && ((e = t.expression.literal) == null ? void 0 : e.kind) === u.NUMERIC_LITERAL;
2503
2503
  }
2504
2504
  function Pn(t) {
2505
2505
  var n;
@@ -2523,7 +2523,7 @@ function j(t) {
2523
2523
  n.push(new l(o.INVALID_SETTINGS, "A setting name must be a stream of identifiers", i.name));
2524
2524
  continue;
2525
2525
  }
2526
- const r = (s = me(i.name).unwrap_or(void 0)) == null ? void 0 : s.toLowerCase();
2526
+ const r = (s = Te(i.name).unwrap_or(void 0)) == null ? void 0 : s.toLowerCase();
2527
2527
  r && (e[r] === void 0 ? e[r] = [i] : e[r].push(i));
2528
2528
  }
2529
2529
  return new B(e, n);
@@ -2562,7 +2562,7 @@ class ae {
2562
2562
  for (const s of e.elementList) {
2563
2563
  if (s.name instanceof U)
2564
2564
  continue;
2565
- const i = me(s.name).unwrap_or(void 0);
2565
+ const i = Te(s.name).unwrap_or(void 0);
2566
2566
  if (!i)
2567
2567
  continue;
2568
2568
  const r = n[i.toLowerCase()];
@@ -2602,7 +2602,7 @@ class ae {
2602
2602
  return;
2603
2603
  this.bindFragments([e], n);
2604
2604
  } else
2605
- e instanceof q ? Je(e) ? this.bindFragments(he(e).unwrap_or([]), n) : (this.scanAndBind(e.leftExpression, n), this.scanAndBind(e.rightExpression, n)) : e instanceof Q ? this.scanAndBind(e.expression, n) : e instanceof Pe ? this.scanAndBind(e.expression, n) : e instanceof J && e.elementList.forEach((r) => this.scanAndBind(r, n));
2605
+ e instanceof q ? Je(e) ? this.bindFragments(fe(e).unwrap_or([]), n) : (this.scanAndBind(e.leftExpression, n), this.scanAndBind(e.rightExpression, n)) : e instanceof Q ? this.scanAndBind(e.expression, n) : e instanceof Pe ? this.scanAndBind(e.expression, n) : e instanceof J && e.elementList.forEach((r) => this.scanAndBind(r, n));
2606
2606
  }
2607
2607
  // Bind the fragments of a member access expression
2608
2608
  // which can be a simple expression like v1.User,
@@ -2903,7 +2903,7 @@ function St(t) {
2903
2903
  }
2904
2904
  throw new Error("Invalid relation op");
2905
2905
  }
2906
- function y(t) {
2906
+ function v(t) {
2907
2907
  return {
2908
2908
  start: {
2909
2909
  offset: t.startPos.offset,
@@ -2915,10 +2915,10 @@ function y(t) {
2915
2915
  }
2916
2916
  function $e(t) {
2917
2917
  var n;
2918
- const e = (n = he(t).unwrap_or(void 0)) == null ? void 0 : n.pop();
2918
+ const e = (n = fe(t).unwrap_or(void 0)) == null ? void 0 : n.pop();
2919
2919
  return e instanceof J ? e.elementList.map((s) => s.referee) : [e.referee];
2920
2920
  }
2921
- function be(t) {
2921
+ function Ie(t) {
2922
2922
  const e = C(t).unwrap();
2923
2923
  return {
2924
2924
  name: e.pop(),
@@ -2944,7 +2944,7 @@ function Dt(t, e) {
2944
2944
  const n = t.id, s = e.id;
2945
2945
  return n === s;
2946
2946
  }
2947
- function Ee(t) {
2947
+ function Ne(t) {
2948
2948
  const e = t.split(`
2949
2949
  `), n = e.slice(e.findIndex((r) => r.trimStart() !== "")), s = n.filter((r) => r.trimStart()), i = Math.min(...s.map((r) => r.length - r.trimStart().length));
2950
2950
  return n.map((r) => r.slice(i)).join(`
@@ -2955,7 +2955,7 @@ class Pt {
2955
2955
  this.declarationNode = e, this.env = n, this.table = { name: void 0, schemaName: void 0, alias: null, fields: [], token: void 0, indexes: [] }, this.pkColumns = [];
2956
2956
  }
2957
2957
  interpret() {
2958
- this.table.token = y(this.declarationNode), this.env.tables.set(this.declarationNode, this.table);
2958
+ this.table.token = v(this.declarationNode), this.env.tables.set(this.declarationNode, this.table);
2959
2959
  const e = [
2960
2960
  ...this.interpretName(this.declarationNode.name),
2961
2961
  ...this.interpretAlias(this.declarationNode.alias),
@@ -2974,7 +2974,7 @@ class Pt {
2974
2974
  }), this.pkColumns.forEach((n) => n.pk = !1)), e;
2975
2975
  }
2976
2976
  interpretName(e) {
2977
- const { name: n, schemaName: s } = be(e);
2977
+ const { name: n, schemaName: s } = Ie(e);
2978
2978
  return s.length > 1 ? (this.table.name = n, this.table.schemaName = s.join("."), [new l(o.UNSUPPORTED, "Nested schema is not supported", e)]) : (this.table.name = n, this.table.schemaName = s.length ? s[0] : null, []);
2979
2979
  }
2980
2980
  interpretAlias(e) {
@@ -2996,12 +2996,12 @@ class Pt {
2996
2996
  this.table.headerColor = (i = n.headercolor) != null && i.length ? Ot((a = (r = n.headercolor) == null ? void 0 : r.at(0)) == null ? void 0 : a.value) : void 0;
2997
2997
  const [s] = n.note || [];
2998
2998
  return this.table.note = s && {
2999
- value: z(s == null ? void 0 : s.value).map(Ee).unwrap(),
3000
- token: y(s)
2999
+ value: z(s == null ? void 0 : s.value).map(Ne).unwrap(),
3000
+ token: v(s)
3001
3001
  }, [];
3002
3002
  }
3003
3003
  interpretBody(e) {
3004
- const [n, s] = I.partition(e.body, (i) => i instanceof w);
3004
+ const [n, s] = I.partition(e.body, (i) => i instanceof y);
3005
3005
  return [...this.interpretFields(n), ...this.interpretSubElements(s)];
3006
3006
  }
3007
3007
  interpretSubElements(e) {
@@ -3010,8 +3010,8 @@ class Pt {
3010
3010
  switch ((s = n.type) == null ? void 0 : s.value.toLowerCase()) {
3011
3011
  case "note":
3012
3012
  return this.table.note = {
3013
- value: z(n.body instanceof ne ? n.body.body[0].callee : n.body.callee).map(Ee).unwrap(),
3014
- token: y(n)
3013
+ value: z(n.body instanceof ne ? n.body.body[0].callee : n.body.callee).map(Ne).unwrap(),
3014
+ token: v(n)
3015
3015
  }, [];
3016
3016
  case "indexes":
3017
3017
  return this.interpretIndexes(n);
@@ -3027,63 +3027,63 @@ class Pt {
3027
3027
  const n = [], s = {};
3028
3028
  s.name = V(e.callee).unwrap();
3029
3029
  const i = Yn(e.args[0]);
3030
- s.type = i.getValue(), n.push(...i.getErrors()), s.token = y(e), s.inline_refs = [];
3030
+ s.type = i.getValue(), n.push(...i.getErrors()), s.token = v(e), s.inline_refs = [];
3031
3031
  const r = e.args.slice(1);
3032
3032
  if (I.last(r) instanceof D) {
3033
3033
  const _ = j(r.pop()).getValue();
3034
3034
  s.pk = !!((a = _.pk) != null && a.length) || !!((c = _["primary key"]) != null && c.length), s.increment = !!((p = _.increment) != null && p.length), s.unique = !!((h = _.unique) != null && h.length), s.not_null = !!((T = _["not null"]) != null && T.length) && !0, s.dbdefault = zn((N = (f = _.default) == null ? void 0 : f.at(0)) == null ? void 0 : N.value);
3035
3035
  const K = (g = _.note) == null ? void 0 : g.at(0);
3036
3036
  s.note = K && {
3037
- value: z(K.value).map(Ee).unwrap(),
3038
- token: y(K)
3037
+ value: z(K.value).map(Ne).unwrap(),
3038
+ token: v(K)
3039
3039
  };
3040
- const Ie = _.ref || [];
3041
- s.inline_refs = Ie.flatMap((Y) => {
3040
+ const oe = _.ref || [];
3041
+ s.inline_refs = oe.flatMap((Y) => {
3042
3042
  const [nt] = $e(Y.value.expression);
3043
3043
  if (Dt(nt, e.symbol))
3044
3044
  return n.push(new l(o.SAME_ENDPOINT, "Two endpoints are the same", Y)), [];
3045
3045
  const ye = Y.value.op, ee = C(Y.value.expression).unwrap();
3046
- let fe;
3046
+ let pe;
3047
3047
  if (ee.length === 1) {
3048
- const [oe] = ee;
3049
- fe = {
3048
+ const [ce] = ee;
3049
+ pe = {
3050
3050
  schemaName: this.table.schemaName,
3051
3051
  tableName: this.table.name,
3052
- fieldNames: [oe],
3052
+ fieldNames: [ce],
3053
3053
  relation: ye.value,
3054
- token: y(Y)
3054
+ token: v(Y)
3055
3055
  };
3056
3056
  } else if (ee.length === 2) {
3057
- const [oe, Le] = ee;
3058
- fe = {
3057
+ const [ce, Le] = ee;
3058
+ pe = {
3059
3059
  schemaName: null,
3060
- tableName: oe,
3060
+ tableName: ce,
3061
3061
  fieldNames: [Le],
3062
3062
  relation: ye.value,
3063
- token: y(Y)
3063
+ token: v(Y)
3064
3064
  };
3065
3065
  } else if (ee.length === 3) {
3066
- const [oe, Le, it] = ee;
3067
- fe = {
3068
- schemaName: oe,
3066
+ const [ce, Le, it] = ee;
3067
+ pe = {
3068
+ schemaName: ce,
3069
3069
  tableName: Le,
3070
3070
  fieldNames: [it],
3071
3071
  relation: ye.value,
3072
- token: y(Y)
3072
+ token: v(Y)
3073
3073
  };
3074
3074
  } else {
3075
3075
  n.push(new l(o.UNSUPPORTED, "Nested schema is not supported", Y));
3076
- const oe = ee.pop(), Le = ee.pop();
3077
- fe = {
3076
+ const ce = ee.pop(), Le = ee.pop();
3077
+ pe = {
3078
3078
  schemaName: ee.join("."),
3079
3079
  tableName: Le,
3080
- fieldNames: [oe],
3080
+ fieldNames: [ce],
3081
3081
  relation: ye.value,
3082
- token: y(Y)
3082
+ token: v(Y)
3083
3083
  };
3084
3084
  }
3085
- const st = this.registerInlineRefToEnv(e, nt, fe, Y);
3086
- return n.push(...st), st.length === 0 ? fe : [];
3085
+ const st = this.registerInlineRefToEnv(e, nt, pe, Y);
3086
+ return n.push(...st), st.length === 0 ? pe : [];
3087
3087
  });
3088
3088
  }
3089
3089
  return s.pk || (s.pk = r.some((_) => X(_).unwrap().toLowerCase() === "pk")), s.unique || (s.unique = r.some((_) => X(_).unwrap().toLowerCase() === "unique")), this.table.fields.push(s), s.pk && this.pkColumns.push(s), n;
@@ -3092,7 +3092,7 @@ class Pt {
3092
3092
  return this.table.indexes.push(...e.body.body.map((n) => {
3093
3093
  var a, c, p, h, T, f, N;
3094
3094
  const s = { columns: [] }, i = n;
3095
- s.token = y(e);
3095
+ s.token = v(e);
3096
3096
  const r = [i.callee, ...i.args];
3097
3097
  if (I.last(r) instanceof D) {
3098
3098
  const g = j(r.pop()).getValue();
@@ -3100,7 +3100,7 @@ class Pt {
3100
3100
  const _ = (T = g.note) == null ? void 0 : T.at(0);
3101
3101
  s.note = _ && {
3102
3102
  value: z(_.value).unwrap(),
3103
- token: y(_)
3103
+ token: v(_)
3104
3104
  }, s.type = X((N = (f = g.type) == null ? void 0 : f.at(0)) == null ? void 0 : N.value).unwrap_or(void 0);
3105
3105
  }
3106
3106
  return r.flatMap((g) => {
@@ -3113,13 +3113,15 @@ class Pt {
3113
3113
  }).forEach((g) => {
3114
3114
  const { functional: _, nonFunctional: K } = Xe(g).unwrap();
3115
3115
  s.columns.push(
3116
- ..._.map((Ie) => ({
3117
- value: Ie.value.value,
3118
- type: "expression"
3116
+ ..._.map((oe) => ({
3117
+ value: oe.value.value,
3118
+ type: "expression",
3119
+ token: v(oe)
3119
3120
  })),
3120
- ...K.map((Ie) => ({
3121
- value: V(Ie).unwrap(),
3122
- type: "column"
3121
+ ...K.map((oe) => ({
3122
+ value: V(oe).unwrap(),
3123
+ type: "column",
3124
+ token: v(oe)
3123
3125
  }))
3124
3126
  );
3125
3127
  }), s;
@@ -3146,7 +3148,7 @@ class Pt {
3146
3148
  schemaName: this.table.schemaName,
3147
3149
  tableName: this.table.name,
3148
3150
  fieldNames: [X(e.callee).unwrap()],
3149
- token: y(e),
3151
+ token: v(e),
3150
3152
  relation: a[0]
3151
3153
  }
3152
3154
  ]
@@ -3155,11 +3157,11 @@ class Pt {
3155
3157
  }
3156
3158
  function Yn(t) {
3157
3159
  let e = null;
3158
- t instanceof H && (e = t.argumentList.elementList.map((r) => ue(r) ? r.expression.literal.value : W(r) ? z(r).unwrap() : X(r).unwrap()).join(","), t = t.callee);
3160
+ t instanceof H && (e = t.argumentList.elementList.map((r) => he(r) ? r.expression.literal.value : W(r) ? z(r).unwrap() : X(r).unwrap()).join(","), t = t.callee);
3159
3161
  let n = "";
3160
- for (; t instanceof le; )
3162
+ for (; t instanceof ue; )
3161
3163
  n = `[${t.indexer.elementList.map((r) => r.name.expression.literal.value).join(",")}]${n}`, t = t.array;
3162
- const { name: s, schemaName: i } = be(t);
3164
+ const { name: s, schemaName: i } = Ie(t);
3163
3165
  return i.length > 1 ? new B(
3164
3166
  {
3165
3167
  schemaName: i.length === 0 ? null : i[0],
@@ -3181,17 +3183,17 @@ function zn(t) {
3181
3183
  value: z(t).unwrap(),
3182
3184
  type: "string"
3183
3185
  };
3184
- if (ue(t))
3186
+ if (he(t))
3185
3187
  return {
3186
3188
  type: "number",
3187
3189
  value: Number.parseFloat(t.expression.literal.value)
3188
3190
  };
3189
- if (Ne(t))
3191
+ if (me(t))
3190
3192
  return {
3191
3193
  value: t.expression.variable.value.toLowerCase(),
3192
3194
  type: "boolean"
3193
3195
  };
3194
- if (t instanceof Q && wt.includes((e = t.op) == null ? void 0 : e.value) && ue(t.expression)) {
3196
+ if (t instanceof Q && wt.includes((e = t.op) == null ? void 0 : e.value) && he(t.expression)) {
3195
3197
  const i = Number.parseFloat(t.expression.expression.literal.value);
3196
3198
  return {
3197
3199
  value: ((n = t.op) == null ? void 0 : n.value) === "-" ? 0 - i : i,
@@ -3211,14 +3213,14 @@ class Qn {
3211
3213
  this.declarationNode = e, this.env = n, this.note = { name: void 0, content: void 0, token: void 0 };
3212
3214
  }
3213
3215
  interpret() {
3214
- return this.note.token = y(this.declarationNode), this.env.notes.set(this.declarationNode, this.note), [
3216
+ return this.note.token = v(this.declarationNode), this.env.notes.set(this.declarationNode, this.note), [
3215
3217
  ...this.interpretName(this.declarationNode.name),
3216
3218
  ...this.interpretSettingList(this.declarationNode.attributeList),
3217
3219
  ...this.interpretBody(this.declarationNode.body)
3218
3220
  ];
3219
3221
  }
3220
3222
  interpretName(e) {
3221
- const { name: n } = be(e);
3223
+ const { name: n } = Ie(e);
3222
3224
  return this.note.name = n, [];
3223
3225
  }
3224
3226
  interpretSettingList(e) {
@@ -3227,14 +3229,14 @@ class Qn {
3227
3229
  return this.note.headerColor = (s = n.headercolor) != null && s.length ? Ot((r = (i = n.headercolor) == null ? void 0 : i.at(0)) == null ? void 0 : r.value) : void 0, [];
3228
3230
  }
3229
3231
  interpretBody(e) {
3230
- const [n, s] = I.partition(e.body, (i) => i instanceof w);
3232
+ const [n, s] = I.partition(e.body, (i) => i instanceof y);
3231
3233
  return n.length !== 1 || s.length > 0 ? [
3232
3234
  new l(o.INVALID_NOTE, "Invalid note syntax", e)
3233
3235
  ] : [...this.interpretNote(n[0])];
3234
3236
  }
3235
3237
  interpretNote(e) {
3236
3238
  const n = I.get(e, "callee.expression.literal.value", "");
3237
- return this.note.content = Ee(n), [];
3239
+ return this.note.content = Ne(n), [];
3238
3240
  }
3239
3241
  }
3240
3242
  class Ut {
@@ -3242,14 +3244,14 @@ class Ut {
3242
3244
  this.declarationNode = e, this.env = n, this.container = this.declarationNode.parent instanceof A ? this.env.tables.get(this.declarationNode.parent) : void 0, this.ref = {};
3243
3245
  }
3244
3246
  interpret() {
3245
- return this.ref.token = y(this.declarationNode), this.env.ref.set(this.declarationNode, this.ref), [...this.interpretName(this.declarationNode.name), ...this.interpretBody(this.declarationNode.body)];
3247
+ return this.ref.token = v(this.declarationNode), this.env.ref.set(this.declarationNode, this.ref), [...this.interpretName(this.declarationNode.name), ...this.interpretBody(this.declarationNode.body)];
3246
3248
  }
3247
3249
  interpretName(e) {
3248
3250
  const n = [], s = C(this.declarationNode.name).unwrap_or([]);
3249
3251
  return this.ref.name = s.pop() || null, s.length > 1 && n.push(new l(o.UNSUPPORTED, "Nested schema is not supported", this.declarationNode.name)), this.ref.schemaName = s.join(".") || null, n;
3250
3252
  }
3251
3253
  interpretBody(e) {
3252
- return e instanceof w ? this.interpretField(e) : this.interpretField(e.body[0]);
3254
+ return e instanceof y ? this.interpretField(e) : this.interpretField(e.body[0]);
3253
3255
  }
3254
3256
  interpretField(e) {
3255
3257
  var h, T, f, N;
@@ -3264,21 +3266,21 @@ class Ut {
3264
3266
  ];
3265
3267
  if (e.args[0]) {
3266
3268
  const g = j(e.args[0]).getValue(), _ = (T = (h = g.delete) == null ? void 0 : h.at(0)) == null ? void 0 : T.value;
3267
- this.ref.onDelete = _ instanceof $ ? me(_).unwrap_or(void 0) : X(_).unwrap_or(void 0);
3269
+ this.ref.onDelete = _ instanceof $ ? Te(_).unwrap_or(void 0) : X(_).unwrap_or(void 0);
3268
3270
  const K = (N = (f = g.update) == null ? void 0 : f.at(0)) == null ? void 0 : N.value;
3269
- this.ref.onUpdate = K instanceof $ ? me(K).unwrap_or(void 0) : X(K).unwrap_or(void 0);
3271
+ this.ref.onUpdate = K instanceof $ ? Te(K).unwrap_or(void 0) : X(K).unwrap_or(void 0);
3270
3272
  }
3271
3273
  const p = St(n);
3272
3274
  return this.ref.endpoints = [
3273
3275
  {
3274
3276
  ...pt(s, this.container),
3275
3277
  relation: p[0],
3276
- token: y(s)
3278
+ token: v(s)
3277
3279
  },
3278
3280
  {
3279
3281
  ...pt(i, this.container),
3280
3282
  relation: p[1],
3281
- token: y(i)
3283
+ token: v(i)
3282
3284
  }
3283
3285
  ], this.env.refIds[c] = this.declarationNode, [];
3284
3286
  }
@@ -3289,13 +3291,13 @@ class Mt {
3289
3291
  }
3290
3292
  interpret() {
3291
3293
  const e = [];
3292
- return this.tableGroup.token = y(this.declarationNode), this.env.tableGroups.set(this.declarationNode, this.tableGroup), e.push(
3294
+ return this.tableGroup.token = v(this.declarationNode), this.env.tableGroups.set(this.declarationNode, this.tableGroup), e.push(
3293
3295
  ...this.interpretName(this.declarationNode.name),
3294
3296
  ...this.interpretBody(this.declarationNode.body)
3295
3297
  ), e;
3296
3298
  }
3297
3299
  interpretName(e) {
3298
- const n = [], { name: s, schemaName: i } = be(e);
3300
+ const n = [], { name: s, schemaName: i } = Ie(e);
3299
3301
  return i.length >= 2 && (this.tableGroup.name = s, this.tableGroup.schemaName = i.join("."), n.push(new l(o.UNSUPPORTED, "Nested schema is not supported", this.declarationNode.name))), this.tableGroup.name = s, this.tableGroup.schemaName = i[0] || null, n;
3300
3302
  }
3301
3303
  interpretBody(e) {
@@ -3303,7 +3305,7 @@ class Mt {
3303
3305
  return this.tableGroup.tables = this.declarationNode.body.body.map((s) => {
3304
3306
  const i = C(s.callee).unwrap();
3305
3307
  i.length > 2 && n.push(new l(o.UNSUPPORTED, "Nested schema is not supported", s));
3306
- const r = he(s.callee).unwrap().pop().referee.id;
3308
+ const r = fe(s.callee).unwrap().pop().referee.id;
3307
3309
  if (this.env.groupOfTable[r]) {
3308
3310
  const a = this.env.groupOfTable[r], { schemaName: c, name: p } = this.env.tableGroups.get(a), h = c ? `${c}.${p}` : p;
3309
3311
  n.push(new l(o.TABLE_REAPPEAR_IN_TABLEGROUP, `Table "${i.join(".")}" already appears in group "${h}"`, s));
@@ -3321,21 +3323,21 @@ class Ft {
3321
3323
  this.declarationNode = e, this.env = n, this.enum = { values: [] };
3322
3324
  }
3323
3325
  interpret() {
3324
- return this.enum.token = y(this.declarationNode), this.env.enums.set(this.declarationNode, this.enum), [...this.interpretName(this.declarationNode.name), ...this.interpretBody(this.declarationNode.body)];
3326
+ return this.enum.token = v(this.declarationNode), this.env.enums.set(this.declarationNode, this.enum), [...this.interpretName(this.declarationNode.name), ...this.interpretBody(this.declarationNode.body)];
3325
3327
  }
3326
3328
  interpretName(e) {
3327
- const { name: n, schemaName: s } = be(e);
3329
+ const { name: n, schemaName: s } = Ie(e);
3328
3330
  return s.length > 1 ? (this.enum.name = n, this.enum.schemaName = s.join("."), [new l(o.UNSUPPORTED, "Nested schema is not supported", e)]) : (this.enum.name = n, this.enum.schemaName = s.length ? s[0] : null, []);
3329
3331
  }
3330
3332
  interpretBody(e) {
3331
3333
  return e.body.flatMap((n) => {
3332
3334
  var c;
3333
3335
  const s = n, i = {};
3334
- i.token = y(s), i.name = X(s.callee).unwrap();
3336
+ i.token = v(s), i.name = X(s.callee).unwrap();
3335
3337
  const a = (c = j(s.args[0]).getValue().note) == null ? void 0 : c.at(0);
3336
3338
  return i.note = a && {
3337
- value: z(a.value).map(Ee).unwrap(),
3338
- token: y(a)
3339
+ value: z(a.value).map(Ne).unwrap(),
3340
+ token: v(a)
3339
3341
  }, this.enum.values.push(i), [];
3340
3342
  });
3341
3343
  }
@@ -3345,12 +3347,12 @@ class qn {
3345
3347
  this.declarationNode = e, this.env = n, this.project = { enums: [], refs: [], tableGroups: [], tables: [] };
3346
3348
  }
3347
3349
  interpret() {
3348
- return this.env.project.set(this.declarationNode, this.project), this.project.token = y(this.declarationNode), [...this.interpretName(this.declarationNode.name), ...this.interpretBody(this.declarationNode.body)];
3350
+ return this.env.project.set(this.declarationNode, this.project), this.project.token = v(this.declarationNode), [...this.interpretName(this.declarationNode.name), ...this.interpretBody(this.declarationNode.body)];
3349
3351
  }
3350
3352
  interpretName(e) {
3351
3353
  if (!e)
3352
3354
  return this.project.name = null, [];
3353
- const { name: n } = be(e);
3355
+ const { name: n } = Ie(e);
3354
3356
  return this.project.name = n, [];
3355
3357
  }
3356
3358
  interpretBody(e) {
@@ -3376,8 +3378,8 @@ class qn {
3376
3378
  }
3377
3379
  case "note":
3378
3380
  return this.project.note = {
3379
- value: z(s.body instanceof ne ? s.body.body[0].callee : s.body.callee).map(Ee).unwrap(),
3380
- token: y(s)
3381
+ value: z(s.body instanceof ne ? s.body.body[0].callee : s.body.callee).map(Ne).unwrap(),
3382
+ token: v(s)
3381
3383
  }, [];
3382
3384
  default:
3383
3385
  return this.project[s.type.value.toLowerCase()] = z(s.body.callee).unwrap(), [];
@@ -3551,7 +3553,7 @@ class Bt {
3551
3553
  return Et(this.compiler, s, N);
3552
3554
  if (N instanceof J)
3553
3555
  return Zn(this.compiler, s);
3554
- if (N instanceof w)
3556
+ if (N instanceof y)
3555
3557
  return mt(this.compiler, s, N);
3556
3558
  if (N instanceof A && (N.bodyColon && s >= N.bodyColon.end || N.body && ge(s, N.body)))
3557
3559
  return mt(this.compiler, s, void 0);
@@ -3629,7 +3631,7 @@ function Et(t, e, n) {
3629
3631
  const i = Kn(
3630
3632
  t,
3631
3633
  e,
3632
- me(n.name).unwrap()
3634
+ Te(n.name).unwrap()
3633
3635
  );
3634
3636
  return (s == null ? void 0 : s.kind) === u.COLON && Re(s, e) ? De(i) : i;
3635
3637
  }
@@ -3761,7 +3763,7 @@ function Kn(t, e, n) {
3761
3763
  return O();
3762
3764
  }
3763
3765
  function Vt(t, e, n) {
3764
- const s = he(n).unwrap_or([]);
3766
+ const s = fe(n).unwrap_or([]);
3765
3767
  if (s.pop(), s.some((r) => !M(r)))
3766
3768
  return O();
3767
3769
  const i = s.map((r) => X(r).unwrap());
@@ -3992,7 +3994,7 @@ class Xt {
3992
3994
  const { uri: s } = e, i = et(e, n), r = [...this.compiler.container.stack(i)];
3993
3995
  for (; r.length !== 0; ) {
3994
3996
  const c = r.pop();
3995
- if ((a = c == null ? void 0 : c.referee) != null && a.declaration && [de.PRIMARY_EXPRESSION, de.VARIABLE].includes(c == null ? void 0 : c.kind)) {
3997
+ if ((a = c == null ? void 0 : c.referee) != null && a.declaration && [Ee.PRIMARY_EXPRESSION, Ee.VARIABLE].includes(c == null ? void 0 : c.kind)) {
3996
3998
  const { startPos: p, endPos: h } = c.referee.declaration;
3997
3999
  return [
3998
4000
  {
@@ -4019,9 +4021,9 @@ class $t {
4019
4021
  for (; r.length !== 0; ) {
4020
4022
  const a = r.pop();
4021
4023
  if (a && [
4022
- de.ELEMENT_DECLARATION,
4023
- de.FUNCTION_APPLICATION,
4024
- de.PRIMARY_EXPRESSION
4024
+ Ee.ELEMENT_DECLARATION,
4025
+ Ee.FUNCTION_APPLICATION,
4026
+ Ee.PRIMARY_EXPRESSION
4025
4027
  ].includes(a == null ? void 0 : a.kind)) {
4026
4028
  const { symbol: c } = a;
4027
4029
  if (c != null && c.references.length)
@@ -4116,7 +4118,7 @@ class ls {
4116
4118
  for (; c.length > 0; ) {
4117
4119
  let p = !1;
4118
4120
  const h = I.last(c);
4119
- if (h instanceof w) {
4121
+ if (h instanceof y) {
4120
4122
  const T = this.parse.source();
4121
4123
  for (let f = h.end; f < e; f += 1)
4122
4124
  T[f] === `