Closed FiV0 closed 5 years ago
I have encountered this problem as well and have been thinking about solutions.
I don't think simply not consuming the whitespace is the right solution since that would make the behavior of eclector.parse-result:read
different from eclector.reader:read
.
A potential solution I have been experimenting with is calling eclector.reader:read-preserving-whitespace
instead of eclector.reader:read
from eclector.parse-result:read
. This could maybe be followed up by consuming any tailing whitespace. If this works, it would not consider the trailing whitespace in the source location but still skip it before returning to the caller.
When taking the README example with the following input:
the source-location of the 1 is considered to be the range (0 . 2) where I think it should be (0 . 1). I think removing this when might fix the issue, but I am not sure it serves another purpose.