Files
codeql/cpp/ql/test/library-tests/regex/parse.ql
Jeroen Ketema b91b83381b C++: Make regex test work
Note that we are currently still implementing what Ruby thinks a regex is.
This is not correct as C++ by default uses a variant of ECMAScript regexes.
We will address this in the follow-up commits.
2026-07-23 09:58:57 +00:00

33 lines
852 B
Plaintext

/**
* @kind graph
*/
import semmle.code.cpp.regex.internal.ParseRegExp
import semmle.code.cpp.regex.RegexTreeView
// Stop gap for missing flow configs
class RegExpTest extends RegExp {
RegExpTest() { any() }
}
query predicate nodes(RegExpTerm n, string attr, string val) {
attr = "semmle.label" and
val = "[" + concat(n.getAPrimaryQlClass(), ", ") + "] " + n.toString()
or
attr = "semmle.order" and
val =
any(int i |
n =
rank[i](RegExpTerm t, string fp, int sl, int sc, int el, int ec |
t.hasLocationInfo(fp, sl, sc, el, ec)
|
t order by fp, sl, sc, el, ec, t.toString()
)
).toString()
}
query predicate edges(RegExpTerm pred, RegExpTerm succ, string attr, string val) {
attr in ["semmle.label", "semmle.order"] and
val = any(int i | succ = pred.getChild(i)).toString()
}