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

View file

@ -0,0 +1,13 @@
[
(assert)
(class)
(multiclass)
(def)
(defm)
(defset)
(defvar)
(foreach)
(if)
(let)
(value_suffix)
] @fold

View file

@ -0,0 +1,156 @@
; Preprocs
(preprocessor_directive) @preproc
; Includes
"include" @include
; Keywords
[
"assert"
"class"
"multiclass"
"field"
"let"
"def"
"defm"
"defset"
"defvar"
] @keyword
[
"in"
] @keyword.operator
; Conditionals
[
"if"
"else"
"then"
] @conditional
; Repeats
[
"foreach"
] @repeat
; Variables
(identifier) @variable
(var) @variable.builtin
; Parameters
(template_arg (identifier) @parameter)
; Types
(type) @type
[
"bit"
"int"
"string"
"dag"
"bits"
"list"
"code"
] @type.builtin
(class name: (identifier) @type)
(multiclass name: (identifier) @type)
(def name: (value (_) @type))
(defm name: (value (_) @type))
(defset name: (identifier) @type)
(parent_class_list (identifier) @type (value (_) @type)?)
(anonymous_record (identifier) @type)
(anonymous_record (value (_) @type))
((identifier) @type
(#lua-match? @type "^_*[A-Z][A-Z0-9_]+$"))
; Fields
(instruction
(identifier) @field)
(let_instruction
(identifier) @field)
; Functions
([
(bang_operator)
(cond_operator)
] @function
(#set! "priority" 105))
; Operators
[
"="
"#"
"-"
":"
"..."
] @operator
; Literals
(string) @string
(code) @string.special
(integer) @number
(boolean) @boolean
(uninitialized_value) @constant.builtin
; Punctuation
[ "{" "}" ] @punctuation.bracket
[ "[" "]" ] @punctuation.bracket
[ "(" ")" ] @punctuation.bracket
[ "<" ">" ] @punctuation.bracket
[
"."
","
";"
] @punctuation.delimiter
[
"!"
] @punctuation.special
; Comments
[
(comment)
(multiline_comment)
] @comment @spell
((comment) @preproc
(#lua-match? @preproc "^.*RUN"))
; Errors
(ERROR) @error

View file

@ -0,0 +1,27 @@
[
(assert)
(class)
(multiclass)
(def)
(defm)
(defvar)
(foreach)
(if)
(let)
(value_suffix)
] @indent.begin
[
"}"
"]"
")"
">"
] @indent.end
[ "{" "}" ] @indent.branch
[ "[" "]" ] @indent.branch
[ "(" ")" ] @indent.branch
[ "<" ">" ] @indent.branch

View file

@ -0,0 +1,9 @@
((code) @injection.content
(#set! injection.language "cpp")
(#offset! @injection.content 0 2 0 -2))
((tablegen_file
(comment) @injection.content)
(#lua-match? @injection.content "^.*RUN")
(#set! injection.language "bash")
(#offset! @injection.content 0 8))

View file

@ -0,0 +1,51 @@
; Scopes
[
(class)
(multiclass)
(def)
(defm)
(defset)
(defvar)
(foreach)
(if)
(let)
] @scope
; References
[
(var)
(identifier)
] @reference
; Definitions
(instruction
(identifier) @definition.field)
(let_instruction
(identifier) @definition.field)
(include_directive
(string) @definition.import)
(template_arg (identifier) @definition.parameter)
(class
name: (identifier) @definition.type)
(multiclass
name: (identifier) @definition.type)
(def
name: (value (_) @definition.type))
(defm
name: (value (_) @definition.type))
(defset
name: (identifier) @definition.type)
(def_var
name: (identifier) @definition.var)