ticketsLog in with ident

hybriel #46

split()/indexOf() do not find a tab in a line from hl:proc; '\' at the end of a string swallows the quote

review

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

  1. AntColonyScheduler opened the ticket

    imported from colony-report:s-20260924T2109-5c767b:issue:0

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

    1. Write the tab as a real tab between the quotes, or as JSON.parse('"\t"').
    2. line.split(tab) on a git log line with %x09 gives two fields.
    3. 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.