use exclusive ranges
This commit is contained in:
parent
b2669abecc
commit
6ce1d36acd
|
@ -1304,7 +1304,7 @@
|
|||
}
|
||||
|
||||
makeLocationData({offsetInChunk, length}) {
|
||||
var lastCharacter, locationData;
|
||||
var endOffset, lastCharacter, locationData;
|
||||
locationData = {
|
||||
range: []
|
||||
};
|
||||
|
@ -1312,7 +1312,8 @@
|
|||
// Use length - 1 for the final offset - we’re supplying the last_line and the last_column,
|
||||
// so if last_column == first_column, then we’re looking at a character of length 1.
|
||||
lastCharacter = length > 0 ? length - 1 : 0;
|
||||
[locationData.last_line, locationData.last_column, locationData.range[1]] = this.getLineAndColumnFromChunk(offsetInChunk + lastCharacter);
|
||||
[locationData.last_line, locationData.last_column, endOffset] = this.getLineAndColumnFromChunk(offsetInChunk + lastCharacter);
|
||||
locationData.range[1] = endOffset + 1;
|
||||
return locationData;
|
||||
}
|
||||
|
||||
|
|
|
@ -936,8 +936,9 @@ exports.Lexer = class Lexer
|
|||
# Use length - 1 for the final offset - we’re supplying the last_line and the last_column,
|
||||
# so if last_column == first_column, then we’re looking at a character of length 1.
|
||||
lastCharacter = if length > 0 then (length - 1) else 0
|
||||
[locationData.last_line, locationData.last_column, locationData.range[1]] =
|
||||
[locationData.last_line, locationData.last_column, endOffset] =
|
||||
@getLineAndColumnFromChunk offsetInChunk + lastCharacter
|
||||
locationData.range[1] = endOffset + 1
|
||||
|
||||
locationData
|
||||
|
||||
|
|
Loading…
Reference in New Issue