From 873d6c89b1d7783fbe5e21655b92f76924c94ef7 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Tue, 27 Sep 2022 14:17:15 -0400 Subject: [PATCH] Rewrote parser test case input files --- tests/parser/data/main.arf | 37 ++++++++++++------------------- tests/parser/enum/main.arf | 34 ++++++++++++++-------------- tests/parser/face/main.arf | 2 ++ tests/parser/func/main.arf | 17 +++++++------- tests/parser/skim/main.arf | 28 ++++++++++-------------- tests/parser/type/main.arf | 45 +++++++++++++++++++------------------- 6 files changed, 75 insertions(+), 88 deletions(-) diff --git a/tests/parser/data/main.arf b/tests/parser/data/main.arf index 824cacd..bd204ba 100644 --- a/tests/parser/data/main.arf +++ b/tests/parser/data/main.arf @@ -1,9 +1,9 @@ :arf --- -data ro aInteger:Int:<3202> +data ro aInteger:Int: 3202 -data ro bMutInteger:Int:mut:<3202> +data ro bMutInteger:Int:mut: 3202 data ro cIntegerPointer:{Int} @@ -13,33 +13,24 @@ data ro eIntegerArray16:Int:16 data ro fIntegerArrayVariable:{Int ..} -data ro gIntegerArrayInitialized:Int:16:< - 3948 293 293049 948 912 - 340 0 2304 0 4785 92 - > +data ro gIntegerArrayInitialized:Int:16 + (3948 293 293049 948 912 + 340 0 2304 0 4785 92) -data rw hIntegerPointerInit:{Int}:<[& integer]> +data rw hIntegerPointerInit:{Int} [& integer] -data rw iMutIntegerPointerInit:{Int}:mut:<[& integer]> +data rw iMutIntegerPointerInit:{Int}:mut + [& integer] -data ro jObject:Obj:( - .this:<324> - .that:<324>) - -data ro kNestedObject:Obj:( - .this:( - .bird0:<324> - .bird1:<"hello world">) - .ro newMember:Int:<9023> - .that:( - .bird2:<123.8439> - .bird3:<9328.21348239>)) +data ro jObject:Obj + (324 + 438) data ro lMutIntegerArray16:Int:16:mut data ro mExternalData:Int:8 external -data ro nIntegerArrayInitialized:Int:16:mut: - <3948 293 293049 948 912 - 340 0 2304 0 4785 92> +data ro nIntegerArrayInitialized:Int:16:mut + (3948 293 293049 948 912 + 340 0 2304 0 4785 92) diff --git a/tests/parser/enum/main.arf b/tests/parser/enum/main.arf index 9e2aedf..e935f73 100644 --- a/tests/parser/enum/main.arf +++ b/tests/parser/enum/main.arf @@ -11,26 +11,26 @@ enum ro Weekday:Int - saturday enum ro NamedColor:U32 - - red: <0xFF0000> - - green: <0x00FF00> - - blue: <0x0000FF> + - red 0xFF0000 + - green 0x00FF00 + - blue 0x0000FF enum ro AffrontToGod:Int:4 - - bird0: - <28394 9328 - 398 9> - - bird1: - <23 932832 + - bird0 + (28394 9328 + 398 9) + - bird1 + (23 932832 398 - 2349> - - bird2: - <1 + 2349) + - bird2 + (1 2 3 - 4> + 4) -enum ro ThisIsTerrible:Obj:(.rw x:Int .rw y:Int) - - up: (.x:< 0> .y:<-1>) - - down: (.x:< 0> .y:< 1>) - - left: (.x:<-1> .y:< 0>) - - right: (.x:< 1> .y:< 0>) +enum ro ThisIsTerrible:Vector + - up ( 0 -1) + - down ( 0 1) + - left (-1 0) + - right ( 1 0) diff --git a/tests/parser/face/main.arf b/tests/parser/face/main.arf index 4a78a7c..8288cdc 100644 --- a/tests/parser/face/main.arf +++ b/tests/parser/face/main.arf @@ -13,3 +13,5 @@ face ro ReadWriter:Face face ro Destroyer:Face destroy + +# TODO: add test case for func interface diff --git a/tests/parser/func/main.arf b/tests/parser/func/main.arf index adee836..2834cfe 100644 --- a/tests/parser/func/main.arf +++ b/tests/parser/func/main.arf @@ -2,14 +2,14 @@ --- func ro aBasicExternal > someInput:Int:mut - < someOutput:Int:<4> + < someOutput:Int 4 --- external func ro bMethod @ bird:{Bird} > someInput:Int:mut - < someOutput:Int:<4> + < someOutput:Int 4 --- external @@ -126,10 +126,9 @@ func ro hSetPhrase --- let x:Int:<3> # loc is a reference, similar to * in C - let y:{Int}:<[loc x]> - let z:Int:8: - <398 9 2309 983 -2387 - 478 555 123> - let bird:Bird:( - .that:(.whenYou:<99999>) - .this:<324>) + let y:{Int} [loc x] + let z:Int:8 (398 9 2309 983 -2387 + 478 555 123) + let bird:Bird ( + (99999) + 324) diff --git a/tests/parser/skim/main.arf b/tests/parser/skim/main.arf index 762a451..bfeba2d 100644 --- a/tests/parser/skim/main.arf +++ b/tests/parser/skim/main.arf @@ -6,37 +6,31 @@ data ro aExternalData:Int data ro bSingleValue:Int 342 -data ro cNestedObject:Obj - -- this - -- bird0 324 - -- bird1 "hello world" - -- that - -- bird2 123.8439 - -- bird3 9328.21348239 +data ro cNestedObject:Obj ( + (324 "hello world") + (123.8439 9328.21348239) +) data ro dUninitialized:Int:16:mut data ro eIntegerArrayInitialized:Int:16:mut - 3948 293 293049 948 912 - 340 0 2304 0 4785 92 + (3948 293 293049 948 912 + 340 0 2304 0 4785 92) func ro fComplexFunction --- = x:Int 3 = y:{Int} [loc x] - = z:Int:8 + = z:Int:8 ( 398 9 2309 983 -2387 - 478 555 123 - = bird:Bird - -- that - -- whenYou 99999 - -- this 324 + 478 555 123) + = bird:Bird ((99999) 324) func ro gExternalFunction > x:Int < arr:Int 5 - 34908 + (34908 39 3498 - 38 219 + 38 219) --- external diff --git a/tests/parser/type/main.arf b/tests/parser/type/main.arf index 8ffe9df..611adf9 100644 --- a/tests/parser/type/main.arf +++ b/tests/parser/type/main.arf @@ -1,35 +1,36 @@ :arf --- -type ro aBasic:Obj:( - .ro that:Int - .ro this:Int) +type ro aBasic:Obj + ro that:Int + ro this:Int -type ro bBitFields:Obj:( - .ro that:Int & 1 - .ro this:Int:<298> & 24) +type ro bBitFields:Obj + ro that:Int & 1 + ro this:Int 298 & 24 type ro cInit:Obj:( - .ro that:String:<"hello world"> - .ro this:Int:<23>) + ro that:String "hello world" + ro this:Int 23 -type ro dInitInherit:aBasic:( - .that:<9384> - .this:<389>) +# the semantic analyzer should let these sections restrict the permissions of +# inherited members, but it should not let the sections lessen the permissions. +type ro dInitInherit:aBasic + ro that 9384 + ro this 389 -type ro eInitAndDefine:aBasic:( - .this:<389> - .ro these:aBasic:( - .ro born:Int:<4> - .ro in:Int - .ro the:Int:3:<9348 92384 92834> - .this:<98>) - .that:<9384>) +type ro eInitAndDefine:aBasic + ro this 389 + ro that 9384 + ro born:Int 4 + ro in:Int + ro the:Int:3 (9348 92384 92834) + ro walls:String "live in the walls, die in the walls." type ro fBasic:Int -type ro gBasicInit:Int:<6> +type ro gBasicInit:Int 6 type ro hIntArray:{Int ..} -type ro iIntArrayInit:Int:3: - <3298 923 92> +type ro iIntArrayInit:Int:3 + (3298 923 92)