From 4462a26fa92569868b01754fc2738bca4f39f1f8 Mon Sep 17 00:00:00 2001 From: Ben Bridle Date: Sun, 26 Nov 2023 10:31:20 +1300 Subject: Implement name-spaced macros --- src/tokenizer.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/tokenizer.rs') 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) } -- cgit v1.2.3-70-g09d2