feat(rslint_lexer): add d flag to regex
MODIFY
crates/rslint_lexer/src/lib.rs
crates/rslint_lexer/src/lib.rs
@@ -982,7 +982,7 @@ impl<'src> Lexer<'src> {
Some(b']') => in_class = false,
Some(b'/') => {
if !in_class {
- let (mut g, mut i, mut m, mut s, mut u, mut y) = (false, false, false, false, false, false);
+ let (mut g, mut i, mut m, mut s, mut u, mut y, mut d) = (false, false, false, false, false, false, false);
unwind_loop! {
let next = self.next_bounded().copied();
@@ -1024,6 +1024,12 @@ impl<'src> Lexer<'src> {
}
y = true;
},
+ Some(b'd') => {
+ if d && diagnostic.is_none() {
+ diagnostic = Some(self.flag_err('d'))
+ }
+ d = true;
+ },
Some(_) if self.cur_ident_part().is_some() => {
if diagnostic.is_none() {
diagnostic = Some(Diagnostic::error(self.file_id, "", "invalid regex flag")

feat(rslint_lexer): add d flag to regex (#1927)