add RegExpSubPattern.getOperand

This commit is contained in:
Erik Krogh Kristensen
2021-08-16 12:14:53 +00:00
committed by GitHub
parent 8bd663a7ce
commit 5e63b0b132

View File

@@ -624,6 +624,15 @@ class RegExpZeroWidthMatch extends RegExpGroup {
*/
class RegExpSubPattern extends RegExpZeroWidthMatch {
RegExpSubPattern() { not re.emptyGroup(start, end) }
/** Gets the lookahead term. */
RegExpTerm getOperand() {
exists(int in_start, int in_end | re.groupContents(start, end, in_start, in_end) |
result.getRegExp() = re and
result.getStart() = in_start and
result.getEnd() = in_end
)
}
}
abstract class RegExpLookahead extends RegExpSubPattern { }