fix(tiger): adjust invalid queries

This commit is contained in:
Bruno BELANYI 2022-06-14 20:01:12 +02:00 committed by Stephan Seitz
parent 6e3f888dc7
commit b8e3b03748
9 changed files with 41 additions and 36 deletions

View file

@ -16,9 +16,4 @@
(method_declaration)
] @fold
[
(comment)
(string_literal)
] @ignore
; vim: sw=2 foldmethod=marker

View file

@ -2,15 +2,21 @@
((function_call
function: (identifier) @function.builtin)
(#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
(#match? @type.builtin "^(int|string|Object)$")
(#is-not? local))
; FIXME: not supported by neovim
; (#is-not? local)
)
((identifier) @variable.builtin
(#match? @variable.builtin "^self$")
(#is-not? local))
; FIXME: not supported by neovim
; (#is-not? local)
)
; }}}
; Keywords {{{
@ -24,15 +30,15 @@
"for"
"to"
"while"
] @keyword.repeat
] @repeat
[
"new"
] @keyword.constructor
] @constructor
[
"method"
] @keyword.method
] @method
[
"array"
@ -101,12 +107,12 @@
name: (identifier) @method)
(parameters
name: (identifier) @variable.parameter)
name: (identifier) @parameter)
; }}}
; Declarations {{{
(import_declaration
file: (string_literal) @string.special.path)
file: (string_literal) @string.special)
; }}}
; Literals {{{

View file

@ -9,27 +9,31 @@
(for_expression)
(let_expression)
(function_declaration)
] @local.scope
] @scope
; }}}
; Definitions {{{
(type_declaration
name: (identifier) @local.definition)
name: (identifier) @definition.type
(#set! "definition.var.scope" "parent"))
(parameters
name: (identifier) @local.definition)
name: (identifier) @definition.parameter)
(function_declaration
name: (identifier) @local.definition)
name: (identifier) @definition.function
(#set! "definition.var.scope" "parent"))
(primitive_declaration
name: (identifier) @local.definition)
name: (identifier) @definition.function
(#set! "definition.var.scope" "parent"))
(variable_declaration
name: (identifier) @local.definition)
name: (identifier) @definition.var
(#set! "definition.var.scope" "parent"))
; }}}
; References {{{
(identifier) @local.reference
(identifier) @reference
; }}}
; vim: sw=2 foldmethod=marker

View file

@ -6,7 +6,7 @@ let
/* ^ type.builtin */
var b := exit(0)
/* ^ function */
/* ^ function.builtin */
type int = string /* Shadowing the built-in type */
/* ^ type.builtin */
@ -30,13 +30,13 @@ in
end;
exit(1);
/* <- function */
/* <- function.builtin */
print("shadowing is fun");
/* <- function.builtin */
self;
/* <- variable */
/* <- variable.builtin */
b := print
/* ^ variable */

View file

@ -1,8 +1,8 @@
primitive print(s: string)
/* ^ function */
/* ^ variable.parameter */
/* ^ parameter */
function func(a: int) : int = (print("Hello World!"); a)
/* ^ function */
/* ^ variable.parameter */
/* ^ function */
/* ^ parameter */
/* ^ function.builtin */

View file

@ -22,8 +22,8 @@ var array := int_array[12] of 27;
/* ^ type */
primitive func(a: int, b: string) : array
/* ^ variable.parameter */
/* ^ parameter */
/* ^ type.builtin */
/* ^ variable.parameter */
/* ^ parameter */
/* ^ type.builtin */
/* ^ type */

View file

@ -1,3 +1,3 @@
import "lib.tih"
/* <- keyword */
/* ^ string.special.path */
/* ^ string.special */

View file

@ -28,13 +28,13 @@ in
/* ^ keyword */
for i := 12 to 27 do 42;
/* <- keyword.repeat */
/* ^ keyword.repeat */
/* ^ keyword.repeat */
/* <- repeat */
/* ^ repeat */
/* ^ repeat */
while 12 do break
/* <- keyword.repeat */
/* ^ keyword.repeat */
/* <- repeat */
/* ^ repeat */
/* ^ keyword */
end

View file

@ -12,13 +12,13 @@ let
var a := 12
method meth() : int = self.a
/* <- keyword.method */
/* <- method */
/* ^ method */
/* ^ variable.builtin */
}
var object := new B
/* ^ keyword.constructor */
/* ^ constructor */
in
object.a := 27;
/* ^ property */