From 834e286af70b7e65a72316fddc4fa3c0c429ced8 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Thu, 28 Aug 2025 21:56:57 +0200 Subject: parser: Add asan:reserve and asan:weak support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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à --- lib/xixanta/src/node.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/xixanta/src/node.rs') 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"), + }, } } } -- cgit v1.2.3