From 45a9d5bc7d834fe1026e227101971bfc8791c02b Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Thu, 20 Jul 2023 11:53:52 +0100 Subject: [PATCH] Java: QLDoc. --- java/ql/lib/semmle/code/java/regex/regex.qll | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/java/ql/lib/semmle/code/java/regex/regex.qll b/java/ql/lib/semmle/code/java/regex/regex.qll index 7c24892ff2e..1533f549f89 100644 --- a/java/ql/lib/semmle/code/java/regex/regex.qll +++ b/java/ql/lib/semmle/code/java/regex/regex.qll @@ -472,6 +472,9 @@ abstract class RegexString extends StringLiteral { ) } + /** + * Holds if a parse mode starts between `start` and `end`. + */ private predicate flagGroupStart(int start, int end) { this.isGroupStart(start) and this.getChar(start + 1) = "?" and @@ -479,6 +482,13 @@ abstract class RegexString extends StringLiteral { end = start + 2 } + /** + * Holds if a parse mode group is between `start` and `end`, and includes the + * mode flag `c`. For example the following span, with mode flag `i`: + * ``` + * (?i) + * ``` + */ private predicate flagGroup(int start, int end, string c) { exists(int inStart, int inEnd | this.flagGroupStart(start, inStart) and