From bb8deef61d79009bd231360c9475cf6f3e40fdee Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Sun, 16 Mar 2008 06:16:45 +0000 Subject: [PATCH] Tweaking regex for optimization and performance. disabling "punctuation.section.scope.round" seems to have helped. git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@9130 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 6f849c5..8915844 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -22,7 +22,12 @@ begin - (?x) (function) (?= (\s+ ([_$a-zA-Z][_$\w]*))? \s* \(.*?\)) + (?x) + (function) + (?= + (?:\s+ (?:[_$a-zA-Z][_$\w]*))? \s* # The function name + \([^)]*\) # The properties that the function accepts + ) beginCaptures 1 @@ -164,7 +169,7 @@ begin - (\{) + (?<!\))(\{) captures 1 @@ -205,6 +210,8 @@ punctuation.section.scope.round.js + disabled + 1 end (\)) name @@ -345,7 +352,10 @@ function-params begin - (?x)(?<=function) (?:\s+ ([_$a-zA-Z][_$\w]*))? \s* (\() + (?x) + (?<=function) # Must come after the word "function" + (?:\s+ ([_$a-zA-Z][_$\w]*))? # Mtch the name if it exists + \s* (\() beginCaptures 1