Skip to content

Commit a0b784e

Browse files
committed
Python: QLDoc.
1 parent aaf9907 commit a0b784e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

python/ql/lib/semmle/python/regexp/internal/ParseRegExp.qll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,13 +679,23 @@ class RegExp extends Expr instanceof StrConst {
679679
end = min(int i | i > start + 4 and this.getChar(i) = "?")
680680
}
681681

682+
/**
683+
* Holds if a parse mode starts between `start` and `end`.
684+
*/
682685
private predicate flag_group_start(int start, int end) {
683686
this.isGroupStart(start) and
684687
this.getChar(start + 1) = "?" and
685688
this.getChar(start + 2) in ["i", "L", "m", "s", "u", "x"] and
686689
end = start + 2
687690
}
688691

692+
/**
693+
* Holds if a parse mode group is between `start` and `end`, and includes the
694+
* mode flag `c`. For example the following span, with mode flag `i`:
695+
* ```
696+
* (?i)
697+
* ```
698+
*/
689699
private predicate flag_group(int start, int end, string c) {
690700
exists(int inStart, int inEnd |
691701
this.flag_group_start(start, inStart) and

0 commit comments

Comments
 (0)