read -NAME as the negation of NAME

The reader took -INFINITY as one symbol, and the leading dash was then
mangled like any other: _INFINITY. -1 was always a number, so a name
gets the same reading.

Fixes #63.
This commit is contained in:
2026-10-09 16:05:03 +03:00
parent ab4fdc54f3
commit cc0f7f91ec
3 changed files with 20 additions and 0 deletions

View File

@@ -735,6 +735,8 @@ compiles."
(test-assert "an expression is walked and parenthesised"
(emits? "(define K (/ (cast 255 float) (cast 60 float)))"
"#define K ((float)255 / (float)60)"))
(test-assert "and a negated name"
(emits? "(define LOWEST -INFINITY)" "#define LOWEST (-INFINITY)"))
(test-assert "so is a negative literal"
(emits? "(define NEG -1)" "#define NEG (-1)"))
(test-assert "a function-like one is converted too"