diff --git a/TypeScript.YAML-tmLanguage b/TypeScript.YAML-tmLanguage
index 891f1805..69b1f230 100644
--- a/TypeScript.YAML-tmLanguage
+++ b/TypeScript.YAML-tmLanguage
@@ -2519,7 +2519,7 @@ repository:
regex:
patterns:
- name: string.regexp.ts
- begin: (?|&&|\|\||\*\/)\s*(\/)(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/[gimsuy]*(?!\s*[a-zA-Z0-9_$]))
+ begin: (?|&&|\|\||\*\/)\s*(\/)(?![\/*])(?=(?:[^\/\\\[\()]|\\.|\[([^\]\\]|\\.)+\]|\(([^\)\\]|\\.)+\))+\/[gimsuy]*(?!\s*[a-zA-Z0-9_$]))
beginCaptures:
'1': { name: punctuation.definition.string.begin.ts }
end: (/)([gimsuy]*)
@@ -2530,7 +2530,7 @@ repository:
- include: '#regexp'
# Check if complete regexp syntax
- name: string.regexp.ts
- begin: (?name
string.regexp.ts
begin
- (?<!\+\+|--|})(?<=[=(:,\[?+!]|^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case|=>|&&|\|\||\*\/)\s*(\/)(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/[gimsuy]*(?!\s*[a-zA-Z0-9_$]))
+ (?<!\+\+|--|})(?<=[=(:,\[?+!]|^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case|=>|&&|\|\||\*\/)\s*(\/)(?![\/*])(?=(?:[^\/\\\[\()]|\\.|\[([^\]\\]|\\.)+\]|\(([^\)\\]|\\.)+\))+\/[gimsuy]*(?!\s*[a-zA-Z0-9_$]))
beginCaptures
1
@@ -7636,7 +7636,7 @@
name
string.regexp.ts
begin
- (?<![_$[:alnum:])\]]|\+\+|--|})\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/[gimsuy]*(?!\s*[a-zA-Z0-9_$]))
+ (?<![_$[:alnum:])\]]|\+\+|--|}|\*\/)\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/[gimsuy]*(?!\s*[a-zA-Z0-9_$]))
beginCaptures
0
diff --git a/TypeScriptReact.tmLanguage b/TypeScriptReact.tmLanguage
index f4f707bc..1700f7f0 100644
--- a/TypeScriptReact.tmLanguage
+++ b/TypeScriptReact.tmLanguage
@@ -7522,7 +7522,7 @@
name
string.regexp.tsx
begin
- (?<!\+\+|--|})(?<=[=(:,\[?+!]|^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case|=>|&&|\|\||\*\/)\s*(\/)(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/[gimsuy]*(?!\s*[a-zA-Z0-9_$]))
+ (?<!\+\+|--|})(?<=[=(:,\[?+!]|^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case|=>|&&|\|\||\*\/)\s*(\/)(?![\/*])(?=(?:[^\/\\\[\()]|\\.|\[([^\]\\]|\\.)+\]|\(([^\)\\]|\\.)+\))+\/[gimsuy]*(?!\s*[a-zA-Z0-9_$]))
beginCaptures
1
@@ -7558,7 +7558,7 @@
name
string.regexp.tsx
begin
- (?<![_$[:alnum:])\]]|\+\+|--|})\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/[gimsuy]*(?!\s*[a-zA-Z0-9_$]))
+ (?<![_$[:alnum:])\]]|\+\+|--|}|\*\/)\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/[gimsuy]*(?!\s*[a-zA-Z0-9_$]))
beginCaptures
0
diff --git a/tests/baselines/Issue717.baseline.txt b/tests/baselines/Issue717.baseline.txt
new file mode 100644
index 00000000..6c0d29d0
--- /dev/null
+++ b/tests/baselines/Issue717.baseline.txt
@@ -0,0 +1,268 @@
+original file
+-----------------------------------
+/* regex? */
+function test() {
+ return /"/.test('xxx"xxx');
+}
+
+console.log(test());
+a = 3 /*test*/ / parseInt(/.+/.exec('3f23fg')[0]);
+console.log(a);
+
+b = 1
+a = () => b
+2 + (b=2), 3
+b = 6
+console.log(a(),b);
+(b)
+
+if (a === 1) {
+ b = 2
+} else if (a === 2) b = 3
+else b = 4
+c = 1
+-----------------------------------
+
+Grammar: TypeScript.tmLanguage
+-----------------------------------
+>/* regex? */
+ ^^
+ source.ts comment.block.ts punctuation.definition.comment.ts
+ ^^^^^^^^
+ source.ts comment.block.ts
+ ^^
+ source.ts comment.block.ts punctuation.definition.comment.ts
+>function test() {
+ ^^^^^^^^
+ source.ts meta.function.ts storage.type.function.ts
+ ^
+ source.ts meta.function.ts
+ ^^^^
+ source.ts meta.function.ts meta.definition.function.ts entity.name.function.ts
+ ^
+ source.ts meta.function.ts meta.parameters.ts punctuation.definition.parameters.begin.ts
+ ^
+ source.ts meta.function.ts meta.parameters.ts punctuation.definition.parameters.end.ts
+ ^
+ source.ts meta.function.ts
+ ^
+ source.ts meta.function.ts meta.block.ts punctuation.definition.block.ts
+> return /"/.test('xxx"xxx');
+ ^^^
+ source.ts meta.function.ts meta.block.ts
+ ^^^^^^
+ source.ts meta.function.ts meta.block.ts keyword.control.flow.ts
+ ^
+ source.ts meta.function.ts meta.block.ts string.regexp.ts
+ ^
+ source.ts meta.function.ts meta.block.ts string.regexp.ts punctuation.definition.string.begin.ts
+ ^
+ source.ts meta.function.ts meta.block.ts string.regexp.ts
+ ^
+ source.ts meta.function.ts meta.block.ts string.regexp.ts punctuation.definition.string.end.ts
+ ^
+ source.ts meta.function.ts meta.block.ts meta.function-call.ts punctuation.accessor.ts
+ ^^^^
+ source.ts meta.function.ts meta.block.ts meta.function-call.ts support.function.ts
+ ^
+ source.ts meta.function.ts meta.block.ts meta.brace.round.ts
+ ^
+ source.ts meta.function.ts meta.block.ts string.quoted.single.ts punctuation.definition.string.begin.ts
+ ^^^^^^^
+ source.ts meta.function.ts meta.block.ts string.quoted.single.ts
+ ^
+ source.ts meta.function.ts meta.block.ts string.quoted.single.ts punctuation.definition.string.end.ts
+ ^
+ source.ts meta.function.ts meta.block.ts meta.brace.round.ts
+ ^
+ source.ts meta.function.ts meta.block.ts punctuation.terminator.statement.ts
+>}
+ ^
+ source.ts meta.function.ts meta.block.ts punctuation.definition.block.ts
+>
+ ^
+ source.ts
+>console.log(test());
+ ^^^^^^^
+ source.ts meta.function-call.ts support.class.console.ts
+ ^
+ source.ts meta.function-call.ts punctuation.accessor.ts
+ ^^^
+ source.ts meta.function-call.ts support.function.console.ts
+ ^
+ source.ts meta.brace.round.ts
+ ^^^^
+ source.ts meta.function-call.ts entity.name.function.ts
+ ^
+ source.ts meta.brace.round.ts
+ ^
+ source.ts meta.brace.round.ts
+ ^
+ source.ts meta.brace.round.ts
+ ^
+ source.ts punctuation.terminator.statement.ts
+>a = 3 /*test*/ / parseInt(/.+/.exec('3f23fg')[0]);
+ ^
+ source.ts variable.other.readwrite.ts
+ ^
+ source.ts
+ ^
+ source.ts keyword.operator.assignment.ts
+ ^
+ source.ts
+ ^
+ source.ts constant.numeric.decimal.ts
+ ^
+ source.ts
+ ^^
+ source.ts comment.block.ts punctuation.definition.comment.ts
+ ^^^^
+ source.ts comment.block.ts
+ ^^
+ source.ts comment.block.ts punctuation.definition.comment.ts
+ ^
+ source.ts
+ ^
+ source.ts string.regexp.ts punctuation.definition.string.begin.ts
+ ^^^^^^^^^
+ source.ts string.regexp.ts
+ ^
+ source.ts string.regexp.ts meta.group.regexp punctuation.definition.group.regexp
+ ^
+ source.ts string.regexp.ts meta.group.regexp
+ ^
+ source.ts string.regexp.ts meta.group.regexp constant.other.character-class.regexp
+ ^
+ source.ts string.regexp.ts meta.group.regexp keyword.operator.quantifier.regexp
+ ^
+ source.ts string.regexp.ts meta.group.regexp
+ ^
+ source.ts string.regexp.ts meta.group.regexp constant.other.character-class.regexp
+ ^^^^
+ source.ts string.regexp.ts meta.group.regexp
+ ^
+ source.ts string.regexp.ts meta.group.regexp meta.group.regexp punctuation.definition.group.regexp
+ ^^^^^^^^
+ source.ts string.regexp.ts meta.group.regexp meta.group.regexp
+ ^
+ source.ts string.regexp.ts meta.group.regexp meta.group.regexp punctuation.definition.group.regexp
+ ^
+ source.ts string.regexp.ts meta.group.regexp constant.other.character-class.set.regexp punctuation.definition.character-class.regexp
+ ^
+ source.ts string.regexp.ts meta.group.regexp constant.other.character-class.set.regexp
+ ^
+ source.ts string.regexp.ts meta.group.regexp constant.other.character-class.set.regexp punctuation.definition.character-class.regexp
+ ^
+ source.ts string.regexp.ts meta.group.regexp punctuation.definition.group.regexp
+ ^^
+ source.ts string.regexp.ts
+>console.log(a);
+ ^^^^^^^
+ source.ts string.regexp.ts
+ ^
+ source.ts string.regexp.ts constant.other.character-class.regexp
+ ^^^
+ source.ts string.regexp.ts
+ ^
+ source.ts string.regexp.ts meta.group.regexp punctuation.definition.group.regexp
+ ^
+ source.ts string.regexp.ts meta.group.regexp
+ ^
+ source.ts string.regexp.ts meta.group.regexp punctuation.definition.group.regexp
+ ^^
+ source.ts string.regexp.ts
+>
+ ^
+ source.ts string.regexp.ts
+>b = 1
+ ^^^^^^
+ source.ts string.regexp.ts
+>a = () => b
+ ^^^^
+ source.ts string.regexp.ts
+ ^
+ source.ts string.regexp.ts meta.group.regexp punctuation.definition.group.regexp
+ ^
+ source.ts string.regexp.ts meta.group.regexp punctuation.definition.group.regexp
+ ^^^^^^
+ source.ts string.regexp.ts
+>2 + (b=2), 3
+ ^^
+ source.ts string.regexp.ts
+ ^
+ source.ts string.regexp.ts keyword.operator.quantifier.regexp
+ ^
+ source.ts string.regexp.ts
+ ^
+ source.ts string.regexp.ts meta.group.regexp punctuation.definition.group.regexp
+ ^^^
+ source.ts string.regexp.ts meta.group.regexp
+ ^
+ source.ts string.regexp.ts meta.group.regexp punctuation.definition.group.regexp
+ ^^^^
+ source.ts string.regexp.ts
+>b = 6
+ ^^^^^^
+ source.ts string.regexp.ts
+>console.log(a(),b);
+ ^^^^^^^
+ source.ts string.regexp.ts
+ ^
+ source.ts string.regexp.ts constant.other.character-class.regexp
+ ^^^
+ source.ts string.regexp.ts
+ ^
+ source.ts string.regexp.ts meta.group.regexp punctuation.definition.group.regexp
+ ^
+ source.ts string.regexp.ts meta.group.regexp
+ ^
+ source.ts string.regexp.ts meta.group.regexp meta.group.regexp punctuation.definition.group.regexp
+ ^
+ source.ts string.regexp.ts meta.group.regexp meta.group.regexp punctuation.definition.group.regexp
+ ^^
+ source.ts string.regexp.ts meta.group.regexp
+ ^
+ source.ts string.regexp.ts meta.group.regexp punctuation.definition.group.regexp
+ ^^
+ source.ts string.regexp.ts
+>(b)
+ ^
+ source.ts string.regexp.ts meta.group.regexp punctuation.definition.group.regexp
+ ^
+ source.ts string.regexp.ts meta.group.regexp
+ ^
+ source.ts string.regexp.ts meta.group.regexp punctuation.definition.group.regexp
+>
+ ^
+ source.ts string.regexp.ts
+>if (a === 1) {
+ ^^^
+ source.ts string.regexp.ts
+ ^
+ source.ts string.regexp.ts meta.group.regexp punctuation.definition.group.regexp
+ ^^^^^^^
+ source.ts string.regexp.ts meta.group.regexp
+ ^
+ source.ts string.regexp.ts meta.group.regexp punctuation.definition.group.regexp
+ ^^^
+ source.ts string.regexp.ts
+> b = 2
+ ^^^^^^^^^
+ source.ts string.regexp.ts
+>} else if (a === 2) b = 3
+ ^^^^^^^^^^
+ source.ts string.regexp.ts
+ ^
+ source.ts string.regexp.ts meta.group.regexp punctuation.definition.group.regexp
+ ^^^^^^^
+ source.ts string.regexp.ts meta.group.regexp
+ ^
+ source.ts string.regexp.ts meta.group.regexp punctuation.definition.group.regexp
+ ^^^^^^^
+ source.ts string.regexp.ts
+>else b = 4
+ ^^^^^^^^^^^
+ source.ts string.regexp.ts
+>c = 1
+ ^^^^^^
+ source.ts string.regexp.ts
\ No newline at end of file
diff --git a/tests/baselines/regexp.baseline.txt b/tests/baselines/regexp.baseline.txt
index f07c4d08..6c2406f5 100644
--- a/tests/baselines/regexp.baseline.txt
+++ b/tests/baselines/regexp.baseline.txt
@@ -18,7 +18,7 @@ Grammar: TypeScript.tmLanguage
^
source.ts meta.var.expr.ts keyword.operator.assignment.ts
^
- source.ts meta.var.expr.ts string.regexp.ts
+ source.ts meta.var.expr.ts
^
source.ts meta.var.expr.ts string.regexp.ts punctuation.definition.string.begin.ts
^
diff --git a/tests/cases/Issue717.ts b/tests/cases/Issue717.ts
new file mode 100644
index 00000000..8db576ce
--- /dev/null
+++ b/tests/cases/Issue717.ts
@@ -0,0 +1,21 @@
+/* regex? */
+function test() {
+ return /"/.test('xxx"xxx');
+}
+
+console.log(test());
+a = 3 /*test*/ / parseInt(/.+/.exec('3f23fg')[0]);
+console.log(a);
+
+b = 1
+a = () => b
+2 + (b=2), 3
+b = 6
+console.log(a(),b);
+(b)
+
+if (a === 1) {
+ b = 2
+} else if (a === 2) b = 3
+else b = 4
+c = 1
\ No newline at end of file