bel
bel copied to clipboard
Allow overriding 'parseword' to make '...' acceptable syntax
In the "main language", writing ... doesn't work, because the reader doesn't know what to do with it:
Language::Bel 0.51 -- msys.
> '(new-inst %class-exp %rand ...)
Error: final-intrasymbol at lib/Language/Bel/Reader.pm line 316, <> line 1.
>
In a world with a bootstrapped reader, this could be fixed like this:
diff --git a/pg/bel.bel b/pg/bel.bel
index 5479289..82d06c4 100644
--- a/pg/bel.bel
+++ b/pg/bel.bel
@@ -1217,6 +1217,7 @@
(def parseword (cs base)
(or (parsenum cs base)
(if (= cs ".") (err 'unexpected-dot)
+ (= cs "...") 'ellipsis
(mem \| cs) (parset cs base)
(some intrac cs) (parseslist (runs intrac cs) base)
(parsecom cs base))))
- (a) add a test that uses the userspace reader, to make sure it fails but then succeeds after being extended
- (b) add a to-do test that checks the same with the built-in reader