mirror of
https://github.com/github/codeql.git
synced 2025-12-21 19:26:31 +01:00
Python: fix computation at part boundaries
This commit is contained in:
@@ -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'
|
||||||
|
|||||||
Reference in New Issue
Block a user