Skip to content

Commit

Permalink
Handle label scope
Browse files Browse the repository at this point in the history
Support both single and single backslash, for use inside macro
see grahambates/m68k-lsp#22
  • Loading branch information
grahambates committed Jul 24, 2024
1 parent 9e082a2 commit 5acfb85
Show file tree
Hide file tree
Showing 4 changed files with 38,336 additions and 37,614 deletions.
19 changes: 19 additions & 0 deletions corpus/statements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,25 @@ Instructions
(data_register)))
)

============================================
Label scope
============================================
move global_label\.local_label,d0
move global_label\\.local_label,d0
---
(source_file
(instruction
(instruction_mnemonic)
(operand_list
(symbol)
(data_register)))
(instruction
(instruction_mnemonic)
(operand_list
(symbol)
(data_register)))
)

============================================
Macro calls
============================================
Expand Down
2 changes: 1 addition & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -1473,7 +1473,7 @@ module.exports = grammar({
prec.right(
seq(repeat1(seq(optional("."), $._symbol_chars)), optional("$"))
),
_symbol_chars: () => /[a-zA-Z0-9_%]+/,
_symbol_chars: () => /([a-zA-Z0-9_%]|(\\?\\\.))+/,

//----------------------------------------------------------------------
// Misc:
Expand Down
2 changes: 1 addition & 1 deletion src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -7154,7 +7154,7 @@
},
"_symbol_chars": {
"type": "PATTERN",
"value": "[a-zA-Z0-9_%]+"
"value": "([a-zA-Z0-9_%]|(\\\\?\\\\\\.))+"
},
"_sep": {
"type": "PATTERN",
Expand Down
Loading

0 comments on commit 5acfb85

Please sign in to comment.