Skip to content

Commit

Permalink
spcasm: use to_ascii_lowercase
Browse files Browse the repository at this point in the history
should be slightly faster
  • Loading branch information
kleinesfilmroellchen committed Sep 3, 2024
1 parent d54eaac commit f319b10
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/parser/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,18 +298,18 @@ fn parse_identifier_like(
*index += identifier.len();
let identifier_span = (start_index, identifier.len()).into();

Token::parse_special_identifier(&identifier.to_lowercase(), identifier_span, source_code.clone())
Token::parse_special_identifier(&identifier.to_ascii_lowercase(), identifier_span, source_code.clone())
.map(|value| Token::SpecialIdentifier(value, identifier_span))
.or_else(|_| {
Register::parse(&identifier.to_lowercase(), identifier_span, source_code.clone())
Register::parse(&identifier.to_ascii_lowercase(), identifier_span, source_code.clone())
.map(|value| Token::Register(value, identifier_span))
})
.or_else(|_| {
DirectiveSymbol::parse(&identifier.to_lowercase(), identifier_span, source_code.clone())
DirectiveSymbol::parse(&identifier.to_ascii_lowercase(), identifier_span, source_code.clone())
.map(|value| Token::Directive(value, identifier_span))
})
.or_else(|_| {
Mnemonic::parse(&identifier.to_lowercase(), identifier_span, source_code.clone())
Mnemonic::parse(&identifier.to_ascii_lowercase(), identifier_span, source_code.clone())
.map(|mnemonic| Token::Mnemonic(mnemonic, identifier_span))
})
.or_else::<AssemblyError, _>(|_| Ok(Token::Identifier(identifier, identifier_span)))
Expand Down

0 comments on commit f319b10

Please sign in to comment.