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>> {...@@ -123,6 +123,7 @@ pub fn tokenize(content: String) -> Result<Vec<Token>> {
123 _ => tokens.push(Token::Equals),123 _ => tokens.push(Token::Equals),
124 },124 },
125 ';' => tokens.push(Token::Semicolon),125 ';' => tokens.push(Token::Semicolon),
126 '>' => tokens.push(Token::Operator(Operator::GreaterThan)),
126 '+' => tokens.push(Token::Operator(Operator::Add)),127 '+' => tokens.push(Token::Operator(Operator::Add)),
127 '-' => match chars.peek() {128 '-' => match chars.peek() {
128 Some((_, '>')) => {129 Some((_, '>')) => {
compiler/src/util.rs+2
...@@ -6,6 +6,7 @@ pub enum Operator {...@@ -6,6 +6,7 @@ pub enum Operator {
6 Divide,6 Divide,
7 Power,7 Power,
8 Equals,8 Equals,
9 GreaterThan,
9}10}
1011
11impl Operator {12impl Operator {
...@@ -17,6 +18,7 @@ impl Operator {...@@ -17,6 +18,7 @@ impl Operator {
17 Self::Multiply => "*",18 Self::Multiply => "*",
18 Self::Power => "**",19 Self::Power => "**",
19 Self::Equals => "===",20 Self::Equals => "===",
21 Self::GreaterThan => ">",
20 })22 })
21 }23 }
22}24}