From 3371c51e945a322567ac3c648425a0c6439f887b Mon Sep 17 00:00:00 2001 From: Umur Ozkul Date: Thu, 19 May 2022 17:47:26 +0200 Subject: [PATCH] post operators test --- .../Reducer/Reducer_Peggy/Reducer_Peggy_Parse_test.res | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/squiggle-lang/__tests__/Reducer/Reducer_Peggy/Reducer_Peggy_Parse_test.res b/packages/squiggle-lang/__tests__/Reducer/Reducer_Peggy/Reducer_Peggy_Parse_test.res index ce0ec5d7..7d57119b 100644 --- a/packages/squiggle-lang/__tests__/Reducer/Reducer_Peggy/Reducer_Peggy_Parse_test.res +++ b/packages/squiggle-lang/__tests__/Reducer/Reducer_Peggy/Reducer_Peggy_Parse_test.res @@ -61,7 +61,6 @@ describe("Peggy parse", () => { testParse("1 * 2 - 3 ./ 4", "{(::subtract (::multiply 1 2) (::dotDivide 3 4))}") testParse("1 * 2 - 3 * 4^5", "{(::subtract (::multiply 1 2) (::multiply 3 (::pow 4 5)))}") testParse("1 * 2 - 3 * 4^5^6", "{(::subtract (::multiply 1 2) (::multiply 3 (::pow (::pow 4 5) 6)))}") - testParse("1 * 2 - 3 * 4^5^6", "{(::subtract (::multiply 1 2) (::multiply 3 (::pow (::pow 4 5) 6)))}") testParse("1 * -a[-2]", "{(::multiply 1 (::unaryMinus (::$atIndex :a (::unaryMinus 2))))}") }) @@ -94,6 +93,13 @@ describe("Peggy parse", () => { testParse("record.property", "{(::$atIndex :record 'property')}") }) + describe("post operators", ()=>{ + //function call, array and record access are post operators with higher priority than unary operators + testParse("a==!b(1)", "{(::equal :a (::not (::b 1)))}") + testParse("a==!b[1]", "{(::equal :a (::not (::$atIndex :b 1)))}") + testParse("a==!b.one", "{(::equal :a (::not (::$atIndex :b 'one')))}") + }) + describe("comments", () => { testParse("1 # This is a line comment", "{1}") testParse("1 // This is a line comment", "{1}")