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,9 @@
[
(function_definition)
(if_statement)
(case_statement)
(for_statement)
(while_statement)
(c_style_for_statement)
(heredoc_redirect)
] @fold

View file

@ -0,0 +1,186 @@
[
"(" ")"
"{" "}"
"[" "]"
"[[" "]]"
"((" "))"
] @punctuation.bracket
[
";"
";;"
";&"
";;&"
"&"
] @punctuation.delimiter
[
">"
">>"
"<"
"<<"
"&&"
"|"
"|&"
"||"
"="
"+="
"=~"
"=="
"!="
"&>"
"&>>"
"<&"
">&"
">|"
"<&-"
">&-"
"<<-"
"<<<"
".."
] @operator
; Do *not* spell check strings since they typically have some sort of
; interpolation in them, or, are typically used for things like filenames, URLs,
; flags and file content.
[
(string)
(raw_string)
(ansi_c_string)
(heredoc_body)
] @string
[
(heredoc_start)
(heredoc_end)
] @label
(variable_assignment (word) @string)
(command argument: "$" @string) ; bare dollar
[
"if"
"then"
"else"
"elif"
"fi"
"case"
"in"
"esac"
] @conditional
[
"for"
"do"
"done"
"select"
"until"
"while"
] @repeat
[
"declare"
"typeset"
"export"
"readonly"
"local"
"unset"
"unsetenv"
] @keyword
"function" @keyword.function
(special_variable_name) @constant
; trap -l
((word) @constant.builtin
(#match? @constant.builtin "^SIG(HUP|INT|QUIT|ILL|TRAP|ABRT|BUS|FPE|KILL|USR[12]|SEGV|PIPE|ALRM|TERM|STKFLT|CHLD|CONT|STOP|TSTP|TT(IN|OU)|URG|XCPU|XFSZ|VTALRM|PROF|WINCH|IO|PWR|SYS|RTMIN([+]([1-9]|1[0-5]))?|RTMAX(-([1-9]|1[0-4]))?)$"))
((word) @boolean
(#any-of? @boolean "true" "false"))
(comment) @comment @spell
(test_operator) @operator
(command_substitution "$(" @punctuation.bracket)
(process_substitution "<(" @punctuation.bracket)
(arithmetic_expansion
[ "$((" "((" ] @punctuation.special
"))" @punctuation.special)
(arithmetic_expansion "," @punctuation.delimiter)
(ternary_expression [ "?" ":" ] @conditional.ternary)
(binary_expression operator: _ @operator)
(unary_expression operator: _ @operator)
(postfix_expression operator: _ @operator)
(function_definition
name: (word) @function)
(command_name (word) @function.call)
((command_name (word) @function.builtin)
(#any-of? @function.builtin
"alias" "bg" "bind" "break" "builtin" "caller" "cd"
"command" "compgen" "complete" "compopt" "continue"
"coproc" "dirs" "disown" "echo" "enable" "eval"
"exec" "exit" "fc" "fg" "getopts" "hash" "help"
"history" "jobs" "kill" "let" "logout" "mapfile"
"popd" "printf" "pushd" "pwd" "read" "readarray"
"return" "set" "shift" "shopt" "source" "suspend"
"test" "time" "times" "trap" "type" "typeset"
"ulimit" "umask" "unalias" "wait"))
(command
argument: [
(word) @parameter
(concatenation (word) @parameter)
])
(number) @number
((word) @number
(#lua-match? @number "^[0-9]+$"))
(file_redirect
destination: (word) @parameter)
(file_descriptor) @operator
(simple_expansion
"$" @punctuation.special) @none
(expansion
"${" @punctuation.special
"}" @punctuation.special) @none
(expansion operator: _ @punctuation.special)
(expansion "@" . operator: _ @character.special)
((expansion
(subscript
index: (word) @character.special))
(#any-of? @character.special "@" "*"))
"``" @punctuation.special
(variable_name) @variable
((variable_name) @constant
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
(case_item
value: (word) @parameter)
[
(regex)
(extglob_pattern)
] @string.regex
((program . (comment) @preproc)
(#lua-match? @preproc "^#!/"))

View file

@ -0,0 +1,10 @@
((comment) @injection.content
(#set! injection.language "comment"))
((regex) @injection.content
(#set! injection.language "regex"))
((heredoc_redirect
(heredoc_body) @injection.content
(heredoc_end) @injection.language)
(#downcase! @injection.language))

View file

@ -0,0 +1,13 @@
; Scopes
(function_definition) @scope
; Definitions
(variable_assignment
name: (variable_name) @definition.var)
(function_definition
name: (word) @definition.function)
; References
(variable_name) @reference
(word) @reference