summaryrefslogtreecommitdiff
path: root/src/stages/compiler.rs
diff options
context:
space:
mode:
authorBen Bridle <ben@derelict.engineering>2026-11-09 16:21:17 +1300
committerBen Bridle <ben@derelict.engineering>2026-11-09 16:21:17 +1300
commitb469d0595321c44723075632fa5414d2339cc629 (patch)
tree87ba834df68c282e9502b6beca09601f7407276c /src/stages/compiler.rs
parentaecc8e439f7360be65d37aa88c0c522434e00881 (diff)
downloadtorque-asm-b469d0595321c44723075632fa5414d2339cc629.zip
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.
Diffstat (limited to 'src/stages/compiler.rs')
-rw-r--r--src/stages/compiler.rs5
1 files changed, 4 insertions, 1 deletions
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,
);
}