@dbml/parse 3.9.6 → 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.
Files changed (68) hide show
  1. package/LICENSE +0 -0
  2. package/dist/compiler.d.ts +0 -0
  3. package/dist/constants.d.ts +0 -0
  4. package/dist/dbml-parse.js +8 -8
  5. package/dist/dbml-parse.mjs +494 -481
  6. package/dist/index.d.ts +0 -0
  7. package/dist/lib/analyzer/analyzer.d.ts +0 -0
  8. package/dist/lib/analyzer/binder/binder.d.ts +0 -0
  9. package/dist/lib/analyzer/binder/elementBinder/custom.d.ts +0 -0
  10. package/dist/lib/analyzer/binder/elementBinder/elementBinder.d.ts +0 -0
  11. package/dist/lib/analyzer/binder/elementBinder/enum.d.ts +0 -0
  12. package/dist/lib/analyzer/binder/elementBinder/indexes.d.ts +0 -0
  13. package/dist/lib/analyzer/binder/elementBinder/note.d.ts +0 -0
  14. package/dist/lib/analyzer/binder/elementBinder/project.d.ts +0 -0
  15. package/dist/lib/analyzer/binder/elementBinder/ref.d.ts +0 -0
  16. package/dist/lib/analyzer/binder/elementBinder/table.d.ts +0 -0
  17. package/dist/lib/analyzer/binder/elementBinder/tableGroup.d.ts +0 -0
  18. package/dist/lib/analyzer/binder/types.d.ts +0 -0
  19. package/dist/lib/analyzer/binder/utils.d.ts +0 -0
  20. package/dist/lib/analyzer/symbol/factory.d.ts +0 -0
  21. package/dist/lib/analyzer/symbol/symbolIndex.d.ts +0 -0
  22. package/dist/lib/analyzer/symbol/symbolTable.d.ts +0 -0
  23. package/dist/lib/analyzer/symbol/symbols.d.ts +0 -0
  24. package/dist/lib/analyzer/symbol/utils.d.ts +0 -0
  25. package/dist/lib/analyzer/types.d.ts +0 -0
  26. package/dist/lib/analyzer/utils.d.ts +0 -0
  27. package/dist/lib/analyzer/validator/elementValidators/custom.d.ts +0 -0
  28. package/dist/lib/analyzer/validator/elementValidators/enum.d.ts +0 -0
  29. package/dist/lib/analyzer/validator/elementValidators/indexes.d.ts +0 -0
  30. package/dist/lib/analyzer/validator/elementValidators/note.d.ts +0 -0
  31. package/dist/lib/analyzer/validator/elementValidators/project.d.ts +0 -0
  32. package/dist/lib/analyzer/validator/elementValidators/ref.d.ts +0 -0
  33. package/dist/lib/analyzer/validator/elementValidators/table.d.ts +0 -0
  34. package/dist/lib/analyzer/validator/elementValidators/tableGroup.d.ts +0 -0
  35. package/dist/lib/analyzer/validator/types.d.ts +0 -0
  36. package/dist/lib/analyzer/validator/utils.d.ts +0 -0
  37. package/dist/lib/analyzer/validator/validator.d.ts +0 -0
  38. package/dist/lib/errors.d.ts +0 -0
  39. package/dist/lib/interpreter/elementInterpreter/enum.d.ts +0 -0
  40. package/dist/lib/interpreter/elementInterpreter/project.d.ts +0 -0
  41. package/dist/lib/interpreter/elementInterpreter/ref.d.ts +0 -0
  42. package/dist/lib/interpreter/elementInterpreter/sticky_note.d.ts +0 -0
  43. package/dist/lib/interpreter/elementInterpreter/table.d.ts +0 -0
  44. package/dist/lib/interpreter/elementInterpreter/tableGroup.d.ts +0 -0
  45. package/dist/lib/interpreter/interpreter.d.ts +0 -0
  46. package/dist/lib/interpreter/types.d.ts +1 -0
  47. package/dist/lib/interpreter/utils.d.ts +0 -0
  48. package/dist/lib/lexer/lexer.d.ts +0 -0
  49. package/dist/lib/lexer/tokens.d.ts +0 -0
  50. package/dist/lib/lexer/utils.d.ts +0 -0
  51. package/dist/lib/option.d.ts +0 -0
  52. package/dist/lib/parser/contextStack.d.ts +0 -0
  53. package/dist/lib/parser/factory.d.ts +0 -0
  54. package/dist/lib/parser/nodes.d.ts +0 -0
  55. package/dist/lib/parser/parser.d.ts +0 -0
  56. package/dist/lib/parser/utils.d.ts +0 -0
  57. package/dist/lib/report.d.ts +0 -0
  58. package/dist/lib/serialization/serialize.d.ts +0 -0
  59. package/dist/lib/types.d.ts +0 -0
  60. package/dist/lib/utils.d.ts +0 -0
  61. package/dist/services/definition/provider.d.ts +0 -0
  62. package/dist/services/index.d.ts +0 -0
  63. package/dist/services/references/provider.d.ts +0 -0
  64. package/dist/services/suggestions/provider.d.ts +0 -0
  65. package/dist/services/suggestions/utils.d.ts +0 -0
  66. package/dist/services/types.d.ts +0 -0
  67. package/dist/services/utils.d.ts +0 -0
  68. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- import I, { last as Ce, 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 at(t) {
15
+ function lt(t) {
16
16
  if (!t)
17
17
  return !1;
18
18
  switch (t) {
@@ -33,31 +33,31 @@ function at(t) {
33
33
  return !1;
34
34
  }
35
35
  }
36
- function ot(t) {
36
+ function ct(t) {
37
37
  return t !== void 0 && t.kind === "<op>";
38
38
  }
39
- class B {
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 B(e, n, s, i, r);
44
+ return new G(e, n, s, i, r);
45
45
  }
46
46
  }
47
- function It(t) {
47
+ function gt(t) {
48
48
  return t.trailingTrivia.find(({ kind: e }) => e === u.NEWLINE) !== void 0;
49
49
  }
50
- function lt(t, e) {
51
- return e.leadingTrivia.find(({ kind: s }) => s === u.NEWLINE) !== void 0 || It(t);
50
+ function ut(t, e) {
51
+ return e.leadingTrivia.find(({ kind: s }) => s === u.NEWLINE) !== void 0 || gt(t);
52
52
  }
53
- function Xe(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 Lt(t) {
57
- return t.trailingTrivia.length === 0 ? t.end : Lt(Ce(t.trailingTrivia));
56
+ function _t(t) {
57
+ return t.trailingTrivia.length === 0 ? t.end : _t($e(t.trailingTrivia));
58
58
  }
59
- function gt(t) {
60
- return t.leadingTrivia.length === 0 ? t.start : gt(t.leadingTrivia[0]);
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 B ? gt(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 B ? Lt(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
- ..._t(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
- ..._t(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 je extends K {
206
+ class ze extends ee {
207
207
  constructor({
208
208
  groupOpenParen: e,
209
209
  expression: n,
@@ -220,7 +220,7 @@ class je 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,7 +233,7 @@ 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
  }
@@ -243,9 +243,9 @@ class M extends k {
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 = B.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 _t(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 Ye(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 ze(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 qe(t) {
350
+ function Je(t) {
351
351
  return `Enum field:${t}`;
352
352
  }
353
- function He(t) {
353
+ function Ze(t) {
354
354
  return `TableGroup:${t}`;
355
355
  }
356
- function Je(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 Ve(t, e) {
362
+ function Ce(t, e) {
363
363
  switch (e) {
364
364
  case "Column":
365
- return ze(t);
365
+ return qe(t);
366
366
  case "Enum":
367
- return Qe(t);
367
+ return He(t);
368
368
  case "Enum field":
369
- return qe(t);
369
+ return Je(t);
370
370
  case "Schema":
371
- return Ye(t);
371
+ return Qe(t);
372
372
  case "Table":
373
- return Oe(t);
373
+ return De(t);
374
374
  case "TableGroup":
375
- return He(t);
375
+ return Ze(t);
376
376
  case "TableGroup field":
377
- return Je(t);
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
- Ye,
399
- Oe,
400
398
  Qe,
399
+ De,
401
400
  He,
402
- ze,
401
+ Ze,
403
402
  qe,
404
- Je
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 ct(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 At {
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 vt {
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 = Ge(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 && Ge(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: Ge(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 ut(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 B ? 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,23 +540,23 @@ 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);
@@ -564,21 +564,21 @@ function hn(t) {
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 je ? 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 wt(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,37 +592,37 @@ 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
- ...ct(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
- ...ct(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
627
  if (t instanceof M)
628
628
  return U(t.expression);
@@ -631,25 +631,25 @@ function fn(t) {
631
631
  t.array,
632
632
  t.indexer
633
633
  );
634
- throw t instanceof je ? 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 Ge(t) {
637
- return F(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 M && (t.expression instanceof ee && t.expression.variable instanceof B && 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 F(t) {
644
- return t instanceof M && t.expression instanceof ee && t.expression.variable instanceof B;
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 M && 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 Ze(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 B.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(B.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 (at(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 && wt(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(B.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 (; at(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`, B.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 (ut(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) || lt(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(je, {
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 (ut(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
- Xe(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() || It(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 } = ht(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
- lt(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 (Xe(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 (ot(s)) {
1460
- const i = s, r = ht(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 (ot(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() {
@@ -1574,7 +1574,7 @@ class Nn {
1574
1574
  });
1575
1575
  if (this.match(u.QUOTED_STRING, u.IDENTIFIER))
1576
1576
  return this.nodeFactory.create(M, {
1577
- expression: this.nodeFactory.create(ee, { variable: this.previous() })
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 ht(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 (!Ze(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 (!F(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 F(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 $e(t) {
1747
- if (ft(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(ft)) {
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(F);
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) || !xt((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 ft(t) {
1777
- return t instanceof M && 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 ? kt(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 = Ke(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 && !F(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 = V(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 && F(e.callee)) {
1909
- const n = X(e.callee).unwrap(), s = qe(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 && !$e(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
- $e(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 = V(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
- F(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,10 +2106,10 @@ 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)] : [];
@@ -2132,11 +2132,16 @@ class Sn {
2132
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) => {
2133
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));
2134
2134
  const i = [...s.args];
2135
- 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)));
2136
2141
  }), n;
2137
2142
  }
2138
2143
  validateFieldSettings(e) {
2139
- const n = V(e), s = n.getErrors(), i = n.getValue();
2144
+ const n = C(e), s = n.getErrors(), i = n.getValue();
2140
2145
  for (const r in i) {
2141
2146
  const a = i[r];
2142
2147
  switch (r) {
@@ -2146,6 +2151,11 @@ class Sn {
2146
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));
2147
2152
  });
2148
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;
2149
2159
  default:
2150
2160
  a.forEach((l) => s.push(new c(o.UNKNOWN_REF_SETTING, `Unknown ref setting '${r}'`, l)));
2151
2161
  }
@@ -2162,10 +2172,10 @@ class Sn {
2162
2172
  }
2163
2173
  }
2164
2174
  function On(t) {
2165
- if (!(F(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))
2166
2176
  return !1;
2167
2177
  let e;
2168
- 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)
2169
2179
  switch (e.toLowerCase()) {
2170
2180
  case "cascade":
2171
2181
  case "no action":
@@ -2189,24 +2199,24 @@ class Dn {
2189
2199
  return this.declarationNode.parent instanceof A ? [new c(o.INVALID_TABLE_CONTEXT, "Table must appear top-level", this.declarationNode)] : [];
2190
2200
  }
2191
2201
  validateName(e) {
2192
- 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)] : kt(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)];
2193
2203
  }
2194
2204
  validateAlias(e) {
2195
2205
  return e ? Mn(e) ? [] : [new c(o.INVALID_ALIAS, "Table aliases can only contains alphanumeric and underscore unless surrounded by double quotes", e)] : [];
2196
2206
  }
2197
2207
  validateSettingList(e) {
2198
- const n = V(e), s = n.getErrors(), i = n.getValue();
2208
+ const n = C(e), s = n.getErrors(), i = n.getValue();
2199
2209
  for (const r in i) {
2200
2210
  const a = i[r];
2201
2211
  switch (r) {
2202
2212
  case "headercolor":
2203
2213
  a.length > 1 && s.push(...a.map((l) => new c(o.DUPLICATE_TABLE_SETTING, "'headercolor' can only appear once", l))), a.forEach((l) => {
2204
- St(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));
2205
2215
  });
2206
2216
  break;
2207
2217
  case "note":
2208
2218
  a.length > 1 && s.push(...a.map((l) => new c(o.DUPLICATE_TABLE_SETTING, "'note' can only appear once", l))), a.forEach((l) => {
2209
- 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));
2210
2220
  });
2211
2221
  break;
2212
2222
  default:
@@ -2217,14 +2227,14 @@ class Dn {
2217
2227
  }
2218
2228
  registerElement() {
2219
2229
  const e = [];
2220
- this.declarationNode.symbol = this.symbolFactory.create(vt, { declaration: this.declarationNode, symbolTable: new we() });
2221
- 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);
2222
2232
  if (i.isOk()) {
2223
- const r = [...i.unwrap()], a = r.pop(), l = Ke(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);
2224
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);
2225
2235
  }
2226
- if (s && ye(s) && !Pn(s.expression.variable.value, i.unwrap_or([]))) {
2227
- 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);
2228
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);
2229
2239
  }
2230
2240
  return e;
@@ -2242,14 +2252,14 @@ class Dn {
2242
2252
  if (!n.callee)
2243
2253
  return [];
2244
2254
  const s = [];
2245
- n.args.length === 0 && s.push(new c(o.INVALID_COLUMN, "A column must have a type", n.callee)), F(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]));
2246
2256
  const i = n.args.slice(1);
2247
2257
  return s.push(...this.validateFieldSetting(i)), s.push(...this.registerField(n)), s;
2248
2258
  });
2249
2259
  }
2250
2260
  registerField(e) {
2251
- if (e.callee && F(e.callee)) {
2252
- const n = X(e.callee).unwrap(), s = ze(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 });
2253
2263
  e.symbol = i;
2254
2264
  const r = this.declarationNode.symbol.symbolTable;
2255
2265
  if (r.has(s)) {
@@ -2265,15 +2275,15 @@ class Dn {
2265
2275
  }
2266
2276
  // This is needed to support legacy inline settings
2267
2277
  validateFieldSetting(e) {
2268
- 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))
2269
2279
  return [...e.map((p) => new c(o.INVALID_COLUMN, "These fields must be some inline settings optionally ended with a setting list", p))];
2270
2280
  if (e.length === 0)
2271
2281
  return [];
2272
2282
  let n;
2273
- I.last(e) instanceof P && (n = e.pop());
2274
- const s = V(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();
2275
2285
  for (const p of e) {
2276
- const f = X(p).unwrap_or("").toLowerCase();
2286
+ const f = W(p).unwrap_or("").toLowerCase();
2277
2287
  if (f !== "pk" && f !== "unique") {
2278
2288
  i.push(new c(o.INVALID_SETTINGS, "Inline column settings can only be `pk` or `unique`", p));
2279
2289
  continue;
@@ -2287,7 +2297,7 @@ class Dn {
2287
2297
  switch (p) {
2288
2298
  case "note":
2289
2299
  f.length > 1 && i.push(...f.map((h) => new c(o.DUPLICATE_COLUMN_SETTING, "note can only appear once", h))), f.forEach((h) => {
2290
- 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));
2291
2301
  });
2292
2302
  break;
2293
2303
  case "ref":
@@ -2352,10 +2362,10 @@ class Dn {
2352
2362
  }
2353
2363
  }
2354
2364
  function Rn(t) {
2355
- if (!(t instanceof J || Ze(t) || t instanceof M || t instanceof he))
2365
+ if (!(t instanceof Z || et(t) || t instanceof M || t instanceof he))
2356
2366
  return !1;
2357
- if (t instanceof J) {
2358
- 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)))
2359
2369
  return !1;
2360
2370
  t = t.callee;
2361
2371
  }
@@ -2364,7 +2374,7 @@ function Rn(t) {
2364
2374
  return !1;
2365
2375
  t = t.array;
2366
2376
  }
2367
- const e = j(t).unwrap_or(void 0);
2377
+ const e = z(t).unwrap_or(void 0);
2368
2378
  return e !== void 0 && e.length > 0;
2369
2379
  }
2370
2380
  function Pn(t, e) {
@@ -2392,7 +2402,7 @@ class Un {
2392
2402
  )] : [];
2393
2403
  }
2394
2404
  validateName(e) {
2395
- return e ? ye(e) ? [] : [new c(
2405
+ return e ? ke(e) ? [] : [new c(
2396
2406
  o.INVALID_NAME,
2397
2407
  "A TableGroup name must be a single identifier",
2398
2408
  e
@@ -2411,10 +2421,10 @@ class Un {
2411
2421
  }
2412
2422
  registerElement() {
2413
2423
  const { name: e } = this.declarationNode;
2414
- this.declarationNode.symbol = this.symbolFactory.create(on, { declaration: this.declarationNode, symbolTable: new we() });
2415
- const n = j(e);
2424
+ this.declarationNode.symbol = this.symbolFactory.create(on, { declaration: this.declarationNode, symbolTable: new ye() });
2425
+ const n = z(e);
2416
2426
  if (n.isOk()) {
2417
- const s = n.unwrap(), i = s.pop(), r = Ke(s, this.publicSymbolTable, this.symbolFactory), a = He(i);
2427
+ const s = n.unwrap(), i = s.pop(), r = tt(s, this.publicSymbolTable, this.symbolFactory), a = Ze(i);
2418
2428
  if (r.has(a))
2419
2429
  return [new c(o.DUPLICATE_NAME, `TableGroup name '${i}' already exists`, e)];
2420
2430
  r.set(a, this.declarationNode.symbol);
@@ -2422,7 +2432,7 @@ class Un {
2422
2432
  return [];
2423
2433
  }
2424
2434
  validateSettingList(e) {
2425
- const n = V(e), s = n.getErrors(), i = n.getValue();
2435
+ const n = C(e), s = n.getErrors(), i = n.getValue();
2426
2436
  return I.forIn(i, (r, a) => {
2427
2437
  switch (a) {
2428
2438
  case "color":
@@ -2431,7 +2441,7 @@ class Un {
2431
2441
  "'color' can only appear once",
2432
2442
  l
2433
2443
  ))), r.forEach((l) => {
2434
- St(l.value) || s.push(new c(
2444
+ nt(l.value) || s.push(new c(
2435
2445
  o.INVALID_TABLE_SETTING,
2436
2446
  "'color' must be a color literal",
2437
2447
  l.value || l.name
@@ -2443,7 +2453,7 @@ class Un {
2443
2453
  o.DUPLICATE_TABLE_SETTING,
2444
2454
  "'note' can only appear once",
2445
2455
  l
2446
- ))), r.filter((l) => !W(l.value)).forEach((l) => {
2456
+ ))), r.filter((l) => !Y(l.value)).forEach((l) => {
2447
2457
  s.push(new c(
2448
2458
  o.INVALID_TABLE_SETTING,
2449
2459
  "'note' must be a string literal",
@@ -2479,7 +2489,7 @@ class Un {
2479
2489
  validateFields(e) {
2480
2490
  return e.flatMap((n) => {
2481
2491
  const s = [];
2482
- 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;
2483
2493
  });
2484
2494
  }
2485
2495
  validateSubElements(e) {
@@ -2495,8 +2505,8 @@ class Un {
2495
2505
  return s.length > 1 && n.push(...s.map((i) => new c(o.NOTE_REDEFINED, "Duplicate notes are defined", i))), n;
2496
2506
  }
2497
2507
  registerField(e) {
2498
- if (e.callee && F(e.callee)) {
2499
- const n = X(e.callee).unwrap(), s = Je(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 });
2500
2510
  e.symbol = i;
2501
2511
  const r = this.declarationNode.symbol.symbolTable;
2502
2512
  if (r.has(s)) {
@@ -2511,7 +2521,7 @@ class Un {
2511
2521
  return [];
2512
2522
  }
2513
2523
  }
2514
- const yt = ["-", "+"];
2524
+ const xt = ["-", "+"];
2515
2525
  function oe(t) {
2516
2526
  switch (t.type.value.toLowerCase()) {
2517
2527
  case b.Enum:
@@ -2532,38 +2542,38 @@ function oe(t) {
2532
2542
  return vn;
2533
2543
  }
2534
2544
  }
2535
- function kt(t) {
2536
- return !!j(t).unwrap_or(!1);
2545
+ function St(t) {
2546
+ return !!z(t).unwrap_or(!1);
2537
2547
  }
2538
2548
  function Mn(t) {
2539
- return ye(t);
2549
+ return ke(t);
2540
2550
  }
2541
- function ye(t) {
2542
- return t instanceof M && t.expression instanceof ee;
2551
+ function ke(t) {
2552
+ return t instanceof M && t.expression instanceof te;
2543
2553
  }
2544
- function Ke(t, e, n) {
2554
+ function tt(t, e, n) {
2545
2555
  var i;
2546
2556
  t[0] === "public" && (t = t.slice(1));
2547
2557
  let s = e;
2548
2558
  for (const r of t) {
2549
2559
  let a;
2550
- const l = Ye(r);
2560
+ const l = Qe(r);
2551
2561
  if (s.has(l)) {
2552
2562
  if (a = (i = s.get(l)) == null ? void 0 : i.symbolTable, !a)
2553
2563
  throw new Error("Expect a symbol table in a schema symbol");
2554
2564
  } else {
2555
- a = new we();
2556
- const p = n.create(At, { symbolTable: a });
2565
+ a = new ye();
2566
+ const p = n.create(wt, { symbolTable: a });
2557
2567
  s.set(l, p);
2558
2568
  }
2559
2569
  s = a;
2560
2570
  }
2561
2571
  return s;
2562
2572
  }
2563
- function xt(t) {
2573
+ function Ot(t) {
2564
2574
  return t === "-" || t === "<>" || t === ">" || t === "<";
2565
2575
  }
2566
- function St(t) {
2576
+ function nt(t) {
2567
2577
  var n;
2568
2578
  if (!(t instanceof M) || !(t.expression instanceof be) || ((n = t.expression.literal) == null ? void 0 : n.kind) !== u.COLOR_LITERAL)
2569
2579
  return !1;
@@ -2580,7 +2590,7 @@ function ue(t) {
2580
2590
  }
2581
2591
  function Fn(t) {
2582
2592
  var e;
2583
- return !!(W(t) || fe(t) || me(t) && ["true", "false", "null"].includes(t.expression.variable.value.toLowerCase()) || t instanceof q && yt.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);
2584
2594
  }
2585
2595
  function fe(t) {
2586
2596
  var e;
@@ -2588,19 +2598,19 @@ function fe(t) {
2588
2598
  }
2589
2599
  function Bn(t) {
2590
2600
  var n;
2591
- if (!(t instanceof q) || !xt((n = t.op) == null ? void 0 : n.value))
2601
+ if (!(t instanceof H) || !Ot((n = t.op) == null ? void 0 : n.value))
2592
2602
  return !1;
2593
- const e = j(t.expression).unwrap_or(void 0);
2603
+ const e = z(t.expression).unwrap_or(void 0);
2594
2604
  return e !== void 0 && e.length > 0;
2595
2605
  }
2596
- function Ot(t) {
2597
- return t instanceof K && t.elementList.every(F);
2606
+ function Dt(t) {
2607
+ return t instanceof ee && t.elementList.every(V);
2598
2608
  }
2599
- function V(t) {
2609
+ function C(t) {
2600
2610
  var s;
2601
2611
  const e = {}, n = [];
2602
2612
  if (!t)
2603
- return new G({});
2613
+ return new X({});
2604
2614
  for (const i of t.elementList) {
2605
2615
  if (!i.name)
2606
2616
  continue;
@@ -2611,12 +2621,12 @@ function V(t) {
2611
2621
  const r = (s = Te(i.name).unwrap_or(void 0)) == null ? void 0 : s.toLowerCase();
2612
2622
  r && (e[r] === void 0 ? e[r] = [i] : e[r].push(i));
2613
2623
  }
2614
- return new G(e, n);
2624
+ return new X(e, n);
2615
2625
  }
2616
- class pt {
2626
+ class Et {
2617
2627
  constructor(e, n) {
2618
- this.ast = e, this.symbolFactory = n, this.publicSchemaSymbol = this.symbolFactory.create(At, {
2619
- symbolTable: new we()
2628
+ this.ast = e, this.symbolFactory = n, this.publicSchemaSymbol = this.symbolFactory.create(wt, {
2629
+ symbolTable: new ye()
2620
2630
  }), this.ast.symbol = this.publicSchemaSymbol, this.ast.symbol.declaration = this.ast;
2621
2631
  }
2622
2632
  validate() {
@@ -2631,8 +2641,8 @@ class pt {
2631
2641
  );
2632
2642
  e.push(...r.validate());
2633
2643
  });
2634
- const n = this.ast.body.filter((s) => ve(s).unwrap_or(void 0) === b.Project);
2635
- 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);
2636
2646
  }
2637
2647
  }
2638
2648
  class le {
@@ -2659,12 +2669,12 @@ class le {
2659
2669
  if (!e.body)
2660
2670
  return;
2661
2671
  const { body: n } = e;
2662
- if (n instanceof Z)
2672
+ if (n instanceof K)
2663
2673
  for (const s of n.body)
2664
2674
  if (s instanceof A) {
2665
2675
  if (!s.type)
2666
2676
  continue;
2667
- const i = Dt(s);
2677
+ const i = Rt(s);
2668
2678
  new i(s, this.errors).bind();
2669
2679
  } else
2670
2680
  this.bindSubfield(s);
@@ -2673,7 +2683,7 @@ class le {
2673
2683
  }
2674
2684
  bindSubfield(e) {
2675
2685
  const n = [e.callee, ...e.args], s = I.last(n);
2676
- s instanceof P && (n.pop(), this.bindSettingList(s, this.subfield.settingList));
2686
+ s instanceof R && (n.pop(), this.bindSettingList(s, this.subfield.settingList));
2677
2687
  const { argBinderRules: i } = this.subfield.arg;
2678
2688
  for (let r = 0; r < Math.min(n.length, i.length); r += 1)
2679
2689
  i[r].shouldBind && this.scanAndBind(n[r], i[r]);
@@ -2683,11 +2693,11 @@ class le {
2683
2693
  var s, i;
2684
2694
  if (e)
2685
2695
  if (e instanceof M) {
2686
- if (e.expression instanceof ee && ((i = n.keywords) != null && i.includes((s = e.expression.variable) == null ? void 0 : s.value.toLowerCase())))
2696
+ if (e.expression instanceof te && ((i = n.keywords) != null && i.includes((s = e.expression.variable) == null ? void 0 : s.value.toLowerCase())))
2687
2697
  return;
2688
2698
  this.bindFragments([e], n);
2689
2699
  } else
2690
- e instanceof H ? Ze(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));
2691
2701
  }
2692
2702
  // Bind the fragments of a member access expression
2693
2703
  // which can be a simple expression like v1.User,
@@ -2695,7 +2705,7 @@ class le {
2695
2705
  bindFragments(e, n) {
2696
2706
  if (e.length === 0)
2697
2707
  return;
2698
- const s = [...n.topSubnamesSymbolKind], { remainingSubnamesSymbolKind: i } = n, r = e.findIndex((h) => !F(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(
2699
2709
  0,
2700
2710
  r === -1 ? void 0 : r
2701
2711
  );
@@ -2703,16 +2713,16 @@ class le {
2703
2713
  return;
2704
2714
  const E = [];
2705
2715
  for (; s.length && f.length; ) {
2706
- const h = s.pop(), m = f.pop(), g = X(m).unwrap();
2716
+ const h = s.pop(), m = f.pop(), g = W(m).unwrap();
2707
2717
  E.unshift({
2708
- index: Ve(g, h),
2718
+ index: Ce(g, h),
2709
2719
  referrer: m
2710
2720
  });
2711
2721
  }
2712
2722
  for (; f.length; ) {
2713
- const h = f.pop(), m = X(h).unwrap();
2723
+ const h = f.pop(), m = W(h).unwrap();
2714
2724
  E.unshift({
2715
- index: Ve(m, i),
2725
+ index: Ce(m, i),
2716
2726
  referrer: h
2717
2727
  });
2718
2728
  }
@@ -2721,8 +2731,8 @@ class le {
2721
2731
  [
2722
2732
  ...E,
2723
2733
  {
2724
- index: Ve(
2725
- X(h).unwrap(),
2734
+ index: Ce(
2735
+ W(h).unwrap(),
2726
2736
  p
2727
2737
  ),
2728
2738
  referrer: h
@@ -2901,7 +2911,7 @@ class Yn extends le {
2901
2911
  }, this.settingList = {};
2902
2912
  }
2903
2913
  }
2904
- function Dt(t) {
2914
+ function Rt(t) {
2905
2915
  switch (t.type.value.toLowerCase()) {
2906
2916
  case b.Enum:
2907
2917
  return Gn;
@@ -2928,10 +2938,10 @@ class zn {
2928
2938
  resolve() {
2929
2939
  for (const e of this.ast.body)
2930
2940
  if (e.type) {
2931
- const n = Dt(e);
2941
+ const n = Rt(e);
2932
2942
  new n(e, this.errors).bind();
2933
2943
  }
2934
- return new G(this.ast, this.errors);
2944
+ return new X(this.ast, this.errors);
2935
2945
  }
2936
2946
  }
2937
2947
  class Qn {
@@ -2948,15 +2958,15 @@ class qn {
2948
2958
  }
2949
2959
  // Analyzing: Invoking both the validator and binder
2950
2960
  analyze() {
2951
- return new pt(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());
2952
2962
  }
2953
2963
  // For invoking the validator only
2954
2964
  validate() {
2955
- return new pt(this.ast, this.symbolFactory).validate().chain((n) => new G(n, []));
2965
+ return new Et(this.ast, this.symbolFactory).validate().chain((n) => new X(n, []));
2956
2966
  }
2957
2967
  }
2958
- function dt(t, e) {
2959
- const { variables: n, tupleElements: s } = _e(t).unwrap();
2968
+ function Nt(t, e) {
2969
+ const { variables: n, tupleElements: s } = Ae(t).unwrap();
2960
2970
  return s ? n.length === 0 ? {
2961
2971
  schemaName: e.schemaName,
2962
2972
  tableName: e.name,
@@ -2975,7 +2985,7 @@ function dt(t, e) {
2975
2985
  schemaName: n.pop() || null
2976
2986
  };
2977
2987
  }
2978
- function Rt(t) {
2988
+ function Pt(t) {
2979
2989
  switch (t) {
2980
2990
  case "<":
2981
2991
  return ["1", "*"];
@@ -2998,22 +3008,22 @@ function _(t) {
2998
3008
  end: { offset: t.endPos.offset, line: t.endPos.line + 1, column: t.endPos.column + 1 }
2999
3009
  };
3000
3010
  }
3001
- function We(t) {
3011
+ function Ye(t) {
3002
3012
  var n;
3003
3013
  const e = (n = pe(t).unwrap_or(void 0)) == null ? void 0 : n.pop();
3004
- 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];
3005
3015
  }
3006
3016
  function Ie(t) {
3007
- const e = j(t).unwrap();
3017
+ const e = z(t).unwrap();
3008
3018
  return {
3009
3019
  name: e.pop(),
3010
3020
  schemaName: e
3011
3021
  };
3012
3022
  }
3013
- function et(t) {
3023
+ function Be(t) {
3014
3024
  return t.expression.literal.value;
3015
3025
  }
3016
- function Pt(t, e) {
3026
+ function Ut(t, e) {
3017
3027
  if (Array.isArray(t)) {
3018
3028
  const i = t.map(({ id: a }) => a).sort().join(","), r = e.map(({ id: a }) => a).sort().join(",");
3019
3029
  return i < r ? `${i}-${r}` : `${r}-${i}`;
@@ -3021,7 +3031,7 @@ function Pt(t, e) {
3021
3031
  const n = t.id.toString(), s = e.id.toString();
3022
3032
  return n < s ? `${n}-${s}` : `${s}-${n}`;
3023
3033
  }
3024
- function Ut(t, e) {
3034
+ function Mt(t, e) {
3025
3035
  if (Array.isArray(t)) {
3026
3036
  const i = t.map(({ id: a }) => a).sort(), r = e.map(({ id: a }) => a).sort();
3027
3037
  return I.zip(i, r).every(([a, l]) => a === l);
@@ -3035,7 +3045,7 @@ function ae(t) {
3035
3045
  return n.map((r) => r.slice(i)).join(`
3036
3046
  `);
3037
3047
  }
3038
- class Mt {
3048
+ class Ft {
3039
3049
  constructor(e, n) {
3040
3050
  this.declarationNode = e, this.env = n, this.table = { name: void 0, schemaName: void 0, alias: null, fields: [], token: void 0, indexes: [] }, this.pkColumns = [];
3041
3051
  }
@@ -3065,7 +3075,7 @@ class Mt {
3065
3075
  interpretAlias(e) {
3066
3076
  if (!e)
3067
3077
  return [];
3068
- const n = X(e).unwrap_or(null);
3078
+ const n = W(e).unwrap_or(null);
3069
3079
  return n && (this.env.aliases.push({
3070
3080
  name: n,
3071
3081
  kind: "table",
@@ -3077,11 +3087,11 @@ class Mt {
3077
3087
  }
3078
3088
  interpretSettingList(e) {
3079
3089
  var i, r, a;
3080
- const n = V(e).getValue();
3081
- this.table.headerColor = (i = n.headercolor) != null && i.length ? et((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;
3082
3092
  const [s] = n.note || [];
3083
3093
  return this.table.note = s && {
3084
- value: C(s == null ? void 0 : s.value).map(ae).unwrap(),
3094
+ value: $(s == null ? void 0 : s.value).map(ae).unwrap(),
3085
3095
  token: _(s)
3086
3096
  }, [];
3087
3097
  }
@@ -3095,7 +3105,7 @@ class Mt {
3095
3105
  switch ((s = n.type) == null ? void 0 : s.value.toLowerCase()) {
3096
3106
  case "note":
3097
3107
  return this.table.note = {
3098
- 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(),
3099
3109
  token: _(n)
3100
3110
  }, [];
3101
3111
  case "indexes":
@@ -3108,26 +3118,26 @@ class Mt {
3108
3118
  return e.flatMap((n) => this.interpretColumn(n));
3109
3119
  }
3110
3120
  interpretColumn(e) {
3111
- var a, l, p, f, E, h, m, g, R;
3121
+ var a, l, p, f, E, h, m, g, P;
3112
3122
  const n = [], s = {};
3113
- s.name = X(e.callee).unwrap();
3123
+ s.name = W(e.callee).unwrap();
3114
3124
  const i = Hn(e.args[0]);
3115
3125
  s.type = i.getValue(), n.push(...i.getErrors()), s.token = _(e), s.inline_refs = [];
3116
3126
  const r = e.args.slice(1);
3117
- if (I.last(r) instanceof P) {
3118
- const S = V(r.pop()).getValue();
3127
+ if (I.last(r) instanceof R) {
3128
+ const S = C(r.pop()).getValue();
3119
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);
3120
- const te = (R = S.note) == null ? void 0 : R.at(0);
3121
- s.note = te && {
3122
- value: C(te.value).map(ae).unwrap(),
3123
- 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)
3124
3134
  };
3125
- const Yt = S.ref || [];
3126
- s.inline_refs = Yt.flatMap((Q) => {
3127
- const [st] = We(Q.value.expression);
3128
- if (Ut(st, e.symbol))
3129
- return n.push(new c(o.SAME_ENDPOINT, "Two endpoints are the same", Q)), [];
3130
- 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();
3131
3141
  let de;
3132
3142
  if (ne.length === 1) {
3133
3143
  const [ce] = ne;
@@ -3135,43 +3145,43 @@ class Mt {
3135
3145
  schemaName: this.table.schemaName,
3136
3146
  tableName: this.table.name,
3137
3147
  fieldNames: [ce],
3138
- relation: ke.value,
3139
- token: _(Q)
3148
+ relation: xe.value,
3149
+ token: _(B)
3140
3150
  };
3141
3151
  } else if (ne.length === 2) {
3142
- const [ce, Le] = ne;
3152
+ const [ce, ge] = ne;
3143
3153
  de = {
3144
3154
  schemaName: null,
3145
3155
  tableName: ce,
3146
- fieldNames: [Le],
3147
- relation: ke.value,
3148
- token: _(Q)
3156
+ fieldNames: [ge],
3157
+ relation: xe.value,
3158
+ token: _(B)
3149
3159
  };
3150
3160
  } else if (ne.length === 3) {
3151
- const [ce, Le, rt] = ne;
3161
+ const [ce, ge, ot] = ne;
3152
3162
  de = {
3153
3163
  schemaName: ce,
3154
- tableName: Le,
3155
- fieldNames: [rt],
3156
- relation: ke.value,
3157
- token: _(Q)
3164
+ tableName: ge,
3165
+ fieldNames: [ot],
3166
+ relation: xe.value,
3167
+ token: _(B)
3158
3168
  };
3159
3169
  } else {
3160
- n.push(new c(o.UNSUPPORTED, "Nested schema is not supported", Q));
3161
- 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();
3162
3172
  de = {
3163
3173
  schemaName: ne.join("."),
3164
- tableName: Le,
3174
+ tableName: ge,
3165
3175
  fieldNames: [ce],
3166
- relation: ke.value,
3167
- token: _(Q)
3176
+ relation: xe.value,
3177
+ token: _(B)
3168
3178
  };
3169
3179
  }
3170
- const it = this.registerInlineRefToEnv(e, st, de, Q);
3171
- return n.push(...it), it.length === 0 ? de : [];
3180
+ const at = this.registerInlineRefToEnv(e, rt, de, B);
3181
+ return n.push(...at), at.length === 0 ? de : [];
3172
3182
  });
3173
3183
  }
3174
- 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;
3175
3185
  }
3176
3186
  interpretIndexes(e) {
3177
3187
  return this.table.indexes.push(...e.body.body.map((n) => {
@@ -3179,47 +3189,47 @@ class Mt {
3179
3189
  const s = { columns: [] }, i = n;
3180
3190
  s.token = _(i);
3181
3191
  const r = [i.callee, ...i.args];
3182
- if (I.last(r) instanceof P) {
3183
- const g = V(r.pop()).getValue();
3184
- 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);
3185
- const R = (E = g.note) == null ? void 0 : E.at(0);
3186
- s.note = R && {
3187
- value: C(R.value).unwrap(),
3188
- token: _(R)
3189
- }, 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);
3190
3200
  }
3191
3201
  return r.flatMap((g) => {
3192
- if (!(g instanceof J))
3202
+ if (!(g instanceof Z))
3193
3203
  return g;
3194
- const R = [];
3195
- for (; g instanceof J; )
3196
- R.push(g.argumentList), g = g.callee;
3197
- 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;
3198
3208
  }).forEach((g) => {
3199
- const { functional: R, nonFunctional: S } = $e(g).unwrap();
3209
+ const { functional: P, nonFunctional: S } = je(g).unwrap();
3200
3210
  s.columns.push(
3201
- ...R.map((te) => ({
3202
- value: te.value.value,
3211
+ ...P.map((F) => ({
3212
+ value: F.value.value,
3203
3213
  type: "expression",
3204
- token: _(te)
3214
+ token: _(F)
3205
3215
  })),
3206
- ...S.map((te) => ({
3207
- value: X(te).unwrap(),
3216
+ ...S.map((F) => ({
3217
+ value: W(F).unwrap(),
3208
3218
  type: "column",
3209
- token: _(te)
3219
+ token: _(F)
3210
3220
  }))
3211
3221
  );
3212
3222
  }), s;
3213
3223
  })), [];
3214
3224
  }
3215
3225
  registerInlineRefToEnv(e, n, s, i) {
3216
- const r = Pt(e.symbol, n);
3226
+ const r = Ut(e.symbol, n);
3217
3227
  if (this.env.refIds[r])
3218
3228
  return [
3219
3229
  new c(o.CIRCULAR_REF, "References with same endpoints exist", i),
3220
3230
  new c(o.CIRCULAR_REF, "References with same endpoints exist", this.env.refIds[r])
3221
3231
  ];
3222
- const a = Rt(s.relation);
3232
+ const a = Pt(s.relation);
3223
3233
  return this.env.refIds[r] = i, this.env.ref.set(i, {
3224
3234
  name: null,
3225
3235
  schemaName: null,
@@ -3232,7 +3242,7 @@ class Mt {
3232
3242
  {
3233
3243
  schemaName: this.table.schemaName,
3234
3244
  tableName: this.table.name,
3235
- fieldNames: [Y(e.callee).unwrap()],
3245
+ fieldNames: [Q(e.callee).unwrap()],
3236
3246
  token: _(e),
3237
3247
  relation: a[0]
3238
3248
  }
@@ -3242,19 +3252,19 @@ class Mt {
3242
3252
  }
3243
3253
  function Hn(t) {
3244
3254
  let e = null;
3245
- 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);
3246
3256
  let n = "";
3247
3257
  for (; t instanceof he; )
3248
3258
  n = `[${t.indexer.elementList.map((r) => r.name.expression.literal.value).join(",")}]${n}`, t = t.array;
3249
3259
  const { name: s, schemaName: i } = Ie(t);
3250
- return i.length > 1 ? new G(
3260
+ return i.length > 1 ? new X(
3251
3261
  {
3252
3262
  schemaName: i.length === 0 ? null : i[0],
3253
3263
  type_name: `${s}${n}${e ? `(${e})` : ""}`,
3254
3264
  args: e
3255
3265
  },
3256
3266
  [new c(o.UNSUPPORTED, "Nested schema is not supported", t)]
3257
- ) : new G({
3267
+ ) : new X({
3258
3268
  schemaName: i.length === 0 ? null : i[0],
3259
3269
  type_name: `${s}${n}${e ? `(${e})` : ""}`,
3260
3270
  args: e
@@ -3263,9 +3273,9 @@ function Hn(t) {
3263
3273
  function Jn(t) {
3264
3274
  var e, n, s;
3265
3275
  if (t) {
3266
- if (W(t))
3276
+ if (Y(t))
3267
3277
  return {
3268
- value: C(t).unwrap(),
3278
+ value: $(t).unwrap(),
3269
3279
  type: "string"
3270
3280
  };
3271
3281
  if (fe(t))
@@ -3278,7 +3288,7 @@ function Jn(t) {
3278
3288
  value: t.expression.variable.value.toLowerCase(),
3279
3289
  type: "boolean"
3280
3290
  };
3281
- if (t instanceof q && yt.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)) {
3282
3292
  const i = Number.parseFloat(t.expression.expression.literal.value);
3283
3293
  return {
3284
3294
  value: ((n = t.op) == null ? void 0 : n.value) === "-" ? 0 - i : i,
@@ -3310,8 +3320,8 @@ class Zn {
3310
3320
  }
3311
3321
  interpretSettingList(e) {
3312
3322
  var s, i, r;
3313
- const n = V(e).getValue();
3314
- return this.note.headerColor = (s = n.headercolor) != null && s.length ? et((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, [];
3315
3325
  }
3316
3326
  interpretBody(e) {
3317
3327
  const [n, s] = I.partition(e.body, (i) => i instanceof v);
@@ -3324,53 +3334,56 @@ class Zn {
3324
3334
  return this.note.content = ae(n), [];
3325
3335
  }
3326
3336
  }
3327
- class Ft {
3337
+ class Bt {
3328
3338
  constructor(e, n) {
3329
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 = {};
3330
3340
  }
3331
3341
  interpret() {
3332
- return this.ref.token = _(this.declarationNode), this.env.ref.set(this.declarationNode, this.ref), [...this.interpretName(this.declarationNode.name), ...this.interpretBody(this.declarationNode.body)];
3342
+ return this.ref.token = _(this.declarationNode), this.env.ref.set(this.declarationNode, this.ref), [
3343
+ ...this.interpretName(this.declarationNode.name),
3344
+ ...this.interpretBody(this.declarationNode.body)
3345
+ ];
3333
3346
  }
3334
3347
  interpretName(e) {
3335
- const n = [], s = j(this.declarationNode.name).unwrap_or([]);
3348
+ const n = [], s = z(this.declarationNode.name).unwrap_or([]);
3336
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;
3337
3350
  }
3338
3351
  interpretBody(e) {
3339
3352
  return e instanceof v ? this.interpretField(e) : this.interpretField(e.body[0]);
3340
3353
  }
3341
3354
  interpretField(e) {
3342
- var f, E, h, m;
3343
- const n = e.callee.op.value, { leftExpression: s, rightExpression: i } = e.callee, r = We(s), a = We(i);
3344
- 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))
3345
3358
  return [new c(o.SAME_ENDPOINT, "Two endpoints are the same", e)];
3346
- const l = Pt(r, a);
3359
+ const l = Ut(r, a);
3347
3360
  if (this.env.refIds[l])
3348
3361
  return [
3349
3362
  new c(o.CIRCULAR_REF, "References with same endpoints exist", this.declarationNode),
3350
3363
  new c(o.CIRCULAR_REF, "References with same endpoints exist", this.env.refIds[l])
3351
3364
  ];
3352
3365
  if (e.args[0]) {
3353
- const g = V(e.args[0]).getValue(), R = (E = (f = g.delete) == null ? void 0 : f.at(0)) == null ? void 0 : E.value;
3354
- this.ref.onDelete = R instanceof z ? Te(R).unwrap_or(void 0) : Y(R).unwrap_or(void 0);
3355
- const S = (m = (h = g.update) == null ? void 0 : h.at(0)) == null ? void 0 : m.value;
3356
- 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;
3357
3370
  }
3358
- const p = Rt(n);
3371
+ const p = Pt(n);
3359
3372
  return this.ref.endpoints = [
3360
3373
  {
3361
- ...dt(s, this.container),
3374
+ ...Nt(s, this.container),
3362
3375
  relation: p[0],
3363
3376
  token: _(s)
3364
3377
  },
3365
3378
  {
3366
- ...dt(i, this.container),
3379
+ ...Nt(i, this.container),
3367
3380
  relation: p[1],
3368
3381
  token: _(i)
3369
3382
  }
3370
3383
  ], this.env.refIds[l] = this.declarationNode, [];
3371
3384
  }
3372
3385
  }
3373
- class Bt {
3386
+ class Vt {
3374
3387
  constructor(e, n) {
3375
3388
  this.declarationNode = e, this.env = n, this.tableGroup = { tables: [] };
3376
3389
  }
@@ -3399,8 +3412,8 @@ class Bt {
3399
3412
  switch ((s = n.type) == null ? void 0 : s.value.toLowerCase()) {
3400
3413
  case "note":
3401
3414
  this.tableGroup.note = {
3402
- value: C(
3403
- 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
3404
3417
  ).map(ae).unwrap(),
3405
3418
  token: _(n)
3406
3419
  };
@@ -3412,7 +3425,7 @@ class Bt {
3412
3425
  interpretFields(e) {
3413
3426
  const n = [];
3414
3427
  return this.tableGroup.tables = e.map((s) => {
3415
- const i = j(s.callee).unwrap();
3428
+ const i = z(s.callee).unwrap();
3416
3429
  i.length > 2 && n.push(new c(o.UNSUPPORTED, "Nested schema is not supported", s));
3417
3430
  const r = pe(s.callee).unwrap().pop().referee.id;
3418
3431
  if (this.env.groupOfTable[r]) {
@@ -3428,16 +3441,16 @@ class Bt {
3428
3441
  }
3429
3442
  interpretSettingList(e) {
3430
3443
  var i, r, a;
3431
- const n = V(e).getValue();
3432
- this.tableGroup.color = (i = n.color) != null && i.length ? et((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;
3433
3446
  const [s] = n.note || [];
3434
3447
  return this.tableGroup.note = s && {
3435
- value: C(s == null ? void 0 : s.value).map(ae).unwrap(),
3448
+ value: $(s == null ? void 0 : s.value).map(ae).unwrap(),
3436
3449
  token: _(s)
3437
3450
  }, [];
3438
3451
  }
3439
3452
  }
3440
- class Vt {
3453
+ class Gt {
3441
3454
  constructor(e, n) {
3442
3455
  this.declarationNode = e, this.env = n, this.enum = { values: [] };
3443
3456
  }
@@ -3452,10 +3465,10 @@ class Vt {
3452
3465
  return e.body.flatMap((n) => {
3453
3466
  var l;
3454
3467
  const s = n, i = {};
3455
- i.token = _(s), i.name = Y(s.callee).unwrap();
3456
- const a = (l = V(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);
3457
3470
  return i.note = a && {
3458
- value: C(a.value).map(ae).unwrap(),
3471
+ value: $(a.value).map(ae).unwrap(),
3459
3472
  token: _(a)
3460
3473
  }, this.enum.values.push(i), [];
3461
3474
  });
@@ -3480,28 +3493,28 @@ class Kn {
3480
3493
  const s = n;
3481
3494
  switch ((i = s.type) == null ? void 0 : i.value.toLowerCase()) {
3482
3495
  case "table": {
3483
- const r = new Mt(s, this.env).interpret();
3496
+ const r = new Ft(s, this.env).interpret();
3484
3497
  return this.project.tables.push(this.env.tables.get(s)), r;
3485
3498
  }
3486
3499
  case "ref": {
3487
- const r = new Ft(s, this.env).interpret();
3500
+ const r = new Bt(s, this.env).interpret();
3488
3501
  return this.project.refs.push(this.env.ref.get(s)), r;
3489
3502
  }
3490
3503
  case "tablegroup": {
3491
- const r = new Bt(s, this.env).interpret();
3504
+ const r = new Vt(s, this.env).interpret();
3492
3505
  return this.project.tableGroups.push(this.env.tableGroups.get(s)), r;
3493
3506
  }
3494
3507
  case "enum": {
3495
- const r = new Vt(s, this.env).interpret();
3508
+ const r = new Gt(s, this.env).interpret();
3496
3509
  return this.project.enums.push(this.env.enums.get(s)), r;
3497
3510
  }
3498
3511
  case "note":
3499
3512
  return this.project.note = {
3500
- 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(),
3501
3514
  token: _(s)
3502
3515
  }, [];
3503
3516
  default:
3504
- return this.project[s.type.value.toLowerCase()] = C(s.body.callee).unwrap(), [];
3517
+ return this.project[s.type.value.toLowerCase()] = $(s.body.callee).unwrap(), [];
3505
3518
  }
3506
3519
  });
3507
3520
  }
@@ -3523,24 +3536,24 @@ class es {
3523
3536
  }
3524
3537
  interpret() {
3525
3538
  const e = this.ast.body.flatMap((n) => {
3526
- switch (ve(n).unwrap_or(void 0)) {
3539
+ switch (we(n).unwrap_or(void 0)) {
3527
3540
  case b.Table:
3528
- return new Mt(n, this.env).interpret();
3541
+ return new Ft(n, this.env).interpret();
3529
3542
  case b.Note:
3530
3543
  return new Zn(n, this.env).interpret();
3531
3544
  case b.Ref:
3532
- return new Ft(n, this.env).interpret();
3533
- case b.TableGroup:
3534
3545
  return new Bt(n, this.env).interpret();
3535
- case b.Enum:
3546
+ case b.TableGroup:
3536
3547
  return new Vt(n, this.env).interpret();
3548
+ case b.Enum:
3549
+ return new Gt(n, this.env).interpret();
3537
3550
  case b.Project:
3538
3551
  return new Kn(n, this.env).interpret();
3539
3552
  default:
3540
3553
  return [];
3541
3554
  }
3542
3555
  });
3543
- return new G(ts(this.env), e);
3556
+ return new X(ts(this.env), e);
3544
3557
  }
3545
3558
  }
3546
3559
  function ts(t) {
@@ -3556,7 +3569,7 @@ function ts(t) {
3556
3569
  };
3557
3570
  }
3558
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 || {});
3559
- function Ae(t) {
3572
+ function ve(t) {
3560
3573
  switch (t) {
3561
3574
  case T.Schema:
3562
3575
  return L.Module;
@@ -3576,8 +3589,8 @@ function Ae(t) {
3576
3589
  return L.Text;
3577
3590
  }
3578
3591
  }
3579
- function Re(t, e) {
3580
- if (!t || Xe(t))
3592
+ function Pe(t, e) {
3593
+ if (!t || We(t))
3581
3594
  return !1;
3582
3595
  for (const n of t.trailingTrivia) {
3583
3596
  if (n.start > e)
@@ -3592,7 +3605,7 @@ function D() {
3592
3605
  suggestions: []
3593
3606
  };
3594
3607
  }
3595
- function Pe(t) {
3608
+ function Ue(t) {
3596
3609
  return {
3597
3610
  ...t,
3598
3611
  suggestions: t.suggestions.map((e) => ({
@@ -3601,65 +3614,65 @@ function Pe(t) {
3601
3614
  }))
3602
3615
  };
3603
3616
  }
3604
- function Fe(t) {
3617
+ function Ve(t) {
3605
3618
  return {
3606
3619
  ...t,
3607
3620
  suggestions: t.suggestions.map((e) => ({
3608
3621
  ...e,
3609
- insertText: e.insertText.split("").every(Me) ? e.insertText : `"${e.insertText}"`
3622
+ insertText: e.insertText.split("").every(Fe) ? e.insertText : `"${e.insertText}"`
3610
3623
  }))
3611
3624
  };
3612
3625
  }
3613
- function tt(t, e) {
3626
+ function st(t, e) {
3614
3627
  return t.getOffsetAt(e);
3615
3628
  }
3616
- class Gt {
3629
+ class Ct {
3617
3630
  constructor(e, n = []) {
3618
3631
  this.compiler = e, this.triggerCharacters = n;
3619
3632
  }
3620
3633
  provideCompletionItems(e, n) {
3621
3634
  var E, h;
3622
- const s = tt(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];
3623
3636
  if ([
3624
3637
  ...(r == null ? void 0 : r.trailingTrivia) || [],
3625
3638
  ...(r == null ? void 0 : r.leadingTrivia) || [],
3626
3639
  ...(l == null ? void 0 : l.leadingTrivia) || []
3627
- ].find((m) => Ht(m) && ge(s, m)))
3640
+ ].find((m) => Ht(m) && _e(s, m)))
3628
3641
  return D();
3629
3642
  if (a === void 0)
3630
- return bt();
3631
- 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))
3632
3645
  return D();
3633
3646
  const p = this.compiler.container.element(s);
3634
3647
  if (this.compiler.container.scopeKind(s) === O.TOPLEVEL || p instanceof A && p.type && p.type.start <= s && p.type.end >= s)
3635
- return bt();
3648
+ return Lt();
3636
3649
  const f = [...this.compiler.container.stack(s)].reverse();
3637
3650
  for (const m of f)
3638
- if (m instanceof q)
3651
+ if (m instanceof H)
3639
3652
  switch ((E = m.op) == null ? void 0 : E.value) {
3640
3653
  case ">":
3641
3654
  case "<":
3642
3655
  case "<>":
3643
3656
  case "-":
3644
- return Et(
3657
+ return mt(
3645
3658
  this.compiler,
3646
3659
  s,
3647
3660
  m
3648
3661
  );
3649
3662
  }
3650
- else if (m instanceof H)
3663
+ else if (m instanceof J)
3651
3664
  switch ((h = m.op) == null ? void 0 : h.value) {
3652
3665
  case ">":
3653
3666
  case "<":
3654
3667
  case "<>":
3655
3668
  case "-":
3656
- return Et(
3669
+ return mt(
3657
3670
  this.compiler,
3658
3671
  s,
3659
3672
  m
3660
3673
  );
3661
3674
  case ".":
3662
- return Ct(
3675
+ return Xt(
3663
3676
  this.compiler,
3664
3677
  s,
3665
3678
  m
@@ -3667,32 +3680,32 @@ class Gt {
3667
3680
  }
3668
3681
  else {
3669
3682
  if (m instanceof ie)
3670
- return Nt(this.compiler, s, m);
3671
- if (m instanceof P)
3672
- return Nt(this.compiler, s, m);
3673
- 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)
3674
3687
  return ns(this.compiler, s);
3675
3688
  if (m instanceof v)
3676
- return Tt(this.compiler, s, m);
3677
- if (m instanceof A && (m.bodyColon && s >= m.bodyColon.end || m.body && ge(s, m.body)))
3678
- return Tt(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);
3679
3692
  }
3680
3693
  return D();
3681
3694
  }
3682
3695
  }
3683
- function Et(t, e, n) {
3696
+ function mt(t, e, n) {
3684
3697
  const s = t.container.scopeKind(e);
3685
3698
  if ([O.REF, O.TABLE].includes(s)) {
3686
- const i = Be(t, e, t.container.element(e), [
3699
+ const i = Ge(t, e, t.container.element(e), [
3687
3700
  T.Table,
3688
3701
  T.Schema,
3689
3702
  T.Column
3690
3703
  ]);
3691
- return Re(n.op, e) ? Pe(i) : i;
3704
+ return Pe(n.op, e) ? Ue(i) : i;
3692
3705
  }
3693
3706
  return D();
3694
3707
  }
3695
- function Be(t, e, n, s) {
3708
+ function Ge(t, e, n, s) {
3696
3709
  var a;
3697
3710
  if (n === void 0)
3698
3711
  return D();
@@ -3706,61 +3719,61 @@ function Be(t, e, n, s) {
3706
3719
  label: p,
3707
3720
  insertText: p,
3708
3721
  insertTextRules: w.KeepWhitespace,
3709
- kind: Ae(f),
3710
- sortText: Ae(f).toString().padStart(2, "0"),
3722
+ kind: ve(f),
3723
+ sortText: ve(f).toString().padStart(2, "0"),
3711
3724
  range: void 0
3712
3725
  }))
3713
3726
  );
3714
3727
  }
3715
3728
  i = i instanceof A ? i.parent : void 0;
3716
3729
  }
3717
- return Fe(r);
3730
+ return Ve(r);
3718
3731
  }
3719
3732
  function ns(t, e) {
3720
3733
  var s;
3721
3734
  switch (t.container.scopeKind(e)) {
3722
3735
  case O.INDEXES:
3723
- return $t(t, e);
3736
+ return Wt(t, e);
3724
3737
  case O.REF:
3725
3738
  {
3726
3739
  const i = [...t.container.stack(e)];
3727
3740
  for (; i.length > 0; ) {
3728
3741
  const r = i.pop();
3729
- if (r instanceof H && ((s = r.op) == null ? void 0 : s.value) === ".")
3730
- return Ct(
3742
+ if (r instanceof J && ((s = r.op) == null ? void 0 : s.value) === ".")
3743
+ return Xt(
3731
3744
  t,
3732
3745
  e,
3733
3746
  r
3734
3747
  );
3735
3748
  }
3736
3749
  }
3737
- return Xt(t, e);
3750
+ return $t(t, e);
3738
3751
  }
3739
3752
  return D();
3740
3753
  }
3741
- function Nt(t, e, n) {
3754
+ function Tt(t, e, n) {
3742
3755
  const { token: s } = t.container.token(e);
3743
3756
  if ([u.COMMA, u.LBRACKET].includes(s == null ? void 0 : s.kind)) {
3744
- const i = mt(t, e);
3745
- 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;
3746
3759
  }
3747
3760
  if (n.name && n.name.start <= e && n.name.end >= e)
3748
- return mt(t, e);
3749
- if (n.name instanceof z) {
3761
+ return bt(t, e);
3762
+ if (n.name instanceof q) {
3750
3763
  const i = ss(
3751
3764
  t,
3752
3765
  e,
3753
3766
  Te(n.name).unwrap_or("")
3754
3767
  );
3755
- 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;
3756
3769
  }
3757
3770
  return D();
3758
3771
  }
3759
- function mt(t, e) {
3772
+ function bt(t, e) {
3760
3773
  const n = t.container.element(e), s = t.container.scopeKind(e);
3761
- if (n instanceof $)
3774
+ if (n instanceof j)
3762
3775
  return D();
3763
- if (n.body && !ge(e, n.body))
3776
+ if (n.body && !_e(e, n.body))
3764
3777
  switch (s) {
3765
3778
  case O.TABLE:
3766
3779
  return {
@@ -3882,21 +3895,21 @@ function ss(t, e, n) {
3882
3895
  }
3883
3896
  return D();
3884
3897
  }
3885
- function Ct(t, e, n) {
3898
+ function Xt(t, e, n) {
3886
3899
  const s = pe(n).unwrap_or([]);
3887
- if (s.pop(), s.some((r) => !F(r)))
3900
+ if (s.pop(), s.some((r) => !V(r)))
3888
3901
  return D();
3889
- const i = s.map((r) => Y(r).unwrap());
3890
- return Fe({
3902
+ const i = s.map((r) => Q(r).unwrap());
3903
+ return Ve({
3891
3904
  suggestions: t.symbol.ofName({ nameStack: i, owner: t.container.element(e) }).flatMap(({ symbol: r }) => t.symbol.members(r)).map(({ kind: r, name: a }) => ({
3892
3905
  label: a,
3893
3906
  insertText: a,
3894
- kind: Ae(r),
3907
+ kind: ve(r),
3895
3908
  range: void 0
3896
3909
  }))
3897
3910
  });
3898
3911
  }
3899
- function Tt(t, e, n) {
3912
+ function It(t, e, n) {
3900
3913
  var i;
3901
3914
  switch (t.container.scopeKind(e)) {
3902
3915
  case O.TABLE:
@@ -3908,8 +3921,8 @@ function Tt(t, e, n) {
3908
3921
  case O.ENUM:
3909
3922
  return is(t, e, n);
3910
3923
  case O.REF: {
3911
- const r = Xt(t, e);
3912
- 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;
3913
3926
  }
3914
3927
  case O.TABLEGROUP:
3915
3928
  return os(t);
@@ -3917,7 +3930,7 @@ function Tt(t, e, n) {
3917
3930
  return D();
3918
3931
  }
3919
3932
  }
3920
- function bt() {
3933
+ function Lt() {
3921
3934
  return {
3922
3935
  suggestions: ["Table", "TableGroup", "Enum", "Project", "Ref"].map((t) => ({
3923
3936
  label: t,
@@ -3929,7 +3942,7 @@ function bt() {
3929
3942
  };
3930
3943
  }
3931
3944
  function is(t, e, n) {
3932
- return n != null && n.callee && nt(e, n) === 1 ? Be(t, e, t.container.element(e), [
3945
+ return n != null && n.callee && it(e, n) === 1 ? Ge(t, e, t.container.element(e), [
3933
3946
  T.Schema,
3934
3947
  T.Table,
3935
3948
  T.Column
@@ -3946,7 +3959,7 @@ function rs(t, e, n) {
3946
3959
  range: void 0
3947
3960
  }))
3948
3961
  };
3949
- const s = nt(e, n);
3962
+ const s = it(e, n);
3950
3963
  return s === 0 ? {
3951
3964
  suggestions: ["Note", "indexes"].map((i) => ({
3952
3965
  label: i,
@@ -3958,7 +3971,7 @@ function rs(t, e, n) {
3958
3971
  } : s === 1 ? cs(t, e) : D();
3959
3972
  }
3960
3973
  function as(t, e, n) {
3961
- return n != null && n.callee ? nt(e, n) === 0 ? {
3974
+ return n != null && n.callee ? it(e, n) === 0 ? {
3962
3975
  suggestions: ["Table", "TableGroup", "Enum", "Note", "Ref"].map((i) => ({
3963
3976
  label: i,
3964
3977
  insertText: i,
@@ -3976,8 +3989,8 @@ function as(t, e, n) {
3976
3989
  }))
3977
3990
  };
3978
3991
  }
3979
- function Xt(t, e) {
3980
- return Be(t, e, t.container.element(e), [
3992
+ function $t(t, e) {
3993
+ return Ge(t, e, t.container.element(e), [
3981
3994
  T.Schema,
3982
3995
  T.Table,
3983
3996
  T.Column
@@ -3986,7 +3999,7 @@ function Xt(t, e) {
3986
3999
  function os(t) {
3987
4000
  return {
3988
4001
  suggestions: [
3989
- ...Fe({
4002
+ ...Ve({
3990
4003
  suggestions: [...t.parse.publicSymbolTable().entries()].flatMap(([e]) => {
3991
4004
  const n = re(e).unwrap_or(void 0);
3992
4005
  if (n === void 0)
@@ -3996,7 +4009,7 @@ function os(t) {
3996
4009
  label: i,
3997
4010
  insertText: i,
3998
4011
  insertTextRules: w.KeepWhitespace,
3999
- kind: Ae(s),
4012
+ kind: ve(s),
4000
4013
  range: void 0
4001
4014
  };
4002
4015
  })
@@ -4012,7 +4025,7 @@ function os(t) {
4012
4025
  };
4013
4026
  }
4014
4027
  function ls(t, e) {
4015
- return $t(t, e);
4028
+ return Wt(t, e);
4016
4029
  }
4017
4030
  function cs(t, e) {
4018
4031
  return {
@@ -4082,19 +4095,19 @@ function cs(t, e) {
4082
4095
  sortText: L.TypeParameter.toString().padStart(2, "0"),
4083
4096
  range: void 0
4084
4097
  })),
4085
- ...Be(t, e, t.container.element(e), [
4098
+ ...Ge(t, e, t.container.element(e), [
4086
4099
  T.Enum,
4087
4100
  T.Schema
4088
4101
  ]).suggestions
4089
4102
  ]
4090
4103
  };
4091
4104
  }
4092
- function $t(t, e) {
4105
+ function Wt(t, e) {
4093
4106
  const n = t.container.element(e), s = n == null ? void 0 : n.parent;
4094
- if (!((s == null ? void 0 : s.symbol) instanceof vt))
4107
+ if (!((s == null ? void 0 : s.symbol) instanceof yt))
4095
4108
  return D();
4096
4109
  const { symbolTable: i } = s.symbol;
4097
- return Fe({
4110
+ return Ve({
4098
4111
  suggestions: [...i.entries()].flatMap(([r]) => {
4099
4112
  const a = re(r).unwrap_or(void 0);
4100
4113
  if (a === void 0)
@@ -4104,25 +4117,25 @@ function $t(t, e) {
4104
4117
  label: l,
4105
4118
  insertText: l,
4106
4119
  insertTextRules: w.KeepWhitespace,
4107
- kind: Ae(T.Column),
4120
+ kind: ve(T.Column),
4108
4121
  range: void 0
4109
4122
  };
4110
4123
  })
4111
4124
  });
4112
4125
  }
4113
- function nt(t, e) {
4126
+ function it(t, e) {
4114
4127
  if (!e.callee)
4115
4128
  return -1;
4116
4129
  const n = [e.callee, ...e.args], s = n.findIndex((i) => t <= i.end);
4117
4130
  return s === -1 ? n.length : s;
4118
4131
  }
4119
- class Wt {
4132
+ class jt {
4120
4133
  constructor(e) {
4121
4134
  this.compiler = e;
4122
4135
  }
4123
4136
  provideDefinition(e, n) {
4124
4137
  var a;
4125
- const { uri: s } = e, i = tt(e, n), r = [...this.compiler.container.stack(i)];
4138
+ const { uri: s } = e, i = st(e, n), r = [...this.compiler.container.stack(i)];
4126
4139
  for (; r.length !== 0; ) {
4127
4140
  const l = r.pop();
4128
4141
  if ((a = l == null ? void 0 : l.referee) != null && a.declaration && [Ne.PRIMARY_EXPRESSION, Ne.VARIABLE].includes(l == null ? void 0 : l.kind)) {
@@ -4143,12 +4156,12 @@ class Wt {
4143
4156
  return [];
4144
4157
  }
4145
4158
  }
4146
- class jt {
4159
+ class Yt {
4147
4160
  constructor(e) {
4148
4161
  this.compiler = e;
4149
4162
  }
4150
4163
  provideReferences(e, n) {
4151
- const { uri: s } = e, i = tt(e, n), r = [...this.compiler.container.stack(i)];
4164
+ const { uri: s } = e, i = st(e, n), r = [...this.compiler.container.stack(i)];
4152
4165
  for (; r.length !== 0; ) {
4153
4166
  const a = r.pop();
4154
4167
  if (a && [
@@ -4176,9 +4189,9 @@ const fs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4176
4189
  __proto__: null,
4177
4190
  CompletionItemInsertTextRule: w,
4178
4191
  CompletionItemKind: L,
4179
- DBMLCompletionItemProvider: Gt,
4180
- DBMLDefinitionProvider: Wt,
4181
- DBMLReferencesProvider: jt
4192
+ DBMLCompletionItemProvider: Ct,
4193
+ DBMLDefinitionProvider: jt,
4194
+ DBMLReferencesProvider: Yt
4182
4195
  }, Symbol.toStringTag, { value: "Module" }));
4183
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 || {});
4184
4197
  class ps {
@@ -4189,7 +4202,7 @@ class ps {
4189
4202
  ).fill(null), this.nodeIdGenerator = new Jt(), this.symbolIdGenerator = new nn(), this.token = {
4190
4203
  invalidStream: this.createQuery(
4191
4204
  6,
4192
- () => this.parse.tokens().filter(wt)
4205
+ () => this.parse.tokens().filter(kt)
4193
4206
  ),
4194
4207
  // Valid + Invalid tokens (which are guarenteed to be non-trivials) are included in the stream
4195
4208
  flatStream: this.createQuery(
@@ -4233,8 +4246,8 @@ class ps {
4233
4246
  let l = this.parse.ast();
4234
4247
  const p = [l];
4235
4248
  for (; ; ) {
4236
- const E = fn(l).find((h) => ge(a, h));
4237
- if (E === void 0 || E instanceof B)
4249
+ const E = fn(l).find((h) => _e(a, h));
4250
+ if (E === void 0 || E instanceof G)
4238
4251
  break;
4239
4252
  p.push(E), l = E;
4240
4253
  }
@@ -4242,16 +4255,16 @@ class ps {
4242
4255
  return p;
4243
4256
  for (; p.length > 0; ) {
4244
4257
  let f = !1;
4245
- const E = Ce(p);
4258
+ const E = $e(p);
4246
4259
  if (E instanceof v) {
4247
4260
  const h = this.parse.source();
4248
4261
  for (let m = E.end; m < e; m += 1)
4249
4262
  h[m] === `
4250
4263
  ` && (p.pop(), f = !0);
4251
4264
  } else
4252
- 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);
4253
4266
  if (f) {
4254
- const h = Ce(p);
4267
+ const h = $e(p);
4255
4268
  h instanceof A && h.end <= e && p.pop();
4256
4269
  }
4257
4270
  if (!f)
@@ -4289,7 +4302,7 @@ class ps {
4289
4302
  ),
4290
4303
  scopeKind: this.createQuery(15, (e) => {
4291
4304
  var s;
4292
- if (this.container.element(e) instanceof $)
4305
+ if (this.container.element(e) instanceof j)
4293
4306
  return 8;
4294
4307
  switch ((s = this.container.element(e).type) == null ? void 0 : s.value.toLowerCase()) {
4295
4308
  case "table":
@@ -4375,9 +4388,9 @@ class ps {
4375
4388
  }
4376
4389
  initMonacoServices() {
4377
4390
  return {
4378
- definitionProvider: new Wt(this),
4379
- referenceProvider: new jt(this),
4380
- autocompletionProvider: new Gt(this)
4391
+ definitionProvider: new jt(this),
4392
+ referenceProvider: new Yt(this),
4393
+ autocompletionProvider: new Ct(this)
4381
4394
  };
4382
4395
  }
4383
4396
  }