@malloydata/malloy 0.0.24-dev230224214106 → 0.0.24-dev230228224434
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.
- package/dist/connection_utils.js +10 -10
- package/dist/dialect/dialect.d.ts +2 -2
- package/dist/dialect/dialect.js +13 -13
- package/dist/dialect/dialect_map.d.ts +1 -1
- package/dist/dialect/duckdb.d.ts +3 -3
- package/dist/dialect/duckdb.js +44 -44
- package/dist/dialect/index.d.ts +6 -6
- package/dist/dialect/postgres.d.ts +3 -3
- package/dist/dialect/postgres.js +46 -46
- package/dist/dialect/standardsql.d.ts +4 -4
- package/dist/dialect/standardsql.js +51 -51
- package/dist/index.d.ts +10 -10
- package/dist/lang/ast/ast-utils.d.ts +1 -1
- package/dist/lang/ast/ast-utils.js +3 -3
- package/dist/lang/ast/elements/define-query.d.ts +3 -3
- package/dist/lang/ast/elements/define-query.js +6 -6
- package/dist/lang/ast/elements/define-source.d.ts +4 -4
- package/dist/lang/ast/elements/define-source.js +8 -8
- package/dist/lang/ast/elements/import-statement.d.ts +2 -2
- package/dist/lang/ast/elements/import-statement.js +7 -7
- package/dist/lang/ast/elements/pipeline-desc.d.ts +5 -5
- package/dist/lang/ast/elements/pipeline-desc.js +11 -11
- package/dist/lang/ast/elements/refined-source.d.ts +4 -4
- package/dist/lang/ast/elements/refined-source.js +6 -6
- package/dist/lang/ast/elements/source.d.ts +3 -3
- package/dist/lang/ast/elements/source.js +1 -1
- package/dist/lang/ast/error-factory.d.ts +1 -1
- package/dist/lang/ast/error-factory.js +15 -15
- package/dist/lang/ast/executors/index-executor.d.ts +7 -7
- package/dist/lang/ast/executors/index-executor.js +4 -4
- package/dist/lang/ast/executors/project-executor.d.ts +5 -5
- package/dist/lang/ast/executors/project-executor.js +2 -2
- package/dist/lang/ast/executors/reduce-executor.d.ts +8 -8
- package/dist/lang/ast/executors/reduce-executor.js +5 -5
- package/dist/lang/ast/expressions/apply.d.ts +2 -2
- package/dist/lang/ast/expressions/apply.js +1 -1
- package/dist/lang/ast/expressions/binary-boolean.d.ts +3 -3
- package/dist/lang/ast/expressions/binary-boolean.js +6 -6
- package/dist/lang/ast/expressions/binary-numeric.d.ts +3 -3
- package/dist/lang/ast/expressions/binary-numeric.js +2 -2
- package/dist/lang/ast/expressions/boolean.d.ts +4 -4
- package/dist/lang/ast/expressions/boolean.js +2 -2
- package/dist/lang/ast/expressions/constant-sub-expression.d.ts +4 -4
- package/dist/lang/ast/expressions/constant-sub-expression.js +12 -12
- package/dist/lang/ast/expressions/expr-add-sub.d.ts +2 -2
- package/dist/lang/ast/expressions/expr-add-sub.js +1 -1
- package/dist/lang/ast/expressions/expr-aggregate-function.d.ts +5 -5
- package/dist/lang/ast/expressions/expr-aggregate-function.js +15 -15
- package/dist/lang/ast/expressions/expr-alternation-tree.d.ts +6 -6
- package/dist/lang/ast/expressions/expr-alternation-tree.js +6 -6
- package/dist/lang/ast/expressions/expr-asymmetric.d.ts +5 -5
- package/dist/lang/ast/expressions/expr-asymmetric.js +3 -3
- package/dist/lang/ast/expressions/expr-avg.d.ts +3 -3
- package/dist/lang/ast/expressions/expr-avg.js +2 -2
- package/dist/lang/ast/expressions/expr-cast.d.ts +4 -4
- package/dist/lang/ast/expressions/expr-cast.js +6 -6
- package/dist/lang/ast/expressions/expr-compare.d.ts +5 -5
- package/dist/lang/ast/expressions/expr-compare.js +9 -9
- package/dist/lang/ast/expressions/expr-count-distinct.d.ts +2 -2
- package/dist/lang/ast/expressions/expr-count-distinct.js +1 -1
- package/dist/lang/ast/expressions/expr-count.d.ts +4 -4
- package/dist/lang/ast/expressions/expr-count.js +10 -10
- package/dist/lang/ast/expressions/expr-filter.d.ts +4 -4
- package/dist/lang/ast/expressions/expr-filter.js +13 -13
- package/dist/lang/ast/expressions/expr-func.d.ts +3 -3
- package/dist/lang/ast/expressions/expr-func.js +8 -8
- package/dist/lang/ast/expressions/expr-granular-time.d.ts +4 -4
- package/dist/lang/ast/expressions/expr-granular-time.js +17 -17
- package/dist/lang/ast/expressions/expr-id-reference.d.ts +4 -4
- package/dist/lang/ast/expressions/expr-id-reference.js +11 -11
- package/dist/lang/ast/expressions/expr-logical-op.d.ts +2 -2
- package/dist/lang/ast/expressions/expr-logical-op.js +1 -1
- package/dist/lang/ast/expressions/expr-max.d.ts +4 -4
- package/dist/lang/ast/expressions/expr-max.js +1 -1
- package/dist/lang/ast/expressions/expr-min.d.ts +4 -4
- package/dist/lang/ast/expressions/expr-min.js +1 -1
- package/dist/lang/ast/expressions/expr-minus.d.ts +3 -3
- package/dist/lang/ast/expressions/expr-minus.js +5 -5
- package/dist/lang/ast/expressions/expr-mul-div.d.ts +2 -2
- package/dist/lang/ast/expressions/expr-mul-div.js +1 -1
- package/dist/lang/ast/expressions/expr-not.d.ts +4 -4
- package/dist/lang/ast/expressions/expr-not.js +3 -3
- package/dist/lang/ast/expressions/expr-now.d.ts +3 -3
- package/dist/lang/ast/expressions/expr-now.js +8 -8
- package/dist/lang/ast/expressions/expr-null.d.ts +2 -2
- package/dist/lang/ast/expressions/expr-null.js +4 -4
- package/dist/lang/ast/expressions/expr-number.d.ts +3 -3
- package/dist/lang/ast/expressions/expr-number.js +2 -2
- package/dist/lang/ast/expressions/expr-parens.d.ts +3 -3
- package/dist/lang/ast/expressions/expr-parens.js +3 -3
- package/dist/lang/ast/expressions/expr-regex.d.ts +2 -2
- package/dist/lang/ast/expressions/expr-regex.js +4 -4
- package/dist/lang/ast/expressions/expr-string.d.ts +3 -3
- package/dist/lang/ast/expressions/expr-string.js +8 -8
- package/dist/lang/ast/expressions/expr-sum.d.ts +3 -3
- package/dist/lang/ast/expressions/expr-sum.js +2 -2
- package/dist/lang/ast/expressions/expr-time-extract.d.ts +4 -4
- package/dist/lang/ast/expressions/expr-time-extract.js +30 -30
- package/dist/lang/ast/expressions/expr-time.d.ts +4 -4
- package/dist/lang/ast/expressions/expr-time.js +10 -10
- package/dist/lang/ast/expressions/expr-ungroup.d.ts +6 -6
- package/dist/lang/ast/expressions/expr-ungroup.js +13 -13
- package/dist/lang/ast/expressions/for-range.d.ts +4 -4
- package/dist/lang/ast/expressions/for-range.js +17 -17
- package/dist/lang/ast/expressions/granular-literal.d.ts +4 -4
- package/dist/lang/ast/expressions/granular-literal.js +34 -34
- package/dist/lang/ast/expressions/partial-compare.d.ts +4 -4
- package/dist/lang/ast/expressions/partial-compare.js +4 -4
- package/dist/lang/ast/expressions/pick-when.d.ts +4 -4
- package/dist/lang/ast/expressions/pick-when.js +32 -32
- package/dist/lang/ast/expressions/range.d.ts +3 -3
- package/dist/lang/ast/expressions/range.js +20 -20
- package/dist/lang/ast/expressions/time-frame.d.ts +2 -2
- package/dist/lang/ast/expressions/time-frame.js +3 -3
- package/dist/lang/ast/expressions/top-by.d.ts +4 -4
- package/dist/lang/ast/expressions/top-by.js +5 -5
- package/dist/lang/ast/expressions/unary.d.ts +1 -1
- package/dist/lang/ast/expressions/unary.js +1 -1
- package/dist/lang/ast/expressions/utils.d.ts +2 -2
- package/dist/lang/ast/expressions/utils.js +6 -6
- package/dist/lang/ast/field-space/column-space-field.d.ts +3 -3
- package/dist/lang/ast/field-space/dynamic-space.d.ts +7 -7
- package/dist/lang/ast/field-space/dynamic-space.js +2 -2
- package/dist/lang/ast/field-space/field-definition-value.d.ts +5 -5
- package/dist/lang/ast/field-space/index-field-space.d.ts +3 -3
- package/dist/lang/ast/field-space/index-field-space.js +4 -4
- package/dist/lang/ast/field-space/join-space-field.d.ts +3 -3
- package/dist/lang/ast/field-space/project-field-space.d.ts +2 -2
- package/dist/lang/ast/field-space/project-field-space.js +5 -5
- package/dist/lang/ast/field-space/query-field-struct.d.ts +3 -3
- package/dist/lang/ast/field-space/query-field-struct.js +1 -1
- package/dist/lang/ast/field-space/query-space-field.d.ts +4 -4
- package/dist/lang/ast/field-space/query-space-field.js +1 -1
- package/dist/lang/ast/field-space/query-spaces.d.ts +11 -11
- package/dist/lang/ast/field-space/query-spaces.js +8 -8
- package/dist/lang/ast/field-space/reference-field.d.ts +5 -5
- package/dist/lang/ast/field-space/reference-field.js +1 -1
- package/dist/lang/ast/field-space/refined-space.d.ts +4 -4
- package/dist/lang/ast/field-space/refined-space.js +2 -2
- package/dist/lang/ast/field-space/rename-space-field.d.ts +3 -3
- package/dist/lang/ast/field-space/rename-space-field.js +2 -2
- package/dist/lang/ast/field-space/static-space.d.ts +7 -7
- package/dist/lang/ast/field-space/static-space.js +12 -12
- package/dist/lang/ast/field-space/struct-space-field-base.d.ts +4 -4
- package/dist/lang/ast/field-space/struct-space-field-base.js +1 -1
- package/dist/lang/ast/field-space/wild-space-field.d.ts +4 -4
- package/dist/lang/ast/field-space/wild-space-field.js +1 -1
- package/dist/lang/ast/fragtype-utils.d.ts +1 -1
- package/dist/lang/ast/fragtype-utils.js +15 -15
- package/dist/lang/ast/index.d.ts +90 -90
- package/dist/lang/ast/parameters/constant-parameter.d.ts +3 -3
- package/dist/lang/ast/parameters/constant-parameter.js +10 -10
- package/dist/lang/ast/parameters/has-parameter.d.ts +3 -3
- package/dist/lang/ast/parameters/has-parameter.js +7 -7
- package/dist/lang/ast/query-elements/anonymous-query.d.ts +3 -3
- package/dist/lang/ast/query-elements/anonymous-query.js +2 -2
- package/dist/lang/ast/query-elements/existing-query.d.ts +4 -4
- package/dist/lang/ast/query-elements/existing-query.js +10 -10
- package/dist/lang/ast/query-elements/full-query.d.ts +4 -4
- package/dist/lang/ast/query-elements/full-query.js +10 -10
- package/dist/lang/ast/query-elements/query-head-struct.d.ts +2 -2
- package/dist/lang/ast/query-elements/query-head-struct.js +2 -2
- package/dist/lang/ast/query-items/field-declaration.d.ts +6 -6
- package/dist/lang/ast/query-items/field-declaration.js +14 -14
- package/dist/lang/ast/query-items/field-references.d.ts +6 -6
- package/dist/lang/ast/query-items/field-references.js +9 -9
- package/dist/lang/ast/query-properties/aggregate.d.ts +2 -2
- package/dist/lang/ast/query-properties/aggregate.js +1 -1
- package/dist/lang/ast/query-properties/declare-fields.d.ts +2 -2
- package/dist/lang/ast/query-properties/declare-fields.js +1 -1
- package/dist/lang/ast/query-properties/dimmensions.d.ts +2 -2
- package/dist/lang/ast/query-properties/dimmensions.js +1 -1
- package/dist/lang/ast/query-properties/filters.d.ts +4 -4
- package/dist/lang/ast/query-properties/filters.js +16 -16
- package/dist/lang/ast/query-properties/group-by.d.ts +2 -2
- package/dist/lang/ast/query-properties/group-by.js +1 -1
- package/dist/lang/ast/query-properties/indexing.d.ts +3 -3
- package/dist/lang/ast/query-properties/indexing.js +3 -3
- package/dist/lang/ast/query-properties/joins.d.ts +6 -6
- package/dist/lang/ast/query-properties/joins.js +27 -27
- package/dist/lang/ast/query-properties/limit.d.ts +1 -1
- package/dist/lang/ast/query-properties/limit.js +1 -1
- package/dist/lang/ast/query-properties/measures.d.ts +2 -2
- package/dist/lang/ast/query-properties/measures.js +1 -1
- package/dist/lang/ast/query-properties/nest-reference.d.ts +2 -2
- package/dist/lang/ast/query-properties/nest-reference.js +1 -1
- package/dist/lang/ast/query-properties/nest.d.ts +7 -7
- package/dist/lang/ast/query-properties/nest.js +7 -7
- package/dist/lang/ast/query-properties/nests.d.ts +2 -2
- package/dist/lang/ast/query-properties/nests.js +1 -1
- package/dist/lang/ast/query-properties/ordering.d.ts +3 -3
- package/dist/lang/ast/query-properties/ordering.js +6 -6
- package/dist/lang/ast/query-properties/project-statement.d.ts +2 -2
- package/dist/lang/ast/query-properties/project-statement.js +1 -1
- package/dist/lang/ast/query-properties/qop-desc.d.ts +7 -7
- package/dist/lang/ast/query-properties/qop-desc.js +20 -20
- package/dist/lang/ast/query-properties/sampling.d.ts +2 -2
- package/dist/lang/ast/query-properties/sampling.js +1 -1
- package/dist/lang/ast/query-properties/top.d.ts +4 -4
- package/dist/lang/ast/query-properties/top.js +5 -5
- package/dist/lang/ast/source-properties/field-list-edit.d.ts +4 -4
- package/dist/lang/ast/source-properties/field-list-edit.js +2 -2
- package/dist/lang/ast/source-properties/primary-key.d.ts +2 -2
- package/dist/lang/ast/source-properties/primary-key.js +2 -2
- package/dist/lang/ast/source-properties/renames.d.ts +2 -2
- package/dist/lang/ast/source-properties/renames.js +3 -3
- package/dist/lang/ast/source-properties/turtles.d.ts +2 -2
- package/dist/lang/ast/source-properties/turtles.js +1 -1
- package/dist/lang/ast/sources/named-source.d.ts +4 -4
- package/dist/lang/ast/sources/named-source.js +5 -5
- package/dist/lang/ast/sources/query-source.d.ts +3 -3
- package/dist/lang/ast/sources/query-source.js +3 -3
- package/dist/lang/ast/sources/sql-source.d.ts +2 -2
- package/dist/lang/ast/sources/sql-source.js +2 -2
- package/dist/lang/ast/sources/table-source.d.ts +2 -2
- package/dist/lang/ast/sources/table-source.js +7 -7
- package/dist/lang/ast/space-seed.d.ts +2 -2
- package/dist/lang/ast/space-seed.js +1 -1
- package/dist/lang/ast/sql-elements/sql-statement.d.ts +4 -4
- package/dist/lang/ast/sql-elements/sql-statement.js +9 -9
- package/dist/lang/ast/sql-elements/sql-string.d.ts +3 -3
- package/dist/lang/ast/sql-elements/sql-string.js +6 -6
- package/dist/lang/ast/struct-utils.d.ts +2 -2
- package/dist/lang/ast/struct-utils.js +3 -3
- package/dist/lang/ast/time-utils.d.ts +6 -6
- package/dist/lang/ast/time-utils.js +46 -46
- package/dist/lang/ast/types/document-compile-result.d.ts +2 -2
- package/dist/lang/ast/types/executor.d.ts +3 -3
- package/dist/lang/ast/types/explore-desc.d.ts +2 -2
- package/dist/lang/ast/types/explore-desc.js +1 -1
- package/dist/lang/ast/types/explore-field.d.ts +3 -3
- package/dist/lang/ast/types/expr-result.d.ts +2 -2
- package/dist/lang/ast/types/expr-value.d.ts +2 -2
- package/dist/lang/ast/types/expression-def.d.ts +4 -4
- package/dist/lang/ast/types/expression-def.js +86 -86
- package/dist/lang/ast/types/field-collection-member.d.ts +3 -3
- package/dist/lang/ast/types/field-decl.d.ts +5 -5
- package/dist/lang/ast/types/field-space.d.ts +5 -5
- package/dist/lang/ast/types/field-space.js +1 -1
- package/dist/lang/ast/types/granular-result.d.ts +3 -3
- package/dist/lang/ast/types/granular-result.js +1 -1
- package/dist/lang/ast/types/lookup-result.d.ts +1 -1
- package/dist/lang/ast/types/malloy-element.d.ts +6 -6
- package/dist/lang/ast/types/malloy-element.js +49 -49
- package/dist/lang/ast/types/model-entry.d.ts +1 -1
- package/dist/lang/ast/types/name-space.d.ts +1 -1
- package/dist/lang/ast/types/nested-query.d.ts +2 -2
- package/dist/lang/ast/types/op-desc.d.ts +2 -2
- package/dist/lang/ast/types/query-comp.d.ts +1 -1
- package/dist/lang/ast/types/query-element.d.ts +3 -3
- package/dist/lang/ast/types/query-item.d.ts +4 -4
- package/dist/lang/ast/types/query-property.d.ts +15 -15
- package/dist/lang/ast/types/source-property.d.ts +8 -8
- package/dist/lang/ast/types/space-entry.d.ts +2 -2
- package/dist/lang/ast/types/space-field.d.ts +4 -4
- package/dist/lang/ast/types/space-field.js +4 -4
- package/dist/lang/ast/types/space-param.d.ts +4 -4
- package/dist/lang/ast/types/space-param.js +4 -4
- package/dist/lang/ast/types/time-result.d.ts +2 -2
- package/dist/lang/ast/types/turtle-headed-pipe.d.ts +2 -2
- package/dist/lang/ast/types/turtle-headed-pipe.js +1 -1
- package/dist/lang/ast/types/type-desc.d.ts +3 -3
- package/dist/lang/field-utils.d.ts +1 -1
- package/dist/lang/field-utils.js +4 -4
- package/dist/lang/index.d.ts +10 -10
- package/dist/lang/malloy-to-ast.d.ts +8 -8
- package/dist/lang/malloy-to-ast.js +68 -68
- package/dist/lang/parse-error-handler.d.ts +3 -3
- package/dist/lang/parse-error-handler.js +4 -4
- package/dist/lang/parse-log.d.ts +2 -2
- package/dist/lang/parse-log.js +1 -1
- package/dist/lang/parse-malloy.d.ts +7 -7
- package/dist/lang/parse-malloy.js +81 -81
- package/dist/lang/parse-tree-walkers/document-completion-walker.d.ts +2 -2
- package/dist/lang/parse-tree-walkers/document-completion-walker.js +38 -38
- package/dist/lang/parse-tree-walkers/document-help-context-walker.d.ts +1 -1
- package/dist/lang/parse-tree-walkers/document-help-context-walker.js +14 -14
- package/dist/lang/parse-tree-walkers/document-highlight-walker.d.ts +3 -3
- package/dist/lang/parse-tree-walkers/document-highlight-walker.js +85 -85
- package/dist/lang/parse-tree-walkers/document-symbol-walker.d.ts +4 -4
- package/dist/lang/parse-tree-walkers/document-symbol-walker.js +40 -40
- package/dist/lang/parse-tree-walkers/explore-query-walker.d.ts +3 -3
- package/dist/lang/parse-tree-walkers/explore-query-walker.js +3 -3
- package/dist/lang/parse-tree-walkers/find-external-references.d.ts +4 -4
- package/dist/lang/parse-tree-walkers/find-external-references.js +2 -2
- package/dist/lang/reference-list.d.ts +1 -1
- package/dist/lang/test/document-help-context-walker.spec.js +9 -9
- package/dist/lang/test/document-symbol-walker.spec.js +32 -32
- package/dist/lang/test/field-symbols.spec.js +87 -87
- package/dist/lang/test/parse.spec.d.ts +1 -1
- package/dist/lang/test/parse.spec.js +768 -768
- package/dist/lang/test/test-translator.d.ts +6 -6
- package/dist/lang/test/test-translator.js +159 -159
- package/dist/lang/translate-response.d.ts +7 -7
- package/dist/lang/translate-response.js +1 -1
- package/dist/lang/zone.d.ts +5 -5
- package/dist/lang/zone.js +8 -8
- package/dist/malloy.d.ts +7 -7
- package/dist/malloy.js +192 -192
- package/dist/model/index.d.ts +2 -2
- package/dist/model/malloy_query.d.ts +12 -12
- package/dist/model/malloy_query.js +497 -502
- package/dist/model/malloy_types.d.ts +68 -68
- package/dist/model/malloy_types.js +102 -102
- package/dist/model/sql_block.d.ts +1 -1
- package/dist/model/sql_block.js +4 -4
- package/dist/model/utils.d.ts +1 -1
- package/dist/model/utils.js +10 -10
- package/dist/runtime_types.d.ts +2 -2
- package/package.json +4 -1
|
@@ -75,20 +75,20 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
75
75
|
/**
|
|
76
76
|
* Log an error message relative to an AST node
|
|
77
77
|
*/
|
|
78
|
-
astError(el, str, sev =
|
|
79
|
-
this.msgLog.log({
|
|
78
|
+
astError(el, str, sev = 'error') {
|
|
79
|
+
this.msgLog.log({ message: str, at: el.location, severity: sev });
|
|
80
80
|
}
|
|
81
81
|
/**
|
|
82
82
|
* Log an error message relative to a parse node
|
|
83
83
|
*/
|
|
84
|
-
contextError(cx, msg, sev =
|
|
84
|
+
contextError(cx, msg, sev = 'error') {
|
|
85
85
|
this.msgLog.log({
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
message: msg,
|
|
87
|
+
at: {
|
|
88
|
+
url: this.parse.subTranslator.sourceURL,
|
|
89
|
+
range: this.parse.subTranslator.rangeFromContext(cx),
|
|
90
90
|
},
|
|
91
|
-
|
|
91
|
+
severity: sev,
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
94
|
onlyExploreProperties(els) {
|
|
@@ -174,7 +174,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
174
174
|
return this.astAt(new ast.ModelEntryReference(this.getIdText(cx)), cx);
|
|
175
175
|
}
|
|
176
176
|
stripQuotes(s) {
|
|
177
|
-
if (s[0] ===
|
|
177
|
+
if (s[0] === '`' || s[0] === "'" || s[0] === '"') {
|
|
178
178
|
if (s[0] === s[s.length - 1]) {
|
|
179
179
|
return s.slice(1, -1);
|
|
180
180
|
}
|
|
@@ -192,8 +192,8 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
192
192
|
}
|
|
193
193
|
astAt(el, cx) {
|
|
194
194
|
el.location = {
|
|
195
|
-
|
|
196
|
-
|
|
195
|
+
url: this.parse.subTranslator.sourceURL,
|
|
196
|
+
range: this.parse.subTranslator.rangeFromContext(cx),
|
|
197
197
|
};
|
|
198
198
|
return el;
|
|
199
199
|
}
|
|
@@ -220,7 +220,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
else {
|
|
223
|
-
this.contextError(cx,
|
|
223
|
+
this.contextError(cx, 'Expected field definition');
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
return visited;
|
|
@@ -233,7 +233,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
233
233
|
throw this.internalError(cx, `expression node unknown type '${element.elementType}'`);
|
|
234
234
|
}
|
|
235
235
|
getSegments(segments) {
|
|
236
|
-
return segments.map(
|
|
236
|
+
return segments.map(cx => this.visitQueryProperties(cx.queryProperties()));
|
|
237
237
|
}
|
|
238
238
|
getFilterShortcut(cx) {
|
|
239
239
|
const el = this.getFilterElement(cx.fieldExpr());
|
|
@@ -256,17 +256,17 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
256
256
|
sqlStr.push(this.visit(part.query()));
|
|
257
257
|
}
|
|
258
258
|
const lastChars = (_a = pcx.SQL_END()) === null || _a === void 0 ? void 0 : _a.text.slice(0, -3);
|
|
259
|
-
sqlStr.push(lastChars ||
|
|
259
|
+
sqlStr.push(lastChars || '');
|
|
260
260
|
this.astAt(sqlStr, pcx);
|
|
261
261
|
}
|
|
262
262
|
visitMalloyDocument(pcx) {
|
|
263
|
-
const stmts = this.onlyDocStatements(pcx.malloyStatement().map(
|
|
263
|
+
const stmts = this.onlyDocStatements(pcx.malloyStatement().map(scx => this.visit(scx)));
|
|
264
264
|
return new ast.Document(stmts);
|
|
265
265
|
}
|
|
266
266
|
visitDefineSourceStatement(pcx) {
|
|
267
267
|
const defsCx = pcx.sourcePropertyList().sourceDefinition();
|
|
268
|
-
const defs = defsCx.map(
|
|
269
|
-
if (defs.length
|
|
268
|
+
const defs = defsCx.map(dcx => this.visitsourceDefinition(dcx));
|
|
269
|
+
if (defs.length === 1) {
|
|
270
270
|
return defs[0];
|
|
271
271
|
}
|
|
272
272
|
return new ast.DefineSourceList(defs);
|
|
@@ -285,7 +285,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
285
285
|
}
|
|
286
286
|
visitExploreProperties(pcx) {
|
|
287
287
|
const filterCx = pcx.filterShortcut();
|
|
288
|
-
const visited = pcx.exploreStatement().map(
|
|
288
|
+
const visited = pcx.exploreStatement().map(ecx => this.visit(ecx));
|
|
289
289
|
const propList = new ast.ExploreDesc(this.onlyExploreProperties(visited));
|
|
290
290
|
if (filterCx) {
|
|
291
291
|
propList.push(this.getFilterShortcut(filterCx));
|
|
@@ -317,13 +317,13 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
317
317
|
if (join instanceof ast.Join) {
|
|
318
318
|
joins.push(join);
|
|
319
319
|
if (join instanceof ast.ExpressionJoin) {
|
|
320
|
-
join.joinType =
|
|
321
|
-
if (join.joinOn
|
|
322
|
-
join.log(
|
|
320
|
+
join.joinType = 'many';
|
|
321
|
+
if (join.joinOn === undefined) {
|
|
322
|
+
join.log('join_many: requires ON expression');
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
325
|
else if (join instanceof ast.KeyJoin) {
|
|
326
|
-
join.log(
|
|
326
|
+
join.log('Foreign key join not legal in join_many:');
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
}
|
|
@@ -336,7 +336,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
336
336
|
if (join instanceof ast.Join) {
|
|
337
337
|
joins.push(join);
|
|
338
338
|
if (join instanceof ast.ExpressionJoin) {
|
|
339
|
-
join.joinType =
|
|
339
|
+
join.joinType = 'one';
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
342
|
}
|
|
@@ -349,17 +349,17 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
349
349
|
if (join instanceof ast.Join) {
|
|
350
350
|
joins.push(join);
|
|
351
351
|
if (join instanceof ast.ExpressionJoin) {
|
|
352
|
-
join.joinType =
|
|
352
|
+
join.joinType = 'cross';
|
|
353
353
|
}
|
|
354
354
|
else {
|
|
355
|
-
join.log(
|
|
355
|
+
join.log('Foreign key join not legal in join_cross:');
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
358
|
}
|
|
359
359
|
return new ast.Joins(joins);
|
|
360
360
|
}
|
|
361
361
|
getJoinList(pcx) {
|
|
362
|
-
return pcx.joinDef().map(
|
|
362
|
+
return pcx.joinDef().map(jcx => this.visit(jcx));
|
|
363
363
|
}
|
|
364
364
|
getJoinSource(name, ecx) {
|
|
365
365
|
if (ecx) {
|
|
@@ -414,12 +414,12 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
414
414
|
}
|
|
415
415
|
visitDefExploreRename(pcx) {
|
|
416
416
|
const rcxs = pcx.renameList().exploreRenameDef();
|
|
417
|
-
const renames = rcxs.map(
|
|
417
|
+
const renames = rcxs.map(rcx => this.visitExploreRenameDef(rcx));
|
|
418
418
|
const stmt = new ast.Renames(renames);
|
|
419
419
|
return this.astAt(stmt, pcx);
|
|
420
420
|
}
|
|
421
421
|
visitFilterClauseList(pcx) {
|
|
422
|
-
return new ast.Filter(pcx.fieldExpr().map(
|
|
422
|
+
return new ast.Filter(pcx.fieldExpr().map(f => this.getFilterElement(f)));
|
|
423
423
|
}
|
|
424
424
|
visitFilterByShortcut(pcx) {
|
|
425
425
|
const el = this.getFilterElement(pcx.fieldExpr());
|
|
@@ -438,7 +438,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
438
438
|
visitSubQueryDefList(pcx) {
|
|
439
439
|
const babyTurtles = pcx
|
|
440
440
|
.exploreQueryDef()
|
|
441
|
-
.map(
|
|
441
|
+
.map(cx => this.visitExploreQueryDef(cx));
|
|
442
442
|
return new ast.Turtles(babyTurtles);
|
|
443
443
|
}
|
|
444
444
|
visitDefExplorePrimaryKey(pcx) {
|
|
@@ -448,18 +448,18 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
448
448
|
visitFieldNameList(pcx) {
|
|
449
449
|
const members = pcx
|
|
450
450
|
.fieldName()
|
|
451
|
-
.map(
|
|
451
|
+
.map(cx => new ast.FieldReference([this.getFieldName(cx)]));
|
|
452
452
|
return new ast.FieldReferences(members);
|
|
453
453
|
}
|
|
454
454
|
visitDefExploreEditField(pcx) {
|
|
455
|
-
const action = pcx.ACCEPT() ?
|
|
455
|
+
const action = pcx.ACCEPT() ? 'accept' : 'except';
|
|
456
456
|
return new ast.FieldListEdit(action, this.visitFieldNameList(pcx.fieldNameList()));
|
|
457
457
|
}
|
|
458
458
|
visitQueryProperties(pcx) {
|
|
459
459
|
const qProps = pcx
|
|
460
460
|
.queryStatement()
|
|
461
|
-
.map(
|
|
462
|
-
.filter(
|
|
461
|
+
.map(qcx => this.astAt(this.visit(qcx), qcx))
|
|
462
|
+
.filter((p) => {
|
|
463
463
|
if (ast.isQueryProperty(p)) {
|
|
464
464
|
return true;
|
|
465
465
|
}
|
|
@@ -473,7 +473,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
473
473
|
return new ast.QOPDesc(qProps);
|
|
474
474
|
}
|
|
475
475
|
visitFieldPath(pcx) {
|
|
476
|
-
const names = pcx.fieldName().map(
|
|
476
|
+
const names = pcx.fieldName().map(nameCx => this.getFieldName(nameCx));
|
|
477
477
|
return this.astAt(new ast.FieldReference(names), pcx);
|
|
478
478
|
}
|
|
479
479
|
visitQueryFieldDef(pcx) {
|
|
@@ -493,7 +493,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
493
493
|
// return noItem;
|
|
494
494
|
// }
|
|
495
495
|
getQueryItems(pcx) {
|
|
496
|
-
const itemList = pcx.queryFieldEntry().map(
|
|
496
|
+
const itemList = pcx.queryFieldEntry().map(e => this.visit(e));
|
|
497
497
|
return this.onlyQueryRefs(itemList);
|
|
498
498
|
}
|
|
499
499
|
visitAggregateStatement(pcx) {
|
|
@@ -517,22 +517,22 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
517
517
|
}
|
|
518
518
|
visitWildMember(pcx) {
|
|
519
519
|
const nameCx = pcx.fieldPath();
|
|
520
|
-
const stars = pcx.STAR() ?
|
|
520
|
+
const stars = pcx.STAR() ? '*' : '**';
|
|
521
521
|
const join = nameCx ? this.visitFieldPath(nameCx) : undefined;
|
|
522
522
|
return new ast.WildcardFieldReference(join, stars);
|
|
523
523
|
}
|
|
524
524
|
visitIndexFields(pcx) {
|
|
525
|
-
const refList = pcx.indexElement().map(
|
|
526
|
-
const hasStar = el.STAR()
|
|
525
|
+
const refList = pcx.indexElement().map(el => {
|
|
526
|
+
const hasStar = el.STAR() !== undefined;
|
|
527
527
|
const pathCx = el.fieldPath();
|
|
528
528
|
if (!pathCx) {
|
|
529
|
-
return new ast.WildcardFieldReference(undefined,
|
|
529
|
+
return new ast.WildcardFieldReference(undefined, '*');
|
|
530
530
|
}
|
|
531
531
|
const path = this.visitFieldPath(pathCx);
|
|
532
532
|
if (!hasStar) {
|
|
533
533
|
return this.astAt(path, pcx);
|
|
534
534
|
}
|
|
535
|
-
return this.astAt(new ast.WildcardFieldReference(path,
|
|
535
|
+
return this.astAt(new ast.WildcardFieldReference(path, '*'), pcx);
|
|
536
536
|
});
|
|
537
537
|
return new ast.FieldReferences(refList);
|
|
538
538
|
}
|
|
@@ -549,7 +549,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
549
549
|
return new ast.Limit(this.getNumber(pcx.INTEGER_LITERAL()));
|
|
550
550
|
}
|
|
551
551
|
visitOrderBySpec(pcx) {
|
|
552
|
-
const dir = pcx.ASC() ?
|
|
552
|
+
const dir = pcx.ASC() ? 'asc' : pcx.DESC() ? 'desc' : undefined;
|
|
553
553
|
const ncx = pcx.INTEGER_LITERAL();
|
|
554
554
|
if (ncx) {
|
|
555
555
|
return new ast.OrderBy(this.getNumber(ncx), dir);
|
|
@@ -561,7 +561,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
561
561
|
throw this.internalError(pcx, "can't parse order_by specification");
|
|
562
562
|
}
|
|
563
563
|
visitOrdering(pcx) {
|
|
564
|
-
const orderList = pcx.orderBySpec().map(
|
|
564
|
+
const orderList = pcx.orderBySpec().map(o => this.visitOrderBySpec(o));
|
|
565
565
|
return this.astAt(new ast.Ordering(orderList), pcx);
|
|
566
566
|
}
|
|
567
567
|
visitTopStatement(pcx) {
|
|
@@ -626,7 +626,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
626
626
|
visitTopLevelQueryDefs(pcx) {
|
|
627
627
|
const stmts = pcx
|
|
628
628
|
.topLevelQueryDef()
|
|
629
|
-
.map(
|
|
629
|
+
.map(cx => this.visitTopLevelQueryDef(cx));
|
|
630
630
|
if (stmts.length === 1) {
|
|
631
631
|
return stmts[0];
|
|
632
632
|
}
|
|
@@ -648,8 +648,8 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
648
648
|
throw this.internalError(pcx, `Anonymous query matched, but ${query.elementType} found`);
|
|
649
649
|
}
|
|
650
650
|
visitNestedQueryList(pcx) {
|
|
651
|
-
const nestedList = pcx.nestEntry().map(
|
|
652
|
-
if (nestedList.length
|
|
651
|
+
const nestedList = pcx.nestEntry().map(cx => this.visit(cx));
|
|
652
|
+
if (nestedList.length === 1) {
|
|
653
653
|
return nestedList[0];
|
|
654
654
|
}
|
|
655
655
|
return new ast.Nests(this.onlyNestedQueries(nestedList));
|
|
@@ -681,20 +681,20 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
681
681
|
return new ast.ExprNot(this.getFieldExpr(pcx.fieldExpr()));
|
|
682
682
|
}
|
|
683
683
|
visitExprBool(pcx) {
|
|
684
|
-
return new ast.Boolean(pcx.TRUE() ?
|
|
684
|
+
return new ast.Boolean(pcx.TRUE() ? 'true' : 'false');
|
|
685
685
|
}
|
|
686
686
|
allFieldExpressions(exprList) {
|
|
687
|
-
return exprList.map(
|
|
687
|
+
return exprList.map(ecx => this.getFieldExpr(ecx));
|
|
688
688
|
}
|
|
689
689
|
visitExprLogical(pcx) {
|
|
690
690
|
const left = this.getFieldExpr(pcx.fieldExpr(0));
|
|
691
691
|
const right = this.getFieldExpr(pcx.fieldExpr(1));
|
|
692
|
-
return new ast.ExprLogicalOp(left, pcx.AND() ?
|
|
692
|
+
return new ast.ExprLogicalOp(left, pcx.AND() ? 'and' : 'or', right);
|
|
693
693
|
}
|
|
694
694
|
visitExprLogicalTree(pcx) {
|
|
695
695
|
const left = this.getFieldExpr(pcx.fieldExpr());
|
|
696
696
|
const right = this.getFieldExpr(pcx.partialAllowedFieldExpr());
|
|
697
|
-
return new ast.ExprAlternationTree(left, pcx.AMPER() ?
|
|
697
|
+
return new ast.ExprAlternationTree(left, pcx.AMPER() ? '&' : '|', right);
|
|
698
698
|
}
|
|
699
699
|
visitPartialAllowedFieldExpr(pcx) {
|
|
700
700
|
var _a;
|
|
@@ -730,7 +730,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
730
730
|
}
|
|
731
731
|
else {
|
|
732
732
|
this.contextError(pcx, `'${pcx.text}' is not a number`);
|
|
733
|
-
return new ast.ExprNumber(
|
|
733
|
+
return new ast.ExprNumber('42');
|
|
734
734
|
}
|
|
735
735
|
}
|
|
736
736
|
visitExprFieldPath(pcx) {
|
|
@@ -749,11 +749,11 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
749
749
|
visitExprAddSub(pcx) {
|
|
750
750
|
const lhs = this.getFieldExpr(pcx.fieldExpr(0));
|
|
751
751
|
const rhs = this.getFieldExpr(pcx.fieldExpr(1));
|
|
752
|
-
const op = pcx.PLUS() ?
|
|
752
|
+
const op = pcx.PLUS() ? '+' : '-';
|
|
753
753
|
return new ast.ExprAddSub(lhs, op, rhs);
|
|
754
754
|
}
|
|
755
755
|
visitExprMulDiv(pcx) {
|
|
756
|
-
const op = pcx.STAR() ?
|
|
756
|
+
const op = pcx.STAR() ? '*' : pcx.SLASH() ? '/' : '%';
|
|
757
757
|
return new ast.ExprMulDiv(this.getFieldExpr(pcx.fieldExpr(0)), op, this.getFieldExpr(pcx.fieldExpr(1)));
|
|
758
758
|
}
|
|
759
759
|
visitExprCompare(pcx) {
|
|
@@ -767,9 +767,9 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
767
767
|
return this.astAt(new ast.ExprCountDistinct(this.getFieldExpr(pcx.fieldExpr())), pcx);
|
|
768
768
|
}
|
|
769
769
|
visitExprUngroup(pcx) {
|
|
770
|
-
const flist = pcx.fieldName().map(
|
|
770
|
+
const flist = pcx.fieldName().map(fcx => this.getFieldName(fcx));
|
|
771
771
|
const kw = this.getIdText(pcx.ungroup()).toLocaleLowerCase();
|
|
772
|
-
return this.astAt(new ast.ExprUngroup(kw
|
|
772
|
+
return this.astAt(new ast.ExprUngroup(kw === 'all' ? kw : 'exclude', this.getFieldExpr(pcx.fieldExpr()), flist), pcx);
|
|
773
773
|
}
|
|
774
774
|
visitExprAggregate(pcx) {
|
|
775
775
|
const pathCx = pcx.fieldPath();
|
|
@@ -778,7 +778,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
778
778
|
const exprDef = pcx.fieldExpr();
|
|
779
779
|
if (pcx.aggregate().COUNT()) {
|
|
780
780
|
if (exprDef) {
|
|
781
|
-
this.contextError(exprDef,
|
|
781
|
+
this.contextError(exprDef, 'Ignored expression inside COUNT()');
|
|
782
782
|
}
|
|
783
783
|
return new ast.ExprCount(source);
|
|
784
784
|
}
|
|
@@ -791,24 +791,24 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
791
791
|
const expr = exprDef ? this.getFieldExpr(exprDef) : undefined;
|
|
792
792
|
if (pcx.aggregate().MIN()) {
|
|
793
793
|
if (path) {
|
|
794
|
-
this.contextError(pcx,
|
|
794
|
+
this.contextError(pcx, 'Path not legal for min()');
|
|
795
795
|
}
|
|
796
796
|
else if (expr) {
|
|
797
797
|
return new ast.ExprMin(expr);
|
|
798
798
|
}
|
|
799
799
|
else {
|
|
800
|
-
this.contextError(pcx,
|
|
800
|
+
this.contextError(pcx, 'Missing expression for min');
|
|
801
801
|
}
|
|
802
802
|
}
|
|
803
803
|
else if (pcx.aggregate().MAX()) {
|
|
804
804
|
if (path) {
|
|
805
|
-
this.contextError(pcx,
|
|
805
|
+
this.contextError(pcx, 'Path not legal for max()');
|
|
806
806
|
}
|
|
807
807
|
else if (expr) {
|
|
808
808
|
return new ast.ExprMax(expr);
|
|
809
809
|
}
|
|
810
810
|
else {
|
|
811
|
-
this.contextError(pcx,
|
|
811
|
+
this.contextError(pcx, 'Missing expression for max');
|
|
812
812
|
}
|
|
813
813
|
}
|
|
814
814
|
else if (pcx.aggregate().AVG()) {
|
|
@@ -821,7 +821,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
821
821
|
}
|
|
822
822
|
visitExprApply(pcx) {
|
|
823
823
|
if (pcx.COLON()) {
|
|
824
|
-
this.contextError(pcx, "':' for apply is deprecated, use '?'",
|
|
824
|
+
this.contextError(pcx, "':' for apply is deprecated, use '?'", 'warn');
|
|
825
825
|
}
|
|
826
826
|
return new ast.Apply(this.getFieldExpr(pcx.fieldExpr()), this.getFieldExpr(pcx.partialAllowedFieldExpr()));
|
|
827
827
|
}
|
|
@@ -869,8 +869,8 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
869
869
|
fn = dCx.text;
|
|
870
870
|
}
|
|
871
871
|
else {
|
|
872
|
-
this.contextError(pcx,
|
|
873
|
-
fn =
|
|
872
|
+
this.contextError(pcx, 'Funciton name error');
|
|
873
|
+
fn = 'FUNCTION_NAME_ERROR';
|
|
874
874
|
}
|
|
875
875
|
if (ast.ExprTimeExtract.extractor(fn)) {
|
|
876
876
|
return this.astAt(new ast.ExprTimeExtract(fn, args), pcx);
|
|
@@ -881,7 +881,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
881
881
|
return new ast.ExprDuration(this.getFieldExpr(pcx.fieldExpr()), this.visitTimeframe(pcx.timeframe()).text);
|
|
882
882
|
}
|
|
883
883
|
visitPickStatement(pcx) {
|
|
884
|
-
const picks = pcx.pick().map(
|
|
884
|
+
const picks = pcx.pick().map(pwCx => {
|
|
885
885
|
let pickExpr;
|
|
886
886
|
if (pwCx._pickValue) {
|
|
887
887
|
pickExpr = this.getFieldExpr(pwCx._pickValue);
|
|
@@ -955,7 +955,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
955
955
|
const nmCx = blockEnt.connectionName();
|
|
956
956
|
if (nmCx) {
|
|
957
957
|
if (connectionName) {
|
|
958
|
-
this.contextError(nmCx,
|
|
958
|
+
this.contextError(nmCx, 'Cannot redefine connection');
|
|
959
959
|
}
|
|
960
960
|
else {
|
|
961
961
|
connectionName = this.getIdText(nmCx);
|
|
@@ -976,14 +976,14 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
976
976
|
visitSampleStatement(pcx) {
|
|
977
977
|
const rowCx = pcx.sampleSpec().INTEGER_LITERAL();
|
|
978
978
|
if (rowCx) {
|
|
979
|
-
return new ast.SampleProperty({
|
|
979
|
+
return new ast.SampleProperty({ rows: this.getNumber(rowCx) });
|
|
980
980
|
}
|
|
981
981
|
const limitCx = pcx.sampleSpec().PERCENT_LITERAL();
|
|
982
982
|
if (limitCx) {
|
|
983
|
-
return new ast.SampleProperty({
|
|
983
|
+
return new ast.SampleProperty({ percent: this.getNumber(limitCx) });
|
|
984
984
|
}
|
|
985
|
-
const enabled = pcx.sampleSpec().TRUE()
|
|
986
|
-
return new ast.SampleProperty({
|
|
985
|
+
const enabled = pcx.sampleSpec().TRUE() !== undefined;
|
|
986
|
+
return new ast.SampleProperty({ enable: enabled });
|
|
987
987
|
}
|
|
988
988
|
}
|
|
989
989
|
exports.MalloyToAST = MalloyToAST;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ANTLRErrorListener, Token } from
|
|
2
|
-
import { MessageLogger } from
|
|
3
|
-
import { MalloyTranslation } from
|
|
1
|
+
import { ANTLRErrorListener, Token } from 'antlr4ts';
|
|
2
|
+
import { MessageLogger } from './parse-log';
|
|
3
|
+
import { MalloyTranslation } from './parse-malloy';
|
|
4
4
|
export declare class MalloyParserErrorHandler implements ANTLRErrorListener<Token> {
|
|
5
5
|
readonly translator: MalloyTranslation;
|
|
6
6
|
readonly messages: MessageLogger;
|
|
@@ -29,13 +29,13 @@ class MalloyParserErrorHandler {
|
|
|
29
29
|
this.messages = messages;
|
|
30
30
|
}
|
|
31
31
|
syntaxError(recognizer, offendingSymbol, line, charPositionInLine, msg, _e) {
|
|
32
|
-
const errAt = {
|
|
32
|
+
const errAt = { line: line - 1, character: charPositionInLine };
|
|
33
33
|
const range = offendingSymbol
|
|
34
34
|
? this.translator.rangeFromToken(offendingSymbol)
|
|
35
|
-
: {
|
|
35
|
+
: { start: errAt, end: errAt };
|
|
36
36
|
const error = {
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
message: msg,
|
|
38
|
+
at: { url: this.translator.sourceURL, range },
|
|
39
39
|
};
|
|
40
40
|
this.messages.log(error);
|
|
41
41
|
}
|
package/dist/lang/parse-log.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DocumentLocation } from
|
|
2
|
-
export declare type LogSeverity =
|
|
1
|
+
import { DocumentLocation } from '../model/malloy_types';
|
|
2
|
+
export declare type LogSeverity = 'error' | 'warn' | 'debug';
|
|
3
3
|
/**
|
|
4
4
|
* Default severity is "error"
|
|
5
5
|
*/
|
package/dist/lang/parse-log.js
CHANGED
|
@@ -40,7 +40,7 @@ class MessageLog {
|
|
|
40
40
|
return !this.hasErrors();
|
|
41
41
|
}
|
|
42
42
|
hasErrors() {
|
|
43
|
-
const firstError = this.rawLog.find(
|
|
43
|
+
const firstError = this.rawLog.find(l => l.severity !== 'warn');
|
|
44
44
|
return firstError !== undefined;
|
|
45
45
|
}
|
|
46
46
|
empty() {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { CodePointCharStream, CommonTokenStream, ParserRuleContext, Token } from
|
|
2
|
-
import { ParseTree } from
|
|
3
|
-
import { DocumentLocation, DocumentPosition, DocumentRange, DocumentReference, ModelDef, NamedStructDefs, Query, SQLBlockStructDef, StructDef } from
|
|
4
|
-
import { MessageLog } from
|
|
5
|
-
import { Zone, ZoneData } from
|
|
6
|
-
import { ReferenceList } from
|
|
7
|
-
import { ASTResponse, CompletionsResponse, DataRequestResponse, ErrorResponse, FatalResponse, FinalResponse, HelpContextResponse, MetadataResponse, ModelDataRequest, NeedURLData, TranslateResponse } from
|
|
1
|
+
import { CodePointCharStream, CommonTokenStream, ParserRuleContext, Token } from 'antlr4ts';
|
|
2
|
+
import { ParseTree } from 'antlr4ts/tree';
|
|
3
|
+
import { DocumentLocation, DocumentPosition, DocumentRange, DocumentReference, ModelDef, NamedStructDefs, Query, SQLBlockStructDef, StructDef } from '../model/malloy_types';
|
|
4
|
+
import { MessageLog } from './parse-log';
|
|
5
|
+
import { Zone, ZoneData } from './zone';
|
|
6
|
+
import { ReferenceList } from './reference-list';
|
|
7
|
+
import { ASTResponse, CompletionsResponse, DataRequestResponse, ErrorResponse, FatalResponse, FinalResponse, HelpContextResponse, MetadataResponse, ModelDataRequest, NeedURLData, TranslateResponse } from './translate-response';
|
|
8
8
|
export declare type StepResponses = DataRequestResponse | ASTResponse | TranslateResponse | ParseResponse | MetadataResponse;
|
|
9
9
|
/**
|
|
10
10
|
* A Translation is a series of translation steps. Each step can depend
|