Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d9f1cdb

Browse files
committedDec 3, 2020
fix(javascript/typescript) fix poly backtracking issue
- Fix poly backtracking issue in gnarly `()` counting regex
1 parent fdec037 commit d9f1cdb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed
 

‎src/languages/javascript.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,8 @@ export default function(hljs) {
282282
'[^()]*(\\(' +
283283
'[^()]*(\\(' +
284284
'[^()]*' +
285-
'\\))*[^()]*' +
286-
'\\))*[^()]*' +
285+
'\\)[^()]*)*' +
286+
'\\)[^()]*)*' +
287287
'\\)|' + hljs.UNDERSCORE_IDENT_RE + ')\\s*=>',
288288
returnBegin: true,
289289
end: '\\s*=>',
@@ -373,8 +373,8 @@ export default function(hljs) {
373373
'[^()]*(\\(' +
374374
'[^()]*(\\(' +
375375
'[^()]*' +
376-
'\\))*[^()]*' +
377-
'\\))*[^()]*' +
376+
'\\)[^()]*)*' +
377+
'\\)[^()]*)*' +
378378
'\\)\\s*\\{', // end parens
379379
returnBegin:true,
380380
contains: [

0 commit comments

Comments
 (0)
Please sign in to comment.