@malloydata/malloy 0.0.80-dev230907183434 → 0.0.80

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 (32) hide show
  1. package/dist/lang/ast/expressions/expr-aggregate-function.d.ts +8 -2
  2. package/dist/lang/ast/expressions/expr-aggregate-function.js +211 -12
  3. package/dist/lang/ast/expressions/expr-asymmetric.d.ts +2 -1
  4. package/dist/lang/ast/expressions/expr-asymmetric.js +5 -2
  5. package/dist/lang/ast/expressions/expr-avg.d.ts +1 -1
  6. package/dist/lang/ast/expressions/expr-avg.js +2 -2
  7. package/dist/lang/ast/expressions/expr-sum.d.ts +1 -1
  8. package/dist/lang/ast/expressions/expr-sum.js +2 -2
  9. package/dist/lang/ast/field-space/static-space.js +19 -2
  10. package/dist/lang/ast/field-space/struct-space-field-base.d.ts +2 -1
  11. package/dist/lang/ast/field-space/struct-space-field-base.js +3 -0
  12. package/dist/lang/ast/types/lookup-result.d.ts +5 -0
  13. package/dist/lang/ast/types/malloy-element.d.ts +1 -0
  14. package/dist/lang/ast/types/malloy-element.js +4 -0
  15. package/dist/lang/lib/Malloy/MalloyLexer.d.ts +75 -74
  16. package/dist/lang/lib/Malloy/MalloyLexer.js +1101 -1094
  17. package/dist/lang/lib/Malloy/MalloyParser.d.ts +91 -78
  18. package/dist/lang/lib/Malloy/MalloyParser.js +866 -801
  19. package/dist/lang/lib/Malloy/MalloyParserListener.d.ts +13 -0
  20. package/dist/lang/lib/Malloy/MalloyParserVisitor.d.ts +8 -0
  21. package/dist/lang/malloy-to-ast.d.ts +3 -0
  22. package/dist/lang/malloy-to-ast.js +76 -25
  23. package/dist/lang/parse-malloy.d.ts +1 -0
  24. package/dist/lang/parse-malloy.js +13 -0
  25. package/dist/lang/test/expressions.spec.js +241 -25
  26. package/dist/lang/test/parse.spec.js +1 -127
  27. package/dist/lang/test/query.spec.js +1 -1
  28. package/dist/lang/test/test-translator.d.ts +7 -1
  29. package/dist/lang/test/test-translator.js +40 -13
  30. package/dist/model/utils.d.ts +1 -0
  31. package/dist/model/utils.js +101 -1
  32. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { FieldValueType } from '../../../model/malloy_types';
1
+ import { FieldValueType, StructRelationship } from '../../../model/malloy_types';
2
2
  import { FieldReference } from '../query-items/field-references';
3
3
  import { ExprValue } from '../types/expr-value';
4
4
  import { ExpressionDef } from '../types/expression-def';
@@ -8,8 +8,14 @@ export declare abstract class ExprAggregateFunction extends ExpressionDef {
8
8
  elementType: string;
9
9
  source?: FieldReference;
10
10
  expr?: ExpressionDef;
11
+ explicitSource?: boolean;
11
12
  legalChildTypes: import("../../../model/malloy_types").TypeDesc[];
12
- constructor(func: string, expr?: ExpressionDef);
13
+ constructor(func: string, expr?: ExpressionDef, explicitSource?: boolean);
13
14
  returns(_forExpression: ExprValue): FieldValueType;
14
15
  getExpression(fs: FieldSpace): ExprValue;
16
+ isSymmetricFunction(): boolean;
17
+ getJoinUsage(fs: FieldSpace): {
18
+ name: string;
19
+ structRelationship: StructRelationship;
20
+ }[][];
15
21
  }
@@ -24,17 +24,22 @@
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
25
  exports.ExprAggregateFunction = void 0;
26
26
  const malloy_types_1 = require("../../../model/malloy_types");
