Skip to content

Commit

Permalink
[#155] != 연산자 토큰화 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
myyrakle committed Aug 16, 2024
1 parent fde8061 commit 289febc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/executor/initializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ impl Executor {
self.check_output_status(output)
}

#[allow(dead_code)]
async fn write_and_check_err(
&self,
base_path: PathBuf,
Expand Down
14 changes: 13 additions & 1 deletion src/lexer/tokenizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,19 @@ impl Tokenizer {
}
'+' => Token::Operator(OperatorToken::Plus),
'*' => Token::Operator(OperatorToken::Asterisk),
'!' => Token::Operator(OperatorToken::Not), // TODO: != 연산자 처리
'!' => {
// 다음 문자가 =일 경우 != 연산자로 처리

self.read_char();

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

Token::Operator(OperatorToken::Not)
}
}
'=' => Token::Operator(OperatorToken::Eq),
'<' => Token::Operator(OperatorToken::Lt), // TODO: <= 연산자 처리
'>' => Token::Operator(OperatorToken::Gt), // TODO: >= 연산자 처리
Expand Down

0 comments on commit 289febc

Please sign in to comment.