put eq2, eq3, neq and neq2 as is_before_expr
MODIFY
crates/rslint_parser/src/tests.rs
crates/rslint_parser/src/tests.rs
@@ -324,3 +324,16 @@ pub fn node_contains_comments() {
assert!(syntax.contains_comments());
}
+
+#[test]
+fn parser_regexp_after_operator() {
+ fn assert_no_errors(src: &str) {
+ let module = parse(src, 0, SourceType::js_script());
+ assert_errors_are_absent(&module, Path::new("parser_regexp_after_operator"));
+ }
+ assert_no_errors(r#"a=/a/"#);
+ assert_no_errors(r#"a==/a/"#);
+ assert_no_errors(r#"a===/a/"#);
+ assert_no_errors(r#"a!=/a/"#);
+ assert_no_errors(r#"a!==/a/"#);
+}

MODIFY
crates/rslint_syntax/src/generated.rs
crates/rslint_syntax/src/generated.rs
@@ -549,9 +549,8 @@ impl JsSyntaxKind {
| MINUS2 | TILDE | CASE_KW | DEFAULT_KW | DO_KW | ELSE_KW | RETURN_KW | THROW_KW
| NEW_KW | EXTENDS_KW | YIELD_KW | IN_KW | TYPEOF_KW | VOID_KW | DELETE_KW | PLUSEQ
| INSTANCEOF_KW | MINUSEQ | PIPEEQ | AMPEQ | CARETEQ | SLASHEQ | STAREQ | PERCENTEQ
- | AMP2 | PIPE2 | SHLEQ | SHREQ | USHREQ | EQ | FAT_ARROW | MINUS | PLUS | AWAIT_KW => {
- true
- }
+ | AMP2 | PIPE2 | SHLEQ | SHREQ | USHREQ | EQ | EQ2 | EQ3 | NEQ | NEQ2 | FAT_ARROW
+ | MINUS | PLUS | AWAIT_KW => true,
_ => false,
}
}

MODIFY
xtask/codegen/src/generate_syntax_kinds.rs
xtask/codegen/src/generate_syntax_kinds.rs
@@ -134,7 +134,7 @@ pub fn generate_syntax_kinds(grammar: KindsSrc) -> Result<String> {
| MINUS2 | TILDE | CASE_KW | DEFAULT_KW | DO_KW | ELSE_KW | RETURN_KW | THROW_KW
| NEW_KW | EXTENDS_KW | YIELD_KW | IN_KW | TYPEOF_KW | VOID_KW | DELETE_KW | PLUSEQ
| INSTANCEOF_KW | MINUSEQ | PIPEEQ | AMPEQ | CARETEQ | SLASHEQ | STAREQ | PERCENTEQ
- | AMP2 | PIPE2 | SHLEQ | SHREQ | USHREQ | EQ | FAT_ARROW | MINUS | PLUS | AWAIT_KW => true,
+ | AMP2 | PIPE2 | SHLEQ | SHREQ | USHREQ | EQ | EQ2 | EQ3 | NEQ | NEQ2 | FAT_ARROW | MINUS | PLUS | AWAIT_KW => true,
_ => false,
}
}

put eq2, eq3, neq and neq2 as is_before_expr (#2200)