authorgravatar for 11367844+lino-levan@users.noreply.github.comLino Le Van <11367844+lino-levan@users.noreply.github.com> 2024-01-17 10:29:18-08:00
committergravatar for 11367844+lino-levan@users.noreply.github.comLino Le Van <11367844+lino-levan@users.noreply.github.com> 2024-01-17 10:29:18-08:00
logcbd76a10233a219727ef576f0dee88eb5902f798
treef4ff3f7c9f9c3dd318b2952ca536b160746a6ef0
parentb893e32685ff6a5115a0723b9ebf142578c73416

feat: add greater than


2 files changed, 3 insertions(+), 0 deletions(-)

compiler/src/tokenizer.rs+1
......@@ -123,6 +123,7 @@ pub fn tokenize(content: String) -> Result<Vec<Token>> {
123123 _ => tokens.push(Token::Equals),
124124 },
125125 ';' => tokens.push(Token::Semicolon),
126 '>' => tokens.push(Token::Operator(Operator::GreaterThan)),
126127 '+' => tokens.push(Token::Operator(Operator::Add)),
127128 '-' => match chars.peek() {
128129 Some((_, '>')) => {
compiler/src/util.rs+2
......@@ -6,6 +6,7 @@ pub enum Operator {
66 Divide,
77 Power,
88 Equals,
9 GreaterThan,
910}
1011
1112impl Operator {
......@@ -17,6 +18,7 @@ impl Operator {
1718 Self::Multiply => "*",
1819 Self::Power => "**",
1920 Self::Equals => "===",
21 Self::GreaterThan => ">",
2022 })
2123 }
2224}