From:  Brian Slesinsky <skybrian@google.com>
Date:  25 Jan 2014 04:18:33 Hong Kong Time
Newsgroup:  news.mozilla.org/mozilla.dev.js-sourcemap
Subject:  

Re: Segment ending column confusion

NNTP-Posting-Host:  63.245.216.66

No, it really does extend to the end of the line.

It can be a bit inconvenient if you're representing a range as a pair of
(line, column) positions. I found it easier to use the first column of the
next line as the ending position. (That is, include the newline character
in the range and consider the range to stop just before the second position
in the pair). The spec doesn't explicitly say whether the newline is
included, but it doesn't seem to matter in practice.

If you want to convert (line, column) pairs to byte offsets or determine
the length of a range, you're going to need the JavaScript source code to
get the line endings.

- Brian



On Fri, Jan 24, 2014 at 11:32 AM, Simon Lydell wrote:

> According to a comment in the source map spec by John Lenz (Oct 19,
> 2012), “the ending column is the start of the next segment **or the end
> of the line**” (emphasis mine). However, a source map can’t know where
> line endings are, can it? So shouldn’t that be "the ending column is the
> start of the next segment (or the end of the file)"?
>
> _______________________________________________
> dev-js-sourcemap mailing list
> dev-js-sourcemap@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-js-sourcemap
>