aboutsummaryrefslogtreecommitdiff
path: root/lib/xixanta/src/node.rs
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mikisabate@gmail.com>2024-10-23 12:54:14 +0200
committerMiquel Sabaté Solà <mikisabate@gmail.com>2024-12-12 07:49:33 +0100
commitd492aa8271f9fb02351b1144733508194df67746 (patch)
treea035d7c495ebc6a12b01e0018b345760de24ba22 /lib/xixanta/src/node.rs
parent4f24eb5e5754c4e1e2c6069bdaf1b0f34c856c1b (diff)
downloadtools.nes-d492aa8271f9fb02351b1144733508194df67746.tar.gz
tools.nes-d492aa8271f9fb02351b1144733508194df67746.zip
Re-work the support on labels, variables and jumps
As a way to firstly adapt on the latest changes from the parser since 184c39579227 ("Re-work the parser from scratch"), the assembler had to leave out some features on 16114b2ca358 ("Adapt the assembler to the changes on the parser"). This commit reintroduces support for settings labels, variables and referencing them, while also providing a more robust implementation at that. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'lib/xixanta/src/node.rs')
-rw-r--r--lib/xixanta/src/node.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/xixanta/src/node.rs b/lib/xixanta/src/node.rs
index 18a5402..f55ca11 100644
--- a/lib/xixanta/src/node.rs
+++ b/lib/xixanta/src/node.rs
@@ -1,5 +1,4 @@
use std::fmt;
-use std::ops::Range;
/// A Positioned String. That is, a String which also has information on the
/// line number and the column range.
@@ -11,14 +10,17 @@ pub struct PString {
/// Line number where it has been found.
pub line: usize,
- /// The column range where it has been found.
- pub range: Range<usize>,
+ /// The start column where it has been found.
+ pub start: usize,
+
+ /// The end column where it has been found.
+ pub end: usize,
}
impl PString {
/// Returns true if the string has either an empty value or an empty range.
pub fn is_empty(&self) -> bool {
- self.value.is_empty() || self.range.is_empty()
+ self.value.is_empty() || (self.start == self.end)
}
/// Returns an empty tuple if the string contains a valid identifier, or a