unisonweb-org icon indicating copy to clipboard operation
unisonweb-org copied to clipboard

The description of Escape Sequences in the reference is missing a bunch

Open pragdave opened this issue 2 years ago • 2 comments

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... :)

pragdave avatar Feb 26 '23 01:02 pragdave

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

pchiusano avatar Feb 27 '23 15:02 pchiusano

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?

pragdave avatar Mar 01 '23 01:03 pragdave