; 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
