250 lines
4.7 KiB
Scheme
250 lines
4.7 KiB
Scheme
; Waltzing Template Highlights
|
|
; Comprehensive query file for tree-sitter-waltzing
|
|
|
|
; ====================
|
|
; KEYWORDS
|
|
; ====================
|
|
|
|
; Template keywords (with @ prefix)
|
|
"@use" @keyword.import
|
|
"@import" @keyword.import
|
|
"@struct" @keyword.type
|
|
"@enum" @keyword.type
|
|
"@func" @keyword.function
|
|
"@if" @keyword.conditional
|
|
"@for" @keyword.repeat
|
|
"@match" @keyword.conditional
|
|
"@break" @keyword.control
|
|
"@continue" @keyword.control
|
|
|
|
; Control flow keywords
|
|
"else" @keyword.conditional
|
|
"if" @keyword.conditional
|
|
"let" @keyword
|
|
"in" @keyword
|
|
"as" @keyword
|
|
"mut" @keyword
|
|
|
|
; Safe output keyword
|
|
"safe" @keyword.function
|
|
|
|
; ====================
|
|
; OPERATORS
|
|
; ====================
|
|
|
|
(binary_operator) @operator
|
|
(unary_operator) @operator
|
|
|
|
; Specific operators
|
|
"=>" @operator
|
|
"=" @operator
|
|
"!" @operator
|
|
"!=" @operator
|
|
"==" @operator
|
|
"<" @operator
|
|
"<=" @operator
|
|
">" @operator
|
|
">=" @operator
|
|
"<<" @operator
|
|
">>" @operator
|
|
"+" @operator
|
|
"-" @operator
|
|
"*" @operator
|
|
"/" @operator
|
|
"%" @operator
|
|
"&" @operator
|
|
"&&" @operator
|
|
"|" @operator
|
|
"||" @operator
|
|
"^" @operator
|
|
".." @operator
|
|
|
|
; ====================
|
|
; PUNCTUATION
|
|
; ====================
|
|
|
|
; Brackets
|
|
"{" @punctuation.bracket
|
|
"}" @punctuation.bracket
|
|
"(" @punctuation.bracket
|
|
")" @punctuation.bracket
|
|
"[" @punctuation.bracket
|
|
"]" @punctuation.bracket
|
|
|
|
; Delimiters
|
|
"," @punctuation.delimiter
|
|
":" @punctuation.delimiter
|
|
";" @punctuation.delimiter
|
|
"." @punctuation.delimiter
|
|
|
|
; Template expression marker
|
|
"@" @punctuation.special
|
|
|
|
; ====================
|
|
; LITERALS
|
|
; ====================
|
|
|
|
(string_literal) @string
|
|
(char_literal) @character
|
|
(integer_literal) @number
|
|
(float_literal) @number
|
|
(boolean_literal) @constant.builtin
|
|
(escape_sequence) @string.escape
|
|
"true" @constant.builtin
|
|
"false" @constant.builtin
|
|
|
|
; ====================
|
|
; TYPES
|
|
; ====================
|
|
|
|
; Primitive types
|
|
(primitive_type) @type.builtin
|
|
"String" @type.builtin
|
|
"bool" @type.builtin
|
|
"char" @type.builtin
|
|
"str" @type.builtin
|
|
"i8" @type.builtin
|
|
"i16" @type.builtin
|
|
"i32" @type.builtin
|
|
"i64" @type.builtin
|
|
"i128" @type.builtin
|
|
"u8" @type.builtin
|
|
"u16" @type.builtin
|
|
"u32" @type.builtin
|
|
"u64" @type.builtin
|
|
"u128" @type.builtin
|
|
"isize" @type.builtin
|
|
"usize" @type.builtin
|
|
"f32" @type.builtin
|
|
"f64" @type.builtin
|
|
|
|
; Generic type parameters
|
|
(generic_params (identifier) @type)
|
|
(generic_type (rust_path) @type)
|
|
|
|
; ====================
|
|
; DEFINITIONS
|
|
; ====================
|
|
|
|
; Struct definitions
|
|
(struct_definition (identifier) @type.definition)
|
|
(struct_field (identifier) @property.definition)
|
|
|
|
; Enum definitions
|
|
(enum_definition (identifier) @type.definition)
|
|
(enum_variant (identifier) @constructor)
|
|
|
|
; Function definitions
|
|
(function_definition (identifier) @function.definition)
|
|
(parameter (identifier) @variable.parameter)
|
|
|
|
; ====================
|
|
; FUNCTION TAGS (Components)
|
|
; ====================
|
|
|
|
(function_path) @function
|
|
(self_closing_function_tag) @tag
|
|
(container_function_tag) @tag
|
|
|
|
; Function tag delimiters
|
|
"<@" @tag.delimiter
|
|
"</@" @tag.delimiter
|
|
"/>" @tag.delimiter
|
|
|
|
; ====================
|
|
; HTML ELEMENTS
|
|
; ====================
|
|
|
|
(tag_name) @tag
|
|
(attribute_name) @attribute
|
|
(attribute_value) @string
|
|
|
|
; HTML tag delimiters
|
|
"<" @tag.delimiter
|
|
">" @tag.delimiter
|
|
"</" @tag.delimiter
|
|
|
|
; ====================
|
|
; PATHS AND IDENTIFIERS
|
|
; ====================
|
|
|
|
; Module paths
|
|
(rust_path) @module
|
|
(use_statement (rust_path) @module)
|
|
(import_statement (string_literal) @string.special)
|
|
|
|
; Expressions
|
|
(expression_path (identifier) @variable)
|
|
(simple_expression (expression_path) @variable)
|
|
(field_access (identifier) @property)
|
|
(method_call (identifier) @function.method)
|
|
|
|
; ====================
|
|
; PATTERNS
|
|
; ====================
|
|
|
|
(wildcard_pattern) @variable.builtin
|
|
(identifier_pattern (identifier) @variable)
|
|
(struct_pattern (rust_path) @type)
|
|
(field_pattern (identifier) @property)
|
|
|
|
; ====================
|
|
; COMMENTS
|
|
; ====================
|
|
|
|
(template_comment) @comment
|
|
(html_comment) @comment
|
|
(comment) @comment
|
|
|
|
; Comment delimiters
|
|
"@*" @comment
|
|
"*@" @comment
|
|
"<!--" @comment
|
|
"-->" @comment
|
|
|
|
; ====================
|
|
; ATTRIBUTES (derive, etc.)
|
|
; ====================
|
|
|
|
(attribute_list) @attribute
|
|
(attribute (identifier) @attribute)
|
|
|
|
; ====================
|
|
; ESCAPE SEQUENCES
|
|
; ====================
|
|
|
|
(escape_at) @string.escape
|
|
|
|
; ====================
|
|
; EMBEDDED LANGUAGES
|
|
; ====================
|
|
|
|
(embedded_language) @embedded
|
|
(language_name) @label
|
|
|
|
; Language name keywords
|
|
"css" @label
|
|
"style" @label
|
|
"javascript" @label
|
|
"js" @label
|
|
"json" @label
|
|
"alpine" @label
|
|
"html" @label
|
|
|
|
; Embedded block delimiters
|
|
"@```" @punctuation.special
|
|
"```@" @punctuation.special
|
|
|
|
; ====================
|
|
; TEXT CONTENT
|
|
; ====================
|
|
|
|
(text_content) @text
|
|
|
|
; ====================
|
|
; FALLBACK
|
|
; ====================
|
|
|
|
; Catch-all for identifiers not matched above
|
|
(identifier) @variable
|