27
+ const utils_1 = require("../../../model/utils");
27
28
  const ast_utils_1 = require("../ast-utils");
28
- const reference_field_1 = require("../field-space/reference-field");
29
+ const static_space_1 = require("../field-space/static-space");
29
30
  const struct_space_field_base_1 = require("../field-space/struct-space-field-base");
30
31
  const fragtype_utils_1 = require("../fragtype-utils");
32
+ const field_references_1 = require("../query-items/field-references");
31
33
  const expression_def_1 = require("../types/expression-def");
34
+ const space_field_1 = require("../types/space-field");
35
+ const expr_id_reference_1 = require("./expr-id-reference");
32
36
  class ExprAggregateFunction extends expression_def_1.ExpressionDef {
33
- constructor(func, expr) {
37
+ constructor(func, expr, explicitSource) {
34
38
  super();
35
39
  this.func = func;
36
40
  this.legalChildTypes = [fragtype_utils_1.FT.numberT];
37
41
  this.elementType = func;
42
+ this.explicitSource = explicitSource;
38
43
  if (expr) {
39
44
  this.expr = expr;
40
45
  this.has({ expr: expr });
@@ -45,13 +50,21 @@ class ExprAggregateFunction extends expression_def_1.ExpressionDef {
45
50
  }
46
51
  getExpression(fs) {
47
52
  var _a, _b;
48
- let exprVal = (_a = this.expr) === null || _a === void 0 ? void 0 : _a.getExpression(fs);
53
+ // It is never useful to use output fields in an aggregate expression
54
+ // so we don't even allow them to be referenced at all
55
+ const inputFS = fs.isQueryFieldSpace() ? fs.inputSpace() : fs;
56
+ let expr = this.expr;
57
+ let exprVal = (_a = this.expr) === null || _a === void 0 ? void 0 : _a.getExpression(inputFS);
49
58
  let structPath = (_b = this.source) === null || _b === void 0 ? void 0 : _b.refString;
59
+ let sourceRelationship = [];
50
60
  if (this.source) {
51
- const sourceFoot = this.source.getField(fs).found;
52
- if (sourceFoot) {
61
+ const result = this.source.getField(inputFS);
62
+ if (result.found) {
63
+ sourceRelationship = result.relationship;
64
+ const sourceFoot = result.found;
53
65
  const footType = sourceFoot.typeDesc();
54
66
  if ((0, malloy_types_1.isAtomicFieldType)(footType.dataType)) {
67
+ expr = this.source;
55
68
  exprVal = {
56
69
  dataType: footType.dataType,
57
70
  expressionType: footType.expressionType,
@@ -68,13 +81,17 @@ class ExprAggregateFunction extends expression_def_1.ExpressionDef {
68
81
  ],
69
82
  evalSpace: footType.evalSpace,
70
83
  };
71
- // If you reference an output field as the foot, then we need to get the
72
- // source from that field, rather than using the default source.
73
- if (sourceFoot.outputField && sourceFoot instanceof reference_field_1.ReferenceField) {
74
- structPath = sourceFoot.fieldRef.sourceString;
75
- }
76
- else {
77
- structPath = this.source.sourceString;
84
+ structPath = this.source.sourceString;
85
+ // Here we handle a special case where you write `foo.agg()` and `foo` is a
86
+ // dimension which uses only one distinct join path; in this case, we set the
87
+ // locality to be that join path
88
+ const joinUsage = this.getJoinUsage(inputFS);
89
+ const allUsagePaths = joinUsage.map(x => x.map(y => y.name).join('.'));
90
+ const allUsagesSame = allUsagePaths.length > 0 &&
91
+ allUsagePaths.slice(1).every(x => x === allUsagePaths[0]);
92
+ if (allUsagesSame) {
93
+ structPath = allUsagePaths[0];
94
+ sourceRelationship = joinUsage[0];
78
95
  }
79
96
  }
80
97
  else {
@@ -97,6 +114,27 @@ class ExprAggregateFunction extends expression_def_1.ExpressionDef {
97
114
  this.log('Aggregate expression cannot be aggregate');
98
115
  return (0, ast_utils_1.errorFor)('reagggregate');
99
116
  }
117
+ const isAnError = exprVal.dataType === 'error';
118
+ if (!isAnError) {
119
+ const joinUsage = this.getJoinUsage(inputFS);
120
+ // Did the user spceify a source, either as `source.agg()` or `path.to.join.agg()` or `path.to.field.agg()`
121
+ const sourceSpecified = this.source !== undefined || this.explicitSource;
122
+ if (expr) {
123
+ // Is this an `agg(field)`, where field uses no joins (or nested fields)
124
+ const noJoinField = !this.source && joinUsage.every(usage => usage.length === 0);
125
+ if (!noJoinField && !this.isSymmetricFunction()) {
126
+ const usagePaths = getJoinUsagePaths(sourceRelationship, joinUsage);
127
+ const joinError = validateUsagePaths(usagePaths);
128
+ const message = sourceSpecified
129
+ ? joinError
130
+ : 'Join path is required for this calculation';
131
+ if (message) {
132
+ const errorWithSuggestion = suggestNewVersion(message, joinUsage, expr, this.elementType);
133
+ this.log(errorWithSuggestion, joinError ? 'error' : 'warn');
134
+ }
135
+ }
136
+ }
137
+ }
100
138
  if (this.typeCheck(this.expr || this, {
101
139
  ...exprVal,
102
140
  expressionType: 'scalar',
@@ -118,6 +156,167 @@ class ExprAggregateFunction extends expression_def_1.ExpressionDef {
118
156
  }
119
157
  return (0, ast_utils_1.errorFor)('aggregate type check');
120
158
  }
159
+ isSymmetricFunction() {
160
+ return true;
161
+ }
162
+ getJoinUsage(fs) {
163
+ const result = [];
164
+ if (this.source) {
165
+ const lookup = this.source.getField(fs);
166
+ if (lookup.found) {
167
+ const sfd = [{ type: 'field', path: this.source.refString }];
168
+ result.push(...getJoinUsage(fs, sfd));
169
+ }
170
+ }
171
+ if (this.expr) {
172
+ const efd = this.expr.getExpression(fs).value;
173
+ result.push(...getJoinUsage(fs, efd));
174
+ }
175
+ return result;
176
+ }
121
177
  }
122
178
  exports.ExprAggregateFunction = ExprAggregateFunction;
179
+ function getJoinUsage(fs, expr) {
180
+ const result = [];
181
+ const lookup = (fs, path) => {
182
+ const parts = path.split('.');
183
+ const head = parts[0];
184
+ const rest = parts.slice(1);
185
+ const def = fs.entry(head);
186
+ if (def === undefined) {
187
+ throw new Error(`Invalid field lookup ${head}`);
188
+ }
189
+ if (def instanceof static_space_1.StructSpaceField && rest.length > 0) {
190
+ const restDef = lookup(def.fieldSpace, rest.join('.'));
191
+ return {
192
+ ...restDef,
193
+ relationship: [
194
+ { name: head, structRelationship: def.structRelationship },
195
+ ...restDef.relationship,
196
+ ],
197
+ };
198
+ }
199
+ else if (def instanceof space_field_1.SpaceField) {
200
+ if (rest.length !== 0) {
201
+ throw new Error(`${head} cannot contain a ${rest.join('.')}`);
202
+ }
203
+ const fieldDef = def.fieldDef();
204
+ if (fieldDef) {
205
+ return {
206
+ fs,
207
+ def: fieldDef,
208
+ relationship: [],
209
+ };
210
+ }
211
+ throw new Error('No field def');
212
+ }
213
+ else {
214
+ throw new Error('expected a field def or struct');
215
+ }
216
+ };
217
+ (0, utils_1.exprWalk)(expr, frag => {
218
+ if (typeof frag !== 'string') {
219
+ if (frag.type === 'field') {
220
+ const def = lookup(fs, frag.path);
221
+ if (def.def.type !== 'struct' && def.def.type !== 'turtle') {
222
+ if (def.def.e) {
223
+ const defUsage = getJoinUsage(def.fs, def.def.e);
224
+ result.push(...defUsage.map(r => [...def.relationship, ...r]));
225
+ }
226
+ else {
227
+ result.push(def.relationship);
228
+ }
229
+ }
230
+ }
231
+ }
232
+ });
233
+ return result;
234
+ }
235
+ function getJoinUsagePaths(sourceRelationship, joinUsage) {
236
+ const sourceToUsagePaths = [];
237
+ for (const usage of joinUsage) {
238
+ let overlap = 0;
239
+ for (let i = 0; i < sourceRelationship.length && i < usage.length; i++) {
240
+ if (sourceRelationship[i].name === usage[i].name) {
241
+ overlap = i + 1;
242
+ }
243
+ else {
244
+ break;
245
+ }
246
+ }
247
+ const nonOverlapSource = sourceRelationship.slice(overlap);
248
+ const nonOverlapUsage = usage.slice(overlap);
249
+ const sourceToUsagePath = [
250
+ ...nonOverlapSource.map(r => ({ ...r, reverse: true })),
251
+ ...nonOverlapUsage.map(r => ({ ...r, reverse: false })),
252
+ ];
253
+ sourceToUsagePaths.push(sourceToUsagePath);
254
+ }
255
+ return sourceToUsagePaths;
256
+ }
257
+ function validateUsagePaths(usagePaths) {
258
+ for (const path of usagePaths) {
259
+ for (const step of path) {
260
+ if (step.structRelationship.type === 'cross') {
261
+ return `Cannot compute asymmetric aggregate across \`join_cross\` relationship \`${step.name}\``;
262
+ }
263
+ else if (step.structRelationship.type === 'many' && !step.reverse) {
264
+ return `Cannot compute asymmetric aggregate across forward \`join_many\` relationship \`${step.name}\``;
265
+ }
266
+ }
267
+ }
268
+ }
269
+ function suggestNewVersion(joinError, joinUsage, expr, func) {
270
+ if (joinUsage.length === 0) {
271
+ return joinError;
272
+ }
273
+ // Get longest shared prefix
274
+ let longestOverlap = joinUsage[0];
275
+ for (const usage of joinUsage.slice(1)) {
276
+ for (let i = 0; i < longestOverlap.length; i++) {
277
+ const a = longestOverlap[i];
278
+ const b = usage[i];
279
+ if (a.name !== b.name) {
280
+ longestOverlap = longestOverlap.slice(0, i);
281
+ break;
282
+ }
283
+ }
284
+ }
285
+ const usagePaths = getJoinUsagePaths(longestOverlap, joinUsage);
286
+ const usageError = validateUsagePaths(usagePaths);
287
+ // get rid of everything after the last many/cross
288
+ const indexFromEndOfLastMany = longestOverlap
289
+ .slice()
290
+ .reverse()
291
+ .findIndex(x => x.structRelationship.type === 'many' ||
292
+ x.structRelationship.type === 'cross');
293
+ const numJoinsToLastMany = indexFromEndOfLastMany === -1
294
+ ? 0
295
+ : longestOverlap.length - indexFromEndOfLastMany;
296
+ const shortestOverlapWithMany = longestOverlap.slice(0, numJoinsToLastMany);
297
+ const shortUsagePaths = getJoinUsagePaths(shortestOverlapWithMany, joinUsage);
298
+ const shortUsageError = validateUsagePaths(shortUsagePaths);
299
+ const longLocality = longestOverlap.length > 0
300
+ ? longestOverlap.map(r => r.name).join('.')
301
+ : 'source';
302
+ const shortLocality = shortestOverlapWithMany.length > 0
303
+ ? shortestOverlapWithMany.map(r => r.name).join('.')
304
+ : 'source';
305
+ if (usageError) {
306
+ return 'Aggregated dimensional expression contains multiple join paths; rewrite, for example `sum(first_join.field + second_join.field)` as `first_join.field.sum() + second_join.field.sum()`';
307
+ }
308
+ else {
309
+ const longSuggestion = expr instanceof field_references_1.FieldReference
310
+ ? `${expr.refString}.${func}()`
311
+ : expr instanceof expr_id_reference_1.ExprIdReference
312
+ ? `${expr.fieldReference.refString}.${func}()`
313
+ : `${longLocality}.${func}(${expr.code})`;
314
+ const shortSuggestion = `${shortLocality}.${func}(${expr.code})`;
315
+ let result = `${joinError}; use \`${longSuggestion}\``;
316
+ if (shortUsageError === undefined && shortLocality !== longLocality) {
317
+ result += ` or \`${shortSuggestion}\` to get a result weighted with respect to \`${shortLocality}\``;
318
+ }
319
+ return result;
320
+ }
321
+ }
123
322
  //# sourceMappingURL=expr-aggregate-function.js.map
@@ -5,6 +5,7 @@ export declare abstract class ExprAsymmetric extends ExprAggregateFunction {
5
5
  readonly func: 'sum' | 'avg';
6
6
  readonly expr: ExpressionDef | undefined;
7
7
  readonly source?: FieldReference | undefined;
8
- constructor(func: 'sum' | 'avg', expr: ExpressionDef | undefined, source?: FieldReference | undefined);
8
+ constructor(func: 'sum' | 'avg', expr: ExpressionDef | undefined, source?: FieldReference | undefined, explicitSource?: boolean);
9
+ isSymmetricFunction(): boolean;
9
10
  defaultFieldName(): undefined | string;
10
11
  }
@@ -25,13 +25,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
25
25
  exports.ExprAsymmetric = void 0;
26
26
  const expr_aggregate_function_1 = require("./expr-aggregate-function");
27
27
  class ExprAsymmetric extends expr_aggregate_function_1.ExprAggregateFunction {
28
- constructor(func, expr, source) {
29
- super(func, expr);
28
+ constructor(func, expr, source, explicitSource) {
29
+ super(func, expr, explicitSource);
30
30
  this.func = func;
31
31
  this.expr = expr;
32
32
  this.source = source;
33
33
  this.has({ source: source });
34
34
  }
35
+ isSymmetricFunction() {
36
+ return false;
37
+ }
35
38
  defaultFieldName() {
36
39
  if (this.source && this.expr === undefined) {
37
40
  const tag = this.source.nameString;
@@ -2,5 +2,5 @@ import { FieldReference } from '../query-items/field-references';
2
2
  import { ExpressionDef } from '../types/expression-def';
3
3
  import { ExprAsymmetric } from './expr-asymmetric';
4
4
  export declare class ExprAvg extends ExprAsymmetric {
5
- constructor(expr: ExpressionDef | undefined, source?: FieldReference);
5
+ constructor(expr: ExpressionDef | undefined, source?: FieldReference, explicitSource?: boolean);
6
6
  }
@@ -25,8 +25,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
25
25
  exports.ExprAvg = void 0;
26
26
  const expr_asymmetric_1 = require("./expr-asymmetric");
27
27
  class ExprAvg extends expr_asymmetric_1.ExprAsymmetric {
28
- constructor(expr, source) {
29
- super('avg', expr, source);
28
+ constructor(expr, source, explicitSource) {
29
+ super('avg', expr, source, explicitSource);
30
30
  this.has({ source: source });
31
31
  }
32
32
  }
@@ -2,5 +2,5 @@ import { FieldReference } from '../query-items/field-references';
2
2
  import { ExpressionDef } from '../types/expression-def';
3
3
  import { ExprAsymmetric } from './expr-asymmetric';
4
4
  export declare class ExprSum extends ExprAsymmetric {
5
- constructor(expr: ExpressionDef | undefined, source?: FieldReference);
5
+ constructor(expr: ExpressionDef | undefined, source?: FieldReference, explicitSource?: boolean);
6
6
  }
@@ -25,8 +25,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
25
25
  exports.ExprSum = void 0;
26
26
  const expr_asymmetric_1 = require("./expr-asymmetric");
27
27
  class ExprSum extends expr_asymmetric_1.ExprAsymmetric {
28
- constructor(expr, source) {
29
- super('sum', expr, source);
28
+ constructor(expr, source, explicitSource) {
29
+ super('sum', expr, source, explicitSource);
30
30
  this.has({ source: source });
31
31
  }
32
32
  }
@@ -132,16 +132,33 @@ class StaticSpace {
132
132
  });
133
133
  }
134
134
  }
135
+ const relationship = found instanceof struct_space_field_base_1.StructSpaceFieldBase
136
+ ? [
137
+ {
138
+ name: head.refString,
139
+ structRelationship: found.structRelationship,
140
+ },
141
+ ]
142
+ : [];
135
143
  if (rest.length) {
136
144
  if (found instanceof struct_space_field_base_1.StructSpaceFieldBase) {
137
- return found.fieldSpace.lookup(rest);
145
+ const restResult = found.fieldSpace.lookup(rest);
146
+ if (restResult.found) {
147
+ return {
148
+ ...restResult,
149
+ relationship: [...relationship, ...restResult.relationship],
150
+ };
151
+ }
152
+ else {
153
+ return restResult;
154
+ }
138
155
  }
139
156
  return {
140
157
  error: `'${head}' cannot contain a '${rest[0]}'`,
141
158
  found: undefined,
142
159
  };
143
160
  }
144
- return { found, error: undefined };
161
+ return { found, error: undefined, relationship };
145
162
  }
146
163
  isQueryFieldSpace() {
147
164
  return false;
@@ -1,10 +1,11 @@
1
- import { FieldDef, StructDef, TypeDesc } from '../../../model/malloy_types';
1
+ import { FieldDef, StructDef, StructRelationship, TypeDesc } from '../../../model/malloy_types';
2
2
  import { FieldSpace } from '../types/field-space';
3
3
  import { SpaceField } from '../types/space-field';
4
4
  export declare abstract class StructSpaceFieldBase extends SpaceField {
5
5
  protected sourceDef: StructDef;
6
6
  constructor(sourceDef: StructDef);
7
7
  abstract get fieldSpace(): FieldSpace;
8
+ get structRelationship(): StructRelationship;
8
9
  fieldDef(): FieldDef;
9
10
  describeType(): TypeDesc;
10
11
  }
@@ -29,6 +29,9 @@ class StructSpaceFieldBase extends space_field_1.SpaceField {
29
29
  super();
30
30
  this.sourceDef = sourceDef;
31
31
  }
32
+ get structRelationship() {
33
+ return this.sourceDef.structRelationship;
34
+ }
32
35
  fieldDef() {
33
36
  return this.sourceDef;
34
37
  }
@@ -1,6 +1,11 @@
1
+ import { StructRelationship } from '../../../model';
1
2
  import { SpaceEntry } from './space-entry';
2
3
  export interface LookupFound {
3
4
  found: SpaceEntry;
5
+ relationship: {
6
+ name: string;
7
+ structRelationship: StructRelationship;
8
+ }[];
4
9
  error: undefined;
5
10
  }
6
11
  export interface LookupError {
@@ -23,6 +23,7 @@ export declare abstract class MalloyElement {
23
23
  has(kids: Record<string, ChildBody | undefined>): void;
24
24
  get location(): DocumentLocation;
25
25
  set location(loc: DocumentLocation | undefined);
26
+ get code(): string;
26
27
  protected document(): Document | undefined;
27
28
  protected namespace(): NameSpace | undefined;
28
29
  modelEntry(reference: string | ModelEntryReference): ModelEntry | undefined;
@@ -82,6 +82,10 @@ class MalloyElement {
82
82
  set location(loc) {
83
83
  this.codeLocation = loc;
84
84
  }
85
+ get code() {
86
+ var _a, _b;
87
+ return (_b = (_a = this.translator()) === null || _a === void 0 ? void 0 : _a.codeAtLocation(this.location)) !== null && _b !== void 0 ? _b : '';
88
+ }
85
89
  document() {
86
90
  var _a;
87
91
  if (this instanceof Document) {
@@ -78,80 +78,81 @@ export declare class MalloyLexer extends Lexer {
78
78
  static readonly REFINE = 73;
79
79
  static readonly SECOND = 74;
80
80
  static readonly STRING = 75;
81
- static readonly SUM = 76;
82
- static readonly SQL = 77;
83
- static readonly TABLE = 78;
84
- static readonly THEN = 79;
85
- static readonly THIS = 80;
86
- static readonly TIMESTAMP = 81;
87
- static readonly TO = 82;
88
- static readonly TRUE = 83;
89
- static readonly TURTLE = 84;
90
- static readonly WEEK = 85;
91
- static readonly WHEN = 86;
92
- static readonly WITH = 87;
93
- static readonly YEAR = 88;
94
- static readonly UNGROUPED = 89;
95
- static readonly STRING_ESCAPE = 90;
96
- static readonly HACKY_REGEX = 91;
97
- static readonly SQ_STRING = 92;
98
- static readonly DQ_STRING = 93;
99
- static readonly BQ_STRING = 94;
100
- static readonly DOC_ANNOTATION = 95;
101
- static readonly ANNOTATION = 96;
102
- static readonly AMPER = 97;
103
- static readonly ARROW = 98;
104
- static readonly FAT_ARROW = 99;
105
- static readonly OPAREN = 100;
106
- static readonly CPAREN = 101;
107
- static readonly OBRACK = 102;
108
- static readonly CBRACK = 103;
109
- static readonly OCURLY = 104;
110
- static readonly CCURLY = 105;
111
- static readonly DOUBLECOLON = 106;
112
- static readonly TRIPLECOLON = 107;
113
- static readonly EXCLAM = 108;
114
- static readonly COLON = 109;
115
- static readonly COMMA = 110;
116
- static readonly DOT = 111;
117
- static readonly LT = 112;
118
- static readonly GT = 113;
119
- static readonly EQ = 114;
120
- static readonly NE = 115;
121
- static readonly LTE = 116;
122
- static readonly GTE = 117;
123
- static readonly PLUS = 118;
124
- static readonly MINUS = 119;
125
- static readonly STAR = 120;
126
- static readonly STARSTAR = 121;
127
- static readonly SLASH = 122;
128
- static readonly BAR = 123;
129
- static readonly SEMI = 124;
130
- static readonly NOT_MATCH = 125;
131
- static readonly MATCH = 126;
132
- static readonly PERCENT = 127;
133
- static readonly DOUBLE_QMARK = 128;
134
- static readonly QMARK = 129;
135
- static readonly LITERAL_TIMESTAMP = 130;
136
- static readonly LITERAL_HOUR = 131;
137
- static readonly LITERAL_DAY = 132;
138
- static readonly LITERAL_QUARTER = 133;
139
- static readonly LITERAL_MONTH = 134;
140
- static readonly LITERAL_WEEK = 135;
141
- static readonly LITERAL_YEAR = 136;
142
- static readonly IDENTIFIER = 137;
143
- static readonly PERCENT_LITERAL = 138;
144
- static readonly NUMERIC_LITERAL = 139;
145
- static readonly INTEGER_LITERAL = 140;
146
- static readonly BLOCK_COMMENT = 141;
147
- static readonly COMMENT_TO_EOL = 142;
148
- static readonly WHITE_SPACE = 143;
149
- static readonly SQL_BEGIN = 144;
150
- static readonly CLOSE_CODE = 145;
151
- static readonly UNWATED_CHARS_TRAILING_NUMBERS = 146;
152
- static readonly UNEXPECTED_CHAR = 147;
153
- static readonly OPEN_CODE = 148;
154
- static readonly SQL_END = 149;
81
+ static readonly SOURCE_KW = 76;
82
+ static readonly SUM = 77;
83
+ static readonly SQL = 78;
84
+ static readonly TABLE = 79;
85
+ static readonly THEN = 80;
86
+ static readonly THIS = 81;
87
+ static readonly TIMESTAMP = 82;
88
+ static readonly TO = 83;
89
+ static readonly TRUE = 84;
90
+ static readonly TURTLE = 85;
91
+ static readonly WEEK = 86;
92
+ static readonly WHEN = 87;
93
+ static readonly WITH = 88;
94
+ static readonly YEAR = 89;
95
+ static readonly UNGROUPED = 90;
96
+ static readonly STRING_ESCAPE = 91;
97
+ static readonly HACKY_REGEX = 92;
98
+ static readonly SQ_STRING = 93;
99
+ static readonly DQ_STRING = 94;
100
+ static readonly BQ_STRING = 95;
101
+ static readonly DOC_ANNOTATION = 96;
102
+ static readonly ANNOTATION = 97;
103
+ static readonly AMPER = 98;
104
+ static readonly ARROW = 99;
105
+ static readonly FAT_ARROW = 100;
106
+ static readonly OPAREN = 101;
107
+ static readonly CPAREN = 102;
108
+ static readonly OBRACK = 103;
109
+ static readonly CBRACK = 104;
110
+ static readonly OCURLY = 105;
111
+ static readonly CCURLY = 106;
112
+ static readonly DOUBLECOLON = 107;
113
+ static readonly TRIPLECOLON = 108;
114
+ static readonly EXCLAM = 109;
115
+ static readonly COLON = 110;
116
+ static readonly COMMA = 111;
117
+ static readonly DOT = 112;
118
+ static readonly LT = 113;
119
+ static readonly GT = 114;
120
+ static readonly EQ = 115;
121
+ static readonly NE = 116;
122
+ static readonly LTE = 117;
123
+ static readonly GTE = 118;
124
+ static readonly PLUS = 119;
125
+ static readonly MINUS = 120;
126
+ static readonly STAR = 121;
127
+ static readonly STARSTAR = 122;
128
+ static readonly SLASH = 123;
129
+ static readonly BAR = 124;
130
+ static readonly SEMI = 125;
131
+ static readonly NOT_MATCH = 126;
132
+ static readonly MATCH = 127;
133
+ static readonly PERCENT = 128;
134
+ static readonly DOUBLE_QMARK = 129;
135
+ static readonly QMARK = 130;
136
+ static readonly LITERAL_TIMESTAMP = 131;
137
+ static readonly LITERAL_HOUR = 132;
138
+ static readonly LITERAL_DAY = 133;
139
+ static readonly LITERAL_QUARTER = 134;
140
+ static readonly LITERAL_MONTH = 135;
141
+ static readonly LITERAL_WEEK = 136;
142
+ static readonly LITERAL_YEAR = 137;
143
+ static readonly IDENTIFIER = 138;
144
+ static readonly PERCENT_LITERAL = 139;
145
+ static readonly NUMERIC_LITERAL = 140;
146
+ static readonly INTEGER_LITERAL = 141;
147
+ static readonly BLOCK_COMMENT = 142;
148
+ static readonly COMMENT_TO_EOL = 143;
149
+ static readonly WHITE_SPACE = 144;
150
+ static readonly SQL_BEGIN = 145;
151
+ static readonly CLOSE_CODE = 146;
152
+ static readonly UNWATED_CHARS_TRAILING_NUMBERS = 147;
153
+ static readonly UNEXPECTED_CHAR = 148;
154
+ static readonly OPEN_CODE = 149;
155
+ static readonly SQL_END = 150;
155
156
  static readonly SQL_MODE = 1;
156
157
  static readonly channelNames: string[];
157
158
  static readonly modeNames: string[];