@dbml/parse 3.9.5 → 3.9.6

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, { partition as Yt, findLastIndex as zt, last as rt } from "lodash";
1
+ import I, { last as Ce, partition as zt, findLastIndex as Qt } from "lodash";
2
2
  var u = /* @__PURE__ */ ((t) => (t.SPACE = "<space>", t.TAB = "<tab>", t.NEWLINE = "<newline>", t.COMMA = "<comma>", t.LPAREN = "<lparen>", t.RPAREN = "<rparen>", t.LBRACE = "<lbrace>", t.RBRACE = "<rbrace>", t.LBRACKET = "<lbracket>", t.RBRACKET = "<rbracket>", t.LANGLE = "<langle>", t.RANGLE = "<rangle>", t.OP = "<op>", t.EOF = "<eof>", t.NUMERIC_LITERAL = "<number>", t.STRING_LITERAL = "<string>", t.COLOR_LITERAL = "<color>", t.FUNCTION_EXPRESSION = "<function-expression>", t.QUOTED_STRING = "<variable>", t.IDENTIFIER = "<identifier>", t.SEMICOLON = "<semicolon>", t.COLON = "<colon>", t.SINGLE_LINE_COMMENT = "<single-line-comment>", t.MULTILINE_COMMENT = "<multiline-comment>", t))(u || {});
