aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-04-09 08:42:49 +0000
committerBlaž Hrastnik2021-04-09 09:57:46 +0000
commit4e31d1521bf9bb59f6485954d4ada16bf853c85a (patch)
treed8d05c9303701590dee6351eea693887dbab3981 /runtime
parentc1e5733b02e4ba39b82d7b330fab0b2ded2220f2 (diff)
Add tree-sitter queries.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/queries/bash/highlights.scm54
-rw-r--r--runtime/queries/css/highlights.scm64
-rw-r--r--runtime/queries/go/highlights.scm117
-rw-r--r--runtime/queries/go/tags.scm30
-rw-r--r--runtime/queries/html/highlights.scm12
-rw-r--r--runtime/queries/html/injections.scm7
-rw-r--r--runtime/queries/javascript/highlights-jsx.scm4
-rw-r--r--runtime/queries/javascript/highlights-params.scm12
-rw-r--r--runtime/queries/javascript/highlights.scm205
-rw-r--r--runtime/queries/javascript/injections.scm20
-rw-r--r--runtime/queries/javascript/locals.scm23
-rw-r--r--runtime/queries/javascript/tags.scm88
-rw-r--r--runtime/queries/json/highlights.scm9
-rw-r--r--runtime/queries/php/highlights.scm114
-rw-r--r--runtime/queries/php/injections.scm3
-rw-r--r--runtime/queries/php/tags.scm26
-rw-r--r--runtime/queries/python/highlights.scm124
-rw-r--r--runtime/queries/python/tags.scm12
-rw-r--r--runtime/queries/ruby/highlights.scm146
-rw-r--r--runtime/queries/ruby/locals.scm27
-rw-r--r--runtime/queries/ruby/tags.scm64
-rw-r--r--runtime/queries/toml/highlights.scm33
22 files changed, 1194 insertions, 0 deletions
diff --git a/runtime/queries/bash/highlights.scm b/runtime/queries/bash/highlights.scm
new file mode 100644
index 00000000..754faeda
--- /dev/null
+++ b/runtime/queries/bash/highlights.scm
@@ -0,0 +1,54 @@
+[
+ (string)
+ (raw_string)
+ (heredoc_body)
+ (heredoc_start)
+] @string
+
+(command_name) @function
+
+(variable_name) @property
+
+[
+ "case"
+ "do"
+ "done"
+ "elif"
+ "else"
+ "esac"
+ "export"
+ "fi"
+ "for"
+ "function"
+ "if"
+ "in"
+ "unset"
+ "while"
+ "then"
+] @keyword
+
+(comment) @comment
+
+(function_definition name: (word) @function)
+
+(file_descriptor) @number
+
+[
+ (command_substitution)
+ (process_substitution)
+ (expansion)
+]@embedded
+
+[
+ "$"
+ "&&"
+ ">"
+ ">>"
+ "<"
+ "|"
+] @operator
+
+(
+ (command (_) @constant)
+ (#match? @constant "^-")
+)
diff --git a/runtime/queries/css/highlights.scm b/runtime/queries/css/highlights.scm
new file mode 100644
index 00000000..763661af
--- /dev/null
+++ b/runtime/queries/css/highlights.scm
@@ -0,0 +1,64 @@
+(comment) @comment
+
+(tag_name) @tag
+(nesting_selector) @tag
+(universal_selector) @tag
+
+"~" @operator
+">" @operator
+"+" @operator
+"-" @operator
+"*" @operator
+"/" @operator
+"=" @operator
+"^=" @operator
+"|=" @operator
+"~=" @operator
+"$=" @operator
+"*=" @operator
+
+"and" @operator
+"or" @operator
+"not" @operator
+"only" @operator
+
+(attribute_selector (plain_value) @string)
+(pseudo_element_selector (tag_name) @attribute)
+(pseudo_class_selector (class_name) @attribute)
+
+(class_name) @property
+(id_name) @property
+(namespace_name) @property
+(property_name) @property
+(feature_name) @property
+
+(attribute_name) @attribute
+
+(function_name) @function
+
+((property_name) @variable
+ (#match? @variable "^--"))
+((plain_value) @variable
+ (#match? @variable "^--"))
+
+"@media" @keyword
+"@import" @keyword
+"@charset" @keyword
+"@namespace" @keyword
+"@supports" @keyword
+"@keyframes" @keyword
+(at_keyword) @keyword
+(to) @keyword
+(from) @keyword
+(important) @keyword
+
+(string_value) @string
+(color_value) @string.special
+
+(integer_value) @number
+(float_value) @number
+(unit) @type
+
+"#" @punctuation.delimiter
+"," @punctuation.delimiter
+":" @punctuation.delimiter
diff --git a/runtime/queries/go/highlights.scm b/runtime/queries/go/highlights.scm
new file mode 100644
index 00000000..224c8b78
--- /dev/null
+++ b/runtime/queries/go/highlights.scm
@@ -0,0 +1,117 @@
+; Function calls
+
+(call_expression
+ function: (identifier) @function)
+
+(call_expression
+ function: (selector_expression
+ field: (field_identifier) @function.method))
+
+; Function definitions
+
+(function_declaration
+ name: (identifier) @function)
+
+(method_declaration
+ name: (field_identifier) @function.method)
+
+; Identifiers
+
+(type_identifier) @type
+(field_identifier) @property
+(identifier) @variable
+
+; Operators
+
+[
+ "--"
+ "-"
+ "-="
+ ":="
+ "!"
+ "!="
+ "..."
+ "*"
+ "*"
+ "*="
+ "/"
+ "/="
+ "&"
+ "&&"
+ "&="
+ "%"
+ "%="
+ "^"
+ "^="
+ "+"
+ "++"
+ "+="
+ "<-"
+ "<"
+ "<<"
+ "<<="
+ "<="
+ "="
+ "=="
+ ">"
+ ">="
+ ">>"
+ ">>="
+ "|"
+ "|="
+ "||"
+] @operator
+
+; Keywords
+
+[
+ "break"
+ "case"
+ "chan"
+ "const"
+ "continue"
+ "default"
+ "defer"
+ "else"
+ "fallthrough"
+ "for"
+ "func"
+ "go"
+ "goto"
+ "if"
+ "import"
+ "interface"
+ "map"
+ "package"
+ "range"
+ "return"
+ "select"
+ "struct"
+ "switch"
+ "type"
+ "var"
+] @keyword
+
+; Literals
+
+[
+ (interpreted_string_literal)
+ (raw_string_literal)
+ (rune_literal)
+] @string
+
+(escape_sequence) @escape
+
+[
+ (int_literal)
+ (float_literal)
+ (imaginary_literal)
+] @number
+
+[
+ (true)
+ (false)
+ (nil)
+] @constant.builtin
+
+(comment) @comment
diff --git a/runtime/queries/go/tags.scm b/runtime/queries/go/tags.scm
new file mode 100644
index 00000000..d87008ab
--- /dev/null
+++ b/runtime/queries/go/tags.scm
@@ -0,0 +1,30 @@
+(
+ (comment)* @doc
+ .
+ (function_declaration
+ name: (identifier) @name) @definition.function
+ (#strip! @doc "^//\\s*")
+ (#set-adjacent! @doc @definition.function)
+)
+
+(
+ (comment)* @doc
+ .
+ (method_declaration
+ name: (field_identifier) @name) @definition.method
+ (#strip! @doc "^//\\s*")
+ (#set-adjacent! @doc @definition.method)
+)
+
+(call_expression
+ function: [
+ (identifier) @name
+ (parenthesized_expression (identifier) @name)
+ (selector_expression field: (field_identifier) @name)
+ (parenthesized_expression (selector_expression field: (field_identifier) @name))
+ ]) @reference.call
+
+(type_spec
+ name: (type_identifier) @name) @definition.type
+
+(type_identifier) @name @reference.type
diff --git a/runtime/queries/html/highlights.scm b/runtime/queries/html/highlights.scm
new file mode 100644
index 00000000..2c70a9c3
--- /dev/null
+++ b/runtime/queries/html/highlights.scm
@@ -0,0 +1,12 @@
+(tag_name) @tag
+(erroneous_end_tag_name) @tag.error
+(doctype) @constant
+(attribute_name) @attribute
+(attribute_value) @string
+(comment) @comment
+
+[
+ "<"
+ ">"
+ "</"
+] @punctuation.bracket
diff --git a/runtime/queries/html/injections.scm b/runtime/queries/html/injections.scm
new file mode 100644
index 00000000..71e7c3ae
--- /dev/null
+++ b/runtime/queries/html/injections.scm
@@ -0,0 +1,7 @@
+((script_element
+ (raw_text) @injection.content)
+ (#set! injection.language "javascript"))
+
+((style_element
+ (raw_text) @injection.content)
+ (#set! injection.language "css"))
diff --git a/runtime/queries/javascript/highlights-jsx.scm b/runtime/queries/javascript/highlights-jsx.scm
new file mode 100644
index 00000000..751da081
--- /dev/null
+++ b/runtime/queries/javascript/highlights-jsx.scm
@@ -0,0 +1,4 @@
+(jsx_opening_element (identifier) @tag)
+(jsx_closing_element (identifier) @tag)
+(jsx_self_closing_element (identifier) @tag)
+(jsx_attribute (property_identifier) @attribute)
diff --git a/runtime/queries/javascript/highlights-params.scm b/runtime/queries/javascript/highlights-params.scm
new file mode 100644
index 00000000..95ffc724
--- /dev/null
+++ b/runtime/queries/javascript/highlights-params.scm
@@ -0,0 +1,12 @@
+(formal_parameters
+ [
+ (identifier) @variable.parameter
+ (array_pattern
+ (identifier) @variable.parameter)
+ (object_pattern
+ [
+ (pair_pattern value: (identifier) @variable.parameter)
+ (shorthand_property_identifier_pattern) @variable.parameter
+ ])
+ ]
+)
diff --git a/runtime/queries/javascript/highlights.scm b/runtime/queries/javascript/highlights.scm
new file mode 100644
index 00000000..a18c38d9
--- /dev/null
+++ b/runtime/queries/javascript/highlights.scm
@@ -0,0 +1,205 @@
+; Special identifiers
+;--------------------
+
+([
+ (identifier)
+ (shorthand_property_identifier)
+ (shorthand_property_identifier_pattern)
+ ] @constant
+ (#match? @constant "^[A-Z_][A-Z\\d_]+$"))
+
+
+((identifier) @constructor
+ (#match? @constructor "^[A-Z]"))
+
+((identifier) @variable.builtin
+ (#match? @variable.builtin "^(arguments|module|console|window|document)$")
+ (#is-not? local))
+
+((identifier) @function.builtin
+ (#eq? @function.builtin "require")
+ (#is-not? local))
+
+; Function and method definitions
+;--------------------------------
+
+(function
+ name: (identifier) @function)
+(function_declaration
+ name: (identifier) @function)
+(method_definition
+ name: (property_identifier) @function.method)
+
+(pair
+ key: (property_identifier) @function.method
+ value: [(function) (arrow_function)])
+
+(assignment_expression
+ left: (member_expression
+ property: (property_identifier) @function.method)
+ right: [(function) (arrow_function)])
+
+(variable_declarator
+ name: (identifier) @function
+ value: [(function) (arrow_function)])
+
+(assignment_expression
+ left: (identifier) @function
+ right: [(function) (arrow_function)])
+
+; Function and method calls
+;--------------------------
+
+(call_expression
+ function: (identifier) @function)
+
+(call_expression
+ function: (member_expression
+ property: (property_identifier) @function.method))
+
+; Variables
+;----------
+
+(identifier) @variable
+
+; Properties
+;-----------
+
+(property_identifier) @property
+
+; Literals
+;---------
+
+(this) @variable.builtin
+(super) @variable.builtin
+
+[
+ (true)
+ (false)
+ (null)
+ (undefined)
+] @constant.builtin
+
+(comment) @comment
+
+[
+ (string)
+ (template_string)
+] @string
+
+(regex) @string.special
+(number) @number
+
+; Tokens
+;-------
+
+(template_substitution
+ "${" @punctuation.special
+ "}" @punctuation.special) @embedded
+
+[
+ ";"
+ "?."
+ "."
+ ","
+] @punctuation.delimiter
+
+[
+ "-"
+ "--"
+ "-="
+ "+"
+ "++"
+ "+="
+ "*"
+ "*="
+ "**"
+ "**="
+ "/"
+ "/="
+ "%"
+ "%="
+ "<"
+ "<="
+ "<<"
+ "<<="
+ "="
+ "=="
+ "==="
+ "!"
+ "!="
+ "!=="
+ "=>"
+ ">"
+ ">="
+ ">>"
+ ">>="
+ ">>>"
+ ">>>="
+ "~"
+ "^"
+ "&"
+ "|"
+ "^="
+ "&="
+ "|="
+ "&&"
+ "||"
+ "??"
+ "&&="
+ "||="
+ "??="
+] @operator
+
+[
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+ "}"
+] @punctuation.bracket
+
+[
+ "as"
+ "async"
+ "await"
+ "break"
+ "case"
+ "catch"
+ "class"
+ "const"
+ "continue"
+ "debugger"
+ "default"
+ "delete"
+ "do"
+ "else"
+ "export"
+ "extends"
+ "finally"
+ "for"
+ "from"
+ "function"
+ "get"
+ "if"
+ "import"
+ "in"
+ "instanceof"
+ "let"
+ "new"
+ "of"
+ "return"
+ "set"
+ "static"
+ "switch"
+ "target"
+ "throw"
+ "try"
+ "typeof"
+ "var"
+ "void"
+ "while"
+ "with"
+ "yield"
+] @keyword
diff --git a/runtime/queries/javascript/injections.scm b/runtime/queries/javascript/injections.scm
new file mode 100644
index 00000000..5539241a
--- /dev/null
+++ b/runtime/queries/javascript/injections.scm
@@ -0,0 +1,20 @@
+; Parse the contents of tagged template literals using
+; a language inferred from the tag.
+
+(call_expression
+ function: [
+ (identifier) @injection.language
+ (member_expression
+ property: (property_identifier) @injection.language)
+ ]
+ arguments: (template_string) @injection.content)
+
+; Parse regex syntax within regex literals
+
+((regex_pattern) @injection.content
+ (#set! injection.language "regex"))
+
+ ; Parse JSDoc annotations in comments
+
+((comment) @injection.content
+ (#set! injection.language "jsdoc"))
diff --git a/runtime/queries/javascript/locals.scm b/runtime/queries/javascript/locals.scm
new file mode 100644
index 00000000..5d680acf
--- /dev/null
+++ b/runtime/queries/javascript/locals.scm
@@ -0,0 +1,23 @@
+; Scopes
+;-------
+
+[
+ (statement_block)
+ (function)
+ (arrow_function)
+ (function_declaration)
+ (method_definition)
+] @local.scope
+
+; Definitions
+;------------
+
+(pattern/identifier)@local.definition
+
+(variable_declarator
+ name: (identifier) @local.definition)
+
+; References
+;------------
+
+(identifier) @local.reference
diff --git a/runtime/queries/javascript/tags.scm b/runtime/queries/javascript/tags.scm
new file mode 100644
index 00000000..a7bbd311
--- /dev/null
+++ b/runtime/queries/javascript/tags.scm
@@ -0,0 +1,88 @@
+(
+ (comment)* @doc
+ .
+ (method_definition
+ name: (property_identifier) @name) @definition.method
+ (#not-eq? @name "constructor")
+ (#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
+ (#select-adjacent! @doc @definition.method)
+)
+
+(
+ (comment)* @doc
+ .
+ [
+ (class
+ name: (_) @name)
+ (class_declaration
+ name: (_) @name)
+ ] @definition.class
+ (#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
+ (#select-adjacent! @doc @definition.class)
+)
+
+(
+ (comment)* @doc
+ .
+ [
+ (function
+ name: (identifier) @name)
+ (function_declaration
+ name: (identifier) @name)
+ (generator_function
+ name: (identifier) @name)
+ (generator_function_declaration
+ name: (identifier) @name)
+ ] @definition.function
+ (#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
+ (#select-adjacent! @doc @definition.function)
+)
+
+(
+ (comment)* @doc
+ .
+ (lexical_declaration
+ (variable_declarator
+ name: (identifier) @name
+ value: [(arrow_function) (function)]) @definition.function)
+ (#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
+ (#select-adjacent! @doc @definition.function)
+)
+
+(
+ (comment)* @doc
+ .
+ (variable_declaration
+ (variable_declarator
+ name: (identifier) @name
+ value: [(arrow_function) (function)]) @definition.function)
+ (#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
+ (#select-adjacent! @doc @definition.function)
+)
+
+(assignment_expression
+ left: [
+ (identifier) @name
+ (member_expression
+ property: (property_identifier) @name)
+ ]
+ right: [(arrow_function) (function)]
+) @definition.function
+
+(pair
+ key: (property_identifier) @name
+ value: [(arrow_function) (function)]) @definition.function
+
+(
+ (call_expression
+ function: (identifier) @name) @reference.call
+ (#not-match? @name "^(require)$")
+)
+
+(call_expression
+ function: (member_expression
+ property: (property_identifier) @name)
+ arguments: (_) @reference.call)
+
+(new_expression
+ constructor: (_) @name) @reference.class
diff --git a/runtime/queries/json/highlights.scm b/runtime/queries/json/highlights.scm
new file mode 100644
index 00000000..b08ea439
--- /dev/null
+++ b/runtime/queries/json/highlights.scm
@@ -0,0 +1,9 @@
+(pair
+ key: (_) @keyword)
+
+(string) @string
+
+(object
+ "{" @escape
+ (_)
+ "}" @escape)
diff --git a/runtime/queries/php/highlights.scm b/runtime/queries/php/highlights.scm
new file mode 100644
index 00000000..83850403
--- /dev/null
+++ b/runtime/queries/php/highlights.scm
@@ -0,0 +1,114 @@
+(php_tag) @tag
+"?>" @tag
+
+; Types
+
+(primitive_type) @type.builtin
+(cast_type) @type.builtin
+(type_name (name) @type)
+
+; Functions
+
+(array_creation_expression "array" @function.builtin)
+(list_literal "list" @function.builtin)
+
+(method_declaration
+ name: (name) @function.method)
+
+(function_call_expression
+ function: (qualified_name (name)) @function)
+
+(scoped_call_expression
+ name: (name) @function)
+
+(member_call_expression
+ name: (name) @function.method)
+
+(function_definition
+ name: (name) @function)
+
+; Member
+
+(property_element
+ (variable_name) @property)
+
+(member_access_expression
+ name: (variable_name (name)) @property)
+(member_access_expression
+ name: (name) @property)
+
+; Variables
+
+(relative_scope) @variable.builtin
+
+((name) @constant
+ (#match? @constant "^_?[A-Z][A-Z\d_]+$"))
+
+((name) @constructor
+ (#match? @constructor "^[A-Z]"))
+
+((name) @variable.builtin
+ (#eq? @variable.builtin "this"))
+
+(variable_name) @variable
+
+; Basic tokens
+
+(string) @string
+(heredoc) @string
+(boolean) @constant.builtin
+(null) @constant.builtin
+(integer) @number
+(float) @number
+(comment) @comment
+
+"$" @operator
+
+; Keywords
+
+"abstract" @keyword
+"as" @keyword
+"break" @keyword
+"case" @keyword
+"catch" @keyword
+"class" @keyword
+"const" @keyword
+"continue" @keyword
+"declare" @keyword
+"default" @keyword
+"do" @keyword
+"echo" @keyword
+"else" @keyword
+"elseif" @keyword
+"enddeclare" @keyword
+"endforeach" @keyword
+"endif" @keyword
+"endswitch" @keyword
+"endwhile" @keyword
+"extends" @keyword
+"final" @keyword
+"finally" @keyword
+"foreach" @keyword
+"function" @keyword
+"global" @keyword
+"if" @keyword
+"implements" @keyword
+"include_once" @keyword
+"include" @keyword
+"insteadof" @keyword
+"interface" @keyword
+"namespace" @keyword
+"new" @keyword
+"private" @keyword
+"protected" @keyword
+"public" @keyword
+"require_once" @keyword
+"require" @keyword
+"return" @keyword
+"static" @keyword
+"switch" @keyword
+"throw" @keyword
+"trait" @keyword
+"try" @keyword
+"use" @keyword
+"while" @keyword
diff --git a/runtime/queries/php/injections.scm b/runtime/queries/php/injections.scm
new file mode 100644
index 00000000..16d5736b
--- /dev/null
+++ b/runtime/queries/php/injections.scm
@@ -0,0 +1,3 @@
+((text) @injection.content
+ (#set! injection.language "html")
+ (#set! injection.combined))
diff --git a/runtime/queries/php/tags.scm b/runtime/queries/php/tags.scm
new file mode 100644
index 00000000..ef889cee
--- /dev/null
+++ b/runtime/queries/php/tags.scm
@@ -0,0 +1,26 @@
+(class_declaration
+ name: (name) @name) @definition.class
+
+(function_definition
+ name: (name) @name) @definition.function
+
+(method_declaration
+ name: (name) @name) @definition.function
+
+(object_creation_expression
+ [
+ (qualified_name (name) @name)
+ (variable_name (name) @name)
+ ]) @reference.class
+
+(function_call_expression
+ function: [
+ (qualified_name (name) @name)
+ (variable_name (name)) @name
+ ]) @reference.call
+
+(scoped_call_expression
+ name: (name) @name) @reference.call
+
+(member_call_expression
+ name: (name) @name) @reference.call
diff --git a/runtime/queries/python/highlights.scm b/runtime/queries/python/highlights.scm
new file mode 100644
index 00000000..f64fecb2
--- /dev/null
+++ b/runtime/queries/python/highlights.scm
@@ -0,0 +1,124 @@
+; Identifier naming conventions
+
+((identifier) @constructor
+ (#match? @constructor "^[A-Z]"))
+
+((identifier) @constant
+ (#match? @constant "^[A-Z][A-Z_]*$"))
+
+; Builtin functions
+
+((call
+ function: (identifier) @function.builtin)
+ (#match?
+ @function.builtin
+ "^(abs|all|any|ascii|bin|bool|breakpoint|bytearray|bytes|callable|chr|classmethod|compile|complex|delattr|dict|dir|divmod|enumerate|eval|exec|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|isinstance|issubclass|iter|len|list|locals|map|max|memoryview|min|next|object|oct|open|ord|pow|print|property|range|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|vars|zip|__import__)$"))
+
+; Function calls
+
+(decorator) @function
+
+(call
+ function: (attribute attribute: (identifier) @function.method))
+(call
+ function: (identifier) @function)
+
+; Function definitions
+
+(function_definition
+ name: (identifier) @function)
+
+(identifier) @variable
+(attribute attribute: (identifier) @property)
+(type (identifier) @type)
+
+; Literals
+
+[
+ (none)
+ (true)
+ (false)
+] @constant.builtin
+
+[
+ (integer)
+ (float)
+] @number
+
+(comment) @comment
+(string) @string
+(escape_sequence) @escape
+
+(interpolation
+ "{" @punctuation.special
+ "}" @punctuation.special) @embedded
+
+[
+ "-"
+ "-="
+ "!="
+ "*"
+ "**"
+ "**="
+ "*="
+ "/"
+ "//"
+ "//="
+ "/="
+ "&"
+ "%"
+ "%="
+ "^"
+ "+"
+ "->"
+ "+="
+ "<"
+ "<<"
+ "<="
+ "<>"
+ "="
+ ":="
+ "=="
+ ">"
+ ">="
+ ">>"
+ "|"
+ "~"
+ "and"
+ "in"
+ "is"
+ "not"
+ "or"
+] @operator
+
+[
+ "as"
+ "assert"
+ "async"
+ "await"
+ "break"
+ "class"
+ "continue"
+ "def"
+ "del"
+ "elif"
+ "else"
+ "except"
+ "exec"
+ "finally"
+ "for"
+ "from"
+ "global"
+ "if"
+ "import"
+ "lambda"
+ "nonlocal"
+ "pass"
+ "print"
+ "raise"
+ "return"
+ "try"
+ "while"
+ "with"
+ "yield"
+] @keyword
diff --git a/runtime/queries/python/tags.scm b/runtime/queries/python/tags.scm
new file mode 100644
index 00000000..c5ca8272
--- /dev/null
+++ b/runtime/queries/python/tags.scm
@@ -0,0 +1,12 @@
+(class_definition
+ name: (identifier) @name) @definition.class
+
+(function_definition
+ name: (identifier) @name) @definition.function
+
+(call
+ function: [
+ (identifier) @name
+ (attribute
+ attribute: (identifier) @name)
+ ]) @reference.call
diff --git a/runtime/queries/ruby/highlights.scm b/runtime/queries/ruby/highlights.scm
new file mode 100644
index 00000000..7f296f3b
--- /dev/null
+++ b/runtime/queries/ruby/highlights.scm
@@ -0,0 +1,146 @@
+; Keywords
+
+[
+ "alias"
+ "and"
+ "begin"
+ "break"
+ "case"
+ "class"
+ "def"
+ "do"
+ "else"
+ "elsif"
+ "end"
+ "ensure"
+ "for"
+ "if"
+ "in"
+ "module"
+ "next"
+ "or"
+ "rescue"
+ "retry"
+ "return"
+ "then"
+ "unless"
+ "until"
+ "when"
+ "while"
+ "yield"
+] @keyword
+
+((identifier) @keyword
+ (#match? @keyword "^(private|protected|public)$"))
+
+; Function calls
+
+((identifier) @function.method.builtin
+ (#eq? @function.method.builtin "require"))
+
+"defined?" @function.method.builtin
+
+(call
+ method: [(identifier) (constant)] @function.method)
+
+; Function definitions
+
+(alias (identifier) @function.method)
+(setter (identifier) @function.method)
+(method name: [(identifier) (constant)] @function.method)
+(singleton_method name: [(identifier) (constant)] @function.method)
+
+; Identifiers
+
+[
+ (class_variable)
+ (instance_variable)
+] @property
+
+((identifier) @constant.builtin
+ (#match? @constant.builtin "^__(FILE|LINE|ENCODING)__$"))
+
+((constant) @constant
+ (#match? @constant "^[A-Z\\d_]+$"))
+
+(constant) @constructor
+
+(self) @variable.builtin
+(super) @variable.builtin
+
+(block_parameter (identifier) @variable.parameter)
+(block_parameters (identifier) @variable.parameter)
+(destructured_parameter (identifier) @variable.parameter)
+(hash_splat_parameter (identifier) @variable.parameter)
+(lambda_parameters (identifier) @variable.parameter)
+(method_parameters (identifier) @variable.parameter)
+(splat_parameter (identifier) @variable.parameter)
+
+(keyword_parameter name: (identifier) @variable.parameter)
+(optional_parameter name: (identifier) @variable.parameter)
+
+((identifier) @function.method
+ (#is-not? local))
+(identifier) @variable
+
+; Literals
+
+[
+ (string)
+ (bare_string)
+ (subshell)
+ (heredoc_body)
+ (heredoc_beginning)
+] @string
+
+[
+ (simple_symbol)
+ (delimited_symbol)
+ (hash_key_symbol)
+ (bare_symbol)
+] @string.special.symbol
+
+(regex) @string.special.regex
+(escape_sequence) @escape
+
+[
+ (integer)
+ (float)
+] @number
+
+[
+ (nil)
+ (true)
+ (false)
+]@constant.builtin
+
+(interpolation
+ "#{" @punctuation.special
+ "}" @punctuation.special) @embedded
+
+(comment) @comment
+
+; Operators
+
+[
+"="
+"=>"
+"->"
+] @operator
+
+[
+ ","
+ ";"
+ "."
+] @punctuation.delimiter
+
+[
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+ "}"
+ "%w("
+ "%i("
+] @punctuation.bracket
diff --git a/runtime/queries/ruby/locals.scm b/runtime/queries/ruby/locals.scm
new file mode 100644
index 00000000..393caafd
--- /dev/null
+++ b/runtime/queries/ruby/locals.scm
@@ -0,0 +1,27 @@
+((method) @local.scope
+ (#set! local.scope-inherits false))
+
+[
+ (lambda)
+ (block)
+ (do_block)
+] @local.scope
+
+(block_parameter (identifier) @local.definition)
+(block_parameters (identifier) @local.definition)
+(destructured_parameter (identifier) @local.definition)
+(hash_splat_parameter (identifier) @local.definition)
+(lambda_parameters (identifier) @local.definition)
+(method_parameters (identifier) @local.definition)
+(splat_parameter (identifier) @local.definition)
+
+(keyword_parameter name: (identifier) @local.definition)
+(optional_parameter name: (identifier) @local.definition)
+
+(identifier) @local.reference
+
+(assignment left: (identifier) @local.definition)
+(operator_assignment left: (identifier) @local.definition)
+(left_assignment_list (identifier) @local.definition)
+(rest_assignment (identifier) @local.definition)
+(destructured_left_assignment (identifier) @local.definition)
diff --git a/runtime/queries/ruby/tags.scm b/runtime/queries/ruby/tags.scm
new file mode 100644
index 00000000..47ba1eb5
--- /dev/null
+++ b/runtime/queries/ruby/tags.scm
@@ -0,0 +1,64 @@
+; Method definitions
+
+(
+ (comment)* @doc
+ .
+ [
+ (method
+ name: (_) @name) @definition.method
+ (singleton_method
+ name: (_) @name) @definition.method
+ ]
+ (#strip! @doc "^#\\s*")
+ (#select-adjacent! @doc @definition.method)
+)
+
+(alias
+ name: (_) @name) @definition.method
+
+(setter
+ (identifier) @ignore)
+
+; Class definitions
+
+(
+ (comment)* @doc
+ .
+ [
+ (class
+ name: [
+ (constant) @name
+ (scope_resolution
+ name: (_) @name)
+ ]) @definition.class
+ (singleton_class
+ value: [
+ (constant) @name
+ (scope_resolution
+ name: (_) @name)
+ ]) @definition.class
+ ]
+ (#strip! @doc "^#\\s*")
+ (#select-adjacent! @doc @definition.class)
+)
+
+; Module definitions
+
+(
+ (module
+ name: [
+ (constant) @name
+ (scope_resolution
+ name: (_) @name)
+ ]) @definition.module
+)
+
+; Calls
+
+(call method: (identifier) @name) @reference.call
+
+(
+ [(identifier) (constant)] @name @reference.call
+ (#is-not? local)
+ (#not-match? @name "^(lambda|load|require|require_relative|__FILE__|__LINE__)$")
+)
diff --git a/runtime/queries/toml/highlights.scm b/runtime/queries/toml/highlights.scm
new file mode 100644
index 00000000..e4d6966f
--- /dev/null
+++ b/runtime/queries/toml/highlights.scm
@@ -0,0 +1,33 @@
+; Properties
+;-----------
+
+(bare_key) @property
+(quoted_key) @string
+
+; Literals
+;---------
+
+(boolean) @constant.builtin
+(comment) @comment
+(string) @string
+(integer) @number
+(float) @number
+(offset_date_time) @string.special
+(local_date_time) @string.special
+(local_date) @string.special
+(local_time) @string.special
+
+; Punctuation
+;------------
+
+"." @punctuation.delimiter
+"," @punctuation.delimiter
+
+"=" @operator
+
+"[" @punctuation.bracket
+"]" @punctuation.bracket
+"[[" @punctuation.bracket
+"]]" @punctuation.bracket
+"{" @punctuation.bracket
+"}" @punctuation.bracket