diff --git a/packages/squiggle-lang/__tests__/Reducer/Reducer_test.res b/packages/squiggle-lang/__tests__/Reducer/Reducer_test.res index 39f387a1..dc403e7d 100644 --- a/packages/squiggle-lang/__tests__/Reducer/Reducer_test.res +++ b/packages/squiggle-lang/__tests__/Reducer/Reducer_test.res @@ -27,6 +27,15 @@ describe("eval", () => { test("index", () => expectEvalToBe("r = {a: 1}; r.a", "Ok(1)")) test("index", () => expectEvalToBe("r = {a: 1}; r.b", "Error(Record property not found: b)")) testEvalError("{a: 1}.b") // invalid syntax + test("always the same property ending", () => + expectEvalToBe( + `{ + a: 1, + b: 2, + }`, + "Ok({a: 1,b: 2})", + ) + ) }) describe("multi-line", () => { diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Peggy/Reducer_Peggy_GeneratedParser.peggy b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Peggy/Reducer_Peggy_GeneratedParser.peggy index dfd3eb45..15837da4 100644 --- a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Peggy/Reducer_Peggy_GeneratedParser.peggy +++ b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Peggy/Reducer_Peggy_GeneratedParser.peggy @@ -277,9 +277,13 @@ arrayConstructor 'array' { return [head, ...tail]; } recordConstructor 'record' - = '{' _nl args:array_recordArguments _nl '}' + = '{' _nl args:array_recordArguments _nl end_of_record { return h.constructRecord(args); } + end_of_record + = '}' + / ',' _nl '}' + array_recordArguments = head:keyValuePair tail:(_ ',' _nl @keyValuePair)* { return [head, ...tail]; }