mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 20:32: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();
|
||||
if !ch.is_ascii_lowercase() {
|
||||
self.error(diagnostics::RegExpFlag(ch, self.current_offset()));
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
let flag = if let Ok(flag) = RegExpFlags::try_from(ch) {
|
||||
flag
|
||||
} else {
|
||||
self.error(diagnostics::RegExpFlag(ch, self.current_offset()));
|
||||
break;
|
||||
continue;
|
||||
};
|
||||
if flags.contains(flag) {
|
||||
self.error(diagnostics::RegExpFlagTwice(ch, self.current_offset()));
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
flags |= flag;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue