/* date = July 11th 2025 6:02 pm */ #ifndef TREE_SITTER_BASH_H #define TREE_SITTER_BASH_H // Source: https://github.com/tree-sitter/tree-sitter-bash/blob/master/queries/highlights.scm String_Const_u8 TS_BASH_HIGHLIGHT_QUERY = string_u8_litexpr(R"DONE( [ (string) (raw_string) (heredoc_body) (heredoc_start) ] @string (command_name) @function.call (variable_name) @property [ "case" "do" "done" "elif" "else" "esac" "export" "fi" "for" "function" "if" "in" "select" "then" "unset" "until" "while" ] @keyword (comment) @comment (function_definition name: (word) @function) (file_descriptor) @number [ (command_substitution) (process_substitution) (expansion) ] @embedded [ "$" "&&" ">" ">>" "<" "|" ] @operator ( (command (_) @constant) (#match? @constant "^-") ) )DONE"); extern "C" { TSLanguage* tree_sitter_bash(); } void tree_sitter_register_bash(Application_Links* app) { TSLanguage* language = tree_sitter_bash(); Tree_Sitter_Language_Queries queries = {}; queries.ptr[Tree_Sitter_Language_Query_Highlights] = tree_sitter_query_new(app, language, TS_BASH_HIGHLIGHT_QUERY); tree_sitter_register_language(SCu8("sh"), language, queries, 0); } #endif //TREE_SITTER_BASH_H