mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
refactor(parser): convert lexer byte handler for | to a single match (#4575)
Same as #4573 and #4574. Convert lexer's byte handler for `|` to a single match rather than multiple `next_ascii_byte_eq` calls.
This commit is contained in:
parent
bba824bc34
commit
e68ed628b8
1 changed files with 14 additions and 9 deletions
|
|
@ -495,16 +495,21 @@ ascii_byte_handler!(BEO(lexer) {
|
|||
// |
|
||||
ascii_byte_handler!(PIP(lexer) {
|
||||
lexer.consume_char();
|
||||
if lexer.next_ascii_byte_eq(b'|') {
|
||||
if lexer.next_ascii_byte_eq(b'=') {
|
||||
Kind::Pipe2Eq
|
||||
} else {
|
||||
Kind::Pipe2
|
||||
|
||||
match lexer.peek_byte() {
|
||||
Some(b'|') => {
|
||||
lexer.consume_char();
|
||||
if lexer.next_ascii_byte_eq(b'=') {
|
||||
Kind::Pipe2Eq
|
||||
} else {
|
||||
Kind::Pipe2
|
||||
}
|
||||
}
|
||||
} else if lexer.next_ascii_byte_eq(b'=') {
|
||||
Kind::PipeEq
|
||||
} else {
|
||||
Kind::Pipe
|
||||
Some(b'=') => {
|
||||
lexer.consume_char();
|
||||
Kind::PipeEq
|
||||
}
|
||||
_ => Kind::Pipe
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue