diff --git a/crates/oxc_parser/src/cursor.rs b/crates/oxc_parser/src/cursor.rs index b06c5c3204153..d5e62064eed08 100644 --- a/crates/oxc_parser/src/cursor.rs +++ b/crates/oxc_parser/src/cursor.rs @@ -2,7 +2,6 @@ use oxc_allocator::{TakeIn, Vec}; use oxc_ast::ast::{Decorator, RegExpFlags}; -use oxc_diagnostics::Result; use oxc_span::{GetSpan, Span}; use crate::{ @@ -219,10 +218,10 @@ impl<'a> ParserImpl<'a> { } /// Tell lexer to read a regex - pub(crate) fn read_regex(&mut self) -> Result<(u32, RegExpFlags, bool)> { - let (token, pattern_end, flags, flags_error) = self.lexer.next_regex(self.cur_kind())?; + pub(crate) fn read_regex(&mut self) -> (u32, RegExpFlags, bool) { + let (token, pattern_end, flags, flags_error) = self.lexer.next_regex(self.cur_kind()); self.token = token; - Ok((pattern_end, flags, flags_error)) + (pattern_end, flags, flags_error) } /// Tell lexer to read a template substitution tail diff --git a/crates/oxc_parser/src/js/expression.rs b/crates/oxc_parser/src/js/expression.rs index 7cd533c330b50..c7b8f10ee58b0 100644 --- a/crates/oxc_parser/src/js/expression.rs +++ b/crates/oxc_parser/src/js/expression.rs @@ -342,13 +342,10 @@ impl<'a> ParserImpl<'a> { pub(crate) fn parse_literal_regexp(&mut self) -> RegExpLiteral<'a> { let span = self.start_span(); - // split out pattern - let (pattern_end, flags, flags_error) = match self.read_regex() { - Ok(res) => res, - Err(error) => { - return self.fatal_error(error); - } - }; + let (pattern_end, flags, flags_error) = self.read_regex(); + if !self.lexer.errors.is_empty() { + return self.unexpected(); + } let pattern_start = self.cur_token().start + 1; // +1 to exclude left `/` let pattern_text = &self.source_text[pattern_start as usize..pattern_end as usize]; let flags_start = pattern_end + 1; // +1 to include right `/` diff --git a/crates/oxc_parser/src/lexer/regex.rs b/crates/oxc_parser/src/lexer/regex.rs index 06505746da6c2..18809ecd94d2c 100644 --- a/crates/oxc_parser/src/lexer/regex.rs +++ b/crates/oxc_parser/src/lexer/regex.rs @@ -1,4 +1,3 @@ -use oxc_diagnostics::Result; use oxc_syntax::identifier::is_line_terminator; use crate::diagnostics; @@ -12,31 +11,34 @@ impl Lexer<'_> { /// where a `RegularExpressionLiteral` is permitted /// Which means the parser needs to re-tokenize on `PrimaryExpression`, /// `RegularExpressionLiteral` only appear on the right hand side of `PrimaryExpression` - pub(crate) fn next_regex(&mut self, kind: Kind) -> Result<(Token, u32, RegExpFlags, bool)> { + pub(crate) fn next_regex(&mut self, kind: Kind) -> (Token, u32, RegExpFlags, bool) { self.token.start = self.offset() - match kind { Kind::Slash => 1, Kind::SlashEq => 2, _ => unreachable!(), }; - let (pattern_end, flags, flags_error) = self.read_regex()?; + let (pattern_end, flags, flags_error) = self.read_regex(); self.lookahead.clear(); let token = self.finish_next(Kind::RegExp); - Ok((token, pattern_end, flags, flags_error)) + (token, pattern_end, flags, flags_error) } /// 12.9.5 Regular Expression Literals - fn read_regex(&mut self) -> Result<(u32, RegExpFlags, bool)> { + fn read_regex(&mut self) -> (u32, RegExpFlags, bool) { let mut in_escape = false; let mut in_character_class = false; loop { match self.next_char() { None => { - return Err(diagnostics::unterminated_reg_exp(self.unterminated_range())); - // return (self.offset(), RegExpFlags::empty()); + self.error(diagnostics::unterminated_reg_exp(self.unterminated_range())); + self.advance_to_end(); + break; } Some(c) if is_line_terminator(c) => { - return Err(diagnostics::unterminated_reg_exp(self.unterminated_range())); + self.error(diagnostics::unterminated_reg_exp(self.unterminated_range())); + self.advance_to_end(); + break; } Some(c) => { if in_escape { @@ -82,6 +84,6 @@ impl Lexer<'_> { flags |= flag; } - Ok((pattern_end, flags, flags_error)) + (pattern_end, flags, flags_error) } } diff --git a/crates/oxc_parser/src/lib.rs b/crates/oxc_parser/src/lib.rs index 1a84be6bb74c7..a25bf8a4c26ba 100644 --- a/crates/oxc_parser/src/lib.rs +++ b/crates/oxc_parser/src/lib.rs @@ -337,7 +337,7 @@ mod parser_parse { /// /// # Errors /// If the source code being parsed has syntax errors. - pub fn parse_expression(self) -> std::result::Result, Vec> { + pub fn parse_expression(self) -> Result, Vec> { let unique = UniquePromise::new(); let parser = ParserImpl::new( self.allocator, @@ -496,7 +496,7 @@ impl<'a> ParserImpl<'a> { } } - pub fn parse_expression(mut self) -> std::result::Result, Vec> { + pub fn parse_expression(mut self) -> Result, Vec> { // initialize cur_token and prev_token by moving onto the first token self.bump_any(); let expr = self.parse_expr(); diff --git a/crates/oxc_parser/src/modifiers.rs b/crates/oxc_parser/src/modifiers.rs index 8b2f62ca4ee02..fa5fae189e49c 100644 --- a/crates/oxc_parser/src/modifiers.rs +++ b/crates/oxc_parser/src/modifiers.rs @@ -111,7 +111,7 @@ impl Modifier { impl TryFrom for Modifier { type Error = >::Error; - fn try_from(tok: Token) -> std::result::Result { + fn try_from(tok: Token) -> Result { ModifierKind::try_from(tok.kind).map(|kind| Self { span: tok.span(), kind }) } } @@ -261,7 +261,7 @@ impl ModifierKind { impl TryFrom for ModifierKind { type Error = (); - fn try_from(kind: Kind) -> std::result::Result { + fn try_from(kind: Kind) -> Result { match kind { Kind::Abstract => Ok(Self::Abstract), Kind::Declare => Ok(Self::Declare), diff --git a/tasks/coverage/snapshots/parser_babel.snap b/tasks/coverage/snapshots/parser_babel.snap index 845e354ce9296..983ce943a01e4 100644 --- a/tasks/coverage/snapshots/parser_babel.snap +++ b/tasks/coverage/snapshots/parser_babel.snap @@ -1742,12 +1742,24 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc · ─ ╰──── + × Unexpected token + ╭─[babel/packages/babel-parser/test/fixtures/core/uncategorised/364/input.js:1:1] + 1 │ / + · ─ + ╰──── + × Unterminated regular expression ╭─[babel/packages/babel-parser/test/fixtures/core/uncategorised/365/input.js:1:1] 1 │ /test · ───── ╰──── + × Unexpected token + ╭─[babel/packages/babel-parser/test/fixtures/core/uncategorised/365/input.js:1:1] + 1 │ /test + · ───── + ╰──── + × Invalid Unicode escape sequence ╭─[babel/packages/babel-parser/test/fixtures/core/uncategorised/366/input.js:1:17] 1 │ var x = /[a-z]/\ux @@ -1841,6 +1853,12 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc 2 │ / ╰──── + × Unexpected token + ╭─[babel/packages/babel-parser/test/fixtures/core/uncategorised/380/input.js:1:9] + 1 │ ╭─▶ var x = / + 2 │ ╰─▶ / + ╰──── + × Unterminated string ╭─[babel/packages/babel-parser/test/fixtures/core/uncategorised/381/input.js:1:9] 1 │ var x = " @@ -2223,6 +2241,12 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc 2 │ / ╰──── + × Unexpected token + ╭─[babel/packages/babel-parser/test/fixtures/core/uncategorised/441/input.js:1:1] + 1 │ ╭─▶ /a\ + 2 │ ╰─▶ / + ╰──── + × Unexpected token ╭─[babel/packages/babel-parser/test/fixtures/core/uncategorised/442/input.js:3:1] 2 │ @@ -3960,6 +3984,12 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc · ─ ╰──── + × Unexpected token + ╭─[babel/packages/babel-parser/test/fixtures/es2015/regex/duplicate-flags/input.js:1:1] + 1 │ /./gii; + · ────── + ╰──── + × Unexpected token ╭─[babel/packages/babel-parser/test/fixtures/es2015/shorthand/reserved-word/input.js:1:17] 1 │ var x = ({ const, if, this }); @@ -9997,12 +10027,24 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc · ── ╰──── + × Unexpected token + ╭─[babel/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0038/input.js:1:1] + 1 │ / + · ── + ╰──── + × Unterminated regular expression ╭─[babel/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0039/input.js:1:1] 1 │ /test · ────── ╰──── + × Unexpected token + ╭─[babel/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0039/input.js:1:1] + 1 │ /test + · ────── + ╰──── + × Unterminated regular expression ╭─[babel/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0040/input.js:1:1] 1 │ /test @@ -10010,6 +10052,12 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc 2 │ / ╰──── + × Unexpected token + ╭─[babel/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0040/input.js:1:1] + 1 │ ╭─▶ /test + 2 │ ╰─▶ / + ╰──── + × Invalid Unicode escape sequence ╭─[babel/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0041/input.js:1:17] 1 │ var x = /[a-z]/\ux @@ -10184,6 +10232,12 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc 2 │ / ╰──── + × Unexpected token + ╭─[babel/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0062/input.js:1:9] + 1 │ ╭─▶ var x = / + 2 │ ╰─▶ / + ╰──── + × Unterminated string ╭─[babel/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0063/input.js:1:9] 1 │ var x = " @@ -10723,6 +10777,12 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc 2 │ / ╰──── + × Unexpected token + ╭─[babel/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0157/input.js:1:1] + 1 │ ╭─▶ /a\ + 2 │ ╰─▶ / + ╰──── + × Unexpected token ╭─[babel/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0158/input.js:3:1] 2 │ diff --git a/tasks/coverage/snapshots/parser_test262.snap b/tasks/coverage/snapshots/parser_test262.snap index 649051e34d0ef..90786af033713 100644 --- a/tasks/coverage/snapshots/parser_test262.snap +++ b/tasks/coverage/snapshots/parser_test262.snap @@ -2659,6 +2659,13 @@ Negative Passed: 4519/4519 (100.00%) × Unterminated regular expression ╭─[test262/test/language/comments/S7.4_A4_T1.js:19:3] 18 │ /* var*/ + 19 │ x*/ + · ── + ╰──── + + × Unexpected token + ╭─[test262/test/language/comments/S7.4_A4_T1.js:19:3] + 18 │ /* var*/ 19 │ x*/ · ── ╰──── @@ -2666,6 +2673,13 @@ Negative Passed: 4519/4519 (100.00%) × Unterminated regular expression ╭─[test262/test/language/comments/S7.4_A4_T4.js:19:3] 18 │ // var /* + 19 │ x*/ + · ── + ╰──── + + × Unexpected token + ╭─[test262/test/language/comments/S7.4_A4_T4.js:19:3] + 18 │ // var /* 19 │ x*/ · ── ╰──── @@ -21200,6 +21214,13 @@ Negative Passed: 4519/4519 (100.00%) · ─ ╰──── + × Unexpected token + ╭─[test262/test/language/line-terminators/invalid-regexp-cr.js:18:1] + 17 │ + 18 │ / / + · ─── + ╰──── + × Unterminated regular expression ╭─[test262/test/language/line-terminators/invalid-regexp-lf.js:18:1] 17 │ @@ -21208,6 +21229,13 @@ Negative Passed: 4519/4519 (100.00%) 19 │ / ╰──── + × Unexpected token + ╭─[test262/test/language/line-terminators/invalid-regexp-lf.js:18:1] + 17 │ + 18 │ ╭─▶ / + 19 │ ╰─▶ / + ╰──── + × Unterminated regular expression ╭─[test262/test/language/line-terminators/invalid-regexp-ls.js:18:1] 17 │ @@ -21215,6 +21243,13 @@ Negative Passed: 4519/4519 (100.00%) · ── ╰──── + × Unexpected token + ╭─[test262/test/language/line-terminators/invalid-regexp-ls.js:18:1] + 17 │ + 18 │ /
/ + · ──── + ╰──── + × Unterminated regular expression ╭─[test262/test/language/line-terminators/invalid-regexp-ps.js:18:1] 17 │ @@ -21222,6 +21257,13 @@ Negative Passed: 4519/4519 (100.00%) · ── ╰──── + × Unexpected token + ╭─[test262/test/language/line-terminators/invalid-regexp-ps.js:18:1] + 17 │ + 18 │ /
/ + · ──── + ╰──── + × Unterminated string ╭─[test262/test/language/line-terminators/invalid-string-cr.js:17:1] 16 │ @@ -21983,6 +22025,13 @@ Negative Passed: 4519/4519 (100.00%) × Unterminated regular expression ╭─[test262/test/language/literals/regexp/S7.8.5_A1.2_T2.js:27:1] 26 │ + 27 │ /\/ + · ──── + ╰──── + + × Unexpected token + ╭─[test262/test/language/literals/regexp/S7.8.5_A1.2_T2.js:27:1] + 26 │ 27 │ /\/ · ──── ╰──── @@ -22009,6 +22058,13 @@ Negative Passed: 4519/4519 (100.00%) 31 │ / ╰──── + × Unexpected token + ╭─[test262/test/language/literals/regexp/S7.8.5_A1.3_T1.js:30:1] + 29 │ + 30 │ ╭─▶ / + 31 │ ╰─▶ / + ╰──── + × Unterminated regular expression ╭─[test262/test/language/literals/regexp/S7.8.5_A1.3_T3.js:30:1] 29 │ @@ -22017,6 +22073,13 @@ Negative Passed: 4519/4519 (100.00%) 31 │ / ╰──── + × Unexpected token + ╭─[test262/test/language/literals/regexp/S7.8.5_A1.3_T3.js:30:1] + 29 │ + 30 │ ╭─▶ / + 31 │ ╰─▶ / + ╰──── + × Unterminated regular expression ╭─[test262/test/language/literals/regexp/S7.8.5_A1.5_T1.js:24:1] 23 │ @@ -22025,6 +22088,13 @@ Negative Passed: 4519/4519 (100.00%) 25 │ / ╰──── + × Unexpected token + ╭─[test262/test/language/literals/regexp/S7.8.5_A1.5_T1.js:24:1] + 23 │ + 24 │ ╭─▶ /\ + 25 │ ╰─▶ / + ╰──── + × Unterminated regular expression ╭─[test262/test/language/literals/regexp/S7.8.5_A1.5_T3.js:23:1] 22 │ @@ -22033,9 +22103,23 @@ Negative Passed: 4519/4519 (100.00%) 24 │ / ╰──── + × Unexpected token + ╭─[test262/test/language/literals/regexp/S7.8.5_A1.5_T3.js:23:1] + 22 │ + 23 │ ╭─▶ /\ + 24 │ ╰─▶ / + ╰──── + × Unterminated regular expression ╭─[test262/test/language/literals/regexp/S7.8.5_A2.2_T1.js:24:1] 23 │ + 24 │ /a\/ + · ───── + ╰──── + + × Unexpected token + ╭─[test262/test/language/literals/regexp/S7.8.5_A2.2_T1.js:24:1] + 23 │ 24 │ /a\/ · ───── ╰──── @@ -22055,6 +22139,13 @@ Negative Passed: 4519/4519 (100.00%) 34 │ / ╰──── + × Unexpected token + ╭─[test262/test/language/literals/regexp/S7.8.5_A2.3_T1.js:33:1] + 32 │ + 33 │ ╭─▶ /a + 34 │ ╰─▶ / + ╰──── + × Unterminated regular expression ╭─[test262/test/language/literals/regexp/S7.8.5_A2.3_T3.js:34:1] 33 │ @@ -22063,6 +22154,13 @@ Negative Passed: 4519/4519 (100.00%) 35 │ / ╰──── + × Unexpected token + ╭─[test262/test/language/literals/regexp/S7.8.5_A2.3_T3.js:34:1] + 33 │ + 34 │ ╭─▶ /a + 35 │ ╰─▶ / + ╰──── + × Unterminated regular expression ╭─[test262/test/language/literals/regexp/S7.8.5_A2.5_T1.js:29:1] 28 │ @@ -22071,6 +22169,13 @@ Negative Passed: 4519/4519 (100.00%) 30 │ / ╰──── + × Unexpected token + ╭─[test262/test/language/literals/regexp/S7.8.5_A2.5_T1.js:29:1] + 28 │ + 29 │ ╭─▶ /a\ + 30 │ ╰─▶ / + ╰──── + × Unterminated regular expression ╭─[test262/test/language/literals/regexp/S7.8.5_A2.5_T3.js:29:1] 28 │ @@ -22079,6 +22184,13 @@ Negative Passed: 4519/4519 (100.00%) 30 │ / ╰──── + × Unexpected token + ╭─[test262/test/language/literals/regexp/S7.8.5_A2.5_T3.js:29:1] + 28 │ + 29 │ ╭─▶ /a\ + 30 │ ╰─▶ / + ╰──── + × Invalid regular expression: Invalid modifiers ╭─[test262/test/language/literals/regexp/early-err-arithmetic-modifiers-add-remove-i.js:20:4] 19 │ @@ -22492,6 +22604,13 @@ Negative Passed: 4519/4519 (100.00%) · ─ ╰──── + × Unexpected token + ╭─[test262/test/language/literals/regexp/early-err-bad-flag.js:19:1] + 18 │ + 19 │ /./G; + · ──── + ╰──── + × Flag g is mentioned twice in regular expression literal ╭─[test262/test/language/literals/regexp/early-err-dup-flag.js:19:6] 18 │ @@ -22499,6 +22618,13 @@ Negative Passed: 4519/4519 (100.00%) · ─ ╰──── + × Unexpected token + ╭─[test262/test/language/literals/regexp/early-err-dup-flag.js:19:1] + 18 │ + 19 │ /./gig; + · ────── + ╰──── + × Expected a semicolon or an implicit semicolon after a statement, but found none ╭─[test262/test/language/literals/regexp/early-err-flags-unicode-escape.js:19:4] 18 │ @@ -23124,6 +23250,16 @@ Negative Passed: 4519/4519 (100.00%) 31 │ ╰──── + × Unexpected token + ╭─[test262/test/language/literals/regexp/regexp-first-char-no-line-separator.js:30:1] + 29 │ + 30 │ ╭─▶ /
/ + 31 │ │ + 32 │ │ /* + 33 │ │ There is a between the two / characters + 34 │ ╰─▶ */ + ╰──── + × Unterminated regular expression ╭─[test262/test/language/literals/regexp/regexp-first-char-no-paragraph-separator.js:30:1] 29 │ @@ -23132,6 +23268,16 @@ Negative Passed: 4519/4519 (100.00%) 31 │ ╰──── + × Unexpected token + ╭─[test262/test/language/literals/regexp/regexp-first-char-no-paragraph-separator.js:30:1] + 29 │ + 30 │ ╭─▶ /
/ + 31 │ │ + 32 │ │ /* + 33 │ │ There is a between the two / characters + 34 │ ╰─▶ */ + ╰──── + × Unterminated regular expression ╭─[test262/test/language/literals/regexp/regexp-source-char-no-line-separator.js:29:1] 28 │ @@ -23140,6 +23286,16 @@ Negative Passed: 4519/4519 (100.00%) 30 │ ╰──── + × Unexpected token + ╭─[test262/test/language/literals/regexp/regexp-source-char-no-line-separator.js:29:1] + 28 │ + 29 │ ╭─▶ /a\\
/ + 30 │ │ + 31 │ │ /* + 32 │ │ There is a between "a\\
" and "/" + 33 │ ╰─▶ */ + ╰──── + × Unterminated regular expression ╭─[test262/test/language/literals/regexp/regexp-source-char-no-paragraph-separator.js:30:1] 29 │ @@ -23148,6 +23304,16 @@ Negative Passed: 4519/4519 (100.00%) 31 │ ╰──── + × Unexpected token + ╭─[test262/test/language/literals/regexp/regexp-source-char-no-paragraph-separator.js:30:1] + 29 │ + 30 │ ╭─▶ /a\\

/ + 31 │ │ + 32 │ │ /* + 33 │ │ There is a between "a\\
" and "/" + 34 │ ╰─▶ */ + ╰──── + × Invalid regular expression: Could not parse the entire pattern ╭─[test262/test/language/literals/regexp/u-invalid-class-escape.js:24:3] 23 │ diff --git a/tasks/coverage/snapshots/parser_typescript.snap b/tasks/coverage/snapshots/parser_typescript.snap index 6e36d22569340..b01080b824c9b 100644 --- a/tasks/coverage/snapshots/parser_typescript.snap +++ b/tasks/coverage/snapshots/parser_typescript.snap @@ -16103,223 +16103,6 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/salsa/private 4 │ // Pattern modifiers ╰──── - × Invalid regular expression: Unknown modifiers - ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:5:5] - 4 │ // Pattern modifiers - 5 │ /(?med-ium:bar)/, - · ─ - 6 │ // Capturing groups - ╰──── - - × Invalid regular expression: Invalid indexed reference - ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:13:8] - 12 │ /\2()(\12)(foo)\1\0[\0\1\01\123\08\8](\3\03)\5\005\9\009/, - 13 │ /\2()(\12)(foo)\1\0[\0\1\01\123\08\8](\3\03)\5\005\9\009/u, - · ─── - 14 │ /(?)((?bar)bar)(?baz)|(foo(?foo))(?)/, - ╰──── - - × Invalid regular expression: Group specifier is empty - ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:15:12] - 14 │ /(?)((?bar)bar)(?baz)|(foo(?foo))(?)/, - 15 │ /(\k)\k(?foo)|(?)((?)|(bar(?bar)))/, - · ────────── - 16 │ // Quantifiers - ╰──── - - × Invalid regular expression: Numbers out of order in braced quantifier - ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:17:31] - 16 │ // Quantifiers - 17 │ /{}{1,2}_{3}.{4,}?(foo){008}${32,16}\b{064,128}.+&*?\???\n{,256}{\\{,/, - · ─────── - 18 │ // Character classes - ╰──── - - × Invalid regular expression: Character class atom range out of order - ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:19:13] - 18 │ // Character classes - 19 │ /[-A-Za-z-z-aZ-A\d_-\d-.-.\r-\n\w-\W]/, - · ── - 20 │ /\p{L}\p{gc=L}\p{ASCII}\p{Invalid}[\p{L}\p{gc=L}\P{ASCII}\p{Invalid}]/, - ╰──── - - × Invalid regular expression: Invalid unicode property name and/or value - ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:21:28] - 20 │ /\p{L}\p{gc=L}\p{ASCII}\p{Invalid}[\p{L}\p{gc=L}\P{ASCII}\p{Invalid}]/, - 21 │ /\p{L}\p{gc=L}\p{ASCII}\p{Invalid}[\p{L}\p{gc=L}\P{ASCII}\p{Invalid}]/u, - · ─────── - 22 │ /\p{L}\p{gc=L}\p{ASCII}\p{Invalid}[\p{L}\p{gc=L}\P{ASCII}\p{Invalid}]/v, - ╰──── - - × Invalid regular expression: Invalid unicode property name and/or value - ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:22:28] - 21 │ /\p{L}\p{gc=L}\p{ASCII}\p{Invalid}[\p{L}\p{gc=L}\P{ASCII}\p{Invalid}]/u, - 22 │ /\p{L}\p{gc=L}\p{ASCII}\p{Invalid}[\p{L}\p{gc=L}\P{ASCII}\p{Invalid}]/v, - · ─────── - 23 │ /\p{InvalidProperty=Value}\p{=}\p{sc=}\P{=foo}[\p{}\p\\\P\P{]\p{/, - ╰──── - - × Invalid regular expression: Invalid unicode property name - ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:24:22] - 23 │ /\p{InvalidProperty=Value}\p{=}\p{sc=}\P{=foo}[\p{}\p\\\P\P{]\p{/, - 24 │ /\p{InvalidProperty=Value}\p{=}\p{sc=}\P{=foo}[\p{}\p\\\P\P{]\p{/u, - · ───── - 25 │ /\p{InvalidProperty=Value}\p{=}\p{sc=}\P{=foo}[\p{}\p\\\P\P{]\p{/v, - ╰──── - - × Invalid regular expression: Invalid unicode property name - ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:25:22] - 24 │ /\p{InvalidProperty=Value}\p{=}\p{sc=}\P{=foo}[\p{}\p\\\P\P{]\p{/u, - 25 │ /\p{InvalidProperty=Value}\p{=}\p{sc=}\P{=foo}[\p{}\p\\\P\P{]\p{/v, - · ───── - 26 │ /\p{RGI_Emoji}\P{RGI_Emoji}[^\p{RGI_Emoji}\P{RGI_Emoji}]/, - ╰──── - - × Invalid regular expression: Invalid unicode property `RGI_Emoji` - ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:27:6] - 26 │ /\p{RGI_Emoji}\P{RGI_Emoji}[^\p{RGI_Emoji}\P{RGI_Emoji}]/, - 27 │ /\p{RGI_Emoji}\P{RGI_Emoji}[^\p{RGI_Emoji}\P{RGI_Emoji}]/u, - · ───────── - 28 │ /\p{RGI_Emoji}\P{RGI_Emoji}[^\p{RGI_Emoji}\P{RGI_Emoji}]/v, - ╰──── - help: Enable `UnicodeSetsMode` to use this property - - × Invalid regular expression: Invalid property name `RGI_Emoji`(negative + property of strings) - ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:28:16] - 27 │ /\p{RGI_Emoji}\P{RGI_Emoji}[^\p{RGI_Emoji}\P{RGI_Emoji}]/u, - 28 │ /\p{RGI_Emoji}\P{RGI_Emoji}[^\p{RGI_Emoji}\P{RGI_Emoji}]/v, - · ───────────── - 29 │ // Character escapes - ╰──── - - × Invalid regular expression: Could not parse the entire pattern - ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:31:4] - 30 │ /\c[\c0\ca\cQ\c\C]\c1\C/, - 31 │ /\c[\c0\ca\cQ\c\C]\c1\C/u, - · ▲ - 32 │ /\q\\\`[\q\\\`[\Q\\\Q{\q{foo|bar|baz]\q{]\q{/, - ╰──── - - × Invalid regular expression: Could not parse the entire pattern - ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:33:4] - 32 │ /\q\\\`[\q\\\`[\Q\\\Q{\q{foo|bar|baz]\q{]\q{/, - 33 │ /\q\\\`[\q\\\`[\Q\\\Q{\q{foo|bar|baz]\q{]\q{/u, - · ▲ - 34 │ /\q\\\`[\q\\\`[\Q\\\Q{\q{foo|bar|baz]\q{]\q{/v, - ╰──── - - × Invalid regular expression: Could not parse the entire pattern - ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:34:4] - 33 │ /\q\\\`[\q\\\`[\Q\\\Q{\q{foo|bar|baz]\q{]\q{/u, - 34 │ /\q\\\`[\q\\\`[\Q\\\Q{\q{foo|bar|baz]\q{]\q{/v, - · ▲ - 35 │ // Unicode sets notation - ╰──── - - × Invalid regular expression: Character class atom range out of order - ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:36:5] - 35 │ // Unicode sets notation - 36 │ /[a--b[--][\d++[]]&&[[&0-9--]&&[\p{L}]--\P{L}-_-]]&&&\q{foo}[0---9][&&q&&&\q{bar}&&]/, - · ── - 37 │ /[a--b[--][\d++[]]&&[[&0-9--]&&[\p{L}]--\P{L}-_-]]&&&\q{foo}[0---9][&&q&&&\q{bar}&&]/u, - ╰──── - - × Invalid regular expression: Character class atom range out of order - ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:37:5] - 36 │ /[a--b[--][\d++[]]&&[[&0-9--]&&[\p{L}]--\P{L}-_-]]&&&\q{foo}[0---9][&&q&&&\q{bar}&&]/, - 37 │ /[a--b[--][\d++[]]&&[[&0-9--]&&[\p{L}]--\P{L}-_-]]&&&\q{foo}[0---9][&&q&&&\q{bar}&&]/u, - · ── - 38 │ /[a--b[--][\d++[]]&&[[&0-9--]&&[\p{L}]--\P{L}-_-]]&&&\q{foo}[0---9][&&q&&&\q{bar}&&]/v, - ╰──── - - × Invalid regular expression: Unexpected character inside of class subtraction - ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:38:8] - 37 │ /[a--b[--][\d++[]]&&[[&0-9--]&&[\p{L}]--\P{L}-_-]]&&&\q{foo}[0---9][&&q&&&\q{bar}&&]/u, - 38 │ /[a--b[--][\d++[]]&&[[&0-9--]&&[\p{L}]--\P{L}-_-]]&&&\q{foo}[0---9][&&q&&&\q{bar}&&]/v, - · ▲ - 39 │ /[[^\P{Decimal_Number}&&[0-9]]&&\p{L}&&\p{ID_Continue}--\p{ASCII}\p{CWCF}]/v, - ╰──── - - × Invalid regular expression: Unexpected character inside of class intersection - ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:39:56] - 38 │ /[a--b[--][\d++[]]&&[[&0-9--]&&[\p{L}]--\P{L}-_-]]&&&\q{foo}[0---9][&&q&&&\q{bar}&&]/v, - 39 │ /[[^\P{Decimal_Number}&&[0-9]]&&\p{L}&&\p{ID_Continue}--\p{ASCII}\p{CWCF}]/v, - · ▲ - 40 │ /[^\p{Emoji}\p{RGI_Emoji}][^\p{Emoji}--\p{RGI_Emoji}][^\p{Emoji}&&\p{RGI_Emoji}]/v, - ╰──── - - × Invalid regular expression: Invalid character class with strings unicode property - ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:40:3] - 39 │ /[[^\P{Decimal_Number}&&[0-9]]&&\p{L}&&\p{ID_Continue}--\p{ASCII}\p{CWCF}]/v, - 40 │ /[^\p{Emoji}\p{RGI_Emoji}][^\p{Emoji}--\p{RGI_Emoji}][^\p{Emoji}&&\p{RGI_Emoji}]/v, - · ───────────────────────── - 41 │ /[^\p{RGI_Emoji}\p{Emoji}][^\p{RGI_Emoji}--\p{Emoji}][^\p{RGI_Emoji}&&\p{Emoji}]/v, - ╰──── - - × Invalid regular expression: Invalid character class with strings unicode property - ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:41:3] - 40 │ /[^\p{Emoji}\p{RGI_Emoji}][^\p{Emoji}--\p{RGI_Emoji}][^\p{Emoji}&&\p{RGI_Emoji}]/v, - 41 │ /[^\p{RGI_Emoji}\p{Emoji}][^\p{RGI_Emoji}--\p{Emoji}][^\p{RGI_Emoji}&&\p{Emoji}]/v, - · ───────────────────────── - 42 │ /[^\p{RGI_Emoji}\q{foo}][^\p{RGI_Emoji}--\q{foo}][^\p{RGI_Emoji}&&\q{foo}]/v, - ╰──── - - × Invalid regular expression: Invalid character class with strings unicode property - ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:42:3] - 41 │ /[^\p{RGI_Emoji}\p{Emoji}][^\p{RGI_Emoji}--\p{Emoji}][^\p{RGI_Emoji}&&\p{Emoji}]/v, - 42 │ /[^\p{RGI_Emoji}\q{foo}][^\p{RGI_Emoji}--\q{foo}][^\p{RGI_Emoji}&&\q{foo}]/v, - · ─────────────────────── - 43 │ /[^\p{Emoji}[[\p{RGI_Emoji}]]][^\p{Emoji}--[[\p{RGI_Emoji}]]][^\p{Emoji}&&[[\p{RGI_Emoji}]]]/v, - ╰──── - - × Invalid regular expression: Invalid character class with strings unicode property - ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:43:3] - 42 │ /[^\p{RGI_Emoji}\q{foo}][^\p{RGI_Emoji}--\q{foo}][^\p{RGI_Emoji}&&\q{foo}]/v, - 43 │ /[^\p{Emoji}[[\p{RGI_Emoji}]]][^\p{Emoji}--[[\p{RGI_Emoji}]]][^\p{Emoji}&&[[\p{RGI_Emoji}]]]/v, - · ───────────────────────────── - 44 │ /[^[[\p{RGI_Emoji}]]\p{Emoji}][^[[\p{RGI_Emoji}]]--\p{Emoji}][^[[\p{RGI_Emoji}]]&&\p{Emoji}]/v, - ╰──── - - × Invalid regular expression: Invalid character class with strings unicode property - ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:44:3] - 43 │ /[^\p{Emoji}[[\p{RGI_Emoji}]]][^\p{Emoji}--[[\p{RGI_Emoji}]]][^\p{Emoji}&&[[\p{RGI_Emoji}]]]/v, - 44 │ /[^[[\p{RGI_Emoji}]]\p{Emoji}][^[[\p{RGI_Emoji}]]--\p{Emoji}][^[[\p{RGI_Emoji}]]&&\p{Emoji}]/v, - · ───────────────────────────── - 45 │ /[^[[\p{RGI_Emoji}]]\q{foo}][^[[\p{RGI_Emoji}]]--\q{foo}][^[[\p{RGI_Emoji}]]&&\q{foo}]/v, - ╰──── - - × Invalid regular expression: Invalid character class with strings unicode property - ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:45:3] - 44 │ /[^[[\p{RGI_Emoji}]]\p{Emoji}][^[[\p{RGI_Emoji}]]--\p{Emoji}][^[[\p{RGI_Emoji}]]&&\p{Emoji}]/v, - 45 │ /[^[[\p{RGI_Emoji}]]\q{foo}][^[[\p{RGI_Emoji}]]--\q{foo}][^[[\p{RGI_Emoji}]]&&\q{foo}]/v, - · ─────────────────────────── - 46 │ /[^\q{foo|bar|baz}--\q{foo}--\q{bar}--\q{baz}][^\p{L}--\q{foo}--[\q{bar}]--[^[\q{baz}]]]/v, - ╰──── - - × Invalid regular expression: Invalid character class with strings unicode property - ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:46:3] - 45 │ /[^[[\p{RGI_Emoji}]]\q{foo}][^[[\p{RGI_Emoji}]]--\q{foo}][^[[\p{RGI_Emoji}]]&&\q{foo}]/v, - 46 │ /[^\q{foo|bar|baz}--\q{foo}--\q{bar}--\q{baz}][^\p{L}--\q{foo}--[\q{bar}]--[^[\q{baz}]]]/v, - · ───────────────────────────────────────────── - 47 │ /[^[[\q{foo|bar|baz}]]--\q{foo}--\q{bar}--\q{baz}][^[^[^\p{L}]]--\q{foo}--[\q{bar}]--[^[\q{baz}]]]/v, - ╰──── - - × Invalid regular expression: Invalid character class with strings unicode property - ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:47:3] - 46 │ /[^\q{foo|bar|baz}--\q{foo}--\q{bar}--\q{baz}][^\p{L}--\q{foo}--[\q{bar}]--[^[\q{baz}]]]/v, - 47 │ /[^[[\q{foo|bar|baz}]]--\q{foo}--\q{bar}--\q{baz}][^[^[^\p{L}]]--\q{foo}--[\q{bar}]--[^[\q{baz}]]]/v, - · ───────────────────────────────────────────────── - 48 │ ]; - ╰──── - - × The 'u' and 'v' regular expression flags cannot be enabled at the same time - ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:3:2] - 2 │ // Flags - 3 │ /foo/visualstudiocode, - · ───────────────────── - 4 │ // Pattern modifiers - ╰──── - × Invalid regular expression: Invalid unicode property name and/or value ╭─[typescript/tests/cases/compiler/regularExpressionUnicodePropertyValueExpressionSuggestions.ts:1:19] 1 │ const regex = /\p{ascii}\p{Sc=Unknown}\p{sc=unknownX}\p{Script_Declensions=Inherited}\p{scx=inherit}/u; @@ -18210,6 +17993,12 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/salsa/private · ─ ╰──── + × Unexpected token + ╭─[typescript/tests/cases/compiler/unterminatedRegexAtEndOfSource1.ts:1:9] + 1 │ var a = / + · ─ + ╰──── + × Unterminated string ╭─[typescript/tests/cases/compiler/unterminatedStringLiteralWithBackslash1.ts:1:1] 1 │ "\ @@ -26821,6 +26610,12 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/salsa/private · ──── ╰──── + × Unexpected token + ╭─[typescript/tests/cases/conformance/parser/ecmascript5/MissingTokens/parserMissingToken2.ts:1:1] + 1 │ / b; + · ──── + ╰──── + × Expected `(` but found `;` ╭─[typescript/tests/cases/conformance/parser/ecmascript5/ObjectTypes/parserObjectType5.ts:3:7] 2 │ A: B @@ -27114,6 +26909,12 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/salsa/private · ─ ╰──── + × Unexpected token + ╭─[typescript/tests/cases/conformance/parser/ecmascript5/RegularExpressions/parserRegularExpressionDivideAmbiguity3.ts:1:8] + 1 │ if (1) /regexp/a.foo(); + · ───────── + ╰──── + × Unterminated regular expression ╭─[typescript/tests/cases/conformance/parser/ecmascript5/RegularExpressions/parserRegularExpressionDivideAmbiguity4.ts:1:5] 1 │ foo(/notregexp);