add markdown parsing + latex + tree-sitter highlighting for codeblocks in llm responses
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
; Vendored from bash (MIT License)
|
||||
; Source: https://github.com/tree-sitter/tree-sitter-bash
|
||||
|
||||
[
|
||||
(string)
|
||||
(raw_string)
|
||||
(heredoc_body)
|
||||
(heredoc_start)
|
||||
] @string
|
||||
|
||||
(command_name) @function
|
||||
|
||||
(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 "^-")
|
||||
)
|
||||
@@ -0,0 +1,84 @@
|
||||
; Vendored from c (MIT License)
|
||||
; Source: https://github.com/tree-sitter/tree-sitter-c
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
((identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z\\d_]*$"))
|
||||
|
||||
"break" @keyword
|
||||
"case" @keyword
|
||||
"const" @keyword
|
||||
"continue" @keyword
|
||||
"default" @keyword
|
||||
"do" @keyword
|
||||
"else" @keyword
|
||||
"enum" @keyword
|
||||
"extern" @keyword
|
||||
"for" @keyword
|
||||
"if" @keyword
|
||||
"inline" @keyword
|
||||
"return" @keyword
|
||||
"sizeof" @keyword
|
||||
"static" @keyword
|
||||
"struct" @keyword
|
||||
"switch" @keyword
|
||||
"typedef" @keyword
|
||||
"union" @keyword
|
||||
"volatile" @keyword
|
||||
"while" @keyword
|
||||
|
||||
"#define" @keyword
|
||||
"#elif" @keyword
|
||||
"#else" @keyword
|
||||
"#endif" @keyword
|
||||
"#if" @keyword
|
||||
"#ifdef" @keyword
|
||||
"#ifndef" @keyword
|
||||
"#include" @keyword
|
||||
(preproc_directive) @keyword
|
||||
|
||||
"--" @operator
|
||||
"-" @operator
|
||||
"-=" @operator
|
||||
"->" @operator
|
||||
"=" @operator
|
||||
"!=" @operator
|
||||
"*" @operator
|
||||
"&" @operator
|
||||
"&&" @operator
|
||||
"+" @operator
|
||||
"++" @operator
|
||||
"+=" @operator
|
||||
"<" @operator
|
||||
"==" @operator
|
||||
">" @operator
|
||||
"||" @operator
|
||||
|
||||
"." @delimiter
|
||||
";" @delimiter
|
||||
|
||||
(string_literal) @string
|
||||
(system_lib_string) @string
|
||||
|
||||
(null) @constant
|
||||
(number_literal) @number
|
||||
(char_literal) @number
|
||||
|
||||
(field_identifier) @property
|
||||
(statement_identifier) @label
|
||||
(type_identifier) @type
|
||||
(primitive_type) @type
|
||||
(sized_type_specifier) @type
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function)
|
||||
(call_expression
|
||||
function: (field_expression
|
||||
field: (field_identifier) @function))
|
||||
(function_declarator
|
||||
declarator: (identifier) @function)
|
||||
(preproc_function_def
|
||||
name: (identifier) @function.special)
|
||||
|
||||
(comment) @comment
|
||||
@@ -0,0 +1,73 @@
|
||||
; Vendored from cpp (MIT License)
|
||||
; Source: https://github.com/tree-sitter/tree-sitter-cpp (tag v0.23.4, matching the distro grammar)
|
||||
|
||||
; Functions
|
||||
|
||||
(call_expression
|
||||
function: (qualified_identifier
|
||||
name: (identifier) @function))
|
||||
|
||||
(template_function
|
||||
name: (identifier) @function)
|
||||
|
||||
(template_method
|
||||
name: (field_identifier) @function)
|
||||
|
||||
(template_function
|
||||
name: (identifier) @function)
|
||||
|
||||
(function_declarator
|
||||
declarator: (qualified_identifier
|
||||
name: (identifier) @function))
|
||||
|
||||
(function_declarator
|
||||
declarator: (field_identifier) @function)
|
||||
|
||||
; Types
|
||||
|
||||
((namespace_identifier) @type
|
||||
(#match? @type "^[A-Z]"))
|
||||
|
||||
(auto) @type
|
||||
|
||||
; Constants
|
||||
|
||||
(this) @variable.builtin
|
||||
(null "nullptr" @constant)
|
||||
|
||||
; Keywords
|
||||
|
||||
[
|
||||
"catch"
|
||||
"class"
|
||||
"co_await"
|
||||
"co_return"
|
||||
"co_yield"
|
||||
"constexpr"
|
||||
"constinit"
|
||||
"consteval"
|
||||
"delete"
|
||||
"explicit"
|
||||
"final"
|
||||
"friend"
|
||||
"mutable"
|
||||
"namespace"
|
||||
"noexcept"
|
||||
"new"
|
||||
"override"
|
||||
"private"
|
||||
"protected"
|
||||
"public"
|
||||
"template"
|
||||
"throw"
|
||||
"try"
|
||||
"typename"
|
||||
"using"
|
||||
"concept"
|
||||
"requires"
|
||||
"virtual"
|
||||
] @keyword
|
||||
|
||||
; Strings
|
||||
|
||||
(raw_string_literal) @string
|
||||
@@ -0,0 +1,126 @@
|
||||
; Vendored from go (MIT License)
|
||||
; Source: https://github.com/tree-sitter/tree-sitter-go
|
||||
|
||||
; Function calls
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function)
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function.builtin
|
||||
(#match? @function.builtin "^(append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover)$"))
|
||||
|
||||
(call_expression
|
||||
function: (selector_expression
|
||||
field: (field_identifier) @function.method))
|
||||
|
||||
; Function definitions
|
||||
|
||||
(function_declaration
|
||||
name: (identifier) @function)
|
||||
|
||||
(method_declaration
|
||||
name: (field_identifier) @function.method)
|
||||
|
||||
; Identifiers
|
||||
|
||||
(type_identifier) @type
|
||||
(field_identifier) @property
|
||||
(identifier) @variable
|
||||
|
||||
; Operators
|
||||
|
||||
[
|
||||
"--"
|
||||
"-"
|
||||
"-="
|
||||
":="
|
||||
"!"
|
||||
"!="
|
||||
"..."
|
||||
"*"
|
||||
"*"
|
||||
"*="
|
||||
"/"
|
||||
"/="
|
||||
"&"
|
||||
"&&"
|
||||
"&="
|
||||
"%"
|
||||
"%="
|
||||
"^"
|
||||
"^="
|
||||
"+"
|
||||
"++"
|
||||
"+="
|
||||
"<-"
|
||||
"<"
|
||||
"<<"
|
||||
"<<="
|
||||
"<="
|
||||
"="
|
||||
"=="
|
||||
">"
|
||||
">="
|
||||
">>"
|
||||
">>="
|
||||
"|"
|
||||
"|="
|
||||
"||"
|
||||
"~"
|
||||
] @operator
|
||||
|
||||
; Keywords
|
||||
|
||||
[
|
||||
"break"
|
||||
"case"
|
||||
"chan"
|
||||
"const"
|
||||
"continue"
|
||||
"default"
|
||||
"defer"
|
||||
"else"
|
||||
"fallthrough"
|
||||
"for"
|
||||
"func"
|
||||
"go"
|
||||
"goto"
|
||||
"if"
|
||||
"import"
|
||||
"interface"
|
||||
"map"
|
||||
"package"
|
||||
"range"
|
||||
"return"
|
||||
"select"
|
||||
"struct"
|
||||
"switch"
|
||||
"type"
|
||||
"var"
|
||||
] @keyword
|
||||
|
||||
; Literals
|
||||
|
||||
[
|
||||
(interpreted_string_literal)
|
||||
(raw_string_literal)
|
||||
(rune_literal)
|
||||
] @string
|
||||
|
||||
(escape_sequence) @escape
|
||||
|
||||
[
|
||||
(int_literal)
|
||||
(float_literal)
|
||||
(imaginary_literal)
|
||||
] @number
|
||||
|
||||
[
|
||||
(true)
|
||||
(false)
|
||||
(nil)
|
||||
(iota)
|
||||
] @constant.builtin
|
||||
|
||||
(comment) @comment
|
||||
@@ -0,0 +1,207 @@
|
||||
; Vendored from javascript (MIT License)
|
||||
; Source: https://github.com/tree-sitter/tree-sitter-javascript
|
||||
|
||||
; Variables
|
||||
;----------
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
; Properties
|
||||
;-----------
|
||||
|
||||
(property_identifier) @property
|
||||
|
||||
; Function and method definitions
|
||||
;--------------------------------
|
||||
|
||||
(function_expression
|
||||
name: (identifier) @function)
|
||||
(function_declaration
|
||||
name: (identifier) @function)
|
||||
(method_definition
|
||||
name: (property_identifier) @function.method)
|
||||
|
||||
(pair
|
||||
key: (property_identifier) @function.method
|
||||
value: [(function_expression) (arrow_function)])
|
||||
|
||||
(assignment_expression
|
||||
left: (member_expression
|
||||
property: (property_identifier) @function.method)
|
||||
right: [(function_expression) (arrow_function)])
|
||||
|
||||
(variable_declarator
|
||||
name: (identifier) @function
|
||||
value: [(function_expression) (arrow_function)])
|
||||
|
||||
(assignment_expression
|
||||
left: (identifier) @function
|
||||
right: [(function_expression) (arrow_function)])
|
||||
|
||||
; Function and method calls
|
||||
;--------------------------
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function)
|
||||
|
||||
(call_expression
|
||||
function: (member_expression
|
||||
property: (property_identifier) @function.method))
|
||||
|
||||
; Special identifiers
|
||||
;--------------------
|
||||
|
||||
((identifier) @constructor
|
||||
(#match? @constructor "^[A-Z]"))
|
||||
|
||||
([
|
||||
(identifier)
|
||||
(shorthand_property_identifier)
|
||||
(shorthand_property_identifier_pattern)
|
||||
] @constant
|
||||
(#match? @constant "^[A-Z_][A-Z\\d_]+$"))
|
||||
|
||||
((identifier) @variable.builtin
|
||||
(#match? @variable.builtin "^(arguments|module|console|window|document)$")
|
||||
(#is-not? local))
|
||||
|
||||
((identifier) @function.builtin
|
||||
(#eq? @function.builtin "require")
|
||||
(#is-not? local))
|
||||
|
||||
; Literals
|
||||
;---------
|
||||
|
||||
(this) @variable.builtin
|
||||
(super) @variable.builtin
|
||||
|
||||
[
|
||||
(true)
|
||||
(false)
|
||||
(null)
|
||||
(undefined)
|
||||
] @constant.builtin
|
||||
|
||||
(comment) @comment
|
||||
|
||||
[
|
||||
(string)
|
||||
(template_string)
|
||||
] @string
|
||||
|
||||
(regex) @string.special
|
||||
(number) @number
|
||||
|
||||
; Tokens
|
||||
;-------
|
||||
|
||||
[
|
||||
";"
|
||||
(optional_chain)
|
||||
"."
|
||||
","
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"-"
|
||||
"--"
|
||||
"-="
|
||||
"+"
|
||||
"++"
|
||||
"+="
|
||||
"*"
|
||||
"*="
|
||||
"**"
|
||||
"**="
|
||||
"/"
|
||||
"/="
|
||||
"%"
|
||||
"%="
|
||||
"<"
|
||||
"<="
|
||||
"<<"
|
||||
"<<="
|
||||
"="
|
||||
"=="
|
||||
"==="
|
||||
"!"
|
||||
"!="
|
||||
"!=="
|
||||
"=>"
|
||||
">"
|
||||
">="
|
||||
">>"
|
||||
">>="
|
||||
">>>"
|
||||
">>>="
|
||||
"~"
|
||||
"^"
|
||||
"&"
|
||||
"|"
|
||||
"^="
|
||||
"&="
|
||||
"|="
|
||||
"&&"
|
||||
"||"
|
||||
"??"
|
||||
"&&="
|
||||
"||="
|
||||
"??="
|
||||
] @operator
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
(template_substitution
|
||||
"${" @punctuation.special
|
||||
"}" @punctuation.special) @embedded
|
||||
|
||||
[
|
||||
"as"
|
||||
"async"
|
||||
"await"
|
||||
"break"
|
||||
"case"
|
||||
"catch"
|
||||
"class"
|
||||
"const"
|
||||
"continue"
|
||||
"debugger"
|
||||
"default"
|
||||
"delete"
|
||||
"do"
|
||||
"else"
|
||||
"export"
|
||||
"extends"
|
||||
"finally"
|
||||
"for"
|
||||
"from"
|
||||
"function"
|
||||
"get"
|
||||
"if"
|
||||
"import"
|
||||
"in"
|
||||
"instanceof"
|
||||
"let"
|
||||
"new"
|
||||
"of"
|
||||
"return"
|
||||
"set"
|
||||
"static"
|
||||
"switch"
|
||||
"target"
|
||||
"throw"
|
||||
"try"
|
||||
"typeof"
|
||||
"var"
|
||||
"void"
|
||||
"while"
|
||||
"with"
|
||||
"yield"
|
||||
] @keyword
|
||||
@@ -0,0 +1,19 @@
|
||||
; Vendored from json (MIT License)
|
||||
; Source: https://github.com/tree-sitter/tree-sitter-json
|
||||
|
||||
(pair
|
||||
key: (_) @string.special.key)
|
||||
|
||||
(string) @string
|
||||
|
||||
(number) @number
|
||||
|
||||
[
|
||||
(null)
|
||||
(true)
|
||||
(false)
|
||||
] @constant.builtin
|
||||
|
||||
(escape_sequence) @escape
|
||||
|
||||
(comment) @comment
|
||||
@@ -0,0 +1,140 @@
|
||||
; Vendored from python (MIT License)
|
||||
; Source: https://github.com/tree-sitter/tree-sitter-python
|
||||
|
||||
; Identifier naming conventions
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
((identifier) @constructor
|
||||
(#match? @constructor "^[A-Z]"))
|
||||
|
||||
((identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z_]*$"))
|
||||
|
||||
; Function calls
|
||||
|
||||
(decorator) @function
|
||||
(decorator
|
||||
(identifier) @function)
|
||||
|
||||
(call
|
||||
function: (attribute attribute: (identifier) @function.method))
|
||||
(call
|
||||
function: (identifier) @function)
|
||||
|
||||
; Builtin functions
|
||||
|
||||
((call
|
||||
function: (identifier) @function.builtin)
|
||||
(#match?
|
||||
@function.builtin
|
||||
"^(abs|all|any|ascii|bin|bool|breakpoint|bytearray|bytes|callable|chr|classmethod|compile|complex|delattr|dict|dir|divmod|enumerate|eval|exec|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|isinstance|issubclass|iter|len|list|locals|map|max|memoryview|min|next|object|oct|open|ord|pow|print|property|range|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|vars|zip|__import__)$"))
|
||||
|
||||
; Function definitions
|
||||
|
||||
(function_definition
|
||||
name: (identifier) @function)
|
||||
|
||||
(attribute attribute: (identifier) @property)
|
||||
(type (identifier) @type)
|
||||
|
||||
; Literals
|
||||
|
||||
[
|
||||
(none)
|
||||
(true)
|
||||
(false)
|
||||
] @constant.builtin
|
||||
|
||||
[
|
||||
(integer)
|
||||
(float)
|
||||
] @number
|
||||
|
||||
(comment) @comment
|
||||
(string) @string
|
||||
(escape_sequence) @escape
|
||||
|
||||
(interpolation
|
||||
"{" @punctuation.special
|
||||
"}" @punctuation.special) @embedded
|
||||
|
||||
[
|
||||
"-"
|
||||
"-="
|
||||
"!="
|
||||
"*"
|
||||
"**"
|
||||
"**="
|
||||
"*="
|
||||
"/"
|
||||
"//"
|
||||
"//="
|
||||
"/="
|
||||
"&"
|
||||
"&="
|
||||
"%"
|
||||
"%="
|
||||
"^"
|
||||
"^="
|
||||
"+"
|
||||
"->"
|
||||
"+="
|
||||
"<"
|
||||
"<<"
|
||||
"<<="
|
||||
"<="
|
||||
"<>"
|
||||
"="
|
||||
":="
|
||||
"=="
|
||||
">"
|
||||
">="
|
||||
">>"
|
||||
">>="
|
||||
"|"
|
||||
"|="
|
||||
"~"
|
||||
"@="
|
||||
"and"
|
||||
"in"
|
||||
"is"
|
||||
"not"
|
||||
"or"
|
||||
"is not"
|
||||
"not in"
|
||||
] @operator
|
||||
|
||||
[
|
||||
"as"
|
||||
"assert"
|
||||
"async"
|
||||
"await"
|
||||
"break"
|
||||
"class"
|
||||
"continue"
|
||||
"def"
|
||||
"del"
|
||||
"elif"
|
||||
"else"
|
||||
"except"
|
||||
"exec"
|
||||
"finally"
|
||||
"for"
|
||||
"from"
|
||||
"global"
|
||||
"if"
|
||||
"import"
|
||||
"lambda"
|
||||
"nonlocal"
|
||||
"pass"
|
||||
"print"
|
||||
"raise"
|
||||
"return"
|
||||
"try"
|
||||
"while"
|
||||
"with"
|
||||
"yield"
|
||||
"match"
|
||||
"case"
|
||||
] @keyword
|
||||
@@ -0,0 +1,164 @@
|
||||
; Vendored from rust (MIT License)
|
||||
; Source: https://github.com/tree-sitter/tree-sitter-rust
|
||||
|
||||
; Identifiers
|
||||
|
||||
(type_identifier) @type
|
||||
(primitive_type) @type.builtin
|
||||
(field_identifier) @property
|
||||
|
||||
; Identifier conventions
|
||||
|
||||
; Assume all-caps names are constants
|
||||
((identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z\\d_]+$'"))
|
||||
|
||||
; Assume uppercase names are enum constructors
|
||||
((identifier) @constructor
|
||||
(#match? @constructor "^[A-Z]"))
|
||||
|
||||
; Assume that uppercase names in paths are types
|
||||
((scoped_identifier
|
||||
path: (identifier) @type)
|
||||
(#match? @type "^[A-Z]"))
|
||||
((scoped_identifier
|
||||
path: (scoped_identifier
|
||||
name: (identifier) @type))
|
||||
(#match? @type "^[A-Z]"))
|
||||
((scoped_type_identifier
|
||||
path: (identifier) @type)
|
||||
(#match? @type "^[A-Z]"))
|
||||
((scoped_type_identifier
|
||||
path: (scoped_identifier
|
||||
name: (identifier) @type))
|
||||
(#match? @type "^[A-Z]"))
|
||||
|
||||
; Assume all qualified names in struct patterns are enum constructors. (They're
|
||||
; either that, or struct names; highlighting both as constructors seems to be
|
||||
; the less glaring choice of error, visually.)
|
||||
(struct_pattern
|
||||
type: (scoped_type_identifier
|
||||
name: (type_identifier) @constructor))
|
||||
|
||||
; Function calls
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function)
|
||||
(call_expression
|
||||
function: (field_expression
|
||||
field: (field_identifier) @function.method))
|
||||
(call_expression
|
||||
function: (scoped_identifier
|
||||
"::"
|
||||
name: (identifier) @function))
|
||||
|
||||
(generic_function
|
||||
function: (identifier) @function)
|
||||
(generic_function
|
||||
function: (scoped_identifier
|
||||
name: (identifier) @function))
|
||||
(generic_function
|
||||
function: (field_expression
|
||||
field: (field_identifier) @function.method))
|
||||
|
||||
(macro_invocation
|
||||
macro: (identifier) @function.macro
|
||||
"!" @function.macro)
|
||||
|
||||
; Function definitions
|
||||
|
||||
(function_item (identifier) @function)
|
||||
(function_signature_item (identifier) @function)
|
||||
|
||||
(line_comment) @comment
|
||||
(block_comment) @comment
|
||||
|
||||
(line_comment (doc_comment)) @comment.documentation
|
||||
(block_comment (doc_comment)) @comment.documentation
|
||||
|
||||
"(" @punctuation.bracket
|
||||
")" @punctuation.bracket
|
||||
"[" @punctuation.bracket
|
||||
"]" @punctuation.bracket
|
||||
"{" @punctuation.bracket
|
||||
"}" @punctuation.bracket
|
||||
|
||||
(type_arguments
|
||||
"<" @punctuation.bracket
|
||||
">" @punctuation.bracket)
|
||||
(type_parameters
|
||||
"<" @punctuation.bracket
|
||||
">" @punctuation.bracket)
|
||||
|
||||
"::" @punctuation.delimiter
|
||||
":" @punctuation.delimiter
|
||||
"." @punctuation.delimiter
|
||||
"," @punctuation.delimiter
|
||||
";" @punctuation.delimiter
|
||||
|
||||
(parameter (identifier) @variable.parameter)
|
||||
|
||||
(lifetime (identifier) @label)
|
||||
|
||||
"as" @keyword
|
||||
"async" @keyword
|
||||
"await" @keyword
|
||||
"break" @keyword
|
||||
"const" @keyword
|
||||
"continue" @keyword
|
||||
"default" @keyword
|
||||
"dyn" @keyword
|
||||
"else" @keyword
|
||||
"enum" @keyword
|
||||
"extern" @keyword
|
||||
"fn" @keyword
|
||||
"for" @keyword
|
||||
"gen" @keyword
|
||||
"if" @keyword
|
||||
"impl" @keyword
|
||||
"in" @keyword
|
||||
"let" @keyword
|
||||
"loop" @keyword
|
||||
"macro_rules!" @keyword
|
||||
"match" @keyword
|
||||
"mod" @keyword
|
||||
"move" @keyword
|
||||
"pub" @keyword
|
||||
"raw" @keyword
|
||||
"ref" @keyword
|
||||
"return" @keyword
|
||||
"static" @keyword
|
||||
"struct" @keyword
|
||||
"trait" @keyword
|
||||
"type" @keyword
|
||||
"union" @keyword
|
||||
"unsafe" @keyword
|
||||
"use" @keyword
|
||||
"where" @keyword
|
||||
"while" @keyword
|
||||
"yield" @keyword
|
||||
(crate) @keyword
|
||||
(mutable_specifier) @keyword
|
||||
(use_list (self) @keyword)
|
||||
(scoped_use_list (self) @keyword)
|
||||
(scoped_identifier (self) @keyword)
|
||||
(super) @keyword
|
||||
|
||||
(self) @variable.builtin
|
||||
|
||||
(char_literal) @string
|
||||
(string_literal) @string
|
||||
(raw_string_literal) @string
|
||||
|
||||
(boolean_literal) @constant.builtin
|
||||
(integer_literal) @constant.builtin
|
||||
(float_literal) @constant.builtin
|
||||
|
||||
(escape_sequence) @escape
|
||||
|
||||
(attribute_item) @attribute
|
||||
(inner_attribute_item) @attribute
|
||||
|
||||
"*" @operator
|
||||
"&" @operator
|
||||
"'" @operator
|
||||
@@ -0,0 +1,463 @@
|
||||
; Vendored from sql (MIT License)
|
||||
; Source: https://github.com/DerekStride/tree-sitter-sql
|
||||
|
||||
(object_reference
|
||||
name: (identifier) @type)
|
||||
|
||||
(invocation
|
||||
(object_reference
|
||||
name: (identifier) @function.call))
|
||||
|
||||
[
|
||||
(keyword_gist)
|
||||
(keyword_btree)
|
||||
(keyword_hash)
|
||||
(keyword_spgist)
|
||||
(keyword_gin)
|
||||
(keyword_brin)
|
||||
(keyword_array)
|
||||
(keyword_object_id)
|
||||
] @function.call
|
||||
|
||||
(relation
|
||||
alias: (identifier) @variable)
|
||||
|
||||
(field
|
||||
name: (identifier) @field)
|
||||
|
||||
(term
|
||||
alias: (identifier) @variable)
|
||||
|
||||
((term
|
||||
value: (cast
|
||||
name: (keyword_cast) @function.call
|
||||
parameter: [(literal)]?)))
|
||||
|
||||
(literal) @string
|
||||
(comment) @comment @spell
|
||||
(marginalia) @comment
|
||||
|
||||
((literal) @number
|
||||
(#match? @number "^[-+]?%d+$"))
|
||||
|
||||
((literal) @float
|
||||
(#match? @float "^[-+]?%d*\.%d*$"))
|
||||
|
||||
(parameter) @parameter
|
||||
|
||||
[
|
||||
(keyword_true)
|
||||
(keyword_false)
|
||||
] @boolean
|
||||
|
||||
[
|
||||
(keyword_asc)
|
||||
(keyword_desc)
|
||||
(keyword_terminated)
|
||||
(keyword_escaped)
|
||||
(keyword_unsigned)
|
||||
(keyword_nulls)
|
||||
(keyword_last)
|
||||
(keyword_delimited)
|
||||
(keyword_replication)
|
||||
(keyword_auto_increment)
|
||||
(keyword_default)
|
||||
(keyword_collate)
|
||||
(keyword_concurrently)
|
||||
(keyword_engine)
|
||||
(keyword_always)
|
||||
(keyword_generated)
|
||||
(keyword_preceding)
|
||||
(keyword_following)
|
||||
(keyword_first)
|
||||
(keyword_current_timestamp)
|
||||
(keyword_immutable)
|
||||
(keyword_atomic)
|
||||
(keyword_parallel)
|
||||
(keyword_leakproof)
|
||||
(keyword_safe)
|
||||
(keyword_cost)
|
||||
(keyword_strict)
|
||||
] @attribute
|
||||
|
||||
[
|
||||
(keyword_materialized)
|
||||
(keyword_recursive)
|
||||
(keyword_temp)
|
||||
(keyword_temporary)
|
||||
(keyword_unlogged)
|
||||
(keyword_external)
|
||||
(keyword_parquet)
|
||||
(keyword_csv)
|
||||
(keyword_rcfile)
|
||||
(keyword_textfile)
|
||||
(keyword_orc)
|
||||
(keyword_avro)
|
||||
(keyword_jsonfile)
|
||||
(keyword_sequencefile)
|
||||
(keyword_volatile)
|
||||
] @storageclass
|
||||
|
||||
[
|
||||
(keyword_case)
|
||||
(keyword_when)
|
||||
(keyword_then)
|
||||
(keyword_else)
|
||||
] @conditional
|
||||
|
||||
[
|
||||
(keyword_select)
|
||||
(keyword_from)
|
||||
(keyword_where)
|
||||
(keyword_index)
|
||||
(keyword_join)
|
||||
(keyword_primary)
|
||||
(keyword_delete)
|
||||
(keyword_create)
|
||||
(keyword_show)
|
||||
(keyword_unload)
|
||||
(keyword_insert)
|
||||
(keyword_merge)
|
||||
(keyword_distinct)
|
||||
(keyword_replace)
|
||||
(keyword_update)
|
||||
(keyword_into)
|
||||
(keyword_overwrite)
|
||||
(keyword_matched)
|
||||
(keyword_values)
|
||||
(keyword_value)
|
||||
(keyword_attribute)
|
||||
(keyword_set)
|
||||
(keyword_left)
|
||||
(keyword_right)
|
||||
(keyword_outer)
|
||||
(keyword_inner)
|
||||
(keyword_full)
|
||||
(keyword_order)
|
||||
(keyword_partition)
|
||||
(keyword_group)
|
||||
(keyword_with)
|
||||
(keyword_without)
|
||||
(keyword_as)
|
||||
(keyword_having)
|
||||
(keyword_limit)
|
||||
(keyword_offset)
|
||||
(keyword_table)
|
||||
(keyword_tables)
|
||||
(keyword_key)
|
||||
(keyword_references)
|
||||
(keyword_foreign)
|
||||
(keyword_constraint)
|
||||
(keyword_force)
|
||||
(keyword_use)
|
||||
(keyword_include)
|
||||
(keyword_for)
|
||||
(keyword_if)
|
||||
(keyword_exists)
|
||||
(keyword_column)
|
||||
(keyword_columns)
|
||||
(keyword_cross)
|
||||
(keyword_lateral)
|
||||
(keyword_natural)
|
||||
(keyword_alter)
|
||||
(keyword_drop)
|
||||
(keyword_add)
|
||||
(keyword_view)
|
||||
(keyword_end)
|
||||
(keyword_is)
|
||||
(keyword_using)
|
||||
(keyword_between)
|
||||
(keyword_window)
|
||||
(keyword_no)
|
||||
(keyword_data)
|
||||
(keyword_type)
|
||||
(keyword_rename)
|
||||
(keyword_refresh)
|
||||
(keyword_to)
|
||||
(keyword_schema)
|
||||
(keyword_owner)
|
||||
(keyword_authorization)
|
||||
(keyword_all)
|
||||
(keyword_any)
|
||||
(keyword_some)
|
||||
(keyword_returning)
|
||||
(keyword_begin)
|
||||
(keyword_commit)
|
||||
(keyword_rollback)
|
||||
(keyword_transaction)
|
||||
(keyword_only)
|
||||
(keyword_like)
|
||||
(keyword_rlike)
|
||||
(keyword_similar)
|
||||
(keyword_over)
|
||||
(keyword_change)
|
||||
(keyword_modify)
|
||||
(keyword_after)
|
||||
(keyword_before)
|
||||
(keyword_range)
|
||||
(keyword_rows)
|
||||
(keyword_groups)
|
||||
(keyword_exclude)
|
||||
(keyword_current)
|
||||
(keyword_ties)
|
||||
(keyword_others)
|
||||
(keyword_zerofill)
|
||||
(keyword_format)
|
||||
(keyword_fields)
|
||||
(keyword_row)
|
||||
(keyword_sort)
|
||||
(keyword_compute)
|
||||
(keyword_comment)
|
||||
(keyword_location)
|
||||
(keyword_cached)
|
||||
(keyword_uncached)
|
||||
(keyword_lines)
|
||||
(keyword_stored)
|
||||
(keyword_virtual)
|
||||
(keyword_partitioned)
|
||||
(keyword_analyze)
|
||||
(keyword_explain)
|
||||
(keyword_verbose)
|
||||
(keyword_truncate)
|
||||
(keyword_rewrite)
|
||||
(keyword_optimize)
|
||||
(keyword_vacuum)
|
||||
(keyword_cache)
|
||||
(keyword_language)
|
||||
(keyword_called)
|
||||
(keyword_conflict)
|
||||
(keyword_declare)
|
||||
(keyword_filter)
|
||||
(keyword_function)
|
||||
(keyword_input)
|
||||
(keyword_name)
|
||||
(keyword_oid)
|
||||
(keyword_oids)
|
||||
(keyword_precision)
|
||||
(keyword_regclass)
|
||||
(keyword_regnamespace)
|
||||
(keyword_regproc)
|
||||
(keyword_regtype)
|
||||
(keyword_restricted)
|
||||
(keyword_return)
|
||||
(keyword_returns)
|
||||
(keyword_separator)
|
||||
(keyword_setof)
|
||||
(keyword_stable)
|
||||
(keyword_support)
|
||||
(keyword_tblproperties)
|
||||
(keyword_trigger)
|
||||
(keyword_unsafe)
|
||||
(keyword_admin)
|
||||
(keyword_connection)
|
||||
(keyword_cycle)
|
||||
(keyword_database)
|
||||
(keyword_encrypted)
|
||||
(keyword_increment)
|
||||
(keyword_logged)
|
||||
(keyword_none)
|
||||
(keyword_owned)
|
||||
(keyword_password)
|
||||
(keyword_reset)
|
||||
(keyword_role)
|
||||
(keyword_current_role)
|
||||
(keyword_sequence)
|
||||
(keyword_start)
|
||||
(keyword_restart)
|
||||
(keyword_tablespace)
|
||||
(keyword_split)
|
||||
(keyword_tablets)
|
||||
(keyword_until)
|
||||
(keyword_user)
|
||||
(keyword_current_user)
|
||||
(keyword_session_user)
|
||||
(keyword_valid)
|
||||
(keyword_action)
|
||||
(keyword_definer)
|
||||
(keyword_invoker)
|
||||
(keyword_enable)
|
||||
(keyword_disable)
|
||||
(keyword_security)
|
||||
(keyword_policy)
|
||||
(keyword_permissive)
|
||||
(keyword_restrictive)
|
||||
(keyword_public)
|
||||
(keyword_extension)
|
||||
(keyword_version)
|
||||
(keyword_out)
|
||||
(keyword_inout)
|
||||
(keyword_variadic)
|
||||
(keyword_ordinality)
|
||||
(keyword_session)
|
||||
(keyword_isolation)
|
||||
(keyword_level)
|
||||
(keyword_serializable)
|
||||
(keyword_repeatable)
|
||||
(keyword_read)
|
||||
(keyword_write)
|
||||
(keyword_committed)
|
||||
(keyword_uncommitted)
|
||||
(keyword_deferrable)
|
||||
(keyword_names)
|
||||
(keyword_zone)
|
||||
(keyword_immediate)
|
||||
(keyword_deferred)
|
||||
(keyword_constraints)
|
||||
(keyword_snapshot)
|
||||
(keyword_characteristics)
|
||||
(keyword_off)
|
||||
(keyword_follows)
|
||||
(keyword_precedes)
|
||||
(keyword_each)
|
||||
(keyword_instead)
|
||||
(keyword_of)
|
||||
(keyword_initially)
|
||||
(keyword_old)
|
||||
(keyword_new)
|
||||
(keyword_referencing)
|
||||
(keyword_statement)
|
||||
(keyword_execute)
|
||||
(keyword_procedure)
|
||||
(keyword_copy)
|
||||
(keyword_delimiter)
|
||||
(keyword_encoding)
|
||||
(keyword_escape)
|
||||
(keyword_force_not_null)
|
||||
(keyword_force_null)
|
||||
(keyword_force_quote)
|
||||
(keyword_freeze)
|
||||
(keyword_header)
|
||||
(keyword_match)
|
||||
(keyword_program)
|
||||
(keyword_quote)
|
||||
(keyword_stdin)
|
||||
(keyword_extended)
|
||||
(keyword_main)
|
||||
(keyword_plain)
|
||||
(keyword_storage)
|
||||
(keyword_compression)
|
||||
(keyword_duplicate)
|
||||
(keyword_while)
|
||||
] @keyword
|
||||
|
||||
[
|
||||
(keyword_restrict)
|
||||
(keyword_unbounded)
|
||||
(keyword_unique)
|
||||
(keyword_cascade)
|
||||
(keyword_delayed)
|
||||
(keyword_high_priority)
|
||||
(keyword_low_priority)
|
||||
(keyword_ignore)
|
||||
(keyword_nothing)
|
||||
(keyword_check)
|
||||
(keyword_option)
|
||||
(keyword_local)
|
||||
(keyword_cascaded)
|
||||
(keyword_wait)
|
||||
(keyword_nowait)
|
||||
(keyword_metadata)
|
||||
(keyword_incremental)
|
||||
(keyword_bin_pack)
|
||||
(keyword_noscan)
|
||||
(keyword_stats)
|
||||
(keyword_statistics)
|
||||
(keyword_maxvalue)
|
||||
(keyword_minvalue)
|
||||
] @type.qualifier
|
||||
|
||||
[
|
||||
(keyword_int)
|
||||
(keyword_null)
|
||||
(keyword_boolean)
|
||||
(keyword_binary)
|
||||
(keyword_varbinary)
|
||||
(keyword_image)
|
||||
(keyword_bit)
|
||||
(keyword_inet)
|
||||
(keyword_character)
|
||||
(keyword_smallserial)
|
||||
(keyword_serial)
|
||||
(keyword_bigserial)
|
||||
(keyword_smallint)
|
||||
(keyword_mediumint)
|
||||
(keyword_bigint)
|
||||
(keyword_tinyint)
|
||||
(keyword_decimal)
|
||||
(keyword_float)
|
||||
(keyword_double)
|
||||
(keyword_numeric)
|
||||
(keyword_real)
|
||||
(double)
|
||||
(keyword_money)
|
||||
(keyword_smallmoney)
|
||||
(keyword_char)
|
||||
(keyword_nchar)
|
||||
(keyword_varchar)
|
||||
(keyword_nvarchar)
|
||||
(keyword_varying)
|
||||
(keyword_text)
|
||||
(keyword_string)
|
||||
(keyword_uuid)
|
||||
(keyword_json)
|
||||
(keyword_jsonb)
|
||||
(keyword_xml)
|
||||
(keyword_bytea)
|
||||
(keyword_enum)
|
||||
(keyword_date)
|
||||
(keyword_datetime)
|
||||
(keyword_time)
|
||||
(keyword_datetime2)
|
||||
(keyword_datetimeoffset)
|
||||
(keyword_smalldatetime)
|
||||
(keyword_timestamp)
|
||||
(keyword_timestamptz)
|
||||
(keyword_geometry)
|
||||
(keyword_geography)
|
||||
(keyword_box2d)
|
||||
(keyword_box3d)
|
||||
(keyword_interval)
|
||||
] @type.builtin
|
||||
|
||||
[
|
||||
(keyword_in)
|
||||
(keyword_and)
|
||||
(keyword_or)
|
||||
(keyword_not)
|
||||
(keyword_by)
|
||||
(keyword_on)
|
||||
(keyword_do)
|
||||
(keyword_union)
|
||||
(keyword_except)
|
||||
(keyword_intersect)
|
||||
] @keyword.operator
|
||||
|
||||
[
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"/"
|
||||
"%"
|
||||
"^"
|
||||
":="
|
||||
"="
|
||||
"<"
|
||||
"<="
|
||||
"!="
|
||||
">="
|
||||
">"
|
||||
"<>"
|
||||
(op_other)
|
||||
(op_unary_other)
|
||||
] @operator
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
";"
|
||||
","
|
||||
"."
|
||||
] @punctuation.delimiter
|
||||
@@ -0,0 +1,36 @@
|
||||
; Vendored from toml (MIT License)
|
||||
; Source: https://github.com/tree-sitter/tree-sitter-toml
|
||||
|
||||
; Properties
|
||||
;-----------
|
||||
|
||||
(bare_key) @property
|
||||
(quoted_key) @string
|
||||
|
||||
; Literals
|
||||
;---------
|
||||
|
||||
(boolean) @constant.builtin
|
||||
(comment) @comment
|
||||
(string) @string
|
||||
(integer) @number
|
||||
(float) @number
|
||||
(offset_date_time) @string.special
|
||||
(local_date_time) @string.special
|
||||
(local_date) @string.special
|
||||
(local_time) @string.special
|
||||
|
||||
; Punctuation
|
||||
;------------
|
||||
|
||||
"." @punctuation.delimiter
|
||||
"," @punctuation.delimiter
|
||||
|
||||
"=" @operator
|
||||
|
||||
"[" @punctuation.bracket
|
||||
"]" @punctuation.bracket
|
||||
"[[" @punctuation.bracket
|
||||
"]]" @punctuation.bracket
|
||||
"{" @punctuation.bracket
|
||||
"}" @punctuation.bracket
|
||||
@@ -0,0 +1,38 @@
|
||||
; Vendored from typescript (MIT License)
|
||||
; Source: https://github.com/tree-sitter/tree-sitter-typescript
|
||||
|
||||
; Types
|
||||
|
||||
(type_identifier) @type
|
||||
(predefined_type) @type.builtin
|
||||
|
||||
((identifier) @type
|
||||
(#match? @type "^[A-Z]"))
|
||||
|
||||
(type_arguments
|
||||
"<" @punctuation.bracket
|
||||
">" @punctuation.bracket)
|
||||
|
||||
; Variables
|
||||
|
||||
(required_parameter (identifier) @variable.parameter)
|
||||
(optional_parameter (identifier) @variable.parameter)
|
||||
|
||||
; Keywords
|
||||
|
||||
[ "abstract"
|
||||
"declare"
|
||||
"enum"
|
||||
"export"
|
||||
"implements"
|
||||
"interface"
|
||||
"keyof"
|
||||
"namespace"
|
||||
"private"
|
||||
"protected"
|
||||
"public"
|
||||
"type"
|
||||
"readonly"
|
||||
"override"
|
||||
"satisfies"
|
||||
] @keyword
|
||||
@@ -0,0 +1,82 @@
|
||||
; Vendored from yaml (MIT License)
|
||||
; Source: https://github.com/tree-sitter-grammars/tree-sitter-yaml
|
||||
|
||||
(boolean_scalar) @boolean
|
||||
|
||||
(null_scalar) @constant.builtin
|
||||
|
||||
[
|
||||
(double_quote_scalar)
|
||||
(single_quote_scalar)
|
||||
(block_scalar)
|
||||
(string_scalar)
|
||||
] @string
|
||||
|
||||
[
|
||||
(integer_scalar)
|
||||
(float_scalar)
|
||||
] @number
|
||||
|
||||
(comment) @comment
|
||||
|
||||
[
|
||||
(anchor_name)
|
||||
(alias_name)
|
||||
] @label
|
||||
|
||||
(tag) @type
|
||||
|
||||
[
|
||||
(yaml_directive)
|
||||
(tag_directive)
|
||||
(reserved_directive)
|
||||
] @attribute
|
||||
|
||||
(block_mapping_pair
|
||||
key: (flow_node
|
||||
[
|
||||
(double_quote_scalar)
|
||||
(single_quote_scalar)
|
||||
] @property))
|
||||
|
||||
(block_mapping_pair
|
||||
key: (flow_node
|
||||
(plain_scalar
|
||||
(string_scalar) @property)))
|
||||
|
||||
(flow_mapping
|
||||
(_
|
||||
key: (flow_node
|
||||
[
|
||||
(double_quote_scalar)
|
||||
(single_quote_scalar)
|
||||
] @property)))
|
||||
|
||||
(flow_mapping
|
||||
(_
|
||||
key: (flow_node
|
||||
(plain_scalar
|
||||
(string_scalar) @property))))
|
||||
|
||||
[
|
||||
","
|
||||
"-"
|
||||
":"
|
||||
">"
|
||||
"?"
|
||||
"|"
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
"*"
|
||||
"&"
|
||||
"---"
|
||||
"..."
|
||||
] @punctuation.special
|
||||
Reference in New Issue
Block a user