-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathregex.qll
More file actions
21 lines (19 loc) · 858 Bytes
/
regex.qll
File metadata and controls
21 lines (19 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import python
// Need to import since frameworks can extend the abstract `RegExpInterpretation::Range`
private import semmle.python.Frameworks
private import regexp.internal.RegExpTracking as RegExpTracking
private import semmle.python.Concepts as Concepts
private import semmle.python.regexp.RegexTreeView
private import semmle.python.dataflow.new.DataFlow
import regexp.internal.ParseRegExp
/** Gets a parsed regular expression term that is executed at `exec`. */
RegExpTerm getTermForExecution(Concepts::RegexExecution exec) {
exists(DataFlow::Node source | source = RegExpTracking::regExpSource(exec.getRegex()) |
result.getRegex() = source.asExpr() and
result.isRootTerm()
)
}
/** A StrConst used as a regular expression */
deprecated class RegexString extends Regex {
RegexString() { this = RegExpTracking::regExpSource(_).asExpr() }
}