refactor(parser): rename function (#4566)

Rename `matches_number_char` function to `matches_number_byte` as it takes a `u8` byte, not a `char`.
This commit is contained in:
overlookmotel 2024-07-31 00:28:55 +00:00
parent 8e3e9104e5
commit 59f00c0a44
2 changed files with 4 additions and 4 deletions

View file

@ -206,7 +206,7 @@ impl Kind {
) )
} }
pub fn matches_number_char(self, b: u8) -> bool { pub fn matches_number_byte(self, b: u8) -> bool {
match self { match self {
Decimal => b.is_ascii_digit(), Decimal => b.is_ascii_digit(),
Binary => matches!(b, b'0'..=b'1'), Binary => matches!(b, b'0'..=b'1'),

View file

@ -42,7 +42,7 @@ impl<'a> Lexer<'a> {
fn read_non_decimal(&mut self, kind: Kind) -> Kind { fn read_non_decimal(&mut self, kind: Kind) -> Kind {
self.consume_char(); self.consume_char();
if self.peek_byte().is_some_and(|b| kind.matches_number_char(b)) { if self.peek_byte().is_some_and(|b| kind.matches_number_byte(b)) {
self.consume_char(); self.consume_char();
} else { } else {
self.unexpected_err(); self.unexpected_err();
@ -58,14 +58,14 @@ impl<'a> Lexer<'a> {
// call here instead of after we ensure the next character // call here instead of after we ensure the next character
// is a number character // is a number character
self.token.set_has_separator(); self.token.set_has_separator();
if self.peek_byte().is_some_and(|b| kind.matches_number_char(b)) { if self.peek_byte().is_some_and(|b| kind.matches_number_byte(b)) {
self.consume_char(); self.consume_char();
} else { } else {
self.unexpected_err(); self.unexpected_err();
return Kind::Undetermined; return Kind::Undetermined;
} }
} }
b if kind.matches_number_char(b) => { b if kind.matches_number_byte(b) => {
self.consume_char(); self.consume_char();
} }
_ => break, _ => break,