mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
refactor(regular_expression): correct typo (#5429)
Just correct a misspelling.
This commit is contained in:
parent
c984219e06
commit
e7bd49dae4
4 changed files with 16 additions and 14 deletions
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue