More binary op

This commit is contained in:
2026-05-08 15:43:57 +02:00
parent 91bee0c4fc
commit 39b15d4207
4 changed files with 7 additions and 1 deletions
+2
View File
@@ -62,6 +62,8 @@ pub enum BinaryOp {
GreaterThan,
LessThanOrEqual,
GreaterThanOrEqual,
And,
Or,
}
#[derive(Debug, Clone, Serialize)]
+1 -1
View File
@@ -192,7 +192,7 @@ macro_call_px = { "!" ~ "(" ~ macro_inner_v* ~ ")" }
struct_px = { "{" ~ (struct_field_decl ~ ("," ~ struct_field_decl)*)? ~ ","? ~ "}" }
index_px = { "[" ~ expr ~ "]" }
binary_px = { bin_op ~ expr }
bin_op = { "<=" | ">=" | "==" | "!=" | "+" | "-" | "*" | "/" | "%" | "<" | ">" }
bin_op = { "<=" | ">=" | "==" | "!=" | "&&" | "||" | "+" | "-" | "*" | "/" | "%" | "<" | ">" }
struct_field_decl = { identifier ~ ":" ~ expr }
prefix = {
+2
View File
@@ -498,6 +498,8 @@ impl From<pest::iterators::Pair<'_, Rule>> for Postfix {
">" => BinaryOp::GreaterThan,
"<=" => BinaryOp::LessThanOrEqual,
">=" => BinaryOp::GreaterThanOrEqual,
"&&" => BinaryOp::And,
"||" => BinaryOp::Or,
_ => {
unimplemented!("Binary operator not implemented yet: {}", op_pair.as_str())