summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Bridle <bridle.benjamin@gmail.com>2023-11-26 10:31:20 +1300
committerBen Bridle <bridle.benjamin@gmail.com>2023-11-26 10:33:01 +1300
commit4462a26fa92569868b01754fc2738bca4f39f1f8 (patch)
treedab69b5ba265707dd29955e6da137a20fd617905
parent1b75959e38636708686cd5e2cbbabe783312a4f3 (diff)
downloadbedrock-asm-4462a26fa92569868b01754fc2738bca4f39f1f8.zip
Implement name-spaced macros
-rw-r--r--src/tokenizer.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/tokenizer.rs b/src/tokenizer.rs
index 03609b2..1fdb994 100644
--- a/src/tokenizer.rs
+++ b/src/tokenizer.rs
@@ -142,7 +142,11 @@ impl Iterator for TokenIterator {
'&' => { SyntacticTokenType::LabelDefinition(format!("{}/{}", self.label, suffix)) }
'$' => { SyntacticTokenType::Padding(parse_padding_value(&suffix)) }
'~' => { SyntacticTokenType::Reference(format!("{}/{}", self.label, suffix)) }
- '%' => { SyntacticTokenType::MacroDefinition(suffix) }
+ '%' => if let Some(("", sublabel)) = suffix.split_once("~") {
+ SyntacticTokenType::MacroDefinition(format!("{}/{}", self.label, sublabel))
+ } else {
+ SyntacticTokenType::MacroDefinition(suffix)
+ }
_ => {
if ";" == &full { SyntacticTokenType::MacroDefinitionTerminator }
else if let Some(value) = parse_byte_lit(&full) { SyntacticTokenType::ByteLiteral(value) }