Skip to content

Commit

Permalink
asm: Use match statement for keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
Granddave committed Jul 13, 2024
1 parent bc50a78 commit 0b7ba86
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/assembler/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,10 @@ impl<'a> Lexer<'a> {
// Identifiers and keywords
'A'..='Z' | 'a'..='z' | '_' => {
let (text, span) = self.read_string();
if text == "define" {
Some(Token::new(TokenType::Define, text, span))
} else if text == "org" {
Some(Token::new(TokenType::OrgDirective, text, span))
} else {
Some(Token::new(TokenType::Identifier, text, span))
match text {
"define" => Some(Token::new(TokenType::Define, text, span)),
"org" => Some(Token::new(TokenType::OrgDirective, text, span)),
_ => Some(Token::new(TokenType::Identifier, text, span)),
}
}
_ => {
Expand Down

0 comments on commit 0b7ba86

Please sign in to comment.