@malloydata/malloy 0.0.43-dev230622180905 → 0.0.43-dev230622192152
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/executors/reduce-executor.js +8 -0
- package/dist/lang/ast/expressions/expr-func.js +6 -0
- package/dist/lang/ast/index.d.ts +3 -0
- package/dist/lang/ast/index.js +3 -0
- package/dist/lang/ast/query-elements/run-query.d.ts +18 -0
- package/dist/lang/ast/query-elements/run-query.js +67 -0
- package/dist/lang/ast/query-properties/extend.d.ts +5 -0
- package/dist/lang/ast/query-properties/extend.js +33 -0
- package/dist/lang/ast/types/query-extend-property.d.ts +6 -0
- package/dist/lang/ast/types/query-extend-property.js +33 -0
- package/dist/lang/ast/types/query-property.d.ts +2 -1
- package/dist/lang/ast/types/query-property.js +2 -0
- package/dist/lang/lib/Malloy/MalloyLexer.d.ts +134 -132
- package/dist/lang/lib/Malloy/MalloyLexer.js +1136 -1119
- package/dist/lang/lib/Malloy/MalloyParser.d.ts +344 -239
- package/dist/lang/lib/Malloy/MalloyParser.js +2218 -1547
- package/dist/lang/lib/Malloy/MalloyParserListener.d.ts +134 -20
- package/dist/lang/lib/Malloy/MalloyParserVisitor.d.ts +84 -12
- package/dist/lang/malloy-to-ast.d.ts +6 -2
- package/dist/lang/malloy-to-ast.js +54 -6
- package/dist/lang/parse-tree-walkers/document-symbol-walker.js +16 -0
- package/dist/lang/test/document-symbol-walker.spec.js +7 -0
- package/dist/lang/test/parse.spec.js +49 -7
- package/package.json +1 -1
|
@@ -48,20 +48,22 @@ import { ExprAggFuncContext } from "./MalloyParser";
|
|
|
48
48
|
import { ExprFuncContext } from "./MalloyParser";
|
|
49
49
|
import { ExprPickContext } from "./MalloyParser";
|
|
50
50
|
import { ExprUngroupContext } from "./MalloyParser";
|
|
51
|
+
import { RunStatementDefContext } from "./MalloyParser";
|
|
52
|
+
import { RunStatementRefContext } from "./MalloyParser";
|
|
51
53
|
import { ExploreArrowQueryContext } from "./MalloyParser";
|
|
52
54
|
import { ArrowQueryContext } from "./MalloyParser";
|
|
53
55
|
import { DefJoinOneContext } from "./MalloyParser";
|
|
54
56
|
import { DefJoinManyContext } from "./MalloyParser";
|
|
55
57
|
import { DefJoinCrossContext } from "./MalloyParser";
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
58
|
+
import { DefExploreDimension_stubContext } from "./MalloyParser";
|
|
59
|
+
import { DefExploreMeasure_stubContext } from "./MalloyParser";
|
|
58
60
|
import { DefDeclare_stubContext } from "./MalloyParser";
|
|
59
61
|
import { DefJoin_stubContext } from "./MalloyParser";
|
|
60
|
-
import {
|
|
62
|
+
import { DefExploreWhere_stubContext } from "./MalloyParser";
|
|
61
63
|
import { DefExplorePrimaryKeyContext } from "./MalloyParser";
|
|
62
64
|
import { DefExploreRenameContext } from "./MalloyParser";
|
|
63
65
|
import { DefExploreEditFieldContext } from "./MalloyParser";
|
|
64
|
-
import {
|
|
66
|
+
import { DefExploreQuery_stubContext } from "./MalloyParser";
|
|
65
67
|
import { DefExploreTimezoneContext } from "./MalloyParser";
|
|
66
68
|
import { FilterByShortcutContext } from "./MalloyParser";
|
|
67
69
|
import { FilterByWhereContext } from "./MalloyParser";
|
|
@@ -72,6 +74,7 @@ import { MalloyStatementContext } from "./MalloyParser";
|
|
|
72
74
|
import { DefineSourceStatementContext } from "./MalloyParser";
|
|
73
75
|
import { DefineQueryContext } from "./MalloyParser";
|
|
74
76
|
import { TopLevelAnonQueryDefContext } from "./MalloyParser";
|
|
77
|
+
import { RunStatementContext } from "./MalloyParser";
|
|
75
78
|
import { DefineSQLStatementContext } from "./MalloyParser";
|
|
76
79
|
import { SqlBlockContext } from "./MalloyParser";
|
|
77
80
|
import { BlockSQLDefContext } from "./MalloyParser";
|
|
@@ -99,6 +102,8 @@ import { SourceNameDefContext } from "./MalloyParser";
|
|
|
99
102
|
import { SourceIDContext } from "./MalloyParser";
|
|
100
103
|
import { ExplorePropertiesContext } from "./MalloyParser";
|
|
101
104
|
import { ExploreStatementContext } from "./MalloyParser";
|
|
105
|
+
import { DefDimensionsContext } from "./MalloyParser";
|
|
106
|
+
import { DefMeasuresContext } from "./MalloyParser";
|
|
102
107
|
import { RenameListContext } from "./MalloyParser";
|
|
103
108
|
import { ExploreRenameDefContext } from "./MalloyParser";
|
|
104
109
|
import { DefListContext } from "./MalloyParser";
|
|
@@ -107,6 +112,9 @@ import { FieldNameDefContext } from "./MalloyParser";
|
|
|
107
112
|
import { JoinNameDefContext } from "./MalloyParser";
|
|
108
113
|
import { DeclareStatementContext } from "./MalloyParser";
|
|
109
114
|
import { JoinStatementContext } from "./MalloyParser";
|
|
115
|
+
import { QueryExtendContext } from "./MalloyParser";
|
|
116
|
+
import { QueryExtendStatementContext } from "./MalloyParser";
|
|
117
|
+
import { QueryExtendStatementListContext } from "./MalloyParser";
|
|
110
118
|
import { JoinListContext } from "./MalloyParser";
|
|
111
119
|
import { JoinDefContext } from "./MalloyParser";
|
|
112
120
|
import { JoinExpressionContext } from "./MalloyParser";
|
|
@@ -119,6 +127,7 @@ import { SubQueryDefListContext } from "./MalloyParser";
|
|
|
119
127
|
import { ExploreQueryNameDefContext } from "./MalloyParser";
|
|
120
128
|
import { ExploreQueryDefContext } from "./MalloyParser";
|
|
121
129
|
import { QueryStatementContext } from "./MalloyParser";
|
|
130
|
+
import { QueryJoinStatementContext } from "./MalloyParser";
|
|
122
131
|
import { GroupByStatementContext } from "./MalloyParser";
|
|
123
132
|
import { QueryFieldListContext } from "./MalloyParser";
|
|
124
133
|
import { QueryFieldEntryContext } from "./MalloyParser";
|
|
@@ -139,6 +148,7 @@ import { IndexFieldsContext } from "./MalloyParser";
|
|
|
139
148
|
import { IndexStatementContext } from "./MalloyParser";
|
|
140
149
|
import { SampleStatementContext } from "./MalloyParser";
|
|
141
150
|
import { TimezoneStatementContext } from "./MalloyParser";
|
|
151
|
+
import { TimezoneNameContext } from "./MalloyParser";
|
|
142
152
|
import { SampleSpecContext } from "./MalloyParser";
|
|
143
153
|
import { AggregateContext } from "./MalloyParser";
|
|
144
154
|
import { MalloyTypeContext } from "./MalloyParser";
|
|
@@ -763,6 +773,30 @@ export interface MalloyParserListener extends ParseTreeListener {
|
|
|
763
773
|
* @param ctx the parse tree
|
|
764
774
|
*/
|
|
765
775
|
exitExprUngroup?: (ctx: ExprUngroupContext) => void;
|
|
776
|
+
/**
|
|
777
|
+
* Enter a parse tree produced by the `runStatementDef`
|
|
778
|
+
* labeled alternative in `MalloyParser.runStatement`.
|
|
779
|
+
* @param ctx the parse tree
|
|
780
|
+
*/
|
|
781
|
+
enterRunStatementDef?: (ctx: RunStatementDefContext) => void;
|
|
782
|
+
/**
|
|
783
|
+
* Exit a parse tree produced by the `runStatementDef`
|
|
784
|
+
* labeled alternative in `MalloyParser.runStatement`.
|
|
785
|
+
* @param ctx the parse tree
|
|
786
|
+
*/
|
|
787
|
+
exitRunStatementDef?: (ctx: RunStatementDefContext) => void;
|
|
788
|
+
/**
|
|
789
|
+
* Enter a parse tree produced by the `runStatementRef`
|
|
790
|
+
* labeled alternative in `MalloyParser.runStatement`.
|
|
791
|
+
* @param ctx the parse tree
|
|
792
|
+
*/
|
|
793
|
+
enterRunStatementRef?: (ctx: RunStatementRefContext) => void;
|
|
794
|
+
/**
|
|
795
|
+
* Exit a parse tree produced by the `runStatementRef`
|
|
796
|
+
* labeled alternative in `MalloyParser.runStatement`.
|
|
797
|
+
* @param ctx the parse tree
|
|
798
|
+
*/
|
|
799
|
+
exitRunStatementRef?: (ctx: RunStatementRefContext) => void;
|
|
766
800
|
/**
|
|
767
801
|
* Enter a parse tree produced by the `exploreArrowQuery`
|
|
768
802
|
* labeled alternative in `MalloyParser.query`.
|
|
@@ -824,29 +858,29 @@ export interface MalloyParserListener extends ParseTreeListener {
|
|
|
824
858
|
*/
|
|
825
859
|
exitDefJoinCross?: (ctx: DefJoinCrossContext) => void;
|
|
826
860
|
/**
|
|
827
|
-
* Enter a parse tree produced by the `
|
|
861
|
+
* Enter a parse tree produced by the `defExploreDimension_stub`
|
|
828
862
|
* labeled alternative in `MalloyParser.exploreStatement`.
|
|
829
863
|
* @param ctx the parse tree
|
|
830
864
|
*/
|
|
831
|
-
|
|
865
|
+
enterDefExploreDimension_stub?: (ctx: DefExploreDimension_stubContext) => void;
|
|
832
866
|
/**
|
|
833
|
-
* Exit a parse tree produced by the `
|
|
867
|
+
* Exit a parse tree produced by the `defExploreDimension_stub`
|
|
834
868
|
* labeled alternative in `MalloyParser.exploreStatement`.
|
|
835
869
|
* @param ctx the parse tree
|
|
836
870
|
*/
|
|
837
|
-
|
|
871
|
+
exitDefExploreDimension_stub?: (ctx: DefExploreDimension_stubContext) => void;
|
|
838
872
|
/**
|
|
839
|
-
* Enter a parse tree produced by the `
|
|
873
|
+
* Enter a parse tree produced by the `defExploreMeasure_stub`
|
|
840
874
|
* labeled alternative in `MalloyParser.exploreStatement`.
|
|
841
875
|
* @param ctx the parse tree
|
|
842
876
|
*/
|
|
843
|
-
|
|
877
|
+
enterDefExploreMeasure_stub?: (ctx: DefExploreMeasure_stubContext) => void;
|
|
844
878
|
/**
|
|
845
|
-
* Exit a parse tree produced by the `
|
|
879
|
+
* Exit a parse tree produced by the `defExploreMeasure_stub`
|
|
846
880
|
* labeled alternative in `MalloyParser.exploreStatement`.
|
|
847
881
|
* @param ctx the parse tree
|
|
848
882
|
*/
|
|
849
|
-
|
|
883
|
+
exitDefExploreMeasure_stub?: (ctx: DefExploreMeasure_stubContext) => void;
|
|
850
884
|
/**
|
|
851
885
|
* Enter a parse tree produced by the `defDeclare_stub`
|
|
852
886
|
* labeled alternative in `MalloyParser.exploreStatement`.
|
|
@@ -872,17 +906,17 @@ export interface MalloyParserListener extends ParseTreeListener {
|
|
|
872
906
|
*/
|
|
873
907
|
exitDefJoin_stub?: (ctx: DefJoin_stubContext) => void;
|
|
874
908
|
/**
|
|
875
|
-
* Enter a parse tree produced by the `
|
|
909
|
+
* Enter a parse tree produced by the `defExploreWhere_stub`
|
|
876
910
|
* labeled alternative in `MalloyParser.exploreStatement`.
|
|
877
911
|
* @param ctx the parse tree
|
|
878
912
|
*/
|
|
879
|
-
|
|
913
|
+
enterDefExploreWhere_stub?: (ctx: DefExploreWhere_stubContext) => void;
|
|
880
914
|
/**
|
|
881
|
-
* Exit a parse tree produced by the `
|
|
915
|
+
* Exit a parse tree produced by the `defExploreWhere_stub`
|
|
882
916
|
* labeled alternative in `MalloyParser.exploreStatement`.
|
|
883
917
|
* @param ctx the parse tree
|
|
884
918
|
*/
|
|
885
|
-
|
|
919
|
+
exitDefExploreWhere_stub?: (ctx: DefExploreWhere_stubContext) => void;
|
|
886
920
|
/**
|
|
887
921
|
* Enter a parse tree produced by the `defExplorePrimaryKey`
|
|
888
922
|
* labeled alternative in `MalloyParser.exploreStatement`.
|
|
@@ -920,17 +954,17 @@ export interface MalloyParserListener extends ParseTreeListener {
|
|
|
920
954
|
*/
|
|
921
955
|
exitDefExploreEditField?: (ctx: DefExploreEditFieldContext) => void;
|
|
922
956
|
/**
|
|
923
|
-
* Enter a parse tree produced by the `
|
|
957
|
+
* Enter a parse tree produced by the `defExploreQuery_stub`
|
|
924
958
|
* labeled alternative in `MalloyParser.exploreStatement`.
|
|
925
959
|
* @param ctx the parse tree
|
|
926
960
|
*/
|
|
927
|
-
|
|
961
|
+
enterDefExploreQuery_stub?: (ctx: DefExploreQuery_stubContext) => void;
|
|
928
962
|
/**
|
|
929
|
-
* Exit a parse tree produced by the `
|
|
963
|
+
* Exit a parse tree produced by the `defExploreQuery_stub`
|
|
930
964
|
* labeled alternative in `MalloyParser.exploreStatement`.
|
|
931
965
|
* @param ctx the parse tree
|
|
932
966
|
*/
|
|
933
|
-
|
|
967
|
+
exitDefExploreQuery_stub?: (ctx: DefExploreQuery_stubContext) => void;
|
|
934
968
|
/**
|
|
935
969
|
* Enter a parse tree produced by the `defExploreTimezone`
|
|
936
970
|
* labeled alternative in `MalloyParser.exploreStatement`.
|
|
@@ -1041,6 +1075,16 @@ export interface MalloyParserListener extends ParseTreeListener {
|
|
|
1041
1075
|
* @param ctx the parse tree
|
|
1042
1076
|
*/
|
|
1043
1077
|
exitTopLevelAnonQueryDef?: (ctx: TopLevelAnonQueryDefContext) => void;
|
|
1078
|
+
/**
|
|
1079
|
+
* Enter a parse tree produced by `MalloyParser.runStatement`.
|
|
1080
|
+
* @param ctx the parse tree
|
|
1081
|
+
*/
|
|
1082
|
+
enterRunStatement?: (ctx: RunStatementContext) => void;
|
|
1083
|
+
/**
|
|
1084
|
+
* Exit a parse tree produced by `MalloyParser.runStatement`.
|
|
1085
|
+
* @param ctx the parse tree
|
|
1086
|
+
*/
|
|
1087
|
+
exitRunStatement?: (ctx: RunStatementContext) => void;
|
|
1044
1088
|
/**
|
|
1045
1089
|
* Enter a parse tree produced by `MalloyParser.defineSQLStatement`.
|
|
1046
1090
|
* @param ctx the parse tree
|
|
@@ -1311,6 +1355,26 @@ export interface MalloyParserListener extends ParseTreeListener {
|
|
|
1311
1355
|
* @param ctx the parse tree
|
|
1312
1356
|
*/
|
|
1313
1357
|
exitExploreStatement?: (ctx: ExploreStatementContext) => void;
|
|
1358
|
+
/**
|
|
1359
|
+
* Enter a parse tree produced by `MalloyParser.defDimensions`.
|
|
1360
|
+
* @param ctx the parse tree
|
|
1361
|
+
*/
|
|
1362
|
+
enterDefDimensions?: (ctx: DefDimensionsContext) => void;
|
|
1363
|
+
/**
|
|
1364
|
+
* Exit a parse tree produced by `MalloyParser.defDimensions`.
|
|
1365
|
+
* @param ctx the parse tree
|
|
1366
|
+
*/
|
|
1367
|
+
exitDefDimensions?: (ctx: DefDimensionsContext) => void;
|
|
1368
|
+
/**
|
|
1369
|
+
* Enter a parse tree produced by `MalloyParser.defMeasures`.
|
|
1370
|
+
* @param ctx the parse tree
|
|
1371
|
+
*/
|
|
1372
|
+
enterDefMeasures?: (ctx: DefMeasuresContext) => void;
|
|
1373
|
+
/**
|
|
1374
|
+
* Exit a parse tree produced by `MalloyParser.defMeasures`.
|
|
1375
|
+
* @param ctx the parse tree
|
|
1376
|
+
*/
|
|
1377
|
+
exitDefMeasures?: (ctx: DefMeasuresContext) => void;
|
|
1314
1378
|
/**
|
|
1315
1379
|
* Enter a parse tree produced by `MalloyParser.renameList`.
|
|
1316
1380
|
* @param ctx the parse tree
|
|
@@ -1391,6 +1455,36 @@ export interface MalloyParserListener extends ParseTreeListener {
|
|
|
1391
1455
|
* @param ctx the parse tree
|
|
1392
1456
|
*/
|
|
1393
1457
|
exitJoinStatement?: (ctx: JoinStatementContext) => void;
|
|
1458
|
+
/**
|
|
1459
|
+
* Enter a parse tree produced by `MalloyParser.queryExtend`.
|
|
1460
|
+
* @param ctx the parse tree
|
|
1461
|
+
*/
|
|
1462
|
+
enterQueryExtend?: (ctx: QueryExtendContext) => void;
|
|
1463
|
+
/**
|
|
1464
|
+
* Exit a parse tree produced by `MalloyParser.queryExtend`.
|
|
1465
|
+
* @param ctx the parse tree
|
|
1466
|
+
*/
|
|
1467
|
+
exitQueryExtend?: (ctx: QueryExtendContext) => void;
|
|
1468
|
+
/**
|
|
1469
|
+
* Enter a parse tree produced by `MalloyParser.queryExtendStatement`.
|
|
1470
|
+
* @param ctx the parse tree
|
|
1471
|
+
*/
|
|
1472
|
+
enterQueryExtendStatement?: (ctx: QueryExtendStatementContext) => void;
|
|
1473
|
+
/**
|
|
1474
|
+
* Exit a parse tree produced by `MalloyParser.queryExtendStatement`.
|
|
1475
|
+
* @param ctx the parse tree
|
|
1476
|
+
*/
|
|
1477
|
+
exitQueryExtendStatement?: (ctx: QueryExtendStatementContext) => void;
|
|
1478
|
+
/**
|
|
1479
|
+
* Enter a parse tree produced by `MalloyParser.queryExtendStatementList`.
|
|
1480
|
+
* @param ctx the parse tree
|
|
1481
|
+
*/
|
|
1482
|
+
enterQueryExtendStatementList?: (ctx: QueryExtendStatementListContext) => void;
|
|
1483
|
+
/**
|
|
1484
|
+
* Exit a parse tree produced by `MalloyParser.queryExtendStatementList`.
|
|
1485
|
+
* @param ctx the parse tree
|
|
1486
|
+
*/
|
|
1487
|
+
exitQueryExtendStatementList?: (ctx: QueryExtendStatementListContext) => void;
|
|
1394
1488
|
/**
|
|
1395
1489
|
* Enter a parse tree produced by `MalloyParser.joinList`.
|
|
1396
1490
|
* @param ctx the parse tree
|
|
@@ -1511,6 +1605,16 @@ export interface MalloyParserListener extends ParseTreeListener {
|
|
|
1511
1605
|
* @param ctx the parse tree
|
|
1512
1606
|
*/
|
|
1513
1607
|
exitQueryStatement?: (ctx: QueryStatementContext) => void;
|
|
1608
|
+
/**
|
|
1609
|
+
* Enter a parse tree produced by `MalloyParser.queryJoinStatement`.
|
|
1610
|
+
* @param ctx the parse tree
|
|
1611
|
+
*/
|
|
1612
|
+
enterQueryJoinStatement?: (ctx: QueryJoinStatementContext) => void;
|
|
1613
|
+
/**
|
|
1614
|
+
* Exit a parse tree produced by `MalloyParser.queryJoinStatement`.
|
|
1615
|
+
* @param ctx the parse tree
|
|
1616
|
+
*/
|
|
1617
|
+
exitQueryJoinStatement?: (ctx: QueryJoinStatementContext) => void;
|
|
1514
1618
|
/**
|
|
1515
1619
|
* Enter a parse tree produced by `MalloyParser.groupByStatement`.
|
|
1516
1620
|
* @param ctx the parse tree
|
|
@@ -1711,6 +1815,16 @@ export interface MalloyParserListener extends ParseTreeListener {
|
|
|
1711
1815
|
* @param ctx the parse tree
|
|
1712
1816
|
*/
|
|
1713
1817
|
exitTimezoneStatement?: (ctx: TimezoneStatementContext) => void;
|
|
1818
|
+
/**
|
|
1819
|
+
* Enter a parse tree produced by `MalloyParser.timezoneName`.
|
|
1820
|
+
* @param ctx the parse tree
|
|
1821
|
+
*/
|
|
1822
|
+
enterTimezoneName?: (ctx: TimezoneNameContext) => void;
|
|
1823
|
+
/**
|
|
1824
|
+
* Exit a parse tree produced by `MalloyParser.timezoneName`.
|
|
1825
|
+
* @param ctx the parse tree
|
|
1826
|
+
*/
|
|
1827
|
+
exitTimezoneName?: (ctx: TimezoneNameContext) => void;
|
|
1714
1828
|
/**
|
|
1715
1829
|
* Enter a parse tree produced by `MalloyParser.sampleSpec`.
|
|
1716
1830
|
* @param ctx the parse tree
|
|
@@ -48,20 +48,22 @@ import { ExprAggFuncContext } from "./MalloyParser";
|
|
|
48
48
|
import { ExprFuncContext } from "./MalloyParser";
|
|
49
49
|
import { ExprPickContext } from "./MalloyParser";
|
|
50
50
|
import { ExprUngroupContext } from "./MalloyParser";
|
|
51
|
+
import { RunStatementDefContext } from "./MalloyParser";
|
|
52
|
+
import { RunStatementRefContext } from "./MalloyParser";
|
|
51
53
|
import { ExploreArrowQueryContext } from "./MalloyParser";
|
|
52
54
|
import { ArrowQueryContext } from "./MalloyParser";
|
|
53
55
|
import { DefJoinOneContext } from "./MalloyParser";
|
|
54
56
|
import { DefJoinManyContext } from "./MalloyParser";
|
|
55
57
|
import { DefJoinCrossContext } from "./MalloyParser";
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
58
|
+
import { DefExploreDimension_stubContext } from "./MalloyParser";
|
|
59
|
+
import { DefExploreMeasure_stubContext } from "./MalloyParser";
|
|
58
60
|
import { DefDeclare_stubContext } from "./MalloyParser";
|
|
59
61
|
import { DefJoin_stubContext } from "./MalloyParser";
|
|
60
|
-
import {
|
|
62
|
+
import { DefExploreWhere_stubContext } from "./MalloyParser";
|
|
61
63
|
import { DefExplorePrimaryKeyContext } from "./MalloyParser";
|
|
62
64
|
import { DefExploreRenameContext } from "./MalloyParser";
|
|
63
65
|
import { DefExploreEditFieldContext } from "./MalloyParser";
|
|
64
|
-
import {
|
|
66
|
+
import { DefExploreQuery_stubContext } from "./MalloyParser";
|
|
65
67
|
import { DefExploreTimezoneContext } from "./MalloyParser";
|
|
66
68
|
import { FilterByShortcutContext } from "./MalloyParser";
|
|
67
69
|
import { FilterByWhereContext } from "./MalloyParser";
|
|
@@ -72,6 +74,7 @@ import { MalloyStatementContext } from "./MalloyParser";
|
|
|
72
74
|
import { DefineSourceStatementContext } from "./MalloyParser";
|
|
73
75
|
import { DefineQueryContext } from "./MalloyParser";
|
|
74
76
|
import { TopLevelAnonQueryDefContext } from "./MalloyParser";
|
|
77
|
+
import { RunStatementContext } from "./MalloyParser";
|
|
75
78
|
import { DefineSQLStatementContext } from "./MalloyParser";
|
|
76
79
|
import { SqlBlockContext } from "./MalloyParser";
|
|
77
80
|
import { BlockSQLDefContext } from "./MalloyParser";
|
|
@@ -99,6 +102,8 @@ import { SourceNameDefContext } from "./MalloyParser";
|
|
|
99
102
|
import { SourceIDContext } from "./MalloyParser";
|
|
100
103
|
import { ExplorePropertiesContext } from "./MalloyParser";
|
|
101
104
|
import { ExploreStatementContext } from "./MalloyParser";
|
|
105
|
+
import { DefDimensionsContext } from "./MalloyParser";
|
|
106
|
+
import { DefMeasuresContext } from "./MalloyParser";
|
|
102
107
|
import { RenameListContext } from "./MalloyParser";
|
|
103
108
|
import { ExploreRenameDefContext } from "./MalloyParser";
|
|
104
109
|
import { DefListContext } from "./MalloyParser";
|
|
@@ -107,6 +112,9 @@ import { FieldNameDefContext } from "./MalloyParser";
|
|
|
107
112
|
import { JoinNameDefContext } from "./MalloyParser";
|
|
108
113
|
import { DeclareStatementContext } from "./MalloyParser";
|
|
109
114
|
import { JoinStatementContext } from "./MalloyParser";
|
|
115
|
+
import { QueryExtendContext } from "./MalloyParser";
|
|
116
|
+
import { QueryExtendStatementContext } from "./MalloyParser";
|
|
117
|
+
import { QueryExtendStatementListContext } from "./MalloyParser";
|
|
110
118
|
import { JoinListContext } from "./MalloyParser";
|
|
111
119
|
import { JoinDefContext } from "./MalloyParser";
|
|
112
120
|
import { JoinExpressionContext } from "./MalloyParser";
|
|
@@ -119,6 +127,7 @@ import { SubQueryDefListContext } from "./MalloyParser";
|
|
|
119
127
|
import { ExploreQueryNameDefContext } from "./MalloyParser";
|
|
120
128
|
import { ExploreQueryDefContext } from "./MalloyParser";
|
|
121
129
|
import { QueryStatementContext } from "./MalloyParser";
|
|
130
|
+
import { QueryJoinStatementContext } from "./MalloyParser";
|
|
122
131
|
import { GroupByStatementContext } from "./MalloyParser";
|
|
123
132
|
import { QueryFieldListContext } from "./MalloyParser";
|
|
124
133
|
import { QueryFieldEntryContext } from "./MalloyParser";
|
|
@@ -139,6 +148,7 @@ import { IndexFieldsContext } from "./MalloyParser";
|
|
|
139
148
|
import { IndexStatementContext } from "./MalloyParser";
|
|
140
149
|
import { SampleStatementContext } from "./MalloyParser";
|
|
141
150
|
import { TimezoneStatementContext } from "./MalloyParser";
|
|
151
|
+
import { TimezoneNameContext } from "./MalloyParser";
|
|
142
152
|
import { SampleSpecContext } from "./MalloyParser";
|
|
143
153
|
import { AggregateContext } from "./MalloyParser";
|
|
144
154
|
import { MalloyTypeContext } from "./MalloyParser";
|
|
@@ -521,6 +531,20 @@ export interface MalloyParserVisitor<Result> extends ParseTreeVisitor<Result> {
|
|
|
521
531
|
* @return the visitor result
|
|
522
532
|
*/
|
|
523
533
|
visitExprUngroup?: (ctx: ExprUngroupContext) => Result;
|
|
534
|
+
/**
|
|
535
|
+
* Visit a parse tree produced by the `runStatementDef`
|
|
536
|
+
* labeled alternative in `MalloyParser.runStatement`.
|
|
537
|
+
* @param ctx the parse tree
|
|
538
|
+
* @return the visitor result
|
|
539
|
+
*/
|
|
540
|
+
visitRunStatementDef?: (ctx: RunStatementDefContext) => Result;
|
|
541
|
+
/**
|
|
542
|
+
* Visit a parse tree produced by the `runStatementRef`
|
|
543
|
+
* labeled alternative in `MalloyParser.runStatement`.
|
|
544
|
+
* @param ctx the parse tree
|
|
545
|
+
* @return the visitor result
|
|
546
|
+
*/
|
|
547
|
+
visitRunStatementRef?: (ctx: RunStatementRefContext) => Result;
|
|
524
548
|
/**
|
|
525
549
|
* Visit a parse tree produced by the `exploreArrowQuery`
|
|
526
550
|
* labeled alternative in `MalloyParser.query`.
|
|
@@ -557,19 +581,19 @@ export interface MalloyParserVisitor<Result> extends ParseTreeVisitor<Result> {
|
|
|
557
581
|
*/
|
|
558
582
|
visitDefJoinCross?: (ctx: DefJoinCrossContext) => Result;
|
|
559
583
|
/**
|
|
560
|
-
* Visit a parse tree produced by the `
|
|
584
|
+
* Visit a parse tree produced by the `defExploreDimension_stub`
|
|
561
585
|
* labeled alternative in `MalloyParser.exploreStatement`.
|
|
562
586
|
* @param ctx the parse tree
|
|
563
587
|
* @return the visitor result
|
|
564
588
|
*/
|
|
565
|
-
|
|
589
|
+
visitDefExploreDimension_stub?: (ctx: DefExploreDimension_stubContext) => Result;
|
|
566
590
|
/**
|
|
567
|
-
* Visit a parse tree produced by the `
|
|
591
|
+
* Visit a parse tree produced by the `defExploreMeasure_stub`
|
|
568
592
|
* labeled alternative in `MalloyParser.exploreStatement`.
|
|
569
593
|
* @param ctx the parse tree
|
|
570
594
|
* @return the visitor result
|
|
571
595
|
*/
|
|
572
|
-
|
|
596
|
+
visitDefExploreMeasure_stub?: (ctx: DefExploreMeasure_stubContext) => Result;
|
|
573
597
|
/**
|
|
574
598
|
* Visit a parse tree produced by the `defDeclare_stub`
|
|
575
599
|
* labeled alternative in `MalloyParser.exploreStatement`.
|
|
@@ -585,12 +609,12 @@ export interface MalloyParserVisitor<Result> extends ParseTreeVisitor<Result> {
|
|
|
585
609
|
*/
|
|
586
610
|
visitDefJoin_stub?: (ctx: DefJoin_stubContext) => Result;
|
|
587
611
|
/**
|
|
588
|
-
* Visit a parse tree produced by the `
|
|
612
|
+
* Visit a parse tree produced by the `defExploreWhere_stub`
|
|
589
613
|
* labeled alternative in `MalloyParser.exploreStatement`.
|
|
590
614
|
* @param ctx the parse tree
|
|
591
615
|
* @return the visitor result
|
|
592
616
|
*/
|
|
593
|
-
|
|
617
|
+
visitDefExploreWhere_stub?: (ctx: DefExploreWhere_stubContext) => Result;
|
|
594
618
|
/**
|
|
595
619
|
* Visit a parse tree produced by the `defExplorePrimaryKey`
|
|
596
620
|
* labeled alternative in `MalloyParser.exploreStatement`.
|
|
@@ -613,12 +637,12 @@ export interface MalloyParserVisitor<Result> extends ParseTreeVisitor<Result> {
|
|
|
613
637
|
*/
|
|
614
638
|
visitDefExploreEditField?: (ctx: DefExploreEditFieldContext) => Result;
|
|
615
639
|
/**
|
|
616
|
-
* Visit a parse tree produced by the `
|
|
640
|
+
* Visit a parse tree produced by the `defExploreQuery_stub`
|
|
617
641
|
* labeled alternative in `MalloyParser.exploreStatement`.
|
|
618
642
|
* @param ctx the parse tree
|
|
619
643
|
* @return the visitor result
|
|
620
644
|
*/
|
|
621
|
-
|
|
645
|
+
visitDefExploreQuery_stub?: (ctx: DefExploreQuery_stubContext) => Result;
|
|
622
646
|
/**
|
|
623
647
|
* Visit a parse tree produced by the `defExploreTimezone`
|
|
624
648
|
* labeled alternative in `MalloyParser.exploreStatement`.
|
|
@@ -684,6 +708,12 @@ export interface MalloyParserVisitor<Result> extends ParseTreeVisitor<Result> {
|
|
|
684
708
|
* @return the visitor result
|
|
685
709
|
*/
|
|
686
710
|
visitTopLevelAnonQueryDef?: (ctx: TopLevelAnonQueryDefContext) => Result;
|
|
711
|
+
/**
|
|
712
|
+
* Visit a parse tree produced by `MalloyParser.runStatement`.
|
|
713
|
+
* @param ctx the parse tree
|
|
714
|
+
* @return the visitor result
|
|
715
|
+
*/
|
|
716
|
+
visitRunStatement?: (ctx: RunStatementContext) => Result;
|
|
687
717
|
/**
|
|
688
718
|
* Visit a parse tree produced by `MalloyParser.defineSQLStatement`.
|
|
689
719
|
* @param ctx the parse tree
|
|
@@ -846,6 +876,18 @@ export interface MalloyParserVisitor<Result> extends ParseTreeVisitor<Result> {
|
|
|
846
876
|
* @return the visitor result
|
|
847
877
|
*/
|
|
848
878
|
visitExploreStatement?: (ctx: ExploreStatementContext) => Result;
|
|
879
|
+
/**
|
|
880
|
+
* Visit a parse tree produced by `MalloyParser.defDimensions`.
|
|
881
|
+
* @param ctx the parse tree
|
|
882
|
+
* @return the visitor result
|
|
883
|
+
*/
|
|
884
|
+
visitDefDimensions?: (ctx: DefDimensionsContext) => Result;
|
|
885
|
+
/**
|
|
886
|
+
* Visit a parse tree produced by `MalloyParser.defMeasures`.
|
|
887
|
+
* @param ctx the parse tree
|
|
888
|
+
* @return the visitor result
|
|
889
|
+
*/
|
|
890
|
+
visitDefMeasures?: (ctx: DefMeasuresContext) => Result;
|
|
849
891
|
/**
|
|
850
892
|
* Visit a parse tree produced by `MalloyParser.renameList`.
|
|
851
893
|
* @param ctx the parse tree
|
|
@@ -894,6 +936,24 @@ export interface MalloyParserVisitor<Result> extends ParseTreeVisitor<Result> {
|
|
|
894
936
|
* @return the visitor result
|
|
895
937
|
*/
|
|
896
938
|
visitJoinStatement?: (ctx: JoinStatementContext) => Result;
|
|
939
|
+
/**
|
|
940
|
+
* Visit a parse tree produced by `MalloyParser.queryExtend`.
|
|
941
|
+
* @param ctx the parse tree
|
|
942
|
+
* @return the visitor result
|
|
943
|
+
*/
|
|
944
|
+
visitQueryExtend?: (ctx: QueryExtendContext) => Result;
|
|
945
|
+
/**
|
|
946
|
+
* Visit a parse tree produced by `MalloyParser.queryExtendStatement`.
|
|
947
|
+
* @param ctx the parse tree
|
|
948
|
+
* @return the visitor result
|
|
949
|
+
*/
|
|
950
|
+
visitQueryExtendStatement?: (ctx: QueryExtendStatementContext) => Result;
|
|
951
|
+
/**
|
|
952
|
+
* Visit a parse tree produced by `MalloyParser.queryExtendStatementList`.
|
|
953
|
+
* @param ctx the parse tree
|
|
954
|
+
* @return the visitor result
|
|
955
|
+
*/
|
|
956
|
+
visitQueryExtendStatementList?: (ctx: QueryExtendStatementListContext) => Result;
|
|
897
957
|
/**
|
|
898
958
|
* Visit a parse tree produced by `MalloyParser.joinList`.
|
|
899
959
|
* @param ctx the parse tree
|
|
@@ -966,6 +1026,12 @@ export interface MalloyParserVisitor<Result> extends ParseTreeVisitor<Result> {
|
|
|
966
1026
|
* @return the visitor result
|
|
967
1027
|
*/
|
|
968
1028
|
visitQueryStatement?: (ctx: QueryStatementContext) => Result;
|
|
1029
|
+
/**
|
|
1030
|
+
* Visit a parse tree produced by `MalloyParser.queryJoinStatement`.
|
|
1031
|
+
* @param ctx the parse tree
|
|
1032
|
+
* @return the visitor result
|
|
1033
|
+
*/
|
|
1034
|
+
visitQueryJoinStatement?: (ctx: QueryJoinStatementContext) => Result;
|
|
969
1035
|
/**
|
|
970
1036
|
* Visit a parse tree produced by `MalloyParser.groupByStatement`.
|
|
971
1037
|
* @param ctx the parse tree
|
|
@@ -1086,6 +1152,12 @@ export interface MalloyParserVisitor<Result> extends ParseTreeVisitor<Result> {
|
|
|
1086
1152
|
* @return the visitor result
|
|
1087
1153
|
*/
|
|
1088
1154
|
visitTimezoneStatement?: (ctx: TimezoneStatementContext) => Result;
|
|
1155
|
+
/**
|
|
1156
|
+
* Visit a parse tree produced by `MalloyParser.timezoneName`.
|
|
1157
|
+
* @param ctx the parse tree
|
|
1158
|
+
* @return the visitor result
|
|
1159
|
+
*/
|
|
1160
|
+
visitTimezoneName?: (ctx: TimezoneNameContext) => Result;
|
|
1089
1161
|
/**
|
|
1090
1162
|
* Visit a parse tree produced by `MalloyParser.sampleSpec`.
|
|
1091
1163
|
* @param ctx the parse tree
|
|
@@ -73,11 +73,13 @@ export declare class MalloyToAST extends AbstractParseTreeVisitor<ast.MalloyElem
|
|
|
73
73
|
visitDefJoinCross(pcx: parse.DefJoinCrossContext): ast.Joins;
|
|
74
74
|
protected getJoinList(pcx: parse.JoinListContext): ast.MalloyElement[];
|
|
75
75
|
protected getJoinSource(name: ast.ModelEntryReference, ecx: parse.ExploreContext | undefined): ast.Source;
|
|
76
|
+
visitQueryJoinStatement(pcx: parse.QueryJoinStatementContext): ast.MalloyElement;
|
|
76
77
|
visitJoinOn(pcx: parse.JoinOnContext): ast.Join;
|
|
77
78
|
visitJoinWith(pcx: parse.JoinWithContext): ast.Join;
|
|
78
79
|
getFieldDef(pcx: parse.FieldDefContext, makeFieldDef: ast.FieldDeclarationConstructor): ast.FieldDeclaration;
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
visitDefDimensions(pcx: parse.DefDimensionsContext): ast.Dimensions;
|
|
81
|
+
visitDefMeasures(pcx: parse.DefMeasuresContext): ast.Measures;
|
|
82
|
+
visitQueryExtend(pcx: parse.QueryExtendContext): ast.ExtendBlock;
|
|
81
83
|
visitDeclareStatement(pcx: parse.DeclareStatementContext): ast.DeclareFields;
|
|
82
84
|
visitExploreRenameDef(pcx: parse.ExploreRenameDefContext): ast.RenameField;
|
|
83
85
|
visitDefExploreRename(pcx: parse.DefExploreRenameContext): ast.Renames;
|
|
@@ -115,6 +117,8 @@ export declare class MalloyToAST extends AbstractParseTreeVisitor<ast.MalloyElem
|
|
|
115
117
|
visitTopLevelQueryDefs(pcx: parse.TopLevelQueryDefsContext): ast.DocStatement;
|
|
116
118
|
visitTopLevelQueryDef(pcx: parse.TopLevelQueryDefContext): ast.DefineQuery;
|
|
117
119
|
visitAnonymousQuery(pcx: parse.AnonymousQueryContext): ast.AnonymousQuery;
|
|
120
|
+
visitRunStatementDef(pcx: parse.RunStatementDefContext): ast.RunQueryDef;
|
|
121
|
+
visitRunStatementRef(pcx: parse.RunStatementRefContext): ast.RunQueryRef;
|
|
118
122
|
visitNestedQueryList(pcx: parse.NestedQueryListContext): ast.MalloyElement;
|
|
119
123
|
visitNestExisting(pcx: parse.NestExistingContext): ast.NestedQuery;
|
|
120
124
|
visitNestDef(pcx: parse.NestDefContext): ast.NestDefinition;
|
|
@@ -49,6 +49,7 @@ exports.MalloyToAST = void 0;
|
|
|
49
49
|
const AbstractParseTreeVisitor_1 = require("antlr4ts/tree/AbstractParseTreeVisitor");
|
|
50
50
|
const ast = __importStar(require("./ast"));
|
|
51
51
|
const Interval_1 = require("antlr4ts/misc/Interval");
|
|
52
|
+
const ENABLE_M4_WARNINGS = false;
|
|
52
53
|
/**
|
|
53
54
|
* ANTLR visitor pattern parse tree traversal. Generates a Malloy
|
|
54
55
|
* AST from an ANTLR parse tree.
|
|
@@ -366,6 +367,13 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
366
367
|
}
|
|
367
368
|
return new ast.NamedSource(name);
|
|
368
369
|
}
|
|
370
|
+
visitQueryJoinStatement(pcx) {
|
|
371
|
+
const result = this.astAt(this.visit(pcx.joinStatement()), pcx);
|
|
372
|
+
if (ENABLE_M4_WARNINGS) {
|
|
373
|
+
this.astError(result, 'Joins in queries are deprecated, move into an `extend:` block.', 'warn');
|
|
374
|
+
}
|
|
375
|
+
return result;
|
|
376
|
+
}
|
|
369
377
|
visitJoinOn(pcx) {
|
|
370
378
|
const joinAs = this.getModelEntryName(pcx.joinNameDef());
|
|
371
379
|
const joinFrom = this.getJoinSource(joinAs, pcx.explore());
|
|
@@ -390,20 +398,41 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
390
398
|
const def = new makeFieldDef(valExpr, fieldName, this.getSourceCode(defCx));
|
|
391
399
|
return this.astAt(def, pcx);
|
|
392
400
|
}
|
|
393
|
-
|
|
401
|
+
visitDefDimensions(pcx) {
|
|
394
402
|
const defs = this.getFieldDefs(pcx.defList().fieldDef(), ast.DimensionFieldDeclaration);
|
|
395
403
|
const stmt = new ast.Dimensions(defs);
|
|
396
404
|
return this.astAt(stmt, pcx);
|
|
397
405
|
}
|
|
398
|
-
|
|
406
|
+
visitDefMeasures(pcx) {
|
|
399
407
|
const defs = this.getFieldDefs(pcx.defList().fieldDef(), ast.MeasureFieldDeclaration);
|
|
400
408
|
const stmt = new ast.Measures(defs);
|
|
401
409
|
return this.astAt(stmt, pcx);
|
|
402
410
|
}
|
|
411
|
+
visitQueryExtend(pcx) {
|
|
412
|
+
const extensions = [];
|
|
413
|
+
const items = pcx
|
|
414
|
+
.queryExtendStatementList()
|
|
415
|
+
.queryExtendStatement()
|
|
416
|
+
.map(ctx => this.visit(ctx));
|
|
417
|
+
for (const item of items) {
|
|
418
|
+
if (ast.isQueryExtendProperty(item)) {
|
|
419
|
+
extensions.push(item);
|
|
420
|
+
}
|
|
421
|
+
else {
|
|
422
|
+
throw this.internalError(pcx, `Query extend matched, but ${item.elementType} found`);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
const el = new ast.ExtendBlock(extensions);
|
|
426
|
+
return this.astAt(el, pcx);
|
|
427
|
+
}
|
|
403
428
|
visitDeclareStatement(pcx) {
|
|
404
429
|
const defs = this.getFieldDefs(pcx.defList().fieldDef(), ast.DeclareFieldDeclaration);
|
|
405
430
|
const stmt = new ast.DeclareFields(defs);
|
|
406
|
-
|
|
431
|
+
const result = this.astAt(stmt, pcx);
|
|
432
|
+
if (ENABLE_M4_WARNINGS) {
|
|
433
|
+
this.astError(result, '`declare:` is deprecated; use `dimension:` or `measure:` inside a source or `extend:` block', 'warn');
|
|
434
|
+
}
|
|
435
|
+
return result;
|
|
407
436
|
}
|
|
408
437
|
visitExploreRenameDef(pcx) {
|
|
409
438
|
const newName = pcx.fieldName(0).id();
|
|
@@ -458,7 +487,8 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
458
487
|
return this.visitTimezoneStatement(cx.timezoneStatement());
|
|
459
488
|
}
|
|
460
489
|
visitTimezoneStatement(cx) {
|
|
461
|
-
const
|
|
490
|
+
const tz = cx.timezoneName();
|
|
491
|
+
const timezoneStatement = this.astAt(new ast.TimezoneStatement(this.stripQuotes(tz.STRING_LITERAL().text)), tz);
|
|
462
492
|
if (!timezoneStatement.isValid) {
|
|
463
493
|
this.astError(timezoneStatement, `Invalid timezone: ${timezoneStatement.tz}`);
|
|
464
494
|
}
|
|
@@ -673,12 +703,30 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
673
703
|
throw this.internalError(pcx, `Expect query definition, got a '${queryDef.elementType}'`);
|
|
674
704
|
}
|
|
675
705
|
visitAnonymousQuery(pcx) {
|
|
676
|
-
const
|
|
706
|
+
const defCx = pcx.topLevelAnonQueryDef();
|
|
707
|
+
const query = this.visit(defCx.query());
|
|
677
708
|
if (ast.isQueryElement(query)) {
|
|
678
|
-
|
|
709
|
+
const el = this.astAt(new ast.AnonymousQuery(query), defCx);
|
|
710
|
+
if (ENABLE_M4_WARNINGS) {
|
|
711
|
+
this.astError(el, 'Anonymous `query:` statements are deprecated, use `run:` instead', 'warn');
|
|
712
|
+
}
|
|
713
|
+
return el;
|
|
679
714
|
}
|
|
680
715
|
throw this.internalError(pcx, `Anonymous query matched, but ${query.elementType} found`);
|
|
681
716
|
}
|
|
717
|
+
visitRunStatementDef(pcx) {
|
|
718
|
+
const query = this.visit(pcx.topLevelAnonQueryDef().query());
|
|
719
|
+
if (ast.isQueryElement(query)) {
|
|
720
|
+
const el = new ast.RunQueryDef(query);
|
|
721
|
+
return this.astAt(el, pcx);
|
|
722
|
+
}
|
|
723
|
+
throw this.internalError(pcx, `Run query matched, but ${query.elementType} found`);
|
|
724
|
+
}
|
|
725
|
+
visitRunStatementRef(pcx) {
|
|
726
|
+
const name = this.getModelEntryName(pcx.queryName());
|
|
727
|
+
const el = this.astAt(new ast.RunQueryRef(name), pcx.queryName());
|
|
728
|
+
return this.astAt(el, pcx);
|
|
729
|
+
}
|
|
682
730
|
visitNestedQueryList(pcx) {
|
|
683
731
|
const nestedList = pcx.nestEntry().map(cx => this.visit(cx));
|
|
684
732
|
if (nestedList.length === 1) {
|