@dbml/parse 3.13.3-alpha.1 → 3.13.4

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 (78) hide show
  1. package/LICENSE +0 -0
  2. package/dist/dbml-parse.js +9 -9
  3. package/dist/dbml-parse.mjs +931 -923
  4. package/dist/src/compiler.d.ts +0 -0
  5. package/dist/src/constants.d.ts +0 -0
  6. package/dist/src/index.d.ts +0 -0
  7. package/dist/src/lib/analyzer/analyzer.d.ts +0 -0
  8. package/dist/src/lib/analyzer/binder/binder.d.ts +0 -0
  9. package/dist/src/lib/analyzer/binder/elementBinder/custom.d.ts +0 -0
  10. package/dist/src/lib/analyzer/binder/elementBinder/elementBinder.d.ts +0 -0
  11. package/dist/src/lib/analyzer/binder/elementBinder/enum.d.ts +0 -0
  12. package/dist/src/lib/analyzer/binder/elementBinder/indexes.d.ts +0 -0
  13. package/dist/src/lib/analyzer/binder/elementBinder/note.d.ts +0 -0
  14. package/dist/src/lib/analyzer/binder/elementBinder/project.d.ts +0 -0
  15. package/dist/src/lib/analyzer/binder/elementBinder/ref.d.ts +0 -0
  16. package/dist/src/lib/analyzer/binder/elementBinder/table.d.ts +0 -0
  17. package/dist/src/lib/analyzer/binder/elementBinder/tableGroup.d.ts +0 -0
  18. package/dist/src/lib/analyzer/binder/elementBinder/tablePartial.d.ts +0 -0
  19. package/dist/src/lib/analyzer/binder/types.d.ts +0 -0
  20. package/dist/src/lib/analyzer/binder/utils.d.ts +0 -0
  21. package/dist/src/lib/analyzer/symbol/factory.d.ts +0 -0
  22. package/dist/src/lib/analyzer/symbol/symbolIndex.d.ts +0 -0
  23. package/dist/src/lib/analyzer/symbol/symbolTable.d.ts +0 -0
  24. package/dist/src/lib/analyzer/symbol/symbols.d.ts +0 -0
  25. package/dist/src/lib/analyzer/symbol/utils.d.ts +0 -0
  26. package/dist/src/lib/analyzer/types.d.ts +0 -0
  27. package/dist/src/lib/analyzer/utils.d.ts +0 -0
  28. package/dist/src/lib/analyzer/validator/elementValidators/custom.d.ts +0 -0
  29. package/dist/src/lib/analyzer/validator/elementValidators/enum.d.ts +0 -0
  30. package/dist/src/lib/analyzer/validator/elementValidators/indexes.d.ts +0 -0
  31. package/dist/src/lib/analyzer/validator/elementValidators/note.d.ts +0 -0
  32. package/dist/src/lib/analyzer/validator/elementValidators/project.d.ts +0 -0
  33. package/dist/src/lib/analyzer/validator/elementValidators/ref.d.ts +0 -0
  34. package/dist/src/lib/analyzer/validator/elementValidators/table.d.ts +0 -0
  35. package/dist/src/lib/analyzer/validator/elementValidators/tableGroup.d.ts +0 -0
  36. package/dist/src/lib/analyzer/validator/elementValidators/tablePartial.d.ts +0 -0
  37. package/dist/src/lib/analyzer/validator/types.d.ts +0 -0
  38. package/dist/src/lib/analyzer/validator/utils.d.ts +4 -9
  39. package/dist/src/lib/analyzer/validator/validator.d.ts +0 -0
  40. package/dist/src/lib/errors.d.ts +0 -0
  41. package/dist/src/lib/interpreter/elementInterpreter/enum.d.ts +0 -0
  42. package/dist/src/lib/interpreter/elementInterpreter/project.d.ts +0 -0
  43. package/dist/src/lib/interpreter/elementInterpreter/ref.d.ts +0 -0
  44. package/dist/src/lib/interpreter/elementInterpreter/sticky_note.d.ts +0 -0
  45. package/dist/src/lib/interpreter/elementInterpreter/table.d.ts +0 -0
  46. package/dist/src/lib/interpreter/elementInterpreter/tableGroup.d.ts +0 -0
  47. package/dist/src/lib/interpreter/elementInterpreter/tablePartial.d.ts +0 -0
  48. package/dist/src/lib/interpreter/interpreter.d.ts +0 -0
  49. package/dist/src/lib/interpreter/types.d.ts +0 -0
  50. package/dist/src/lib/interpreter/utils.d.ts +0 -0
  51. package/dist/src/lib/lexer/lexer.d.ts +1 -1
  52. package/dist/src/lib/lexer/tokens.d.ts +0 -0
  53. package/dist/src/lib/lexer/utils.d.ts +0 -0
  54. package/dist/src/lib/option.d.ts +0 -0
  55. package/dist/src/lib/parser/contextStack.d.ts +0 -0
  56. package/dist/src/lib/parser/factory.d.ts +0 -0
  57. package/dist/src/lib/parser/nodes.d.ts +0 -0
  58. package/dist/src/lib/parser/parser.d.ts +0 -0
  59. package/dist/src/lib/parser/utils.d.ts +0 -0
  60. package/dist/src/lib/report.d.ts +0 -0
  61. package/dist/src/lib/serialization/serialize.d.ts +0 -0
  62. package/dist/src/lib/types.d.ts +0 -0
  63. package/dist/src/lib/utils.d.ts +3 -1
  64. package/dist/src/services/definition/provider.d.ts +0 -0
  65. package/dist/src/services/index.d.ts +0 -0
  66. package/dist/src/services/references/provider.d.ts +0 -0
  67. package/dist/src/services/suggestions/provider.d.ts +0 -0
  68. package/dist/src/services/suggestions/utils.d.ts +0 -0
  69. package/dist/src/services/types.d.ts +0 -0
  70. package/dist/src/services/utils.d.ts +0 -0
  71. package/dist/tests/NaN_errors/interpreter_NaN.test.d.ts +0 -0
  72. package/dist/tests/binder/binder.test.d.ts +0 -0
  73. package/dist/tests/interpreter/interpreter.test.d.ts +0 -0
  74. package/dist/tests/jestHelpers.d.ts +0 -0
  75. package/dist/tests/lexer/lexer.test.d.ts +0 -0
  76. package/dist/tests/parser/parser.test.d.ts +0 -0
  77. package/dist/tests/validator/validator.test.d.ts +0 -0
  78. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
- import g, { last as Ve, forIn as pt, partition as Pt, head as on, findLastIndex as ln } from "lodash";
2
- var h = /* @__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.TILDE = "<tilde>", t.SINGLE_LINE_COMMENT = "<single-line-comment>", t.MULTILINE_COMMENT = "<multiline-comment>", t))(h || {});
3
- function cn(t) {
1
+ import g, { last as Ve, forIn as Ge, partition as Pt, head as ln, findLastIndex as cn } from "lodash";
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.TILDE = "<tilde>", t.SINGLE_LINE_COMMENT = "<single-line-comment>", t.MULTILINE_COMMENT = "<multiline-comment>", t))(u || {});
3
+ function un(t) {
4
4
  switch (t.kind) {
5
5
  case "<newline>":
6
6
  case "<space>":
@@ -12,7 +12,7 @@ function cn(t) {
12
12
  return !1;
13
13
  }
14
14
  }
15
- function dt(t) {
15
+ function hn(t) {
16
16
  if (!t)
17
17
  return !1;
18
18
  switch (t) {
@@ -36,22 +36,22 @@ function dt(t) {
36
36
  function Et(t) {
37
37
  return t !== void 0 && t.kind === "<op>";
38
38
  }
39
- class J {
39
+ class Q {
40
40
  constructor(e, n, s, i, a) {
41
41
  this.kind = e, this.startPos = n, this.endPos = s, this.value = i, this.leadingTrivia = [], this.trailingTrivia = [], this.leadingInvalid = [], this.trailingInvalid = [], this.isInvalid = a, this.start = n.offset, this.end = s.offset;
42
42
  }
43
43
  static create(e, n, s, i, a) {
44
- return new J(e, n, s, i, a);
44
+ return new Q(e, n, s, i, a);
45
45
  }
46
46
  }
47
47
  function St(t) {
48
- return t.trailingTrivia.find(({ kind: e }) => e === h.NEWLINE) !== void 0;
48
+ return t.trailingTrivia.find(({ kind: e }) => e === u.NEWLINE) !== void 0;
49
49
  }
50
50
  function Nt(t, e) {
51
- return e.leadingTrivia.find(({ kind: s }) => s === h.NEWLINE) !== void 0 || St(t);
51
+ return e.leadingTrivia.find(({ kind: s }) => s === u.NEWLINE) !== void 0 || St(t);
52
52
  }
53
53
  function et(t) {
54
- return t.trailingTrivia.find(({ kind: e }) => [h.SPACE, h.TAB].includes(e)) !== void 0;
54
+ return t.trailingTrivia.find(({ kind: e }) => [u.SPACE, u.TAB].includes(e)) !== void 0;
55
55
  }
56
56
  function Dt(t) {
57
57
  return t.trailingTrivia.length === 0 ? t.end : Dt(Ve(t.trailingTrivia));
@@ -59,12 +59,12 @@ function Dt(t) {
59
59
  function xt(t) {
60
60
  return t.leadingTrivia.length === 0 ? t.start : xt(t.leadingTrivia[0]);
61
61
  }
62
- function un(t) {
63
- return [h.SINGLE_LINE_COMMENT, h.MULTILINE_COMMENT].includes(
62
+ function fn(t) {
63
+ return [u.SINGLE_LINE_COMMENT, u.MULTILINE_COMMENT].includes(
64
64
  t.kind
65
65
  );
66
66
  }
67
- class hn {
67
+ class pn {
68
68
  constructor() {
69
69
  this.id = 0;
70
70
  }
@@ -81,21 +81,21 @@ class x {
81
81
  constructor(e, n, s) {
82
82
  this.id = e, this.kind = n;
83
83
  const i = s.find((r) => r !== void 0 && !Number.isNaN(r.start));
84
- i ? (this.startPos = i.startPos, this.fullStart = i instanceof J ? xt(i) : i.fullStart) : (this.startPos = {
84
+ i ? (this.startPos = i.startPos, this.fullStart = i instanceof Q ? xt(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 a = [...s].reverse().find((r) => r !== void 0 && !Number.isNaN(r.end));
90
- a ? (this.endPos = a.endPos, this.fullEnd = a instanceof J ? Dt(a) : a.fullEnd) : (this.endPos = {
90
+ a ? (this.endPos = a.endPos, this.fullEnd = a instanceof Q ? Dt(a) : a.fullEnd) : (this.endPos = {
91
91
  offset: NaN,
92
92
  column: NaN,
93
93
  line: NaN
94
94
  }, this.fullEnd = NaN), this.start = this.startPos.offset, this.end = this.endPos.offset;
95
95
  }
96
96
  }
97
- var Ie = /* @__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.PARTIAL_INJECTION = "<partial-injection>", t))(Ie || {});
98
- class Z extends x {
97
+ var me = /* @__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.PARTIAL_INJECTION = "<partial-injection>", t))(me || {});
98
+ class K extends x {
99
99
  constructor({ body: e = [], eof: n }, s) {
100
100
  super(s, "<program>", [...e, n]), this.body = e, this.eof = n;
101
101
  }
@@ -109,8 +109,8 @@ class y extends x {
109
109
  attributeList: a,
110
110
  bodyColon: r,
111
111
  body: c
112
- }, p) {
113
- if (super(p, "<element-declaration>", [
112
+ }, f) {
113
+ if (super(f, "<element-declaration>", [
114
114
  e,
115
115
  n,
116
116
  s,
@@ -123,12 +123,12 @@ class y extends x {
123
123
  this.type = e, this.name = n, this.as = s, this.alias = i, this.attributeList = a, this.bodyColon = r, this.body = c;
124
124
  }
125
125
  }
126
- class te extends x {
126
+ class ne extends x {
127
127
  constructor({ identifiers: e = [] }, n) {
128
128
  super(n, "<identifer-stream>", e || []), this.identifiers = e;
129
129
  }
130
130
  }
131
- class ne extends x {
131
+ class se extends x {
132
132
  constructor({
133
133
  name: e,
134
134
  colon: n,
@@ -137,7 +137,7 @@ class ne extends x {
137
137
  super(i, "<attribute>", [e, n, s]), this.name = e, this.value = s, this.colon = n;
138
138
  }
139
139
  }
140
- class oe extends x {
140
+ class Z extends x {
141
141
  constructor({ op: e, expression: n }, s) {
142
142
  super(s, "<prefix-expression>", [e, n]), this.op = e, this.expression = n;
143
143
  }
@@ -151,7 +151,7 @@ class le extends x {
151
151
  super(i, "<infix-expression>", [n, e, s]), this.op = e, this.leftExpression = n, this.rightExpression = s;
152
152
  }
153
153
  }
154
- class Ye extends x {
154
+ class qe extends x {
155
155
  constructor({ op: e, expression: n }, s) {
156
156
  super(s, "<postfix-expression>", [n, e]), this.op = e, this.expression = n;
157
157
  }
@@ -166,7 +166,7 @@ class w extends x {
166
166
  super(s, "<function-application>", [e, ...n]), this.callee = e, this.args = n;
167
167
  }
168
168
  }
169
- class ae extends x {
169
+ class oe extends x {
170
170
  constructor({
171
171
  blockOpenBrace: e,
172
172
  body: n = [],
@@ -175,7 +175,7 @@ class ae extends x {
175
175
  super(i, "<block-expression>", [e, ...n, s]), this.blockOpenBrace = e, this.body = n, this.blockCloseBrace = s;
176
176
  }
177
177
  }
178
- class Le extends x {
178
+ class be extends x {
179
179
  constructor({ op: e, partial: n }, s) {
180
180
  super(s, "<partial-injection>", [e, n]), this.partial = n;
181
181
  }
@@ -208,7 +208,7 @@ class ce extends x {
208
208
  ]), this.tupleOpenParen = e, this.elementList = n, this.commaList = s, this.tupleCloseParen = i;
209
209
  }
210
210
  }
211
- class tt extends ce {
211
+ class nt extends ce {
212
212
  constructor({
213
213
  groupOpenParen: e,
214
214
  expression: n,
@@ -225,7 +225,7 @@ class tt extends ce {
225
225
  ), this.kind = "<group-expression>";
226
226
  }
227
227
  }
228
- class H extends x {
228
+ class ee extends x {
229
229
  constructor({
230
230
  callee: e,
231
231
  argumentList: n
@@ -238,23 +238,23 @@ class ye extends x {
238
238
  super(n, "<literal>", [e]), this.literal = e;
239
239
  }
240
240
  }
241
- class ie extends x {
241
+ class re extends x {
242
242
  constructor({ variable: e }, n) {
243
243
  super(n, "<variable>", [e]), this.variable = e;
244
244
  }
245
245
  }
246
- class $ extends x {
246
+ class j extends x {
247
247
  constructor({ expression: e }, n) {
248
248
  super(n, "<primary-expression>", [e]), this.expression = e;
249
249
  }
250
250
  }
251
251
  class Me extends x {
252
252
  constructor({ pre: e }, n) {
253
- const s = J.create(h.SPACE, e.endPos, e.endPos, " ", !1);
253
+ const s = Q.create(u.SPACE, e.endPos, e.endPos, " ", !1);
254
254
  super(n, "<dummy>", [s]);
255
255
  }
256
256
  }
257
- class he extends x {
257
+ class Ie extends x {
258
258
  constructor({ expression: e, indexer: n }, s) {
259
259
  super(s, "<array>", [e, n]), this.array = e, this.indexer = n;
260
260
  }
@@ -269,12 +269,12 @@ function Ot(t, e) {
269
269
  (i) => i !== null
270
270
  );
271
271
  }
272
- function Ps(t, e = !1) {
272
+ function Ss(t, e = !1) {
273
273
  return JSON.stringify(
274
274
  t,
275
275
  function(n, s) {
276
276
  var i;
277
- return !(this instanceof Z) && n === "symbol" ? s == null ? void 0 : s.id : (
277
+ return !(this instanceof K) && n === "symbol" ? s == null ? void 0 : s.id : (
278
278
  /* this instanceof SyntaxNode && */
279
279
  n === "symbol" ? {
280
280
  symbolTable: s == null ? void 0 : s.symbolTable,
@@ -340,31 +340,31 @@ class S {
340
340
  }
341
341
  }
342
342
  var m = /* @__PURE__ */ ((t) => (t.Schema = "Schema", t.Table = "Table", t.Column = "Column", t.TableGroup = "TableGroup", t.TableGroupField = "TableGroup field", t.Enum = "Enum", t.EnumField = "Enum field", t.Note = "Note", t.TablePartial = "TablePartial", t.TablePartialInjection = "TablePartialInjection", t))(m || {});
