add reader syntax for []

Now [...] reads to (¤ ...) for easy semantic processing
This commit is contained in:
2025-10-21 21:22:22 +03:00
committed by Pavel Kulyov
parent 036f82facf
commit 45d9199c27
4 changed files with 73 additions and 4 deletions

28
tests/reader.scm Normal file
View File

@@ -0,0 +1,28 @@
(import (chicken port))
(test-group "reader"
;; []-syntax. For array types and array access expressions
(test '((¤ * char))
(with-input-from-string "[* char]"
(lambda ()
(read-raw-forms 'stdin))))
(test '((¤ * * char const 512))
(with-input-from-string "[* * char const 512]"
(lambda ()
(read-raw-forms 'stdin))))
(test '((¤))
(with-input-from-string "[]"
(lambda ()
(read-raw-forms 'stdin))))
(test '((¤ (¤)))
(with-input-from-string "[[]]"
(lambda ()
(read-raw-forms 'stdin))))
(test '((¤ (¤ const char)))
(with-input-from-string "[[const char]]"
(lambda ()
(read-raw-forms 'stdin)))))