feat!: drop modules, general refactor and cleanup

This commit is contained in:
Christian Clason 2023-06-12 09:54:30 -06:00
parent 310f0925ec
commit 692b051b09
1247 changed files with 6096 additions and 9074 deletions

View file

@ -0,0 +1,10 @@
[
(block)
(switch)
(formal_parameters)
(actual_parameters)
(decl_class)
(decl_enum)
(comment_block)
(doc_block)
] @fold

View file

@ -0,0 +1,190 @@
[
(comment_line)
(comment_block)
] @comment @spell
[
(doc_line)
(doc_block)
] @comment.documentation @spell
(literal_bool) @boolean
(literal_int) @number
(literal_float) @number.float
(literal_string) @string
(escape_sequence) @string.escape
(identifier) @variable
(formal_parameter
name: (identifier) @variable.parameter)
((identifier) @constant
(#lua-match? @constant "^[A-Z_][A-Z%d_]+$"))
; Preprocessor directives
[
(include)
(define)
(ifdef)
(ifndef)
(else)
(endif)
] @keyword.directive
(preproc_const) @constant.macro
; Constant fields
(decl_field
((field_modifier) @_modifier
(#eq? @_modifier "const"))
type: (_)
name: (identifier) @constant)
(enum_member
name: (identifier) @constant)
[
"+"
"-"
"*"
"/"
"%"
"^"
"++"
"--"
"="
"+="
"-="
"*="
"/="
"&="
"^="
"|="
"<<="
">>="
"<"
"<="
">="
">"
"=="
"!="
"!"
"&&"
"||"
">>"
"<<"
"&"
"|"
"^"
"~"
] @operator
[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket
; TODO: <> in decl_class
(types
[
"<"
">"
] @punctuation.bracket)
[
","
"."
":"
";"
] @punctuation.delimiter
[
"default"
"extends"
] @keyword
[
"new"
"delete"
] @keyword.operator
"return" @keyword.return
[
"if"
"else"
"switch"
"case"
] @keyword.conditional
[
"while"
"for"
"foreach"
"continue"
"break"
] @keyword.repeat
[
"enum"
"class"
"typedef"
] @keyword.type
[
(variable_modifier)
(method_modifier)
(class_modifier)
(field_modifier)
(formal_parameter_modifier)
] @keyword.modifier
"ref" @type
(decl_class
typename: (identifier) @type)
(decl_class
superclass: (superclass
typename: (identifier) @type))
(decl_enum
typename: (identifier) @type)
(type_identifier
(identifier) @type)
[
"auto"
(type_primitive)
] @type.builtin
[
(super)
(this)
] @variable.builtin
(literal_null) @constant.builtin
(decl_method
name: (identifier) @function.method)
(invokation
invoked: (identifier) @function.method.call)
; Constructor and deconstructor (function with same name of the class)
(decl_class
typename: (identifier) @_classname
body: (class_body
(decl_method
name: (identifier) @constructor
(#eq? @constructor @_classname))))

View file

@ -0,0 +1,30 @@
[
(block)
(class_body)
(enum_body)
(switch_body)
(array_creation)
(formal_parameters)
(actual_parameters)
] @indent.begin
[
"("
")"
"["
"]"
"}"
] @indent.branch
[
")"
"]"
"}"
] @indent.end
(comment_line) @indent.ignore
[
(ERROR)
(comment_block)
] @indent.auto

View file

@ -0,0 +1,13 @@
([
(comment_block)
(comment_line)
] @injection.content
(#set! injection.language "comment"))
([
(doc_block)
(doc_line)
] @injection.content
(#set! injection.language "doxygen"))
; TODO: string and print (numbered) format injection

View file

@ -0,0 +1,40 @@
; Scopes
(compilation_unit) @local.scope
(decl_class
body: (_) @local.scope)
(decl_enum
body: (_) @local.scope)
(decl_method) @local.scope
(block) @local.scope
(if) @local.scope
(for) @local.scope
(foreach) @local.scope
(while) @local.scope
; Definitions
(decl_class
typename: (identifier) @local.definition.type)
(decl_enum
typename: (identifier) @local.definition.enum)
(decl_method
name: (identifier) @local.definition.method)
(decl_variable
(_)*
(identifier) @local.definition.var)
; References
(identifier) @local.reference
(type_identifier
(identifier) @local.reference)