Fix issue with named backrefs; add needed import

This commit is contained in:
Joe Farebrother
2022-05-04 15:39:51 +01:00
parent 2d82dfba38
commit c7d30087d1
3 changed files with 5 additions and 1 deletions

View File

@@ -258,6 +258,9 @@ class RegExpQuantifier extends RegExpTerm, TRegExpQuantifier {
result.occursInRegex(re, start, part_end)
}
/** Holds if this term may match zero times. */
predicate mayBeEmpty() { maybe_empty = true }
/** Holds if this term may match an unlimited number of times. */
predicate mayRepeatForever() { may_repeat_forever = true }

View File

@@ -112,7 +112,7 @@ abstract class RegexString extends StringLiteral {
this.getChar(start + 1) = "k" and
this.getChar(start + 2) = "<" and
end = min(int i | i > start + 2 and this.getChar(i) = ">") + 1 and
name = this.getText().substring(start + 3, end - 2)
name = this.getText().substring(start + 3, end - 1)
}
private predicate numberedBackreference(int start, int end, int value) {

View File

@@ -4,6 +4,7 @@
*/
private import java
import semmle.code.FileSystem
import semmle.code.java.regex.RegexTreeView
/**