aboutsummaryrefslogtreecommitdiff
path: root/lib/xixanta/src/node.rs
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mikisabate@gmail.com>2025-08-28 21:56:57 +0200
committerMiquel Sabaté Solà <mikisabate@gmail.com>2025-08-28 21:56:57 +0200
commit834e286af70b7e65a72316fddc4fa3c0c429ced8 (patch)
treeadb53888f207efc17ecd57948af37aba7c23343a /lib/xixanta/src/node.rs
parentb93267c56565582b9a85e7a1255568e16abcafd2 (diff)
downloadtools.nes-834e286af70b7e65a72316fddc4fa3c0c429ced8.tar.gz
tools.nes-834e286af70b7e65a72316fddc4fa3c0c429ced8.zip
parser: Add asan:reserve and asan:weak support
These are special directives that happen on comments, and hence this parser will no longer simply ignore comments. This feature is not used by the assembler, but following commits should build up address sanitizer strategies from it. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'lib/xixanta/src/node.rs')
-rw-r--r--lib/xixanta/src/node.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/xixanta/src/node.rs b/lib/xixanta/src/node.rs
index a09568c..4281c4a 100644
--- a/lib/xixanta/src/node.rs
+++ b/lib/xixanta/src/node.rs
@@ -249,6 +249,12 @@ pub enum OperationType {
Greater,
}
+#[derive(Debug, Clone, PartialEq)]
+pub enum CommentType {
+ AsanReserve(u8),
+ AsanWeak,
+}
+
/// The PNode type.
#[derive(Debug, Clone, PartialEq)]
pub enum NodeType {
@@ -299,6 +305,9 @@ pub enum NodeType {
/// A operation expression. If the operation has two sides, then the left
/// and right arms contain the operands, otherwise only the right one.
Operation(OperationType),
+
+ /// A command which is relevant for the current session.
+ Comment(CommentType),
}
impl fmt::Display for NodeType {
@@ -338,6 +347,10 @@ impl fmt::Display for NodeType {
OperationType::Less => write!(f, "less"),
OperationType::Greater => write!(f, "greater"),
},
+ NodeType::Comment(ct) => match ct {
+ CommentType::AsanReserve(_) => write!(f, ";; asan:reserve"),
+ CommentType::AsanWeak => write!(f, ";; asan:weak"),
+ },
}
}
}