aboutsummaryrefslogtreecommitdiff
path: root/lib/xixanta/src/node.rs
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mikisabate@gmail.com>2025-01-16 14:12:11 +0100
committerMiquel Sabaté Solà <mikisabate@gmail.com>2025-01-16 14:12:11 +0100
commit9261588dcaa10aac0a9b8b7a81ff70a621cf1551 (patch)
tree2f58d0889a3bc84c6fd6829ef1fce56f880d8791 /lib/xixanta/src/node.rs
parente7d815c73701377ad3f370e5e5e2b3296627a7ae (diff)
downloadtools.nes-9261588dcaa10aac0a9b8b7a81ff70a621cf1551.tar.gz
tools.nes-9261588dcaa10aac0a9b8b7a81ff70a621cf1551.zip
Add boolean operators
Allow for expressions that evaluate to a boolean expression. This in turn mean that the value is just set to 0 or 1 depending on the given condition. As with other assemblers, only a value of 0 evaluates to 0, and others go to 1. So, something like "1 && 2" evaluates to 1 even if it doesn't make much sense at first glance (as an assembler we just assume that the programmer knows what it's doing). Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'lib/xixanta/src/node.rs')
-rw-r--r--lib/xixanta/src/node.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/xixanta/src/node.rs b/lib/xixanta/src/node.rs
index 04655cb..a31c578 100644
--- a/lib/xixanta/src/node.rs
+++ b/lib/xixanta/src/node.rs
@@ -197,13 +197,22 @@ pub enum OperationType {
Lshift,
Rshift,
And,
+ LogicalAnd,
Or,
+ LogicalOr,
Xor,
UnaryPositive,
UnaryNegative,
BitwiseNot,
+ LogicalNot,
LoByte,
HiByte,
+ Equal,
+ NotEqual,
+ LessEqual,
+ GreaterEqual,
+ Less,
+ Greater,
}
/// The PNode type.
@@ -278,13 +287,22 @@ impl fmt::Display for NodeType {
OperationType::Lshift => write!(f, "left shift"),
OperationType::Rshift => write!(f, "right shift"),
OperationType::And => write!(f, "bitwise and"),
+ OperationType::LogicalAnd => write!(f, "logical and"),
OperationType::Or => write!(f, "bitwise or"),
+ OperationType::LogicalOr => write!(f, "logical or"),
OperationType::Xor => write!(f, "bitwise xor"),
OperationType::UnaryPositive => write!(f, "unary positive"),
OperationType::UnaryNegative => write!(f, "unary negative"),
OperationType::BitwiseNot => write!(f, "bitwise not"),
+ OperationType::LogicalNot => write!(f, "logical not"),
OperationType::LoByte => write!(f, "low byte"),
OperationType::HiByte => write!(f, "high byte"),
+ OperationType::Equal => write!(f, "equal"),
+ OperationType::NotEqual => write!(f, "not equal"),
+ OperationType::LessEqual => write!(f, "less or equal"),
+ OperationType::GreaterEqual => write!(f, "greater or equal"),
+ OperationType::Less => write!(f, "less"),
+ OperationType::Greater => write!(f, "greater"),
},
}
}