Skip to content

Commit 5e63b0b

Browse files
authored
add RegExpSubPattern.getOperand
1 parent 8bd663a commit 5e63b0b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ql/src/codeql_ruby/regexp/RegExpTreeView.qll

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,15 @@ class RegExpZeroWidthMatch extends RegExpGroup {
624624
*/
625625
class RegExpSubPattern extends RegExpZeroWidthMatch {
626626
RegExpSubPattern() { not re.emptyGroup(start, end) }
627+
628+
/** Gets the lookahead term. */
629+
RegExpTerm getOperand() {
630+
exists(int in_start, int in_end | re.groupContents(start, end, in_start, in_end) |
631+
result.getRegExp() = re and
632+
result.getStart() = in_start and
633+
result.getEnd() = in_end
634+
)
635+
}
627636
}
628637

629638
abstract class RegExpLookahead extends RegExpSubPattern { }

0 commit comments

Comments
 (0)