@malloydata/malloy 0.0.360 → 0.0.361
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/annotation.js +6 -3
- package/dist/lang/lib/Malloy/MalloyLexer.d.ts +69 -54
- package/dist/lang/lib/Malloy/MalloyLexer.js +1407 -1287
- package/dist/lang/lib/Malloy/MalloyParser.d.ts +280 -229
- package/dist/lang/lib/Malloy/MalloyParser.js +2668 -2354
- package/dist/lang/lib/Malloy/MalloyParserListener.d.ts +44 -0
- package/dist/lang/lib/Malloy/MalloyParserVisitor.d.ts +28 -0
- package/dist/lang/malloy-to-ast.d.ts +3 -7
- package/dist/lang/malloy-to-ast.js +45 -25
- package/dist/lang/malloy-to-stable-query.d.ts +3 -3
- package/dist/lang/malloy-to-stable-query.js +3 -3
- package/dist/lang/parse-log.d.ts +2 -0
- package/dist/lang/parse-malloy.js +1 -1
- package/dist/lang/parse-tree-walkers/model-annotation-walker.js +5 -6
- package/dist/lang/parse-utils.d.ts +4 -1
- package/dist/lang/parse-utils.js +49 -0
- package/dist/lang/syntax-errors/malloy-parser-error-listener.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
package/dist/annotation.js
CHANGED
|
@@ -39,7 +39,7 @@ function annotationToTag(annote, spec = {}) {
|
|
|
39
39
|
startLine: note.at.range.start.line,
|
|
40
40
|
startColumn: note.at.range.start.character,
|
|
41
41
|
};
|
|
42
|
-
const noteParse = session.
|
|
42
|
+
const noteParse = session.parseAnnotation(note.text, origin);
|
|
43
43
|
allErrs.push(...noteParse.log.map((e) => mapMalloyError(e, note)));
|
|
44
44
|
}
|
|
45
45
|
const tag = session.finish();
|
|
@@ -54,10 +54,10 @@ function annotationToTag(annote, spec = {}) {
|
|
|
54
54
|
return { tag, log: allErrs };
|
|
55
55
|
}
|
|
56
56
|
function mapMalloyError(e, note) {
|
|
57
|
-
// Calculate prefix length (same logic as
|
|
57
|
+
// Calculate prefix length (same logic as stripPrefix in malloy-tag)
|
|
58
58
|
let prefixLen = 0;
|
|
59
59
|
if (note.text[0] === '#') {
|
|
60
|
-
const skipTo = note.text.
|
|
60
|
+
const skipTo = note.text.search(/[ \n]/);
|
|
61
61
|
if (skipTo > 0) {
|
|
62
62
|
prefixLen = skipTo;
|
|
63
63
|
}
|
|
@@ -65,6 +65,9 @@ function mapMalloyError(e, note) {
|
|
|
65
65
|
// Map error position to source location
|
|
66
66
|
// e.line is 0-based line within the (stripped) input
|
|
67
67
|
// e.offset is 0-based column within that line
|
|
68
|
+
// TODO: For block annotations, lines > 0 have indentation stripped by
|
|
69
|
+
// stripBlockIndent, so e.offset doesn't account for the removed columns.
|
|
70
|
+
// This makes error squigglies misaligned on block annotation body lines.
|
|
68
71
|
const line = note.at.range.start.line + e.line;
|
|
69
72
|
const character = e.line === 0
|
|
70
73
|
? note.at.range.start.character + prefixLen + e.offset
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ATN } from "antlr4ts/atn/ATN";
|
|
2
2
|
import { CharStream } from "antlr4ts/CharStream";
|
|
3
3
|
import { Lexer } from "antlr4ts/Lexer";
|
|
4
|
+
import { RuleContext } from "antlr4ts/RuleContext";
|
|
4
5
|
import { Vocabulary } from "antlr4ts/Vocabulary";
|
|
5
6
|
export declare class MalloyLexer extends Lexer {
|
|
6
7
|
static readonly ACCEPT = 1;
|
|
@@ -122,61 +123,66 @@ export declare class MalloyLexer extends Lexer {
|
|
|
122
123
|
static readonly SQ_STRING = 117;
|
|
123
124
|
static readonly DQ_STRING = 118;
|
|
124
125
|
static readonly BQ_STRING = 119;
|
|
125
|
-
static readonly
|
|
126
|
-
static readonly
|
|
127
|
-
static readonly
|
|
128
|
-
static readonly
|
|
129
|
-
static readonly
|
|
130
|
-
static readonly
|
|
131
|
-
static readonly
|
|
132
|
-
static readonly
|
|
133
|
-
static readonly
|
|
134
|
-
static readonly
|
|
135
|
-
static readonly
|
|
136
|
-
static readonly
|
|
137
|
-
static readonly
|
|
138
|
-
static readonly
|
|
139
|
-
static readonly
|
|
140
|
-
static readonly
|
|
141
|
-
static readonly
|
|
142
|
-
static readonly
|
|
143
|
-
static readonly
|
|
144
|
-
static readonly
|
|
145
|
-
static readonly
|
|
146
|
-
static readonly
|
|
147
|
-
static readonly
|
|
148
|
-
static readonly
|
|
149
|
-
static readonly
|
|
150
|
-
static readonly
|
|
151
|
-
static readonly
|
|
152
|
-
static readonly
|
|
153
|
-
static readonly
|
|
154
|
-
static readonly
|
|
155
|
-
static readonly
|
|
156
|
-
static readonly
|
|
157
|
-
static readonly
|
|
158
|
-
static readonly
|
|
159
|
-
static readonly
|
|
160
|
-
static readonly
|
|
161
|
-
static readonly
|
|
162
|
-
static readonly
|
|
163
|
-
static readonly
|
|
164
|
-
static readonly
|
|
165
|
-
static readonly
|
|
166
|
-
static readonly
|
|
167
|
-
static readonly
|
|
168
|
-
static readonly
|
|
169
|
-
static readonly
|
|
170
|
-
static readonly
|
|
171
|
-
static readonly
|
|
172
|
-
static readonly
|
|
173
|
-
static readonly
|
|
174
|
-
static readonly
|
|
175
|
-
static readonly
|
|
176
|
-
static readonly
|
|
177
|
-
static readonly
|
|
178
|
-
static readonly
|
|
126
|
+
static readonly DOC_BLOCK_ANNOTATION_BEGIN = 120;
|
|
127
|
+
static readonly BLOCK_ANNOTATION_BEGIN = 121;
|
|
128
|
+
static readonly DOC_ANNOTATION = 122;
|
|
129
|
+
static readonly ANNOTATION = 123;
|
|
130
|
+
static readonly AMPER = 124;
|
|
131
|
+
static readonly ARROW = 125;
|
|
132
|
+
static readonly FAT_ARROW = 126;
|
|
133
|
+
static readonly OPAREN = 127;
|
|
134
|
+
static readonly CPAREN = 128;
|
|
135
|
+
static readonly OBRACK = 129;
|
|
136
|
+
static readonly CBRACK = 130;
|
|
137
|
+
static readonly OCURLY = 131;
|
|
138
|
+
static readonly CCURLY = 132;
|
|
139
|
+
static readonly DOUBLECOLON = 133;
|
|
140
|
+
static readonly TRIPLECOLON = 134;
|
|
141
|
+
static readonly EXCLAM = 135;
|
|
142
|
+
static readonly COLON = 136;
|
|
143
|
+
static readonly COMMA = 137;
|
|
144
|
+
static readonly DOT = 138;
|
|
145
|
+
static readonly LT = 139;
|
|
146
|
+
static readonly GT = 140;
|
|
147
|
+
static readonly EQ = 141;
|
|
148
|
+
static readonly NE = 142;
|
|
149
|
+
static readonly LTE = 143;
|
|
150
|
+
static readonly GTE = 144;
|
|
151
|
+
static readonly PLUS = 145;
|
|
152
|
+
static readonly MINUS = 146;
|
|
153
|
+
static readonly STAR = 147;
|
|
154
|
+
static readonly STARSTAR = 148;
|
|
155
|
+
static readonly SLASH = 149;
|
|
156
|
+
static readonly BAR = 150;
|
|
157
|
+
static readonly SEMI = 151;
|
|
158
|
+
static readonly NOT_MATCH = 152;
|
|
159
|
+
static readonly MATCH = 153;
|
|
160
|
+
static readonly PERCENT = 154;
|
|
161
|
+
static readonly DOUBLE_QMARK = 155;
|
|
162
|
+
static readonly QMARK = 156;
|
|
163
|
+
static readonly LITERAL_TIMESTAMP = 157;
|
|
164
|
+
static readonly LITERAL_HOUR = 158;
|
|
165
|
+
static readonly LITERAL_DAY = 159;
|
|
166
|
+
static readonly LITERAL_QUARTER = 160;
|
|
167
|
+
static readonly LITERAL_MONTH = 161;
|
|
168
|
+
static readonly LITERAL_WEEK = 162;
|
|
169
|
+
static readonly LITERAL_YEAR = 163;
|
|
170
|
+
static readonly IDENTIFIER = 164;
|
|
171
|
+
static readonly PERCENT_LITERAL = 165;
|
|
172
|
+
static readonly NUMERIC_LITERAL = 166;
|
|
173
|
+
static readonly INTEGER_LITERAL = 167;
|
|
174
|
+
static readonly BLOCK_COMMENT = 168;
|
|
175
|
+
static readonly COMMENT_TO_EOL = 169;
|
|
176
|
+
static readonly WHITE_SPACE = 170;
|
|
177
|
+
static readonly SQL_BEGIN = 171;
|
|
178
|
+
static readonly UNWATED_CHARS_TRAILING_NUMBERS = 172;
|
|
179
|
+
static readonly UNEXPECTED_CHAR = 173;
|
|
180
|
+
static readonly OPEN_CODE = 174;
|
|
181
|
+
static readonly SQL_END = 175;
|
|
182
|
+
static readonly BLOCK_ANNOTATION_END = 176;
|
|
183
|
+
static readonly BLOCK_ANNOTATION_TEXT = 177;
|
|
179
184
|
static readonly SQL_MODE = 1;
|
|
185
|
+
static readonly BLOCK_ANNOTATION_MODE = 2;
|
|
180
186
|
static readonly channelNames: string[];
|
|
181
187
|
static readonly modeNames: string[];
|
|
182
188
|
static readonly ruleNames: string[];
|
|
@@ -184,17 +190,26 @@ export declare class MalloyLexer extends Lexer {
|
|
|
184
190
|
private static readonly _SYMBOLIC_NAMES;
|
|
185
191
|
static readonly VOCABULARY: Vocabulary;
|
|
186
192
|
get vocabulary(): Vocabulary;
|
|
193
|
+
_blockAnnotationColumn: number;
|
|
194
|
+
_blockAnnotationCloser: string;
|
|
195
|
+
isBlockAnnotationCloseLine(): boolean;
|
|
187
196
|
constructor(input: CharStream);
|
|
188
197
|
get grammarFileName(): string;
|
|
189
198
|
get ruleNames(): string[];
|
|
190
199
|
get serializedATN(): string;
|
|
191
200
|
get channelNames(): string[];
|
|
192
201
|
get modeNames(): string[];
|
|
202
|
+
action(_localctx: RuleContext, ruleIndex: number, actionIndex: number): void;
|
|
203
|
+
private DOC_BLOCK_ANNOTATION_BEGIN_action;
|
|
204
|
+
private BLOCK_ANNOTATION_BEGIN_action;
|
|
205
|
+
sempred(_localctx: RuleContext, ruleIndex: number, predIndex: number): boolean;
|
|
206
|
+
private BLOCK_ANNOTATION_END_sempred;
|
|
193
207
|
private static readonly _serializedATNSegments;
|
|
194
208
|
private static readonly _serializedATNSegment0;
|
|
195
209
|
private static readonly _serializedATNSegment1;
|
|
196
210
|
private static readonly _serializedATNSegment2;
|
|
197
211
|
private static readonly _serializedATNSegment3;
|
|
212
|
+
private static readonly _serializedATNSegment4;
|
|
198
213
|
static readonly _serializedATN: string;
|
|
199
214
|
static __ATN: ATN;
|
|
200
215
|
static get _ATN(): ATN;
|