You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
unexpected behaviour, with delim=' ' (and wh1 changed, since its required):
julia> res = Parsers.xparse(String, str; openquotechar='{', closequotechar='}', stripquoted=true, delim='', wh1=0x00)
Parsers.Result{PosLen}(37, 13, PosLen(0x000000000020000b))
julia> Parsers.getstring(str, res.val, 0x22) # has trailing whitespace"hey, there "
The trailing whitespace in the quoted string isn't striped in the second case, because we explicitly set wh1 to a value that wasn't ' ' due to ' ' being the delimiter... but there's no way to tell Parsers "inside quotes treat ' ' as whitespace not the delimiter, just like you treat ',' as a regular character inside quotes even when comma is the delimiter"
One way to fix this would be to hardcode certain characters as always being whitespace when quoted e.g.
- if options.stripquoted && b != options.wh1 && b != options.wh2+ if options.stripquoted && b != options.wh1 && b != options.wh2 && b != UInt8(' ') && b != UInt8('\t')
lastnonwhitespacepos = pos
end
where space is the delimiter, and values are padded to make them line up... with the "padding" occuring inside the quotes for quoted values, i.e. strings are quoted and padded with trailing whitespace to the size of the longest string, but we want to strip the padding when parsing.
expected behaviour, with
delim=','
(and defaultwh1, wh2
):unexpected behaviour, with
delim=' '
(andwh1
changed, since its required):The trailing whitespace in the quoted string isn't striped in the second case, because we explicitly set
wh1
to a value that wasn't' '
due to' '
being the delimiter... but there's no way to tell Parsers "inside quotes treat' '
as whitespace not the delimiter, just like you treat','
as a regular character inside quotes even when comma is the delimiter"One way to fix this would be to hardcode certain characters as always being whitespace when quoted e.g.
Parsers.jl/src/strings.jl
Lines 100 to 102 in 462fb55
The text was updated successfully, but these errors were encountered: