Regenerate nvim config
This commit is contained in:
17
config/neovim/store/nvim-treesitter/queries/tiger/folds.scm
Normal file
17
config/neovim/store/nvim-treesitter/queries/tiger/folds.scm
Normal file
@ -0,0 +1,17 @@
|
||||
[
|
||||
(array_expression)
|
||||
(record_expression)
|
||||
(sequence_expression)
|
||||
(if_expression)
|
||||
(while_expression)
|
||||
(for_expression)
|
||||
(let_expression)
|
||||
(function_declaration)
|
||||
(primitive_declaration)
|
||||
(record_type)
|
||||
(class_declaration)
|
||||
(class_type)
|
||||
(method_declaration)
|
||||
] @fold
|
||||
|
||||
; vim: sw=2 foldmethod=marker
|
||||
121
config/neovim/store/nvim-treesitter/queries/tiger/highlights.scm
Normal file
121
config/neovim/store/nvim-treesitter/queries/tiger/highlights.scm
Normal file
@ -0,0 +1,121 @@
|
||||
; Built-ins {{{
|
||||
((function_call
|
||||
function: (identifier) @function.builtin)
|
||||
(#any-of? @function.builtin
|
||||
"chr" "concat" "exit" "flush" "getchar" "not" "ord" "print" "print_err" "print_int" "size"
|
||||
"strcmp" "streq" "substring"))
|
||||
|
||||
((type_identifier) @type.builtin
|
||||
(#any-of? @type.builtin "int" "string" "Object"))
|
||||
|
||||
((identifier) @variable.builtin
|
||||
(#eq? @variable.builtin "self"))
|
||||
|
||||
; }}}
|
||||
; Keywords {{{
|
||||
[
|
||||
"function"
|
||||
"primitive"
|
||||
"method"
|
||||
] @keyword.function
|
||||
|
||||
[
|
||||
"do"
|
||||
"for"
|
||||
"to"
|
||||
"while"
|
||||
] @keyword.repeat
|
||||
|
||||
"new" @keyword.operator
|
||||
|
||||
"import" @keyword.import
|
||||
|
||||
[
|
||||
"array"
|
||||
(break_expression)
|
||||
"else"
|
||||
"end"
|
||||
"if"
|
||||
"in"
|
||||
"let"
|
||||
"of"
|
||||
"then"
|
||||
"type"
|
||||
"var"
|
||||
"extends"
|
||||
"_cast"
|
||||
"_chunks"
|
||||
"_exp"
|
||||
"_lvalue"
|
||||
"_namety"
|
||||
] @keyword
|
||||
|
||||
"class" @keyword.type
|
||||
|
||||
; }}}
|
||||
; Operators {{{
|
||||
(operator) @operator
|
||||
|
||||
[
|
||||
","
|
||||
";"
|
||||
":"
|
||||
"."
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
; }}}
|
||||
; Functions and methods {{{
|
||||
(function_call
|
||||
function: (identifier) @function)
|
||||
|
||||
(function_declaration
|
||||
name: (identifier) @function)
|
||||
|
||||
(primitive_declaration
|
||||
name: (identifier) @function)
|
||||
|
||||
(method_call
|
||||
method: (identifier) @function.method)
|
||||
|
||||
(method_declaration
|
||||
name: (identifier) @function.method)
|
||||
|
||||
(parameters
|
||||
name: (identifier) @variable.parameter)
|
||||
|
||||
; }}}
|
||||
; Declarations {{{
|
||||
(import_declaration
|
||||
file: (string_literal) @string.special.path)
|
||||
|
||||
; }}}
|
||||
; Literals {{{
|
||||
(nil_literal) @constant.builtin
|
||||
|
||||
(integer_literal) @number
|
||||
|
||||
(string_literal) @string
|
||||
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
; }}}
|
||||
; Misc {{{
|
||||
(comment) @comment @spell
|
||||
|
||||
(type_identifier) @type
|
||||
|
||||
(field_identifier) @variable.member
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
; }}}
|
||||
; vim: sw=2 foldmethod=marker
|
||||
104
config/neovim/store/nvim-treesitter/queries/tiger/indents.scm
Normal file
104
config/neovim/store/nvim-treesitter/queries/tiger/indents.scm
Normal file
@ -0,0 +1,104 @@
|
||||
; Control flow {{{
|
||||
(if_expression) @indent.begin
|
||||
|
||||
"then" @indent.branch
|
||||
|
||||
"else" @indent.branch
|
||||
|
||||
(while_expression) @indent.begin
|
||||
|
||||
"do" @indent.branch
|
||||
|
||||
(for_expression) @indent.begin
|
||||
|
||||
"to" @indent.branch
|
||||
|
||||
; }}}
|
||||
; Class {{{
|
||||
(class_declaration) @indent.begin
|
||||
|
||||
(class_declaration
|
||||
"}" @indent.end)
|
||||
|
||||
(class_type) @indent.begin
|
||||
|
||||
(class_type
|
||||
"}" @indent.end)
|
||||
|
||||
; }}}
|
||||
; Groups {{{
|
||||
(let_expression) @indent.begin
|
||||
|
||||
"in" @indent.branch
|
||||
|
||||
"end" @indent.branch
|
||||
|
||||
(let_expression
|
||||
"end" @indent.end)
|
||||
|
||||
(sequence_expression) @indent.begin
|
||||
|
||||
")" @indent.branch
|
||||
|
||||
(sequence_expression
|
||||
")" @indent.end)
|
||||
|
||||
; }}}
|
||||
; Functions and methods {{{
|
||||
(parameters) @indent.begin
|
||||
|
||||
(parameters
|
||||
")" @indent.end)
|
||||
|
||||
(function_call) @indent.begin
|
||||
|
||||
(function_call
|
||||
")" @indent.end)
|
||||
|
||||
(method_call) @indent.begin
|
||||
|
||||
")" @indent.branch
|
||||
|
||||
(function_declaration) @indent.begin
|
||||
|
||||
(primitive_declaration) @indent.begin
|
||||
|
||||
(method_declaration) @indent.begin
|
||||
|
||||
; }}}
|
||||
; Values and expressions {{{
|
||||
(array_value) @indent.begin
|
||||
|
||||
"]" @indent.branch
|
||||
|
||||
(array_value
|
||||
"]" @indent.end)
|
||||
|
||||
(array_expression) @indent.begin
|
||||
|
||||
"of" @indent.branch
|
||||
|
||||
(record_expression) @indent.begin
|
||||
|
||||
"}" @indent.branch
|
||||
|
||||
(record_expression
|
||||
"}" @indent.end)
|
||||
|
||||
(record_type) @indent.begin
|
||||
|
||||
"}" @indent.branch
|
||||
|
||||
(record_type
|
||||
"}" @indent.end)
|
||||
|
||||
(variable_declaration) @indent.begin
|
||||
|
||||
; }}}
|
||||
; Misc{{{
|
||||
(comment) @indent.ignore
|
||||
|
||||
(string_literal) @indent.ignore
|
||||
|
||||
; }}}
|
||||
; vim: sw=2 foldmethod=marker
|
||||
@ -0,0 +1,4 @@
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
; vim: sw=2 foldmethod=marker
|
||||
39
config/neovim/store/nvim-treesitter/queries/tiger/locals.scm
Normal file
39
config/neovim/store/nvim-treesitter/queries/tiger/locals.scm
Normal file
@ -0,0 +1,39 @@
|
||||
; See this issue [1] for support for "lazy scoping" which is somewhat needed
|
||||
; for Tiger semantics (e.g: one can call a function before it has been defined
|
||||
; top-to-bottom).
|
||||
;
|
||||
; [1]: https://github.com/tree-sitter/tree-sitter/issues/918
|
||||
; Scopes {{{
|
||||
[
|
||||
(for_expression)
|
||||
(let_expression)
|
||||
(function_declaration)
|
||||
] @local.scope
|
||||
|
||||
; }}}
|
||||
; Definitions {{{
|
||||
(type_declaration
|
||||
name: (identifier) @local.definition.type
|
||||
(#set! "definition.var.scope" "parent"))
|
||||
|
||||
(parameters
|
||||
name: (identifier) @local.definition.parameter)
|
||||
|
||||
(function_declaration
|
||||
name: (identifier) @local.definition.function
|
||||
(#set! "definition.var.scope" "parent"))
|
||||
|
||||
(primitive_declaration
|
||||
name: (identifier) @local.definition.function
|
||||
(#set! "definition.var.scope" "parent"))
|
||||
|
||||
(variable_declaration
|
||||
name: (identifier) @local.definition.var
|
||||
(#set! "definition.var.scope" "parent"))
|
||||
|
||||
; }}}
|
||||
; References {{{
|
||||
(identifier) @local.reference
|
||||
|
||||
; }}}
|
||||
; vim: sw=2 foldmethod=marker
|
||||
Reference in New Issue
Block a user