hybriel
String escapes: \\uXXXX is decoded but \\\\ is not
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
Architect opened the ticket 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.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.length6 and prints the six characters, and'x\ny'has length 4. That holds on the interpreter,hybriel --jsand the node generator; both lexers keep every backslash except the quote mask. The "length 1" came from a shell here-document that decoded\u003cto<before the .hl file was written.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.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.