Skip to content

Commit

Permalink
[#155] >= 연산자 토큰화 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
myyrakle committed Aug 17, 2024
1 parent 3bc6557 commit 8f24583
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/lexer/tokenizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,19 @@ impl Tokenizer {
Token::Operator(OperatorToken::Lt)
}
}
'>' => Token::Operator(OperatorToken::Gt), // TODO: >= 연산자 처리
'>' => {
// 다음 문자가 =일 경우 >= 연산자로 처리

self.read_char();

if self.last_char == '=' {
Token::Operator(OperatorToken::Gte)
} else {
self.unread_char();

Token::Operator(OperatorToken::Gt)
}
}
_ => {
return Err(LexingError::wrap(format!(
"unexpected operator: {:?}",
Expand Down

0 comments on commit 8f24583

Please sign in to comment.