mirror of
https://github.com/danbulant/oxc
synced 2026-05-25 04:42:10 +00:00
fix(parser): restore regex flag parsing (#2007)
As discussed in https://github.com/oxc-project/oxc/pull/1999#issuecomment-1888916383, this PR restores some of regex parsing behavior to as it was prior to #1926.
This commit is contained in:
parent
1ecdeaa662
commit
712e99cf9b
1 changed files with 3 additions and 3 deletions
|
|
@ -872,17 +872,17 @@ impl<'a> Lexer<'a> {
|
||||||
self.current.chars.next();
|
self.current.chars.next();
|
||||||
if !ch.is_ascii_lowercase() {
|
if !ch.is_ascii_lowercase() {
|
||||||
self.error(diagnostics::RegExpFlag(ch, self.current_offset()));
|
self.error(diagnostics::RegExpFlag(ch, self.current_offset()));
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
let flag = if let Ok(flag) = RegExpFlags::try_from(ch) {
|
let flag = if let Ok(flag) = RegExpFlags::try_from(ch) {
|
||||||
flag
|
flag
|
||||||
} else {
|
} else {
|
||||||
self.error(diagnostics::RegExpFlag(ch, self.current_offset()));
|
self.error(diagnostics::RegExpFlag(ch, self.current_offset()));
|
||||||
break;
|
continue;
|
||||||
};
|
};
|
||||||
if flags.contains(flag) {
|
if flags.contains(flag) {
|
||||||
self.error(diagnostics::RegExpFlagTwice(ch, self.current_offset()));
|
self.error(diagnostics::RegExpFlagTwice(ch, self.current_offset()));
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
flags |= flag;
|
flags |= flag;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue