@dbml/parse 3.5.0 → 3.5.2-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- import I 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.SINGLE_LINE_COMMENT = "<single-line-comment>", t.MULTILINE_COMMENT = "<multiline-comment>", t))(u || {});
3
- function Wt(t) {
1
+ import I, { findLastIndex as jt, last as it } from "lodash";
2
+ var l = /* @__PURE__ */ ((t) => (t.SPACE = "<space>", t.TAB = "<tab>", t.NEWLINE = "<newline>", t.COMMA = "<comma>", t.LPAREN = "<lparen>", t.RPAREN = "<rparen>", t.LBRACE = "<lbrace>", t.RBRACE = "<rbrace>", t.LBRACKET = "<lbracket>", t.RBRACKET = "<rbracket>", t.LANGLE = "<langle>", t.RANGLE = "<rangle>", t.OP = "<op>", t.EOF = "<eof>", t.NUMERIC_LITERAL = "<number>", t.STRING_LITERAL = "<string>", t.COLOR_LITERAL = "<color>", t.FUNCTION_EXPRESSION = "<function-expression>", t.QUOTED_STRING = "<variable>", t.IDENTIFIER = "<identifier>", t.SEMICOLON = "<semicolon>", t.COLON = "<colon>", t.SINGLE_LINE_COMMENT = "<single-line-comment>", t.MULTILINE_COMMENT = "<multiline-comment>", t))(l || {});
3
+ function Yt(t) {
4
4
  switch (t.kind) {
5
5
  case "<newline>":
6
6
  case "<space>":
@@ -12,7 +12,7 @@ function Wt(t) {
12
12
  return !1;
13
13
  }
14
14
  }
15
- function it(t) {
15
+ function rt(t) {
16
16
  if (!t)
17
17
  return !1;
18
18
  switch (t) {
@@ -33,7 +33,7 @@ function it(t) {
33
33
  return !1;
34
34
  }
35
35
  }
36
- function rt(t) {
36
+ function at(t) {
37
37
  return t !== void 0 && t.kind === "<op>";
38
38
  }
39
39
  class F {
@@ -44,27 +44,27 @@ class F {
44
44
  return new F(e, n, s, i, r);
45
45
  }
46
46
  }
47
- function Tt(t) {
48
- return t.trailingTrivia.find(({ kind: e }) => e === u.NEWLINE) !== void 0;
47
+ function bt(t) {
48
+ return t.trailingTrivia.find(({ kind: e }) => e === l.NEWLINE) !== void 0;
49
49
  }
50
- function at(t, e) {
51
- return e.leadingTrivia.find(({ kind: s }) => s === u.NEWLINE) !== void 0 || Tt(t);
50
+ function ot(t, e) {
51
+ return e.leadingTrivia.find(({ kind: s }) => s === l.NEWLINE) !== void 0 || bt(t);
52
52
  }
53
53
  function Ce(t) {
54
- return t.trailingTrivia.find(({ kind: e }) => e === u.SPACE) !== void 0;
55
- }
56
- function bt(t) {
57
- return t.trailingTrivia.length === 0 ? t.end : bt(I.last(t.trailingTrivia));
54
+ return t.trailingTrivia.find(({ kind: e }) => e === l.SPACE) !== void 0;
58
55
  }
59
56
  function It(t) {
60
- return t.leadingTrivia.length === 0 ? t.start : It(t.leadingTrivia[0]);
57
+ return t.trailingTrivia.length === 0 ? t.end : It(I.last(t.trailingTrivia));
58
+ }
59
+ function Lt(t) {
60
+ return t.leadingTrivia.length === 0 ? t.start : Lt(t.leadingTrivia[0]);
61
61
  }
62
- function jt(t) {
63
- return [u.SINGLE_LINE_COMMENT, u.MULTILINE_COMMENT].includes(
62
+ function zt(t) {
63
+ return [l.SINGLE_LINE_COMMENT, l.MULTILINE_COMMENT].includes(
64
64
  t.kind
65
65
  );
66
66
  }
67
- class Yt {
67
+ class Qt {
68
68
  constructor() {
69
69
  this.id = 0;
70
70
  }
@@ -81,13 +81,13 @@ class x {
81
81
  constructor(e, n, s) {
82
82
  this.id = e, this.kind = n;
83
83
  const i = s.find((a) => a !== void 0 && !Number.isNaN(a.start));
84
- i ? (this.startPos = i.startPos, this.fullStart = i instanceof F ? It(i) : i.fullStart) : (this.startPos = {
84
+ i ? (this.startPos = i.startPos, this.fullStart = i instanceof F ? Lt(i) : i.fullStart) : (this.startPos = {
85
85
  offset: NaN,
86
86
  column: NaN,
87
87
  line: NaN
88
88
  }, this.fullStart = NaN);
89
89
  const r = [...s].reverse().find((a) => a !== void 0 && !Number.isNaN(a.end));
90
- r ? (this.endPos = r.endPos, this.fullEnd = r instanceof F ? bt(r) : r.fullEnd) : (this.endPos = {
90
+ r ? (this.endPos = r.endPos, this.fullEnd = r instanceof F ? It(r) : r.fullEnd) : (this.endPos = {
91
91
  offset: NaN,
92
92
  column: NaN,
93
93
  line: NaN
@@ -108,7 +108,7 @@ class A extends x {
108
108
  alias: i,
109
109
  attributeList: r,
110
110
  bodyColon: a,
111
- body: c
111
+ body: u
112
112
  }, p) {
113
113
  if (super(p, "<element-declaration>", [
114
114
  e,
@@ -117,10 +117,10 @@ class A extends x {
117
117
  i,
118
118
  r,
119
119
  a,
120
- c
121
- ]), c && a && !(c instanceof y || c instanceof A))
120
+ u
121
+ ]), u && a && !(u instanceof y || u instanceof A))
122
122
  throw new Error("If an element has a simple body, it must be a function application node");
123
- this.type = e, this.name = n, this.as = s, this.alias = i, this.attributeList = r, this.bodyColon = a, this.body = c;
123
+ this.type = e, this.name = n, this.as = s, this.alias = i, this.attributeList = r, this.bodyColon = a, this.body = u;
124
124
  }
125
125
  }
126
126
  class $ extends x {
@@ -184,7 +184,7 @@ class D extends x {
184
184
  }, r) {
185
185
  super(r, "<list-expression>", [
186
186
  e,
187
- ...Lt(n, s),
187
+ ...gt(n, s),
188
188
  i
189
189
  ]), this.listOpenBracket = e, this.elementList = n, this.commaList = s, this.listCloseBracket = i;
190
190
  }
@@ -198,7 +198,7 @@ class J extends x {
198
198
  }, r) {
199
199
  super(r, "<tuple-expression>", [
200
200
  e,
201
- ...Lt(n, s),
201
+ ...gt(n, s),
202
202
  i
203
203
  ]), this.tupleOpenParen = e, this.elementList = n, this.commaList = s, this.tupleCloseParen = i;
204
204
  }
@@ -245,7 +245,7 @@ class U extends x {
245
245
  }
246
246
  class xe extends x {
247
247
  constructor({ pre: e }, n) {
248
- const s = F.create(u.SPACE, e.endPos, e.endPos, " ", !1);
248
+ const s = F.create(l.SPACE, e.endPos, e.endPos, " ", !1);
249
249
  super(n, "<dummy>", [s]);
250
250
  }
251
251
  }
@@ -254,7 +254,7 @@ class ue extends x {
254
254
  super(s, "<array>", [e, n]), this.array = e, this.indexer = n;
255
255
  }
256
256
  }
257
- function Lt(t, e) {
257
+ function gt(t, e) {
258
258
  if (!t || t.length === 0)
259
259
  return e || [];
260
260
  if (!e || e.length === 0)
@@ -264,7 +264,7 @@ function Lt(t, e) {
264
264
  (i) => i !== null
265
265
  );
266
266
  }
267
- function os(t, e = !1) {
267
+ function ls(t, e = !1) {
268
268
  return JSON.stringify(
269
269
  t,
270
270
  function(n, s) {
@@ -334,7 +334,7 @@ class w {
334
334
  return !1;
335
335
  }
336
336
  }
337
- 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))(m || {});
337
+ var T = /* @__PURE__ */ ((t) => (t.Schema = "Schema", t.Table = "Table", t.Column = "Column", t.TableGroup = "TableGroup", t.TableGroupField = "TableGroup field", t.Enum = "Enum", t.EnumField = "Enum field", t.Note = "Note", t))(T || {});
338
338
  function je(t) {
339
339
  return `Schema:${t}`;
340
340
  }
@@ -356,7 +356,7 @@ function qe(t) {
356
356
  function He(t) {
357
357
  return `TableGroup field:${t}`;
358
358
  }
359
- function zt(t) {
359
+ function qt(t) {
360
360
  return `Note:${t}`;
361
361
  }
362
362
  function Ve(t, e) {
@@ -381,19 +381,19 @@ function Ve(t, e) {
381
381
  }
382
382
  function ie(t) {
383
383
  const [e, n] = t.split(":");
384
- return Object.values(m).includes(e) ? new S({
384
+ return Object.values(T).includes(e) ? new S({
385
385
  name: n,
386
386
  kind: e
387
387
  }) : new w();
388
388
  }
389
- function Qt(t) {
389
+ function Ht(t) {
390
390
  const e = ie(t).unwrap_or(void 0);
391
391
  if (!e)
392
392
  return !1;
393
393
  const { kind: n, name: s } = e;
394
394
  return n === "Schema" && s === "public";
395
395
  }
396
- function qt(t) {
396
+ function Jt(t) {
397
397
  return [
398
398
  je,
399
399
  Oe,
@@ -411,14 +411,14 @@ function Re(t) {
411
411
  const [e] = t;
412
412
  return e >= "0" && e <= "9";
413
413
  }
414
- function Ht(t) {
414
+ function Zt(t) {
415
415
  const [e] = t;
416
416
  return Re(e) || Me(e) && e.toLowerCase() >= "a" && e.toLowerCase() <= "f";
417
417
  }
418
418
  function de(t) {
419
419
  return Me(t) || Re(t);
420
420
  }
421
- function ot(t, e) {
421
+ function ct(t, e) {
422
422
  const n = [], s = Math.min(t.length, e.length);
423
423
  for (let i = 0; i < s; i += 1)
424
424
  n.push(t[i], e[i]);
@@ -427,7 +427,7 @@ function ot(t, e) {
427
427
  function ge(t, e) {
428
428
  return t >= e.start && t < e.end;
429
429
  }
430
- class Jt {
430
+ class Kt {
431
431
  constructor() {
432
432
  this.id = 0;
433
433
  }
@@ -438,45 +438,45 @@ class Jt {
438
438
  return this.id++;
439
439
  }
440
440
  }
441
- class gt {
441
+ class _t {
442
442
  constructor({ symbolTable: e }, n) {
443
443
  this.references = [], this.id = n, this.symbolTable = e;
444
444
  }
445
445
  }
446
- class Zt {
446
+ class en {
447
447
  constructor({ symbolTable: e, declaration: n }, s) {
448
448
  this.references = [], this.id = s, this.symbolTable = e, this.declaration = n;
449
449
  }
450
450
  }
451
- class Kt {
451
+ class tn {
452
452
  constructor({ declaration: e }, n) {
453
453
  this.references = [], this.id = n, this.declaration = e;
454
454
  }
455
455
  }
456
- class _t {
456
+ class At {
457
457
  constructor({ symbolTable: e, declaration: n }, s) {
458
458
  this.references = [], this.id = s, this.symbolTable = e, this.declaration = n;
459
459
  }
460
460
  }
461
- class en {
461
+ class nn {
462
462
  constructor({ declaration: e }, n) {
463
463
  this.references = [], this.id = n, this.declaration = e;
464
464
  }
465
465
  }
466
- class tn {
466
+ class sn {
467
467
  constructor({ symbolTable: e, declaration: n }, s) {
468
468
  this.references = [], this.id = s, this.symbolTable = e, this.declaration = n;
469
469
  }
470
470
  }
471
- class nn {
471
+ class rn {
472
472
  constructor({ declaration: e }, n) {
473
473
  this.references = [], this.id = n, this.declaration = e;
474
474
  }
475
475
  }
476
476
  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.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 || {});
477
- class l extends Error {
477
+ class c extends Error {
478
478
  constructor(e, n, s) {
479
- super(n), this.code = e, this.diagnostic = n, this.nodeOrToken = s, this.start = s.start, this.end = s.end, this.name = this.constructor.name, Object.setPrototypeOf(this, l.prototype);
479
+ super(n), this.code = e, this.diagnostic = n, this.nodeOrToken = s, this.start = s.start, this.end = s.end, this.name = this.constructor.name, Object.setPrototypeOf(this, c.prototype);
480
480
  }
481
481
  }
482
482
  class B {
@@ -497,7 +497,7 @@ class B {
497
497
  return new B(e(this.value), this.errors);
498
498
  }
499
499
  }
500
- function sn(t, e, n) {
500
+ function an(t, e, n) {
501
501
  if (!t || !me(t) || e.length === 0)
502
502
  return new w();
503
503
  const s = [...e], i = Ge(t).unwrap(), r = s.pop();
@@ -528,56 +528,56 @@ function sn(t, e, n) {
528
528
  })
529
529
  ) : new w();
530
530
  }
531
- function ct(t) {
532
- return t.kind === u.IDENTIFIER && t.value === "as";
531
+ function lt(t) {
532
+ return t.kind === l.IDENTIFIER && t.value === "as";
533
533
  }
534
- function E(t) {
535
- t && (t instanceof F ? rn(t) : an(t));
534
+ function N(t) {
535
+ t && (t instanceof F ? on(t) : cn(t));
536
536
  }
537
- function rn(t) {
538
- t.kind !== u.EOF && (t.isInvalid = !0);
537
+ function on(t) {
538
+ t.kind !== l.EOF && (t.isInvalid = !0);
539
539
  }
540
- function an(t) {
540
+ function cn(t) {
541
541
  if (t instanceof A)
542
- E(t.type), E(t.name), E(t.as), E(t.alias), E(t.bodyColon), E(t.attributeList), E(t.body);
542
+ N(t.type), N(t.name), N(t.as), N(t.alias), N(t.bodyColon), N(t.attributeList), N(t.body);
543
543
  else if (t instanceof $)
544
- t.identifiers.forEach(E);
544
+ t.identifiers.forEach(N);
545
545
  else if (t instanceof se)
546
- E(t.name), E(t.colon), E(t.value);
546
+ N(t.name), N(t.colon), N(t.value);
547
547
  else if (t instanceof Q)
548
- E(t.op), E(t.expression);
548
+ N(t.op), N(t.expression);
549
549
  else if (t instanceof q)
550
- E(t.leftExpression), E(t.op), E(t.rightExpression);
550
+ N(t.leftExpression), N(t.op), N(t.rightExpression);
551
551
  else if (t instanceof Ue)
552
- E(t.op), E(t.expression);
552
+ N(t.op), N(t.expression);
553
553
  else if (t instanceof ne)
554
- E(t.blockOpenBrace), t.body.forEach(E), E(t.blockCloseBrace);
554
+ N(t.blockOpenBrace), t.body.forEach(N), N(t.blockCloseBrace);
555
555
  else if (t instanceof D)
556
- E(t.listOpenBracket), t.commaList.forEach(E), t.elementList.forEach(E), E(t.listCloseBracket);
556
+ N(t.listOpenBracket), t.commaList.forEach(N), t.elementList.forEach(N), N(t.listCloseBracket);
557
557
  else if (t instanceof J)
558
- E(t.tupleOpenParen), t.commaList.forEach(E), t.elementList.forEach(E), E(t.tupleCloseParen);
558
+ N(t.tupleOpenParen), t.commaList.forEach(N), t.elementList.forEach(N), N(t.tupleCloseParen);
559
559
  else if (t instanceof H)
560
- E(t.callee), E(t.argumentList);
560
+ N(t.callee), N(t.argumentList);
561
561
  else if (t instanceof y)
562
- E(t.callee), t.args.forEach(E);
562
+ N(t.callee), t.args.forEach(N);
563
563
  else if (t instanceof U)
564
- E(t.expression);
564
+ N(t.expression);
565
565
  else if (t instanceof te)
566
- E(t.value);
566
+ N(t.value);
567
567
  else if (t instanceof Z)
568
- E(t.variable);
568
+ N(t.variable);
569
569
  else if (t instanceof be)
570
- E(t.literal);
570
+ N(t.literal);
571
571
  else
572
572
  throw t instanceof We ? new Error("This case is handled by the TupleExpressionNode case") : new Error("Unreachable case in markInvalidNode");
573
573
  }
574
- function At(t) {
574
+ function vt(t) {
575
575
  return !!(t != null && t.isInvalid);
576
576
  }
577
577
  function P(...t) {
578
578
  return t.filter((e) => e !== void 0);
579
579
  }
580
- function on(t) {
580
+ function ln(t) {
581
581
  if (t instanceof G)
582
582
  return P(...t.body, t.eof);
583
583
  if (t instanceof A)
@@ -613,13 +613,13 @@ function on(t) {
613
613
  if (t instanceof D)
614
614
  return P(
615
615
  t.listOpenBracket,
616
- ...ot(t.elementList, t.commaList),
616
+ ...ct(t.elementList, t.commaList),
617
617
  t.listCloseBracket
618
618
  );
619
619
  if (t instanceof J)
620
620
  return P(
621
621
  t.tupleOpenParen,
622
- ...ot(t.elementList, t.commaList),
622
+ ...ct(t.elementList, t.commaList),
623
623
  t.tupleCloseParen
624
624
  );
625
625
  if (t instanceof H)
@@ -638,14 +638,14 @@ function Ge(t) {
638
638
  }
639
639
  function j(t) {
640
640
  var e;
641
- return t instanceof U && (t.expression instanceof Z && t.expression.variable instanceof F && t.expression.variable.kind === u.QUOTED_STRING || t.expression instanceof be && ((e = t.expression.literal) == null ? void 0 : e.kind) === u.STRING_LITERAL);
641
+ return t instanceof U && (t.expression instanceof Z && t.expression.variable instanceof F && t.expression.variable.kind === l.QUOTED_STRING || t.expression instanceof be && ((e = t.expression.literal) == null ? void 0 : e.kind) === l.STRING_LITERAL);
642
642
  }
643
643
  function M(t) {
644
644
  return t instanceof U && t.expression instanceof Z && t.expression.variable instanceof F;
645
645
  }
646
646
  function me(t) {
647
647
  var e;
648
- return t instanceof U && t.expression instanceof Z && ((e = t.expression.variable) == null ? void 0 : e.kind) === u.IDENTIFIER;
648
+ return t instanceof U && t.expression instanceof Z && ((e = t.expression.variable) == null ? void 0 : e.kind) === l.IDENTIFIER;
649
649
  }
650
650
  function Je(t) {
651
651
  var e;
@@ -657,7 +657,7 @@ function Te(t) {
657
657
  const e = t.identifiers.map((n) => n.value).join(" ");
658
658
  return e === "" ? new w() : new S(e);
659
659
  }
660
- class cn {
660
+ class un {
661
661
  // list of errors during lexing
662
662
  constructor(e) {
663
663
  this.start = {
@@ -706,50 +706,50 @@ class cn {
706
706
  );
707
707
  }
708
708
  lex() {
709
- return this.scanTokens(), this.tokens.push(F.create(u.EOF, this.start, this.current, "", !1)), this.gatherTrivia(), this.gatherInvalid(), new B(this.tokens, this.errors);
709
+ return this.scanTokens(), this.tokens.push(F.create(l.EOF, this.start, this.current, "", !1)), this.gatherTrivia(), this.gatherInvalid(), new B(this.tokens, this.errors);
710
710
  }
711
711
  scanTokens() {
712
712
  for (; !this.isAtEnd(); ) {
713
713
  const e = this.advance();
714
714
  switch (e) {
715
715
  case " ":
716
- this.addToken(u.SPACE);
716
+ this.addToken(l.SPACE);
717
717
  break;
718
718
  case "\r":
719
719
  break;
720
720
  case `
721
721
  `:
722
- this.addToken(u.NEWLINE);
722
+ this.addToken(l.NEWLINE);
723
723
  break;
724
724
  case " ":
725
- this.addToken(u.TAB);
725
+ this.addToken(l.TAB);
726
726
  break;
727
727
  case ",":
728
- this.addToken(u.COMMA);
728
+ this.addToken(l.COMMA);
729
729
  break;
730
730
  case "(":
731
- this.addToken(u.LPAREN);
731
+ this.addToken(l.LPAREN);
732
732
  break;
733
733
  case ")":
734
- this.addToken(u.RPAREN);
734
+ this.addToken(l.RPAREN);
735
735
  break;
736
736
  case "[":
737
- this.addToken(u.LBRACKET);
737
+ this.addToken(l.LBRACKET);
738
738
  break;
739
739
  case "]":
740
- this.addToken(u.RBRACKET);
740
+ this.addToken(l.RBRACKET);
741
741
  break;
742
742
  case "{":
743
- this.addToken(u.LBRACE);
743
+ this.addToken(l.LBRACE);
744
744
  break;
745
745
  case "}":
746
- this.addToken(u.RBRACE);
746
+ this.addToken(l.RBRACE);
747
747
  break;
748
748
  case ";":
749
- this.addToken(u.SEMICOLON);
749
+ this.addToken(l.SEMICOLON);
750
750
  break;
751
751
  case ":":
752
- this.addToken(u.COLON);
752
+ this.addToken(l.COLON);
753
753
  break;
754
754
  case "'":
755
755
  this.match("''") ? this.multilineStringLiteral() : this.singleLineStringLiteral();
@@ -767,7 +767,7 @@ class cn {
767
767
  this.match("/") ? this.singleLineComment() : this.match("*") ? this.multilineComment() : this.operator();
768
768
  break;
769
769
  default:
770
- if (it(e)) {
770
+ if (rt(e)) {
771
771
  this.operator();
772
772
  break;
773
773
  }
@@ -779,11 +779,11 @@ class cn {
779
779
  this.numericLiteralOrIdentifier();
780
780
  break;
781
781
  }
782
- this.addToken(u.OP, !0), this.errors.push(
783
- new l(
782
+ this.addToken(l.OP, !0), this.errors.push(
783
+ new c(
784
784
  o.UNKNOWN_SYMBOL,
785
785
  `Unexpected token '${e}'`,
786
- this.createToken(u.OP, !0)
786
+ this.createToken(l.OP, !0)
787
787
  )
788
788
  );
789
789
  break;
@@ -795,13 +795,13 @@ class cn {
795
795
  let e = !0, n = [], s;
796
796
  const i = [];
797
797
  for (const r of this.tokens)
798
- Wt(r) ? (n.push(r), r.kind === u.NEWLINE && s && (s.trailingTrivia = n, e = !0, s = void 0, n = [])) : (e ? r.leadingTrivia = n : s.trailingTrivia = n, i.push(r), n = [], s = r, e = !1);
798
+ Yt(r) ? (n.push(r), r.kind === l.NEWLINE && s && (s.trailingTrivia = n, e = !0, s = void 0, n = [])) : (e ? r.leadingTrivia = n : s.trailingTrivia = n, i.push(r), n = [], s = r, e = !1);
799
799
  this.tokens = i;
800
800
  }
801
801
  gatherInvalid() {
802
802
  let e;
803
803
  const n = [], s = [];
804
- for (e = 0; e < this.tokens.length && At(this.tokens[e]); e += 1)
804
+ for (e = 0; e < this.tokens.length && vt(this.tokens[e]); e += 1)
805
805
  s.push(this.tokens[e]);
806
806
  let i = this.tokens[e];
807
807
  for (i.leadingInvalid = [...s, ...i.leadingInvalid]; e < this.tokens.length; e += 1) {
@@ -820,14 +820,14 @@ class cn {
820
820
  // Whether to interpret '\' as a backlash
821
821
  consumeStopSequence: a = !0
822
822
  }) {
823
- let c = "";
823
+ let u = "";
824
824
  for (; !this.isAtEnd() && (s || !this.check(`
825
825
  `)) && !this.check(n); )
826
- this.peek() === "\\" && !r ? (this.advance(), c += this.escapedString()) : c += this.advance();
826
+ this.peek() === "\\" && !r ? (this.advance(), u += this.escapedString()) : u += this.advance();
827
827
  if (this.isAtEnd() && !i) {
828
828
  const p = this.createToken(e, !0);
829
829
  this.tokens.push(p), this.errors.push(
830
- new l(o.UNEXPECTED_EOF, "EOF reached while parsing", p)
830
+ new c(o.UNEXPECTED_EOF, "EOF reached while parsing", p)
831
831
  );
832
832
  return;
833
833
  }
@@ -835,7 +835,7 @@ class cn {
835
835
  `) && !s) {
836
836
  const p = this.createToken(e, !0);
837
837
  this.tokens.push(p), this.errors.push(
838
- new l(
838
+ new c(
839
839
  o.UNEXPECTED_NEWLINE,
840
840
  "Invalid newline encountered while parsing",
841
841
  p
@@ -843,38 +843,38 @@ class cn {
843
843
  );
844
844
  return;
845
845
  }
846
- a && this.match(n), this.tokens.push(F.create(e, this.start, this.current, c, !1));
846
+ a && this.match(n), this.tokens.push(F.create(e, this.start, this.current, u, !1));
847
847
  }
848
848
  singleLineStringLiteral() {
849
- this.consumeUntil(u.STRING_LITERAL, "'", {
849
+ this.consumeUntil(l.STRING_LITERAL, "'", {
850
850
  allowNewline: !1,
851
851
  allowEof: !1,
852
852
  raw: !1
853
853
  });
854
854
  }
855
855
  multilineStringLiteral() {
856
- this.consumeUntil(u.STRING_LITERAL, "'''", {
856
+ this.consumeUntil(l.STRING_LITERAL, "'''", {
857
857
  allowNewline: !0,
858
858
  allowEof: !1,
859
859
  raw: !1
860
860
  });
861
861
  }
862
862
  functionExpression() {
863
- this.consumeUntil(u.FUNCTION_EXPRESSION, "`", {
863
+ this.consumeUntil(l.FUNCTION_EXPRESSION, "`", {
864
864
  allowNewline: !1,
865
865
  allowEof: !1,
866
866
  raw: !0
867
867
  });
868
868
  }
869
869
  quotedVariable() {
870
- this.consumeUntil(u.QUOTED_STRING, '"', {
870
+ this.consumeUntil(l.QUOTED_STRING, '"', {
871
871
  allowNewline: !1,
872
872
  allowEof: !1,
873
873
  raw: !1
874
874
  });
875
875
  }
876
876
  singleLineComment() {
877
- this.consumeUntil(u.SINGLE_LINE_COMMENT, `
877
+ this.consumeUntil(l.SINGLE_LINE_COMMENT, `
878
878
  `, {
879
879
  allowNewline: !0,
880
880
  allowEof: !0,
@@ -883,7 +883,7 @@ class cn {
883
883
  });
884
884
  }
885
885
  multilineComment() {
886
- this.consumeUntil(u.MULTILINE_COMMENT, "*/", {
886
+ this.consumeUntil(l.MULTILINE_COMMENT, "*/", {
887
887
  allowNewline: !0,
888
888
  allowEof: !1,
889
889
  raw: !0
@@ -892,26 +892,26 @@ class cn {
892
892
  identifier() {
893
893
  for (; !this.isAtEnd() && de(this.peek()); )
894
894
  this.advance();
895
- this.addToken(u.IDENTIFIER);
895
+ this.addToken(l.IDENTIFIER);
896
896
  }
897
897
  operator() {
898
- for (; it(this.peek()); )
898
+ for (; rt(this.peek()); )
899
899
  this.advance();
900
- this.addToken(u.OP);
900
+ this.addToken(l.OP);
901
901
  }
902
902
  // we accept identifiers starting with digits but must contain at least one char or underscore
903
903
  numericLiteralOrIdentifier() {
904
904
  let e = 0;
905
905
  if (this.isAtEnd())
906
- return this.addToken(u.NUMERIC_LITERAL);
906
+ return this.addToken(l.NUMERIC_LITERAL);
907
907
  for (; !this.isAtEnd(); ) {
908
908
  const n = this.check(".");
909
909
  if (e += n ? 1 : 0, e > 1)
910
910
  break;
911
911
  if (!n && this.current.offset === this.text.length - 1)
912
- return this.advance(), this.addToken(u.NUMERIC_LITERAL);
912
+ return this.advance(), this.addToken(l.NUMERIC_LITERAL);
913
913
  if (!n && !de(this.peek()))
914
- return this.addToken(u.NUMERIC_LITERAL);
914
+ return this.addToken(l.NUMERIC_LITERAL);
915
915
  if (!n && !Re(this.peek()))
916
916
  break;
917
917
  this.advance();
@@ -919,19 +919,19 @@ class cn {
919
919
  if (e > 0) {
920
920
  for (; !this.isAtEnd() && (this.check(".") || de(this.peek())); )
921
921
  this.advance();
922
- const n = this.createToken(u.NUMERIC_LITERAL, !0);
923
- this.tokens.push(n), this.errors.push(new l(o.UNKNOWN_TOKEN, "Invalid number", n));
922
+ const n = this.createToken(l.NUMERIC_LITERAL, !0);
923
+ this.tokens.push(n), this.errors.push(new c(o.UNKNOWN_TOKEN, "Invalid number", n));
924
924
  } else {
925
925
  for (; !this.isAtEnd() && de(this.peek()); )
926
926
  this.advance();
927
- const n = this.createToken(u.IDENTIFIER, !1);
927
+ const n = this.createToken(l.IDENTIFIER, !1);
928
928
  this.tokens.push(n);
929
929
  }
930
930
  }
931
931
  colorLiteral() {
932
932
  for (; !this.isAtEnd() && de(this.peek()); )
933
933
  this.advance();
934
- this.addToken(u.COLOR_LITERAL);
934
+ this.addToken(l.COLOR_LITERAL);
935
935
  }
936
936
  escapedString() {
937
937
  const e = { column: this.current.column - 1, offset: this.current.offset - 1, line: this.current.line };
@@ -971,7 +971,7 @@ class cn {
971
971
  let n = "";
972
972
  for (let s = 0; s <= 3; s += 1) {
973
973
  if (this.isAtEnd() || !de(this.peek()))
974
- return this.errors.push(new l(o.INVALID_ESCAPE_SEQUENCE, `Invalid unicode escape sequence '\\u${n}', only unicode escape sequences of the form '\\uHHHH' where H is a hexadecimal number are allowed`, F.create(u.STRING_LITERAL, e, this.current, `\\u${n}`, !0))), `\\u${n}`;
974
+ return this.errors.push(new c(o.INVALID_ESCAPE_SEQUENCE, `Invalid unicode escape sequence '\\u${n}', only unicode escape sequences of the form '\\uHHHH' where H is a hexadecimal number are allowed`, F.create(l.STRING_LITERAL, e, this.current, `\\u${n}`, !0))), `\\u${n}`;
975
975
  n += this.advance();
976
976
  }
977
977
  return String.fromCharCode(parseInt(n, 16));
@@ -982,7 +982,7 @@ class cn {
982
982
  }
983
983
  }
984
984
  var Se = /* @__PURE__ */ ((t) => (t[t.ListExpression = 0] = "ListExpression", t[t.GroupExpression = 1] = "GroupExpression", t[t.BlockExpression = 2] = "BlockExpression", t))(Se || {});
985
- class ln {
985
+ class hn {
986
986
  constructor() {
987
987
  this.stack = [], this.numberOfNestedLParens = 0, this.numberOfNestedLBrackets = 0, this.numberOfNestedLBraces = 0;
988
988
  }
@@ -1023,7 +1023,7 @@ class ln {
1023
1023
  if (!(this.numberOfNestedLBraces <= 0 && this.numberOfNestedLBrackets <= 0 && this.numberOfNestedLParens <= 0))
1024
1024
  for (let s = n; s < e.length - 1; s += 1)
1025
1025
  switch (e[s].kind) {
1026
- case u.COMMA:
1026
+ case l.COMMA:
1027
1027
  if (this.isWithinGroupExpressionContext() || this.isWithinListExpressionContext())
1028
1028
  return [...this.stack].reverse().find(
1029
1029
  (r) => [
@@ -1033,22 +1033,22 @@ class ln {
1033
1033
  ].includes(r)
1034
1034
  );
1035
1035
  break;
1036
- case u.RPAREN:
1036
+ case l.RPAREN:
1037
1037
  if (this.isWithinGroupExpressionContext())
1038
1038
  return 1;
1039
1039
  break;
1040
- case u.RBRACE:
1040
+ case l.RBRACE:
1041
1041
  if (this.isWithinBlockExpressionContext())
1042
1042
  return 2;
1043
1043
  break;
1044
- case u.RBRACKET:
1044
+ case l.RBRACKET:
1045
1045
  if (this.isWithinListExpressionContext())
1046
1046
  return 0;
1047
1047
  break;
1048
1048
  }
1049
1049
  }
1050
1050
  }
1051
- class un {
1051
+ class fn {
1052
1052
  constructor(e) {
1053
1053
  this.generator = e;
1054
1054
  }
@@ -1061,29 +1061,29 @@ class d {
1061
1061
  this.token = e, this.partialNode = n, this.handlerContext = s;
1062
1062
  }
1063
1063
  }
1064
- class hn {
1064
+ class pn {
1065
1065
  constructor(e, n) {
1066
- this.current = 0, this.errors = [], this.contextStack = new ln(), this.synchronizeProgram = () => {
1066
+ this.current = 0, this.errors = [], this.contextStack = new hn(), this.synchronizeProgram = () => {
1067
1067
  const s = this.peek();
1068
- s.kind !== u.EOF ? E(this.advance()) : (E(this.peek()), this.logError(s, o.UNEXPECTED_EOF, "Unexpected EOF"));
1068
+ s.kind !== l.EOF ? N(this.advance()) : (N(this.peek()), this.logError(s, o.UNEXPECTED_EOF, "Unexpected EOF"));
1069
1069
  }, this.synchronizeElementDeclarationName = () => {
1070
1070
  for (; !this.isAtEnd(); ) {
1071
1071
  const s = this.peek();
1072
- if (ct(s) || this.check(u.COLON, u.LBRACE, u.LBRACKET))
1072
+ if (lt(s) || this.check(l.COLON, l.LBRACE, l.LBRACKET))
1073
1073
  break;
1074
- E(s), this.advance();
1074
+ N(s), this.advance();
1075
1075
  }
1076
1076
  }, this.synchronizeElementDeclarationAlias = () => {
1077
1077
  for (; !this.isAtEnd(); ) {
1078
1078
  const s = this.peek();
1079
- if (this.check(u.COLON, u.LBRACE, u.LBRACKET))
1079
+ if (this.check(l.COLON, l.LBRACE, l.LBRACKET))
1080
1080
  break;
1081
- E(s), this.advance();
1081
+ N(s), this.advance();
1082
1082
  }
1083
1083
  }, this.blockExpression = this.contextStack.withContextDo(Se.BlockExpression, () => {
1084
1084
  const s = { body: [] }, i = () => this.nodeFactory.create(ne, s);
1085
1085
  try {
1086
- this.consume("Expect an opening brace '{'", u.LBRACE), s.blockOpenBrace = this.previous();
1086
+ this.consume("Expect an opening brace '{'", l.LBRACE), s.blockOpenBrace = this.previous();
1087
1087
  } catch (r) {
1088
1088
  if (!(r instanceof d))
1089
1089
  throw r;
@@ -1091,7 +1091,7 @@ class hn {
1091
1091
  throw new d(r.token, i(), r.handlerContext);
1092
1092
  this.synchronizeBlock();
1093
1093
  }
1094
- for (; !this.isAtEnd() && !this.check(u.RBRACE); )
1094
+ for (; !this.isAtEnd() && !this.check(l.RBRACE); )
1095
1095
  try {
1096
1096
  s.body.push(this.canBeField() ? this.fieldDeclaration() : this.expression());
1097
1097
  } catch (r) {
@@ -1102,7 +1102,7 @@ class hn {
1102
1102
  this.synchronizeBlock();
1103
1103
  }
1104
1104
  try {
1105
- this.consume("Expect a closing brace '}'", u.RBRACE), s.blockCloseBrace = this.previous();
1105
+ this.consume("Expect a closing brace '}'", l.RBRACE), s.blockCloseBrace = this.previous();
1106
1106
  } catch (r) {
1107
1107
  if (!(r instanceof d))
1108
1108
  throw r;
@@ -1112,12 +1112,12 @@ class hn {
1112
1112
  }
1113
1113
  return i();
1114
1114
  }), this.synchronizeBlock = () => {
1115
- if (!this.check(u.RBRACE))
1116
- for (E(this.advance()); !this.isAtEnd(); ) {
1115
+ if (!this.check(l.RBRACE))
1116
+ for (N(this.advance()); !this.isAtEnd(); ) {
1117
1117
  const s = this.peek();
1118
- if (this.check(u.RBRACE) || at(this.previous(), s))
1118
+ if (this.check(l.RBRACE) || ot(this.previous(), s))
1119
1119
  break;
1120
- E(s), this.advance();
1120
+ N(s), this.advance();
1121
1121
  }
1122
1122
  }, this.tupleExpression = this.contextStack.withContextDo(Se.GroupExpression, () => {
1123
1123
  const s = { elementList: [], commaList: [] }, i = () => this.nodeFactory.create(We, {
@@ -1126,7 +1126,7 @@ class hn {
1126
1126
  expression: s.elementList[0]
1127
1127
  }), r = () => this.nodeFactory.create(J, s);
1128
1128
  try {
1129
- this.consume("Expect an opening parenthesis '('", u.LPAREN), s.tupleOpenParen = this.previous();
1129
+ this.consume("Expect an opening parenthesis '('", l.LPAREN), s.tupleOpenParen = this.previous();
1130
1130
  } catch (a) {
1131
1131
  if (!(a instanceof d))
1132
1132
  throw a;
@@ -1134,7 +1134,7 @@ class hn {
1134
1134
  throw new d(a.token, r(), a.handlerContext);
1135
1135
  this.synchronizeTuple();
1136
1136
  }
1137
- if (!this.isAtEnd() && !this.check(u.RPAREN))
1137
+ if (!this.isAtEnd() && !this.check(l.RPAREN))
1138
1138
  try {
1139
1139
  s.elementList.push(this.normalExpression());
1140
1140
  } catch (a) {
@@ -1144,9 +1144,9 @@ class hn {
1144
1144
  throw new d(a.token, i(), a.handlerContext);
1145
1145
  this.synchronizeTuple();
1146
1146
  }
1147
- for (; !this.isAtEnd() && !this.check(u.RPAREN); )
1147
+ for (; !this.isAtEnd() && !this.check(l.RPAREN); )
1148
1148
  try {
1149
- this.consume("Expect a comma ','", u.COMMA), s.commaList.push(this.previous()), s.elementList.push(this.normalExpression());
1149
+ this.consume("Expect a comma ','", l.COMMA), s.commaList.push(this.previous()), s.elementList.push(this.normalExpression());
1150
1150
  } catch (a) {
1151
1151
  if (!(a instanceof d))
1152
1152
  throw a;
@@ -1155,7 +1155,7 @@ class hn {
1155
1155
  this.synchronizeTuple();
1156
1156
  }
1157
1157
  try {
1158
- this.consume("Expect a closing parenthesis ')'", u.RPAREN), s.tupleCloseParen = this.previous();
1158
+ this.consume("Expect a closing parenthesis ')'", l.RPAREN), s.tupleCloseParen = this.previous();
1159
1159
  } catch (a) {
1160
1160
  if (!(a instanceof d))
1161
1161
  throw a;
@@ -1167,14 +1167,14 @@ class hn {
1167
1167
  }), this.synchronizeTuple = () => {
1168
1168
  for (; !this.isAtEnd(); ) {
1169
1169
  const s = this.peek();
1170
- if (this.check(u.RPAREN, u.COMMA))
1170
+ if (this.check(l.RPAREN, l.COMMA))
1171
1171
  break;
1172
- E(s), this.advance();
1172
+ N(s), this.advance();
1173
1173
  }
1174
1174
  }, this.listExpression = this.contextStack.withContextDo(Se.ListExpression, () => {
1175
1175
  const s = { elementList: [], commaList: [] }, i = () => this.nodeFactory.create(D, s);
1176
1176
  try {
1177
- this.consume("Expect an opening bracket '['", u.LBRACKET), s.listOpenBracket = this.previous();
1177
+ this.consume("Expect an opening bracket '['", l.LBRACKET), s.listOpenBracket = this.previous();
1178
1178
  } catch (r) {
1179
1179
  if (!(r instanceof d))
1180
1180
  throw r;
@@ -1182,7 +1182,7 @@ class hn {
1182
1182
  throw new d(r.token, i(), r.handlerContext);
1183
1183
  this.synchronizeList();
1184
1184
  }
1185
- if (!this.isAtEnd() && !this.check(u.RBRACKET))
1185
+ if (!this.isAtEnd() && !this.check(l.RBRACKET))
1186
1186
  try {
1187
1187
  s.elementList.push(this.attribute());
1188
1188
  } catch (r) {
@@ -1192,9 +1192,9 @@ class hn {
1192
1192
  throw new d(r.token, i(), r.handlerContext);
1193
1193
  this.synchronizeList();
1194
1194
  }
1195
- for (; !this.isAtEnd() && !this.check(u.RBRACKET); )
1195
+ for (; !this.isAtEnd() && !this.check(l.RBRACKET); )
1196
1196
  try {
1197
- this.consume("Expect a comma ','", u.COMMA), s.commaList.push(this.previous()), s.elementList.push(this.attribute());
1197
+ this.consume("Expect a comma ','", l.COMMA), s.commaList.push(this.previous()), s.elementList.push(this.attribute());
1198
1198
  } catch (r) {
1199
1199
  if (!(r instanceof d))
1200
1200
  throw r;
@@ -1203,7 +1203,7 @@ class hn {
1203
1203
  this.synchronizeList();
1204
1204
  }
1205
1205
  try {
1206
- this.consume("Expect a closing bracket ']'", u.RBRACKET), s.listCloseBracket = this.previous();
1206
+ this.consume("Expect a closing bracket ']'", l.RBRACKET), s.listCloseBracket = this.previous();
1207
1207
  } catch (r) {
1208
1208
  if (!(r instanceof d))
1209
1209
  throw r;
@@ -1215,28 +1215,28 @@ class hn {
1215
1215
  }), this.synchronizeList = () => {
1216
1216
  for (; !this.isAtEnd(); ) {
1217
1217
  const s = this.peek();
1218
- if (this.check(u.COMMA, u.RBRACKET))
1218
+ if (this.check(l.COMMA, l.RBRACKET))
1219
1219
  break;
1220
- E(s), this.advance();
1220
+ N(s), this.advance();
1221
1221
  }
1222
1222
  }, this.synchronizeAttributeName = () => {
1223
1223
  for (; !this.isAtEnd(); ) {
1224
1224
  const s = this.peek();
1225
- if (this.check(u.COMMA, u.RBRACKET, u.COLON))
1225
+ if (this.check(l.COMMA, l.RBRACKET, l.COLON))
1226
1226
  break;
1227
- E(s), this.advance();
1227
+ N(s), this.advance();
1228
1228
  }
1229
1229
  }, this.synchronizeAttributeValue = () => {
1230
1230
  for (; !this.isAtEnd(); ) {
1231
1231
  const s = this.peek();
1232
- if (this.check(u.COMMA, u.RBRACKET))
1232
+ if (this.check(l.COMMA, l.RBRACKET))
1233
1233
  break;
1234
- E(s), this.advance();
1234
+ N(s), this.advance();
1235
1235
  }
1236
- }, this.tokens = e, this.nodeFactory = new un(n);
1236
+ }, this.tokens = e, this.nodeFactory = new fn(n);
1237
1237
  }
1238
1238
  isAtEnd() {
1239
- return this.current >= this.tokens.length || this.tokens[this.current].kind === u.EOF;
1239
+ return this.current >= this.tokens.length || this.tokens[this.current].kind === l.EOF;
1240
1240
  }
1241
1241
  advance() {
1242
1242
  return this.isAtEnd() ? I.last(this.tokens) : this.tokens[this.current++];
@@ -1271,8 +1271,8 @@ class hn {
1271
1271
  // Return whether the token of one of the listed kinds are eventually reached
1272
1272
  discardUntil(e, ...n) {
1273
1273
  if (this.isAtEnd() || !this.check(...n)) {
1274
- for (E(this.peek()), this.logError(this.advance(), o.UNEXPECTED_TOKEN, e); !this.isAtEnd() && !this.check(...n); )
1275
- E(this.advance());
1274
+ for (N(this.peek()), this.logError(this.advance(), o.UNEXPECTED_TOKEN, e); !this.isAtEnd() && !this.check(...n); )
1275
+ N(this.advance());
1276
1276
  return !this.isAtEnd();
1277
1277
  }
1278
1278
  return !0;
@@ -1310,11 +1310,11 @@ class hn {
1310
1310
  elementDeclaration() {
1311
1311
  const e = {}, n = () => this.nodeFactory.create(A, e);
1312
1312
  try {
1313
- this.consume("Expect an identifier", u.IDENTIFIER), e.type = this.previous();
1313
+ this.consume("Expect an identifier", l.IDENTIFIER), e.type = this.previous();
1314
1314
  } catch (s) {
1315
1315
  throw s instanceof d ? (e.type = s.partialNode, new d(s.token, n(), s.handlerContext)) : s;
1316
1316
  }
1317
- if (!this.check(u.COLON, u.LBRACE, u.LBRACKET))
1317
+ if (!this.check(l.COLON, l.LBRACE, l.LBRACKET))
1318
1318
  try {
1319
1319
  e.name = this.normalExpression();
1320
1320
  } catch (s) {
@@ -1324,8 +1324,8 @@ class hn {
1324
1324
  throw new d(s.token, n(), s.handlerContext);
1325
1325
  this.synchronizeElementDeclarationName();
1326
1326
  }
1327
- if (ct(this.peek()))
1328
- if (e.as = this.advance(), this.check(u.COLON, u.LBRACE, u.LBRACKET))
1327
+ if (lt(this.peek()))
1328
+ if (e.as = this.advance(), this.check(l.COLON, l.LBRACE, l.LBRACKET))
1329
1329
  this.logError(this.peek(), o.UNEXPECTED_TOKEN, "Expect an alias");
1330
1330
  else
1331
1331
  try {
@@ -1338,21 +1338,21 @@ class hn {
1338
1338
  this.synchronizeElementDeclarationAlias();
1339
1339
  }
1340
1340
  try {
1341
- e.attributeList = this.check(u.LBRACKET) ? this.listExpression() : void 0;
1341
+ e.attributeList = this.check(l.LBRACKET) ? this.listExpression() : void 0;
1342
1342
  } catch (s) {
1343
1343
  throw s instanceof d ? (e.attributeList = s.partialNode, new d(s.token, n(), s.handlerContext)) : s;
1344
1344
  }
1345
1345
  if (!this.discardUntil(
1346
1346
  "Expect an opening brace '{' or a colon ':'",
1347
- u.LBRACE,
1348
- u.COLON
1347
+ l.LBRACE,
1348
+ l.COLON
1349
1349
  ))
1350
1350
  return n();
1351
1351
  try {
1352
- if (this.match(u.COLON)) {
1352
+ if (this.match(l.COLON)) {
1353
1353
  e.bodyColon = this.previous();
1354
1354
  const s = this.expression();
1355
- s instanceof A ? (E(s), this.logError(s, o.UNEXPECTED_ELEMENT_DECLARATION, "An element's simple body must not be an element declaration")) : e.body = s;
1355
+ s instanceof A ? (N(s), this.logError(s, o.UNEXPECTED_ELEMENT_DECLARATION, "An element's simple body must not be an element declaration")) : e.body = s;
1356
1356
  } else
1357
1357
  e.body = this.blockExpression();
1358
1358
  } catch (s) {
@@ -1369,18 +1369,18 @@ class hn {
1369
1369
  fieldDeclaration() {
1370
1370
  const e = {}, n = () => this.nodeFactory.create(A, e);
1371
1371
  try {
1372
- this.consume("Expect an identifier", u.IDENTIFIER), e.type = this.previous();
1372
+ this.consume("Expect an identifier", l.IDENTIFIER), e.type = this.previous();
1373
1373
  } catch (s) {
1374
1374
  throw s instanceof d ? (e.type = s.partialNode, new d(s.token, n(), s.handlerContext)) : s;
1375
1375
  }
1376
1376
  try {
1377
- this.consume("Expect a colon ':'", u.COLON), e.bodyColon = this.previous();
1377
+ this.consume("Expect a colon ':'", l.COLON), e.bodyColon = this.previous();
1378
1378
  } catch (s) {
1379
1379
  throw s instanceof d ? (e.bodyColon = s.partialNode, new d(s.token, n(), s.handlerContext)) : s;
1380
1380
  }
1381
1381
  try {
1382
1382
  const s = this.expression();
1383
- s instanceof A ? this.errors.push(new l(o.INVALID_ELEMENT_IN_SIMPLE_BODY, "Simple body cannot be an element declaration", s)) : e.body = s;
1383
+ s instanceof A ? this.errors.push(new c(o.INVALID_ELEMENT_IN_SIMPLE_BODY, "Simple body cannot be an element declaration", s)) : e.body = s;
1384
1384
  } catch (s) {
1385
1385
  throw s instanceof d ? (e.body = s.partialNode, new d(s.token, n(), s.handlerContext)) : s;
1386
1386
  }
@@ -1388,7 +1388,7 @@ class hn {
1388
1388
  }
1389
1389
  /* Parsing any ExpressionNode, including non-NormalExpression */
1390
1390
  expression() {
1391
- const e = { args: [] }, n = () => sn(e.callee, e.args, this.nodeFactory).unwrap_or(
1391
+ const e = { args: [] }, n = () => an(e.callee, e.args, this.nodeFactory).unwrap_or(
1392
1392
  this.nodeFactory.create(y, e)
1393
1393
  );
1394
1394
  try {
@@ -1410,10 +1410,10 @@ class hn {
1410
1410
  return n();
1411
1411
  }
1412
1412
  shouldStopExpression() {
1413
- if (this.isAtEnd() || Tt(this.previous()))
1413
+ if (this.isAtEnd() || bt(this.previous()))
1414
1414
  return !0;
1415
1415
  const e = this.peek().kind;
1416
- return e === u.RBRACE || e === u.RBRACKET || e === u.RPAREN || e === u.COMMA || e === u.COLON;
1416
+ return e === l.RBRACE || e === l.RBRACKET || e === l.RPAREN || e === l.COMMA || e === l.COLON;
1417
1417
  }
1418
1418
  normalExpression() {
1419
1419
  return this.expression_bp(0);
@@ -1423,13 +1423,13 @@ class hn {
1423
1423
  let n = this.leftExpression_bp();
1424
1424
  for (; !this.isAtEnd(); ) {
1425
1425
  const s = this.peek();
1426
- if (s.kind === u.LPAREN) {
1427
- const { left: i } = lt(s);
1426
+ if (s.kind === l.LPAREN) {
1427
+ const { left: i } = ut(s);
1428
1428
  if (i < e || // When '(' is encountered,
1429
1429
  // consider it part of another expression if
1430
1430
  // it's at the start of a new line
1431
1431
  // and we're currently not having unmatched '(' or '['
1432
- at(this.previous(), s) && !this.contextStack.isWithinGroupExpressionContext() && !this.contextStack.isWithinListExpressionContext())
1432
+ ot(this.previous(), s) && !this.contextStack.isWithinGroupExpressionContext() && !this.contextStack.isWithinListExpressionContext())
1433
1433
  break;
1434
1434
  try {
1435
1435
  n = this.nodeFactory.create(H, {
@@ -1442,7 +1442,7 @@ class hn {
1442
1442
  argumentList: r.partialNode
1443
1443
  }), new d(r.token, n, r.handlerContext)) : r;
1444
1444
  }
1445
- } else if (s.kind === u.LBRACKET) {
1445
+ } else if (s.kind === l.LBRACKET) {
1446
1446
  if (Ce(this.previous()))
1447
1447
  break;
1448
1448
  try {
@@ -1456,8 +1456,8 @@ class hn {
1456
1456
  indexer: i.partialNode
1457
1457
  }), new d(i.token, n, i.handlerContext)) : i;
1458
1458
  }
1459
- } else if (rt(s)) {
1460
- const i = s, r = lt(i);
1459
+ } else if (at(s)) {
1460
+ const i = s, r = ut(i);
1461
1461
  if (r.left !== null) {
1462
1462
  if (r.left <= e)
1463
1463
  break;
@@ -1466,7 +1466,7 @@ class hn {
1466
1466
  op: i
1467
1467
  });
1468
1468
  } else {
1469
- const a = pn(i);
1469
+ const a = En(i);
1470
1470
  if (a.left === null || a.left <= e)
1471
1471
  break;
1472
1472
  this.advance();
@@ -1476,12 +1476,12 @@ class hn {
1476
1476
  op: i,
1477
1477
  rightExpression: i.value === "." ? this.extractOperand() : this.expression_bp(a.right)
1478
1478
  });
1479
- } catch (c) {
1480
- throw c instanceof d ? (n = this.nodeFactory.create(q, {
1479
+ } catch (u) {
1480
+ throw u instanceof d ? (n = this.nodeFactory.create(q, {
1481
1481
  leftExpression: n,
1482
1482
  op: i,
1483
- rightExpression: c.partialNode
1484
- }), new d(c.token, n, c.handlerContext)) : c;
1483
+ rightExpression: u.partialNode
1484
+ }), new d(u.token, n, u.handlerContext)) : u;
1485
1485
  }
1486
1486
  }
1487
1487
  } else
@@ -1491,10 +1491,10 @@ class hn {
1491
1491
  }
1492
1492
  leftExpression_bp() {
1493
1493
  let e;
1494
- if (rt(this.peek())) {
1494
+ if (at(this.peek())) {
1495
1495
  const n = {};
1496
1496
  n.op = this.peek();
1497
- const s = En(n.op);
1497
+ const s = mn(n.op);
1498
1498
  if (s.right === null)
1499
1499
  throw this.logError(
1500
1500
  n.op,
@@ -1530,12 +1530,12 @@ class hn {
1530
1530
  // e.g { ... }
1531
1531
  extractOperand() {
1532
1532
  return this.check(
1533
- u.NUMERIC_LITERAL,
1534
- u.STRING_LITERAL,
1535
- u.COLOR_LITERAL,
1536
- u.QUOTED_STRING,
1537
- u.IDENTIFIER
1538
- ) ? 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(
1533
+ l.NUMERIC_LITERAL,
1534
+ l.STRING_LITERAL,
1535
+ l.COLOR_LITERAL,
1536
+ l.QUOTED_STRING,
1537
+ l.IDENTIFIER
1538
+ ) ? this.primaryExpression() : this.check(l.FUNCTION_EXPRESSION) ? this.functionExpression() : this.check(l.LBRACKET) ? this.listExpression() : this.check(l.LBRACE) ? this.blockExpression() : this.check(l.LPAREN) ? this.tupleExpression() : (this.peek().kind === l.EOF ? this.logError(
1539
1539
  this.peek(),
1540
1540
  o.UNEXPECTED_EOF,
1541
1541
  "Unexpected EOF"
@@ -1549,7 +1549,7 @@ class hn {
1549
1549
  functionExpression() {
1550
1550
  const e = {};
1551
1551
  try {
1552
- this.consume("Expect a function expression", u.FUNCTION_EXPRESSION), e.value = this.previous();
1552
+ this.consume("Expect a function expression", l.FUNCTION_EXPRESSION), e.value = this.previous();
1553
1553
  } catch (n) {
1554
1554
  throw n instanceof d ? (e.value = n.partialNode, new d(
1555
1555
  n.token,
@@ -1560,19 +1560,19 @@ class hn {
1560
1560
  return this.nodeFactory.create(te, e);
1561
1561
  }
1562
1562
  canBeField() {
1563
- return this.peek().kind === u.IDENTIFIER && this.peek(1).kind === u.COLON;
1563
+ return this.peek().kind === l.IDENTIFIER && this.peek(1).kind === l.COLON;
1564
1564
  }
1565
1565
  /* Parsing PrimaryExpression */
1566
1566
  primaryExpression() {
1567
1567
  if (this.match(
1568
- u.COLOR_LITERAL,
1569
- u.STRING_LITERAL,
1570
- u.NUMERIC_LITERAL
1568
+ l.COLOR_LITERAL,
1569
+ l.STRING_LITERAL,
1570
+ l.NUMERIC_LITERAL
1571
1571
  ))
1572
1572
  return this.nodeFactory.create(U, {
1573
1573
  expression: this.nodeFactory.create(be, { literal: this.previous() })
1574
1574
  });
1575
- if (this.match(u.QUOTED_STRING, u.IDENTIFIER))
1575
+ if (this.match(l.QUOTED_STRING, l.IDENTIFIER))
1576
1576
  return this.nodeFactory.create(U, {
1577
1577
  expression: this.nodeFactory.create(Z, { variable: this.previous() })
1578
1578
  });
@@ -1584,7 +1584,7 @@ class hn {
1584
1584
  }
1585
1585
  attribute() {
1586
1586
  const e = {};
1587
- if (this.check(u.COLON, u.RBRACKET, u.COMMA)) {
1587
+ if (this.check(l.COLON, l.RBRACKET, l.COMMA)) {
1588
1588
  const n = this.peek();
1589
1589
  this.logError(
1590
1590
  n,
@@ -1605,12 +1605,12 @@ class hn {
1605
1605
  );
1606
1606
  this.synchronizeAttributeName();
1607
1607
  }
1608
- return this.match(u.COLON) && (e.colon = this.previous(), e.value = this.attributeValue()), this.nodeFactory.create(se, e);
1608
+ return this.match(l.COLON) && (e.colon = this.previous(), e.value = this.attributeValue()), this.nodeFactory.create(se, e);
1609
1609
  }
1610
1610
  attributeValue() {
1611
1611
  let e;
1612
1612
  try {
1613
- e = this.peek().kind === u.IDENTIFIER && this.peek(1).kind === u.IDENTIFIER ? this.attributeName() : this.normalExpression();
1613
+ e = this.peek().kind === l.IDENTIFIER && this.peek(1).kind === l.IDENTIFIER ? this.attributeName() : this.normalExpression();
1614
1614
  } catch (n) {
1615
1615
  if (!(n instanceof d) || !this.canHandle(n))
1616
1616
  throw n;
@@ -1620,11 +1620,11 @@ class hn {
1620
1620
  }
1621
1621
  attributeName() {
1622
1622
  const e = [];
1623
- if (this.peek().kind !== u.IDENTIFIER)
1623
+ if (this.peek().kind !== l.IDENTIFIER)
1624
1624
  return this.primaryExpression();
1625
- for (; !this.isAtEnd() && !this.check(u.COLON, u.COMMA, u.RBRACKET); )
1625
+ for (; !this.isAtEnd() && !this.check(l.COLON, l.COMMA, l.RBRACKET); )
1626
1626
  try {
1627
- this.consume("Expect an identifier", u.IDENTIFIER), e.push(this.previous());
1627
+ this.consume("Expect an identifier", l.IDENTIFIER), e.push(this.previous());
1628
1628
  } catch (n) {
1629
1629
  throw n instanceof d ? new d(
1630
1630
  n.token,
@@ -1635,10 +1635,10 @@ class hn {
1635
1635
  return this.nodeFactory.create($, { identifiers: e });
1636
1636
  }
1637
1637
  logError(e, n, s) {
1638
- this.errors.push(new l(n, s, e));
1638
+ this.errors.push(new c(n, s, e));
1639
1639
  }
1640
1640
  }
1641
- const fn = {
1641
+ const dn = {
1642
1642
  "+": { left: 9, right: 10 },
1643
1643
  "*": { left: 11, right: 12 },
1644
1644
  "-": { left: 9, right: 10 },
@@ -1654,10 +1654,10 @@ const fn = {
1654
1654
  "!=": { left: 4, right: 5 },
1655
1655
  ".": { left: 16, right: 17 }
1656
1656
  };
1657
- function pn(t) {
1658
- return fn[t.value] || { left: null, right: null };
1657
+ function En(t) {
1658
+ return dn[t.value] || { left: null, right: null };
1659
1659
  }
1660
- const dn = {
1660
+ const Nn = {
1661
1661
  "+": { left: null, right: 15 },
1662
1662
  "-": { left: null, right: 15 },
1663
1663
  "<": { left: null, right: 15 },
@@ -1665,14 +1665,14 @@ const dn = {
1665
1665
  "<>": { left: null, right: 15 },
1666
1666
  "!": { left: null, right: 15 }
1667
1667
  };
1668
- function En(t) {
1669
- return dn[t.value] || { left: null, right: null };
1668
+ function mn(t) {
1669
+ return Nn[t.value] || { left: null, right: null };
1670
1670
  }
1671
- const Nn = {
1671
+ const Tn = {
1672
1672
  "(": { left: 14, right: null }
1673
1673
  };
1674
- function lt(t) {
1675
- return Nn[t.value] || { left: null, right: null };
1674
+ function ut(t) {
1675
+ return Tn[t.value] || { left: null, right: null };
1676
1676
  }
1677
1677
  var b = /* @__PURE__ */ ((t) => (t.Table = "table", t.Enum = "enum", t.Ref = "ref", t.Note = "note", t.Project = "project", t.Indexes = "indexes", t.TableGroup = "tablegroup", t))(b || {});
1678
1678
  function ve(t) {
@@ -1722,7 +1722,7 @@ function _e(t) {
1722
1722
  let s;
1723
1723
  if (!M(I.last(e))) {
1724
1724
  const i = e.pop();
1725
- if (kt(i))
1725
+ if (xt(i))
1726
1726
  s = i.elementList.map(
1727
1727
  (r) => V(r).unwrap()
1728
1728
  );
@@ -1744,9 +1744,9 @@ function X(t) {
1744
1744
  return M(t) ? new S(t.expression.variable.value) : new w();
1745
1745
  }
1746
1746
  function Xe(t) {
1747
- if (ut(t))
1747
+ if (ht(t))
1748
1748
  return t instanceof te ? new S({ functional: [t], nonFunctional: [] }) : new S({ functional: [], nonFunctional: [t] });
1749
- if (t instanceof J && t.elementList.every(ut)) {
1749
+ if (t instanceof J && t.elementList.every(ht)) {
1750
1750
  const e = t.elementList.filter(
1751
1751
  (s) => s instanceof te
1752
1752
  ), n = t.elementList.filter(M);
@@ -1762,35 +1762,35 @@ function V(t) {
1762
1762
  function z(t) {
1763
1763
  return j(t) ? t.expression instanceof Z ? new S(t.expression.variable.value) : new S(t.expression.literal.value) : new w();
1764
1764
  }
1765
- function mn(t) {
1765
+ function bn(t) {
1766
1766
  var e;
1767
- return !(t instanceof q) || !yt((e = t.op) == null ? void 0 : e.value) ? !1 : _e(t.leftExpression).and_then(() => _e(t.rightExpression)).unwrap_or(void 0) !== void 0;
1767
+ return !(t instanceof q) || !kt((e = t.op) == null ? void 0 : e.value) ? !1 : _e(t.leftExpression).and_then(() => _e(t.rightExpression)).unwrap_or(void 0) !== void 0;
1768
1768
  }
1769
- function Tn(t) {
1769
+ function In(t) {
1770
1770
  const e = _e(t.leftExpression), n = _e(t.rightExpression);
1771
1771
  if (!e.isOk() || !n.isOk())
1772
1772
  return !1;
1773
1773
  const { tupleElements: s } = e.unwrap(), { tupleElements: i } = n.unwrap();
1774
1774
  return (s == null ? void 0 : s.length) === (i == null ? void 0 : i.length);
1775
1775
  }
1776
- function ut(t) {
1776
+ function ht(t) {
1777
1777
  return t instanceof U && t.expression instanceof Z || t instanceof te;
1778
1778
  }
1779
- function bn(t, e) {
1780
- var i, r, a, c;
1779
+ function Ln(t, e) {
1780
+ var i, r, a, u;
1781
1781
  let n = e;
1782
- const s = Qt(t);
1782
+ const s = Ht(t);
1783
1783
  for (; n; ) {
1784
1784
  if ((r = (i = n.symbol) == null ? void 0 : i.symbolTable) != null && r.has(t))
1785
1785
  return (a = n.symbol.symbolTable) == null ? void 0 : a.get(t);
1786
- if (((c = n.symbol) == null ? void 0 : c.declaration) instanceof G && s)
1786
+ if (((u = n.symbol) == null ? void 0 : u.declaration) instanceof G && s)
1787
1787
  return n.symbol;
1788
1788
  if (n instanceof G)
1789
1789
  return;
1790
1790
  n = n.parent;
1791
1791
  }
1792
1792
  }
1793
- class In {
1793
+ class gn {
1794
1794
  constructor(e, n, s) {
1795
1795
  this.declarationNode = e, this.publicSymbolTable = n, this.symbolFactory = s;
1796
1796
  }
@@ -1798,24 +1798,24 @@ class In {
1798
1798
  return [...this.validateContext(), ...this.validateName(this.declarationNode.name), ...this.validateAlias(this.declarationNode.alias), ...this.validateSettingList(this.declarationNode.attributeList), ...this.validateBody(this.declarationNode.body)];
1799
1799
  }
1800
1800
  validateContext() {
1801
- return this.declarationNode.parent instanceof G || ve(this.declarationNode.parent).unwrap_or(void 0) !== b.Project ? [new l(o.INVALID_CUSTOM_CONTEXT, "A custom element can only appear in a Project", this.declarationNode)] : [];
1801
+ return this.declarationNode.parent instanceof G || ve(this.declarationNode.parent).unwrap_or(void 0) !== b.Project ? [new c(o.INVALID_CUSTOM_CONTEXT, "A custom element can only appear in a Project", this.declarationNode)] : [];
1802
1802
  }
1803
1803
  validateName(e) {
1804
- return e ? [new l(o.UNEXPECTED_NAME, "A Custom element shouldn't have a name", e)] : [];
1804
+ return e ? [new c(o.UNEXPECTED_NAME, "A Custom element shouldn't have a name", e)] : [];
1805
1805
  }
1806
1806
  validateAlias(e) {
1807
- return e ? [new l(o.UNEXPECTED_NAME, "A Custom element shouldn't have an alias", e)] : [];
1807
+ return e ? [new c(o.UNEXPECTED_NAME, "A Custom element shouldn't have an alias", e)] : [];
1808
1808
  }
1809
1809
  validateSettingList(e) {
1810
- return e ? [new l(o.UNEXPECTED_SETTINGS, "A Custom element shouldn't have a setting list", e)] : [];
1810
+ return e ? [new c(o.UNEXPECTED_SETTINGS, "A Custom element shouldn't have a setting list", e)] : [];
1811
1811
  }
1812
1812
  validateBody(e) {
1813
1813
  if (!e)
1814
1814
  return [];
1815
1815
  if (e instanceof ne)
1816
- return [new l(o.UNEXPECTED_COMPLEX_BODY, "A Custom element can only have an inline field", e)];
1816
+ return [new c(o.UNEXPECTED_COMPLEX_BODY, "A Custom element can only have an inline field", e)];
1817
1817
  const n = [];
1818
- return j(e.callee) || n.push(new l(o.INVALID_CUSTOM_ELEMENT_VALUE, "A Custom element value can only be a string", e)), e.args.length > 0 && n.push(...e.args.map((s) => new l(o.INVALID_CUSTOM_ELEMENT_VALUE, "A Custom element value can only be a string", s))), n;
1818
+ return j(e.callee) || n.push(new c(o.INVALID_CUSTOM_ELEMENT_VALUE, "A Custom element value can only be a string", e)), e.args.length > 0 && n.push(...e.args.map((s) => new c(o.INVALID_CUSTOM_ELEMENT_VALUE, "A Custom element value can only be a string", s))), n;
1819
1819
  }
1820
1820
  }
1821
1821
  class we {
@@ -1835,7 +1835,7 @@ class we {
1835
1835
  return this.table.entries();
1836
1836
  }
1837
1837
  }
1838
- class Ln {
1838
+ class _n {
1839
1839
  constructor(e, n, s) {
1840
1840
  this.declarationNode = e, this.publicSymbolTable = n, this.symbolFactory = s;
1841
1841
  }
@@ -1843,26 +1843,26 @@ class Ln {
1843
1843
  return [...this.validateContext(), ...this.validateName(this.declarationNode.name), ...this.validateAlias(this.declarationNode.alias), ...this.validateSettingList(this.declarationNode.attributeList), ...this.registerElement(), ...this.validateBody(this.declarationNode.body)];
1844
1844
  }
1845
1845
  validateContext() {
1846
- return this.declarationNode.parent instanceof A ? [new l(o.INVALID_PROJECT_CONTEXT, "An Enum can only appear top-level", this.declarationNode)] : [];
1846
+ return this.declarationNode.parent instanceof A ? [new c(o.INVALID_PROJECT_CONTEXT, "An Enum can only appear top-level", this.declarationNode)] : [];
1847
1847
  }
1848
1848
  validateName(e) {
1849
- return e ? wt(e) ? [] : [new l(o.INVALID_NAME, "An Enum name must be of the form <enum> or <schema>.<enum>", e)] : [new l(o.NAME_NOT_FOUND, "An Enum must have a name", this.declarationNode)];
1849
+ return e ? yt(e) ? [] : [new c(o.INVALID_NAME, "An Enum name must be of the form <enum> or <schema>.<enum>", e)] : [new c(o.NAME_NOT_FOUND, "An Enum must have a name", this.declarationNode)];
1850
1850
  }
1851
1851
  validateAlias(e) {
1852
- return e ? [new l(o.UNEXPECTED_ALIAS, "A Ref shouldn't have an alias", e)] : [];
1852
+ return e ? [new c(o.UNEXPECTED_ALIAS, "A Ref shouldn't have an alias", e)] : [];
1853
1853
  }
1854
1854
  registerElement() {
1855
1855
  const e = [];
1856
- this.declarationNode.symbol = this.symbolFactory.create(Zt, { declaration: this.declarationNode, symbolTable: new we() });
1856
+ this.declarationNode.symbol = this.symbolFactory.create(en, { declaration: this.declarationNode, symbolTable: new we() });
1857
1857
  const { name: n } = this.declarationNode, s = C(n);
1858
1858
  if (s.isOk()) {
1859
- const i = s.unwrap(), r = i.pop(), a = Ze(i, this.publicSymbolTable, this.symbolFactory), c = ze(r);
1860
- a.has(c) && e.push(new l(o.DUPLICATE_NAME, `Enum name ${r} already exists in schema '${i.join(".") || "public"}'`, n)), a.set(c, this.declarationNode.symbol);
1859
+ const i = s.unwrap(), r = i.pop(), a = Ze(i, this.publicSymbolTable, this.symbolFactory), u = ze(r);
1860
+ a.has(u) && e.push(new c(o.DUPLICATE_NAME, `Enum name ${r} already exists in schema '${i.join(".") || "public"}'`, n)), a.set(u, this.declarationNode.symbol);
1861
1861
  }
1862
1862
  return e;
1863
1863
  }
1864
1864
  validateSettingList(e) {
1865
- return e ? [new l(o.UNEXPECTED_SETTINGS, "An Enum shouldn't have a setting list", e)] : [];
1865
+ return e ? [new c(o.UNEXPECTED_SETTINGS, "An Enum shouldn't have a setting list", e)] : [];
1866
1866
  }
1867
1867
  validateBody(e) {
1868
1868
  if (!e)
@@ -1873,11 +1873,11 @@ class Ln {
1873
1873
  return [...this.validateFields(n), ...this.validateSubElements(s)];
1874
1874
  }
1875
1875
  validateFields(e) {
1876
- return e.length === 0 ? [new l(o.EMPTY_ENUM, "An Enum must have at least one element", this.declarationNode)] : e.flatMap((n) => {
1876
+ return e.length === 0 ? [new c(o.EMPTY_ENUM, "An Enum must have at least one element", this.declarationNode)] : e.flatMap((n) => {
1877
1877
  const s = [];
1878
- n.callee && !M(n.callee) && s.push(new l(o.INVALID_ENUM_ELEMENT_NAME, "An enum field must be an identifier or a quoted identifier", n.callee));
1878
+ n.callee && !M(n.callee) && s.push(new c(o.INVALID_ENUM_ELEMENT_NAME, "An enum field must be an identifier or a quoted identifier", n.callee));
1879
1879
  const i = [...n.args];
1880
- return I.last(i) instanceof D ? (s.push(...this.validateFieldSettings(I.last(i))), i.pop()) : i[0] instanceof D && (s.push(...this.validateFieldSettings(i[0])), i.shift()), i.length > 0 && s.push(...i.map((r) => new l(o.INVALID_ENUM_ELEMENT, "An Enum must have only a field and optionally a setting list", r))), s.push(...this.registerField(n)), s;
1880
+ return I.last(i) instanceof D ? (s.push(...this.validateFieldSettings(I.last(i))), i.pop()) : i[0] instanceof D && (s.push(...this.validateFieldSettings(i[0])), i.shift()), i.length > 0 && s.push(...i.map((r) => new c(o.INVALID_ENUM_ELEMENT, "An Enum must have only a field and optionally a setting list", r))), s.push(...this.registerField(n)), s;
1881
1881
  });
1882
1882
  }
1883
1883
  validateFieldSettings(e) {
@@ -1886,12 +1886,12 @@ class Ln {
1886
1886
  const a = i[r];
1887
1887
  switch (r) {
1888
1888
  case "note":
1889
- a.length > 1 && a.forEach((c) => s.push(new l(o.DUPLICATE_ENUM_ELEMENT_SETTING, "'note' can only appear once", c))), a.forEach((c) => {
1890
- j(c.value) || s.push(new l(o.INVALID_ENUM_ELEMENT_SETTING, "'note' must be a string", c));
1889
+ a.length > 1 && a.forEach((u) => s.push(new c(o.DUPLICATE_ENUM_ELEMENT_SETTING, "'note' can only appear once", u))), a.forEach((u) => {
1890
+ j(u.value) || s.push(new c(o.INVALID_ENUM_ELEMENT_SETTING, "'note' must be a string", u));
1891
1891
  });
1892
1892
  break;
1893
1893
  default:
1894
- a.forEach((c) => s.push(new l(o.UNKNOWN_ENUM_ELEMENT_SETTING, `Unknown enum field setting '${r}'`, c)));
1894
+ a.forEach((u) => s.push(new c(o.UNKNOWN_ENUM_ELEMENT_SETTING, `Unknown enum field setting '${r}'`, u)));
1895
1895
  }
1896
1896
  }
1897
1897
  return s;
@@ -1906,14 +1906,14 @@ class Ln {
1906
1906
  }
1907
1907
  registerField(e) {
1908
1908
  if (e.callee && M(e.callee)) {
1909
- const n = V(e.callee).unwrap(), s = Qe(n), i = this.symbolFactory.create(Kt, { declaration: e });
1909
+ const n = V(e.callee).unwrap(), s = Qe(n), i = this.symbolFactory.create(tn, { declaration: e });
1910
1910
  e.symbol = i;
1911
1911
  const r = this.declarationNode.symbol.symbolTable;
1912
1912
  if (r.has(s)) {
1913
1913
  const a = r.get(s);
1914
1914
  return [
1915
- new l(o.DUPLICATE_COLUMN_NAME, `Duplicate enum field ${n}`, e),
1916
- new l(o.DUPLICATE_COLUMN_NAME, `Duplicate enum field ${n}`, a.declaration)
1915
+ new c(o.DUPLICATE_COLUMN_NAME, `Duplicate enum field ${n}`, e),
1916
+ new c(o.DUPLICATE_COLUMN_NAME, `Duplicate enum field ${n}`, a.declaration)
1917
1917
  ];
1918
1918
  }
1919
1919
  r.set(s, i);
@@ -1921,7 +1921,7 @@ class Ln {
1921
1921
  return [];
1922
1922
  }
1923
1923
  }
1924
- class gn {
1924
+ class An {
1925
1925
  constructor(e, n, s) {
1926
1926
  this.declarationNode = e, this.publicSymbolTable = n, this.symbolFactory = s;
1927
1927
  }
@@ -1929,22 +1929,22 @@ class gn {
1929
1929
  return [...this.validateContext(), ...this.validateName(this.declarationNode.name), ...this.validateAlias(this.declarationNode.alias), ...this.validateSettingList(this.declarationNode.attributeList), ...this.validateBody(this.declarationNode.body)];
1930
1930
  }
1931
1931
  validateContext() {
1932
- return this.declarationNode.parent instanceof G || ve(this.declarationNode.parent).unwrap_or(void 0) !== b.Table ? [new l(o.INVALID_NOTE_CONTEXT, "An Indexes can only appear inside a Table", this.declarationNode)] : [];
1932
+ return this.declarationNode.parent instanceof G || ve(this.declarationNode.parent).unwrap_or(void 0) !== b.Table ? [new c(o.INVALID_NOTE_CONTEXT, "An Indexes can only appear inside a Table", this.declarationNode)] : [];
1933
1933
  }
1934
1934
  validateName(e) {
1935
- return e ? [new l(o.UNEXPECTED_NAME, "An Indexes shouldn't have a name", e)] : [];
1935
+ return e ? [new c(o.UNEXPECTED_NAME, "An Indexes shouldn't have a name", e)] : [];
1936
1936
  }
1937
1937
  validateAlias(e) {
1938
- return e ? [new l(o.UNEXPECTED_ALIAS, "An Indexes shouldn't have an alias", e)] : [];
1938
+ return e ? [new c(o.UNEXPECTED_ALIAS, "An Indexes shouldn't have an alias", e)] : [];
1939
1939
  }
1940
1940
  validateSettingList(e) {
1941
- return e ? [new l(o.UNEXPECTED_SETTINGS, "An Indexes shouldn't have a setting list", e)] : [];
1941
+ return e ? [new c(o.UNEXPECTED_SETTINGS, "An Indexes shouldn't have a setting list", e)] : [];
1942
1942
  }
1943
1943
  validateBody(e) {
1944
1944
  if (!e)
1945
1945
  return [];
1946
1946
  if (e instanceof y)
1947
- return [new l(o.UNEXPECTED_SIMPLE_BODY, "An Indexes must have a complex body", e)];
1947
+ return [new c(o.UNEXPECTED_SIMPLE_BODY, "An Indexes must have a complex body", e)];
1948
1948
  const [n, s] = I.partition(e.body, (i) => i instanceof y);
1949
1949
  return [...this.validateFields(n), ...this.validateSubElements(s)];
1950
1950
  }
@@ -1955,8 +1955,8 @@ class gn {
1955
1955
  const s = [], i = [n.callee, ...n.args];
1956
1956
  return I.last(i) instanceof D && s.push(...this.validateFieldSetting(i.pop())), i.forEach((r) => {
1957
1957
  for (; r instanceof H; )
1958
- r.argumentList && !Xe(r.argumentList).isOk() && s.push(new l(o.INVALID_INDEXES_FIELD, "An index field must be an identifier, a quoted identifier, a functional expression or a tuple of such", r.argumentList)), r = r.callee;
1959
- Xe(r).isOk() || s.push(new l(o.INVALID_INDEXES_FIELD, "An index field must be an identifier, a quoted identifier, a functional expression or a tuple of such", r));
1958
+ r.argumentList && !Xe(r.argumentList).isOk() && s.push(new c(o.INVALID_INDEXES_FIELD, "An index field must be an identifier, a quoted identifier, a functional expression or a tuple of such", r.argumentList)), r = r.callee;
1959
+ Xe(r).isOk() || s.push(new c(o.INVALID_INDEXES_FIELD, "An index field must be an identifier, a quoted identifier, a functional expression or a tuple of such", r));
1960
1960
  }), s;
1961
1961
  });
1962
1962
  }
@@ -1967,23 +1967,23 @@ class gn {
1967
1967
  switch (r) {
1968
1968
  case "note":
1969
1969
  case "name":
1970
- a.length > 1 && a.forEach((c) => s.push(new l(o.DUPLICATE_INDEX_SETTING, `'${r}' can only appear once`, c))), a.forEach((c) => {
1971
- j(c.value) || s.push(new l(o.INVALID_INDEX_SETTING_VALUE, `'${r}' must be a string`, c));
1970
+ a.length > 1 && a.forEach((u) => s.push(new c(o.DUPLICATE_INDEX_SETTING, `'${r}' can only appear once`, u))), a.forEach((u) => {
1971
+ j(u.value) || s.push(new c(o.INVALID_INDEX_SETTING_VALUE, `'${r}' must be a string`, u));
1972
1972
  });
1973
1973
  break;
1974
1974
  case "unique":
1975
1975
  case "pk":
1976
- a.length > 1 && a.forEach((c) => s.push(new l(o.DUPLICATE_INDEX_SETTING, `'${r}' can only appear once`, c))), a.forEach((c) => {
1977
- le(c.value) || s.push(new l(o.INVALID_INDEX_SETTING_VALUE, `'${r}' must not have a value`, c));
1976
+ a.length > 1 && a.forEach((u) => s.push(new c(o.DUPLICATE_INDEX_SETTING, `'${r}' can only appear once`, u))), a.forEach((u) => {
1977
+ le(u.value) || s.push(new c(o.INVALID_INDEX_SETTING_VALUE, `'${r}' must not have a value`, u));
1978
1978
  });
1979
1979
  break;
1980
1980
  case "type":
1981
- a.length > 1 && a.forEach((c) => s.push(new l(o.DUPLICATE_INDEX_SETTING, "'type' can only appear once", c))), a.forEach((c) => {
1982
- M(c.value) || s.push(new l(o.INVALID_INDEX_SETTING_VALUE, `'type' must be "btree" or "hash"`, c));
1981
+ a.length > 1 && a.forEach((u) => s.push(new c(o.DUPLICATE_INDEX_SETTING, "'type' can only appear once", u))), a.forEach((u) => {
1982
+ M(u.value) || s.push(new c(o.INVALID_INDEX_SETTING_VALUE, `'type' must be "btree" or "hash"`, u));
1983
1983
  });
1984
1984
  break;
1985
1985
  default:
1986
- a.forEach((c) => s.push(new l(o.UNKNOWN_INDEX_SETTING, `Unknown index setting '${r}'`, c)));
1986
+ a.forEach((u) => s.push(new c(o.UNKNOWN_INDEX_SETTING, `Unknown index setting '${r}'`, u)));
1987
1987
  }
1988
1988
  }
1989
1989
  return s;
@@ -1997,7 +1997,7 @@ class gn {
1997
1997
  });
1998
1998
  }
1999
1999
  }
2000
- class _n {
2000
+ class vn {
2001
2001
  constructor(e, n, s) {
2002
2002
  this.declarationNode = e, this.publicSymbolTable = n, this.symbolFactory = s;
2003
2003
  }
@@ -2005,24 +2005,24 @@ class _n {
2005
2005
  return [...this.validateContext(), ...this.validateName(this.declarationNode.name), ...this.validateAlias(this.declarationNode.alias), ...this.validateSettingList(this.declarationNode.attributeList), ...this.validateBody(this.declarationNode.body)];
2006
2006
  }
2007
2007
  validateContext() {
2008
- return !(this.declarationNode.parent instanceof G) && ![b.Table, b.Project].includes(ve(this.declarationNode.parent).unwrap_or(void 0)) ? [new l(o.INVALID_NOTE_CONTEXT, "A Note can only appear inside a Table or a Project. Sticky note can only appear at the global scope.", this.declarationNode)] : [];
2008
+ return !(this.declarationNode.parent instanceof G) && ![b.Table, b.Project].includes(ve(this.declarationNode.parent).unwrap_or(void 0)) ? [new c(o.INVALID_NOTE_CONTEXT, "A Note can only appear inside a Table or a Project. Sticky note can only appear at the global scope.", this.declarationNode)] : [];
2009
2009
  }
2010
2010
  validateName(e) {
2011
2011
  if (!(this.declarationNode.parent instanceof G))
2012
- return e ? [new l(o.UNEXPECTED_NAME, "A Note shouldn't have a name", e)] : [];
2012
+ return e ? [new c(o.UNEXPECTED_NAME, "A Note shouldn't have a name", e)] : [];
2013
2013
  if (!e)
2014
- return [new l(o.INVALID_NAME, "Sticky note must have a name", this.declarationNode)];
2014
+ return [new c(o.INVALID_NAME, "Sticky note must have a name", this.declarationNode)];
2015
2015
  const n = C(e);
2016
2016
  if (!n.isOk())
2017
- return [new l(o.INVALID_NAME, "Invalid name for sticky note ", this.declarationNode)];
2018
- const i = n.unwrap().join("."), r = zt(i);
2019
- return this.publicSymbolTable.has(r) ? [new l(o.DUPLICATE_NAME, `Sticky note "${i}" has already been defined`, e)] : (this.publicSymbolTable.set(r, this.declarationNode.symbol), []);
2017
+ return [new c(o.INVALID_NAME, "Invalid name for sticky note ", this.declarationNode)];
2018
+ const i = n.unwrap().join("."), r = qt(i);
2019
+ return this.publicSymbolTable.has(r) ? [new c(o.DUPLICATE_NAME, `Sticky note "${i}" has already been defined`, e)] : (this.publicSymbolTable.set(r, this.declarationNode.symbol), []);
2020
2020
  }
2021
2021
  validateAlias(e) {
2022
- return e ? [new l(o.UNEXPECTED_ALIAS, "A Ref shouldn't have an alias", e)] : [];
2022
+ return e ? [new c(o.UNEXPECTED_ALIAS, "A Ref shouldn't have an alias", e)] : [];
2023
2023
  }
2024
2024
  validateSettingList(e) {
2025
- return e ? [new l(o.UNEXPECTED_SETTINGS, "A Note shouldn't have a setting list", e)] : [];
2025
+ return e ? [new c(o.UNEXPECTED_SETTINGS, "A Note shouldn't have a setting list", e)] : [];
2026
2026
  }
2027
2027
  validateBody(e) {
2028
2028
  if (!e)
@@ -2034,7 +2034,7 @@ class _n {
2034
2034
  }
2035
2035
  validateFields(e) {
2036
2036
  const n = [];
2037
- return e.length === 0 ? [new l(o.EMPTY_NOTE, "A Note must have a content", this.declarationNode)] : (e.length > 1 && e.slice(1).forEach((s) => n.push(new l(o.NOTE_CONTENT_REDEFINED, "A Note can only contain one string", s))), j(e[0].callee) || n.push(new l(o.INVALID_NOTE, "A Note content must be a quoted string", e[0])), e[0].args.length > 0 && n.push(...e[0].args.map((s) => new l(o.INVALID_NOTE, "A Note can only contain one quoted string", s))), n);
2037
+ return e.length === 0 ? [new c(o.EMPTY_NOTE, "A Note must have a content", this.declarationNode)] : (e.length > 1 && e.slice(1).forEach((s) => n.push(new c(o.NOTE_CONTENT_REDEFINED, "A Note can only contain one string", s))), j(e[0].callee) || n.push(new c(o.INVALID_NOTE, "A Note content must be a quoted string", e[0])), e[0].args.length > 0 && n.push(...e[0].args.map((s) => new c(o.INVALID_NOTE, "A Note can only contain one quoted string", s))), n);
2038
2038
  }
2039
2039
  validateSubElements(e) {
2040
2040
  return e.flatMap((n) => {
@@ -2045,7 +2045,7 @@ class _n {
2045
2045
  });
2046
2046
  }
2047
2047
  }
2048
- class An {
2048
+ class wn {
2049
2049
  constructor(e, n, s) {
2050
2050
  this.declarationNode = e, this.publicSymbolTable = n, this.symbolFactory = s;
2051
2051
  }
@@ -2053,25 +2053,25 @@ class An {
2053
2053
  return [...this.validateContext(), ...this.validateName(this.declarationNode.name), ...this.validateAlias(this.declarationNode.alias), ...this.validateSettingList(this.declarationNode.attributeList), ...this.validateBody(this.declarationNode.body)];
2054
2054
  }
2055
2055
  validateContext() {
2056
- return this.declarationNode.parent instanceof A ? [new l(o.INVALID_PROJECT_CONTEXT, "A Project can only appear top-level", this.declarationNode)] : [];
2056
+ return this.declarationNode.parent instanceof A ? [new c(o.INVALID_PROJECT_CONTEXT, "A Project can only appear top-level", this.declarationNode)] : [];
2057
2057
  }
2058
2058
  validateName(e) {
2059
- return e ? ye(e) ? [] : [new l(o.INVALID_NAME, "A Project's name is optional or must be an identifier or a quoted identifer", e)] : [];
2059
+ return e ? ye(e) ? [] : [new c(o.INVALID_NAME, "A Project's name is optional or must be an identifier or a quoted identifer", e)] : [];
2060
2060
  }
2061
2061
  validateAlias(e) {
2062
- return e ? [new l(o.UNEXPECTED_ALIAS, "A Project shouldn't have an alias", e)] : [];
2062
+ return e ? [new c(o.UNEXPECTED_ALIAS, "A Project shouldn't have an alias", e)] : [];
2063
2063
  }
2064
2064
  validateSettingList(e) {
2065
- return e ? [new l(o.UNEXPECTED_SETTINGS, "A Project shouldn't have a setting list", e)] : [];
2065
+ return e ? [new c(o.UNEXPECTED_SETTINGS, "A Project shouldn't have a setting list", e)] : [];
2066
2066
  }
2067
2067
  validateBody(e) {
2068
2068
  if (!e)
2069
2069
  return [];
2070
2070
  if (e instanceof y)
2071
- return [new l(o.UNEXPECTED_SIMPLE_BODY, "A Project's body must be a block", e)];
2071
+ return [new c(o.UNEXPECTED_SIMPLE_BODY, "A Project's body must be a block", e)];
2072
2072
  const [n, s] = I.partition(e.body, (i) => i instanceof y);
2073
2073
  return [
2074
- ...n.map((i) => new l(o.INVALID_PROJECT_FIELD, "A Project can not have inline fields", i)),
2074
+ ...n.map((i) => new c(o.INVALID_PROJECT_FIELD, "A Project can not have inline fields", i)),
2075
2075
  ...this.validateSubElements(s)
2076
2076
  ];
2077
2077
  }
@@ -2084,7 +2084,7 @@ class An {
2084
2084
  });
2085
2085
  }
2086
2086
  }
2087
- class vn {
2087
+ class yn {
2088
2088
  constructor(e, n, s) {
2089
2089
  this.declarationNode = e, this.publicSymbolTable = n, this.symbolFactory = s;
2090
2090
  }
@@ -2092,16 +2092,16 @@ class vn {
2092
2092
  return [...this.validateContext(), ...this.validateName(this.declarationNode.name), ...this.validateAlias(this.declarationNode.alias), ...this.validateSettingList(this.declarationNode.attributeList), ...this.validateBody(this.declarationNode.body)];
2093
2093
  }
2094
2094
  validateContext() {
2095
- return this.declarationNode.parent instanceof G ? [] : [new l(o.INVALID_REF_CONTEXT, "A Ref must appear top-level", this.declarationNode)];
2095
+ return this.declarationNode.parent instanceof G ? [] : [new c(o.INVALID_REF_CONTEXT, "A Ref must appear top-level", this.declarationNode)];
2096
2096
  }
2097
2097
  validateName(e) {
2098
- return e ? ye(e) ? [] : [new l(o.INVALID_NAME, "A Ref's name is optional or must be an identifier or a quoted identifer", e)] : [];
2098
+ return e ? ye(e) ? [] : [new c(o.INVALID_NAME, "A Ref's name is optional or must be an identifier or a quoted identifer", e)] : [];
2099
2099
  }
2100
2100
  validateAlias(e) {
2101
- return e ? [new l(o.UNEXPECTED_ALIAS, "A Ref shouldn't have an alias", e)] : [];
2101
+ return e ? [new c(o.UNEXPECTED_ALIAS, "A Ref shouldn't have an alias", e)] : [];
2102
2102
  }
2103
2103
  validateSettingList(e) {
2104
- return e ? [new l(o.UNEXPECTED_SETTINGS, "A Ref shouldn't have a setting list", e)] : [];
2104
+ return e ? [new c(o.UNEXPECTED_SETTINGS, "A Ref shouldn't have a setting list", e)] : [];
2105
2105
  }
2106
2106
  validateBody(e) {
2107
2107
  if (!e)
@@ -2113,12 +2113,12 @@ class vn {
2113
2113
  }
2114
2114
  validateFields(e) {
2115
2115
  if (e.length === 0)
2116
- return [new l(o.EMPTY_REF, "A Ref must have at least one field", this.declarationNode)];
2116
+ return [new c(o.EMPTY_REF, "A Ref must have at least one field", this.declarationNode)];
2117
2117
  const n = [];
2118
- return e.length > 1 && n.push(...e.slice(1).map((s) => new l(o.REF_REDEFINED, "A Ref can only contain one binary relationship", s))), e.forEach((s) => {
2119
- s.callee && !mn(s.callee) && n.push(new l(o.INVALID_REF_FIELD, "A Ref field must be a binary relationship", s.callee)), s.callee && !Tn(s.callee) && n.push(new l(o.UNEQUAL_FIELDS_BINARY_REF, "Unequal fields in ref endpoints", s.callee));
2118
+ return e.length > 1 && n.push(...e.slice(1).map((s) => new c(o.REF_REDEFINED, "A Ref can only contain one binary relationship", s))), e.forEach((s) => {
2119
+ s.callee && !bn(s.callee) && n.push(new c(o.INVALID_REF_FIELD, "A Ref field must be a binary relationship", s.callee)), s.callee && !In(s.callee) && n.push(new c(o.UNEQUAL_FIELDS_BINARY_REF, "Unequal fields in ref endpoints", s.callee));
2120
2120
  const i = [...s.args];
2121
- I.last(i) instanceof D ? (this.validateFieldSettings(I.last(i)), i.pop()) : i[0] instanceof D && (n.push(...this.validateFieldSettings(i[0])), i.shift()), i.length > 0 && n.push(...i.map((r) => new l(o.INVALID_REF_FIELD, "A Ref field should only have a single binary relationship", r)));
2121
+ I.last(i) instanceof D ? (this.validateFieldSettings(I.last(i)), i.pop()) : i[0] instanceof D && (n.push(...this.validateFieldSettings(i[0])), i.shift()), i.length > 0 && n.push(...i.map((r) => new c(o.INVALID_REF_FIELD, "A Ref field should only have a single binary relationship", r)));
2122
2122
  }), n;
2123
2123
  }
2124
2124
  validateFieldSettings(e) {
@@ -2128,12 +2128,12 @@ class vn {
2128
2128
  switch (r) {
2129
2129
  case "delete":
2130
2130
  case "update":
2131
- a.length > 1 && a.forEach((c) => s.push(new l(o.DUPLICATE_REF_SETTING, `'${r}' can only appear once`, c))), a.forEach((c) => {
2132
- wn(c.value) || s.push(new l(o.INVALID_REF_SETTING_VALUE, `'${r}' can only have values "cascade", "no action", "set null", "set default" or "restrict"`, c));
2131
+ a.length > 1 && a.forEach((u) => s.push(new c(o.DUPLICATE_REF_SETTING, `'${r}' can only appear once`, u))), a.forEach((u) => {
2132
+ kn(u.value) || s.push(new c(o.INVALID_REF_SETTING_VALUE, `'${r}' can only have values "cascade", "no action", "set null", "set default" or "restrict"`, u));
2133
2133
  });
2134
2134
  break;
2135
2135
  default:
2136
- a.forEach((c) => s.push(new l(o.UNKNOWN_REF_SETTING, `Unknown ref setting '${r}'`, c)));
2136
+ a.forEach((u) => s.push(new c(o.UNKNOWN_REF_SETTING, `Unknown ref setting '${r}'`, u)));
2137
2137
  }
2138
2138
  }
2139
2139
  return s;
@@ -2147,8 +2147,8 @@ class vn {
2147
2147
  });
2148
2148
  }
2149
2149
  }
2150
- function wn(t) {
2151
- if (!(M(t) && t.expression.variable.kind !== u.QUOTED_STRING) && !(t instanceof $))
2150
+ function kn(t) {
2151
+ if (!(M(t) && t.expression.variable.kind !== l.QUOTED_STRING) && !(t instanceof $))
2152
2152
  return !1;
2153
2153
  let e;
2154
2154
  if (t instanceof $ ? e = Te(t).unwrap_or("") : e = t.expression.variable.value, e)
@@ -2164,7 +2164,7 @@ function wn(t) {
2164
2164
  }
2165
2165
  return !1;
2166
2166
  }
2167
- class yn {
2167
+ class xn {
2168
2168
  constructor(e, n, s) {
2169
2169
  this.declarationNode = e, this.symbolFactory = s, this.publicSymbolTable = n;
2170
2170
  }
@@ -2172,13 +2172,13 @@ class yn {
2172
2172
  return [...this.validateContext(), ...this.validateName(this.declarationNode.name), ...this.validateAlias(this.declarationNode.alias), ...this.validateSettingList(this.declarationNode.attributeList), ...this.registerElement(), ...this.validateBody(this.declarationNode.body)];
2173
2173
  }
2174
2174
  validateContext() {
2175
- return this.declarationNode.parent instanceof A ? [new l(o.INVALID_TABLE_CONTEXT, "Table must appear top-level", this.declarationNode)] : [];
2175
+ return this.declarationNode.parent instanceof A ? [new c(o.INVALID_TABLE_CONTEXT, "Table must appear top-level", this.declarationNode)] : [];
2176
2176
  }
2177
2177
  validateName(e) {
2178
- return e ? e instanceof ue ? [new l(o.INVALID_NAME, "Invalid array as Table name, maybe you forget to add a space between the name and the setting list?", e)] : wt(e) ? [] : [new l(o.INVALID_NAME, "A Table name must be of the form <table> or <schema>.<table>", e)] : [new l(o.NAME_NOT_FOUND, "A Table must have a name", this.declarationNode)];
2178
+ return e ? e instanceof ue ? [new c(o.INVALID_NAME, "Invalid array as Table name, maybe you forget to add a space between the name and the setting list?", e)] : yt(e) ? [] : [new c(o.INVALID_NAME, "A Table name must be of the form <table> or <schema>.<table>", e)] : [new c(o.NAME_NOT_FOUND, "A Table must have a name", this.declarationNode)];
2179
2179
  }
2180
2180
  validateAlias(e) {
2181
- return e ? On(e) ? [] : [new l(o.INVALID_ALIAS, "Table aliases can only contains alphanumeric and underscore unless surrounded by double quotes", e)] : [];
2181
+ return e ? Dn(e) ? [] : [new c(o.INVALID_ALIAS, "Table aliases can only contains alphanumeric and underscore unless surrounded by double quotes", e)] : [];
2182
2182
  }
2183
2183
  validateSettingList(e) {
2184
2184
  const n = W(e), s = n.getErrors(), i = n.getValue();
@@ -2186,32 +2186,32 @@ class yn {
2186
2186
  const a = i[r];
2187
2187
  switch (r) {
2188
2188
  case "headercolor":
2189
- a.length > 1 && s.push(...a.map((c) => new l(o.DUPLICATE_TABLE_SETTING, "'headercolor' can only appear once", c))), a.forEach((c) => {
2190
- Rn(c.value) || s.push(new l(o.INVALID_TABLE_SETTING, "'headercolor' must be a color literal", c.value || c.name));
2189
+ a.length > 1 && s.push(...a.map((u) => new c(o.DUPLICATE_TABLE_SETTING, "'headercolor' can only appear once", u))), a.forEach((u) => {
2190
+ Pn(u.value) || s.push(new c(o.INVALID_TABLE_SETTING, "'headercolor' must be a color literal", u.value || u.name));
2191
2191
  });
2192
2192
  break;
2193
2193
  case "note":
2194
- a.length > 1 && s.push(...a.map((c) => new l(o.DUPLICATE_TABLE_SETTING, "'note' can only appear once", c))), a.forEach((c) => {
2195
- j(c.value) || s.push(new l(o.INVALID_TABLE_SETTING, "'note' must be a string literal", c.value || c.name));
2194
+ a.length > 1 && s.push(...a.map((u) => new c(o.DUPLICATE_TABLE_SETTING, "'note' can only appear once", u))), a.forEach((u) => {
2195
+ j(u.value) || s.push(new c(o.INVALID_TABLE_SETTING, "'note' must be a string literal", u.value || u.name));
2196
2196
  });
2197
2197
  break;
2198
2198
  default:
2199
- s.push(...a.map((c) => new l(o.INVALID_TABLE_SETTING, `Unknown '${r}' setting`, c)));
2199
+ s.push(...a.map((u) => new c(o.INVALID_TABLE_SETTING, `Unknown '${r}' setting`, u)));
2200
2200
  }
2201
2201
  }
2202
2202
  return s;
2203
2203
  }
2204
2204
  registerElement() {
2205
2205
  const e = [];
2206
- this.declarationNode.symbol = this.symbolFactory.create(_t, { declaration: this.declarationNode, symbolTable: new we() });
2206
+ this.declarationNode.symbol = this.symbolFactory.create(At, { declaration: this.declarationNode, symbolTable: new we() });
2207
2207
  const { name: n, alias: s } = this.declarationNode, i = C(n);
2208
2208
  if (i.isOk()) {
2209
- const r = [...i.unwrap()], a = r.pop(), c = Ze(r, this.publicSymbolTable, this.symbolFactory), p = Oe(a);
2210
- c.has(p) && e.push(new l(o.DUPLICATE_NAME, `Table name '${a}' already exists in schema '${r.join(".") || "public"}'`, n)), c.set(p, this.declarationNode.symbol);
2209
+ const r = [...i.unwrap()], a = r.pop(), u = Ze(r, this.publicSymbolTable, this.symbolFactory), p = Oe(a);
2210
+ u.has(p) && e.push(new c(o.DUPLICATE_NAME, `Table name '${a}' already exists in schema '${r.join(".") || "public"}'`, n)), u.set(p, this.declarationNode.symbol);
2211
2211
  }
2212
- if (s && ye(s) && !xn(s.expression.variable.value, i.unwrap_or([]))) {
2212
+ if (s && ye(s) && !On(s.expression.variable.value, i.unwrap_or([]))) {
2213
2213
  const r = V(s).unwrap(), a = Oe(r);
2214
- this.publicSymbolTable.has(a) && e.push(new l(o.DUPLICATE_NAME, `Table name '${r}' already exists`, n)), this.publicSymbolTable.set(a, this.declarationNode.symbol);
2214
+ this.publicSymbolTable.has(a) && e.push(new c(o.DUPLICATE_NAME, `Table name '${r}' already exists`, n)), this.publicSymbolTable.set(a, this.declarationNode.symbol);
2215
2215
  }
2216
2216
  return e;
2217
2217
  }
@@ -2219,30 +2219,30 @@ class yn {
2219
2219
  if (!e)
2220
2220
  return [];
2221
2221
  if (e instanceof y)
2222
- return [new l(o.UNEXPECTED_SIMPLE_BODY, "A Table's body must be a block", e)];
2222
+ return [new c(o.UNEXPECTED_SIMPLE_BODY, "A Table's body must be a block", e)];
2223
2223
  const [n, s] = I.partition(e.body, (i) => i instanceof y);
2224
2224
  return [...this.validateFields(n), ...this.validateSubElements(s)];
2225
2225
  }
2226
2226
  validateFields(e) {
2227
- return e.length === 0 ? [new l(o.EMPTY_TABLE, "A Table must have at least one column", this.declarationNode)] : e.flatMap((n) => {
2227
+ return e.length === 0 ? [new c(o.EMPTY_TABLE, "A Table must have at least one column", this.declarationNode)] : e.flatMap((n) => {
2228
2228
  if (!n.callee)
2229
2229
  return [];
2230
2230
  const s = [];
2231
- n.args.length === 0 && s.push(new l(o.INVALID_COLUMN, "A column must have a type", n.callee)), M(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] && !kn(n.args[0]) && s.push(new l(o.INVALID_COLUMN_TYPE, "Invalid column type", n.args[0]));
2231
+ n.args.length === 0 && s.push(new c(o.INVALID_COLUMN, "A column must have a type", n.callee)), M(n.callee) || s.push(new c(o.INVALID_COLUMN_NAME, "A column name must be an identifier or a quoted identifier", n.callee)), n.args[0] && !Sn(n.args[0]) && s.push(new c(o.INVALID_COLUMN_TYPE, "Invalid column type", n.args[0]));
2232
2232
  const i = n.args.slice(1);
2233
2233
  return s.push(...this.validateFieldSetting(i)), s.push(...this.registerField(n)), s;
2234
2234
  });
2235
2235
  }
2236
2236
  registerField(e) {
2237
2237
  if (e.callee && M(e.callee)) {
2238
- const n = V(e.callee).unwrap(), s = Ye(n), i = this.symbolFactory.create(en, { declaration: e });
2238
+ const n = V(e.callee).unwrap(), s = Ye(n), i = this.symbolFactory.create(nn, { declaration: e });
2239
2239
  e.symbol = i;
2240
2240
  const r = this.declarationNode.symbol.symbolTable;
2241
2241
  if (r.has(s)) {
2242
2242
  const a = r.get(s);
2243
2243
  return [
2244
- new l(o.DUPLICATE_COLUMN_NAME, `Duplicate column ${n}`, e),
2245
- new l(o.DUPLICATE_COLUMN_NAME, `Duplicate column ${n}`, a.declaration)
2244
+ new c(o.DUPLICATE_COLUMN_NAME, `Duplicate column ${n}`, e),
2245
+ new c(o.DUPLICATE_COLUMN_NAME, `Duplicate column ${n}`, a.declaration)
2246
2246
  ];
2247
2247
  }
2248
2248
  r.set(s, i);
@@ -2252,74 +2252,74 @@ class yn {
2252
2252
  // This is needed to support legacy inline settings
2253
2253
  validateFieldSetting(e) {
2254
2254
  if (!e.slice(0, -1).every(me) || !e.slice(-1).every((p) => me(p) || p instanceof D))
2255
- return [...e.map((p) => new l(o.INVALID_COLUMN, "These fields must be some inline settings optionally ended with a setting list", p))];
2255
+ return [...e.map((p) => new c(o.INVALID_COLUMN, "These fields must be some inline settings optionally ended with a setting list", p))];
2256
2256
  if (e.length === 0)
2257
2257
  return [];
2258
2258
  let n;
2259
2259
  I.last(e) instanceof D && (n = e.pop());
2260
2260
  const s = W(n), i = s.getErrors(), r = s.getValue();
2261
2261
  for (const p of e) {
2262
- const h = V(p).unwrap_or("").toLowerCase();
2263
- if (h !== "pk" && h !== "unique") {
2264
- i.push(new l(o.INVALID_SETTINGS, "Inline column settings can only be `pk` or `unique`", p));
2262
+ const f = V(p).unwrap_or("").toLowerCase();
2263
+ if (f !== "pk" && f !== "unique") {
2264
+ i.push(new c(o.INVALID_SETTINGS, "Inline column settings can only be `pk` or `unique`", p));
2265
2265
  continue;
2266
2266
  }
2267
- r[h] === void 0 ? r[h] = [p] : r[h].push(p);
2267
+ r[f] === void 0 ? r[f] = [p] : r[f].push(p);
2268
2268
  }
2269
- const a = r.pk || [], c = r["primary key"] || [];
2270
- a.length >= 1 && c.length >= 1 && i.push(...[...a, ...c].map((p) => new l(o.DUPLICATE_COLUMN_SETTING, "Either one of 'primary key' and 'pk' can appear", p)));
2269
+ const a = r.pk || [], u = r["primary key"] || [];
2270
+ a.length >= 1 && u.length >= 1 && i.push(...[...a, ...u].map((p) => new c(o.DUPLICATE_COLUMN_SETTING, "Either one of 'primary key' and 'pk' can appear", p)));
2271
2271
  for (const p in r) {
2272
- const h = r[p];
2272
+ const f = r[p];
2273
2273
  switch (p) {
2274
2274
  case "note":
2275
- h.length > 1 && i.push(...h.map((f) => new l(o.DUPLICATE_COLUMN_SETTING, "note can only appear once", f))), h.forEach((f) => {
2276
- j(f.value) || i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'note' must be a quoted string", f.value || f.name));
2275
+ f.length > 1 && i.push(...f.map((h) => new c(o.DUPLICATE_COLUMN_SETTING, "note can only appear once", h))), f.forEach((h) => {
2276
+ j(h.value) || i.push(new c(o.INVALID_COLUMN_SETTING_VALUE, "'note' must be a quoted string", h.value || h.name));
2277
2277
  });
2278
2278
  break;
2279
2279
  case "ref":
2280
- h.forEach((f) => {
2281
- Pn(f.value) || i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'ref' must be a valid unary relationship", f.value || f.name));
2280
+ f.forEach((h) => {
2281
+ Mn(h.value) || i.push(new c(o.INVALID_COLUMN_SETTING_VALUE, "'ref' must be a valid unary relationship", h.value || h.name));
2282
2282
  });
2283
2283
  break;
2284
2284
  case "primary key":
2285
- h.length > 1 && i.push(...h.map((f) => new l(o.DUPLICATE_COLUMN_SETTING, "primary key can only appear once", f))), h.forEach((f) => {
2286
- le(f.value) || i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'primary key' must not have a value", f.value || f.name));
2285
+ f.length > 1 && i.push(...f.map((h) => new c(o.DUPLICATE_COLUMN_SETTING, "primary key can only appear once", h))), f.forEach((h) => {
2286
+ le(h.value) || i.push(new c(o.INVALID_COLUMN_SETTING_VALUE, "'primary key' must not have a value", h.value || h.name));
2287
2287
  });
2288
2288
  break;
2289
2289
  case "pk":
2290
- h.length > 1 && i.push(...h.map((f) => new l(o.DUPLICATE_COLUMN_SETTING, "'pk' can only appear once", f))), h.forEach((f) => {
2291
- f instanceof se && !le(f.value) && i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'pk' must not have a value", f.value || f.name));
2290
+ f.length > 1 && i.push(...f.map((h) => new c(o.DUPLICATE_COLUMN_SETTING, "'pk' can only appear once", h))), f.forEach((h) => {
2291
+ h instanceof se && !le(h.value) && i.push(new c(o.INVALID_COLUMN_SETTING_VALUE, "'pk' must not have a value", h.value || h.name));
2292
2292
  });
2293
2293
  break;
2294
2294
  case "not null":
2295
- h.length > 1 && i.push(...h.map((f) => new l(o.DUPLICATE_COLUMN_SETTING, "'not null' can only appear once", f)));
2296
- const T = r.null || [];
2297
- h.length >= 1 && T.length >= 1 && i.push(...[...h, ...T].map((f) => new l(o.CONFLICTING_SETTING, "'not null' and 'null' can not be set at the same time", f))), h.forEach((f) => {
2298
- le(f.value) || i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'not null' must not have a value", f.value || f.name));
2295
+ f.length > 1 && i.push(...f.map((h) => new c(o.DUPLICATE_COLUMN_SETTING, "'not null' can only appear once", h)));
2296
+ const E = r.null || [];
2297
+ f.length >= 1 && E.length >= 1 && i.push(...[...f, ...E].map((h) => new c(o.CONFLICTING_SETTING, "'not null' and 'null' can not be set at the same time", h))), f.forEach((h) => {
2298
+ le(h.value) || i.push(new c(o.INVALID_COLUMN_SETTING_VALUE, "'not null' must not have a value", h.value || h.name));
2299
2299
  });
2300
2300
  break;
2301
2301
  case "null":
2302
- h.length > 1 && i.push(...h.map((f) => new l(o.DUPLICATE_COLUMN_SETTING, "'null' can only appear once", f))), h.forEach((f) => {
2303
- le(f.value) || i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'null' must not have a value", f.value || f.name));
2302
+ f.length > 1 && i.push(...f.map((h) => new c(o.DUPLICATE_COLUMN_SETTING, "'null' can only appear once", h))), f.forEach((h) => {
2303
+ le(h.value) || i.push(new c(o.INVALID_COLUMN_SETTING_VALUE, "'null' must not have a value", h.value || h.name));
2304
2304
  });
2305
2305
  break;
2306
2306
  case "unique":
2307
- h.length > 1 && i.push(...h.map((f) => new l(o.DUPLICATE_COLUMN_SETTING, "'unique' can only appear once", f))), h.forEach((f) => {
2308
- f instanceof se && !le(f.value) && i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'unique' must not have a value", f.value || f.name));
2307
+ f.length > 1 && i.push(...f.map((h) => new c(o.DUPLICATE_COLUMN_SETTING, "'unique' can only appear once", h))), f.forEach((h) => {
2308
+ h instanceof se && !le(h.value) && i.push(new c(o.INVALID_COLUMN_SETTING_VALUE, "'unique' must not have a value", h.value || h.name));
2309
2309
  });
2310
2310
  break;
2311
2311
  case "increment":
2312
- h.length > 1 && i.push(...h.map((f) => new l(o.DUPLICATE_COLUMN_SETTING, "'increment' can only appear once", f))), h.forEach((f) => {
2313
- f instanceof se && !le(f.value) && i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'increment' must not have a value", f.value || f.name));
2312
+ f.length > 1 && i.push(...f.map((h) => new c(o.DUPLICATE_COLUMN_SETTING, "'increment' can only appear once", h))), f.forEach((h) => {
2313
+ h instanceof se && !le(h.value) && i.push(new c(o.INVALID_COLUMN_SETTING_VALUE, "'increment' must not have a value", h.value || h.name));
2314
2314
  });
2315
2315
  break;
2316
2316
  case "default":
2317
- h.length > 1 && i.push(...h.map((f) => new l(o.DUPLICATE_TABLE_SETTING, "'default' can only appear once", f))), h.forEach((f) => {
2318
- Dn(f.value) || i.push(new l(o.INVALID_TABLE_SETTING, "'default' must be a string literal, number literal, function expression, true, false or null", f.value || f.name));
2317
+ f.length > 1 && i.push(...f.map((h) => new c(o.DUPLICATE_TABLE_SETTING, "'default' can only appear once", h))), f.forEach((h) => {
2318
+ Un(h.value) || i.push(new c(o.INVALID_TABLE_SETTING, "'default' must be a string literal, number literal, function expression, true, false or null", h.value || h.name));
2319
2319
  });
2320
2320
  break;
2321
2321
  default:
2322
- h.forEach((f) => i.push(new l(o.UNKNOWN_COLUMN_SETTING, `Unknown column setting '${p}'`, f)));
2322
+ f.forEach((h) => i.push(new c(o.UNKNOWN_COLUMN_SETTING, `Unknown column setting '${p}'`, h)));
2323
2323
  }
2324
2324
  }
2325
2325
  return i;
@@ -2334,10 +2334,10 @@ class yn {
2334
2334
  var r;
2335
2335
  return ((r = i.type) == null ? void 0 : r.value.toLowerCase()) === "note";
2336
2336
  });
2337
- return s.length > 1 && (n.push(...s.map((i) => new l(o.NOTE_REDEFINED, "Duplicate notes are defined", i))), n.push()), n;
2337
+ return s.length > 1 && (n.push(...s.map((i) => new c(o.NOTE_REDEFINED, "Duplicate notes are defined", i))), n.push()), n;
2338
2338
  }
2339
2339
  }
2340
- function kn(t) {
2340
+ function Sn(t) {
2341
2341
  if (!(t instanceof H || Je(t) || t instanceof U || t instanceof ue))
2342
2342
  return !1;
2343
2343
  if (t instanceof H) {
@@ -2353,10 +2353,10 @@ function kn(t) {
2353
2353
  const e = C(t).unwrap_or(void 0);
2354
2354
  return e !== void 0 && e.length > 0;
2355
2355
  }
2356
- function xn(t, e) {
2356
+ function On(t, e) {
2357
2357
  return e.length === 1 && t === e[0];
2358
2358
  }
2359
- class Sn {
2359
+ class Rn {
2360
2360
  constructor(e, n, s) {
2361
2361
  this.declarationNode = e, this.publicSymbolTable = n, this.symbolFactory = s;
2362
2362
  }
@@ -2364,41 +2364,41 @@ class Sn {
2364
2364
  return [...this.validateContext(), ...this.validateName(this.declarationNode.name), ...this.validateAlias(this.declarationNode.alias), ...this.validateSettingList(this.declarationNode.attributeList), ...this.registerElement(), ...this.validateBody(this.declarationNode.body)];
2365
2365
  }
2366
2366
  validateContext() {
2367
- return this.declarationNode.parent instanceof A ? [new l(o.INVALID_TABLEGROUP_CONTEXT, "TableGroup must appear top-level", this.declarationNode)] : [];
2367
+ return this.declarationNode.parent instanceof A ? [new c(o.INVALID_TABLEGROUP_CONTEXT, "TableGroup must appear top-level", this.declarationNode)] : [];
2368
2368
  }
2369
2369
  validateName(e) {
2370
- return e ? ye(e) ? [] : [new l(o.INVALID_NAME, "A TableGroup name must be a single identifier", e)] : [new l(o.NAME_NOT_FOUND, "A TableGroup must have a name", this.declarationNode)];
2370
+ return e ? ye(e) ? [] : [new c(o.INVALID_NAME, "A TableGroup name must be a single identifier", e)] : [new c(o.NAME_NOT_FOUND, "A TableGroup must have a name", this.declarationNode)];
2371
2371
  }
2372
2372
  validateAlias(e) {
2373
- return e ? [new l(o.UNEXPECTED_ALIAS, "A TableGroup shouldn't have an alias", e)] : [];
2373
+ return e ? [new c(o.UNEXPECTED_ALIAS, "A TableGroup shouldn't have an alias", e)] : [];
2374
2374
  }
2375
2375
  registerElement() {
2376
2376
  const { name: e } = this.declarationNode;
2377
- this.declarationNode.symbol = this.symbolFactory.create(tn, { declaration: this.declarationNode, symbolTable: new we() });
2377
+ this.declarationNode.symbol = this.symbolFactory.create(sn, { declaration: this.declarationNode, symbolTable: new we() });
2378
2378
  const n = C(e);
2379
2379
  if (n.isOk()) {
2380
2380
  const s = n.unwrap(), i = s.pop(), r = Ze(s, this.publicSymbolTable, this.symbolFactory), a = qe(i);
2381
2381
  if (r.has(a))
2382
- return [new l(o.DUPLICATE_NAME, `TableGroup name '${i}' already exists`, e)];
2382
+ return [new c(o.DUPLICATE_NAME, `TableGroup name '${i}' already exists`, e)];
2383
2383
  r.set(a, this.declarationNode.symbol);
2384
2384
  }
2385
2385
  return [];
2386
2386
  }
2387
2387
  validateSettingList(e) {
2388
- return e ? [new l(o.UNEXPECTED_SETTINGS, "A TableGroup shouldn't have a setting list", e)] : [];
2388
+ return e ? [new c(o.UNEXPECTED_SETTINGS, "A TableGroup shouldn't have a setting list", e)] : [];
2389
2389
  }
2390
2390
  validateBody(e) {
2391
2391
  if (!e)
2392
2392
  return [];
2393
2393
  if (e instanceof y)
2394
- return [new l(o.UNEXPECTED_SIMPLE_BODY, "A TableGroup's body must be a block", e)];
2394
+ return [new c(o.UNEXPECTED_SIMPLE_BODY, "A TableGroup's body must be a block", e)];
2395
2395
  const [n, s] = I.partition(e.body, (i) => i instanceof y);
2396
2396
  return [...this.validateFields(n), ...this.validateSubElements(s)];
2397
2397
  }
2398
2398
  validateFields(e) {
2399
2399
  return e.flatMap((n) => {
2400
2400
  const s = [];
2401
- return n.callee && !C(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;
2401
+ return n.callee && !C(n.callee).isOk() && s.push(new c(o.INVALID_TABLEGROUP_FIELD, "A TableGroup field must be of the form <table> or <schema>.<table>", n.callee)), this.registerField(n), n.args.length > 0 && s.push(...n.args.map((i) => new c(o.INVALID_TABLEGROUP_FIELD, "A TableGroup field should only have a single Table name", i))), s;
2402
2402
  });
2403
2403
  }
2404
2404
  validateSubElements(e) {
@@ -2411,14 +2411,14 @@ class Sn {
2411
2411
  }
2412
2412
  registerField(e) {
2413
2413
  if (e.callee && M(e.callee)) {
2414
- const n = V(e.callee).unwrap(), s = He(n), i = this.symbolFactory.create(nn, { declaration: e });
2414
+ const n = V(e.callee).unwrap(), s = He(n), i = this.symbolFactory.create(rn, { declaration: e });
2415
2415
  e.symbol = i;
2416
2416
  const r = this.declarationNode.symbol.symbolTable;
2417
2417
  if (r.has(s)) {
2418
2418
  const a = r.get(s);
2419
2419
  return [
2420
- new l(o.DUPLICATE_TABLEGROUP_FIELD_NAME, `${n} already exists in the group`, e),
2421
- new l(o.DUPLICATE_TABLEGROUP_FIELD_NAME, `${n} already exists in the group`, a.declaration)
2420
+ new c(o.DUPLICATE_TABLEGROUP_FIELD_NAME, `${n} already exists in the group`, e),
2421
+ new c(o.DUPLICATE_TABLEGROUP_FIELD_NAME, `${n} already exists in the group`, a.declaration)
2422
2422
  ];
2423
2423
  }
2424
2424
  r.set(s, i);
@@ -2426,31 +2426,31 @@ class Sn {
2426
2426
  return [];
2427
2427
  }
2428
2428
  }
2429
- const vt = ["-", "+"];
2429
+ const wt = ["-", "+"];
2430
2430
  function re(t) {
2431
2431
  switch (t.type.value.toLowerCase()) {
2432
2432
  case b.Enum:
2433
- return Ln;
2433
+ return _n;
2434
2434
  case b.Table:
2435
- return yn;
2435
+ return xn;
2436
2436
  case b.TableGroup:
2437
- return Sn;
2437
+ return Rn;
2438
2438
  case b.Project:
2439
- return An;
2439
+ return wn;
2440
2440
  case b.Ref:
2441
- return vn;
2441
+ return yn;
2442
2442
  case b.Note:
2443
- return _n;
2443
+ return vn;
2444
2444
  case b.Indexes:
2445
- return gn;
2445
+ return An;
2446
2446
  default:
2447
- return In;
2447
+ return gn;
2448
2448
  }
2449
2449
  }
2450
- function wt(t) {
2450
+ function yt(t) {
2451
2451
  return !!C(t).unwrap_or(!1);
2452
2452
  }
2453
- function On(t) {
2453
+ function Dn(t) {
2454
2454
  return ye(t);
2455
2455
  }
2456
2456
  function ye(t) {
@@ -2462,53 +2462,53 @@ function Ze(t, e, n) {
2462
2462
  let s = e;
2463
2463
  for (const r of t) {
2464
2464
  let a;
2465
- const c = je(r);
2466
- if (s.has(c)) {
2467
- if (a = (i = s.get(c)) == null ? void 0 : i.symbolTable, !a)
2465
+ const u = je(r);
2466
+ if (s.has(u)) {
2467
+ if (a = (i = s.get(u)) == null ? void 0 : i.symbolTable, !a)
2468
2468
  throw new Error("Expect a symbol table in a schema symbol");
2469
2469
  } else {
2470
2470
  a = new we();
2471
- const p = n.create(gt, { symbolTable: a });
2472
- s.set(c, p);
2471
+ const p = n.create(_t, { symbolTable: a });
2472
+ s.set(u, p);
2473
2473
  }
2474
2474
  s = a;
2475
2475
  }
2476
2476
  return s;
2477
2477
  }
2478
- function yt(t) {
2478
+ function kt(t) {
2479
2479
  return t === "-" || t === "<>" || t === ">" || t === "<";
2480
2480
  }
2481
- function Rn(t) {
2481
+ function Pn(t) {
2482
2482
  var n;
2483
- if (!(t instanceof U) || !(t.expression instanceof be) || ((n = t.expression.literal) == null ? void 0 : n.kind) !== u.COLOR_LITERAL)
2483
+ if (!(t instanceof U) || !(t.expression instanceof be) || ((n = t.expression.literal) == null ? void 0 : n.kind) !== l.COLOR_LITERAL)
2484
2484
  return !1;
2485
2485
  const e = t.expression.literal.value;
2486
2486
  if (e.length !== 4 && e.length !== 7 || e[0] !== "#")
2487
2487
  return !1;
2488
2488
  for (let s = 1; s < e.length; s += 1)
2489
- if (!Ht(e[s]))
2489
+ if (!Zt(e[s]))
2490
2490
  return !1;
2491
2491
  return !0;
2492
2492
  }
2493
2493
  function le(t) {
2494
2494
  return t === void 0;
2495
2495
  }
2496
- function Dn(t) {
2496
+ function Un(t) {
2497
2497
  var e;
2498
- return !!(j(t) || he(t) || me(t) && ["true", "false", "null"].includes(t.expression.variable.value.toLowerCase()) || t instanceof Q && vt.includes((e = t.op) == null ? void 0 : e.value) && he(t.expression) || t instanceof te);
2498
+ return !!(j(t) || he(t) || me(t) && ["true", "false", "null"].includes(t.expression.variable.value.toLowerCase()) || t instanceof Q && wt.includes((e = t.op) == null ? void 0 : e.value) && he(t.expression) || t instanceof te);
2499
2499
  }
2500
2500
  function he(t) {
2501
2501
  var e;
2502
- return t instanceof U && t.expression instanceof be && ((e = t.expression.literal) == null ? void 0 : e.kind) === u.NUMERIC_LITERAL;
2502
+ return t instanceof U && t.expression instanceof be && ((e = t.expression.literal) == null ? void 0 : e.kind) === l.NUMERIC_LITERAL;
2503
2503
  }
2504
- function Pn(t) {
2504
+ function Mn(t) {
2505
2505
  var n;
2506
- if (!(t instanceof Q) || !yt((n = t.op) == null ? void 0 : n.value))
2506
+ if (!(t instanceof Q) || !kt((n = t.op) == null ? void 0 : n.value))
2507
2507
  return !1;
2508
2508
  const e = C(t.expression).unwrap_or(void 0);
2509
2509
  return e !== void 0 && e.length > 0;
2510
2510
  }
2511
- function kt(t) {
2511
+ function xt(t) {
2512
2512
  return t instanceof J && t.elementList.every(M);
2513
2513
  }
2514
2514
  function W(t) {
@@ -2520,7 +2520,7 @@ function W(t) {
2520
2520
  if (!i.name)
2521
2521
  continue;
2522
2522
  if (i.name instanceof U) {
2523
- n.push(new l(o.INVALID_SETTINGS, "A setting name must be a stream of identifiers", i.name));
2523
+ n.push(new c(o.INVALID_SETTINGS, "A setting name must be a stream of identifiers", i.name));
2524
2524
  continue;
2525
2525
  }
2526
2526
  const r = (s = Te(i.name).unwrap_or(void 0)) == null ? void 0 : s.toLowerCase();
@@ -2528,9 +2528,9 @@ function W(t) {
2528
2528
  }
2529
2529
  return new B(e, n);
2530
2530
  }
2531
- class ht {
2531
+ class ft {
2532
2532
  constructor(e, n) {
2533
- this.ast = e, this.symbolFactory = n, this.publicSchemaSymbol = this.symbolFactory.create(gt, {
2533
+ this.ast = e, this.symbolFactory = n, this.publicSchemaSymbol = this.symbolFactory.create(_t, {
2534
2534
  symbolTable: new we()
2535
2535
  }), this.ast.symbol = this.publicSchemaSymbol, this.ast.symbol.declaration = this.ast;
2536
2536
  }
@@ -2547,7 +2547,7 @@ class ht {
2547
2547
  e.push(...r.validate());
2548
2548
  });
2549
2549
  const n = this.ast.body.filter((s) => ve(s).unwrap_or(void 0) === b.Project);
2550
- return n.length > 1 && n.forEach((s) => e.push(new l(o.PROJECT_REDEFINED, "Only one project can exist", s))), new B(this.ast, e);
2550
+ return n.length > 1 && n.forEach((s) => e.push(new c(o.PROJECT_REDEFINED, "Only one project can exist", s))), new B(this.ast, e);
2551
2551
  }
2552
2552
  }
2553
2553
  class ae {
@@ -2579,7 +2579,7 @@ class ae {
2579
2579
  if (s instanceof A) {
2580
2580
  if (!s.type)
2581
2581
  continue;
2582
- const i = xt(s);
2582
+ const i = St(s);
2583
2583
  new i(s, this.errors).bind();
2584
2584
  } else
2585
2585
  this.bindSubfield(s);
@@ -2610,76 +2610,76 @@ class ae {
2610
2610
  bindFragments(e, n) {
2611
2611
  if (e.length === 0)
2612
2612
  return;
2613
- const s = [...n.topSubnamesSymbolKind], { remainingSubnamesSymbolKind: i } = n, r = e.findIndex((f) => !M(f)), c = r !== -1 && kt(e[r]) ? e[r] : void 0, p = r >= 0 ? s.pop() : void 0, h = e.slice(
2613
+ const s = [...n.topSubnamesSymbolKind], { remainingSubnamesSymbolKind: i } = n, r = e.findIndex((h) => !M(h)), u = r !== -1 && xt(e[r]) ? e[r] : void 0, p = r >= 0 ? s.pop() : void 0, f = e.slice(
2614
2614
  0,
2615
2615
  r === -1 ? void 0 : r
2616
2616
  );
2617
- if (h.length === 0)
2617
+ if (f.length === 0)
2618
2618
  return;
2619
- const T = [];
2620
- for (; s.length && h.length; ) {
2621
- const f = s.pop(), N = h.pop(), g = V(N).unwrap();
2622
- T.unshift({
2623
- index: Ve(g, f),
2624
- referrer: N
2619
+ const E = [];
2620
+ for (; s.length && f.length; ) {
2621
+ const h = s.pop(), m = f.pop(), g = V(m).unwrap();
2622
+ E.unshift({
2623
+ index: Ve(g, h),
2624
+ referrer: m
2625
2625
  });
2626
2626
  }
2627
- for (; h.length; ) {
2628
- const f = h.pop(), N = V(f).unwrap();
2629
- T.unshift({
2630
- index: Ve(N, i),
2631
- referrer: f
2627
+ for (; f.length; ) {
2628
+ const h = f.pop(), m = V(h).unwrap();
2629
+ E.unshift({
2630
+ index: Ve(m, i),
2631
+ referrer: h
2632
2632
  });
2633
2633
  }
2634
- return c ? c.elementList.forEach(
2635
- (f) => this.resolveIndexStack(
2634
+ return u ? u.elementList.forEach(
2635
+ (h) => this.resolveIndexStack(
2636
2636
  [
2637
- ...T,
2637
+ ...E,
2638
2638
  {
2639
2639
  index: Ve(
2640
- V(f).unwrap(),
2640
+ V(h).unwrap(),
2641
2641
  p
2642
2642
  ),
2643
- referrer: f
2643
+ referrer: h
2644
2644
  }
2645
2645
  ],
2646
2646
  n.ignoreNameNotFound
2647
2647
  )
2648
- ) : this.resolveIndexStack(T, n.ignoreNameNotFound);
2648
+ ) : this.resolveIndexStack(E, n.ignoreNameNotFound);
2649
2649
  }
2650
2650
  // Looking up the indexes in the subname stack from the current declaration node
2651
2651
  // Each time the index resolves to a symbol, the referrer's symbol is bound to it
2652
2652
  resolveIndexStack(e, n) {
2653
2653
  if (e.length === 0)
2654
2654
  throw new Error("Unreachable - An unresolved name must have at least one name component");
2655
- const [s, ...i] = e, r = bn(s.index, this.declarationNode);
2655
+ const [s, ...i] = e, r = Ln(s.index, this.declarationNode);
2656
2656
  if (r === void 0) {
2657
- const { kind: h, name: T } = ie(s.index).unwrap();
2658
- this.logError(s.referrer, `Can not find ${h} '${T}'`, n);
2657
+ const { kind: f, name: E } = ie(s.index).unwrap();
2658
+ this.logError(s.referrer, `Can not find ${f} '${E}'`, n);
2659
2659
  return;
2660
2660
  }
2661
2661
  r.references.push(s.referrer), s.referrer.referee = r;
2662
- let a = r.symbolTable, { kind: c, name: p } = ie(s.index).unwrap();
2663
- for (const h of i) {
2664
- const { kind: T, name: f } = ie(h.index).unwrap(), N = a.get(h.index);
2665
- if (!N) {
2662
+ let a = r.symbolTable, { kind: u, name: p } = ie(s.index).unwrap();
2663
+ for (const f of i) {
2664
+ const { kind: E, name: h } = ie(f.index).unwrap(), m = a.get(f.index);
2665
+ if (!m) {
2666
2666
  this.logError(
2667
- h.referrer,
2668
- `${c} '${p}' does not have ${T} '${f}'`,
2667
+ f.referrer,
2668
+ `${u} '${p}' does not have ${E} '${h}'`,
2669
2669
  n
2670
2670
  );
2671
2671
  return;
2672
2672
  }
2673
- if (c = T, p = f, h.referrer.referee = N, N.references.push(h.referrer), !N.symbolTable)
2673
+ if (u = E, p = h, f.referrer.referee = m, m.references.push(f.referrer), !m.symbolTable)
2674
2674
  break;
2675
- a = N.symbolTable;
2675
+ a = m.symbolTable;
2676
2676
  }
2677
2677
  }
2678
2678
  logError(e, n, s) {
2679
- s || this.errors.push(new l(o.BINDING_ERROR, n, e));
2679
+ s || this.errors.push(new c(o.BINDING_ERROR, n, e));
2680
2680
  }
2681
2681
  }
2682
- class Un extends ae {
2682
+ class Fn extends ae {
2683
2683
  constructor() {
2684
2684
  super(...arguments), this.subfield = {
2685
2685
  arg: {
@@ -2689,7 +2689,7 @@ class Un extends ae {
2689
2689
  }, this.settingList = {};
2690
2690
  }
2691
2691
  }
2692
- class Mn extends ae {
2692
+ class Bn extends ae {
2693
2693
  constructor() {
2694
2694
  super(...arguments), this.subfield = {
2695
2695
  arg: {
@@ -2699,33 +2699,33 @@ class Mn extends ae {
2699
2699
  }, this.settingList = {};
2700
2700
  }
2701
2701
  }
2702
- class Fn extends ae {
2702
+ class Vn extends ae {
2703
2703
  constructor() {
2704
2704
  super(...arguments), this.subfield = {
2705
2705
  arg: {
2706
2706
  argBinderRules: [
2707
2707
  {
2708
2708
  shouldBind: !0,
2709
- topSubnamesSymbolKind: [m.Table, m.Column],
2710
- remainingSubnamesSymbolKind: m.Schema,
2709
+ topSubnamesSymbolKind: [T.Table, T.Column],
2710
+ remainingSubnamesSymbolKind: T.Schema,
2711
2711
  ignoreNameNotFound: !1
2712
2712
  },
2713
2713
  {
2714
2714
  shouldBind: !0,
2715
- topSubnamesSymbolKind: [m.Table, m.Column],
2716
- remainingSubnamesSymbolKind: m.Schema,
2715
+ topSubnamesSymbolKind: [T.Table, T.Column],
2716
+ remainingSubnamesSymbolKind: T.Schema,
2717
2717
  ignoreNameNotFound: !1
2718
2718
  },
2719
2719
  {
2720
2720
  shouldBind: !0,
2721
- topSubnamesSymbolKind: [m.Table, m.Column],
2722
- remainingSubnamesSymbolKind: m.Schema,
2721
+ topSubnamesSymbolKind: [T.Table, T.Column],
2722
+ remainingSubnamesSymbolKind: T.Schema,
2723
2723
  ignoreNameNotFound: !1
2724
2724
  },
2725
2725
  {
2726
2726
  shouldBind: !0,
2727
- topSubnamesSymbolKind: [m.Table, m.Column],
2728
- remainingSubnamesSymbolKind: m.Schema,
2727
+ topSubnamesSymbolKind: [T.Table, T.Column],
2728
+ remainingSubnamesSymbolKind: T.Schema,
2729
2729
  ignoreNameNotFound: !1
2730
2730
  }
2731
2731
  ]
@@ -2734,7 +2734,7 @@ class Fn extends ae {
2734
2734
  }, this.settingList = {};
2735
2735
  }
2736
2736
  }
2737
- class Bn extends ae {
2737
+ class Gn extends ae {
2738
2738
  constructor() {
2739
2739
  super(...arguments), this.subfield = {
2740
2740
  arg: {
@@ -2744,7 +2744,7 @@ class Bn extends ae {
2744
2744
  }, this.settingList = {};
2745
2745
  }
2746
2746
  }
2747
- class Vn extends ae {
2747
+ class Cn extends ae {
2748
2748
  constructor() {
2749
2749
  super(...arguments), this.subfield = {
2750
2750
  arg: {
@@ -2754,15 +2754,15 @@ class Vn extends ae {
2754
2754
  }, this.settingList = {};
2755
2755
  }
2756
2756
  }
2757
- class Gn extends ae {
2757
+ class Xn extends ae {
2758
2758
  constructor() {
2759
2759
  super(...arguments), this.subfield = {
2760
2760
  arg: {
2761
2761
  argBinderRules: [
2762
2762
  {
2763
2763
  shouldBind: !0,
2764
- topSubnamesSymbolKind: [m.Table, m.Column],
2765
- remainingSubnamesSymbolKind: m.Schema,
2764
+ topSubnamesSymbolKind: [T.Table, T.Column],
2765
+ remainingSubnamesSymbolKind: T.Schema,
2766
2766
  ignoreNameNotFound: !1
2767
2767
  }
2768
2768
  ]
@@ -2771,7 +2771,7 @@ class Gn extends ae {
2771
2771
  }, this.settingList = {};
2772
2772
  }
2773
2773
  }
2774
- class Cn extends ae {
2774
+ class $n extends ae {
2775
2775
  constructor() {
2776
2776
  super(...arguments), this.subfield = {
2777
2777
  arg: {
@@ -2779,8 +2779,8 @@ class Cn extends ae {
2779
2779
  { shouldBind: !1 },
2780
2780
  {
2781
2781
  shouldBind: !0,
2782
- topSubnamesSymbolKind: [m.Enum],
2783
- remainingSubnamesSymbolKind: m.Schema,
2782
+ topSubnamesSymbolKind: [T.Enum],
2783
+ remainingSubnamesSymbolKind: T.Schema,
2784
2784
  ignoreNameNotFound: !0
2785
2785
  }
2786
2786
  ]
@@ -2788,8 +2788,8 @@ class Cn extends ae {
2788
2788
  settingList: {
2789
2789
  ref: {
2790
2790
  shouldBind: !0,
2791
- topSubnamesSymbolKind: [m.Table, m.Column],
2792
- remainingSubnamesSymbolKind: m.Schema,
2791
+ topSubnamesSymbolKind: [T.Table, T.Column],
2792
+ remainingSubnamesSymbolKind: T.Schema,
2793
2793
  ignoreNameNotFound: !1
2794
2794
  },
2795
2795
  default: {
@@ -2799,15 +2799,15 @@ class Cn extends ae {
2799
2799
  }, this.settingList = {};
2800
2800
  }
2801
2801
  }
2802
- class Xn extends ae {
2802
+ class Wn extends ae {
2803
2803
  constructor() {
2804
2804
  super(...arguments), this.subfield = {
2805
2805
  arg: {
2806
2806
  argBinderRules: [
2807
2807
  {
2808
2808
  shouldBind: !0,
2809
- topSubnamesSymbolKind: [m.Table],
2810
- remainingSubnamesSymbolKind: m.Schema,
2809
+ topSubnamesSymbolKind: [T.Table],
2810
+ remainingSubnamesSymbolKind: T.Schema,
2811
2811
  ignoreNameNotFound: !1
2812
2812
  }
2813
2813
  ]
@@ -2816,40 +2816,40 @@ class Xn extends ae {
2816
2816
  }, this.settingList = {};
2817
2817
  }
2818
2818
  }
2819
- function xt(t) {
2819
+ function St(t) {
2820
2820
  switch (t.type.value.toLowerCase()) {
2821
2821
  case b.Enum:
2822
- return Mn;
2822
+ return Bn;
2823
2823
  case b.Table:
2824
- return Cn;
2824
+ return $n;
2825
2825
  case b.TableGroup:
2826
- return Xn;
2826
+ return Wn;
2827
2827
  case b.Project:
2828
- return Vn;
2828
+ return Cn;
2829
2829
  case b.Ref:
2830
- return Gn;
2830
+ return Xn;
2831
2831
  case b.Note:
2832
- return Bn;
2832
+ return Gn;
2833
2833
  case b.Indexes:
2834
- return Fn;
2834
+ return Vn;
2835
2835
  default:
2836
- return Un;
2836
+ return Fn;
2837
2837
  }
2838
2838
  }
2839
- class $n {
2839
+ class jn {
2840
2840
  constructor(e) {
2841
2841
  this.ast = e, this.errors = [];
2842
2842
  }
2843
2843
  resolve() {
2844
2844
  for (const e of this.ast.body)
2845
2845
  if (e.type) {
2846
- const n = xt(e);
2846
+ const n = St(e);
2847
2847
  new n(e, this.errors).bind();
2848
2848
  }
2849
2849
  return new B(this.ast, this.errors);
2850
2850
  }
2851
2851
  }
2852
- class Wn {
2852
+ class Yn {
2853
2853
  constructor(e) {
2854
2854
  this.generator = e;
2855
2855
  }
@@ -2857,20 +2857,20 @@ class Wn {
2857
2857
  return new e(n, this.generator.nextId());
2858
2858
  }
2859
2859
  }
2860
- class jn {
2860
+ class zn {
2861
2861
  constructor(e, n) {
2862
- this.ast = e, this.symbolFactory = new Wn(n);
2862
+ this.ast = e, this.symbolFactory = new Yn(n);
2863
2863
  }
2864
2864
  // Analyzing: Invoking both the validator and binder
2865
2865
  analyze() {
2866
- return new ht(this.ast, this.symbolFactory).validate().chain((n) => new $n(n).resolve());
2866
+ return new ft(this.ast, this.symbolFactory).validate().chain((n) => new jn(n).resolve());
2867
2867
  }
2868
2868
  // For invoking the validator only
2869
2869
  validate() {
2870
- return new ht(this.ast, this.symbolFactory).validate().chain((n) => new B(n, []));
2870
+ return new ft(this.ast, this.symbolFactory).validate().chain((n) => new B(n, []));
2871
2871
  }
2872
2872
  }
2873
- function ft(t, e) {
2873
+ function pt(t, e) {
2874
2874
  const { variables: n, tupleElements: s } = _e(t).unwrap();
2875
2875
  return s ? n.length === 0 ? {
2876
2876
  schemaName: e.schemaName,
@@ -2890,7 +2890,7 @@ function ft(t, e) {
2890
2890
  schemaName: n.pop() || null
2891
2891
  };
2892
2892
  }
2893
- function St(t) {
2893
+ function Ot(t) {
2894
2894
  switch (t) {
2895
2895
  case "<":
2896
2896
  return ["1", "*"];
@@ -2925,10 +2925,10 @@ function Ie(t) {
2925
2925
  schemaName: e
2926
2926
  };
2927
2927
  }
2928
- function Ot(t) {
2928
+ function Rt(t) {
2929
2929
  return t.expression.literal.value;
2930
2930
  }
2931
- function Rt(t, e) {
2931
+ function Dt(t, e) {
2932
2932
  if (Array.isArray(t)) {
2933
2933
  const i = t.map(({ id: a }) => a).sort().join(","), r = e.map(({ id: a }) => a).sort().join(",");
2934
2934
  return i < r ? `${i}-${r}` : `${r}-${i}`;
@@ -2936,10 +2936,10 @@ function Rt(t, e) {
2936
2936
  const n = t.id.toString(), s = e.id.toString();
2937
2937
  return n < s ? `${n}-${s}` : `${s}-${n}`;
2938
2938
  }
2939
- function Dt(t, e) {
2939
+ function Pt(t, e) {
2940
2940
  if (Array.isArray(t)) {
2941
2941
  const i = t.map(({ id: a }) => a).sort(), r = e.map(({ id: a }) => a).sort();
2942
- return I.zip(i, r).every(([a, c]) => a === c);
2942
+ return I.zip(i, r).every(([a, u]) => a === u);
2943
2943
  }
2944
2944
  const n = t.id, s = e.id;
2945
2945
  return n === s;
@@ -2950,7 +2950,7 @@ function Ne(t) {
2950
2950
  return n.map((r) => r.slice(i)).join(`
2951
2951
  `);
2952
2952
  }
2953
- class Pt {
2953
+ class Ut {
2954
2954
  constructor(e, n) {
2955
2955
  this.declarationNode = e, this.env = n, this.table = { name: void 0, schemaName: void 0, alias: null, fields: [], token: void 0, indexes: [] }, this.pkColumns = [];
2956
2956
  }
@@ -2975,7 +2975,7 @@ class Pt {
2975
2975
  }
2976
2976
  interpretName(e) {
2977
2977
  const { name: n, schemaName: s } = Ie(e);
2978
- return s.length > 1 ? (this.table.name = n, this.table.schemaName = s.join("."), [new l(o.UNSUPPORTED, "Nested schema is not supported", e)]) : (this.table.name = n, this.table.schemaName = s.length ? s[0] : null, []);
2978
+ return s.length > 1 ? (this.table.name = n, this.table.schemaName = s.join("."), [new c(o.UNSUPPORTED, "Nested schema is not supported", e)]) : (this.table.name = n, this.table.schemaName = s.length ? s[0] : null, []);
2979
2979
  }
2980
2980
  interpretAlias(e) {
2981
2981
  if (!e)
@@ -2993,7 +2993,7 @@ class Pt {
2993
2993
  interpretSettingList(e) {
2994
2994
  var i, r, a;
2995
2995
  const n = W(e).getValue();
2996
- this.table.headerColor = (i = n.headercolor) != null && i.length ? Ot((a = (r = n.headercolor) == null ? void 0 : r.at(0)) == null ? void 0 : a.value) : void 0;
2996
+ this.table.headerColor = (i = n.headercolor) != null && i.length ? Rt((a = (r = n.headercolor) == null ? void 0 : r.at(0)) == null ? void 0 : a.value) : void 0;
2997
2997
  const [s] = n.note || [];
2998
2998
  return this.table.note = s && {
2999
2999
  value: z(s == null ? void 0 : s.value).map(Ne).unwrap(),
@@ -3023,15 +3023,15 @@ class Pt {
3023
3023
  return e.flatMap((n) => this.interpretColumn(n));
3024
3024
  }
3025
3025
  interpretColumn(e) {
3026
- var a, c, p, h, T, f, N, g;
3026
+ var a, u, p, f, E, h, m, g;
3027
3027
  const n = [], s = {};
3028
3028
  s.name = V(e.callee).unwrap();
3029
- const i = Yn(e.args[0]);
3029
+ const i = Qn(e.args[0]);
3030
3030
  s.type = i.getValue(), n.push(...i.getErrors()), s.token = v(e), s.inline_refs = [];
3031
3031
  const r = e.args.slice(1);
3032
3032
  if (I.last(r) instanceof D) {
3033
3033
  const _ = W(r.pop()).getValue();
3034
- s.pk = !!((a = _.pk) != null && a.length) || !!((c = _["primary key"]) != null && c.length), s.increment = !!((p = _.increment) != null && p.length), s.unique = !!((h = _.unique) != null && h.length), s.not_null = !!((T = _["not null"]) != null && T.length) && !0, s.dbdefault = zn((N = (f = _.default) == null ? void 0 : f.at(0)) == null ? void 0 : N.value);
3034
+ s.pk = !!((a = _.pk) != null && a.length) || !!((u = _["primary key"]) != null && u.length), s.increment = !!((p = _.increment) != null && p.length), s.unique = !!((f = _.unique) != null && f.length), s.not_null = !!((E = _["not null"]) != null && E.length) && !0, s.dbdefault = qn((m = (h = _.default) == null ? void 0 : h.at(0)) == null ? void 0 : m.value);
3035
3035
  const K = (g = _.note) == null ? void 0 : g.at(0);
3036
3036
  s.note = K && {
3037
3037
  value: z(K.value).map(Ne).unwrap(),
@@ -3040,8 +3040,8 @@ class Pt {
3040
3040
  const oe = _.ref || [];
3041
3041
  s.inline_refs = oe.flatMap((Y) => {
3042
3042
  const [tt] = $e(Y.value.expression);
3043
- if (Dt(tt, e.symbol))
3044
- return n.push(new l(o.SAME_ENDPOINT, "Two endpoints are the same", Y)), [];
3043
+ if (Pt(tt, e.symbol))
3044
+ return n.push(new c(o.SAME_ENDPOINT, "Two endpoints are the same", Y)), [];
3045
3045
  const ke = Y.value.op, ee = C(Y.value.expression).unwrap();
3046
3046
  let pe;
3047
3047
  if (ee.length === 1) {
@@ -3072,7 +3072,7 @@ class Pt {
3072
3072
  token: v(Y)
3073
3073
  };
3074
3074
  } else {
3075
- n.push(new l(o.UNSUPPORTED, "Nested schema is not supported", Y));
3075
+ n.push(new c(o.UNSUPPORTED, "Nested schema is not supported", Y));
3076
3076
  const ce = ee.pop(), Le = ee.pop();
3077
3077
  pe = {
3078
3078
  schemaName: ee.join("."),
@@ -3090,18 +3090,18 @@ class Pt {
3090
3090
  }
3091
3091
  interpretIndexes(e) {
3092
3092
  return this.table.indexes.push(...e.body.body.map((n) => {
3093
- var a, c, p, h, T, f, N;
3093
+ var a, u, p, f, E, h, m;
3094
3094
  const s = { columns: [] }, i = n;
3095
3095
  s.token = v(e);
3096
3096
  const r = [i.callee, ...i.args];
3097
3097
  if (I.last(r) instanceof D) {
3098
3098
  const g = W(r.pop()).getValue();
3099
- s.pk = !!((a = g.pk) != null && a.length), s.unique = !!((c = g.unique) != null && c.length), s.name = z((h = (p = g.name) == null ? void 0 : p.at(0)) == null ? void 0 : h.value).unwrap_or(void 0);
3100
- const _ = (T = g.note) == null ? void 0 : T.at(0);
3099
+ s.pk = !!((a = g.pk) != null && a.length), s.unique = !!((u = g.unique) != null && u.length), s.name = z((f = (p = g.name) == null ? void 0 : p.at(0)) == null ? void 0 : f.value).unwrap_or(void 0);
3100
+ const _ = (E = g.note) == null ? void 0 : E.at(0);
3101
3101
  s.note = _ && {
3102
3102
  value: z(_.value).unwrap(),
3103
3103
  token: v(_)
3104
- }, s.type = X((N = (f = g.type) == null ? void 0 : f.at(0)) == null ? void 0 : N.value).unwrap_or(void 0);
3104
+ }, s.type = X((m = (h = g.type) == null ? void 0 : h.at(0)) == null ? void 0 : m.value).unwrap_or(void 0);
3105
3105
  }
3106
3106
  return r.flatMap((g) => {
3107
3107
  if (!(g instanceof H))
@@ -3128,13 +3128,13 @@ class Pt {
3128
3128
  })), [];
3129
3129
  }
3130
3130
  registerInlineRefToEnv(e, n, s, i) {
3131
- const r = Rt(e.symbol, n);
3131
+ const r = Dt(e.symbol, n);
3132
3132
  if (this.env.refIds[r])
3133
3133
  return [
3134
- new l(o.CIRCULAR_REF, "References with same endpoints exist", i),
3135
- new l(o.CIRCULAR_REF, "References with same endpoints exist", this.env.refIds[r])
3134
+ new c(o.CIRCULAR_REF, "References with same endpoints exist", i),
3135
+ new c(o.CIRCULAR_REF, "References with same endpoints exist", this.env.refIds[r])
3136
3136
  ];
3137
- const a = St(s.relation);
3137
+ const a = Ot(s.relation);
3138
3138
  return this.env.refIds[r] = i, this.env.ref.set(i, {
3139
3139
  name: null,
3140
3140
  schemaName: null,
@@ -3155,7 +3155,7 @@ class Pt {
3155
3155
  }), [];
3156
3156
  }
3157
3157
  }
3158
- function Yn(t) {
3158
+ function Qn(t) {
3159
3159
  let e = null;
3160
3160
  t instanceof H && (e = t.argumentList.elementList.map((r) => he(r) ? r.expression.literal.value : j(r) ? z(r).unwrap() : X(r).unwrap()).join(","), t = t.callee);
3161
3161
  let n = "";
@@ -3168,14 +3168,14 @@ function Yn(t) {
3168
3168
  type_name: `${s}${n}${e ? `(${e})` : ""}`,
3169
3169
  args: e
3170
3170
  },
3171
- [new l(o.UNSUPPORTED, "Nested schema is not supported", t)]
3171
+ [new c(o.UNSUPPORTED, "Nested schema is not supported", t)]
3172
3172
  ) : new B({
3173
3173
  schemaName: i.length === 0 ? null : i[0],
3174
3174
  type_name: `${s}${n}${e ? `(${e})` : ""}`,
3175
3175
  args: e
3176
3176
  });
3177
3177
  }
3178
- function zn(t) {
3178
+ function qn(t) {
3179
3179
  var e, n, s;
3180
3180
  if (t) {
3181
3181
  if (j(t))
@@ -3193,7 +3193,7 @@ function zn(t) {
3193
3193
  value: t.expression.variable.value.toLowerCase(),
3194
3194
  type: "boolean"
3195
3195
  };
3196
- if (t instanceof Q && vt.includes((e = t.op) == null ? void 0 : e.value) && he(t.expression)) {
3196
+ if (t instanceof Q && wt.includes((e = t.op) == null ? void 0 : e.value) && he(t.expression)) {
3197
3197
  const i = Number.parseFloat(t.expression.expression.literal.value);
3198
3198
  return {
3199
3199
  value: ((n = t.op) == null ? void 0 : n.value) === "-" ? 0 - i : i,
@@ -3208,7 +3208,7 @@ function zn(t) {
3208
3208
  throw new Error("Unreachable");
3209
3209
  }
3210
3210
  }
3211
- class Qn {
3211
+ class Hn {
3212
3212
  constructor(e, n) {
3213
3213
  this.declarationNode = e, this.env = n, this.note = { name: void 0, content: void 0, token: void 0 };
3214
3214
  }
@@ -3226,12 +3226,12 @@ class Qn {
3226
3226
  interpretSettingList(e) {
3227
3227
  var s, i, r;
3228
3228
  const n = W(e).getValue();
3229
- return this.note.headerColor = (s = n.headercolor) != null && s.length ? Ot((r = (i = n.headercolor) == null ? void 0 : i.at(0)) == null ? void 0 : r.value) : void 0, [];
3229
+ return this.note.headerColor = (s = n.headercolor) != null && s.length ? Rt((r = (i = n.headercolor) == null ? void 0 : i.at(0)) == null ? void 0 : r.value) : void 0, [];
3230
3230
  }
3231
3231
  interpretBody(e) {
3232
3232
  const [n, s] = I.partition(e.body, (i) => i instanceof y);
3233
3233
  return n.length !== 1 || s.length > 0 ? [
3234
- new l(o.INVALID_NOTE, "Invalid note syntax", e)
3234
+ new c(o.INVALID_NOTE, "Invalid note syntax", e)
3235
3235
  ] : [...this.interpretNote(n[0])];
3236
3236
  }
3237
3237
  interpretNote(e) {
@@ -3239,7 +3239,7 @@ class Qn {
3239
3239
  return this.note.content = Ne(n), [];
3240
3240
  }
3241
3241
  }
3242
- class Ut {
3242
+ class Mt {
3243
3243
  constructor(e, n) {
3244
3244
  this.declarationNode = e, this.env = n, this.container = this.declarationNode.parent instanceof A ? this.env.tables.get(this.declarationNode.parent) : void 0, this.ref = {};
3245
3245
  }
@@ -3248,44 +3248,44 @@ class Ut {
3248
3248
  }
3249
3249
  interpretName(e) {
3250
3250
  const n = [], s = C(this.declarationNode.name).unwrap_or([]);
3251
- return this.ref.name = s.pop() || null, s.length > 1 && n.push(new l(o.UNSUPPORTED, "Nested schema is not supported", this.declarationNode.name)), this.ref.schemaName = s.join(".") || null, n;
3251
+ return this.ref.name = s.pop() || null, s.length > 1 && n.push(new c(o.UNSUPPORTED, "Nested schema is not supported", this.declarationNode.name)), this.ref.schemaName = s.join(".") || null, n;
3252
3252
  }
3253
3253
  interpretBody(e) {
3254
3254
  return e instanceof y ? this.interpretField(e) : this.interpretField(e.body[0]);
3255
3255
  }
3256
3256
  interpretField(e) {
3257
- var h, T, f, N;
3257
+ var f, E, h, m;
3258
3258
  const n = e.callee.op.value, { leftExpression: s, rightExpression: i } = e.callee, r = $e(s), a = $e(i);
3259
- if (Dt(r, a))
3260
- return [new l(o.SAME_ENDPOINT, "Two endpoints are the same", e)];
3261
- const c = Rt(r, a);
3262
- if (this.env.refIds[c])
3259
+ if (Pt(r, a))
3260
+ return [new c(o.SAME_ENDPOINT, "Two endpoints are the same", e)];
3261
+ const u = Dt(r, a);
3262
+ if (this.env.refIds[u])
3263
3263
  return [
3264
- new l(o.CIRCULAR_REF, "References with same endpoints exist", this.declarationNode),
3265
- new l(o.CIRCULAR_REF, "References with same endpoints exist", this.env.refIds[c])
3264
+ new c(o.CIRCULAR_REF, "References with same endpoints exist", this.declarationNode),
3265
+ new c(o.CIRCULAR_REF, "References with same endpoints exist", this.env.refIds[u])
3266
3266
  ];
3267
3267
  if (e.args[0]) {
3268
- const g = W(e.args[0]).getValue(), _ = (T = (h = g.delete) == null ? void 0 : h.at(0)) == null ? void 0 : T.value;
3268
+ const g = W(e.args[0]).getValue(), _ = (E = (f = g.delete) == null ? void 0 : f.at(0)) == null ? void 0 : E.value;
3269
3269
  this.ref.onDelete = _ instanceof $ ? Te(_).unwrap_or(void 0) : X(_).unwrap_or(void 0);
3270
- const K = (N = (f = g.update) == null ? void 0 : f.at(0)) == null ? void 0 : N.value;
3270
+ const K = (m = (h = g.update) == null ? void 0 : h.at(0)) == null ? void 0 : m.value;
3271
3271
  this.ref.onUpdate = K instanceof $ ? Te(K).unwrap_or(void 0) : X(K).unwrap_or(void 0);
3272
3272
  }
3273
- const p = St(n);
3273
+ const p = Ot(n);
3274
3274
  return this.ref.endpoints = [
3275
3275
  {
3276
- ...ft(s, this.container),
3276
+ ...pt(s, this.container),
3277
3277
  relation: p[0],
3278
3278
  token: v(s)
3279
3279
  },
3280
3280
  {
3281
- ...ft(i, this.container),
3281
+ ...pt(i, this.container),
3282
3282
  relation: p[1],
3283
3283
  token: v(i)
3284
3284
  }
3285
- ], this.env.refIds[c] = this.declarationNode, [];
3285
+ ], this.env.refIds[u] = this.declarationNode, [];
3286
3286
  }
3287
3287
  }
3288
- class Mt {
3288
+ class Ft {
3289
3289
  constructor(e, n) {
3290
3290
  this.declarationNode = e, this.env = n, this.tableGroup = { tables: [] };
3291
3291
  }
@@ -3298,17 +3298,17 @@ class Mt {
3298
3298
  }
3299
3299
  interpretName(e) {
3300
3300
  const n = [], { name: s, schemaName: i } = Ie(e);
3301
- return i.length >= 2 && (this.tableGroup.name = s, this.tableGroup.schemaName = i.join("."), n.push(new l(o.UNSUPPORTED, "Nested schema is not supported", this.declarationNode.name))), this.tableGroup.name = s, this.tableGroup.schemaName = i[0] || null, n;
3301
+ return i.length >= 2 && (this.tableGroup.name = s, this.tableGroup.schemaName = i.join("."), n.push(new c(o.UNSUPPORTED, "Nested schema is not supported", this.declarationNode.name))), this.tableGroup.name = s, this.tableGroup.schemaName = i[0] || null, n;
3302
3302
  }
3303
3303
  interpretBody(e) {
3304
3304
  const n = [];
3305
3305
  return this.tableGroup.tables = this.declarationNode.body.body.map((s) => {
3306
3306
  const i = C(s.callee).unwrap();
3307
- i.length > 2 && n.push(new l(o.UNSUPPORTED, "Nested schema is not supported", s));
3307
+ i.length > 2 && n.push(new c(o.UNSUPPORTED, "Nested schema is not supported", s));
3308
3308
  const r = fe(s.callee).unwrap().pop().referee.id;
3309
3309
  if (this.env.groupOfTable[r]) {
3310
- const a = this.env.groupOfTable[r], { schemaName: c, name: p } = this.env.tableGroups.get(a), h = c ? `${c}.${p}` : p;
3311
- n.push(new l(o.TABLE_REAPPEAR_IN_TABLEGROUP, `Table "${i.join(".")}" already appears in group "${h}"`, s));
3310
+ const a = this.env.groupOfTable[r], { schemaName: u, name: p } = this.env.tableGroups.get(a), f = u ? `${u}.${p}` : p;
3311
+ n.push(new c(o.TABLE_REAPPEAR_IN_TABLEGROUP, `Table "${i.join(".")}" already appears in group "${f}"`, s));
3312
3312
  } else
3313
3313
  this.env.groupOfTable[r] = this.declarationNode;
3314
3314
  return {
@@ -3318,7 +3318,7 @@ class Mt {
3318
3318
  }), n;
3319
3319
  }
3320
3320
  }
3321
- class Ft {
3321
+ class Bt {
3322
3322
  constructor(e, n) {
3323
3323
  this.declarationNode = e, this.env = n, this.enum = { values: [] };
3324
3324
  }
@@ -3327,14 +3327,14 @@ class Ft {
3327
3327
  }
3328
3328
  interpretName(e) {
3329
3329
  const { name: n, schemaName: s } = Ie(e);
3330
- return s.length > 1 ? (this.enum.name = n, this.enum.schemaName = s.join("."), [new l(o.UNSUPPORTED, "Nested schema is not supported", e)]) : (this.enum.name = n, this.enum.schemaName = s.length ? s[0] : null, []);
3330
+ return s.length > 1 ? (this.enum.name = n, this.enum.schemaName = s.join("."), [new c(o.UNSUPPORTED, "Nested schema is not supported", e)]) : (this.enum.name = n, this.enum.schemaName = s.length ? s[0] : null, []);
3331
3331
  }
3332
3332
  interpretBody(e) {
3333
3333
  return e.body.flatMap((n) => {
3334
- var c;
3334
+ var u;
3335
3335
  const s = n, i = {};
3336
3336
  i.token = v(s), i.name = X(s.callee).unwrap();
3337
- const a = (c = W(s.args[0]).getValue().note) == null ? void 0 : c.at(0);
3337
+ const a = (u = W(s.args[0]).getValue().note) == null ? void 0 : u.at(0);
3338
3338
  return i.note = a && {
3339
3339
  value: z(a.value).map(Ne).unwrap(),
3340
3340
  token: v(a)
@@ -3342,7 +3342,7 @@ class Ft {
3342
3342
  });
3343
3343
  }
3344
3344
  }
3345
- class qn {
3345
+ class Jn {
3346
3346
  constructor(e, n) {
3347
3347
  this.declarationNode = e, this.env = n, this.project = { enums: [], refs: [], tableGroups: [], tables: [] };
3348
3348
  }
@@ -3361,19 +3361,19 @@ class qn {
3361
3361
  const s = n;
3362
3362
  switch ((i = s.type) == null ? void 0 : i.value.toLowerCase()) {
3363
3363
  case "table": {
3364
- const r = new Pt(s, this.env).interpret();
3364
+ const r = new Ut(s, this.env).interpret();
3365
3365
  return this.project.tables.push(this.env.tables.get(s)), r;
3366
3366
  }
3367
3367
  case "ref": {
3368
- const r = new Ut(s, this.env).interpret();
3368
+ const r = new Mt(s, this.env).interpret();
3369
3369
  return this.project.refs.push(this.env.ref.get(s)), r;
3370
3370
  }
3371
3371
  case "tablegroup": {
3372
- const r = new Mt(s, this.env).interpret();
3372
+ const r = new Ft(s, this.env).interpret();
3373
3373
  return this.project.tableGroups.push(this.env.tableGroups.get(s)), r;
3374
3374
  }
3375
3375
  case "enum": {
3376
- const r = new Ft(s, this.env).interpret();
3376
+ const r = new Bt(s, this.env).interpret();
3377
3377
  return this.project.enums.push(this.env.enums.get(s)), r;
3378
3378
  }
3379
3379
  case "note":
@@ -3387,7 +3387,7 @@ class qn {
3387
3387
  });
3388
3388
  }
3389
3389
  }
3390
- class Hn {
3390
+ class Zn {
3391
3391
  constructor(e) {
3392
3392
  this.ast = e, this.env = {
3393
3393
  schema: [],
@@ -3406,25 +3406,25 @@ class Hn {
3406
3406
  const e = this.ast.body.flatMap((n) => {
3407
3407
  switch (ve(n).unwrap_or(void 0)) {
3408
3408
  case b.Table:
3409
- return new Pt(n, this.env).interpret();
3409
+ return new Ut(n, this.env).interpret();
3410
3410
  case b.Note:
3411
- return new Qn(n, this.env).interpret();
3411
+ return new Hn(n, this.env).interpret();
3412
3412
  case b.Ref:
3413
- return new Ut(n, this.env).interpret();
3414
- case b.TableGroup:
3415
3413
  return new Mt(n, this.env).interpret();
3416
- case b.Enum:
3414
+ case b.TableGroup:
3417
3415
  return new Ft(n, this.env).interpret();
3416
+ case b.Enum:
3417
+ return new Bt(n, this.env).interpret();
3418
3418
  case b.Project:
3419
- return new qn(n, this.env).interpret();
3419
+ return new Jn(n, this.env).interpret();
3420
3420
  default:
3421
3421
  return [];
3422
3422
  }
3423
3423
  });
3424
- return new B(Jn(this.env), e);
3424
+ return new B(Kn(this.env), e);
3425
3425
  }
3426
3426
  }
3427
- function Jn(t) {
3427
+ function Kn(t) {
3428
3428
  return {
3429
3429
  schemas: [],
3430
3430
  tables: Array.from(t.tables.values()),
@@ -3439,19 +3439,19 @@ function Jn(t) {
3439
3439
  var L = /* @__PURE__ */ ((t) => (t[t.Function = 1] = "Function", t[t.Constructor = 2] = "Constructor", t[t.Field = 3] = "Field", t[t.Variable = 4] = "Variable", t[t.Class = 5] = "Class", t[t.Struct = 6] = "Struct", t[t.Interface = 7] = "Interface", t[t.Module = 8] = "Module", t[t.Property = 9] = "Property", t[t.Event = 10] = "Event", t[t.Operator = 11] = "Operator", t[t.Unit = 12] = "Unit", t[t.Value = 13] = "Value", t[t.Constant = 14] = "Constant", t[t.Enum = 15] = "Enum", t[t.EnumMember = 16] = "EnumMember", t[t.Keyword = 17] = "Keyword", t[t.Text = 18] = "Text", t[t.Color = 19] = "Color", t[t.File = 20] = "File", t[t.Reference = 21] = "Reference", t[t.Customcolor = 22] = "Customcolor", t[t.Folder = 23] = "Folder", t[t.TypeParameter = 24] = "TypeParameter", t[t.User = 25] = "User", t[t.Issue = 26] = "Issue", t[t.Snippet = 27] = "Snippet", t))(L || {}), k = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.KeepWhitespace = 1] = "KeepWhitespace", t[t.InsertAsSnippet = 4] = "InsertAsSnippet", t))(k || {});
3440
3440
  function Ae(t) {
3441
3441
  switch (t) {
3442
- case m.Schema:
3442
+ case T.Schema:
3443
3443
  return L.Module;
3444
- case m.Table:
3444
+ case T.Table:
3445
3445
  return L.Class;
3446
- case m.Column:
3446
+ case T.Column:
3447
3447
  return L.Field;
3448
- case m.Enum:
3448
+ case T.Enum:
3449
3449
  return L.Enum;
3450
- case m.EnumField:
3450
+ case T.EnumField:
3451
3451
  return L.EnumMember;
3452
- case m.TableGroup:
3452
+ case T.TableGroup:
3453
3453
  return L.Struct;
3454
- case m.TableGroupField:
3454
+ case T.TableGroupField:
3455
3455
  return L.Field;
3456
3456
  default:
3457
3457
  return L.Text;
@@ -3463,7 +3463,7 @@ function De(t, e) {
3463
3463
  for (const n of t.trailingTrivia) {
3464
3464
  if (n.start > e)
3465
3465
  break;
3466
- if (n.kind === u.NEWLINE && n.end <= e)
3466
+ if (n.kind === l.NEWLINE && n.end <= e)
3467
3467
  return !1;
3468
3468
  }
3469
3469
  return !0;
@@ -3494,80 +3494,80 @@ function Fe(t) {
3494
3494
  function Ke(t, e) {
3495
3495
  return t.getOffsetAt(e);
3496
3496
  }
3497
- class Bt {
3497
+ class Vt {
3498
3498
  constructor(e, n = []) {
3499
3499
  this.compiler = e, this.triggerCharacters = n;
3500
3500
  }
3501
3501
  provideCompletionItems(e, n) {
3502
- var T, f;
3503
- const s = Ke(e, n), i = this.compiler.token.flatStream(), { token: r, index: a } = this.compiler.container.token(s), c = a === void 0 ? i[0] : i[a + 1];
3502
+ var E, h;
3503
+ const s = Ke(e, n), i = this.compiler.token.flatStream(), { token: r, index: a } = this.compiler.container.token(s), u = a === void 0 ? i[0] : i[a + 1];
3504
3504
  if ([
3505
3505
  ...(r == null ? void 0 : r.trailingTrivia) || [],
3506
3506
  ...(r == null ? void 0 : r.leadingTrivia) || [],
3507
- ...(c == null ? void 0 : c.leadingTrivia) || []
3508
- ].find((N) => jt(N) && ge(s, N)))
3507
+ ...(u == null ? void 0 : u.leadingTrivia) || []
3508
+ ].find((m) => zt(m) && ge(s, m)))
3509
3509
  return O();
3510
3510
  if (a === void 0)
3511
- return mt();
3512
- if ([u.STRING_LITERAL, u.QUOTED_STRING].includes(r.kind) && ge(s, r))
3511
+ return Tt();
3512
+ if ([l.STRING_LITERAL, l.QUOTED_STRING].includes(r.kind) && ge(s, r))
3513
3513
  return O();
3514
3514
  const p = this.compiler.container.element(s);
3515
3515
  if (this.compiler.container.scopeKind(s) === R.TOPLEVEL || p instanceof A && p.type && p.type.start <= s && p.type.end >= s)
3516
- return mt();
3517
- const h = [...this.compiler.container.stack(s)].reverse();
3518
- for (const N of h)
3519
- if (N instanceof Q)
3520
- switch ((T = N.op) == null ? void 0 : T.value) {
3516
+ return Tt();
3517
+ const f = [...this.compiler.container.stack(s)].reverse();
3518
+ for (const m of f)
3519
+ if (m instanceof Q)
3520
+ switch ((E = m.op) == null ? void 0 : E.value) {
3521
3521
  case ">":
3522
3522
  case "<":
3523
3523
  case "<>":
3524
3524
  case "-":
3525
- return pt(
3525
+ return dt(
3526
3526
  this.compiler,
3527
3527
  s,
3528
- N
3528
+ m
3529
3529
  );
3530
3530
  }
3531
- else if (N instanceof q)
3532
- switch ((f = N.op) == null ? void 0 : f.value) {
3531
+ else if (m instanceof q)
3532
+ switch ((h = m.op) == null ? void 0 : h.value) {
3533
3533
  case ">":
3534
3534
  case "<":
3535
3535
  case "<>":
3536
3536
  case "-":
3537
- return pt(
3537
+ return dt(
3538
3538
  this.compiler,
3539
3539
  s,
3540
- N
3540
+ m
3541
3541
  );
3542
3542
  case ".":
3543
- return Vt(
3543
+ return Gt(
3544
3544
  this.compiler,
3545
3545
  s,
3546
- N
3546
+ m
3547
3547
  );
3548
3548
  }
3549
3549
  else {
3550
- if (N instanceof se)
3551
- return dt(this.compiler, s, N);
3552
- if (N instanceof D)
3553
- return dt(this.compiler, s, N);
3554
- if (N instanceof J)
3555
- return Zn(this.compiler, s);
3556
- if (N instanceof y)
3557
- return Nt(this.compiler, s, N);
3558
- if (N instanceof A && (N.bodyColon && s >= N.bodyColon.end || N.body && ge(s, N.body)))
3559
- return Nt(this.compiler, s, void 0);
3550
+ if (m instanceof se)
3551
+ return Et(this.compiler, s, m);
3552
+ if (m instanceof D)
3553
+ return Et(this.compiler, s, m);
3554
+ if (m instanceof J)
3555
+ return es(this.compiler, s);
3556
+ if (m instanceof y)
3557
+ return mt(this.compiler, s, m);
3558
+ if (m instanceof A && (m.bodyColon && s >= m.bodyColon.end || m.body && ge(s, m.body)))
3559
+ return mt(this.compiler, s, void 0);
3560
3560
  }
3561
3561
  return O();
3562
3562
  }
3563
3563
  }
3564
- function pt(t, e, n) {
3564
+ function dt(t, e, n) {
3565
3565
  const s = t.container.scopeKind(e);
3566
3566
  if ([R.REF, R.TABLE].includes(s)) {
3567
3567
  const i = Be(t, e, t.container.element(e), [
3568
- m.Table,
3569
- m.Schema,
3570
- m.Column
3568
+ T.Table,
3569
+ T.Schema,
3570
+ T.Column
3571
3571
  ]);
3572
3572
  return De(n.op, e) ? Pe(i) : i;
3573
3573
  }
@@ -3581,14 +3581,14 @@ function Be(t, e, n, s) {
3581
3581
  const r = { suggestions: [] };
3582
3582
  for (; i; ) {
3583
3583
  if ((a = i == null ? void 0 : i.symbol) != null && a.symbolTable) {
3584
- const { symbol: c } = i;
3584
+ const { symbol: u } = i;
3585
3585
  r.suggestions.push(
3586
- ...t.symbol.members(c).filter(({ kind: p }) => s.includes(p)).map(({ name: p, kind: h }) => ({
3586
+ ...t.symbol.members(u).filter(({ kind: p }) => s.includes(p)).map(({ name: p, kind: f }) => ({
3587
3587
  label: p,
3588
3588
  insertText: p,
3589
3589
  insertTextRules: k.KeepWhitespace,
3590
- kind: Ae(h),
3591
- sortText: Ae(h).toString().padStart(2, "0"),
3590
+ kind: Ae(f),
3591
+ sortText: Ae(f).toString().padStart(2, "0"),
3592
3592
  range: void 0
3593
3593
  }))
3594
3594
  );
@@ -3597,47 +3597,47 @@ function Be(t, e, n, s) {
3597
3597
  }
3598
3598
  return Fe(r);
3599
3599
  }
3600
- function Zn(t, e) {
3600
+ function es(t, e) {
3601
3601
  var s;
3602
3602
  switch (t.container.scopeKind(e)) {
3603
3603
  case R.INDEXES:
3604
- return Ct(t, e);
3604
+ return Xt(t, e);
3605
3605
  case R.REF:
3606
3606
  {
3607
3607
  const i = [...t.container.stack(e)];
3608
3608
  for (; i.length > 0; ) {
3609
3609
  const r = i.pop();
3610
3610
  if (r instanceof q && ((s = r.op) == null ? void 0 : s.value) === ".")
3611
- return Vt(
3611
+ return Gt(
3612
3612
  t,
3613
3613
  e,
3614
3614
  r
3615
3615
  );
3616
3616
  }
3617
3617
  }
3618
- return Gt(t, e);
3618
+ return Ct(t, e);
3619
3619
  }
3620
3620
  return O();
3621
3621
  }
3622
- function dt(t, e, n) {
3622
+ function Et(t, e, n) {
3623
3623
  const { token: s } = t.container.token(e);
3624
- if ([u.COMMA, u.LBRACKET].includes(s == null ? void 0 : s.kind)) {
3625
- const i = Et(t, e);
3626
- return (s == null ? void 0 : s.kind) === u.COMMA && De(s, e) ? Pe(i) : i;
3624
+ if ([l.COMMA, l.LBRACKET].includes(s == null ? void 0 : s.kind)) {
3625
+ const i = Nt(t, e);
3626
+ return (s == null ? void 0 : s.kind) === l.COMMA && De(s, e) ? Pe(i) : i;
3627
3627
  }
3628
3628
  if (n.name && n.name.start <= e && n.name.end >= e)
3629
- return Et(t, e);
3629
+ return Nt(t, e);
3630
3630
  if (n.name instanceof $) {
3631
- const i = Kn(
3631
+ const i = ts(
3632
3632
  t,
3633
3633
  e,
3634
3634
  Te(n.name).unwrap()
3635
3635
  );
3636
- return (s == null ? void 0 : s.kind) === u.COLON && De(s, e) ? Pe(i) : i;
3636
+ return (s == null ? void 0 : s.kind) === l.COLON && De(s, e) ? Pe(i) : i;
3637
3637
  }
3638
3638
  return O();
3639
3639
  }
3640
- function Et(t, e) {
3640
+ function Nt(t, e) {
3641
3641
  const n = t.container.element(e), s = t.container.scopeKind(e);
3642
3642
  if (n instanceof G)
3643
3643
  return O();
@@ -3736,7 +3736,7 @@ function Et(t, e) {
3736
3736
  }
3737
3737
  return O();
3738
3738
  }
3739
- function Kn(t, e, n) {
3739
+ function ts(t, e, n) {
3740
3740
  switch (n == null ? void 0 : n.toLowerCase()) {
3741
3741
  case "update":
3742
3742
  case "delete":
@@ -3762,7 +3762,7 @@ function Kn(t, e, n) {
3762
3762
  }
3763
3763
  return O();
3764
3764
  }
3765
- function Vt(t, e, n) {
3765
+ function Gt(t, e, n) {
3766
3766
  const s = fe(n).unwrap_or([]);
3767
3767
  if (s.pop(), s.some((r) => !M(r)))
3768
3768
  return O();
@@ -3776,28 +3776,28 @@ function Vt(t, e, n) {
3776
3776
  }))
3777
3777
  });
3778
3778
  }
3779
- function Nt(t, e, n) {
3779
+ function mt(t, e, n) {
3780
3780
  var i;
3781
3781
  switch (t.container.scopeKind(e)) {
3782
3782
  case R.TABLE:
3783
- return ts(t, e, n);
3783
+ return ss(t, e, n);
3784
3784
  case R.PROJECT:
3785
- return ns(t, e, n);
3785
+ return is(t, e, n);
3786
3786
  case R.INDEXES:
3787
- return is(t, e);
3787
+ return as(t, e);
3788
3788
  case R.ENUM:
3789
- return es(t, e, n);
3789
+ return ns(t, e, n);
3790
3790
  case R.REF: {
3791
- const r = Gt(t, e);
3792
- return ((i = t.container.token(e).token) == null ? void 0 : i.kind) === u.COLON && De(t.container.token(e).token, e) ? Pe(r) : r;
3791
+ const r = Ct(t, e);
3792
+ return ((i = t.container.token(e).token) == null ? void 0 : i.kind) === l.COLON && De(t.container.token(e).token, e) ? Pe(r) : r;
3793
3793
  }
3794
3794
  case R.TABLEGROUP:
3795
- return ss(t);
3795
+ return rs(t);
3796
3796
  default:
3797
3797
  return O();
3798
3798
  }
3799
3799
  }
3800
- function mt() {
3800
+ function Tt() {
3801
3801
  return {
3802
3802
  suggestions: ["Table", "TableGroup", "Enum", "Project", "Ref"].map((t) => ({
3803
3803
  label: t,
@@ -3808,14 +3808,14 @@ function mt() {
3808
3808
  }))
3809
3809
  };
3810
3810
  }
3811
- function es(t, e, n) {
3811
+ function ns(t, e, n) {
3812
3812
  return n != null && n.callee && et(e, n) === 1 ? Be(t, e, t.container.element(e), [
3813
- m.Schema,
3814
- m.Table,
3815
- m.Column
3813
+ T.Schema,
3814
+ T.Table,
3815
+ T.Column
3816
3816
  ]) : O();
3817
3817
  }
3818
- function ts(t, e, n) {
3818
+ function ss(t, e, n) {
3819
3819
  if (!(n != null && n.callee))
3820
3820
  return {
3821
3821
  suggestions: ["Note", "indexes"].map((i) => ({
@@ -3835,9 +3835,9 @@ function ts(t, e, n) {
3835
3835
  kind: L.Keyword,
3836
3836
  range: void 0
3837
3837
  }))
3838
- } : s === 1 ? rs(t, e) : O();
3838
+ } : s === 1 ? os(t, e) : O();
3839
3839
  }
3840
- function ns(t, e, n) {
3840
+ function is(t, e, n) {
3841
3841
  return n != null && n.callee ? et(e, n) === 0 ? {
3842
3842
  suggestions: ["Table", "TableGroup", "Enum", "Note", "Ref"].map((i) => ({
3843
3843
  label: i,
@@ -3856,21 +3856,21 @@ function ns(t, e, n) {
3856
3856
  }))
3857
3857
  };
3858
3858
  }
3859
- function Gt(t, e) {
3859
+ function Ct(t, e) {
3860
3860
  return Be(t, e, t.container.element(e), [
3861
- m.Schema,
3862
- m.Table,
3863
- m.Column
3861
+ T.Schema,
3862
+ T.Table,
3863
+ T.Column
3864
3864
  ]);
3865
3865
  }
3866
- function ss(t) {
3866
+ function rs(t) {
3867
3867
  return Fe({
3868
3868
  suggestions: [...t.parse.publicSymbolTable().entries()].flatMap(([e]) => {
3869
3869
  const n = ie(e).unwrap_or(void 0);
3870
3870
  if (n === void 0)
3871
3871
  return [];
3872
3872
  const { kind: s, name: i } = n;
3873
- return s !== m.Table && s !== m.Schema ? [] : {
3873
+ return s !== T.Table && s !== T.Schema ? [] : {
3874
3874
  label: i,
3875
3875
  insertText: i,
3876
3876
  insertTextRules: k.KeepWhitespace,
@@ -3880,10 +3880,10 @@ function ss(t) {
3880
3880
  })
3881
3881
  });
3882
3882
  }
3883
- function is(t, e) {
3884
- return Ct(t, e);
3883
+ function as(t, e) {
3884
+ return Xt(t, e);
3885
3885
  }
3886
- function rs(t, e) {
3886
+ function os(t, e) {
3887
3887
  return {
3888
3888
  suggestions: [
3889
3889
  ...[
@@ -3952,15 +3952,15 @@ function rs(t, e) {
3952
3952
  range: void 0
3953
3953
  })),
3954
3954
  ...Be(t, e, t.container.element(e), [
3955
- m.Enum,
3956
- m.Schema
3955
+ T.Enum,
3956
+ T.Schema
3957
3957
  ]).suggestions
3958
3958
  ]
3959
3959
  };
3960
3960
  }
3961
- function Ct(t, e) {
3961
+ function Xt(t, e) {
3962
3962
  const n = t.container.element(e), s = n == null ? void 0 : n.parent;
3963
- if (!((s == null ? void 0 : s.symbol) instanceof _t))
3963
+ if (!((s == null ? void 0 : s.symbol) instanceof At))
3964
3964
  return O();
3965
3965
  const { symbolTable: i } = s.symbol;
3966
3966
  return Fe({
@@ -3968,12 +3968,12 @@ function Ct(t, e) {
3968
3968
  const a = ie(r).unwrap_or(void 0);
3969
3969
  if (a === void 0)
3970
3970
  return [];
3971
- const { name: c } = a;
3971
+ const { name: u } = a;
3972
3972
  return {
3973
- label: c,
3974
- insertText: c,
3973
+ label: u,
3974
+ insertText: u,
3975
3975
  insertTextRules: k.KeepWhitespace,
3976
- kind: Ae(m.Column),
3976
+ kind: Ae(T.Column),
3977
3977
  range: void 0
3978
3978
  };
3979
3979
  })
@@ -3985,7 +3985,7 @@ function et(t, e) {
3985
3985
  const n = [e.callee, ...e.args], s = n.findIndex((i) => t <= i.end);
3986
3986
  return s === -1 ? n.length : s;
3987
3987
  }
3988
- class Xt {
3988
+ class $t {
3989
3989
  constructor(e) {
3990
3990
  this.compiler = e;
3991
3991
  }
@@ -3993,16 +3993,16 @@ class Xt {
3993
3993
  var a;
3994
3994
  const { uri: s } = e, i = Ke(e, n), r = [...this.compiler.container.stack(i)];
3995
3995
  for (; r.length !== 0; ) {
3996
- const c = r.pop();
3997
- if ((a = c == null ? void 0 : c.referee) != null && a.declaration && [Ee.PRIMARY_EXPRESSION, Ee.VARIABLE].includes(c == null ? void 0 : c.kind)) {
3998
- const { startPos: p, endPos: h } = c.referee.declaration;
3996
+ const u = r.pop();
3997
+ if ((a = u == null ? void 0 : u.referee) != null && a.declaration && [Ee.PRIMARY_EXPRESSION, Ee.VARIABLE].includes(u == null ? void 0 : u.kind)) {
3998
+ const { startPos: p, endPos: f } = u.referee.declaration;
3999
3999
  return [
4000
4000
  {
4001
4001
  range: {
4002
4002
  startColumn: p.column + 1,
4003
4003
  startLineNumber: p.line + 1,
4004
- endColumn: h.column + 1,
4005
- endLineNumber: h.line + 1
4004
+ endColumn: f.column + 1,
4005
+ endLineNumber: f.line + 1
4006
4006
  },
4007
4007
  uri: s
4008
4008
  }
@@ -4012,7 +4012,7 @@ class Xt {
4012
4012
  return [];
4013
4013
  }
4014
4014
  }
4015
- class $t {
4015
+ class Wt {
4016
4016
  constructor(e) {
4017
4017
  this.compiler = e;
4018
4018
  }
@@ -4025,14 +4025,14 @@ class $t {
4025
4025
  Ee.FUNCTION_APPLICATION,
4026
4026
  Ee.PRIMARY_EXPRESSION
4027
4027
  ].includes(a == null ? void 0 : a.kind)) {
4028
- const { symbol: c } = a;
4029
- if (c != null && c.references.length)
4030
- return c.references.map(({ startPos: p, endPos: h }) => ({
4028
+ const { symbol: u } = a;
4029
+ if (u != null && u.references.length)
4030
+ return u.references.map(({ startPos: p, endPos: f }) => ({
4031
4031
  range: {
4032
4032
  startColumn: p.column + 1,
4033
4033
  startLineNumber: p.line + 1,
4034
- endColumn: h.column + 1,
4035
- endLineNumber: h.line + 1
4034
+ endColumn: f.column + 1,
4035
+ endLineNumber: f.line + 1
4036
4036
  },
4037
4037
  uri: s
4038
4038
  }));
@@ -4041,24 +4041,24 @@ class $t {
4041
4041
  return [];
4042
4042
  }
4043
4043
  }
4044
- const cs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4044
+ const us = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4045
4045
  __proto__: null,
4046
4046
  CompletionItemInsertTextRule: k,
4047
4047
  CompletionItemKind: L,
4048
- DBMLCompletionItemProvider: Bt,
4049
- DBMLDefinitionProvider: Xt,
4050
- DBMLReferencesProvider: $t
4048
+ DBMLCompletionItemProvider: Vt,
4049
+ DBMLDefinitionProvider: $t,
4050
+ DBMLReferencesProvider: Wt
4051
4051
  }, Symbol.toStringTag, { value: "Module" }));
4052
4052
  var R = /* @__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))(R || {});
4053
- class ls {
4053
+ class hs {
4054
4054
  constructor() {
4055
4055
  this.source = "", this.cache = new Array(
4056
4056
  16
4057
4057
  /* TOTAL_QUERY_COUNT */
4058
- ).fill(null), this.nodeIdGenerator = new Yt(), this.symbolIdGenerator = new Jt(), this.token = {
4058
+ ).fill(null), this.nodeIdGenerator = new Qt(), this.symbolIdGenerator = new Kt(), this.token = {
4059
4059
  invalidStream: this.createQuery(
4060
4060
  6,
4061
- () => this.parse.tokens().filter(At)
4061
+ () => this.parse.tokens().filter(vt)
4062
4062
  ),
4063
4063
  // Valid + Invalid tokens (which are guarenteed to be non-trivials) are included in the stream
4064
4064
  flatStream: this.createQuery(
@@ -4070,8 +4070,8 @@ class ls {
4070
4070
  _: this.createQuery(
4071
4071
  0,
4072
4072
  () => {
4073
- const e = new cn(this.source).lex().chain((n) => new hn(n, this.nodeIdGenerator).parse()).chain(({ ast: n, tokens: s }) => new jn(n, this.symbolIdGenerator).analyze().map(() => ({ ast: n, tokens: s })));
4074
- return e.getErrors().length > 0 ? e : e.chain(({ ast: n, tokens: s }) => new Hn(n).interpret().map((r) => ({ ast: n, tokens: s, rawDb: r })));
4073
+ const e = new un(this.source).lex().chain((n) => new pn(n, this.nodeIdGenerator).parse()).chain(({ ast: n, tokens: s }) => new zn(n, this.symbolIdGenerator).analyze().map(() => ({ ast: n, tokens: s })));
4074
+ return e.getErrors().length > 0 ? e : e.chain(({ ast: n, tokens: s }) => new Zn(n).interpret().map((r) => ({ ast: n, tokens: s, rawDb: r })));
4075
4075
  }
4076
4076
  ),
4077
4077
  ast: this.createQuery(
@@ -4095,44 +4095,38 @@ class ls {
4095
4095
  stack: this.createQuery(
4096
4096
  10,
4097
4097
  (e) => {
4098
- const n = this.parse.tokens();
4099
- let { index: s } = this.container.token(e);
4100
- const { token: i } = this.container.token(e);
4101
- if (s === void 0)
4102
- return [this.parse.ast()];
4103
- for (; n[s].isInvalid && s >= 0; )
4104
- s -= 1;
4105
- if (s === -1)
4098
+ const n = this.token.flatStream(), { index: s, token: i } = this.container.token(e), r = s === void 0 ? -1 : jt(n, (f) => !f.isInvalid, s);
4099
+ if (r === -1)
4106
4100
  return [this.parse.ast()];
4107
- const r = n[s].start;
4108
- let a = this.parse.ast();
4109
- const c = [a];
4101
+ const a = n[r].start;
4102
+ let u = this.parse.ast();
4103
+ const p = [u];
4110
4104
  for (; ; ) {
4111
- const h = on(a).find((T) => ge(r, T));
4112
- if (h === void 0 || h instanceof F)
4105
+ const E = ln(u).find((h) => ge(a, h));
4106
+ if (E === void 0 || E instanceof F)
4113
4107
  break;
4114
- c.push(h), a = h;
4108
+ p.push(E), u = E;
4115
4109
  }
4116
- if ((i == null ? void 0 : i.kind) === u.COLON)
4117
- return c;
4118
- for (; c.length > 0; ) {
4119
- let p = !1;
4120
- const h = I.last(c);
4121
- if (h instanceof y) {
4122
- const T = this.parse.source();
4123
- for (let f = h.end; f < e; f += 1)
4124
- T[f] === `
4125
- ` && (c.pop(), p = !0);
4110
+ if ((i == null ? void 0 : i.kind) === l.COLON)
4111
+ return p;
4112
+ for (; p.length > 0; ) {
4113
+ let f = !1;
4114
+ const E = it(p);
4115
+ if (E instanceof y) {
4116
+ const h = this.parse.source();
4117
+ for (let m = E.end; m < e; m += 1)
4118
+ h[m] === `
4119
+ ` && (p.pop(), f = !0);
4126
4120
  } else
4127
- h instanceof Q || h instanceof q ? this.container.token(e).token !== h.op && (c.pop(), p = !0) : h instanceof D ? h.listCloseBracket && h.end <= e && (c.pop(), p = !0) : h instanceof J ? h.tupleCloseParen && h.end <= e && (c.pop(), p = !0) : h instanceof ne ? h.blockCloseBrace && h.end <= e && (c.pop(), p = !0) : h instanceof $ || h.end < e && (c.pop(), p = !0);
4128
- if (p) {
4129
- const T = I.last(c);
4130
- T instanceof A && T.end <= e && c.pop();
4121
+ E instanceof Q || E instanceof q ? this.container.token(e).token !== E.op && (p.pop(), f = !0) : E instanceof D ? E.listCloseBracket && E.end <= e && (p.pop(), f = !0) : E instanceof J ? E.tupleCloseParen && E.end <= e && (p.pop(), f = !0) : E instanceof ne ? E.blockCloseBrace && E.end <= e && (p.pop(), f = !0) : E instanceof $ || E.end < e && (p.pop(), f = !0);
4122
+ if (f) {
4123
+ const h = it(p);
4124
+ h instanceof A && h.end <= e && p.pop();
4131
4125
  }
4132
- if (!p)
4126
+ if (!f)
4133
4127
  break;
4134
4128
  }
4135
- return c;
4129
+ return p;
4136
4130
  }
4137
4131
  ),
4138
4132
  token: this.createQuery(
@@ -4204,15 +4198,15 @@ class ls {
4204
4198
  if (!((i = r.symbol) != null && i.symbolTable))
4205
4199
  continue;
4206
4200
  const { symbolTable: a } = r.symbol;
4207
- let c = [a], p = [];
4208
- for (const h of e)
4209
- p = c.flatMap(
4210
- (T) => qt(h).flatMap((f) => {
4211
- const N = T.get(f), g = ie(f).unwrap_or(void 0);
4212
- return !N || !g ? [] : { ...g, symbol: N };
4201
+ let u = [a], p = [];
4202
+ for (const f of e)
4203
+ p = u.flatMap(
4204
+ (E) => Jt(f).flatMap((h) => {
4205
+ const m = E.get(h), g = ie(h).unwrap_or(void 0);
4206
+ return !m || !g ? [] : { ...g, symbol: m };
4213
4207
  })
4214
- ), c = p.flatMap(
4215
- (T) => T.symbol.symbolTable ? T.symbol.symbolTable : []
4208
+ ), u = p.flatMap(
4209
+ (E) => E.symbol.symbolTable ? E.symbol.symbolTable : []
4216
4210
  );
4217
4211
  s.push(...p);
4218
4212
  }
@@ -4238,8 +4232,8 @@ class ls {
4238
4232
  if (r.has(a))
4239
4233
  return r.get(a);
4240
4234
  }
4241
- const c = n(i);
4242
- return i !== void 0 ? r instanceof Map ? r.set(a, c) : (this.cache[e] = /* @__PURE__ */ new Map(), this.cache[e].set(a, c)) : this.cache[e] = c, c;
4235
+ const u = n(i);
4236
+ return i !== void 0 ? r instanceof Map ? r.set(a, u) : (this.cache[e] = /* @__PURE__ */ new Map(), this.cache[e].set(a, u)) : this.cache[e] = u, u;
4243
4237
  };
4244
4238
  }
4245
4239
  setSource(e) {
@@ -4250,14 +4244,14 @@ class ls {
4250
4244
  }
4251
4245
  initMonacoServices() {
4252
4246
  return {
4253
- definitionProvider: new Xt(this),
4254
- referenceProvider: new $t(this),
4255
- autocompletionProvider: new Bt(this)
4247
+ definitionProvider: new $t(this),
4248
+ referenceProvider: new Wt(this),
4249
+ autocompletionProvider: new Vt(this)
4256
4250
  };
4257
4251
  }
4258
4252
  }
4259
4253
  export {
4260
- ls as Compiler,
4261
- os as serialize,
4262
- cs as services
4254
+ hs as Compiler,
4255
+ ls as serialize,
4256
+ us as services
4263
4257
  };