Skip to content

Commit

Permalink
lexer: update names
Browse files Browse the repository at this point in the history
Signed-off-by: FedericoBruzzone <[email protected]>
  • Loading branch information
FedericoBruzzone committed Sep 1, 2024
1 parent 0895565 commit ed8828a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
24 changes: 12 additions & 12 deletions src/lexer/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ const CLOSE_BRACE: &str = "]";
const COMMA: &str = ",";
const MINUS: &str = "-";
const PLUS: &str = "+";
const MULTIPLY: &str = "*";
const DIVIDE: &str = "/";
const STAR: &str = "*";
const SLASH: &str = "/";
const GREATER: &str = ">";
const RIGHT_ARROW: &str = "->";
const RIGHT_DOUBLE_ARROW: &str = "=>";
Expand Down Expand Up @@ -91,10 +91,10 @@ pub enum TokenKind {
TokenPipe, // |
TokenEOF, // End of file
// Operators
TokenPlus, // +
TokenMinus, // -
TokenMultiply, // *
TokenDivide, // /
TokenPlus, // +
TokenMinus, // -
TokenStar, // *
TokenSlash, // /
TokenUnknown,
}

Expand Down Expand Up @@ -123,8 +123,8 @@ impl TokenKind {
| COMMA
| MINUS
| PLUS
| MULTIPLY
| DIVIDE
| STAR
| SLASH
| GREATER
| NEW_LINE
)
Expand Down Expand Up @@ -178,8 +178,8 @@ impl TokenKind {
COMMA => Some(TokenKind::TokenComma),
PLUS => Some(TokenKind::TokenPlus),
MINUS => Some(TokenKind::TokenMinus),
MULTIPLY => Some(TokenKind::TokenMultiply),
DIVIDE => Some(TokenKind::TokenDivide),
STAR => Some(TokenKind::TokenStar),
SLASH => Some(TokenKind::TokenSlash),
RIGHT_ARROW => Some(TokenKind::TokenRightArrow),
RIGHT_DOUBLE_ARROW => Some(TokenKind::TokenRightDoubleArrow),
PLUS_PLUS => Some(TokenKind::TokenPlusPlus),
Expand Down Expand Up @@ -388,8 +388,8 @@ impl std::fmt::Display for TokenKind {
TokenKind::TokenEOF => write!(f, "TokenEOF"),
TokenKind::TokenPlus => write!(f, "TokenPlus"),
TokenKind::TokenMinus => write!(f, "TokenMinus"),
TokenKind::TokenMultiply => write!(f, "TokenMultiply"),
TokenKind::TokenDivide => write!(f, "TokenDivide"),
TokenKind::TokenStar => write!(f, "TokenMultiply"),
TokenKind::TokenSlash => write!(f, "TokenDivide"),
TokenKind::TokenUnknown => write!(f, "TokenUnknown"),
}
}
Expand Down
2 changes: 1 addition & 1 deletion testdata/functions/id_fun_div.tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
}
},
{
"kind": "TokenDivide",
"kind": "TokenSlash",
"lexeme": "/",
"location": {
"file_path": "",
Expand Down
4 changes: 2 additions & 2 deletions testdata/functions/id_fun_if_else.tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
}
},
{
"kind": "TokenMultiply",
"kind": "TokenStar",
"lexeme": "*",
"location": {
"file_path": "",
Expand Down Expand Up @@ -276,7 +276,7 @@
}
},
{
"kind": "TokenMultiply",
"kind": "TokenStar",
"lexeme": "*",
"location": {
"file_path": "",
Expand Down
2 changes: 1 addition & 1 deletion testdata/functions/id_fun_mul.tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
}
},
{
"kind": "TokenMultiply",
"kind": "TokenStar",
"lexeme": "*",
"location": {
"file_path": "",
Expand Down
4 changes: 2 additions & 2 deletions testdata/functions/id_fun_sum_square.tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@
}
},
{
"kind": "TokenMultiply",
"kind": "TokenStar",
"lexeme": "*",
"location": {
"file_path": "",
Expand Down Expand Up @@ -310,7 +310,7 @@
}
},
{
"kind": "TokenMultiply",
"kind": "TokenStar",
"lexeme": "*",
"location": {
"file_path": "",
Expand Down

0 comments on commit ed8828a

Please sign in to comment.