@malloydata/malloy 0.0.22-dev230126015148 → 0.0.22-dev230202171033
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/lang/ast/ast-main.d.ts +18 -815
- package/dist/lang/ast/ast-main.js +106 -3241
- package/dist/lang/ast/ast-utils.d.ts +10 -0
- package/dist/lang/ast/ast-utils.js +42 -0
- package/dist/lang/ast/elements/define-explore.d.ts +17 -0
- package/dist/lang/ast/elements/define-explore.js +79 -0
- package/dist/lang/ast/elements/define-query.d.ts +14 -0
- package/dist/lang/ast/elements/define-query.js +56 -0
- package/dist/lang/ast/elements/mallobj.d.ts +12 -0
- package/dist/lang/ast/elements/mallobj.js +53 -0
- package/dist/lang/ast/elements/pipeline-desc.d.ts +28 -0
- package/dist/lang/ast/elements/pipeline-desc.js +102 -0
- package/dist/lang/ast/elements/refined-explore.d.ts +15 -0
- package/dist/lang/ast/elements/refined-explore.js +121 -0
- package/dist/lang/ast/error-factory.d.ts +9 -0
- package/dist/lang/ast/error-factory.js +61 -0
- package/dist/lang/ast/executors/index-executor.d.ts +18 -0
- package/dist/lang/ast/executors/index-executor.js +96 -0
- package/dist/lang/ast/executors/project-executor.d.ts +10 -0
- package/dist/lang/ast/executors/project-executor.js +68 -0
- package/dist/lang/ast/executors/reduce-executor.d.ts +20 -0
- package/dist/lang/ast/executors/reduce-executor.js +149 -0
- package/dist/lang/ast/explore-properties/field-list-edit.d.ts +8 -0
- package/dist/lang/ast/explore-properties/field-list-edit.js +36 -0
- package/dist/lang/ast/explore-properties/primary-key.d.ts +7 -0
- package/dist/lang/ast/{apply-expr.js → explore-properties/primary-key.js} +9 -8
- package/dist/lang/ast/explore-properties/renames.d.ts +11 -0
- package/dist/lang/ast/explore-properties/renames.js +43 -0
- package/dist/lang/ast/explore-properties/turtles.d.ts +5 -0
- package/dist/lang/ast/explore-properties/turtles.js +33 -0
- package/dist/lang/ast/expressions/apply.d.ts +8 -0
- package/dist/lang/ast/expressions/apply.js +37 -0
- package/dist/lang/ast/expressions/binary-boolean.d.ts +12 -0
- package/dist/lang/ast/expressions/binary-boolean.js +54 -0
- package/dist/lang/ast/expressions/binary-numeric.d.ts +11 -0
- package/dist/lang/ast/expressions/binary-numeric.js +42 -0
- package/dist/lang/ast/expressions/boolean.d.ts +8 -0
- package/dist/lang/ast/expressions/boolean.js +39 -0
- package/dist/lang/ast/expressions/constant-sub-expression.d.ts +16 -0
- package/dist/lang/ast/expressions/constant-sub-expression.js +98 -0
- package/dist/lang/ast/expressions/expr-add-sub.d.ts +4 -0
- package/dist/lang/ast/expressions/expr-add-sub.js +34 -0
- package/dist/lang/ast/expressions/expr-aggregate-function.d.ts +15 -0
- package/dist/lang/ast/expressions/expr-aggregate-function.js +99 -0
- package/dist/lang/ast/expressions/expr-alternation-tree.d.ts +11 -0
- package/dist/lang/ast/expressions/expr-alternation-tree.js +54 -0
- package/dist/lang/ast/expressions/expr-asymmetric.d.ts +10 -0
- package/dist/lang/ast/expressions/expr-asymmetric.js +27 -0
- package/dist/lang/ast/expressions/expr-avg.d.ts +6 -0
- package/dist/lang/ast/expressions/expr-avg.js +34 -0
- package/dist/lang/ast/expressions/expr-case.d.ts +11 -0
- package/dist/lang/ast/expressions/expr-case.js +84 -0
- package/dist/lang/ast/expressions/expr-cast.d.ts +13 -0
- package/dist/lang/ast/expressions/expr-cast.js +29 -0
- package/dist/lang/ast/expressions/expr-compare.d.ts +10 -0
- package/dist/lang/ast/expressions/expr-compare.js +48 -0
- package/dist/lang/ast/expressions/expr-count-distinct.d.ts +6 -0
- package/dist/lang/ast/expressions/expr-count-distinct.js +35 -0
- package/dist/lang/ast/expressions/expr-count.d.ts +11 -0
- package/dist/lang/ast/expressions/expr-count.js +57 -0
- package/dist/lang/ast/expressions/expr-filter.d.ts +12 -0
- package/dist/lang/ast/expressions/expr-filter.js +69 -0
- package/dist/lang/ast/expressions/expr-func.d.ts +10 -0
- package/dist/lang/ast/expressions/expr-func.js +63 -0
- package/dist/lang/ast/expressions/expr-granular-time.d.ts +24 -0
- package/dist/lang/ast/expressions/expr-granular-time.js +117 -0
- package/dist/lang/ast/expressions/expr-id-reference.d.ts +12 -0
- package/dist/lang/ast/expressions/expr-id-reference.js +76 -0
- package/dist/lang/ast/expressions/expr-logical-op.d.ts +9 -0
- package/dist/lang/ast/expressions/expr-logical-op.js +36 -0
- package/dist/lang/ast/expressions/expr-max.d.ts +9 -0
- package/dist/lang/ast/expressions/expr-max.js +16 -0
- package/dist/lang/ast/expressions/expr-min.d.ts +9 -0
- package/dist/lang/ast/expressions/expr-min.js +16 -0
- package/dist/lang/ast/expressions/expr-minus.d.ts +9 -0
- package/dist/lang/ast/expressions/expr-minus.js +48 -0
- package/dist/lang/ast/expressions/expr-mul-div.d.ts +4 -0
- package/dist/lang/ast/expressions/expr-mul-div.js +34 -0
- package/dist/lang/ast/expressions/expr-not.d.ts +10 -0
- package/dist/lang/ast/expressions/expr-not.js +49 -0
- package/dist/lang/ast/expressions/expr-now.d.ts +7 -0
- package/dist/lang/ast/expressions/expr-now.js +46 -0
- package/dist/lang/ast/expressions/expr-null.d.ts +6 -0
- package/dist/lang/ast/expressions/expr-null.js +41 -0
- package/dist/lang/ast/expressions/expr-number.d.ts +10 -0
- package/dist/lang/ast/expressions/expr-number.js +42 -0
- package/dist/lang/ast/expressions/expr-parens.d.ts +10 -0
- package/dist/lang/ast/expressions/expr-parens.js +42 -0
- package/dist/lang/ast/expressions/expr-regex.d.ts +8 -0
- package/dist/lang/ast/expressions/expr-regex.js +42 -0
- package/dist/lang/ast/expressions/expr-string.d.ts +9 -0
- package/dist/lang/ast/expressions/expr-string.js +50 -0
- package/dist/lang/ast/expressions/expr-sum.d.ts +6 -0
- package/dist/lang/ast/expressions/expr-sum.js +12 -0
- package/dist/lang/ast/expressions/expr-time-extract.d.ts +13 -0
- package/dist/lang/ast/expressions/expr-time-extract.js +117 -0
- package/dist/lang/ast/expressions/expr-time.d.ts +11 -0
- package/dist/lang/ast/expressions/expr-time.js +62 -0
- package/dist/lang/ast/expressions/expr-ungroup.d.ts +14 -0
- package/dist/lang/ast/expressions/expr-ungroup.js +83 -0
- package/dist/lang/ast/expressions/for-range.d.ts +19 -0
- package/dist/lang/ast/expressions/for-range.js +101 -0
- package/dist/lang/ast/expressions/granular-literal.d.ts +20 -0
- package/dist/lang/ast/expressions/granular-literal.js +148 -0
- package/dist/lang/ast/expressions/partial-compare.d.ts +14 -0
- package/dist/lang/ast/expressions/partial-compare.js +50 -0
- package/dist/lang/ast/expressions/pick-when.d.ts +19 -0
- package/dist/lang/ast/expressions/pick-when.js +156 -0
- package/dist/lang/ast/expressions/range.d.ts +12 -0
- package/dist/lang/ast/expressions/range.js +80 -0
- package/dist/lang/ast/expressions/time-frame.d.ts +7 -0
- package/dist/lang/ast/expressions/time-frame.js +40 -0
- package/dist/lang/ast/expressions/top-by.d.ts +10 -0
- package/dist/lang/ast/expressions/top-by.js +51 -0
- package/dist/lang/ast/expressions/unary.d.ts +5 -0
- package/dist/lang/ast/expressions/unary.js +34 -0
- package/dist/lang/ast/expressions/utils.d.ts +15 -0
- package/dist/lang/ast/expressions/utils.js +106 -0
- package/dist/lang/ast/expressions/when-clause.d.ts +10 -0
- package/dist/lang/ast/expressions/when-clause.js +17 -0
- package/dist/lang/ast/fragtype-utils.d.ts +39 -0
- package/dist/lang/ast/fragtype-utils.js +100 -0
- package/dist/lang/ast/import-elements/import-statement.d.ts +9 -0
- package/dist/lang/ast/import-elements/import-statement.js +78 -0
- package/dist/lang/ast/index.d.ts +94 -3
- package/dist/lang/ast/index.js +94 -3
- package/dist/lang/ast/json-elements/json-element.d.ts +6 -0
- package/dist/lang/ast/json-elements/json-element.js +41 -0
- package/dist/lang/ast/json-elements/json-struct-def.d.ts +10 -0
- package/dist/lang/ast/json-elements/json-struct-def.js +48 -0
- package/dist/lang/ast/nesting/nest-reference.d.ts +7 -0
- package/dist/lang/ast/nesting/nest-reference.js +35 -0
- package/dist/lang/ast/parameters/constant-parameter.d.ts +8 -0
- package/dist/lang/ast/parameters/constant-parameter.js +54 -0
- package/dist/lang/ast/parameters/has-parameter.d.ts +19 -0
- package/dist/lang/ast/parameters/has-parameter.js +64 -0
- package/dist/lang/ast/query-elements/anonymous-query.d.ts +9 -0
- package/dist/lang/ast/query-elements/anonymous-query.js +41 -0
- package/dist/lang/ast/query-elements/existing-query.d.ts +11 -0
- package/dist/lang/ast/query-elements/existing-query.js +79 -0
- package/dist/lang/ast/query-elements/full-query.d.ts +10 -0
- package/dist/lang/ast/query-elements/full-query.js +85 -0
- package/dist/lang/ast/query-elements/query-head-struct.d.ts +9 -0
- package/dist/lang/ast/query-elements/query-head-struct.js +48 -0
- package/dist/lang/ast/query-items/field-declaration.d.ts +31 -0
- package/dist/lang/ast/query-items/field-declaration.js +137 -0
- package/dist/lang/ast/query-items/field-references.d.ts +25 -0
- package/dist/lang/ast/query-items/field-references.js +80 -0
- package/dist/lang/ast/query-properties/aggregate.d.ts +5 -0
- package/dist/lang/ast/query-properties/aggregate.js +39 -0
- package/dist/lang/ast/query-properties/declare-fields.d.ts +5 -0
- package/dist/lang/ast/query-properties/declare-fields.js +33 -0
- package/dist/lang/ast/query-properties/dimmensions.d.ts +5 -0
- package/dist/lang/ast/query-properties/dimmensions.js +36 -0
- package/dist/lang/ast/query-properties/filters.d.ts +18 -0
- package/dist/lang/ast/query-properties/filters.js +89 -0
- package/dist/lang/ast/query-properties/group-by.d.ts +5 -0
- package/dist/lang/ast/query-properties/group-by.js +39 -0
- package/dist/lang/ast/query-properties/indexing.d.ts +10 -0
- package/dist/lang/ast/query-properties/indexing.js +39 -0
- package/dist/lang/ast/query-properties/joins.d.ts +36 -0
- package/dist/lang/ast/query-properties/joins.js +143 -0
- package/dist/lang/ast/query-properties/limit.d.ts +6 -0
- package/dist/lang/ast/query-properties/limit.js +35 -0
- package/dist/lang/ast/query-properties/measures.d.ts +5 -0
- package/dist/lang/ast/query-properties/measures.js +36 -0
- package/dist/lang/ast/query-properties/nests.d.ts +5 -0
- package/dist/lang/ast/query-properties/nests.js +33 -0
- package/dist/lang/ast/query-properties/ordering.d.ts +15 -0
- package/dist/lang/ast/query-properties/ordering.js +66 -0
- package/dist/lang/ast/query-properties/project-statement.d.ts +5 -0
- package/dist/lang/ast/query-properties/project-statement.js +33 -0
- package/dist/lang/ast/query-properties/qop-desc.d.ts +17 -0
- package/dist/lang/ast/query-properties/qop-desc.js +123 -0
- package/dist/lang/ast/query-properties/sampling.d.ts +8 -0
- package/dist/lang/ast/query-properties/sampling.js +38 -0
- package/dist/lang/ast/query-properties/top.d.ts +13 -0
- package/dist/lang/ast/query-properties/top.js +60 -0
- package/dist/lang/ast/result-spaces/index-field-space.d.ts +10 -0
- package/dist/lang/ast/result-spaces/index-field-space.js +57 -0
- package/dist/lang/ast/result-spaces/project-field-space.d.ts +6 -0
- package/dist/lang/ast/result-spaces/project-field-space.js +51 -0
- package/dist/lang/ast/result-spaces/reduce-field-space.d.ts +7 -0
- package/dist/lang/ast/result-spaces/reduce-field-space.js +37 -0
- package/dist/lang/ast/sources/named-source.d.ts +19 -0
- package/dist/lang/ast/sources/named-source.js +147 -0
- package/dist/lang/ast/sources/query-source.d.ts +9 -0
- package/dist/lang/ast/sources/query-source.js +41 -0
- package/dist/lang/ast/sources/sql-source.d.ts +7 -0
- package/dist/lang/ast/sources/sql-source.js +54 -0
- package/dist/lang/ast/sources/table-source.d.ts +8 -0
- package/dist/lang/ast/sources/table-source.js +60 -0
- package/dist/lang/ast/space-fields/column-space-field.d.ts +9 -0
- package/dist/lang/ast/space-fields/column-space-field.js +40 -0
- package/dist/lang/ast/space-fields/join-space-field.d.ts +8 -0
- package/dist/lang/ast/space-fields/join-space-field.js +35 -0
- package/dist/lang/ast/space-fields/query-field-struct.d.ts +10 -0
- package/dist/lang/ast/space-fields/query-field-struct.js +46 -0
- package/dist/lang/ast/space-fields/query-space-field.d.ts +11 -0
- package/dist/lang/ast/space-fields/query-space-field.js +37 -0
- package/dist/lang/ast/space-fields/reference-field.d.ts +11 -0
- package/dist/lang/ast/space-fields/reference-field.js +45 -0
- package/dist/lang/ast/space-fields/rename-space-field.d.ts +11 -0
- package/dist/lang/ast/space-fields/rename-space-field.js +50 -0
- package/dist/lang/ast/space-fields/wild-space-field.d.ts +10 -0
- package/dist/lang/ast/space-fields/wild-space-field.js +40 -0
- package/dist/lang/ast/space-parameters/abstract-parameter.d.ts +10 -0
- package/dist/lang/ast/space-parameters/abstract-parameter.js +41 -0
- package/dist/lang/ast/space-parameters/defined-parameter.d.ts +9 -0
- package/dist/lang/ast/space-parameters/defined-parameter.js +40 -0
- package/dist/lang/ast/space-seed.d.ts +17 -0
- package/dist/lang/ast/space-seed.js +59 -0
- package/dist/lang/ast/sql-elements/sql-statement.d.ts +19 -0
- package/dist/lang/ast/sql-elements/sql-statement.js +80 -0
- package/dist/lang/ast/sql-elements/sql-string.d.ts +12 -0
- package/dist/lang/ast/sql-elements/sql-string.js +60 -0
- package/dist/lang/ast/static-space.d.ts +33 -0
- package/dist/lang/ast/static-space.js +167 -0
- package/dist/lang/ast/struct-utils.d.ts +4 -0
- package/dist/lang/ast/struct-utils.js +48 -0
- package/dist/lang/ast/time-utils.d.ts +5 -2
- package/dist/lang/ast/time-utils.js +37 -1
- package/dist/lang/ast/types/comparison.d.ts +11 -0
- package/dist/lang/ast/types/comparison.js +41 -0
- package/dist/lang/ast/types/compart-types.d.ts +10 -0
- package/dist/lang/ast/types/compart-types.js +37 -0
- package/dist/lang/ast/types/document-compile-result.d.ts +8 -0
- package/dist/lang/ast/types/document-compile-result.js +25 -0
- package/dist/lang/ast/types/equality.d.ts +7 -0
- package/dist/lang/ast/types/equality.js +37 -0
- package/dist/lang/ast/types/executor.d.ts +9 -0
- package/dist/lang/ast/types/executor.js +25 -0
- package/dist/lang/ast/types/explore-desc.d.ts +5 -0
- package/dist/lang/ast/types/explore-desc.js +33 -0
- package/dist/lang/ast/types/explore-field.d.ts +5 -0
- package/dist/lang/ast/types/explore-field.js +32 -0
- package/dist/lang/ast/types/explore-property.d.ts +10 -0
- package/dist/lang/ast/types/explore-property.js +43 -0
- package/dist/lang/ast/types/expr-result.d.ts +5 -0
- package/dist/lang/ast/types/expr-result.js +25 -0
- package/dist/lang/ast/types/expr-value.d.ts +3 -0
- package/dist/lang/ast/types/expr-value.js +25 -0
- package/dist/lang/ast/types/expression-def.d.ts +69 -0
- package/dist/lang/ast/types/expression-def.js +346 -0
- package/dist/lang/ast/types/expression-value-type.d.ts +2 -0
- package/dist/lang/ast/types/expression-value-type.js +25 -0
- package/dist/lang/ast/types/field-collection-member.d.ts +5 -0
- package/dist/lang/ast/types/field-collection-member.js +34 -0
- package/dist/lang/ast/types/field-decl.d.ts +7 -0
- package/dist/lang/ast/types/field-decl.js +37 -0
- package/dist/lang/ast/types/field-map.d.ts +2 -0
- package/dist/lang/ast/types/field-map.js +25 -0
- package/dist/lang/ast/types/field-space.d.ts +26 -0
- package/dist/lang/ast/types/field-space.js +48 -0
- package/dist/lang/ast/types/field-type.d.ts +6 -0
- package/dist/lang/ast/types/field-type.js +25 -0
- package/dist/lang/ast/types/field-value-type.d.ts +3 -0
- package/dist/lang/ast/types/field-value-type.js +25 -0
- package/dist/lang/ast/types/frag-type.d.ts +6 -0
- package/dist/lang/ast/types/frag-type.js +25 -0
- package/dist/lang/ast/types/granular-result.d.ts +7 -0
- package/dist/lang/ast/types/granular-result.js +11 -0
- package/dist/lang/ast/types/lookup-result.d.ts +10 -0
- package/dist/lang/ast/types/lookup-result.js +25 -0
- package/dist/lang/ast/types/malloy-element.d.ts +105 -0
- package/dist/lang/ast/types/malloy-element.js +398 -0
- package/dist/lang/ast/types/model-entry.d.ts +6 -0
- package/dist/lang/ast/types/model-entry.js +25 -0
- package/dist/lang/ast/types/name-space.d.ts +5 -0
- package/dist/lang/ast/types/name-space.js +25 -0
- package/dist/lang/ast/types/nested-query.d.ts +3 -0
- package/dist/lang/ast/types/nested-query.js +25 -0
- package/dist/lang/ast/types/op-desc.d.ts +6 -0
- package/dist/lang/ast/types/op-desc.js +25 -0
- package/dist/lang/ast/types/query-comp.d.ts +5 -0
- package/dist/lang/ast/types/query-comp.js +25 -0
- package/dist/lang/ast/types/query-element.d.ts +5 -0
- package/dist/lang/ast/types/query-element.js +32 -0
- package/dist/lang/ast/types/query-item.d.ts +5 -0
- package/dist/lang/ast/types/query-item.js +25 -0
- package/dist/lang/ast/types/query-property.d.ts +17 -0
- package/dist/lang/ast/types/query-property.js +55 -0
- package/dist/lang/ast/types/space-entry.d.ts +5 -0
- package/dist/lang/ast/types/space-entry.js +29 -0
- package/dist/lang/ast/types/space-field.d.ts +10 -0
- package/dist/lang/ast/types/space-field.js +48 -0
- package/dist/lang/ast/types/space-param.d.ts +6 -0
- package/dist/lang/ast/types/space-param.js +34 -0
- package/dist/lang/ast/types/stage-field-type.d.ts +1 -0
- package/dist/lang/ast/types/stage-field-type.js +25 -0
- package/dist/lang/ast/types/time-result.d.ts +6 -0
- package/dist/lang/ast/types/time-result.js +25 -0
- package/dist/lang/ast/types/turtle-headed-pipe.d.ts +7 -0
- package/dist/lang/ast/types/turtle-headed-pipe.js +37 -0
- package/dist/lang/space-field.d.ts +4 -1
- package/dist/lang/space-field.js +4 -3
- package/dist/lang/test/field-symbols.spec.js +25 -21
- package/dist/lang/test/parse.spec.js +4 -3
- package/dist/lang/test/test-translator.d.ts +3 -1
- package/package.json +1 -1
- package/dist/lang/ast/apply-expr.d.ts +0 -3
- package/dist/lang/ast/ast-expr.d.ts +0 -206
- package/dist/lang/ast/ast-expr.js +0 -781
- package/dist/lang/ast/ast-time-expr.d.ts +0 -69
- package/dist/lang/ast/ast-time-expr.js +0 -389
- package/dist/lang/ast/ast-types.d.ts +0 -83
- package/dist/lang/ast/ast-types.js +0 -225
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExprMin = void 0;
|
|
4
|
+
const fragtype_utils_1 = require("../fragtype-utils");
|
|
5
|
+
const expr_aggregate_function_1 = require("./expr-aggregate-function");
|
|
6
|
+
class ExprMin extends expr_aggregate_function_1.ExprAggregateFunction {
|
|
7
|
+
constructor(expr) {
|
|
8
|
+
super("min", expr);
|
|
9
|
+
this.legalChildTypes = [fragtype_utils_1.FT.numberT, fragtype_utils_1.FT.stringT, fragtype_utils_1.FT.dateT, fragtype_utils_1.FT.timestampT];
|
|
10
|
+
}
|
|
11
|
+
returns(forExpression) {
|
|
12
|
+
return forExpression.dataType;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.ExprMin = ExprMin;
|
|
16
|
+
//# sourceMappingURL=expr-min.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ExprValue } from "../types/expr-value";
|
|
2
|
+
import { FieldSpace } from "../types/field-space";
|
|
3
|
+
import { ExpressionDef } from "../types/expression-def";
|
|
4
|
+
export declare class ExprMinus extends ExpressionDef {
|
|
5
|
+
readonly expr: ExpressionDef;
|
|
6
|
+
elementType: string;
|
|
7
|
+
constructor(expr: ExpressionDef);
|
|
8
|
+
getExpression(fs: FieldSpace): ExprValue;
|
|
9
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
* a copy of this software and associated documentation files
|
|
7
|
+
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
+
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
+
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
+
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
+
* subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be
|
|
14
|
+
* included in all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.ExprMinus = void 0;
|
|
26
|
+
const ast_utils_1 = require("../ast-utils");
|
|
27
|
+
const fragtype_utils_1 = require("../fragtype-utils");
|
|
28
|
+
const expression_def_1 = require("../types/expression-def");
|
|
29
|
+
class ExprMinus extends expression_def_1.ExpressionDef {
|
|
30
|
+
constructor(expr) {
|
|
31
|
+
super({ expr });
|
|
32
|
+
this.expr = expr;
|
|
33
|
+
this.elementType = "unary minus";
|
|
34
|
+
this.legalChildTypes = [fragtype_utils_1.FT.numberT];
|
|
35
|
+
}
|
|
36
|
+
getExpression(fs) {
|
|
37
|
+
const expr = this.expr.getExpression(fs);
|
|
38
|
+
if (this.typeCheck(this.expr, expr)) {
|
|
39
|
+
if (expr.value.length > 1) {
|
|
40
|
+
return { ...expr, value: ["-(", ...expr.value, ")"] };
|
|
41
|
+
}
|
|
42
|
+
return { ...expr, value: ["-", ...expr.value] };
|
|
43
|
+
}
|
|
44
|
+
return (0, ast_utils_1.errorFor)("negate requires number");
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.ExprMinus = ExprMinus;
|
|
48
|
+
//# sourceMappingURL=expr-minus.js.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExprMulDiv = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Copyright 2023 Google LLC
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
8
|
+
* a copy of this software and associated documentation files
|
|
9
|
+
* (the "Software"), to deal in the Software without restriction,
|
|
10
|
+
* including without limitation the rights to use, copy, modify, merge,
|
|
11
|
+
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
12
|
+
* and to permit persons to whom the Software is furnished to do so,
|
|
13
|
+
* subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be
|
|
16
|
+
* included in all copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
19
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
20
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
21
|
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
22
|
+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
23
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
24
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
25
|
+
*/
|
|
26
|
+
const binary_numeric_1 = require("./binary-numeric");
|
|
27
|
+
class ExprMulDiv extends binary_numeric_1.BinaryNumeric {
|
|
28
|
+
constructor() {
|
|
29
|
+
super(...arguments);
|
|
30
|
+
this.elementType = "*/%";
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.ExprMulDiv = ExprMulDiv;
|
|
34
|
+
//# sourceMappingURL=expr-mul-div.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ExprValue } from "../types/expr-value";
|
|
2
|
+
import { ExpressionDef } from "../types/expression-def";
|
|
3
|
+
import { FieldSpace } from "../types/field-space";
|
|
4
|
+
import { Unary } from "./unary";
|
|
5
|
+
export declare class ExprNot extends Unary {
|
|
6
|
+
elementType: string;
|
|
7
|
+
legalChildTypes: import("../types/frag-type").FragType[];
|
|
8
|
+
constructor(expr: ExpressionDef);
|
|
9
|
+
getExpression(fs: FieldSpace): ExprValue;
|
|
10
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
* a copy of this software and associated documentation files
|
|
7
|
+
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
+
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
+
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
+
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
+
* subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be
|
|
14
|
+
* included in all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.ExprNot = void 0;
|
|
26
|
+
const ast_utils_1 = require("../ast-utils");
|
|
27
|
+
const fragtype_utils_1 = require("../fragtype-utils");
|
|
28
|
+
const unary_1 = require("./unary");
|
|
29
|
+
const utils_1 = require("./utils");
|
|
30
|
+
class ExprNot extends unary_1.Unary {
|
|
31
|
+
constructor(expr) {
|
|
32
|
+
super(expr);
|
|
33
|
+
this.elementType = "not";
|
|
34
|
+
this.legalChildTypes = [fragtype_utils_1.FT.boolT, fragtype_utils_1.FT.nullT];
|
|
35
|
+
}
|
|
36
|
+
getExpression(fs) {
|
|
37
|
+
const notThis = this.expr.getExpression(fs);
|
|
38
|
+
if (this.typeCheck(this.expr, notThis)) {
|
|
39
|
+
return {
|
|
40
|
+
...notThis,
|
|
41
|
+
dataType: "boolean",
|
|
42
|
+
value: (0, utils_1.nullsafeNot)(notThis.value),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return (0, ast_utils_1.errorFor)("not requires boolean");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.ExprNot = ExprNot;
|
|
49
|
+
//# sourceMappingURL=expr-not.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ExprValue } from "../types/expr-value";
|
|
2
|
+
import { FieldSpace } from "../types/field-space";
|
|
3
|
+
import { ExpressionDef } from "../types/expression-def";
|
|
4
|
+
export declare class ExprNow extends ExpressionDef {
|
|
5
|
+
elementType: string;
|
|
6
|
+
getExpression(_fs: FieldSpace): ExprValue;
|
|
7
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
* a copy of this software and associated documentation files
|
|
7
|
+
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
+
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
+
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
+
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
+
* subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be
|
|
14
|
+
* included in all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.ExprNow = void 0;
|
|
26
|
+
const expression_def_1 = require("../types/expression-def");
|
|
27
|
+
class ExprNow extends expression_def_1.ExpressionDef {
|
|
28
|
+
constructor() {
|
|
29
|
+
super(...arguments);
|
|
30
|
+
this.elementType = "timestamp";
|
|
31
|
+
}
|
|
32
|
+
getExpression(_fs) {
|
|
33
|
+
return {
|
|
34
|
+
dataType: "timestamp",
|
|
35
|
+
expressionType: "scalar",
|
|
36
|
+
value: [
|
|
37
|
+
{
|
|
38
|
+
type: "dialect",
|
|
39
|
+
function: "now",
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.ExprNow = ExprNow;
|
|
46
|
+
//# sourceMappingURL=expr-now.js.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
* a copy of this software and associated documentation files
|
|
7
|
+
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
+
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
+
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
+
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
+
* subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be
|
|
14
|
+
* included in all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.ExprNULL = void 0;
|
|
26
|
+
const expression_def_1 = require("../types/expression-def");
|
|
27
|
+
class ExprNULL extends expression_def_1.ExpressionDef {
|
|
28
|
+
constructor() {
|
|
29
|
+
super(...arguments);
|
|
30
|
+
this.elementType = "NULL";
|
|
31
|
+
}
|
|
32
|
+
getExpression() {
|
|
33
|
+
return {
|
|
34
|
+
dataType: "null",
|
|
35
|
+
value: ["NULL"],
|
|
36
|
+
expressionType: "scalar",
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.ExprNULL = ExprNULL;
|
|
41
|
+
//# sourceMappingURL=expr-null.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ExprValue } from "../types/expr-value";
|
|
2
|
+
import { FieldSpace } from "../types/field-space";
|
|
3
|
+
import { ExpressionDef } from "../types/expression-def";
|
|
4
|
+
export declare class ExprNumber extends ExpressionDef {
|
|
5
|
+
readonly n: string;
|
|
6
|
+
elementType: string;
|
|
7
|
+
constructor(n: string);
|
|
8
|
+
getExpression(_fs: FieldSpace): ExprValue;
|
|
9
|
+
constantExpression(): ExprValue;
|
|
10
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
* a copy of this software and associated documentation files
|
|
7
|
+
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
+
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
+
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
+
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
+
* subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be
|
|
14
|
+
* included in all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.ExprNumber = void 0;
|
|
26
|
+
const fragtype_utils_1 = require("../fragtype-utils");
|
|
27
|
+
const expression_def_1 = require("../types/expression-def");
|
|
28
|
+
class ExprNumber extends expression_def_1.ExpressionDef {
|
|
29
|
+
constructor(n) {
|
|
30
|
+
super();
|
|
31
|
+
this.n = n;
|
|
32
|
+
this.elementType = "numeric literal";
|
|
33
|
+
}
|
|
34
|
+
getExpression(_fs) {
|
|
35
|
+
return this.constantExpression();
|
|
36
|
+
}
|
|
37
|
+
constantExpression() {
|
|
38
|
+
return { ...fragtype_utils_1.FT.numberT, value: [this.n] };
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.ExprNumber = ExprNumber;
|
|
42
|
+
//# sourceMappingURL=expr-number.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ExprValue } from "../types/expr-value";
|
|
2
|
+
import { ExpressionDef } from "../types/expression-def";
|
|
3
|
+
import { FieldSpace } from "../types/field-space";
|
|
4
|
+
export declare class ExprParens extends ExpressionDef {
|
|
5
|
+
readonly expr: ExpressionDef;
|
|
6
|
+
elementType: string;
|
|
7
|
+
constructor(expr: ExpressionDef);
|
|
8
|
+
requestExpression(fs: FieldSpace): ExprValue | undefined;
|
|
9
|
+
getExpression(fs: FieldSpace): ExprValue;
|
|
10
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
* a copy of this software and associated documentation files
|
|
7
|
+
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
+
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
+
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
+
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
+
* subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be
|
|
14
|
+
* included in all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.ExprParens = void 0;
|
|
26
|
+
const expression_def_1 = require("../types/expression-def");
|
|
27
|
+
class ExprParens extends expression_def_1.ExpressionDef {
|
|
28
|
+
constructor(expr) {
|
|
29
|
+
super({ expr });
|
|
30
|
+
this.expr = expr;
|
|
31
|
+
this.elementType = "(expression)";
|
|
32
|
+
}
|
|
33
|
+
requestExpression(fs) {
|
|
34
|
+
return this.expr.requestExpression(fs);
|
|
35
|
+
}
|
|
36
|
+
getExpression(fs) {
|
|
37
|
+
const subExpr = this.expr.getExpression(fs);
|
|
38
|
+
return { ...subExpr, value: ["(", ...subExpr.value, ")"] };
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.ExprParens = ExprParens;
|
|
42
|
+
//# sourceMappingURL=expr-parens.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ExprValue } from "../types/expr-value";
|
|
2
|
+
import { ExpressionDef } from "../types/expression-def";
|
|
3
|
+
export declare class ExprRegEx extends ExpressionDef {
|
|
4
|
+
readonly regex: string;
|
|
5
|
+
elementType: string;
|
|
6
|
+
constructor(regex: string);
|
|
7
|
+
getExpression(): ExprValue;
|
|
8
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
* a copy of this software and associated documentation files
|
|
7
|
+
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
+
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
+
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
+
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
+
* subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be
|
|
14
|
+
* included in all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.ExprRegEx = void 0;
|
|
26
|
+
const expression_def_1 = require("../types/expression-def");
|
|
27
|
+
class ExprRegEx extends expression_def_1.ExpressionDef {
|
|
28
|
+
constructor(regex) {
|
|
29
|
+
super();
|
|
30
|
+
this.regex = regex;
|
|
31
|
+
this.elementType = "regular expression literal";
|
|
32
|
+
}
|
|
33
|
+
getExpression() {
|
|
34
|
+
return {
|
|
35
|
+
dataType: "regular expression",
|
|
36
|
+
expressionType: "scalar",
|
|
37
|
+
value: [`r'${this.regex}'`],
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.ExprRegEx = ExprRegEx;
|
|
42
|
+
//# sourceMappingURL=expr-regex.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ExpressionDef } from "../types/expression-def";
|
|
2
|
+
import { FieldSpace } from "../types/field-space";
|
|
3
|
+
import { ExprValue } from "../types/expr-value";
|
|
4
|
+
export declare class ExprString extends ExpressionDef {
|
|
5
|
+
elementType: string;
|
|
6
|
+
value: string;
|
|
7
|
+
constructor(src: string);
|
|
8
|
+
getExpression(_fs: FieldSpace): ExprValue;
|
|
9
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
* a copy of this software and associated documentation files
|
|
7
|
+
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
+
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
+
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
+
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
+
* subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be
|
|
14
|
+
* included in all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.ExprString = void 0;
|
|
26
|
+
const expression_def_1 = require("../types/expression-def");
|
|
27
|
+
const fragtype_utils_1 = require("../fragtype-utils");
|
|
28
|
+
class ExprString extends expression_def_1.ExpressionDef {
|
|
29
|
+
constructor(src) {
|
|
30
|
+
super();
|
|
31
|
+
this.elementType = "string literal";
|
|
32
|
+
const bareStr = src.slice(1, -1);
|
|
33
|
+
const val = bareStr.replace(/\\(.)/g, "$1");
|
|
34
|
+
this.value = val;
|
|
35
|
+
}
|
|
36
|
+
getExpression(_fs) {
|
|
37
|
+
return {
|
|
38
|
+
...fragtype_utils_1.FT.stringT,
|
|
39
|
+
value: [
|
|
40
|
+
{
|
|
41
|
+
type: "dialect",
|
|
42
|
+
function: "stringLiteral",
|
|
43
|
+
literal: this.value,
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.ExprString = ExprString;
|
|
50
|
+
//# sourceMappingURL=expr-string.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FieldReference } from "../query-items/field-references";
|
|
2
|
+
import { ExprAsymmetric } from "./expr-asymmetric";
|
|
3
|
+
import { ExpressionDef } from "../types/expression-def";
|
|
4
|
+
export declare class ExprSum extends ExprAsymmetric {
|
|
5
|
+
constructor(expr: ExpressionDef | undefined, source?: FieldReference);
|
|
6
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExprSum = void 0;
|
|
4
|
+
const expr_asymmetric_1 = require("./expr-asymmetric");
|
|
5
|
+
class ExprSum extends expr_asymmetric_1.ExprAsymmetric {
|
|
6
|
+
constructor(expr, source) {
|
|
7
|
+
super("sum", expr, source);
|
|
8
|
+
this.has({ source });
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.ExprSum = ExprSum;
|
|
12
|
+
//# sourceMappingURL=expr-sum.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ExtractUnit } from "../../../model/malloy_types";
|
|
2
|
+
import { ExprValue } from "../types/expr-value";
|
|
3
|
+
import { FieldSpace } from "../types/field-space";
|
|
4
|
+
import { ExpressionDef } from "../types/expression-def";
|
|
5
|
+
export declare class ExprTimeExtract extends ExpressionDef {
|
|
6
|
+
readonly extractText: string;
|
|
7
|
+
readonly args: ExpressionDef[];
|
|
8
|
+
elementType: string;
|
|
9
|
+
static pluralMap: Record<string, ExtractUnit>;
|
|
10
|
+
static extractor(funcName: string): ExtractUnit | undefined;
|
|
11
|
+
constructor(extractText: string, args: ExpressionDef[]);
|
|
12
|
+
getExpression(fs: FieldSpace): ExprValue;
|
|
13
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExprTimeExtract = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Copyright 2023 Google LLC
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
8
|
+
* a copy of this software and associated documentation files
|
|
9
|
+
* (the "Software"), to deal in the Software without restriction,
|
|
10
|
+
* including without limitation the rights to use, copy, modify, merge,
|
|
11
|
+
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
12
|
+
* and to permit persons to whom the Software is furnished to do so,
|
|
13
|
+
* subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be
|
|
16
|
+
* included in all copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
19
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
20
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
21
|
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
22
|
+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
23
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
24
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
25
|
+
*/
|
|
26
|
+
const malloy_types_1 = require("../../../model/malloy_types");
|
|
27
|
+
const ast_utils_1 = require("../ast-utils");
|
|
28
|
+
const range_1 = require("./range");
|
|
29
|
+
const expression_def_1 = require("../types/expression-def");
|
|
30
|
+
class ExprTimeExtract extends expression_def_1.ExpressionDef {
|
|
31
|
+
constructor(extractText, args) {
|
|
32
|
+
super({ args });
|
|
33
|
+
this.extractText = extractText;
|
|
34
|
+
this.args = args;
|
|
35
|
+
this.elementType = "timeExtract";
|
|
36
|
+
}
|
|
37
|
+
static extractor(funcName) {
|
|
38
|
+
const mappedName = ExprTimeExtract.pluralMap[funcName];
|
|
39
|
+
if (mappedName) {
|
|
40
|
+
return mappedName;
|
|
41
|
+
}
|
|
42
|
+
if ((0, malloy_types_1.isExtractUnit)(funcName)) {
|
|
43
|
+
return funcName;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
getExpression(fs) {
|
|
47
|
+
const extractTo = ExprTimeExtract.extractor(this.extractText);
|
|
48
|
+
if (extractTo) {
|
|
49
|
+
if (this.args.length !== 1) {
|
|
50
|
+
this.log(`Extraction function ${extractTo} requires one argument`);
|
|
51
|
+
return (0, ast_utils_1.errorFor)(`{this.name} arg count`);
|
|
52
|
+
}
|
|
53
|
+
const from = this.args[0];
|
|
54
|
+
if (from instanceof range_1.Range) {
|
|
55
|
+
const first = from.first.getExpression(fs);
|
|
56
|
+
const last = from.last.getExpression(fs);
|
|
57
|
+
if (!(0, malloy_types_1.isTimeFieldType)(first.dataType)) {
|
|
58
|
+
from.first.log(`Can't extract ${extractTo} from '${first.dataType}'`);
|
|
59
|
+
return (0, ast_utils_1.errorFor)(`${extractTo} bad type ${first.dataType}`);
|
|
60
|
+
}
|
|
61
|
+
if (!(0, malloy_types_1.isTimeFieldType)(last.dataType)) {
|
|
62
|
+
from.last.log(`Cannot extract ${extractTo} from '${last.dataType}'`);
|
|
63
|
+
return (0, ast_utils_1.errorFor)(`${extractTo} bad type ${last.dataType}`);
|
|
64
|
+
}
|
|
65
|
+
if (!(0, malloy_types_1.isTimestampUnit)(extractTo)) {
|
|
66
|
+
this.log(`Cannot extract ${extractTo} from a range`);
|
|
67
|
+
return (0, ast_utils_1.errorFor)(`${extractTo} bad extraction`);
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
dataType: "number",
|
|
71
|
+
expressionType: (0, malloy_types_1.maxExpressionType)(first.expressionType, last.expressionType),
|
|
72
|
+
value: [
|
|
73
|
+
{
|
|
74
|
+
type: "dialect",
|
|
75
|
+
function: "timeDiff",
|
|
76
|
+
units: extractTo,
|
|
77
|
+
left: { valueType: first.dataType, value: first.value },
|
|
78
|
+
right: { valueType: last.dataType, value: last.value },
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
const argV = from.getExpression(fs);
|
|
85
|
+
if ((0, malloy_types_1.isTimeFieldType)(argV.dataType)) {
|
|
86
|
+
return {
|
|
87
|
+
dataType: "number",
|
|
88
|
+
expressionType: argV.expressionType,
|
|
89
|
+
value: [
|
|
90
|
+
{
|
|
91
|
+
type: "dialect",
|
|
92
|
+
function: "extract",
|
|
93
|
+
expr: { value: argV.value, valueType: argV.dataType },
|
|
94
|
+
units: extractTo,
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
this.log(`${this.extractText}() requires time type, not '${argV.dataType}'`);
|
|
100
|
+
return (0, ast_utils_1.errorFor)(`${this.extractText} bad type ${argV.dataType}`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
throw this.internalError(`Illegal extraction unit '${this.extractText}'`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
exports.ExprTimeExtract = ExprTimeExtract;
|
|
107
|
+
ExprTimeExtract.pluralMap = {
|
|
108
|
+
years: "year",
|
|
109
|
+
quarters: "quarter",
|
|
110
|
+
months: "month",
|
|
111
|
+
weeks: "week",
|
|
112
|
+
days: "day",
|
|
113
|
+
hours: "hour",
|
|
114
|
+
minutes: "minute",
|
|
115
|
+
seconds: "second",
|
|
116
|
+
};
|
|
117
|
+
//# sourceMappingURL=expr-time-extract.js.map
|