mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-21 04:40:08 -04:00
fix(tiger): adjust invalid queries
This commit is contained in:
parent
6e3f888dc7
commit
b8e3b03748
9 changed files with 41 additions and 36 deletions
|
|
@ -16,9 +16,4 @@
|
||||||
(method_declaration)
|
(method_declaration)
|
||||||
] @fold
|
] @fold
|
||||||
|
|
||||||
[
|
|
||||||
(comment)
|
|
||||||
(string_literal)
|
|
||||||
] @ignore
|
|
||||||
|
|
||||||
; vim: sw=2 foldmethod=marker
|
; vim: sw=2 foldmethod=marker
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,21 @@
|
||||||
((function_call
|
((function_call
|
||||||
function: (identifier) @function.builtin)
|
function: (identifier) @function.builtin)
|
||||||
(#match? @function.builtin "^(chr|concat|exit|flush|getchar|not|ord|print|print_err|print_int|size|strcmp|streq|substring)$")
|
(#match? @function.builtin "^(chr|concat|exit|flush|getchar|not|ord|print|print_err|print_int|size|strcmp|streq|substring)$")
|
||||||
(#is-not? local))
|
; FIXME: not supported by neovim
|
||||||
|
; (#is-not? local)
|
||||||
|
)
|
||||||
|
|
||||||
((type_identifier) @type.builtin
|
((type_identifier) @type.builtin
|
||||||
(#match? @type.builtin "^(int|string|Object)$")
|
(#match? @type.builtin "^(int|string|Object)$")
|
||||||
(#is-not? local))
|
; FIXME: not supported by neovim
|
||||||
|
; (#is-not? local)
|
||||||
|
)
|
||||||
|
|
||||||
((identifier) @variable.builtin
|
((identifier) @variable.builtin
|
||||||
(#match? @variable.builtin "^self$")
|
(#match? @variable.builtin "^self$")
|
||||||
(#is-not? local))
|
; FIXME: not supported by neovim
|
||||||
|
; (#is-not? local)
|
||||||
|
)
|
||||||
; }}}
|
; }}}
|
||||||
|
|
||||||
; Keywords {{{
|
; Keywords {{{
|
||||||
|
|
@ -24,15 +30,15 @@
|
||||||
"for"
|
"for"
|
||||||
"to"
|
"to"
|
||||||
"while"
|
"while"
|
||||||
] @keyword.repeat
|
] @repeat
|
||||||
|
|
||||||
[
|
[
|
||||||
"new"
|
"new"
|
||||||
] @keyword.constructor
|
] @constructor
|
||||||
|
|
||||||
[
|
[
|
||||||
"method"
|
"method"
|
||||||
] @keyword.method
|
] @method
|
||||||
|
|
||||||
[
|
[
|
||||||
"array"
|
"array"
|
||||||
|
|
@ -101,12 +107,12 @@
|
||||||
name: (identifier) @method)
|
name: (identifier) @method)
|
||||||
|
|
||||||
(parameters
|
(parameters
|
||||||
name: (identifier) @variable.parameter)
|
name: (identifier) @parameter)
|
||||||
; }}}
|
; }}}
|
||||||
|
|
||||||
; Declarations {{{
|
; Declarations {{{
|
||||||
(import_declaration
|
(import_declaration
|
||||||
file: (string_literal) @string.special.path)
|
file: (string_literal) @string.special)
|
||||||
; }}}
|
; }}}
|
||||||
|
|
||||||
; Literals {{{
|
; Literals {{{
|
||||||
|
|
|
||||||
|
|
@ -9,27 +9,31 @@
|
||||||
(for_expression)
|
(for_expression)
|
||||||
(let_expression)
|
(let_expression)
|
||||||
(function_declaration)
|
(function_declaration)
|
||||||
] @local.scope
|
] @scope
|
||||||
; }}}
|
; }}}
|
||||||
|
|
||||||
; Definitions {{{
|
; Definitions {{{
|
||||||
(type_declaration
|
(type_declaration
|
||||||
name: (identifier) @local.definition)
|
name: (identifier) @definition.type
|
||||||
|
(#set! "definition.var.scope" "parent"))
|
||||||
|
|
||||||
(parameters
|
(parameters
|
||||||
name: (identifier) @local.definition)
|
name: (identifier) @definition.parameter)
|
||||||
|
|
||||||
(function_declaration
|
(function_declaration
|
||||||
name: (identifier) @local.definition)
|
name: (identifier) @definition.function
|
||||||
|
(#set! "definition.var.scope" "parent"))
|
||||||
(primitive_declaration
|
(primitive_declaration
|
||||||
name: (identifier) @local.definition)
|
name: (identifier) @definition.function
|
||||||
|
(#set! "definition.var.scope" "parent"))
|
||||||
|
|
||||||
(variable_declaration
|
(variable_declaration
|
||||||
name: (identifier) @local.definition)
|
name: (identifier) @definition.var
|
||||||
|
(#set! "definition.var.scope" "parent"))
|
||||||
; }}}
|
; }}}
|
||||||
|
|
||||||
; References {{{
|
; References {{{
|
||||||
(identifier) @local.reference
|
(identifier) @reference
|
||||||
; }}}
|
; }}}
|
||||||
|
|
||||||
; vim: sw=2 foldmethod=marker
|
; vim: sw=2 foldmethod=marker
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ let
|
||||||
/* ^ type.builtin */
|
/* ^ type.builtin */
|
||||||
|
|
||||||
var b := exit(0)
|
var b := exit(0)
|
||||||
/* ^ function */
|
/* ^ function.builtin */
|
||||||
|
|
||||||
type int = string /* Shadowing the built-in type */
|
type int = string /* Shadowing the built-in type */
|
||||||
/* ^ type.builtin */
|
/* ^ type.builtin */
|
||||||
|
|
@ -30,13 +30,13 @@ in
|
||||||
end;
|
end;
|
||||||
|
|
||||||
exit(1);
|
exit(1);
|
||||||
/* <- function */
|
/* <- function.builtin */
|
||||||
|
|
||||||
print("shadowing is fun");
|
print("shadowing is fun");
|
||||||
/* <- function.builtin */
|
/* <- function.builtin */
|
||||||
|
|
||||||
self;
|
self;
|
||||||
/* <- variable */
|
/* <- variable.builtin */
|
||||||
|
|
||||||
b := print
|
b := print
|
||||||
/* ^ variable */
|
/* ^ variable */
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
primitive print(s: string)
|
primitive print(s: string)
|
||||||
/* ^ function */
|
/* ^ function */
|
||||||
/* ^ variable.parameter */
|
/* ^ parameter */
|
||||||
|
|
||||||
function func(a: int) : int = (print("Hello World!"); a)
|
function func(a: int) : int = (print("Hello World!"); a)
|
||||||
/* ^ function */
|
/* ^ function */
|
||||||
/* ^ variable.parameter */
|
/* ^ parameter */
|
||||||
/* ^ function */
|
/* ^ function.builtin */
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,8 @@ var array := int_array[12] of 27;
|
||||||
/* ^ type */
|
/* ^ type */
|
||||||
|
|
||||||
primitive func(a: int, b: string) : array
|
primitive func(a: int, b: string) : array
|
||||||
/* ^ variable.parameter */
|
/* ^ parameter */
|
||||||
/* ^ type.builtin */
|
/* ^ type.builtin */
|
||||||
/* ^ variable.parameter */
|
/* ^ parameter */
|
||||||
/* ^ type.builtin */
|
/* ^ type.builtin */
|
||||||
/* ^ type */
|
/* ^ type */
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
import "lib.tih"
|
import "lib.tih"
|
||||||
/* <- keyword */
|
/* <- keyword */
|
||||||
/* ^ string.special.path */
|
/* ^ string.special */
|
||||||
|
|
|
||||||
|
|
@ -28,13 +28,13 @@ in
|
||||||
/* ^ keyword */
|
/* ^ keyword */
|
||||||
|
|
||||||
for i := 12 to 27 do 42;
|
for i := 12 to 27 do 42;
|
||||||
/* <- keyword.repeat */
|
/* <- repeat */
|
||||||
/* ^ keyword.repeat */
|
/* ^ repeat */
|
||||||
/* ^ keyword.repeat */
|
/* ^ repeat */
|
||||||
|
|
||||||
while 12 do break
|
while 12 do break
|
||||||
/* <- keyword.repeat */
|
/* <- repeat */
|
||||||
/* ^ keyword.repeat */
|
/* ^ repeat */
|
||||||
/* ^ keyword */
|
/* ^ keyword */
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -12,13 +12,13 @@ let
|
||||||
var a := 12
|
var a := 12
|
||||||
|
|
||||||
method meth() : int = self.a
|
method meth() : int = self.a
|
||||||
/* <- keyword.method */
|
/* <- method */
|
||||||
/* ^ method */
|
/* ^ method */
|
||||||
/* ^ variable.builtin */
|
/* ^ variable.builtin */
|
||||||
}
|
}
|
||||||
|
|
||||||
var object := new B
|
var object := new B
|
||||||
/* ^ keyword.constructor */
|
/* ^ constructor */
|
||||||
in
|
in
|
||||||
object.a := 27;
|
object.a := 27;
|
||||||
/* ^ property */
|
/* ^ property */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue