fix ql-for-ql errors inside ql-for-ql

This commit is contained in:
Erik Krogh Kristensen
2022-02-24 14:41:27 +01:00
parent 83aaeca751
commit ea1503ce2c
3 changed files with 13 additions and 10 deletions

View File

@@ -415,7 +415,7 @@ class ClasslessPredicate extends TClasslessPredicate, Predicate, ModuleDeclarati
ClasslessPredicate() { this = TClasslessPredicate(pred) }
/**
* If this predicate is an alias, gets the aliased value.
* Gets the aliased value if this predicate is an alias
* E.g. for `predicate foo = Module::bar/2;` gets `Module::bar/2`.
* The result is either a `PredicateExpr` or `HigherOrderFormula`.
*/
@@ -1672,7 +1672,7 @@ class Rank extends Aggregate {
override string getAPrimaryQlClass() { result = "Rank" }
/**
* The `i` in `rank[i]( | | )`.
* Gets the `i` in `rank[i]( | | )`.
*/
Expr getRankExpr() { toQL(result) = this.getAggregate().getChild(1) }

View File

@@ -13,7 +13,7 @@ import codeql_ql.printAstAst
import codeql.IDEContextual
/**
* The source file to generate an AST from.
* Gets the source file to generate an AST from.
*/
external string selectedSourceFile();

View File

@@ -13,13 +13,16 @@ import ql
* Gets a regular expression pattern that matches the syntax of likely regular expressions.
*/
private string getALikelyRegExpPattern() {
result = "/.*/[gimuy]{1,5}" or // pattern with at least one flag: /foo/i
result = "/\\^.*/[gimuy]{0,5}" or // pattern with anchor: /^foo/
result = "/.*\\$/[gimuy]{0,5}" or // pattern with anchor: /foo$/
result = "\\^.*\\$" or // pattern body with anchors: ^foo$
result = ".*(?<!\\\\)\\\\[dDwWsSB].*" or // contains a builtin character class: \s
result = ".*(?<!\\\\)\\\\[\\[\\]()*+?{}|^$.].*" or // contains an escaped meta-character: \(
result = ".*\\[\\^?[\\p{Alnum}\\p{Blank}_-]+\\][*+].*" // contains a quantified custom character class: [^a-zA-Z123]+
result =
[
"/.*/[gimuy]{1,5}", // pattern with at least one flag: /foo/i
"/\\^.*/[gimuy]{0,5}", // pattern with anchor: /^foo/
"/.*\\$/[gimuy]{0,5}", // pattern with anchor: /foo$/
"\\^.*\\$", // pattern body with anchors: ^foo$
".*(?<!\\\\)\\\\[dDwWsSB].*", // contains a builtin character class: \s
".*(?<!\\\\)\\\\[\\[\\]()*+?{}|^$.].*", // contains an escaped meta-character: \(
".*\\[\\^?[\\p{Alnum}\\p{Blank}_-]+\\][*+].*" // contains a quantified custom character class: [^a-zA-Z123]+
]
}
predicate isMatchesCall(MemberCall c) { c.getMemberName() = "matches" }