diff --git a/.gitmodules b/.gitmodules index 8f192f8..15f9b26 100644 --- a/.gitmodules +++ b/.gitmodules @@ -14,10 +14,6 @@ path = libs/tree-sitter-ruby url = https://github.com/tree-sitter/tree-sitter-ruby.git ignore = dirty -[submodule "libs/tree-sitter-c"] - path = libs/tree-sitter-c - url = https://github.com/tree-sitter/tree-sitter-c.git - ignore = dirty [submodule "libs/tree-sitter-cpp"] path = libs/tree-sitter-cpp url = https://github.com/tree-sitter/tree-sitter-cpp.git diff --git a/Makefile b/Makefile index 430875a..1b3dd52 100644 --- a/Makefile +++ b/Makefile @@ -34,15 +34,15 @@ TREE_SITTER_LIBS := $(wildcard libs/tree-sitter-*/libtree-sitter*.a) PHP_LIB := libs/tree-sitter-php/php/libtree-sitter-php.a +NGINX_OBJ_PARSER := libs/tree-sitter-nginx/build/Release/obj.target/tree_sitter_nginx_binding/src/parser.o + +GITIGNORE_OBJ_PARSER := libs/tree-sitter-gitignore/build/Release/obj.target/tree_sitter_ignore_binding/src/parser.o + FISH_OBJ_PARSER := libs/tree-sitter-fish/build/Release/obj.target/tree_sitter_fish_binding/src/parser.o FISH_OBJ_SCANNER := libs/tree-sitter-fish/build/Release/obj.target/tree_sitter_fish_binding/src/scanner.o -NGINX_OBJ_PARSER := libs/tree-sitter-nginx/build/Release/obj.target/tree_sitter_nginx_binding/src/parser.o - CABAL_OBJ_PARSER := libs/tree-sitter-cabal/build/Release/obj.target/tree_sitter_cabal_binding/src/parser.o -CABAL_OBJ_SCANNER := libs/tree-sitter-cabal/src/scanner.o - -GITIGNORE_OBJ_PARSER := libs/tree-sitter-gitignore/build/Release/obj.target/tree_sitter_ignore_binding/src/parser.o +CABAL_OBJ_SCANNER := libs/tree-sitter-cabal/src/libscanner.a MD_OBJ_PARSER := libs/tree-sitter-markdown/build/Release/obj.target/tree_sitter_markdown_binding/tree-sitter-markdown/src/parser.o MD_OBJ_SCANNER := libs/tree-sitter-markdown/build/Release/obj.target/tree_sitter_markdown_binding/tree-sitter-markdown/src/scanner.o @@ -55,9 +55,9 @@ LIBS := \ $(NGINX_OBJ_PARSER) \ $(GITIGNORE_OBJ_PARSER) \ $(FISH_OBJ_PARSER) \ + $(FISH_OBJ_SCANNER) \ $(CABAL_OBJ_PARSER) \ $(CABAL_OBJ_SCANNER) \ - $(FISH_OBJ_SCANNER) \ $(MD_OBJ_PARSER) \ $(MD_OBJ_SCANNER) \ -lpcre2-8 -lmagic diff --git a/grammar/bash.scm b/grammar/bash.scm index 766116c..25879c7 100644 --- a/grammar/bash.scm +++ b/grammar/bash.scm @@ -1,4 +1,4 @@ -;; #bd9ae6 #000000 0 0 0 1 +;; #BFBDB6 #000000 0 0 0 1 [ "(" ")" @@ -12,7 +12,7 @@ "))" ] @punctuation.bracket -;; #bd9ae6 #000000 0 0 0 1 +;; #BFBDB6 #000000 0 0 0 1 [ ";" ";;" @@ -21,7 +21,7 @@ "&" ] @punctuation.delimiter -;; #ffffff #000000 0 1 0 1 +;; #F29668 #000000 0 1 0 1 [ ">" ">>" @@ -49,7 +49,7 @@ "!" ] @operator -;; #aad84c #000000 0 0 0 1 +;; #AAD94C #000000 0 0 0 1 [ (string) (raw_string) @@ -57,14 +57,14 @@ (heredoc_body) ] @string -;; #fbb152 #000000 0 0 0 1 +;; #E6C08A #000000 0 0 0 1 [ (heredoc_start) (heredoc_end) ] @label (variable_assignment - (word) @string) + (word) @variable) (command argument: "$" @string) ; bare dollar @@ -72,7 +72,7 @@ (concatenation (word) @string) -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 [ "if" "then" @@ -84,7 +84,7 @@ "esac" ] @keyword.conditional -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 [ "for" "do" @@ -94,7 +94,7 @@ "while" ] @keyword.repeat -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 [ "declare" "typeset" @@ -104,39 +104,39 @@ "unsetenv" ] @keyword -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 "export" @keyword.import -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 "function" @keyword.function -;; #ebda8c #000000 0 0 0 1 +;; #D2A6FF #000000 0 0 0 1 (special_variable_name) @constant -;; #ebda8c #000000 0 0 0 1 +;; #D2A6FF #000000 0 0 0 1 ((word) @constant.builtin (#match? @constant.builtin "^(SIGHUP|SIGINT|SIGQUIT|SIGILL|SIGTRAP|SIGABRT|SIGBUS|SIGFPE|SIGKILL|SIGUSR1|SIGSEGV|SIGUSR2|SIGPIPE|SIGALRM|SIGTERM|SIGSTKFLT|SIGCHLD|SIGCONT|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU|SIGURG|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGIO|SIGPWR|SIGSYS|SIGRTMIN|SIGRTMIN\+1|SIGRTMIN\+2|SIGRTMIN\+3|SIGRTMIN\+4|SIGRTMIN\+5|SIGRTMIN\+6|SIGRTMIN\+7|SIGRTMIN\+8|SIGRTMIN\+9|SIGRTMIN\+10|SIGRTMIN\+11|SIGRTMIN\+12|SIGRTMIN\+13|SIGRTMIN\+14|SIGRTMIN\+15|SIGRTMAX\-14|SIGRTMAX\-13|SIGRTMAX\-12|SIGRTMAX\-11|SIGRTMAX\-10|SIGRTMAX\-9|SIGRTMAX\-8|SIGRTMAX\-7|SIGRTMAX\-6|SIGRTMAX\-5|SIGRTMAX\-4|SIGRTMAX\-3|SIGRTMAX\-2|SIGRTMAX\-1|SIGRTMAX)$")) -;; #51eeba #000000 0 0 0 1 +;; #D2A6FF #000000 0 0 0 1 ((word) @boolean.true (#match? @boolean.true "^true$")) -;; #ee513a #000000 0 0 0 1 +;; #D2A6FF #000000 0 0 0 1 ((word) @boolean.false (#match? @boolean.false "^false$")) -;; #AAAAAA #000000 0 1 0 1 +;; #99ADBF #000000 0 1 0 1 (comment) @comment @spell -;; #ffffff #000000 0 0 0 1 +;; #F29668 #000000 0 0 0 1 (test_operator) @operator -;; #e6a24c #000000 0 0 0 2 +;; #7dcfff #000000 0 0 0 2 (command_substitution "$(" @punctuation.special ")" @punctuation.special) -;; #e6a24c #000000 0 0 0 2 +;; #7dcfff #000000 0 0 0 2 (process_substitution [ "<(" @@ -144,7 +144,7 @@ ] @punctuation.special ")" @punctuation.special) -;; #e6a24c #000000 0 0 0 2 +;; #7dcfff #000000 0 0 0 2 (arithmetic_expansion [ "$((" @@ -152,43 +152,43 @@ ] @punctuation.special "))" @punctuation.special) -;; #bd9ae6 #000000 0 0 0 1 +;; #BFBDB6 #000000 0 0 0 1 (arithmetic_expansion "," @punctuation.delimiter) -;; #ffffff #000000 0 0 0 1 +;; #F29668 #000000 0 0 0 1 (ternary_expression [ "?" ":" ] @keyword.conditional.ternary) -;; #ffffff #000000 0 0 0 1 +;; #F29668 #000000 0 0 0 1 (binary_expression operator: _ @operator) -;; #ffffff #000000 0 0 0 1 +;; #F29668 #000000 0 0 0 1 (unary_expression operator: _ @operator) -;; #ffffff #000000 0 0 0 1 +;; #F29668 #000000 0 0 0 1 (postfix_expression operator: _ @operator) -;; #aad84c #000000 0 0 0 3 +;; #FFB454 #000000 0 0 0 3 (function_definition name: (word) @function) -;; #aad84c #000000 0 0 0 3 +;; #FFB454 #000000 0 0 0 3 (command_name (word) @function.call) -;; #aad84c #000000 0 0 0 3 +;; #FFB454 #000000 0 0 0 3 (command_name (word) @function.builtin (#match? @function.builtin "^(\.|\:|alias|bg|bind|break|builtin|caller|cd|command|compgen|complete|compopt|continue|coproc|dirs|disown|echo|enable|eval|exec|exit|false|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|true|type|typeset|ulimit|umask|unalias|wait)$")) -;; #ffffff #000000 0 0 0 1 +;; #FFFFFF #000000 0 0 0 1 (command argument: [ (word) @variable.parameter @@ -196,83 +196,302 @@ (word) @variable.parameter) ]) -;; #ffffff #000000 0 0 0 1 +;; #FFFFFF #000000 0 0 0 1 (declaration_command (word) @variable.parameter) -;; #ffffff #000000 0 0 0 1 +;; #FFFFFF #000000 0 0 0 1 (unset_command (word) @variable.parameter) -;; #ebda8c #000000 0 0 0 2 +;; #D2A6FF #000000 0 0 0 2 (number) @number -;; #ebda8c #000000 0 0 0 2 +;; #D2A6FF #000000 0 0 0 2 ((word) @number (#match? @number "^[0-9]+$")) -;; #aad84c #000000 0 0 0 1 +;; #AAD94C #000000 0 0 0 1 (file_redirect (word) @string.special.path) -;; #aad84c #000000 0 0 0 1 +;; #AAD94C #000000 0 0 0 1 (herestring_redirect (word) @string) -;; #ffffff #000000 0 0 0 1 +;; #F29668 #000000 0 0 0 1 (file_descriptor) @operator -;; #e6a24c #000000 0 0 0 2 +;; #7dcfff #000000 0 0 0 2 (simple_expansion "$" @punctuation.special) @none -;; #e6a24c #000000 0 0 0 2 +;; #7dcfff #000000 0 0 0 2 (expansion "${" @punctuation.special "}" @punctuation.special) @none -;; #e6a24c #000000 0 0 0 2 +;; #7dcfff #000000 0 0 0 2 (expansion operator: _ @punctuation.special) -;; #e6a24c #000000 0 0 0 2 +;; #7dcfff #000000 0 0 0 2 (expansion "@" . operator: _ @character.special) -;; #e6a24c #000000 0 0 0 2 +;; #7dcfff #000000 0 0 0 2 ((expansion (subscript index: (word) @character.special)) (#any-of? @character.special "@" "*")) -;; #e6a24c #000000 0 0 0 2 +;; #7dcfff #000000 0 0 0 2 "``" @punctuation.special -;; #ffffff #000000 0 0 0 1 +;; #FFFFFF #000000 0 0 0 1 (variable_name) @variable -;; #ebda8c #000000 0 0 0 1 +;; #D2A6FF #000000 0 0 0 1 ((variable_name) @constant (#match? @constant "^[A-Z][A-Z_0-9]*$")) -;; #ffffff #000000 0 0 0 1 +;; #F07178 #000000 0 0 0 1 ((variable_name) @variable.builtin (#match? @variable.builtin "^(CDPATH|HOME|IFS|MAIL|MAILPATH|OPTARG|OPTIND|PATH|PS1|PS2|_|BASH|BASHOPTS|BASHPID|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_ARGV0|BASH_CMDS|BASH_COMMAND|BASH_COMPAT|BASH_ENV|BASH_EXECUTION_STRING|BASH_LINENO|BASH_LOADABLES_PATH|BASH_REMATCH|BASH_SOURCE|BASH_SUBSHELL|BASH_VERSINFO|BASH_VERSION|BASH_XTRACEFD|CHILD_MAX|COLUMNS|COMP_CWORD|COMP_LINE|COMP_POINT|COMP_TYPE|COMP_KEY|COMP_WORDBREAKS|COMP_WORDS|COMPREPLY|COPROC|DIRSTACK|EMACS|ENV|EPOCHREALTIME|EPOCHSECONDS|EUID|EXECIGNORE|FCEDIT|FIGNORE|FUNCNAME|FUNCNEST|GLOBIGNORE|GROUPS|histchars|HISTCMD|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTIGNORE|HISTSIZE|HISTTIMEFORMAT|HOSTFILE|HOSTNAME|HOSTTYPE|IGNOREEOF|INPUTRC|INSIDE_EMACS|LANG|LC_ALL|LC_COLLATE|LC_CTYPE|LC_MESSAGES|LC_NUMERIC|LC_TIME|LINENO|LINES|MACHTYPE|MAILCHECK|MAPFILE|OLDPWD|OPTERR|OSTYPE|PIPESTATUS|POSIXLY_CORRECT|PPID|PROMPT_COMMAND|PROMPT_DIRTRIM|PS0|PS3|PS4|PWD|RANDOM|READLINE_ARGUMENT|READLINE_LINE|READLINE_MARK|READLINE_POINT|REPLY|SECONDS|SHELL|SHELLOPTS|SHLVL|SRANDOM|TIMEFORMAT|TMOUT|TMPDIR|UID)$")) -;; #ffffff #000000 0 0 0 1 +;; #FFFFFF #000000 0 0 0 1 (case_item value: (word) @variable.parameter) -;; #e6a24c #000000 0 0 0 2 +;; #95E6CB #000000 0 0 0 2 [ (regex) (extglob_pattern) ] @string.regexp -;; #51eeba #000000 0 0 0 3 +;; #AAD94C #000000 0 0 0 3 ((program . (comment) @keyword.directive @nospell) (#match? @keyword.directive "^#!/")) + +; Injections + +( +;; !bash + (heredoc_body) @bash_injection + ((heredoc_end) @lang + (#match? @lang "BASH")) +) + +( +;; !c + (heredoc_body) @c_injection + ((heredoc_end) @lang + (#match? @lang "C$")) +) + +( +;; !cpp + (heredoc_body) @cpp_injection + ((heredoc_end) @lang + (#match? @lang "CPP")) +) + +( +;; !css + (heredoc_body) @css_injection + ((heredoc_end) @lang + (#match? @lang "CSS")) +) + +( +;; !fish + (heredoc_body) @fish_injection + ((heredoc_end) @lang + (#match? @lang "FISH")) +) + +( +;; !go + (heredoc_body) @go_injection + ((heredoc_end) @lang + (#match? @lang "GO")) +) + +( +;; !haskell + (heredoc_body) @haskell_injection + ((heredoc_end) @lang + (#match? @lang "HASKELL")) +) + +( +;; !html + (heredoc_body) @html_injection + ((heredoc_end) @lang + (#match? @lang "HTML")) +) + +( +;; !javascript + (heredoc_body) @javascript_injection + ((heredoc_end) @lang + (#match? @lang "JAVASCRIPT")) +) + +( +;; !json + (heredoc_body) @json_injection + ((heredoc_end) @lang + (#match? @lang "JSON")) +) + +( +;; !lua + (heredoc_body) @lua_injection + ((heredoc_end) @lang + (#match? @lang "LUA")) +) + +( +;; !make + (heredoc_body) @make_injection + ((heredoc_end) @lang + (#match? @lang "MAKE")) +) + +( +;; !python + (heredoc_body) @python_injection + ((heredoc_end) @lang + (#match? @lang "PYTHON")) +) + +( +;; !ruby + (heredoc_body) @ruby_injection + ((heredoc_end) @lang + (#match? @lang "RUBY")) +) + +( +;; !rust + (heredoc_body) @rust_injection + ((heredoc_end) @lang + (#match? @lang "RUST")) +) + +( +;; !diff + (heredoc_body) @diff_injection + ((heredoc_end) @lang + (#match? @lang "DIFF")) +) + +( +;; !embedded_template + (heredoc_body) @embedded_template_injection + ((heredoc_end) @lang + (#match? @lang "ERB")) +) + +( +;; !gdscript + (heredoc_body) @gdscript_injection + ((heredoc_end) @lang + (#match? @lang "GDSCRIPT")) +) + +( +;; !gitattributes + (heredoc_body) @gitattributes_injection + ((heredoc_end) @lang + (#match? @lang "GITATTRIBUTES")) +) + +( +;; !gitignore + (heredoc_body) @gitignore_injection + ((heredoc_end) @lang + (#match? @lang "GITIGNORE")) +) + +( +;; !gomod + (heredoc_body) @gomod_injection + ((heredoc_end) @lang + (#match? @lang "GOMOD")) +) + +( +;; !ini + (heredoc_body) @ini_injection + ((heredoc_end) @lang + (#match? @lang "INI")) +) + +( +;; !markdown + (heredoc_body) @markdown_injection + ((heredoc_end) @lang + (#match? @lang "MARKDOWN")) +) + +( +;; !nginx + (heredoc_body) @nginx_injection + ((heredoc_end) @lang + (#match? @lang "NGINX")) +) + +( +;; !php + (heredoc_body) @php_injection + ((heredoc_end) @lang + (#match? @lang "PHP")) +) + +( +;; !query + (heredoc_body) @query_injection + ((heredoc_end) @lang + (#match? @lang "QUERY")) +) + +( +;; !regex + (heredoc_body) @regex_injection + ((heredoc_end) @lang + (#match? @lang "REGEX")) +) + +( +;; !sql + (heredoc_body) @sql_injection + ((heredoc_end) @lang + (#match? @lang "SQL")) +) + +( +;; !toml + (heredoc_body) @toml_injection + ((heredoc_end) @lang + (#match? @lang "TOML")) +) + +( +;; !yaml + (heredoc_body) @yaml_injection + ((heredoc_end) @lang + (#match? @lang "YAML")) +) + +( +;; !cabal + (heredoc_body) @cabal_injection + ((heredoc_end) @lang + (#match? @lang "CABAL")) +) diff --git a/grammar/c.scm b/grammar/c.scm new file mode 100644 index 0000000..49df591 --- /dev/null +++ b/grammar/c.scm @@ -0,0 +1,363 @@ +;; #ffffff #000000 0 0 0 1 +((identifier) @variable + (#set! priority 95)) + +(preproc_def + (preproc_arg) @variable) + +;; #FF8F40 #000000 0 0 0 1 +[ + "default" + "goto" + "asm" + "__asm__" +] @keyword + +[ + "enum" + "struct" + "union" + "typedef" +] @keyword.type + +[ + "sizeof" + "offsetof" +] @keyword.operator + +(alignof_expression + . + _ @keyword.operator) + +;; #FF8F40 #000000 0 0 0 1 +"return" @keyword.return + +;; #FF8F40 #000000 0 0 0 1 +[ + "while" + "for" + "do" + "continue" + "break" +] @keyword.repeat + +;; #FF8F40 #000000 0 0 0 1 +[ + "if" + "else" + "case" + "switch" +] @keyword.conditional + +;; #FF8F40 #000000 0 0 0 1 +[ + "#if" + "#ifdef" + "#ifndef" + "#else" + "#elif" + "#endif" + "#elifdef" + "#elifndef" + (preproc_directive) +] @keyword.directive + +;; #FF8F40 #000000 0 0 0 1 +"#define" @keyword.directive.define + +;; #FF8F40 #000000 0 0 0 1 +"#include" @keyword.import + +;; #BFBDB6 #000000 0 0 0 1 +[ + ";" + ":" + "," + "." + "::" +] @punctuation.delimiter + +;; #BFBDB6 #000000 0 0 0 2 +"..." @punctuation.special + +;; #BFBDB6 #000000 0 0 0 1 +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +;; #F29668 #000000 0 1 0 1 +[ + "=" + "-" + "*" + "/" + "+" + "%" + "~" + "|" + "&" + "^" + "<<" + ">>" + "->" + "<" + "<=" + ">=" + ">" + "==" + "!=" + "!" + "&&" + "||" + "-=" + "+=" + "*=" + "/=" + "%=" + "|=" + "&=" + "^=" + ">>=" + "<<=" + "--" + "++" +] @operator + +;; #F29668 #000000 0 0 0 1 +(comma_expression + "," @operator) + +;; #D2A6FF #000000 0 0 0 1 +[ + (true) + (false) +] @boolean + +;; #F29668 #000000 0 0 0 1 +(conditional_expression + [ + "?" + ":" + ] @keyword.conditional.ternary) + +;; #aad84c #000000 0 0 0 1 +(string_literal) @string + +(system_lib_string) @string + +;; #95E6CB #000000 0 0 0 2 +(escape_sequence) @string.escape + +;; #D2A6FF #000000 0 0 0 1 +(null) @constant.builtin + +;; #D2A6FF #000000 0 0 0 1 +(number_literal) @number + +;; #39BAE6 #000000 0 0 0 1 +(char_literal) @character + +;; #FFB454 #000000 0 0 0 1 +(preproc_defined) @function.macro + +;; #F07178 #000000 0 0 0 1 +((field_expression + (field_identifier) @property) @_parent) + +(field_designator) @property + +((field_identifier) @property) + +;; #39BAE6 #000000 0 0 0 1 +(statement_identifier) @label + +(declaration + type: (type_identifier) @_type + declarator: (identifier) @label + (#match? @_type "^__label__$")) + +;; #59C2FF #000000 0 0 0 1 +[ + (type_identifier) + (type_descriptor) +] @type + +;; #FF8F40 #000000 0 0 0 1 +(storage_class_specifier) @keyword.modifier + +[ + (type_qualifier) + (gnu_asm_qualifier) + "__extension__" +] @keyword.modifier + +;; #FF8F40 #000000 0 0 0 1 +(linkage_specification + "extern" @keyword.modifier) + +;; #59C2FF #000000 0 0 0 1 +(type_definition + declarator: (type_identifier) @type.definition) + +;; #59C2FF #000000 0 0 0 1 +(primitive_type) @type.builtin + +(sized_type_specifier + _ @type.builtin + type: _?) + +;; #D2A6FF #000000 0 0 0 1 +((identifier) @constant + (#match? @constant "^[A-Z][A-Z0-9_]+$")) + +(preproc_def + (preproc_arg) @constant + (#match? @constant "^[A-Z][A-Z0-9_]+$")) + +(enumerator + name: (identifier) @constant) + +(case_statement + value: (identifier) @constant) + +;; #D2A6FF #000000 0 0 0 1 +((identifier) @constant.builtin + (#match? @constant.builtin "^(stderr|stdin|stdout|__FILE__|__LINE__|__DATE__|__TIME__|__STDC__|__STDC_VERSION__|__STDC_HOSTED__|__cplusplus|__OBJC__|__ASSEMBLER__|__BASE_FILE__|__FILE_NAME__|__INCLUDE_LEVEL__|__TIMESTAMP__|__clang__|__clang_major__|__clang_minor__|__clang_patchlevel__|__clang_version__|__clang_literal_encoding__|__clang_wide_literal_encoding__|__FUNCTION__|__func__|__PRETTY_FUNCTION__|__VA_ARGS__|__VA_OPT__)$")) + +(preproc_def + (preproc_arg) @constant.builtin + (#match? @constant.builtin "^(stderr|stdin|stdout|__FILE__|__LINE__|__DATE__|__TIME__|__STDC__|__STDC_VERSION__|__STDC_HOSTED__|__cplusplus|__OBJC__|__ASSEMBLER__|__BASE_FILE__|__FILE_NAME__|__INCLUDE_LEVEL__|__TIMESTAMP__|__clang__|__clang_major__|__clang_minor__|__clang_patchlevel__|__clang_version__|__clang_literal_encoding__|__clang_wide_literal_encoding__|__FUNCTION__|__func__|__PRETTY_FUNCTION__|__VA_ARGS__|__VA_OPT__)$")) + +;; #D2A6FF #000000 0 0 0 1 +(attribute_specifier + (argument_list + (identifier) @variable.builtin)) + +(attribute_specifier + (argument_list + (call_expression + function: (identifier) @variable.builtin))) + +;; #FFB454 #000000 0 0 0 1 +((call_expression + function: (identifier) @function.builtin) + (#match? @function.builtin "^__builtin_")) + +((call_expression + function: (identifier) @function.builtin)) + +;; #D2A6FF #000000 0 0 0 1 +(preproc_def + name: (_) @constant.macro) + +(preproc_call + directive: (preproc_directive) @_u + argument: (_) @constant.macro + (#match? @_u "^#undef$")) + +(preproc_ifdef + name: (identifier) @constant.macro) + +(preproc_elifdef + name: (identifier) @constant.macro) + +(preproc_defined + (identifier) @constant.macro) + +;; #FFB454 #000000 0 0 0 3 +(call_expression + function: (identifier) @function.call) + +(call_expression + function: (field_expression + field: (field_identifier) @function.call)) + +;; #FFB454 #000000 0 0 0 3 +(function_declarator + declarator: (identifier) @function) + +(function_declarator + declarator: (parenthesized_declarator + (pointer_declarator + declarator: (field_identifier) @function))) + +;; #FFB454 #000000 0 0 0 3 +(preproc_function_def + name: (identifier) @function.macro) + +;; #99ADBF #000000 0 1 0 1 +(comment) @comment @spell + +;; #99ADBF #000000 0 1 0 1 +((comment) @comment.documentation + (#match? @comment.documentation "^/[*][*][^*].*[*]/$")) + +;; #D2A6FF #000000 0 0 0 1 +(parameter_declaration + declarator: (identifier) @variable.parameter) + +(parameter_declaration + declarator: (array_declarator) @variable.parameter) + +(parameter_declaration + declarator: (pointer_declarator) @variable.parameter) + +(preproc_params + (identifier) @variable.parameter) + +;; #FF8F40 #000000 0 0 0 1 +[ + "__attribute__" + "__declspec" + "__based" + "__cdecl" + "__clrcall" + "__stdcall" + "__fastcall" + "__thiscall" + "__vectorcall" + (ms_pointer_modifier) + (attribute_declaration) +] @attribute + +;; #F07178 #000000 0 0 0 1 +((identifier) @variable.member + (#match? @variable.member "^m_.*$")) + +(parameter_declaration + declarator: (reference_declarator) @variable.parameter) + +(variadic_parameter_declaration + declarator: (variadic_declarator + (_) @variable.parameter)) + +(optional_parameter_declaration + declarator: (_) @variable.parameter) + +;; #F07178 #000000 0 0 0 1 +((field_expression + (field_identifier) @function.method) @_parent) + +(field_declaration + (field_identifier) @variable.member) + +(field_initializer + (field_identifier) @property) + +(function_declarator + declarator: (field_identifier) @function.method) + +;; #59C2FF #000000 0 0 0 3 +(concept_definition + name: (identifier) @type.definition) + +(alias_declaration + name: (type_identifier) @type.definition) + +;; #59C2FF #000000 0 0 0 1 +(auto) @type.builtin diff --git a/grammar/cpp.scm b/grammar/cpp.scm index 29187ba..d6b8b26 100644 --- a/grammar/cpp.scm +++ b/grammar/cpp.scm @@ -5,7 +5,7 @@ (preproc_def (preproc_arg) @variable) -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 [ "default" "goto" @@ -29,10 +29,10 @@ . _ @keyword.operator) -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 "return" @keyword.return -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 [ "while" "for" @@ -41,7 +41,7 @@ "break" ] @keyword.repeat -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 [ "if" "else" @@ -49,7 +49,7 @@ "switch" ] @keyword.conditional -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 [ "#if" "#ifdef" @@ -62,13 +62,13 @@ (preproc_directive) ] @keyword.directive -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 "#define" @keyword.directive.define -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 "#include" @keyword.import -;; #bd9ae6 #000000 0 0 0 1 +;; #BFBDB6 #000000 0 0 0 1 [ ";" ":" @@ -77,10 +77,10 @@ "::" ] @punctuation.delimiter -;; #e6a24c #000000 0 0 0 2 +;; #BFBDB6 #000000 0 0 0 2 "..." @punctuation.special -;; #bd9ae6 #000000 0 0 0 1 +;; #BFBDB6 #000000 0 0 0 1 [ "(" ")" @@ -90,7 +90,7 @@ "}" ] @punctuation.bracket -;; #ffffff #000000 0 0 0 1 +;; #F29668 #000000 0 1 0 1 [ "=" "-" @@ -128,17 +128,17 @@ "++" ] @operator -;; #ffffff #000000 0 0 0 1 +;; #F29668 #000000 0 0 0 1 (comma_expression "," @operator) -;; #51eeba #000000 0 0 0 1 +;; #D2A6FF #000000 0 0 0 1 [ (true) (false) ] @boolean -;; #fbb152 #000000 0 0 0 1 +;; #F29668 #000000 0 0 0 1 (conditional_expression [ "?" @@ -150,22 +150,22 @@ (system_lib_string) @string -;; #e6a24c #000000 0 0 0 2 +;; #95E6CB #000000 0 0 0 2 (escape_sequence) @string.escape -;; #ebda8c #000000 0 0 0 1 +;; #D2A6FF #000000 0 0 0 1 (null) @constant.builtin -;; #ebda8c #000000 0 0 0 1 +;; #D2A6FF #000000 0 0 0 1 (number_literal) @number -;; #ebda8c #000000 0 0 0 1 +;; #39BAE6 #000000 0 0 0 1 (char_literal) @character -;; #aad84c #000000 0 0 0 1 +;; #FFB454 #000000 0 0 0 1 (preproc_defined) @function.macro -;; #ffffff #000000 0 0 0 1 +;; #F07178 #000000 0 0 0 1 ((field_expression (field_identifier) @property) @_parent) @@ -173,7 +173,7 @@ ((field_identifier) @property) -;; #fbb152 #000000 0 0 0 1 +;; #39BAE6 #000000 0 0 0 1 (statement_identifier) @label (declaration @@ -181,13 +181,13 @@ declarator: (identifier) @label (#match? @_type "^__label__$")) -;; #aad84c #000000 0 0 0 1 +;; #59C2FF #000000 0 0 0 1 [ (type_identifier) (type_descriptor) ] @type -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 (storage_class_specifier) @keyword.modifier [ @@ -196,22 +196,22 @@ "__extension__" ] @keyword.modifier -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 (linkage_specification "extern" @keyword.modifier) -;; #aad84c #000000 0 0 0 1 +;; #59C2FF #000000 0 0 0 1 (type_definition declarator: (type_identifier) @type.definition) -;; #aad84c #000000 0 0 0 1 +;; #59C2FF #000000 0 0 0 1 (primitive_type) @type.builtin (sized_type_specifier _ @type.builtin type: _?) -;; #ebda8c #000000 0 0 0 1 +;; #D2A6FF #000000 0 0 0 1 ((identifier) @constant (#match? @constant "^[A-Z][A-Z0-9_]+$")) @@ -225,7 +225,7 @@ (case_statement value: (identifier) @constant) -;; #ebda8c #000000 0 0 0 1 +;; #D2A6FF #000000 0 0 0 1 ((identifier) @constant.builtin (#match? @constant.builtin "^(stderr|stdin|stdout|__FILE__|__LINE__|__DATE__|__TIME__|__STDC__|__STDC_VERSION__|__STDC_HOSTED__|__cplusplus|__OBJC__|__ASSEMBLER__|__BASE_FILE__|__FILE_NAME__|__INCLUDE_LEVEL__|__TIMESTAMP__|__clang__|__clang_major__|__clang_minor__|__clang_patchlevel__|__clang_version__|__clang_literal_encoding__|__clang_wide_literal_encoding__|__FUNCTION__|__func__|__PRETTY_FUNCTION__|__VA_ARGS__|__VA_OPT__)$")) @@ -233,7 +233,7 @@ (preproc_arg) @constant.builtin (#match? @constant.builtin "^(stderr|stdin|stdout|__FILE__|__LINE__|__DATE__|__TIME__|__STDC__|__STDC_VERSION__|__STDC_HOSTED__|__cplusplus|__OBJC__|__ASSEMBLER__|__BASE_FILE__|__FILE_NAME__|__INCLUDE_LEVEL__|__TIMESTAMP__|__clang__|__clang_major__|__clang_minor__|__clang_patchlevel__|__clang_version__|__clang_literal_encoding__|__clang_wide_literal_encoding__|__FUNCTION__|__func__|__PRETTY_FUNCTION__|__VA_ARGS__|__VA_OPT__)$")) -;; #ffffff #000000 0 0 0 1 +;; #D2A6FF #000000 0 0 0 1 (attribute_specifier (argument_list (identifier) @variable.builtin)) @@ -243,7 +243,7 @@ (call_expression function: (identifier) @variable.builtin))) -;; #aad84c #000000 0 0 0 1 +;; #FFB454 #000000 0 0 0 1 ((call_expression function: (identifier) @function.builtin) (#match? @function.builtin "^__builtin_")) @@ -251,7 +251,7 @@ ((call_expression function: (identifier) @function.builtin)) -;; #ebda8c #000000 0 0 0 1 +;; #D2A6FF #000000 0 0 0 1 (preproc_def name: (_) @constant.macro) @@ -269,7 +269,7 @@ (preproc_defined (identifier) @constant.macro) -;; #aad84c #000000 0 0 0 3 +;; #FFB454 #000000 0 0 0 3 (call_expression function: (identifier) @function.call) @@ -277,7 +277,7 @@ function: (field_expression field: (field_identifier) @function.call)) -;; #aad84c #000000 0 0 0 3 +;; #FFB454 #000000 0 0 0 3 (function_declarator declarator: (identifier) @function) @@ -286,18 +286,18 @@ (pointer_declarator declarator: (field_identifier) @function))) -;; #aad84c #000000 0 0 0 3 +;; #FFB454 #000000 0 0 0 3 (preproc_function_def name: (identifier) @function.macro) -;; #AAAAAA #000000 0 1 0 1 +;; #99ADBF #000000 0 1 0 1 (comment) @comment @spell -;; #AAAAAA #000000 0 1 0 1 +;; #99ADBF #000000 0 1 0 1 ((comment) @comment.documentation (#match? @comment.documentation "^/[*][*][^*].*[*]/$")) -;; #ffffff #000000 0 0 0 1 +;; #D2A6FF #000000 0 0 0 1 (parameter_declaration declarator: (identifier) @variable.parameter) @@ -310,7 +310,7 @@ (preproc_params (identifier) @variable.parameter) -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 [ "__attribute__" "__declspec" @@ -325,7 +325,7 @@ (attribute_declaration) ] @attribute -;; #ffffff #000000 0 0 0 1 +;; #F07178 #000000 0 0 0 1 ((identifier) @variable.member (#match? @variable.member "^m_.*$")) @@ -339,7 +339,7 @@ (optional_parameter_declaration declarator: (_) @variable.parameter) -;; #ffffff #000000 0 0 0 1 +;; #F07178 #000000 0 0 0 1 ((field_expression (field_identifier) @function.method) @_parent) @@ -352,29 +352,29 @@ (function_declarator declarator: (field_identifier) @function.method) -;; #aad84c #000000 0 0 0 3 +;; #59C2FF #000000 0 0 0 3 (concept_definition name: (identifier) @type.definition) (alias_declaration name: (type_identifier) @type.definition) -;; #aad84c #000000 0 0 0 1 +;; #59C2FF #000000 0 0 0 1 (auto) @type.builtin -;; #aad84c #000000 0 0 0 1 +;; #59C2FF #000000 0 0 0 1 (namespace_identifier) @module -;; #aad84c #000000 0 0 0 1 +;; #59C2FF #000000 0 0 0 1 ((namespace_identifier) @type (#match? @type "^[A-Z]")) -;; #ebda8c #000000 0 0 0 1 +;; #D2A6FF #000000 0 0 0 1 (case_statement value: (qualified_identifier (identifier) @constant)) -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 (using_declaration . "using" @@ -386,11 +386,11 @@ (identifier) ] @module) -;; #aad84c #000000 0 0 0 3 +;; #FFB454 #000000 0 0 0 3 (destructor_name (identifier) @function.method) -;; #aad84c #000000 0 0 0 3 +;; #FFB454 #000000 0 0 0 3 (function_declarator (qualified_identifier (identifier) @function)) @@ -420,10 +420,10 @@ "operator" @function -;; #aad84c #000000 0 0 0 3 +;; #FFB454 #000000 0 0 0 3 "static_assert" @function.builtin -;; #aad84c #000000 0 0 0 3 +;; #FFB454 #000000 0 0 0 3 (call_expression (qualified_identifier (identifier) @function.call)) @@ -478,7 +478,7 @@ (template_method (field_identifier) @function.method)) -;; #aad84c #000000 0 0 0 3 +;; #FFB454 #000000 0 0 0 3 (call_expression (field_expression (field_identifier) @function.method.call)) @@ -488,7 +488,7 @@ (template_method (field_identifier) @function.method.call))) -;; #aad84c #000000 0 0 0 3 +;; #FFB454 #000000 0 0 0 3 ((function_declarator (qualified_identifier (identifier) @constructor)) @@ -513,23 +513,23 @@ (argument_list)) (#match? @constructor "^[A-Z]")) -;; #ffffff #000000 0 0 0 1 +;; #F07178 #000000 0 0 0 1 (this) @variable.builtin -;; #ebda8c #000000 0 0 0 1 +;; #D2A6FF #000000 0 0 0 1 (null "nullptr" @constant.builtin) -;; #51eeba #000000 0 0 0 2 +;; #D2A6FF #000000 0 0 0 2 (true) @boolean_true -;; #ee513a #000000 0 0 0 2 +;; #D2A6FF #000000 0 0 0 2 (false) @boolean_false ;; #aad84c #000000 0 0 0 1 (raw_string_literal) @string -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 [ "try" "catch" @@ -537,7 +537,7 @@ "throw" ] @keyword.exception -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 [ "decltype" "explicit" @@ -548,7 +548,7 @@ "constexpr" ] @keyword -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 [ "class" "namespace" @@ -557,14 +557,14 @@ "concept" ] @keyword.type -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 [ "co_await" "co_yield" "co_return" ] @keyword.coroutine -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 [ "public" "private" @@ -573,7 +573,7 @@ "virtual" ] @keyword.modifier -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 [ "new" "delete" @@ -590,13 +590,13 @@ "or" ] @keyword.operator -;; #ffffff #000000 0 0 0 1 +;; #F29668 #000000 0 0 0 1 "<=>" @operator -;; #bd9ae6 #000000 0 0 0 1 +;; #BFBDB6 #000000 0 0 0 1 "::" @punctuation.delimiter -;; #bd9ae6 #000000 0 0 0 1 +;; #BFBDB6 #000000 0 0 0 1 (template_argument_list [ "<" @@ -609,5 +609,5 @@ ">" ] @punctuation.bracket) -;; #ffffff #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 (literal_suffix) @operator diff --git a/grammar/h.scm b/grammar/h.scm index 29187ba..d6b8b26 100644 --- a/grammar/h.scm +++ b/grammar/h.scm @@ -5,7 +5,7 @@ (preproc_def (preproc_arg) @variable) -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 [ "default" "goto" @@ -29,10 +29,10 @@ . _ @keyword.operator) -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 "return" @keyword.return -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 [ "while" "for" @@ -41,7 +41,7 @@ "break" ] @keyword.repeat -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 [ "if" "else" @@ -49,7 +49,7 @@ "switch" ] @keyword.conditional -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 [ "#if" "#ifdef" @@ -62,13 +62,13 @@ (preproc_directive) ] @keyword.directive -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 "#define" @keyword.directive.define -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 "#include" @keyword.import -;; #bd9ae6 #000000 0 0 0 1 +;; #BFBDB6 #000000 0 0 0 1 [ ";" ":" @@ -77,10 +77,10 @@ "::" ] @punctuation.delimiter -;; #e6a24c #000000 0 0 0 2 +;; #BFBDB6 #000000 0 0 0 2 "..." @punctuation.special -;; #bd9ae6 #000000 0 0 0 1 +;; #BFBDB6 #000000 0 0 0 1 [ "(" ")" @@ -90,7 +90,7 @@ "}" ] @punctuation.bracket -;; #ffffff #000000 0 0 0 1 +;; #F29668 #000000 0 1 0 1 [ "=" "-" @@ -128,17 +128,17 @@ "++" ] @operator -;; #ffffff #000000 0 0 0 1 +;; #F29668 #000000 0 0 0 1 (comma_expression "," @operator) -;; #51eeba #000000 0 0 0 1 +;; #D2A6FF #000000 0 0 0 1 [ (true) (false) ] @boolean -;; #fbb152 #000000 0 0 0 1 +;; #F29668 #000000 0 0 0 1 (conditional_expression [ "?" @@ -150,22 +150,22 @@ (system_lib_string) @string -;; #e6a24c #000000 0 0 0 2 +;; #95E6CB #000000 0 0 0 2 (escape_sequence) @string.escape -;; #ebda8c #000000 0 0 0 1 +;; #D2A6FF #000000 0 0 0 1 (null) @constant.builtin -;; #ebda8c #000000 0 0 0 1 +;; #D2A6FF #000000 0 0 0 1 (number_literal) @number -;; #ebda8c #000000 0 0 0 1 +;; #39BAE6 #000000 0 0 0 1 (char_literal) @character -;; #aad84c #000000 0 0 0 1 +;; #FFB454 #000000 0 0 0 1 (preproc_defined) @function.macro -;; #ffffff #000000 0 0 0 1 +;; #F07178 #000000 0 0 0 1 ((field_expression (field_identifier) @property) @_parent) @@ -173,7 +173,7 @@ ((field_identifier) @property) -;; #fbb152 #000000 0 0 0 1 +;; #39BAE6 #000000 0 0 0 1 (statement_identifier) @label (declaration @@ -181,13 +181,13 @@ declarator: (identifier) @label (#match? @_type "^__label__$")) -;; #aad84c #000000 0 0 0 1 +;; #59C2FF #000000 0 0 0 1 [ (type_identifier) (type_descriptor) ] @type -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 (storage_class_specifier) @keyword.modifier [ @@ -196,22 +196,22 @@ "__extension__" ] @keyword.modifier -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 (linkage_specification "extern" @keyword.modifier) -;; #aad84c #000000 0 0 0 1 +;; #59C2FF #000000 0 0 0 1 (type_definition declarator: (type_identifier) @type.definition) -;; #aad84c #000000 0 0 0 1 +;; #59C2FF #000000 0 0 0 1 (primitive_type) @type.builtin (sized_type_specifier _ @type.builtin type: _?) -;; #ebda8c #000000 0 0 0 1 +;; #D2A6FF #000000 0 0 0 1 ((identifier) @constant (#match? @constant "^[A-Z][A-Z0-9_]+$")) @@ -225,7 +225,7 @@ (case_statement value: (identifier) @constant) -;; #ebda8c #000000 0 0 0 1 +;; #D2A6FF #000000 0 0 0 1 ((identifier) @constant.builtin (#match? @constant.builtin "^(stderr|stdin|stdout|__FILE__|__LINE__|__DATE__|__TIME__|__STDC__|__STDC_VERSION__|__STDC_HOSTED__|__cplusplus|__OBJC__|__ASSEMBLER__|__BASE_FILE__|__FILE_NAME__|__INCLUDE_LEVEL__|__TIMESTAMP__|__clang__|__clang_major__|__clang_minor__|__clang_patchlevel__|__clang_version__|__clang_literal_encoding__|__clang_wide_literal_encoding__|__FUNCTION__|__func__|__PRETTY_FUNCTION__|__VA_ARGS__|__VA_OPT__)$")) @@ -233,7 +233,7 @@ (preproc_arg) @constant.builtin (#match? @constant.builtin "^(stderr|stdin|stdout|__FILE__|__LINE__|__DATE__|__TIME__|__STDC__|__STDC_VERSION__|__STDC_HOSTED__|__cplusplus|__OBJC__|__ASSEMBLER__|__BASE_FILE__|__FILE_NAME__|__INCLUDE_LEVEL__|__TIMESTAMP__|__clang__|__clang_major__|__clang_minor__|__clang_patchlevel__|__clang_version__|__clang_literal_encoding__|__clang_wide_literal_encoding__|__FUNCTION__|__func__|__PRETTY_FUNCTION__|__VA_ARGS__|__VA_OPT__)$")) -;; #ffffff #000000 0 0 0 1 +;; #D2A6FF #000000 0 0 0 1 (attribute_specifier (argument_list (identifier) @variable.builtin)) @@ -243,7 +243,7 @@ (call_expression function: (identifier) @variable.builtin))) -;; #aad84c #000000 0 0 0 1 +;; #FFB454 #000000 0 0 0 1 ((call_expression function: (identifier) @function.builtin) (#match? @function.builtin "^__builtin_")) @@ -251,7 +251,7 @@ ((call_expression function: (identifier) @function.builtin)) -;; #ebda8c #000000 0 0 0 1 +;; #D2A6FF #000000 0 0 0 1 (preproc_def name: (_) @constant.macro) @@ -269,7 +269,7 @@ (preproc_defined (identifier) @constant.macro) -;; #aad84c #000000 0 0 0 3 +;; #FFB454 #000000 0 0 0 3 (call_expression function: (identifier) @function.call) @@ -277,7 +277,7 @@ function: (field_expression field: (field_identifier) @function.call)) -;; #aad84c #000000 0 0 0 3 +;; #FFB454 #000000 0 0 0 3 (function_declarator declarator: (identifier) @function) @@ -286,18 +286,18 @@ (pointer_declarator declarator: (field_identifier) @function))) -;; #aad84c #000000 0 0 0 3 +;; #FFB454 #000000 0 0 0 3 (preproc_function_def name: (identifier) @function.macro) -;; #AAAAAA #000000 0 1 0 1 +;; #99ADBF #000000 0 1 0 1 (comment) @comment @spell -;; #AAAAAA #000000 0 1 0 1 +;; #99ADBF #000000 0 1 0 1 ((comment) @comment.documentation (#match? @comment.documentation "^/[*][*][^*].*[*]/$")) -;; #ffffff #000000 0 0 0 1 +;; #D2A6FF #000000 0 0 0 1 (parameter_declaration declarator: (identifier) @variable.parameter) @@ -310,7 +310,7 @@ (preproc_params (identifier) @variable.parameter) -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 [ "__attribute__" "__declspec" @@ -325,7 +325,7 @@ (attribute_declaration) ] @attribute -;; #ffffff #000000 0 0 0 1 +;; #F07178 #000000 0 0 0 1 ((identifier) @variable.member (#match? @variable.member "^m_.*$")) @@ -339,7 +339,7 @@ (optional_parameter_declaration declarator: (_) @variable.parameter) -;; #ffffff #000000 0 0 0 1 +;; #F07178 #000000 0 0 0 1 ((field_expression (field_identifier) @function.method) @_parent) @@ -352,29 +352,29 @@ (function_declarator declarator: (field_identifier) @function.method) -;; #aad84c #000000 0 0 0 3 +;; #59C2FF #000000 0 0 0 3 (concept_definition name: (identifier) @type.definition) (alias_declaration name: (type_identifier) @type.definition) -;; #aad84c #000000 0 0 0 1 +;; #59C2FF #000000 0 0 0 1 (auto) @type.builtin -;; #aad84c #000000 0 0 0 1 +;; #59C2FF #000000 0 0 0 1 (namespace_identifier) @module -;; #aad84c #000000 0 0 0 1 +;; #59C2FF #000000 0 0 0 1 ((namespace_identifier) @type (#match? @type "^[A-Z]")) -;; #ebda8c #000000 0 0 0 1 +;; #D2A6FF #000000 0 0 0 1 (case_statement value: (qualified_identifier (identifier) @constant)) -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 (using_declaration . "using" @@ -386,11 +386,11 @@ (identifier) ] @module) -;; #aad84c #000000 0 0 0 3 +;; #FFB454 #000000 0 0 0 3 (destructor_name (identifier) @function.method) -;; #aad84c #000000 0 0 0 3 +;; #FFB454 #000000 0 0 0 3 (function_declarator (qualified_identifier (identifier) @function)) @@ -420,10 +420,10 @@ "operator" @function -;; #aad84c #000000 0 0 0 3 +;; #FFB454 #000000 0 0 0 3 "static_assert" @function.builtin -;; #aad84c #000000 0 0 0 3 +;; #FFB454 #000000 0 0 0 3 (call_expression (qualified_identifier (identifier) @function.call)) @@ -478,7 +478,7 @@ (template_method (field_identifier) @function.method)) -;; #aad84c #000000 0 0 0 3 +;; #FFB454 #000000 0 0 0 3 (call_expression (field_expression (field_identifier) @function.method.call)) @@ -488,7 +488,7 @@ (template_method (field_identifier) @function.method.call))) -;; #aad84c #000000 0 0 0 3 +;; #FFB454 #000000 0 0 0 3 ((function_declarator (qualified_identifier (identifier) @constructor)) @@ -513,23 +513,23 @@ (argument_list)) (#match? @constructor "^[A-Z]")) -;; #ffffff #000000 0 0 0 1 +;; #F07178 #000000 0 0 0 1 (this) @variable.builtin -;; #ebda8c #000000 0 0 0 1 +;; #D2A6FF #000000 0 0 0 1 (null "nullptr" @constant.builtin) -;; #51eeba #000000 0 0 0 2 +;; #D2A6FF #000000 0 0 0 2 (true) @boolean_true -;; #ee513a #000000 0 0 0 2 +;; #D2A6FF #000000 0 0 0 2 (false) @boolean_false ;; #aad84c #000000 0 0 0 1 (raw_string_literal) @string -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 [ "try" "catch" @@ -537,7 +537,7 @@ "throw" ] @keyword.exception -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 [ "decltype" "explicit" @@ -548,7 +548,7 @@ "constexpr" ] @keyword -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 [ "class" "namespace" @@ -557,14 +557,14 @@ "concept" ] @keyword.type -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 [ "co_await" "co_yield" "co_return" ] @keyword.coroutine -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 [ "public" "private" @@ -573,7 +573,7 @@ "virtual" ] @keyword.modifier -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 [ "new" "delete" @@ -590,13 +590,13 @@ "or" ] @keyword.operator -;; #ffffff #000000 0 0 0 1 +;; #F29668 #000000 0 0 0 1 "<=>" @operator -;; #bd9ae6 #000000 0 0 0 1 +;; #BFBDB6 #000000 0 0 0 1 "::" @punctuation.delimiter -;; #bd9ae6 #000000 0 0 0 1 +;; #BFBDB6 #000000 0 0 0 1 (template_argument_list [ "<" @@ -609,5 +609,5 @@ ">" ] @punctuation.bracket) -;; #ffffff #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 (literal_suffix) @operator diff --git a/grammar/ruby.scm b/grammar/ruby.scm index d38aa34..a834766 100644 --- a/grammar/ruby.scm +++ b/grammar/ruby.scm @@ -1,24 +1,10 @@ -(heredoc_body -;; !bash - (heredoc_content) @bash_injection - ((heredoc_end) @lang - (#match? @lang "BASH")) -) - -(heredoc_body -;; !ruby - (heredoc_content) @ruby_injection - ((heredoc_end) @lang - (#match? @lang "RUBY")) -) - -;; #ffffff #000000 0 0 0 1 +;; #FFFFFF #000000 0 0 0 1 [ (identifier) (global_variable) ] @variable -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 [ "alias" "begin" @@ -30,17 +16,17 @@ "then" ] @keyword -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 "class" @keyword.type -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 [ "return" "yield" ] @keyword.return -;; #fbb152 #000000 0 0 0 1 +;; #F29668 #000000 0 0 0 1 [ "and" "or" @@ -48,7 +34,7 @@ "not" ] @keyword.operator -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 [ "def" "undef" @@ -58,7 +44,7 @@ "end" @keyword.function) -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 [ "case" "else" @@ -72,7 +58,7 @@ (if "end" @keyword.conditional) -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 [ "for" "until" @@ -83,27 +69,28 @@ "next" ] @keyword.repeat -;; #ebda8c #000000 0 0 0 1 +;; #D2A6FF #000000 0 0 0 1 (constant) @constant -;; #fbb152 #000000 0 0 0 1 +;; #FF8F40 #000000 0 0 0 1 [ "rescue" "ensure" ] @keyword.exception -;; #aad84c #000000 0 0 0 3 +;; #FFB454 #000000 0 0 0 3 "defined?" @function -;; #aad84c #000000 0 0 0 3 +;; #FFB454 #000000 0 0 0 3 (call receiver: (constant)? @type method: [ (identifier) (constant) -;; #ff5689 #000000 0 0 0 2 +;; #FFB454 #000000 0 0 0 2 ] @function.call) +;; #FFB454 #000000 0 0 0 2 (alias (identifier) @function) @@ -122,6 +109,7 @@ (constant) @type ]) +;; #59C2FF #000000 0 0 0 2 (class name: (constant) @type) @@ -131,26 +119,27 @@ (superclass (constant) @type) -;; #ffffff #000000 0 0 0 1 +;; #F07178 #000000 0 0 0 1 [ (class_variable) (instance_variable) ] @variable.member +;; #FF8F40 #000000 0 0 0 2 ((identifier) @keyword.modifier (#match? @keyword.modifier "^(private|protected|public)$" )) -;; #fbb152 #000000 0 0 0 3 +;; #FF8F40 #000000 0 0 0 3 (program (call (identifier) @keyword.import) (#match? @keyword.import "^(require|require_relative|load)$")) -;; #fbb152 #000000 0 0 0 4 +;; #D2A6FF #000000 0 0 0 4 ((identifier) @constant.builtin (#match? @constant.builtin "^(__callee__|__dir__|__id__|__method__|__send__|__ENCODING__|__FILE__|__LINE__)$" )) -;; #aad84c #000000 0 0 0 3 +;; #FFB454 #000000 0 0 0 3 ((identifier) @function.builtin (#match? @function.builtin "^(attr_reader|attr_writer|attr_accessor|module_function)$" )) @@ -159,16 +148,17 @@ method: (identifier) @function.builtin) (#match? @function.builtin "^(include|extend|prepend|refine|using)$")) +;; #FF8F40 #000000 0 0 0 3 ((identifier) @keyword.exception (#match? @keyword.exception "^(raise|fail|catch|throw)$" )) -;; #ffffff #000000 0 0 0 1 +;; #F07178 #000000 0 0 0 1 [ (self) (super) ] @variable.builtin -;; #ffffff #000000 0 0 0 1 +;; #D2A6FF #000000 0 0 0 1 (method_parameters (identifier) @variable.parameter) @@ -196,7 +186,7 @@ (keyword_parameter (identifier) @variable.parameter) -;; #aad84c #000000 0 0 0 1 +;; #AAD94C #000000 0 0 0 1 [ (string_content) (heredoc_content) @@ -204,13 +194,13 @@ "`" ] @string -;; #fbb152 #000000 0 0 0 1 +;; #E6C08A #000000 0 0 0 1 [ (heredoc_beginning) (heredoc_end) ] @label -;; #bd9ae6 #000000 0 0 0 2 +;; #39BAE6 #000000 0 0 0 2 [ (bare_symbol) (simple_symbol) @@ -218,38 +208,38 @@ (hash_key_symbol) ] @string.special.symbol -;; #e6a24c #000000 0 0 0 2 +;; #95E6CB #000000 0 0 0 2 (regex (string_content) @string.regexp) -;; #e6a24c #000000 0 0 0 2 +;; #95E6CB #000000 0 0 0 2 (escape_sequence) @string.escape -;; #ebda8c #000000 0 0 0 2 +;; #D2A6FF #000000 0 0 0 2 (integer) @number -;; #ebda8c #000000 0 0 0 2 +;; #D2A6FF #000000 0 0 0 2 (float) @number.float -;; #51eeba #000000 0 0 0 1 +;; #D2A6FF #000000 0 0 0 1 (true) @boolean.true -;; #ee513a #000000 0 0 0 1 +;; #D2A6FF #000000 0 0 0 1 (false) @boolean.false -;; #ee8757 #000000 0 0 0 1 +;; #D2A6FF #000000 0 0 0 1 (nil) @constant.nil -;; #AAAAAA #000000 0 1 0 1 +;; #99ADBF #000000 0 1 0 1 (comment) @comment -;; #51eeba #000000 0 0 0 3 +;; #AAD94C #000000 0 0 0 3 ((program . (comment) @shebang @nospell) (#match? @shebang "^#!/")) -;; #ffffff #000000 0 0 0 1 +;; #F29668 #000000 0 0 0 1 [ "!" "=" @@ -277,7 +267,7 @@ ":" ] @operator -;; #ffffff #000000 0 1 0 1 +;; #F29668 #000000 0 1 0 1 [ "==" "===" @@ -295,7 +285,7 @@ "..." ] @operator.ligature -;; #bd9ae6 #000000 0 0 0 1 +;; #BFBDB6 #000000 0 0 0 1 [ "," ";" @@ -307,7 +297,7 @@ (pair ":" @punctuation.delimiter) -;; #bd9ae6 #000000 0 0 0 1 +;; #BFBDB6 #000000 0 0 0 1 [ "(" ")" @@ -325,7 +315,226 @@ (block_parameters "|" @punctuation.bracket) -;; #e6a24c #000000 0 0 0 2 +;; #7dcfff #000000 0 0 0 2 (interpolation "#{" @punctuation.special "}" @punctuation.special) + +; Injections + +(heredoc_body +;; !bash + (heredoc_content) @bash_injection + ((heredoc_end) @lang + (#match? @lang "BASH")) +) + +(heredoc_body +;; !c + (heredoc_content) @c_injection + ((heredoc_end) @lang + (#match? @lang "C$")) +) + +(heredoc_body +;; !cpp + (heredoc_content) @cpp_injection + ((heredoc_end) @lang + (#match? @lang "CPP")) +) + +(heredoc_body +;; !css + (heredoc_content) @css_injection + ((heredoc_end) @lang + (#match? @lang "CSS")) +) + +(heredoc_body +;; !fish + (heredoc_content) @fish_injection + ((heredoc_end) @lang + (#match? @lang "FISH")) +) + +(heredoc_body +;; !go + (heredoc_content) @go_injection + ((heredoc_end) @lang + (#match? @lang "GO")) +) + +(heredoc_body +;; !haskell + (heredoc_content) @haskell_injection + ((heredoc_end) @lang + (#match? @lang "HASKELL")) +) + +(heredoc_body +;; !html + (heredoc_content) @html_injection + ((heredoc_end) @lang + (#match? @lang "HTML")) +) + +(heredoc_body +;; !javascript + (heredoc_content) @javascript_injection + ((heredoc_end) @lang + (#match? @lang "JAVASCRIPT")) +) + +(heredoc_body +;; !json + (heredoc_content) @json_injection + ((heredoc_end) @lang + (#match? @lang "JSON")) +) + +(heredoc_body +;; !lua + (heredoc_content) @lua_injection + ((heredoc_end) @lang + (#match? @lang "LUA")) +) + +(heredoc_body +;; !make + (heredoc_content) @make_injection + ((heredoc_end) @lang + (#match? @lang "MAKE")) +) + +(heredoc_body +;; !python + (heredoc_content) @python_injection + ((heredoc_end) @lang + (#match? @lang "PYTHON")) +) + +(heredoc_body +;; !ruby + (heredoc_content) @ruby_injection + ((heredoc_end) @lang + (#match? @lang "RUBY")) +) + +(heredoc_body +;; !rust + (heredoc_content) @rust_injection + ((heredoc_end) @lang + (#match? @lang "RUST")) +) + +(heredoc_body +;; !diff + (heredoc_content) @diff_injection + ((heredoc_end) @lang + (#match? @lang "DIFF")) +) + +(heredoc_body +;; !embedded_template + (heredoc_content) @embedded_template_injection + ((heredoc_end) @lang + (#match? @lang "ERB")) +) + +(heredoc_body +;; !gdscript + (heredoc_content) @gdscript_injection + ((heredoc_end) @lang + (#match? @lang "GDSCRIPT")) +) + +(heredoc_body +;; !gitattributes + (heredoc_content) @gitattributes_injection + ((heredoc_end) @lang + (#match? @lang "GITATTRIBUTES")) +) + +(heredoc_body +;; !gitignore + (heredoc_content) @gitignore_injection + ((heredoc_end) @lang + (#match? @lang "GITIGNORE")) +) + +(heredoc_body +;; !gomod + (heredoc_content) @gomod_injection + ((heredoc_end) @lang + (#match? @lang "GOMOD")) +) + +(heredoc_body +;; !ini + (heredoc_content) @ini_injection + ((heredoc_end) @lang + (#match? @lang "INI")) +) + +(heredoc_body +;; !markdown + (heredoc_content) @markdown_injection + ((heredoc_end) @lang + (#match? @lang "MARKDOWN")) +) + +(heredoc_body +;; !nginx + (heredoc_content) @nginx_injection + ((heredoc_end) @lang + (#match? @lang "NGINX")) +) + +(heredoc_body +;; !php + (heredoc_content) @php_injection + ((heredoc_end) @lang + (#match? @lang "PHP")) +) + +(heredoc_body +;; !query + (heredoc_content) @query_injection + ((heredoc_end) @lang + (#match? @lang "QUERY")) +) + +(heredoc_body +;; !regex + (heredoc_content) @regex_injection + ((heredoc_end) @lang + (#match? @lang "REGEX")) +) + +(heredoc_body +;; !sql + (heredoc_content) @sql_injection + ((heredoc_end) @lang + (#match? @lang "SQL")) +) + +(heredoc_body +;; !toml + (heredoc_content) @toml_injection + ((heredoc_end) @lang + (#match? @lang "TOML")) +) + +(heredoc_body +;; !yaml + (heredoc_content) @yaml_injection + ((heredoc_end) @lang + (#match? @lang "YAML")) +) + +(heredoc_body +;; !cabal + (heredoc_content) @cabal_injection + ((heredoc_end) @lang + (#match? @lang "CABAL")) +) diff --git a/include/maps.h b/include/maps.h index 0f2968f..c8f55e0 100644 --- a/include/maps.h +++ b/include/maps.h @@ -23,7 +23,7 @@ static const std::unordered_map kLsps = { static const std::unordered_map kLanguages = { {"bash", {"bash", LANG(bash)}}, - {"c", {"c", LANG(c), 1}}, + {"c", {"c", LANG(cpp), 1}}, {"cpp", {"cpp", LANG(cpp), 1}}, {"h", {"h", LANG(cpp), 1}}, {"css", {"css", LANG(css)}}, diff --git a/include/ts_def.h b/include/ts_def.h index 6fa6f69..e6a9cdc 100644 --- a/include/ts_def.h +++ b/include/ts_def.h @@ -13,7 +13,6 @@ struct Language { }; TS_DEF(bash); -TS_DEF(c); TS_DEF(cpp); TS_DEF(css); TS_DEF(fish); diff --git a/libs/tree-sitter-c b/libs/tree-sitter-c deleted file mode 160000 index ae19b67..0000000 --- a/libs/tree-sitter-c +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ae19b676b13bdcc13b7665397e6d9b14975473dd diff --git a/samples/bash.sh b/samples/bash.sh index 0d5cba4..10e5bc6 100644 --- a/samples/bash.sh +++ b/samples/bash.sh @@ -28,12 +28,13 @@ handle_error() { trap 'handle_error $LINENO' ERR # Multiline string test -read -r -d '' MULTI <<'EOF' -This is a multi-line -string used to test -syntax highlighting for -here-documents. -EOF +read -r -d '' MULTI <<'CPP' + +int main() { + +} + +CPP log INFO "Multi-line string loaded"