mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
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:
parent
8e3e9104e5
commit
59f00c0a44
2 changed files with 4 additions and 4 deletions
|
|
@ -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 {
|
||||
Decimal => b.is_ascii_digit(),
|
||||
Binary => matches!(b, b'0'..=b'1'),
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ impl<'a> Lexer<'a> {
|
|||
fn read_non_decimal(&mut self, kind: Kind) -> Kind {
|
||||
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();
|
||||
} else {
|
||||
self.unexpected_err();
|
||||
|
|
@ -58,14 +58,14 @@ impl<'a> Lexer<'a> {
|
|||
// call here instead of after we ensure the next character
|
||||
// is a number character
|
||||
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();
|
||||
} else {
|
||||
self.unexpected_err();
|
||||
return Kind::Undetermined;
|
||||
}
|
||||
}
|
||||
b if kind.matches_number_char(b) => {
|
||||
b if kind.matches_number_byte(b) => {
|
||||
self.consume_char();
|
||||
}
|
||||
_ => break,
|
||||
|
|
|
|||
Loading…
Reference in a new issue