Files
nand2tetris-zed/languages/jack/highlights.scm
Sean O'Connor c231dbfd27 Fix HDL and Hack Assembly syntax highlighting and queries
- Fixed HDL highlights query syntax error with #match? predicate
- Replaced #match? with #any-of? for exact string matching
- Fixed Hack Assembly outline query invalid field name
- Improved HDL syntax highlighting with comprehensive patterns
- Added HDL bracket matching for all syntax types
- Fixed XML scope mismatch from text.xml to source.xml
- Enhanced outline queries for better code navigation
2025-09-11 11:24:24 -04:00

102 lines
1.8 KiB
Scheme

; Jack syntax highlighting queries for tree-sitter
; Keywords as string terminals
"class" @keyword
"static" @keyword
"function" @keyword
"constructor" @keyword
"method" @keyword
"field" @keyword
"var" @keyword
"let" @keyword
"do" @keyword
"if" @keyword
"else" @keyword
"while" @keyword
"return" @keyword
; Operators and punctuation
"=" @operator
"+" @operator
"-" @operator
"*" @operator
"/" @operator
"&" @operator
"|" @operator
"<" @operator
">" @operator
"~" @operator
";" @punctuation.delimiter
"," @punctuation.delimiter
"." @punctuation.delimiter
"{" @punctuation.bracket
"}" @punctuation.bracket
"(" @punctuation.bracket
")" @punctuation.bracket
"[" @punctuation.bracket
"]" @punctuation.bracket
; Special alias nodes (these are created by the grammar)
(this) @variable.builtin
(true) @boolean
(false) @boolean
(null) @constant.builtin
; Class declarations
(class_declaration
name: (identifier) @type)
; Class name references
(class_name) @type
; Subroutine declarations
(subroutine_declaration
name: (identifier) @function)
; Parameters
(parameter
(identifier) @variable.parameter)
; Variable declarations
(class_variable_declaration
(identifier) @property)
(local_variable_declaration
(identifier) @variable)
; Function calls
(call_expression
function: (identifier) @function)
(call_expression
function: (member_expression
property: (identifier) @function))
; Member access
(member_expression
object: (identifier) @variable
property: (identifier) @property)
; Subscript access
(subscript_expression
object: (identifier) @variable)
; Let statement variable
(let_statement
(identifier) @variable)
(let_statement
(subscript_expression
object: (identifier) @variable))
; General identifiers
(identifier) @variable
; Literals
(integer) @number
(string) @string
; Comments
(comment) @comment
(doc_comment) @comment.doc