Prefix operators

This commit is contained in:
2023-07-08 23:33:30 -05:00
parent ca72b480c5
commit c373198084
3 changed files with 44 additions and 2 deletions
+8 -1
View File
@@ -38,7 +38,7 @@ pub struct Member {
#[derive(Eq, PartialEq, Clone, Debug)]
pub struct Const {
pub name: String,
pub value: Option<i32>,
pub value: Option<i32>, // todo: this should take a Node
pub string: Option<String>,
}
@@ -150,6 +150,12 @@ pub enum Operator {
Rshift,
}
#[derive(Debug, PartialEq, Copy, Clone)]
pub enum Prefix {
Neg,
Not,
}
#[derive(PartialEq, Clone, Debug)]
pub enum Node {
Number(i32),
@@ -158,6 +164,7 @@ pub enum Node {
Name(String),
Address(String),
Expr(BoxNode, Operator, BoxNode),
Prefix(Prefix, BoxNode),
}
impl From<i32> for Node {