aboutsummaryrefslogtreecommitdiff
path: root/lib/xixanta/src/assembler.rs
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mikisabate@gmail.com>2025-01-04 17:12:11 +0100
committerMiquel Sabaté Solà <mikisabate@gmail.com>2025-01-04 23:26:57 +0100
commit1f8a6becc7cdca285333d51b4548373974df7dd3 (patch)
treebc95144b3f31d89433b505a7998a5ad685f6af77 /lib/xixanta/src/assembler.rs
parent3c8773bf8ea8a17550f50f17eb211ae1a561bfb6 (diff)
downloadtools.nes-1f8a6becc7cd.tar.gz
tools.nes-1f8a6becc7cd.zip
parser: Implement block bodies
These are bodies which are the right node of some proc controls. This way the parser comes back to sanity for statements like .macro and the likes, and behaves more like a usual parser. This was not done in the past because I thought things could have been simpler this way, but it ended up making the assembler way more complicated that it needed to. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'lib/xixanta/src/assembler.rs')
-rw-r--r--lib/xixanta/src/assembler.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/xixanta/src/assembler.rs b/lib/xixanta/src/assembler.rs
index e9d2025..f2ca35b 100644
--- a/lib/xixanta/src/assembler.rs
+++ b/lib/xixanta/src/assembler.rs
@@ -123,16 +123,18 @@ impl Assembler {
return Err(errors.iter().map(|e| Error::Parse(e.clone())).collect());
}
+ let nodes = parser.nodes();
+
// Build the context by iterating over the parsed nodes and checking
// where scopes start/end, evaluating values for variables, labels, etc.
- self.eval_context(&parser.nodes)?;
+ self.eval_context(&nodes)?;
// Convert the relevant nodes into binary bundles which can be used by
// the caller. This is done for most nodes, even if some of them will
// have to be marked as pending, since they depend on knowing the exact
// size for a given segment.
self.stage = Stage::Bundling;
- self.bundle(&parser.nodes)?;
+ self.bundle(&nodes)?;
// Now we know how much each segment spans, and we can resolve (crunch)
// the nodes marked as pending.