3
- function Qt(t) {
3
+ function qt(t) {
4
4
  switch (t.kind) {
5
5
  case "<newline>":
6
6
  case "<space>":
@@ -36,12 +36,12 @@ function at(t) {
36
36
  function ot(t) {
37
37
  return t !== void 0 && t.kind === "<op>";
38
38
  }
39
- class F {
39
+ class B {
40
40
  constructor(e, n, s, i, r) {
41
41
  this.kind = e, this.startPos = n, this.endPos = s, this.value = i, this.leadingTrivia = [], this.trailingTrivia = [], this.leadingInvalid = [], this.trailingInvalid = [], this.isInvalid = r, this.start = n.offset, this.end = s.offset;
42
42
  }
43
43
  static create(e, n, s, i, r) {
44
- return new F(e, n, s, i, r);
44
+ return new B(e, n, s, i, r);
45
45
  }
46
46
  }
47
47
  function It(t) {
@@ -50,21 +50,21 @@ function It(t) {
50
50
  function lt(t, e) {
51
51
  return e.leadingTrivia.find(({ kind: s }) => s === u.NEWLINE) !== void 0 || It(t);
52
52
  }
53
- function Ce(t) {
54
- return t.trailingTrivia.find(({ kind: e }) => e === u.SPACE) !== void 0;
53
+ function Xe(t) {
54
+ return t.trailingTrivia.find(({ kind: e }) => [u.SPACE, u.TAB].includes(e)) !== void 0;
55
55
  }
56
56
  function Lt(t) {
57
- return t.trailingTrivia.length === 0 ? t.end : Lt(I.last(t.trailingTrivia));
57
+ return t.trailingTrivia.length === 0 ? t.end : Lt(Ce(t.trailingTrivia));
58
58
  }
59
59
  function gt(t) {
60
60
  return t.leadingTrivia.length === 0 ? t.start : gt(t.leadingTrivia[0]);
61
61
  }
62
- function qt(t) {
62
+ function Ht(t) {
63
63
  return [u.SINGLE_LINE_COMMENT, u.MULTILINE_COMMENT].includes(
64
64
  t.kind
65
65
  );
66
66
  }
67
- class Ht {
67
+ class Jt {
68
68
  constructor() {
69
69
  this.id = 0;
70
70
  }
@@ -75,19 +75,19 @@ class Ht {
75
75
  return this.id++;
76
76
  }
77
77
  }
78
- class x {
78
+ class k {
79
79
  // The symbol that this syntax node refers to
80
80
  // args must be passed in order of appearance in the node
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 ? gt(i) : i.fullStart) : (this.startPos = {
84
+ i ? (this.startPos = i.startPos, this.fullStart = i instanceof B ? gt(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 ? Lt(r) : r.fullEnd) : (this.endPos = {
90
+ r ? (this.endPos = r.endPos, this.fullEnd = r instanceof B ? Lt(r) : r.fullEnd) : (this.endPos = {
91
91
  offset: NaN,
92
92
  column: NaN,
93
93
  line: NaN
@@ -95,12 +95,12 @@ class x {
95
95
  }
96
96
  }
97
97
  var Ne = /* @__PURE__ */ ((t) => (t.PROGRAM = "<program>", t.ELEMENT_DECLARATION = "<element-declaration>", t.ATTRIBUTE = "<attribute>", t.IDENTIFIER_STREAM = "<identifer-stream>", t.LITERAL = "<literal>", t.VARIABLE = "<variable>", t.PREFIX_EXPRESSION = "<prefix-expression>", t.INFIX_EXPRESSION = "<infix-expression>", t.POSTFIX_EXPRESSION = "<postfix-expression>", t.FUNCTION_EXPRESSION = "<function-expression>", t.FUNCTION_APPLICATION = "<function-application>", t.BLOCK_EXPRESSION = "<block-expression>", t.LIST_EXPRESSION = "<list-expression>", t.TUPLE_EXPRESSION = "<tuple-expression>", t.CALL_EXPRESSION = "<call-expression>", t.PRIMARY_EXPRESSION = "<primary-expression>", t.GROUP_EXPRESSION = "<group-expression>", t.DUMMY = "<dummy>", t.ARRAY = "<array>", t))(Ne || {});
98
- class X extends x {
98
+ class $ extends k {
99
99
  constructor({ body: e = [], eof: n }, s) {
100
100
  super(s, "<program>", [...e, n]), this.body = e, this.eof = n;
101
101
  }
102
102
  }
103
- class v extends x {
103
+ class A extends k {
104
104
  constructor({
105
105
  type: e,
106
106
  name: n,
@@ -118,17 +118,17 @@ class v extends x {
118
118
  r,
119
119
  a,
120
120
  l
121
- ]), l && a && !(l instanceof w || l instanceof v))
121
+ ]), l && a && !(l instanceof v || l instanceof A))
122
122
  throw new Error("If an element has a simple body, it must be a function application node");
123
123
  this.type = e, this.name = n, this.as = s, this.alias = i, this.attributeList = r, this.bodyColon = a, this.body = l;
124
124
  }
125
125
  }
126
- class Y extends x {
126
+ class z extends k {
127
127
  constructor({ identifiers: e = [] }, n) {
128
128
  super(n, "<identifer-stream>", e || []), this.identifiers = e;
129
129
  }
130
130
  }
131
- class se extends x {
131
+ class ie extends k {
132
132
  constructor({
133
133
  name: e,
134
134
  colon: n,
@@ -137,12 +137,12 @@ class se extends x {
137
137
  super(i, "<attribute>", [e, n, s]), this.name = e, this.value = s, this.colon = n;
138
138
  }
139
139
  }
140
- class Q extends x {
140
+ class q extends k {
141
141
  constructor({ op: e, expression: n }, s) {
142
142
  super(s, "<prefix-expression>", [e, n]), this.op = e, this.expression = n;
143
143
  }
144
144
  }
145
- class q extends x {
145
+ class H extends k {
146
146
  constructor({
147
147
  op: e,
148
148
  leftExpression: n,
@@ -151,22 +151,22 @@ class q extends x {
151
151
  super(i, "<infix-expression>", [n, e, s]), this.op = e, this.leftExpression = n, this.rightExpression = s;
152
152
  }
153
153
  }
154
- class Ue extends x {
154
+ class Ue extends k {
155
155
  constructor({ op: e, expression: n }, s) {
156
156
  super(s, "<postfix-expression>", [n, e]), this.op = e, this.expression = n;
157
157
  }
158
158
  }
159
- class ne extends x {
159
+ class se extends k {
160
160
  constructor({ value: e }, n) {
161
161
  super(n, "<function-expression>", [e]), this.value = e;
162
162
  }
163
163
  }
164
- class w extends x {
164
+ class v extends k {
165
165
  constructor({ callee: e, args: n = [] }, s) {
166
166
  super(s, "<function-application>", [e, ...n]), this.callee = e, this.args = n;
167
167
  }
168
168
  }
169
- class J extends x {
169
+ class Z extends k {
170
170
  constructor({
171
171
  blockOpenBrace: e,
172
172
  body: n = [],
@@ -175,7 +175,7 @@ class J extends x {
175
175
  super(i, "<block-expression>", [e, ...n, s]), this.blockOpenBrace = e, this.body = n, this.blockCloseBrace = s;
176
176
  }
177
177
  }
178
- class R extends x {
178
+ class P extends k {
179
179
  constructor({
180
180
  listOpenBracket: e,
181
181
  elementList: n = [],
@@ -189,7 +189,7 @@ class R extends x {
189
189
  ]), this.listOpenBracket = e, this.elementList = n, this.commaList = s, this.listCloseBracket = i;
190
190
  }
191
191
  }
192
- class Z extends x {
192
+ class K extends k {
193
193
  constructor({
194
194
  tupleOpenParen: e,
195
195
  elementList: n = [],
@@ -203,7 +203,7 @@ class Z extends x {
203
203
  ]), this.tupleOpenParen = e, this.elementList = n, this.commaList = s, this.tupleCloseParen = i;
204
204
  }
205
205
  }
206
- class We extends Z {
206
+ class je extends K {
207
207
  constructor({
208
208
  groupOpenParen: e,
209
209
  expression: n,
@@ -220,7 +220,7 @@ class We extends Z {
220
220
  ), this.kind = "<group-expression>";
221
221
  }
222
222
  }
223
- class H extends x {
223
+ class J extends k {
224
224
  constructor({
225
225
  callee: e,
226
226
  argumentList: n
@@ -228,28 +228,28 @@ class H extends x {
228
228
  super(s, "<call-expression>", [e, n]), this.callee = e, this.argumentList = n;
229
229
  }
230
230
  }
231
- class be extends x {
231
+ class be extends k {
232
232
  constructor({ literal: e }, n) {
233
233
  super(n, "<literal>", [e]), this.literal = e;
234
234
  }
235
235
  }
236
- class K extends x {
236
+ class ee extends k {
237
237
  constructor({ variable: e }, n) {
238
238
  super(n, "<variable>", [e]), this.variable = e;
239
239
  }
240
240
  }
241
- class U extends x {
241
+ class M extends k {
242
242
  constructor({ expression: e }, n) {
243
243
  super(n, "<primary-expression>", [e]), this.expression = e;
244
244
  }
245
245
  }
246
- class xe extends x {
246
+ class xe extends k {
247
247
  constructor({ pre: e }, n) {
248
- const s = F.create(u.SPACE, e.endPos, e.endPos, " ", !1);
248
+ const s = B.create(u.SPACE, e.endPos, e.endPos, " ", !1);
249
249
  super(n, "<dummy>", [s]);
250
250
  }
251
251
  }
252
- class he extends x {
252
+ class he extends k {
253
253
  constructor({ expression: e, indexer: n }, s) {
254
254
  super(s, "<array>", [e, n]), this.array = e, this.indexer = n;
255
255
  }
@@ -264,12 +264,12 @@ function _t(t, e) {
264
264
  (i) => i !== null
265
265
  );
266
266
  }
267
- function us(t, e = !1) {
267
+ function hs(t, e = !1) {
268
268
  return JSON.stringify(
269
269
  t,
270
270
  function(n, s) {
271
271
  var i;
272
- return !(this instanceof X) && n === "symbol" ? s == null ? void 0 : s.id : (
272
+ return !(this instanceof $) && n === "symbol" ? s == null ? void 0 : s.id : (
273
273
  /* this instanceof SyntaxNode && */
274
274
  n === "symbol" ? {
275
275
  symbolTable: s == null ? void 0 : s.symbolTable,
@@ -290,7 +290,7 @@ function us(t, e = !1) {
290
290
  e ? 2 : 0
291
291
  );
292
292
  }
293
- class S {
293
+ class x {
294
294
  constructor(e) {
295
295
  this.value = e;
296
296
  }
@@ -305,14 +305,14 @@ class S {
305
305
  return e(this.value);
306
306
  }
307
307
  map(e) {
308
- return new S(e(this.value));
308
+ return new x(e(this.value));
309
309
  }
310
310
  // eslint-disable-next-line class-methods-use-this
311
311
  isOk() {
312
312
  return !0;
313
313
  }
314
314
  }
315
- class k {
315
+ class y {
316
316
  // eslint-disable-next-line class-methods-use-this
317
317
  unwrap() {
318
318
  throw new Error("Trying to unwrap a None value");
@@ -323,11 +323,11 @@ class k {
323
323
  }
324
324
  // eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this
325
325
  and_then(e) {
326
- return new k();
326
+ return new y();
327
327
  }
328
328
  // eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this
329
329
  map(e) {
330
- return new k();
330
+ return new y();
331
331
  }
332
332
  // eslint-disable-next-line class-methods-use-this
333
333
  isOk() {
@@ -335,73 +335,73 @@ class k {
335
335
  }
336
336
  }
337
337
  var T = /* @__PURE__ */ ((t) => (t.Schema = "Schema", t.Table = "Table", t.Column = "Column", t.TableGroup = "TableGroup", t.TableGroupField = "TableGroup field", t.Enum = "Enum", t.EnumField = "Enum field", t.Note = "Note", t))(T || {});
338
- function je(t) {
338
+ function Ye(t) {
339
339
  return `Schema:${t}`;
340
340
  }
341
341
  function Oe(t) {
342
342
  return `Table:${t}`;
343
343
  }
344
- function Ye(t) {
344
+ function ze(t) {
345
345
  return `Column:${t}`;
346
346
  }
347
- function ze(t) {
347
+ function Qe(t) {
348
348
  return `Enum:${t}`;
349
349
  }
350
- function Qe(t) {
350
+ function qe(t) {
351
351
  return `Enum field:${t}`;
352
352
  }
353
- function qe(t) {
353
+ function He(t) {
354
354
  return `TableGroup:${t}`;
355
355
  }
356
- function He(t) {
356
+ function Je(t) {
357
357
  return `TableGroup field:${t}`;
358
358
  }
359
- function Jt(t) {
359
+ function Zt(t) {
360
360
  return `Note:${t}`;
361
361
  }
362
362
  function Ve(t, e) {
363
363
  switch (e) {
364
364
  case "Column":
365
- return Ye(t);
366
- case "Enum":
367
365
  return ze(t);
368
- case "Enum field":
366
+ case "Enum":
369
367
  return Qe(t);
368
+ case "Enum field":
369
+ return qe(t);
370
370
  case "Schema":
371
- return je(t);
371
+ return Ye(t);
372
372
  case "Table":
373
373
  return Oe(t);
374
374
  case "TableGroup":
375
- return qe(t);
376
- case "TableGroup field":
377
375
  return He(t);
376
+ case "TableGroup field":
377
+ return Je(t);
378
378
  default:
379
379
  throw new Error("Unreachable");
380
380
  }
381
381
  }
382
- function ie(t) {
382
+ function re(t) {
383
383
  const [e, n] = t.split(":");
384
- return Object.values(T).includes(e) ? new S({
384
+ return Object.values(T).includes(e) ? new x({
385
385
  name: n,
386
386
  kind: e
387
- }) : new k();
387
+ }) : new y();
388
388
  }
389
- function Zt(t) {
390
- const e = ie(t).unwrap_or(void 0);
389
+ function Kt(t) {
390
+ const e = re(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 Kt(t) {
396
+ function en(t) {
397
397
  return [
398
- je,
398
+ Ye,
399
399
  Oe,
400
+ Qe,
401
+ He,
400
402
  ze,
401
403
  qe,
402
- Ye,
403
- Qe,
404
- He
404
+ Je
405
405
  ].map((e) => e(t));
406
406
  }
407
407
  function Me(t) {
@@ -411,7 +411,7 @@ function De(t) {
411
411
  const [e] = t;
412
412
  return e >= "0" && e <= "9";
413
413
  }
414
- function en(t) {
414
+ function tn(t) {
415
415
  const [e] = t;
416
416
  return De(e) || Me(e) && e.toLowerCase() >= "a" && e.toLowerCase() <= "f";
417
417
  }
@@ -427,7 +427,7 @@ function ct(t, e) {
427
427
  function ge(t, e) {
428
428
  return t >= e.start && t < e.end;
429
429
  }
430
- class tn {
430
+ class nn {
431
431
  constructor() {
432
432
  this.id = 0;
433
433
  }
@@ -443,12 +443,12 @@ class At {
443
443
  this.references = [], this.id = n, this.symbolTable = e;
444
444
  }
445
445
  }
446
- class nn {
446
+ class sn {
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 sn {
451
+ class rn {
452
452
  constructor({ declaration: e }, n) {
453
453
  this.references = [], this.id = n, this.declaration = e;
454
454
  }
@@ -458,17 +458,17 @@ class vt {
458
458
  this.references = [], this.id = s, this.symbolTable = e, this.declaration = n;
459
459
  }
460
460
  }
461
- class rn {
461
+ class an {
462
462
  constructor({ declaration: e }, n) {
463
463
  this.references = [], this.id = n, this.declaration = e;
464
464
  }
465
465
  }
466
- class an {
466
+ class on {
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 on {
471
+ class ln {
472
472
  constructor({ declaration: e }, n) {
473
473
  this.references = [], this.id = n, this.declaration = e;
474
474
  }
@@ -479,7 +479,7 @@ class c extends Error {
479
479
  super(n), this.code = e, this.diagnostic = n, this.nodeOrToken = s, this.start = s.start, this.end = s.end, this.name = this.constructor.name, Object.setPrototypeOf(this, c.prototype);
480
480
  }
481
481
  }
482
- class V {
482
+ class G {
483
483
  constructor(e, n) {
484
484
  this.value = e, this.errors = n === void 0 ? [] : n;
485
485
  }
@@ -491,21 +491,21 @@ class V {
491
491
  }
492
492
  chain(e) {
493
493
  const n = e(this.value), s = [...this.errors, ...n.errors];
494
- return new V(n.value, s);
494
+ return new G(n.value, s);
495
495
  }
496
496
  map(e) {
497
- return new V(e(this.value), this.errors);
497
+ return new G(e(this.value), this.errors);
498
498
  }
499
499
  }
500
- function ln(t, e, n) {
500
+ function cn(t, e, n) {
501
501
  if (!t || !me(t) || e.length === 0)
502
- return new k();
502
+ return new y();
503
503
  const s = [...e], i = Ge(t).unwrap(), r = s.pop();
504
- if (!(r instanceof J))
505
- return new k();
506
- const a = I.last(s) instanceof R ? s.pop() : void 0;
507
- return s.length === 3 && Ge(s[1]).unwrap().value === "as" ? new S(
508
- n.create(v, {
504
+ if (!(r instanceof Z))
505
+ return new y();
506
+ const a = I.last(s) instanceof P ? s.pop() : void 0;
507
+ return s.length === 3 && Ge(s[1]).unwrap().value === "as" ? new x(
508
+ n.create(A, {
509
509
  type: i,
510
510
  name: s[0],
511
511
  as: Ge(s[1]).unwrap(),
@@ -513,75 +513,75 @@ function ln(t, e, n) {
513
513
  attributeList: a,
514
514
  body: r
515
515
  })
516
- ) : s.length === 1 ? new S(
517
- n.create(v, {
516
+ ) : s.length === 1 ? new x(
517
+ n.create(A, {
518
518
  type: i,
519
519
  name: s[0],
520
520
  attributeList: a,
521
521
  body: r
522
522
  })
523
- ) : s.length === 0 ? new S(
524
- n.create(v, {
523
+ ) : s.length === 0 ? new x(
524
+ n.create(A, {
525
525
  type: i,
526
526
  attributeList: a,
527
527
  body: r
528
528
  })
529
- ) : new k();
529
+ ) : new y();
530
530
  }
531
531
  function ut(t) {
532
532
  return t.kind === u.IDENTIFIER && t.value === "as";
533
533
  }
534
534
  function N(t) {
535
- t && (t instanceof F ? cn(t) : un(t));
535
+ t && (t instanceof B ? un(t) : hn(t));
536
536
  }
537
- function cn(t) {
537
+ function un(t) {
538
538
  t.kind !== u.EOF && (t.isInvalid = !0);
539
539
  }
540
- function un(t) {
541
- if (t instanceof v)
540
+ function hn(t) {
541
+ if (t instanceof A)
542
542
  N(t.type), N(t.name), N(t.as), N(t.alias), N(t.bodyColon), N(t.attributeList), N(t.body);
543
- else if (t instanceof Y)
543
+ else if (t instanceof z)
544
544
  t.identifiers.forEach(N);
545
- else if (t instanceof se)
545
+ else if (t instanceof ie)
546
546
  N(t.name), N(t.colon), N(t.value);
547
- else if (t instanceof Q)
548
- N(t.op), N(t.expression);
549
547
  else if (t instanceof q)
548
+ N(t.op), N(t.expression);
549
+ else if (t instanceof H)
550
550
  N(t.leftExpression), N(t.op), N(t.rightExpression);
551
551
  else if (t instanceof Ue)
552
552
  N(t.op), N(t.expression);
553
- else if (t instanceof J)
553
+ else if (t instanceof Z)
554
554
  N(t.blockOpenBrace), t.body.forEach(N), N(t.blockCloseBrace);
555
- else if (t instanceof R)
555
+ else if (t instanceof P)
556
556
  N(t.listOpenBracket), t.commaList.forEach(N), t.elementList.forEach(N), N(t.listCloseBracket);
557
- else if (t instanceof Z)
557
+ else if (t instanceof K)
558
558
  N(t.tupleOpenParen), t.commaList.forEach(N), t.elementList.forEach(N), N(t.tupleCloseParen);
559
- else if (t instanceof H)
559
+ else if (t instanceof J)
560
560
  N(t.callee), N(t.argumentList);
561
- else if (t instanceof w)
561
+ else if (t instanceof v)
562
562
  N(t.callee), t.args.forEach(N);
563
- else if (t instanceof U)
563
+ else if (t instanceof M)
564
564
  N(t.expression);
565
- else if (t instanceof ne)
565
+ else if (t instanceof se)
566
566
  N(t.value);
567
- else if (t instanceof K)
567
+ else if (t instanceof ee)
568
568
  N(t.variable);
569
569
  else if (t instanceof be)
570
570
  N(t.literal);
571
571
  else
572
- throw t instanceof We ? new Error("This case is handled by the TupleExpressionNode case") : new Error("Unreachable case in markInvalidNode");
572
+ throw t instanceof je ? new Error("This case is handled by the TupleExpressionNode case") : new Error("Unreachable case in markInvalidNode");
573
573
  }
574
574
  function wt(t) {
575
575
  return !!(t != null && t.isInvalid);
576
576
  }
577
- function P(...t) {
577
+ function U(...t) {
578
578
  return t.filter((e) => e !== void 0);
579
579
  }
580
- function hn(t) {
581
- if (t instanceof X)
582
- return P(...t.body, t.eof);
583
- if (t instanceof v)
584
- return P(
580
+ function fn(t) {
581
+ if (t instanceof $)
582
+ return U(...t.body, t.eof);
583
+ if (t instanceof A)
584
+ return U(
585
585
  t.type,
586
586
  t.name,
587
587
  t.as,
@@ -590,74 +590,74 @@ function hn(t) {
590
590
  t.bodyColon,
591
591
  t.body
592
592
  );
593
- if (t instanceof se)
594
- return P(t.name, t.colon, t.value);
595
- if (t instanceof Y)
593
+ if (t instanceof ie)
594
+ return U(t.name, t.colon, t.value);
595
+ if (t instanceof z)
596
596
  return t.identifiers;
597
597
  if (t instanceof be)
598
598
  return t.literal ? [t.literal] : [];
599
- if (t instanceof K)
600
- return P(t.variable);
601
- if (t instanceof Q)
602
- return P(t.op, t.expression);
599
+ if (t instanceof ee)
600
+ return U(t.variable);
603
601
  if (t instanceof q)
604
- return P(t.leftExpression, t.op, t.rightExpression);
602
+ return U(t.op, t.expression);
603
+ if (t instanceof H)
604
+ return U(t.leftExpression, t.op, t.rightExpression);
605
605
  if (t instanceof Ue)
606
- return P(t.expression, t.op);
607
- if (t instanceof ne)
608
- return P(t.value);
609
- if (t instanceof w)
610
- return P(t.callee, ...t.args);
611
- if (t instanceof J)
612
- return P(t.blockOpenBrace, ...t.body, t.blockCloseBrace);
613
- if (t instanceof R)
614
- return P(
606
+ return U(t.expression, t.op);
607
+ if (t instanceof se)
608
+ return U(t.value);
609
+ if (t instanceof v)
610
+ return U(t.callee, ...t.args);
611
+ if (t instanceof Z)
612
+ return U(t.blockOpenBrace, ...t.body, t.blockCloseBrace);
613
+ if (t instanceof P)
614
+ return U(
615
615
  t.listOpenBracket,
616
616
  ...ct(t.elementList, t.commaList),
617
617
  t.listCloseBracket
618
618
  );
619
- if (t instanceof Z)
620
- return P(
619
+ if (t instanceof K)
620
+ return U(
621
621
  t.tupleOpenParen,
622
622
  ...ct(t.elementList, t.commaList),
623
623
  t.tupleCloseParen
624
624
  );
625
- if (t instanceof H)
626
- return P(t.callee, t.argumentList);
627
- if (t instanceof U)
628
- return P(t.expression);
625
+ if (t instanceof J)
626
+ return U(t.callee, t.argumentList);
627
+ if (t instanceof M)
628
+ return U(t.expression);
629
629
  if (t instanceof he)
630
- return P(
630
+ return U(
631
631
  t.array,
632
632
  t.indexer
633
633
  );
634
- throw t instanceof We ? new Error("This case is already handled by TupleExpressionNode") : new Error("Unreachable - no other possible cases");
634
+ throw t instanceof je ? new Error("This case is already handled by TupleExpressionNode") : new Error("Unreachable - no other possible cases");
635
635
  }
636
636
  function Ge(t) {
637
- return M(t) ? new S(t.expression.variable) : new k();
637
+ return F(t) ? new x(t.expression.variable) : new y();
638
638
  }
639
- function $(t) {
639
+ function W(t) {
640
640
  var e;
641
- return t instanceof U && (t.expression instanceof K && 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 M && (t.expression instanceof ee && t.expression.variable instanceof B && t.expression.variable.kind === u.QUOTED_STRING || t.expression instanceof be && ((e = t.expression.literal) == null ? void 0 : e.kind) === u.STRING_LITERAL);
642
642
  }
643
- function M(t) {
644
- return t instanceof U && t.expression instanceof K && t.expression.variable instanceof F;
643
+ function F(t) {
644
+ return t instanceof M && t.expression instanceof ee && t.expression.variable instanceof B;
645
645
  }
646
646
  function me(t) {
647
647
  var e;
648
- return t instanceof U && t.expression instanceof K && ((e = t.expression.variable) == null ? void 0 : e.kind) === u.IDENTIFIER;
648
+ return t instanceof M && t.expression instanceof ee && ((e = t.expression.variable) == null ? void 0 : e.kind) === u.IDENTIFIER;
649
649
  }
650
- function Je(t) {
650
+ function Ze(t) {
651
651
  var e;
652
- return t instanceof q && t.leftExpression instanceof x && t.rightExpression instanceof x && ((e = t.op) == null ? void 0 : e.value) === ".";
652
+ return t instanceof H && t.leftExpression instanceof k && t.rightExpression instanceof k && ((e = t.op) == null ? void 0 : e.value) === ".";
653
653
  }
654
654
  function Te(t) {
655
655
  if (t === void 0)
656
- return new k();
656
+ return new y();
657
657
  const e = t.identifiers.map((n) => n.value).join(" ");
658
- return e === "" ? new k() : new S(e);
658
+ return e === "" ? new y() : new x(e);
659
659
  }
660
- class fn {
660
+ class pn {
661
661
  // list of errors during lexing
662
662
  constructor(e) {
663
663
  this.start = {
@@ -697,7 +697,7 @@ class fn {
697
697
  this.tokens.push(this.createToken(e, n));
698
698
  }
699
699
  createToken(e, n = !1) {
700
- return F.create(
700
+ return B.create(
701
701
  e,
702
702
  this.start,
703
703
  this.current,
@@ -706,7 +706,7 @@ class fn {
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 V(this.tokens, this.errors);
709
+ return this.scanTokens(), this.tokens.push(B.create(u.EOF, this.start, this.current, "", !1)), this.gatherTrivia(), this.gatherInvalid(), new G(this.tokens, this.errors);
710
710
  }
711
711
  scanTokens() {
712
712
  for (; !this.isAtEnd(); ) {
@@ -795,7 +795,7 @@ class fn {
795
795
  let e = !0, n = [], s;
796
796
  const i = [];
797
797
  for (const r of this.tokens)
798
- Qt(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
+ qt(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);
799
799
  this.tokens = i;
800
800
  }
801
801
  gatherInvalid() {
@@ -843,7 +843,7 @@ class fn {
843
843
  );
844
844
  return;
845
845
  }
846
- a && this.match(n), this.tokens.push(F.create(e, this.start, this.current, l, !1));
846
+ a && this.match(n), this.tokens.push(B.create(e, this.start, this.current, l, !1));
847
847
  }
848
848
  singleLineStringLiteral() {
849
849
  this.consumeUntil(u.STRING_LITERAL, "'", {
@@ -971,7 +971,7 @@ class fn {
971
971
  let n = "";
972
972
  for (let s = 0; s <= 3; s += 1) {
973
973
  if (this.isAtEnd() || !Ee(this.peek()))
974
- return this.errors.push(new c(o.INVALID_ESCAPE_SEQUENCE, `Invalid unicode escape sequence '\\u${n}', only unicode escape sequences of the form '\\uHHHH' where H is a hexadecimal number are allowed`, 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`, B.create(u.STRING_LITERAL, e, this.current, `\\u${n}`, !0))), `\\u${n}`;
975
975
  n += this.advance();
976
976
  }
977
977
  return String.fromCharCode(parseInt(n, 16));
@@ -982,7 +982,7 @@ class fn {
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 pn {
985
+ class dn {
986
986
  constructor() {
987
987
  this.stack = [], this.numberOfNestedLParens = 0, this.numberOfNestedLBrackets = 0, this.numberOfNestedLBraces = 0;
988
988
  }
@@ -1048,7 +1048,7 @@ class pn {
1048
1048
  }
1049
1049
  }
1050
1050
  }
1051
- class dn {
1051
+ class En {
1052
1052
  constructor(e) {
1053
1053
  this.generator = e;
1054
1054
  }
@@ -1061,9 +1061,9 @@ class d {
1061
1061
  this.token = e, this.partialNode = n, this.handlerContext = s;
1062
1062
  }
1063
1063
  }
1064
- class En {
1064
+ class Nn {
1065
1065
  constructor(e, n) {
1066
- this.current = 0, this.errors = [], this.contextStack = new pn(), this.synchronizeProgram = () => {
1066
+ this.current = 0, this.errors = [], this.contextStack = new dn(), this.synchronizeProgram = () => {
1067
1067
  const s = this.peek();
1068
1068
  s.kind !== u.EOF ? N(this.advance()) : (N(this.peek()), this.logError(s, o.UNEXPECTED_EOF, "Unexpected EOF"));
1069
1069
  }, this.synchronizeElementDeclarationName = () => {
@@ -1081,7 +1081,7 @@ class En {
1081
1081
  N(s), this.advance();
1082
1082
  }
1083
1083
  }, this.blockExpression = this.contextStack.withContextDo(Se.BlockExpression, () => {
1084
- const s = { body: [] }, i = () => this.nodeFactory.create(J, s);
1084
+ const s = { body: [] }, i = () => this.nodeFactory.create(Z, s);
1085
1085
  try {
1086
1086
  this.consume("Expect an opening brace '{'", u.LBRACE), s.blockOpenBrace = this.previous();
1087
1087
  } catch (r) {
@@ -1120,11 +1120,11 @@ class En {
1120
1120
  N(s), this.advance();
1121
1121
  }
1122
1122
  }, this.tupleExpression = this.contextStack.withContextDo(Se.GroupExpression, () => {
1123
- const s = { elementList: [], commaList: [] }, i = () => this.nodeFactory.create(We, {
1123
+ const s = { elementList: [], commaList: [] }, i = () => this.nodeFactory.create(je, {
1124
1124
  groupOpenParen: s.tupleOpenParen,
1125
1125
  groupCloseParen: s.tupleCloseParen,
1126
1126
  expression: s.elementList[0]
1127
- }), r = () => this.nodeFactory.create(Z, s);
1127
+ }), r = () => this.nodeFactory.create(K, s);
1128
1128
  try {
1129
1129
  this.consume("Expect an opening parenthesis '('", u.LPAREN), s.tupleOpenParen = this.previous();
1130
1130
  } catch (a) {
@@ -1150,7 +1150,7 @@ class En {
1150
1150
  } catch (a) {
1151
1151
  if (!(a instanceof d))
1152
1152
  throw a;
1153
- if (a.partialNode instanceof x && s.elementList.push(a.partialNode), !this.canHandle(a))
1153
+ if (a.partialNode instanceof k && s.elementList.push(a.partialNode), !this.canHandle(a))
1154
1154
  throw new d(a.token, r(), a.handlerContext);
1155
1155
  this.synchronizeTuple();
1156
1156
  }
@@ -1172,7 +1172,7 @@ class En {
1172
1172
  N(s), this.advance();
1173
1173
  }
1174
1174
  }, this.listExpression = this.contextStack.withContextDo(Se.ListExpression, () => {
1175
- const s = { elementList: [], commaList: [] }, i = () => this.nodeFactory.create(R, s);
1175
+ const s = { elementList: [], commaList: [] }, i = () => this.nodeFactory.create(P, s);
1176
1176
  try {
1177
1177
  this.consume("Expect an opening bracket '['", u.LBRACKET), s.listOpenBracket = this.previous();
1178
1178
  } catch (r) {
@@ -1198,7 +1198,7 @@ class En {
1198
1198
  } catch (r) {
1199
1199
  if (!(r instanceof d))
1200
1200
  throw r;
1201
- if (r.partialNode instanceof x && s.elementList.push(r.partialNode), !this.canHandle(r))
1201
+ if (r.partialNode instanceof k && s.elementList.push(r.partialNode), !this.canHandle(r))
1202
1202
  throw new d(r.token, i(), r.handlerContext);
1203
1203
  this.synchronizeList();
1204
1204
  }
@@ -1233,7 +1233,7 @@ class En {
1233
1233
  break;
1234
1234
  N(s), this.advance();
1235
1235
  }
1236
- }, this.tokens = e, this.nodeFactory = new dn(n);
1236
+ }, this.tokens = e, this.nodeFactory = new En(n);
1237
1237
  }
1238
1238
  isAtEnd() {
1239
1239
  return this.current >= this.tokens.length || this.tokens[this.current].kind === u.EOF;
@@ -1289,8 +1289,8 @@ class En {
1289
1289
  this.tokens = e;
1290
1290
  }
1291
1291
  parse() {
1292
- const e = this.program(), n = this.advance(), s = this.nodeFactory.create(X, { body: e, eof: n });
1293
- return this.gatherInvalid(), new V({ ast: s, tokens: this.tokens }, this.errors);
1292
+ const e = this.program(), n = this.advance(), s = this.nodeFactory.create($, { body: e, eof: n });
1293
+ return this.gatherInvalid(), new G({ ast: s, tokens: this.tokens }, this.errors);
1294
1294
  }
1295
1295
  /* Parsing and synchronizing ProgramNode */
1296
1296
  program() {
@@ -1308,7 +1308,7 @@ class En {
1308
1308
  }
1309
1309
  /* Parsing and synchronizing top-level ElementDeclarationNode */
1310
1310
  elementDeclaration() {
1311
- const e = {}, n = () => this.nodeFactory.create(v, e);
1311
+ const e = {}, n = () => this.nodeFactory.create(A, e);
1312
1312
  try {
1313
1313
  this.consume("Expect an identifier", u.IDENTIFIER), e.type = this.previous();
1314
1314
  } catch (s) {
@@ -1352,13 +1352,13 @@ class En {
1352
1352
  if (this.match(u.COLON)) {
1353
1353
  e.bodyColon = this.previous();
1354
1354
  const s = this.expression();
1355
- s instanceof v ? (N(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) {
1359
1359
  throw s instanceof d ? (e.body = s.partialNode, new d(s.token, n(), s.handlerContext)) : s;
1360
1360
  }
1361
- return this.nodeFactory.create(v, e);
1361
+ return this.nodeFactory.create(A, e);
1362
1362
  }
1363
1363
  /* Parsing nested element declarations with simple body */
1364
1364
  // e.g
@@ -1367,7 +1367,7 @@ class En {
1367
1367
  // Note: 'This is a note' // fieldDeclaration() handles this
1368
1368
  // }
1369
1369
  fieldDeclaration() {
1370
- const e = {}, n = () => this.nodeFactory.create(v, e);
1370
+ const e = {}, n = () => this.nodeFactory.create(A, e);
1371
1371
  try {
1372
1372
  this.consume("Expect an identifier", u.IDENTIFIER), e.type = this.previous();
1373
1373
  } catch (s) {
@@ -1380,16 +1380,16 @@ class En {
1380
1380
  }
1381
1381
  try {
1382
1382
  const s = this.expression();
1383
- s instanceof v ? this.errors.push(new c(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
  }
1387
- return this.nodeFactory.create(v, e);
1387
+ return this.nodeFactory.create(A, e);
1388
1388
  }
1389
1389
  /* Parsing any ExpressionNode, including non-NormalExpression */
1390
1390
  expression() {
1391
- const e = { args: [] }, n = () => ln(e.callee, e.args, this.nodeFactory).unwrap_or(
1392
- this.nodeFactory.create(w, e)
1391
+ const e = { args: [] }, n = () => cn(e.callee, e.args, this.nodeFactory).unwrap_or(
1392
+ this.nodeFactory.create(v, e)
1393
1393
  );
1394
1394
  try {
1395
1395
  e.callee = this.normalExpression();
@@ -1400,7 +1400,7 @@ class En {
1400
1400
  return n();
1401
1401
  let s = e.callee;
1402
1402
  for (; !this.shouldStopExpression(); ) {
1403
- Ce(this.previous()) || this.logError(s, o.MISSING_SPACES, "Expect a following space");
1403
+ Xe(this.previous()) || this.logError(s, o.MISSING_SPACES, "Expect a following space");
1404
1404
  try {
1405
1405
  s = this.normalExpression(), e.args.push(s);
1406
1406
  } catch (i) {
@@ -1432,18 +1432,18 @@ class En {
1432
1432
  lt(this.previous(), s) && !this.contextStack.isWithinGroupExpressionContext() && !this.contextStack.isWithinListExpressionContext())
1433
1433
  break;
1434
1434
  try {
1435
- n = this.nodeFactory.create(H, {
1435
+ n = this.nodeFactory.create(J, {
1436
1436
  callee: n,
1437
1437
  argumentList: this.tupleExpression()
1438
1438
  });
1439
1439
  } catch (r) {
1440
- throw r instanceof d ? (n = this.nodeFactory.create(H, {
1440
+ throw r instanceof d ? (n = this.nodeFactory.create(J, {
1441
1441
  callee: n,
1442
1442
  argumentList: r.partialNode
1443
1443
  }), new d(r.token, n, r.handlerContext)) : r;
1444
1444
  }
1445
1445
  } else if (s.kind === u.LBRACKET) {
1446
- if (Ce(this.previous()))
1446
+ if (Xe(this.previous()))
1447
1447
  break;
1448
1448
  try {
1449
1449
  n = this.nodeFactory.create(he, {
@@ -1466,18 +1466,18 @@ class En {
1466
1466
  op: i
1467
1467
  });
1468
1468
  } else {
1469
- const a = mn(i);
1469
+ const a = Tn(i);
1470
1470
  if (a.left === null || a.left <= e)
1471
1471
  break;
1472
1472
  this.advance();
1473
1473
  try {
1474
- n = this.nodeFactory.create(q, {
1474
+ n = this.nodeFactory.create(H, {
1475
1475
  leftExpression: n,
1476
1476
  op: i,
1477
1477
  rightExpression: i.value === "." ? this.extractOperand() : this.expression_bp(a.right)
1478
1478
  });
1479
1479
  } catch (l) {
1480
- throw l instanceof d ? (n = this.nodeFactory.create(q, {
1480
+ throw l instanceof d ? (n = this.nodeFactory.create(H, {
1481
1481
  leftExpression: n,
1482
1482
  op: i,
1483
1483
  rightExpression: l.partialNode
@@ -1494,7 +1494,7 @@ class En {
1494
1494
  if (ot(this.peek())) {
1495
1495
  const n = {};
1496
1496
  n.op = this.peek();
1497
- const s = bn(n.op);
1497
+ const s = In(n.op);
1498
1498
  if (s.right === null)
1499
1499
  throw this.logError(
1500
1500
  n.op,
@@ -1511,11 +1511,11 @@ class En {
1511
1511
  } catch (i) {
1512
1512
  throw i instanceof d ? (n.expression = i.partialNode, new d(
1513
1513
  i.token,
1514
- this.nodeFactory.create(Q, n),
1514
+ this.nodeFactory.create(q, n),
1515
1515
  i.handlerContext
1516
1516
  )) : i;
1517
1517
  }
1518
- e = this.nodeFactory.create(Q, n);
1518
+ e = this.nodeFactory.create(q, n);
1519
1519
  } else if (e = this.extractOperand(), e instanceof xe)
1520
1520
  throw new d(
1521
1521
  this.peek(),
@@ -1553,11 +1553,11 @@ class En {
1553
1553
  } catch (n) {
1554
1554
  throw n instanceof d ? (e.value = n.partialNode, new d(
1555
1555
  n.token,
1556
- this.nodeFactory.create(ne, e),
1556
+ this.nodeFactory.create(se, e),
1557
1557
  n.handlerContext
1558
1558
  )) : n;
1559
1559
  }
1560
- return this.nodeFactory.create(ne, e);
1560
+ return this.nodeFactory.create(se, e);
1561
1561
  }
1562
1562
  canBeField() {
1563
1563
  return this.peek().kind === u.IDENTIFIER && this.peek(1).kind === u.COLON;
@@ -1569,12 +1569,12 @@ class En {
1569
1569
  u.STRING_LITERAL,
1570
1570
  u.NUMERIC_LITERAL
1571
1571
  ))
1572
- return this.nodeFactory.create(U, {
1572
+ return this.nodeFactory.create(M, {
1573
1573
  expression: this.nodeFactory.create(be, { literal: this.previous() })
1574
1574
  });
1575
1575
  if (this.match(u.QUOTED_STRING, u.IDENTIFIER))
1576
- return this.nodeFactory.create(U, {
1577
- expression: this.nodeFactory.create(K, { variable: this.previous() })
1576
+ return this.nodeFactory.create(M, {
1577
+ expression: this.nodeFactory.create(ee, { variable: this.previous() })
1578
1578
  });
1579
1579
  throw this.logError(this.peek(), o.UNEXPECTED_TOKEN, "Expect a variable or literal"), new d(
1580
1580
  this.peek(),
@@ -1590,7 +1590,7 @@ class En {
1590
1590
  n,
1591
1591
  o.EMPTY_ATTRIBUTE_NAME,
1592
1592
  "Expect a non-empty attribute name"
1593
- ), e.name = this.nodeFactory.create(Y, { identifiers: [] });
1593
+ ), e.name = this.nodeFactory.create(z, { identifiers: [] });
1594
1594
  } else
1595
1595
  try {
1596
1596
  e.name = this.attributeName();
@@ -1600,12 +1600,12 @@ class En {
1600
1600
  if (e.name = n.partialNode, !this.canHandle(n))
1601
1601
  throw new d(
1602
1602
  n.token,
1603
- this.nodeFactory.create(se, e),
1603
+ this.nodeFactory.create(ie, e),
1604
1604
  n.handlerContext
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(u.COLON) && (e.colon = this.previous(), e.value = this.attributeValue()), this.nodeFactory.create(ie, e);
1609
1609
  }
1610
1610
  attributeValue() {
1611
1611
  let e;
@@ -1628,17 +1628,17 @@ class En {
1628
1628
  } catch (n) {
1629
1629
  throw n instanceof d ? new d(
1630
1630
  n.token,
1631
- this.nodeFactory.create(Y, { identifiers: e }),
1631
+ this.nodeFactory.create(z, { identifiers: e }),
1632
1632
  n.handlerContext
1633
1633
  ) : n;
1634
1634
  }
1635
- return this.nodeFactory.create(Y, { identifiers: e });
1635
+ return this.nodeFactory.create(z, { identifiers: e });
1636
1636
  }
1637
1637
  logError(e, n, s) {
1638
1638
  this.errors.push(new c(n, s, e));
1639
1639
  }
1640
1640
  }
1641
- const Nn = {
1641
+ const mn = {
1642
1642
  "+": { left: 9, right: 10 },
1643
1643
  "*": { left: 11, right: 12 },
1644
1644
  "-": { left: 9, right: 10 },
@@ -1654,10 +1654,10 @@ const Nn = {
1654
1654
  "!=": { left: 4, right: 5 },
1655
1655
  ".": { left: 16, right: 17 }
1656
1656
  };
1657
- function mn(t) {
1658
- return Nn[t.value] || { left: null, right: null };
1657
+ function Tn(t) {
1658
+ return mn[t.value] || { left: null, right: null };
1659
1659
  }
1660
- const Tn = {
1660
+ const bn = {
1661
1661
  "+": { left: null, right: 15 },
1662
1662
  "-": { left: null, right: 15 },
1663
1663
  "<": { left: null, right: 15 },
@@ -1665,14 +1665,14 @@ const Tn = {
1665
1665
  "<>": { left: null, right: 15 },
1666
1666
  "!": { left: null, right: 15 }
1667
1667
  };
1668
- function bn(t) {
1669
- return Tn[t.value] || { left: null, right: null };
1668
+ function In(t) {
1669
+ return bn[t.value] || { left: null, right: null };
1670
1670
  }
1671
- const In = {
1671
+ const Ln = {
1672
1672
  "(": { left: 14, right: null }
1673
1673
  };
1674
1674
  function ht(t) {
1675
- return In[t.value] || { left: null, right: null };
1675
+ return Ln[t.value] || { left: null, right: null };
1676
1676
  }
1677
1677
  var b = /* @__PURE__ */ ((t) => (t.Table = "table", t.Enum = "enum", t.Ref = "ref", t.Note = "note", t.Project = "project", t.Indexes = "indexes", t.TableGroup = "tablegroup", t))(b || {});
1678
1678
  function ve(t) {
@@ -1686,87 +1686,87 @@ function ve(t) {
1686
1686
  case b.Project:
1687
1687
  case b.Ref:
1688
1688
  case b.TableGroup:
1689
- return new S(e);
1689
+ return new x(e);
1690
1690
  default:
1691
- return new k();
1691
+ return new y();
1692
1692
  }
1693
1693
  }
1694
1694
  function pe(t) {
1695
- if (!Je(t))
1696
- return new S([t]);
1695
+ if (!Ze(t))
1696
+ return new x([t]);
1697
1697
  const e = pe(t.leftExpression).unwrap_or(void 0);
1698
- return e ? (e.push(t.rightExpression), new S(e)) : new k();
1698
+ return e ? (e.push(t.rightExpression), new x(e)) : new y();
1699
1699
  }
1700
- function W(t) {
1700
+ function j(t) {
1701
1701
  if (t === void 0)
1702
- return new k();
1702
+ return new y();
1703
1703
  const e = pe(t).unwrap_or(void 0);
1704
1704
  if (!e)
1705
- return new k();
1705
+ return new y();
1706
1706
  const n = [];
1707
1707
  for (const s of e) {
1708
- const i = j(s).unwrap_or(void 0);
1708
+ const i = Y(s).unwrap_or(void 0);
1709
1709
  if (!i)
1710
- return new k();
1710
+ return new y();
1711
1711
  n.push(i);
1712
1712
  }
1713
- return new S(n);
1713
+ return new x(n);
1714
1714
  }
1715
1715
  function _e(t) {
1716
1716
  if (t === void 0)
1717
- return new k();
1717
+ return new y();
1718
1718
  const e = pe(t).unwrap_or(void 0);
1719
1719
  if (!e || e.length === 0)
1720
- return new k();
1720
+ return new y();
1721
1721
  const n = [];
1722
1722
  let s;
1723
- if (!M(I.last(e))) {
1723
+ if (!F(I.last(e))) {
1724
1724
  const i = e.pop();
1725
1725
  if (Ot(i))
1726
1726
  s = i.elementList.map(
1727
- (r) => C(r).unwrap()
1727
+ (r) => X(r).unwrap()
1728
1728
  );
1729
1729
  else
1730
- return new k();
1730
+ return new y();
1731
1731
  }
1732
1732
  for (const i of e) {
1733
- const r = j(i).unwrap_or(void 0);
1733
+ const r = Y(i).unwrap_or(void 0);
1734
1734
  if (!r)
1735
- return new k();
1735
+ return new y();
1736
1736
  n.push(r);
1737
1737
  }
1738
- return new S({
1738
+ return new x({
1739
1739
  variables: n,
1740
1740
  tupleElements: s
1741
1741
  });
1742
1742
  }
1743
- function j(t) {
1744
- return M(t) ? new S(t.expression.variable.value) : new k();
1743
+ function Y(t) {
1744
+ return F(t) ? new x(t.expression.variable.value) : new y();
1745
1745
  }
1746
- function Xe(t) {
1746
+ function $e(t) {
1747
1747
  if (ft(t))
1748
- return t instanceof ne ? new S({ functional: [t], nonFunctional: [] }) : new S({ functional: [], nonFunctional: [t] });
1749
- if (t instanceof Z && t.elementList.every(ft)) {
1748
+ return t instanceof se ? new x({ functional: [t], nonFunctional: [] }) : new x({ functional: [], nonFunctional: [t] });
1749
+ if (t instanceof K && t.elementList.every(ft)) {
1750
1750
  const e = t.elementList.filter(
1751
- (s) => s instanceof ne
1752
- ), n = t.elementList.filter(M);
1753
- return new S({ functional: e, nonFunctional: n });
1751
+ (s) => s instanceof se
1752
+ ), n = t.elementList.filter(F);
1753
+ return new x({ functional: e, nonFunctional: n });
1754
1754
  }
1755
- return new k();
1755
+ return new y();
1756
1756
  }
1757
- function C(t) {
1757
+ function X(t) {
1758
1758
  var n;
1759
1759
  const e = (n = t == null ? void 0 : t.expression.variable) == null ? void 0 : n.value;
1760
- return e === void 0 ? new k() : new S(e);
1760
+ return e === void 0 ? new y() : new x(e);
1761
1761
  }
1762
- function G(t) {
1763
- return $(t) ? t.expression instanceof K ? new S(t.expression.variable.value) : new S(t.expression.literal.value) : new k();
1762
+ function C(t) {
1763
+ return W(t) ? t.expression instanceof ee ? new x(t.expression.variable.value) : new x(t.expression.literal.value) : new y();
1764
1764
  }
1765
- function Ln(t) {
1765
+ function gn(t) {
1766
1766
  var e;
1767
- return !(t instanceof q) || !xt((e = t.op) == null ? void 0 : e.value) ? !1 : _e(t.leftExpression).and_then(() => _e(t.rightExpression)).unwrap_or(void 0) !== void 0;
1767
+ return !(t instanceof H) || !xt((e = t.op) == null ? void 0 : e.value) ? !1 : _e(t.leftExpression).and_then(() => _e(t.rightExpression)).unwrap_or(void 0) !== void 0;
1768
1768
  }
1769
- function gn(t) {
1769
+ function _n(t) {
1770
1770
  const e = _e(t.leftExpression), n = _e(t.rightExpression);
1771
1771
  if (!e.isOk() || !n.isOk())
1772
1772
  return !1;
@@ -1774,23 +1774,23 @@ function gn(t) {
1774
1774
  return (s == null ? void 0 : s.length) === (i == null ? void 0 : i.length);
1775
1775
  }
1776
1776
  function ft(t) {
1777
- return t instanceof U && t.expression instanceof K || t instanceof ne;
1777
+ return t instanceof M && t.expression instanceof ee || t instanceof se;
1778
1778
  }
1779
- function _n(t, e) {
1779
+ function An(t, e) {
1780
1780
  var i, r, a, l;
1781
1781
  let n = e;
1782
- const s = Zt(t);
1782
+ const s = Kt(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 (((l = n.symbol) == null ? void 0 : l.declaration) instanceof X && s)
1786
+ if (((l = n.symbol) == null ? void 0 : l.declaration) instanceof $ && s)
1787
1787
  return n.symbol;
1788
- if (n instanceof X)
1788
+ if (n instanceof $)
1789
1789
  return;
1790
1790
  n = n.parent;
1791
1791
  }
1792
1792
  }
1793
- class An {
1793
+ class vn {
1794
1794
  constructor(e, n, s) {
1795
1795
  this.declarationNode = e, this.publicSymbolTable = n, this.symbolFactory = s;
1796
1796
  }
@@ -1798,7 +1798,7 @@ class An {
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 X || ve(this.declarationNode.parent).unwrap_or(void 0) !== b.Project ? [new c(o.INVALID_CUSTOM_CONTEXT, "A custom element can only appear in a Project", this.declarationNode)] : [];
1801
+ return this.declarationNode.parent instanceof $ || 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
1804
  return e ? [new c(o.UNEXPECTED_NAME, "A Custom element shouldn't have a name", e)] : [];
@@ -1812,10 +1812,10 @@ class An {
1812
1812
  validateBody(e) {
1813
1813
  if (!e)
1814
1814
  return [];
1815
- if (e instanceof J)
1815
+ if (e instanceof Z)
1816
1816
  return [new c(o.UNEXPECTED_COMPLEX_BODY, "A Custom element can only have an inline field", e)];
1817
1817
  const n = [];
1818
- return $(e.callee) || n.push(new c(o.INVALID_CUSTOM_ELEMENT_VALUE, "A Custom element value can only be a string", e)), e.args.length > 0 && n.push(...e.args.map((s) => new c(o.INVALID_CUSTOM_ELEMENT_VALUE, "A Custom element value can only be a string", s))), n;
1818
+ return W(e.callee) || n.push(new c(o.INVALID_CUSTOM_ELEMENT_VALUE, "A Custom element value can only be a string", e)), e.args.length > 0 && n.push(...e.args.map((s) => new c(o.INVALID_CUSTOM_ELEMENT_VALUE, "A Custom element value can only be a string", s))), n;
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 vn {
1838
+ class wn {
1839
1839
  constructor(e, n, s) {
1840
1840
  this.declarationNode = e, this.publicSymbolTable = n, this.symbolFactory = s;
1841
1841
  }
@@ -1843,7 +1843,7 @@ class vn {
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 v ? [new c(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
1849
  return e ? kt(e) ? [] : [new c(o.INVALID_NAME, "An Enum name must be of the form <enum> or <schema>.<enum>", e)] : [new c(o.NAME_NOT_FOUND, "An Enum must have a name", this.declarationNode)];
@@ -1853,10 +1853,10 @@ class vn {
1853
1853
  }
1854
1854
  registerElement() {
1855
1855
  const e = [];
1856
- this.declarationNode.symbol = this.symbolFactory.create(nn, { declaration: this.declarationNode, symbolTable: new we() });
1857
- const { name: n } = this.declarationNode, s = W(n);
1856
+ this.declarationNode.symbol = this.symbolFactory.create(sn, { declaration: this.declarationNode, symbolTable: new we() });
1857
+ const { name: n } = this.declarationNode, s = j(n);
1858
1858
  if (s.isOk()) {
1859
- const i = s.unwrap(), r = i.pop(), a = Ze(i, this.publicSymbolTable, this.symbolFactory), l = ze(r);
1859
+ const i = s.unwrap(), r = i.pop(), a = Ke(i, this.publicSymbolTable, this.symbolFactory), l = Qe(r);
1860
1860
  a.has(l) && e.push(new c(o.DUPLICATE_NAME, `Enum name ${r} already exists in schema '${i.join(".") || "public"}'`, n)), a.set(l, this.declarationNode.symbol);
1861
1861
  }
1862
1862
  return e;
@@ -1867,27 +1867,27 @@ class vn {
1867
1867
  validateBody(e) {
1868
1868
  if (!e)
1869
1869
  return [];
1870
- if (e instanceof w)
1870
+ if (e instanceof v)
1871
1871
  return this.validateFields([e]);
1872
- const [n, s] = I.partition(e.body, (i) => i instanceof w);
1872
+ const [n, s] = I.partition(e.body, (i) => i instanceof v);
1873
1873
  return [...this.validateFields(n), ...this.validateSubElements(s)];
1874
1874
  }
1875
1875
  validateFields(e) {
1876
1876
  return e.length === 0 ? [new c(o.EMPTY_ENUM, "An Enum must have at least one element", this.declarationNode)] : e.flatMap((n) => {
1877
1877
  const s = [];
1878
- n.callee && !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));
1878
+ n.callee && !F(n.callee) && s.push(new c(o.INVALID_ENUM_ELEMENT_NAME, "An enum field must be an identifier or a quoted identifier", n.callee));
1879
1879
  const i = [...n.args];
1880
- return I.last(i) instanceof R ? (s.push(...this.validateFieldSettings(I.last(i))), i.pop()) : i[0] instanceof R && (s.push(...this.validateFieldSettings(i[0])), i.shift()), i.length > 0 && s.push(...i.map((r) => new c(o.INVALID_ENUM_ELEMENT, "An Enum must have only a field and optionally a setting list", r))), s.push(...this.registerField(n)), s;
1880
+ return I.last(i) instanceof P ? (s.push(...this.validateFieldSettings(I.last(i))), i.pop()) : i[0] instanceof P && (s.push(...this.validateFieldSettings(i[0])), i.shift()), i.length > 0 && s.push(...i.map((r) => new c(o.INVALID_ENUM_ELEMENT, "An Enum must have only a field and optionally a setting list", r))), s.push(...this.registerField(n)), s;
1881
1881
  });
1882
1882
  }
1883
1883
  validateFieldSettings(e) {
1884
- const n = B(e), s = n.getErrors(), i = n.getValue();
1884
+ const n = V(e), s = n.getErrors(), i = n.getValue();
1885
1885
  for (const r in i) {
1886
1886
  const a = i[r];
1887
1887
  switch (r) {
1888
1888
  case "note":
1889
1889
  a.length > 1 && a.forEach((l) => s.push(new c(o.DUPLICATE_ENUM_ELEMENT_SETTING, "'note' can only appear once", l))), a.forEach((l) => {
1890
- $(l.value) || s.push(new c(o.INVALID_ENUM_ELEMENT_SETTING, "'note' must be a string", l));
1890
+ W(l.value) || s.push(new c(o.INVALID_ENUM_ELEMENT_SETTING, "'note' must be a string", l));
1891
1891
  });
1892
1892
  break;
1893
1893
  default:
@@ -1900,13 +1900,13 @@ class vn {
1900
1900
  return e.flatMap((n) => {
1901
1901
  if (n.parent = this.declarationNode, !n.type)
1902
1902
  return [];
1903
- const s = ae(n);
1903
+ const s = oe(n);
1904
1904
  return new s(n, this.publicSymbolTable, this.symbolFactory).validate();
1905
1905
  });
1906
1906
  }
1907
1907
  registerField(e) {
1908
- if (e.callee && M(e.callee)) {
1909
- const n = C(e.callee).unwrap(), s = Qe(n), i = this.symbolFactory.create(sn, { declaration: e });
1908
+ if (e.callee && F(e.callee)) {
1909
+ const n = X(e.callee).unwrap(), s = qe(n), i = this.symbolFactory.create(rn, { declaration: e });
1910
1910
  e.symbol = i;
1911
1911
  const r = this.declarationNode.symbol.symbolTable;
1912
1912
  if (r.has(s)) {
@@ -1921,7 +1921,7 @@ class vn {
1921
1921
  return [];
1922
1922
  }
1923
1923
  }
1924
- class wn {
1924
+ class yn {
1925
1925
  constructor(e, n, s) {
1926
1926
  this.declarationNode = e, this.publicSymbolTable = n, this.symbolFactory = s;
1927
1927
  }
@@ -1929,7 +1929,7 @@ class wn {
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 X || ve(this.declarationNode.parent).unwrap_or(void 0) !== b.Table ? [new c(o.INVALID_NOTE_CONTEXT, "An Indexes can only appear inside a Table", this.declarationNode)] : [];
1932
+ return this.declarationNode.parent instanceof $ || 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
1935
  return e ? [new c(o.UNEXPECTED_NAME, "An Indexes shouldn't have a name", e)] : [];
@@ -1943,9 +1943,9 @@ class wn {
1943
1943
  validateBody(e) {
1944
1944
  if (!e)
1945
1945
  return [];
1946
- if (e instanceof w)
1946
+ if (e instanceof v)
1947
1947
  return [new c(o.UNEXPECTED_SIMPLE_BODY, "An Indexes must have a complex body", e)];
1948
- const [n, s] = I.partition(e.body, (i) => i instanceof w);
1948
+ const [n, s] = I.partition(e.body, (i) => i instanceof v);
1949
1949
  return [...this.validateFields(n), ...this.validateSubElements(s)];
1950
1950
  }
1951
1951
  validateFields(e) {
@@ -1953,22 +1953,22 @@ class wn {
1953
1953
  if (!n.callee)
1954
1954
  return [];
1955
1955
  const s = [], i = [n.callee, ...n.args];
1956
- return I.last(i) instanceof R && s.push(...this.validateFieldSetting(i.pop())), i.forEach((r) => {
1957
- for (; r instanceof H; )
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));
1956
+ return I.last(i) instanceof P && s.push(...this.validateFieldSetting(i.pop())), i.forEach((r) => {
1957
+ for (; r instanceof J; )
1958
+ r.argumentList && !$e(r.argumentList).isOk() && s.push(new c(o.INVALID_INDEXES_FIELD, "An index field must be an identifier, a quoted identifier, a functional expression or a tuple of such", r.argumentList)), r = r.callee;
1959
+ $e(r).isOk() || s.push(new c(o.INVALID_INDEXES_FIELD, "An index field must be an identifier, a quoted identifier, a functional expression or a tuple of such", r));
1960
1960
  }), s;
1961
1961
  });
1962
1962
  }
1963
1963
  validateFieldSetting(e) {
1964
- const n = B(e), s = n.getErrors(), i = n.getValue();
1964
+ const n = V(e), s = n.getErrors(), i = n.getValue();
1965
1965
  for (const r in i) {
1966
1966
  const a = i[r];
1967
1967
  switch (r) {
1968
1968
  case "note":
1969
1969
  case "name":
1970
1970
  a.length > 1 && a.forEach((l) => s.push(new c(o.DUPLICATE_INDEX_SETTING, `'${r}' can only appear once`, l))), a.forEach((l) => {
1971
- $(l.value) || s.push(new c(o.INVALID_INDEX_SETTING_VALUE, `'${r}' must be a string`, l));
1971
+ W(l.value) || s.push(new c(o.INVALID_INDEX_SETTING_VALUE, `'${r}' must be a string`, l));
1972
1972
  });
1973
1973
  break;
1974
1974
  case "unique":
@@ -1979,7 +1979,7 @@ class wn {
1979
1979
  break;
1980
1980
  case "type":
1981
1981
  a.length > 1 && a.forEach((l) => s.push(new c(o.DUPLICATE_INDEX_SETTING, "'type' can only appear once", l))), a.forEach((l) => {
1982
- M(l.value) || s.push(new c(o.INVALID_INDEX_SETTING_VALUE, `'type' must be "btree" or "hash"`, l));
1982
+ F(l.value) || s.push(new c(o.INVALID_INDEX_SETTING_VALUE, `'type' must be "btree" or "hash"`, l));
1983
1983
  });
1984
1984
  break;
1985
1985
  default:
@@ -1992,12 +1992,12 @@ class wn {
1992
1992
  return e.flatMap((n) => {
1993
1993
  if (n.parent = this.declarationNode, !n.type)
1994
1994
  return [];
1995
- const s = ae(n);
1995
+ const s = oe(n);
1996
1996
  return new s(n, this.publicSymbolTable, this.symbolFactory).validate();
1997
1997
  });
1998
1998
  }
1999
1999
  }
2000
- class yn {
2000
+ class kn {
2001
2001
  constructor(e, n, s) {
2002
2002
  this.declarationNode = e, this.publicSymbolTable = n, this.symbolFactory = s;
2003
2003
  }
@@ -2011,7 +2011,7 @@ class yn {
2011
2011
  ];
2012
2012
  }
2013
2013
  validateContext() {
2014
- return !(this.declarationNode.parent instanceof X) && ![
2014
+ return !(this.declarationNode.parent instanceof $) && ![
2015
2015
  b.Table,
2016
2016
  b.TableGroup,
2017
2017
  b.Project
@@ -2022,14 +2022,14 @@ class yn {
2022
2022
  )] : [];
2023
2023
  }
2024
2024
  validateName(e) {
2025
- if (!(this.declarationNode.parent instanceof X))
2025
+ if (!(this.declarationNode.parent instanceof $))
2026
2026
  return e ? [new c(o.UNEXPECTED_NAME, "A Note shouldn't have a name", e)] : [];
2027
2027
  if (!e)
2028
2028
  return [new c(o.INVALID_NAME, "Sticky note must have a name", this.declarationNode)];
2029
- const n = W(e);
2029
+ const n = j(e);
2030
2030
  if (!n.isOk())
2031
2031
  return [new c(o.INVALID_NAME, "Invalid name for sticky note ", this.declarationNode)];
2032
- const i = n.unwrap().join("."), r = Jt(i);
2032
+ const i = n.unwrap().join("."), r = Zt(i);
2033
2033
  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), []);
2034
2034
  }
2035
2035
  validateAlias(e) {
@@ -2041,25 +2041,25 @@ class yn {
2041
2041
  validateBody(e) {
2042
2042
  if (!e)
2043
2043
  return [];
2044
- if (e instanceof w)
2044
+ if (e instanceof v)
2045
2045
  return this.validateFields([e]);
2046
- const [n, s] = I.partition(e.body, (i) => i instanceof w);
2046
+ const [n, s] = I.partition(e.body, (i) => i instanceof v);
2047
2047
  return [...this.validateFields(n), ...this.validateSubElements(s)];
2048
2048
  }
2049
2049
  validateFields(e) {
2050
2050
  const n = [];
2051
- return e.length === 0 ? [new c(o.EMPTY_NOTE, "A Note must have a content", this.declarationNode)] : (e.length > 1 && e.slice(1).forEach((s) => n.push(new c(o.NOTE_CONTENT_REDEFINED, "A Note can only contain one string", s))), $(e[0].callee) || n.push(new c(o.INVALID_NOTE, "A Note content must be a quoted string", e[0])), e[0].args.length > 0 && n.push(...e[0].args.map((s) => new c(o.INVALID_NOTE, "A Note can only contain one quoted string", s))), n);
2051
+ return e.length === 0 ? [new c(o.EMPTY_NOTE, "A Note must have a content", this.declarationNode)] : (e.length > 1 && e.slice(1).forEach((s) => n.push(new c(o.NOTE_CONTENT_REDEFINED, "A Note can only contain one string", s))), W(e[0].callee) || n.push(new c(o.INVALID_NOTE, "A Note content must be a quoted string", e[0])), e[0].args.length > 0 && n.push(...e[0].args.map((s) => new c(o.INVALID_NOTE, "A Note can only contain one quoted string", s))), n);
2052
2052
  }
2053
2053
  validateSubElements(e) {
2054
2054
  return e.flatMap((n) => {
2055
2055
  if (n.parent = this.declarationNode, !n.type)
2056
2056
  return [];
2057
- const s = ae(n);
2057
+ const s = oe(n);
2058
2058
  return new s(n, this.publicSymbolTable, this.symbolFactory).validate();
2059
2059
  });
2060
2060
  }
2061
2061
  }
2062
- class kn {
2062
+ class xn {
2063
2063
  constructor(e, n, s) {
2064
2064
  this.declarationNode = e, this.publicSymbolTable = n, this.symbolFactory = s;
2065
2065
  }
@@ -2067,7 +2067,7 @@ class kn {
2067
2067
  return [...this.validateContext(), ...this.validateName(this.declarationNode.name), ...this.validateAlias(this.declarationNode.alias), ...this.validateSettingList(this.declarationNode.attributeList), ...this.validateBody(this.declarationNode.body)];
2068
2068
  }
2069
2069
  validateContext() {
2070
- return this.declarationNode.parent instanceof v ? [new c(o.INVALID_PROJECT_CONTEXT, "A Project can only appear top-level", this.declarationNode)] : [];
2070
+ return this.declarationNode.parent instanceof A ? [new c(o.INVALID_PROJECT_CONTEXT, "A Project can only appear top-level", this.declarationNode)] : [];
2071
2071
  }
2072
2072
  validateName(e) {
2073
2073
  return e ? ye(e) ? [] : [new c(o.INVALID_NAME, "A Project's name is optional or must be an identifier or a quoted identifer", e)] : [];
@@ -2081,9 +2081,9 @@ class kn {
2081
2081
  validateBody(e) {
2082
2082
  if (!e)
2083
2083
  return [];
2084
- if (e instanceof w)
2084
+ if (e instanceof v)
2085
2085
  return [new c(o.UNEXPECTED_SIMPLE_BODY, "A Project's body must be a block", e)];
2086
- const [n, s] = I.partition(e.body, (i) => i instanceof w);
2086
+ const [n, s] = I.partition(e.body, (i) => i instanceof v);
2087
2087
  return [
2088
2088
  ...n.map((i) => new c(o.INVALID_PROJECT_FIELD, "A Project can not have inline fields", i)),
2089
2089
  ...this.validateSubElements(s)
@@ -2093,12 +2093,12 @@ class kn {
2093
2093
  return e.flatMap((n) => {
2094
2094
  if (n.parent = this.declarationNode, !n.type)
2095
2095
  return [];
2096
- const s = ae(n);
2096
+ const s = oe(n);
2097
2097
  return new s(n, this.publicSymbolTable, this.symbolFactory).validate();
2098
2098
  });
2099
2099
  }
2100
2100
  }
2101
- class xn {
2101
+ class Sn {
2102
2102
  constructor(e, n, s) {
2103
2103
  this.declarationNode = e, this.publicSymbolTable = n, this.symbolFactory = s;
2104
2104
  }
@@ -2106,7 +2106,7 @@ class xn {
2106
2106
  return [...this.validateContext(), ...this.validateName(this.declarationNode.name), ...this.validateAlias(this.declarationNode.alias), ...this.validateSettingList(this.declarationNode.attributeList), ...this.validateBody(this.declarationNode.body)];
2107
2107
  }
2108
2108
  validateContext() {
2109
- return this.declarationNode.parent instanceof X ? [] : [new c(o.INVALID_REF_CONTEXT, "A Ref must appear top-level", this.declarationNode)];
2109
+ return this.declarationNode.parent instanceof $ ? [] : [new c(o.INVALID_REF_CONTEXT, "A Ref must appear top-level", this.declarationNode)];
2110
2110
  }
2111
2111
  validateName(e) {
2112
2112
  return e ? ye(e) ? [] : [new c(o.INVALID_NAME, "A Ref's name is optional or must be an identifier or a quoted identifer", e)] : [];
@@ -2120,9 +2120,9 @@ class xn {
2120
2120
  validateBody(e) {
2121
2121
  if (!e)
2122
2122
  return [];
2123
- if (e instanceof w)
2123
+ if (e instanceof v)
2124
2124
  return this.validateFields([e]);
2125
- const [n, s] = I.partition(e.body, (i) => i instanceof w);
2125
+ const [n, s] = I.partition(e.body, (i) => i instanceof v);
2126
2126
  return [...this.validateFields(n), ...this.validateSubElements(s)];
2127
2127
  }
2128
2128
  validateFields(e) {
@@ -2130,20 +2130,20 @@ class xn {
2130
2130
  return [new c(o.EMPTY_REF, "A Ref must have at least one field", this.declarationNode)];
2131
2131
  const n = [];
2132
2132
  return e.length > 1 && n.push(...e.slice(1).map((s) => new c(o.REF_REDEFINED, "A Ref can only contain one binary relationship", s))), e.forEach((s) => {
2133
- s.callee && !Ln(s.callee) && n.push(new c(o.INVALID_REF_FIELD, "A Ref field must be a binary relationship", s.callee)), s.callee && !gn(s.callee) && n.push(new c(o.UNEQUAL_FIELDS_BINARY_REF, "Unequal fields in ref endpoints", s.callee));
2133
+ s.callee && !gn(s.callee) && n.push(new c(o.INVALID_REF_FIELD, "A Ref field must be a binary relationship", s.callee)), s.callee && !_n(s.callee) && n.push(new c(o.UNEQUAL_FIELDS_BINARY_REF, "Unequal fields in ref endpoints", s.callee));
2134
2134
  const i = [...s.args];
2135
- I.last(i) instanceof R ? (this.validateFieldSettings(I.last(i)), i.pop()) : i[0] instanceof R && (n.push(...this.validateFieldSettings(i[0])), i.shift()), i.length > 0 && n.push(...i.map((r) => new c(o.INVALID_REF_FIELD, "A Ref field should only have a single binary relationship", r)));
2135
+ I.last(i) instanceof P ? (this.validateFieldSettings(I.last(i)), i.pop()) : i[0] instanceof P && (n.push(...this.validateFieldSettings(i[0])), i.shift()), i.length > 0 && n.push(...i.map((r) => new c(o.INVALID_REF_FIELD, "A Ref field should only have a single binary relationship", r)));
2136
2136
  }), n;
2137
2137
  }
2138
2138
  validateFieldSettings(e) {
2139
- const n = B(e), s = n.getErrors(), i = n.getValue();
2139
+ const n = V(e), s = n.getErrors(), i = n.getValue();
2140
2140
  for (const r in i) {
2141
2141
  const a = i[r];
2142
2142
  switch (r) {
2143
2143
  case "delete":
2144
2144
  case "update":
2145
2145
  a.length > 1 && a.forEach((l) => s.push(new c(o.DUPLICATE_REF_SETTING, `'${r}' can only appear once`, l))), a.forEach((l) => {
2146
- Sn(l.value) || s.push(new c(o.INVALID_REF_SETTING_VALUE, `'${r}' can only have values "cascade", "no action", "set null", "set default" or "restrict"`, l));
2146
+ On(l.value) || s.push(new c(o.INVALID_REF_SETTING_VALUE, `'${r}' can only have values "cascade", "no action", "set null", "set default" or "restrict"`, l));
2147
2147
  });
2148
2148
  break;
2149
2149
  default:
@@ -2156,16 +2156,16 @@ class xn {
2156
2156
  return e.flatMap((n) => {
2157
2157
  if (n.parent = this.declarationNode, !n.type)
2158
2158
  return [];
2159
- const s = ae(n);
2159
+ const s = oe(n);
2160
2160
  return new s(n, this.publicSymbolTable, this.symbolFactory).validate();
2161
2161
  });
2162
2162
  }
2163
2163
  }
2164
- function Sn(t) {
2165
- if (!(M(t) && t.expression.variable.kind !== u.QUOTED_STRING) && !(t instanceof Y))
2164
+ function On(t) {
2165
+ if (!(F(t) && t.expression.variable.kind !== u.QUOTED_STRING) && !(t instanceof z))
2166
2166
  return !1;
2167
2167
  let e;
2168
- if (t instanceof Y ? e = Te(t).unwrap_or("") : e = t.expression.variable.value, e)
2168
+ if (t instanceof z ? e = Te(t).unwrap_or("") : e = t.expression.variable.value, e)
2169
2169
  switch (e.toLowerCase()) {
2170
2170
  case "cascade":
2171
2171
  case "no action":
@@ -2178,7 +2178,7 @@ function Sn(t) {
2178
2178
  }
2179
2179
  return !1;
2180
2180
  }
2181
- class On {
2181
+ class Dn {
2182
2182
  constructor(e, n, s) {
2183
2183
  this.declarationNode = e, this.symbolFactory = s, this.publicSymbolTable = n;
2184
2184
  }
@@ -2186,16 +2186,16 @@ class On {
2186
2186
  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)];
2187
2187
  }
2188
2188
  validateContext() {
2189
- return this.declarationNode.parent instanceof v ? [new c(o.INVALID_TABLE_CONTEXT, "Table must appear top-level", this.declarationNode)] : [];
2189
+ return this.declarationNode.parent instanceof A ? [new c(o.INVALID_TABLE_CONTEXT, "Table must appear top-level", this.declarationNode)] : [];
2190
2190
  }
2191
2191
  validateName(e) {
2192
2192
  return e ? e instanceof he ? [new c(o.INVALID_NAME, "Invalid array as Table name, maybe you forget to add a space between the name and the setting list?", e)] : kt(e) ? [] : [new c(o.INVALID_NAME, "A Table name must be of the form <table> or <schema>.<table>", e)] : [new c(o.NAME_NOT_FOUND, "A Table must have a name", this.declarationNode)];
2193
2193
  }
2194
2194
  validateAlias(e) {
2195
- return e ? Un(e) ? [] : [new c(o.INVALID_ALIAS, "Table aliases can only contains alphanumeric and underscore unless surrounded by double quotes", e)] : [];
2195
+ return e ? Mn(e) ? [] : [new c(o.INVALID_ALIAS, "Table aliases can only contains alphanumeric and underscore unless surrounded by double quotes", e)] : [];
2196
2196
  }
2197
2197
  validateSettingList(e) {
2198
- const n = B(e), s = n.getErrors(), i = n.getValue();
2198
+ const n = V(e), s = n.getErrors(), i = n.getValue();
2199
2199
  for (const r in i) {
2200
2200
  const a = i[r];
2201
2201
  switch (r) {
@@ -2206,7 +2206,7 @@ class On {
2206
2206
  break;
2207
2207
  case "note":
2208
2208
  a.length > 1 && s.push(...a.map((l) => new c(o.DUPLICATE_TABLE_SETTING, "'note' can only appear once", l))), a.forEach((l) => {
2209
- $(l.value) || s.push(new c(o.INVALID_TABLE_SETTING, "'note' must be a string literal", l.value || l.name));
2209
+ W(l.value) || s.push(new c(o.INVALID_TABLE_SETTING, "'note' must be a string literal", l.value || l.name));
2210
2210
  });
2211
2211
  break;
2212
2212
  default:
@@ -2218,13 +2218,13 @@ class On {
2218
2218
  registerElement() {
2219
2219
  const e = [];
2220
2220
  this.declarationNode.symbol = this.symbolFactory.create(vt, { declaration: this.declarationNode, symbolTable: new we() });
2221
- const { name: n, alias: s } = this.declarationNode, i = W(n);
2221
+ const { name: n, alias: s } = this.declarationNode, i = j(n);
2222
2222
  if (i.isOk()) {
2223
- const r = [...i.unwrap()], a = r.pop(), l = Ze(r, this.publicSymbolTable, this.symbolFactory), p = Oe(a);
2223
+ const r = [...i.unwrap()], a = r.pop(), l = Ke(r, this.publicSymbolTable, this.symbolFactory), p = Oe(a);
2224
2224
  l.has(p) && e.push(new c(o.DUPLICATE_NAME, `Table name '${a}' already exists in schema '${r.join(".") || "public"}'`, n)), l.set(p, this.declarationNode.symbol);
2225
2225
  }
2226
- if (s && ye(s) && !Rn(s.expression.variable.value, i.unwrap_or([]))) {
2227
- const r = C(s).unwrap(), a = Oe(r);
2226
+ if (s && ye(s) && !Pn(s.expression.variable.value, i.unwrap_or([]))) {
2227
+ const r = X(s).unwrap(), a = Oe(r);
2228
2228
  this.publicSymbolTable.has(a) && e.push(new c(o.DUPLICATE_NAME, `Table name '${r}' already exists`, n)), this.publicSymbolTable.set(a, this.declarationNode.symbol);
2229
2229
  }
2230
2230
  return e;
@@ -2232,9 +2232,9 @@ class On {
2232
2232
  validateBody(e) {
2233
2233
  if (!e)
2234
2234
  return [];
2235
- if (e instanceof w)
2235
+ if (e instanceof v)
2236
2236
  return [new c(o.UNEXPECTED_SIMPLE_BODY, "A Table's body must be a block", e)];
2237
- const [n, s] = I.partition(e.body, (i) => i instanceof w);
2237
+ const [n, s] = I.partition(e.body, (i) => i instanceof v);
2238
2238
  return [...this.validateFields(n), ...this.validateSubElements(s)];
2239
2239
  }
2240
2240
  validateFields(e) {
@@ -2242,14 +2242,14 @@ class On {
2242
2242
  if (!n.callee)
2243
2243
  return [];
2244
2244
  const s = [];
2245
- 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] && !Dn(n.args[0]) && s.push(new c(o.INVALID_COLUMN_TYPE, "Invalid column type", n.args[0]));
2245
+ n.args.length === 0 && s.push(new c(o.INVALID_COLUMN, "A column must have a type", n.callee)), F(n.callee) || s.push(new c(o.INVALID_COLUMN_NAME, "A column name must be an identifier or a quoted identifier", n.callee)), n.args[0] && !Rn(n.args[0]) && s.push(new c(o.INVALID_COLUMN_TYPE, "Invalid column type", n.args[0]));
2246
2246
  const i = n.args.slice(1);
2247
2247
  return s.push(...this.validateFieldSetting(i)), s.push(...this.registerField(n)), s;
2248
2248
  });
2249
2249
  }
2250
2250
  registerField(e) {
2251
- if (e.callee && M(e.callee)) {
2252
- const n = C(e.callee).unwrap(), s = Ye(n), i = this.symbolFactory.create(rn, { declaration: e });
2251
+ if (e.callee && F(e.callee)) {
2252
+ const n = X(e.callee).unwrap(), s = ze(n), i = this.symbolFactory.create(an, { declaration: e });
2253
2253
  e.symbol = i;
2254
2254
  const r = this.declarationNode.symbol.symbolTable;
2255
2255
  if (r.has(s)) {
@@ -2265,15 +2265,15 @@ class On {
2265
2265
  }
2266
2266
  // This is needed to support legacy inline settings
2267
2267
  validateFieldSetting(e) {
2268
- if (!e.slice(0, -1).every(me) || !e.slice(-1).every((p) => me(p) || p instanceof R))
2268
+ if (!e.slice(0, -1).every(me) || !e.slice(-1).every((p) => me(p) || p instanceof P))
2269
2269
  return [...e.map((p) => new c(o.INVALID_COLUMN, "These fields must be some inline settings optionally ended with a setting list", p))];
2270
2270
  if (e.length === 0)
2271
2271
  return [];
2272
2272
  let n;
2273
- I.last(e) instanceof R && (n = e.pop());
2274
- const s = B(n), i = s.getErrors(), r = s.getValue();
2273
+ I.last(e) instanceof P && (n = e.pop());
2274
+ const s = V(n), i = s.getErrors(), r = s.getValue();
2275
2275
  for (const p of e) {
2276
- const f = C(p).unwrap_or("").toLowerCase();
2276
+ const f = X(p).unwrap_or("").toLowerCase();
2277
2277
  if (f !== "pk" && f !== "unique") {
2278
2278
  i.push(new c(o.INVALID_SETTINGS, "Inline column settings can only be `pk` or `unique`", p));
2279
2279
  continue;
@@ -2287,12 +2287,12 @@ class On {
2287
2287
  switch (p) {
2288
2288
  case "note":
2289
2289
  f.length > 1 && i.push(...f.map((h) => new c(o.DUPLICATE_COLUMN_SETTING, "note can only appear once", h))), f.forEach((h) => {
2290
- $(h.value) || i.push(new c(o.INVALID_COLUMN_SETTING_VALUE, "'note' must be a quoted string", h.value || h.name));
2290
+ W(h.value) || i.push(new c(o.INVALID_COLUMN_SETTING_VALUE, "'note' must be a quoted string", h.value || h.name));
2291
2291
  });
2292
2292
  break;
2293
2293
  case "ref":
2294
2294
  f.forEach((h) => {
2295
- Fn(h.value) || i.push(new c(o.INVALID_COLUMN_SETTING_VALUE, "'ref' must be a valid unary relationship", h.value || h.name));
2295
+ Bn(h.value) || i.push(new c(o.INVALID_COLUMN_SETTING_VALUE, "'ref' must be a valid unary relationship", h.value || h.name));
2296
2296
  });
2297
2297
  break;
2298
2298
  case "primary key":
@@ -2302,7 +2302,7 @@ class On {
2302
2302
  break;
2303
2303
  case "pk":
2304
2304
  f.length > 1 && i.push(...f.map((h) => new c(o.DUPLICATE_COLUMN_SETTING, "'pk' can only appear once", h))), f.forEach((h) => {
2305
- h instanceof se && !ue(h.value) && i.push(new c(o.INVALID_COLUMN_SETTING_VALUE, "'pk' must not have a value", h.value || h.name));
2305
+ h instanceof ie && !ue(h.value) && i.push(new c(o.INVALID_COLUMN_SETTING_VALUE, "'pk' must not have a value", h.value || h.name));
2306
2306
  });
2307
2307
  break;
2308
2308
  case "not null":
@@ -2319,17 +2319,17 @@ class On {
2319
2319
  break;
2320
2320
  case "unique":
2321
2321
  f.length > 1 && i.push(...f.map((h) => new c(o.DUPLICATE_COLUMN_SETTING, "'unique' can only appear once", h))), f.forEach((h) => {
2322
- h instanceof se && !ue(h.value) && i.push(new c(o.INVALID_COLUMN_SETTING_VALUE, "'unique' must not have a value", h.value || h.name));
2322
+ h instanceof ie && !ue(h.value) && i.push(new c(o.INVALID_COLUMN_SETTING_VALUE, "'unique' must not have a value", h.value || h.name));
2323
2323
  });
2324
2324
  break;
2325
2325
  case "increment":
2326
2326
  f.length > 1 && i.push(...f.map((h) => new c(o.DUPLICATE_COLUMN_SETTING, "'increment' can only appear once", h))), f.forEach((h) => {
2327
- h instanceof se && !ue(h.value) && i.push(new c(o.INVALID_COLUMN_SETTING_VALUE, "'increment' must not have a value", h.value || h.name));
2327
+ h instanceof ie && !ue(h.value) && i.push(new c(o.INVALID_COLUMN_SETTING_VALUE, "'increment' must not have a value", h.value || h.name));
2328
2328
  });
2329
2329
  break;
2330
2330
  case "default":
2331
2331
  f.length > 1 && i.push(...f.map((h) => new c(o.DUPLICATE_TABLE_SETTING, "'default' can only appear once", h))), f.forEach((h) => {
2332
- Mn(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));
2332
+ Fn(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));
2333
2333
  });
2334
2334
  break;
2335
2335
  default:
@@ -2342,7 +2342,7 @@ class On {
2342
2342
  const n = e.flatMap((i) => {
2343
2343
  if (i.parent = this.declarationNode, !i.type)
2344
2344
  return [];
2345
- const r = ae(i);
2345
+ const r = oe(i);
2346
2346
  return new r(i, this.publicSymbolTable, this.symbolFactory).validate();
2347
2347
  }), s = e.filter((i) => {
2348
2348
  var r;
@@ -2351,11 +2351,11 @@ class On {
2351
2351
  return s.length > 1 && n.push(...s.map((i) => new c(o.NOTE_REDEFINED, "Duplicate notes are defined", i))), n;
2352
2352
  }
2353
2353
  }
2354
- function Dn(t) {
2355
- if (!(t instanceof H || Je(t) || t instanceof U || t instanceof he))
2354
+ function Rn(t) {
2355
+ if (!(t instanceof J || Ze(t) || t instanceof M || t instanceof he))
2356
2356
  return !1;
2357
- if (t instanceof H) {
2358
- if (t.callee === void 0 || t.argumentList === void 0 || !t.argumentList.elementList.every((n) => fe(n) || $(n) || me(n)))
2357
+ if (t instanceof J) {
2358
+ if (t.callee === void 0 || t.argumentList === void 0 || !t.argumentList.elementList.every((n) => fe(n) || W(n) || me(n)))
2359
2359
  return !1;
2360
2360
  t = t.callee;
2361
2361
  }
@@ -2364,13 +2364,13 @@ function Dn(t) {
2364
2364
  return !1;
2365
2365
  t = t.array;
2366
2366
  }
2367
- const e = W(t).unwrap_or(void 0);
2367
+ const e = j(t).unwrap_or(void 0);
2368
2368
  return e !== void 0 && e.length > 0;
2369
2369
  }
2370
- function Rn(t, e) {
2370
+ function Pn(t, e) {
2371
2371
  return e.length === 1 && t === e[0];
2372
2372
  }
2373
- class Pn {
2373
+ class Un {
2374
2374
  constructor(e, n, s) {
2375
2375
  this.declarationNode = e, this.publicSymbolTable = n, this.symbolFactory = s;
2376
2376
  }
@@ -2385,7 +2385,7 @@ class Pn {
2385
2385
  ];
2386
2386
  }
2387
2387
  validateContext() {
2388
- return this.declarationNode.parent instanceof v ? [new c(
2388
+ return this.declarationNode.parent instanceof A ? [new c(
2389
2389
  o.INVALID_TABLEGROUP_CONTEXT,
2390
2390
  "TableGroup must appear top-level",
2391
2391
  this.declarationNode
@@ -2411,10 +2411,10 @@ class Pn {
2411
2411
  }
2412
2412
  registerElement() {
2413
2413
  const { name: e } = this.declarationNode;
2414
- this.declarationNode.symbol = this.symbolFactory.create(an, { declaration: this.declarationNode, symbolTable: new we() });
2415
- const n = W(e);
2414
+ this.declarationNode.symbol = this.symbolFactory.create(on, { declaration: this.declarationNode, symbolTable: new we() });
2415
+ const n = j(e);
2416
2416
  if (n.isOk()) {
2417
- const s = n.unwrap(), i = s.pop(), r = Ze(s, this.publicSymbolTable, this.symbolFactory), a = qe(i);
2417
+ const s = n.unwrap(), i = s.pop(), r = Ke(s, this.publicSymbolTable, this.symbolFactory), a = He(i);
2418
2418
  if (r.has(a))
2419
2419
  return [new c(o.DUPLICATE_NAME, `TableGroup name '${i}' already exists`, e)];
2420
2420
  r.set(a, this.declarationNode.symbol);
@@ -2422,7 +2422,7 @@ class Pn {
2422
2422
  return [];
2423
2423
  }
2424
2424
  validateSettingList(e) {
2425
- const n = B(e), s = n.getErrors(), i = n.getValue();
2425
+ const n = V(e), s = n.getErrors(), i = n.getValue();
2426
2426
  return I.forIn(i, (r, a) => {
2427
2427
  switch (a) {
2428
2428
  case "color":
@@ -2443,7 +2443,7 @@ class Pn {
2443
2443
  o.DUPLICATE_TABLE_SETTING,
2444
2444
  "'note' can only appear once",
2445
2445
  l
2446
- ))), r.filter((l) => !$(l.value)).forEach((l) => {
2446
+ ))), r.filter((l) => !W(l.value)).forEach((l) => {
2447
2447
  s.push(new c(
2448
2448
  o.INVALID_TABLE_SETTING,
2449
2449
  "'note' must be a string literal",
@@ -2464,13 +2464,13 @@ class Pn {
2464
2464
  validateBody(e) {
2465
2465
  if (!e)
2466
2466
  return [];
2467
- if (e instanceof w)
2467
+ if (e instanceof v)
2468
2468
  return [new c(
2469
2469
  o.UNEXPECTED_SIMPLE_BODY,
2470
2470
  "A TableGroup's body must be a block",
2471
2471
  e
2472
2472
  )];
2473
- const [n, s] = I.partition(e.body, (i) => i instanceof w);
2473
+ const [n, s] = I.partition(e.body, (i) => i instanceof v);
2474
2474
  return [
2475
2475
  ...this.validateFields(n),
2476
2476
  ...this.validateSubElements(s)
@@ -2479,14 +2479,14 @@ class Pn {
2479
2479
  validateFields(e) {
2480
2480
  return e.flatMap((n) => {
2481
2481
  const s = [];
2482
- return n.callee && !W(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;
2482
+ return n.callee && !j(n.callee).isOk() && s.push(new c(o.INVALID_TABLEGROUP_FIELD, "A TableGroup field must be of the form <table> or <schema>.<table>", n.callee)), this.registerField(n), n.args.length > 0 && s.push(...n.args.map((i) => new c(o.INVALID_TABLEGROUP_FIELD, "A TableGroup field should only have a single Table name", i))), s;
2483
2483
  });
2484
2484
  }
2485
2485
  validateSubElements(e) {
2486
2486
  const n = e.flatMap((i) => {
2487
2487
  if (i.parent = this.declarationNode, !i.type)
2488
2488
  return [];
2489
- const r = ae(i);
2489
+ const r = oe(i);
2490
2490
  return new r(i, this.publicSymbolTable, this.symbolFactory).validate();
2491
2491
  }), s = e.filter((i) => {
2492
2492
  var r;
@@ -2495,8 +2495,8 @@ class Pn {
2495
2495
  return s.length > 1 && n.push(...s.map((i) => new c(o.NOTE_REDEFINED, "Duplicate notes are defined", i))), n;
2496
2496
  }
2497
2497
  registerField(e) {
2498
- if (e.callee && M(e.callee)) {
2499
- const n = C(e.callee).unwrap(), s = He(n), i = this.symbolFactory.create(on, { declaration: e });
2498
+ if (e.callee && F(e.callee)) {
2499
+ const n = X(e.callee).unwrap(), s = Je(n), i = this.symbolFactory.create(ln, { declaration: e });
2500
2500
  e.symbol = i;
2501
2501
  const r = this.declarationNode.symbol.symbolTable;
2502
2502
  if (r.has(s)) {
@@ -2512,42 +2512,42 @@ class Pn {
2512
2512
  }
2513
2513
  }
2514
2514
  const yt = ["-", "+"];
2515
- function ae(t) {
2515
+ function oe(t) {
2516
2516
  switch (t.type.value.toLowerCase()) {
2517
2517
  case b.Enum:
2518
- return vn;
2518
+ return wn;
2519
2519
  case b.Table:
2520
- return On;
2520
+ return Dn;
2521
2521
  case b.TableGroup:
2522
- return Pn;
2522
+ return Un;
2523
2523
  case b.Project:
2524
- return kn;
2525
- case b.Ref:
2526
2524
  return xn;
2525
+ case b.Ref:
2526
+ return Sn;
2527
2527
  case b.Note:
2528
- return yn;
2528
+ return kn;
2529
2529
  case b.Indexes:
2530
- return wn;
2530
+ return yn;
2531
2531
  default:
2532
- return An;
2532
+ return vn;
2533
2533
  }
2534
2534
  }
2535
2535
  function kt(t) {
2536
- return !!W(t).unwrap_or(!1);
2536
+ return !!j(t).unwrap_or(!1);
2537
2537
  }
2538
- function Un(t) {
2538
+ function Mn(t) {
2539
2539
  return ye(t);
2540
2540
  }
2541
2541
  function ye(t) {
2542
- return t instanceof U && t.expression instanceof K;
2542
+ return t instanceof M && t.expression instanceof ee;
2543
2543
  }
2544
- function Ze(t, e, n) {
2544
+ function Ke(t, e, n) {
2545
2545
  var i;
2546
2546
  t[0] === "public" && (t = t.slice(1));
2547
2547
  let s = e;
2548
2548
  for (const r of t) {
2549
2549
  let a;
2550
- const l = je(r);
2550
+ const l = Ye(r);
2551
2551
  if (s.has(l)) {
2552
2552
  if (a = (i = s.get(l)) == null ? void 0 : i.symbolTable, !a)
2553
2553
  throw new Error("Expect a symbol table in a schema symbol");
@@ -2565,53 +2565,53 @@ function xt(t) {
2565
2565
  }
2566
2566
  function St(t) {
2567
2567
  var n;
2568
- if (!(t instanceof U) || !(t.expression instanceof be) || ((n = t.expression.literal) == null ? void 0 : n.kind) !== u.COLOR_LITERAL)
2568
+ if (!(t instanceof M) || !(t.expression instanceof be) || ((n = t.expression.literal) == null ? void 0 : n.kind) !== u.COLOR_LITERAL)
2569
2569
  return !1;
2570
2570
  const e = t.expression.literal.value;
2571
2571
  if (e.length !== 4 && e.length !== 7 || e[0] !== "#")
2572
2572
  return !1;
2573
2573
  for (let s = 1; s < e.length; s += 1)
2574
- if (!en(e[s]))
2574
+ if (!tn(e[s]))
2575
2575
  return !1;
2576
2576
  return !0;
2577
2577
  }
2578
2578
  function ue(t) {
2579
2579
  return t === void 0;
2580
2580
  }
2581
- function Mn(t) {
2581
+ function Fn(t) {
2582
2582
  var e;
2583
- return !!($(t) || fe(t) || me(t) && ["true", "false", "null"].includes(t.expression.variable.value.toLowerCase()) || t instanceof Q && yt.includes((e = t.op) == null ? void 0 : e.value) && fe(t.expression) || t instanceof ne);
2583
+ return !!(W(t) || fe(t) || me(t) && ["true", "false", "null"].includes(t.expression.variable.value.toLowerCase()) || t instanceof q && yt.includes((e = t.op) == null ? void 0 : e.value) && fe(t.expression) || t instanceof se);
2584
2584
  }
2585
2585
  function fe(t) {
2586
2586
  var e;
2587
- return t instanceof U && t.expression instanceof be && ((e = t.expression.literal) == null ? void 0 : e.kind) === u.NUMERIC_LITERAL;
2587
+ return t instanceof M && t.expression instanceof be && ((e = t.expression.literal) == null ? void 0 : e.kind) === u.NUMERIC_LITERAL;
2588
2588
  }
2589
- function Fn(t) {
2589
+ function Bn(t) {
2590
2590
  var n;
2591
- if (!(t instanceof Q) || !xt((n = t.op) == null ? void 0 : n.value))
2591
+ if (!(t instanceof q) || !xt((n = t.op) == null ? void 0 : n.value))
2592
2592
  return !1;
2593
- const e = W(t.expression).unwrap_or(void 0);
2593
+ const e = j(t.expression).unwrap_or(void 0);
2594
2594
  return e !== void 0 && e.length > 0;
2595
2595
  }
2596
2596
  function Ot(t) {
2597
- return t instanceof Z && t.elementList.every(M);
2597
+ return t instanceof K && t.elementList.every(F);
2598
2598
  }
2599
- function B(t) {
2599
+ function V(t) {
2600
2600
  var s;
2601
2601
  const e = {}, n = [];
2602
2602
  if (!t)
2603
- return new V({});
2603
+ return new G({});
2604
2604
  for (const i of t.elementList) {
2605
2605
  if (!i.name)
2606
2606
  continue;
2607
- if (i.name instanceof U) {
2607
+ if (i.name instanceof M) {
2608
2608
  n.push(new c(o.INVALID_SETTINGS, "A setting name must be a stream of identifiers", i.name));
2609
2609
  continue;
2610
2610
  }
2611
2611
  const r = (s = Te(i.name).unwrap_or(void 0)) == null ? void 0 : s.toLowerCase();
2612
2612
  r && (e[r] === void 0 ? e[r] = [i] : e[r].push(i));
2613
2613
  }
2614
- return new V(e, n);
2614
+ return new G(e, n);
2615
2615
  }
2616
2616
  class pt {
2617
2617
  constructor(e, n) {
@@ -2624,7 +2624,7 @@ class pt {
2624
2624
  this.ast.body.forEach((s) => {
2625
2625
  if (s.parent = this.ast, s.type === void 0)
2626
2626
  return;
2627
- const i = ae(s), r = new i(
2627
+ const i = oe(s), r = new i(
2628
2628
  s,
2629
2629
  this.publicSchemaSymbol.symbolTable,
2630
2630
  this.symbolFactory
@@ -2632,10 +2632,10 @@ class pt {
2632
2632
  e.push(...r.validate());
2633
2633
  });
2634
2634
  const n = this.ast.body.filter((s) => ve(s).unwrap_or(void 0) === b.Project);
2635
- return n.length > 1 && n.forEach((s) => e.push(new c(o.PROJECT_REDEFINED, "Only one project can exist", s))), new V(this.ast, e);
2635
+ return n.length > 1 && n.forEach((s) => e.push(new c(o.PROJECT_REDEFINED, "Only one project can exist", s))), new G(this.ast, e);
2636
2636
  }
2637
2637
  }
2638
- class oe {
2638
+ class le {
2639
2639
  constructor(e, n) {
2640
2640
  this.declarationNode = e, this.errors = n;
2641
2641
  }
@@ -2645,7 +2645,7 @@ class oe {
2645
2645
  bindSettingList(e, n) {
2646
2646
  if (e)
2647
2647
  for (const s of e.elementList) {
2648
- if (s.name instanceof U)
2648
+ if (s.name instanceof M)
2649
2649
  continue;
2650
2650
  const i = Te(s.name).unwrap_or(void 0);
2651
2651
  if (!i)
@@ -2659,9 +2659,9 @@ class oe {
2659
2659
  if (!e.body)
2660
2660
  return;
2661
2661
  const { body: n } = e;
2662
- if (n instanceof J)
2662
+ if (n instanceof Z)
2663
2663
  for (const s of n.body)
2664
- if (s instanceof v) {
2664
+ if (s instanceof A) {
2665
2665
  if (!s.type)
2666
2666
  continue;
2667
2667
  const i = Dt(s);
@@ -2673,7 +2673,7 @@ class oe {
2673
2673
  }
2674
2674
  bindSubfield(e) {
2675
2675
  const n = [e.callee, ...e.args], s = I.last(n);
2676
- s instanceof R && (n.pop(), this.bindSettingList(s, this.subfield.settingList));
2676
+ s instanceof P && (n.pop(), this.bindSettingList(s, this.subfield.settingList));
2677
2677
  const { argBinderRules: i } = this.subfield.arg;
2678
2678
  for (let r = 0; r < Math.min(n.length, i.length); r += 1)
2679
2679
  i[r].shouldBind && this.scanAndBind(n[r], i[r]);
@@ -2682,12 +2682,12 @@ class oe {
2682
2682
  scanAndBind(e, n) {
2683
2683
  var s, i;
2684
2684
  if (e)
2685
- if (e instanceof U) {
2686
- if (e.expression instanceof K && ((i = n.keywords) != null && i.includes((s = e.expression.variable) == null ? void 0 : s.value.toLowerCase())))
2685
+ if (e instanceof M) {
2686
+ if (e.expression instanceof ee && ((i = n.keywords) != null && i.includes((s = e.expression.variable) == null ? void 0 : s.value.toLowerCase())))
2687
2687
  return;
2688
2688
  this.bindFragments([e], n);
2689
2689
  } else
2690
- e instanceof q ? Je(e) ? this.bindFragments(pe(e).unwrap_or([]), n) : (this.scanAndBind(e.leftExpression, n), this.scanAndBind(e.rightExpression, n)) : e instanceof Q ? this.scanAndBind(e.expression, n) : e instanceof Ue ? this.scanAndBind(e.expression, n) : e instanceof Z && e.elementList.forEach((r) => this.scanAndBind(r, n));
2690
+ e instanceof H ? Ze(e) ? this.bindFragments(pe(e).unwrap_or([]), n) : (this.scanAndBind(e.leftExpression, n), this.scanAndBind(e.rightExpression, n)) : e instanceof q ? this.scanAndBind(e.expression, n) : e instanceof Ue ? this.scanAndBind(e.expression, n) : e instanceof K && e.elementList.forEach((r) => this.scanAndBind(r, n));
2691
2691
  }
2692
2692
  // Bind the fragments of a member access expression
2693
2693
  // which can be a simple expression like v1.User,
@@ -2695,7 +2695,7 @@ class oe {
2695
2695
  bindFragments(e, n) {
2696
2696
  if (e.length === 0)
2697
2697
  return;
2698
- const s = [...n.topSubnamesSymbolKind], { remainingSubnamesSymbolKind: i } = n, r = e.findIndex((h) => !M(h)), l = r !== -1 && Ot(e[r]) ? e[r] : void 0, p = r >= 0 ? s.pop() : void 0, f = e.slice(
2698
+ const s = [...n.topSubnamesSymbolKind], { remainingSubnamesSymbolKind: i } = n, r = e.findIndex((h) => !F(h)), l = r !== -1 && Ot(e[r]) ? e[r] : void 0, p = r >= 0 ? s.pop() : void 0, f = e.slice(
2699
2699
  0,
2700
2700
  r === -1 ? void 0 : r
2701
2701
  );
@@ -2703,14 +2703,14 @@ class oe {
2703
2703
  return;
2704
2704
  const E = [];
2705
2705
  for (; s.length && f.length; ) {
2706
- const h = s.pop(), m = f.pop(), g = C(m).unwrap();
2706
+ const h = s.pop(), m = f.pop(), g = X(m).unwrap();
2707
2707
  E.unshift({
2708
2708
  index: Ve(g, h),
2709
2709
  referrer: m
2710
2710
  });
2711
2711
  }
2712
2712
  for (; f.length; ) {
2713
- const h = f.pop(), m = C(h).unwrap();
2713
+ const h = f.pop(), m = X(h).unwrap();
2714
2714
  E.unshift({
2715
2715
  index: Ve(m, i),
2716
2716
  referrer: h
@@ -2722,7 +2722,7 @@ class oe {
2722
2722
  ...E,
2723
2723
  {
2724
2724
  index: Ve(
2725
- C(h).unwrap(),
2725
+ X(h).unwrap(),
2726
2726
  p
2727
2727
  ),
2728
2728
  referrer: h
@@ -2737,16 +2737,16 @@ class oe {
2737
2737
  resolveIndexStack(e, n) {
2738
2738
  if (e.length === 0)
2739
2739
  throw new Error("Unreachable - An unresolved name must have at least one name component");
2740
- const [s, ...i] = e, r = _n(s.index, this.declarationNode);
2740
+ const [s, ...i] = e, r = An(s.index, this.declarationNode);
2741
2741
  if (r === void 0) {
2742
- const { kind: f, name: E } = ie(s.index).unwrap();
2742
+ const { kind: f, name: E } = re(s.index).unwrap();
2743
2743
  this.logError(s.referrer, `Can not find ${f} '${E}'`, n);
2744
2744
  return;
2745
2745
  }
2746
2746
  r.references.push(s.referrer), s.referrer.referee = r;
2747
- let a = r.symbolTable, { kind: l, name: p } = ie(s.index).unwrap();
2747
+ let a = r.symbolTable, { kind: l, name: p } = re(s.index).unwrap();
2748
2748
  for (const f of i) {
2749
- const { kind: E, name: h } = ie(f.index).unwrap(), m = a.get(f.index);
2749
+ const { kind: E, name: h } = re(f.index).unwrap(), m = a.get(f.index);
2750
2750
  if (!m) {
2751
2751
  this.logError(
2752
2752
  f.referrer,
@@ -2764,7 +2764,7 @@ class oe {
2764
2764
  s || this.errors.push(new c(o.BINDING_ERROR, n, e));
2765
2765
  }
2766
2766
  }
2767
- class Bn extends oe {
2767
+ class Vn extends le {
2768
2768
  constructor() {
2769
2769
  super(...arguments), this.subfield = {
2770
2770
  arg: {
@@ -2774,7 +2774,7 @@ class Bn extends oe {
2774
2774
  }, this.settingList = {};
2775
2775
  }
2776
2776
  }
2777
- class Vn extends oe {
2777
+ class Gn extends le {
2778
2778
  constructor() {
2779
2779
  super(...arguments), this.subfield = {
2780
2780
  arg: {
@@ -2784,7 +2784,7 @@ class Vn extends oe {
2784
2784
  }, this.settingList = {};
2785
2785
  }
2786
2786
  }
2787
- class Gn extends oe {
2787
+ class Cn extends le {
2788
2788
  constructor() {
2789
2789
  super(...arguments), this.subfield = {
2790
2790
  arg: {
@@ -2819,7 +2819,7 @@ class Gn extends oe {
2819
2819
  }, this.settingList = {};
2820
2820
  }
2821
2821
  }
2822
- class Cn extends oe {
2822
+ class Xn extends le {
2823
2823
  constructor() {
2824
2824
  super(...arguments), this.subfield = {
2825
2825
  arg: {
@@ -2829,7 +2829,7 @@ class Cn extends oe {
2829
2829
  }, this.settingList = {};
2830
2830
  }
2831
2831
  }
2832
- class Xn extends oe {
2832
+ class $n extends le {
2833
2833
  constructor() {
2834
2834
  super(...arguments), this.subfield = {
2835
2835
  arg: {
@@ -2839,7 +2839,7 @@ class Xn extends oe {
2839
2839
  }, this.settingList = {};
2840
2840
  }
2841
2841
  }
2842
- class $n extends oe {
2842
+ class Wn extends le {
2843
2843
  constructor() {
2844
2844
  super(...arguments), this.subfield = {
2845
2845
  arg: {
@@ -2856,7 +2856,7 @@ class $n extends oe {
2856
2856
  }, this.settingList = {};
2857
2857
  }
2858
2858
  }
2859
- class Wn extends oe {
2859
+ class jn extends le {
2860
2860
  constructor() {
2861
2861
  super(...arguments), this.subfield = {
2862
2862
  arg: {
@@ -2884,7 +2884,7 @@ class Wn extends oe {
2884
2884
  }, this.settingList = {};
2885
2885
  }
2886
2886
  }
2887
- class jn extends oe {
2887
+ class Yn extends le {
2888
2888
  constructor() {
2889
2889
  super(...arguments), this.subfield = {
2890
2890
  arg: {
@@ -2904,24 +2904,24 @@ class jn extends oe {
2904
2904
  function Dt(t) {
2905
2905
  switch (t.type.value.toLowerCase()) {
2906
2906
  case b.Enum:
2907
- return Vn;
2907
+ return Gn;
2908
2908
  case b.Table:
2909
- return Wn;
2910
- case b.TableGroup:
2911
2909
  return jn;
2910
+ case b.TableGroup:
2911
+ return Yn;
2912
2912
  case b.Project:
2913
- return Xn;
2914
- case b.Ref:
2915
2913
  return $n;
2914
+ case b.Ref:
2915
+ return Wn;
2916
2916
  case b.Note:
2917
- return Cn;
2917
+ return Xn;
2918
2918
  case b.Indexes:
2919
- return Gn;
2919
+ return Cn;
2920
2920
  default:
2921
- return Bn;
2921
+ return Vn;
2922
2922
  }
2923
2923
  }
2924
- class Yn {
2924
+ class zn {
2925
2925
  constructor(e) {
2926
2926
  this.ast = e, this.errors = [];
2927
2927
  }
@@ -2931,10 +2931,10 @@ class Yn {
2931
2931
  const n = Dt(e);
2932
2932
  new n(e, this.errors).bind();
2933
2933
  }
2934
- return new V(this.ast, this.errors);
2934
+ return new G(this.ast, this.errors);
2935
2935
  }
2936
2936
  }
2937
- class zn {
2937
+ class Qn {
2938
2938
  constructor(e) {
2939
2939
  this.generator = e;
2940
2940
  }
@@ -2942,17 +2942,17 @@ class zn {
2942
2942
  return new e(n, this.generator.nextId());
2943
2943
  }
2944
2944
  }
2945
- class Qn {
2945
+ class qn {
2946
2946
  constructor(e, n) {
2947
- this.ast = e, this.symbolFactory = new zn(n);
2947
+ this.ast = e, this.symbolFactory = new Qn(n);
2948
2948
  }
2949
2949
  // Analyzing: Invoking both the validator and binder
2950
2950
  analyze() {
2951
- return new pt(this.ast, this.symbolFactory).validate().chain((n) => new Yn(n).resolve());
2951
+ return new pt(this.ast, this.symbolFactory).validate().chain((n) => new zn(n).resolve());
2952
2952
  }
2953
2953
  // For invoking the validator only
2954
2954
  validate() {
2955
- return new pt(this.ast, this.symbolFactory).validate().chain((n) => new V(n, []));
2955
+ return new pt(this.ast, this.symbolFactory).validate().chain((n) => new G(n, []));
2956
2956
  }
2957
2957
  }
2958
2958
  function dt(t, e) {
@@ -2988,7 +2988,7 @@ function Rt(t) {
2988
2988
  }
2989
2989
  throw new Error("Invalid relation op");
2990
2990
  }
2991
- function A(t) {
2991
+ function _(t) {
2992
2992
  return {
2993
2993
  start: {
2994
2994
  offset: t.startPos.offset,
@@ -2998,19 +2998,19 @@ function A(t) {
2998
2998
  end: { offset: t.endPos.offset, line: t.endPos.line + 1, column: t.endPos.column + 1 }
2999
2999
  };
3000
3000
  }
3001
- function $e(t) {
3001
+ function We(t) {
3002
3002
  var n;
3003
3003
  const e = (n = pe(t).unwrap_or(void 0)) == null ? void 0 : n.pop();
3004
- return e instanceof Z ? e.elementList.map((s) => s.referee) : [e.referee];
3004
+ return e instanceof K ? e.elementList.map((s) => s.referee) : [e.referee];
3005
3005
  }
3006
3006
  function Ie(t) {
3007
- const e = W(t).unwrap();
3007
+ const e = j(t).unwrap();
3008
3008
  return {
3009
3009
  name: e.pop(),
3010
3010
  schemaName: e
3011
3011
  };
3012
3012
  }
3013
- function Ke(t) {
3013
+ function et(t) {
3014
3014
  return t.expression.literal.value;
3015
3015
  }
3016
3016
  function Pt(t, e) {
@@ -3029,7 +3029,7 @@ function Ut(t, e) {
3029
3029
  const n = t.id, s = e.id;
3030
3030
  return n === s;
3031
3031
  }
3032
- function re(t) {
3032
+ function ae(t) {
3033
3033
  const e = t.split(`
3034
3034
  `), n = e.slice(e.findIndex((r) => r.trimStart() !== "")), s = n.filter((r) => r.trimStart()), i = Math.min(...s.map((r) => r.length - r.trimStart().length));
3035
3035
  return n.map((r) => r.slice(i)).join(`
@@ -3040,7 +3040,7 @@ class Mt {
3040
3040
  this.declarationNode = e, this.env = n, this.table = { name: void 0, schemaName: void 0, alias: null, fields: [], token: void 0, indexes: [] }, this.pkColumns = [];
3041
3041
  }
3042
3042
  interpret() {
3043
- this.table.token = A(this.declarationNode), this.env.tables.set(this.declarationNode, this.table);
3043
+ this.table.token = _(this.declarationNode), this.env.tables.set(this.declarationNode, this.table);
3044
3044
  const e = [
3045
3045
  ...this.interpretName(this.declarationNode.name),
3046
3046
  ...this.interpretAlias(this.declarationNode.alias),
@@ -3065,7 +3065,7 @@ class Mt {
3065
3065
  interpretAlias(e) {
3066
3066
  if (!e)
3067
3067
  return [];
3068
- const n = C(e).unwrap_or(null);
3068
+ const n = X(e).unwrap_or(null);
3069
3069
  return n && (this.env.aliases.push({
3070
3070
  name: n,
3071
3071
  kind: "table",
@@ -3077,16 +3077,16 @@ class Mt {
3077
3077
  }
3078
3078
  interpretSettingList(e) {
3079
3079
  var i, r, a;
3080
- const n = B(e).getValue();
3081
- this.table.headerColor = (i = n.headercolor) != null && i.length ? Ke((a = (r = n.headercolor) == null ? void 0 : r.at(0)) == null ? void 0 : a.value) : void 0;
3080
+ const n = V(e).getValue();
3081
+ this.table.headerColor = (i = n.headercolor) != null && i.length ? et((a = (r = n.headercolor) == null ? void 0 : r.at(0)) == null ? void 0 : a.value) : void 0;
3082
3082
  const [s] = n.note || [];
3083
3083
  return this.table.note = s && {
3084
- value: G(s == null ? void 0 : s.value).map(re).unwrap(),
3085
- token: A(s)
3084
+ value: C(s == null ? void 0 : s.value).map(ae).unwrap(),
3085
+ token: _(s)
3086
3086
  }, [];
3087
3087
  }
3088
3088
  interpretBody(e) {
3089
- const [n, s] = I.partition(e.body, (i) => i instanceof w);
3089
+ const [n, s] = I.partition(e.body, (i) => i instanceof v);
3090
3090
  return [...this.interpretFields(n), ...this.interpretSubElements(s)];
3091
3091
  }
3092
3092
  interpretSubElements(e) {
@@ -3095,8 +3095,8 @@ class Mt {
3095
3095
  switch ((s = n.type) == null ? void 0 : s.value.toLowerCase()) {
3096
3096
  case "note":
3097
3097
  return this.table.note = {
3098
- value: G(n.body instanceof J ? n.body.body[0].callee : n.body.callee).map(re).unwrap(),
3099
- token: A(n)
3098
+ value: C(n.body instanceof Z ? n.body.body[0].callee : n.body.callee).map(ae).unwrap(),
3099
+ token: _(n)
3100
3100
  }, [];
3101
3101
  case "indexes":
3102
3102
  return this.interpretIndexes(n);
@@ -3108,105 +3108,105 @@ class Mt {
3108
3108
  return e.flatMap((n) => this.interpretColumn(n));
3109
3109
  }
3110
3110
  interpretColumn(e) {
3111
- var a, l, p, f, E, h, m, g;
3111
+ var a, l, p, f, E, h, m, g, R;
3112
3112
  const n = [], s = {};
3113
- s.name = C(e.callee).unwrap();
3114
- const i = qn(e.args[0]);
3115
- s.type = i.getValue(), n.push(...i.getErrors()), s.token = A(e), s.inline_refs = [];
3113
+ s.name = X(e.callee).unwrap();
3114
+ const i = Hn(e.args[0]);
3115
+ s.type = i.getValue(), n.push(...i.getErrors()), s.token = _(e), s.inline_refs = [];
3116
3116
  const r = e.args.slice(1);
3117
- if (I.last(r) instanceof R) {
3118
- const _ = B(r.pop()).getValue();
3119
- s.pk = !!((a = _.pk) != null && a.length) || !!((l = _["primary key"]) != null && l.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 = Hn((m = (h = _.default) == null ? void 0 : h.at(0)) == null ? void 0 : m.value);
3120
- const ee = (g = _.note) == null ? void 0 : g.at(0);
3121
- s.note = ee && {
3122
- value: G(ee.value).map(re).unwrap(),
3123
- token: A(ee)
3117
+ if (I.last(r) instanceof P) {
3118
+ const S = V(r.pop()).getValue();
3119
+ s.pk = !!((a = S.pk) != null && a.length) || !!((l = S["primary key"]) != null && l.length), s.increment = !!((p = S.increment) != null && p.length), s.unique = !!((f = S.unique) != null && f.length), s.not_null = (E = S["not null"]) != null && E.length ? !0 : (h = S.null) != null && h.length ? !1 : void 0, s.dbdefault = Jn((g = (m = S.default) == null ? void 0 : m.at(0)) == null ? void 0 : g.value);
3120
+ const te = (R = S.note) == null ? void 0 : R.at(0);
3121
+ s.note = te && {
3122
+ value: C(te.value).map(ae).unwrap(),
3123
+ token: _(te)
3124
3124
  };
3125
- const le = _.ref || [];
3126
- s.inline_refs = le.flatMap((z) => {
3127
- const [nt] = $e(z.value.expression);
3128
- if (Ut(nt, e.symbol))
3129
- return n.push(new c(o.SAME_ENDPOINT, "Two endpoints are the same", z)), [];
3130
- const ke = z.value.op, te = W(z.value.expression).unwrap();
3125
+ const Yt = S.ref || [];
3126
+ s.inline_refs = Yt.flatMap((Q) => {
3127
+ const [st] = We(Q.value.expression);
3128
+ if (Ut(st, e.symbol))
3129
+ return n.push(new c(o.SAME_ENDPOINT, "Two endpoints are the same", Q)), [];
3130
+ const ke = Q.value.op, ne = j(Q.value.expression).unwrap();
3131
3131
  let de;
3132
- if (te.length === 1) {
3133
- const [ce] = te;
3132
+ if (ne.length === 1) {
3133
+ const [ce] = ne;
3134
3134
  de = {
3135
3135
  schemaName: this.table.schemaName,
3136
3136
  tableName: this.table.name,
3137
3137
  fieldNames: [ce],
3138
3138
  relation: ke.value,
3139
- token: A(z)
3139
+ token: _(Q)
3140
3140
  };
3141
- } else if (te.length === 2) {
3142
- const [ce, Le] = te;
3141
+ } else if (ne.length === 2) {
3142
+ const [ce, Le] = ne;
3143
3143
  de = {
3144
3144
  schemaName: null,
3145
3145
  tableName: ce,
3146
3146
  fieldNames: [Le],
3147
3147
  relation: ke.value,
3148
- token: A(z)
3148
+ token: _(Q)
3149
3149
  };
3150
- } else if (te.length === 3) {
3151
- const [ce, Le, it] = te;
3150
+ } else if (ne.length === 3) {
3151
+ const [ce, Le, rt] = ne;
3152
3152
  de = {
3153
3153
  schemaName: ce,
3154
3154
  tableName: Le,
3155
- fieldNames: [it],
3155
+ fieldNames: [rt],
3156
3156
  relation: ke.value,
3157
- token: A(z)
3157
+ token: _(Q)
3158
3158
  };
3159
3159
  } else {
3160
- n.push(new c(o.UNSUPPORTED, "Nested schema is not supported", z));
3161
- const ce = te.pop(), Le = te.pop();
3160
+ n.push(new c(o.UNSUPPORTED, "Nested schema is not supported", Q));
3161
+ const ce = ne.pop(), Le = ne.pop();
3162
3162
  de = {
3163
- schemaName: te.join("."),
3163
+ schemaName: ne.join("."),
3164
3164
  tableName: Le,
3165
3165
  fieldNames: [ce],
3166
3166
  relation: ke.value,
3167
- token: A(z)
3167
+ token: _(Q)
3168
3168
  };
3169
3169
  }
3170
- const st = this.registerInlineRefToEnv(e, nt, de, z);
3171
- return n.push(...st), st.length === 0 ? de : [];
3170
+ const it = this.registerInlineRefToEnv(e, st, de, Q);
3171
+ return n.push(...it), it.length === 0 ? de : [];
3172
3172
  });
3173
3173
  }
3174
- return s.pk || (s.pk = r.some((_) => j(_).unwrap().toLowerCase() === "pk")), s.unique || (s.unique = r.some((_) => j(_).unwrap().toLowerCase() === "unique")), this.table.fields.push(s), s.pk && this.pkColumns.push(s), n;
3174
+ return s.pk || (s.pk = r.some((S) => Y(S).unwrap().toLowerCase() === "pk")), s.unique || (s.unique = r.some((S) => Y(S).unwrap().toLowerCase() === "unique")), this.table.fields.push(s), s.pk && this.pkColumns.push(s), n;
3175
3175
  }
3176
3176
  interpretIndexes(e) {
3177
3177
  return this.table.indexes.push(...e.body.body.map((n) => {
3178
3178
  var a, l, p, f, E, h, m;
3179
3179
  const s = { columns: [] }, i = n;
3180
- s.token = A(i);
3180
+ s.token = _(i);
3181
3181
  const r = [i.callee, ...i.args];
3182
- if (I.last(r) instanceof R) {
3183
- const g = B(r.pop()).getValue();
3184
- s.pk = !!((a = g.pk) != null && a.length), s.unique = !!((l = g.unique) != null && l.length), s.name = G((f = (p = g.name) == null ? void 0 : p.at(0)) == null ? void 0 : f.value).unwrap_or(void 0);
3185
- const _ = (E = g.note) == null ? void 0 : E.at(0);
3186
- s.note = _ && {
3187
- value: G(_.value).unwrap(),
3188
- token: A(_)
3189
- }, s.type = j((m = (h = g.type) == null ? void 0 : h.at(0)) == null ? void 0 : m.value).unwrap_or(void 0);
3182
+ if (I.last(r) instanceof P) {
3183
+ const g = V(r.pop()).getValue();
3184
+ s.pk = !!((a = g.pk) != null && a.length), s.unique = !!((l = g.unique) != null && l.length), s.name = C((f = (p = g.name) == null ? void 0 : p.at(0)) == null ? void 0 : f.value).unwrap_or(void 0);
3185
+ const R = (E = g.note) == null ? void 0 : E.at(0);
3186
+ s.note = R && {
3187
+ value: C(R.value).unwrap(),
3188
+ token: _(R)
3189
+ }, s.type = Y((m = (h = g.type) == null ? void 0 : h.at(0)) == null ? void 0 : m.value).unwrap_or(void 0);
3190
3190
  }
3191
3191
  return r.flatMap((g) => {
3192
- if (!(g instanceof H))
3192
+ if (!(g instanceof J))
3193
3193
  return g;
3194
- const _ = [];
3195
- for (; g instanceof H; )
3196
- _.push(g.argumentList), g = g.callee;
3197
- return _.push(g), _;
3194
+ const R = [];
3195
+ for (; g instanceof J; )
3196
+ R.push(g.argumentList), g = g.callee;
3197
+ return R.push(g), R;
3198
3198
  }).forEach((g) => {
3199
- const { functional: _, nonFunctional: ee } = Xe(g).unwrap();
3199
+ const { functional: R, nonFunctional: S } = $e(g).unwrap();
3200
3200
  s.columns.push(
3201
- ..._.map((le) => ({
3202
- value: le.value.value,
3201
+ ...R.map((te) => ({
3202
+ value: te.value.value,
3203
3203
  type: "expression",
3204
- token: A(le)
3204
+ token: _(te)
3205
3205
  })),
3206
- ...ee.map((le) => ({
3207
- value: C(le).unwrap(),
3206
+ ...S.map((te) => ({
3207
+ value: X(te).unwrap(),
3208
3208
  type: "column",
3209
- token: A(le)
3209
+ token: _(te)
3210
3210
  }))
3211
3211
  );
3212
3212
  }), s;
@@ -3232,40 +3232,40 @@ class Mt {
3232
3232
  {
3233
3233
  schemaName: this.table.schemaName,
3234
3234
  tableName: this.table.name,
3235
- fieldNames: [j(e.callee).unwrap()],
3236
- token: A(e),
3235
+ fieldNames: [Y(e.callee).unwrap()],
3236
+ token: _(e),
3237
3237
  relation: a[0]
3238
3238
  }
3239
3239
  ]
3240
3240
  }), [];
3241
3241
  }
3242
3242
  }
3243
- function qn(t) {
3243
+ function Hn(t) {
3244
3244
  let e = null;
3245
- t instanceof H && (e = t.argumentList.elementList.map((r) => fe(r) ? r.expression.literal.value : $(r) ? G(r).unwrap() : j(r).unwrap()).join(","), t = t.callee);
3245
+ t instanceof J && (e = t.argumentList.elementList.map((r) => fe(r) ? r.expression.literal.value : W(r) ? C(r).unwrap() : Y(r).unwrap()).join(","), t = t.callee);
3246
3246
  let n = "";
3247
3247
  for (; t instanceof he; )
3248
3248
  n = `[${t.indexer.elementList.map((r) => r.name.expression.literal.value).join(",")}]${n}`, t = t.array;
3249
3249
  const { name: s, schemaName: i } = Ie(t);
3250
- return i.length > 1 ? new V(
3250
+ return i.length > 1 ? new G(
3251
3251
  {
3252
3252
  schemaName: i.length === 0 ? null : i[0],
3253
3253
  type_name: `${s}${n}${e ? `(${e})` : ""}`,
3254
3254
  args: e
3255
3255
  },
3256
3256
  [new c(o.UNSUPPORTED, "Nested schema is not supported", t)]
3257
- ) : new V({
3257
+ ) : new G({
3258
3258
  schemaName: i.length === 0 ? null : i[0],
3259
3259
  type_name: `${s}${n}${e ? `(${e})` : ""}`,
3260
3260
  args: e
3261
3261
  });
3262
3262
  }
3263
- function Hn(t) {
3263
+ function Jn(t) {
3264
3264
  var e, n, s;
3265
3265
  if (t) {
3266
- if ($(t))
3266
+ if (W(t))
3267
3267
  return {
3268
- value: G(t).unwrap(),
3268
+ value: C(t).unwrap(),
3269
3269
  type: "string"
3270
3270
  };
3271
3271
  if (fe(t))
@@ -3278,14 +3278,14 @@ function Hn(t) {
3278
3278
  value: t.expression.variable.value.toLowerCase(),
3279
3279
  type: "boolean"
3280
3280
  };
3281
- if (t instanceof Q && yt.includes((e = t.op) == null ? void 0 : e.value) && fe(t.expression)) {
3281
+ if (t instanceof q && yt.includes((e = t.op) == null ? void 0 : e.value) && fe(t.expression)) {
3282
3282
  const i = Number.parseFloat(t.expression.expression.literal.value);
3283
3283
  return {
3284
3284
  value: ((n = t.op) == null ? void 0 : n.value) === "-" ? 0 - i : i,
3285
3285
  type: "number"
3286
3286
  };
3287
3287
  }
3288
- if (t instanceof ne)
3288
+ if (t instanceof se)
3289
3289
  return {
3290
3290
  value: (s = t.value) == null ? void 0 : s.value,
3291
3291
  type: "expression"
@@ -3293,12 +3293,12 @@ function Hn(t) {
3293
3293
  throw new Error("Unreachable");
3294
3294
  }
3295
3295
  }
3296
- class Jn {
3296
+ class Zn {
3297
3297
  constructor(e, n) {
3298
3298
  this.declarationNode = e, this.env = n, this.note = { name: void 0, content: void 0, token: void 0 };
3299
3299
  }
3300
3300
  interpret() {
3301
- return this.note.token = A(this.declarationNode), this.env.notes.set(this.declarationNode, this.note), [
3301
+ return this.note.token = _(this.declarationNode), this.env.notes.set(this.declarationNode, this.note), [
3302
3302
  ...this.interpretName(this.declarationNode.name),
3303
3303
  ...this.interpretSettingList(this.declarationNode.attributeList),
3304
3304
  ...this.interpretBody(this.declarationNode.body)
@@ -3310,37 +3310,37 @@ class Jn {
3310
3310
  }
3311
3311
  interpretSettingList(e) {
3312
3312
  var s, i, r;
3313
- const n = B(e).getValue();
3314
- return this.note.headerColor = (s = n.headercolor) != null && s.length ? Ke((r = (i = n.headercolor) == null ? void 0 : i.at(0)) == null ? void 0 : r.value) : void 0, [];
3313
+ const n = V(e).getValue();
3314
+ return this.note.headerColor = (s = n.headercolor) != null && s.length ? et((r = (i = n.headercolor) == null ? void 0 : i.at(0)) == null ? void 0 : r.value) : void 0, [];
3315
3315
  }
3316
3316
  interpretBody(e) {
3317
- const [n, s] = I.partition(e.body, (i) => i instanceof w);
3317
+ const [n, s] = I.partition(e.body, (i) => i instanceof v);
3318
3318
  return n.length !== 1 || s.length > 0 ? [
3319
3319
  new c(o.INVALID_NOTE, "Invalid note syntax", e)
3320
3320
  ] : [...this.interpretNote(n[0])];
3321
3321
  }
3322
3322
  interpretNote(e) {
3323
3323
  const n = I.get(e, "callee.expression.literal.value", "");
3324
- return this.note.content = re(n), [];
3324
+ return this.note.content = ae(n), [];
3325
3325
  }
3326
3326
  }
3327
3327
  class Ft {
3328
3328
  constructor(e, n) {
3329
- this.declarationNode = e, this.env = n, this.container = this.declarationNode.parent instanceof v ? this.env.tables.get(this.declarationNode.parent) : void 0, this.ref = {};
3329
+ this.declarationNode = e, this.env = n, this.container = this.declarationNode.parent instanceof A ? this.env.tables.get(this.declarationNode.parent) : void 0, this.ref = {};
3330
3330
  }
3331
3331
  interpret() {
3332
- return this.ref.token = A(this.declarationNode), this.env.ref.set(this.declarationNode, this.ref), [...this.interpretName(this.declarationNode.name), ...this.interpretBody(this.declarationNode.body)];
3332
+ return this.ref.token = _(this.declarationNode), this.env.ref.set(this.declarationNode, this.ref), [...this.interpretName(this.declarationNode.name), ...this.interpretBody(this.declarationNode.body)];
3333
3333
  }
3334
3334
  interpretName(e) {
3335
- const n = [], s = W(this.declarationNode.name).unwrap_or([]);
3335
+ const n = [], s = j(this.declarationNode.name).unwrap_or([]);
3336
3336
  return this.ref.name = s.pop() || null, s.length > 1 && n.push(new c(o.UNSUPPORTED, "Nested schema is not supported", this.declarationNode.name)), this.ref.schemaName = s.join(".") || null, n;
3337
3337
  }
3338
3338
  interpretBody(e) {
3339
- return e instanceof w ? this.interpretField(e) : this.interpretField(e.body[0]);
3339
+ return e instanceof v ? this.interpretField(e) : this.interpretField(e.body[0]);
3340
3340
  }
3341
3341
  interpretField(e) {
3342
3342
  var f, E, h, m;
3343
- const n = e.callee.op.value, { leftExpression: s, rightExpression: i } = e.callee, r = $e(s), a = $e(i);
3343
+ const n = e.callee.op.value, { leftExpression: s, rightExpression: i } = e.callee, r = We(s), a = We(i);
3344
3344
  if (Ut(r, a))
3345
3345
  return [new c(o.SAME_ENDPOINT, "Two endpoints are the same", e)];
3346
3346
  const l = Pt(r, a);
@@ -3350,22 +3350,22 @@ class Ft {
3350
3350
  new c(o.CIRCULAR_REF, "References with same endpoints exist", this.env.refIds[l])
3351
3351
  ];
3352
3352
  if (e.args[0]) {
3353
- const g = B(e.args[0]).getValue(), _ = (E = (f = g.delete) == null ? void 0 : f.at(0)) == null ? void 0 : E.value;
3354
- this.ref.onDelete = _ instanceof Y ? Te(_).unwrap_or(void 0) : j(_).unwrap_or(void 0);
3355
- const ee = (m = (h = g.update) == null ? void 0 : h.at(0)) == null ? void 0 : m.value;
3356
- this.ref.onUpdate = ee instanceof Y ? Te(ee).unwrap_or(void 0) : j(ee).unwrap_or(void 0);
3353
+ const g = V(e.args[0]).getValue(), R = (E = (f = g.delete) == null ? void 0 : f.at(0)) == null ? void 0 : E.value;
3354
+ this.ref.onDelete = R instanceof z ? Te(R).unwrap_or(void 0) : Y(R).unwrap_or(void 0);
3355
+ const S = (m = (h = g.update) == null ? void 0 : h.at(0)) == null ? void 0 : m.value;
3356
+ this.ref.onUpdate = S instanceof z ? Te(S).unwrap_or(void 0) : Y(S).unwrap_or(void 0);
3357
3357
  }
3358
3358
  const p = Rt(n);
3359
3359
  return this.ref.endpoints = [
3360
3360
  {
3361
3361
  ...dt(s, this.container),
3362
3362
  relation: p[0],
3363
- token: A(s)
3363
+ token: _(s)
3364
3364
  },
3365
3365
  {
3366
3366
  ...dt(i, this.container),
3367
3367
  relation: p[1],
3368
- token: A(i)
3368
+ token: _(i)
3369
3369
  }
3370
3370
  ], this.env.refIds[l] = this.declarationNode, [];
3371
3371
  }
@@ -3376,7 +3376,7 @@ class Bt {
3376
3376
  }
3377
3377
  interpret() {
3378
3378
  const e = [];
3379
- return this.tableGroup.token = A(this.declarationNode), this.env.tableGroups.set(this.declarationNode, this.tableGroup), e.push(
3379
+ return this.tableGroup.token = _(this.declarationNode), this.env.tableGroups.set(this.declarationNode, this.tableGroup), e.push(
3380
3380
  ...this.interpretName(this.declarationNode.name),
3381
3381
  ...this.interpretSettingList(this.declarationNode.attributeList),
3382
3382
  ...this.interpretBody(this.declarationNode.body)
@@ -3387,7 +3387,7 @@ class Bt {
3387
3387
  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;
3388
3388
  }
3389
3389
  interpretBody(e) {
3390
- const [n, s] = Yt(e.body, (i) => i instanceof w);
3390
+ const [n, s] = zt(e.body, (i) => i instanceof v);
3391
3391
  return [
3392
3392
  ...this.interpretFields(n),
3393
3393
  ...this.interpretSubElements(s)
@@ -3399,10 +3399,10 @@ class Bt {
3399
3399
  switch ((s = n.type) == null ? void 0 : s.value.toLowerCase()) {
3400
3400
  case "note":
3401
3401
  this.tableGroup.note = {
3402
- value: G(
3403
- n.body instanceof J ? n.body.body[0].callee : n.body.callee
3404
- ).map(re).unwrap(),
3405
- token: A(n)
3402
+ value: C(
3403
+ n.body instanceof Z ? n.body.body[0].callee : n.body.callee
3404
+ ).map(ae).unwrap(),
3405
+ token: _(n)
3406
3406
  };
3407
3407
  break;
3408
3408
  }
@@ -3412,7 +3412,7 @@ class Bt {
3412
3412
  interpretFields(e) {
3413
3413
  const n = [];
3414
3414
  return this.tableGroup.tables = e.map((s) => {
3415
- const i = W(s.callee).unwrap();
3415
+ const i = j(s.callee).unwrap();
3416
3416
  i.length > 2 && n.push(new c(o.UNSUPPORTED, "Nested schema is not supported", s));
3417
3417
  const r = pe(s.callee).unwrap().pop().referee.id;
3418
3418
  if (this.env.groupOfTable[r]) {
@@ -3428,12 +3428,12 @@ class Bt {
3428
3428
  }
3429
3429
  interpretSettingList(e) {
3430
3430
  var i, r, a;
3431
- const n = B(e).getValue();
3432
- this.tableGroup.color = (i = n.color) != null && i.length ? Ke((a = (r = n.color) == null ? void 0 : r.at(0)) == null ? void 0 : a.value) : void 0;
3431
+ const n = V(e).getValue();
3432
+ this.tableGroup.color = (i = n.color) != null && i.length ? et((a = (r = n.color) == null ? void 0 : r.at(0)) == null ? void 0 : a.value) : void 0;
3433
3433
  const [s] = n.note || [];
3434
3434
  return this.tableGroup.note = s && {
3435
- value: G(s == null ? void 0 : s.value).map(re).unwrap(),
3436
- token: A(s)
3435
+ value: C(s == null ? void 0 : s.value).map(ae).unwrap(),
3436
+ token: _(s)
3437
3437
  }, [];
3438
3438
  }
3439
3439
  }
@@ -3442,7 +3442,7 @@ class Vt {
3442
3442
  this.declarationNode = e, this.env = n, this.enum = { values: [] };
3443
3443
  }
3444
3444
  interpret() {
3445
- return this.enum.token = A(this.declarationNode), this.env.enums.set(this.declarationNode, this.enum), [...this.interpretName(this.declarationNode.name), ...this.interpretBody(this.declarationNode.body)];
3445
+ return this.enum.token = _(this.declarationNode), this.env.enums.set(this.declarationNode, this.enum), [...this.interpretName(this.declarationNode.name), ...this.interpretBody(this.declarationNode.body)];
3446
3446
  }
3447
3447
  interpretName(e) {
3448
3448
  const { name: n, schemaName: s } = Ie(e);
@@ -3452,21 +3452,21 @@ class Vt {
3452
3452
  return e.body.flatMap((n) => {
3453
3453
  var l;
3454
3454
  const s = n, i = {};
3455
- i.token = A(s), i.name = j(s.callee).unwrap();
3456
- const a = (l = B(s.args[0]).getValue().note) == null ? void 0 : l.at(0);
3455
+ i.token = _(s), i.name = Y(s.callee).unwrap();
3456
+ const a = (l = V(s.args[0]).getValue().note) == null ? void 0 : l.at(0);
3457
3457
  return i.note = a && {
3458
- value: G(a.value).map(re).unwrap(),
3459
- token: A(a)
3458
+ value: C(a.value).map(ae).unwrap(),
3459
+ token: _(a)
3460
3460
  }, this.enum.values.push(i), [];
3461
3461
  });
3462
3462
  }
3463
3463
  }
3464
- class Zn {
3464
+ class Kn {
3465
3465
  constructor(e, n) {
3466
3466
  this.declarationNode = e, this.env = n, this.project = { enums: [], refs: [], tableGroups: [], tables: [] };
3467
3467
  }
3468
3468
  interpret() {
3469
- return this.env.project.set(this.declarationNode, this.project), this.project.token = A(this.declarationNode), [...this.interpretName(this.declarationNode.name), ...this.interpretBody(this.declarationNode.body)];
3469
+ return this.env.project.set(this.declarationNode, this.project), this.project.token = _(this.declarationNode), [...this.interpretName(this.declarationNode.name), ...this.interpretBody(this.declarationNode.body)];
3470
3470
  }
3471
3471
  interpretName(e) {
3472
3472
  if (!e)
@@ -3497,16 +3497,16 @@ class Zn {
3497
3497
  }
3498
3498
  case "note":
3499
3499
  return this.project.note = {
3500
- value: G(s.body instanceof J ? s.body.body[0].callee : s.body.callee).map(re).unwrap(),
3501
- token: A(s)
3500
+ value: C(s.body instanceof Z ? s.body.body[0].callee : s.body.callee).map(ae).unwrap(),
3501
+ token: _(s)
3502
3502
  }, [];
3503
3503
  default:
3504
- return this.project[s.type.value.toLowerCase()] = G(s.body.callee).unwrap(), [];
3504
+ return this.project[s.type.value.toLowerCase()] = C(s.body.callee).unwrap(), [];
3505
3505
  }
3506
3506
  });
3507
3507
  }
3508
3508
  }
3509
- class Kn {
3509
+ class es {
3510
3510
  constructor(e) {
3511
3511
  this.ast = e, this.env = {
3512
3512
  schema: [],
@@ -3527,7 +3527,7 @@ class Kn {
3527
3527
  case b.Table:
3528
3528
  return new Mt(n, this.env).interpret();
3529
3529
  case b.Note:
3530
- return new Jn(n, this.env).interpret();
3530
+ return new Zn(n, this.env).interpret();
3531
3531
  case b.Ref:
3532
3532
  return new Ft(n, this.env).interpret();
3533
3533
  case b.TableGroup:
@@ -3535,15 +3535,15 @@ class Kn {
3535
3535
  case b.Enum:
3536
3536
  return new Vt(n, this.env).interpret();
3537
3537
  case b.Project:
3538
- return new Zn(n, this.env).interpret();
3538
+ return new Kn(n, this.env).interpret();
3539
3539
  default:
3540
3540
  return [];
3541
3541
  }
3542
3542
  });
3543
- return new V(es(this.env), e);
3543
+ return new G(ts(this.env), e);
3544
3544
  }
3545
3545
  }
3546
- function es(t) {
3546
+ function ts(t) {
3547
3547
  return {
3548
3548
  schemas: [],
3549
3549
  tables: Array.from(t.tables.values()),
@@ -3555,7 +3555,7 @@ function es(t) {
3555
3555
  project: Array.from(t.project.values())[0] || {}
3556
3556
  };
3557
3557
  }
3558
- 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 || {}), y = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.KeepWhitespace = 1] = "KeepWhitespace", t[t.InsertAsSnippet = 4] = "InsertAsSnippet", t))(y || {});
3558
+ var L = /* @__PURE__ */ ((t) => (t[t.Function = 1] = "Function", t[t.Constructor = 2] = "Constructor", t[t.Field = 3] = "Field", t[t.Variable = 4] = "Variable", t[t.Class = 5] = "Class", t[t.Struct = 6] = "Struct", t[t.Interface = 7] = "Interface", t[t.Module = 8] = "Module", t[t.Property = 9] = "Property", t[t.Event = 10] = "Event", t[t.Operator = 11] = "Operator", t[t.Unit = 12] = "Unit", t[t.Value = 13] = "Value", t[t.Constant = 14] = "Constant", t[t.Enum = 15] = "Enum", t[t.EnumMember = 16] = "EnumMember", t[t.Keyword = 17] = "Keyword", t[t.Text = 18] = "Text", t[t.Color = 19] = "Color", t[t.File = 20] = "File", t[t.Reference = 21] = "Reference", t[t.Customcolor = 22] = "Customcolor", t[t.Folder = 23] = "Folder", t[t.TypeParameter = 24] = "TypeParameter", t[t.User = 25] = "User", t[t.Issue = 26] = "Issue", t[t.Snippet = 27] = "Snippet", t))(L || {}), w = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.KeepWhitespace = 1] = "KeepWhitespace", t[t.InsertAsSnippet = 4] = "InsertAsSnippet", t))(w || {});
3559
3559
  function Ae(t) {
3560
3560
  switch (t) {
3561
3561
  case T.Schema:
@@ -3577,7 +3577,7 @@ function Ae(t) {
3577
3577
  }
3578
3578
  }
3579
3579
  function Re(t, e) {
3580
- if (!t || Ce(t))
3580
+ if (!t || Xe(t))
3581
3581
  return !1;
3582
3582
  for (const n of t.trailingTrivia) {
3583
3583
  if (n.start > e)
@@ -3610,7 +3610,7 @@ function Fe(t) {
3610
3610
  }))
3611
3611
  };
3612
3612
  }
3613
- function et(t, e) {
3613
+ function tt(t, e) {
3614
3614
  return t.getOffsetAt(e);
3615
3615
  }
3616
3616
  class Gt {
@@ -3619,23 +3619,23 @@ class Gt {
3619
3619
  }
3620
3620
  provideCompletionItems(e, n) {
3621
3621
  var E, h;
3622
- const s = et(e, n), i = this.compiler.token.flatStream(), { token: r, index: a } = this.compiler.container.token(s), l = a === void 0 ? i[0] : i[a + 1];
3622
+ const s = tt(e, n), i = this.compiler.token.flatStream(), { token: r, index: a } = this.compiler.container.token(s), l = a === void 0 ? i[0] : i[a + 1];
3623
3623
  if ([
3624
3624
  ...(r == null ? void 0 : r.trailingTrivia) || [],
3625
3625
  ...(r == null ? void 0 : r.leadingTrivia) || [],
3626
3626
  ...(l == null ? void 0 : l.leadingTrivia) || []
3627
- ].find((m) => qt(m) && ge(s, m)))
3627
+ ].find((m) => Ht(m) && ge(s, m)))
3628
3628
  return D();
3629
3629
  if (a === void 0)
3630
3630
  return bt();
3631
3631
  if ([u.STRING_LITERAL, u.QUOTED_STRING].includes(r.kind) && ge(s, r))
3632
3632
  return D();
3633
3633
  const p = this.compiler.container.element(s);
3634
- if (this.compiler.container.scopeKind(s) === O.TOPLEVEL || p instanceof v && p.type && p.type.start <= s && p.type.end >= s)
3634
+ if (this.compiler.container.scopeKind(s) === O.TOPLEVEL || p instanceof A && p.type && p.type.start <= s && p.type.end >= s)
3635
3635
  return bt();
3636
3636
  const f = [...this.compiler.container.stack(s)].reverse();
3637
3637
  for (const m of f)
3638
- if (m instanceof Q)
3638
+ if (m instanceof q)
3639
3639
  switch ((E = m.op) == null ? void 0 : E.value) {
3640
3640
  case ">":
3641
3641
  case "<":
@@ -3647,7 +3647,7 @@ class Gt {
3647
3647
  m
3648
3648
  );
3649
3649
  }
3650
- else if (m instanceof q)
3650
+ else if (m instanceof H)
3651
3651
  switch ((h = m.op) == null ? void 0 : h.value) {
3652
3652
  case ">":
3653
3653
  case "<":
@@ -3666,15 +3666,15 @@ class Gt {
3666
3666
  );
3667
3667
  }
3668
3668
  else {
3669
- if (m instanceof se)
3669
+ if (m instanceof ie)
3670
3670
  return Nt(this.compiler, s, m);
3671
- if (m instanceof R)
3671
+ if (m instanceof P)
3672
3672
  return Nt(this.compiler, s, m);
3673
- if (m instanceof Z)
3674
- return ts(this.compiler, s);
3675
- if (m instanceof w)
3673
+ if (m instanceof K)
3674
+ return ns(this.compiler, s);
3675
+ if (m instanceof v)
3676
3676
  return Tt(this.compiler, s, m);
3677
- if (m instanceof v && (m.bodyColon && s >= m.bodyColon.end || m.body && ge(s, m.body)))
3677
+ if (m instanceof A && (m.bodyColon && s >= m.bodyColon.end || m.body && ge(s, m.body)))
3678
3678
  return Tt(this.compiler, s, void 0);
3679
3679
  }
3680
3680
  return D();
@@ -3705,18 +3705,18 @@ function Be(t, e, n, s) {
3705
3705
  ...t.symbol.members(l).filter(({ kind: p }) => s.includes(p)).map(({ name: p, kind: f }) => ({
3706
3706
  label: p,
3707
3707
  insertText: p,
3708
- insertTextRules: y.KeepWhitespace,
3708
+ insertTextRules: w.KeepWhitespace,
3709
3709
  kind: Ae(f),
3710
3710
  sortText: Ae(f).toString().padStart(2, "0"),
3711
3711
  range: void 0
3712
3712
  }))
3713
3713
  );
3714
3714
  }
3715
- i = i instanceof v ? i.parent : void 0;
3715
+ i = i instanceof A ? i.parent : void 0;
3716
3716
  }
3717
3717
  return Fe(r);
3718
3718
  }
3719
- function ts(t, e) {
3719
+ function ns(t, e) {
3720
3720
  var s;
3721
3721
  switch (t.container.scopeKind(e)) {
3722
3722
  case O.INDEXES:
@@ -3726,7 +3726,7 @@ function ts(t, e) {
3726
3726
  const i = [...t.container.stack(e)];
3727
3727
  for (; i.length > 0; ) {
3728
3728
  const r = i.pop();
3729
- if (r instanceof q && ((s = r.op) == null ? void 0 : s.value) === ".")
3729
+ if (r instanceof H && ((s = r.op) == null ? void 0 : s.value) === ".")
3730
3730
  return Ct(
3731
3731
  t,
3732
3732
  e,
@@ -3746,8 +3746,8 @@ function Nt(t, e, n) {
3746
3746
  }
3747
3747
  if (n.name && n.name.start <= e && n.name.end >= e)
3748
3748
  return mt(t, e);
3749
- if (n.name instanceof Y) {
3750
- const i = ns(
3749
+ if (n.name instanceof z) {
3750
+ const i = ss(
3751
3751
  t,
3752
3752
  e,
3753
3753
  Te(n.name).unwrap_or("")
@@ -3758,7 +3758,7 @@ function Nt(t, e, n) {
3758
3758
  }
3759
3759
  function mt(t, e) {
3760
3760
  const n = t.container.element(e), s = t.container.scopeKind(e);
3761
- if (n instanceof X)
3761
+ if (n instanceof $)
3762
3762
  return D();
3763
3763
  if (n.body && !ge(e, n.body))
3764
3764
  switch (s) {
@@ -3768,7 +3768,7 @@ function mt(t, e) {
3768
3768
  label: i,
3769
3769
  insertText: `${i}: `,
3770
3770
  kind: L.Field,
3771
- insertTextRules: y.KeepWhitespace,
3771
+ insertTextRules: w.KeepWhitespace,
3772
3772
  range: void 0
3773
3773
  }))
3774
3774
  };
@@ -3778,7 +3778,7 @@ function mt(t, e) {
3778
3778
  label: i,
3779
3779
  insertText: `${i}: `,
3780
3780
  kind: L.Field,
3781
- insertTextRules: y.KeepWhitespace,
3781
+ insertTextRules: w.KeepWhitespace,
3782
3782
  range: void 0
3783
3783
  }))
3784
3784
  };
@@ -3793,21 +3793,21 @@ function mt(t, e) {
3793
3793
  label: i,
3794
3794
  insertText: i,
3795
3795
  kind: L.Property,
3796
- insertTextRules: y.KeepWhitespace,
3796
+ insertTextRules: w.KeepWhitespace,
3797
3797
  range: void 0
3798
3798
  })),
3799
3799
  ...["ref", "default"].map((i) => ({
3800
3800
  label: i,
3801
3801
  insertText: `${i}: `,
3802
3802
  kind: L.Property,
3803
- insertTextRules: y.KeepWhitespace,
3803
+ insertTextRules: w.KeepWhitespace,
3804
3804
  range: void 0
3805
3805
  })),
3806
3806
  {
3807
3807
  label: "note",
3808
3808
  insertText: "note: ",
3809
3809
  kind: L.Property,
3810
- insertTextRules: y.KeepWhitespace,
3810
+ insertTextRules: w.KeepWhitespace,
3811
3811
  range: void 0
3812
3812
  }
3813
3813
  ]
@@ -3819,7 +3819,7 @@ function mt(t, e) {
3819
3819
  label: "note",
3820
3820
  insertText: "note: ",
3821
3821
  kind: L.Property,
3822
- insertTextRules: y.KeepWhitespace,
3822
+ insertTextRules: w.KeepWhitespace,
3823
3823
  range: void 0
3824
3824
  }
3825
3825
  ]
@@ -3830,7 +3830,7 @@ function mt(t, e) {
3830
3830
  ...["unique", "pk"].map((i) => ({
3831
3831
  label: i,
3832
3832
  insertText: i,
3833
- insertTextRules: y.KeepWhitespace,
3833
+ insertTextRules: w.KeepWhitespace,
3834
3834
  kind: L.Property,
3835
3835
  range: void 0
3836
3836
  })),
@@ -3838,7 +3838,7 @@ function mt(t, e) {
3838
3838
  label: i,
3839
3839
  insertText: `${i}: `,
3840
3840
  kind: L.Property,
3841
- insertTextRules: y.KeepWhitespace,
3841
+ insertTextRules: w.KeepWhitespace,
3842
3842
  range: void 0
3843
3843
  }))
3844
3844
  ]
@@ -3849,14 +3849,14 @@ function mt(t, e) {
3849
3849
  label: i,
3850
3850
  insertText: `${i}: `,
3851
3851
  kind: L.Property,
3852
- insertTextRules: y.KeepWhitespace,
3852
+ insertTextRules: w.KeepWhitespace,
3853
3853
  range: void 0
3854
3854
  }))
3855
3855
  };
3856
3856
  }
3857
3857
  return D();
3858
3858
  }
3859
- function ns(t, e, n) {
3859
+ function ss(t, e, n) {
3860
3860
  switch (n == null ? void 0 : n.toLowerCase()) {
3861
3861
  case "update":
3862
3862
  case "delete":
@@ -3865,7 +3865,7 @@ function ns(t, e, n) {
3865
3865
  label: s,
3866
3866
  insertText: s,
3867
3867
  kind: L.Value,
3868
- insertTextRules: y.KeepWhitespace,
3868
+ insertTextRules: w.KeepWhitespace,
3869
3869
  range: void 0
3870
3870
  }))
3871
3871
  };
@@ -3875,7 +3875,7 @@ function ns(t, e, n) {
3875
3875
  label: s,
3876
3876
  insertText: `${s}`,
3877
3877
  kind: L.Value,
3878
- insertTextRules: y.KeepWhitespace,
3878
+ insertTextRules: w.KeepWhitespace,
3879
3879
  range: void 0
3880
3880
  }))
3881
3881
  };
@@ -3884,9 +3884,9 @@ function ns(t, e, n) {
3884
3884
  }
3885
3885
  function Ct(t, e, n) {
3886
3886
  const s = pe(n).unwrap_or([]);
3887
- if (s.pop(), s.some((r) => !M(r)))
3887
+ if (s.pop(), s.some((r) => !F(r)))
3888
3888
  return D();
3889
- const i = s.map((r) => j(r).unwrap());
3889
+ const i = s.map((r) => Y(r).unwrap());
3890
3890
  return Fe({
3891
3891
  suggestions: t.symbol.ofName({ nameStack: i, owner: t.container.element(e) }).flatMap(({ symbol: r }) => t.symbol.members(r)).map(({ kind: r, name: a }) => ({
3892
3892
  label: a,
@@ -3900,19 +3900,19 @@ function Tt(t, e, n) {
3900
3900
  var i;
3901
3901
  switch (t.container.scopeKind(e)) {
3902
3902
  case O.TABLE:
3903
- return is(t, e, n);
3904
- case O.PROJECT:
3905
3903
  return rs(t, e, n);
3904
+ case O.PROJECT:
3905
+ return as(t, e, n);
3906
3906
  case O.INDEXES:
3907
- return os(t, e);
3907
+ return ls(t, e);
3908
3908
  case O.ENUM:
3909
- return ss(t, e, n);
3909
+ return is(t, e, n);
3910
3910
  case O.REF: {
3911
3911
  const r = Xt(t, e);
3912
3912
  return ((i = t.container.token(e).token) == null ? void 0 : i.kind) === u.COLON && Re(t.container.token(e).token, e) ? Pe(r) : r;
3913
3913
  }
3914
3914
  case O.TABLEGROUP:
3915
- return as(t);
3915
+ return os(t);
3916
3916
  default:
3917
3917
  return D();
3918
3918
  }
@@ -3922,47 +3922,47 @@ function bt() {
3922
3922
  suggestions: ["Table", "TableGroup", "Enum", "Project", "Ref"].map((t) => ({
3923
3923
  label: t,
3924
3924
  insertText: t,
3925
- insertTextRules: y.KeepWhitespace,
3925
+ insertTextRules: w.KeepWhitespace,
3926
3926
  kind: L.Keyword,
3927
3927
  range: void 0
3928
3928
  }))
3929
3929
  };
3930
3930
  }
3931
- function ss(t, e, n) {
3932
- return n != null && n.callee && tt(e, n) === 1 ? Be(t, e, t.container.element(e), [
3931
+ function is(t, e, n) {
3932
+ return n != null && n.callee && nt(e, n) === 1 ? Be(t, e, t.container.element(e), [
3933
3933
  T.Schema,
3934
3934
  T.Table,
3935
3935
  T.Column
3936
3936
  ]) : D();
3937
3937
  }
3938
- function is(t, e, n) {
3938
+ function rs(t, e, n) {
3939
3939
  if (!(n != null && n.callee))
3940
3940
  return {
3941
3941
  suggestions: ["Note", "indexes"].map((i) => ({
3942
3942
  label: i,
3943
3943
  insertText: i,
3944
- insertTextRules: y.KeepWhitespace,
3944
+ insertTextRules: w.KeepWhitespace,
3945
3945
  kind: L.Keyword,
3946
3946
  range: void 0
3947
3947
  }))
3948
3948
  };
3949
- const s = tt(e, n);
3949
+ const s = nt(e, n);
3950
3950
  return s === 0 ? {
3951
3951
  suggestions: ["Note", "indexes"].map((i) => ({
3952
3952
  label: i,
3953
3953
  insertText: i,
3954
- insertTextRules: y.KeepWhitespace,
3954
+ insertTextRules: w.KeepWhitespace,
3955
3955
  kind: L.Keyword,
3956
3956
  range: void 0
3957
3957
  }))
3958
- } : s === 1 ? ls(t, e) : D();
3958
+ } : s === 1 ? cs(t, e) : D();
3959
3959
  }
3960
- function rs(t, e, n) {
3961
- return n != null && n.callee ? tt(e, n) === 0 ? {
3960
+ function as(t, e, n) {
3961
+ return n != null && n.callee ? nt(e, n) === 0 ? {
3962
3962
  suggestions: ["Table", "TableGroup", "Enum", "Note", "Ref"].map((i) => ({
3963
3963
  label: i,
3964
3964
  insertText: i,
3965
- insertTextRules: y.KeepWhitespace,
3965
+ insertTextRules: w.KeepWhitespace,
3966
3966
  kind: L.Keyword,
3967
3967
  range: void 0
3968
3968
  }))
@@ -3970,7 +3970,7 @@ function rs(t, e, n) {
3970
3970
  suggestions: ["Table", "TableGroup", "Enum", "Note", "Ref"].map((i) => ({
3971
3971
  label: i,
3972
3972
  insertText: i,
3973
- insertTextRules: y.KeepWhitespace,
3973
+ insertTextRules: w.KeepWhitespace,
3974
3974
  kind: L.Keyword,
3975
3975
  range: void 0
3976
3976
  }))
@@ -3983,19 +3983,19 @@ function Xt(t, e) {
3983
3983
  T.Column
3984
3984
  ]);
3985
3985
  }
3986
- function as(t) {
3986
+ function os(t) {
3987
3987
  return {
3988
3988
  suggestions: [
3989
3989
  ...Fe({
3990
3990
  suggestions: [...t.parse.publicSymbolTable().entries()].flatMap(([e]) => {
3991
- const n = ie(e).unwrap_or(void 0);
3991
+ const n = re(e).unwrap_or(void 0);
3992
3992
  if (n === void 0)
3993
3993
  return [];
3994
3994
  const { kind: s, name: i } = n;
3995
3995
  return s !== T.Table && s !== T.Schema ? [] : {
3996
3996
  label: i,
3997
3997
  insertText: i,
3998
- insertTextRules: y.KeepWhitespace,
3998
+ insertTextRules: w.KeepWhitespace,
3999
3999
  kind: Ae(s),
4000
4000
  range: void 0
4001
4001
  };
@@ -4004,17 +4004,17 @@ function as(t) {
4004
4004
  ...["Note"].map((e) => ({
4005
4005
  label: e,
4006
4006
  insertText: e,
4007
- insertTextRules: y.KeepWhitespace,
4007
+ insertTextRules: w.KeepWhitespace,
4008
4008
  kind: L.Keyword,
4009
4009
  range: void 0
4010
4010
  }))
4011
4011
  ]
4012
4012
  };
4013
4013
  }
4014
- function os(t, e) {
4014
+ function ls(t, e) {
4015
4015
  return $t(t, e);
4016
4016
  }
4017
- function ls(t, e) {
4017
+ function cs(t, e) {
4018
4018
  return {
4019
4019
  suggestions: [
4020
4020
  ...[
@@ -4077,7 +4077,7 @@ function ls(t, e) {
4077
4077
  ].map((n) => ({
4078
4078
  label: n,
4079
4079
  insertText: n,
4080
- insertTextRules: y.KeepWhitespace,
4080
+ insertTextRules: w.KeepWhitespace,
4081
4081
  kind: L.TypeParameter,
4082
4082
  sortText: L.TypeParameter.toString().padStart(2, "0"),
4083
4083
  range: void 0
@@ -4096,21 +4096,21 @@ function $t(t, e) {
4096
4096
  const { symbolTable: i } = s.symbol;
4097
4097
  return Fe({
4098
4098
  suggestions: [...i.entries()].flatMap(([r]) => {
4099
- const a = ie(r).unwrap_or(void 0);
4099
+ const a = re(r).unwrap_or(void 0);
4100
4100
  if (a === void 0)
4101
4101
  return [];
4102
4102
  const { name: l } = a;
4103
4103
  return {
4104
4104
  label: l,
4105
4105
  insertText: l,
4106
- insertTextRules: y.KeepWhitespace,
4106
+ insertTextRules: w.KeepWhitespace,
4107
4107
  kind: Ae(T.Column),
4108
4108
  range: void 0
4109
4109
  };
4110
4110
  })
4111
4111
  });
4112
4112
  }
4113
- function tt(t, e) {
4113
+ function nt(t, e) {
4114
4114
  if (!e.callee)
4115
4115
  return -1;
4116
4116
  const n = [e.callee, ...e.args], s = n.findIndex((i) => t <= i.end);
@@ -4122,7 +4122,7 @@ class Wt {
4122
4122
  }
4123
4123
  provideDefinition(e, n) {
4124
4124
  var a;
4125
- const { uri: s } = e, i = et(e, n), r = [...this.compiler.container.stack(i)];
4125
+ const { uri: s } = e, i = tt(e, n), r = [...this.compiler.container.stack(i)];
4126
4126
  for (; r.length !== 0; ) {
4127
4127
  const l = r.pop();
4128
4128
  if ((a = l == null ? void 0 : l.referee) != null && a.declaration && [Ne.PRIMARY_EXPRESSION, Ne.VARIABLE].includes(l == null ? void 0 : l.kind)) {
@@ -4148,7 +4148,7 @@ class jt {
4148
4148
  this.compiler = e;
4149
4149
  }
4150
4150
  provideReferences(e, n) {
4151
- const { uri: s } = e, i = et(e, n), r = [...this.compiler.container.stack(i)];
4151
+ const { uri: s } = e, i = tt(e, n), r = [...this.compiler.container.stack(i)];
4152
4152
  for (; r.length !== 0; ) {
4153
4153
  const a = r.pop();
4154
4154
  if (a && [
@@ -4172,21 +4172,21 @@ class jt {
4172
4172
  return [];
4173
4173
  }
4174
4174
  }
4175
- const hs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4175
+ const fs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4176
4176
  __proto__: null,
4177
- CompletionItemInsertTextRule: y,
4177
+ CompletionItemInsertTextRule: w,
4178
4178
  CompletionItemKind: L,
4179
4179
  DBMLCompletionItemProvider: Gt,
4180
4180
  DBMLDefinitionProvider: Wt,
4181
4181
  DBMLReferencesProvider: jt
4182
4182
  }, Symbol.toStringTag, { value: "Module" }));
4183
4183
  var O = /* @__PURE__ */ ((t) => (t[t.TABLE = 0] = "TABLE", t[t.ENUM = 1] = "ENUM", t[t.TABLEGROUP = 2] = "TABLEGROUP", t[t.INDEXES = 3] = "INDEXES", t[t.NOTE = 4] = "NOTE", t[t.REF = 5] = "REF", t[t.PROJECT = 6] = "PROJECT", t[t.CUSTOM = 7] = "CUSTOM", t[t.TOPLEVEL = 8] = "TOPLEVEL", t))(O || {});
4184
- class fs {
4184
+ class ps {
4185
4185
  constructor() {
4186
4186
  this.source = "", this.cache = new Array(
4187
4187
  16
4188
4188
  /* TOTAL_QUERY_COUNT */
4189
- ).fill(null), this.nodeIdGenerator = new Ht(), this.symbolIdGenerator = new tn(), this.token = {
4189
+ ).fill(null), this.nodeIdGenerator = new Jt(), this.symbolIdGenerator = new nn(), this.token = {
4190
4190
  invalidStream: this.createQuery(
4191
4191
  6,
4192
4192
  () => this.parse.tokens().filter(wt)
@@ -4201,8 +4201,8 @@ class fs {
4201
4201
  _: this.createQuery(
4202
4202
  0,
4203
4203
  () => {
4204
- const e = new fn(this.source).lex().chain((n) => new En(n, this.nodeIdGenerator).parse()).chain(({ ast: n, tokens: s }) => new Qn(n, this.symbolIdGenerator).analyze().map(() => ({ ast: n, tokens: s })));
4205
- return e.getErrors().length > 0 ? e : e.chain(({ ast: n, tokens: s }) => new Kn(n).interpret().map((r) => ({ ast: n, tokens: s, rawDb: r })));
4204
+ const e = new pn(this.source).lex().chain((n) => new Nn(n, this.nodeIdGenerator).parse()).chain(({ ast: n, tokens: s }) => new qn(n, this.symbolIdGenerator).analyze().map(() => ({ ast: n, tokens: s })));
4205
+ return e.getErrors().length > 0 ? e : e.chain(({ ast: n, tokens: s }) => new es(n).interpret().map((r) => ({ ast: n, tokens: s, rawDb: r })));
4206
4206
  }
4207
4207
  ),
4208
4208
  ast: this.createQuery(
@@ -4226,15 +4226,15 @@ class fs {
4226
4226
  stack: this.createQuery(
4227
4227
  10,
4228
4228
  (e) => {
4229
- const n = this.token.flatStream(), { index: s, token: i } = this.container.token(e), r = s === void 0 ? -1 : zt(n, (f) => !f.isInvalid, s);
4229
+ const n = this.token.flatStream(), { index: s, token: i } = this.container.token(e), r = s === void 0 ? -1 : Qt(n, (f) => !f.isInvalid, s);
4230
4230
  if (r === -1)
4231
4231
  return [this.parse.ast()];
4232
4232
  const a = n[r].start;
4233
4233
  let l = this.parse.ast();
4234
4234
  const p = [l];
4235
4235
  for (; ; ) {
4236
- const E = hn(l).find((h) => ge(a, h));
4237
- if (E === void 0 || E instanceof F)
4236
+ const E = fn(l).find((h) => ge(a, h));
4237
+ if (E === void 0 || E instanceof B)
4238
4238
  break;
4239
4239
  p.push(E), l = E;
4240
4240
  }
@@ -4242,17 +4242,17 @@ class fs {
4242
4242
  return p;
4243
4243
  for (; p.length > 0; ) {
4244
4244
  let f = !1;
4245
- const E = rt(p);
4246
- if (E instanceof w) {
4245
+ const E = Ce(p);
4246
+ if (E instanceof v) {
4247
4247
  const h = this.parse.source();
4248
4248
  for (let m = E.end; m < e; m += 1)
4249
4249
  h[m] === `
4250
4250
  ` && (p.pop(), f = !0);
4251
4251
  } else
4252
- E instanceof Q || E instanceof q ? this.container.token(e).token !== E.op && (p.pop(), f = !0) : E instanceof R ? E.listCloseBracket && E.end <= e && (p.pop(), f = !0) : E instanceof Z ? E.tupleCloseParen && E.end <= e && (p.pop(), f = !0) : E instanceof J ? E.blockCloseBrace && E.end <= e && (p.pop(), f = !0) : E instanceof Y || E.end < e && (p.pop(), f = !0);
4252
+ E instanceof q || E instanceof H ? this.container.token(e).token !== E.op && (p.pop(), f = !0) : E instanceof P ? E.listCloseBracket && E.end <= e && (p.pop(), f = !0) : E instanceof K ? E.tupleCloseParen && E.end <= e && (p.pop(), f = !0) : E instanceof Z ? E.blockCloseBrace && E.end <= e && (p.pop(), f = !0) : E instanceof z || E.end < e && (p.pop(), f = !0);
4253
4253
  if (f) {
4254
- const h = rt(p);
4255
- h instanceof v && h.end <= e && p.pop();
4254
+ const h = Ce(p);
4255
+ h instanceof A && h.end <= e && p.pop();
4256
4256
  }
4257
4257
  if (!f)
4258
4258
  break;
@@ -4275,7 +4275,7 @@ class fs {
4275
4275
  (e) => {
4276
4276
  const n = this.container.stack(e);
4277
4277
  for (let s = n.length - 1; s >= 0; s -= 1)
4278
- if (n[s] instanceof v)
4278
+ if (n[s] instanceof A)
4279
4279
  return n[s];
4280
4280
  return this.parse.ast();
4281
4281
  }
@@ -4289,7 +4289,7 @@ class fs {
4289
4289
  ),
4290
4290
  scopeKind: this.createQuery(15, (e) => {
4291
4291
  var s;
4292
- if (this.container.element(e) instanceof X)
4292
+ if (this.container.element(e) instanceof $)
4293
4293
  return 8;
4294
4294
  switch ((s = this.container.element(e).type) == null ? void 0 : s.value.toLowerCase()) {
4295
4295
  case "table":
@@ -4325,15 +4325,15 @@ class fs {
4325
4325
  if (e.length === 0)
4326
4326
  return [];
4327
4327
  const s = [];
4328
- for (let r = n; r; r = r instanceof v ? r.parent : void 0) {
4328
+ for (let r = n; r; r = r instanceof A ? r.parent : void 0) {
4329
4329
  if (!((i = r.symbol) != null && i.symbolTable))
4330
4330
  continue;
4331
4331
  const { symbolTable: a } = r.symbol;
4332
4332
  let l = [a], p = [];
4333
4333
  for (const f of e)
4334
4334
  p = l.flatMap(
4335
- (E) => Kt(f).flatMap((h) => {
4336
- const m = E.get(h), g = ie(h).unwrap_or(void 0);
4335
+ (E) => en(f).flatMap((h) => {
4336
+ const m = E.get(h), g = re(h).unwrap_or(void 0);
4337
4337
  return !m || !g ? [] : { ...g, symbol: m };
4338
4338
  })
4339
4339
  ), l = p.flatMap(
@@ -4348,7 +4348,7 @@ class fs {
4348
4348
  members: this.createQuery(
4349
4349
  9,
4350
4350
  (e) => e.symbolTable ? [...e.symbolTable.entries()].map(([n, s]) => ({
4351
- ...ie(n).unwrap(),
4351
+ ...re(n).unwrap(),
4352
4352
  symbol: s
4353
4353
  })) : []
4354
4354
  )
@@ -4382,7 +4382,7 @@ class fs {
4382
4382
  }
4383
4383
  }
4384
4384
  export {
4385
- fs as Compiler,
4386
- us as serialize,
4387
- hs as services
4385
+ ps as Compiler,
4386
+ hs as serialize,
4387
+ fs as services
4388
4388
  };