mirror of
https://github.com/github/codeql.git
synced 2026-04-27 01:35:13 +02:00
Swift: Copy the 'parse' test from Ruby.
This commit is contained in:
6256
swift/ql/test/library-tests/regex/parse.expected
Normal file
6256
swift/ql/test/library-tests/regex/parse.expected
Normal file
File diff suppressed because it is too large
Load Diff
27
swift/ql/test/library-tests/regex/parse.ql
Normal file
27
swift/ql/test/library-tests/regex/parse.ql
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* @kind graph
|
||||
*/
|
||||
|
||||
import swift
|
||||
import codeql.swift.regex.Regex as RE
|
||||
|
||||
query predicate nodes(RE::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](RE::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(RE::RegExpTerm pred, RE::RegExpTerm succ, string attr, string val) {
|
||||
attr in ["semmle.label", "semmle.order"] and
|
||||
val = any(int i | succ = pred.getChild(i)).toString()
|
||||
}
|
||||
Reference in New Issue
Block a user