feat!: drop modules, general refactor and cleanup

This commit is contained in:
Christian Clason 2023-06-12 09:54:30 -06:00
parent c13e28f894
commit 2c8f2f2fad
829 changed files with 4905 additions and 8010 deletions

144
runtime/queries/r/highlights.scm Executable file
View file

@ -0,0 +1,144 @@
; highlights.scm
; Literals
(integer) @number
(float) @float
(complex) @number
(string) @string
(string (escape_sequence) @string.escape)
(comment) @comment @spell
((program . (comment) @preproc)
(#lua-match? @preproc "^#!/"))
(identifier) @variable
((dollar (identifier) @variable.builtin)
(#eq? @variable.builtin "self"))
((dollar _ (identifier) @field))
; Parameters
(formal_parameters (identifier) @parameter)
(formal_parameters
(default_parameter name: (identifier) @parameter))
(default_argument name: (identifier) @parameter)
; Namespace
(namespace_get namespace: (identifier) @namespace)
(namespace_get_internal namespace: (identifier) @namespace)
; Operators
[
"="
"<-"
"<<-"
"->"
] @operator
(unary operator: [
"-"
"+"
"!"
"~"
"?"
] @operator)
(binary operator: [
"-"
"+"
"*"
"/"
"^"
"<"
">"
"<="
">="
"=="
"!="
"||"
"|"
"&&"
"&"
":"
"~"
] @operator)
[
"|>"
(special)
] @operator
(lambda_function "\\" @operator)
[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket
(dollar _ "$" @operator)
(subset2
"[[" @punctuation.bracket
"]]" @punctuation.bracket)
[
(dots)
(break)
(next)
] @keyword
[
(nan)
(na)
(null)
(inf)
] @constant.builtin
[
"if"
"else"
"switch"
] @conditional
[
"while"
"repeat"
"for"
"in"
] @repeat
[
(true)
(false)
] @boolean
"function" @keyword.function
; Functions/Methods
(call function: (identifier) @function.call)
(call
(namespace_get function: (identifier) @function.call))
(call
(namespace_get_internal function: (identifier) @function.call))
(call
function: ((dollar _ (identifier) @method.call)))
; Error
(ERROR) @error

View file

@ -0,0 +1,33 @@
[
(brace_list)
(paren_list)
(special)
(pipe)
(call)
"|>"
"if"
"else"
"while"
"repeat"
"for"
] @indent.begin
((binary operator: (special)) @indent.begin)
[
"}"
")"
] @indent.branch
((formal_parameters (identifier)) @indent.align
(#set! indent.open_delimiter "(")
(#set! indent.close_delimiter ")"))
[
")"
"}"
] @indent.end
[
(comment)
] @indent.ignore

View file

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

11
runtime/queries/r/locals.scm Executable file
View file

@ -0,0 +1,11 @@
; locals.scm
(function_definition) @scope
(formal_parameters (identifier) @definition.parameter)
(left_assignment name: (identifier) @definition)
(equals_assignment name: (identifier) @definition)
(right_assignment name: (identifier) @definition)
(identifier) @reference