Skip to content

Commit

Permalink
Enhance operator
Browse files Browse the repository at this point in the history
  • Loading branch information
KajizukaTaichi committed Jul 26, 2024
1 parent 7c3ab86 commit 034f81d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,22 @@ fn parse_expr(source: String) -> Expr {
expr.push(Expr::Operator(Operator::Mod))
} else if token == "==" {
expr.push(Expr::Operator(Operator::Equal))
} else if token == "!=" {
expr.push(Expr::Operator(Operator::NotEq))
} else if token == ">" {
expr.push(Expr::Operator(Operator::Greater))
} else if token == "<" {
expr.push(Expr::Operator(Operator::Less))
} else if token == ">=" {
expr.push(Expr::Operator(Operator::GreaterEq))
} else if token == "<=" {
expr.push(Expr::Operator(Operator::LessEq))
} else if token == "&& " {
expr.push(Expr::Operator(Operator::And))
} else if token == "||" {
expr.push(Expr::Operator(Operator::Or))
} else if token == "!" {
expr.push(Expr::Operator(Operator::Not))
} else {
expr.push(Expr::Literal(Type::Symbol(token)))
}
Expand Down

0 comments on commit 034f81d

Please sign in to comment.