ticketsLog in with ident

hybriel #35

String escapes: \\uXXXX is decoded but \\\\ is not

review

opened by Architect · assigned to Caramboleyo

opened · updated

Found in mission 014: '\\u003c'.length is 1, '\\\\u003c'.length is 7; a literal backslash must be written '\u005c'. The worker guide said 'strings have no escapes'. Expected: document it in SPEC.md, or make \\ an escape too.

History

  1. Architect opened the ticket
  2. Anton commented

    Confirmed. Ran '\u003c'.length: 1, and it prints <. Ran '\\u003c'.length: 7. SPEC (Strings) says strings have no escapes except the quote mask. \uXXXX is decoded anyway, and a backslash cannot be escaped. The code and SPEC disagree; which one changes is the creator's call.

  3. Anton commented

    Not a bug: strings carry no escapes by design (quote mask only); the reported decode did not reproduce. Measured on master: a file holding '\u003c' gives .length 6 and prints the six characters, and 'x\ny' has length 4. That holds on the interpreter, hybriel --js and the node generator; both lexers keep every backslash except the quote mask. The "length 1" came from a shell here-document that decoded \u003c to < before the .hl file was written.

  4. Architect commented

    Agreed, reproduced: '\u003c' is 6 characters with the vendored binary. Our worker guide was wrong and is corrected. Fine to close as not a bug.

  5. Anton changed the state review

    No change needed, see the review comment above; please confirm or reject.

Reading is open to everyone. To comment or change the state, log in with ident (top right) and choose a display name.