diff --git a/TypeScript.YAML-tmLanguage b/TypeScript.YAML-tmLanguage index 7a61c3df..1489e899 100644 --- a/TypeScript.YAML-tmLanguage +++ b/TypeScript.YAML-tmLanguage @@ -140,7 +140,7 @@ variables: {{functionLikeType}} | (:\s*(=>|{{matchingParenthesis}}|(<[^<>]*>)|[^<>(),=])+={{functionOrArrowLookup}}) arrowFunctionEnd: (?==>|\{|(^\s*(export|function|class|interface|let|var|{{usingKeyword}}|{{awaitUsingKeyword}}|const|import|enum|namespace|module|type|abstract|declare)\s+)) - regexpTail: ([dgimsuy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$]) + regexpTail: (?!\*)[dgimsuvy]*((?!\/)|(?=\/\*))(?!\s*[a-zA-Z0-9_$]) completeRegexp: \/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)*\])+\/{{regexpTail}}) patterns: @@ -1365,7 +1365,7 @@ repository: begin: (?<=\))\s*{{completeRegexp}} beginCaptures: '0': { name: punctuation.definition.string.begin.ts } - end: (/)([dgimsuy]*) + end: (/)([dgimsuvy]*) endCaptures: '1': { name: punctuation.definition.string.end.ts } '2': { name: keyword.other.ts } @@ -2793,7 +2793,7 @@ repository: begin: (?|&&|\|\||\*\/)\s*(\/)(?![\/*])(?=(?:[^\/\\\[\()]|\\.|\[([^\]\\]|\\.)+\]|\(([^\)\\]|\\.)+\))+\/{{regexpTail}}) beginCaptures: '1': { name: punctuation.definition.string.begin.ts } - end: (/)([dgimsuy]*) + end: (/)([dgimsuvy]*) endCaptures: '1': { name: punctuation.definition.string.end.ts } '2': { name: keyword.other.ts} @@ -2804,7 +2804,7 @@ repository: begin: ((?name string.regexp.ts begin - (?<=\))\s*\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)*\])+\/([dgimsuy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$])) + (?<=\))\s*\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)*\])+\/(?!\*)[dgimsuvy]*((?!\/)|(?=\/\*))(?!\s*[a-zA-Z0-9_$])) beginCaptures 0 @@ -4375,7 +4375,7 @@ end - (/)([dgimsuy]*) + (/)([dgimsuvy]*) endCaptures 1 @@ -8470,7 +8470,7 @@ name string.regexp.ts begin - (?<!\+\+|--|})(?<=[=(:,\[?+!]|^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case|=>|&&|\|\||\*\/)\s*(\/)(?![\/*])(?=(?:[^\/\\\[\()]|\\.|\[([^\]\\]|\\.)+\]|\(([^\)\\]|\\.)+\))+\/([dgimsuy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$])) + (?<!\+\+|--|})(?<=[=(:,\[?+!]|^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case|=>|&&|\|\||\*\/)\s*(\/)(?![\/*])(?=(?:[^\/\\\[\()]|\\.|\[([^\]\\]|\\.)+\]|\(([^\)\\]|\\.)+\))+\/(?!\*)[dgimsuvy]*((?!\/)|(?=\/\*))(?!\s*[a-zA-Z0-9_$])) beginCaptures 1 @@ -8480,7 +8480,7 @@ end - (/)([dgimsuy]*) + (/)([dgimsuvy]*) endCaptures 1 @@ -8506,7 +8506,7 @@ name string.regexp.ts begin - ((?<![_$[:alnum:])\]]|\+\+|--|}|\*\/)|((?<=^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case))\s*)\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)*\])+\/([dgimsuy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$])) + ((?<![_$[:alnum:])\]]|\+\+|--|}|\*\/)|((?<=^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case))\s*)\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)*\])+\/(?!\*)[dgimsuvy]*((?!\/)|(?=\/\*))(?!\s*[a-zA-Z0-9_$])) beginCaptures 0 @@ -8516,7 +8516,7 @@ end - (/)([dgimsuy]*) + (/)([dgimsuvy]*) endCaptures 1 diff --git a/TypeScriptReact.tmLanguage b/TypeScriptReact.tmLanguage index dcdd118b..718d5ddf 100644 --- a/TypeScriptReact.tmLanguage +++ b/TypeScriptReact.tmLanguage @@ -4387,7 +4387,7 @@ name string.regexp.tsx begin - (?<=\))\s*\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)*\])+\/([dgimsuy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$])) + (?<=\))\s*\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)*\])+\/(?!\*)[dgimsuvy]*((?!\/)|(?=\/\*))(?!\s*[a-zA-Z0-9_$])) beginCaptures 0 @@ -4397,7 +4397,7 @@ end - (/)([dgimsuy]*) + (/)([dgimsuvy]*) endCaptures 1 @@ -8418,7 +8418,7 @@ name string.regexp.tsx begin - (?<!\+\+|--|})(?<=[=(:,\[?+!]|^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case|=>|&&|\|\||\*\/)\s*(\/)(?![\/*])(?=(?:[^\/\\\[\()]|\\.|\[([^\]\\]|\\.)+\]|\(([^\)\\]|\\.)+\))+\/([dgimsuy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$])) + (?<!\+\+|--|})(?<=[=(:,\[?+!]|^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case|=>|&&|\|\||\*\/)\s*(\/)(?![\/*])(?=(?:[^\/\\\[\()]|\\.|\[([^\]\\]|\\.)+\]|\(([^\)\\]|\\.)+\))+\/(?!\*)[dgimsuvy]*((?!\/)|(?=\/\*))(?!\s*[a-zA-Z0-9_$])) beginCaptures 1 @@ -8428,7 +8428,7 @@ end - (/)([dgimsuy]*) + (/)([dgimsuvy]*) endCaptures 1 @@ -8454,7 +8454,7 @@ name string.regexp.tsx begin - ((?<![_$[:alnum:])\]]|\+\+|--|}|\*\/)|((?<=^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case))\s*)\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)*\])+\/([dgimsuy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$])) + ((?<![_$[:alnum:])\]]|\+\+|--|}|\*\/)|((?<=^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case))\s*)\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)*\])+\/(?!\*)[dgimsuvy]*((?!\/)|(?=\/\*))(?!\s*[a-zA-Z0-9_$])) beginCaptures 0 @@ -8464,7 +8464,7 @@ end - (/)([dgimsuy]*) + (/)([dgimsuvy]*) endCaptures 1 diff --git a/tests/baselines/Issue1024.baseline.txt b/tests/baselines/Issue1024.baseline.txt new file mode 100644 index 00000000..ae5b5788 --- /dev/null +++ b/tests/baselines/Issue1024.baseline.txt @@ -0,0 +1,38 @@ +original file +----------------------------------- +1 + / f(/u/g); + +----------------------------------- + +Grammar: TypeScript.tmLanguage +----------------------------------- +>1 + ^ + source.ts constant.numeric.decimal.ts +> / f(/u/g); + ^ + source.ts + ^ + source.ts keyword.operator.arithmetic.ts + ^ + source.ts + ^ + source.ts meta.function-call.ts entity.name.function.ts + ^ + source.ts meta.brace.round.ts + ^ + source.ts string.regexp.ts punctuation.definition.string.begin.ts + ^ + source.ts string.regexp.ts + ^ + source.ts string.regexp.ts punctuation.definition.string.end.ts + ^ + source.ts string.regexp.ts keyword.other.ts + ^ + source.ts meta.brace.round.ts + ^ + source.ts punctuation.terminator.statement.ts +> + ^ + source.ts \ No newline at end of file diff --git a/tests/cases/Issue1024.ts b/tests/cases/Issue1024.ts new file mode 100644 index 00000000..820f819e --- /dev/null +++ b/tests/cases/Issue1024.ts @@ -0,0 +1,2 @@ +1 + / f(/u/g);