@dbml/parse 3.4.1 → 3.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -137,12 +137,12 @@ class se extends x {
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 x {
140
+ class Q extends x {
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 x {
145
+ class q extends x {
146
146
  constructor({
147
147
  op: e,
148
148
  leftExpression: n,
@@ -175,7 +175,7 @@ class ne extends x {
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 x {
178
+ class D extends x {
179
179
  constructor({
180
180
  listOpenBracket: e,
181
181
  elementList: n = [],
@@ -189,7 +189,7 @@ class P extends x {
189
189
  ]), this.listOpenBracket = e, this.elementList = n, this.commaList = s, this.listCloseBracket = i;
190
190
  }
191
191
  }
192
- class Z extends x {
192
+ class J extends x {
193
193
  constructor({
194
194
  tupleOpenParen: e,
195
195
  elementList: n = [],
@@ -203,7 +203,7 @@ class Z extends x {
203
203
  ]), this.tupleOpenParen = e, this.elementList = n, this.commaList = s, this.tupleCloseParen = i;
204
204
  }
205
205
  }
206
- class je extends Z {
206
+ class je extends J {
207
207
  constructor({
208
208
  groupOpenParen: e,
209
209
  expression: n,
@@ -220,7 +220,7 @@ class je extends Z {
220
220
  ), this.kind = "<group-expression>";
221
221
  }
222
222
  }
223
- class J extends x {
223
+ class H extends x {
224
224
  constructor({
225
225
  callee: e,
226
226
  argumentList: n
@@ -233,12 +233,12 @@ class Te extends x {
233
233
  super(n, "<literal>", [e]), this.literal = e;
234
234
  }
235
235
  }
236
- class W extends x {
236
+ class Z extends x {
237
237
  constructor({ variable: e }, n) {
238
238
  super(n, "<variable>", [e]), this.variable = e;
239
239
  }
240
240
  }
241
- class D extends x {
241
+ class U extends x {
242
242
  constructor({ expression: e }, n) {
243
243
  super(n, "<primary-expression>", [e]), this.expression = e;
244
244
  }
@@ -503,7 +503,7 @@ function sn(t, e, n) {
503
503
  const s = [...e], i = Ge(t).unwrap(), r = s.pop();
504
504
  if (!(r instanceof ne))
505
505
  return new v();
506
- const a = I.last(s) instanceof P ? s.pop() : void 0;
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, {
509
509
  type: i,
@@ -544,27 +544,27 @@ function an(t) {
544
544
  t.identifiers.forEach(E);
545
545
  else if (t instanceof se)
546
546
  E(t.name), E(t.colon), E(t.value);
547
- else if (t instanceof q)
547
+ else if (t instanceof Q)
548
548
  E(t.op), E(t.expression);
549
- else if (t instanceof H)
549
+ else if (t instanceof q)
550
550
  E(t.leftExpression), E(t.op), E(t.rightExpression);
551
551
  else if (t instanceof Pe)
552
552
  E(t.op), E(t.expression);
553
553
  else if (t instanceof ne)
554
554
  E(t.blockOpenBrace), t.body.forEach(E), E(t.blockCloseBrace);
555
- else if (t instanceof P)
555
+ else if (t instanceof D)
556
556
  E(t.listOpenBracket), t.commaList.forEach(E), t.elementList.forEach(E), E(t.listCloseBracket);
557
- else if (t instanceof Z)
558
- E(t.tupleOpenParen), t.commaList.forEach(E), t.elementList.forEach(E), E(t.tupleCloseParen);
559
557
  else if (t instanceof J)
558
+ E(t.tupleOpenParen), t.commaList.forEach(E), t.elementList.forEach(E), E(t.tupleCloseParen);
559
+ else if (t instanceof H)
560
560
  E(t.callee), E(t.argumentList);
561
561
  else if (t instanceof w)
562
562
  E(t.callee), t.args.forEach(E);
563
- else if (t instanceof D)
563
+ else if (t instanceof U)
564
564
  E(t.expression);
565
565
  else if (t instanceof te)
566
566
  E(t.value);
567
- else if (t instanceof W)
567
+ else if (t instanceof Z)
568
568
  E(t.variable);
569
569
  else if (t instanceof Te)
570
570
  E(t.literal);
@@ -574,14 +574,14 @@ function an(t) {
574
574
  function vt(t) {
575
575
  return !!(t != null && t.isInvalid);
576
576
  }
577
- function U(...t) {
577
+ function P(...t) {
578
578
  return t.filter((e) => e !== void 0);
579
579
  }
580
580
  function on(t) {
581
581
  if (t instanceof G)
582
- return U(...t.body, t.eof);
582
+ return P(...t.body, t.eof);
583
583
  if (t instanceof A)
584
- return U(
584
+ return P(
585
585
  t.type,
586
586
  t.name,
587
587
  t.as,
@@ -591,43 +591,43 @@ function on(t) {
591
591
  t.body
592
592
  );
593
593
  if (t instanceof se)
594
- return U(t.name, t.colon, t.value);
594
+ return P(t.name, t.colon, t.value);
595
595
  if (t instanceof $)
596
596
  return t.identifiers;
597
597
  if (t instanceof Te)
598
598
  return t.literal ? [t.literal] : [];
599
- if (t instanceof W)
600
- return U(t.variable);
599
+ if (t instanceof Z)
600
+ return P(t.variable);
601
+ if (t instanceof Q)
602
+ return P(t.op, t.expression);
601
603
  if (t instanceof q)
602
- return U(t.op, t.expression);
603
- if (t instanceof H)
604
- return U(t.leftExpression, t.op, t.rightExpression);
604
+ return P(t.leftExpression, t.op, t.rightExpression);
605
605
  if (t instanceof Pe)
606
- return U(t.expression, t.op);
606
+ return P(t.expression, t.op);
607
607
  if (t instanceof te)
608
- return U(t.value);
608
+ return P(t.value);
609
609
  if (t instanceof w)
610
- return U(t.callee, ...t.args);
610
+ return P(t.callee, ...t.args);
611
611
  if (t instanceof ne)
612
- return U(t.blockOpenBrace, ...t.body, t.blockCloseBrace);
613
- if (t instanceof P)
614
- return U(
612
+ return P(t.blockOpenBrace, ...t.body, t.blockCloseBrace);
613
+ if (t instanceof D)
614
+ return P(
615
615
  t.listOpenBracket,
616
616
  ...ct(t.elementList, t.commaList),
617
617
  t.listCloseBracket
618
618
  );
619
- if (t instanceof Z)
620
- return U(
619
+ if (t instanceof J)
620
+ return P(
621
621
  t.tupleOpenParen,
622
622
  ...ct(t.elementList, t.commaList),
623
623
  t.tupleCloseParen
624
624
  );
625
- if (t instanceof J)
626
- return U(t.callee, t.argumentList);
627
- if (t instanceof D)
628
- return U(t.expression);
625
+ if (t instanceof H)
626
+ return P(t.callee, t.argumentList);
627
+ if (t instanceof U)
628
+ return P(t.expression);
629
629
  if (t instanceof le)
630
- return U(
630
+ return P(
631
631
  t.array,
632
632
  t.indexer
633
633
  );
@@ -636,20 +636,20 @@ function on(t) {
636
636
  function Ge(t) {
637
637
  return M(t) ? new S(t.expression.variable) : new v();
638
638
  }
639
- function Y(t) {
639
+ function W(t) {
640
640
  var e;
641
- return t instanceof D && (t.expression instanceof W && 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 Te && ((e = t.expression.literal) == null ? void 0 : e.kind) === u.STRING_LITERAL);
642
642
  }
643
643
  function M(t) {
644
- return t instanceof D && t.expression instanceof W && t.expression.variable instanceof F;
644
+ return t instanceof U && t.expression instanceof Z && t.expression.variable instanceof F;
645
645
  }
646
646
  function Ne(t) {
647
647
  var e;
648
- return t instanceof D && t.expression instanceof W && ((e = t.expression.variable) == null ? void 0 : e.kind) === u.IDENTIFIER;
648
+ return t instanceof U && t.expression instanceof Z && ((e = t.expression.variable) == null ? void 0 : e.kind) === u.IDENTIFIER;
649
649
  }
650
650
  function Je(t) {
651
651
  var e;
652
- return t instanceof H && t.leftExpression instanceof x && t.rightExpression instanceof x && ((e = t.op) == null ? void 0 : e.value) === ".";
652
+ return t instanceof q && t.leftExpression instanceof x && t.rightExpression instanceof x && ((e = t.op) == null ? void 0 : e.value) === ".";
653
653
  }
654
654
  function me(t) {
655
655
  if (t === void 0)
@@ -1124,7 +1124,7 @@ class hn {
1124
1124
  groupOpenParen: s.tupleOpenParen,
1125
1125
  groupCloseParen: s.tupleCloseParen,
1126
1126
  expression: s.elementList[0]
1127
- }), r = () => this.nodeFactory.create(Z, s);
1127
+ }), r = () => this.nodeFactory.create(J, s);
1128
1128
  try {
1129
1129
  this.consume("Expect an opening parenthesis '('", u.LPAREN), s.tupleOpenParen = this.previous();
1130
1130
  } catch (a) {
@@ -1172,7 +1172,7 @@ class hn {
1172
1172
  E(s), this.advance();
1173
1173
  }
1174
1174
  }, this.listExpression = this.contextStack.withContextDo(xe.ListExpression, () => {
1175
- const s = { elementList: [], commaList: [] }, i = () => this.nodeFactory.create(P, s);
1175
+ const s = { elementList: [], commaList: [] }, i = () => this.nodeFactory.create(D, s);
1176
1176
  try {
1177
1177
  this.consume("Expect an opening bracket '['", u.LBRACKET), s.listOpenBracket = this.previous();
1178
1178
  } catch (r) {
@@ -1432,12 +1432,12 @@ class hn {
1432
1432
  ot(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(H, {
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(H, {
1441
1441
  callee: n,
1442
1442
  argumentList: r.partialNode
1443
1443
  }), new d(r.token, n, r.handlerContext)) : r;
@@ -1471,13 +1471,13 @@ class hn {
1471
1471
  break;
1472
1472
  this.advance();
1473
1473
  try {
1474
- n = this.nodeFactory.create(H, {
1474
+ n = this.nodeFactory.create(q, {
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 (c) {
1480
- throw c instanceof d ? (n = this.nodeFactory.create(H, {
1480
+ throw c instanceof d ? (n = this.nodeFactory.create(q, {
1481
1481
  leftExpression: n,
1482
1482
  op: i,
1483
1483
  rightExpression: c.partialNode
@@ -1511,11 +1511,11 @@ class hn {
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(Q, n),
1515
1515
  i.handlerContext
1516
1516
  )) : i;
1517
1517
  }
1518
- e = this.nodeFactory.create(q, n);
1518
+ e = this.nodeFactory.create(Q, n);
1519
1519
  } else if (e = this.extractOperand(), e instanceof ke)
1520
1520
  throw new d(
1521
1521
  this.peek(),
@@ -1569,18 +1569,16 @@ class hn {
1569
1569
  u.STRING_LITERAL,
1570
1570
  u.NUMERIC_LITERAL
1571
1571
  ))
1572
- return this.nodeFactory.create(D, {
1572
+ return this.nodeFactory.create(U, {
1573
1573
  expression: this.nodeFactory.create(Te, { literal: this.previous() })
1574
1574
  });
1575
1575
  if (this.match(u.QUOTED_STRING, u.IDENTIFIER))
1576
- return this.nodeFactory.create(D, {
1577
- expression: this.nodeFactory.create(W, { variable: this.previous() })
1576
+ return this.nodeFactory.create(U, {
1577
+ expression: this.nodeFactory.create(Z, { 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(),
1581
- this.nodeFactory.create(D, {
1582
- expression: this.nodeFactory.create(W, {})
1583
- }),
1581
+ void 0,
1584
1582
  this.contextStack.findHandlerContext(this.tokens, this.current)
1585
1583
  );
1586
1584
  }
@@ -1748,7 +1746,7 @@ function X(t) {
1748
1746
  function Xe(t) {
1749
1747
  if (ht(t))
1750
1748
  return t instanceof te ? new S({ functional: [t], nonFunctional: [] }) : new S({ functional: [], nonFunctional: [t] });
1751
- if (t instanceof Z && t.elementList.every(ht)) {
1749
+ if (t instanceof J && t.elementList.every(ht)) {
1752
1750
  const e = t.elementList.filter(
1753
1751
  (s) => s instanceof te
1754
1752
  ), n = t.elementList.filter(M);
@@ -1761,12 +1759,12 @@ function V(t) {
1761
1759
  const e = (n = t == null ? void 0 : t.expression.variable) == null ? void 0 : n.value;
1762
1760
  return e === void 0 ? new v() : new S(e);
1763
1761
  }
1764
- function Q(t) {
1765
- return Y(t) ? t.expression instanceof W ? new S(t.expression.variable.value) : new S(t.expression.literal.value) : new v();
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();
1766
1764
  }
1767
1765
  function mn(t) {
1768
1766
  var e;
1769
- return !(t instanceof H) || !yt((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 q) || !yt((e = t.op) == null ? void 0 : e.value) ? !1 : _e(t.leftExpression).and_then(() => _e(t.rightExpression)).unwrap_or(void 0) !== void 0;
1770
1768
  }
1771
1769
  function Tn(t) {
1772
1770
  const e = _e(t.leftExpression), n = _e(t.rightExpression);
@@ -1776,7 +1774,7 @@ function Tn(t) {
1776
1774
  return (s == null ? void 0 : s.length) === (i == null ? void 0 : i.length);
1777
1775
  }
1778
1776
  function ht(t) {
1779
- return t instanceof D && t.expression instanceof W || t instanceof te;
1777
+ return t instanceof U && t.expression instanceof Z || t instanceof te;
1780
1778
  }
1781
1779
  function bn(t, e) {
1782
1780
  var i, r, a, c;
@@ -1817,7 +1815,7 @@ class In {
1817
1815
  if (e instanceof ne)
1818
1816
  return [new l(o.UNEXPECTED_COMPLEX_BODY, "A Custom element can only have an inline field", e)];
1819
1817
  const n = [];
1820
- return Y(e.callee) || n.push(new l(o.INVALID_CUSTOM_ELEMENT_VALUE, "A Custom element value can only be a string", e)), e.args.length > 0 && n.push(...e.args.map((s) => new l(o.INVALID_CUSTOM_ELEMENT_VALUE, "A Custom element value can only be a string", s))), n;
1818
+ return W(e.callee) || n.push(new l(o.INVALID_CUSTOM_ELEMENT_VALUE, "A Custom element value can only be a string", e)), e.args.length > 0 && n.push(...e.args.map((s) => new l(o.INVALID_CUSTOM_ELEMENT_VALUE, "A Custom element value can only be a string", s))), n;
1821
1819
  }
1822
1820
  }
1823
1821
  class we {
@@ -1879,7 +1877,7 @@ class Ln {
1879
1877
  const s = [];
1880
1878
  n.callee && !M(n.callee) && s.push(new l(o.INVALID_ENUM_ELEMENT_NAME, "An enum field must be an identifier or a quoted identifier", n.callee));
1881
1879
  const i = [...n.args];
1882
- 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 l(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 D ? (s.push(...this.validateFieldSettings(I.last(i))), i.pop()) : i[0] instanceof D && (s.push(...this.validateFieldSettings(i[0])), i.shift()), i.length > 0 && s.push(...i.map((r) => new l(o.INVALID_ENUM_ELEMENT, "An Enum must have only a field and optionally a setting list", r))), s.push(...this.registerField(n)), s;
1883
1881
  });
1884
1882
  }
1885
1883
  validateFieldSettings(e) {
@@ -1889,7 +1887,7 @@ class Ln {
1889
1887
  switch (r) {
1890
1888
  case "note":
1891
1889
  a.length > 1 && a.forEach((c) => s.push(new l(o.DUPLICATE_ENUM_ELEMENT_SETTING, "'note' can only appear once", c))), a.forEach((c) => {
1892
- Y(c.value) || s.push(new l(o.INVALID_ENUM_ELEMENT_SETTING, "'note' must be a string", c));
1890
+ W(c.value) || s.push(new l(o.INVALID_ENUM_ELEMENT_SETTING, "'note' must be a string", c));
1893
1891
  });
1894
1892
  break;
1895
1893
  default:
@@ -1955,8 +1953,8 @@ class gn {
1955
1953
  if (!n.callee)
1956
1954
  return [];
1957
1955
  const s = [], i = [n.callee, ...n.args];
1958
- return I.last(i) instanceof P && s.push(...this.validateFieldSetting(i.pop())), i.forEach((r) => {
1959
- for (; r instanceof J; )
1956
+ return I.last(i) instanceof D && s.push(...this.validateFieldSetting(i.pop())), i.forEach((r) => {
1957
+ for (; r instanceof H; )
1960
1958
  r.argumentList && !Xe(r.argumentList).isOk() && s.push(new l(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;
1961
1959
  Xe(r).isOk() || s.push(new l(o.INVALID_INDEXES_FIELD, "An index field must be an identifier, a quoted identifier, a functional expression or a tuple of such", r));
1962
1960
  }), s;
@@ -1970,7 +1968,7 @@ class gn {
1970
1968
  case "note":
1971
1969
  case "name":
1972
1970
  a.length > 1 && a.forEach((c) => s.push(new l(o.DUPLICATE_INDEX_SETTING, `'${r}' can only appear once`, c))), a.forEach((c) => {
1973
- Y(c.value) || s.push(new l(o.INVALID_INDEX_SETTING_VALUE, `'${r}' must be a string`, c));
1971
+ W(c.value) || s.push(new l(o.INVALID_INDEX_SETTING_VALUE, `'${r}' must be a string`, c));
1974
1972
  });
1975
1973
  break;
1976
1974
  case "unique":
@@ -2036,7 +2034,7 @@ class _n {
2036
2034
  }
2037
2035
  validateFields(e) {
2038
2036
  const n = [];
2039
- return e.length === 0 ? [new l(o.EMPTY_NOTE, "A Note must have a content", this.declarationNode)] : (e.length > 1 && e.slice(1).forEach((s) => n.push(new l(o.NOTE_CONTENT_REDEFINED, "A Note can only contain one string", s))), Y(e[0].callee) || n.push(new l(o.INVALID_NOTE, "A Note content must be a quoted string", e[0])), e[0].args.length > 0 && n.push(...e[0].args.map((s) => new l(o.INVALID_NOTE, "A Note can only contain one quoted string", s))), n);
2037
+ return e.length === 0 ? [new l(o.EMPTY_NOTE, "A Note must have a content", this.declarationNode)] : (e.length > 1 && e.slice(1).forEach((s) => n.push(new l(o.NOTE_CONTENT_REDEFINED, "A Note can only contain one string", s))), W(e[0].callee) || n.push(new l(o.INVALID_NOTE, "A Note content must be a quoted string", e[0])), e[0].args.length > 0 && n.push(...e[0].args.map((s) => new l(o.INVALID_NOTE, "A Note can only contain one quoted string", s))), n);
2040
2038
  }
2041
2039
  validateSubElements(e) {
2042
2040
  return e.flatMap((n) => {
@@ -2120,7 +2118,7 @@ class vn {
2120
2118
  return e.length > 1 && n.push(...e.slice(1).map((s) => new l(o.REF_REDEFINED, "A Ref can only contain one binary relationship", s))), e.forEach((s) => {
2121
2119
  s.callee && !mn(s.callee) && n.push(new l(o.INVALID_REF_FIELD, "A Ref field must be a binary relationship", s.callee)), s.callee && !Tn(s.callee) && n.push(new l(o.UNEQUAL_FIELDS_BINARY_REF, "Unequal fields in ref endpoints", s.callee));
2122
2120
  const i = [...s.args];
2123
- 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 l(o.INVALID_REF_FIELD, "A Ref field should only have a single binary relationship", r)));
2121
+ I.last(i) instanceof D ? (this.validateFieldSettings(I.last(i)), i.pop()) : i[0] instanceof D && (n.push(...this.validateFieldSettings(i[0])), i.shift()), i.length > 0 && n.push(...i.map((r) => new l(o.INVALID_REF_FIELD, "A Ref field should only have a single binary relationship", r)));
2124
2122
  }), n;
2125
2123
  }
2126
2124
  validateFieldSettings(e) {
@@ -2194,7 +2192,7 @@ class yn {
2194
2192
  break;
2195
2193
  case "note":
2196
2194
  a.length > 1 && s.push(...a.map((c) => new l(o.DUPLICATE_TABLE_SETTING, "'note' can only appear once", c))), a.forEach((c) => {
2197
- Y(c.value) || s.push(new l(o.INVALID_TABLE_SETTING, "'note' must be a string literal", c.value || c.name));
2195
+ W(c.value) || s.push(new l(o.INVALID_TABLE_SETTING, "'note' must be a string literal", c.value || c.name));
2198
2196
  });
2199
2197
  break;
2200
2198
  default:
@@ -2253,12 +2251,12 @@ class yn {
2253
2251
  }
2254
2252
  // This is needed to support legacy inline settings
2255
2253
  validateFieldSetting(e) {
2256
- if (!e.slice(0, -1).every(Ne) || !e.slice(-1).every((p) => Ne(p) || p instanceof P))
2254
+ if (!e.slice(0, -1).every(Ne) || !e.slice(-1).every((p) => Ne(p) || p instanceof D))
2257
2255
  return [...e.map((p) => new l(o.INVALID_COLUMN, "These fields must be some inline settings optionally ended with a setting list", p))];
2258
2256
  if (e.length === 0)
2259
2257
  return [];
2260
2258
  let n;
2261
- I.last(e) instanceof P && (n = e.pop());
2259
+ I.last(e) instanceof D && (n = e.pop());
2262
2260
  const s = j(n), i = s.getErrors(), r = s.getValue();
2263
2261
  for (const p of e) {
2264
2262
  const h = V(p).unwrap_or("").toLowerCase();
@@ -2275,7 +2273,7 @@ class yn {
2275
2273
  switch (p) {
2276
2274
  case "note":
2277
2275
  h.length > 1 && i.push(...h.map((f) => new l(o.DUPLICATE_COLUMN_SETTING, "note can only appear once", f))), h.forEach((f) => {
2278
- Y(f.value) || i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'note' must be a quoted string", f.value || f.name));
2276
+ W(f.value) || i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'note' must be a quoted string", f.value || f.name));
2279
2277
  });
2280
2278
  break;
2281
2279
  case "ref":
@@ -2340,10 +2338,10 @@ class yn {
2340
2338
  }
2341
2339
  }
2342
2340
  function kn(t) {
2343
- if (!(t instanceof J || Je(t) || t instanceof D || t instanceof le))
2341
+ if (!(t instanceof H || Je(t) || t instanceof U || t instanceof le))
2344
2342
  return !1;
2345
- if (t instanceof J) {
2346
- if (t.callee === void 0 || t.argumentList === void 0 || !t.argumentList.elementList.every((n) => ue(n) || Y(n) || Ne(n)))
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)))
2347
2345
  return !1;
2348
2346
  t = t.callee;
2349
2347
  }
@@ -2456,7 +2454,7 @@ function On(t) {
2456
2454
  return Me(t);
2457
2455
  }
2458
2456
  function Me(t) {
2459
- return t instanceof D && t.expression instanceof W;
2457
+ return t instanceof U && t.expression instanceof Z;
2460
2458
  }
2461
2459
  function Ke(t, e, n) {
2462
2460
  var i;
@@ -2482,7 +2480,7 @@ function yt(t) {
2482
2480
  }
2483
2481
  function Rn(t) {
2484
2482
  var n;
2485
- if (!(t instanceof D) || !(t.expression instanceof Te) || ((n = t.expression.literal) == null ? void 0 : n.kind) !== u.COLOR_LITERAL)
2483
+ if (!(t instanceof U) || !(t.expression instanceof Te) || ((n = t.expression.literal) == null ? void 0 : n.kind) !== u.COLOR_LITERAL)
2486
2484
  return !1;
2487
2485
  const e = t.expression.literal.value;
2488
2486
  if (e.length !== 4 && e.length !== 7 || e[0] !== "#")
@@ -2497,21 +2495,21 @@ function ce(t) {
2497
2495
  }
2498
2496
  function Dn(t) {
2499
2497
  var e;
2500
- return !!(Y(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) || 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);
2501
2499
  }
2502
2500
  function ue(t) {
2503
2501
  var e;
2504
- return t instanceof D && t.expression instanceof Te && ((e = t.expression.literal) == null ? void 0 : e.kind) === u.NUMERIC_LITERAL;
2502
+ return t instanceof U && t.expression instanceof Te && ((e = t.expression.literal) == null ? void 0 : e.kind) === u.NUMERIC_LITERAL;
2505
2503
  }
2506
2504
  function Pn(t) {
2507
2505
  var n;
2508
- if (!(t instanceof q) || !yt((n = t.op) == null ? void 0 : n.value))
2506
+ if (!(t instanceof Q) || !yt((n = t.op) == null ? void 0 : n.value))
2509
2507
  return !1;
2510
2508
  const e = C(t.expression).unwrap_or(void 0);
2511
2509
  return e !== void 0 && e.length > 0;
2512
2510
  }
2513
2511
  function kt(t) {
2514
- return t instanceof Z && t.elementList.every(M);
2512
+ return t instanceof J && t.elementList.every(M);
2515
2513
  }
2516
2514
  function j(t) {
2517
2515
  var s;
@@ -2521,7 +2519,7 @@ function j(t) {
2521
2519
  for (const i of t.elementList) {
2522
2520
  if (!i.name)
2523
2521
  continue;
2524
- if (i.name instanceof D) {
2522
+ if (i.name instanceof U) {
2525
2523
  n.push(new l(o.INVALID_SETTINGS, "A setting name must be a stream of identifiers", i.name));
2526
2524
  continue;
2527
2525
  }
@@ -2562,7 +2560,7 @@ class ae {
2562
2560
  bindSettingList(e, n) {
2563
2561
  if (e)
2564
2562
  for (const s of e.elementList) {
2565
- if (s.name instanceof D)
2563
+ if (s.name instanceof U)
2566
2564
  continue;
2567
2565
  const i = me(s.name).unwrap_or(void 0);
2568
2566
  if (!i)
@@ -2590,7 +2588,7 @@ class ae {
2590
2588
  }
2591
2589
  bindSubfield(e) {
2592
2590
  const n = [e.callee, ...e.args], s = I.last(n);
2593
- s instanceof P && (n.pop(), this.bindSettingList(s, this.subfield.settingList));
2591
+ s instanceof D && (n.pop(), this.bindSettingList(s, this.subfield.settingList));
2594
2592
  const { argBinderRules: i } = this.subfield.arg;
2595
2593
  for (let r = 0; r < Math.min(n.length, i.length); r += 1)
2596
2594
  i[r].shouldBind && this.scanAndBind(n[r], i[r]);
@@ -2599,12 +2597,12 @@ class ae {
2599
2597
  scanAndBind(e, n) {
2600
2598
  var s, i;
2601
2599
  if (e)
2602
- if (e instanceof D) {
2603
- if (e.expression instanceof W && ((i = n.keywords) != null && i.includes((s = e.expression.variable) == null ? void 0 : s.value.toLowerCase())))
2600
+ if (e instanceof U) {
2601
+ if (e.expression instanceof Z && ((i = n.keywords) != null && i.includes((s = e.expression.variable) == null ? void 0 : s.value.toLowerCase())))
2604
2602
  return;
2605
2603
  this.bindFragments([e], n);
2606
2604
  } else
2607
- e instanceof H ? 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 Z && e.elementList.forEach((r) => this.scanAndBind(r, n));
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));
2608
2606
  }
2609
2607
  // Bind the fragments of a member access expression
2610
2608
  // which can be a simple expression like v1.User,
@@ -2918,7 +2916,7 @@ function y(t) {
2918
2916
  function $e(t) {
2919
2917
  var n;
2920
2918
  const e = (n = he(t).unwrap_or(void 0)) == null ? void 0 : n.pop();
2921
- return e instanceof Z ? e.elementList.map((s) => s.referee) : [e.referee];
2919
+ return e instanceof J ? e.elementList.map((s) => s.referee) : [e.referee];
2922
2920
  }
2923
2921
  function be(t) {
2924
2922
  const e = C(t).unwrap();
@@ -2998,7 +2996,7 @@ class Pt {
2998
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;
2999
2997
  const [s] = n.note || [];
3000
2998
  return this.table.note = s && {
3001
- value: Q(s == null ? void 0 : s.value).map(Ee).unwrap(),
2999
+ value: z(s == null ? void 0 : s.value).map(Ee).unwrap(),
3002
3000
  token: y(s)
3003
3001
  }, [];
3004
3002
  }
@@ -3012,7 +3010,7 @@ class Pt {
3012
3010
  switch ((s = n.type) == null ? void 0 : s.value.toLowerCase()) {
3013
3011
  case "note":
3014
3012
  return this.table.note = {
3015
- value: Q(n.body instanceof ne ? n.body.body[0].callee : n.body.callee).map(Ee).unwrap(),
3013
+ value: z(n.body instanceof ne ? n.body.body[0].callee : n.body.callee).map(Ee).unwrap(),
3016
3014
  token: y(n)
3017
3015
  }, [];
3018
3016
  case "indexes":
@@ -3031,20 +3029,20 @@ class Pt {
3031
3029
  const i = Yn(e.args[0]);
3032
3030
  s.type = i.getValue(), n.push(...i.getErrors()), s.token = y(e), s.inline_refs = [];
3033
3031
  const r = e.args.slice(1);
3034
- if (I.last(r) instanceof P) {
3032
+ if (I.last(r) instanceof D) {
3035
3033
  const _ = j(r.pop()).getValue();
3036
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);
3037
3035
  const K = (g = _.note) == null ? void 0 : g.at(0);
3038
3036
  s.note = K && {
3039
- value: Q(K.value).map(Ee).unwrap(),
3037
+ value: z(K.value).map(Ee).unwrap(),
3040
3038
  token: y(K)
3041
3039
  };
3042
3040
  const Ie = _.ref || [];
3043
- s.inline_refs = Ie.flatMap((z) => {
3044
- const [nt] = $e(z.value.expression);
3041
+ s.inline_refs = Ie.flatMap((Y) => {
3042
+ const [nt] = $e(Y.value.expression);
3045
3043
  if (Dt(nt, e.symbol))
3046
- return n.push(new l(o.SAME_ENDPOINT, "Two endpoints are the same", z)), [];
3047
- const ye = z.value.op, ee = C(z.value.expression).unwrap();
3044
+ return n.push(new l(o.SAME_ENDPOINT, "Two endpoints are the same", Y)), [];
3045
+ const ye = Y.value.op, ee = C(Y.value.expression).unwrap();
3048
3046
  let fe;
3049
3047
  if (ee.length === 1) {
3050
3048
  const [oe] = ee;
@@ -3053,7 +3051,7 @@ class Pt {
3053
3051
  tableName: this.table.name,
3054
3052
  fieldNames: [oe],
3055
3053
  relation: ye.value,
3056
- token: y(z)
3054
+ token: y(Y)
3057
3055
  };
3058
3056
  } else if (ee.length === 2) {
3059
3057
  const [oe, Le] = ee;
@@ -3062,7 +3060,7 @@ class Pt {
3062
3060
  tableName: oe,
3063
3061
  fieldNames: [Le],
3064
3062
  relation: ye.value,
3065
- token: y(z)
3063
+ token: y(Y)
3066
3064
  };
3067
3065
  } else if (ee.length === 3) {
3068
3066
  const [oe, Le, it] = ee;
@@ -3071,20 +3069,20 @@ class Pt {
3071
3069
  tableName: Le,
3072
3070
  fieldNames: [it],
3073
3071
  relation: ye.value,
3074
- token: y(z)
3072
+ token: y(Y)
3075
3073
  };
3076
3074
  } else {
3077
- n.push(new l(o.UNSUPPORTED, "Nested schema is not supported", z));
3075
+ n.push(new l(o.UNSUPPORTED, "Nested schema is not supported", Y));
3078
3076
  const oe = ee.pop(), Le = ee.pop();
3079
3077
  fe = {
3080
3078
  schemaName: ee.join("."),
3081
3079
  tableName: Le,
3082
3080
  fieldNames: [oe],
3083
3081
  relation: ye.value,
3084
- token: y(z)
3082
+ token: y(Y)
3085
3083
  };
3086
3084
  }
3087
- const st = this.registerInlineRefToEnv(e, nt, fe, z);
3085
+ const st = this.registerInlineRefToEnv(e, nt, fe, Y);
3088
3086
  return n.push(...st), st.length === 0 ? fe : [];
3089
3087
  });
3090
3088
  }
@@ -3096,20 +3094,20 @@ class Pt {
3096
3094
  const s = { columns: [] }, i = n;
3097
3095
  s.token = y(e);
3098
3096
  const r = [i.callee, ...i.args];
3099
- if (I.last(r) instanceof P) {
3097
+ if (I.last(r) instanceof D) {
3100
3098
  const g = j(r.pop()).getValue();
3101
- s.pk = !!((a = g.pk) != null && a.length), s.unique = !!((c = g.unique) != null && c.length), s.name = Q((h = (p = g.name) == null ? void 0 : p.at(0)) == null ? void 0 : h.value).unwrap_or(void 0);
3099
+ s.pk = !!((a = g.pk) != null && a.length), s.unique = !!((c = g.unique) != null && c.length), s.name = z((h = (p = g.name) == null ? void 0 : p.at(0)) == null ? void 0 : h.value).unwrap_or(void 0);
3102
3100
  const _ = (T = g.note) == null ? void 0 : T.at(0);
3103
3101
  s.note = _ && {
3104
- value: Q(_.value).unwrap(),
3102
+ value: z(_.value).unwrap(),
3105
3103
  token: y(_)
3106
3104
  }, s.type = X((N = (f = g.type) == null ? void 0 : f.at(0)) == null ? void 0 : N.value).unwrap_or(void 0);
3107
3105
  }
3108
3106
  return r.flatMap((g) => {
3109
- if (!(g instanceof J))
3107
+ if (!(g instanceof H))
3110
3108
  return g;
3111
3109
  const _ = [];
3112
- for (; g instanceof J; )
3110
+ for (; g instanceof H; )
3113
3111
  _.push(g.argumentList), g = g.callee;
3114
3112
  return _.push(g), _;
3115
3113
  }).forEach((g) => {
@@ -3157,7 +3155,7 @@ class Pt {
3157
3155
  }
3158
3156
  function Yn(t) {
3159
3157
  let e = null;
3160
- t instanceof J && (e = t.argumentList.elementList.map((r) => ue(r) ? r.expression.literal.value : Y(r) ? Q(r).unwrap() : X(r).unwrap()).join(","), t = t.callee);
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);
3161
3159
  let n = "";
3162
3160
  for (; t instanceof le; )
3163
3161
  n = `[${t.indexer.elementList.map((r) => r.name.expression.literal.value).join(",")}]${n}`, t = t.array;
@@ -3178,9 +3176,9 @@ function Yn(t) {
3178
3176
  function zn(t) {
3179
3177
  var e, n, s;
3180
3178
  if (t) {
3181
- if (Y(t))
3179
+ if (W(t))
3182
3180
  return {
3183
- value: Q(t).unwrap(),
3181
+ value: z(t).unwrap(),
3184
3182
  type: "string"
3185
3183
  };
3186
3184
  if (ue(t))
@@ -3193,7 +3191,7 @@ function zn(t) {
3193
3191
  value: t.expression.variable.value.toLowerCase(),
3194
3192
  type: "boolean"
3195
3193
  };
3196
- if (t instanceof q && wt.includes((e = t.op) == null ? void 0 : e.value) && ue(t.expression)) {
3194
+ if (t instanceof Q && wt.includes((e = t.op) == null ? void 0 : e.value) && ue(t.expression)) {
3197
3195
  const i = Number.parseFloat(t.expression.expression.literal.value);
3198
3196
  return {
3199
3197
  value: ((n = t.op) == null ? void 0 : n.value) === "-" ? 0 - i : i,
@@ -3336,7 +3334,7 @@ class Ft {
3336
3334
  i.token = y(s), i.name = X(s.callee).unwrap();
3337
3335
  const a = (c = j(s.args[0]).getValue().note) == null ? void 0 : c.at(0);
3338
3336
  return i.note = a && {
3339
- value: Q(a.value).map(Ee).unwrap(),
3337
+ value: z(a.value).map(Ee).unwrap(),
3340
3338
  token: y(a)
3341
3339
  }, this.enum.values.push(i), [];
3342
3340
  });
@@ -3378,11 +3376,11 @@ class qn {
3378
3376
  }
3379
3377
  case "note":
3380
3378
  return this.project.note = {
3381
- value: Q(s.body instanceof ne ? s.body.body[0].callee : s.body.callee).map(Ee).unwrap(),
3379
+ value: z(s.body instanceof ne ? s.body.body[0].callee : s.body.callee).map(Ee).unwrap(),
3382
3380
  token: y(s)
3383
3381
  }, [];
3384
3382
  default:
3385
- return this.project[s.type.value.toLowerCase()] = Q(s.body.callee).unwrap(), [];
3383
+ return this.project[s.type.value.toLowerCase()] = z(s.body.callee).unwrap(), [];
3386
3384
  }
3387
3385
  });
3388
3386
  }
@@ -3516,7 +3514,7 @@ class Bt {
3516
3514
  return Tt();
3517
3515
  const h = [...this.compiler.container.stack(s)].reverse();
3518
3516
  for (const N of h)
3519
- if (N instanceof q)
3517
+ if (N instanceof Q)
3520
3518
  switch ((T = N.op) == null ? void 0 : T.value) {
3521
3519
  case ">":
3522
3520
  case "<":
@@ -3528,7 +3526,7 @@ class Bt {
3528
3526
  N
3529
3527
  );
3530
3528
  }
3531
- else if (N instanceof H)
3529
+ else if (N instanceof q)
3532
3530
  switch ((f = N.op) == null ? void 0 : f.value) {
3533
3531
  case ">":
3534
3532
  case "<":
@@ -3549,9 +3547,9 @@ class Bt {
3549
3547
  else {
3550
3548
  if (N instanceof se)
3551
3549
  return Et(this.compiler, s, N);
3552
- if (N instanceof P)
3550
+ if (N instanceof D)
3553
3551
  return Et(this.compiler, s, N);
3554
- if (N instanceof Z)
3552
+ if (N instanceof J)
3555
3553
  return Zn(this.compiler, s);
3556
3554
  if (N instanceof w)
3557
3555
  return mt(this.compiler, s, N);
@@ -3607,7 +3605,7 @@ function Zn(t, e) {
3607
3605
  const i = [...t.container.stack(e)];
3608
3606
  for (; i.length > 0; ) {
3609
3607
  const r = i.pop();
3610
- if (r instanceof H && ((s = r.op) == null ? void 0 : s.value) === ".")
3608
+ if (r instanceof q && ((s = r.op) == null ? void 0 : s.value) === ".")
3611
3609
  return Vt(
3612
3610
  t,
3613
3611
  e,
@@ -4124,7 +4122,7 @@ class ls {
4124
4122
  T[f] === `
4125
4123
  ` && (c.pop(), p = !0);
4126
4124
  } else
4127
- h instanceof q || h instanceof H ? this.container.token(e).token !== h.op && (c.pop(), p = !0) : h instanceof P ? h.listCloseBracket && h.end <= e && (c.pop(), p = !0) : h instanceof Z ? h.tupleCloseParen && h.end <= e && (c.pop(), p = !0) : h instanceof ne ? h.blockCloseBrace && h.end <= e && (c.pop(), p = !0) : h instanceof $ || h.end < e && (c.pop(), p = !0);
4125
+ h instanceof Q || h instanceof q ? this.container.token(e).token !== h.op && (c.pop(), p = !0) : h instanceof D ? h.listCloseBracket && h.end <= e && (c.pop(), p = !0) : h instanceof J ? h.tupleCloseParen && h.end <= e && (c.pop(), p = !0) : h instanceof ne ? h.blockCloseBrace && h.end <= e && (c.pop(), p = !0) : h instanceof $ || h.end < e && (c.pop(), p = !0);
4128
4126
  if (p) {
4129
4127
  const T = I.last(c);
4130
4128
  T instanceof A && T.end <= e && c.pop();