diff --git a/extensions/php/build/update-grammar.js b/extensions/php/build/update-grammar.js index a6bf6d52721..58b1207a4a2 100644 --- a/extensions/php/build/update-grammar.js +++ b/extensions/php/build/update-grammar.js @@ -23,16 +23,40 @@ function adaptInjectionScope(grammar) { // Workaround for https://github.com/Microsoft/vscode/issues/40279 // and https://github.com/Microsoft/vscode-textmate/issues/59 function fixBadRegex(grammar) { + function fail(msg) { + throw new Error(`fixBadRegex callback couldn't patch ${msg}. It may be obsolete`); + } + const scopeResolution = grammar.repository['scope-resolution']; if (scopeResolution) { const match = scopeResolution.patterns[0].match; if (match === '(?i)([a-z_\\x{7f}-\\x{7fffffff}\\\\][a-z0-9_\\x{7f}-\\x{7fffffff}\\\\]*)(?=\\s*::)') { scopeResolution.patterns[0].match = '([A-Za-z_\\x{7f}-\\x{7fffffff}\\\\][A-Za-z0-9_\\x{7f}-\\x{7fffffff}\\\\]*)(?=\\s*::)'; - return; + } else { + fail('scope-resolution.match'); } + } else { + fail('scope-resolution'); } - throw new Error(`fixBadRegex callback couldn't patch the regex. It may be obsolete`); + const functionCall = grammar.repository['function-call']; + if (functionCall) { + const begin0 = functionCall.patterns[0].begin; + if (begin0 === '(?xi)\n(\n \\\\?(?