Python: fix computation at part boundaries

This commit is contained in:
Rasmus Lerchedahl Petersen 2023-09-26 20:51:15 +02:00
Родитель cdf1db09bd
Коммит f5059a6918
2 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -239,7 +239,7 @@ module Impl implements RegexTreeViewSig {
* `localOffset` will be the offset of this `RegExpTerm` inside `result`. * `localOffset` will be the offset of this `RegExpTerm` inside `result`.
*/ */
StringPart getPart(int localOffset) { StringPart getPart(int localOffset) {
exists(int index, int prefixLength | index = max(int i | this.getPartOffset(i) < start) | exists(int index, int prefixLength | index = max(int i | this.getPartOffset(i) <= start) |
result = re.(StrConst).getImplicitlyConcatenatedPart(index) and result = re.(StrConst).getImplicitlyConcatenatedPart(index) and
result.contextSize(prefixLength, _) and result.contextSize(prefixLength, _) and
// Example: // Example:

Просмотреть файл

@ -55,7 +55,7 @@ re.compile( # $ location=1:2 location=1:26
) )
# plain string with multiple parts across lines # plain string with multiple parts across lines
re.compile( # $ location=1:2 location=2:7 SPURIOUS:location=2:29 MISSING:location=3:2 re.compile( # $ location=1:2 location=2:7 location=3:2
'[this] is a test' '[this] is a test'
' and [this] is another test' ' and [this] is another test'
'[this] comes right at the start of a part' '[this] comes right at the start of a part'