From 614b4182ada28651eebece03d48e4e366020371a Mon Sep 17 00:00:00 2001 From: Michael Toy <66150587+mtoy-googly-moogly@users.noreply.github.com> Date: Tue, 22 Oct 2024 13:51:33 -0700 Subject: [PATCH] better parse errors for records and arrays (#1975) --- packages/malloy/src/lang/malloy-to-ast.ts | 14 ++++++++++++++ packages/malloy/src/lang/parse-log.ts | 1 + 2 files changed, 15 insertions(+) diff --git a/packages/malloy/src/lang/malloy-to-ast.ts b/packages/malloy/src/lang/malloy-to-ast.ts index fda892fd5..e433ed31e 100644 --- a/packages/malloy/src/lang/malloy-to-ast.ts +++ b/packages/malloy/src/lang/malloy-to-ast.ts @@ -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( pcx.recordElement().map(elCx => this.astAt(this.visit(elCx), elCx)), visited => visited instanceof ast.RecordElement && visited, @@ -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); diff --git a/packages/malloy/src/lang/parse-log.ts b/packages/malloy/src/lang/parse-log.ts index 2b90470b0..a55c08838 100644 --- a/packages/malloy/src/lang/parse-log.ts +++ b/packages/malloy/src/lang/parse-log.ts @@ -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;