From 3395cd7dc356b61fe48ee9d755eef8a7b19ee9f1 Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Fri, 29 Oct 2021 20:06:51 -0400 Subject: [AST] Statement parsing (incomplete) Still need to figure out a check for a type followed by a value --- tests/block-test.tnsl | 74 ++++++++++++++++++++++++----------------------- tests/literal-test.tnsl | 7 +++-- tests/parameter-test.tnsl | 2 +- 3 files changed, 43 insertions(+), 40 deletions(-) (limited to 'tests') diff --git a/tests/block-test.tnsl b/tests/block-test.tnsl index 6dde05f..c48d7de 100644 --- a/tests/block-test.tnsl +++ b/tests/block-test.tnsl @@ -1,47 +1,49 @@ /# - Copyright 2020 Kyle Gunger + Copyright 2020 Kyle Gunger - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. #/ -/;if (i==0) - ;i = 2 -;/ -/: include - "this" - "that" -:/ +/; main + ;int i = 0 -# ;; can be used as a quick block re-definition + /;if (i==0) + ;i = 2 + ;/ -/;if (i==0) - ;i = 2 -;;else - ;i = 0 -;/ + /: include + "this" + "that" + :/ -# Comment block switching + # ;; can be used as a quick block re-definition -/; if (i == 2) - ;i = 4 -;# - Comment -#; else - ;i = 6 -;/ + /;if (i==0) + ;i = 2 + ;;else + ;i = 0 + ;/ -/; main + # Comment block switching + + /; if (i == 2) + ;i = 4 + ;# + Comment + #; else + ;i = 6 + ;/ ;/ /; module vec @@ -51,17 +53,17 @@ /;method Vector2 /; operator + (~Vector2 v) - ;self.x += `v.x - ;self.y += `v.y + ;self.x += v`.x + ;self.y += v`.y ;/ - /; operator + (int32 a) + /; operator + (int32 a) ;self.x += a ;self.y += a ;/ ;/ - ;struct FVector2 () {} + ;struct FVector2 () {} ;/ \ No newline at end of file diff --git a/tests/literal-test.tnsl b/tests/literal-test.tnsl index 1841159..73f5f77 100644 --- a/tests/literal-test.tnsl +++ b/tests/literal-test.tnsl @@ -15,8 +15,8 @@ #/ # These should all work -;[]char s = "\"" -;[]char st="\\" +;{}char s = "\"" +;{}char st="\\" ;int i = 0 ;int j=1 @@ -40,4 +40,5 @@ ;int k = .1 -;int l = 0x01 \ No newline at end of file +;int l = 0x01 + diff --git a/tests/parameter-test.tnsl b/tests/parameter-test.tnsl index 254db75..96f6d41 100644 --- a/tests/parameter-test.tnsl +++ b/tests/parameter-test.tnsl @@ -13,6 +13,6 @@ See the License for the specific language governing permissions and limitations under the License. #/ - +;int another = 0 /; loop (int initial = 0, complex = 2) [initial < max || complex < 40, initial++, complex += 7, another += 2] ;/ -- cgit v1.2.3