@malloydata/malloy 0.0.226-dev250113204439 → 0.0.226-dev250113232339

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.
@@ -391,7 +391,6 @@ class DuckDBTypeParser extends tiny_parser_1.TinyParser {
391
391
  return token.text.toUpperCase();
392
392
  }
393
393
  typeDef() {
394
- const unknownStart = this.parseCursor;
395
394
  const wantID = this.next('id');
396
395
  const id = this.sqlID(wantID);
397
396
  let baseType;
@@ -438,17 +437,18 @@ class DuckDBTypeParser extends tiny_parser_1.TinyParser {
438
437
  }
439
438
  else {
440
439
  if (wantID.type === 'id') {
441
- for (;;) {
442
- const next = this.peek();
443
- // Might be WEIRDTYP(a,b)[] ... stop at the []
444
- if (next.type === 'arrayOf' || next.type === 'eof') {
445
- break;
446
- }
440
+ // unknown field type, strip all type decorations, there was a regex for this
441
+ // in the pre-parser code, but no tests, so this is also untested
442
+ let idEnd = wantID.cursor + wantID.text.length;
443
+ if (this.peek().type === 'precision') {
447
444
  this.next();
448
445
  }
446
+ if (this.peek().type === 'eof') {
447
+ idEnd = this.input.length;
448
+ }
449
449
  baseType = {
450
450
  type: 'sql native',
451
- rawType: this.input.slice(unknownStart, this.parseCursor - unknownStart + 1),
451
+ rawType: this.input.slice(wantID.cursor, idEnd),
452
452
  };
453
453
  }
454
454
  else {
@@ -1,4 +1,5 @@
1
1
  export interface TinyToken {
2
+ cursor: number;
2
3
  type: string;
3
4
  text: string;
4
5
  }
@@ -129,12 +129,14 @@ class TinyParser {
129
129
  if (foundToken) {
130
130
  notFound = false;
131
131
  let tokenText = foundToken[0];
132
+ const cursor = this.parseCursor;
132
133
  this.parseCursor += tokenText.length;
133
134
  if (tokenType !== 'space') {
134
135
  if (tokenType[0] === 'q') {
135
136
  tokenText = tokenText.slice(1, -1); // strip quotes
136
137
  }
137
138
  yield {
139
+ cursor,
138
140
  type: tokenType === 'char' ? tokenText : tokenType,
139
141
  text: tokenText,
140
142
  };
@@ -143,7 +145,7 @@ class TinyParser {
143
145
  }
144
146
  }
145
147
  if (notFound) {
146
- yield { type: 'unexpected token', text: src };
148
+ yield { cursor: this.parseCursor, type: 'unexpected token', text: src };
147
149
  return;
148
150
  }
149
151
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/malloy",
3
- "version": "0.0.226-dev250113204439",
3
+ "version": "0.0.226-dev250113232339",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",