mirror of
https://github.com/soconnor0919/nand2tetris-zed.git
synced 2025-12-12 23:24:45 -05:00
- 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
103 lines
1.8 KiB
Scheme
103 lines
1.8 KiB
Scheme
; Hack Assembly syntax highlighting queries based on actual node types
|
|
|
|
; A-instruction marker
|
|
"@" @punctuation.special
|
|
|
|
; A-instruction components
|
|
(a_instruction
|
|
(constant) @constant.numeric)
|
|
|
|
(a_instruction
|
|
(symbol
|
|
(predefined_symbol) @constant.builtin))
|
|
|
|
(a_instruction
|
|
(symbol
|
|
(user_symbol) @variable))
|
|
|
|
; C-instruction components
|
|
(dest) @type
|
|
(comp) @operator
|
|
(jump) @keyword.control
|
|
|
|
; Assignment and jump operators
|
|
"=" @operator
|
|
";" @punctuation.delimiter
|
|
|
|
; Label declarations
|
|
(label_declaration
|
|
"(" @punctuation.bracket
|
|
(symbol) @label
|
|
")" @punctuation.bracket)
|
|
|
|
; Comments
|
|
(comment) @comment
|
|
|
|
; Predefined symbols
|
|
"SP" @constant.builtin
|
|
"LCL" @constant.builtin
|
|
"ARG" @constant.builtin
|
|
"THIS" @constant.builtin
|
|
"THAT" @constant.builtin
|
|
"SCREEN" @constant.builtin
|
|
"KBD" @constant.builtin
|
|
|
|
; Virtual registers R0-R15 (handled by predefined_symbol pattern)
|
|
(predefined_symbol) @constant.builtin
|
|
|
|
; User-defined symbols
|
|
(user_symbol) @variable
|
|
|
|
; Constants
|
|
(constant) @constant.numeric
|
|
|
|
; Computation operations
|
|
"0" @constant.numeric
|
|
"1" @constant.numeric
|
|
"-1" @constant.numeric
|
|
|
|
; Register references
|
|
"D" @variable.builtin
|
|
"A" @variable.builtin
|
|
"M" @variable.builtin
|
|
|
|
; Arithmetic operations
|
|
"D+1" @operator
|
|
"A+1" @operator
|
|
"M+1" @operator
|
|
"D-1" @operator
|
|
"A-1" @operator
|
|
"M-1" @operator
|
|
"D+A" @operator
|
|
"D-A" @operator
|
|
"A-D" @operator
|
|
"D+M" @operator
|
|
"D-M" @operator
|
|
"M-D" @operator
|
|
|
|
; Logical operations
|
|
"!D" @operator
|
|
"!A" @operator
|
|
"!M" @operator
|
|
"-D" @operator
|
|
"-A" @operator
|
|
"-M" @operator
|
|
"D&A" @operator
|
|
"D|A" @operator
|
|
"D&M" @operator
|
|
"D|M" @operator
|
|
|
|
; Destination combinations
|
|
"MD" @type
|
|
"AM" @type
|
|
"AD" @type
|
|
"AMD" @type
|
|
|
|
; Jump conditions
|
|
"JGT" @keyword.control
|
|
"JEQ" @keyword.control
|
|
"JGE" @keyword.control
|
|
"JLT" @keyword.control
|
|
"JNE" @keyword.control
|
|
"JLE" @keyword.control
|
|
"JMP" @keyword.control |