diff options
| -rw-r--r-- | queries/tiger/folds.scm | 5 | ||||
| -rw-r--r-- | queries/tiger/highlights.scm | 22 | ||||
| -rw-r--r-- | queries/tiger/locals.scm | 18 | ||||
| -rw-r--r-- | tests/query/highlights/tiger/built-ins.tig | 6 | ||||
| -rw-r--r-- | tests/query/highlights/tiger/functions.tig | 6 | ||||
| -rw-r--r-- | tests/query/highlights/tiger/identifiers.tig | 4 | ||||
| -rw-r--r-- | tests/query/highlights/tiger/imports.tig | 2 | ||||
| -rw-r--r-- | tests/query/highlights/tiger/keywords.tig | 10 | ||||
| -rw-r--r-- | tests/query/highlights/tiger/object-oriented.tig | 4 |
9 files changed, 41 insertions, 36 deletions
diff --git a/queries/tiger/folds.scm b/queries/tiger/folds.scm index 994c936e..24332a0f 100644 --- a/queries/tiger/folds.scm +++ b/queries/tiger/folds.scm @@ -16,9 +16,4 @@ (method_declaration) ] @fold -[ - (comment) - (string_literal) -] @ignore - ; vim: sw=2 foldmethod=marker diff --git a/queries/tiger/highlights.scm b/queries/tiger/highlights.scm index cadeed7b..6bc93109 100644 --- a/queries/tiger/highlights.scm +++ b/queries/tiger/highlights.scm @@ -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 {{{ diff --git a/queries/tiger/locals.scm b/queries/tiger/locals.scm index 70baf874..33ccd3c7 100644 --- a/queries/tiger/locals.scm +++ b/queries/tiger/locals.scm @@ -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 diff --git a/tests/query/highlights/tiger/built-ins.tig b/tests/query/highlights/tiger/built-ins.tig index 68790541..f359959f 100644 --- a/tests/query/highlights/tiger/built-ins.tig +++ b/tests/query/highlights/tiger/built-ins.tig @@ -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 */ diff --git a/tests/query/highlights/tiger/functions.tig b/tests/query/highlights/tiger/functions.tig index 802f394a..799ccd38 100644 --- a/tests/query/highlights/tiger/functions.tig +++ b/tests/query/highlights/tiger/functions.tig @@ -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 */ diff --git a/tests/query/highlights/tiger/identifiers.tig b/tests/query/highlights/tiger/identifiers.tig index f177a5a5..2d52edd1 100644 --- a/tests/query/highlights/tiger/identifiers.tig +++ b/tests/query/highlights/tiger/identifiers.tig @@ -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 */ diff --git a/tests/query/highlights/tiger/imports.tig b/tests/query/highlights/tiger/imports.tig index c056c301..6e60910f 100644 --- a/tests/query/highlights/tiger/imports.tig +++ b/tests/query/highlights/tiger/imports.tig @@ -1,3 +1,3 @@ import "lib.tih" /* <- keyword */ -/* ^ string.special.path */ +/* ^ string.special */ diff --git a/tests/query/highlights/tiger/keywords.tig b/tests/query/highlights/tiger/keywords.tig index 70cb82c0..79ebfd4d 100644 --- a/tests/query/highlights/tiger/keywords.tig +++ b/tests/query/highlights/tiger/keywords.tig @@ -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 diff --git a/tests/query/highlights/tiger/object-oriented.tig b/tests/query/highlights/tiger/object-oriented.tig index 930eabf0..0b4357c0 100644 --- a/tests/query/highlights/tiger/object-oriented.tig +++ b/tests/query/highlights/tiger/object-oriented.tig @@ -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 */ |
