summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2021-10-29 20:06:51 -0400
committerKyle Gunger <kgunger12@gmail.com>2021-10-29 20:06:51 -0400
commit3395cd7dc356b61fe48ee9d755eef8a7b19ee9f1 (patch)
tree7ff4dcc5fc9e24021fd5d754a8a8ecd2df3a6df4 /tests
parent8502bdd410c5a685a66a218fa97ddd2e7d207d30 (diff)
[AST] Statement parsing (incomplete)
Still need to figure out a check for a type followed by a value
Diffstat (limited to 'tests')
-rw-r--r--tests/block-test.tnsl74
-rw-r--r--tests/literal-test.tnsl7
-rw-r--r--tests/parameter-test.tnsl2
3 files changed, 43 insertions, 40 deletions
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]
;/