@sap/cds-compiler 5.1.2 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/bin/cdsc.js +7 -2
  3. package/bin/cdshi.js +24 -17
  4. package/bin/cdsse.js +17 -18
  5. package/doc/CHANGELOG_BETA.md +9 -4
  6. package/lib/api/main.js +19 -2
  7. package/lib/api/options.js +4 -1
  8. package/lib/api/validate.js +5 -0
  9. package/lib/base/builtins.js +1 -0
  10. package/lib/base/message-registry.js +40 -3
  11. package/lib/base/messages.js +1 -1
  12. package/lib/base/model.js +0 -11
  13. package/lib/checks/actionsFunctions.js +0 -12
  14. package/lib/checks/structuredAnnoExpressions.js +10 -14
  15. package/lib/compiler/assert-consistency.js +21 -13
  16. package/lib/compiler/builtins.js +2 -2
  17. package/lib/compiler/checks.js +25 -6
  18. package/lib/compiler/define.js +27 -31
  19. package/lib/compiler/extend.js +16 -18
  20. package/lib/compiler/generate.js +3 -3
  21. package/lib/compiler/populate.js +22 -16
  22. package/lib/compiler/propagator.js +3 -2
  23. package/lib/compiler/resolve.js +87 -94
  24. package/lib/compiler/shared.js +12 -13
  25. package/lib/compiler/tweak-assocs.js +390 -86
  26. package/lib/compiler/utils.js +41 -33
  27. package/lib/compiler/xpr-rewrite.js +45 -58
  28. package/lib/edm/annotations/genericTranslation.js +17 -13
  29. package/lib/edm/csn2edm.js +28 -4
  30. package/lib/edm/edm.js +68 -28
  31. package/lib/edm/edmInboundChecks.js +5 -8
  32. package/lib/edm/edmPreprocessor.js +66 -40
  33. package/lib/edm/edmUtils.js +1 -1
  34. package/lib/gen/BaseParser.js +778 -0
  35. package/lib/gen/CdlParser.js +4477 -0
  36. package/lib/gen/language.checksum +1 -1
  37. package/lib/gen/language.interp +1 -1
  38. package/lib/gen/languageParser.js +4072 -4024
  39. package/lib/inspect/inspectPropagation.js +1 -1
  40. package/lib/json/from-csn.js +5 -3
  41. package/lib/json/to-csn.js +7 -10
  42. package/lib/language/antlrParser.js +96 -0
  43. package/lib/language/errorStrategy.js +1 -1
  44. package/lib/language/genericAntlrParser.js +32 -4
  45. package/lib/language/multiLineStringParser.js +1 -1
  46. package/lib/main.d.ts +23 -0
  47. package/lib/model/cloneCsn.js +22 -13
  48. package/lib/model/csnUtils.js +2 -0
  49. package/lib/model/revealInternalProperties.js +2 -0
  50. package/lib/modelCompare/utils/filter.js +70 -42
  51. package/lib/optionProcessor.js +16 -10
  52. package/lib/parsers/AstBuildingParser.js +1290 -0
  53. package/lib/parsers/CdlGrammar.g4 +2013 -0
  54. package/lib/parsers/Lexer.js +249 -0
  55. package/lib/render/toCdl.js +46 -45
  56. package/lib/render/toSql.js +5 -5
  57. package/lib/transform/addTenantFields.js +4 -4
  58. package/lib/transform/db/applyTransformations.js +54 -16
  59. package/lib/transform/draft/odata.js +10 -11
  60. package/lib/transform/effective/flattening.js +10 -14
  61. package/lib/transform/forRelationalDB.js +7 -6
  62. package/lib/transform/odata/flattening.js +42 -31
  63. package/lib/transform/odata/toFinalBaseType.js +7 -6
  64. package/lib/transform/universalCsn/universalCsnEnricher.js +1 -0
  65. package/lib/utils/moduleResolve.js +1 -1
  66. package/package.json +2 -2
  67. package/share/messages/redirected-to-ambiguous.md +5 -4
  68. package/share/messages/redirected-to-complex.md +6 -3
