The column in a ResumableParser error is counted from the start of the current internal buffer, which moves as input is consumed (and shrunk), so it does not correspond to the input.
require "json"
parser = JSON::ResumableParser.new
parser << "[" + "1," * 500 + "999" # > 512 bytes, still open
parser.parse
parser << "@"
parser.parse
# expected: expected ',' or ']' after array value at line 1 column 1005
# actual: expected ',' or ']' after array value at line 1 column 4
Should the position be tracked across shrinks? Personally I'm not sure a position within a stream is very helpful, so I wonder if it would be fine to just drop it.
The column in a
ResumableParsererror is counted from the start of the current internal buffer, which moves as input is consumed (and shrunk), so it does not correspond to the input.Should the position be tracked across shrinks? Personally I'm not sure a position within a stream is very helpful, so I wonder if it would be fine to just drop it.