From fb643d08a48bfd1a5a45d0d2224ac302707a6f22 Mon Sep 17 00:00:00 2001 From: Sebastian Pahnke Date: Tue, 1 Jun 2021 10:08:27 +0200 Subject: [PATCH] [JS/TS] Add support for the RegExp Match Indices flag --- src/javascript/javascript.test.ts | 2 +- src/typescript/typescript.test.ts | 2 +- src/typescript/typescript.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/javascript/javascript.test.ts b/src/javascript/javascript.test.ts index 0dfc9a2b..a3566422 100644 --- a/src/javascript/javascript.test.ts +++ b/src/javascript/javascript.test.ts @@ -652,7 +652,7 @@ testTokenization('javascript', [ [ { - line: '/foo/gimsuy', + line: '/foo/dgimsuy', tokens: [ { startIndex: 0, type: 'regexp.js' }, { startIndex: 5, type: 'keyword.other.js' } diff --git a/src/typescript/typescript.test.ts b/src/typescript/typescript.test.ts index f001763e..b2a3400e 100644 --- a/src/typescript/typescript.test.ts +++ b/src/typescript/typescript.test.ts @@ -674,7 +674,7 @@ testTokenization('typescript', [ [ { - line: '/foo/gimsuy', + line: '/foo/dgimsuy', tokens: [ { startIndex: 0, type: 'regexp.ts' }, { startIndex: 5, type: 'keyword.other.ts' } diff --git a/src/typescript/typescript.ts b/src/typescript/typescript.ts index d9cf5d32..04758878 100644 --- a/src/typescript/typescript.ts +++ b/src/typescript/typescript.ts @@ -239,7 +239,7 @@ export const language = { // regular expression: ensure it is terminated before beginning (otherwise it is an opeator) [ - /\/(?=([^\\\/]|\\.)+\/([gimsuy]*)(\s*)(\.|;|,|\)|\]|\}|$))/, + /\/(?=([^\\\/]|\\.)+\/([dgimsuy]*)(\s*)(\.|;|,|\)|\]|\}|$))/, { token: 'regexp', bracket: '@open', next: '@regexp' } ], @@ -312,7 +312,7 @@ export const language = { [/@regexpesc/, 'regexp.escape'], [/\\\./, 'regexp.invalid'], [ - /(\/)([gimsuy]*)/, + /(\/)([dgimsuy]*)/, [{ token: 'regexp', bracket: '@close', next: '@pop' }, 'keyword.other'] ] ],