@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.
@@ -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.parse(note.text, origin);
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 parseTagLine)
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.indexOf(' ');
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 DOC_ANNOTATION = 120;
126
- static readonly ANNOTATION = 121;
127
- static readonly AMPER = 122;
128
- static readonly ARROW = 123;
129
- static readonly FAT_ARROW = 124;
130
- static readonly OPAREN = 125;
131
- static readonly CPAREN = 126;
132
- static readonly OBRACK = 127;
133
- static readonly CBRACK = 128;
134
- static readonly OCURLY = 129;
135
- static readonly CCURLY = 130;
136
- static readonly DOUBLECOLON = 131;
137
- static readonly TRIPLECOLON = 132;
138
- static readonly EXCLAM = 133;
139
- static readonly COLON = 134;
140
- static readonly COMMA = 135;
141
- static readonly DOT = 136;
142
- static readonly LT = 137;
143
- static readonly GT = 138;
144
- static readonly EQ = 139;
145
- static readonly NE = 140;
146
- static readonly LTE = 141;
147
- static readonly GTE = 142;
148
- static readonly PLUS = 143;
149
- static readonly MINUS = 144;
150
- static readonly STAR = 145;
151
- static readonly STARSTAR = 146;
152
- static readonly SLASH = 147;
153
- static readonly BAR = 148;
154
- static readonly SEMI = 149;
155
- static readonly NOT_MATCH = 150;
156
- static readonly MATCH = 151;
157
- static readonly PERCENT = 152;
158
- static readonly DOUBLE_QMARK = 153;
159
- static readonly QMARK = 154;
160
- static readonly LITERAL_TIMESTAMP = 155;
161
- static readonly LITERAL_HOUR = 156;
162
- static readonly LITERAL_DAY = 157;
163
- static readonly LITERAL_QUARTER = 158;
164
- static readonly LITERAL_MONTH = 159;
165
- static readonly LITERAL_WEEK = 160;
166
- static readonly LITERAL_YEAR = 161;
167
- static readonly IDENTIFIER = 162;
168
- static readonly PERCENT_LITERAL = 163;
169
- static readonly NUMERIC_LITERAL = 164;
170
- static readonly INTEGER_LITERAL = 165;
171
- static readonly BLOCK_COMMENT = 166;
172
- static readonly COMMENT_TO_EOL = 167;
173
- static readonly WHITE_SPACE = 168;
174
- static readonly SQL_BEGIN = 169;
175
- static readonly UNWATED_CHARS_TRAILING_NUMBERS = 170;
176
- static readonly UNEXPECTED_CHAR = 171;
177
- static readonly OPEN_CODE = 172;
178
- static readonly SQL_END = 173;
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;