@@ -0,0 +1,4477 @@
1
+ // Parser generated by redepage v0.1.12
2
+ 'use strict;'
3
+ const { XsnSource, XsnArtifact, XsnName } = require( '../compiler/xsn-model' );
4
+ const AstBuildingParser = require('../parsers/AstBuildingParser');
5
+ const keywords = {
6
+ abstract: true,
7
+ action: true,
8
+ actions: true,
9
+ all: false,
10
+ and: true,
11
+ annotate: true,
12
+ annotation: true,
13
+ any: false,
14
+ array: true,
15
+ as: false,
16
+ asc: true,
17
+ aspect: true,
18
+ association: true,
19
+ between: true,
20
+ by: false,
21
+ case: false,
22
+ cast: false,
23
+ columns: true,
24
+ composition: true,
25
+ context: true,
26
+ cross: true,
27
+ current: true,
28
+ default: true,
29
+ define: true,
30
+ definitions: true,
31
+ desc: true,
32
+ distinct: true,
33
+ element: true,
34
+ elements: true,
35
+ else: true,
36
+ end: true,
37
+ entity: true,
38
+ enum: true,
39
+ escape: true,
40
+ event: true,
41
+ exact: true,
42
+ except: true,
43
+ excluding: true,
44
+ exists: false,
45
+ extend: true,
46
+ false: false,
47
+ first: true,
48
+ floating: true,
49
+ following: true,
50
+ from: false,
51
+ full: true,
52
+ function: true,
53
+ group: true,
54
+ having: true,
55
+ in: false,
56
+ inner: true,
57
+ intersect: true,
58
+ into: true,
59
+ is: true,
60
+ join: true,
61
+ key: false,
62
+ last: true,
63
+ left: true,
64
+ like: true,
65
+ limit: true,
66
+ localized: true,
67
+ many: true,
68
+ masked: true,
69
+ minus: true,
70
+ mixin: true,
71
+ namespace: true,
72
+ new: true,
73
+ not: false,
74
+ null: false,
75
+ nulls: true,
76
+ of: false,
77
+ offset: true,
78
+ on: false,
79
+ one: true,
80
+ or: true,
81
+ order: true,
82
+ outer: true,
83
+ over: true,
84
+ parameters: true,
85
+ partition: true,
86
+ preceding: true,
87
+ projection: true,
88
+ redirected: true,
89
+ returns: true,
90
+ right: true,
91
+ row: true,
92
+ rows: true,
93
+ select: false,
94
+ service: true,
95
+ some: false,
96
+ stored: true,
97
+ then: true,
98
+ to: true,
99
+ true: false,
100
+ type: true,
101
+ unbounded: true,
102
+ union: true,
103
+ up: true,
104
+ using: true,
105
+ variable: true,
106
+ view: true,
107
+ virtual: true,
108
+ when: true,
109
+ where: false,
110
+ with: false,
111
+ };
112
+ const table = [
113
+ 'start',
114
+ /* 1 */ {
115
+ namespace: [2,16],
116
+ using: [2,19],
117
+ '@': [2,10], type: '@', view: '@', event: '@', action: '@', aspect: '@', define: '@', entity: '@', extend: '@', context: '@', service: '@', abstract: '@', annotate: '@', function: '@', annotation: '@',
118
+ '': 3
119
+ },
120
+ /* 2 */ {
121
+ ';': ['c',1],
122
+ EOF: 3,
123
+ Id: ['g',1], '@': 'Id',
124
+ },
125
+ /* 3 */ ['m',0,'EOF'],
126
+ 'artifactsBlock',
127
+ /* 5 */ ['m',6,'{'],
128
+ /* 6 */ { Id: [7,10], '@': 'Id', '': 8 },
129
+ /* 7 */ {
130
+ ';': ['c',6],
131
+ '}': 8,
132
+ Id: ['g',6], '@': 'Id',
133
+ },
134
+ /* 8 */ ['m',0,'}'],
135
+ 'artifactDefOrExtend',
136
+ /* 10 */ { '@': [10,777], '': 11 },
137
+ /* 11 */ {
138
+ define: ['ck',12],
139
+ type: 12, view: 12, event: 12, action: 12, aspect: 12, entity: 12, context: 12, service: 12, abstract: 12, function: 12, annotation: 12,
140
+ extend: ['ck',13],
141
+ annotate: ['ck',14],
142
+ },
143
+ /* 12 */ {
144
+ service: [0,44],
145
+ context: [0,49],
146
+ annotation: [0,54],
147
+ type: [0,59],
148
+ aspect: [0,64], abstract: 'aspect',
149
+ entity: [0,77],
150
+ view: [0,91],
151
+ event: [0,103],
152
+ action: [0,115],
153
+ function: [0,121],
154
+ },
155
+ /* 13 */ {
156
+ Id: [0,231],
157
+ service: [0,253,1],
158
+ context: [0,260,1],
159
+ type: [0,267,1],
160
+ aspect: [0,279,1], entity: 'aspect',
161
+ projection: [0,290,1],
162
+ },
163
+ /* 14 */ [0,218],
164
+ 'namespaceDeclaration',
165
+ /* 16 */ ['mk',17,'namespace'],
166
+ /* 17 */ [0,36],
167
+ 'usingDeclaration',
168
+ /* 19 */ ['mk',20,'using'],
169
+ /* 20 */ {
170
+ from: ['ck',21],
171
+ Id: [22,32],
172
+ '{': 24,
173
+ },
174
+ /* 21 */ ['m',0,'String'],
175
+ /* 22 */ { from: ['ck',23], '': 0 },
176
+ /* 23 */ ['m',0,'String'],
177
+ /* 24 */ ['m',25,'{'],
178
+ /* 25 */ { Id: 26 },
179
+ /* 26 */ { Id: [27,32], '': 28 },
180
+ /* 27 */ {
181
+ ',': ['c',26],
182
+ '}': 28,
183
+ },
184
+ /* 28 */ ['m',29,'}'],
185
+ /* 29 */ { from: ['ck',30], '': 0 },
186
+ /* 30 */ ['m',0,'String'],
187
+ 'usingProxy',
188
+ /* 32 */ [33,40],
189
+ /* 33 */ { as: ['ck',34], '': 0 },
190
+ /* 34 */ ['mi',0],
191
+ 'namePath',
192
+ /* 36 */ ['mi',37],
193
+ /* 37 */ { '.': ['c',38], '': 0 },
194
+ /* 38 */ ['miA',37],
195
+ 'simplePath',
196
+ /* 40 */ ['mi',41],
197
+ /* 41 */ { '.': ['c',42], '': 0 },
198
+ /* 42 */ ['miA',41],
199
+ 'serviceDef',
200
+ /* 44 */ ['mk',45,'service'],
201
+ /* 45 */ [46,36],
202
+ /* 46 */ { '@': [46,783], '': 47 },
203
+ /* 47 */ { '{': [0,5], '': 0 },
204
+ 'contextDef',
205
+ /* 49 */ ['mk',50,'context'],
206
+ /* 50 */ [51,36],
207
+ /* 51 */ { '@': [51,783], '': 52 },
208
+ /* 52 */ { '{': [0,5], '': 0 },
209
+ 'annotationDef',
210
+ /* 54 */ ['mk',55,'annotation'],
211
+ /* 55 */ [56,36],
212
+ /* 56 */ { '@': [56,783], '': 57 },
213
+ /* 57 */ [0,349],
214
+ 'typeDef',
215
+ /* 59 */ ['mk',60,'type'],
216
+ /* 60 */ [61,36],
217
+ /* 61 */ { '@': [61,783], '': 62 },
218
+ /* 62 */ [0,349],
219
+ 'aspectDef',
220
+ /* 64 */ {
221
+ aspect: ['ck',66],
222
+ abstract: ['ck',65],
223
+ },
224
+ /* 65 */ ['mk',66,'entity'],
225
+ /* 66 */ [67,36],
226
+ /* 67 */ { '@': [67,783], '': 68 },
227
+ /* 68 */ {
228
+ '{': [69,160],
229
+ ':': ['c',70],
230
+ '': 0
231
+ },
232
+ /* 69 */ { actions: [0,127], '': 0 },
233
+ /* 70 */ [0,72],
234
+ 'aspectColonSpec',
235
+ /* 72 */ { Id: [73,40], '': 74 },
236
+ /* 73 */ { ',': ['c',72], '': 74 },
237
+ /* 74 */ { '{': [75,160], '': 0 },
238
+ /* 75 */ { actions: [0,127], '': 0 },
239
+ 'entityDef',
240
+ /* 77 */ ['mk',78,'entity'],
241
+ /* 78 */ [79,36],
242
+ /* 79 */ { '@': [79,783], '': 80 },
243
+ /* 80 */ { '(': [81,144], '': 81 },
244
+ /* 81 */ {
245
+ ':': ['c',82],
246
+ '{': 85,
247
+ as: ['ck',86],
248
+ },
249
+ /* 82 */ { Id: 83 },
250
+ /* 83 */ { Id: [84,40], '': 85 },
251
+ /* 84 */ {
252
+ ',': ['c',83],
253
+ '{': 85,
254
+ },
255
+ /* 85 */ [89,160],
256
+ /* 86 */ {
257
+ '(': [89,461], select: '(',
258
+ projection: [87,455],
259
+ },
260
+ /* 87 */ { group: [88,610], where: 'group', having: 'group', '': 88 },
261
+ /* 88 */ { limit: [89,622], order: 'limit', '': 89 },
262
+ /* 89 */ { actions: [0,127], '': 0 },
263
+ 'viewDef',
264
+ /* 91 */ ['mk',92,'view'],
265
+ /* 92 */ [93,36],
266
+ /* 93 */ { '@': [93,783], '': 94 },
267
+ /* 94 */ {
268
+ '(': [100,144],
269
+ with: ['ck',95],
270
+ '': 100
271
+ },
272
+ /* 95 */ ['mk',96,'parameters'],
273
+ /* 96 */ [97,149],
274
+ /* 97 */ { ',': ['c',98], '': 99 },
275
+ /* 98 */ [97,149],
276
+ /* 99 */ ['g',100],
277
+ /* 100 */ ['mk',101,'as'],
278
+ /* 101 */ [0,461],
279
+ 'eventDef',
280
+ /* 103 */ ['mk',104,'event'],
281
+ /* 104 */ [105,36],
282
+ /* 105 */ { '@': [105,783], '': 106 },
283
+ /* 106 */ {
284
+ '{': [0,160],
285
+ ':': ['c',107],
286
+ },
287
+ /* 107 */ {
288
+ '{': [0,160],
289
+ Id: [108,40],
290
+ projection: [0,455,1],
291
+ },
292
+ /* 108 */ { ',': 109, '{': 109, '': 113 },
293
+ /* 109 */ { ',': ['c',110], '': 112 },
294
+ /* 110 */ { Id: [111,40], '': 112 },
295
+ /* 111 */ {
296
+ ',': ['c',110],
297
+ '{': 112,
298
+ },
299
+ /* 112 */ [0,160],
300
+ /* 113 */ { '@': [113,777], '': 0 },
301
+ 'actionMainDef',
302
+ /* 115 */ ['mk',116,'action'],
303
+ /* 116 */ [117,36],
304
+ /* 117 */ { '@': [117,783], '': 118 },
305
+ /* 118 */ [119,144],
306
+ /* 119 */ { returns: [0,156], '': 0 },
307
+ 'functionMainDef',
308
+ /* 121 */ ['mk',122,'function'],
309
+ /* 122 */ [123,36],
310
+ /* 123 */ { '@': [123,783], '': 124 },
311
+ /* 124 */ [125,144],
312
+ /* 125 */ [0,156],
313
+ 'actionsBlock',
314
+ /* 127 */ ['mk',128,'actions'],
315
+ /* 128 */ ['m',129,'{'],
316
+ /* 129 */ { Id: [130,133], '@': 'Id', '': 131 },
317
+ /* 130 */ {
318
+ ';': ['c',129],
319
+ '}': 131,
320
+ Id: ['g',129], '@': 'Id',
321
+ },
322
+ /* 131 */ ['m',0,'}'],
323
+ 'boundActionFunctionDef',
324
+ /* 133 */ { '@': [133,777], '': 134 },
325
+ /* 134 */ {
326
+ action: ['ck',135],
327
+ function: ['ck',139],
328
+ },
329
+ /* 135 */ ['mi',136],
330
+ /* 136 */ { '@': [136,783], '': 137 },
331
+ /* 137 */ [138,144],
332
+ /* 138 */ { returns: [0,156], '': 0 },
333
+ /* 139 */ ['mi',140],
334
+ /* 140 */ { '@': [140,783], '': 141 },
335
+ /* 141 */ [142,144],
336
+ /* 142 */ [0,156],
337
+ 'paramsList',
338
+ /* 144 */ ['m',145,'('],
339
+ /* 145 */ { Id: [146,149], '@': 'Id', '': 147 },
340
+ /* 146 */ {
341
+ ',': ['c',145],
342
+ ')': 147,
343
+ },
344
+ /* 147 */ ['m',0,')'],
345
+ 'paramDef',
346
+ /* 149 */ { '@': [149,777], '': 150 },
347
+ /* 150 */ ['miA',151],
348
+ /* 151 */ { '@': [151,783], '': 152 },
349
+ /* 152 */ {
350
+ '{': [153,160],
351
+ ':': ['c',154],
352
+ },
353
+ /* 153 */ { not: [0,448], null: 'not', '': 0 },
354
+ /* 154 */ [0,360],
355
+ 'returnsSpec',
356
+ /* 156 */ ['mk',157,'returns'],
357
+ /* 157 */ { '@': [157,777], '': 158 },
358
+ /* 158 */ [0,360],
359
+ 'elementsBlock',
360
+ /* 160 */ ['m',161,'{'],
361
+ /* 161 */ { Id: [162,165], '@': 'Id', '': 163 },
362
+ /* 162 */ {
363
+ ';': ['c',161],
364
+ '}': 163,
365
+ Id: ['g',161], '@': 'Id',
366
+ },
367
+ /* 163 */ ['m',0,'}'],
368
+ 'elementDef',
369
+ /* 165 */ { '@': [165,777], '': 166 },
370
+ /* 166 */ { virtual: ['ck',167,1], '': 167 },
371
+ /* 167 */ { key: ['ck',168], '': 168 },
372
+ /* 168 */ { masked: ['ck',169,1], '': 169 },
373
+ /* 169 */ { element: ['ck',170,1], '': 170 },
374
+ /* 170 */ ['mi',171],
375
+ /* 171 */ { '@': [171,783], '': 172 },
376
+ /* 172 */ {
377
+ '{': [173,160],
378
+ ':': ['c',174],
379
+ '': 175
380
+ },
381
+ /* 173 */ { not: [175,448], null: 'not', '': 175 },
382
+ /* 174 */ [175,360],
383
+ /* 175 */ { '=': ['c',176], '': 0 },
384
+ /* 176 */ [177,650],
385
+ /* 177 */ { stored: ['ck',178], '': 178 },
386
+ /* 178 */ ['g',179],
387
+ /* 179 */ { '@': [179,777], '': 0 },
388
+ 'enumSymbolsBlock',
389
+ /* 181 */ ['mk',182,'enum'],
390
+ /* 182 */ ['m',183,'{'],
391
+ /* 183 */ { Id: [184,187], '@': 'Id', '': 185 },
392
+ /* 184 */ {
393
+ ';': ['c',183],
394
+ '}': 185,
395
+ },
396
+ /* 185 */ ['m',0,'}'],
397
+ 'enumSymbolDef',
398
+ /* 187 */ { '@': [187,777], '': 188 },
399
+ /* 188 */ ['mi',189],
400
+ /* 189 */ { '@': [189,777], '': 190 },
401
+ /* 190 */ { '=': ['c',191], '': 0 },
402
+ /* 191 */ {
403
+ String: ['c',193],
404
+ Number: ['c',193],
405
+ '+': ['c',192], '-': '+',
406
+ Id: [193,774], '#': 'Id', QuotedLiteral: 'Id',
407
+ },
408
+ /* 192 */ ['m',193,'Number'],
409
+ /* 193 */ ['g',194],
410
+ /* 194 */ { '@': [194,777], '': 0 },
411
+ 'foreignKeysBlock',
412
+ /* 196 */ ['m',197,'{'],
413
+ /* 197 */ { Id: [198,201], '@': 'Id', '': 199 },
414
+ /* 198 */ {
415
+ ',': ['c',197],
416
+ '}': 199,
417
+ },
418
+ /* 199 */ ['m',0,'}'],
419
+ 'foreignKeyDef',
420
+ /* 201 */ { '@': [201,777], '': 202 },
421
+ /* 202 */ [203,40],
422
+ /* 203 */ { as: ['ck',204], '': 0 },
423
+ /* 204 */ ['mi',0],
424
+ 'mixinElementDef',
425
+ /* 206 */ ['mi',207],
426
+ /* 207 */ ['m',208,':'],
427
+ /* 208 */ {
428
+ association: ['ck',209],
429
+ composition: ['ck',211],
430
+ },
431
+ /* 209 */ { '[': [210,430], '': 210 },
432
+ /* 210 */ ['mk',213,'to'],
433
+ /* 211 */ { '[': [212,430], '': 212 },
434
+ /* 212 */ ['mk',213,'of'],
435
+ /* 213 */ { one: ['ck',214,1], many: 'one', '': 214 },
436
+ /* 214 */ [215,40],
437
+ /* 215 */ ['mk',216,'on'],
438
+ /* 216 */ [0,642],
439
+ 'annotateArtifact',
440
+ /* 218 */ [219,36],
441
+ /* 219 */ {
442
+ ':': ['c',220],
443
+ with: ['ck',225],
444
+ '': 225
445
+ },
446
+ /* 220 */ [221,36],
447
+ /* 221 */ { with: ['ck',222], '': 222 },
448
+ /* 222 */ ['g',223],
449
+ /* 223 */ { '@': [223,777], '': 224 },
450
+ /* 224 */ { '{': [0,323], '': 0 },
451
+ /* 225 */ ['g',226],
452
+ /* 226 */ { '@': [226,777], '': 227 },
453
+ /* 227 */ { '(': [228,310], '': 228 },
454
+ /* 228 */ {
455
+ returns: [0,319],
456
+ '{': [229,323],
457
+ '': 229
458
+ },
459
+ /* 229 */ { actions: [0,298], '': 0 },
460
+ 'extendArtifact',
461
+ /* 231 */ [232,36],
462
+ /* 232 */ {
463
+ ':': ['c',233],
464
+ with: ['ck',242],
465
+ '': 239
466
+ },
467
+ /* 233 */ [234,36],
468
+ /* 234 */ { with: ['ck',235], '': 235 },
469
+ /* 235 */ ['g',236],
470
+ /* 236 */ { '@': [236,777], '': 237 },
471
+ /* 237 */ {
472
+ elements: ['ck',238],
473
+ '{': 238,
474
+ enum: [0,181],
475
+ '(': [0,421],
476
+ '': 0
477
+ },
478
+ /* 238 */ [0,333],
479
+ /* 239 */ { '@': [239,777], '': 240 },
480
+ /* 240 */ { '{': [241,333], '': 0 },
481
+ /* 241 */ { actions: [0,127], '': 0 },
482
+ /* 242 */ { '@': [242,777], '': 243 },
483
+ /* 243 */ {
484
+ Id: [244,40],
485
+ elements: ['ck',248,1],
486
+ '{': 248,
487
+ actions: [0,127,1],
488
+ enum: [0,181,1],
489
+ '(': [0,421],
490
+ columns: ['ck',250,1],
491
+ definitions: ['ck',251,1],
492
+ '': 0
493
+ },
494
+ /* 244 */ { ',': ['c',245], '': 246 },
495
+ /* 245 */ [244,40],
496
+ /* 246 */ { '{': [247,333], '': 247 },
497
+ /* 247 */ { actions: [0,127], '': 0 },
498
+ /* 248 */ [249,333],
499
+ /* 249 */ { actions: [0,127], '': 0 },
500
+ /* 250 */ [0,566],
501
+ /* 251 */ [0,5],
502
+ 'extendService',
503
+ /* 253 */ ['mk',254,'service'],
504
+ /* 254 */ [255,36],
505
+ /* 255 */ { with: ['ck',256], '': 256 },
506
+ /* 256 */ ['g',257],
507
+ /* 257 */ { '@': [257,777], '': 258 },
508
+ /* 258 */ { '{': [0,5], '': 0 },
509
+ 'extendContext',
510
+ /* 260 */ ['mk',261,'context'],
511
+ /* 261 */ [262,36],
512
+ /* 262 */ { with: ['ck',263], '': 263 },
513
+ /* 263 */ ['g',264],
514
+ /* 264 */ { '@': [264,777], '': 265 },
515
+ /* 265 */ { '{': [0,5], '': 0 },
516
+ 'extendType',
517
+ /* 267 */ ['mk',268,'type'],
518
+ /* 268 */ [269,36],
519
+ /* 269 */ { with: ['ck',272], '': 270 },
520
+ /* 270 */ { '@': [270,777], '': 271 },
521
+ /* 271 */ { '{': [0,333], '': 0 },
522
+ /* 272 */ { '@': [272,777], '': 273 },
523
+ /* 273 */ {
524
+ Id: [274,40],
525
+ elements: ['ck',277,1],
526
+ '{': 277,
527
+ enum: [0,181,1],
528
+ '(': [0,421],
529
+ '': 0
530
+ },
531
+ /* 274 */ { ',': ['c',275], '': 276 },
532
+ /* 275 */ [274,40],
533
+ /* 276 */ { '{': [0,333], '': 0 },
534
+ /* 277 */ [0,333],
535
+ 'extendEntityOrAspect',
536
+ /* 279 */ { aspect: ['ck',280], entity: 'aspect' },
537
+ /* 280 */ [281,36],
538
+ /* 281 */ { with: ['ck',283], '': 282 },
539
+ /* 282 */ { '@': [282,777], '': 287 },
540
+ /* 283 */ { '@': [283,777], '': 284 },
541
+ /* 284 */ {
542
+ Id: [285,40],
543
+ actions: ['g',287,1],
544
+ '': 287
545
+ },
546
+ /* 285 */ { ',': ['c',286], '': 287 },
547
+ /* 286 */ [285,40],
548
+ /* 287 */ { '{': [288,333], '': 288 },
549
+ /* 288 */ { actions: [0,127], '': 0 },
550
+ 'extendProjection',
551
+ /* 290 */ ['mk',291,'projection'],
552
+ /* 291 */ [292,36],
553
+ /* 292 */ { with: ['ck',293], '': 293 },
554
+ /* 293 */ ['g',294],
555
+ /* 294 */ { '@': [294,777], '': 295 },
556
+ /* 295 */ { '{': [296,566], '': 296 },
557
+ /* 296 */ { actions: [0,127], '': 0 },
558
+ 'annotateActionsBlock',
559
+ /* 298 */ ['mk',299,'actions'],
560
+ /* 299 */ ['m',300,'{'],
561
+ /* 300 */ { Id: [301,304], '@': 'Id', '': 302 },
562
+ /* 301 */ {
563
+ ';': ['c',300],
564
+ '}': 302,
565
+ Id: ['g',300], '@': 'Id',
566
+ },
567
+ /* 302 */ ['m',0,'}'],
568
+ 'annotateBoundAction',
569
+ /* 304 */ { '@': [304,777], '': 305 },
570
+ /* 305 */ ['mi',306],
571
+ /* 306 */ { '@': [306,777], '': 307 },
572
+ /* 307 */ { '(': [308,310], '': 308 },
573
+ /* 308 */ { returns: [0,319,1], '': 0 },
574
+ 'annotateParamsBlock',
575
+ /* 310 */ ['m',311,'('],
576
+ /* 311 */ { Id: [312,315], '@': 'Id', '': 313 },
577
+ /* 312 */ {
578
+ ',': ['c',311],
579
+ ')': 313,
580
+ },
581
+ /* 313 */ ['m',0,')'],
582
+ 'annotateParam',
583
+ /* 315 */ { '@': [315,777], '': 316 },
584
+ /* 316 */ ['mi',317],
585
+ /* 317 */ { '@': [317,777], '': 0 },
586
+ 'annotateReturns',
587
+ /* 319 */ ['mk',320,'returns'],
588
+ /* 320 */ { '@': [320,777], '': 321 },
589
+ /* 321 */ { '{': [0,323], '': 0 },
590
+ 'annotateElementsBlock',
591
+ /* 323 */ ['m',324,'{'],
592
+ /* 324 */ { Id: [325,328], '@': 'Id', '': 326 },
593
+ /* 325 */ {
594
+ ';': ['c',324],
595
+ '}': 326,
596
+ Id: ['g',324], '@': 'Id',
597
+ },
598
+ /* 326 */ ['m',0,'}'],
599
+ 'annotateElement',
600
+ /* 328 */ { '@': [328,777], '': 329 },
601
+ /* 329 */ ['mi',330],
602
+ /* 330 */ { '@': [330,777], '': 331 },
603
+ /* 331 */ { '{': [0,323], '': 0 },
604
+ 'extendElementsBlock',
605
+ /* 333 */ ['m',334,'{'],
606
+ /* 334 */ { Id: [335,338], '@': 'Id', '': 336 },
607
+ /* 335 */ {
608
+ ';': ['c',334],
609
+ '}': 336,
610
+ Id: ['g',334], '@': 'Id',
611
+ },
612
+ /* 336 */ ['m',0,'}'],
613
+ 'elementDefOrExtend',
614
+ /* 338 */ { '@': [338,777], '': 339 },
615
+ /* 339 */ {
616
+ Id: [0,165], '@': 'Id', key: 'Id',
617
+ extend: ['ck',340,1],
618
+ },
619
+ /* 340 */ { element: ['ck',341,1], '': 341 },
620
+ /* 341 */ ['mi',342],
621
+ /* 342 */ { with: ['ck',345], '': 343 },
622
+ /* 343 */ { '@': [343,777], '': 344 },
623
+ /* 344 */ { '{': [0,333], '': 0 },
624
+ /* 345 */ { '@': [345,777], '': 346 },
625
+ /* 346 */ {
626
+ elements: ['ck',347],
627
+ '{': 347,
628
+ enum: [0,181],
629
+ '(': [0,421],
630
+ '': 0
631
+ },
632
+ /* 347 */ [0,333],
633
+ 'typeOrIncludesSpec',
634
+ /* 349 */ {
635
+ '{': [350,160],
636
+ ':': ['c',351],
637
+ },
638
+ /* 350 */ { not: [0,448], null: 'not', '': 0 },
639
+ /* 351 */ {
640
+ '{': [0,360,1], many: '{', type: '{', array: '{', localized: '{', association: '{', composition: '{',
641
+ Id: [352,40],
642
+ },
643
+ /* 352 */ {
644
+ '(': [353,410], ':': '(',
645
+ '@': [0,362], not: '@', enum: '@', null: '@', default: '@',
646
+ ',': 354, '{': 354,
647
+ '': 0
648
+ },
649
+ /* 353 */ { '@': [0,362], not: '@', enum: '@', null: '@', default: '@', '': 0 },
650
+ /* 354 */ { ',': ['c',355], '': 357 },
651
+ /* 355 */ { Id: [356,40], '': 357 },
652
+ /* 356 */ {
653
+ ',': ['c',355],
654
+ '{': 357,
655
+ },
656
+ /* 357 */ [358,160],
657
+ /* 358 */ { not: [0,448], null: 'not', '': 0 },
658
+ 'typeExpression',
659
+ /* 360 */ {
660
+ '{': [361,160],
661
+ Id: [362,409],
662
+ type: [362,401,1],
663
+ localized: ['ck',370,1],
664
+ association: ['ck',374,1],
665
+ composition: ['ck',383,1],
666
+ array: ['ck',393,1],
667
+ many: ['ck',394,1],
668
+ },
669
+ /* 361 */ { not: [0,448], null: 'not', '': 0 },
670
+ /* 362 */ { not: [363,448], null: 'not', '': 363 },
671
+ /* 363 */ ['g',364],
672
+ /* 364 */ {
673
+ not: [365,442], null: 'not', default: 'not',
674
+ enum: [366,181],
675
+ '@': 367,
676
+ '': 0
677
+ },
678
+ /* 365 */ { '@': [365,777], '': 0 },
679
+ /* 366 */ { not: [0,442], null: 'not', default: 'not', '': 0 },
680
+ /* 367 */ { '@': [367,777], '': 368 },
681
+ /* 368 */ { enum: [369,181], '': 0 },
682
+ /* 369 */ { not: [0,442], null: 'not', default: 'not', '': 0 },
683
+ /* 370 */ [371,409],
684
+ /* 371 */ { not: [372,442], null: 'not', default: 'not', '': 372 },
685
+ /* 372 */ ['g',373],
686
+ /* 373 */ { '@': [373,777], '': 0 },
687
+ /* 374 */ { '[': [375,430], '': 375 },
688
+ /* 375 */ ['mk',376,'to'],
689
+ /* 376 */ { one: ['ck',377,1], many: 'one', '': 377 },
690
+ /* 377 */ [378,40],
691
+ /* 378 */ {
692
+ on: ['ck',379],
693
+ '{': [380,196],
694
+ '': 380
695
+ },
696
+ /* 379 */ [381,642],
697
+ /* 380 */ { not: [381,442], null: 'not', default: 'not', '': 381 },
698
+ /* 381 */ ['g',382],
699
+ /* 382 */ { '@': [382,777], '': 0 },
700
+ /* 383 */ { '[': [384,430], '': 384 },
701
+ /* 384 */ ['mk',385,'of'],
702
+ /* 385 */ { one: ['ck',386,1], many: 'one', '': 386 },
703
+ /* 386 */ {
704
+ Id: [387,40],
705
+ '{': 392,
706
+ },
707
+ /* 387 */ {
708
+ on: ['ck',388],
709
+ '{': [389,196],
710
+ '': 389
711
+ },
712
+ /* 388 */ [390,642],
713
+ /* 389 */ { not: [390,442], null: 'not', default: 'not', '': 390 },
714
+ /* 390 */ ['g',391],
715
+ /* 391 */ { '@': [391,777], '': 0 },
716
+ /* 392 */ [0,160],
717
+ /* 393 */ ['mk',394,'of'],
718
+ /* 394 */ {
719
+ '{': [395,160],
720
+ Id: [396,409],
721
+ type: [396,401,1],
722
+ },
723
+ /* 395 */ { not: [0,448], null: 'not', '': 0 },
724
+ /* 396 */ { not: [397,448], null: 'not', '': 397 },
725
+ /* 397 */ { enum: [398,181], '': 399 },
726
+ /* 398 */ { not: [0,448], null: 'not', '': 0 },
727
+ /* 399 */ { '@': [399,777], '': 0 },
728
+ 'typeTypeOf',
729
+ /* 401 */ ['mk',402,'type'],
730
+ /* 402 */ ['mk',403,'of'],
731
+ /* 403 */ [404,40],
732
+ /* 404 */ { ':': ['c',405], '': 0 },
733
+ /* 405 */ ['miA',406],
734
+ /* 406 */ { '.': ['c',407], '': 0 },
735
+ /* 407 */ ['miA',406],
736
+ 'typeRefOptArgs',
737
+ /* 409 */ [410,40],
738
+ /* 410 */ {
739
+ ':': ['c',411],
740
+ '(': ['c',414],
741
+ '': 0
742
+ },
743
+ /* 411 */ ['miA',412],
744
+ /* 412 */ { '.': ['c',413], '': 0 },
745
+ /* 413 */ ['miA',412],
746
+ /* 414 */ {
747
+ Number: ['c',415],
748
+ Id: 417,
749
+ },
750
+ /* 415 */ { ',': ['c',416], '': 419 },
751
+ /* 416 */ {
752
+ Number: ['c',415],
753
+ floating: ['ck',415], variable: 'floating',
754
+ ')': 419,
755
+ },
756
+ /* 417 */ { Id: [418,426], '': 419 },
757
+ /* 418 */ {
758
+ ',': ['c',417],
759
+ ')': 419,
760
+ },
761
+ /* 419 */ ['m',0,')'],
762
+ 'typeNamedArgsList',
763
+ /* 421 */ ['m',422,'('],
764
+ /* 422 */ { Id: [423,426], '': 424 },
765
+ /* 423 */ {
766
+ ',': ['c',422],
767
+ ')': 424,
768
+ },
769
+ /* 424 */ ['m',0,')'],
770
+ 'typeNamedArg',
771
+ /* 426 */ ['mi',427],
772
+ /* 427 */ ['m',428,':'],
773
+ /* 428 */ {
774
+ Number: ['c',0],
775
+ floating: ['ck',0], variable: 'floating',
776
+ },
777
+ 'cardinality',
778
+ /* 430 */ ['m',431,'['],
779
+ /* 431 */ {
780
+ '*': ['c',432],
781
+ Number: ['c',434],
782
+ '': 436
783
+ },
784
+ /* 432 */ { ',': ['c',433], '': 436 },
785
+ /* 433 */ [436,438],
786
+ /* 434 */ {
787
+ ',': ['c',435],
788
+ '..': [436,439],
789
+ '': 436
790
+ },
791
+ /* 435 */ [436,438],
792
+ /* 436 */ ['m',0,']'],
793
+ 'targetCardinality',
794
+ /* 438 */ {
795
+ '*': ['c',0],
796
+ Number: ['c',439],
797
+ },
798
+ /* 439 */ { '..': ['c',440], '': 0 },
799
+ /* 440 */ {
800
+ '*': ['c',0],
801
+ Number: ['c',0],
802
+ },
803
+ 'nullabilityAndDefault',
804
+ /* 442 */ {
805
+ not: [443,448], null: 'not',
806
+ default: ['ck',445],
807
+ },
808
+ /* 443 */ { default: ['ck',444], '': 0 },
809
+ /* 444 */ [0,650],
810
+ /* 445 */ [446,650],
811
+ /* 446 */ { not: [0,448], null: 'not', '': 0 },
812
+ 'nullability',
813
+ /* 448 */ {
814
+ null: ['ck',0],
815
+ not: ['ck',449],
816
+ },
817
+ /* 449 */ ['mk',0,'null'],
818
+ 'queryEOF',
819
+ /* 451 */ [452,461],
820
+ /* 452 */ { ';': ['c',453], '': 453 },
821
+ /* 453 */ ['m',0,'EOF'],
822
+ 'projectionSpec',
823
+ /* 455 */ ['mk',456,'projection'],
824
+ /* 456 */ ['mk',457,'on'],
825
+ /* 457 */ [458,520],
826
+ /* 458 */ { '{': [459,566], '': 459 },
827
+ /* 459 */ { excluding: [0,559], '': 0 },
828
+ 'queryExpression',
829
+ /* 461 */ {
830
+ '(': ['c',462],
831
+ Id: [464,471],
832
+ },
833
+ /* 462 */ [463,461],
834
+ /* 463 */ ['m',464,')'],
835
+ /* 464 */ {
836
+ intersect: ['ck',465],
837
+ minus: ['ck',465], except: 'minus',
838
+ union: ['ck',466],
839
+ '': 468
840
+ },
841
+ /* 465 */ { distinct: ['ck',467], '': 467 },
842
+ /* 466 */ { all: ['ck',467], distinct: 'all', '': 467 },
843
+ /* 467 */ [464,461],
844
+ /* 468 */ { limit: ['g',469], order: 'limit', '': 0 },
845
+ /* 469 */ [0,622],
846
+ 'selectQuery',
847
+ /* 471 */ ['mk',472,'select'],
848
+ /* 472 */ {
849
+ from: ['ck',473],
850
+ all: ['ck',483,1], distinct: 'all',
851
+ Id: 483, '#': 483, '(': 483, '*': 483, '+': 483, '-': 483, ':': 483, '?': 483, '@': 483, '{': 483, key: 483, not: 483, case: 483, cast: 483, null: 483, true: 483, false: 483, Number: 483, String: 483, exists: 483, QuotedLiteral: 483,
852
+ },
853
+ /* 473 */ [474,490],
854
+ /* 474 */ { mixin: ['ck',475], '': 480 },
855
+ /* 475 */ ['m',476,'{'],
856
+ /* 476 */ { Id: [477,206], '': 478 },
857
+ /* 477 */ {
858
+ ';': ['c',476],
859
+ '}': 478,
860
+ },
861
+ /* 478 */ ['m',479,'}'],
862
+ /* 479 */ ['mk',480,'into'],
863
+ /* 480 */ { all: ['ck',481], distinct: 'all', '': 481 },
864
+ /* 481 */ { '{': [482,566], '': 482 },
865
+ /* 482 */ { excluding: [488,559], '': 488 },
866
+ /* 483 */ {
867
+ '*': ['c',484],
868
+ Id: [484,576], '#': 'Id', '(': 'Id', '+': 'Id', '-': 'Id', ':': 'Id', '?': 'Id', '@': 'Id', '{': 'Id', Number: 'Id', String: 'Id', QuotedLiteral: 'Id',
869
+ },
870
+ /* 484 */ { ',': ['c',485], '': 486 },
871
+ /* 485 */ {
872
+ '*': ['c',484],
873
+ Id: [484,576], '#': 'Id', '(': 'Id', '+': 'Id', '-': 'Id', ':': 'Id', '?': 'Id', '@': 'Id', '{': 'Id', Number: 'Id', String: 'Id', QuotedLiteral: 'Id',
874
+ },
875
+ /* 486 */ ['mk',487,'from'],
876
+ /* 487 */ [488,490],
877
+ /* 488 */ { group: [0,610], where: 'group', having: 'group', '': 0 },
878
+ 'querySource',
879
+ /* 490 */ [491,495],
880
+ /* 491 */ { ',': 492, '': 0 },
881
+ /* 492 */ { ',': ['c',493], '': 0 },
882
+ /* 493 */ [492,495],
883
+ 'tableExpression',
884
+ /* 495 */ {
885
+ '(': [496,507],
886
+ Id: [497,520],
887
+ },
888
+ /* 496 */ ['g',497],
889
+ /* 497 */ {
890
+ cross: ['ck',498],
891
+ inner: ['ck',501],
892
+ full: ['ck',500], left: 'full', right: 'full',
893
+ join: 502,
894
+ '': 0
895
+ },
896
+ /* 498 */ ['mk',499,'join'],
897
+ /* 499 */ {
898
+ '(': [497,507],
899
+ Id: [497,520],
900
+ },
901
+ /* 500 */ { outer: ['ck',501], '': 501 },
902
+ /* 501 */ { one: [502,514], many: 'one', exact: 'one', '': 502 },
903
+ /* 502 */ ['mk',503,'join'],
904
+ /* 503 */ [504,495],
905
+ /* 504 */ ['mk',505,'on'],
906
+ /* 505 */ [497,642],
907
+ 'tableOrQueryParens',
908
+ /* 507 */ ['m',508,'('],
909
+ /* 508 */ {
910
+ '(': [509,507],
911
+ Id: [510,495],
912
+ select: [510,461],
913
+ },
914
+ /* 509 */ {
915
+ full: [510,496], join: 'full', left: 'full', cross: 'full', inner: 'full', right: 'full',
916
+ limit: [510,464], minus: 'limit', order: 'limit', union: 'limit', except: 'limit', intersect: 'limit',
917
+ '': 510
918
+ },
919
+ /* 510 */ ['m',511,')'],
920
+ /* 511 */ {
921
+ as: ['ck',512],
922
+ Id: ['ci',0],
923
+ '': 0
924
+ },
925
+ /* 512 */ ['mi',0],
926
+ 'joinCardinality',
927
+ /* 514 */ {
928
+ exact: ['ck',515],
929
+ one: 515,
930
+ many: ['ck',516],
931
+ },
932
+ /* 515 */ ['mk',516,'one'],
933
+ /* 516 */ ['mk',517,'to'],
934
+ /* 517 */ {
935
+ exact: ['ck',518],
936
+ one: 518,
937
+ many: ['ck',0],
938
+ },
939
+ /* 518 */ ['mk',0,'one'],
940
+ 'fromRefWithOptAlias',
941
+ /* 520 */ [521,527],
942
+ /* 521 */ { ':': ['c',522], '': 523 },
943
+ /* 522 */ [523,527],
944
+ /* 523 */ {
945
+ as: ['ck',524],
946
+ Id: ['ci',0],
947
+ '': 525
948
+ },
949
+ /* 524 */ ['mi',0],
950
+ /* 525 */ ['g',0,[]],
951
+ 'fromPath',
952
+ /* 527 */ ['mi',528],
953
+ /* 528 */ { '(': [529,533], '[': '(', '': 529 },
954
+ /* 529 */ { '.': ['c',530], '': 0 },
955
+ /* 530 */ ['miA',531],
956
+ /* 531 */ { '(': [529,533], '[': '(', '': 529 },
957
+ 'fromArgumentsAndFilter',
958
+ /* 533 */ { '(': ['c',534], '': 538 },
959
+ /* 534 */ { Id: 535 },
960
+ /* 535 */ { Id: [536,540], '': 537 },
961
+ /* 536 */ {
962
+ ',': ['c',535],
963
+ ')': 537,
964
+ },
965
+ /* 537 */ ['m',538,')'],
966
+ /* 538 */ { '[': [0,544], '': 0 },
967
+ 'fromNamedArgument',
968
+ /* 540 */ ['mi',541],
969
+ /* 541 */ ['m',542,':'],
970
+ /* 542 */ [0,650],
971
+ 'cardinalityAndFilter',
972
+ /* 544 */ ['m',545,'['],
973
+ /* 545 */ { Number: ['c',546], '': 547 },
974
+ /* 546 */ ['m',547,':'],
975
+ /* 547 */ [548,550],
976
+ /* 548 */ ['m',0,']'],
977
+ 'filterClauses',
978
+ /* 550 */ {
979
+ where: ['ck',551],
980
+ Id: 551, '#': 551, '(': 551, '+': 551, '-': 551, ':': 551, '?': 551, not: 551, case: 551, cast: 551, null: 551, true: 551, false: 551, Number: 551, String: 551, exists: 551, QuotedLiteral: 551,
981
+ group: ['g',552,1], limit: 'group', order: 'group', having: 'group',
982
+ '': 552
983
+ },
984
+ /* 551 */ [552,642],
985
+ /* 552 */ { group: 553, '': 554 },
986
+ /* 553 */ [554,616],
987
+ /* 554 */ { having: ['ck',555], '': 556 },
988
+ /* 555 */ [556,642],
989
+ /* 556 */ { limit: 557, order: 557, '': 0 },
990
+ /* 557 */ [0,622],
991
+ 'excludingClause',
992
+ /* 559 */ ['mk',560,'excluding'],
993
+ /* 560 */ ['m',561,'{'],
994
+ /* 561 */ { Id: 562 },
995
+ /* 562 */ { Id: ['ciA',563], '': 564 },
996
+ /* 563 */ {
997
+ ',': ['c',562],
998
+ '}': 564,
999
+ },
1000
+ /* 564 */ ['m',0,'}'],
1001
+ 'selectItemsList',
1002
+ /* 566 */ ['m',567,'{'],
1003
+ /* 567 */ {
1004
+ '*': ['c',568],
1005
+ Id: [568,576], '#': 'Id', '(': 'Id', '+': 'Id', '-': 'Id', ':': 'Id', '?': 'Id', '@': 'Id', '{': 'Id', Number: 'Id', String: 'Id', QuotedLiteral: 'Id',
1006
+ '': 569
1007
+ },
1008
+ /* 568 */ {
1009
+ ',': ['c',567],
1010
+ '}': 569,
1011
+ },
1012
+ /* 569 */ ['m',0,'}'],
1013
+ 'nestedSelectItemsList',
1014
+ /* 571 */ ['m',572,'{'],
1015
+ /* 572 */ {
1016
+ '*': ['c',573],
1017
+ Id: [573,576], '#': 'Id', '(': 'Id', '+': 'Id', '-': 'Id', ':': 'Id', '?': 'Id', '@': 'Id', '{': 'Id', Number: 'Id', String: 'Id', QuotedLiteral: 'Id',
1018
+ '': 574
1019
+ },
1020
+ /* 573 */ {
1021
+ ',': ['c',572],
1022
+ '}': 574,
1023
+ },
1024
+ /* 574 */ ['m',0,'}'],
1025
+ 'selectItemDef',
1026
+ /* 576 */ { '@': [576,780], '': 577 },
1027
+ /* 577 */ { virtual: ['ck',578,1], '': 578 },
1028
+ /* 578 */ { key: ['ck',579], '': 579 },
1029
+ /* 579 */ {
1030
+ Id: [580,650], '#': 'Id', '(': 'Id', '+': 'Id', '-': 'Id', ':': 'Id', '?': 'Id', Number: 'Id', String: 'Id', QuotedLiteral: 'Id',
1031
+ '{': [587,571],
1032
+ },
1033
+ /* 580 */ {
1034
+ as: ['ck',581],
1035
+ Id: ['ci',582],
1036
+ '': 582
1037
+ },
1038
+ /* 581 */ ['mi',582],
1039
+ /* 582 */ {
1040
+ '{': 583,
1041
+ '.': ['c',585],
1042
+ '': 590
1043
+ },
1044
+ /* 583 */ [584,571],
1045
+ /* 584 */ { excluding: [590,559], '': 590 },
1046
+ /* 585 */ {
1047
+ '{': [586,571],
1048
+ '*': ['c',590],
1049
+ },
1050
+ /* 586 */ { excluding: [590,559], '': 590 },
1051
+ /* 587 */ { excluding: [588,559], '': 588 },
1052
+ /* 588 */ ['mk',589,'as'],
1053
+ /* 589 */ ['mi',590],
1054
+ /* 590 */ ['g',591],
1055
+ /* 591 */ { '@': [591,783], '': 592 },
1056
+ /* 592 */ { ':': ['c',593], '': 0 },
1057
+ /* 593 */ {
1058
+ type: [607,401,1],
1059
+ localized: ['ck',594,1],
1060
+ Id: 594,
1061
+ redirected: ['ck',595,1],
1062
+ association: ['ck',599,1],
1063
+ composition: ['ck',601,1],
1064
+ },
1065
+ /* 594 */ [607,409],
1066
+ /* 595 */ ['mk',596,'to'],
1067
+ /* 596 */ [597,40],
1068
+ /* 597 */ {
1069
+ on: ['ck',598],
1070
+ '{': [607,196],
1071
+ '': 607
1072
+ },
1073
+ /* 598 */ [607,642],
1074
+ /* 599 */ { '[': [600,430], '': 600 },
1075
+ /* 600 */ ['mk',603,'to'],
1076
+ /* 601 */ { '[': [602,430], '': 602 },
1077
+ /* 602 */ ['mk',603,'of'],
1078
+ /* 603 */ { one: ['ck',604,1], many: 'one', '': 604 },
1079
+ /* 604 */ [605,40],
1080
+ /* 605 */ ['mk',606,'on'],
1081
+ /* 606 */ [607,642],
1082
+ /* 607 */ ['g',608],
1083
+ /* 608 */ { '@': [608,777], '': 0 },
1084
+ 'whereGroupByHaving',
1085
+ /* 610 */ { where: ['ck',611], '': 612 },
1086
+ /* 611 */ [612,642],
1087
+ /* 612 */ { group: [613,616], '': 613 },
1088
+ /* 613 */ { having: ['ck',614], '': 0 },
1089
+ /* 614 */ [0,642],
1090
+ 'groupByClause',
1091
+ /* 616 */ ['mk',617,'group'],
1092
+ /* 617 */ ['mk',618,'by'],
1093
+ /* 618 */ [619,650],
1094
+ /* 619 */ { ',': ['c',620], '': 0 },
1095
+ /* 620 */ [619,650],
1096
+ 'orderByLimitOffset',
1097
+ /* 622 */ { order: [623,628], '': 623 },
1098
+ /* 623 */ { limit: ['ck',624], '': 0 },
1099
+ /* 624 */ [625,650],
1100
+ /* 625 */ { offset: ['ck',626], '': 0 },
1101
+ /* 626 */ [0,650],
1102
+ 'orderByClause',
1103
+ /* 628 */ ['mk',629,'order'],
1104
+ /* 629 */ ['mk',630,'by'],
1105
+ /* 630 */ [631,634],
1106
+ /* 631 */ { ',': ['c',632], '': 0 },
1107
+ /* 632 */ [631,634],
1108
+ 'orderByExpression',
1109
+ /* 634 */ [635,650],
1110
+ /* 635 */ { asc: ['ck',636], desc: 'asc', '': 636 },
1111
+ /* 636 */ { nulls: ['ck',637], '': 0 },
1112
+ /* 637 */ { last: ['ck',0], first: 'last' },
1113
+ 'conditionEOF',
1114
+ /* 639 */ [640,650],
1115
+ /* 640 */ ['m',0,'EOF'],
1116
+ 'condition',
1117
+ /* 642 */ [0,650],
1118
+ 'valuePath',
1119
+ /* 644 */ ['mi',645],
1120
+ /* 645 */ { '(': [646,711], '[': '(', '': 646 },
1121
+ /* 646 */ { '.': ['c',647], '': 0 },
1122
+ /* 647 */ ['miA',648],
1123
+ /* 648 */ { '(': [646,711], '[': '(', '': 646 },
1124
+ 'expression',
1125
+ /* 650 */ {
1126
+ '(': [651,678],
1127
+ '#': [661,774], null: '#', true: '#', false: '#', Number: '#', String: '#', QuotedLiteral: '#',
1128
+ ':': ['c',652],
1129
+ '?': ['c',661],
1130
+ Id: [654,644],
1131
+ new: [661,690,1],
1132
+ exists: ['ck',657],
1133
+ case: [661,693],
1134
+ cast: [661,704],
1135
+ '+': ['c',660], '-': '+',
1136
+ not: ['ck',660],
1137
+ },
1138
+ /* 651 */ ['g',661],
1139
+ /* 652 */ {
1140
+ Id: ['ciA',653],
1141
+ Number: ['c',661],
1142
+ },
1143
+ /* 653 */ { '.': [661,646], '': 661 },
1144
+ /* 654 */ { over: ['ck',655,1], '': 656 },
1145
+ /* 655 */ [656,738],
1146
+ /* 656 */ ['g',661],
1147
+ /* 657 */ {
1148
+ '(': ['c',658],
1149
+ Id: [661,644],
1150
+ '?': ['c',661],
1151
+ },
1152
+ /* 658 */ [659,461],
1153
+ /* 659 */ ['m',661,')'],
1154
+ /* 660 */ [661,650],
1155
+ /* 661 */ {
1156
+ '*': ['c',665], '/': '*',
1157
+ '+': ['c',665], '-': '+',
1158
+ '||': ['c',665],
1159
+ and: ['ck',665,1],
1160
+ or: ['ck',665,1],
1161
+ '?': ['c',662],
1162
+ '<': ['c',664], '=': '<', '>': '<', '!=': '<', '<=': '<', '<>': '<', '>=': '<',
1163
+ is: ['ck',666,1],
1164
+ not: ['ck',668],
1165
+ in: ['g',668,1], like: 'in', between: 'in',
1166
+ '': 0
1167
+ },
1168
+ /* 662 */ [663,650],
1169
+ /* 663 */ ['m',665,':'],
1170
+ /* 664 */ { all: ['ck',665], any: 'all', some: 'all', '': 665 },
1171
+ /* 665 */ [676,650],
1172
+ /* 666 */ { not: ['ck',667], '': 667 },
1173
+ /* 667 */ ['mk',676,'null'],
1174
+ /* 668 */ {
1175
+ between: ['ck',669],
1176
+ in: ['ck',672],
1177
+ like: ['ck',673],
1178
+ },
1179
+ /* 669 */ [670,650],
1180
+ /* 670 */ ['mk',671,'and'],
1181
+ /* 671 */ [676,650],
1182
+ /* 672 */ [676,650],
1183
+ /* 673 */ [674,650],
1184
+ /* 674 */ { escape: ['ck',675,1], '': 676 },
1185
+ /* 675 */ [676,650],
1186
+ /* 676 */ ['g',661],
1187
+ 'expressionOrQueryParens',
1188
+ /* 678 */ ['m',679,'('],
1189
+ /* 679 */ {
1190
+ '(': [680,678],
1191
+ Id: [682,650], '#': 'Id', '+': 'Id', '-': 'Id', ':': 'Id', '?': 'Id', not: 'Id', case: 'Id', cast: 'Id', null: 'Id', true: 'Id', false: 'Id', Number: 'Id', String: 'Id', exists: 'Id', QuotedLiteral: 'Id',
1192
+ select: [683,461],
1193
+ },
1194
+ /* 680 */ {
1195
+ '*': [681,651], '+': '*', '-': '*', '/': '*', '<': '*', '=': '*', '>': '*', '?': '*', '!=': '*', '<=': '*', '<>': '*', '>=': '*', in: '*', is: '*', or: '*', '||': '*', and: '*', not: '*', like: '*', between: '*',
1196
+ ',': [683,685],
1197
+ limit: [683,464], minus: 'limit', order: 'limit', union: 'limit', except: 'limit', intersect: 'limit',
1198
+ '': 683
1199
+ },
1200
+ /* 681 */ { ',': [683,685], '': 683 },
1201
+ /* 682 */ { ',': [683,685], '': 683 },
1202
+ /* 683 */ ['m',0,')'],
1203
+ 'continueExpressionslist',
1204
+ /* 685 */ ['m',686,','],
1205
+ /* 686 */ { Id: 687, '#': 687, '(': 687, '+': 687, '-': 687, ':': 687, '?': 687, not: 687, case: 687, cast: 687, null: 687, true: 687, false: 687, Number: 687, String: 687, exists: 687, QuotedLiteral: 687 },
1206
+ /* 687 */ { Id: [688,650], '#': 'Id', '(': 'Id', '+': 'Id', '-': 'Id', ':': 'Id', '?': 'Id', not: 'Id', case: 'Id', cast: 'Id', null: 'Id', true: 'Id', false: 'Id', Number: 'Id', String: 'Id', exists: 'Id', QuotedLiteral: 'Id', '': 0 },
1207
+ /* 688 */ { ',': ['c',687], '': 0 },
1208
+ 'newAndValuePath',
1209
+ /* 690 */ ['mk',691,'new'],
1210
+ /* 691 */ [0,644],
1211
+ 'caseExpression',
1212
+ /* 693 */ ['mk',694,'case'],
1213
+ /* 694 */ {
1214
+ Id: [695,650], '#': 'Id', '(': 'Id', '+': 'Id', '-': 'Id', ':': 'Id', '?': 'Id', not: 'Id', case: 'Id', cast: 'Id', null: 'Id', true: 'Id', false: 'Id', Number: 'Id', String: 'Id', exists: 'Id', QuotedLiteral: 'Id',
1215
+ when: ['g',695,1],
1216
+ '': 695
1217
+ },
1218
+ /* 695 */ { when: 696 },
1219
+ /* 696 */ { when: ['ck',697], '': 700 },
1220
+ /* 697 */ [698,650],
1221
+ /* 698 */ ['mk',699,'then'],
1222
+ /* 699 */ [696,650],
1223
+ /* 700 */ { else: ['ck',701], '': 702 },
1224
+ /* 701 */ [702,650],
1225
+ /* 702 */ ['mk',0,'end'],
1226
+ 'castFunction',
1227
+ /* 704 */ ['mk',705,'cast'],
1228
+ /* 705 */ ['m',706,'('],
1229
+ /* 706 */ [707,650],
1230
+ /* 707 */ ['mk',708,'as'],
1231
+ /* 708 */ [709,409],
1232
+ /* 709 */ ['m',0,')'],
1233
+ 'argumentsAndFilter',
1234
+ /* 711 */ { '(': ['c',712], '': 731 },
1235
+ /* 712 */ { Id: ['ciA',719], '': 713 },
1236
+ /* 713 */ { Id: [714,733], '#': 'Id', '(': 'Id', '*': 'Id', '+': 'Id', '-': 'Id', ':': 'Id', '?': 'Id', Id_all: 'Id', Number: 'Id', String: 'Id', QuotedLiteral: 'Id', '': 730 },
1237
+ /* 714 */ { ',': ['c',715], '': 716 },
1238
+ /* 715 */ {
1239
+ Id: [714,733], '#': 'Id', '(': 'Id', '*': 'Id', '+': 'Id', '-': 'Id', ':': 'Id', '?': 'Id', not: 'Id', case: 'Id', cast: 'Id', null: 'Id', true: 'Id', false: 'Id', Id_all: 'Id', Number: 'Id', String: 'Id', exists: 'Id', QuotedLiteral: 'Id',
1240
+ ')': ['g',716,1], order: ')',
1241
+ },
1242
+ /* 716 */ { order: ['ck',717], '': 730 },
1243
+ /* 717 */ ['mk',718,'by'],
1244
+ /* 718 */ [730,753],
1245
+ /* 719 */ {
1246
+ ':': ['c',720],
1247
+ '=>': ['c',725],
1248
+ },
1249
+ /* 720 */ [721,650],
1250
+ /* 721 */ { ',': ['c',722], '': 730 },
1251
+ /* 722 */ {
1252
+ Id: ['ciA',723],
1253
+ ')': 730,
1254
+ },
1255
+ /* 723 */ ['m',724,':'],
1256
+ /* 724 */ [721,650],
1257
+ /* 725 */ [726,650],
1258
+ /* 726 */ { ',': ['c',727], '': 730 },
1259
+ /* 727 */ {
1260
+ Id: ['ciA',728],
1261
+ ')': 730,
1262
+ },
1263
+ /* 728 */ ['m',729,'=>'],
1264
+ /* 729 */ [726,650],
1265
+ /* 730 */ ['m',731,')'],
1266
+ /* 731 */ { '[': [0,544], '': 0 },
1267
+ 'funcExpression',
1268
+ /* 733 */ {
1269
+ ' lookahead': 'lGenericIntroOrExpr',
1270
+ Id: [735,650], '#': 'Id', '(': 'Id', '+': 'Id', '-': 'Id', ':': 'Id', '?': 'Id', Number: 'Id', String: 'Id', QuotedLiteral: 'Id',
1271
+ GenericExpr: ['ckA',735],
1272
+ GenericIntro: ['ckA',734],
1273
+ },
1274
+ /* 734 */ [735,650],
1275
+ /* 735 */ {
1276
+ ' lookahead': 'lGenericSeparator',
1277
+ GenericSeparator: ['ckA',736],
1278
+ '': 0
1279
+ },
1280
+ /* 736 */ {
1281
+ ' lookahead': 'lGenericExpr',
1282
+ Id: [735,650], '#': 'Id', '(': 'Id', '+': 'Id', '-': 'Id', ':': 'Id', '?': 'Id', Number: 'Id', String: 'Id', QuotedLiteral: 'Id',
1283
+ GenericExpr: ['ckA',735],
1284
+ },
1285
+ 'overClause',
1286
+ /* 738 */ ['m',739,'('],
1287
+ /* 739 */ { partition: ['ck',740], '': 742 },
1288
+ /* 740 */ ['mk',741,'by'],
1289
+ /* 741 */ [742,749],
1290
+ /* 742 */ { order: ['ck',743], '': 745 },
1291
+ /* 743 */ ['mk',744,'by'],
1292
+ /* 744 */ [745,753],
1293
+ /* 745 */ { rows: ['ck',746], '': 747 },
1294
+ /* 746 */ [747,762],
1295
+ /* 747 */ ['m',0,')'],
1296
+ 'expressionsAsXpr',
1297
+ /* 749 */ [750,650],
1298
+ /* 750 */ { ',': ['c',751], '': 0 },
1299
+ /* 751 */ [750,650],
1300
+ 'orderByClauseAsXpr',
1301
+ /* 753 */ [754,757],
1302
+ /* 754 */ { ',': ['c',755], '': 0 },
1303
+ /* 755 */ [754,757],
1304
+ 'orderBySpecAsXpr',
1305
+ /* 757 */ [758,650],
1306
+ /* 758 */ { asc: ['ck',759], desc: 'asc', '': 759 },
1307
+ /* 759 */ { nulls: ['ck',760], '': 0 },
1308
+ /* 760 */ { last: ['ck',0], first: 'last' },
1309
+ 'windowFrameClause',
1310
+ /* 762 */ {
1311
+ unbounded: ['ck',763],
1312
+ Number: ['c',763],
1313
+ current: ['ck',764],
1314
+ between: ['ck',765],
1315
+ },
1316
+ /* 763 */ ['mk',0,'preceding'],
1317
+ /* 764 */ ['mk',0,'row'],
1318
+ /* 765 */ [766,769],
1319
+ /* 766 */ ['mk',767,'and'],
1320
+ /* 767 */ [0,769],
1321
+ 'windowFrameBoundSpec',
1322
+ /* 769 */ {
1323
+ unbounded: ['ck',770],
1324
+ Number: ['c',770],
1325
+ current: ['ck',772],
1326
+ },
1327
+ /* 770 */ {
1328
+ following: ['ck',771],
1329
+ preceding: ['ck',771],
1330
+ },
1331
+ /* 771 */ ['g',0,[]],
1332
+ /* 772 */ ['mk',0,'row'],
1333
+ 'literalValue',
1334
+ /* 774 */ {
1335
+ '#': ['c',775],
1336
+ null: ['ck',0],
1337
+ true: ['ck',0], false: 'true',
1338
+ Number: ['c',0],
1339
+ String: ['c',0],
1340
+ QuotedLiteral: ['c',0],
1341
+ },
1342
+ /* 775 */ ['mi',0],
1343
+ 'annoAssignStd',
1344
+ /* 777 */ ['m',778,'@'],
1345
+ /* 778 */ {
1346
+ '(': [0,786],
1347
+ Id: [0,791],
1348
+ },
1349
+ 'annoAssignCol',
1350
+ /* 780 */ ['m',781,'@'],
1351
+ /* 781 */ {
1352
+ '(': [0,786],
1353
+ Id: [0,791],
1354
+ },
1355
+ 'annoAssignMid',
1356
+ /* 783 */ ['m',784,'@'],
1357
+ /* 784 */ {
1358
+ '(': [0,786],
1359
+ Id: [0,795],
1360
+ },
1361
+ 'annoAssignParen',
1362
+ /* 786 */ ['m',787,'('],
1363
+ /* 787 */ { Id: [788,791], '': 789 },
1364
+ /* 788 */ {
1365
+ ',': ['c',787],
1366
+ ')': 789,
1367
+ },
1368
+ /* 789 */ ['m',0,')'],
1369
+ 'annoAssignBase',
1370
+ /* 791 */ [792,795],
1371
+ /* 792 */ { ':': ['c',793], '': 0 },
1372
+ /* 793 */ [0,817],
1373
+ 'annoNamePath',
1374
+ /* 795 */ ['miA',796],
1375
+ /* 796 */ { '.': ['c',797], '': 799 },
1376
+ /* 797 */ {
1377
+ Id: ['ciA',796],
1378
+ '@': ['c',798],
1379
+ },
1380
+ /* 798 */ ['miA',796],
1381
+ /* 799 */ { '#': [0,808], '': 0 },
1382
+ 'annoPath',
1383
+ /* 801 */ {
1384
+ Id: ['ciA',803],
1385
+ '@': ['c',802],
1386
+ },
1387
+ /* 802 */ ['miA',803],
1388
+ /* 803 */ { '.': ['c',804], '': 806 },
1389
+ /* 804 */ {
1390
+ Id: ['ciA',803],
1391
+ '@': ['c',805],
1392
+ },
1393
+ /* 805 */ ['miA',803],
1394
+ /* 806 */ { '#': [0,808], '': 0 },
1395
+ 'annoPathVariant',
1396
+ /* 808 */ ['m',809,'#'],
1397
+ /* 809 */ ['miA',810],
1398
+ /* 810 */ { '.': ['c',811], '': 0 },
1399
+ /* 811 */ ['miA',810],
1400
+ 'annoStructValue',
1401
+ /* 813 */ [814,801],
1402
+ /* 814 */ { ':': ['c',815], '': 0 },
1403
+ /* 815 */ [0,817],
1404
+ 'annoValue',
1405
+ /* 817 */ {
1406
+ '#': [0,774], null: '#', true: '#', false: '#', Number: '#', String: '#', QuotedLiteral: '#',
1407
+ '+': ['c',818], '-': '+',
1408
+ Id: [0,801], '@': 'Id',
1409
+ '{': ['c',819],
1410
+ '[': ['c',822],
1411
+ '(': ['c',829],
1412
+ },
1413
+ /* 818 */ ['m',0,'Number'],
1414
+ /* 819 */ { Id: [820,813], '@': 'Id', '': 821 },
1415
+ /* 820 */ {
1416
+ ',': ['c',819],
1417
+ '}': 821,
1418
+ },
1419
+ /* 821 */ ['m',0,'}'],
1420
+ /* 822 */ {
1421
+ Id: [827,817], '#': 'Id', '(': 'Id', '+': 'Id', '-': 'Id', '@': 'Id', '[': 'Id', '{': 'Id', Number: 'Id', String: 'Id', QuotedLiteral: 'Id',
1422
+ '...': ['c',823],
1423
+ '': 828
1424
+ },
1425
+ /* 823 */ { up: ['ck',824], '': 826 },
1426
+ /* 824 */ ['mk',825,'to'],
1427
+ /* 825 */ [826,817],
1428
+ /* 826 */ ['g',827],
1429
+ /* 827 */ {
1430
+ ',': ['c',822],
1431
+ ']': 828,
1432
+ },
1433
+ /* 828 */ ['m',0,']'],
1434
+ /* 829 */ [830,642],
1435
+ /* 830 */ ['m',0,')'],
1436
+ ];
1437
+ class CdlParser extends AstBuildingParser {
1438
+ constructor(lexer,...args) { super(lexer,keywords,table,...args) }
1439
+ start($,$next) {
1440
+ $.source??=new XsnSource( 'cdl' );
1441
+ this.rule_(1,$next);
1442
+ for(;;) switch(this.s) {
1443
+ case 1: switch(this.lk()) {
1444
+ case 'namespace': this.gc(3,'namespaceRestriction') && this.namespaceDeclaration({source:$.source},2); continue;
1445
+ case 'using': this.usingDeclaration({source:$.source},2); continue;
1446
+ case '@': case 'type': case 'view': case 'event': case 'action': case 'aspect': case 'define': case 'entity': case 'extend': case 'context': case 'service': case 'abstract': case 'annotate': case 'function': case 'annotation': if(this.artifactDefOrExtend({outer:$.source},2)) {this.namespaceRestriction();} continue;
1447
+ default: this.s=3; continue;
1448
+ }
1449
+ case 2: switch(this.l()) {
1450
+ case ';': this.c(1); continue;
1451
+ case 'EOF': this.s=3; continue;
1452
+ case 'Id': case '@': this.ec('afterBrace') && this.g(1); continue;
1453
+ default: this.e(); continue;
1454
+ }
1455
+ case 3: if(this.m(0,'EOF')) { this.docComment( null ); } continue;
1456
+ default: return this.exit_();
1457
+ }
1458
+ }
1459
+ artifactsBlock($,$next) {
1460
+ this.rule_(5,$next);
1461
+ for(;;) switch(this.s) {
1462
+ case 5: if(this.m(6,'{')) {this.vocabularyRestriction(); $.art.artifacts = this.createDict( $.start ); $.art.extensions = []; } continue;
1463
+ case 6: switch(this.l()) {
1464
+ case 'Id': case '@': this.artifactDefOrExtend({outer:$.art},7); continue;
1465
+ default: this.s=8; continue;
1466
+ }
1467
+ case 7: switch(this.l()) {
1468
+ case ';': this.c(6); continue;
1469
+ case '}': this.s=8; continue;
1470
+ case 'Id': case '@': this.ec('afterBrace') && this.g(6); continue;
1471
+ default: this.e(); continue;
1472
+ }
1473
+ case 8: if(this.m(0,'}')) {this.afterBrace(); this.finalizeDictOrArray( $.art.artifacts ); } continue;
1474
+ default: return this.exit_();
1475
+ }
1476
+ }
1477
+ artifactDefOrExtend($,$next) {
1478
+ this.rule_(10,$next);
1479
+ let art=new XsnArtifact();
1480
+ { art.location = this.startLocation();
1481
+ this.docComment( art ); }
1482
+ for(;;) switch(this.s) {
1483
+ case 10: switch(this.l()) {
1484
+ case '@': this.annoAssignStd({art},10); continue;
1485
+ default: this.s=11; continue;
1486
+ }
1487
+ case 11: switch(this.lk()) {
1488
+ case 'define': this.ck(12); continue;
1489
+ case 'type': case 'view': case 'event': case 'action': case 'aspect': case 'entity': case 'context': case 'service': case 'abstract': case 'function': case 'annotation': this.s=12; continue;
1490
+ case 'extend': if(this.ec('extensionRestriction') && this.ck(13)) { art.kind = 'extend'; } continue;
1491
+ case 'annotate': this.ec('extensionRestriction') && this.ck(14); continue;
1492
+ default: this.e(); continue;
1493
+ }
1494
+ case 12: switch(this.lk()) {
1495
+ case 'service': this.serviceDef({art,outer:$.outer},0); continue;
1496
+ case 'context': this.contextDef({art,outer:$.outer},0); continue;
1497
+ case 'annotation': this.ec('vocabularyRestriction') && this.annotationDef({art,outer:$.outer},0); continue;
1498
+ case 'type': this.typeDef({art,outer:$.outer},0); continue;
1499
+ case 'aspect': case 'abstract': this.aspectDef({art,outer:$.outer},0); continue;
1500
+ case 'entity': this.entityDef({art,outer:$.outer},0); continue;
1501
+ case 'view': this.viewDef({art,outer:$.outer},0); continue;
1502
+ case 'event': this.eventDef({art,outer:$.outer},0); continue;
1503
+ case 'action': this.actionMainDef({art,outer:$.outer},0); continue;
1504
+ case 'function': this.functionMainDef({art,outer:$.outer},0); continue;
1505
+ default: this.e(); continue;
1506
+ }
1507
+ case 13: switch(this.lk()) {
1508
+ case 'Id': this.extendArtifact({art,outer:$.outer},0); continue;
1509
+ case 'service': this.lP() && this.extendService({art,outer:$.outer},0); continue;
1510
+ case 'context': this.lP() && this.extendContext({art,outer:$.outer},0); continue;
1511
+ case 'type': this.lP() && this.extendType({art,outer:$.outer},0); continue;
1512
+ case 'aspect': case 'entity': this.lP() && this.extendEntityOrAspect({art,outer:$.outer},0); continue;
1513
+ case 'projection': this.lP() && this.extendProjection({art,outer:$.outer},0); continue;
1514
+ default: this.ei(); continue;
1515
+ }
1516
+ case 14: this.annotateArtifact({art,outer:$.outer},0); continue;
1517
+ default: return this.exit_();
1518
+ }
1519
+ }
1520
+ namespaceDeclaration($,$next) {
1521
+ this.rule_(16,$next);
1522
+ let name; let _;
1523
+ for(;;) switch(this.s) {
1524
+ case 16: this.mk(17,'namespace'); continue;
1525
+ case 17: if(this.namePath(_={category:'Namespace'},0)) {name=_.name; $.source.namespace ??= { kind: 'namespace', name: name }; } continue;
1526
+ default:
1527
+ this.attachLocation( $.source.namespace );
1528
+ return this.exit_();
1529
+ }
1530
+ }
1531
+ usingDeclaration($,$next) {
1532
+ this.rule_(19,$next);
1533
+ let decl={ kind: 'using' };
1534
+ for(;;) switch(this.s) {
1535
+ case 19: this.mk(20,'using'); continue;
1536
+ case 20: switch(this.lk()) {
1537
+ case 'from': this.ck(21); continue;
1538
+ case 'Id': this.usingProxy({outer:$.source,proxy:decl},22); continue;
1539
+ case '{': this.s=24;{ $.source.usings.push( decl ); } continue;
1540
+ default: this.ei(); continue;
1541
+ }
1542
+ case 21: if(this.m(0,'String')) { $.source.dependencies.push( this.quotedLiteral() ); } continue;
1543
+ case 22: switch(this.lk()) {
1544
+ case 'from': this.ck(23); continue;
1545
+ default: this.gr([';']); continue;
1546
+ }
1547
+ case 23: if(this.m(0,'String')) { $.source.dependencies.push( decl.fileDep = this.quotedLiteral() ); } continue;
1548
+ case 24: if(this.m(25,'{')) { decl.usings = this.createArray(); } continue;
1549
+ case 25: switch(this.lk()) {
1550
+ case 'Id': this.s=26; continue;
1551
+ default: this.ei(); continue;
1552
+ }
1553
+ case 26: switch(this.l()) {
1554
+ case 'Id': this.usingProxy({outer:decl,proxy:{ kind: 'using' }},27); continue;
1555
+ default: this.s=28; continue;
1556
+ }
1557
+ case 27: switch(this.l()) {
1558
+ case ',': this.c(26); continue;
1559
+ case '}': this.s=28; continue;
1560
+ default: this.e(); continue;
1561
+ }
1562
+ case 28: if(this.m(29,'}')) {this.afterBrace(); this.finalizeDictOrArray( decl.usings ); } continue;
1563
+ case 29: switch(this.lk()) {
1564
+ case 'from': this.ck(30); continue;
1565
+ default: this.gr([';']); continue;
1566
+ }
1567
+ case 30: if(this.m(0,'String')) { $.source.dependencies.push( decl.fileDep = this.quotedLiteral() ); } continue;
1568
+ default:
1569
+ this.attachLocation( decl );
1570
+ return this.exit_();
1571
+ }
1572
+ }
1573
+ usingProxy($,$next) {
1574
+ this.rule_(32,$next);
1575
+ let extern; let _;
1576
+ for(;;) switch(this.s) {
1577
+ case 32: if(this.simplePath(_={category:'global'},33)) {extern=_.ref; $.proxy.extern = extern; $.outer.usings.push( $.proxy ); } continue;
1578
+ case 33: switch(this.lk()) {
1579
+ case 'as': this.ck(34); continue;
1580
+ default: if(this.gr([])) { this.classifyImplicitName( 'Using' ); } continue;
1581
+ }
1582
+ case 34: if(this.mi(0,'UsingAlias')) { $.proxy.name = this.identAst(); } continue;
1583
+ default:
1584
+ this.attachLocation( $.proxy );
1585
+ return this.exit_();
1586
+ }
1587
+ }
1588
+ namePath($,$next) {
1589
+ $.name??=new XsnName();
1590
+ this.rule_(36,$next);
1591
+ for(;;) switch(this.s) {
1592
+ case 36: if(this.mi(37,$.category)) { $.name.path = [ this.identAst() ]; } continue;
1593
+ case 37: switch(this.l()) {
1594
+ case '.': this.c(38); continue;
1595
+ default: this.gr(['@']); continue;
1596
+ }
1597
+ case 38: if(this.miA(37,$.category)) { $.name.path.push( this.identAst() ); } continue;
1598
+ default:
1599
+ this.attachLocation( $.name );
1600
+ return this.exit_();
1601
+ }
1602
+ }
1603
+ simplePath($,$next) {
1604
+ $.ref??={};
1605
+ this.rule_(40,$next);
1606
+ for(;;) switch(this.s) {
1607
+ case 40: if(this.mi(41,$.category)) { $.ref.path = [ this.identAst() ]; } continue;
1608
+ case 41: switch(this.l()) {
1609
+ case '.': this.c(42); continue;
1610
+ default: this.gr([]); continue;
1611
+ }
1612
+ case 42: if(this.miA(41,$.category)) { $.ref.path.push( this.identAst() ); } continue;
1613
+ default:
1614
+ this.attachLocation( $.ref );
1615
+ return this.exit_();
1616
+ }
1617
+ }
1618
+ serviceDef($,$next) {
1619
+ this.rule_(44,$next);
1620
+ let name; let _;
1621
+ for(;;) switch(this.s) {
1622
+ case 44: this.mk(45,'service'); continue;
1623
+ case 45: if(this.namePath(_={category:'Service'},46)) {name=_.name; this.addDef( $.art, $.outer, 'artifacts', 'service', name );
1624
+ this.docComment( $.art ); } continue;
1625
+ case 46: switch(this.l()) {
1626
+ case '@': this.annoAssignMid({art:$.art},46); continue;
1627
+ default: this.s=47; continue;
1628
+ }
1629
+ case 47: switch(this.l()) {
1630
+ case '{': this.artifactsBlock({art:$.art,start:undefined},0); continue;
1631
+ default: this.gr([';']); continue;
1632
+ }
1633
+ default:
1634
+ this.attachLocation( $.art );
1635
+ return this.exit_();
1636
+ }
1637
+ }
1638
+ contextDef($,$next) {
1639
+ this.rule_(49,$next);
1640
+ let name; let _;
1641
+ for(;;) switch(this.s) {
1642
+ case 49: this.mk(50,'context'); continue;
1643
+ case 50: if(this.namePath(_={category:'Context'},51)) {name=_.name; this.addDef( $.art, $.outer, 'artifacts', 'context', name );
1644
+ this.docComment( $.art ); } continue;
1645
+ case 51: switch(this.l()) {
1646
+ case '@': this.annoAssignMid({art:$.art},51); continue;
1647
+ default: this.s=52; continue;
1648
+ }
1649
+ case 52: switch(this.l()) {
1650
+ case '{': this.artifactsBlock({art:$.art,start:undefined},0); continue;
1651
+ default: this.gr([';']); continue;
1652
+ }
1653
+ default:
1654
+ this.attachLocation( $.art );
1655
+ return this.exit_();
1656
+ }
1657
+ }
1658
+ annotationDef($,$next) {
1659
+ this.rule_(54,$next);
1660
+ let name; let _;
1661
+ for(;;) switch(this.s) {
1662
+ case 54: this.mk(55,'annotation'); continue;
1663
+ case 55: if(this.namePath(_={category:'AnnoDef'},56)) {name=_.name; this.addDef( $.art, $.outer, 'vocabularies', 'annotation', name );
1664
+ this.docComment( $.art ); } continue;
1665
+ case 56: switch(this.l()) {
1666
+ case '@': this.annoAssignMid({art:$.art},56); continue;
1667
+ default: this.s=57; continue;
1668
+ }
1669
+ case 57: this.typeOrIncludesSpec({art:$.art},0); continue;
1670
+ default:
1671
+ this.attachLocation( $.art );
1672
+ return this.exit_();
1673
+ }
1674
+ }
1675
+ typeDef($,$next) {
1676
+ this.rule_(59,$next);
1677
+ let name; let _;
1678
+ for(;;) switch(this.s) {
1679
+ case 59: this.mk(60,'type'); continue;
1680
+ case 60: if(this.namePath(_={category:'Type'},61)) {name=_.name; this.addDef( $.art, $.outer, 'artifacts', 'type', name );
1681
+ this.docComment( $.art ); } continue;
1682
+ case 61: switch(this.l()) {
1683
+ case '@': this.annoAssignMid({art:$.art},61); continue;
1684
+ default: this.s=62; continue;
1685
+ }
1686
+ case 62: this.typeOrIncludesSpec({art:$.art},0); continue;
1687
+ default:
1688
+ this.attachLocation( $.art );
1689
+ return this.exit_();
1690
+ }
1691
+ }
1692
+ aspectDef($,$next) {
1693
+ this.rule_(64,$next);
1694
+ let name; let _;
1695
+ for(;;) switch(this.s) {
1696
+ case 64: switch(this.lk()) {
1697
+ case 'aspect': this.ck(66); continue;
1698
+ case 'abstract': if(this.ck(65)) { this.warning( 'syntax-deprecated-abstract', this.lb().location ); } continue;
1699
+ default: this.e(); continue;
1700
+ }
1701
+ case 65: this.mk(66,'entity'); continue;
1702
+ case 66: if(this.namePath(_={category:'Type'},67)) {name=_.name; this.addDef( $.art, $.outer, 'artifacts', 'aspect', name );
1703
+ this.docComment( $.art ); } continue;
1704
+ case 67: switch(this.l()) {
1705
+ case '@': this.annoAssignMid({art:$.art},67); continue;
1706
+ default: this.s=68; continue;
1707
+ }
1708
+ case 68: switch(this.l()) {
1709
+ case '{': this.elementsBlock({art:$.art},69); continue;
1710
+ case ':': this.c(70); continue;
1711
+ default: this.gr([';']); continue;
1712
+ }
1713
+ case 69: switch(this.lk()) {
1714
+ case 'actions': this.actionsBlock({art:$.art},0); continue;
1715
+ default: this.gr([';']); continue;
1716
+ }
1717
+ case 70: this.aspectColonSpec({art:$.art},0); continue;
1718
+ default:
1719
+ this.attachLocation( $.art );
1720
+ return this.exit_();
1721
+ }
1722
+ }
1723
+ aspectColonSpec($,$next) {
1724
+ this.rule_(72,$next);
1725
+ let incl; let _;
1726
+ for(;;) switch(this.s) {
1727
+ case 72: switch(this.l()) {
1728
+ case 'Id': if(this.simplePath(_={category:'artref'},73)) {incl=_.ref; $.art.includes ??= []; $.art.includes.push( incl ); } continue;
1729
+ default: this.s=74; continue;
1730
+ }
1731
+ case 73: switch(this.l()) {
1732
+ case ',': this.c(72); continue;
1733
+ default: this.s=74; continue;
1734
+ }
1735
+ case 74: switch(this.l()) {
1736
+ case '{': this.elementsBlock({art:$.art},75); continue;
1737
+ default: this.gr([';']); continue;
1738
+ }
1739
+ case 75: switch(this.lk()) {
1740
+ case 'actions': this.actionsBlock({art:$.art},0); continue;
1741
+ default: this.gr([';']); continue;
1742
+ }
1743
+ default: return this.exit_();
1744
+ }
1745
+ }
1746
+ entityDef($,$next) {
1747
+ this.rule_(77,$next);
1748
+ let name; let incl; let query; let _;
1749
+ for(;;) switch(this.s) {
1750
+ case 77: this.mk(78,'entity'); continue;
1751
+ case 78: if(this.namePath(_={category:'Entity'},79)) {name=_.name; this.addDef( $.art, $.outer, 'artifacts', 'entity', name );
1752
+ this.docComment( $.art ); } continue;
1753
+ case 79: switch(this.l()) {
1754
+ case '@': this.annoAssignMid({art:$.art},79); continue;
1755
+ default: this.s=80; continue;
1756
+ }
1757
+ case 80: switch(this.l()) {
1758
+ case '(': this.paramsList({art:$.art},81); continue;
1759
+ default: this.s=81; continue;
1760
+ }
1761
+ case 81: switch(this.lk()) {
1762
+ case ':': if(this.c(82)) { $.art.includes ??= []; } continue;
1763
+ case '{': this.s=85; continue;
1764
+ case 'as': this.ck(86); continue;
1765
+ default: this.e(); continue;
1766
+ }
1767
+ case 82: switch(this.lk()) {
1768
+ case 'Id': this.s=83; continue;
1769
+ default: this.ei(); continue;
1770
+ }
1771
+ case 83: switch(this.l()) {
1772
+ case 'Id': if(this.simplePath(_={category:'artref'},84)) {incl=_.ref; $.art.includes.push( incl ); } continue;
1773
+ default: this.s=85; continue;
1774
+ }
1775
+ case 84: switch(this.l()) {
1776
+ case ',': this.c(83); continue;
1777
+ case '{': this.s=85; continue;
1778
+ default: this.e(); continue;
1779
+ }
1780
+ case 85: this.elementsBlock({art:$.art},89); continue;
1781
+ case 86: switch(this.lk()) {
1782
+ case '(': case 'select': if(this.queryExpression(_={},89)) {query=_.expr; $.art.query = query; $.art.$syntax = 'entity'; } continue;
1783
+ case 'projection': if(this.projectionSpec(_={},87)) {query=_.query; $.art.query = query; $.art.$syntax = 'projection'; } continue;
1784
+ default: this.e(); continue;
1785
+ }
1786
+ case 87: switch(this.lk()) {
1787
+ case 'group': case 'where': case 'having': this.whereGroupByHaving({query},88); continue;
1788
+ default: this.s=88; continue;
1789
+ }
1790
+ case 88: switch(this.lk()) {
1791
+ case 'limit': case 'order': this.orderByLimitOffset({query},89); continue;
1792
+ default: this.s=89; continue;
1793
+ }
1794
+ case 89: switch(this.lk()) {
1795
+ case 'actions': this.actionsBlock({art:$.art},0); continue;
1796
+ default: this.gr([';']); continue;
1797
+ }
1798
+ default:
1799
+ this.attachLocation( $.art );
1800
+ return this.exit_();
1801
+ }
1802
+ }
1803
+ viewDef($,$next) {
1804
+ this.rule_(91,$next);
1805
+ let name; let query; let _;
1806
+ for(;;) switch(this.s) {
1807
+ case 91: this.mk(92,'view'); continue;
1808
+ case 92: if(this.namePath(_={category:'Entity'},93)) {name=_.name; this.addDef( $.art, $.outer, 'artifacts', 'entity', name );
1809
+ this.docComment( $.art ); } continue;
1810
+ case 93: switch(this.l()) {
1811
+ case '@': this.annoAssignMid({art:$.art},93); continue;
1812
+ default: this.s=94; continue;
1813
+ }
1814
+ case 94: switch(this.lk()) {
1815
+ case '(': this.paramsList({art:$.art},100); continue;
1816
+ case 'with': this.ck(95); continue;
1817
+ default: this.s=100; continue;
1818
+ }
1819
+ case 95: if(this.mk(96,'parameters')) { $.art.params = this.createDict(); } continue;
1820
+ case 96: this.paramDef({outer:$.art},97); continue;
1821
+ case 97: switch(this.l()) {
1822
+ case ',': this.c(98); continue;
1823
+ default: this.s=99; continue;
1824
+ }
1825
+ case 98: this.paramDef({outer:$.art},97); continue;
1826
+ case 99: this.s=100;{ this.finalizeDictOrArray( $.art.params ); } continue;
1827
+ case 100: this.mk(101,'as'); continue;
1828
+ case 101: if(this.queryExpression(_={},0)) {query=_.expr; $.art.query = query; $.art.$syntax = 'view'; } continue;
1829
+ default:
1830
+ this.attachLocation( $.art );
1831
+ return this.exit_();
1832
+ }
1833
+ }
1834
+ eventDef($,$next) {
1835
+ this.rule_(103,$next);
1836
+ let name; let incl; let query; let _;
1837
+ for(;;) switch(this.s) {
1838
+ case 103: this.mk(104,'event'); continue;
1839
+ case 104: if(this.namePath(_={category:'Event'},105)) {name=_.name; this.addDef( $.art, $.outer, 'artifacts', 'event', name );
1840
+ this.docComment( $.art ); } continue;
1841
+ case 105: switch(this.l()) {
1842
+ case '@': this.annoAssignMid({art:$.art},105); continue;
1843
+ default: this.s=106; continue;
1844
+ }
1845
+ case 106: switch(this.l()) {
1846
+ case '{': this.elementsBlock({art:$.art},0); continue;
1847
+ case ':': this.c(107); continue;
1848
+ default: this.e(); continue;
1849
+ }
1850
+ case 107: switch(this.lk()) {
1851
+ case '{': this.elementsBlock({art:$.art},0); continue;
1852
+ case 'Id': if(this.simplePath(_={category:'artref'},108)) {incl=_.ref; $.art.type = incl; } continue;
1853
+ case 'projection': if(this.lP() && this.projectionSpec(_={},0)) {query=_.query; $.art.query = query; $.art.$syntax = 'projection'; } continue;
1854
+ default: this.ei(); continue;
1855
+ }
1856
+ case 108: switch(this.l()) {
1857
+ case ',': case '{': this.s=109;{ $.art.includes = [ $.art.type ]; delete $.art.type; } continue;
1858
+ default: this.s=113;{ this.docComment( $.art ); } continue;
1859
+ }
1860
+ case 109: switch(this.l()) {
1861
+ case ',': this.c(110); continue;
1862
+ default: this.s=112; continue;
1863
+ }
1864
+ case 110: switch(this.l()) {
1865
+ case 'Id': if(this.simplePath(_={category:'artref'},111)) {incl=_.ref; $.art.includes.push( incl ); } continue;
1866
+ default: this.s=112; continue;
1867
+ }
1868
+ case 111: switch(this.l()) {
1869
+ case ',': this.c(110); continue;
1870
+ case '{': this.s=112; continue;
1871
+ default: this.e(); continue;
1872
+ }
1873
+ case 112: this.elementsBlock({art:$.art},0); continue;
1874
+ case 113: switch(this.l()) {
1875
+ case '@': this.annoAssignStd({art:$.art},113); continue;
1876
+ default: this.gr([';']); continue;
1877
+ }
1878
+ default:
1879
+ this.attachLocation( $.art );
1880
+ return this.exit_();
1881
+ }
1882
+ }
1883
+ actionMainDef($,$next) {
1884
+ this.rule_(115,$next);
1885
+ let name; let _;
1886
+ for(;;) switch(this.s) {
1887
+ case 115: this.mk(116,'action'); continue;
1888
+ case 116: if(this.namePath(_={category:'Action'},117)) {name=_.name; this.addDef( $.art, $.outer, 'artifacts', 'action', name );
1889
+ this.docComment( $.art ); } continue;
1890
+ case 117: switch(this.l()) {
1891
+ case '@': this.annoAssignMid({art:$.art},117); continue;
1892
+ default: this.s=118; continue;
1893
+ }
1894
+ case 118: this.paramsList({art:$.art},119); continue;
1895
+ case 119: switch(this.lk()) {
1896
+ case 'returns': this.returnsSpec({outer:$.art},0); continue;
1897
+ default: this.gr([';']); continue;
1898
+ }
1899
+ default:
1900
+ this.attachLocation( $.art );
1901
+ return this.exit_();
1902
+ }
1903
+ }
1904
+ functionMainDef($,$next) {
1905
+ this.rule_(121,$next);
1906
+ let name; let _;
1907
+ for(;;) switch(this.s) {
1908
+ case 121: this.mk(122,'function'); continue;
1909
+ case 122: if(this.namePath(_={category:'Action'},123)) {name=_.name; this.addDef( $.art, $.outer, 'artifacts', 'function', name );
1910
+ this.docComment( $.art ); } continue;
1911
+ case 123: switch(this.l()) {
1912
+ case '@': this.annoAssignMid({art:$.art},123); continue;
1913
+ default: this.s=124; continue;
1914
+ }
1915
+ case 124: this.paramsList({art:$.art},125); continue;
1916
+ case 125: this.returnsSpec({outer:$.art},0); continue;
1917
+ default:
1918
+ this.attachLocation( $.art );
1919
+ return this.exit_();
1920
+ }
1921
+ }
1922
+ actionsBlock($,$next) {
1923
+ this.rule_(127,$next);
1924
+ for(;;) switch(this.s) {
1925
+ case 127: if(this.mk(128,'actions')) { $.art.actions = this.createDict(); } continue;
1926
+ case 128: this.m(129,'{'); continue;
1927
+ case 129: switch(this.l()) {
1928
+ case 'Id': case '@': this.boundActionFunctionDef({outer:$.art},130); continue;
1929
+ default: this.s=131; continue;
1930
+ }
1931
+ case 130: switch(this.l()) {
1932
+ case ';': this.c(129); continue;
1933
+ case '}': this.s=131; continue;
1934
+ case 'Id': case '@': this.ec('afterBrace') && this.g(129); continue;
1935
+ default: this.e(); continue;
1936
+ }
1937
+ case 131: if(this.m(0,'}')) {this.afterBrace(); this.finalizeDictOrArray( $.art.actions ); } continue;
1938
+ default: return this.exit_();
1939
+ }
1940
+ }
1941
+ boundActionFunctionDef($,$next) {
1942
+ this.rule_(133,$next);
1943
+ let art=new XsnArtifact();
1944
+ { this.docComment( art ); }
1945
+ for(;;) switch(this.s) {
1946
+ case 133: switch(this.l()) {
1947
+ case '@': this.annoAssignStd({art},133); continue;
1948
+ default: this.s=134; continue;
1949
+ }
1950
+ case 134: switch(this.lk()) {
1951
+ case 'action': this.ck(135); continue;
1952
+ case 'function': this.ck(139); continue;
1953
+ default: this.e(); continue;
1954
+ }
1955
+ case 135: if(this.mi(136,'BoundAction')) { this.addDef( art, $.outer, 'actions', 'action', this.identAst() );
1956
+ this.docComment( art ); } continue;
1957
+ case 136: switch(this.l()) {
1958
+ case '@': this.annoAssignMid({art},136); continue;
1959
+ default: this.s=137; continue;
1960
+ }
1961
+ case 137: this.paramsList({art},138); continue;
1962
+ case 138: switch(this.lk()) {
1963
+ case 'returns': this.returnsSpec({outer:art},0); continue;
1964
+ default: this.gr([';','@','}','action','function']); continue;
1965
+ }
1966
+ case 139: if(this.mi(140,'BoundAction')) { this.addDef( art, $.outer, 'actions', 'function', this.identAst() );
1967
+ this.docComment( art ); } continue;
1968
+ case 140: switch(this.l()) {
1969
+ case '@': this.annoAssignMid({art},140); continue;
1970
+ default: this.s=141; continue;
1971
+ }
1972
+ case 141: this.paramsList({art},142); continue;
1973
+ case 142: this.returnsSpec({outer:art},0); continue;
1974
+ default:
1975
+ this.attachLocation( art );
1976
+ return this.exit_();
1977
+ }
1978
+ }
1979
+ paramsList($,$next) {
1980
+ this.rule_(144,$next);
1981
+ for(;;) switch(this.s) {
1982
+ case 144: if(this.m(145,'(')) { $.art.params = this.createDict(); } continue;
1983
+ case 145: switch(this.l()) {
1984
+ case 'Id': case '@': this.paramDef({outer:$.art},146); continue;
1985
+ default: this.s=147; continue;
1986
+ }
1987
+ case 146: switch(this.l()) {
1988
+ case ',': this.c(145); continue;
1989
+ case ')': this.s=147; continue;
1990
+ default: this.e(); continue;
1991
+ }
1992
+ case 147: if(this.m(0,')')) { this.finalizeDictOrArray( $.art.params ); } continue;
1993
+ default: return this.exit_();
1994
+ }
1995
+ }
1996
+ paramDef($,$next) {
1997
+ this.rule_(149,$next);
1998
+ let art=new XsnArtifact();
1999
+ { this.docComment( art ); }
2000
+ for(;;) switch(this.s) {
2001
+ case 149: switch(this.l()) {
2002
+ case '@': this.annoAssignStd({art},149); continue;
2003
+ default: this.s=150; continue;
2004
+ }
2005
+ case 150: if(this.miA(151,'Param')) { this.addDef( art, $.outer, 'params', 'param', this.identAst() );
2006
+ this.docComment( art ); } continue;
2007
+ case 151: switch(this.l()) {
2008
+ case '@': this.annoAssignMid({art},151); continue;
2009
+ default: this.s=152; continue;
2010
+ }
2011
+ case 152: switch(this.l()) {
2012
+ case '{': this.elementsBlock({art},153); continue;
2013
+ case ':': this.c(154); continue;
2014
+ default: this.e(); continue;
2015
+ }
2016
+ case 153: switch(this.lk()) {
2017
+ case 'not': case 'null': this.nullability({art},0); continue;
2018
+ default: this.gr([',']); continue;
2019
+ }
2020
+ case 154: this.typeExpression({art},0); continue;
2021
+ default:
2022
+ this.attachLocation( art );
2023
+ return this.exit_();
2024
+ }
2025
+ }
2026
+ returnsSpec($,$next) {
2027
+ this.rule_(156,$next);
2028
+ let art=new XsnArtifact();
2029
+ for(;;) switch(this.s) {
2030
+ case 156: if(this.mk(157,'returns')) {this.elementRestriction(); art.kind = 'param'; $.outer.returns = art;
2031
+ this.docComment( art ); } continue;
2032
+ case 157: switch(this.l()) {
2033
+ case '@': this.annoAssignStd({art},157); continue;
2034
+ default: this.s=158; continue;
2035
+ }
2036
+ case 158: this.typeExpression({art},0); continue;
2037
+ default:
2038
+ this.attachLocation( art );
2039
+ return this.exit_();
2040
+ }
2041
+ }
2042
+ elementsBlock($,$next) {
2043
+ this.rule_(160,$next);
2044
+ for(;;) switch(this.s) {
2045
+ case 160: if(this.m(161,'{')) { $.art.elements = this.createDict(); } continue;
2046
+ case 161: switch(this.l()) {
2047
+ case 'Id': case '@': this.elementDef({outer:$.art,art:undefined},162); continue;
2048
+ default: this.s=163; continue;
2049
+ }
2050
+ case 162: switch(this.l()) {
2051
+ case ';': this.c(161); continue;
2052
+ case '}': this.s=163; continue;
2053
+ case 'Id': case '@': this.ec('afterBrace') && this.g(161); continue;
2054
+ default: this.e(); continue;
2055
+ }
2056
+ case 163: if(this.m(0,'}')) {this.afterBrace(); this.finalizeDictOrArray( $.art.elements ); } continue;
2057
+ default: return this.exit_();
2058
+ }
2059
+ }
2060
+ elementDef($,$next) {
2061
+ this.rule_(165,$next);
2062
+ let expr; let _;
2063
+ { $.art ??= new XsnArtifact();
2064
+ this.docComment( $.art ); }
2065
+ for(;;) switch(this.s) {
2066
+ case 165: switch(this.l()) {
2067
+ case '@': this.annoAssignStd({art:$.art},165); continue;
2068
+ default: this.s=166; continue;
2069
+ }
2070
+ case 166: switch(this.lk()) {
2071
+ case 'virtual': if(this.ckP(167,['Id','key'])) { $.art.virtual = this.valueWithLocation( true ); } continue;
2072
+ default: this.s=167; continue;
2073
+ }
2074
+ case 167: switch(this.lk()) {
2075
+ case 'key': if(this.ck(168)) { $.art.key = this.valueWithLocation( true ); } continue;
2076
+ default: this.s=168; continue;
2077
+ }
2078
+ case 168: switch(this.lk()) {
2079
+ case 'masked': if(this.ckP(169,['Id'])) { $.art.masked = this.valueWithLocation( true );
2080
+ this.message( 'syntax-unsupported-masked', this.lb(), { keyword: 'masked' } ); } continue;
2081
+ default: this.s=169; continue;
2082
+ }
2083
+ case 169: switch(this.lk()) {
2084
+ case 'element': if(this.ckP(170,['Id'])) { $.art.$syntax = 'element'; } continue;
2085
+ default: this.s=170; continue;
2086
+ }
2087
+ case 170: if(this.mi(171,'Element')) { this.addDef( $.art, $.outer, 'elements', 'element', this.identAst() );
2088
+ this.docComment( $.art ); } continue;
2089
+ case 171: switch(this.l()) {
2090
+ case '@': this.annoAssignMid({art:$.art},171); continue;
2091
+ default: this.s=172; continue;
2092
+ }
2093
+ case 172: switch(this.l()) {
2094
+ case '{': this.elementsBlock({art:$.art},173); continue;
2095
+ case ':': if(this.c(174)) {this.elementRestriction();} continue;
2096
+ default: this.s=175;{ this.elementRestriction(); } continue;
2097
+ }
2098
+ case 173: switch(this.lk()) {
2099
+ case 'not': case 'null': this.nullability({art:$.art},175); continue;
2100
+ default: this.s=175; continue;
2101
+ }
2102
+ case 174: this.typeExpression({art:$.art},175); continue;
2103
+ case 175: switch(this.l()) {
2104
+ case '=': this.gc(0,'calcOrDefaultRestriction') && this.c(176); continue;
2105
+ default: this.gr(['Id',';','@','}','key']); continue;
2106
+ }
2107
+ case 176: if(this.expression(_={},177)) {expr=_.expr; $.art.value = expr; } continue;
2108
+ case 177: switch(this.lk()) {
2109
+ case 'stored': if(this.ck(178)) { $.art.value.stored = this.valueWithLocation( true ); } continue;
2110
+ default: this.s=178; continue;
2111
+ }
2112
+ case 178: this.s=179;{ this.docComment( $.art ); } continue;
2113
+ case 179: switch(this.l()) {
2114
+ case '@': this.gc(0,'elementRestriction') && this.annoAssignStd({art:$.art},179); continue;
2115
+ default: this.gr(['Id',';','@','}','key']); continue;
2116
+ }
2117
+ default:
2118
+ this.attachLocation( $.art );
2119
+ return this.exit_();
2120
+ }
2121
+ }
2122
+ enumSymbolsBlock($,$next) {
2123
+ this.rule_(181,$next);
2124
+ for(;;) switch(this.s) {
2125
+ case 181: if(this.mk(182,'enum')) { $.art.enum = this.createDict(); } continue;
2126
+ case 182: this.m(183,'{'); continue;
2127
+ case 183: switch(this.l()) {
2128
+ case 'Id': case '@': this.enumSymbolDef({outer:$.art},184); continue;
2129
+ default: this.s=185; continue;
2130
+ }
2131
+ case 184: switch(this.l()) {
2132
+ case ';': this.c(183); continue;
2133
+ case '}': this.s=185; continue;
2134
+ default: this.e(); continue;
2135
+ }
2136
+ case 185: if(this.m(0,'}')) {this.afterBrace(); this.finalizeDictOrArray( $.art.enum ); } continue;
2137
+ default: return this.exit_();
2138
+ }
2139
+ }
2140
+ enumSymbolDef($,$next) {
2141
+ this.rule_(187,$next);
2142
+ let art=new XsnArtifact();
2143
+ let sign; let value; let _;
2144
+ { this.docComment( art ); }
2145
+ for(;;) switch(this.s) {
2146
+ case 187: switch(this.l()) {
2147
+ case '@': this.annoAssignStd({art},187); continue;
2148
+ default: this.s=188; continue;
2149
+ }
2150
+ case 188: if(this.mi(189,'Enum')) { this.addDef( art, $.outer, 'enum', 'enum', this.identAst() );
2151
+ this.docComment( art ); } continue;
2152
+ case 189: switch(this.l()) {
2153
+ case '@': this.annoAssignStd({art},189); continue;
2154
+ default: this.s=190; continue;
2155
+ }
2156
+ case 190: switch(this.l()) {
2157
+ case '=': this.c(191); continue;
2158
+ default: this.gr([';','}']); continue;
2159
+ }
2160
+ case 191: switch(this.l()) {
2161
+ case 'String': if(this.c(193)) { art.value = this.quotedLiteral(); } continue;
2162
+ case 'Number': if(this.c(193)) { art.value = this.numberLiteral(); } continue;
2163
+ case '+': case '-': if(this.c(192)) sign=this.lb(); continue;
2164
+ case 'Id': case '#': case 'QuotedLiteral': if(this.literalValue(_={},193)) {value=_.expr; art.value = value; } continue;
2165
+ default: this.e(); continue;
2166
+ }
2167
+ case 192: if(this.m(193,'Number')) { art.value = this.numberLiteral( sign ); } continue;
2168
+ case 193: this.s=194;{ this.docComment( art ); } continue;
2169
+ case 194: switch(this.l()) {
2170
+ case '@': this.annoAssignStd({art},194); continue;
2171
+ default: this.gr([';','}']); continue;
2172
+ }
2173
+ default:
2174
+ this.attachLocation( art );
2175
+ return this.exit_();
2176
+ }
2177
+ }
2178
+ foreignKeysBlock($,$next) {
2179
+ this.rule_(196,$next);
2180
+ for(;;) switch(this.s) {
2181
+ case 196: if(this.m(197,'{')) { $.art.foreignKeys = this.createDict(); } continue;
2182
+ case 197: switch(this.l()) {
2183
+ case 'Id': case '@': this.foreignKeyDef({outer:$.art},198); continue;
2184
+ default: this.s=199; continue;
2185
+ }
2186
+ case 198: switch(this.l()) {
2187
+ case ',': this.c(197); continue;
2188
+ case '}': this.s=199; continue;
2189
+ default: this.e(); continue;
2190
+ }
2191
+ case 199: if(this.m(0,'}')) { this.finalizeDictOrArray( $.art.foreignKeys ); } continue;
2192
+ default: return this.exit_();
2193
+ }
2194
+ }
2195
+ foreignKeyDef($,$next) {
2196
+ this.rule_(201,$next);
2197
+ let art=new XsnArtifact(); let name;
2198
+ let ref; let _;
2199
+ { this.docComment( art ); }
2200
+ for(;;) switch(this.s) {
2201
+ case 201: switch(this.l()) {
2202
+ case '@': this.annoAssignStd({art},201); continue;
2203
+ default: this.s=202; continue;
2204
+ }
2205
+ case 202: if(this.simplePath(_={category:'ref'},203)) {ref=_.ref; art.targetElement = ref; } continue;
2206
+ case 203: switch(this.lk()) {
2207
+ case 'as': this.ck(204); continue;
2208
+ default: if(this.gr([',','}'])) { this.classifyImplicitName( 'KeyImplicit', ref ); name = ref.path; } continue;
2209
+ }
2210
+ case 204: if(this.mi(0,'Key')) {name=this.lb(); name = this.identAst(); } continue;
2211
+ case 0: { this.addDef( art, $.outer, 'foreignKeys', 'key', name ); }
2212
+ default:
2213
+ this.attachLocation(art);
2214
+ return this.exit_();
2215
+ }
2216
+ }
2217
+ mixinElementDef($,$next) {
2218
+ this.rule_(206,$next);
2219
+ let art=new XsnArtifact();
2220
+ let assoc; let card; let target; let expr; let _;
2221
+ for(;;) switch(this.s) {
2222
+ case 206: if(this.mi(207,'Mixin')) { this.addDef( art, $.outer, 'mixin', 'mixin', this.identAst() ); } continue;
2223
+ case 207: this.m(208,':'); continue;
2224
+ case 208: switch(this.lk()) {
2225
+ case 'association': if(this.ck(209)) assoc=this.lb(); continue;
2226
+ case 'composition': if(this.ck(211)) assoc=this.lb(); continue;
2227
+ default: this.e(); continue;
2228
+ }
2229
+ case 209: switch(this.l()) {
2230
+ case '[': this.cardinality({art},210); continue;
2231
+ default: this.s=210; continue;
2232
+ }
2233
+ case 210: this.mk(213,'to'); continue;
2234
+ case 211: switch(this.l()) {
2235
+ case '[': this.cardinality({art},212); continue;
2236
+ default: this.s=212; continue;
2237
+ }
2238
+ case 212: this.mk(213,'of'); continue;
2239
+ case 213: switch(this.lk()) {
2240
+ case 'one': case 'many': if(this.ckP(214,['Id'])) card=this.lb(); continue;
2241
+ default: this.s=214; continue;
2242
+ }
2243
+ case 214: if(this.simplePath(_={category:'artref'},215)) {target=_.ref; this.setAssocAndComposition( art, assoc, card, target ); } continue;
2244
+ case 215: this.mk(216,'on'); continue;
2245
+ case 216: if(this.condition(_={},0)) {expr=_.expr; art.on = expr; } continue;
2246
+ default:
2247
+ this.attachLocation(art);
2248
+ return this.exit_();
2249
+ }
2250
+ }
2251
+ annotateArtifact($,$next) {
2252
+ this.rule_(218,$next);
2253
+ let name; let elemName; let _;
2254
+ for(;;) switch(this.s) {
2255
+ case 218: if(this.namePath(_={category:'Ext'},219)) name=_.name; continue;
2256
+ case 219: switch(this.lk()) {
2257
+ case ':': this.c(220); continue;
2258
+ case 'with': this.ck(225); continue;
2259
+ default: this.s=225; continue;
2260
+ }
2261
+ case 220: if(this.namePath(_={category:'ExtElement'},221)) {elemName=_.name; this.addExtension( $.art, $.outer, 'annotate', name, elemName.path ); } continue;
2262
+ case 221: switch(this.lk()) {
2263
+ case 'with': this.ck(222); continue;
2264
+ default: this.s=222; continue;
2265
+ }
2266
+ case 222: this.s=223;{ this.docComment( $.art ); } continue;
2267
+ case 223: switch(this.l()) {
2268
+ case '@': this.annoAssignStd({art:$.art},223); continue;
2269
+ default: this.s=224; continue;
2270
+ }
2271
+ case 224: switch(this.l()) {
2272
+ case '{': this.annotateElementsBlock({art:$.art},0); continue;
2273
+ default: this.gr([';']); continue;
2274
+ }
2275
+ case 225: this.s=226;{ this.addExtension( $.art, $.outer, 'annotate', name );
2276
+ this.docComment( $.art ); } continue;
2277
+ case 226: switch(this.l()) {
2278
+ case '@': this.annoAssignStd({art:$.art},226); continue;
2279
+ default: this.s=227; continue;
2280
+ }
2281
+ case 227: switch(this.l()) {
2282
+ case '(': this.annotateParamsBlock({art:$.art},228); continue;
2283
+ default: this.s=228; continue;
2284
+ }
2285
+ case 228: switch(this.lk()) {
2286
+ case 'returns': this.annotateReturns({outer:$.art},0); continue;
2287
+ case '{': this.annotateElementsBlock({art:$.art},229); continue;
2288
+ default: this.s=229; continue;
2289
+ }
2290
+ case 229: switch(this.lk()) {
2291
+ case 'actions': this.annotateActionsBlock({art:$.art},0); continue;
2292
+ default: this.gr([';']); continue;
2293
+ }
2294
+ default:
2295
+ this.attachLocation( $.art );
2296
+ return this.exit_();
2297
+ }
2298
+ }
2299
+ extendArtifact($,$next) {
2300
+ this.rule_(231,$next);
2301
+ let name; let elemName; let elements; let incl; let _;
2302
+ for(;;) switch(this.s) {
2303
+ case 231: if(this.namePath(_={category:'Ext'},232)) name=_.name; continue;
2304
+ case 232: switch(this.lk()) {
2305
+ case ':': this.c(233); continue;
2306
+ case 'with': if(this.ck(242)) { this.addExtension( $.art, $.outer, 'extend', name );
2307
+ this.docComment( $.art ); } continue;
2308
+ default: this.s=239;{ this.addExtension( $.art, $.outer, 'extend', name );
2309
+ this.docComment( $.art ); } continue;
2310
+ }
2311
+ case 233: if(this.namePath(_={category:'ExtElement'},234)) {elemName=_.name; this.addExtension( $.art, $.outer, 'extend', name, elemName.path ); } continue;
2312
+ case 234: switch(this.lk()) {
2313
+ case 'with': this.ck(235); continue;
2314
+ default: this.s=235; continue;
2315
+ }
2316
+ case 235: this.s=236;{ this.docComment( $.art ); } continue;
2317
+ case 236: switch(this.l()) {
2318
+ case '@': this.annoAssignStd({art:$.art},236); continue;
2319
+ default: this.s=237; continue;
2320
+ }
2321
+ case 237: switch(this.lk()) {
2322
+ case 'elements': if(this.ck(238)) elements=this.lb(); continue;
2323
+ case '{': this.s=238; continue;
2324
+ case 'enum': this.enumSymbolsBlock({art:$.art},0); continue;
2325
+ case '(': this.typeNamedArgsList({art:$.art},0); continue;
2326
+ default: this.gr([';']); continue;
2327
+ }
2328
+ case 238: this.extendElementsBlock({art:$.art,start:elements},0); continue;
2329
+ case 239: switch(this.l()) {
2330
+ case '@': this.annoAssignStd({art:$.art},239); continue;
2331
+ default: this.s=240; continue;
2332
+ }
2333
+ case 240: switch(this.l()) {
2334
+ case '{': this.extendElementsBlock({art:$.art,start:undefined},241); continue;
2335
+ default: this.gr([';']); continue;
2336
+ }
2337
+ case 241: switch(this.lk()) {
2338
+ case 'actions': this.actionsBlock({art:$.art},0); continue;
2339
+ default: this.gr([';']); continue;
2340
+ }
2341
+ case 242: switch(this.l()) {
2342
+ case '@': this.annoAssignStd({art:$.art},242); continue;
2343
+ default: this.s=243; continue;
2344
+ }
2345
+ case 243: switch(this.lk()) {
2346
+ case 'Id': if(this.simplePath(_={category:'artref'},244)) {incl=_.ref; $.art.includes = [ incl ]; } continue;
2347
+ case 'elements': if(this.ckP(248,['{'])) elements=this.lb(); continue;
2348
+ case '{': this.s=248; continue;
2349
+ case 'actions': this.lP() && this.actionsBlock({art:$.art},0); continue;
2350
+ case 'enum': this.lP() && this.enumSymbolsBlock({art:$.art},0); continue;
2351
+ case '(': this.typeNamedArgsList({art:$.art},0); continue;
2352
+ case 'columns': this.ckP(250,['{']); continue;
2353
+ case 'definitions': this.ckP(251,['{']); continue;
2354
+ default: this.gi(0,[';']); continue;
2355
+ }
2356
+ case 244: switch(this.l()) {
2357
+ case ',': this.c(245); continue;
2358
+ default: this.s=246; continue;
2359
+ }
2360
+ case 245: if(this.simplePath(_={category:'artref'},244)) {incl=_.ref; $.art.includes.push( incl ); } continue;
2361
+ case 246: switch(this.l()) {
2362
+ case '{': this.extendElementsBlock({art:$.art,start:undefined},247); continue;
2363
+ default: this.s=247; continue;
2364
+ }
2365
+ case 247: switch(this.lk()) {
2366
+ case 'actions': this.actionsBlock({art:$.art},0); continue;
2367
+ default: this.gr([';']); continue;
2368
+ }
2369
+ case 248: this.extendElementsBlock({art:$.art,start:elements},249); continue;
2370
+ case 249: switch(this.lk()) {
2371
+ case 'actions': this.actionsBlock({art:$.art},0); continue;
2372
+ default: this.gr([';']); continue;
2373
+ }
2374
+ case 250: this.selectItemsList({query:$.art,start:this.lb()},0); continue;
2375
+ case 251: this.artifactsBlock({art:$.art,start:this.lb()},0); continue;
2376
+ default:
2377
+ this.attachLocation( $.art );
2378
+ return this.exit_();
2379
+ }
2380
+ }
2381
+ extendService($,$next) {
2382
+ this.rule_(253,$next);
2383
+ let name; let _;
2384
+ for(;;) switch(this.s) {
2385
+ case 253: if(this.mk(254,'service')) { $.art.expectedKind = this.valueWithLocation(); } continue;
2386
+ case 254: if(this.namePath(_={category:'ExtService'},255)) {name=_.name; $.art.name = name; $.outer.extensions.push( $.art ); } continue;
2387
+ case 255: switch(this.lk()) {
2388
+ case 'with': this.ck(256); continue;
2389
+ default: this.s=256; continue;
2390
+ }
2391
+ case 256: this.s=257;{ this.docComment( $.art ); } continue;
2392
+ case 257: switch(this.l()) {
2393
+ case '@': this.annoAssignStd({art:$.art},257); continue;
2394
+ default: this.s=258; continue;
2395
+ }
2396
+ case 258: switch(this.l()) {
2397
+ case '{': this.artifactsBlock({art:$.art,start:undefined},0); continue;
2398
+ default: this.gr([';']); continue;
2399
+ }
2400
+ default:
2401
+ this.attachLocation( $.art );
2402
+ return this.exit_();
2403
+ }
2404
+ }
2405
+ extendContext($,$next) {
2406
+ this.rule_(260,$next);
2407
+ let name; let _;
2408
+ for(;;) switch(this.s) {
2409
+ case 260: if(this.mk(261,'context')) { $.art.expectedKind = this.valueWithLocation(); } continue;
2410
+ case 261: if(this.namePath(_={category:'ExtContext'},262)) {name=_.name; $.art.name = name; $.outer.extensions.push( $.art ); } continue;
2411
+ case 262: switch(this.lk()) {
2412
+ case 'with': this.ck(263); continue;
2413
+ default: this.s=263; continue;
2414
+ }
2415
+ case 263: this.s=264;{ this.docComment( $.art ); } continue;
2416
+ case 264: switch(this.l()) {
2417
+ case '@': this.annoAssignStd({art:$.art},264); continue;
2418
+ default: this.s=265; continue;
2419
+ }
2420
+ case 265: switch(this.l()) {
2421
+ case '{': this.artifactsBlock({art:$.art,start:undefined},0); continue;
2422
+ default: this.gr([';']); continue;
2423
+ }
2424
+ default:
2425
+ this.attachLocation( $.art );
2426
+ return this.exit_();
2427
+ }
2428
+ }
2429
+ extendType($,$next) {
2430
+ this.rule_(267,$next);
2431
+ let name; let incl; let elements; let _;
2432
+ for(;;) switch(this.s) {
2433
+ case 267: if(this.mk(268,'type')) { $.art.expectedKind = this.valueWithLocation(); } continue;
2434
+ case 268: if(this.namePath(_={category:'Ext'},269)) {name=_.name; $.art.name = name; $.outer.extensions.push( $.art ); } continue;
2435
+ case 269: switch(this.lk()) {
2436
+ case 'with': if(this.ck(272)) { this.docComment( $.art ); } continue;
2437
+ default: this.s=270;{ this.docComment( $.art ); } continue;
2438
+ }
2439
+ case 270: switch(this.l()) {
2440
+ case '@': this.annoAssignStd({art:$.art},270); continue;
2441
+ default: this.s=271; continue;
2442
+ }
2443
+ case 271: switch(this.l()) {
2444
+ case '{': this.extendElementsBlock({art:$.art,start:undefined},0); continue;
2445
+ default: this.gr([';']); continue;
2446
+ }
2447
+ case 272: switch(this.l()) {
2448
+ case '@': this.annoAssignStd({art:$.art},272); continue;
2449
+ default: this.s=273; continue;
2450
+ }
2451
+ case 273: switch(this.lk()) {
2452
+ case 'Id': if(this.simplePath(_={category:'artref'},274)) {incl=_.ref; $.art.includes = [ incl ]; } continue;
2453
+ case 'elements': if(this.ckP(277,['{'])) elements=this.lb(); continue;
2454
+ case '{': this.s=277; continue;
2455
+ case 'enum': this.lP() && this.enumSymbolsBlock({art:$.art},0); continue;
2456
+ case '(': this.typeNamedArgsList({art:$.art},0); continue;
2457
+ default: this.gi(0,[';']); continue;
2458
+ }
2459
+ case 274: switch(this.l()) {
2460
+ case ',': this.c(275); continue;
2461
+ default: this.s=276; continue;
2462
+ }
2463
+ case 275: if(this.simplePath(_={category:'artref'},274)) {incl=_.ref; $.art.includes.push( incl ); } continue;
2464
+ case 276: switch(this.l()) {
2465
+ case '{': this.extendElementsBlock({art:$.art,start:undefined},0); continue;
2466
+ default: this.gr([';']); continue;
2467
+ }
2468
+ case 277: this.extendElementsBlock({art:$.art,start:elements},0); continue;
2469
+ default:
2470
+ this.attachLocation( $.art );
2471
+ return this.exit_();
2472
+ }
2473
+ }
2474
+ extendEntityOrAspect($,$next) {
2475
+ this.rule_(279,$next);
2476
+ let name; let incl; let _;
2477
+ for(;;) switch(this.s) {
2478
+ case 279: switch(this.lk()) {
2479
+ case 'aspect': case 'entity': if(this.ck(280)) { $.art.expectedKind = this.valueWithLocation(); } continue;
2480
+ default: this.e(); continue;
2481
+ }
2482
+ case 280: if(this.namePath(_={category:'Ext'},281)) {name=_.name; $.art.name = name; $.outer.extensions.push( $.art ); } continue;
2483
+ case 281: switch(this.lk()) {
2484
+ case 'with': if(this.ck(283)) { this.docComment( $.art ); } continue;
2485
+ default: this.s=282;{ this.docComment( $.art ); } continue;
2486
+ }
2487
+ case 282: switch(this.l()) {
2488
+ case '@': this.annoAssignStd({art:$.art},282); continue;
2489
+ default: this.s=287; continue;
2490
+ }
2491
+ case 283: switch(this.l()) {
2492
+ case '@': this.annoAssignStd({art:$.art},283); continue;
2493
+ default: this.s=284; continue;
2494
+ }
2495
+ case 284: switch(this.lk()) {
2496
+ case 'Id': if(this.simplePath(_={category:'artref'},285)) {incl=_.ref; $.art.includes = [ incl ]; } continue;
2497
+ case 'actions': this.gP(287); continue;
2498
+ default: this.gi(287); continue;
2499
+ }
2500
+ case 285: switch(this.l()) {
2501
+ case ',': this.c(286); continue;
2502
+ default: this.s=287; continue;
2503
+ }
2504
+ case 286: if(this.simplePath(_={category:'artref'},285)) {incl=_.ref; $.art.includes.push( incl ); } continue;
2505
+ case 287: switch(this.l()) {
2506
+ case '{': this.extendElementsBlock({art:$.art,start:undefined},288); continue;
2507
+ default: this.s=288; continue;
2508
+ }
2509
+ case 288: switch(this.lk()) {
2510
+ case 'actions': this.actionsBlock({art:$.art},0); continue;
2511
+ default: this.gr([';']); continue;
2512
+ }
2513
+ default:
2514
+ this.attachLocation( $.art );
2515
+ return this.exit_();
2516
+ }
2517
+ }
2518
+ extendProjection($,$next) {
2519
+ this.rule_(290,$next);
2520
+ let name; let _;
2521
+ for(;;) switch(this.s) {
2522
+ case 290: if(this.mk(291,'projection')) { $.art.expectedKind = this.valueWithLocation(); } continue;
2523
+ case 291: if(this.namePath(_={category:'Ext'},292)) {name=_.name; $.art.name = name; $.outer.extensions.push( $.art ); } continue;
2524
+ case 292: switch(this.lk()) {
2525
+ case 'with': this.ck(293); continue;
2526
+ default: this.s=293; continue;
2527
+ }
2528
+ case 293: this.s=294;{ this.docComment( $.art ); } continue;
2529
+ case 294: switch(this.l()) {
2530
+ case '@': this.annoAssignStd({art:$.art},294); continue;
2531
+ default: this.s=295; continue;
2532
+ }
2533
+ case 295: switch(this.l()) {
2534
+ case '{': this.selectItemsList({query:$.art,start:undefined},296); continue;
2535
+ default: this.s=296; continue;
2536
+ }
2537
+ case 296: switch(this.lk()) {
2538
+ case 'actions': this.actionsBlock({art:$.art},0); continue;
2539
+ default: this.gr([';']); continue;
2540
+ }
2541
+ default:
2542
+ this.attachLocation( $.art );
2543
+ return this.exit_();
2544
+ }
2545
+ }
2546
+ annotateActionsBlock($,$next) {
2547
+ this.rule_(298,$next);
2548
+ for(;;) switch(this.s) {
2549
+ case 298: if(this.mk(299,'actions')) { $.art.actions = this.createDict(); } continue;
2550
+ case 299: this.m(300,'{'); continue;
2551
+ case 300: switch(this.l()) {
2552
+ case 'Id': case '@': this.annotateBoundAction({outer:$.art},301); continue;
2553
+ default: this.s=302; continue;
2554
+ }
2555
+ case 301: switch(this.l()) {
2556
+ case ';': this.c(300); continue;
2557
+ case '}': this.s=302; continue;
2558
+ case 'Id': case '@': this.ec('afterBrace') && this.g(300); continue;
2559
+ default: this.e(); continue;
2560
+ }
2561
+ case 302: if(this.m(0,'}')) {this.afterBrace(); this.finalizeExtensionsDict( $.art.actions ); } continue;
2562
+ default: return this.exit_();
2563
+ }
2564
+ }
2565
+ annotateBoundAction($,$next) {
2566
+ this.rule_(304,$next);
2567
+ let art=new XsnArtifact();
2568
+ { this.docComment( art ); }
2569
+ for(;;) switch(this.s) {
2570
+ case 304: switch(this.l()) {
2571
+ case '@': this.annoAssignStd({art},304); continue;
2572
+ default: this.s=305; continue;
2573
+ }
2574
+ case 305: if(this.mi(306,'ExtBoundAction')) { this.addDef( art, $.outer, 'actions', 'annotate', this.identAst() );
2575
+ this.docComment( art ); } continue;
2576
+ case 306: switch(this.l()) {
2577
+ case '@': this.annoAssignStd({art},306); continue;
2578
+ default: this.s=307; continue;
2579
+ }
2580
+ case 307: switch(this.l()) {
2581
+ case '(': this.annotateParamsBlock({art},308); continue;
2582
+ default: this.s=308; continue;
2583
+ }
2584
+ case 308: switch(this.lk()) {
2585
+ case 'returns': this.lP() && this.annotateReturns({outer:art},0); continue;
2586
+ default: this.gr(['Id',';','@','}']); continue;
2587
+ }
2588
+ default:
2589
+ this.attachLocation( art );
2590
+ return this.exit_();
2591
+ }
2592
+ }
2593
+ annotateParamsBlock($,$next) {
2594
+ this.rule_(310,$next);
2595
+ for(;;) switch(this.s) {
2596
+ case 310: if(this.m(311,'(')) { $.art.params = this.createDict(); } continue;
2597
+ case 311: switch(this.l()) {
2598
+ case 'Id': case '@': this.annotateParam({outer:$.art},312); continue;
2599
+ default: this.s=313; continue;
2600
+ }
2601
+ case 312: switch(this.l()) {
2602
+ case ',': this.c(311); continue;
2603
+ case ')': this.s=313; continue;
2604
+ default: this.e(); continue;
2605
+ }
2606
+ case 313: if(this.m(0,')')) { this.finalizeExtensionsDict( $.art.params ); } continue;
2607
+ default: return this.exit_();
2608
+ }
2609
+ }
2610
+ annotateParam($,$next) {
2611
+ this.rule_(315,$next);
2612
+ let art=new XsnArtifact();
2613
+ { this.docComment( art ); }
2614
+ for(;;) switch(this.s) {
2615
+ case 315: switch(this.l()) {
2616
+ case '@': this.annoAssignStd({art},315); continue;
2617
+ default: this.s=316; continue;
2618
+ }
2619
+ case 316: if(this.mi(317,'ExtParam')) { this.addDef( art, $.outer, 'params', 'annotate', this.identAst() );
2620
+ this.docComment( art ); } continue;
2621
+ case 317: switch(this.l()) {
2622
+ case '@': this.annoAssignStd({art},317); continue;
2623
+ default: this.gr([')',',']); continue;
2624
+ }
2625
+ default:
2626
+ this.attachLocation( art );
2627
+ return this.exit_();
2628
+ }
2629
+ }
2630
+ annotateReturns($,$next) {
2631
+ this.rule_(319,$next);
2632
+ let art=new XsnArtifact();
2633
+ for(;;) switch(this.s) {
2634
+ case 319: if(this.mk(320,'returns')) { $.outer.returns = art; art.kind = 'annotate';
2635
+ this.docComment( art ); } continue;
2636
+ case 320: switch(this.l()) {
2637
+ case '@': this.annoAssignStd({art},320); continue;
2638
+ default: this.s=321; continue;
2639
+ }
2640
+ case 321: switch(this.l()) {
2641
+ case '{': this.annotateElementsBlock({art},0); continue;
2642
+ default: this.gr([';']); continue;
2643
+ }
2644
+ default:
2645
+ this.attachLocation( art );
2646
+ return this.exit_();
2647
+ }
2648
+ }
2649
+ annotateElementsBlock($,$next) {
2650
+ this.rule_(323,$next);
2651
+ for(;;) switch(this.s) {
2652
+ case 323: if(this.m(324,'{')) { $.art.elements = this.createDict(); } continue;
2653
+ case 324: switch(this.l()) {
2654
+ case 'Id': case '@': this.annotateElement({outer:$.art},325); continue;
2655
+ default: this.s=326; continue;
2656
+ }
2657
+ case 325: switch(this.l()) {
2658
+ case ';': this.c(324); continue;
2659
+ case '}': this.s=326; continue;
2660
+ case 'Id': case '@': this.ec('afterBrace') && this.g(324); continue;
2661
+ default: this.e(); continue;
2662
+ }
2663
+ case 326: if(this.m(0,'}')) {this.afterBrace(); this.finalizeExtensionsDict( $.art.elements ); } continue;
2664
+ default: return this.exit_();
2665
+ }
2666
+ }
2667
+ annotateElement($,$next) {
2668
+ this.rule_(328,$next);
2669
+ let art=new XsnArtifact();
2670
+ { this.docComment( art ); }
2671
+ for(;;) switch(this.s) {
2672
+ case 328: switch(this.l()) {
2673
+ case '@': this.annoAssignStd({art},328); continue;
2674
+ default: this.s=329; continue;
2675
+ }
2676
+ case 329: if(this.mi(330,'ExtElement')) { this.addDef( art, $.outer, 'elements', 'annotate', this.identAst() );
2677
+ this.docComment( art ); } continue;
2678
+ case 330: switch(this.l()) {
2679
+ case '@': this.annoAssignStd({art},330); continue;
2680
+ default: this.s=331; continue;
2681
+ }
2682
+ case 331: switch(this.l()) {
2683
+ case '{': this.annotateElementsBlock({art},0); continue;
2684
+ default: this.gr(['Id',';','@','}']); continue;
2685
+ }
2686
+ default:
2687
+ this.attachLocation( art );
2688
+ return this.exit_();
2689
+ }
2690
+ }
2691
+ extendElementsBlock($,$next) {
2692
+ this.rule_(333,$next);
2693
+ for(;;) switch(this.s) {
2694
+ case 333: if(this.m(334,'{')) { $.art.elements = this.createDict( $.start ); } continue;
2695
+ case 334: switch(this.l()) {
2696
+ case 'Id': case '@': this.elementDefOrExtend({outer:$.art},335); continue;
2697
+ default: this.s=336; continue;
2698
+ }
2699
+ case 335: switch(this.l()) {
2700
+ case ';': this.c(334); continue;
2701
+ case '}': this.s=336; continue;
2702
+ case 'Id': case '@': this.ec('afterBrace') && this.g(334); continue;
2703
+ default: this.e(); continue;
2704
+ }
2705
+ case 336: if(this.m(0,'}')) {this.afterBrace(); this.finalizeExtensionsDict( $.art.elements ); } continue;
2706
+ default: return this.exit_();
2707
+ }
2708
+ }
2709
+ elementDefOrExtend($,$next) {
2710
+ this.rule_(338,$next);
2711
+ let art=new XsnArtifact();
2712
+ let elements;
2713
+ { this.docComment( art ); }
2714
+ for(;;) switch(this.s) {
2715
+ case 338: switch(this.l()) {
2716
+ case '@': this.annoAssignStd({art},338); continue;
2717
+ default: this.s=339; continue;
2718
+ }
2719
+ case 339: switch(this.lk()) {
2720
+ case 'Id': case '@': case 'key': this.elementDef({outer:$.outer,art},0); continue;
2721
+ case 'extend': this.ckP(340,['Id']); continue;
2722
+ default: this.ei(); continue;
2723
+ }
2724
+ case 340: switch(this.lk()) {
2725
+ case 'element': if(this.ckP(341,['Id'])) { art.expectedKind = this.valueWithLocation(); } continue;
2726
+ default: this.s=341; continue;
2727
+ }
2728
+ case 341: if(this.mi(342,'ExtElement')) { this.addDef( art, $.outer, 'elements', 'extend', this.identAst() ); } continue;
2729
+ case 342: switch(this.lk()) {
2730
+ case 'with': if(this.ck(345)) { this.docComment( art ); } continue;
2731
+ default: this.s=343;{ this.docComment( art ); } continue;
2732
+ }
2733
+ case 343: switch(this.l()) {
2734
+ case '@': this.annoAssignStd({art},343); continue;
2735
+ default: this.s=344; continue;
2736
+ }
2737
+ case 344: switch(this.l()) {
2738
+ case '{': this.extendElementsBlock({art,start:undefined},0); continue;
2739
+ default: this.gr(['Id',';','@','}','key']); continue;
2740
+ }
2741
+ case 345: switch(this.l()) {
2742
+ case '@': this.annoAssignStd({art},345); continue;
2743
+ default: this.s=346; continue;
2744
+ }
2745
+ case 346: switch(this.lk()) {
2746
+ case 'elements': if(this.ck(347)) elements=this.lb(); continue;
2747
+ case '{': this.s=347; continue;
2748
+ case 'enum': this.enumSymbolsBlock({art},0); continue;
2749
+ case '(': this.typeNamedArgsList({art},0); continue;
2750
+ default: this.gr(['Id',';','@','}','key']); continue;
2751
+ }
2752
+ case 347: this.extendElementsBlock({art,start:elements},0); continue;
2753
+ default: return this.exit_();
2754
+ }
2755
+ }
2756
+ typeOrIncludesSpec($,$next) {
2757
+ this.rule_(349,$next);
2758
+ let ref; let _;
2759
+ for(;;) switch(this.s) {
2760
+ case 349: switch(this.l()) {
2761
+ case '{': this.elementsBlock({art:$.art},350); continue;
2762
+ case ':': this.c(351); continue;
2763
+ default: this.e(); continue;
2764
+ }
2765
+ case 350: switch(this.lk()) {
2766
+ case 'not': case 'null': this.nullability({art:$.art},0); continue;
2767
+ default: this.gr([';']); continue;
2768
+ }
2769
+ case 351: switch(this.lk()) {
2770
+ case '{': case 'many': case 'type': case 'array': case 'localized': case 'association': case 'composition': this.lP() && this.typeExpression({art:$.art},0); continue;
2771
+ case 'Id': if(this.simplePath(_={category:'artref'},352)) {ref=_.ref; $.art.type = ref; } continue;
2772
+ default: this.ei(); continue;
2773
+ }
2774
+ case 352: switch(this.lk()) {
2775
+ case '(': case ':': this.typeRefOptArgs({art:$.art},353,410); continue;
2776
+ case '@': case 'not': case 'enum': case 'null': case 'default': this.typeExpression({art:$.art},0,362); continue;
2777
+ case ',': case '{': this.s=354;{ $.art.includes = [ $.art.type ]; delete $.art.type; } continue;
2778
+ default: if(this.gr([';'])) { this.docComment( $.art ); } continue;
2779
+ }
2780
+ case 353: switch(this.lk()) {
2781
+ case '@': case 'not': case 'enum': case 'null': case 'default': this.typeExpression({art:$.art},0,362); continue;
2782
+ default: if(this.gr([';'])) { this.docComment( $.art ); } continue;
2783
+ }
2784
+ case 354: switch(this.l()) {
2785
+ case ',': this.c(355); continue;
2786
+ default: this.s=357; continue;
2787
+ }
2788
+ case 355: switch(this.l()) {
2789
+ case 'Id': if(this.simplePath(_={category:'artref'},356)) {ref=_.ref; $.art.includes.push( ref ); } continue;
2790
+ default: this.s=357; continue;
2791
+ }
2792
+ case 356: switch(this.l()) {
2793
+ case ',': this.c(355); continue;
2794
+ case '{': this.s=357; continue;
2795
+ default: this.e(); continue;
2796
+ }
2797
+ case 357: this.elementsBlock({art:$.art},358); continue;
2798
+ case 358: switch(this.lk()) {
2799
+ case 'not': case 'null': this.nullability({art:$.art},0); continue;
2800
+ default: this.gr([';']); continue;
2801
+ }
2802
+ default: return this.exit_();
2803
+ }
2804
+ }
2805
+ typeExpression($,$next,$startState) {
2806
+ this.rule_($startState??360,$next);
2807
+ let assoc; let card; let target; let cond; let _;
2808
+ for(;;) switch(this.s) {
2809
+ case 360: switch(this.lk()) {
2810
+ case '{': this.elementsBlock({art:$.art},361); continue;
2811
+ case 'Id': this.typeRefOptArgs({art:$.art},362); continue;
2812
+ case 'type': this.lP() && this.typeTypeOf({art:$.art},362); continue;
2813
+ case 'localized': if(this.ckP(370,['Id'])) { $.art.localized = this.valueWithLocation( true ); } continue;
2814
+ case 'association': if(this.ckP(374,['[','to'])) assoc=this.lb(); continue;
2815
+ case 'composition': if(this.ckP(383,['[','of'])) assoc=this.lb(); continue;
2816
+ case 'array': this.ckP(393,['of']); continue;
2817
+ case 'many': if(this.ckP(394,['Id','{'])) { $.art.items = { location: this.lb().location }; } continue;
2818
+ default: this.ei(); continue;
2819
+ }
2820
+ case 361: switch(this.lk()) {
2821
+ case 'not': case 'null': this.nullability({art:$.art},0); continue;
2822
+ default: this.gr([]); continue;
2823
+ }
2824
+ case 362: switch(this.lk()) {
2825
+ case 'not': case 'null': this.nullability({art:$.art},363); continue;
2826
+ default: this.s=363; continue;
2827
+ }
2828
+ case 363: this.s=364;{ this.calcOrDefaultRestriction(); } continue;
2829
+ case 364: switch(this.lk()) {
2830
+ case 'not': case 'null': case 'default': if(this.nullabilityAndDefault({art:$.art},365)) { this.docComment( $.art ); } continue;
2831
+ case 'enum': this.enumSymbolsBlock({art:$.art},366); continue;
2832
+ case '@': this.s=367;{ this.docComment( $.art ); } continue;
2833
+ default: if(this.gr([])) { this.docComment( $.art ); } continue;
2834
+ }
2835
+ case 365: switch(this.l()) {
2836
+ case '@': this.annoAssignStd({art:$.art},365); continue;
2837
+ default: this.gr([]); continue;
2838
+ }
2839
+ case 366: switch(this.lk()) {
2840
+ case 'not': case 'null': case 'default': this.nullabilityAndDefault({art:$.art},0); continue;
2841
+ default: this.gr([]); continue;
2842
+ }
2843
+ case 367: switch(this.l()) {
2844
+ case '@': this.annoAssignStd({art:$.art},367); continue;
2845
+ default: this.s=368; continue;
2846
+ }
2847
+ case 368: switch(this.lk()) {
2848
+ case 'enum': if(this.enumSymbolsBlock({art:$.art},369)) { this.calcOrDefaultRestriction(); } continue;
2849
+ default: this.gr([]); continue;
2850
+ }
2851
+ case 369: switch(this.lk()) {
2852
+ case 'not': case 'null': case 'default': this.nullabilityAndDefault({art:$.art},0); continue;
2853
+ default: this.gr([]); continue;
2854
+ }
2855
+ case 370: if(this.typeRefOptArgs({art:$.art},371)) { this.calcOrDefaultRestriction(); } continue;
2856
+ case 371: switch(this.lk()) {
2857
+ case 'not': case 'null': case 'default': this.nullabilityAndDefault({art:$.art},372); continue;
2858
+ default: this.s=372; continue;
2859
+ }
2860
+ case 372: this.s=373;{ this.docComment( $.art ); } continue;
2861
+ case 373: switch(this.l()) {
2862
+ case '@': this.annoAssignStd({art:$.art},373); continue;
2863
+ default: this.gr([]); continue;
2864
+ }
2865
+ case 374: switch(this.l()) {
2866
+ case '[': this.cardinality({art:$.art},375); continue;
2867
+ default: this.s=375; continue;
2868
+ }
2869
+ case 375: this.mk(376,'to'); continue;
2870
+ case 376: switch(this.lk()) {
2871
+ case 'one': case 'many': if(this.ckP(377,['Id'])) card=this.lb(); continue;
2872
+ default: this.s=377; continue;
2873
+ }
2874
+ case 377: if(this.simplePath(_={category:'artref'},378)) {target=_.ref; this.setAssocAndComposition( $.art, assoc, card, target );
2875
+ this.calcOrDefaultRestriction(false,true); } continue;
2876
+ case 378: switch(this.lk()) {
2877
+ case 'on': this.ck(379); continue;
2878
+ case '{': this.foreignKeysBlock({art:$.art},380); continue;
2879
+ default: this.s=380; continue;
2880
+ }
2881
+ case 379: if(this.condition(_={},381)) {cond=_.expr; $.art.on = cond; } continue;
2882
+ case 380: switch(this.lk()) {
2883
+ case 'not': case 'null': case 'default': this.nullabilityAndDefault({art:$.art},381); continue;
2884
+ default: this.s=381; continue;
2885
+ }
2886
+ case 381: this.s=382;{ this.docComment( $.art ); } continue;
2887
+ case 382: switch(this.l()) {
2888
+ case '@': this.annoAssignStd({art:$.art},382); continue;
2889
+ default: this.gr([]); continue;
2890
+ }
2891
+ case 383: switch(this.l()) {
2892
+ case '[': this.cardinality({art:$.art},384); continue;
2893
+ default: this.s=384; continue;
2894
+ }
2895
+ case 384: this.mk(385,'of'); continue;
2896
+ case 385: switch(this.lk()) {
2897
+ case 'one': case 'many': if(this.ckP(386,['Id','{'])) card=this.lb(); continue;
2898
+ default: this.s=386; continue;
2899
+ }
2900
+ case 386: switch(this.l()) {
2901
+ case 'Id': if(this.simplePath(_={category:'artref'},387)) {target=_.ref; this.setAssocAndComposition( $.art, assoc, card, target );
2902
+ this.calcOrDefaultRestriction(false,true); } continue;
2903
+ case '{': this.s=392;{ target = {}; this.setAssocAndComposition( $.art, assoc, card, target ); } continue;
2904
+ default: this.e(); continue;
2905
+ }
2906
+ case 387: switch(this.lk()) {
2907
+ case 'on': this.ck(388); continue;
2908
+ case '{': this.foreignKeysBlock({art:$.art},389); continue;
2909
+ default: this.s=389; continue;
2910
+ }
2911
+ case 388: if(this.condition(_={},390)) {cond=_.expr; $.art.on = cond; } continue;
2912
+ case 389: switch(this.lk()) {
2913
+ case 'not': case 'null': case 'default': this.nullabilityAndDefault({art:$.art},390); continue;
2914
+ default: this.s=390; continue;
2915
+ }
2916
+ case 390: this.s=391;{ this.docComment( $.art ); } continue;
2917
+ case 391: switch(this.l()) {
2918
+ case '@': this.annoAssignStd({art:$.art},391); continue;
2919
+ default: this.gr([]); continue;
2920
+ }
2921
+ case 392: if(this.elementsBlock({art:target},0)) { target.location = target.elements[Symbol.for('cds.$location')]; } continue;
2922
+ case 393: if(this.mk(394,'of')) { $.art.items = { location: this.locationOfPrevTokens( 2 ) }; } continue;
2923
+ case 394: switch(this.lk()) {
2924
+ case '{': this.elementsBlock({art:$.art.items},395); continue;
2925
+ case 'Id': this.typeRefOptArgs({art:$.art.items},396); continue;
2926
+ case 'type': this.lP() && this.typeTypeOf({art:$.art.items},396); continue;
2927
+ default: this.ei(); continue;
2928
+ }
2929
+ case 395: switch(this.lk()) {
2930
+ case 'not': case 'null': this.nullability({art:$.art.items},0); continue;
2931
+ default: this.gr([]); continue;
2932
+ }
2933
+ case 396: switch(this.lk()) {
2934
+ case 'not': case 'null': this.nullability({art:$.art.items},397); continue;
2935
+ default: this.s=397; continue;
2936
+ }
2937
+ case 397: switch(this.lk()) {
2938
+ case 'enum': this.enumSymbolsBlock({art:$.art.items},398); continue;
2939
+ default: this.s=399;{ this.docComment( $.art ); } continue;
2940
+ }
2941
+ case 398: switch(this.lk()) {
2942
+ case 'not': case 'null': this.nullability({art:$.art.items},0); continue;
2943
+ default: this.gr([]); continue;
2944
+ }
2945
+ case 399: switch(this.l()) {
2946
+ case '@': this.annoAssignStd({art:$.art},399); continue;
2947
+ default: this.gr([]); continue;
2948
+ }
2949
+ default: return this.exit_();
2950
+ }
2951
+ }
2952
+ typeTypeOf($,$next) {
2953
+ this.rule_(401,$next);
2954
+ let location;
2955
+ let type; let _;
2956
+ for(;;) switch(this.s) {
2957
+ case 401: this.mk(402,'type'); continue;
2958
+ case 402: if(this.mk(403,'of')) { location = this.locationOfPrevTokens( 2 ); } continue;
2959
+ case 403: if(this.simplePath(_={category:'ref'},404)) {type=_.ref; $.art.type = type; } continue;
2960
+ case 404: switch(this.l()) {
2961
+ case ':': if(this.c(405)) { type.scope = type.path.length; } continue;
2962
+ default: if(this.gr(['@'])) { type.scope = 'typeOf'; type.path.unshift( { id: 'type of', location } ); } continue;
2963
+ }
2964
+ case 405: if(this.miA(406,'ref')) { type.path.push( this.identAst() ); } continue;
2965
+ case 406: switch(this.l()) {
2966
+ case '.': this.c(407); continue;
2967
+ default: this.gr(['@']); continue;
2968
+ }
2969
+ case 407: if(this.miA(406,'ref')) { type.path.push( this.identAst() ); } continue;
2970
+ default: return this.exit_();
2971
+ }
2972
+ }
2973
+ typeRefOptArgs($,$next,$startState) {
2974
+ this.rule_($startState??409,$next);
2975
+ let type=$.art.type;
2976
+ let open; let tok; let _;
2977
+ for(;;) switch(this.s) {
2978
+ case 409: if(this.simplePath(_={category:'artref'},410)) {type=_.ref; $.art.type = type; } continue;
2979
+ case 410: switch(this.l()) {
2980
+ case ':': if(this.c(411)) { type.scope = type.path.length; } continue;
2981
+ case '(': if(this.c(414)) open=this.lb(); continue;
2982
+ default: this.gr([]); continue;
2983
+ }
2984
+ case 411: if(this.miA(412,'ref')) { type.path.push( this.identAst() ); } continue;
2985
+ case 412: switch(this.l()) {
2986
+ case '.': this.c(413); continue;
2987
+ default: this.gr([]); continue;
2988
+ }
2989
+ case 413: if(this.miA(412,'ref')) { type.path.push( this.identAst() ); } continue;
2990
+ case 414: switch(this.lk()) {
2991
+ case 'Number': if(this.c(415)) { $.art.$typeArgs = this.createArray( open );
2992
+ $.art.$typeArgs.push( this.unsignedIntegerLiteral() ); } continue;
2993
+ case 'Id': this.s=417;{ $.art.$typeArgs = this.createDict( open ); } continue;
2994
+ default: this.ei(); continue;
2995
+ }
2996
+ case 415: switch(this.l()) {
2997
+ case ',': this.c(416); continue;
2998
+ default: this.s=419; continue;
2999
+ }
3000
+ case 416: switch(this.lk()) {
3001
+ case 'Number': if(this.c(415)) { $.art.$typeArgs.push( this.unsignedIntegerLiteral() ); } continue;
3002
+ case 'floating': case 'variable': if(this.ck(415)) {tok=this.lb(); $.art.$typeArgs.push( { literal: 'string', val: tok.keyword, location: tok.location } ); } continue;
3003
+ case ')': this.s=419; continue;
3004
+ default: this.e(); continue;
3005
+ }
3006
+ case 417: switch(this.l()) {
3007
+ case 'Id': this.typeNamedArg({art:$.art},418); continue;
3008
+ default: this.s=419; continue;
3009
+ }
3010
+ case 418: switch(this.l()) {
3011
+ case ',': this.c(417); continue;
3012
+ case ')': this.s=419; continue;
3013
+ default: this.e(); continue;
3014
+ }
3015
+ case 419: if(this.m(0,')')) { this.finalizeDictOrArray( $.art.$typeArgs ); } continue;
3016
+ default: return this.exit_();
3017
+ }
3018
+ }
3019
+ typeNamedArgsList($,$next) {
3020
+ this.rule_(421,$next);
3021
+ for(;;) switch(this.s) {
3022
+ case 421: if(this.m(422,'(')) { $.art.$typeArgs = this.createDict(); } continue;
3023
+ case 422: switch(this.l()) {
3024
+ case 'Id': this.typeNamedArg({art:$.art},423); continue;
3025
+ default: this.s=424; continue;
3026
+ }
3027
+ case 423: switch(this.l()) {
3028
+ case ',': this.c(422); continue;
3029
+ case ')': this.s=424; continue;
3030
+ default: this.e(); continue;
3031
+ }
3032
+ case 424: if(this.m(0,')')) { this.finalizeDictOrArray( $.art.$typeArgs ); } continue;
3033
+ default: return this.exit_();
3034
+ }
3035
+ }
3036
+ typeNamedArg($,$next) {
3037
+ this.rule_(426,$next);
3038
+ let name; let tok;
3039
+ for(;;) switch(this.s) {
3040
+ case 426: if(this.mi(427,'typeparamname')) name=this.lb(); continue;
3041
+ case 427: this.m(428,':'); continue;
3042
+ case 428: switch(this.lk()) {
3043
+ case 'Number': if(this.c(0)) { this.setTypeFacet( $.art, name, this.unsignedIntegerLiteral() ); } continue;
3044
+ case 'floating': case 'variable': if(this.ck(0)) {tok=this.lb(); this.setTypeFacet( $.art, name, { literal: 'string', val: tok.keyword, location: tok.location } ); } continue;
3045
+ default: this.e(); continue;
3046
+ }
3047
+ default: return this.exit_();
3048
+ }
3049
+ }
3050
+ cardinality($,$next) {
3051
+ this.rule_(430,$next);
3052
+ let card={};
3053
+ for(;;) switch(this.s) {
3054
+ case 430: this.m(431,'['); continue;
3055
+ case 431: switch(this.l()) {
3056
+ case '*': if(this.c(432)) { card.targetMax = this.valueWithLocation(); } continue;
3057
+ case 'Number': if(this.c(434)) { card.targetMax = this.unsignedIntegerLiteral(); } continue;
3058
+ default: this.s=436;{ card.targetMax = this.valueWithLocation( '*' ); } continue;
3059
+ }
3060
+ case 432: switch(this.l()) {
3061
+ case ',': this.c(433); continue;
3062
+ default: this.s=436; continue;
3063
+ }
3064
+ case 433: this.targetCardinality({card,atAlt:false},436); continue;
3065
+ case 434: switch(this.l()) {
3066
+ case ',': this.c(435); continue;
3067
+ case '..': this.targetCardinality({card,atAlt:true},436,439); continue;
3068
+ default: this.s=436; continue;
3069
+ }
3070
+ case 435: this.targetCardinality({card,atAlt:false},436); continue;
3071
+ case 436: this.m(0,']'); continue;
3072
+ default:
3073
+ $.art.cardinality = this.attachLocation(card);
3074
+ return this.exit_();
3075
+ }
3076
+ }
3077
+ targetCardinality($,$next,$startState) {
3078
+ this.rule_($startState??438,$next);
3079
+ { if (!$.atAlt) $.card.sourceMax = $.card.targetMax; }
3080
+ for(;;) switch(this.s) {
3081
+ case 438: switch(this.l()) {
3082
+ case '*': if(this.c(0)) { $.card.targetMax = this.valueWithLocation(); } continue;
3083
+ case 'Number': if(this.c(439)) { $.card.targetMax = this.unsignedIntegerLiteral(); } continue;
3084
+ default: this.e(); continue;
3085
+ }
3086
+ case 439: switch(this.l()) {
3087
+ case '..': if(this.c(440)) { $.card.targetMin = $.card.targetMax; } continue;
3088
+ default: this.gr([']']); continue;
3089
+ }
3090
+ case 440: switch(this.l()) {
3091
+ case '*': if(this.c(0)) { $.card.targetMax = this.valueWithLocation(); } continue;
3092
+ case 'Number': if(this.c(0)) { $.card.targetMax = this.unsignedIntegerLiteral(); } continue;
3093
+ default: this.e(); continue;
3094
+ }
3095
+ default: return this.exit_();
3096
+ }
3097
+ }
3098
+ nullabilityAndDefault($,$next) {
3099
+ this.rule_(442,$next);
3100
+ let expr; let _;
3101
+ for(;;) switch(this.s) {
3102
+ case 442: switch(this.lk()) {
3103
+ case 'not': case 'null': this.nullability({art:$.art},443); continue;
3104
+ case 'default': this.ec('calcOrDefaultRestriction') && this.ck(445); continue;
3105
+ default: this.e(); continue;
3106
+ }
3107
+ case 443: switch(this.lk()) {
3108
+ case 'default': this.gc(0,'calcOrDefaultRestriction') && this.ck(444); continue;
3109
+ default: this.gr([]); continue;
3110
+ }
3111
+ case 444: if(this.expression(_={},0)) {expr=_.expr; $.art.default = expr; } continue;
3112
+ case 445: if(this.expression(_={},446)) {expr=_.expr; $.art.default = expr; } continue;
3113
+ case 446: switch(this.lk()) {
3114
+ case 'not': case 'null': this.nullability({art:$.art},0); continue;
3115
+ default: this.gr([]); continue;
3116
+ }
3117
+ default: return this.exit_();
3118
+ }
3119
+ }
3120
+ nullability($,$next) {
3121
+ this.rule_(448,$next);
3122
+ for(;;) switch(this.s) {
3123
+ case 448: switch(this.lk()) {
3124
+ case 'null': if(this.ck(0)) { this.setNullability( $.art, false ); } continue;
3125
+ case 'not': this.ck(449); continue;
3126
+ default: this.e(); continue;
3127
+ }
3128
+ case 449: if(this.mk(0,'null')) { this.setNullability( $.art, true, this.locationOfPrevTokens( 2 ) ); } continue;
3129
+ default: return this.exit_();
3130
+ }
3131
+ }
3132
+ queryEOF($,$next) {
3133
+ $.query??=undefined;
3134
+ this.rule_(451,$next);
3135
+ let _;
3136
+ for(;;) switch(this.s) {
3137
+ case 451: if(this.queryExpression(_={},452)) $.query=_.expr; continue;
3138
+ case 452: switch(this.l()) {
3139
+ case ';': this.c(453); continue;
3140
+ default: this.s=453; continue;
3141
+ }
3142
+ case 453: this.m(0,'EOF'); continue;
3143
+ default: return this.exit_();
3144
+ }
3145
+ }
3146
+ projectionSpec($,$next) {
3147
+ $.query??={};
3148
+ this.rule_(455,$next);
3149
+ let tab; let _;
3150
+ for(;;) switch(this.s) {
3151
+ case 455: if(this.mk(456,'projection')) { $.query = { op: this.valueWithLocation( 'SELECT' ) }; } continue;
3152
+ case 456: this.mk(457,'on'); continue;
3153
+ case 457: if(this.fromRefWithOptAlias(_={},458)) {tab=_.expr; this.afterBrace();
3154
+ $.query.from = tab; } continue;
3155
+ case 458: switch(this.l()) {
3156
+ case '{': this.selectItemsList({query:$.query,start:undefined},459); continue;
3157
+ default: this.s=459; continue;
3158
+ }
3159
+ case 459: switch(this.lk()) {
3160
+ case 'excluding': this.excludingClause({query:$.query},0); continue;
3161
+ default: this.gr([';']); continue;
3162
+ }
3163
+ default:
3164
+ this.attachLocation($.query);
3165
+ return this.exit_();
3166
+ }
3167
+ }
3168
+ queryExpression($,$next,$startState) {
3169
+ $.expr??={};
3170
+ this.rule_($startState??461,$next);
3171
+ let op; let quantifier;
3172
+ let query; let _;
3173
+ for(;;) switch(this.s) {
3174
+ case 461: switch(this.l()) {
3175
+ case '(': this.c(462); continue;
3176
+ case 'Id': if(this.selectQuery(_={},464)) $.expr=_.query; continue;
3177
+ default: this.e(); continue;
3178
+ }
3179
+ case 462: this.queryExpression($,463); continue;
3180
+ case 463: if(this.m(464,')')) { this.surroundByParens( $.expr ); } continue;
3181
+ case 464: switch(this.lk()) {
3182
+ case 'intersect': if(this.gp(468,4) && this.ck(465)) { op = this.valueWithLocation(); } continue;
3183
+ case 'minus': case 'except': if(this.gp(468,2) && this.ck(465)) { op = this.valueWithLocation(); } continue;
3184
+ case 'union': if(this.gp(468,2) && this.ck(466)) { op = this.valueWithLocation(); } continue;
3185
+ default: this.s=468; continue;
3186
+ }
3187
+ case 465: switch(this.lk()) {
3188
+ case 'distinct': if(this.ck(467)) { quantifier = this.valueWithLocation(); } continue;
3189
+ default: this.s=467; continue;
3190
+ }
3191
+ case 466: switch(this.lk()) {
3192
+ case 'all': case 'distinct': if(this.ck(467)) { quantifier = this.valueWithLocation(); } continue;
3193
+ default: this.s=467; continue;
3194
+ }
3195
+ case 467: if(this.queryExpression(_={},464)) {query=_.expr; if ($.expr.$parens || op.val !== $.expr.op.val || quantifier?.val !== $.expr.quantifier?.val) $.expr = { op, args: [$.expr], quantifier };
3196
+ quantifier = undefined;
3197
+ $.expr.args.push( query ); this.attachLocation( $.expr ); } continue;
3198
+ case 468: switch(this.lk()) {
3199
+ case 'limit': case 'order': if(this.gp(0,0,'post') && this.g(469)) { if ($.expr.$parens) { this.attachLocation( $.expr ); $.expr = { op: this.valueWithLocation( '$query', this.la() ), args: [ $.expr ] }; } } continue;
3200
+ default: this.gr([]); continue;
3201
+ }
3202
+ case 469: this.orderByLimitOffset({query:$.expr},0); continue;
3203
+ default:
3204
+ this.attachLocation( $.expr );
3205
+ return this.exit_();
3206
+ }
3207
+ }
3208
+ selectQuery($,$next) {
3209
+ $.query??={};
3210
+ this.rule_(471,$next);
3211
+ for(;;) switch(this.s) {
3212
+ case 471: if(this.mk(472,'select')) { $.query = { op: this.valueWithLocation( 'SELECT' ) }; } continue;
3213
+ case 472: switch(this.lk()) {
3214
+ case 'from': this.ck(473); continue;
3215
+ case 'all': case 'distinct': if(this.ckP(483,['Id','#','(','*','+','-',':','?','@','{','key','not','case','cast','null','true','false','Number','String','exists','QuotedLiteral'])) { $.query.quantifier = this.valueWithLocation(); } continue;
3216
+ case 'Id': case '#': case '(': case '*': case '+': case '-': case ':': case '?': case '@': case '{': case 'key': case 'not': case 'case': case 'cast': case 'null': case 'true': case 'false': case 'Number': case 'String': case 'exists': case 'QuotedLiteral': this.s=483; continue;
3217
+ default: this.ei(); continue;
3218
+ }
3219
+ case 473: this.querySource({query:$.query},474); continue;
3220
+ case 474: switch(this.lk()) {
3221
+ case 'mixin': this.ck(475); continue;
3222
+ default: this.s=480; continue;
3223
+ }
3224
+ case 475: if(this.m(476,'{')) { $.query.mixin = this.createDict(); } continue;
3225
+ case 476: switch(this.l()) {
3226
+ case 'Id': this.mixinElementDef({outer:$.query},477); continue;
3227
+ default: this.s=478; continue;
3228
+ }
3229
+ case 477: switch(this.l()) {
3230
+ case ';': this.c(476); continue;
3231
+ case '}': this.s=478; continue;
3232
+ default: this.e(); continue;
3233
+ }
3234
+ case 478: if(this.m(479,'}')) { this.finalizeDictOrArray( $.query.mixin ); } continue;
3235
+ case 479: this.mk(480,'into'); continue;
3236
+ case 480: switch(this.lk()) {
3237
+ case 'all': case 'distinct': if(this.ck(481)) { $.query.quantifier = this.valueWithLocation(); } continue;
3238
+ default: this.s=481; continue;
3239
+ }
3240
+ case 481: switch(this.l()) {
3241
+ case '{': this.selectItemsList({query:$.query,start:undefined},482); continue;
3242
+ default: this.s=482; continue;
3243
+ }
3244
+ case 482: switch(this.lk()) {
3245
+ case 'excluding': this.excludingClause({query:$.query},488); continue;
3246
+ default: this.s=488; continue;
3247
+ }
3248
+ case 483: switch(this.l()) {
3249
+ case '*': if(this.c(484)) { $.query.columns = [ this.valueWithLocation() ]; } continue;
3250
+ case 'Id': case '#': case '(': case '+': case '-': case ':': case '?': case '@': case '{': case 'Number': case 'String': case 'QuotedLiteral': this.selectItemDef({columns:($.query.columns = [])},484); continue;
3251
+ default: this.e(); continue;
3252
+ }
3253
+ case 484: switch(this.l()) {
3254
+ case ',': this.c(485); continue;
3255
+ default: this.s=486; continue;
3256
+ }
3257
+ case 485: switch(this.l()) {
3258
+ case '*': if(this.c(484)) { $.query.columns.push( this.valueWithLocation() ); } continue;
3259
+ case 'Id': case '#': case '(': case '+': case '-': case ':': case '?': case '@': case '{': case 'Number': case 'String': case 'QuotedLiteral': this.selectItemDef({columns:$.query.columns},484); continue;
3260
+ default: this.e(); continue;
3261
+ }
3262
+ case 486: this.mk(487,'from'); continue;
3263
+ case 487: this.querySource({query:$.query},488); continue;
3264
+ case 488: switch(this.lk()) {
3265
+ case 'group': case 'where': case 'having': this.whereGroupByHaving({query:$.query},0); continue;
3266
+ default: this.gr(['limit','minus','order','union','except','intersect']); continue;
3267
+ }
3268
+ default:
3269
+ this.attachLocation($.query);
3270
+ return this.exit_();
3271
+ }
3272
+ }
3273
+ querySource($,$next) {
3274
+ this.rule_(490,$next);
3275
+ let tab; let _;
3276
+ for(;;) switch(this.s) {
3277
+ case 490: if(this.tableExpression(_={},491)) {tab=_.expr; $.query.from = tab; } continue;
3278
+ case 491: switch(this.l()) {
3279
+ case ',': this.s=492;{ const { location } = this.la();
3280
+ $.query.from = { op: { val: 'join', location }, join: { val: 'cross', location }, args: [tab] }; } continue;
3281
+ default: this.gr(['group','limit','minus','order','union','where','except','having','intersect']); continue;
3282
+ }
3283
+ case 492: switch(this.l()) {
3284
+ case ',': this.c(493); continue;
3285
+ default: this.gr(['group','limit','minus','order','union','where','except','having','intersect']); continue;
3286
+ }
3287
+ case 493: if(this.tableExpression(_={},492)) {tab=_.expr; $.query.from.args.push( tab ); } continue;
3288
+ case 0:
3289
+ this.attachLocation($.query.from);
3290
+ default: return this.exit_();
3291
+ }
3292
+ }
3293
+ tableExpression($,$next,$startState) {
3294
+ $.expr??=undefined;
3295
+ this.rule_($startState??495,$next);
3296
+ let join; let tab; let card; let cond; let _;
3297
+ for(;;) switch(this.s) {
3298
+ case 495: switch(this.l()) {
3299
+ case '(': this.tableOrQueryParens($,496); continue;
3300
+ case 'Id': this.fromRefWithOptAlias($,497); continue;
3301
+ default: this.e(); continue;
3302
+ }
3303
+ case 496: this.s=497;{ $.expr = this.taggedIfQuery( $.expr ); } continue;
3304
+ case 497: switch(this.lk()) {
3305
+ case 'cross': if(this.ck(498)) join=this.lb(); continue;
3306
+ case 'inner': if(this.ck(501)) join=this.lb(); continue;
3307
+ case 'full': case 'left': case 'right': if(this.ck(500)) join=this.lb(); continue;
3308
+ case 'join': this.s=502; continue;
3309
+ default: if(this.gr([])) { join = undefined; } continue;
3310
+ }
3311
+ case 498: if(this.mk(499,'join')) { if ($.expr?.join?.val !== 'cross' || $.expr.$parens) $.expr = { op: this.valueWithLocation(), join: this.valueWithLocation( undefined, join ), args: [ $.expr ] }; } continue;
3312
+ case 499: switch(this.l()) {
3313
+ case '(': if(this.tableOrQueryParens(_={},497)) {tab=_.expr; $.expr.args.push( this.taggedIfQuery( tab ) );
3314
+ this.attachLocation( $.expr ); } continue;
3315
+ case 'Id': if(this.fromRefWithOptAlias(_={},497)) {tab=_.expr; $.expr.args.push( tab );
3316
+ this.attachLocation( $.expr ); } continue;
3317
+ default: this.e(); continue;
3318
+ }
3319
+ case 500: switch(this.lk()) {
3320
+ case 'outer': this.ck(501); continue;
3321
+ default: this.s=501; continue;
3322
+ }
3323
+ case 501: switch(this.lk()) {
3324
+ case 'one': case 'many': case 'exact': this.joinCardinality(card={},502); continue;
3325
+ default: this.s=502; continue;
3326
+ }
3327
+ case 502: if(this.mk(503,'join')) { $.expr = { op: this.valueWithLocation(), join: this.valueWithLocation( join?.keyword || 'inner', join ), args: [ $.expr ] }; if (card) $.expr.cardinality = card; card = undefined;
3328
+ join = undefined; } continue;
3329
+ case 503: if(this.tableExpression(_={},504)) {tab=_.expr; $.expr.args.push( tab ); this.attachLocation( $.expr ); } continue;
3330
+ case 504: this.mk(505,'on'); continue;
3331
+ case 505: if(this.condition(_={},497)) {cond=_.expr; $.expr.on = cond;
3332
+ this.attachLocation( $.expr ); } continue;
3333
+ default: return this.exit_();
3334
+ }
3335
+ }
3336
+ tableOrQueryParens($,$next) {
3337
+ $.expr??=undefined;
3338
+ this.rule_(507,$next);
3339
+ for(;;) switch(this.s) {
3340
+ case 507: this.m(508,'('); continue;
3341
+ case 508: switch(this.lk()) {
3342
+ case '(': this.tableOrQueryParens($,509); continue;
3343
+ case 'Id': this.ep(-2) && this.tableExpression($,510); continue;
3344
+ case 'select': this.ep(-1) && this.queryExpression($,510); continue;
3345
+ default: this.ei(); continue;
3346
+ }
3347
+ case 509: switch(this.lk()) {
3348
+ case 'full': case 'join': case 'left': case 'cross': case 'inner': case 'right': this.gp(510,-2,'post') && this.tableExpression($,510,496); continue;
3349
+ case 'limit': case 'minus': case 'order': case 'union': case 'except': case 'intersect': this.gp(510,-1,'post') && this.queryExpression($,510,464); continue;
3350
+ default: this.s=510; continue;
3351
+ }
3352
+ case 510: if(this.m(511,')')) { this.surroundByParens( $.expr ); } continue;
3353
+ case 511: switch(this.lk()) {
3354
+ case 'as': this.gp(0,-2,'none') && this.ck(512); continue;
3355
+ case 'Id': if(this.gc(0,'tableAlias') && this.ci(0,'FromAlias')) {this.setPrecInCallingRule(); $.expr = this.taggedIfQuery( $.expr ); $.expr.name = this.fragileAlias(); } continue;
3356
+ default: if(this.gi(0,['full','join','left','cross','inner','right'])) { this.setPrecInCallingRule(); } continue;
3357
+ }
3358
+ case 512: if(this.mi(0,'FromAlias')) {this.setPrecInCallingRule(); $.expr = this.taggedIfQuery( $.expr ); $.expr.name = this.identAst(); } continue;
3359
+ default: return this.exit_();
3360
+ }
3361
+ }
3362
+ joinCardinality($,$next) {
3363
+ $.sourceMax??=undefined; $.targetMax??=undefined;
3364
+ this.rule_(514,$next);
3365
+ for(;;) switch(this.s) {
3366
+ case 514: switch(this.lk()) {
3367
+ case 'exact': if(this.ck(515)) { $.sourceMin = this.valueWithLocation( 1 ); } continue;
3368
+ case 'one': this.s=515; continue;
3369
+ case 'many': if(this.ck(516)) { $.sourceMax = this.valueWithLocation( '*' ); } continue;
3370
+ default: this.e(); continue;
3371
+ }
3372
+ case 515: if(this.mk(516,'one')) { $.sourceMax = this.valueWithLocation( 1 ); } continue;
3373
+ case 516: this.mk(517,'to'); continue;
3374
+ case 517: switch(this.lk()) {
3375
+ case 'exact': if(this.ck(518)) { $.targetMin = this.valueWithLocation( 1 ); } continue;
3376
+ case 'one': this.s=518; continue;
3377
+ case 'many': if(this.ck(0)) { $.targetMax = this.valueWithLocation( '*' ); } continue;
3378
+ default: this.e(); continue;
3379
+ }
3380
+ case 518: if(this.mk(0,'one')) { $.targetMax = this.valueWithLocation( 1 ); } continue;
3381
+ default:
3382
+ this.attachLocation( $ );
3383
+ return this.exit_();
3384
+ }
3385
+ }
3386
+ fromRefWithOptAlias($,$next) {
3387
+ $.expr??={ path: [] };
3388
+ this.rule_(520,$next);
3389
+ for(;;) switch(this.s) {
3390
+ case 520: this.fromPath({table:$.expr,category:'artref'},521); continue;
3391
+ case 521: switch(this.l()) {
3392
+ case ':': if(this.c(522)) { if (!$.expr.scope) $.expr.scope = $.expr.path.length; else {
3393
+ this.warning( 'syntax-invalid-path-separator', this.lb(),
3394
+ { '#': 'colon', code: ':', newcode: '.' } );
3395
+ } } continue;
3396
+ default: this.s=523; continue;
3397
+ }
3398
+ case 522: this.fromPath({table:$.expr,category:'ref'},523); continue;
3399
+ case 523: switch(this.lk()) {
3400
+ case 'as': this.ck(524); continue;
3401
+ case 'Id': if(this.gc(525,'tableAlias') && this.ci(0,'FromAlias')) { $.expr.name = this.fragileAlias(); } continue;
3402
+ default: this.giR(525); continue;
3403
+ }
3404
+ case 524: if(this.mi(0,'FromAlias')) { $.expr.name = this.identAst(); } continue;
3405
+ case 525: if(this.gr([])) { this.classifyImplicitName( $.expr.scope ? 'FromElemImplicit' : 'FromImplicit', $.expr ); } continue;
3406
+ default:
3407
+ this.attachLocation( $.expr );
3408
+ return this.exit_();
3409
+ }
3410
+ }
3411
+ fromPath($,$next) {
3412
+ this.rule_(527,$next);
3413
+ let pathItem;
3414
+ for(;;) switch(this.s) {
3415
+ case 527: if(this.mi(528,$.category)) { $.table.path.push( pathItem = this.identAst() ); } continue;
3416
+ case 528: switch(this.l()) {
3417
+ case '(': case '[': if(this.fromArgumentsAndFilter({pathStep:pathItem},529)) { pathItem = null; } continue;
3418
+ default: this.s=529; continue;
3419
+ }
3420
+ case 529: switch(this.l()) {
3421
+ case '.': if(this.c(530)) { if (!pathItem && !$.table.scope) {
3422
+ $.table.scope = $.table.path.length; $.category = 'ref';
3423
+ this.warning( 'syntax-invalid-path-separator', this.lb(),
3424
+ { '#': 'dot', code: '.', newcode: ':' } );
3425
+ } } continue;
3426
+ default: this.gr(['Id','as']); continue;
3427
+ }
3428
+ case 530: if(this.miA(531,$.category)) { $.table.path.push( pathItem = this.identAst() ); } continue;
3429
+ case 531: switch(this.l()) {
3430
+ case '(': case '[': if(this.fromArgumentsAndFilter({pathStep:pathItem},529)) { pathItem = null; } continue;
3431
+ default: this.s=529; continue;
3432
+ }
3433
+ default:
3434
+ this.attachLocation( $.table.path );
3435
+ return this.exit_();
3436
+ }
3437
+ }
3438
+ fromArgumentsAndFilter($,$next) {
3439
+ this.rule_(533,$next);
3440
+ for(;;) switch(this.s) {
3441
+ case 533: switch(this.l()) {
3442
+ case '(': if(this.c(534)) { $.pathStep.args = this.createDict(); $.pathStep.$syntax = ':'; } continue;
3443
+ default: this.s=538; continue;
3444
+ }
3445
+ case 534: switch(this.lk()) {
3446
+ case 'Id': this.s=535; continue;
3447
+ default: this.ei(); continue;
3448
+ }
3449
+ case 535: switch(this.l()) {
3450
+ case 'Id': this.fromNamedArgument($,536); continue;
3451
+ default: this.s=537; continue;
3452
+ }
3453
+ case 536: switch(this.l()) {
3454
+ case ',': this.c(535); continue;
3455
+ case ')': this.s=537; continue;
3456
+ default: this.e(); continue;
3457
+ }
3458
+ case 537: this.m(538,')'); continue;
3459
+ case 538: switch(this.l()) {
3460
+ case '[': this.cardinalityAndFilter($,0); continue;
3461
+ default: this.gr(['Id','.','as']); continue;
3462
+ }
3463
+ default: return this.exit_();
3464
+ }
3465
+ }
3466
+ fromNamedArgument($,$next) {
3467
+ this.rule_(540,$next);
3468
+ let name; let expr; let _;
3469
+ for(;;) switch(this.s) {
3470
+ case 540: if(this.mi(541,'paramname')) name=this.lb(); continue;
3471
+ case 541: this.m(542,':'); continue;
3472
+ case 542: if(this.expression(_={},0)) {expr=_.expr; this.addDef( expr, $.pathStep, 'args', 0, this.identAst( name ) ); } continue;
3473
+ default: return this.exit_();
3474
+ }
3475
+ }
3476
+ cardinalityAndFilter($,$next) {
3477
+ this.rule_(544,$next);
3478
+ for(;;) switch(this.s) {
3479
+ case 544: this.m(545,'['); continue;
3480
+ case 545: switch(this.l()) {
3481
+ case 'Number': if(this.gc(547,'beforeColon') && this.c(546)) { $.pathStep.cardinality = { targetMax: this.unsignedIntegerLiteral(), location: this.lb().location }; } continue;
3482
+ default: this.s=547; continue;
3483
+ }
3484
+ case 546: this.m(547,':'); continue;
3485
+ case 547: this.filterClauses({pathStep:$.pathStep},548); continue;
3486
+ case 548: this.m(0,']'); continue;
3487
+ default: return this.exit_();
3488
+ }
3489
+ }
3490
+ filterClauses($,$next) {
3491
+ this.rule_(550,$next);
3492
+ let cond; let _;
3493
+ for(;;) switch(this.s) {
3494
+ case 550: switch(this.lk()) {
3495
+ case 'where': this.ck(551); continue;
3496
+ case 'Id': case '#': case '(': case '+': case '-': case ':': case '?': case 'not': case 'case': case 'cast': case 'null': case 'true': case 'false': case 'Number': case 'String': case 'exists': case 'QuotedLiteral': this.s=551; continue;
3497
+ case 'group': case 'limit': case 'order': case 'having': this.gP(552); continue;
3498
+ default: this.gi(552); continue;
3499
+ }
3500
+ case 551: if(this.condition(_={},552)) {cond=_.expr; $.pathStep.where = cond; } continue;
3501
+ case 552: switch(this.lk()) {
3502
+ case 'group': this.s=553;{ this.csnParseOnly('syntax-unexpected-sql-clause', 1, { keyword: 'group by' }); } continue;
3503
+ default: this.s=554; continue;
3504
+ }
3505
+ case 553: this.groupByClause({query:$.pathStep},554); continue;
3506
+ case 554: switch(this.lk()) {
3507
+ case 'having': if(this.ck(555)) { this.csnParseOnly('syntax-unexpected-sql-clause', -1, { keyword: 'having' }); } continue;
3508
+ default: this.s=556; continue;
3509
+ }
3510
+ case 555: if(this.condition(_={},556)) {cond=_.expr; $.pathStep.having = cond; } continue;
3511
+ case 556: switch(this.lk()) {
3512
+ case 'limit': case 'order': this.s=557;{ if (this.lk() === 'limit') this.csnParseOnly('syntax-unexpected-sql-clause', 0, { keyword: 'limit' } ); else this.csnParseOnly('syntax-unexpected-sql-clause', 1, { keyword: 'order by' } ); } continue;
3513
+ default: this.gr([']']); continue;
3514
+ }
3515
+ case 557: this.orderByLimitOffset({query:$.pathStep},0); continue;
3516
+ default: return this.exit_();
3517
+ }
3518
+ }
3519
+ excludingClause($,$next) {
3520
+ this.rule_(559,$next);
3521
+ for(;;) switch(this.s) {
3522
+ case 559: this.mk(560,'excluding'); continue;
3523
+ case 560: if(this.m(561,'{')) { $.query.excludingDict = this.createDict(); } continue;
3524
+ case 561: switch(this.l()) {
3525
+ case 'Id': this.s=562; continue;
3526
+ default: this.e(); continue;
3527
+ }
3528
+ case 562: switch(this.l()) {
3529
+ case 'Id': if(this.ciA(563,'ref')) { this.addDef( { location: this.lb().location }, $.query, 'excludingDict', '', this.identAst() ); } continue;
3530
+ default: this.s=564; continue;
3531
+ }
3532
+ case 563: switch(this.l()) {
3533
+ case ',': this.c(562); continue;
3534
+ case '}': this.s=564; continue;
3535
+ default: this.e(); continue;
3536
+ }
3537
+ case 564: if(this.m(0,'}')) {this.afterBrace(); this.finalizeDictOrArray( $.query.excludingDict ); } continue;
3538
+ default: return this.exit_();
3539
+ }
3540
+ }
3541
+ selectItemsList($,$next) {
3542
+ this.rule_(566,$next);
3543
+ for(;;) switch(this.s) {
3544
+ case 566: if(this.m(567,'{')) {this.notInExpandInline(); $.query.columns = this.createArray( $.start ); } continue;
3545
+ case 567: switch(this.l()) {
3546
+ case '*': if(this.c(568)) { $.query.columns.push( this.valueWithLocation() ); } continue;
3547
+ case 'Id': case '#': case '(': case '+': case '-': case ':': case '?': case '@': case '{': case 'Number': case 'String': case 'QuotedLiteral': this.selectItemDef({columns:$.query.columns},568); continue;
3548
+ default: this.s=569; continue;
3549
+ }
3550
+ case 568: switch(this.l()) {
3551
+ case ',': this.c(567); continue;
3552
+ case '}': this.s=569; continue;
3553
+ default: this.e(); continue;
3554
+ }
3555
+ case 569: if(this.m(0,'}')) {this.afterBrace(); this.finalizeDictOrArray( $.query.columns ); } continue;
3556
+ default: return this.exit_();
3557
+ }
3558
+ }
3559
+ nestedSelectItemsList($,$next) {
3560
+ this.rule_(571,$next);
3561
+ for(;;) switch(this.s) {
3562
+ case 571: if(this.m(572,'{')) {this.inExpandInline(); $.query[$.clause] = this.createArray(); } continue;
3563
+ case 572: switch(this.l()) {
3564
+ case '*': if(this.c(573)) { $.query[$.clause].push( this.valueWithLocation() ); } continue;
3565
+ case 'Id': case '#': case '(': case '+': case '-': case ':': case '?': case '@': case '{': case 'Number': case 'String': case 'QuotedLiteral': this.selectItemDef({columns:$.query[$.clause]},573); continue;
3566
+ default: this.s=574; continue;
3567
+ }
3568
+ case 573: switch(this.l()) {
3569
+ case ',': this.c(572); continue;
3570
+ case '}': this.s=574; continue;
3571
+ default: this.e(); continue;
3572
+ }
3573
+ case 574: if(this.m(0,'}')) {this.afterBrace(); this.finalizeDictOrArray( $.query[$.clause] ); } continue;
3574
+ default: return this.exit_();
3575
+ }
3576
+ }
3577
+ selectItemDef($,$next) {
3578
+ this.rule_(576,$next);
3579
+ let art=new XsnArtifact(); let alias;
3580
+ let expr; let as; let target; let cond; let assoc; let card; let _;
3581
+ { $.columns.push( art );
3582
+ this.docComment( art ); }
3583
+ for(;;) switch(this.s) {
3584
+ case 576: switch(this.l()) {
3585
+ case '@': this.annoAssignCol({art},576); continue;
3586
+ default: this.s=577; continue;
3587
+ }
3588
+ case 577: switch(this.lk()) {
3589
+ case 'virtual': if(this.lP(['Id','#','(','+','-',':','?','{','key','not','case','cast','null','true','false','Number','String','exists','QuotedLiteral']) && this.gc(578,'notInExpandInline') && this.ck(578)) { art.virtual = this.valueWithLocation( true ); } continue;
3590
+ default: this.s=578; continue;
3591
+ }
3592
+ case 578: switch(this.lk()) {
3593
+ case 'key': if(this.gc(579,'notInExpandInline') && this.ck(579)) { art.key = this.valueWithLocation( true ); } continue;
3594
+ default: this.s=579; continue;
3595
+ }
3596
+ case 579: switch(this.l()) {
3597
+ case 'Id': case '#': case '(': case '+': case '-': case ':': case '?': case 'Number': case 'String': case 'QuotedLiteral': if(this.expression(_={},580)) {expr=_.expr; art.value = expr; } continue;
3598
+ case '{': this.nestedSelectItemsList({query:art,clause:'expand'},587); continue;
3599
+ default: this.e(); continue;
3600
+ }
3601
+ case 580: switch(this.lk()) {
3602
+ case 'as': if(this.ck(581)) as=this.lb(); continue;
3603
+ case 'Id': if(this.ci(582,'ItemAlias')) { art.name = this.fragileAlias( true ); } continue;
3604
+ default: if(this.gi(582)) { alias = this.classifyImplicitName( 'ItemImplicit', expr ); } continue;
3605
+ }
3606
+ case 581: if(this.mi(582,'ItemAlias')) { art.name = this.identAst(); } continue;
3607
+ case 582: switch(this.l()) {
3608
+ case '{': this.s=583;{ this.reportExpandInline( art, false ); } continue;
3609
+ case '.': if(this.c(585)) { this.reportExpandInline( art, as || true );
3610
+ if (alias) alias.token.parsedAs = alias.parsedAs; } continue;
3611
+ default: this.s=590; continue;
3612
+ }
3613
+ case 583: this.nestedSelectItemsList({query:art,clause:'expand'},584); continue;
3614
+ case 584: switch(this.lk()) {
3615
+ case 'excluding': this.excludingClause({query:art},590); continue;
3616
+ default: this.s=590; continue;
3617
+ }
3618
+ case 585: switch(this.l()) {
3619
+ case '{': this.nestedSelectItemsList({query:art,clause:'inline'},586); continue;
3620
+ case '*': if(this.c(590)) { art.inline = [ this.valueWithLocation() ]; } continue;
3621
+ default: this.e(); continue;
3622
+ }
3623
+ case 586: switch(this.lk()) {
3624
+ case 'excluding': this.excludingClause({query:art},590); continue;
3625
+ default: this.s=590; continue;
3626
+ }
3627
+ case 587: switch(this.lk()) {
3628
+ case 'excluding': this.excludingClause({query:art},588); continue;
3629
+ default: this.s=588; continue;
3630
+ }
3631
+ case 588: this.mk(589,'as'); continue;
3632
+ case 589: if(this.mi(590,'ItemAlias')) { art.name = this.identAst(); } continue;
3633
+ case 590: this.s=591;{ this.docComment( art ); } continue;
3634
+ case 591: switch(this.l()) {
3635
+ case '@': this.annoAssignMid({art},591); continue;
3636
+ default: this.s=592; continue;
3637
+ }
3638
+ case 592: switch(this.l()) {
3639
+ case ':': this.c(593); continue;
3640
+ default: this.gr([',']); continue;
3641
+ }
3642
+ case 593: switch(this.lk()) {
3643
+ case 'type': this.lP() && this.typeTypeOf({art},607); continue;
3644
+ case 'localized': if(this.ckP(594,['Id'])) { art.localized = this.valueWithLocation( true ); } continue;
3645
+ case 'Id': this.s=594; continue;
3646
+ case 'redirected': this.ckP(595,['to']); continue;
3647
+ case 'association': if(this.ckP(599,['[','to'])) {assoc=this.lb(); this.associationInSelectItem( art ); } continue;
3648
+ case 'composition': if(this.ckP(601,['[','of'])) {assoc=this.lb(); this.associationInSelectItem( art ); } continue;
3649
+ default: this.ei(); continue;
3650
+ }
3651
+ case 594: this.typeRefOptArgs({art},607); continue;
3652
+ case 595: this.mk(596,'to'); continue;
3653
+ case 596: if(this.simplePath(_={category:'artref'},597)) {target=_.ref; art.target = target; } continue;
3654
+ case 597: switch(this.lk()) {
3655
+ case 'on': this.ck(598); continue;
3656
+ case '{': this.foreignKeysBlock({art},607); continue;
3657
+ default: this.s=607; continue;
3658
+ }
3659
+ case 598: if(this.condition(_={},607)) {cond=_.expr; art.on = cond; } continue;
3660
+ case 599: switch(this.l()) {
3661
+ case '[': this.cardinality({art},600); continue;
3662
+ default: this.s=600; continue;
3663
+ }
3664
+ case 600: this.mk(603,'to'); continue;
3665
+ case 601: switch(this.l()) {
3666
+ case '[': this.cardinality({art},602); continue;
3667
+ default: this.s=602; continue;
3668
+ }
3669
+ case 602: this.mk(603,'of'); continue;
3670
+ case 603: switch(this.lk()) {
3671
+ case 'one': case 'many': if(this.ckP(604,['Id'])) card=this.lb(); continue;
3672
+ default: this.s=604; continue;
3673
+ }
3674
+ case 604: if(this.simplePath(_={category:'artref'},605)) {target=_.ref; this.setAssocAndComposition( art, assoc, card, target ); } continue;
3675
+ case 605: this.mk(606,'on'); continue;
3676
+ case 606: if(this.condition(_={},607)) {expr=_.expr; art.on = expr; } continue;
3677
+ case 607: this.s=608;{ this.docComment( art ); } continue;
3678
+ case 608: switch(this.l()) {
3679
+ case '@': this.annoAssignStd({art},608); continue;
3680
+ default: this.gr([',']); continue;
3681
+ }
3682
+ default:
3683
+ this.attachLocation( art );
3684
+ return this.exit_();
3685
+ }
3686
+ }
3687
+ whereGroupByHaving($,$next) {
3688
+ this.rule_(610,$next);
3689
+ let cond; let _;
3690
+ for(;;) switch(this.s) {
3691
+ case 610: switch(this.lk()) {
3692
+ case 'where': this.ck(611); continue;
3693
+ default: this.s=612; continue;
3694
+ }
3695
+ case 611: if(this.condition(_={},612)) {cond=_.expr; $.query.where = cond; } continue;
3696
+ case 612: switch(this.lk()) {
3697
+ case 'group': this.groupByClause($,613); continue;
3698
+ default: this.s=613; continue;
3699
+ }
3700
+ case 613: switch(this.lk()) {
3701
+ case 'having': this.ck(614); continue;
3702
+ default: this.gr(['limit','order']); continue;
3703
+ }
3704
+ case 614: if(this.condition(_={},0)) {cond=_.expr; $.query.having = cond; } continue;
3705
+ default: return this.exit_();
3706
+ }
3707
+ }
3708
+ groupByClause($,$next) {
3709
+ this.rule_(616,$next);
3710
+ let expr; let _;
3711
+ for(;;) switch(this.s) {
3712
+ case 616: this.mk(617,'group'); continue;
3713
+ case 617: this.mk(618,'by'); continue;
3714
+ case 618: if(this.expression(_={},619)) {expr=_.expr; $.query.groupBy = [ expr ]; } continue;
3715
+ case 619: switch(this.l()) {
3716
+ case ',': this.c(620); continue;
3717
+ default: this.gr(['limit','order','having']); continue;
3718
+ }
3719
+ case 620: if(this.expression(_={},619)) {expr=_.expr; $.query.groupBy.push( expr ); } continue;
3720
+ default: return this.exit_();
3721
+ }
3722
+ }
3723
+ orderByLimitOffset($,$next) {
3724
+ this.rule_(622,$next);
3725
+ let expr; let _;
3726
+ for(;;) switch(this.s) {
3727
+ case 622: switch(this.lk()) {
3728
+ case 'order': this.orderByClause($,623); continue;
3729
+ default: this.s=623; continue;
3730
+ }
3731
+ case 623: switch(this.lk()) {
3732
+ case 'limit': this.ck(624); continue;
3733
+ default: this.gr([]); continue;
3734
+ }
3735
+ case 624: if(this.expression(_={},625)) {expr=_.expr; $.query.limit = { rows: expr }; } continue;
3736
+ case 625: switch(this.lk()) {
3737
+ case 'offset': this.ck(626); continue;
3738
+ default: this.gr([]); continue;
3739
+ }
3740
+ case 626: if(this.expression(_={},0)) {expr=_.expr; $.query.limit.offset = expr; } continue;
3741
+ default: return this.exit_();
3742
+ }
3743
+ }
3744
+ orderByClause($,$next) {
3745
+ this.rule_(628,$next);
3746
+ let expr; let _;
3747
+ for(;;) switch(this.s) {
3748
+ case 628: this.mk(629,'order'); continue;
3749
+ case 629: this.mk(630,'by'); continue;
3750
+ case 630: if(this.orderByExpression(_={},631)) {expr=_.expr; $.query.orderBy = [ expr ]; } continue;
3751
+ case 631: switch(this.l()) {
3752
+ case ',': this.c(632); continue;
3753
+ default: this.gr(['limit']); continue;
3754
+ }
3755
+ case 632: if(this.orderByExpression(_={},631)) {expr=_.expr; $.query.orderBy.push( expr ); } continue;
3756
+ default: return this.exit_();
3757
+ }
3758
+ }
3759
+ orderByExpression($,$next) {
3760
+ $.expr??=undefined;
3761
+ this.rule_(634,$next);
3762
+ for(;;) switch(this.s) {
3763
+ case 634: this.expression($,635); continue;
3764
+ case 635: switch(this.lk()) {
3765
+ case 'asc': case 'desc': if(this.ck(636)) { $.expr.sort = this.valueWithLocation(); } continue;
3766
+ default: this.s=636; continue;
3767
+ }
3768
+ case 636: switch(this.lk()) {
3769
+ case 'nulls': this.ck(637); continue;
3770
+ default: this.gr([',','limit']); continue;
3771
+ }
3772
+ case 637: switch(this.lk()) {
3773
+ case 'last': case 'first': if(this.ck(0)) { $.expr.nulls = this.valueWithLocation(); } continue;
3774
+ default: this.e(); continue;
3775
+ }
3776
+ default: return this.exit_();
3777
+ }
3778
+ }
3779
+ conditionEOF($,$next) {
3780
+ $.cond??=undefined;
3781
+ this.rule_(639,$next);
3782
+ let _;
3783
+ for(;;) switch(this.s) {
3784
+ case 639: if(this.expression(_={},640)) $.cond=_.expr; continue;
3785
+ case 640: this.m(0,'EOF'); continue;
3786
+ default: return this.exit_();
3787
+ }
3788
+ }
3789
+ condition($,$next) {
3790
+ $.expr??=undefined;
3791
+ this.rule_(642,$next);
3792
+ for(;;) switch(this.s) {
3793
+ case 642: this.expression($,0); continue;
3794
+ default: return this.exit_();
3795
+ }
3796
+ }
3797
+ valuePath($,$next,$startState) {
3798
+ $.expr??={ path: [] };
3799
+ this.rule_($startState??644,$next);
3800
+ let pathItem;
3801
+ for(;;) switch(this.s) {
3802
+ case 644: if(this.mi(645,'ref')) { $.expr.path.push( pathItem = this.identAst() ); } continue;
3803
+ case 645: switch(this.l()) {
3804
+ case '(': case '[': this.argumentsAndFilter({pathStep:pathItem},646); continue;
3805
+ default: this.s=646; continue;
3806
+ }
3807
+ case 646: switch(this.l()) {
3808
+ case '.': this.gc(0,'isDotForPath') && this.c(647); continue;
3809
+ default: this.gr(['*','+','-','/','<','=','>','?','!=','<=','<>','>=','in','is','or','||','and','not','like','between']); continue;
3810
+ }
3811
+ case 647: if(this.miA(648,'ref')) { $.expr.path.push( pathItem = this.identAst() ); } continue;
3812
+ case 648: switch(this.l()) {
3813
+ case '(': case '[': if(this.argumentsAndFilter({pathStep:pathItem},646)) { pathItem = null; } continue;
3814
+ default: this.s=646; continue;
3815
+ }
3816
+ default:
3817
+ this.attachLocation( $.expr );
3818
+ return this.exit_();
3819
+ }
3820
+ }
3821
+ expression($,$next,$startState) {
3822
+ $.expr??=undefined;
3823
+ this.rule_($startState??650,$next);
3824
+ let e; let open; let _;
3825
+ for(;;) switch(this.s) {
3826
+ case 650: switch(this.lk()) {
3827
+ case '(': this.expressionOrQueryParens($,651); continue;
3828
+ case '#': case 'null': case 'true': case 'false': case 'Number': case 'String': case 'QuotedLiteral': this.literalValue($,661); continue;
3829
+ case ':': if(this.c(652)) { this.reportUnexpectedSpace(); } continue;
3830
+ case '?': if(this.c(661)) { this.csnParseOnly( 'syntax-unsupported-param', -1, { '#': 'dynamic', code: '?' } );
3831
+ $.expr = this.attachLocation({ param: this.valueWithLocation(), scope: 'param' }); } continue;
3832
+ case 'Id': if(this.valuePath(_={},654)) {e=_.expr; $.expr = this.valuePathAst( e ); } continue;
3833
+ case 'new': this.lP() && this.newAndValuePath($,661); continue;
3834
+ case 'exists': if(this.ck(657)) { $.expr = this.applyOpToken(); } continue;
3835
+ case 'case': this.caseExpression($,661); continue;
3836
+ case 'cast': this.castFunction($,661); continue;
3837
+ case '+': case '-': if(this.ep(30,'right') && this.c(660)) { $.expr = this.applyOpToken(); } continue;
3838
+ case 'not': if(this.ep(8,'right') && this.ck(660)) { $.expr = this.applyOpToken(); } continue;
3839
+ default: this.ei(); continue;
3840
+ }
3841
+ case 651: this.s=661;{ $.expr = this.taggedIfQuery( $.expr ); } continue;
3842
+ case 652: switch(this.l()) {
3843
+ case 'Id': if(this.ciA(653,'paramref')) { $.expr = { path: [ this.identAst() ], location: this.startLocation(), scope: 'param' }; } continue;
3844
+ case 'Number': if(this.c(661)) { this.csnParseOnly( 'syntax-unsupported-param', -1, { '#': 'positional', code: ':' + this.lb().text } );
3845
+ $.expr = this.attachLocation({ param: this.unsignedIntegerLiteral(), scope: 'param' }); } continue;
3846
+ default: this.e(); continue;
3847
+ }
3848
+ case 653: switch(this.l()) {
3849
+ case '.': if(this.valuePath($,661,646)) { $.expr = this.valuePathAst( $.expr ); } continue;
3850
+ default: this.s=661;{ this.attachLocation( $.expr ); } continue;
3851
+ }
3852
+ case 654: switch(this.lk()) {
3853
+ case 'over': if(this.ckP(655,['('])) { this.pushXprToken( $.expr.suffix = [] ); } continue;
3854
+ default: this.s=656; continue;
3855
+ }
3856
+ case 655: this.overClause(e={outer:$.expr.suffix},656); continue;
3857
+ case 656: this.s=661;{ this.attachLocation( $.expr ); } continue;
3858
+ case 657: switch(this.l()) {
3859
+ case '(': if(this.c(658)) open=this.lb(); continue;
3860
+ case 'Id': if(this.valuePath(_={},661)) {e=_.expr; e = this.valuePathAst( e ); e.$expected = 'exists';
3861
+ $.expr.args.push( e ); this.attachLocation( $.expr ); } continue;
3862
+ case '?': if(this.c(661)) { this.csnParseOnly( 'syntax-unsupported-param', -1, { '#': 'dynamic', code: '?' } );
3863
+ $.expr.args.push( { param: this.valueWithLocation(), scope: 'param' } ); this.attachLocation( $.expr ); } continue;
3864
+ default: this.e(); continue;
3865
+ }
3866
+ case 658: if(this.queryExpression(_={},659)) e=_.expr; continue;
3867
+ case 659: if(this.m(661,')')) { $.expr.args.push( this.taggedIfQuery( this.surroundByParens( e, open ) ) );
3868
+ this.attachLocation( $.expr ); } continue;
3869
+ case 660: if(this.expression(_={},661)) {e=_.expr; $.expr = this.signedExpression( $.expr, e ); } continue;
3870
+ case 661: switch(this.lk()) {
3871
+ case '*': case '/': if(this.gp(0,24) && this.c(665)) { $.expr = this.applyOpToken( $.expr, 'nary' ); } continue;
3872
+ case '+': case '-': if(this.gp(0,22) && this.c(665)) { $.expr = this.applyOpToken( $.expr, 'nary' ); } continue;
3873
+ case '||': if(this.gp(0,20) && this.c(665)) { $.expr = this.applyOpToken( $.expr, 'nary' ); } continue;
3874
+ case 'and': if(this.lP(['Id','#','(','+','-',':','?','not','case','cast','null','true','false','Number','String','exists','QuotedLiteral']) && this.gp(0,4) && this.ck(665)) { $.expr = this.applyOpToken( $.expr, 'nary' ); } continue;
3875
+ case 'or': if(this.lP(['Id','#','(','+','-',':','?','not','case','cast','null','true','false','Number','String','exists','QuotedLiteral']) && this.gp(0,2) && this.ck(665)) { $.expr = this.applyOpToken( $.expr, 'nary' ); } continue;
3876
+ case '?': if(this.gp(0,0) && this.c(662)) { $.expr = this.applyOpToken( $.expr, '?:' ); } continue;
3877
+ case '<': case '=': case '>': case '!=': case '<=': case '<>': case '>=': if(this.gp(0,10,'none') && this.c(664)) { $.expr = this.applyOpToken( $.expr ); } continue;
3878
+ case 'is': if(this.lP(['not','null']) && this.gp(0,10,'none') && this.ck(666)) { $.expr = this.applyOpToken( $.expr ); } continue;
3879
+ case 'not': if(this.gc(0,'isNegatedRelation') && this.ck(668)) { $.expr = this.applyOpToken( $.expr ); } continue;
3880
+ case 'in': case 'like': case 'between': if(this.lP() && this.gp(0,10,'none') && this.g(668)) { $.expr = { op: { val: 'ixpr', location: this.la().location }, args: [ $.expr ] }; } continue;
3881
+ default: this.gr([]); continue;
3882
+ }
3883
+ case 662: if(this.expression(_={},663)) {e=_.expr; $.expr.args.push( e ); } continue;
3884
+ case 663: if(this.m(665,':')) { this.pushXprToken( $.expr ); } continue;
3885
+ case 664: switch(this.lk()) {
3886
+ case 'all': case 'any': case 'some': if(this.ck(665)) { this.pushXprToken( $.expr ); } continue;
3887
+ default: this.s=665; continue;
3888
+ }
3889
+ case 665: if(this.expression(_={},676)) {e=_.expr; $.expr.args.push( e ); } continue;
3890
+ case 666: switch(this.lk()) {
3891
+ case 'not': if(this.ck(667)) { this.pushXprToken( $.expr ); } continue;
3892
+ default: this.s=667; continue;
3893
+ }
3894
+ case 667: if(this.mk(676,'null')) { this.pushXprToken( $.expr ); } continue;
3895
+ case 668: switch(this.lk()) {
3896
+ case 'between': if(this.ck(669)) { this.pushXprToken( $.expr ); } continue;
3897
+ case 'in': if(this.ck(672)) { this.pushXprToken( $.expr ); } continue;
3898
+ case 'like': if(this.ck(673)) { this.pushXprToken( $.expr ); } continue;
3899
+ default: this.e(); continue;
3900
+ }
3901
+ case 669: if(this.expression(_={},670)) {e=_.expr; $.expr.args?.push( e ); } continue;
3902
+ case 670: if(this.mk(671,'and')) { this.pushXprToken( $.expr ); } continue;
3903
+ case 671: if(this.expression(_={},676)) {e=_.expr; $.expr.args?.push( e ); } continue;
3904
+ case 672: if(this.expression(_={},676)) {e=_.expr; $.expr.args?.push( this.secureParens( e ) ); } continue;
3905
+ case 673: if(this.expression(_={},674)) {e=_.expr; $.expr.args?.push( e ); } continue;
3906
+ case 674: switch(this.lk()) {
3907
+ case 'escape': if(this.ckP(675,['Id','#','(','+','-',':','?','not','case','cast','null','true','false','Number','String','exists','QuotedLiteral'])) { this.pushXprToken( $.expr ); } continue;
3908
+ default: this.s=676; continue;
3909
+ }
3910
+ case 675: if(this.expression(_={},676)) {e=_.expr; $.expr.args?.push( e ); } continue;
3911
+ case 676: this.s=661;{ this.attachLocation( $.expr ); } continue;
3912
+ default: return this.exit_();
3913
+ }
3914
+ }
3915
+ expressionOrQueryParens($,$next) {
3916
+ $.expr??=undefined;
3917
+ this.rule_(678,$next);
3918
+ for(;;) switch(this.s) {
3919
+ case 678: this.m(679,'('); continue;
3920
+ case 679: switch(this.lk()) {
3921
+ case '(': this.expressionOrQueryParens($,680); continue;
3922
+ case 'Id': case '#': case '+': case '-': case ':': case '?': case 'not': case 'case': case 'cast': case 'null': case 'true': case 'false': case 'Number': case 'String': case 'exists': case 'QuotedLiteral': this.ep(-2) && this.expression($,682); continue;
3923
+ case 'select': this.ep(-1) && this.queryExpression($,683); continue;
3924
+ default: this.ei(); continue;
3925
+ }
3926
+ case 680: switch(this.lk()) {
3927
+ case '*': case '+': case '-': case '/': case '<': case '=': case '>': case '?': case '!=': case '<=': case '<>': case '>=': case 'in': case 'is': case 'or': case '||': case 'and': case 'not': case 'like': case 'between': this.gp(683,-2,'post') && this.expression($,681,651); continue;
3928
+ case ',': this.gp(683,-2,'post') && this.continueExpressionslist($,683); continue;
3929
+ case 'limit': case 'minus': case 'order': case 'union': case 'except': case 'intersect': this.gp(683,-1,'post') && this.queryExpression($,683,464); continue;
3930
+ default: this.s=683; continue;
3931
+ }
3932
+ case 681: switch(this.l()) {
3933
+ case ',': this.continueExpressionslist($,683); continue;
3934
+ default: this.s=683; continue;
3935
+ }
3936
+ case 682: switch(this.l()) {
3937
+ case ',': this.continueExpressionslist($,683); continue;
3938
+ default: this.s=683; continue;
3939
+ }
3940
+ case 683: if(this.m(0,')')) {this.setPrecInCallingRule(); this.surroundByParens( $.expr ); } continue;
3941
+ default: return this.exit_();
3942
+ }
3943
+ }
3944
+ continueExpressionslist($,$next) {
3945
+ this.rule_(685,$next);
3946
+ let e; let _;
3947
+ for(;;) switch(this.s) {
3948
+ case 685: if(this.m(686,',')) { $.expr = { op: this.valueWithLocation( 'list' ), args: [ $.expr ], location: { ... $.expr.$parens?.at( -1 ) ?? $.expr.location } }; } continue;
3949
+ case 686: switch(this.lk()) {
3950
+ case 'Id': case '#': case '(': case '+': case '-': case ':': case '?': case 'not': case 'case': case 'cast': case 'null': case 'true': case 'false': case 'Number': case 'String': case 'exists': case 'QuotedLiteral': this.s=687; continue;
3951
+ default: this.ei(); continue;
3952
+ }
3953
+ case 687: switch(this.lk()) {
3954
+ case 'Id': case '#': case '(': case '+': case '-': case ':': case '?': case 'not': case 'case': case 'cast': case 'null': case 'true': case 'false': case 'Number': case 'String': case 'exists': case 'QuotedLiteral': if(this.expression(_={},688)) {e=_.expr; $.expr.args.push( e ); } continue;
3955
+ default: this.gi(0,[')']); continue;
3956
+ }
3957
+ case 688: switch(this.l()) {
3958
+ case ',': this.c(687); continue;
3959
+ default: this.gr([')']); continue;
3960
+ }
3961
+ case 0: { this.attachLocation( $.expr ); }
3962
+ default:
3963
+ this.attachLocation( $.expr );
3964
+ return this.exit_();
3965
+ }
3966
+ }
3967
+ newAndValuePath($,$next) {
3968
+ $.expr??=undefined;
3969
+ this.rule_(690,$next);
3970
+ let e; let _;
3971
+ for(;;) switch(this.s) {
3972
+ case 690: if(this.mk(691,'new')) { $.expr = this.applyOpToken(); } continue;
3973
+ case 691: if(this.valuePath(_={},0)) {e=_.expr; e = this.valuePathAst( e );
3974
+ if (e.op?.val !== 'ixpr') $.expr.args.push( e ); else $.expr.args.push( ...e.args ); } continue;
3975
+ default:
3976
+ this.attachLocation( $.expr );
3977
+ return this.exit_();
3978
+ }
3979
+ }
3980
+ caseExpression($,$next) {
3981
+ $.expr??={ op: { val: 'ixpr' }, args: [] };
3982
+ this.rule_(693,$next);
3983
+ let e; let _;
3984
+ for(;;) switch(this.s) {
3985
+ case 693: if(this.mk(694,'case')) { this.pushXprToken( $.expr ); $.expr.op.location = $.expr.args[0].location; } continue;
3986
+ case 694: switch(this.lk()) {
3987
+ case 'Id': case '#': case '(': case '+': case '-': case ':': case '?': case 'not': case 'case': case 'cast': case 'null': case 'true': case 'false': case 'Number': case 'String': case 'exists': case 'QuotedLiteral': if(this.expression(_={},695)) {e=_.expr; $.expr.args.push( e ); } continue;
3988
+ case 'when': this.gP(695); continue;
3989
+ default: this.gi(695); continue;
3990
+ }
3991
+ case 695: switch(this.lk()) {
3992
+ case 'when': this.s=696; continue;
3993
+ default: this.e(); continue;
3994
+ }
3995
+ case 696: switch(this.lk()) {
3996
+ case 'when': if(this.ck(697)) { this.pushXprToken( $.expr ); } continue;
3997
+ default: this.s=700; continue;
3998
+ }
3999
+ case 697: if(this.expression(_={},698)) {e=_.expr; $.expr.args.push( e ); } continue;
4000
+ case 698: if(this.mk(699,'then')) { this.pushXprToken( $.expr ); } continue;
4001
+ case 699: if(this.expression(_={},696)) {e=_.expr; $.expr.args.push( e ); } continue;
4002
+ case 700: switch(this.lk()) {
4003
+ case 'else': if(this.ck(701)) { this.pushXprToken( $.expr ); } continue;
4004
+ default: this.s=702; continue;
4005
+ }
4006
+ case 701: if(this.expression(_={},702)) {e=_.expr; $.expr.args.push( e ); } continue;
4007
+ case 702: if(this.mk(0,'end')) { this.pushXprToken( $.expr ); } continue;
4008
+ default:
4009
+ this.attachLocation( $.expr );
4010
+ return this.exit_();
4011
+ }
4012
+ }
4013
+ castFunction($,$next) {
4014
+ $.expr??={};
4015
+ this.rule_(704,$next);
4016
+ let arg; let _;
4017
+ for(;;) switch(this.s) {
4018
+ case 704: if(this.mk(705,'cast')) { $.expr.op = this.valueWithLocation(); } continue;
4019
+ case 705: if(this.m(706,'(')) { $.expr.args = this.createArray(); } continue;
4020
+ case 706: if(this.expression(_={},707)) {arg=_.expr; $.expr.args?.push( arg ); } continue;
4021
+ case 707: this.mk(708,'as'); continue;
4022
+ case 708: this.typeRefOptArgs({art:$.expr},709); continue;
4023
+ case 709: if(this.m(0,')')) { this.finalizeDictOrArray( $.expr.args ); } continue;
4024
+ default:
4025
+ this.attachLocation( $.expr );
4026
+ return this.exit_();
4027
+ }
4028
+ }
4029
+ argumentsAndFilter($,$next) {
4030
+ this.rule_(711,$next);
4031
+ let open; let expr; let id; let _;
4032
+ for(;;) switch(this.s) {
4033
+ case 711: switch(this.l()) {
4034
+ case '(': if(this.c(712)) {open=this.lb();this.prepareSpecialFunction(); $.pathStep.args = this.createArray(); } continue;
4035
+ default: this.s=731; continue;
4036
+ }
4037
+ case 712: switch(this.l()) {
4038
+ case 'Id': if(this.gc(713,'isNamedArg') && this.ciA(719,'paramname')) id=this.lb(); continue;
4039
+ default: this.s=713; continue;
4040
+ }
4041
+ case 713: switch(this.l()) {
4042
+ case 'Id': case '#': case '(': case '*': case '+': case '-': case ':': case '?': case 'Id_all': case 'Number': case 'String': case 'QuotedLiteral': if(this.funcExpression(_={},714)) {expr=_.expr; $.pathStep.args.push( expr ); } continue;
4043
+ default: this.s=730; continue;
4044
+ }
4045
+ case 714: switch(this.l()) {
4046
+ case ',': if(this.c(715)) {this.nextFunctionArgument();} continue;
4047
+ default: this.s=716; continue;
4048
+ }
4049
+ case 715: switch(this.lk()) {
4050
+ case 'Id': case '#': case '(': case '*': case '+': case '-': case ':': case '?': case 'not': case 'case': case 'cast': case 'null': case 'true': case 'false': case 'Id_all': case 'Number': case 'String': case 'exists': case 'QuotedLiteral': if(this.funcExpression(_={},714)) {expr=_.expr; $.pathStep.args.push( expr ); } continue;
4051
+ case ')': case 'order': this.gP(716); continue;
4052
+ default: this.ei(); continue;
4053
+ }
4054
+ case 716: switch(this.lk()) {
4055
+ case 'order': if(this.ck(717)) { expr = $.pathStep.args[$.pathStep.args.length - 1] = this.applyOpToken( expr ); } continue;
4056
+ default: this.s=730; continue;
4057
+ }
4058
+ case 717: if(this.mk(718,'by')) { this.pushXprToken( expr ); } continue;
4059
+ case 718: if(this.orderByClauseAsXpr({outer:expr.args},730)) { this.attachLocation( expr ); } continue;
4060
+ case 719: switch(this.l()) {
4061
+ case ':': if(this.c(720)) { $.pathStep.args = this.createDict( open ); $.pathStep.$syntax = ':'; } continue;
4062
+ case '=>': if(this.c(725)) { $.pathStep.args = this.createDict(); } continue;
4063
+ default: this.e(); continue;
4064
+ }
4065
+ case 720: if(this.expression(_={},721)) {expr=_.expr; this.addNamedArg( $.pathStep, id, expr ); } continue;
4066
+ case 721: switch(this.l()) {
4067
+ case ',': this.c(722); continue;
4068
+ default: this.s=730; continue;
4069
+ }
4070
+ case 722: switch(this.l()) {
4071
+ case 'Id': if(this.ciA(723,'paramname')) id=this.lb(); continue;
4072
+ case ')': this.s=730; continue;
4073
+ default: this.e(); continue;
4074
+ }
4075
+ case 723: this.m(724,':'); continue;
4076
+ case 724: if(this.expression(_={},721)) {expr=_.expr; this.addNamedArg( $.pathStep, id, expr ); } continue;
4077
+ case 725: if(this.expression(_={},726)) {expr=_.expr; this.addNamedArg( $.pathStep, id, expr ); } continue;
4078
+ case 726: switch(this.l()) {
4079
+ case ',': this.c(727); continue;
4080
+ default: this.s=730; continue;
4081
+ }
4082
+ case 727: switch(this.l()) {
4083
+ case 'Id': if(this.ciA(728,'paramname')) id=this.lb(); continue;
4084
+ case ')': this.s=730; continue;
4085
+ default: this.e(); continue;
4086
+ }
4087
+ case 728: this.m(729,'=>'); continue;
4088
+ case 729: if(this.expression(_={},726)) {expr=_.expr; this.addNamedArg( $.pathStep, id, expr ); } continue;
4089
+ case 730: this.m(731,')'); continue;
4090
+ case 731: switch(this.l()) {
4091
+ case '[': this.cardinalityAndFilter($,0); continue;
4092
+ default: this.gr(['*','+','-','.','/','<','=','>','?','!=','<=','<>','>=','in','is','or','||','and','not','like','between']); continue;
4093
+ }
4094
+ default: return this.exit_();
4095
+ }
4096
+ }
4097
+ funcExpression($,$next) {
4098
+ $.expr??=undefined;
4099
+ this.rule_(733,$next);
4100
+ let args;
4101
+ let tok; let e; let _;
4102
+ for(;;) switch(this.s) {
4103
+ case 733: switch(this.lGenericIntroOrExpr()) {
4104
+ case 'Id': case '#': case '(': case '+': case '-': case ':': case '?': case 'Number': case 'String': case 'QuotedLiteral': if(this.expression(_={},735)) $.expr=_.expr; continue;
4105
+ case 'GenericExpr': if(this.ckA(735)) {tok=this.lb(); $.expr = { val: tok.keyword ?? tok.type, location: tok.location, literal: 'token' }; } continue;
4106
+ case 'GenericIntro': if(this.ckA(734)) { $.expr = this.applyOpToken(); args = $.expr.args; } continue;
4107
+ default: this.e(); continue;
4108
+ }
4109
+ case 734: if(this.expression(_={},735)) {e=_.expr; $.expr.args.push( e ); } continue;
4110
+ case 735: switch(this.lGenericSeparator()) {
4111
+ case 'GenericSeparator': if(this.ckA(736)) { if (args) this.pushXprToken( args ); else { $.expr= this.applyOpToken( $.expr ); args = $.expr.args; } } continue;
4112
+ default: this.gr([')',',','order']); continue;
4113
+ }
4114
+ case 736: switch(this.lGenericExpr()) {
4115
+ case 'Id': case '#': case '(': case '+': case '-': case ':': case '?': case 'Number': case 'String': case 'QuotedLiteral': if(this.expression(_={},735)) {e=_.expr; args.push( e ); } continue;
4116
+ case 'GenericExpr': if(this.ckA(735)) { this.pushXprToken( args ); } continue;
4117
+ default: this.e(); continue;
4118
+ }
4119
+ default:
4120
+ this.attachLocation( $.expr );
4121
+ return this.exit_();
4122
+ }
4123
+ }
4124
+ overClause($,$next) {
4125
+ this.rule_(738,$next);
4126
+ let over=[];
4127
+ for(;;) switch(this.s) {
4128
+ case 738: this.m(739,'('); continue;
4129
+ case 739: switch(this.lk()) {
4130
+ case 'partition': if(this.ck(740)) { this.pushXprToken( over ); } continue;
4131
+ default: this.s=742; continue;
4132
+ }
4133
+ case 740: if(this.mk(741,'by')) { this.pushXprToken( over ); } continue;
4134
+ case 741: this.expressionsAsXpr({outer:over},742); continue;
4135
+ case 742: switch(this.lk()) {
4136
+ case 'order': if(this.ck(743)) { this.pushXprToken( over ); } continue;
4137
+ default: this.s=745; continue;
4138
+ }
4139
+ case 743: if(this.mk(744,'by')) { this.pushXprToken( over ); } continue;
4140
+ case 744: this.orderByClauseAsXpr({outer:over},745); continue;
4141
+ case 745: switch(this.lk()) {
4142
+ case 'rows': if(this.ck(746)) { this.pushXprToken( over ); } continue;
4143
+ default: this.s=747; continue;
4144
+ }
4145
+ case 746: this.windowFrameClause({outer:over},747); continue;
4146
+ case 747: this.m(0,')'); continue;
4147
+ default:
4148
+ $.outer.push( this.surroundByParens( this.ixprAst( over ) ) );
4149
+ return this.exit_();
4150
+ }
4151
+ }
4152
+ expressionsAsXpr($,$next) {
4153
+ this.rule_(749,$next);
4154
+ let args=[];
4155
+ let expr; let _;
4156
+ for(;;) switch(this.s) {
4157
+ case 749: if(this.expression(_={},750)) {expr=_.expr; args.push( expr ); } continue;
4158
+ case 750: switch(this.l()) {
4159
+ case ',': if(this.c(751)) { this.pushXprToken( args ); } continue;
4160
+ default: this.gr([')','rows','order']); continue;
4161
+ }
4162
+ case 751: if(this.expression(_={},750)) {expr=_.expr; args.push( expr ); } continue;
4163
+ default:
4164
+ $.outer.push( this.ixprAst( args ) );
4165
+ return this.exit_();
4166
+ }
4167
+ }
4168
+ orderByClauseAsXpr($,$next) {
4169
+ this.rule_(753,$next);
4170
+ let args=[];
4171
+ for(;;) switch(this.s) {
4172
+ case 753: this.orderBySpecAsXpr({args},754); continue;
4173
+ case 754: switch(this.l()) {
4174
+ case ',': if(this.c(755)) { this.pushXprToken( args ); } continue;
4175
+ default: this.gr([')']); continue;
4176
+ }
4177
+ case 755: this.orderBySpecAsXpr({args},754); continue;
4178
+ default:
4179
+ $.outer.push( this.ixprAst( args ) );
4180
+ return this.exit_();
4181
+ }
4182
+ }
4183
+ orderBySpecAsXpr($,$next) {
4184
+ this.rule_(757,$next);
4185
+ let expr; let _;
4186
+ for(;;) switch(this.s) {
4187
+ case 757: if(this.expression(_={},758)) {expr=_.expr; $.args.push( expr ); } continue;
4188
+ case 758: switch(this.lk()) {
4189
+ case 'asc': case 'desc': if(this.ck(759)) { this.pushXprToken( $.args ); } continue;
4190
+ default: this.s=759; continue;
4191
+ }
4192
+ case 759: switch(this.lk()) {
4193
+ case 'nulls': if(this.ck(760)) { this.pushXprToken( $.args ); } continue;
4194
+ default: this.gr([')',',']); continue;
4195
+ }
4196
+ case 760: switch(this.lk()) {
4197
+ case 'last': case 'first': if(this.ck(0)) { this.pushXprToken( $.args ); } continue;
4198
+ default: this.e(); continue;
4199
+ }
4200
+ default: return this.exit_();
4201
+ }
4202
+ }
4203
+ windowFrameClause($,$next) {
4204
+ this.rule_(762,$next);
4205
+ let args=[];
4206
+ for(;;) switch(this.s) {
4207
+ case 762: switch(this.lk()) {
4208
+ case 'unbounded': if(this.ck(763)) { this.pushXprToken( args ); } continue;
4209
+ case 'Number': if(this.c(763)) { args.push( this.unsignedIntegerLiteral() ); } continue;
4210
+ case 'current': if(this.ck(764)) { this.pushXprToken( args ); } continue;
4211
+ case 'between': if(this.ck(765)) { this.pushXprToken( args ); } continue;
4212
+ default: this.e(); continue;
4213
+ }
4214
+ case 763: if(this.mk(0,'preceding')) { this.pushXprToken( args ); } continue;
4215
+ case 764: if(this.mk(0,'row')) { this.pushXprToken( args ); } continue;
4216
+ case 765: this.windowFrameBoundSpec({args},766); continue;
4217
+ case 766: if(this.mk(767,'and')) { this.pushXprToken( args ); } continue;
4218
+ case 767: this.windowFrameBoundSpec({args},0); continue;
4219
+ default:
4220
+ $.outer.push( this.ixprAst( args ) );
4221
+ return this.exit_();
4222
+ }
4223
+ }
4224
+ windowFrameBoundSpec($,$next) {
4225
+ this.rule_(769,$next);
4226
+ for(;;) switch(this.s) {
4227
+ case 769: switch(this.lk()) {
4228
+ case 'unbounded': if(this.ck(770)) { this.pushXprToken( $.args ); } continue;
4229
+ case 'Number': if(this.c(770)) { $.args.push( this.unsignedIntegerLiteral() ); } continue;
4230
+ case 'current': if(this.ck(772)) { this.pushXprToken( $.args ); } continue;
4231
+ default: this.e(); continue;
4232
+ }
4233
+ case 770: switch(this.lk()) {
4234
+ case 'following': this.ck(771); continue;
4235
+ case 'preceding': this.ck(771); continue;
4236
+ default: this.e(); continue;
4237
+ }
4238
+ case 771: if(this.gr([])) { this.pushXprToken( $.args ); } continue;
4239
+ case 772: if(this.mk(0,'row')) { this.pushXprToken( $.args ); } continue;
4240
+ default: return this.exit_();
4241
+ }
4242
+ }
4243
+ literalValue($,$next) {
4244
+ $.expr??={};
4245
+ this.rule_(774,$next);
4246
+ for(;;) switch(this.s) {
4247
+ case 774: switch(this.lk()) {
4248
+ case '#': if(this.c(775)) { this.reportUnexpectedSpace(); } continue;
4249
+ case 'null': if(this.ck(0)) { $.expr = { literal: 'null', val: null }; } continue;
4250
+ case 'true': case 'false': if(this.ck(0)) { $.expr = { literal: 'boolean', val: this.lb().keyword === 'true' }; } continue;
4251
+ case 'Number': if(this.c(0)) { $.expr = this.numberLiteral(); } continue;
4252
+ case 'String': if(this.c(0)) { $.expr = this.quotedLiteral(); } continue;
4253
+ case 'QuotedLiteral': if(this.c(0)) { $.expr = this.quotedLiteral(); } continue;
4254
+ default: this.e(); continue;
4255
+ }
4256
+ case 775: if(this.mi(0,'enumref')) { $.expr = { literal: 'enum', sym: this.identAst() } } continue;
4257
+ default:
4258
+ this.attachLocation( $.expr );
4259
+ return this.exit_();
4260
+ }
4261
+ }
4262
+ annoAssignStd($,$next) {
4263
+ this.rule_(777,$next);
4264
+ for(;;) switch(this.s) {
4265
+ case 777: if(this.m(778,'@')) {this.annoInSameLine(); this.reportUnexpectedSpace(); } continue;
4266
+ case 778: switch(this.l()) {
4267
+ case '(': this.annoAssignParen($,0); continue;
4268
+ case 'Id': this.annoAssignBase($,0); continue;
4269
+ default: this.e(); continue;
4270
+ }
4271
+ default:
4272
+ this.docComment( $.art );
4273
+ return this.exit_();
4274
+ }
4275
+ }
4276
+ annoAssignCol($,$next) {
4277
+ this.rule_(780,$next);
4278
+ for(;;) switch(this.s) {
4279
+ case 780: if(this.m(781,'@')) { this.reportUnexpectedSpace(); } continue;
4280
+ case 781: switch(this.l()) {
4281
+ case '(': this.annoAssignParen($,0); continue;
4282
+ case 'Id': this.annoAssignBase($,0); continue;
4283
+ default: this.e(); continue;
4284
+ }
4285
+ default:
4286
+ this.docComment( $.art );
4287
+ return this.exit_();
4288
+ }
4289
+ }
4290
+ annoAssignMid($,$next) {
4291
+ this.rule_(783,$next);
4292
+ let name; let _;
4293
+ for(;;) switch(this.s) {
4294
+ case 783: if(this.m(784,'@')) {this.annoInSameLine(); this.reportUnexpectedSpace(); } continue;
4295
+ case 784: switch(this.l()) {
4296
+ case '(': this.annoAssignParen($,0); continue;
4297
+ case 'Id': if(this.annoNamePath(_={category:'anno'},0)) {name=_.name; this.assignAnnotation( $.art, {}, name ); this.warnIfColonFollows( name ); } continue;
4298
+ default: this.e(); continue;
4299
+ }
4300
+ default:
4301
+ this.docComment( $.art );
4302
+ return this.exit_();
4303
+ }
4304
+ }
4305
+ annoAssignParen($,$next) {
4306
+ this.rule_(786,$next);
4307
+ for(;;) switch(this.s) {
4308
+ case 786: if(this.m(787,'(')) {this.annoInSameLine();} continue;
4309
+ case 787: switch(this.l()) {
4310
+ case 'Id': this.annoAssignBase({art:$.art},788); continue;
4311
+ default: this.s=789; continue;
4312
+ }
4313
+ case 788: switch(this.l()) {
4314
+ case ',': this.c(787); continue;
4315
+ case ')': this.s=789; continue;
4316
+ default: this.e(); continue;
4317
+ }
4318
+ case 789: this.m(0,')'); continue;
4319
+ default: return this.exit_();
4320
+ }
4321
+ }
4322
+ annoAssignBase($,$next) {
4323
+ this.rule_(791,$next);
4324
+ let value={};
4325
+ let name; let _;
4326
+ for(;;) switch(this.s) {
4327
+ case 791: if(this.annoNamePath(_={category:'anno'},792)) name=_.name; continue;
4328
+ case 792: switch(this.l()) {
4329
+ case ':': this.gc(0,'annoInSameLine') && this.c(793); continue;
4330
+ default: this.gr([]); continue;
4331
+ }
4332
+ case 793: if(this.annoValue(_={},0)) value=_.value; continue;
4333
+ default:
4334
+ this.assignAnnotation( $.art, value, name || {} );
4335
+ return this.exit_();
4336
+ }
4337
+ }
4338
+ annoNamePath($,$next) {
4339
+ $.name??=new XsnName();
4340
+ this.rule_(795,$next);
4341
+ let at;
4342
+ for(;;) switch(this.s) {
4343
+ case 795: if(this.miA(796,$.category)) { $.name.path = [ this.identAst() ]; } continue;
4344
+ case 796: switch(this.l()) {
4345
+ case '.': this.c(797); continue;
4346
+ default: this.s=799; continue;
4347
+ }
4348
+ case 797: switch(this.l()) {
4349
+ case 'Id': if(this.ciA(796,$.category)) { $.name.path.push( this.identAst() ); } continue;
4350
+ case '@': if(this.c(798)) at=this.lb(); continue;
4351
+ default: this.e(); continue;
4352
+ }
4353
+ case 798: if(this.miA(796,$.category)) { $.name.path.push( this.identAstWithPrefix( at ) ); } continue;
4354
+ case 799: switch(this.l()) {
4355
+ case '#': this.gc(0,'annoInSameLine') && this.annoPathVariant({nameOrRef:$.name},0); continue;
4356
+ default: this.gr([]); continue;
4357
+ }
4358
+ default:
4359
+ this.attachLocation( $.name );
4360
+ return this.exit_();
4361
+ }
4362
+ }
4363
+ annoPath($,$next) {
4364
+ this.rule_(801,$next);
4365
+ let at;
4366
+ for(;;) switch(this.s) {
4367
+ case 801: switch(this.l()) {
4368
+ case 'Id': if(this.ciA(803,$.category)) { $.nameOrRef.path = [ this.identAst() ]; } continue;
4369
+ case '@': if(this.c(802)) at=this.lb(); continue;
4370
+ default: this.e(); continue;
4371
+ }
4372
+ case 802: if(this.miA(803,$.category)) { $.nameOrRef.path = [ this.identAstWithPrefix( at ) ]; } continue;
4373
+ case 803: switch(this.l()) {
4374
+ case '.': this.c(804); continue;
4375
+ default: this.s=806; continue;
4376
+ }
4377
+ case 804: switch(this.l()) {
4378
+ case 'Id': if(this.ciA(803,$.category)) { $.nameOrRef.path.push( this.identAst() ); } continue;
4379
+ case '@': if(this.c(805)) at=this.lb(); continue;
4380
+ default: this.e(); continue;
4381
+ }
4382
+ case 805: if(this.miA(803,$.category)) { $.nameOrRef.path.push( this.identAstWithPrefix( at ) ); } continue;
4383
+ case 806: switch(this.l()) {
4384
+ case '#': this.annoPathVariant({nameOrRef:$.nameOrRef},0); continue;
4385
+ default: this.gr([]); continue;
4386
+ }
4387
+ default:
4388
+ this.attachLocation( $.nameOrRef );
4389
+ return this.exit_();
4390
+ }
4391
+ }
4392
+ annoPathVariant($,$next) {
4393
+ this.rule_(808,$next);
4394
+ for(;;) switch(this.s) {
4395
+ case 808: if(this.m(809,'#')) { this.reportUnexpectedSpace(); } continue;
4396
+ case 809: if(this.miA(810,'variant')) { $.nameOrRef.variant = { path: [ this.identAst() ] }; } continue;
4397
+ case 810: switch(this.l()) {
4398
+ case '.': this.c(811); continue;
4399
+ default: this.gr([]); continue;
4400
+ }
4401
+ case 811: if(this.miA(810,'variant')) { $.nameOrRef.variant.path.push( this.identAst() ); } continue;
4402
+ default:
4403
+ this.attachLocation( $.nameOrRef.variant );
4404
+ return this.exit_();
4405
+ }
4406
+ }
4407
+ annoStructValue($,$next) {
4408
+ $.value??={};
4409
+ this.rule_(813,$next);
4410
+ let name=new XsnName();
4411
+ let _;
4412
+ for(;;) switch(this.s) {
4413
+ case 813: if(this.annoPath({nameOrRef:name,category:'name'},814)) { this.attachLocation( name ); } continue;
4414
+ case 814: switch(this.l()) {
4415
+ case ':': this.c(815); continue;
4416
+ default: if(this.gr([',','}'])) { this.attachLocation( $.value ); } continue;
4417
+ }
4418
+ case 815: if(this.annoValue(_={},0)) $.value=_.value; continue;
4419
+ default:
4420
+ $.value.name = name;
4421
+ return this.exit_();
4422
+ }
4423
+ }
4424
+ annoValue($,$next) {
4425
+ $.value??={};
4426
+ this.rule_(817,$next);
4427
+ let sign; let sub; let ellipsis; let upTo; let _;
4428
+ for(;;) switch(this.s) {
4429
+ case 817: switch(this.lk()) {
4430
+ case '#': case 'null': case 'true': case 'false': case 'Number': case 'String': case 'QuotedLiteral': if(this.literalValue(_={},0)) {$.value=_.expr; this.adjustAnnoNumber( $.value ); } continue;
4431
+ case '+': case '-': if(this.c(818)) sign=this.lb(); continue;
4432
+ case 'Id': case '@': this.annoPath({nameOrRef:$.value,category:'annoref'},0); continue;
4433
+ case '{': if(this.c(819)) { if (!this.dynamic_.arrayAnno) $.value.$flatten = [];
4434
+ else { $.value.struct = Object.create(null); $.value.literal = 'struct'; } } continue;
4435
+ case '[': if(this.c(822)) {this.ellipsisRestriction(); $.value.val = []; $.value.literal = 'array' } continue;
4436
+ case '(': this.c(829); continue;
4437
+ default: this.ei(); continue;
4438
+ }
4439
+ case 818: if(this.m(0,'Number')) { this.adjustAnnoNumber( $.value = this.numberLiteral( sign ) ); } continue;
4440
+ case 819: switch(this.l()) {
4441
+ case 'Id': case '@': if(this.annoStructValue(_={},820)) {sub=_.value; if ($.value.$flatten) $.value.$flatten.push( sub );
4442
+ else this.addDef( sub, $.value, 'struct', null, sub.name ); } continue;
4443
+ default: this.s=821; continue;
4444
+ }
4445
+ case 820: switch(this.l()) {
4446
+ case ',': this.c(819); continue;
4447
+ case '}': this.s=821; continue;
4448
+ default: this.e(); continue;
4449
+ }
4450
+ case 821: this.m(0,'}'); continue;
4451
+ case 822: switch(this.l()) {
4452
+ case 'Id': case '#': case '(': case '+': case '-': case '@': case '[': case '{': case 'Number': case 'String': case 'QuotedLiteral': if(this.annoValue(_={},827)) {sub=_.value; $.value.val.push( sub ) } continue;
4453
+ case '...': if(this.gc(828,'ellipsisRestriction') && this.c(823)) ellipsis=this.lb(); continue;
4454
+ default: this.s=828; continue;
4455
+ }
4456
+ case 823: switch(this.lk()) {
4457
+ case 'up': this.ck(824); continue;
4458
+ default: this.s=826;{ upTo = undefined; } continue;
4459
+ }
4460
+ case 824: this.mk(825,'to'); continue;
4461
+ case 825: if(this.annoValue(_={},826)) upTo=_.value; continue;
4462
+ case 826: this.s=827;{ $.value.val.push( { literal: 'token', val: '...', location: ellipsis.location, upTo: upTo } ); } continue;
4463
+ case 827: switch(this.l()) {
4464
+ case ',': this.c(822); continue;
4465
+ case ']': this.s=828; continue;
4466
+ default: this.e(); continue;
4467
+ }
4468
+ case 828: this.m(0,']'); continue;
4469
+ case 829: if(this.condition(_={},830)) $.value=_.expr; continue;
4470
+ case 830: if(this.m(0,')')) { $.value.$tokenTexts = this.ruleTokensText(); } continue;
4471
+ default:
4472
+ this.attachLocation( $.value );
4473
+ return this.exit_();
4474
+ }
4475
+ }
4476
+ }
4477
+ module.exports = CdlParser;