From b469d0595321c44723075632fa5414d2339cc629 Mon Sep 17 00:00:00 2001 From: Ben Bridle Date: Mon, 9 Nov 2026 16:21:17 +1300 Subject: Add support for disjoint fields in word templates The AVR instruction set requires that fields in some instructions are split across multiple ranges, requiring words that look like: #0001_11rd_dddd_rrrr This commit makes it possible to define fields with this syntax. The syntactic error DuplicateFieldNameInWord has been removed. --- src/stages/compiler.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/stages/compiler.rs') diff --git a/src/stages/compiler.rs b/src/stages/compiler.rs index 4777fb4..d4d28dd 100644 --- a/src/stages/compiler.rs +++ b/src/stages/compiler.rs @@ -221,10 +221,13 @@ impl SymbolParser { } BlockToken::WordTemplate(word_template) => { for field in &word_template.fields { + // If a field is disjoint, the source span of the first range + // will identify the whole field. + let range = field.ranges.first().unwrap(); self.record_symbol( &field.name.to_string(), 0, - &field.source, + &range.source, SymbolRoleDetailed::Invocation, ); } -- cgit v1.3.1