rename hasChildThatMatchesIgnoringCasing to hasChildThatMatchesIgnoringCasingFlags

This commit is contained in:
Erik Krogh Kristensen
2021-09-01 12:45:20 +02:00
parent 75a3f34e86
commit ff74fe1e03

View File

@@ -186,12 +186,7 @@ private predicate isCanonicalTerm(RelevantRegExpTerm term, string str) {
*/
string getCanonicalizationFlags(RegExpTerm root) {
root.isRootTerm() and
(
if RegExpFlags::isIgnoreCase(root) then
result = "i"
else
result = ""
)
(if RegExpFlags::isIgnoreCase(root) then result = "i" else result = "")
}
/**
@@ -324,16 +319,16 @@ private module CharacterClasses {
if RegExpFlags::isIgnoreCase(cc.getRootTerm())
then
// normalize everything to lower case if the regexp is case insensitive
exists(string c | hasChildThatMatchesIgnoringCasing(cc, c) | char = c.toLowerCase())
else hasChildThatMatchesIgnoringCasing(cc, char)
exists(string c | hasChildThatMatchesIgnoringCasingFlags(cc, c) | char = c.toLowerCase())
else hasChildThatMatchesIgnoringCasingFlags(cc, char)
}
/**
* Holds if the character class `cc` has a child (constant or range) that matches `char`.
* Ignores whether the character class is inside a regular expression that ignores casing.
* Ignores whether the character class is inside a regular expression that has the ignore case flag.
*/
pragma[noinline]
predicate hasChildThatMatchesIgnoringCasing(RegExpCharacterClass cc, string char) {
predicate hasChildThatMatchesIgnoringCasingFlags(RegExpCharacterClass cc, string char) {
exists(getCanonicalCharClass(cc)) and
exists(RegExpTerm child | child = cc.getAChild() |
char = child.(RegexpCharacterConstant).getValue()