unisonweb-org
unisonweb-org copied to clipboard
The description of Escape Sequences in the reference is missing a bunch
The current list contains the single-character C escapes (\b, \r, \n etc). It's missing
- two character specials: \LF, \CR, \FF, \VT, \SP, \BS, \HT
- decimal escapes: \ddd
- hex escapes: \xdd
- octal escapes: \oddd
(Guess who's writing a SkyLighting syntax for Unison... :)
Actually, I just checked the lexer, and it only supports -
escapeChars :: [(Char, Char)]
escapeChars =
[ ('0', '\0'),
('a', '\a'),
('b', '\b'),
('f', '\f'),
('n', '\n'),
('r', '\r'),
('t', '\t'),
('v', '\v'),
('s', ' '),
('\'', '\''),
('"', '"'),
('\\', '\\')
]
So I believe the docs are correct as is.
No objections to adding other standard escape syntaxes though! Could be done in Lexer.hs
Except they seem to work?
> "<a\SPb\x66\HT\o143\CR\LF\100>"
reports
1 | > "<a\SPb\x66\HT\o143\CR\LF\100>"
⧩
"<a bf\tc\r\nd>"
Or is this ucm accidentally using Haskell string parsing?