diff --git a/crates/oxc_regular_expression/src/body_parser/parser.rs b/crates/oxc_regular_expression/src/body_parser/parser.rs index 1544cb4a4948e..4d180c1bada40 100644 --- a/crates/oxc_regular_expression/src/body_parser/parser.rs +++ b/crates/oxc_regular_expression/src/body_parser/parser.rs @@ -7,7 +7,7 @@ use crate::{ body_parser::{diagnostics, reader::Reader, state::State, unicode, unicode_property}, options::ParserOptions, span::SpanFactory, - surroage_pair, + surrogate_pair, }; pub struct PatternParser<'a> { @@ -1848,14 +1848,15 @@ impl<'a> PatternParser<'a> { let span_start = self.reader.offset(); if let Some(lead_surrogate) = - self.reader.peek().filter(|&cp| surroage_pair::is_lead_surrogate(cp)) + self.reader.peek().filter(|&cp| surrogate_pair::is_lead_surrogate(cp)) { if let Some(trail_surrogate) = - self.reader.peek2().filter(|&cp| surroage_pair::is_trail_surrogate(cp)) + self.reader.peek2().filter(|&cp| surrogate_pair::is_trail_surrogate(cp)) { self.reader.advance(); self.reader.advance(); - let cp = surroage_pair::combine_surrogate_pair(lead_surrogate, trail_surrogate); + let cp = + surrogate_pair::combine_surrogate_pair(lead_surrogate, trail_surrogate); // [SS:EE] RegExpIdentifierStart :: UnicodeLeadSurrogate UnicodeTrailSurrogate // It is a Syntax Error if the RegExpIdentifierCodePoint of RegExpIdentifierStart is not matched by the UnicodeIDStart lexical grammar production. @@ -1908,15 +1909,16 @@ impl<'a> PatternParser<'a> { let span_start = self.reader.offset(); if let Some(lead_surrogate) = - self.reader.peek().filter(|&cp| surroage_pair::is_lead_surrogate(cp)) + self.reader.peek().filter(|&cp| surrogate_pair::is_lead_surrogate(cp)) { if let Some(trail_surrogate) = - self.reader.peek2().filter(|&cp| surroage_pair::is_trail_surrogate(cp)) + self.reader.peek2().filter(|&cp| surrogate_pair::is_trail_surrogate(cp)) { self.reader.advance(); self.reader.advance(); - let cp = surroage_pair::combine_surrogate_pair(lead_surrogate, trail_surrogate); + let cp = + surrogate_pair::combine_surrogate_pair(lead_surrogate, trail_surrogate); // [SS:EE] RegExpIdentifierPart :: UnicodeLeadSurrogate UnicodeTrailSurrogate // It is a Syntax Error if the RegExpIdentifierCodePoint of RegExpIdentifierPart is not matched by the UnicodeIDContinue lexical grammar production. if !unicode::is_unicode_id_continue(cp) { @@ -1956,14 +1958,14 @@ impl<'a> PatternParser<'a> { // HexLeadSurrogate + HexTrailSurrogate if let Some(lead_surrogate) = self .consume_fixed_hex_digits(4) - .filter(|&cp| surroage_pair::is_lead_surrogate(cp)) + .filter(|&cp| surrogate_pair::is_lead_surrogate(cp)) { if self.reader.eat2('\\', 'u') { if let Some(trail_surrogate) = self .consume_fixed_hex_digits(4) - .filter(|&cp| surroage_pair::is_trail_surrogate(cp)) + .filter(|&cp| surrogate_pair::is_trail_surrogate(cp)) { - return Ok(Some(surroage_pair::combine_surrogate_pair( + return Ok(Some(surrogate_pair::combine_surrogate_pair( lead_surrogate, trail_surrogate, ))); @@ -1975,7 +1977,7 @@ impl<'a> PatternParser<'a> { // HexLeadSurrogate if let Some(lead_surrogate) = self .consume_fixed_hex_digits(4) - .filter(|&cp| surroage_pair::is_lead_surrogate(cp)) + .filter(|&cp| surrogate_pair::is_lead_surrogate(cp)) { return Ok(Some(lead_surrogate)); } @@ -1984,7 +1986,7 @@ impl<'a> PatternParser<'a> { // HexTrailSurrogate if let Some(trail_surrogate) = self .consume_fixed_hex_digits(4) - .filter(|&cp| surroage_pair::is_trail_surrogate(cp)) + .filter(|&cp| surrogate_pair::is_trail_surrogate(cp)) { return Ok(Some(trail_surrogate)); } diff --git a/crates/oxc_regular_expression/src/display.rs b/crates/oxc_regular_expression/src/display.rs index e309ecbe3dbe1..1ccd905b15761 100644 --- a/crates/oxc_regular_expression/src/display.rs +++ b/crates/oxc_regular_expression/src/display.rs @@ -5,7 +5,7 @@ use std::{ #[allow(clippy::wildcard_imports)] use crate::ast::*; -use crate::surroage_pair::{combine_surrogate_pair, is_lead_surrogate, is_trail_surrogate}; +use crate::surrogate_pair::{combine_surrogate_pair, is_lead_surrogate, is_trail_surrogate}; impl<'a> Display for RegularExpression<'a> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/crates/oxc_regular_expression/src/lib.rs b/crates/oxc_regular_expression/src/lib.rs index c6e172a3241bb..e1ea7bae349a8 100644 --- a/crates/oxc_regular_expression/src/lib.rs +++ b/crates/oxc_regular_expression/src/lib.rs @@ -7,7 +7,7 @@ mod flag_parser; mod literal_parser; mod options; mod span; -mod surroage_pair; +mod surrogate_pair; mod generated { mod derive_clone_in; diff --git a/crates/oxc_regular_expression/src/surroage_pair.rs b/crates/oxc_regular_expression/src/surrogate_pair.rs similarity index 100% rename from crates/oxc_regular_expression/src/surroage_pair.rs rename to crates/oxc_regular_expression/src/surrogate_pair.rs