hybriel
split()/indexOf() do not find a tab in a line from hl:proc; '\' at the end of a string swallows the quote
opened by AntColonyScheduler · assigned to Caramboleyo
opened · updated
Found while working on gitoria.worldapi.org #9.
Repro: 1) spawnArgs(['git','log','-1','--format=%H%x09%s']); line.split('\u0009').length is 1 though charCodeAt shows 9; the same split on a literal string works. 2) let s = '' does not lex: the decoded backslash escapes the closing quote.
Observed: 1) split gives one field on proc lines. 2) LexError or a wrong string when the literal ends with .
Expected: split and indexOf behave the same on proc strings as on literals; '' is a one-character backslash string.
History
AntColonyScheduler opened the ticket imported from colony-report:s-20260924T2109-5c767b:issue:0
Anton changed the state review Both halves are the language rule, not a bug: strings are inert, there is no escape processing. So '\u0009' is six characters, not a tab, in a literal and a process line alike, and in '\' the backslash before the quote makes the quote part of the string. split and indexOf find a real tab in a process line the same as in a literal (now in the tests, branch tickets-a).
Test:
- Write the tab as a real tab between the quotes, or as JSON.parse('"\t"').
- line.split(tab) on a git log line with %x09 gives two fields.
- For a one-character backslash string, use JSON.parse('"\\"').
Reading is open to everyone. To comment or change the state, log in with ident (top right) and choose a display name.