Files
storybook/tree-sitter-storybook/queries/highlights.scm

154 lines
2.6 KiB
Scheme

; Highlights query for Storybook DSL
; Maps grammar nodes to standard highlight groups
; Comments
(line_comment) @comment.line
(block_comment) @comment.block
; Keywords - Declaration keywords
[
"character"
"template"
"life_arc"
"schedule"
"behavior"
"institution"
"relationship"
"location"
"species"
"enum"
"state"
] @keyword.declaration
; Keywords - Control flow and modifiers
[
"and"
"or"
"not"
"on"
"enter"
"strict"
] @keyword.control
; Keywords - Import/module
[
"use"
"include"
"from"
] @keyword.import
; Keywords - Special
[
"as"
"self"
"other"
"remove"
"append"
"is"
] @keyword.special
; Boolean literals
[
"true"
"false"
] @constant.builtin.boolean
; Numbers
(integer) @constant.numeric.integer
(float) @constant.numeric.float
(time) @constant.numeric.time
(duration) @constant.numeric.duration
; Strings
(string) @string
; Identifiers in different contexts
(character name: (identifier) @type.character)
(template name: (identifier) @type.template)
(life_arc name: (identifier) @type.life_arc)
(schedule name: (identifier) @type.schedule)
(behavior name: (identifier) @type.behavior)
(institution name: (identifier) @type.institution)
(relationship name: (identifier) @type.relationship)
(location name: (identifier) @type.location)
(species name: (identifier) @type.species)
(enum_declaration name: (identifier) @type.enum)
(arc_state name: (identifier) @type.state)
; Field names
(field name: (dotted_path) @property)
; Species reference
(character species: (identifier) @type.builtin)
; Paths and identifiers
(path) @namespace
(identifier) @variable
; Prose blocks - tag and content
(prose_block tag: (identifier) @tag)
(prose_block marker: (prose_marker) @punctuation.delimiter)
(prose_content) @markup.raw
; Operators
[
">"
">="
"<"
"<="
"->"
"is"
] @operator
; Punctuation
[
"{"
"}"
] @punctuation.bracket
[
"("
")"
] @punctuation.bracket
[
"["
"]"
] @punctuation.bracket
[
":"
"::"
";"
","
"."
".."
"*"
"?"
"@"
] @punctuation.delimiter
; Behavior tree nodes
(selector_node "?" @keyword.behavior.selector)
(sequence_node ">" @keyword.behavior.sequence)
(repeat_node "*" @keyword.behavior.repeat)
(action_node (identifier) @function.action)
; Transitions
(transition "->" @operator.transition)
(transition target: (identifier) @type.state)
; Schedule blocks
(schedule_block activity: (identifier) @function.activity)
; Override operations
(override "@" @keyword.override)
(override_op "remove" @keyword.override)
(override_op "append" @keyword.override)
; Template clause
(template_clause "from" @keyword.import)
; Error handling
(ERROR) @error