From cbd76a10233a219727ef576f0dee88eb5902f798 Mon Sep 17 00:00:00 2001 From: Lino Le Van <11367844+lino-levan@users.noreply.github.com> Date: Wed, 17 Jan 2024 10:29:18 -0800 Subject: [PATCH] feat: add greater than --- compiler/src/tokenizer.rs | 1 + compiler/src/util.rs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/compiler/src/tokenizer.rs b/compiler/src/tokenizer.rs index 9229028ec160ab61dca9b81734437d77308cb035..df7b1ca200f8d84b970300c6a390c3e24c248276 100644 --- a/compiler/src/tokenizer.rs +++ b/compiler/src/tokenizer.rs @@ -123,6 +123,7 @@ pub fn tokenize(content: String) -> Result> { _ => tokens.push(Token::Equals), }, ';' => tokens.push(Token::Semicolon), + '>' => tokens.push(Token::Operator(Operator::GreaterThan)), '+' => tokens.push(Token::Operator(Operator::Add)), '-' => match chars.peek() { Some((_, '>')) => { diff --git a/compiler/src/util.rs b/compiler/src/util.rs index 130f73004cfe6e03e5dbd5c169378677d091dc54..25de3ac1c7c30d6191678c51bb23193e298bd284 100644 --- a/compiler/src/util.rs +++ b/compiler/src/util.rs @@ -6,6 +6,7 @@ pub enum Operator { Divide, Power, Equals, + GreaterThan, } impl Operator { @@ -17,6 +18,7 @@ impl Operator { Self::Multiply => "*", Self::Power => "**", Self::Equals => "===", + Self::GreaterThan => ">", }) } } -- 2.54.0