343
- function nt(t) {
343
+ function st(t) {
344
344
  return `Schema:${t}`;
345
345
  }
346
- function Ge(t) {
346
+ function Ce(t) {
347
347
  return `Table:${t}`;
348
348
  }
349
- function qe(t) {
349
+ function He(t) {
350
350
  return `Column:${t}`;
351
351
  }
352
- function st(t) {
352
+ function it(t) {
353
353
  return `Enum:${t}`;
354
354
  }
355
- function it(t) {
355
+ function at(t) {
356
356
  return `Enum field:${t}`;
357
357
  }
358
- function at(t) {
358
+ function rt(t) {
359
359
  return `TableGroup:${t}`;
360
360
  }
361
- function rt(t) {
361
+ function ot(t) {
362
362
  return `TableGroup field:${t}`;
363
363
  }
364
- function fn(t) {
364
+ function dn(t) {
365
365
  return `Note:${t}`;
366
366
  }
367
- function ot(t) {
367
+ function lt(t) {
368
368
  return `TablePartial:${t}`;
369
369
  }
370
370
  function Rt(t) {
@@ -373,48 +373,48 @@ function Rt(t) {
373
373
  function Fe(t, e) {
374
374
  switch (e) {
375
375
  case "Column":
376
- return qe(t);
376
+ return He(t);
377
377
  case "Enum":
378
- return st(t);
379
- case "Enum field":
380
378
  return it(t);
379
+ case "Enum field":
380
+ return at(t);
381
381
  case "Schema":
382
- return nt(t);
382
+ return st(t);
383
383
  case "Table":
384
- return Ge(t);
384
+ return Ce(t);
385
385
  case "TableGroup":
386
- return at(t);
387
- case "TableGroup field":
388
386
  return rt(t);
389
- case "TablePartial":
387
+ case "TableGroup field":
390
388
  return ot(t);
389
+ case "TablePartial":
390
+ return lt(t);
391
391
  default:
392
392
  throw new Error("Unreachable");
393
393
  }
394
394
  }
395
- function re(t) {
395
+ function ie(t) {
396
396
  const [e, n] = t.split(":");
397
397
  return Object.values(m).includes(e) ? new U({
398
398
  name: n,
399
399
  kind: e
400
400
  }) : new S();
401
401
  }
402
- function pn(t) {
403
- const e = re(t).unwrap_or(void 0);
402
+ function En(t) {
403
+ const e = ie(t).unwrap_or(void 0);
404
404
  if (!e)
405
405
  return !1;
406
406
  const { kind: n, name: s } = e;
407
407
  return n === "Schema" && s === "public";
408
408
  }
409
- function dn(t) {
410
- const e = re(t).unwrap_or(void 0);
409
+ function Nn(t) {
410
+ const e = ie(t).unwrap_or(void 0);
411
411
  if (!e)
412
412
  return !1;
413
413
  const { kind: n } = e;
414
414
  return n === "TablePartialInjection";
415
415
  }
416
- function En(t) {
417
- const e = re(t).unwrap_or(void 0);
416
+ function Tn(t) {
417
+ const e = ie(t).unwrap_or(void 0);
418
418
  if (!e)
419
419
  return null;
420
420
  const { kind: n, name: s } = e;
@@ -424,7 +424,7 @@ function En(t) {
424
424
  /* TablePartial */
425
425
  ) : null;
426
426
  }
427
- class Nn {
427
+ class mn {
428
428
  constructor() {
429
429
  this.id = 0;
430
430
  }
@@ -440,12 +440,12 @@ class Ut {
440
440
  this.references = [], this.id = n, this.symbolTable = e;
441
441
  }
442
442
  }
443
- class Tn {
443
+ class bn {
444
444
  constructor({ symbolTable: e, declaration: n }, s) {
445
445
  this.references = [], this.id = s, this.symbolTable = e, this.declaration = n;
446
446
  }
447
447
  }
448
- class mn {
448
+ class In {
449
449
  constructor({ declaration: e }, n) {
450
450
  this.references = [], this.id = n, this.declaration = e;
451
451
  }
@@ -455,65 +455,65 @@ class Mt {
455
455
  this.references = [], this.id = s, this.symbolTable = e, this.declaration = n;
456
456
  }
457
457
  }
458
- class lt {
458
+ class ct {
459
459
  constructor({ declaration: e }, n) {
460
460
  this.references = [], this.id = n, this.declaration = e;
461
461
  }
462
462
  }
463
- class bn {
463
+ class Ln {
464
464
  constructor({ symbolTable: e, declaration: n }, s) {
465
465
  this.references = [], this.id = s, this.symbolTable = e, this.declaration = n;
466
466
  }
467
467
  }
468
- class In {
468
+ class An {
469
469
  constructor({ declaration: e }, n) {
470
470
  this.references = [], this.id = n, this.declaration = e;
471
471
  }
472
472
  }
473
- class Ln {
473
+ class _n {
474
474
  constructor({ symbolTable: e, declaration: n }, s) {
475
475
  this.references = [], this.id = s, this.symbolTable = e, this.declaration = n;
476
476
  }
477
477
  }
478
- class An {
478
+ class gn {
479
479
  constructor({ declaration: e }, n) {
480
480
  this.references = [], this.id = n, this.declaration = e;
481
481
  }
482
482
  }
483
- class _n {
483
+ class vn {
484
484
  constructor({ injectorFieldSymbol: e, injectorDeclaration: n }, s) {
485
485
  this.references = [], this.id = s, this.injectorDeclaration = n, this.injectorFieldSymbol = e;
486
486
  }
487
487
  }
488
- function gn(t) {
488
+ function wn(t) {
489
489
  return [
490
- nt,
491
- Ge,
492
490
  st,
493
- at,
494
- qe,
491
+ Ce,
495
492
  it,
496
493
  rt,
494
+ He,
495
+ at,
497
496
  ot,
497
+ lt,
498
498
  Rt
499
499
  ].map((e) => e(t));
500
500
  }
501
- function vn(t) {
502
- return t instanceof lt ? _n : null;
501
+ function yn(t) {
502
+ return t instanceof ct ? vn : null;
503
503
  }
504
- function He(t) {
504
+ function ze(t) {
505
505
  return !!t.match(/(\p{L}|_|\p{M})/gu);
506
506
  }
507
- function Ce(t) {
507
+ function Xe(t) {
508
508
  const [e] = t;
509
509
  return e >= "0" && e <= "9";
510
510
  }
511
- function wn(t) {
511
+ function kn(t) {
512
512
  const [e] = t;
513
- return Ce(e) || He(e) && e.toLowerCase() >= "a" && e.toLowerCase() <= "f";
513
+ return Xe(e) || ze(e) && e.toLowerCase() >= "a" && e.toLowerCase() <= "f";
514
514
  }
515
515
  function ve(t) {
516
- return He(t) || Ce(t);
516
+ return ze(t) || Xe(t);
517
517
  }
518
518
  function Tt(t, e) {
519
519
  const n = [], s = Math.min(t.length, e.length);
@@ -524,13 +524,21 @@ function Tt(t, e) {
524
524
  function Se(t, e) {
525
525
  return t >= e.start && t < e.end;
526
526
  }
527
+ function Ft(t) {
528
+ var e;
529
+ return t instanceof Z ? `${(e = t.op) == null ? void 0 : e.value}${Ft(t.expression)}` : t.expression.literal.value;
530
+ }
531
+ function tt(t) {
532
+ var e;
533
+ return t instanceof Z ? ((e = t.op) == null ? void 0 : e.value) === "-" ? -tt(t.expression) : tt(t.expression) : Number.parseFloat(t.expression.literal.value);
534
+ }
527
535
  var o = /* @__PURE__ */ ((t) => (t[t.UNKNOWN_SYMBOL = 1e3] = "UNKNOWN_SYMBOL", t[t.UNEXPECTED_SYMBOL = 1001] = "UNEXPECTED_SYMBOL", t[t.UNEXPECTED_EOF = 1002] = "UNEXPECTED_EOF", t[t.UNEXPECTED_NEWLINE = 1003] = "UNEXPECTED_NEWLINE", t[t.UNKNOWN_TOKEN = 1004] = "UNKNOWN_TOKEN", t[t.UNEXPECTED_TOKEN = 1005] = "UNEXPECTED_TOKEN", t[t.UNEXPECTED_ELEMENT_DECLARATION = 1006] = "UNEXPECTED_ELEMENT_DECLARATION", t[t.MISSING_SPACES = 1007] = "MISSING_SPACES", t[t.UNKNOWN_PREFIX_OP = 1008] = "UNKNOWN_PREFIX_OP", t[t.INVALID_OPERAND = 1009] = "INVALID_OPERAND", t[t.EMPTY_ATTRIBUTE_NAME = 1010] = "EMPTY_ATTRIBUTE_NAME", t[t.INVALID_ESCAPE_SEQUENCE = 1011] = "INVALID_ESCAPE_SEQUENCE", t[t.INVALID_NAME = 3e3] = "INVALID_NAME", t[t.UNEXPECTED_NAME = 3001] = "UNEXPECTED_NAME", t[t.NAME_NOT_FOUND = 3002] = "NAME_NOT_FOUND", t[t.DUPLICATE_NAME = 3003] = "DUPLICATE_NAME", t[t.INVALID_ALIAS = 3004] = "INVALID_ALIAS", t[t.UNEXPECTED_ALIAS = 3005] = "UNEXPECTED_ALIAS", t[t.UNEXPECTED_SETTINGS = 3006] = "UNEXPECTED_SETTINGS", t[t.INVALID_SETTINGS = 3007] = "INVALID_SETTINGS", t[t.UNEXPECTED_SIMPLE_BODY = 3008] = "UNEXPECTED_SIMPLE_BODY", t[t.UNEXPECTED_COMPLEX_BODY = 3009] = "UNEXPECTED_COMPLEX_BODY", t[t.INVALID_TABLE_CONTEXT = 3010] = "INVALID_TABLE_CONTEXT", t[t.INVALID_TABLE_SETTING = 3011] = "INVALID_TABLE_SETTING", t[t.DUPLICATE_TABLE_SETTING = 3012] = "DUPLICATE_TABLE_SETTING", t[t.INVALID_TABLEGROUP_CONTEXT = 3013] = "INVALID_TABLEGROUP_CONTEXT", t[t.INVALID_TABLEGROUP_ELEMENT_NAME = 3014] = "INVALID_TABLEGROUP_ELEMENT_NAME", t[t.DUPLICATE_TABLEGROUP_ELEMENT_NAME = 3015] = "DUPLICATE_TABLEGROUP_ELEMENT_NAME", t[t.DUPLICATE_TABLEGROUP_FIELD_NAME = 3016] = "DUPLICATE_TABLEGROUP_FIELD_NAME", t[t.INVALID_TABLEGROUP_FIELD = 3017] = "INVALID_TABLEGROUP_FIELD", t[t.EMPTY_TABLE = 3018] = "EMPTY_TABLE", t[t.INVALID_COLUMN = 3019] = "INVALID_COLUMN", t[t.INVALID_COLUMN_NAME = 3020] = "INVALID_COLUMN_NAME", t[t.UNKNOWN_COLUMN_SETTING = 3021] = "UNKNOWN_COLUMN_SETTING", t[t.INVALID_COLUMN_TYPE = 3022] = "INVALID_COLUMN_TYPE", t[t.DUPLICATE_COLUMN_NAME = 3023] = "DUPLICATE_COLUMN_NAME", t[t.DUPLICATE_COLUMN_SETTING = 3024] = "DUPLICATE_COLUMN_SETTING", t[t.INVALID_COLUMN_SETTING_VALUE = 3025] = "INVALID_COLUMN_SETTING_VALUE", t[t.INVALID_ENUM_CONTEXT = 3026] = "INVALID_ENUM_CONTEXT", t[t.INVALID_ENUM_ELEMENT_NAME = 3027] = "INVALID_ENUM_ELEMENT_NAME", t[t.INVALID_ENUM_ELEMENT = 3028] = "INVALID_ENUM_ELEMENT", t[t.DUPLICATE_ENUM_ELEMENT_NAME = 3029] = "DUPLICATE_ENUM_ELEMENT_NAME", t[t.UNKNOWN_ENUM_ELEMENT_SETTING = 3030] = "UNKNOWN_ENUM_ELEMENT_SETTING", t[t.DUPLICATE_ENUM_ELEMENT_SETTING = 3031] = "DUPLICATE_ENUM_ELEMENT_SETTING", t[t.INVALID_ENUM_ELEMENT_SETTING = 3032] = "INVALID_ENUM_ELEMENT_SETTING", t[t.EMPTY_ENUM = 3033] = "EMPTY_ENUM", t[t.INVALID_REF_CONTEXT = 3034] = "INVALID_REF_CONTEXT", t[t.UNKNOWN_REF_SETTING = 3035] = "UNKNOWN_REF_SETTING", t[t.DUPLICATE_REF_SETTING = 3036] = "DUPLICATE_REF_SETTING", t[t.INVALID_REF_SETTING_VALUE = 3037] = "INVALID_REF_SETTING_VALUE", t[t.INVALID_REF_RELATIONSHIP = 3038] = "INVALID_REF_RELATIONSHIP", t[t.INVALID_REF_FIELD = 3039] = "INVALID_REF_FIELD", t[t.EMPTY_REF = 3040] = "EMPTY_REF", t[t.REF_REDEFINED = 3041] = "REF_REDEFINED", t[t.INVALID_NOTE_CONTEXT = 3042] = "INVALID_NOTE_CONTEXT", t[t.INVALID_NOTE = 3043] = "INVALID_NOTE", t[t.NOTE_REDEFINED = 3044] = "NOTE_REDEFINED", t[t.NOTE_CONTENT_REDEFINED = 3045] = "NOTE_CONTENT_REDEFINED", t[t.EMPTY_NOTE = 3046] = "EMPTY_NOTE", t[t.INVALID_INDEXES_CONTEXT = 3047] = "INVALID_INDEXES_CONTEXT", t[t.INVALID_INDEXES_FIELD = 3048] = "INVALID_INDEXES_FIELD", t[t.INVALID_INDEX = 3049] = "INVALID_INDEX", t[t.UNKNOWN_INDEX_SETTING = 3050] = "UNKNOWN_INDEX_SETTING", t[t.DUPLICATE_INDEX_SETTING = 3051] = "DUPLICATE_INDEX_SETTING", t[t.UNEXPECTED_INDEX_SETTING_VALUE = 3052] = "UNEXPECTED_INDEX_SETTING_VALUE", t[t.INVALID_INDEX_SETTING_VALUE = 3053] = "INVALID_INDEX_SETTING_VALUE", t[t.INVALID_PROJECT_CONTEXT = 3054] = "INVALID_PROJECT_CONTEXT", t[t.PROJECT_REDEFINED = 3055] = "PROJECT_REDEFINED", t[t.INVALID_PROJECT_FIELD = 3056] = "INVALID_PROJECT_FIELD", t[t.INVALID_CUSTOM_CONTEXT = 3057] = "INVALID_CUSTOM_CONTEXT", t[t.INVALID_CUSTOM_ELEMENT_VALUE = 3058] = "INVALID_CUSTOM_ELEMENT_VALUE", t[t.INVALID_ELEMENT_IN_SIMPLE_BODY = 3059] = "INVALID_ELEMENT_IN_SIMPLE_BODY", t[t.INVALID_TABLE_PARTIAL_CONTEXT = 3060] = "INVALID_TABLE_PARTIAL_CONTEXT", t[t.INVALID_TABLE_PARTIAL_ELEMENT_NAME = 3061] = "INVALID_TABLE_PARTIAL_ELEMENT_NAME", t[t.INVALID_TABLE_PARTIAL_SETTING = 3062] = "INVALID_TABLE_PARTIAL_SETTING", t[t.DUPLICATE_TABLE_PARTIAL_ELEMENT_NAME = 3063] = "DUPLICATE_TABLE_PARTIAL_ELEMENT_NAME", t[t.DUPLICATE_TABLE_PARTIAL_SETTING = 3064] = "DUPLICATE_TABLE_PARTIAL_SETTING", t[t.INVALID_TABLE_PARTIAL_INJECTION = 3065] = "INVALID_TABLE_PARTIAL_INJECTION", t[t.INVALID_TABLE_PARTIAL_INJECTION_OP = 3066] = "INVALID_TABLE_PARTIAL_INJECTION_OP", t[t.INVALID_TABLE_PARTIAL_INJECTION_NAME = 3067] = "INVALID_TABLE_PARTIAL_INJECTION_NAME", t[t.DUPLICATE_TABLE_PARTIAL_INJECTION_NAME = 3068] = "DUPLICATE_TABLE_PARTIAL_INJECTION_NAME", t[t.BINDING_ERROR = 4e3] = "BINDING_ERROR", t[t.UNSUPPORTED = 5e3] = "UNSUPPORTED", t[t.CIRCULAR_REF = 5001] = "CIRCULAR_REF", t[t.SAME_ENDPOINT = 5002] = "SAME_ENDPOINT", t[t.UNEQUAL_FIELDS_BINARY_REF = 5003] = "UNEQUAL_FIELDS_BINARY_REF", t[t.CONFLICTING_SETTING = 5004] = "CONFLICTING_SETTING", t[t.TABLE_REAPPEAR_IN_TABLEGROUP = 5005] = "TABLE_REAPPEAR_IN_TABLEGROUP", t))(o || {});
528
536
  class l extends Error {
529
537
  constructor(e, n, s) {
530
538
  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, l.prototype);
531
539
  }
532
540
  }
533
- class K {
541
+ class J {
534
542
  constructor(e, n) {
535
543
  this.value = e, this.errors = n === void 0 ? [] : n;
536
544
  }
@@ -542,17 +550,17 @@ class K {
542
550
  }
543
551
  chain(e) {
544
552
  const n = e(this.value), s = [...this.errors, ...n.errors];
545
- return new K(n.value, s);
553
+ return new J(n.value, s);
546
554
  }
547
555
  map(e) {
548
- return new K(e(this.value), this.errors);
556
+ return new J(e(this.value), this.errors);
549
557
  }
550
558
  }
551
- function yn(t, e, n) {
552
- if (!t || !fe(t) || e.length === 0)
559
+ function Pn(t, e, n) {
560
+ if (!t || !Ne(t) || e.length === 0)
553
561
  return new S();
554
562
  const s = [...e], i = Ze(t).unwrap(), a = s.pop();
555
- if (!(a instanceof ae))
563
+ if (!(a instanceof oe))
556
564
  return new S();
557
565
  const r = g.last(s) instanceof M ? s.pop() : void 0;
558
566
  return s.length === 3 && Ze(s[1]).unwrap().value === "as" ? new U(
@@ -580,56 +588,56 @@ function yn(t, e, n) {
580
588
  ) : new S();
581
589
  }
582
590
  function mt(t) {
583
- return t.kind === h.IDENTIFIER && t.value === "as";
591
+ return t.kind === u.IDENTIFIER && t.value === "as";
584
592
  }
585
593
  function b(t) {
586
- t && (t instanceof J ? kn(t) : Pn(t));
594
+ t && (t instanceof Q ? Sn(t) : Dn(t));
587
595
  }
588
- function kn(t) {
589
- t.kind !== h.EOF && (t.isInvalid = !0);
596
+ function Sn(t) {
597
+ t.kind !== u.EOF && (t.isInvalid = !0);
590
598
  }
591
- function Pn(t) {
599
+ function Dn(t) {
592
600
  if (t instanceof y)
593
601
  b(t.type), b(t.name), b(t.as), b(t.alias), b(t.bodyColon), b(t.attributeList), b(t.body);
594
- else if (t instanceof te)
595
- t.identifiers.forEach(b);
596
602
  else if (t instanceof ne)
603
+ t.identifiers.forEach(b);
604
+ else if (t instanceof se)
597
605
  b(t.name), b(t.colon), b(t.value);
598
- else if (t instanceof oe)
606
+ else if (t instanceof Z)
599
607
  b(t.op), b(t.expression);
600
608
  else if (t instanceof le)
601
609
  b(t.leftExpression), b(t.op), b(t.rightExpression);
602
- else if (t instanceof Ye)
610
+ else if (t instanceof qe)
603
611
  b(t.op), b(t.expression);
604
- else if (t instanceof ae)
612
+ else if (t instanceof oe)
605
613
  b(t.blockOpenBrace), t.body.forEach(b), b(t.blockCloseBrace);
606
614
  else if (t instanceof M)
607
615
  b(t.listOpenBracket), t.commaList.forEach(b), t.elementList.forEach(b), b(t.listCloseBracket);
608
616
  else if (t instanceof ce)
609
617
  b(t.tupleOpenParen), t.commaList.forEach(b), t.elementList.forEach(b), b(t.tupleCloseParen);
610
- else if (t instanceof H)
618
+ else if (t instanceof ee)
611
619
  b(t.callee), b(t.argumentList);
612
620
  else if (t instanceof w)
613
621
  b(t.callee), t.args.forEach(b);
614
- else if (t instanceof $)
622
+ else if (t instanceof j)
615
623
  b(t.expression);
616
624
  else if (t instanceof ue)
617
625
  b(t.value);
618
- else if (t instanceof ie)
626
+ else if (t instanceof re)
619
627
  b(t.variable);
620
628
  else if (t instanceof ye)
621
629
  b(t.literal);
622
630
  else
623
- throw t instanceof tt ? new Error("This case is handled by the TupleExpressionNode case") : new Error("Unreachable case in markInvalidNode");
631
+ throw t instanceof nt ? new Error("This case is handled by the TupleExpressionNode case") : new Error("Unreachable case in markInvalidNode");
624
632
  }
625
- function Ft(t) {
633
+ function Bt(t) {
626
634
  return !!(t != null && t.isInvalid);
627
635
  }
628
636
  function C(...t) {
629
637
  return t.filter((e) => e !== void 0);
630
638
  }
631
- function Sn(t) {
632
- if (t instanceof Z)
639
+ function xn(t) {
640
+ if (t instanceof K)
633
641
  return C(...t.body, t.eof);
634
642
  if (t instanceof y)
635
643
  return C(
@@ -641,25 +649,25 @@ function Sn(t) {
641
649
  t.bodyColon,
642
650
  t.body
643
651
  );
644
- if (t instanceof ne)
652
+ if (t instanceof se)
645
653
  return C(t.name, t.colon, t.value);
646
- if (t instanceof te)
654
+ if (t instanceof ne)
647
655
  return t.identifiers;
648
656
  if (t instanceof ye)
649
657
  return t.literal ? [t.literal] : [];
650
- if (t instanceof ie)
658
+ if (t instanceof re)
651
659
  return C(t.variable);
652
- if (t instanceof oe)
660
+ if (t instanceof Z)
653
661
  return C(t.op, t.expression);
654
662
  if (t instanceof le)
655
663
  return C(t.leftExpression, t.op, t.rightExpression);
656
- if (t instanceof Ye)
664
+ if (t instanceof qe)
657
665
  return C(t.expression, t.op);
658
666
  if (t instanceof ue)
659
667
  return C(t.value);
660
668
  if (t instanceof w)
661
669
  return C(t.callee, ...t.args);
662
- if (t instanceof ae)
670
+ if (t instanceof oe)
663
671
  return C(t.blockOpenBrace, ...t.body, t.blockCloseBrace);
664
672
  if (t instanceof M)
665
673
  return C(
@@ -673,34 +681,34 @@ function Sn(t) {
673
681
  ...Tt(t.elementList, t.commaList),
674
682
  t.tupleCloseParen
675
683
  );
676
- if (t instanceof H)
684
+ if (t instanceof ee)
677
685
  return C(t.callee, t.argumentList);
678
- if (t instanceof $)
686
+ if (t instanceof j)
679
687
  return C(t.expression);
680
- if (t instanceof he)
688
+ if (t instanceof Ie)
681
689
  return C(
682
690
  t.array,
683
691
  t.indexer
684
692
  );
685
- if (t instanceof Le)
693
+ if (t instanceof be)
686
694
  return C(t.partial);
687
- throw t instanceof tt ? new Error("This case is already handled by TupleExpressionNode") : new Error("Unreachable - no other possible cases");
695
+ throw t instanceof nt ? new Error("This case is already handled by TupleExpressionNode") : new Error("Unreachable - no other possible cases");
688
696
  }
689
697
  function Ze(t) {
690
- return j(t) ? new U(t.expression.variable) : new S();
698
+ return $(t) ? new U(t.expression.variable) : new S();
691
699
  }
692
- function W(t) {
700
+ function Y(t) {
693
701
  var e;
694
- return t instanceof $ && (t.expression instanceof ie && t.expression.variable instanceof J && t.expression.variable.kind === h.QUOTED_STRING || t.expression instanceof ye && ((e = t.expression.literal) == null ? void 0 : e.kind) === h.STRING_LITERAL);
702
+ return t instanceof j && (t.expression instanceof re && t.expression.variable instanceof Q && t.expression.variable.kind === u.QUOTED_STRING || t.expression instanceof ye && ((e = t.expression.literal) == null ? void 0 : e.kind) === u.STRING_LITERAL);
695
703
  }
696
- function j(t) {
697
- return t instanceof $ && t.expression instanceof ie && t.expression.variable instanceof J;
704
+ function $(t) {
705
+ return t instanceof j && t.expression instanceof re && t.expression.variable instanceof Q;
698
706
  }
699
- function fe(t) {
707
+ function Ne(t) {
700
708
  var e;
701
- return t instanceof $ && t.expression instanceof ie && ((e = t.expression.variable) == null ? void 0 : e.kind) === h.IDENTIFIER;
709
+ return t instanceof j && t.expression instanceof re && ((e = t.expression.variable) == null ? void 0 : e.kind) === u.IDENTIFIER;
702
710
  }
703
- function ze(t) {
711
+ function ut(t) {
704
712
  var e;
705
713
  return t instanceof le && t.leftExpression instanceof x && t.rightExpression instanceof x && ((e = t.op) == null ? void 0 : e.value) === ".";
706
714
  }
@@ -710,7 +718,7 @@ function we(t) {
710
718
  const e = t.identifiers.map((n) => n.value).join(" ");
711
719
  return e === "" ? new S() : new U(e);
712
720
  }
713
- class Dn {
721
+ class On {
714
722
  // list of errors during lexing
715
723
  constructor(e) {
716
724
  this.start = {
@@ -750,7 +758,7 @@ class Dn {
750
758
  this.tokens.push(this.createToken(e, n));
751
759
  }
752
760
  createToken(e, n = !1) {
753
- return J.create(
761
+ return Q.create(
754
762
  e,
755
763
  this.start,
756
764
  this.current,
@@ -759,53 +767,53 @@ class Dn {
759
767
  );
760
768
  }
761
769
  lex() {
762
- return this.scanTokens(), this.tokens.push(J.create(h.EOF, this.start, this.current, "", !1)), this.gatherTrivia(), this.gatherInvalid(), new K(this.tokens, this.errors);
770
+ return this.scanTokens(), this.tokens.push(Q.create(u.EOF, this.start, this.current, "", !1)), this.gatherTrivia(), this.gatherInvalid(), new J(this.tokens, this.errors);
763
771
  }
764
772
  scanTokens() {
765
773
  for (; !this.isAtEnd(); ) {
766
774
  const e = this.advance();
767
775
  switch (e) {
768
776
  case " ":
769
- this.addToken(h.SPACE);
777
+ this.addToken(u.SPACE);
770
778
  break;
771
779
  case "\r":
772
780
  break;
773
781
  case `
774
782
  `:
775
- this.addToken(h.NEWLINE);
783
+ this.addToken(u.NEWLINE);
776
784
  break;
777
785
  case " ":
778
- this.addToken(h.TAB);
786
+ this.addToken(u.TAB);
779
787
  break;
780
788
  case ",":
781
- this.addToken(h.COMMA);
789
+ this.addToken(u.COMMA);
782
790
  break;
783
791
  case "(":
784
- this.addToken(h.LPAREN);
792
+ this.addToken(u.LPAREN);
785
793
  break;
786
794
  case ")":
787
- this.addToken(h.RPAREN);
795
+ this.addToken(u.RPAREN);
788
796
  break;
789
797
  case "[":
790
- this.addToken(h.LBRACKET);
798
+ this.addToken(u.LBRACKET);
791
799
  break;
792
800
  case "]":
793
- this.addToken(h.RBRACKET);
801
+ this.addToken(u.RBRACKET);
794
802
  break;
795
803
  case "{":
796
- this.addToken(h.LBRACE);
804
+ this.addToken(u.LBRACE);
797
805
  break;
798
806
  case "}":
799
- this.addToken(h.RBRACE);
807
+ this.addToken(u.RBRACE);
800
808
  break;
801
809
  case ";":
802
- this.addToken(h.SEMICOLON);
810
+ this.addToken(u.SEMICOLON);
803
811
  break;
804
812
  case ":":
805
- this.addToken(h.COLON);
813
+ this.addToken(u.COLON);
806
814
  break;
807
815
  case "~":
808
- this.addToken(h.TILDE);
816
+ this.addToken(u.TILDE);
809
817
  break;
810
818
  case "'":
811
819
  this.match("''") ? this.multilineStringLiteral() : this.singleLineStringLiteral();
@@ -820,26 +828,26 @@ class Dn {
820
828
  this.colorLiteral();
821
829
  break;
822
830
  case "/":
823
- this.match("/") ? this.singleLineComment() : this.match("*") ? this.multilineComment() : this.operator();
831
+ this.match("/") ? this.singleLineComment() : this.match("*") ? this.multilineComment() : this.operator(e);
824
832
  break;
825
833
  default:
826
- if (dt(e)) {
827
- this.operator();
834
+ if (hn(e)) {
835
+ this.operator(e);
828
836
  break;
829
837
  }
830
- if (He(e)) {
838
+ if (ze(e)) {
831
839
  this.identifier();
832
840
  break;
833
841
  }
834
- if (Ce(e)) {
842
+ if (Xe(e)) {
835
843
  this.numericLiteralOrIdentifier();
836
844
  break;
837
845
  }
838
- this.addToken(h.OP, !0), this.errors.push(
846
+ this.addToken(u.OP, !0), this.errors.push(
839
847
  new l(
840
848
  o.UNKNOWN_SYMBOL,
841
849
  `Unexpected token '${e}'`,
842
- this.createToken(h.OP, !0)
850
+ this.createToken(u.OP, !0)
843
851
  )
844
852
  );
845
853
  break;
@@ -851,13 +859,13 @@ class Dn {
851
859
  let e = !0, n = [], s;
852
860
  const i = [];
853
861
  for (const a of this.tokens)
854
- cn(a) ? (n.push(a), a.kind === h.NEWLINE && s && (s.trailingTrivia = n, e = !0, s = void 0, n = [])) : (e ? a.leadingTrivia = n : s.trailingTrivia = n, i.push(a), n = [], s = a, e = !1);
862
+ un(a) ? (n.push(a), a.kind === u.NEWLINE && s && (s.trailingTrivia = n, e = !0, s = void 0, n = [])) : (e ? a.leadingTrivia = n : s.trailingTrivia = n, i.push(a), n = [], s = a, e = !1);
855
863
  this.tokens = i;
856
864
  }
857
865
  gatherInvalid() {
858
866
  let e;
859
867
  const n = [], s = [];
860
- for (e = 0; e < this.tokens.length && Ft(this.tokens[e]); e += 1)
868
+ for (e = 0; e < this.tokens.length && Bt(this.tokens[e]); e += 1)
861
869
  s.push(this.tokens[e]);
862
870
  let i = this.tokens[e];
863
871
  for (i.leadingInvalid = [...s, ...i.leadingInvalid]; e < this.tokens.length; e += 1) {
@@ -881,56 +889,56 @@ class Dn {
881
889
  `)) && !this.check(n); )
882
890
  this.peek() === "\\" && !a ? (this.advance(), c += this.escapedString()) : c += this.advance();
883
891
  if (this.isAtEnd() && !i) {
884
- const p = this.createToken(e, !0);
885
- this.tokens.push(p), this.errors.push(
886
- new l(o.UNEXPECTED_EOF, "EOF reached while parsing", p)
892
+ const f = this.createToken(e, !0);
893
+ this.tokens.push(f), this.errors.push(
894
+ new l(o.UNEXPECTED_EOF, "EOF reached while parsing", f)
887
895
  );
888
896
  return;
889
897
  }
890
898
  if (this.check(`
891
899
  `) && !s) {
892
- const p = this.createToken(e, !0);
893
- this.tokens.push(p), this.errors.push(
900
+ const f = this.createToken(e, !0);
901
+ this.tokens.push(f), this.errors.push(
894
902
  new l(
895
903
  o.UNEXPECTED_NEWLINE,
896
904
  "Invalid newline encountered while parsing",
897
- p
905
+ f
898
906
  )
899
907
  );
900
908
  return;
901
909
  }
902
- r && this.match(n), this.tokens.push(J.create(e, this.start, this.current, c, !1));
910
+ r && this.match(n), this.tokens.push(Q.create(e, this.start, this.current, c, !1));
903
911
  }
904
912
  singleLineStringLiteral() {
905
- this.consumeUntil(h.STRING_LITERAL, "'", {
913
+ this.consumeUntil(u.STRING_LITERAL, "'", {
906
914
  allowNewline: !1,
907
915
  allowEof: !1,
908
916
  raw: !1
909
917
  });
910
918
  }
911
919
  multilineStringLiteral() {
912
- this.consumeUntil(h.STRING_LITERAL, "'''", {
920
+ this.consumeUntil(u.STRING_LITERAL, "'''", {
913
921
  allowNewline: !0,
914
922
  allowEof: !1,
915
923
  raw: !1
916
924
  });
917
925
  }
918
926
  functionExpression() {
919
- this.consumeUntil(h.FUNCTION_EXPRESSION, "`", {
927
+ this.consumeUntil(u.FUNCTION_EXPRESSION, "`", {
920
928
  allowNewline: !1,
921
929
  allowEof: !1,
922
930
  raw: !0
923
931
  });
924
932
  }
925
933
  quotedVariable() {
926
- this.consumeUntil(h.QUOTED_STRING, '"', {
934
+ this.consumeUntil(u.QUOTED_STRING, '"', {
927
935
  allowNewline: !1,
928
936
  allowEof: !1,
929
937
  raw: !1
930
938
  });
931
939
  }
932
940
  singleLineComment() {
933
- this.consumeUntil(h.SINGLE_LINE_COMMENT, `
941
+ this.consumeUntil(u.SINGLE_LINE_COMMENT, `
934
942
  `, {
935
943
  allowNewline: !0,
936
944
  allowEof: !0,
@@ -939,7 +947,7 @@ class Dn {
939
947
  });
940
948
  }
941
949
  multilineComment() {
942
- this.consumeUntil(h.MULTILINE_COMMENT, "*/", {
950
+ this.consumeUntil(u.MULTILINE_COMMENT, "*/", {
943
951
  allowNewline: !0,
944
952
  allowEof: !1,
945
953
  raw: !0
@@ -948,46 +956,58 @@ class Dn {
948
956
  identifier() {
949
957
  for (; !this.isAtEnd() && ve(this.peek()); )
950
958
  this.advance();
951
- this.addToken(h.IDENTIFIER);
959
+ this.addToken(u.IDENTIFIER);
952
960
  }
953
- operator() {
954
- for (; dt(this.peek()); )
955
- this.advance();
956
- this.addToken(h.OP);
961
+ operator(e) {
962
+ switch (e) {
963
+ case "<":
964
+ [">", "="].includes(this.peek()) && this.advance();
965
+ break;
966
+ case ">":
967
+ this.peek() === "=" && this.advance();
968
+ break;
969
+ case "=":
970
+ this.peek() === "=" && this.advance();
971
+ break;
972
+ case "!":
973
+ this.peek() === "=" && this.advance();
974
+ break;
975
+ }
976
+ this.addToken(u.OP);
957
977
  }
958
978
  // we accept identifiers starting with digits but must contain at least one char or underscore
959
979
  numericLiteralOrIdentifier() {
960
980
  let e = 0;
961
981
  if (this.isAtEnd())
962
- return this.addToken(h.NUMERIC_LITERAL);
982
+ return this.addToken(u.NUMERIC_LITERAL);
963
983
  for (; !this.isAtEnd(); ) {
964
984
  const n = this.check(".");
965
985
  if (e += n ? 1 : 0, e > 1)
966
986
  break;
967
987
  if (!n && this.current.offset === this.text.length - 1)
968
- return this.advance(), this.addToken(h.NUMERIC_LITERAL);
988
+ return this.advance(), this.addToken(u.NUMERIC_LITERAL);
969
989
  if (!n && !ve(this.peek()))
970
- return this.addToken(h.NUMERIC_LITERAL);
971
- if (!n && !Ce(this.peek()))
990
+ return this.addToken(u.NUMERIC_LITERAL);
991
+ if (!n && !Xe(this.peek()))
972
992
  break;
973
993
  this.advance();
974
994
  }
975
995
  if (e > 0) {
976
996
  for (; !this.isAtEnd() && (this.check(".") || ve(this.peek())); )
977
997
  this.advance();
978
- const n = this.createToken(h.NUMERIC_LITERAL, !0);
998
+ const n = this.createToken(u.NUMERIC_LITERAL, !0);
979
999
  this.tokens.push(n), this.errors.push(new l(o.UNKNOWN_TOKEN, "Invalid number", n));
980
1000
  } else {
981
1001
  for (; !this.isAtEnd() && ve(this.peek()); )
982
1002
  this.advance();
983
- const n = this.createToken(h.IDENTIFIER, !1);
1003
+ const n = this.createToken(u.IDENTIFIER, !1);
984
1004
  this.tokens.push(n);
985
1005
  }
986
1006
  }
987
1007
  colorLiteral() {
988
1008
  for (; !this.isAtEnd() && ve(this.peek()); )
989
1009
  this.advance();
990
- this.addToken(h.COLOR_LITERAL);
1010
+ this.addToken(u.COLOR_LITERAL);
991
1011
  }
992
1012
  escapedString() {
993
1013
  const e = { column: this.current.column - 1, offset: this.current.offset - 1, line: this.current.line };
@@ -1027,7 +1047,7 @@ class Dn {
1027
1047
  let n = "";
1028
1048
  for (let s = 0; s <= 3; s += 1) {
1029
1049
  if (this.isAtEnd() || !ve(this.peek()))
1030
- return this.errors.push(new l(o.INVALID_ESCAPE_SEQUENCE, `Invalid unicode escape sequence '\\u${n}', only unicode escape sequences of the form '\\uHHHH' where H is a hexadecimal number are allowed`, J.create(h.STRING_LITERAL, e, this.current, `\\u${n}`, !0))), `\\u${n}`;
1050
+ return this.errors.push(new l(o.INVALID_ESCAPE_SEQUENCE, `Invalid unicode escape sequence '\\u${n}', only unicode escape sequences of the form '\\uHHHH' where H is a hexadecimal number are allowed`, Q.create(u.STRING_LITERAL, e, this.current, `\\u${n}`, !0))), `\\u${n}`;
1031
1051
  n += this.advance();
1032
1052
  }
1033
1053
  return String.fromCharCode(parseInt(n, 16));
@@ -1038,7 +1058,7 @@ class Dn {
1038
1058
  }
1039
1059
  }
1040
1060
  var Be = /* @__PURE__ */ ((t) => (t[t.ListExpression = 0] = "ListExpression", t[t.GroupExpression = 1] = "GroupExpression", t[t.BlockExpression = 2] = "BlockExpression", t))(Be || {});
1041
- class xn {
1061
+ class Rn {
1042
1062
  constructor() {
1043
1063
  this.stack = [], this.numberOfNestedLParens = 0, this.numberOfNestedLBrackets = 0, this.numberOfNestedLBraces = 0;
1044
1064
  }
@@ -1079,7 +1099,7 @@ class xn {
1079
1099
  if (!(this.numberOfNestedLBraces <= 0 && this.numberOfNestedLBrackets <= 0 && this.numberOfNestedLParens <= 0))
1080
1100
  for (let s = n; s < e.length - 1; s += 1)
1081
1101
  switch (e[s].kind) {
1082
- case h.COMMA:
1102
+ case u.COMMA:
1083
1103
  if (this.isWithinGroupExpressionContext() || this.isWithinListExpressionContext())
1084
1104
  return [...this.stack].reverse().find(
1085
1105
  (a) => [
@@ -1089,22 +1109,22 @@ class xn {
1089
1109
  ].includes(a)
1090
1110
  );
1091
1111
  break;
1092
- case h.RPAREN:
1112
+ case u.RPAREN:
1093
1113
  if (this.isWithinGroupExpressionContext())
1094
1114
  return 1;
1095
1115
  break;
1096
- case h.RBRACE:
1116
+ case u.RBRACE:
1097
1117
  if (this.isWithinBlockExpressionContext())
1098
1118
  return 2;
1099
1119
  break;
1100
- case h.RBRACKET:
1120
+ case u.RBRACKET:
1101
1121
  if (this.isWithinListExpressionContext())
1102
1122
  return 0;
1103
1123
  break;
1104
1124
  }
1105
1125
  }
1106
1126
  }
1107
- class On {
1127
+ class Un {
1108
1128
  constructor(e) {
1109
1129
  this.generator = e;
1110
1130
  }
@@ -1117,29 +1137,29 @@ class T {
1117
1137
  this.token = e, this.partialNode = n, this.handlerContext = s;
1118
1138
  }
1119
1139
  }
1120
- class Rn {
1140
+ class Mn {
1121
1141
  constructor(e, n) {
1122
- this.current = 0, this.errors = [], this.contextStack = new xn(), this.synchronizeProgram = () => {
1142
+ this.current = 0, this.errors = [], this.contextStack = new Rn(), this.synchronizeProgram = () => {
1123
1143
  const s = this.peek();
1124
- s.kind !== h.EOF ? b(this.advance()) : (b(this.peek()), this.logError(s, o.UNEXPECTED_EOF, "Unexpected EOF"));
1144
+ s.kind !== u.EOF ? b(this.advance()) : (b(this.peek()), this.logError(s, o.UNEXPECTED_EOF, "Unexpected EOF"));
1125
1145
  }, this.synchronizeElementDeclarationName = () => {
1126
1146
  for (; !this.isAtEnd(); ) {
1127
1147
  const s = this.peek();
1128
- if (mt(s) || this.check(h.COLON, h.LBRACE, h.LBRACKET))
1148
+ if (mt(s) || this.check(u.COLON, u.LBRACE, u.LBRACKET))
1129
1149
  break;
1130
1150
  b(s), this.advance();
1131
1151
  }
1132
1152
  }, this.synchronizeElementDeclarationAlias = () => {
1133
1153
  for (; !this.isAtEnd(); ) {
1134
1154
  const s = this.peek();
1135
- if (this.check(h.COLON, h.LBRACE, h.LBRACKET))
1155
+ if (this.check(u.COLON, u.LBRACE, u.LBRACKET))
1136
1156
  break;
1137
1157
  b(s), this.advance();
1138
1158
  }
1139
1159
  }, this.blockExpression = this.contextStack.withContextDo(Be.BlockExpression, () => {
1140
- const s = { body: [] }, i = () => this.nodeFactory.create(ae, s);
1160
+ const s = { body: [] }, i = () => this.nodeFactory.create(oe, s);
1141
1161
  try {
1142
- this.consume("Expect an opening brace '{'", h.LBRACE), s.blockOpenBrace = this.previous();
1162
+ this.consume("Expect an opening brace '{'", u.LBRACE), s.blockOpenBrace = this.previous();
1143
1163
  } catch (a) {
1144
1164
  if (!(a instanceof T))
1145
1165
  throw a;
@@ -1147,10 +1167,10 @@ class Rn {
1147
1167
  throw new T(a.token, i(), a.handlerContext);
1148
1168
  this.synchronizeBlock();
1149
1169
  }
1150
- for (; !this.isAtEnd() && !this.check(h.RBRACE); )
1170
+ for (; !this.isAtEnd() && !this.check(u.RBRACE); )
1151
1171
  try {
1152
- if (this.match(h.TILDE)) {
1153
- const a = this.previous(), r = this.variable(), c = this.nodeFactory.create(Le, { op: a, partial: r });
1172
+ if (this.match(u.TILDE)) {
1173
+ const a = this.previous(), r = this.variable(), c = this.nodeFactory.create(be, { op: a, partial: r });
1154
1174
  s.body.push(c);
1155
1175
  } else
1156
1176
  s.body.push(this.canBeField() ? this.fieldDeclaration() : this.expression());
@@ -1162,7 +1182,7 @@ class Rn {
1162
1182
  this.synchronizeBlock();
1163
1183
  }
1164
1184
  try {
1165
- this.consume("Expect a closing brace '}'", h.RBRACE), s.blockCloseBrace = this.previous();
1185
+ this.consume("Expect a closing brace '}'", u.RBRACE), s.blockCloseBrace = this.previous();
1166
1186
  } catch (a) {
1167
1187
  if (!(a instanceof T))
1168
1188
  throw a;
@@ -1172,21 +1192,21 @@ class Rn {
1172
1192
  }
1173
1193
  return i();
1174
1194
  }), this.synchronizeBlock = () => {
1175
- if (!this.check(h.RBRACE))
1195
+ if (!this.check(u.RBRACE))
1176
1196
  for (b(this.advance()); !this.isAtEnd(); ) {
1177
1197
  const s = this.peek();
1178
- if (this.check(h.RBRACE) || Nt(this.previous(), s))
1198
+ if (this.check(u.RBRACE) || Nt(this.previous(), s))
1179
1199
  break;
1180
1200
  b(s), this.advance();
1181
1201
  }
1182
1202
  }, this.tupleExpression = this.contextStack.withContextDo(Be.GroupExpression, () => {
1183
- const s = { elementList: [], commaList: [] }, i = () => this.nodeFactory.create(tt, {
1203
+ const s = { elementList: [], commaList: [] }, i = () => this.nodeFactory.create(nt, {
1184
1204
  groupOpenParen: s.tupleOpenParen,
1185
1205
  groupCloseParen: s.tupleCloseParen,
1186
1206
  expression: s.elementList[0]
1187
1207
  }), a = () => this.nodeFactory.create(ce, s);
1188
1208
  try {
1189
- this.consume("Expect an opening parenthesis '('", h.LPAREN), s.tupleOpenParen = this.previous();
1209
+ this.consume("Expect an opening parenthesis '('", u.LPAREN), s.tupleOpenParen = this.previous();
1190
1210
  } catch (r) {
1191
1211
  if (!(r instanceof T))
1192
1212
  throw r;
@@ -1194,7 +1214,7 @@ class Rn {
1194
1214
  throw new T(r.token, a(), r.handlerContext);
1195
1215
  this.synchronizeTuple();
1196
1216
  }
1197
- if (!this.isAtEnd() && !this.check(h.RPAREN))
1217
+ if (!this.isAtEnd() && !this.check(u.RPAREN))
1198
1218
  try {
1199
1219
  s.elementList.push(this.normalExpression());
1200
1220
  } catch (r) {
@@ -1204,9 +1224,9 @@ class Rn {
1204
1224
  throw new T(r.token, i(), r.handlerContext);
1205
1225
  this.synchronizeTuple();
1206
1226
  }
1207
- for (; !this.isAtEnd() && !this.check(h.RPAREN); )
1227
+ for (; !this.isAtEnd() && !this.check(u.RPAREN); )
1208
1228
  try {
1209
- this.consume("Expect a comma ','", h.COMMA), s.commaList.push(this.previous()), s.elementList.push(this.normalExpression());
1229
+ this.consume("Expect a comma ','", u.COMMA), s.commaList.push(this.previous()), s.elementList.push(this.normalExpression());
1210
1230
  } catch (r) {
1211
1231
  if (!(r instanceof T))
1212
1232
  throw r;
@@ -1215,7 +1235,7 @@ class Rn {
1215
1235
  this.synchronizeTuple();
1216
1236
  }
1217
1237
  try {
1218
- this.consume("Expect a closing parenthesis ')'", h.RPAREN), s.tupleCloseParen = this.previous();
1238
+ this.consume("Expect a closing parenthesis ')'", u.RPAREN), s.tupleCloseParen = this.previous();
1219
1239
  } catch (r) {
1220
1240
  if (!(r instanceof T))
1221
1241
  throw r;
@@ -1227,14 +1247,14 @@ class Rn {
1227
1247
  }), this.synchronizeTuple = () => {
1228
1248
  for (; !this.isAtEnd(); ) {
1229
1249
  const s = this.peek();
1230
- if (this.check(h.RPAREN, h.COMMA))
1250
+ if (this.check(u.RPAREN, u.COMMA))
1231
1251
  break;
1232
1252
  b(s), this.advance();
1233
1253
  }
1234
1254
  }, this.listExpression = this.contextStack.withContextDo(Be.ListExpression, () => {
1235
1255
  const s = { elementList: [], commaList: [] }, i = () => this.nodeFactory.create(M, s);
1236
1256
  try {
1237
- this.consume("Expect an opening bracket '['", h.LBRACKET), s.listOpenBracket = this.previous();
1257
+ this.consume("Expect an opening bracket '['", u.LBRACKET), s.listOpenBracket = this.previous();
1238
1258
  } catch (a) {
1239
1259
  if (!(a instanceof T))
1240
1260
  throw a;
@@ -1242,7 +1262,7 @@ class Rn {
1242
1262
  throw new T(a.token, i(), a.handlerContext);
1243
1263
  this.synchronizeList();
1244
1264
  }
1245
- if (!this.isAtEnd() && !this.check(h.RBRACKET))
1265
+ if (!this.isAtEnd() && !this.check(u.RBRACKET))
1246
1266
  try {
1247
1267
  s.elementList.push(this.attribute());
1248
1268
  } catch (a) {
@@ -1252,9 +1272,9 @@ class Rn {
1252
1272
  throw new T(a.token, i(), a.handlerContext);
1253
1273
  this.synchronizeList();
1254
1274
  }
1255
- for (; !this.isAtEnd() && !this.check(h.RBRACKET); )
1275
+ for (; !this.isAtEnd() && !this.check(u.RBRACKET); )
1256
1276
  try {
1257
- this.consume("Expect a comma ','", h.COMMA), s.commaList.push(this.previous()), s.elementList.push(this.attribute());
1277
+ this.consume("Expect a comma ','", u.COMMA), s.commaList.push(this.previous()), s.elementList.push(this.attribute());
1258
1278
  } catch (a) {
1259
1279
  if (!(a instanceof T))
1260
1280
  throw a;
@@ -1263,7 +1283,7 @@ class Rn {
1263
1283
  this.synchronizeList();
1264
1284
  }
1265
1285
  try {
1266
- this.consume("Expect a closing bracket ']'", h.RBRACKET), s.listCloseBracket = this.previous();
1286
+ this.consume("Expect a closing bracket ']'", u.RBRACKET), s.listCloseBracket = this.previous();
1267
1287
  } catch (a) {
1268
1288
  if (!(a instanceof T))
1269
1289
  throw a;
@@ -1275,28 +1295,28 @@ class Rn {
1275
1295
  }), this.synchronizeList = () => {
1276
1296
  for (; !this.isAtEnd(); ) {
1277
1297
  const s = this.peek();
1278
- if (this.check(h.COMMA, h.RBRACKET))
1298
+ if (this.check(u.COMMA, u.RBRACKET))
1279
1299
  break;
1280
1300
  b(s), this.advance();
1281
1301
  }
1282
1302
  }, this.synchronizeAttributeName = () => {
1283
1303
  for (; !this.isAtEnd(); ) {
1284
1304
  const s = this.peek();
1285
- if (this.check(h.COMMA, h.RBRACKET, h.COLON))
1305
+ if (this.check(u.COMMA, u.RBRACKET, u.COLON))
1286
1306
  break;
1287
1307
  b(s), this.advance();
1288
1308
  }
1289
1309
  }, this.synchronizeAttributeValue = () => {
1290
1310
  for (; !this.isAtEnd(); ) {
1291
1311
  const s = this.peek();
1292
- if (this.check(h.COMMA, h.RBRACKET))
1312
+ if (this.check(u.COMMA, u.RBRACKET))
1293
1313
  break;
1294
1314
  b(s), this.advance();
1295
1315
  }
1296
- }, this.tokens = e, this.nodeFactory = new On(n);
1316
+ }, this.tokens = e, this.nodeFactory = new Un(n);
1297
1317
  }
1298
1318
  isAtEnd() {
1299
- return this.current >= this.tokens.length || this.tokens[this.current].kind === h.EOF;
1319
+ return this.current >= this.tokens.length || this.tokens[this.current].kind === u.EOF;
1300
1320
  }
1301
1321
  advance() {
1302
1322
  return this.isAtEnd() ? g.last(this.tokens) : this.tokens[this.current++];
@@ -1349,8 +1369,8 @@ class Rn {
1349
1369
  this.tokens = e;
1350
1370
  }
1351
1371
  parse() {
1352
- const e = this.program(), n = this.advance(), s = this.nodeFactory.create(Z, { body: e, eof: n });
1353
- return this.gatherInvalid(), new K({ ast: s, tokens: this.tokens }, this.errors);
1372
+ const e = this.program(), n = this.advance(), s = this.nodeFactory.create(K, { body: e, eof: n });
1373
+ return this.gatherInvalid(), new J({ ast: s, tokens: this.tokens }, this.errors);
1354
1374
  }
1355
1375
  /* Parsing and synchronizing ProgramNode */
1356
1376
  program() {
@@ -1370,11 +1390,11 @@ class Rn {
1370
1390
  elementDeclaration() {
1371
1391
  const e = {}, n = () => this.nodeFactory.create(y, e);
1372
1392
  try {
1373
- this.consume("Expect an identifier", h.IDENTIFIER), e.type = this.previous();
1393
+ this.consume("Expect an identifier", u.IDENTIFIER), e.type = this.previous();
1374
1394
  } catch (s) {
1375
1395
  throw s instanceof T ? (e.type = s.partialNode, new T(s.token, n(), s.handlerContext)) : s;
1376
1396
  }
1377
- if (!this.check(h.COLON, h.LBRACE, h.LBRACKET))
1397
+ if (!this.check(u.COLON, u.LBRACE, u.LBRACKET))
1378
1398
  try {
1379
1399
  e.name = this.normalExpression();
1380
1400
  } catch (s) {
@@ -1385,7 +1405,7 @@ class Rn {
1385
1405
  this.synchronizeElementDeclarationName();
1386
1406
  }
1387
1407
  if (mt(this.peek()))
1388
- if (e.as = this.advance(), this.check(h.COLON, h.LBRACE, h.LBRACKET))
1408
+ if (e.as = this.advance(), this.check(u.COLON, u.LBRACE, u.LBRACKET))
1389
1409
  this.logError(this.peek(), o.UNEXPECTED_TOKEN, "Expect an alias");
1390
1410
  else
1391
1411
  try {
@@ -1398,18 +1418,18 @@ class Rn {
1398
1418
  this.synchronizeElementDeclarationAlias();
1399
1419
  }
1400
1420
  try {
1401
- e.attributeList = this.check(h.LBRACKET) ? this.listExpression() : void 0;
1421
+ e.attributeList = this.check(u.LBRACKET) ? this.listExpression() : void 0;
1402
1422
  } catch (s) {
1403
1423
  throw s instanceof T ? (e.attributeList = s.partialNode, new T(s.token, n(), s.handlerContext)) : s;
1404
1424
  }
1405
1425
  if (!this.discardUntil(
1406
1426
  "Expect an opening brace '{' or a colon ':'",
1407
- h.LBRACE,
1408
- h.COLON
1427
+ u.LBRACE,
1428
+ u.COLON
1409
1429
  ))
1410
1430
  return n();
1411
1431
  try {
1412
- if (this.match(h.COLON)) {
1432
+ if (this.match(u.COLON)) {
1413
1433
  e.bodyColon = this.previous();
1414
1434
  const s = this.expression();
1415
1435
  s instanceof y ? (b(s), this.logError(s, o.UNEXPECTED_ELEMENT_DECLARATION, "An element's simple body must not be an element declaration")) : e.body = s;
@@ -1429,12 +1449,12 @@ class Rn {
1429
1449
  fieldDeclaration() {
1430
1450
  const e = {}, n = () => this.nodeFactory.create(y, e);
1431
1451
  try {
1432
- this.consume("Expect an identifier", h.IDENTIFIER), e.type = this.previous();
1452
+ this.consume("Expect an identifier", u.IDENTIFIER), e.type = this.previous();
1433
1453
  } catch (s) {
1434
1454
  throw s instanceof T ? (e.type = s.partialNode, new T(s.token, n(), s.handlerContext)) : s;
1435
1455
  }
1436
1456
  try {
1437
- this.consume("Expect a colon ':'", h.COLON), e.bodyColon = this.previous();
1457
+ this.consume("Expect a colon ':'", u.COLON), e.bodyColon = this.previous();
1438
1458
  } catch (s) {
1439
1459
  throw s instanceof T ? (e.bodyColon = s.partialNode, new T(s.token, n(), s.handlerContext)) : s;
1440
1460
  }
@@ -1448,7 +1468,7 @@ class Rn {
1448
1468
  }
1449
1469
  /* Parsing any ExpressionNode, including non-NormalExpression */
1450
1470
  expression() {
1451
- const e = { args: [] }, n = () => yn(e.callee, e.args, this.nodeFactory).unwrap_or(
1471
+ const e = { args: [] }, n = () => Pn(e.callee, e.args, this.nodeFactory).unwrap_or(
1452
1472
  this.nodeFactory.create(w, e)
1453
1473
  );
1454
1474
  try {
@@ -1473,7 +1493,7 @@ class Rn {
1473
1493
  if (this.isAtEnd() || St(this.previous()))
1474
1494
  return !0;
1475
1495
  const e = this.peek().kind;
1476
- return e === h.RBRACE || e === h.RBRACKET || e === h.RPAREN || e === h.COMMA || e === h.COLON;
1496
+ return e === u.RBRACE || e === u.RBRACKET || e === u.RPAREN || e === u.COMMA || e === u.COLON;
1477
1497
  }
1478
1498
  normalExpression() {
1479
1499
  return this.expression_bp(0);
@@ -1483,7 +1503,7 @@ class Rn {
1483
1503
  let n = this.leftExpression_bp();
1484
1504
  for (; !this.isAtEnd(); ) {
1485
1505
  const s = this.peek();
1486
- if (s.kind === h.LPAREN) {
1506
+ if (s.kind === u.LPAREN) {
1487
1507
  const { left: i } = bt(s);
1488
1508
  if (i < e || // When '(' is encountered,
1489
1509
  // consider it part of another expression if
@@ -1492,26 +1512,26 @@ class Rn {
1492
1512
  Nt(this.previous(), s) && !this.contextStack.isWithinGroupExpressionContext() && !this.contextStack.isWithinListExpressionContext())
1493
1513
  break;
1494
1514
  try {
1495
- n = this.nodeFactory.create(H, {
1515
+ n = this.nodeFactory.create(ee, {
1496
1516
  callee: n,
1497
1517
  argumentList: this.tupleExpression()
1498
1518
  });
1499
1519
  } catch (a) {
1500
- throw a instanceof T ? (n = this.nodeFactory.create(H, {
1520
+ throw a instanceof T ? (n = this.nodeFactory.create(ee, {
1501
1521
  callee: n,
1502
1522
  argumentList: a.partialNode
1503
1523
  }), new T(a.token, n, a.handlerContext)) : a;
1504
1524
  }
1505
- } else if (s.kind === h.LBRACKET) {
1525
+ } else if (s.kind === u.LBRACKET) {
1506
1526
  if (et(this.previous()))
1507
1527
  break;
1508
1528
  try {
1509
- n = this.nodeFactory.create(he, {
1529
+ n = this.nodeFactory.create(Ie, {
1510
1530
  expression: n,
1511
1531
  indexer: this.listExpression()
1512
1532
  });
1513
1533
  } catch (i) {
1514
- throw i instanceof T ? (n = this.nodeFactory.create(he, {
1534
+ throw i instanceof T ? (n = this.nodeFactory.create(Ie, {
1515
1535
  expression: n,
1516
1536
  indexer: i.partialNode
1517
1537
  }), new T(i.token, n, i.handlerContext)) : i;
@@ -1521,12 +1541,12 @@ class Rn {
1521
1541
  if (a.left !== null) {
1522
1542
  if (a.left <= e)
1523
1543
  break;
1524
- this.advance(), n = this.nodeFactory.create(Ye, {
1544
+ this.advance(), n = this.nodeFactory.create(qe, {
1525
1545
  expression: n,
1526
1546
  op: i
1527
1547
  });
1528
1548
  } else {
1529
- const r = Mn(i);
1549
+ const r = Bn(i);
1530
1550
  if (r.left === null || r.left <= e)
1531
1551
  break;
1532
1552
  this.advance();
@@ -1554,7 +1574,7 @@ class Rn {
1554
1574
  if (Et(this.peek())) {
1555
1575
  const n = {};
1556
1576
  n.op = this.peek();
1557
- const s = Bn(n.op);
1577
+ const s = Gn(n.op);
1558
1578
  if (s.right === null)
1559
1579
  throw this.logError(
1560
1580
  n.op,
@@ -1571,11 +1591,11 @@ class Rn {
1571
1591
  } catch (i) {
1572
1592
  throw i instanceof T ? (n.expression = i.partialNode, new T(
1573
1593
  i.token,
1574
- this.nodeFactory.create(oe, n),
1594
+ this.nodeFactory.create(Z, n),
1575
1595
  i.handlerContext
1576
1596
  )) : i;
1577
1597
  }
1578
- e = this.nodeFactory.create(oe, n);
1598
+ e = this.nodeFactory.create(Z, n);
1579
1599
  } else if (e = this.extractOperand(), e instanceof Me)
1580
1600
  throw new T(
1581
1601
  this.peek(),
@@ -1590,12 +1610,12 @@ class Rn {
1590
1610
  // e.g { ... }
1591
1611
  extractOperand() {
1592
1612
  return this.check(
1593
- h.NUMERIC_LITERAL,
1594
- h.STRING_LITERAL,
1595
- h.COLOR_LITERAL,
1596
- h.QUOTED_STRING,
1597
- h.IDENTIFIER
1598
- ) ? this.primaryExpression() : this.check(h.FUNCTION_EXPRESSION) ? this.functionExpression() : this.check(h.LBRACKET) ? this.listExpression() : this.check(h.LBRACE) ? this.blockExpression() : this.check(h.LPAREN) ? this.tupleExpression() : (this.peek().kind === h.EOF ? this.logError(
1613
+ u.NUMERIC_LITERAL,
1614
+ u.STRING_LITERAL,
1615
+ u.COLOR_LITERAL,
1616
+ u.QUOTED_STRING,
1617
+ u.IDENTIFIER
1618
+ ) ? this.primaryExpression() : this.check(u.FUNCTION_EXPRESSION) ? this.functionExpression() : this.check(u.LBRACKET) ? this.listExpression() : this.check(u.LBRACE) ? this.blockExpression() : this.check(u.LPAREN) ? this.tupleExpression() : (this.peek().kind === u.EOF ? this.logError(
1599
1619
  this.peek(),
1600
1620
  o.UNEXPECTED_EOF,
1601
1621
  "Unexpected EOF"
@@ -1609,7 +1629,7 @@ class Rn {
1609
1629
  functionExpression() {
1610
1630
  const e = {};
1611
1631
  try {
1612
- this.consume("Expect a function expression", h.FUNCTION_EXPRESSION), e.value = this.previous();
1632
+ this.consume("Expect a function expression", u.FUNCTION_EXPRESSION), e.value = this.previous();
1613
1633
  } catch (n) {
1614
1634
  throw n instanceof T ? (e.value = n.partialNode, new T(
1615
1635
  n.token,
@@ -1620,26 +1640,26 @@ class Rn {
1620
1640
  return this.nodeFactory.create(ue, e);
1621
1641
  }
1622
1642
  variable() {
1623
- this.consume("Expect a variable", h.IDENTIFIER);
1643
+ this.consume("Expect a variable", u.IDENTIFIER);
1624
1644
  const e = this.previous();
1625
- return this.nodeFactory.create(ie, { variable: e });
1645
+ return this.nodeFactory.create(re, { variable: e });
1626
1646
  }
1627
1647
  canBeField() {
1628
- return this.peek().kind === h.IDENTIFIER && this.peek(1).kind === h.COLON;
1648
+ return this.peek().kind === u.IDENTIFIER && this.peek(1).kind === u.COLON;
1629
1649
  }
1630
1650
  /* Parsing PrimaryExpression */
1631
1651
  primaryExpression() {
1632
1652
  if (this.match(
1633
- h.COLOR_LITERAL,
1634
- h.STRING_LITERAL,
1635
- h.NUMERIC_LITERAL
1653
+ u.COLOR_LITERAL,
1654
+ u.STRING_LITERAL,
1655
+ u.NUMERIC_LITERAL
1636
1656
  ))
1637
- return this.nodeFactory.create($, {
1657
+ return this.nodeFactory.create(j, {
1638
1658
  expression: this.nodeFactory.create(ye, { literal: this.previous() })
1639
1659
  });
1640
- if (this.match(h.QUOTED_STRING, h.IDENTIFIER))
1641
- return this.nodeFactory.create($, {
1642
- expression: this.nodeFactory.create(ie, { variable: this.previous() })
1660
+ if (this.match(u.QUOTED_STRING, u.IDENTIFIER))
1661
+ return this.nodeFactory.create(j, {
1662
+ expression: this.nodeFactory.create(re, { variable: this.previous() })
1643
1663
  });
1644
1664
  throw this.logError(this.peek(), o.UNEXPECTED_TOKEN, "Expect a variable or literal"), new T(
1645
1665
  this.peek(),
@@ -1649,13 +1669,13 @@ class Rn {
1649
1669
  }
1650
1670
  attribute() {
1651
1671
  const e = {};
1652
- if (this.check(h.COLON, h.RBRACKET, h.COMMA)) {
1672
+ if (this.check(u.COLON, u.RBRACKET, u.COMMA)) {
1653
1673
  const n = this.peek();
1654
1674
  this.logError(
1655
1675
  n,
1656
1676
  o.EMPTY_ATTRIBUTE_NAME,
1657
1677
  "Expect a non-empty attribute name"
1658
- ), e.name = this.nodeFactory.create(te, { identifiers: [] });
1678
+ ), e.name = this.nodeFactory.create(ne, { identifiers: [] });
1659
1679
  } else
1660
1680
  try {
1661
1681
  e.name = this.attributeName();
@@ -1665,17 +1685,17 @@ class Rn {
1665
1685
  if (e.name = n.partialNode, !this.canHandle(n))
1666
1686
  throw new T(
1667
1687
  n.token,
1668
- this.nodeFactory.create(ne, e),
1688
+ this.nodeFactory.create(se, e),
1669
1689
  n.handlerContext
1670
1690
  );
1671
1691
  this.synchronizeAttributeName();
1672
1692
  }
1673
- return this.match(h.COLON) && (e.colon = this.previous(), e.value = this.attributeValue()), this.nodeFactory.create(ne, e);
1693
+ return this.match(u.COLON) && (e.colon = this.previous(), e.value = this.attributeValue()), this.nodeFactory.create(se, e);
1674
1694
  }
1675
1695
  attributeValue() {
1676
1696
  let e;
1677
1697
  try {
1678
- e = this.peek().kind === h.IDENTIFIER && this.peek(1).kind === h.IDENTIFIER ? this.attributeName() : this.normalExpression();
1698
+ e = this.peek().kind === u.IDENTIFIER && this.peek(1).kind === u.IDENTIFIER ? this.attributeName() : this.normalExpression();
1679
1699
  } catch (n) {
1680
1700
  if (!(n instanceof T) || !this.canHandle(n))
1681
1701
  throw n;
@@ -1685,25 +1705,25 @@ class Rn {
1685
1705
  }
1686
1706
  attributeName() {
1687
1707
  const e = [];
1688
- if (this.peek().kind !== h.IDENTIFIER)
1708
+ if (this.peek().kind !== u.IDENTIFIER)
1689
1709
  return this.primaryExpression();
1690
- for (; !this.isAtEnd() && !this.check(h.COLON, h.COMMA, h.RBRACKET); )
1710
+ for (; !this.isAtEnd() && !this.check(u.COLON, u.COMMA, u.RBRACKET); )
1691
1711
  try {
1692
- this.consume("Expect an identifier", h.IDENTIFIER), e.push(this.previous());
1712
+ this.consume("Expect an identifier", u.IDENTIFIER), e.push(this.previous());
1693
1713
  } catch (n) {
1694
1714
  throw n instanceof T ? new T(
1695
1715
  n.token,
1696
- this.nodeFactory.create(te, { identifiers: e }),
1716
+ this.nodeFactory.create(ne, { identifiers: e }),
1697
1717
  n.handlerContext
1698
1718
  ) : n;
1699
1719
  }
1700
- return this.nodeFactory.create(te, { identifiers: e });
1720
+ return this.nodeFactory.create(ne, { identifiers: e });
1701
1721
  }
1702
1722
  logError(e, n, s) {
1703
1723
  this.errors.push(new l(n, s, e));
1704
1724
  }
1705
1725
  }
1706
- const Un = {
1726
+ const Fn = {
1707
1727
  "+": { left: 9, right: 10 },
1708
1728
  "*": { left: 11, right: 12 },
1709
1729
  "-": { left: 9, right: 10 },
@@ -1719,10 +1739,10 @@ const Un = {
1719
1739
  "!=": { left: 4, right: 5 },
1720
1740
  ".": { left: 16, right: 17 }
1721
1741
  };
1722
- function Mn(t) {
1723
- return Un[t.value] || { left: null, right: null };
1742
+ function Bn(t) {
1743
+ return Fn[t.value] || { left: null, right: null };
1724
1744
  }
1725
- const Fn = {
1745
+ const Vn = {
1726
1746
  "+": { left: null, right: 15 },
1727
1747
  "-": { left: null, right: 15 },
1728
1748
  "<": { left: null, right: 15 },
@@ -1730,17 +1750,17 @@ const Fn = {
1730
1750
  "<>": { left: null, right: 15 },
1731
1751
  "!": { left: null, right: 15 }
1732
1752
  };
1733
- function Bn(t) {
1734
- return Fn[t.value] || { left: null, right: null };
1753
+ function Gn(t) {
1754
+ return Vn[t.value] || { left: null, right: null };
1735
1755
  }
1736
- const Vn = {
1756
+ const Cn = {
1737
1757
  "(": { left: 14, right: null }
1738
1758
  };
1739
1759
  function bt(t) {
1740
- return Vn[t.value] || { left: null, right: null };
1760
+ return Cn[t.value] || { left: null, right: null };
1741
1761
  }
1742
- var I = /* @__PURE__ */ ((t) => (t.Table = "table", t.Enum = "enum", t.Ref = "ref", t.Note = "note", t.Project = "project", t.Indexes = "indexes", t.TableGroup = "tablegroup", t.TablePartial = "tablepartial", t))(I || {}), N = /* @__PURE__ */ ((t) => (t.Color = "color", t.HeaderColor = "headercolor", t.Note = "note", t.PK = "pk", t.PKey = "primary key", t.Unique = "unique", t.Ref = "ref", t.NotNull = "not null", t.Null = "null", t.Increment = "increment", t.Default = "default", t.Name = "name", t.Type = "type", t.Update = "update", t.Delete = "delete", t))(N || {});
1743
- function Ae(t) {
1762
+ var I = /* @__PURE__ */ ((t) => (t.Table = "table", t.Enum = "enum", t.Ref = "ref", t.Note = "note", t.Project = "project", t.Indexes = "indexes", t.TableGroup = "tablegroup", t.TablePartial = "tablepartial", t))(I || {}), E = /* @__PURE__ */ ((t) => (t.Color = "color", t.HeaderColor = "headercolor", t.Note = "note", t.PK = "pk", t.PKey = "primary key", t.Unique = "unique", t.Ref = "ref", t.NotNull = "not null", t.Null = "null", t.Increment = "increment", t.Default = "default", t.Name = "name", t.Type = "type", t.Update = "update", t.Delete = "delete", t))(E || {});
1763
+ function Le(t) {
1744
1764
  var n;
1745
1765
  const e = (n = t == null ? void 0 : t.type) == null ? void 0 : n.value.toLowerCase();
1746
1766
  switch (e) {
@@ -1758,12 +1778,12 @@ function Ae(t) {
1758
1778
  }
1759
1779
  }
1760
1780
  function _e(t) {
1761
- if (!ze(t))
1781
+ if (!ut(t))
1762
1782
  return new U([t]);
1763
1783
  const e = _e(t.leftExpression).unwrap_or(void 0);
1764
1784
  return e ? (e.push(t.rightExpression), new U(e)) : new S();
1765
1785
  }
1766
- function Y(t) {
1786
+ function q(t) {
1767
1787
  if (t === void 0)
1768
1788
  return new S();
1769
1789
  const e = _e(t).unwrap_or(void 0);
@@ -1771,7 +1791,7 @@ function Y(t) {
1771
1791
  return new S();
1772
1792
  const n = [];
1773
1793
  for (const s of e) {
1774
- const i = q(s).unwrap_or(void 0);
1794
+ const i = W(s).unwrap_or(void 0);
1775
1795
  if (!i)
1776
1796
  return new S();
1777
1797
  n.push(i);
@@ -1786,7 +1806,7 @@ function De(t) {
1786
1806
  return new S();
1787
1807
  const n = [];
1788
1808
  let s;
1789
- if (!j(g.last(e))) {
1809
+ if (!$(g.last(e))) {
1790
1810
  const i = e.pop();
1791
1811
  if ($t(i))
1792
1812
  s = i.elementList.map(
@@ -1796,7 +1816,7 @@ function De(t) {
1796
1816
  return new S();
1797
1817
  }
1798
1818
  for (const i of e) {
1799
- const a = q(i).unwrap_or(void 0);
1819
+ const a = W(i).unwrap_or(void 0);
1800
1820
  if (!a)
1801
1821
  return new S();
1802
1822
  n.push(a);
@@ -1806,16 +1826,16 @@ function De(t) {
1806
1826
  tupleElements: s
1807
1827
  });
1808
1828
  }
1809
- function q(t) {
1810
- return j(t) ? new U(t.expression.variable.value) : new S();
1829
+ function W(t) {
1830
+ return $(t) ? new U(t.expression.variable.value) : new S();
1811
1831
  }
1812
- function Xe(t) {
1832
+ function $e(t) {
1813
1833
  if (It(t))
1814
1834
  return t instanceof ue ? new U({ functional: [t], nonFunctional: [] }) : new U({ functional: [], nonFunctional: [t] });
1815
1835
  if (t instanceof ce && t.elementList.every(It)) {
1816
1836
  const e = t.elementList.filter(
1817
1837
  (s) => s instanceof ue
1818
- ), n = t.elementList.filter(j);
1838
+ ), n = t.elementList.filter($);
1819
1839
  return new U({ functional: e, nonFunctional: n });
1820
1840
  }
1821
1841
  return new S();
@@ -1825,19 +1845,19 @@ function X(t) {
1825
1845
  const e = (n = t == null ? void 0 : t.expression.variable) == null ? void 0 : n.value;
1826
1846
  return e === void 0 ? new S() : new U(e);
1827
1847
  }
1828
- function Gn(t) {
1848
+ function Xn(t) {
1829
1849
  var n, s;
1830
1850
  const e = (s = (n = t == null ? void 0 : t.partial) == null ? void 0 : n.variable) == null ? void 0 : s.value;
1831
1851
  return e === void 0 ? new S() : new U(e);
1832
1852
  }
1833
1853
  function V(t) {
1834
- return W(t) ? t.expression instanceof ie ? new U(t.expression.variable.value) : new U(t.expression.literal.value) : new S();
1854
+ return Y(t) ? t.expression instanceof re ? new U(t.expression.variable.value) : new U(t.expression.literal.value) : new S();
1835
1855
  }
1836
- function Cn(t) {
1856
+ function $n(t) {
1837
1857
  var e;
1838
1858
  return !(t instanceof le) || !Gt((e = t.op) == null ? void 0 : e.value) ? !1 : De(t.leftExpression).and_then(() => De(t.rightExpression)).unwrap_or(void 0) !== void 0;
1839
1859
  }
1840
- function Xn(t) {
1860
+ function jn(t) {
1841
1861
  const e = De(t.leftExpression), n = De(t.rightExpression);
1842
1862
  if (!e.isOk() || !n.isOk())
1843
1863
  return !1;
@@ -1845,23 +1865,23 @@ function Xn(t) {
1845
1865
  return (s == null ? void 0 : s.length) === (i == null ? void 0 : i.length);
1846
1866
  }
1847
1867
  function It(t) {
1848
- return t instanceof $ && t.expression instanceof ie || t instanceof ue;
1868
+ return t instanceof j && t.expression instanceof re || t instanceof ue;
1849
1869
  }
1850
1870
  function Lt(t, e) {
1851
1871
  var i, a, r, c;
1852
1872
  let n = e;
1853
- const s = pn(t);
1873
+ const s = En(t);
1854
1874
  for (; n; ) {
1855
1875
  if ((a = (i = n.symbol) == null ? void 0 : i.symbolTable) != null && a.has(t))
1856
1876
  return (r = n.symbol.symbolTable) == null ? void 0 : r.get(t);
1857
- if (((c = n.symbol) == null ? void 0 : c.declaration) instanceof Z && s)
1877
+ if (((c = n.symbol) == null ? void 0 : c.declaration) instanceof K && s)
1858
1878
  return n.symbol;
1859
- if (n instanceof Z)
1879
+ if (n instanceof K)
1860
1880
  return;
1861
1881
  n = n.parent;
1862
1882
  }
1863
1883
  }
1864
- class $n {
1884
+ class Wn {
1865
1885
  constructor(e, n, s) {
1866
1886
  this.declarationNode = e, this.publicSymbolTable = n, this.symbolFactory = s;
1867
1887
  }
@@ -1869,7 +1889,7 @@ class $n {
1869
1889
  return [...this.validateContext(), ...this.validateName(this.declarationNode.name), ...this.validateAlias(this.declarationNode.alias), ...this.validateSettingList(this.declarationNode.attributeList), ...this.validateBody(this.declarationNode.body)];
1870
1890
  }
1871
1891
  validateContext() {
1872
- return this.declarationNode.parent instanceof Z || Ae(this.declarationNode.parent).unwrap_or(void 0) !== I.Project ? [new l(o.INVALID_CUSTOM_CONTEXT, "A custom element can only appear in a Project", this.declarationNode)] : [];
1892
+ return this.declarationNode.parent instanceof K || Le(this.declarationNode.parent).unwrap_or(void 0) !== I.Project ? [new l(o.INVALID_CUSTOM_CONTEXT, "A custom element can only appear in a Project", this.declarationNode)] : [];
1873
1893
  }
1874
1894
  validateName(e) {
1875
1895
  return e ? [new l(o.UNEXPECTED_NAME, "A Custom element shouldn't have a name", e)] : [];
@@ -1883,10 +1903,10 @@ class $n {
1883
1903
  validateBody(e) {
1884
1904
  if (!e)
1885
1905
  return [];
1886
- if (e instanceof ae)
1906
+ if (e instanceof oe)
1887
1907
  return [new l(o.UNEXPECTED_COMPLEX_BODY, "A Custom element can only have an inline field", e)];
1888
1908
  const n = [];
1889
- return W(e.callee) || n.push(new l(o.INVALID_CUSTOM_ELEMENT_VALUE, "A Custom element value can only be a string", e)), e.args.length > 0 && n.push(...e.args.map((s) => new l(o.INVALID_CUSTOM_ELEMENT_VALUE, "A Custom element value can only be a string", s))), n;
1909
+ return Y(e.callee) || n.push(new l(o.INVALID_CUSTOM_ELEMENT_VALUE, "A Custom element value can only be a string", e)), e.args.length > 0 && n.push(...e.args.map((s) => new l(o.INVALID_CUSTOM_ELEMENT_VALUE, "A Custom element value can only be a string", s))), n;
1890
1910
  }
1891
1911
  }
1892
1912
  class ke {
@@ -1909,7 +1929,7 @@ class ke {
1909
1929
  return this.table.forEach(e);
1910
1930
  }
1911
1931
  }
1912
- class jn {
1932
+ class Yn {
1913
1933
  constructor(e, n, s) {
1914
1934
  this.declarationNode = e, this.publicSymbolTable = n, this.symbolFactory = s;
1915
1935
  }
@@ -1927,10 +1947,10 @@ class jn {
1927
1947
  }
1928
1948
  registerElement() {
1929
1949
  const e = [];
1930
- this.declarationNode.symbol = this.symbolFactory.create(Tn, { declaration: this.declarationNode, symbolTable: new ke() });
1931
- const { name: n } = this.declarationNode, s = Y(n);
1950
+ this.declarationNode.symbol = this.symbolFactory.create(bn, { declaration: this.declarationNode, symbolTable: new ke() });
1951
+ const { name: n } = this.declarationNode, s = q(n);
1932
1952
  if (s.isOk()) {
1933
- const i = s.unwrap(), a = i.pop(), r = Qe(i, this.publicSymbolTable, this.symbolFactory), c = st(a);
1953
+ const i = s.unwrap(), a = i.pop(), r = Qe(i, this.publicSymbolTable, this.symbolFactory), c = it(a);
1934
1954
  r.has(c) && e.push(new l(o.DUPLICATE_NAME, `Enum name ${a} already exists in schema '${i.join(".") || "public"}'`, n)), r.set(c, this.declarationNode.symbol);
1935
1955
  }
1936
1956
  return e;
@@ -1949,7 +1969,7 @@ class jn {
1949
1969
  validateFields(e) {
1950
1970
  return e.length === 0 ? [new l(o.EMPTY_ENUM, "An Enum must have at least one element", this.declarationNode)] : e.flatMap((n) => {
1951
1971
  const s = [];
1952
- n.callee && !j(n.callee) && s.push(new l(o.INVALID_ENUM_ELEMENT_NAME, "An enum field must be an identifier or a quoted identifier", n.callee));
1972
+ n.callee && !$(n.callee) && s.push(new l(o.INVALID_ENUM_ELEMENT_NAME, "An enum field must be an identifier or a quoted identifier", n.callee));
1953
1973
  const i = [...n.args];
1954
1974
  return g.last(i) instanceof M ? (s.push(...this.validateFieldSettings(g.last(i))), i.pop()) : i[0] instanceof M && (s.push(...this.validateFieldSettings(i[0])), i.shift()), i.length > 0 && s.push(...i.map((a) => new l(o.INVALID_ENUM_ELEMENT, "An Enum must have only a field and optionally a setting list", a))), s.push(...this.registerField(n)), s;
1955
1975
  });
@@ -1961,7 +1981,7 @@ class jn {
1961
1981
  switch (a) {
1962
1982
  case "note":
1963
1983
  r.length > 1 && r.forEach((c) => s.push(new l(o.DUPLICATE_ENUM_ELEMENT_SETTING, "'note' can only appear once", c))), r.forEach((c) => {
1964
- W(c.value) || s.push(new l(o.INVALID_ENUM_ELEMENT_SETTING, "'note' must be a string", c));
1984
+ Y(c.value) || s.push(new l(o.INVALID_ENUM_ELEMENT_SETTING, "'note' must be a string", c));
1965
1985
  });
1966
1986
  break;
1967
1987
  default:
@@ -1974,13 +1994,13 @@ class jn {
1974
1994
  return e.flatMap((n) => {
1975
1995
  if (n.parent = this.declarationNode, !n.type)
1976
1996
  return [];
1977
- const s = de(n);
1997
+ const s = he(n);
1978
1998
  return new s(n, this.publicSymbolTable, this.symbolFactory).validate();
1979
1999
  });
1980
2000
  }
1981
2001
  registerField(e) {
1982
- if (e.callee && j(e.callee)) {
1983
- const n = X(e.callee).unwrap(), s = it(n), i = this.symbolFactory.create(mn, { declaration: e });
2002
+ if (e.callee && $(e.callee)) {
2003
+ const n = X(e.callee).unwrap(), s = at(n), i = this.symbolFactory.create(In, { declaration: e });
1984
2004
  e.symbol = i;
1985
2005
  const a = this.declarationNode.symbol.symbolTable;
1986
2006
  if (a.has(s)) {
@@ -1995,7 +2015,7 @@ class jn {
1995
2015
  return [];
1996
2016
  }
1997
2017
  }
1998
- class Wn {
2018
+ class qn {
1999
2019
  constructor(e, n, s) {
2000
2020
  this.declarationNode = e, this.publicSymbolTable = n, this.symbolFactory = s;
2001
2021
  }
@@ -2014,9 +2034,9 @@ class Wn {
2014
2034
  "An Indexes can only appear inside a Table or a TablePartial",
2015
2035
  this.declarationNode
2016
2036
  );
2017
- if (this.declarationNode.parent instanceof Z)
2037
+ if (this.declarationNode.parent instanceof K)
2018
2038
  return [e];
2019
- const n = Ae(this.declarationNode.parent).unwrap_or(void 0);
2039
+ const n = Le(this.declarationNode.parent).unwrap_or(void 0);
2020
2040
  return n && [I.Table, I.TablePartial].includes(n) ? [] : [e];
2021
2041
  }
2022
2042
  validateName(e) {
@@ -2042,9 +2062,9 @@ class Wn {
2042
2062
  return [];
2043
2063
  const s = [], i = [n.callee, ...n.args];
2044
2064
  return g.last(i) instanceof M && s.push(...this.validateFieldSetting(i.pop())), i.forEach((a) => {
2045
- for (; a instanceof H; )
2046
- a.argumentList && !Xe(a.argumentList).isOk() && s.push(new l(o.INVALID_INDEXES_FIELD, "An index field must be an identifier, a quoted identifier, a functional expression or a tuple of such", a.argumentList)), a = a.callee;
2047
- Xe(a).isOk() || s.push(new l(o.INVALID_INDEXES_FIELD, "An index field must be an identifier, a quoted identifier, a functional expression or a tuple of such", a));
2065
+ for (; a instanceof ee; )
2066
+ a.argumentList && !$e(a.argumentList).isOk() && s.push(new l(o.INVALID_INDEXES_FIELD, "An index field must be an identifier, a quoted identifier, a functional expression or a tuple of such", a.argumentList)), a = a.callee;
2067
+ $e(a).isOk() || s.push(new l(o.INVALID_INDEXES_FIELD, "An index field must be an identifier, a quoted identifier, a functional expression or a tuple of such", a));
2048
2068
  }), s;
2049
2069
  });
2050
2070
  }
@@ -2056,18 +2076,18 @@ class Wn {
2056
2076
  case "note":
2057
2077
  case "name":
2058
2078
  r.length > 1 && r.forEach((c) => s.push(new l(o.DUPLICATE_INDEX_SETTING, `'${a}' can only appear once`, c))), r.forEach((c) => {
2059
- W(c.value) || s.push(new l(o.INVALID_INDEX_SETTING_VALUE, `'${a}' must be a string`, c));
2079
+ Y(c.value) || s.push(new l(o.INVALID_INDEX_SETTING_VALUE, `'${a}' must be a string`, c));
2060
2080
  });
2061
2081
  break;
2062
2082
  case "unique":
2063
2083
  case "pk":
2064
2084
  r.length > 1 && r.forEach((c) => s.push(new l(o.DUPLICATE_INDEX_SETTING, `'${a}' can only appear once`, c))), r.forEach((c) => {
2065
- Q(c.value) || s.push(new l(o.INVALID_INDEX_SETTING_VALUE, `'${a}' must not have a value`, c));
2085
+ z(c.value) || s.push(new l(o.INVALID_INDEX_SETTING_VALUE, `'${a}' must not have a value`, c));
2066
2086
  });
2067
2087
  break;
2068
2088
  case "type":
2069
2089
  r.length > 1 && r.forEach((c) => s.push(new l(o.DUPLICATE_INDEX_SETTING, "'type' can only appear once", c))), r.forEach((c) => {
2070
- j(c.value) || s.push(new l(o.INVALID_INDEX_SETTING_VALUE, `'type' must be "btree" or "hash"`, c));
2090
+ $(c.value) || s.push(new l(o.INVALID_INDEX_SETTING_VALUE, `'type' must be "btree" or "hash"`, c));
2071
2091
  });
2072
2092
  break;
2073
2093
  default:
@@ -2080,12 +2100,12 @@ class Wn {
2080
2100
  return e.flatMap((n) => {
2081
2101
  if (n.parent = this.declarationNode, !n.type)
2082
2102
  return [];
2083
- const s = de(n);
2103
+ const s = he(n);
2084
2104
  return new s(n, this.publicSymbolTable, this.symbolFactory).validate();
2085
2105
  });
2086
2106
  }
2087
2107
  }
2088
- class Yn {
2108
+ class Hn {
2089
2109
  constructor(e, n, s) {
2090
2110
  this.declarationNode = e, this.publicSymbolTable = n, this.symbolFactory = s;
2091
2111
  }
@@ -2099,26 +2119,26 @@ class Yn {
2099
2119
  ];
2100
2120
  }
2101
2121
  validateContext() {
2102
- return !(this.declarationNode.parent instanceof Z) && ![
2122
+ return !(this.declarationNode.parent instanceof K) && ![
2103
2123
  I.Table,
2104
2124
  I.TableGroup,
2105
2125
  I.TablePartial,
2106
2126
  I.Project
2107
- ].includes(Ae(this.declarationNode.parent).unwrap_or(void 0)) ? [new l(
2127
+ ].includes(Le(this.declarationNode.parent).unwrap_or(void 0)) ? [new l(
2108
2128
  o.INVALID_NOTE_CONTEXT,
2109
2129
  "A Note can only appear inside a Table, a TableGroup, a TablePartial or a Project. Sticky note can only appear at the global scope.",
2110
2130
  this.declarationNode
2111
2131
  )] : [];
2112
2132
  }
2113
2133
  validateName(e) {
2114
- if (!(this.declarationNode.parent instanceof Z))
2134
+ if (!(this.declarationNode.parent instanceof K))
2115
2135
  return e ? [new l(o.UNEXPECTED_NAME, "A Note shouldn't have a name", e)] : [];
2116
2136
  if (!e)
2117
2137
  return [new l(o.INVALID_NAME, "Sticky note must have a name", this.declarationNode)];
2118
- const n = Y(e);
2138
+ const n = q(e);
2119
2139
  if (!n.isOk())
2120
2140
  return [new l(o.INVALID_NAME, "Invalid name for sticky note ", this.declarationNode)];
2121
- const i = n.unwrap().join("."), a = fn(i);
2141
+ const i = n.unwrap().join("."), a = dn(i);
2122
2142
  return this.publicSymbolTable.has(a) ? [new l(o.DUPLICATE_NAME, `Sticky note "${i}" has already been defined`, e)] : (this.publicSymbolTable.set(a, this.declarationNode.symbol), []);
2123
2143
  }
2124
2144
  validateAlias(e) {
@@ -2137,18 +2157,18 @@ class Yn {
2137
2157
  }
2138
2158
  validateFields(e) {
2139
2159
  const n = [];
2140
- return e.length === 0 ? [new l(o.EMPTY_NOTE, "A Note must have a content", this.declarationNode)] : (e.length > 1 && e.slice(1).forEach((s) => n.push(new l(o.NOTE_CONTENT_REDEFINED, "A Note can only contain one string", s))), W(e[0].callee) || n.push(new l(o.INVALID_NOTE, "A Note content must be a quoted string", e[0])), e[0].args.length > 0 && n.push(...e[0].args.map((s) => new l(o.INVALID_NOTE, "A Note can only contain one quoted string", s))), n);
2160
+ return e.length === 0 ? [new l(o.EMPTY_NOTE, "A Note must have a content", this.declarationNode)] : (e.length > 1 && e.slice(1).forEach((s) => n.push(new l(o.NOTE_CONTENT_REDEFINED, "A Note can only contain one string", s))), Y(e[0].callee) || n.push(new l(o.INVALID_NOTE, "A Note content must be a quoted string", e[0])), e[0].args.length > 0 && n.push(...e[0].args.map((s) => new l(o.INVALID_NOTE, "A Note can only contain one quoted string", s))), n);
2141
2161
  }
2142
2162
  validateSubElements(e) {
2143
2163
  return e.flatMap((n) => {
2144
2164
  if (n.parent = this.declarationNode, !n.type)
2145
2165
  return [];
2146
- const s = de(n);
2166
+ const s = he(n);
2147
2167
  return new s(n, this.publicSymbolTable, this.symbolFactory).validate();
2148
2168
  });
2149
2169
  }
2150
2170
  }
2151
- class qn {
2171
+ class zn {
2152
2172
  constructor(e, n, s) {
2153
2173
  this.declarationNode = e, this.publicSymbolTable = n, this.symbolFactory = s;
2154
2174
  }
@@ -2182,12 +2202,12 @@ class qn {
2182
2202
  return e.flatMap((n) => {
2183
2203
  if (n.parent = this.declarationNode, !n.type)
2184
2204
  return [];
2185
- const s = de(n);
2205
+ const s = he(n);
2186
2206
  return new s(n, this.publicSymbolTable, this.symbolFactory).validate();
2187
2207
  });
2188
2208
  }
2189
2209
  }
2190
- class Hn {
2210
+ class Qn {
2191
2211
  constructor(e, n, s) {
2192
2212
  this.declarationNode = e, this.publicSymbolTable = n, this.symbolFactory = s;
2193
2213
  }
@@ -2195,7 +2215,7 @@ class Hn {
2195
2215
  return [...this.validateContext(), ...this.validateName(this.declarationNode.name), ...this.validateAlias(this.declarationNode.alias), ...this.validateSettingList(this.declarationNode.attributeList), ...this.validateBody(this.declarationNode.body)];
2196
2216
  }
2197
2217
  validateContext() {
2198
- return this.declarationNode.parent instanceof Z ? [] : [new l(o.INVALID_REF_CONTEXT, "A Ref must appear top-level", this.declarationNode)];
2218
+ return this.declarationNode.parent instanceof K ? [] : [new l(o.INVALID_REF_CONTEXT, "A Ref must appear top-level", this.declarationNode)];
2199
2219
  }
2200
2220
  validateName(e) {
2201
2221
  return e ? Pe(e) ? [] : [new l(o.INVALID_NAME, "A Ref's name is optional or must be an identifier or a quoted identifer", e)] : [];
@@ -2219,7 +2239,7 @@ class Hn {
2219
2239
  return [new l(o.EMPTY_REF, "A Ref must have at least one field", this.declarationNode)];
2220
2240
  const n = [];
2221
2241
  return e.length > 1 && n.push(...e.slice(1).map((s) => new l(o.REF_REDEFINED, "A Ref can only contain one binary relationship", s))), e.forEach((s) => {
2222
- s.callee && !Cn(s.callee) && n.push(new l(o.INVALID_REF_FIELD, "A Ref field must be a binary relationship", s.callee)), s.callee && !Xn(s.callee) && n.push(new l(o.UNEQUAL_FIELDS_BINARY_REF, "Unequal fields in ref endpoints", s.callee));
2242
+ s.callee && !$n(s.callee) && n.push(new l(o.INVALID_REF_FIELD, "A Ref field must be a binary relationship", s.callee)), s.callee && !jn(s.callee) && n.push(new l(o.UNEQUAL_FIELDS_BINARY_REF, "Unequal fields in ref endpoints", s.callee));
2223
2243
  const i = [...s.args];
2224
2244
  if (g.last(i) instanceof M) {
2225
2245
  const a = this.validateFieldSettings(g.last(i));
@@ -2237,7 +2257,7 @@ class Hn {
2237
2257
  case "delete":
2238
2258
  case "update":
2239
2259
  r.length > 1 && r.forEach((c) => s.push(new l(o.DUPLICATE_REF_SETTING, `'${a}' can only appear once`, c))), r.forEach((c) => {
2240
- zn(c.value) || s.push(new l(o.INVALID_REF_SETTING_VALUE, `'${a}' can only have values "cascade", "no action", "set null", "set default" or "restrict"`, c));
2260
+ Jn(c.value) || s.push(new l(o.INVALID_REF_SETTING_VALUE, `'${a}' can only have values "cascade", "no action", "set null", "set default" or "restrict"`, c));
2241
2261
  });
2242
2262
  break;
2243
2263
  case "color":
@@ -2255,16 +2275,16 @@ class Hn {
2255
2275
  return e.flatMap((n) => {
2256
2276
  if (n.parent = this.declarationNode, !n.type)
2257
2277
  return [];
2258
- const s = de(n);
2278
+ const s = he(n);
2259
2279
  return new s(n, this.publicSymbolTable, this.symbolFactory).validate();
2260
2280
  });
2261
2281
  }
2262
2282
  }
2263
- function zn(t) {
2264
- if (!(j(t) && t.expression.variable.kind !== h.QUOTED_STRING) && !(t instanceof te))
2283
+ function Jn(t) {
2284
+ if (!($(t) && t.expression.variable.kind !== u.QUOTED_STRING) && !(t instanceof ne))
2265
2285
  return !1;
2266
2286
  let e;
2267
- if (t instanceof te ? e = we(t).unwrap_or("") : e = t.expression.variable.value, e)
2287
+ if (t instanceof ne ? e = we(t).unwrap_or("") : e = t.expression.variable.value, e)
2268
2288
  switch (e.toLowerCase()) {
2269
2289
  case "cascade":
2270
2290
  case "no action":
@@ -2277,7 +2297,7 @@ function zn(t) {
2277
2297
  }
2278
2298
  return !1;
2279
2299
  }
2280
- class Qn {
2300
+ class Kn {
2281
2301
  constructor(e, n, s) {
2282
2302
  this.declarationNode = e, this.symbolFactory = s, this.publicSymbolTable = n;
2283
2303
  }
@@ -2295,42 +2315,40 @@ class Qn {
2295
2315
  return this.declarationNode.parent instanceof y ? [new l(o.INVALID_TABLE_CONTEXT, "Table must appear top-level", this.declarationNode)] : [];
2296
2316
  }
2297
2317
  validateName(e) {
2298
- return e ? e instanceof he ? [new l(o.INVALID_NAME, "Invalid array as Table name, maybe you forget to add a space between the name and the setting list?", e)] : Vt(e) ? [] : [new l(o.INVALID_NAME, "A Table name must be of the form <table> or <schema>.<table>", e)] : [new l(o.NAME_NOT_FOUND, "A Table must have a name", this.declarationNode)];
2318
+ return e ? e instanceof Ie ? [new l(o.INVALID_NAME, "Invalid array as Table name, maybe you forget to add a space between the name and the setting list?", e)] : Vt(e) ? [] : [new l(o.INVALID_NAME, "A Table name must be of the form <table> or <schema>.<table>", e)] : [new l(o.NAME_NOT_FOUND, "A Table must have a name", this.declarationNode)];
2299
2319
  }
2300
2320
  validateAlias(e) {
2301
- return e ? ns(e) ? [] : [new l(o.INVALID_ALIAS, "Table aliases can only contains alphanumeric and underscore unless surrounded by double quotes", e)] : [];
2321
+ return e ? ss(e) ? [] : [new l(o.INVALID_ALIAS, "Table aliases can only contains alphanumeric and underscore unless surrounded by double quotes", e)] : [];
2302
2322
  }
2303
2323
  validateSettingList(e) {
2304
2324
  const n = F(e), s = n.getErrors(), i = n.getValue();
2305
- for (const a in i) {
2306
- const r = i[a];
2307
- switch (a) {
2308
- case "headercolor":
2309
- r.length > 1 && s.push(...r.map((c) => new l(o.DUPLICATE_TABLE_SETTING, "'headercolor' can only appear once", c))), r.forEach((c) => {
2325
+ return Ge(i, (a, r) => {
2326
+ switch (r) {
2327
+ case E.HeaderColor:
2328
+ a.length > 1 && s.push(...a.map((c) => new l(o.DUPLICATE_TABLE_SETTING, "'headercolor' can only appear once", c))), a.forEach((c) => {
2310
2329
  Je(c.value) || s.push(new l(o.INVALID_TABLE_SETTING, "'headercolor' must be a color literal", c.value || c.name));
2311
2330
  });
2312
2331
  break;
2313
- case "note":
2314
- r.length > 1 && s.push(...r.map((c) => new l(o.DUPLICATE_TABLE_SETTING, "'note' can only appear once", c))), r.forEach((c) => {
2315
- W(c.value) || s.push(new l(o.INVALID_TABLE_SETTING, "'note' must be a string literal", c.value || c.name));
2332
+ case E.Note:
2333
+ a.length > 1 && s.push(...a.map((c) => new l(o.DUPLICATE_TABLE_SETTING, "'note' can only appear once", c))), a.forEach((c) => {
2334
+ Y(c.value) || s.push(new l(o.INVALID_TABLE_SETTING, "'note' must be a string literal", c.value || c.name));
2316
2335
  });
2317
2336
  break;
2318
2337
  default:
2319
- s.push(...r.map((c) => new l(o.INVALID_TABLE_SETTING, `Unknown '${a}' setting`, c)));
2338
+ s.push(...a.map((c) => new l(o.INVALID_TABLE_SETTING, `Unknown '${r}' setting`, c)));
2320
2339
  }
2321
- }
2322
- return s;
2340
+ }), s;
2323
2341
  }
2324
2342
  registerElement() {
2325
2343
  const e = [];
2326
2344
  this.declarationNode.symbol = this.symbolFactory.create(Mt, { declaration: this.declarationNode, symbolTable: new ke() });
2327
- const { name: n, alias: s } = this.declarationNode, i = Y(n);
2345
+ const { name: n, alias: s } = this.declarationNode, i = q(n);
2328
2346
  if (i.isOk()) {
2329
- const a = [...i.unwrap()], r = a.pop(), c = Qe(a, this.publicSymbolTable, this.symbolFactory), p = Ge(r);
2330
- c.has(p) && e.push(new l(o.DUPLICATE_NAME, `Table name '${r}' already exists in schema '${a.join(".") || "public"}'`, n)), c.set(p, this.declarationNode.symbol);
2347
+ const a = [...i.unwrap()], r = a.pop(), c = Qe(a, this.publicSymbolTable, this.symbolFactory), f = Ce(r);
2348
+ c.has(f) && e.push(new l(o.DUPLICATE_NAME, `Table name '${r}' already exists in schema '${a.join(".") || "public"}'`, n)), c.set(f, this.declarationNode.symbol);
2331
2349
  }
2332
- if (s && Pe(s) && !Kn(s.expression.variable.value, i.unwrap_or([]))) {
2333
- const a = X(s).unwrap(), r = Ge(a);
2350
+ if (s && Pe(s) && !Zn(s.expression.variable.value, i.unwrap_or([]))) {
2351
+ const a = X(s).unwrap(), r = Ce(a);
2334
2352
  this.publicSymbolTable.has(r) && e.push(new l(o.DUPLICATE_NAME, `Table name '${a}' already exists`, n)), this.publicSymbolTable.set(r, this.declarationNode.symbol);
2335
2353
  }
2336
2354
  return e;
@@ -2340,7 +2358,7 @@ class Qn {
2340
2358
  return [];
2341
2359
  if (e instanceof w)
2342
2360
  return [new l(o.UNEXPECTED_SIMPLE_BODY, "A Table's body must be a block", e)];
2343
- const [n, s, i] = e.body.reduce((a, r) => (r instanceof w ? a[0].push(r) : r instanceof Le ? a[1].push(r) : r instanceof y && a[2].push(r), a), [[], [], []]);
2361
+ const [n, s, i] = e.body.reduce((a, r) => (r instanceof w ? a[0].push(r) : r instanceof be ? a[1].push(r) : r instanceof y && a[2].push(r), a), [[], [], []]);
2344
2362
  return [
2345
2363
  ...this.validateFields(n),
2346
2364
  ...this.validateInjections(s),
@@ -2351,10 +2369,10 @@ class Qn {
2351
2369
  return e.flatMap((n) => this.registerInjection(n));
2352
2370
  }
2353
2371
  registerInjection(e) {
2354
- var c, p, f;
2355
- if (!((p = (c = e.partial) == null ? void 0 : c.variable) != null && p.value))
2372
+ var c, f, p;
2373
+ if (!((f = (c = e.partial) == null ? void 0 : c.variable) != null && f.value))
2356
2374
  return [];
2357
- const n = (f = e.partial.variable) == null ? void 0 : f.value, s = Rt(n), i = this.symbolFactory.create(An, { declaration: e });
2375
+ const n = (p = e.partial.variable) == null ? void 0 : p.value, s = Rt(n), i = this.symbolFactory.create(gn, { declaration: e });
2358
2376
  e.symbol = i;
2359
2377
  const a = this.declarationNode.symbol.symbolTable, r = a.get(s);
2360
2378
  return r ? [
@@ -2363,18 +2381,18 @@ class Qn {
2363
2381
  ] : (a.set(s, i), []);
2364
2382
  }
2365
2383
  validateFields(e) {
2366
- return e.length === 0 ? [new l(o.EMPTY_TABLE, "A Table must have at least one column", this.declarationNode)] : e.flatMap((n) => {
2384
+ return e.flatMap((n) => {
2367
2385
  if (!n.callee)
2368
2386
  return [];
2369
2387
  const s = [];
2370
- n.args.length === 0 && s.push(new l(o.INVALID_COLUMN, "A column must have a type", n.callee)), j(n.callee) || s.push(new l(o.INVALID_COLUMN_NAME, "A column name must be an identifier or a quoted identifier", n.callee)), n.args[0] && !Jn(n.args[0]) && s.push(new l(o.INVALID_COLUMN_TYPE, "Invalid column type", n.args[0]));
2388
+ n.args.length === 0 && s.push(new l(o.INVALID_COLUMN, "A column must have a type", n.callee)), $(n.callee) || s.push(new l(o.INVALID_COLUMN_NAME, "A column name must be an identifier or a quoted identifier", n.callee)), n.args[0] && !jt(n.args[0]) && s.push(new l(o.INVALID_COLUMN_TYPE, "Invalid column type", n.args[0]));
2371
2389
  const i = n.args.slice(1);
2372
2390
  return s.push(...this.validateFieldSetting(i)), s.push(...this.registerField(n)), s;
2373
2391
  });
2374
2392
  }
2375
2393
  registerField(e) {
2376
- if (e.callee && j(e.callee)) {
2377
- const n = X(e.callee).unwrap(), s = qe(n), i = this.symbolFactory.create(lt, { declaration: e });
2394
+ if (e.callee && $(e.callee)) {
2395
+ const n = X(e.callee).unwrap(), s = He(n), i = this.symbolFactory.create(ct, { declaration: e });
2378
2396
  e.symbol = i;
2379
2397
  const a = this.declarationNode.symbol.symbolTable;
2380
2398
  if (a.has(s)) {
@@ -2390,84 +2408,90 @@ class Qn {
2390
2408
  }
2391
2409
  // This is needed to support legacy inline settings
2392
2410
  validateFieldSetting(e) {
2393
- if (!e.slice(0, -1).every(fe) || !e.slice(-1).every((p) => fe(p) || p instanceof M))
2394
- return [...e.map((p) => new l(o.INVALID_COLUMN, "These fields must be some inline settings optionally ended with a setting list", p))];
2411
+ if (!e.slice(0, -1).every(Ne) || !e.slice(-1).every((f) => Ne(f) || f instanceof M))
2412
+ return [...e.map((f) => new l(o.INVALID_COLUMN, "These fields must be some inline settings optionally ended with a setting list", f))];
2395
2413
  if (e.length === 0)
2396
2414
  return [];
2397
2415
  let n;
2398
2416
  g.last(e) instanceof M && (n = e.pop());
2399
2417
  const s = F(n), i = s.getErrors(), a = s.getValue();
2400
- for (const p of e) {
2401
- const f = X(p).unwrap_or("").toLowerCase();
2402
- if (f !== "pk" && f !== "unique") {
2403
- i.push(new l(o.INVALID_SETTINGS, "Inline column settings can only be `pk` or `unique`", p));
2404
- continue;
2418
+ e.forEach((f) => {
2419
+ const p = X(f).unwrap_or("").toLowerCase();
2420
+ if (p !== "pk" && p !== "unique") {
2421
+ i.push(new l(o.INVALID_SETTINGS, "Inline column settings can only be `pk` or `unique`", f));
2422
+ return;
2405
2423
  }
2406
- a[f] === void 0 ? a[f] = [p] : a[f].push(p);
2407
- }
2408
- const r = a.pk || [], c = a["primary key"] || [];
2409
- r.length >= 1 && c.length >= 1 && i.push(...[...r, ...c].map((p) => new l(o.DUPLICATE_COLUMN_SETTING, "Either one of 'primary key' and 'pk' can appear", p)));
2410
- for (const p in a) {
2411
- const f = a[p];
2424
+ a[p] === void 0 ? a[p] = [f] : a[p].push(f);
2425
+ });
2426
+ const r = a[E.PK] || [], c = a[E.PKey] || [];
2427
+ return r.length >= 1 && c.length >= 1 && i.push(
2428
+ ...[...r, ...c].map((f) => new l(o.DUPLICATE_COLUMN_SETTING, "Either one of 'primary key' and 'pk' can appear", f))
2429
+ ), Ge(a, (f, p) => {
2412
2430
  switch (p) {
2413
- case "note":
2414
- f.length > 1 && i.push(...f.map((u) => new l(o.DUPLICATE_COLUMN_SETTING, "note can only appear once", u))), f.forEach((u) => {
2415
- W(u.value) || i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'note' must be a quoted string", u.value || u.name));
2431
+ case E.Note:
2432
+ f.length > 1 && i.push(...f.map((h) => new l(o.DUPLICATE_COLUMN_SETTING, "note can only appear once", h))), f.forEach((h) => {
2433
+ Y(h.value) || i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'note' must be a quoted string", h.value || h.name));
2416
2434
  });
2417
2435
  break;
2418
- case "ref":
2419
- f.forEach((u) => {
2420
- Xt(u.value) || i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'ref' must be a valid unary relationship", u.value || u.name));
2436
+ case E.Ref:
2437
+ f.forEach((h) => {
2438
+ Xt(h.value) || i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'ref' must be a valid unary relationship", h.value || h.name));
2421
2439
  });
2422
2440
  break;
2423
- case "primary key":
2424
- f.length > 1 && i.push(...f.map((u) => new l(o.DUPLICATE_COLUMN_SETTING, "primary key can only appear once", u))), f.forEach((u) => {
2425
- Q(u.value) || i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'primary key' must not have a value", u.value || u.name));
2441
+ case E.PKey:
2442
+ f.length > 1 && i.push(...f.map((h) => new l(o.DUPLICATE_COLUMN_SETTING, "primary key can only appear once", h))), f.forEach((h) => {
2443
+ z(h.value) || i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'primary key' must not have a value", h.value || h.name));
2426
2444
  });
2427
2445
  break;
2428
- case "pk":
2429
- f.length > 1 && i.push(...f.map((u) => new l(o.DUPLICATE_COLUMN_SETTING, "'pk' can only appear once", u))), f.forEach((u) => {
2430
- u instanceof ne && !Q(u.value) && i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'pk' must not have a value", u.value || u.name));
2446
+ case E.PK:
2447
+ f.length > 1 && i.push(...f.map((h) => new l(o.DUPLICATE_COLUMN_SETTING, "'pk' can only appear once", h))), f.forEach((h) => {
2448
+ h instanceof se && !z(h.value) && i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'pk' must not have a value", h.value || h.name));
2431
2449
  });
2432
2450
  break;
2433
- case "not null":
2434
- f.length > 1 && i.push(...f.map((u) => new l(o.DUPLICATE_COLUMN_SETTING, "'not null' can only appear once", u)));
2435
- const d = a.null || [];
2436
- f.length >= 1 && d.length >= 1 && i.push(...[...f, ...d].map((u) => new l(o.CONFLICTING_SETTING, "'not null' and 'null' can not be set at the same time", u))), f.forEach((u) => {
2437
- Q(u.value) || i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'not null' must not have a value", u.value || u.name));
2451
+ case E.NotNull: {
2452
+ f.length > 1 && i.push(...f.map((d) => new l(o.DUPLICATE_COLUMN_SETTING, "'not null' can only appear once", d)));
2453
+ const h = a[E.Null] || [];
2454
+ f.length >= 1 && h.length >= 1 && i.push(
2455
+ ...[...f, ...h].map((d) => new l(o.CONFLICTING_SETTING, "'not null' and 'null' can not be set at the same time", d))
2456
+ ), f.forEach((d) => {
2457
+ z(d.value) || i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'not null' must not have a value", d.value || d.name));
2438
2458
  });
2439
2459
  break;
2440
- case "null":
2441
- f.length > 1 && i.push(...f.map((u) => new l(o.DUPLICATE_COLUMN_SETTING, "'null' can only appear once", u))), f.forEach((u) => {
2442
- Q(u.value) || i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'null' must not have a value", u.value || u.name));
2460
+ }
2461
+ case E.Null:
2462
+ f.length > 1 && i.push(...f.map((h) => new l(o.DUPLICATE_COLUMN_SETTING, "'null' can only appear once", h))), f.forEach((h) => {
2463
+ z(h.value) || i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'null' must not have a value", h.value || h.name));
2443
2464
  });
2444
2465
  break;
2445
- case "unique":
2446
- f.length > 1 && i.push(...f.map((u) => new l(o.DUPLICATE_COLUMN_SETTING, "'unique' can only appear once", u))), f.forEach((u) => {
2447
- u instanceof ne && !Q(u.value) && i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'unique' must not have a value", u.value || u.name));
2466
+ case E.Unique:
2467
+ f.length > 1 && i.push(...f.map((h) => new l(o.DUPLICATE_COLUMN_SETTING, "'unique' can only appear once", h))), f.forEach((h) => {
2468
+ h instanceof se && !z(h.value) && i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'unique' must not have a value", h.value || h.name));
2448
2469
  });
2449
2470
  break;
2450
- case "increment":
2451
- f.length > 1 && i.push(...f.map((u) => new l(o.DUPLICATE_COLUMN_SETTING, "'increment' can only appear once", u))), f.forEach((u) => {
2452
- u instanceof ne && !Q(u.value) && i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'increment' must not have a value", u.value || u.name));
2471
+ case E.Increment:
2472
+ f.length > 1 && i.push(...f.map((h) => new l(o.DUPLICATE_COLUMN_SETTING, "'increment' can only appear once", h))), f.forEach((h) => {
2473
+ h instanceof se && !z(h.value) && i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'increment' must not have a value", h.value || h.name));
2453
2474
  });
2454
2475
  break;
2455
- case "default":
2456
- f.length > 1 && i.push(...f.map((u) => new l(o.DUPLICATE_TABLE_SETTING, "'default' can only appear once", u))), f.forEach((u) => {
2457
- Ct(u.value) || i.push(new l(o.INVALID_TABLE_SETTING, "'default' must be a string literal, number literal, function expression, true, false or null", u.value || u.name));
2476
+ case E.Default:
2477
+ f.length > 1 && i.push(...f.map((h) => new l(o.DUPLICATE_TABLE_SETTING, "'default' can only appear once", h))), f.forEach((h) => {
2478
+ Ct(h.value) || i.push(new l(
2479
+ o.INVALID_TABLE_SETTING,
2480
+ "'default' must be a string literal, number literal, function expression, true, false or null",
2481
+ h.value || h.name
2482
+ ));
2458
2483
  });
2459
2484
  break;
2460
2485
  default:
2461
- f.forEach((u) => i.push(new l(o.UNKNOWN_COLUMN_SETTING, `Unknown column setting '${p}'`, u)));
2486
+ f.forEach((h) => i.push(new l(o.UNKNOWN_COLUMN_SETTING, `Unknown column setting '${p}'`, h)));
2462
2487
  }
2463
- }
2464
- return i;
2488
+ }), i;
2465
2489
  }
2466
2490
  validateSubElements(e) {
2467
2491
  const n = e.flatMap((i) => {
2468
2492
  if (i.parent = this.declarationNode, !i.type)
2469
2493
  return [];
2470
- const a = de(i);
2494
+ const a = he(i);
2471
2495
  return new a(i, this.publicSymbolTable, this.symbolFactory).validate();
2472
2496
  }), s = e.filter((i) => {
2473
2497
  var a;
@@ -2476,26 +2500,10 @@ class Qn {
2476
2500
  return s.length > 1 && n.push(...s.map((i) => new l(o.NOTE_REDEFINED, "Duplicate notes are defined", i))), n;
2477
2501
  }
2478
2502
  }
2479
- function Jn(t) {
2480
- if (!(t instanceof H || ze(t) || t instanceof $ || t instanceof he))
2481
- return !1;
2482
- if (t instanceof H) {
2483
- if (t.callee === void 0 || t.argumentList === void 0 || !t.argumentList.elementList.every((n) => pe(n) || W(n) || fe(n)))
2484
- return !1;
2485
- t = t.callee;
2486
- }
2487
- for (; t instanceof he; ) {
2488
- if (t.array === void 0 || t.indexer === void 0 || !t.indexer.elementList.every((n) => !n.colon && !n.value && pe(n.name)))
2489
- return !1;
2490
- t = t.array;
2491
- }
2492
- const e = Y(t).unwrap_or(void 0);
2493
- return e !== void 0 && e.length > 0;
2494
- }
2495
- function Kn(t, e) {
2503
+ function Zn(t, e) {
2496
2504
  return e.length === 1 && t === e[0];
2497
2505
  }
2498
- class Zn {
2506
+ class es {
2499
2507
  constructor(e, n, s) {
2500
2508
  this.declarationNode = e, this.publicSymbolTable = n, this.symbolFactory = s;
2501
2509
  }
@@ -2536,10 +2544,10 @@ class Zn {
2536
2544
  }
2537
2545
  registerElement() {
2538
2546
  const { name: e } = this.declarationNode;
2539
- this.declarationNode.symbol = this.symbolFactory.create(bn, { declaration: this.declarationNode, symbolTable: new ke() });
2540
- const n = Y(e);
2547
+ this.declarationNode.symbol = this.symbolFactory.create(Ln, { declaration: this.declarationNode, symbolTable: new ke() });
2548
+ const n = q(e);
2541
2549
  if (n.isOk()) {
2542
- const s = n.unwrap(), i = s.pop(), a = Qe(s, this.publicSymbolTable, this.symbolFactory), r = at(i);
2550
+ const s = n.unwrap(), i = s.pop(), a = Qe(s, this.publicSymbolTable, this.symbolFactory), r = rt(i);
2543
2551
  if (a.has(r))
2544
2552
  return [new l(o.DUPLICATE_NAME, `TableGroup name '${i}' already exists`, e)];
2545
2553
  a.set(r, this.declarationNode.symbol);
@@ -2568,7 +2576,7 @@ class Zn {
2568
2576
  o.DUPLICATE_TABLE_SETTING,
2569
2577
  "'note' can only appear once",
2570
2578
  c
2571
- ))), a.filter((c) => !W(c.value)).forEach((c) => {
2579
+ ))), a.filter((c) => !Y(c.value)).forEach((c) => {
2572
2580
  s.push(new l(
2573
2581
  o.INVALID_TABLE_SETTING,
2574
2582
  "'note' must be a string literal",
@@ -2604,14 +2612,14 @@ class Zn {
2604
2612
  validateFields(e) {
2605
2613
  return e.flatMap((n) => {
2606
2614
  const s = [];
2607
- return n.callee && !Y(n.callee).isOk() && s.push(new l(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 l(o.INVALID_TABLEGROUP_FIELD, "A TableGroup field should only have a single Table name", i))), s;
2615
+ return n.callee && !q(n.callee).isOk() && s.push(new l(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 l(o.INVALID_TABLEGROUP_FIELD, "A TableGroup field should only have a single Table name", i))), s;
2608
2616
  });
2609
2617
  }
2610
2618
  validateSubElements(e) {
2611
2619
  const n = e.flatMap((i) => {
2612
2620
  if (i.parent = this.declarationNode, !i.type)
2613
2621
  return [];
2614
- const a = de(i);
2622
+ const a = he(i);
2615
2623
  return new a(i, this.publicSymbolTable, this.symbolFactory).validate();
2616
2624
  }), s = e.filter((i) => {
2617
2625
  var a;
@@ -2620,8 +2628,8 @@ class Zn {
2620
2628
  return s.length > 1 && n.push(...s.map((i) => new l(o.NOTE_REDEFINED, "Duplicate notes are defined", i))), n;
2621
2629
  }
2622
2630
  registerField(e) {
2623
- if (e.callee && j(e.callee)) {
2624
- const n = X(e.callee).unwrap(), s = rt(n), i = this.symbolFactory.create(In, { declaration: e });
2631
+ if (e.callee && $(e.callee)) {
2632
+ const n = X(e.callee).unwrap(), s = ot(n), i = this.symbolFactory.create(An, { declaration: e });
2625
2633
  e.symbol = i;
2626
2634
  const a = this.declarationNode.symbol.symbolTable;
2627
2635
  if (a.has(s)) {
@@ -2636,24 +2644,8 @@ class Zn {
2636
2644
  return [];
2637
2645
  }
2638
2646
  }
2639
- const Bt = ["-", "+"];
2640
- function es(t) {
2641
- if (!(t instanceof H || ze(t) || t instanceof $ || t instanceof he))
2642
- return !1;
2643
- if (t instanceof H) {
2644
- if (t.callee === void 0 || t.argumentList === void 0 || !t.argumentList.elementList.every((n) => pe(n) || W(n) || fe(n)))
2645
- return !1;
2646
- t = t.callee;
2647
- }
2648
- for (; t instanceof he; ) {
2649
- if (t.array === void 0 || t.indexer === void 0 || !t.indexer.elementList.every((n) => !n.colon && !n.value && pe(n.name)))
2650
- return !1;
2651
- t = t.array;
2652
- }
2653
- const e = Y(t).unwrap_or(void 0);
2654
- return e !== void 0 && e.length > 0;
2655
- }
2656
- class ts {
2647
+ const ts = ["-", "+"];
2648
+ class ns {
2657
2649
  constructor(e, n, s) {
2658
2650
  this.declarationNode = e, this.symbolFactory = s, this.publicSymbolTable = n;
2659
2651
  }
@@ -2694,16 +2686,16 @@ class ts {
2694
2686
  }
2695
2687
  validateSettingList(e) {
2696
2688
  const n = F(e), s = n.getErrors(), i = n.getValue();
2697
- return pt(i, (a, r) => {
2689
+ return Ge(i, (a, r) => {
2698
2690
  switch (r) {
2699
- case N.HeaderColor:
2691
+ case E.HeaderColor:
2700
2692
  a.length > 1 && s.push(...a.map((c) => new l(o.DUPLICATE_TABLE_PARTIAL_SETTING, `'${r}' can only appear once`, c))), a.forEach((c) => {
2701
2693
  Je(c.value) || s.push(new l(o.INVALID_TABLE_PARTIAL_SETTING, `'${r}' must be a color literal`, c.value || c.name));
2702
2694
  });
2703
2695
  break;
2704
- case N.Note:
2696
+ case E.Note:
2705
2697
  a.length > 1 && s.push(...a.map((c) => new l(o.DUPLICATE_TABLE_PARTIAL_SETTING, `'${r}' can only appear once`, c))), a.forEach((c) => {
2706
- W(c.value) || s.push(new l(o.INVALID_TABLE_PARTIAL_SETTING, `'${r}' must be a string literal`, c.value || c.name));
2698
+ Y(c.value) || s.push(new l(o.INVALID_TABLE_PARTIAL_SETTING, `'${r}' must be a string literal`, c.value || c.name));
2707
2699
  });
2708
2700
  break;
2709
2701
  default:
@@ -2713,11 +2705,11 @@ class ts {
2713
2705
  }
2714
2706
  registerElement() {
2715
2707
  const { name: e } = this.declarationNode;
2716
- this.declarationNode.symbol = this.symbolFactory.create(Ln, { declaration: this.declarationNode, symbolTable: new ke() });
2717
- const n = Y(e);
2708
+ this.declarationNode.symbol = this.symbolFactory.create(_n, { declaration: this.declarationNode, symbolTable: new ke() });
2709
+ const n = q(e);
2718
2710
  if (!n.isOk())
2719
2711
  return [];
2720
- const s = n.unwrap(), i = s.pop(), a = Qe(s, this.publicSymbolTable, this.symbolFactory), r = ot(i);
2712
+ const s = n.unwrap(), i = s.pop(), a = Qe(s, this.publicSymbolTable, this.symbolFactory), r = lt(i);
2721
2713
  return a.has(r) ? [new l(o.DUPLICATE_NAME, `TablePartial name '${i}' already exists`, e)] : (a.set(r, this.declarationNode.symbol), []);
2722
2714
  }
2723
2715
  validateBody(e) {
@@ -2736,7 +2728,7 @@ class ts {
2736
2728
  if (!n.callee)
2737
2729
  return [];
2738
2730
  const s = [];
2739
- n.args.length === 0 && s.push(new l(o.INVALID_COLUMN, "A column must have a type", n.callee)), j(n.callee) || s.push(new l(o.INVALID_COLUMN_NAME, "A column name must be an identifier or a quoted identifier", n.callee)), n.args[0] && !es(n.args[0]) && s.push(new l(o.INVALID_COLUMN_TYPE, "Invalid column type", n.args[0]));
2731
+ n.args.length === 0 && s.push(new l(o.INVALID_COLUMN, "A column must have a type", n.callee)), $(n.callee) || s.push(new l(o.INVALID_COLUMN_NAME, "A column name must be an identifier or a quoted identifier", n.callee)), n.args[0] && !jt(n.args[0]) && s.push(new l(o.INVALID_COLUMN_TYPE, "Invalid column type", n.args[0]));
2740
2732
  const i = n.args.slice(1);
2741
2733
  return s.push(
2742
2734
  ...this.validateFieldSetting(i),
@@ -2745,9 +2737,9 @@ class ts {
2745
2737
  });
2746
2738
  }
2747
2739
  registerField(e) {
2748
- if (!e.callee || !j(e.callee))
2740
+ if (!e.callee || !$(e.callee))
2749
2741
  return [];
2750
- const n = X(e.callee).unwrap(), s = qe(n), i = this.symbolFactory.create(lt, { declaration: e });
2742
+ const n = X(e.callee).unwrap(), s = He(n), i = this.symbolFactory.create(ct, { declaration: e });
2751
2743
  e.symbol = i;
2752
2744
  const a = this.declarationNode.symbol.symbolTable;
2753
2745
  if (a.has(s)) {
@@ -2762,86 +2754,86 @@ class ts {
2762
2754
  // This is needed to support legacy inline settings
2763
2755
  validateFieldSetting(e) {
2764
2756
  const n = Ve(e);
2765
- if (!e.slice(0, -1).every(fe) || !(fe(n) || n instanceof M))
2766
- return [...e.map((f) => new l(o.INVALID_COLUMN, "These fields must be some inline settings optionally ended with a setting list", f))];
2757
+ if (!e.slice(0, -1).every(Ne) || !(Ne(n) || n instanceof M))
2758
+ return [...e.map((p) => new l(o.INVALID_COLUMN, "These fields must be some inline settings optionally ended with a setting list", p))];
2767
2759
  if (e.length === 0)
2768
2760
  return [];
2769
2761
  let s;
2770
2762
  g.last(e) instanceof M && (s = e.pop());
2771
2763
  const i = F(s), a = i.getErrors(), r = i.getValue();
2772
- e.forEach((f) => {
2773
- const d = X(f).unwrap_or("").toLowerCase();
2774
- if (d !== N.PK && d !== N.Unique) {
2775
- a.push(new l(o.INVALID_SETTINGS, "Inline column settings can only be `pk` or `unique`", f));
2764
+ e.forEach((p) => {
2765
+ const h = X(p).unwrap_or("").toLowerCase();
2766
+ if (h !== E.PK && h !== E.Unique) {
2767
+ a.push(new l(o.INVALID_SETTINGS, "Inline column settings can only be `pk` or `unique`", p));
2776
2768
  return;
2777
2769
  }
2778
- r[d] === void 0 ? r[d] = [f] : r[d].push(f);
2770
+ r[h] === void 0 ? r[h] = [p] : r[h].push(p);
2779
2771
  });
2780
- const c = r[N.PK] || [], p = r[N.PKey] || [];
2781
- return c.length >= 1 && p.length >= 1 && a.push(...[...c, ...p].map((f) => new l(
2772
+ const c = r[E.PK] || [], f = r[E.PKey] || [];
2773
+ return c.length >= 1 && f.length >= 1 && a.push(...[...c, ...f].map((p) => new l(
2782
2774
  o.DUPLICATE_COLUMN_SETTING,
2783
2775
  "Either one of 'primary key' and 'pk' can appear",
2784
- f
2785
- ))), pt(r, (f, d) => {
2786
- switch (d) {
2787
- case N.Note:
2788
- f.length > 1 && a.push(...f.map((u) => new l(o.DUPLICATE_COLUMN_SETTING, `'${d}' can only appear once`, u))), f.forEach((u) => {
2789
- W(u.value) || a.push(new l(o.INVALID_COLUMN_SETTING_VALUE, `'${d}' must be a quoted string`, u.value || u.name));
2776
+ p
2777
+ ))), Ge(r, (p, h) => {
2778
+ switch (h) {
2779
+ case E.Note:
2780
+ p.length > 1 && a.push(...p.map((d) => new l(o.DUPLICATE_COLUMN_SETTING, `'${h}' can only appear once`, d))), p.forEach((d) => {
2781
+ Y(d.value) || a.push(new l(o.INVALID_COLUMN_SETTING_VALUE, `'${h}' must be a quoted string`, d.value || d.name));
2790
2782
  });
2791
2783
  break;
2792
- case N.Ref:
2793
- f.forEach((u) => {
2794
- Xt(u.value) || a.push(new l(o.INVALID_COLUMN_SETTING_VALUE, `'${d}' must be a valid unary relationship`, u.value || u.name));
2784
+ case E.Ref:
2785
+ p.forEach((d) => {
2786
+ Xt(d.value) || a.push(new l(o.INVALID_COLUMN_SETTING_VALUE, `'${h}' must be a valid unary relationship`, d.value || d.name));
2795
2787
  });
2796
2788
  break;
2797
- case N.PKey:
2798
- f.length > 1 && a.push(...f.map((u) => new l(o.DUPLICATE_COLUMN_SETTING, `'${d}' can only appear once`, u))), f.forEach((u) => {
2799
- Q(u.value) || a.push(new l(o.INVALID_COLUMN_SETTING_VALUE, `'${d}' must not have a value`, u.value || u.name));
2789
+ case E.PKey:
2790
+ p.length > 1 && a.push(...p.map((d) => new l(o.DUPLICATE_COLUMN_SETTING, `'${h}' can only appear once`, d))), p.forEach((d) => {
2791
+ z(d.value) || a.push(new l(o.INVALID_COLUMN_SETTING_VALUE, `'${h}' must not have a value`, d.value || d.name));
2800
2792
  });
2801
2793
  break;
2802
- case N.PK:
2803
- f.length > 1 && a.push(...f.map((u) => new l(o.DUPLICATE_COLUMN_SETTING, `'${d}' can only appear once`, u))), f.forEach((u) => {
2804
- u instanceof ne && !Q(u.value) && a.push(new l(o.INVALID_COLUMN_SETTING_VALUE, `'${d}' must not have a value`, u.value || u.name));
2794
+ case E.PK:
2795
+ p.length > 1 && a.push(...p.map((d) => new l(o.DUPLICATE_COLUMN_SETTING, `'${h}' can only appear once`, d))), p.forEach((d) => {
2796
+ d instanceof se && !z(d.value) && a.push(new l(o.INVALID_COLUMN_SETTING_VALUE, `'${h}' must not have a value`, d.value || d.name));
2805
2797
  });
2806
2798
  break;
2807
- case N.NotNull: {
2808
- f.length > 1 && a.push(...f.map((E) => new l(o.DUPLICATE_COLUMN_SETTING, `'${d}' can only appear once`, E)));
2809
- const u = r[N.Null] || [];
2810
- f.length >= 1 && u.length >= 1 && a.push(...[...f, ...u].map((E) => new l(
2799
+ case E.NotNull: {
2800
+ p.length > 1 && a.push(...p.map((N) => new l(o.DUPLICATE_COLUMN_SETTING, `'${h}' can only appear once`, N)));
2801
+ const d = r[E.Null] || [];
2802
+ p.length >= 1 && d.length >= 1 && a.push(...[...p, ...d].map((N) => new l(
2811
2803
  o.CONFLICTING_SETTING,
2812
2804
  "'not null' and 'null' can not be set at the same time",
2813
- E
2814
- ))), f.forEach((E) => {
2815
- Q(E.value) || a.push(new l(o.INVALID_COLUMN_SETTING_VALUE, `'${d}' must not have a value`, E.value || E.name));
2805
+ N
2806
+ ))), p.forEach((N) => {
2807
+ z(N.value) || a.push(new l(o.INVALID_COLUMN_SETTING_VALUE, `'${h}' must not have a value`, N.value || N.name));
2816
2808
  });
2817
2809
  break;
2818
2810
  }
2819
- case N.Null:
2820
- f.length > 1 && a.push(...f.map((u) => new l(o.DUPLICATE_COLUMN_SETTING, `'${d}' can only appear once`, u))), f.forEach((u) => {
2821
- Q(u.value) || a.push(new l(o.INVALID_COLUMN_SETTING_VALUE, `'${d}' must not have a value`, u.value || u.name));
2811
+ case E.Null:
2812
+ p.length > 1 && a.push(...p.map((d) => new l(o.DUPLICATE_COLUMN_SETTING, `'${h}' can only appear once`, d))), p.forEach((d) => {
2813
+ z(d.value) || a.push(new l(o.INVALID_COLUMN_SETTING_VALUE, `'${h}' must not have a value`, d.value || d.name));
2822
2814
  });
2823
2815
  break;
2824
- case N.Unique:
2825
- f.length > 1 && a.push(...f.map((u) => new l(o.DUPLICATE_COLUMN_SETTING, `'${d}' can only appear once`, u))), f.forEach((u) => {
2826
- u instanceof ne && !Q(u.value) && a.push(new l(o.INVALID_COLUMN_SETTING_VALUE, `'${d}' must not have a value`, u.value || u.name));
2816
+ case E.Unique:
2817
+ p.length > 1 && a.push(...p.map((d) => new l(o.DUPLICATE_COLUMN_SETTING, `'${h}' can only appear once`, d))), p.forEach((d) => {
2818
+ d instanceof se && !z(d.value) && a.push(new l(o.INVALID_COLUMN_SETTING_VALUE, `'${h}' must not have a value`, d.value || d.name));
2827
2819
  });
2828
2820
  break;
2829
- case N.Increment:
2830
- f.length > 1 && a.push(...f.map((u) => new l(o.DUPLICATE_COLUMN_SETTING, `'${d}' can only appear once`, u))), f.forEach((u) => {
2831
- u instanceof ne && !Q(u.value) && a.push(new l(o.INVALID_COLUMN_SETTING_VALUE, `'${d}' must not have a value`, u.value || u.name));
2821
+ case E.Increment:
2822
+ p.length > 1 && a.push(...p.map((d) => new l(o.DUPLICATE_COLUMN_SETTING, `'${h}' can only appear once`, d))), p.forEach((d) => {
2823
+ d instanceof se && !z(d.value) && a.push(new l(o.INVALID_COLUMN_SETTING_VALUE, `'${h}' must not have a value`, d.value || d.name));
2832
2824
  });
2833
2825
  break;
2834
- case N.Default:
2835
- f.length > 1 && a.push(...f.map((u) => new l(o.DUPLICATE_COLUMN_SETTING, `'${d}' can only appear once`, u))), f.forEach((u) => {
2836
- Ct(u.value) || a.push(new l(
2826
+ case E.Default:
2827
+ p.length > 1 && a.push(...p.map((d) => new l(o.DUPLICATE_COLUMN_SETTING, `'${h}' can only appear once`, d))), p.forEach((d) => {
2828
+ Ct(d.value) || a.push(new l(
2837
2829
  o.INVALID_COLUMN_SETTING_VALUE,
2838
- `'${d}' must be a string literal, number literal, function expression, true, false or null`,
2839
- u.value || u.name
2830
+ `'${h}' must be a string literal, number literal, function expression, true, false or null`,
2831
+ d.value || d.name
2840
2832
  ));
2841
2833
  });
2842
2834
  break;
2843
2835
  default:
2844
- f.forEach((u) => a.push(new l(o.UNKNOWN_COLUMN_SETTING, `Unknown column setting '${d}'`, u)));
2836
+ p.forEach((d) => a.push(new l(o.UNKNOWN_COLUMN_SETTING, `Unknown column setting '${h}'`, d)));
2845
2837
  }
2846
2838
  }), a;
2847
2839
  }
@@ -2849,7 +2841,7 @@ class ts {
2849
2841
  const n = e.flatMap((i) => {
2850
2842
  if (i.parent = this.declarationNode, !i.type)
2851
2843
  return [];
2852
- const a = de(i);
2844
+ const a = he(i);
2853
2845
  return new a(i, this.publicSymbolTable, this.symbolFactory).validate();
2854
2846
  }), s = e.filter((i) => {
2855
2847
  var a;
@@ -2858,36 +2850,36 @@ class ts {
2858
2850
  return s.length > 1 && n.push(...s.map((i) => new l(o.NOTE_REDEFINED, "Duplicate notes are defined", i))), n;
2859
2851
  }
2860
2852
  }
2861
- function de(t) {
2853
+ function he(t) {
2862
2854
  switch (t.type.value.toLowerCase()) {
2863
2855
  case I.Enum:
2864
- return jn;
2856
+ return Yn;
2865
2857
  case I.Table:
2866
- return Qn;
2858
+ return Kn;
2867
2859
  case I.TableGroup:
2868
- return Zn;
2860
+ return es;
2869
2861
  case I.Project:
2870
- return qn;
2862
+ return zn;
2871
2863
  case I.Ref:
2872
- return Hn;
2864
+ return Qn;
2873
2865
  case I.Note:
2874
- return Yn;
2866
+ return Hn;
2875
2867
  case I.Indexes:
2876
- return Wn;
2868
+ return qn;
2877
2869
  case I.TablePartial:
2878
- return ts;
2870
+ return ns;
2879
2871
  default:
2880
- return $n;
2872
+ return Wn;
2881
2873
  }
2882
2874
  }
2883
2875
  function Vt(t) {
2884
- return !!Y(t).unwrap_or(!1);
2876
+ return !!q(t).unwrap_or(!1);
2885
2877
  }
2886
- function ns(t) {
2878
+ function ss(t) {
2887
2879
  return Pe(t);
2888
2880
  }
2889
2881
  function Pe(t) {
2890
- return t instanceof $ && t.expression instanceof ie;
2882
+ return t instanceof j && t.expression instanceof re;
2891
2883
  }
2892
2884
  function Qe(t, e, n) {
2893
2885
  var i;
@@ -2895,14 +2887,14 @@ function Qe(t, e, n) {
2895
2887
  let s = e;
2896
2888
  for (const a of t) {
2897
2889
  let r;
2898
- const c = nt(a);
2890
+ const c = st(a);
2899
2891
  if (s.has(c)) {
2900
2892
  if (r = (i = s.get(c)) == null ? void 0 : i.symbolTable, !r)
2901
2893
  throw new Error("Expect a symbol table in a schema symbol");
2902
2894
  } else {
2903
2895
  r = new ke();
2904
- const p = n.create(Ut, { symbolTable: r });
2905
- s.set(c, p);
2896
+ const f = n.create(Ut, { symbolTable: r });
2897
+ s.set(c, f);
2906
2898
  }
2907
2899
  s = r;
2908
2900
  }
@@ -2913,53 +2905,69 @@ function Gt(t) {
2913
2905
  }
2914
2906
  function Je(t) {
2915
2907
  var n;
2916
- if (!(t instanceof $) || !(t.expression instanceof ye) || ((n = t.expression.literal) == null ? void 0 : n.kind) !== h.COLOR_LITERAL)
2908
+ if (!(t instanceof j) || !(t.expression instanceof ye) || ((n = t.expression.literal) == null ? void 0 : n.kind) !== u.COLOR_LITERAL)
2917
2909
  return !1;
2918
2910
  const e = t.expression.literal.value;
2919
2911
  if (e.length !== 4 && e.length !== 7 || e[0] !== "#")
2920
2912
  return !1;
2921
2913
  for (let s = 1; s < e.length; s += 1)
2922
- if (!wn(e[s]))
2914
+ if (!kn(e[s]))
2923
2915
  return !1;
2924
2916
  return !0;
2925
2917
  }
2926
- function Q(t) {
2918
+ function z(t) {
2927
2919
  return t === void 0;
2928
2920
  }
2929
2921
  function Ct(t) {
2930
2922
  var e;
2931
- return !!(W(t) || pe(t) || fe(t) && ["true", "false", "null"].includes(t.expression.variable.value.toLowerCase()) || t instanceof oe && Bt.includes((e = t.op) == null ? void 0 : e.value) && pe(t.expression) || t instanceof ue);
2923
+ return !!(Y(t) || Ae(t) || Ne(t) && ["true", "false", "null"].includes(t.expression.variable.value.toLowerCase()) || t instanceof Z && ts.includes((e = t.op) == null ? void 0 : e.value) && Ae(t.expression) || t instanceof ue);
2932
2924
  }
2933
- function pe(t) {
2934
- var e;
2935
- return t instanceof $ && t.expression instanceof ye && ((e = t.expression.literal) == null ? void 0 : e.kind) === h.NUMERIC_LITERAL;
2925
+ function Ae(t) {
2926
+ var e, n, s;
2927
+ return t instanceof Z ? ((e = t.op) == null ? void 0 : e.value) !== "-" && ((n = t.op) == null ? void 0 : n.value) !== "+" ? !1 : Ae(t.expression) : t instanceof j && t.expression instanceof ye && ((s = t.expression.literal) == null ? void 0 : s.kind) === u.NUMERIC_LITERAL;
2936
2928
  }
2937
2929
  function Xt(t) {
2938
2930
  var n;
2939
- if (!(t instanceof oe) || !Gt((n = t.op) == null ? void 0 : n.value))
2931
+ if (!(t instanceof Z) || !Gt((n = t.op) == null ? void 0 : n.value))
2940
2932
  return !1;
2941
- const e = Y(t.expression).unwrap_or(void 0);
2933
+ const e = q(t.expression).unwrap_or(void 0);
2942
2934
  return e !== void 0 && e.length > 0;
2943
2935
  }
2944
2936
  function $t(t) {
2945
- return t instanceof ce && t.elementList.every(j);
2937
+ return t instanceof ce && t.elementList.every($);
2938
+ }
2939
+ function jt(t) {
2940
+ if (!(t instanceof ee || ut(t) || t instanceof j || t instanceof Ie))
2941
+ return !1;
2942
+ if (t instanceof ee) {
2943
+ if (t.callee === void 0 || t.argumentList === void 0 || !t.argumentList.elementList.every((n) => Ae(n) || Y(n) || Ne(n)))
2944
+ return !1;
2945
+ t = t.callee;
2946
+ }
2947
+ for (; t instanceof Ie; ) {
2948
+ if (t.array === void 0 || t.indexer === void 0 || !t.indexer.elementList.every((n) => !n.colon && !n.value && Ae(n.name)))
2949
+ return !1;
2950
+ t = t.array;
2951
+ }
2952
+ const e = q(t).unwrap_or(void 0);
2953
+ return e !== void 0 && e.length > 0;
2946
2954
  }
2947
2955
  function F(t) {
2948
2956
  var s;
2949
2957
  const e = {}, n = [];
2950
2958
  if (!t)
2951
- return new K({});
2959
+ return new J({});
2952
2960
  for (const i of t.elementList) {
2953
2961
  if (!i.name)
2954
2962
  continue;
2955
- if (i.name instanceof $) {
2963
+ if (i.name instanceof j) {
2956
2964
  n.push(new l(o.INVALID_SETTINGS, "A setting name must be a stream of identifiers", i.name));
2957
2965
  continue;
2958
2966
  }
2959
2967
  const a = (s = we(i.name).unwrap_or(void 0)) == null ? void 0 : s.toLowerCase();
2960
2968
  a && (e[a] === void 0 ? e[a] = [i] : e[a].push(i));
2961
2969
  }
2962
- return new K(e, n);
2970
+ return new J(e, n);
2963
2971
  }
2964
2972
  class At {
2965
2973
  constructor(e, n) {
@@ -2972,18 +2980,18 @@ class At {
2972
2980
  this.ast.body.forEach((s) => {
2973
2981
  if (s.parent = this.ast, s.type === void 0)
2974
2982
  return;
2975
- const i = de(s), a = new i(
2983
+ const i = he(s), a = new i(
2976
2984
  s,
2977
2985
  this.publicSchemaSymbol.symbolTable,
2978
2986
  this.symbolFactory
2979
2987
  );
2980
2988
  e.push(...a.validate());
2981
2989
  });
2982
- const n = this.ast.body.filter((s) => Ae(s).unwrap_or(void 0) === I.Project);
2983
- return n.length > 1 && n.forEach((s) => e.push(new l(o.PROJECT_REDEFINED, "Only one project can exist", s))), new K(this.ast, e);
2990
+ const n = this.ast.body.filter((s) => Le(s).unwrap_or(void 0) === I.Project);
2991
+ return n.length > 1 && n.forEach((s) => e.push(new l(o.PROJECT_REDEFINED, "Only one project can exist", s))), new J(this.ast, e);
2984
2992
  }
2985
2993
  }
2986
- class Ee {
2994
+ class fe {
2987
2995
  constructor(e, n) {
2988
2996
  this.declarationNode = e, this.errors = n;
2989
2997
  }
@@ -2992,7 +3000,7 @@ class Ee {
2992
3000
  }
2993
3001
  bindSettingList(e, n) {
2994
3002
  e && e.elementList.forEach((s) => {
2995
- if (s.name instanceof $)
3003
+ if (s.name instanceof j)
2996
3004
  return;
2997
3005
  const i = we(s.name).unwrap_or(void 0);
2998
3006
  if (!i)
@@ -3006,11 +3014,11 @@ class Ee {
3006
3014
  if (!e.body)
3007
3015
  return;
3008
3016
  const { body: n } = e;
3009
- n instanceof ae ? n.body.forEach((s) => {
3017
+ n instanceof oe ? n.body.forEach((s) => {
3010
3018
  if (s instanceof y) {
3011
- if (!s.type || Ae(this.declarationNode).unwrap_or(null) === I.TablePartial && Ae(s).unwrap_or(null) === I.Indexes)
3019
+ if (!s.type || Le(this.declarationNode).unwrap_or(null) === I.TablePartial && Le(s).unwrap_or(null) === I.Indexes)
3012
3020
  return;
3013
- const i = jt(s);
3021
+ const i = Wt(s);
3014
3022
  new i(s, this.errors).bind();
3015
3023
  } else
3016
3024
  s instanceof w ? this.bindSubfield(s) : this.bindPartialInjection(s);
@@ -3031,12 +3039,12 @@ class Ee {
3031
3039
  scanAndBind(e, n) {
3032
3040
  var s, i;
3033
3041
  if (e)
3034
- if (e instanceof $) {
3035
- if (e.expression instanceof ie && ((i = n.keywords) != null && i.includes((s = e.expression.variable) == null ? void 0 : s.value.toLowerCase())))
3042
+ if (e instanceof j) {
3043
+ if (e.expression instanceof re && ((i = n.keywords) != null && i.includes((s = e.expression.variable) == null ? void 0 : s.value.toLowerCase())))
3036
3044
  return;
3037
3045
  this.bindFragments([e], n);
3038
3046
  } else
3039
- e instanceof le ? ze(e) ? this.bindFragments(_e(e).unwrap_or([]), n) : (this.scanAndBind(e.leftExpression, n), this.scanAndBind(e.rightExpression, n)) : e instanceof oe ? this.scanAndBind(e.expression, n) : e instanceof Ye ? this.scanAndBind(e.expression, n) : e instanceof ce ? e.elementList.forEach((a) => this.scanAndBind(a, n)) : e instanceof Le && this.bindFragments([e], n);
3047
+ e instanceof le ? ut(e) ? this.bindFragments(_e(e).unwrap_or([]), n) : (this.scanAndBind(e.leftExpression, n), this.scanAndBind(e.rightExpression, n)) : e instanceof Z ? this.scanAndBind(e.expression, n) : e instanceof qe ? this.scanAndBind(e.expression, n) : e instanceof ce ? e.elementList.forEach((a) => this.scanAndBind(a, n)) : e instanceof be && this.bindFragments([e], n);
3040
3048
  }
3041
3049
  // Bind the fragments of a member access expression
3042
3050
  // which can be a simple expression like v1.User,
@@ -3044,40 +3052,40 @@ class Ee {
3044
3052
  bindFragments(e, n) {
3045
3053
  if (e.length === 0)
3046
3054
  return;
3047
- const s = e.length === 1 && e[0] instanceof Le, i = [...n.topSubnamesSymbolKind], { remainingSubnamesSymbolKind: a } = n, r = s ? -1 : e.findIndex((E) => !j(E)), p = r !== -1 && $t(e[r]) ? e[r] : void 0, f = r >= 0 ? i.pop() : void 0, d = e.slice(
3055
+ const s = e.length === 1 && e[0] instanceof be, i = [...n.topSubnamesSymbolKind], { remainingSubnamesSymbolKind: a } = n, r = s ? -1 : e.findIndex((N) => !$(N)), f = r !== -1 && $t(e[r]) ? e[r] : void 0, p = r >= 0 ? i.pop() : void 0, h = e.slice(
3048
3056
  0,
3049
3057
  r === -1 ? void 0 : r
3050
3058
  );
3051
- if (d.length === 0)
3059
+ if (h.length === 0)
3052
3060
  return;
3053
- const u = [];
3054
- for (; i.length && d.length; ) {
3055
- const E = i.pop(), L = d.pop(), v = X(L).unwrap();
3056
- u.unshift({
3057
- index: Fe(v, E),
3061
+ const d = [];
3062
+ for (; i.length && h.length; ) {
3063
+ const N = i.pop(), L = h.pop(), v = X(L).unwrap();
3064
+ d.unshift({
3065
+ index: Fe(v, N),
3058
3066
  referrer: L
3059
3067
  });
3060
3068
  }
3061
- for (; d.length; ) {
3062
- const E = d.pop(), L = s ? Gn(E).unwrap() : X(E).unwrap();
3063
- u.unshift({
3069
+ for (; h.length; ) {
3070
+ const N = h.pop(), L = s ? Xn(N).unwrap() : X(N).unwrap();
3071
+ d.unshift({
3064
3072
  index: Fe(L, a),
3065
- referrer: E
3073
+ referrer: N
3066
3074
  });
3067
3075
  }
3068
- return p ? p.elementList.forEach((E) => this.resolveIndexStack(
3076
+ return f ? f.elementList.forEach((N) => this.resolveIndexStack(
3069
3077
  [
3070
- ...u,
3078
+ ...d,
3071
3079
  {
3072
3080
  index: Fe(
3073
- X(E).unwrap(),
3074
- f
3081
+ X(N).unwrap(),
3082
+ p
3075
3083
  ),
3076
- referrer: E
3084
+ referrer: N
3077
3085
  }
3078
3086
  ],
3079
3087
  n.ignoreNameNotFound
3080
- )) : this.resolveIndexStack(u, n.ignoreNameNotFound);
3088
+ )) : this.resolveIndexStack(d, n.ignoreNameNotFound);
3081
3089
  }
3082
3090
  // Looking up the indexes in the subname stack from the current declaration node
3083
3091
  // Each time the index resolves to a symbol, the referrer's symbol is bound to it
@@ -3086,25 +3094,25 @@ class Ee {
3086
3094
  throw new Error("Unreachable - An unresolved name must have at least one name component");
3087
3095
  const [s, ...i] = e, a = Lt(s.index, this.declarationNode);
3088
3096
  if (a === void 0) {
3089
- const { kind: f, name: d } = re(s.index).unwrap();
3090
- this.logError(s.referrer, `Can not find ${f} '${d}'`, n);
3097
+ const { kind: p, name: h } = ie(s.index).unwrap();
3098
+ this.logError(s.referrer, `Can not find ${p} '${h}'`, n);
3091
3099
  return;
3092
3100
  }
3093
3101
  a.references.push(s.referrer), s.referrer.referee = a;
3094
- let r = a.symbolTable, { kind: c, name: p } = re(s.index).unwrap();
3095
- for (const f of i) {
3096
- const { kind: d, name: u } = re(f.index).unwrap(), E = r.get(f.index);
3097
- if (!E) {
3102
+ let r = a.symbolTable, { kind: c, name: f } = ie(s.index).unwrap();
3103
+ for (const p of i) {
3104
+ const { kind: h, name: d } = ie(p.index).unwrap(), N = r.get(p.index);
3105
+ if (!N) {
3098
3106
  this.logError(
3099
- f.referrer,
3100
- `${c} '${p}' does not have ${d} '${u}'`,
3107
+ p.referrer,
3108
+ `${c} '${f}' does not have ${h} '${d}'`,
3101
3109
  n
3102
3110
  );
3103
3111
  return;
3104
3112
  }
3105
- if (c = d, p = u, f.referrer.referee = E, E.references.push(f.referrer), !E.symbolTable)
3113
+ if (c = h, f = d, p.referrer.referee = N, N.references.push(p.referrer), !N.symbolTable)
3106
3114
  break;
3107
- r = E.symbolTable;
3115
+ r = N.symbolTable;
3108
3116
  }
3109
3117
  }
3110
3118
  logError(e, n, s) {
@@ -3118,23 +3126,23 @@ class Ee {
3118
3126
  return;
3119
3127
  const s = /* @__PURE__ */ new Map();
3120
3128
  n.forEach((a, r) => {
3121
- var f, d;
3122
- if (!dn(r))
3129
+ var p, h;
3130
+ if (!Nn(r))
3123
3131
  return;
3124
- const c = Lt(En(r), this.declarationNode), p = (d = (f = c == null ? void 0 : c.declaration) == null ? void 0 : f.symbol) == null ? void 0 : d.symbolTable;
3125
- p && p.forEach((u, E) => {
3126
- n.has(E) || s.set(E, { injectorFieldSymbol: u, injectorDeclaration: a.declaration });
3132
+ const c = Lt(Tn(r), this.declarationNode), f = (h = (p = c == null ? void 0 : c.declaration) == null ? void 0 : p.symbol) == null ? void 0 : h.symbolTable;
3133
+ f && f.forEach((d, N) => {
3134
+ n.has(N) || s.set(N, { injectorFieldSymbol: d, injectorDeclaration: a.declaration });
3127
3135
  });
3128
3136
  }), s.forEach((a, r) => {
3129
- const c = vn(a.injectorFieldSymbol);
3137
+ const c = yn(a.injectorFieldSymbol);
3130
3138
  if (!c)
3131
3139
  return;
3132
- const p = e.create(c, a);
3133
- n.set(r, p);
3140
+ const f = e.create(c, a);
3141
+ n.set(r, f);
3134
3142
  });
3135
3143
  }
3136
3144
  }
3137
- class ss extends Ee {
3145
+ class is extends fe {
3138
3146
  constructor() {
3139
3147
  super(...arguments), this.subfield = {
3140
3148
  arg: {
@@ -3144,7 +3152,7 @@ class ss extends Ee {
3144
3152
  }, this.settingList = {};
3145
3153
  }
3146
3154
  }
3147
- class is extends Ee {
3155
+ class as extends fe {
3148
3156
  constructor() {
3149
3157
  super(...arguments), this.subfield = {
3150
3158
  arg: {
@@ -3154,7 +3162,7 @@ class is extends Ee {
3154
3162
  }, this.settingList = {};
3155
3163
  }
3156
3164
  }
3157
- class as extends Ee {
3165
+ class rs extends fe {
3158
3166
  constructor() {
3159
3167
  super(...arguments), this.subfield = {
3160
3168
  arg: {
@@ -3189,7 +3197,7 @@ class as extends Ee {
3189
3197
  }, this.settingList = {};
3190
3198
  }
3191
3199
  }
3192
- class rs extends Ee {
3200
+ class os extends fe {
3193
3201
  constructor() {
3194
3202
  super(...arguments), this.subfield = {
3195
3203
  arg: {
@@ -3199,7 +3207,7 @@ class rs extends Ee {
3199
3207
  }, this.settingList = {};
3200
3208
  }
3201
3209
  }
3202
- class os extends Ee {
3210
+ class ls extends fe {
3203
3211
  constructor() {
3204
3212
  super(...arguments), this.subfield = {
3205
3213
  arg: {
@@ -3209,7 +3217,7 @@ class os extends Ee {
3209
3217
  }, this.settingList = {};
3210
3218
  }
3211
3219
  }
3212
- class ls extends Ee {
3220
+ class cs extends fe {
3213
3221
  constructor() {
3214
3222
  super(...arguments), this.subfield = {
3215
3223
  arg: {
@@ -3226,7 +3234,7 @@ class ls extends Ee {
3226
3234
  }, this.settingList = {};
3227
3235
  }
3228
3236
  }
3229
- class cs extends Ee {
3237
+ class us extends fe {
3230
3238
  constructor() {
3231
3239
  super(...arguments), this.subfield = {
3232
3240
  arg: {
@@ -3259,7 +3267,7 @@ class cs extends Ee {
3259
3267
  };
3260
3268
  }
3261
3269
  }
3262
- class us extends Ee {
3270
+ class hs extends fe {
3263
3271
  constructor() {
3264
3272
  super(...arguments), this.subfield = {
3265
3273
  arg: {
@@ -3276,7 +3284,7 @@ class us extends Ee {
3276
3284
  }, this.settingList = {};
3277
3285
  }
3278
3286
  }
3279
- class hs extends Ee {
3287
+ class fs extends fe {
3280
3288
  constructor() {
3281
3289
  super(...arguments), this.subfield = {
3282
3290
  arg: {
@@ -3304,29 +3312,29 @@ class hs extends Ee {
3304
3312
  }, this.settingList = {};
3305
3313
  }
3306
3314
  }
3307
- function jt(t) {
3315
+ function Wt(t) {
3308
3316
  switch (t.type.value.toLowerCase()) {
3309
3317
  case I.Enum:
3310
- return is;
3318
+ return as;
3311
3319
  case I.Table:
3312
- return cs;
3313
- case I.TableGroup:
3314
3320
  return us;
3321
+ case I.TableGroup:
3322
+ return hs;
3315
3323
  case I.Project:
3316
- return os;
3317
- case I.Ref:
3318
3324
  return ls;
3325
+ case I.Ref:
3326
+ return cs;
3319
3327
  case I.Note:
3320
- return rs;
3328
+ return os;
3321
3329
  case I.Indexes:
3322
- return as;
3330
+ return rs;
3323
3331
  case I.TablePartial:
3324
- return hs;
3332
+ return fs;
3325
3333
  default:
3326
- return ss;
3334
+ return is;
3327
3335
  }
3328
3336
  }
3329
- class fs {
3337
+ class ps {
3330
3338
  constructor(e) {
3331
3339
  this.ast = e, this.errors = [];
3332
3340
  }
@@ -3334,12 +3342,12 @@ class fs {
3334
3342
  return this.ast.body.map((n) => {
3335
3343
  if (!n.type)
3336
3344
  return null;
3337
- const s = jt(n), i = new s(n, this.errors);
3345
+ const s = Wt(n), i = new s(n, this.errors);
3338
3346
  return i.resolveInjections(e), i;
3339
- }).forEach((n) => n == null ? void 0 : n.bind()), new K(this.ast, this.errors);
3347
+ }).forEach((n) => n == null ? void 0 : n.bind()), new J(this.ast, this.errors);
3340
3348
  }
3341
3349
  }
3342
- class ps {
3350
+ class ds {
3343
3351
  constructor(e) {
3344
3352
  this.generator = e;
3345
3353
  }
@@ -3347,17 +3355,17 @@ class ps {
3347
3355
  return new e(n, this.generator.nextId());
3348
3356
  }
3349
3357
  }
3350
- class ds {
3358
+ class Es {
3351
3359
  constructor(e, n) {
3352
- this.ast = e, this.symbolFactory = new ps(n);
3360
+ this.ast = e, this.symbolFactory = new ds(n);
3353
3361
  }
3354
3362
  // Analyzing: Invoking both the validator and binder
3355
3363
  analyze() {
3356
- return new At(this.ast, this.symbolFactory).validate().chain((n) => new fs(n).resolve(this.symbolFactory));
3364
+ return new At(this.ast, this.symbolFactory).validate().chain((n) => new ps(n).resolve(this.symbolFactory));
3357
3365
  }
3358
3366
  // For invoking the validator only
3359
3367
  validate() {
3360
- return new At(this.ast, this.symbolFactory).validate().chain((n) => new K(n, []));
3368
+ return new At(this.ast, this.symbolFactory).validate().chain((n) => new J(n, []));
3361
3369
  }
3362
3370
  }
3363
3371
  function _t(t, e) {
@@ -3380,7 +3388,7 @@ function _t(t, e) {
3380
3388
  schemaName: n.pop() || null
3381
3389
  };
3382
3390
  }
3383
- function Wt(t) {
3391
+ function Yt(t) {
3384
3392
  switch (t) {
3385
3393
  case "<":
3386
3394
  return ["1", "*"];
@@ -3408,13 +3416,13 @@ function _(t) {
3408
3416
  }
3409
3417
  };
3410
3418
  }
3411
- function $e(t) {
3419
+ function je(t) {
3412
3420
  var n;
3413
3421
  const e = (n = _e(t).unwrap_or(void 0)) == null ? void 0 : n.pop();
3414
3422
  return e instanceof ce ? e.elementList.map((s) => s.referee) : [e.referee];
3415
3423
  }
3416
3424
  function ge(t) {
3417
- const e = Y(t).unwrap();
3425
+ const e = q(t).unwrap();
3418
3426
  return {
3419
3427
  name: e.pop(),
3420
3428
  schemaName: e
@@ -3423,7 +3431,7 @@ function ge(t) {
3423
3431
  function Oe(t) {
3424
3432
  return t.expression.literal.value;
3425
3433
  }
3426
- function Yt(t, e) {
3434
+ function qt(t, e) {
3427
3435
  if (Array.isArray(t)) {
3428
3436
  const i = t.map(({ id: r }) => r).sort().join(","), a = e.map(({ id: r }) => r).sort().join(",");
3429
3437
  return i < a ? `${i}-${a}` : `${a}-${i}`;
@@ -3431,7 +3439,7 @@ function Yt(t, e) {
3431
3439
  const n = t.id.toString(), s = e.id.toString();
3432
3440
  return n < s ? `${n}-${s}` : `${s}-${n}`;
3433
3441
  }
3434
- function ct(t, e) {
3442
+ function ht(t, e) {
3435
3443
  if (Array.isArray(t)) {
3436
3444
  const i = t.map(({ id: r }) => r).sort(), a = e.map(({ id: r }) => r).sort();
3437
3445
  return g.zip(i, a).every(([r, c]) => r === c);
@@ -3439,37 +3447,29 @@ function ct(t, e) {
3439
3447
  const n = t.id, s = e.id;
3440
3448
  return n === s;
3441
3449
  }
3442
- function se(t) {
3450
+ function ae(t) {
3443
3451
  const e = t.split(`
3444
3452
  `), n = e.slice(e.findIndex((a) => a.trimStart() !== "")), s = n.filter((a) => a.trimStart()), i = Math.min(...s.map((a) => a.length - a.trimStart().length));
3445
3453
  return n.map((a) => a.slice(i)).join(`
3446
3454
  `);
3447
3455
  }
3448
- function qt(t) {
3449
- var e, n;
3456
+ function Ht(t) {
3450
3457
  if (t) {
3451
- if (W(t))
3458
+ if (Y(t))
3452
3459
  return {
3453
3460
  value: V(t).unwrap(),
3454
3461
  type: "string"
3455
3462
  };
3456
- if (pe(t))
3463
+ if (Ae(t))
3457
3464
  return {
3458
3465
  type: "number",
3459
- value: Number.parseFloat(t.expression.literal.value)
3466
+ value: tt(t)
3460
3467
  };
3461
- if (fe(t))
3468
+ if (Ne(t))
3462
3469
  return {
3463
3470
  value: t.expression.variable.value.toLowerCase(),
3464
3471
  type: "boolean"
3465
3472
  };
3466
- if (t instanceof oe && Bt.includes((e = t.op) == null ? void 0 : e.value) && pe(t.expression)) {
3467
- const s = Number.parseFloat(t.expression.expression.literal.value);
3468
- return {
3469
- value: ((n = t.op) == null ? void 0 : n.value) === "-" ? 0 - s : s,
3470
- type: "number"
3471
- };
3472
- }
3473
3473
  if (t instanceof ue && t.value)
3474
3474
  return {
3475
3475
  value: t.value.value,
@@ -3478,27 +3478,27 @@ function qt(t) {
3478
3478
  throw new Error("Unreachable");
3479
3479
  }
3480
3480
  }
3481
- function Ht(t) {
3481
+ function zt(t) {
3482
3482
  let e = null;
3483
- t instanceof H && (e = t.argumentList.elementList.map((a) => pe(a) ? a.expression.literal.value : W(a) ? V(a).unwrap() : q(a).unwrap()).join(","), t = t.callee);
3483
+ t instanceof ee && (e = t.argumentList.elementList.map((a) => Ae(a) ? Ft(a) : Y(a) ? V(a).unwrap() : W(a).unwrap()).join(","), t = t.callee);
3484
3484
  let n = "";
3485
- for (; t instanceof he; )
3485
+ for (; t instanceof Ie; )
3486
3486
  n = `[${t.indexer.elementList.map((a) => a.name.expression.literal.value).join(",")}]${n}`, t = t.array;
3487
3487
  const { name: s, schemaName: i } = ge(t);
3488
- return i.length > 1 ? new K(
3488
+ return i.length > 1 ? new J(
3489
3489
  {
3490
3490
  schemaName: i.length === 0 ? null : i[0],
3491
3491
  type_name: `${s}${n}${e ? `(${e})` : ""}`,
3492
3492
  args: e
3493
3493
  },
3494
3494
  [new l(o.UNSUPPORTED, "Nested schema is not supported", t)]
3495
- ) : new K({
3495
+ ) : new J({
3496
3496
  schemaName: i.length === 0 ? null : i[0],
3497
3497
  type_name: `${s}${n}${e ? `(${e})` : ""}`,
3498
3498
  args: e
3499
3499
  });
3500
3500
  }
3501
- class zt {
3501
+ class Qt {
3502
3502
  constructor(e, n) {
3503
3503
  this.declarationNode = e, this.env = n, this.table = {
3504
3504
  name: void 0,
@@ -3551,15 +3551,15 @@ class zt {
3551
3551
  interpretSettingList(e) {
3552
3552
  var i, a, r;
3553
3553
  const n = F(e).getValue();
3554
- this.table.headerColor = (i = n[N.HeaderColor]) != null && i.length ? Oe((r = (a = n[N.HeaderColor]) == null ? void 0 : a.at(0)) == null ? void 0 : r.value) : void 0;
3555
- const [s] = n[N.Note] || [];
3554
+ this.table.headerColor = (i = n[E.HeaderColor]) != null && i.length ? Oe((r = (a = n[E.HeaderColor]) == null ? void 0 : a.at(0)) == null ? void 0 : r.value) : void 0;
3555
+ const [s] = n[E.Note] || [];
3556
3556
  return this.table.note = s && {
3557
- value: V(s == null ? void 0 : s.value).map(se).unwrap(),
3557
+ value: V(s == null ? void 0 : s.value).map(ae).unwrap(),
3558
3558
  token: _(s)
3559
3559
  }, [];
3560
3560
  }
3561
3561
  interpretBody(e) {
3562
- const [n, s] = g.partition(e.body, (i) => i instanceof w || i instanceof Le);
3562
+ const [n, s] = g.partition(e.body, (i) => i instanceof w || i instanceof be);
3563
3563
  return [
3564
3564
  ...this.interpretFields(n),
3565
3565
  ...this.interpretSubElements(s)
@@ -3572,8 +3572,8 @@ class zt {
3572
3572
  case I.Note:
3573
3573
  return this.table.note = {
3574
3574
  value: V(
3575
- n.body instanceof ae ? n.body.body[0].callee : n.body.callee
3576
- ).map(se).unwrap(),
3575
+ n.body instanceof oe ? n.body.body[0].callee : n.body.callee
3576
+ ).map(ae).unwrap(),
3577
3577
  token: _(n)
3578
3578
  }, [];
3579
3579
  case I.Indexes:
@@ -3588,98 +3588,106 @@ class zt {
3588
3588
  return s.name = e.partial.variable.value, this.table.partials.push(s), [];
3589
3589
  }
3590
3590
  interpretFields(e) {
3591
- return e.flatMap((n, s) => n instanceof w ? this.interpretColumn(n) : this.interpretInjection(n, s));
3591
+ var r;
3592
+ const i = ((r = this.declarationNode.symbol) != null && r.symbolTable ? [...this.declarationNode.symbol.symbolTable.entries()] : []).filter(([c]) => {
3593
+ const f = ie(c).unwrap_or(null);
3594
+ return (f == null ? void 0 : f.kind) === m.Column;
3595
+ }).length ? [] : [new l(o.EMPTY_TABLE, "A Table must have at least one column", this.declarationNode)], a = e.flatMap((c, f) => c instanceof w ? this.interpretColumn(c) : this.interpretInjection(c, f));
3596
+ return [
3597
+ ...i,
3598
+ ...a
3599
+ ];
3592
3600
  }
3593
3601
  interpretColumn(e) {
3594
- var r, c, p, f, d, u, E, L, v;
3602
+ var r, c, f, p, h, d, N, L, v;
3595
3603
  const n = [], s = {};
3596
3604
  s.name = X(e.callee).unwrap();
3597
- const i = Ht(e.args[0]);
3605
+ const i = zt(e.args[0]);
3598
3606
  s.type = i.getValue(), n.push(...i.getErrors()), s.token = _(e), s.inline_refs = [];
3599
3607
  const a = e.args.slice(1);
3600
3608
  if (g.last(a) instanceof M) {
3601
3609
  const A = F(a.pop()).getValue();
3602
- s.pk = !!((r = A[N.PK]) != null && r.length) || !!((c = A[N.PKey]) != null && c.length), s.increment = !!((p = A[N.Increment]) != null && p.length), s.unique = !!((f = A[N.Unique]) != null && f.length), s.not_null = (d = A[N.NotNull]) != null && d.length ? !0 : (u = A[N.Null]) != null && u.length ? !1 : void 0, s.dbdefault = qt((L = (E = A[N.Default]) == null ? void 0 : E.at(0)) == null ? void 0 : L.value);
3603
- const P = (v = A[N.Note]) == null ? void 0 : v.at(0);
3610
+ s.pk = !!((r = A[E.PK]) != null && r.length) || !!((c = A[E.PKey]) != null && c.length), s.increment = !!((f = A[E.Increment]) != null && f.length), s.unique = !!((p = A[E.Unique]) != null && p.length), s.not_null = (h = A[E.NotNull]) != null && h.length ? !0 : (d = A[E.Null]) != null && d.length ? !1 : void 0, s.dbdefault = Ht((L = (N = A[E.Default]) == null ? void 0 : N.at(0)) == null ? void 0 : L.value);
3611
+ const P = (v = A[E.Note]) == null ? void 0 : v.at(0);
3604
3612
  s.note = P && {
3605
- value: V(P.value).map(se).unwrap(),
3613
+ value: V(P.value).map(ae).unwrap(),
3606
3614
  token: _(P)
3607
3615
  };
3608
- const be = A[N.Ref] || [];
3609
- s.inline_refs = be.flatMap((D) => {
3610
- const [Ue] = $e(D.value.expression);
3611
- if (ct(Ue, e.symbol))
3616
+ const Te = A[E.Ref] || [];
3617
+ s.inline_refs = Te.flatMap((D) => {
3618
+ const [Ue] = je(D.value.expression);
3619
+ if (ht(Ue, e.symbol))
3612
3620
  return n.push(new l(o.SAME_ENDPOINT, "Two endpoints are the same", D)), [];
3613
- const Ne = D.value.op, B = Y(D.value.expression).unwrap();
3614
- let ee;
3621
+ const pe = D.value.op, B = q(D.value.expression).unwrap();
3622
+ let te;
3615
3623
  if (B.length === 1) {
3616
- const [z] = B;
3617
- ee = {
3624
+ const [H] = B;
3625
+ te = {
3618
3626
  schemaName: this.table.schemaName,
3619
3627
  tableName: this.table.name,
3620
- fieldNames: [z],
3621
- relation: Ne.value,
3628
+ fieldNames: [H],
3629
+ relation: pe.value,
3622
3630
  token: _(D)
3623
3631
  };
3624
3632
  } else if (B.length === 2) {
3625
- const [z, me] = B;
3626
- ee = {
3633
+ const [H, Ee] = B;
3634
+ te = {
3627
3635
  schemaName: null,
3628
- tableName: z,
3629
- fieldNames: [me],
3630
- relation: Ne.value,
3636
+ tableName: H,
3637
+ fieldNames: [Ee],
3638
+ relation: pe.value,
3631
3639
  token: _(D)
3632
3640
  };
3633
3641
  } else if (B.length === 3) {
3634
- const [z, me, ft] = B;
3635
- ee = {
3636
- schemaName: z,
3637
- tableName: me,
3638
- fieldNames: [ft],
3639
- relation: Ne.value,
3642
+ const [H, Ee, dt] = B;
3643
+ te = {
3644
+ schemaName: H,
3645
+ tableName: Ee,
3646
+ fieldNames: [dt],
3647
+ relation: pe.value,
3640
3648
  token: _(D)
3641
3649
  };
3642
3650
  } else {
3643
3651
  n.push(new l(o.UNSUPPORTED, "Nested schema is not supported", D));
3644
- const z = B.pop(), me = B.pop();
3645
- ee = {
3652
+ const H = B.pop(), Ee = B.pop();
3653
+ te = {
3646
3654
  schemaName: B.join("."),
3647
- tableName: me,
3648
- fieldNames: [z],
3649
- relation: Ne.value,
3655
+ tableName: Ee,
3656
+ fieldNames: [H],
3657
+ relation: pe.value,
3650
3658
  token: _(D)
3651
3659
  };
3652
3660
  }
3653
- const Te = this.registerInlineRefToEnv(e, Ue, ee, D);
3654
- return n.push(...Te), Te.length === 0 ? ee : [];
3661
+ const de = this.registerInlineRefToEnv(e, Ue, te, D);
3662
+ return n.push(...de), de.length === 0 ? te : [];
3655
3663
  });
3656
3664
  }
3657
- return s.pk || (s.pk = a.some((A) => q(A).unwrap().toLowerCase() === "pk")), s.unique || (s.unique = a.some((A) => q(A).unwrap().toLowerCase() === "unique")), this.table.fields.push(s), s.pk && this.pkColumns.push(s), n;
3665
+ return s.pk || (s.pk = a.some((A) => W(A).unwrap().toLowerCase() === "pk")), s.unique || (s.unique = a.some((A) => W(A).unwrap().toLowerCase() === "unique")), this.table.fields.push(s), s.pk && this.pkColumns.push(s), n;
3658
3666
  }
3659
3667
  interpretIndexes(e) {
3660
3668
  return this.table.indexes.push(...e.body.body.map((n) => {
3661
- var r, c, p, f, d, u, E;
3669
+ var r, c, f, p, h, d, N;
3662
3670
  const s = { columns: [] }, i = n;
3663
3671
  s.token = _(i);
3664
3672
  const a = [i.callee, ...i.args];
3665
3673
  if (g.last(a) instanceof M) {
3666
3674
  const L = F(a.pop()).getValue();
3667
- s.pk = !!((r = L[N.PK]) != null && r.length), s.unique = !!((c = L[N.Unique]) != null && c.length), s.name = V((f = (p = L[N.Name]) == null ? void 0 : p.at(0)) == null ? void 0 : f.value).unwrap_or(void 0);
3668
- const v = (d = L[N.Note]) == null ? void 0 : d.at(0);
3675
+ s.pk = !!((r = L[E.PK]) != null && r.length), s.unique = !!((c = L[E.Unique]) != null && c.length), s.name = V((p = (f = L[E.Name]) == null ? void 0 : f.at(0)) == null ? void 0 : p.value).unwrap_or(void 0);
3676
+ const v = (h = L[E.Note]) == null ? void 0 : h.at(0);
3669
3677
  s.note = v && {
3670
3678
  value: V(v.value).unwrap(),
3671
3679
  token: _(v)
3672
- }, s.type = q((E = (u = L[N.Type]) == null ? void 0 : u.at(0)) == null ? void 0 : E.value).unwrap_or(void 0);
3680
+ }, s.type = W((N = (d = L[E.Type]) == null ? void 0 : d.at(0)) == null ? void 0 : N.value).unwrap_or(void 0);
3673
3681
  }
3674
3682
  return a.flatMap((L) => {
3675
- if (!(L instanceof H))
3683
+ if (!(L instanceof ee))
3676
3684
  return L;
3677
3685
  const v = [];
3678
- for (; L instanceof H; )
3686
+ for (; L instanceof ee; )
3679
3687
  v.push(L.argumentList), L = L.callee;
3680
3688
  return v.push(L), v;
3681
3689
  }).forEach((L) => {
3682
- const { functional: v, nonFunctional: A } = Xe(L).unwrap();
3690
+ const { functional: v, nonFunctional: A } = $e(L).unwrap();
3683
3691
  s.columns.push(
3684
3692
  ...v.map((P) => ({
3685
3693
  value: P.value.value,
@@ -3696,13 +3704,13 @@ class zt {
3696
3704
  })), [];
3697
3705
  }
3698
3706
  registerInlineRefToEnv(e, n, s, i) {
3699
- const a = Yt(e.symbol, n);
3707
+ const a = qt(e.symbol, n);
3700
3708
  if (this.env.refIds[a])
3701
3709
  return [
3702
3710
  new l(o.CIRCULAR_REF, "References with same endpoints exist", i),
3703
3711
  new l(o.CIRCULAR_REF, "References with same endpoints exist", this.env.refIds[a])
3704
3712
  ];
3705
- const r = Wt(s.relation);
3713
+ const r = Yt(s.relation);
3706
3714
  return this.env.refIds[a] = i, this.env.ref.set(i, {
3707
3715
  name: null,
3708
3716
  schemaName: null,
@@ -3715,7 +3723,7 @@ class zt {
3715
3723
  {
3716
3724
  schemaName: this.table.schemaName,
3717
3725
  tableName: this.table.name,
3718
- fieldNames: [q(e.callee).unwrap()],
3726
+ fieldNames: [W(e.callee).unwrap()],
3719
3727
  token: _(e),
3720
3728
  relation: r[0]
3721
3729
  }
@@ -3723,7 +3731,7 @@ class zt {
3723
3731
  }), [];
3724
3732
  }
3725
3733
  }
3726
- class Es {
3734
+ class Ns {
3727
3735
  constructor(e, n) {
3728
3736
  this.declarationNode = e, this.env = n, this.note = { name: void 0, content: void 0, token: void 0 };
3729
3737
  }
@@ -3751,10 +3759,10 @@ class Es {
3751
3759
  }
3752
3760
  interpretNote(e) {
3753
3761
  const n = g.get(e, "callee.expression.literal.value", "");
3754
- return this.note.content = se(n), [];
3762
+ return this.note.content = ae(n), [];
3755
3763
  }
3756
3764
  }
3757
- class Qt {
3765
+ class Jt {
3758
3766
  constructor(e, n) {
3759
3767
  this.declarationNode = e, this.env = n, this.container = this.declarationNode.parent instanceof y ? this.env.tables.get(this.declarationNode.parent) : void 0, this.ref = {};
3760
3768
  }
@@ -3765,45 +3773,45 @@ class Qt {
3765
3773
  ];
3766
3774
  }
3767
3775
  interpretName(e) {
3768
- const n = [], s = Y(this.declarationNode.name).unwrap_or([]);
3776
+ const n = [], s = q(this.declarationNode.name).unwrap_or([]);
3769
3777
  return this.ref.name = s.pop() || null, s.length > 1 && n.push(new l(o.UNSUPPORTED, "Nested schema is not supported", this.declarationNode.name)), this.ref.schemaName = s.join(".") || null, n;
3770
3778
  }
3771
3779
  interpretBody(e) {
3772
3780
  return e instanceof w ? this.interpretField(e) : this.interpretField(e.body[0]);
3773
3781
  }
3774
3782
  interpretField(e) {
3775
- var f, d, u, E, L, v, A;
3776
- const n = e.callee.op.value, { leftExpression: s, rightExpression: i } = e.callee, a = $e(s), r = $e(i);
3777
- if (ct(a, r))
3783
+ var p, h, d, N, L, v, A;
3784
+ const n = e.callee.op.value, { leftExpression: s, rightExpression: i } = e.callee, a = je(s), r = je(i);
3785
+ if (ht(a, r))
3778
3786
  return [new l(o.SAME_ENDPOINT, "Two endpoints are the same", e)];
3779
- const c = Yt(a, r);
3787
+ const c = qt(a, r);
3780
3788
  if (this.env.refIds[c])
3781
3789
  return [
3782
3790
  new l(o.CIRCULAR_REF, "References with same endpoints exist", this.declarationNode),
3783
3791
  new l(o.CIRCULAR_REF, "References with same endpoints exist", this.env.refIds[c])
3784
3792
  ];
3785
3793
  if (e.args[0]) {
3786
- const P = F(e.args[0]).getValue(), be = (d = (f = P.delete) == null ? void 0 : f.at(0)) == null ? void 0 : d.value;
3787
- this.ref.onDelete = be instanceof te ? we(be).unwrap_or(void 0) : q(be).unwrap_or(void 0);
3788
- const D = (E = (u = P.update) == null ? void 0 : u.at(0)) == null ? void 0 : E.value;
3789
- this.ref.onUpdate = D instanceof te ? we(D).unwrap_or(void 0) : q(D).unwrap_or(void 0), this.ref.color = (L = P.color) != null && L.length ? Oe((A = (v = P.color) == null ? void 0 : v.at(0)) == null ? void 0 : A.value) : void 0;
3794
+ const P = F(e.args[0]).getValue(), Te = (h = (p = P.delete) == null ? void 0 : p.at(0)) == null ? void 0 : h.value;
3795
+ this.ref.onDelete = Te instanceof ne ? we(Te).unwrap_or(void 0) : W(Te).unwrap_or(void 0);
3796
+ const D = (N = (d = P.update) == null ? void 0 : d.at(0)) == null ? void 0 : N.value;
3797
+ this.ref.onUpdate = D instanceof ne ? we(D).unwrap_or(void 0) : W(D).unwrap_or(void 0), this.ref.color = (L = P.color) != null && L.length ? Oe((A = (v = P.color) == null ? void 0 : v.at(0)) == null ? void 0 : A.value) : void 0;
3790
3798
  }
3791
- const p = Wt(n);
3799
+ const f = Yt(n);
3792
3800
  return this.ref.endpoints = [
3793
3801
  {
3794
3802
  ..._t(s, this.container),
3795
- relation: p[0],
3803
+ relation: f[0],
3796
3804
  token: _(s)
3797
3805
  },
3798
3806
  {
3799
3807
  ..._t(i, this.container),
3800
- relation: p[1],
3808
+ relation: f[1],
3801
3809
  token: _(i)
3802
3810
  }
3803
3811
  ], this.env.refIds[c] = this.declarationNode, [];
3804
3812
  }
3805
3813
  }
3806
- class Jt {
3814
+ class Kt {
3807
3815
  constructor(e, n) {
3808
3816
  this.declarationNode = e, this.env = n, this.tableGroup = { tables: [] };
3809
3817
  }
@@ -3833,8 +3841,8 @@ class Jt {
3833
3841
  case "note":
3834
3842
  this.tableGroup.note = {
3835
3843
  value: V(
3836
- n.body instanceof ae ? n.body.body[0].callee : n.body.callee
3837
- ).map(se).unwrap(),
3844
+ n.body instanceof oe ? n.body.body[0].callee : n.body.callee
3845
+ ).map(ae).unwrap(),
3838
3846
  token: _(n)
3839
3847
  };
3840
3848
  break;
@@ -3845,12 +3853,12 @@ class Jt {
3845
3853
  interpretFields(e) {
3846
3854
  const n = [];
3847
3855
  return this.tableGroup.tables = e.map((s) => {
3848
- const i = Y(s.callee).unwrap();
3856
+ const i = q(s.callee).unwrap();
3849
3857
  i.length > 2 && n.push(new l(o.UNSUPPORTED, "Nested schema is not supported", s));
3850
3858
  const a = _e(s.callee).unwrap().pop().referee.id;
3851
3859
  if (this.env.groupOfTable[a]) {
3852
- const r = this.env.groupOfTable[a], { schemaName: c, name: p } = this.env.tableGroups.get(r), f = c ? `${c}.${p}` : p;
3853
- n.push(new l(o.TABLE_REAPPEAR_IN_TABLEGROUP, `Table "${i.join(".")}" already appears in group "${f}"`, s));
3860
+ const r = this.env.groupOfTable[a], { schemaName: c, name: f } = this.env.tableGroups.get(r), p = c ? `${c}.${f}` : f;
3861
+ n.push(new l(o.TABLE_REAPPEAR_IN_TABLEGROUP, `Table "${i.join(".")}" already appears in group "${p}"`, s));
3854
3862
  } else
3855
3863
  this.env.groupOfTable[a] = this.declarationNode;
3856
3864
  return {
@@ -3865,12 +3873,12 @@ class Jt {
3865
3873
  this.tableGroup.color = (i = n.color) != null && i.length ? Oe((r = (a = n.color) == null ? void 0 : a.at(0)) == null ? void 0 : r.value) : void 0;
3866
3874
  const [s] = n.note || [];
3867
3875
  return this.tableGroup.note = s && {
3868
- value: V(s == null ? void 0 : s.value).map(se).unwrap(),
3876
+ value: V(s == null ? void 0 : s.value).map(ae).unwrap(),
3869
3877
  token: _(s)
3870
3878
  }, [];
3871
3879
  }
3872
3880
  }
3873
- class Kt {
3881
+ class Zt {
3874
3882
  constructor(e, n) {
3875
3883
  this.declarationNode = e, this.env = n, this.enum = { values: [] };
3876
3884
  }
@@ -3885,16 +3893,16 @@ class Kt {
3885
3893
  return e.body.flatMap((n) => {
3886
3894
  var c;
3887
3895
  const s = n, i = {};
3888
- i.token = _(s), i.name = q(s.callee).unwrap();
3896
+ i.token = _(s), i.name = W(s.callee).unwrap();
3889
3897
  const r = (c = F(s.args[0]).getValue().note) == null ? void 0 : c.at(0);
3890
3898
  return i.note = r && {
3891
- value: V(r.value).map(se).unwrap(),
3899
+ value: V(r.value).map(ae).unwrap(),
3892
3900
  token: _(r)
3893
3901
  }, this.enum.values.push(i), [];
3894
3902
  });
3895
3903
  }
3896
3904
  }
3897
- class Zt {
3905
+ class en {
3898
3906
  constructor(e, n) {
3899
3907
  this.declarationNode = e, this.env = n, this.tablePartial = {
3900
3908
  name: void 0,
@@ -3928,11 +3936,11 @@ class Zt {
3928
3936
  return this.tablePartial.name = n, [];
3929
3937
  }
3930
3938
  interpretSettingList(e) {
3931
- const n = F(e).getValue(), s = on(n[N.HeaderColor]);
3939
+ const n = F(e).getValue(), s = ln(n[E.HeaderColor]);
3932
3940
  this.tablePartial.headerColor = s ? Oe(s.value) : void 0;
3933
- const [i] = n[N.Note] || [];
3941
+ const [i] = n[E.Note] || [];
3934
3942
  return this.tablePartial.note = i && {
3935
- value: V(i == null ? void 0 : i.value).map(se).unwrap(),
3943
+ value: V(i == null ? void 0 : i.value).map(ae).unwrap(),
3936
3944
  token: _(i)
3937
3945
  }, [];
3938
3946
  }
@@ -3950,8 +3958,8 @@ class Zt {
3950
3958
  case I.Note:
3951
3959
  return this.tablePartial.note = {
3952
3960
  value: V(
3953
- n.body instanceof ae ? n.body.body[0].callee : n.body.callee
3954
- ).map(se).unwrap(),
3961
+ n.body instanceof oe ? n.body.body[0].callee : n.body.callee
3962
+ ).map(ae).unwrap(),
3955
3963
  token: _(n)
3956
3964
  }, [];
3957
3965
  case I.Indexes:
@@ -3965,86 +3973,86 @@ class Zt {
3965
3973
  return e.flatMap((n) => this.interpretColumn(n));
3966
3974
  }
3967
3975
  interpretColumn(e) {
3968
- var r, c, p, f, d, u, E, L, v;
3976
+ var r, c, f, p, h, d, N, L, v;
3969
3977
  const n = [], s = {};
3970
3978
  s.name = X(e.callee).unwrap();
3971
- const i = Ht(e.args[0]);
3979
+ const i = zt(e.args[0]);
3972
3980
  s.type = i.getValue(), n.push(...i.getErrors()), s.token = _(e), s.inline_refs = [];
3973
3981
  const a = e.args.slice(1);
3974
3982
  if (g.last(a) instanceof M) {
3975
3983
  const A = F(a.pop()).getValue();
3976
- s.pk = !!((r = A[N.PK]) != null && r.length) || !!((c = A[N.PKey]) != null && c.length), s.increment = !!((p = A[N.Increment]) != null && p.length), s.unique = !!((f = A[N.Unique]) != null && f.length), s.not_null = (d = A[N.NotNull]) != null && d.length ? !0 : (u = A[N.Null]) != null && u.length ? !1 : void 0, s.dbdefault = qt((L = (E = A[N.Default]) == null ? void 0 : E.at(0)) == null ? void 0 : L.value);
3977
- const P = (v = A[N.Note]) == null ? void 0 : v.at(0);
3984
+ s.pk = !!((r = A[E.PK]) != null && r.length) || !!((c = A[E.PKey]) != null && c.length), s.increment = !!((f = A[E.Increment]) != null && f.length), s.unique = !!((p = A[E.Unique]) != null && p.length), s.not_null = (h = A[E.NotNull]) != null && h.length ? !0 : (d = A[E.Null]) != null && d.length ? !1 : void 0, s.dbdefault = Ht((L = (N = A[E.Default]) == null ? void 0 : N.at(0)) == null ? void 0 : L.value);
3985
+ const P = (v = A[E.Note]) == null ? void 0 : v.at(0);
3978
3986
  s.note = P && {
3979
- value: V(P.value).map(se).unwrap(),
3987
+ value: V(P.value).map(ae).unwrap(),
3980
3988
  token: _(P)
3981
3989
  };
3982
- const be = A[N.Ref] || [];
3983
- s.inline_refs = be.flatMap((D) => {
3984
- const [Ue] = $e(D.value.expression);
3985
- if (ct(Ue, e.symbol))
3990
+ const Te = A[E.Ref] || [];
3991
+ s.inline_refs = Te.flatMap((D) => {
3992
+ const [Ue] = je(D.value.expression);
3993
+ if (ht(Ue, e.symbol))
3986
3994
  return n.push(new l(o.SAME_ENDPOINT, "Two endpoints are the same", D)), [];
3987
- const Ne = D.value.op, B = Y(D.value.expression).unwrap();
3988
- let ee;
3995
+ const pe = D.value.op, B = q(D.value.expression).unwrap();
3996
+ let te;
3989
3997
  if (B.length === 2) {
3990
- const [Te, z] = B;
3991
- ee = {
3998
+ const [de, H] = B;
3999
+ te = {
3992
4000
  schemaName: null,
3993
- tableName: Te,
3994
- fieldNames: [z],
3995
- relation: Ne.value,
4001
+ tableName: de,
4002
+ fieldNames: [H],
4003
+ relation: pe.value,
3996
4004
  token: _(D)
3997
4005
  };
3998
4006
  } else if (B.length === 3) {
3999
- const [Te, z, me] = B;
4000
- ee = {
4001
- schemaName: Te,
4002
- tableName: z,
4003
- fieldNames: [me],
4004
- relation: Ne.value,
4007
+ const [de, H, Ee] = B;
4008
+ te = {
4009
+ schemaName: de,
4010
+ tableName: H,
4011
+ fieldNames: [Ee],
4012
+ relation: pe.value,
4005
4013
  token: _(D)
4006
4014
  };
4007
4015
  } else {
4008
4016
  n.push(new l(o.UNSUPPORTED, "Unsupported", D));
4009
- const Te = B.pop(), z = B.pop();
4010
- ee = {
4017
+ const de = B.pop(), H = B.pop();
4018
+ te = {
4011
4019
  schemaName: B.join("."),
4012
- tableName: z,
4013
- fieldNames: [Te],
4014
- relation: Ne.value,
4020
+ tableName: H,
4021
+ fieldNames: [de],
4022
+ relation: pe.value,
4015
4023
  token: _(D)
4016
4024
  };
4017
4025
  }
4018
- return ee;
4026
+ return te;
4019
4027
  });
4020
4028
  }
4021
- return s.pk || (s.pk = a.some((A) => q(A).unwrap().toLowerCase() === "pk")), s.unique || (s.unique = a.some((A) => q(A).unwrap().toLowerCase() === "unique")), this.tablePartial.fields.push(s), s.pk && this.pkColumns.push(s), n;
4029
+ return s.pk || (s.pk = a.some((A) => W(A).unwrap().toLowerCase() === "pk")), s.unique || (s.unique = a.some((A) => W(A).unwrap().toLowerCase() === "unique")), this.tablePartial.fields.push(s), s.pk && this.pkColumns.push(s), n;
4022
4030
  }
4023
4031
  interpretIndexes(e) {
4024
4032
  return this.tablePartial.indexes.push(...e.body.body.map((n) => {
4025
- var r, c, p, f, d, u, E;
4033
+ var r, c, f, p, h, d, N;
4026
4034
  const s = { columns: [] }, i = n;
4027
4035
  s.token = _(i);
4028
4036
  const a = [i.callee, ...i.args];
4029
4037
  if (g.last(a) instanceof M) {
4030
4038
  const L = F(a.pop()).getValue();
4031
- s.pk = !!((r = L[N.PK]) != null && r.length), s.unique = !!((c = L[N.Unique]) != null && c.length), s.name = V((f = (p = L[N.Name]) == null ? void 0 : p.at(0)) == null ? void 0 : f.value).unwrap_or(void 0);
4032
- const v = (d = L[N.Note]) == null ? void 0 : d.at(0);
4039
+ s.pk = !!((r = L[E.PK]) != null && r.length), s.unique = !!((c = L[E.Unique]) != null && c.length), s.name = V((p = (f = L[E.Name]) == null ? void 0 : f.at(0)) == null ? void 0 : p.value).unwrap_or(void 0);
4040
+ const v = (h = L[E.Note]) == null ? void 0 : h.at(0);
4033
4041
  s.note = v && {
4034
4042
  value: V(v.value).unwrap(),
4035
4043
  token: _(v)
4036
- }, s.type = q((E = (u = L[N.Type]) == null ? void 0 : u.at(0)) == null ? void 0 : E.value).unwrap_or(void 0);
4044
+ }, s.type = W((N = (d = L[E.Type]) == null ? void 0 : d.at(0)) == null ? void 0 : N.value).unwrap_or(void 0);
4037
4045
  }
4038
4046
  return a.flatMap((L) => {
4039
- if (!(L instanceof H))
4047
+ if (!(L instanceof ee))
4040
4048
  return L;
4041
4049
  const v = [];
4042
4050
  let A = L;
4043
- for (; A instanceof H; )
4051
+ for (; A instanceof ee; )
4044
4052
  v.push(A.argumentList), A = A.callee;
4045
4053
  return v.push(A), v;
4046
4054
  }).forEach((L) => {
4047
- const { functional: v, nonFunctional: A } = Xe(L).unwrap();
4055
+ const { functional: v, nonFunctional: A } = $e(L).unwrap();
4048
4056
  s.columns.push(
4049
4057
  ...v.map((P) => ({
4050
4058
  value: P.value.value,
@@ -4061,7 +4069,7 @@ class Zt {
4061
4069
  })), [];
4062
4070
  }
4063
4071
  }
4064
- class Ns {
4072
+ class Ts {
4065
4073
  constructor(e, n) {
4066
4074
  this.declarationNode = e, this.env = n, this.project = { enums: [], refs: [], tableGroups: [], tables: [], tablePartials: [] };
4067
4075
  }
@@ -4080,28 +4088,28 @@ class Ns {
4080
4088
  const s = n;
4081
4089
  switch ((i = s.type) == null ? void 0 : i.value.toLowerCase()) {
4082
4090
  case "table": {
4083
- const a = new zt(s, this.env).interpret();
4091
+ const a = new Qt(s, this.env).interpret();
4084
4092
  return this.project.tables.push(this.env.tables.get(s)), a;
4085
4093
  }
4086
4094
  case "ref": {
4087
- const a = new Qt(s, this.env).interpret();
4095
+ const a = new Jt(s, this.env).interpret();
4088
4096
  return this.project.refs.push(this.env.ref.get(s)), a;
4089
4097
  }
4090
4098
  case "tablegroup": {
4091
- const a = new Jt(s, this.env).interpret();
4099
+ const a = new Kt(s, this.env).interpret();
4092
4100
  return this.project.tableGroups.push(this.env.tableGroups.get(s)), a;
4093
4101
  }
4094
4102
  case "enum": {
4095
- const a = new Kt(s, this.env).interpret();
4103
+ const a = new Zt(s, this.env).interpret();
4096
4104
  return this.project.enums.push(this.env.enums.get(s)), a;
4097
4105
  }
4098
4106
  case "note":
4099
4107
  return this.project.note = {
4100
- value: V(s.body instanceof ae ? s.body.body[0].callee : s.body.callee).map(se).unwrap(),
4108
+ value: V(s.body instanceof oe ? s.body.body[0].callee : s.body.callee).map(ae).unwrap(),
4101
4109
  token: _(s)
4102
4110
  }, [];
4103
4111
  case "tablepartial": {
4104
- const a = new Zt(s, this.env).interpret();
4112
+ const a = new en(s, this.env).interpret();
4105
4113
  return this.project.tablePartials.push(this.env.tablePartials.get(s)), a;
4106
4114
  }
4107
4115
  default:
@@ -4110,7 +4118,7 @@ class Ns {
4110
4118
  });
4111
4119
  }
4112
4120
  }
4113
- function Ts(t) {
4121
+ function ms(t) {
4114
4122
  return {
4115
4123
  schemas: [],
4116
4124
  tables: Array.from(t.tables.values()),
@@ -4123,7 +4131,7 @@ function Ts(t) {
4123
4131
  tablePartials: Array.from(t.tablePartials.values())
4124
4132
  };
4125
4133
  }
4126
- class ms {
4134
+ class bs {
4127
4135
  constructor(e) {
4128
4136
  this.ast = e, this.env = {
4129
4137
  schema: [],
@@ -4141,26 +4149,26 @@ class ms {
4141
4149
  }
4142
4150
  interpret() {
4143
4151
  const e = this.ast.body.flatMap((n) => {
4144
- switch (Ae(n).unwrap_or(void 0)) {
4152
+ switch (Le(n).unwrap_or(void 0)) {
4145
4153
  case I.Table:
4146
- return new zt(n, this.env).interpret();
4154
+ return new Qt(n, this.env).interpret();
4147
4155
  case I.Note:
4148
- return new Es(n, this.env).interpret();
4156
+ return new Ns(n, this.env).interpret();
4149
4157
  case I.Ref:
4150
- return new Qt(n, this.env).interpret();
4151
- case I.TableGroup:
4152
4158
  return new Jt(n, this.env).interpret();
4159
+ case I.TableGroup:
4160
+ return new Kt(n, this.env).interpret();
4153
4161
  case I.TablePartial:
4154
- return new Zt(n, this.env).interpret();
4162
+ return new en(n, this.env).interpret();
4155
4163
  case I.Enum:
4156
- return new Kt(n, this.env).interpret();
4164
+ return new Zt(n, this.env).interpret();
4157
4165
  case I.Project:
4158
- return new Ns(n, this.env).interpret();
4166
+ return new Ts(n, this.env).interpret();
4159
4167
  default:
4160
4168
  return [];
4161
4169
  }
4162
4170
  });
4163
- return new K(Ts(this.env), e);
4171
+ return new J(ms(this.env), e);
4164
4172
  }
4165
4173
  }
4166
4174
  var k = /* @__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))(k || {}), R = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.KeepWhitespace = 1] = "KeepWhitespace", t[t.InsertAsSnippet = 4] = "InsertAsSnippet", t))(R || {});
@@ -4184,13 +4192,13 @@ function xe(t) {
4184
4192
  return k.Text;
4185
4193
  }
4186
4194
  }
4187
- function je(t, e) {
4195
+ function We(t, e) {
4188
4196
  if (!t || et(t))
4189
4197
  return !1;
4190
4198
  for (const n of t.trailingTrivia) {
4191
4199
  if (n.start > e)
4192
4200
  break;
4193
- if (n.kind === h.NEWLINE && n.end <= e)
4201
+ if (n.kind === u.NEWLINE && n.end <= e)
4194
4202
  return !1;
4195
4203
  }
4196
4204
  return !0;
@@ -4200,7 +4208,7 @@ function G() {
4200
4208
  suggestions: []
4201
4209
  };
4202
4210
  }
4203
- function We(t) {
4211
+ function Ye(t) {
4204
4212
  return {
4205
4213
  ...t,
4206
4214
  suggestions: t.suggestions.map((e) => ({
@@ -4214,37 +4222,37 @@ function Ke(t) {
4214
4222
  ...t,
4215
4223
  suggestions: t.suggestions.map((e) => ({
4216
4224
  ...e,
4217
- insertText: e.insertText.split("").every(He) ? e.insertText : `"${e.insertText}"`
4225
+ insertText: e.insertText.split("").every(ze) ? e.insertText : `"${e.insertText}"`
4218
4226
  }))
4219
4227
  };
4220
4228
  }
4221
- function ut(t, e) {
4229
+ function ft(t, e) {
4222
4230
  return t.getOffsetAt(e);
4223
4231
  }
4224
- class en {
4232
+ class tn {
4225
4233
  constructor(e, n = []) {
4226
4234
  this.compiler = e, this.triggerCharacters = n;
4227
4235
  }
4228
4236
  provideCompletionItems(e, n) {
4229
- var d, u;
4230
- const s = ut(e, n), i = this.compiler.token.flatStream(), { token: a, index: r } = this.compiler.container.token(s), c = r === void 0 ? i[0] : i[r + 1];
4237
+ var h, d;
4238
+ const s = ft(e, n), i = this.compiler.token.flatStream(), { token: a, index: r } = this.compiler.container.token(s), c = r === void 0 ? i[0] : i[r + 1];
4231
4239
  if ([
4232
4240
  ...(a == null ? void 0 : a.trailingTrivia) || [],
4233
4241
  ...(a == null ? void 0 : a.leadingTrivia) || [],
4234
4242
  ...(c == null ? void 0 : c.leadingTrivia) || []
4235
- ].find((E) => un(E) && Se(s, E)))
4243
+ ].find((N) => fn(N) && Se(s, N)))
4236
4244
  return G();
4237
4245
  if (r === void 0)
4238
4246
  return kt();
4239
- if ([h.STRING_LITERAL, h.QUOTED_STRING].includes(a.kind) && Se(s, a))
4247
+ if ([u.STRING_LITERAL, u.QUOTED_STRING].includes(a.kind) && Se(s, a))
4240
4248
  return G();
4241
- const p = this.compiler.container.element(s);
4242
- if (this.compiler.container.scopeKind(s) === O.TOPLEVEL || p instanceof y && p.type && p.type.start <= s && p.type.end >= s)
4249
+ const f = this.compiler.container.element(s);
4250
+ if (this.compiler.container.scopeKind(s) === O.TOPLEVEL || f instanceof y && f.type && f.type.start <= s && f.type.end >= s)
4243
4251
  return kt();
4244
- const f = [...this.compiler.container.stack(s)].reverse();
4245
- for (const E of f)
4246
- if (E instanceof oe)
4247
- switch ((d = E.op) == null ? void 0 : d.value) {
4252
+ const p = [...this.compiler.container.stack(s)].reverse();
4253
+ for (const N of p)
4254
+ if (N instanceof Z)
4255
+ switch ((h = N.op) == null ? void 0 : h.value) {
4248
4256
  case ">":
4249
4257
  case "<":
4250
4258
  case "<>":
@@ -4252,11 +4260,11 @@ class en {
4252
4260
  return gt(
4253
4261
  this.compiler,
4254
4262
  s,
4255
- E
4263
+ N
4256
4264
  );
4257
4265
  }
4258
- else if (E instanceof le)
4259
- switch ((u = E.op) == null ? void 0 : u.value) {
4266
+ else if (N instanceof le)
4267
+ switch ((d = N.op) == null ? void 0 : d.value) {
4260
4268
  case ">":
4261
4269
  case "<":
4262
4270
  case "<>":
@@ -4264,33 +4272,33 @@ class en {
4264
4272
  return gt(
4265
4273
  this.compiler,
4266
4274
  s,
4267
- E
4275
+ N
4268
4276
  );
4269
4277
  case ".":
4270
- return tn(
4278
+ return nn(
4271
4279
  this.compiler,
4272
4280
  s,
4273
- E
4281
+ N
4274
4282
  );
4275
4283
  }
4276
4284
  else {
4277
- if (E instanceof ne)
4278
- return vt(this.compiler, s, E);
4279
- if (E instanceof M)
4280
- return vt(this.compiler, s, E);
4281
- if (E instanceof ce)
4285
+ if (N instanceof se)
4286
+ return vt(this.compiler, s, N);
4287
+ if (N instanceof M)
4288
+ return vt(this.compiler, s, N);
4289
+ if (N instanceof ce)
4290
+ return Ls(this.compiler, s);
4291
+ if (N instanceof be)
4282
4292
  return Is(this.compiler, s);
4283
- if (E instanceof Le)
4284
- return bs(this.compiler, s);
4285
- if (E instanceof w)
4286
- return yt(this.compiler, s, E);
4287
- if (E instanceof y && (E.bodyColon && s >= E.bodyColon.end || E.body && Se(s, E.body)))
4293
+ if (N instanceof w)
4294
+ return yt(this.compiler, s, N);
4295
+ if (N instanceof y && (N.bodyColon && s >= N.bodyColon.end || N.body && Se(s, N.body)))
4288
4296
  return yt(this.compiler, s, void 0);
4289
4297
  }
4290
4298
  return G();
4291
4299
  }
4292
4300
  }
4293
- function bs(t, e) {
4301
+ function Is(t, e) {
4294
4302
  const n = t.container.element(e);
4295
4303
  return Re(t, e, n, [m.TablePartial]);
4296
4304
  }
@@ -4306,7 +4314,7 @@ function gt(t, e, n) {
4306
4314
  m.Schema,
4307
4315
  m.Column
4308
4316
  ]);
4309
- return je(n.op, e) ? We(i) : i;
4317
+ return We(n.op, e) ? Ye(i) : i;
4310
4318
  }
4311
4319
  return G();
4312
4320
  }
@@ -4320,12 +4328,12 @@ function Re(t, e, n, s) {
4320
4328
  if ((r = i == null ? void 0 : i.symbol) != null && r.symbolTable) {
4321
4329
  const { symbol: c } = i;
4322
4330
  a.suggestions.push(
4323
- ...t.symbol.members(c).filter(({ kind: p }) => s.includes(p)).map(({ name: p, kind: f }) => ({
4324
- label: p,
4325
- insertText: p,
4331
+ ...t.symbol.members(c).filter(({ kind: f }) => s.includes(f)).map(({ name: f, kind: p }) => ({
4332
+ label: f,
4333
+ insertText: f,
4326
4334
  insertTextRules: R.KeepWhitespace,
4327
- kind: xe(f),
4328
- sortText: xe(f).toString().padStart(2, "0"),
4335
+ kind: xe(p),
4336
+ sortText: xe(p).toString().padStart(2, "0"),
4329
4337
  range: void 0
4330
4338
  }))
4331
4339
  );
@@ -4334,49 +4342,49 @@ function Re(t, e, n, s) {
4334
4342
  }
4335
4343
  return Ke(a);
4336
4344
  }
4337
- function Is(t, e) {
4345
+ function Ls(t, e) {
4338
4346
  var s;
4339
4347
  switch (t.container.scopeKind(e)) {
4340
4348
  case O.INDEXES:
4341
- return sn(t, e);
4349
+ return an(t, e);
4342
4350
  case O.REF:
4343
4351
  {
4344
4352
  const i = [...t.container.stack(e)];
4345
4353
  for (; i.length > 0; ) {
4346
4354
  const a = i.pop();
4347
4355
  if (a instanceof le && ((s = a.op) == null ? void 0 : s.value) === ".")
4348
- return tn(
4356
+ return nn(
4349
4357
  t,
4350
4358
  e,
4351
4359
  a
4352
4360
  );
4353
4361
  }
4354
4362
  }
4355
- return nn(t, e);
4363
+ return sn(t, e);
4356
4364
  }
4357
4365
  return G();
4358
4366
  }
4359
4367
  function vt(t, e, n) {
4360
4368
  const { token: s } = t.container.token(e);
4361
- if ([h.COMMA, h.LBRACKET].includes(s == null ? void 0 : s.kind)) {
4369
+ if ([u.COMMA, u.LBRACKET].includes(s == null ? void 0 : s.kind)) {
4362
4370
  const i = wt(t, e);
4363
- return (s == null ? void 0 : s.kind) === h.COMMA && je(s, e) ? We(i) : i;
4371
+ return (s == null ? void 0 : s.kind) === u.COMMA && We(s, e) ? Ye(i) : i;
4364
4372
  }
4365
4373
  if (n.name && n.name.start <= e && n.name.end >= e)
4366
4374
  return wt(t, e);
4367
- if (n.name instanceof te) {
4368
- const i = Ls(
4375
+ if (n.name instanceof ne) {
4376
+ const i = As(
4369
4377
  t,
4370
4378
  e,
4371
4379
  we(n.name).unwrap_or("")
4372
4380
  );
4373
- return (s == null ? void 0 : s.kind) === h.COLON && je(s, e) ? We(i) : i;
4381
+ return (s == null ? void 0 : s.kind) === u.COLON && We(s, e) ? Ye(i) : i;
4374
4382
  }
4375
4383
  return G();
4376
4384
  }
4377
4385
  function wt(t, e) {
4378
4386
  const n = t.container.element(e);
4379
- if (n instanceof Z)
4387
+ if (n instanceof K)
4380
4388
  return G();
4381
4389
  const s = t.container.scopeKind(e);
4382
4390
  if (n.body && !Se(e, n.body)) {
@@ -4384,10 +4392,10 @@ function wt(t, e) {
4384
4392
  switch (s) {
4385
4393
  case O.TABLE:
4386
4394
  case O.TABLEPARTIAL:
4387
- i = [N.HeaderColor, N.Note];
4395
+ i = [E.HeaderColor, E.Note];
4388
4396
  break;
4389
4397
  case O.TABLEGROUP:
4390
- i = [N.Color, N.Note];
4398
+ i = [E.Color, E.Note];
4391
4399
  break;
4392
4400
  default:
4393
4401
  i = [];
@@ -4408,12 +4416,12 @@ function wt(t, e) {
4408
4416
  return {
4409
4417
  suggestions: [
4410
4418
  ...[
4411
- N.PK,
4412
- N.PKey,
4413
- N.Null,
4414
- N.NotNull,
4415
- N.Increment,
4416
- N.Unique
4419
+ E.PK,
4420
+ E.PKey,
4421
+ E.Null,
4422
+ E.NotNull,
4423
+ E.Increment,
4424
+ E.Unique
4417
4425
  ].map((i) => ({
4418
4426
  label: i,
4419
4427
  insertText: i,
@@ -4421,7 +4429,7 @@ function wt(t, e) {
4421
4429
  insertTextRules: R.KeepWhitespace,
4422
4430
  range: void 0
4423
4431
  })),
4424
- ...[N.Ref, N.Default, N.Note].map((i) => ({
4432
+ ...[E.Ref, E.Default, E.Note].map((i) => ({
4425
4433
  label: i,
4426
4434
  insertText: `${i}: `,
4427
4435
  kind: k.Property,
@@ -4433,7 +4441,7 @@ function wt(t, e) {
4433
4441
  case O.ENUM:
4434
4442
  return {
4435
4443
  suggestions: [
4436
- ...[N.Note].map((i) => ({
4444
+ ...[E.Note].map((i) => ({
4437
4445
  label: i,
4438
4446
  insertText: `${i}: `,
4439
4447
  kind: k.Property,
@@ -4445,14 +4453,14 @@ function wt(t, e) {
4445
4453
  case O.INDEXES:
4446
4454
  return {
4447
4455
  suggestions: [
4448
- ...[N.Unique, N.PK].map((i) => ({
4456
+ ...[E.Unique, E.PK].map((i) => ({
4449
4457
  label: i,
4450
4458
  insertText: i,
4451
4459
  insertTextRules: R.KeepWhitespace,
4452
4460
  kind: k.Property,
4453
4461
  range: void 0
4454
4462
  })),
4455
- ...[N.Note, N.Name, N.Type].map((i) => ({
4463
+ ...[E.Note, E.Name, E.Type].map((i) => ({
4456
4464
  label: i,
4457
4465
  insertText: `${i}: `,
4458
4466
  kind: k.Property,
@@ -4463,7 +4471,7 @@ function wt(t, e) {
4463
4471
  };
4464
4472
  case O.REF:
4465
4473
  return {
4466
- suggestions: [N.Update, N.Delete].map((i) => ({
4474
+ suggestions: [E.Update, E.Delete].map((i) => ({
4467
4475
  label: i,
4468
4476
  insertText: `${i}: `,
4469
4477
  kind: k.Property,
@@ -4474,7 +4482,7 @@ function wt(t, e) {
4474
4482
  }
4475
4483
  return G();
4476
4484
  }
4477
- function Ls(t, e, n) {
4485
+ function As(t, e, n) {
4478
4486
  switch (n == null ? void 0 : n.toLowerCase()) {
4479
4487
  case "update":
4480
4488
  case "delete":
@@ -4500,11 +4508,11 @@ function Ls(t, e, n) {
4500
4508
  }
4501
4509
  return G();
4502
4510
  }
4503
- function tn(t, e, n) {
4511
+ function nn(t, e, n) {
4504
4512
  const s = _e(n).unwrap_or([]);
4505
- if (s.pop(), s.some((a) => !j(a)))
4513
+ if (s.pop(), s.some((a) => !$(a)))
4506
4514
  return G();
4507
- const i = s.map((a) => q(a).unwrap());
4515
+ const i = s.map((a) => W(a).unwrap());
4508
4516
  return Ke({
4509
4517
  suggestions: t.symbol.ofName({ nameStack: i, owner: t.container.element(e) }).flatMap(({ symbol: a }) => t.symbol.members(a)).map(({ kind: a, name: r }) => ({
4510
4518
  label: r,
@@ -4519,19 +4527,19 @@ function yt(t, e, n) {
4519
4527
  switch (t.container.scopeKind(e)) {
4520
4528
  case O.TABLE:
4521
4529
  case O.TABLEPARTIAL:
4522
- return _s(t, e, n);
4523
- case O.PROJECT:
4524
4530
  return gs(t, e, n);
4531
+ case O.PROJECT:
4532
+ return vs(t, e, n);
4525
4533
  case O.INDEXES:
4526
- return ws(t, e);
4534
+ return ys(t, e);
4527
4535
  case O.ENUM:
4528
- return As(t, e, n);
4536
+ return _s(t, e, n);
4529
4537
  case O.REF: {
4530
- const a = nn(t, e);
4531
- return ((i = t.container.token(e).token) == null ? void 0 : i.kind) === h.COLON && je(t.container.token(e).token, e) ? We(a) : a;
4538
+ const a = sn(t, e);
4539
+ return ((i = t.container.token(e).token) == null ? void 0 : i.kind) === u.COLON && We(t.container.token(e).token, e) ? Ye(a) : a;
4532
4540
  }
4533
4541
  case O.TABLEGROUP:
4534
- return vs(t);
4542
+ return ws(t);
4535
4543
  default:
4536
4544
  return G();
4537
4545
  }
@@ -4547,14 +4555,14 @@ function kt() {
4547
4555
  }))
4548
4556
  };
4549
4557
  }
4550
- function As(t, e, n) {
4551
- return n != null && n.callee && ht(e, n) === 1 ? Re(t, e, t.container.element(e), [
4558
+ function _s(t, e, n) {
4559
+ return n != null && n.callee && pt(e, n) === 1 ? Re(t, e, t.container.element(e), [
4552
4560
  m.Schema,
4553
4561
  m.Table,
4554
4562
  m.Column
4555
4563
  ]) : G();
4556
4564
  }
4557
- function _s(t, e, n) {
4565
+ function gs(t, e, n) {
4558
4566
  const s = ["Note", "indexes"];
4559
4567
  if (!(n != null && n.callee))
4560
4568
  return {
@@ -4566,7 +4574,7 @@ function _s(t, e, n) {
4566
4574
  range: void 0
4567
4575
  }))
4568
4576
  };
4569
- const i = ht(e, n);
4577
+ const i = pt(e, n);
4570
4578
  return i === 0 ? {
4571
4579
  suggestions: s.map((a) => ({
4572
4580
  label: a,
@@ -4575,11 +4583,11 @@ function _s(t, e, n) {
4575
4583
  kind: k.Keyword,
4576
4584
  range: void 0
4577
4585
  }))
4578
- } : i === 1 ? ys(t, e) : G();
4586
+ } : i === 1 ? ks(t, e) : G();
4579
4587
  }
4580
- function gs(t, e, n) {
4588
+ function vs(t, e, n) {
4581
4589
  const s = ["Table", "TableGroup", "Enum", "Note", "Ref", "TablePartial"];
4582
- return n != null && n.callee ? ht(e, n) === 0 ? {
4590
+ return n != null && n.callee ? pt(e, n) === 0 ? {
4583
4591
  suggestions: s.map((a) => ({
4584
4592
  label: a,
4585
4593
  insertText: a,
@@ -4597,19 +4605,19 @@ function gs(t, e, n) {
4597
4605
  }))
4598
4606
  };
4599
4607
  }
4600
- function nn(t, e) {
4608
+ function sn(t, e) {
4601
4609
  return Re(t, e, t.container.element(e), [
4602
4610
  m.Schema,
4603
4611
  m.Table,
4604
4612
  m.Column
4605
4613
  ]);
4606
4614
  }
4607
- function vs(t) {
4615
+ function ws(t) {
4608
4616
  return {
4609
4617
  suggestions: [
4610
4618
  ...Ke({
4611
4619
  suggestions: [...t.parse.publicSymbolTable().entries()].flatMap(([e]) => {
4612
- const n = re(e).unwrap_or(void 0);
4620
+ const n = ie(e).unwrap_or(void 0);
4613
4621
  if (n === void 0)
4614
4622
  return [];
4615
4623
  const { kind: s, name: i } = n;
@@ -4632,10 +4640,10 @@ function vs(t) {
4632
4640
  ]
4633
4641
  };
4634
4642
  }
4635
- function ws(t, e) {
4636
- return sn(t, e);
4637
- }
4638
4643
  function ys(t, e) {
4644
+ return an(t, e);
4645
+ }
4646
+ function ks(t, e) {
4639
4647
  return {
4640
4648
  suggestions: [
4641
4649
  ...[
@@ -4710,14 +4718,14 @@ function ys(t, e) {
4710
4718
  ]
4711
4719
  };
4712
4720
  }
4713
- function sn(t, e) {
4721
+ function an(t, e) {
4714
4722
  const n = t.container.element(e), s = n == null ? void 0 : n.parent;
4715
4723
  if (!((s == null ? void 0 : s.symbol) instanceof Mt))
4716
4724
  return G();
4717
4725
  const { symbolTable: i } = s.symbol;
4718
4726
  return Ke({
4719
4727
  suggestions: [...i.entries()].flatMap(([a]) => {
4720
- const r = re(a).unwrap_or(void 0);
4728
+ const r = ie(a).unwrap_or(void 0);
4721
4729
  if (r === void 0)
4722
4730
  return [];
4723
4731
  const { name: c } = r;
@@ -4731,37 +4739,37 @@ function sn(t, e) {
4731
4739
  })
4732
4740
  });
4733
4741
  }
4734
- function ht(t, e) {
4742
+ function pt(t, e) {
4735
4743
  if (!e.callee)
4736
4744
  return -1;
4737
4745
  const n = [e.callee, ...e.args], s = n.findIndex((i) => t <= i.end);
4738
4746
  return s === -1 ? n.length : s;
4739
4747
  }
4740
- class an {
4748
+ class rn {
4741
4749
  constructor(e) {
4742
4750
  this.compiler = e;
4743
4751
  }
4744
4752
  provideDefinition(e, n) {
4745
4753
  var r, c;
4746
- const { uri: s } = e, i = ut(e, n), a = [...this.compiler.container.stack(i)];
4754
+ const { uri: s } = e, i = ft(e, n), a = [...this.compiler.container.stack(i)];
4747
4755
  for (; a.length !== 0; ) {
4748
- const p = a.pop();
4749
- if (!(p != null && p.referee))
4756
+ const f = a.pop();
4757
+ if (!(f != null && f.referee))
4750
4758
  continue;
4751
- let f;
4752
- if ((r = p.referee) != null && r.declaration && [
4753
- Ie.PRIMARY_EXPRESSION,
4754
- Ie.VARIABLE,
4755
- Ie.PARTIAL_INJECTION
4756
- ].includes(p == null ? void 0 : p.kind) ? { declaration: f } = p.referee : (c = p.referee) != null && c.injectorDeclaration && (f = p.referee.injectorDeclaration), f) {
4757
- const { startPos: d, endPos: u } = f;
4759
+ let p;
4760
+ if ((r = f.referee) != null && r.declaration && [
4761
+ me.PRIMARY_EXPRESSION,
4762
+ me.VARIABLE,
4763
+ me.PARTIAL_INJECTION
4764
+ ].includes(f == null ? void 0 : f.kind) ? { declaration: p } = f.referee : (c = f.referee) != null && c.injectorDeclaration && (p = f.referee.injectorDeclaration), p) {
4765
+ const { startPos: h, endPos: d } = p;
4758
4766
  return [
4759
4767
  {
4760
4768
  range: {
4761
- startColumn: d.column + 1,
4762
- startLineNumber: d.line + 1,
4763
- endColumn: u.column + 1,
4764
- endLineNumber: u.line + 1
4769
+ startColumn: h.column + 1,
4770
+ startLineNumber: h.line + 1,
4771
+ endColumn: d.column + 1,
4772
+ endLineNumber: d.line + 1
4765
4773
  },
4766
4774
  uri: s
4767
4775
  }
@@ -4771,27 +4779,27 @@ class an {
4771
4779
  return [];
4772
4780
  }
4773
4781
  }
4774
- class rn {
4782
+ class on {
4775
4783
  constructor(e) {
4776
4784
  this.compiler = e;
4777
4785
  }
4778
4786
  provideReferences(e, n) {
4779
- const { uri: s } = e, i = ut(e, n), a = [...this.compiler.container.stack(i)];
4787
+ const { uri: s } = e, i = ft(e, n), a = [...this.compiler.container.stack(i)];
4780
4788
  for (; a.length !== 0; ) {
4781
4789
  const r = a.pop();
4782
4790
  if (r && [
4783
- Ie.ELEMENT_DECLARATION,
4784
- Ie.FUNCTION_APPLICATION,
4785
- Ie.PRIMARY_EXPRESSION
4791
+ me.ELEMENT_DECLARATION,
4792
+ me.FUNCTION_APPLICATION,
4793
+ me.PRIMARY_EXPRESSION
4786
4794
  ].includes(r == null ? void 0 : r.kind)) {
4787
4795
  const { symbol: c } = r;
4788
4796
  if (c != null && c.references.length)
4789
- return c.references.map(({ startPos: p, endPos: f }) => ({
4797
+ return c.references.map(({ startPos: f, endPos: p }) => ({
4790
4798
  range: {
4791
- startColumn: p.column + 1,
4792
- startLineNumber: p.line + 1,
4793
- endColumn: f.column + 1,
4794
- endLineNumber: f.line + 1
4799
+ startColumn: f.column + 1,
4800
+ startLineNumber: f.line + 1,
4801
+ endColumn: p.column + 1,
4802
+ endLineNumber: p.line + 1
4795
4803
  },
4796
4804
  uri: s
4797
4805
  }));
@@ -4800,24 +4808,24 @@ class rn {
4800
4808
  return [];
4801
4809
  }
4802
4810
  }
4803
- const Ss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4811
+ const Ds = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4804
4812
  __proto__: null,
4805
4813
  CompletionItemInsertTextRule: R,
4806
4814
  CompletionItemKind: k,
4807
- DBMLCompletionItemProvider: en,
4808
- DBMLDefinitionProvider: an,
4809
- DBMLReferencesProvider: rn
4815
+ DBMLCompletionItemProvider: tn,
4816
+ DBMLDefinitionProvider: rn,
4817
+ DBMLReferencesProvider: on
4810
4818
  }, Symbol.toStringTag, { value: "Module" }));
4811
4819
  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[t.TABLEPARTIAL = 9] = "TABLEPARTIAL", t))(O || {});
4812
- class Ds {
4820
+ class xs {
4813
4821
  constructor() {
4814
4822
  this.source = "", this.cache = new Array(
4815
4823
  16
4816
4824
  /* TOTAL_QUERY_COUNT */
4817
- ).fill(null), this.nodeIdGenerator = new hn(), this.symbolIdGenerator = new Nn(), this.token = {
4825
+ ).fill(null), this.nodeIdGenerator = new pn(), this.symbolIdGenerator = new mn(), this.token = {
4818
4826
  invalidStream: this.createQuery(
4819
4827
  6,
4820
- () => this.parse.tokens().filter(Ft)
4828
+ () => this.parse.tokens().filter(Bt)
4821
4829
  ),
4822
4830
  // Valid + Invalid tokens (which are guarenteed to be non-trivials) are included in the stream
4823
4831
  flatStream: this.createQuery(
@@ -4829,8 +4837,8 @@ class Ds {
4829
4837
  _: this.createQuery(
4830
4838
  0,
4831
4839
  () => {
4832
- const e = new Dn(this.source).lex().chain((n) => new Rn(n, this.nodeIdGenerator).parse()).chain(({ ast: n, tokens: s }) => new ds(n, this.symbolIdGenerator).analyze().map(() => ({ ast: n, tokens: s })));
4833
- return e.getErrors().length > 0 ? e : e.chain(({ ast: n, tokens: s }) => new ms(n).interpret().map((a) => ({ ast: n, tokens: s, rawDb: a })));
4840
+ const e = new On(this.source).lex().chain((n) => new Mn(n, this.nodeIdGenerator).parse()).chain(({ ast: n, tokens: s }) => new Es(n, this.symbolIdGenerator).analyze().map(() => ({ ast: n, tokens: s })));
4841
+ return e.getErrors().length > 0 ? e : e.chain(({ ast: n, tokens: s }) => new bs(n).interpret().map((a) => ({ ast: n, tokens: s, rawDb: a })));
4834
4842
  }
4835
4843
  ),
4836
4844
  ast: this.createQuery(
@@ -4854,38 +4862,38 @@ class Ds {
4854
4862
  stack: this.createQuery(
4855
4863
  10,
4856
4864
  (e) => {
4857
- const n = this.token.flatStream(), { index: s, token: i } = this.container.token(e), a = s === void 0 ? -1 : ln(n, (f) => !f.isInvalid, s);
4865
+ const n = this.token.flatStream(), { index: s, token: i } = this.container.token(e), a = s === void 0 ? -1 : cn(n, (p) => !p.isInvalid, s);
4858
4866
  if (a === -1)
4859
4867
  return [this.parse.ast()];
4860
4868
  const r = n[a].start;
4861
4869
  let c = this.parse.ast();
4862
- const p = [c];
4870
+ const f = [c];
4863
4871
  for (; ; ) {
4864
- const d = Sn(c).find((u) => Se(r, u));
4865
- if (d === void 0 || d instanceof J)
4872
+ const h = xn(c).find((d) => Se(r, d));
4873
+ if (h === void 0 || h instanceof Q)
4866
4874
  break;
4867
- p.push(d), c = d;
4875
+ f.push(h), c = h;
4868
4876
  }
4869
- if ((i == null ? void 0 : i.kind) === h.COLON)
4870
- return p;
4871
- for (; p.length > 0; ) {
4872
- let f = !1;
4873
- const d = Ve(p);
4874
- if (d instanceof w) {
4875
- const u = this.parse.source();
4876
- for (let E = d.end; E < e; E += 1)
4877
- u[E] === `
4878
- ` && (p.pop(), f = !0);
4877
+ if ((i == null ? void 0 : i.kind) === u.COLON)
4878
+ return f;
4879
+ for (; f.length > 0; ) {
4880
+ let p = !1;
4881
+ const h = Ve(f);
4882
+ if (h instanceof w) {
4883
+ const d = this.parse.source();
4884
+ for (let N = h.end; N < e; N += 1)
4885
+ d[N] === `
4886
+ ` && (f.pop(), p = !0);
4879
4887
  } else
4880
- d instanceof oe || d instanceof le ? this.container.token(e).token !== d.op && (p.pop(), f = !0) : d instanceof M ? d.listCloseBracket && d.end <= e && (p.pop(), f = !0) : d instanceof ce ? d.tupleCloseParen && d.end <= e && (p.pop(), f = !0) : d instanceof ae ? d.blockCloseBrace && d.end <= e && (p.pop(), f = !0) : d instanceof te || d.end < e && (p.pop(), f = !0);
4881
- if (f) {
4882
- const u = Ve(p);
4883
- u instanceof y && u.end <= e && p.pop();
4888
+ h instanceof Z || h instanceof le ? this.container.token(e).token !== h.op && (f.pop(), p = !0) : h instanceof M ? h.listCloseBracket && h.end <= e && (f.pop(), p = !0) : h instanceof ce ? h.tupleCloseParen && h.end <= e && (f.pop(), p = !0) : h instanceof oe ? h.blockCloseBrace && h.end <= e && (f.pop(), p = !0) : h instanceof ne || h.end < e && (f.pop(), p = !0);
4889
+ if (p) {
4890
+ const d = Ve(f);
4891
+ d instanceof y && d.end <= e && f.pop();
4884
4892
  }
4885
- if (!f)
4893
+ if (!p)
4886
4894
  break;
4887
4895
  }
4888
- return p;
4896
+ return f;
4889
4897
  }
4890
4898
  ),
4891
4899
  token: this.createQuery(
@@ -4917,7 +4925,7 @@ class Ds {
4917
4925
  ),
4918
4926
  scopeKind: this.createQuery(15, (e) => {
4919
4927
  var s;
4920
- if (this.container.element(e) instanceof Z)
4928
+ if (this.container.element(e) instanceof K)
4921
4929
  return 8;
4922
4930
  switch ((s = this.container.element(e).type) == null ? void 0 : s.value.toLowerCase()) {
4923
4931
  case "table":
@@ -4959,17 +4967,17 @@ class Ds {
4959
4967
  if (!((i = a.symbol) != null && i.symbolTable))
4960
4968
  continue;
4961
4969
  const { symbolTable: r } = a.symbol;
4962
- let c = [r], p = [];
4963
- for (const f of e)
4964
- p = c.flatMap(
4965
- (d) => gn(f).flatMap((u) => {
4966
- const E = d.get(u), L = re(u).unwrap_or(void 0);
4967
- return !E || !L ? [] : { ...L, symbol: E };
4970
+ let c = [r], f = [];
4971
+ for (const p of e)
4972
+ f = c.flatMap(
4973
+ (h) => wn(p).flatMap((d) => {
4974
+ const N = h.get(d), L = ie(d).unwrap_or(void 0);
4975
+ return !N || !L ? [] : { ...L, symbol: N };
4968
4976
  })
4969
- ), c = p.flatMap(
4970
- (d) => d.symbol.symbolTable ? d.symbol.symbolTable : []
4977
+ ), c = f.flatMap(
4978
+ (h) => h.symbol.symbolTable ? h.symbol.symbolTable : []
4971
4979
  );
4972
- s.push(...p);
4980
+ s.push(...f);
4973
4981
  }
4974
4982
  return s;
4975
4983
  },
@@ -4978,7 +4986,7 @@ class Ds {
4978
4986
  members: this.createQuery(
4979
4987
  9,
4980
4988
  (e) => e.symbolTable ? [...e.symbolTable.entries()].map(([n, s]) => ({
4981
- ...re(n).unwrap(),
4989
+ ...ie(n).unwrap(),
4982
4990
  symbol: s
4983
4991
  })) : []
4984
4992
  )
@@ -5005,14 +5013,14 @@ class Ds {
5005
5013
  }
5006
5014
  initMonacoServices() {
5007
5015
  return {
5008
- definitionProvider: new an(this),
5009
- referenceProvider: new rn(this),
5010
- autocompletionProvider: new en(this)
5016
+ definitionProvider: new rn(this),
5017
+ referenceProvider: new on(this),
5018
+ autocompletionProvider: new tn(this)
5011
5019
  };
5012
5020
  }
5013
5021
  }
5014
5022
  export {
5015
- Ds as Compiler,
5016
- Ps as serialize,
5017
- Ss as services
5023
+ xs as Compiler,
5024
+ Ss as serialize,
5025
+ Ds as services
5018
5026
  };