reader: one-char literals for non-symbol chars (\{ \( \, \%)

read-char read the char name with symbol-char?, so a literal whose char isn't a
symbol char (\{, \(, \), \,, \%, …) came back as an empty name and errored
'Unsupported character'. Now a single non-symbol char after \ is taken as a
one-character literal of that char. Surfaced by funcool/cuerdas (uses \{), which
now loads. Spec cases added.
This commit is contained in:
Yogthos 2026-06-06 00:10:17 -04:00
parent b3a145f124
commit d724aa7069
3 changed files with 18 additions and 5 deletions

View file

@ -12,6 +12,12 @@
["namespaced keyword" "true" "(= :a/b :a/b)"]
["char" "\\a" "\\a"]
["char newline" "true" "(= \\newline (first \"\\n\"))"]
# single non-symbol chars are one-char literals (\{ \( \, \% etc.)
["char open-brace" "123" "(int \\{)"]
["char open-paren" "40" "(int \\()"]
["char comma" "44" "(int \\,)"]
["char percent" "37" "(int \\%)"]
["char unicode" "65" "(int \\u0041)"]
["hex literal" "255" "0xff"]
["hex uppercase" "31" "0X1F"]
["bigint suffix N" "42" "42N"]