about summary refs log tree commit diff
path: root/boot/tests/parse
diff options
context:
space:
mode:
authorMel <mel@rnrd.eu>2026-05-28 00:36:13 +0200
committerMel <mel@rnrd.eu>2026-05-28 00:36:13 +0200
commit1aef923b312f2bc9c0963381eae8619c187081c6 (patch)
tree2e324f09960c31b13f72b3961fc7abaf0fa2865e /boot/tests/parse
parent7db79f43b431b94d525308699a87a3daeff31d92 (diff)
downloadcatskill-1aef923b312f2bc9c0963381eae8619c187081c6.tar.zst
catskill-1aef923b312f2bc9c0963381eae8619c187081c6.zip
Use semicolon tokens as statement separators
Signed-off-by: Mel <mel@rnrd.eu>
Diffstat (limited to 'boot/tests/parse')
-rw-r--r--boot/tests/parse/semicolon_separators.cskt25
1 files changed, 25 insertions, 0 deletions
diff --git a/boot/tests/parse/semicolon_separators.cskt b/boot/tests/parse/semicolon_separators.cskt
new file mode 100644
index 0000000..384ca71
--- /dev/null
+++ b/boot/tests/parse/semicolon_separators.cskt
@@ -0,0 +1,25 @@
+a `;` terminates the current statement just like a newline,
+so multiple statements can sit on the same source line without
+forcing a line break between them.
+
+<<<
+
+var a int = 1; var b int = 2
+a = a + b; b = a - b
+a; b; c; d; e; f; g;
+;;;;0;;;;
+
+>>>
+
+(variable (declaration a (type name int) (initializer (expr 1))))
+(variable (declaration b (type name int) (initializer (expr 2))))
+(expr (binary = (expr (name a)) (expr (binary + (expr (name a)) (expr (name b))))))
+(expr (binary = (expr (name b)) (expr (binary - (expr (name a)) (expr (name b))))))
+(expr (name a))
+(expr (name b))
+(expr (name c))
+(expr (name d))
+(expr (name e))
+(expr (name f))
+(expr (name g))
+(expr 0)