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
This commit is contained in:
2025-09-11 11:24:24 -04:00
commit c231dbfd27
133 changed files with 2792 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
; Test script bracket matching
; Repeat blocks use curly braces
(repeat_command
"{" @open
"}" @close) @container
; While blocks use curly braces
(while_command
"{" @open
"}" @close) @container
; Square brackets for array references
"[" @open
"]" @close

View File

@@ -0,0 +1,7 @@
name = "Test Script"
grammar = "test_script"
scope = "source.test_script"
path_suffixes = ["tst"]
line_comments = ["// "]
tab_size = 2
hard_tabs = false

View File

@@ -0,0 +1,66 @@
; Test script syntax highlighting queries based on actual node types
; Commands
"load" @keyword
"output-file" @keyword
"compare-to" @keyword
"output-list" @keyword
"set" @keyword
"eval" @keyword
"output" @keyword
"tick" @keyword
"tock" @keyword
"ticktock" @keyword
"repeat" @keyword
"while" @keyword
"echo" @keyword
; Control flow keywords
"repeat" @keyword.control
"while" @keyword.control
; File operations
(load_command "load" @keyword)
(output_file_command "output-file" @keyword)
(compare_to_command "compare-to" @keyword)
; Variable references
(memory_reference "RAM" @type.builtin)
(register_reference) @variable.builtin
; Pin references
(pin_reference) @property
; Numbers and indices
(number) @constant.numeric
; Binary values
(binary_value) @constant.numeric
; Format specifications
(format_spec) @string.special
; Filenames
(filename) @string
; Strings
(string) @string
; Comments
(comment) @comment
; Punctuation
"," @punctuation.delimiter
";" @punctuation.delimiter
"[" @punctuation.bracket
"]" @punctuation.bracket
"{" @punctuation.bracket
"}" @punctuation.bracket
; Special memory references
"DRegister[]" @variable.builtin
"ARegister[]" @variable.builtin
"PC[]" @variable.builtin
; Conditions in while loops
(condition) @string.special

View File

@@ -0,0 +1,15 @@
; Test script indentation rules
; Indent content inside repeat blocks
(repeat_command
"{" @indent) @container
; Indent content inside while blocks
(while_command
"{" @indent) @container
; Dedent closing braces
"}" @dedent
; No other special indentation rules needed
; Most test script commands are at the same level

View File

@@ -0,0 +1,26 @@
; Test script outline queries
; Show repeat blocks in the outline
(repeat_command
(number) @name) @item
(#set! item.kind "loop")
; Show while blocks in the outline
(while_command
(condition) @name) @item
(#set! item.kind "loop")
; Show load commands for file references
(load_command
(filename) @name) @item
(#set! item.kind "file")
; Show set commands with variable assignments
(set_command
(variable_reference) @name) @item
(#set! item.kind "variable")
; Show comments that look like section headers
(comment) @item
(#match? @item "^//\\s*[A-Z].*|^//.*[Ss]ection|^//.*[Tt]est|^//.*[Pp]hase")
(#set! item.kind "comment")