initial support for CodeQL

This commit is contained in:
Alvaro Muñoz 2020-09-30 00:30:26 +02:00 committed by Stephan Seitz
parent b66b533ecd
commit 3dc2e9331e
3 changed files with 137 additions and 0 deletions

View file

@ -261,6 +261,14 @@ list.fennel = {
maintainers = {'@TravonteD'},
}
list.ql = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-ql",
files = { "src/parser.c" },
},
maintainers = {'@pwntester'},
}
-- Parsers for injections
list.regex = {
install_info = {

103
queries/ql/highlights.scm Normal file
View file

@ -0,0 +1,103 @@
[
"and"
"any"
"as"
"asc"
"avg"
"by"
"class"
"concat"
"count"
"desc"
"else"
"exists"
"extends"
"forall"
"forex"
"from"
"if"
"implies"
"import"
"in"
"instanceof"
"max"
"min"
"module"
"newtype"
"not"
"or"
"order"
"rank"
"select"
"strictconcat"
"strictcount"
"strictsum"
"sum"
"then"
"where"
(false)
(predicate)
(result)
(specialId)
(super)
(this)
(true)
] @keyword
[
"boolean"
"float"
"int"
"date"
"string"
] @type.builtin
(annotName) @attribute
[
"<"
"<="
"="
">"
">="
"-"
"!="
"/"
"*"
"%"
"+"
"::"
] @operator
[
"("
")"
"{"
"}"
"["
"]"
] @punctuation.bracket
[
","
"|"
] @punctuation.delimiter
(className) @type
(varName) @variable
(integer) @number
(float) @number
(string) @string
(aritylessPredicateExpr (literalId) @function)
(predicateName) @function
[
(line_comment)
(block_comment)
(qldoc)
] @comment

26
queries/ql/locals.scm Normal file
View file

@ -0,0 +1,26 @@
(classlessPredicate
name: (predicateName) @name) @definition.function
(memberPredicate
name: (predicateName) @name) @definition.method
(aritylessPredicateExpr
name: (literalId) @name) @reference.call
(module
name: (moduleName) @name) @definition.module
(dataclass
name: (className) @name) @definition.class
(datatype
name: (className) @name) @definition.class
(datatypeBranch
name: (className) @name) @definition.class
(qualifiedRhs
name: (predicateName) @name) @reference.call
(typeExpr
name: (className) @name) @reference.type