process template lines when Lexer is created not when parsing each token. (#230)

This commit is contained in:
Ilya Puchka
2018-09-10 11:39:19 +01:00
committed by GitHub
parent 00e71c1b4d
commit acda1b0caf
7 changed files with 52 additions and 51 deletions

View File

@@ -125,9 +125,9 @@ public class TokenParser {
}
// find offset of filter in the containing token so that only filter is highligted, not the whole token
if let filterTokenRange = containingToken.contents.range(of: filterToken) {
var rangeLine = containingToken.sourceMap.line
rangeLine.offset += containingToken.contents.distance(from: containingToken.contents.startIndex, to: filterTokenRange.lowerBound)
syntaxError.token = .variable(value: filterToken, at: SourceMap(filename: containingToken.sourceMap.filename, line: rangeLine))
var location = containingToken.sourceMap.location
location.lineOffset += containingToken.contents.distance(from: containingToken.contents.startIndex, to: filterTokenRange.lowerBound)
syntaxError.token = .variable(value: filterToken, at: SourceMap(filename: containingToken.sourceMap.filename, location: location))
} else {
syntaxError.token = containingToken
}