Skip to content

Commit

Permalink
better parse errors for records and arrays (#1975)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtoy-googly-moogly authored Oct 22, 2024
1 parent 1b20b15 commit 614b418
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/malloy/src/lang/malloy-to-ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1964,6 +1964,11 @@ export class MalloyToAST
}

visitExprLiteralRecord(pcx: parse.ExprLiteralRecordContext) {
this.contextError(
pcx,
'not-yet-implemented',
'Record data is not yet implemented'
);
const els = this.only<ast.RecordElement>(
pcx.recordElement().map(elCx => this.astAt(this.visit(elCx), elCx)),
visited => visited instanceof ast.RecordElement && visited,
Expand All @@ -1972,6 +1977,15 @@ export class MalloyToAST
return new ast.RecordLiteral(els);
}

visitExprArrayLiteral(pcx: parse.ExprArrayLiteralContext): ast.Unimplemented {
this.contextError(
pcx,
'not-yet-implemented',
'Array data is not yet implemented'
);
return new ast.Unimplemented();
}

visitExprWarnLike(pcx: parse.ExprWarnLikeContext): ast.ExprCompare {
let op: ast.CompareMalloyOperator = '~';
const left = pcx.fieldExpr(0);
Expand Down
1 change: 1 addition & 0 deletions packages/malloy/src/lang/parse-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ type MessageParameterTypes = {
'sql-is-not-null': string;
'sql-is-null': string;
'illegal-record-property-type': string;
'not-yet-implemented': string;
'sql-case': string;
'case-then-type-does-not-match': {
thenType: FieldValueType;
Expand Down

0 comments on commit 614b418

Please sign in to comment.