From 9fff45d36d5c6c72a3415444e749b67a30b8f119 Mon Sep 17 00:00:00 2001 From: haraldmartin Date: Tue, 26 Sep 2006 14:07:21 +0000 Subject: [PATCH] =?UTF-8?q?=E2=80=A2=20Moved=20a=20lot=20of=20the=20generi?= =?UTF-8?q?c=20JS=20stuff=20from=20the=20Prototype=20bundle=20to=20the=20J?= =?UTF-8?q?S=20bundle=20and=20removed=20duplicated=20rules.=20=E2=80=A2=20?= =?UTF-8?q?Improved=20some=20rules=20to=20catch=20more=20functions=20(like?= =?UTF-8?q?=20Object.myfunc=20=3D=20...)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some of the rules can be simplified but I'm not a regexp guru so if somebody want to make them shorter/easier/faster, go ahead :) git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@5307 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 195 +++++++++++++++++++++++++++++++++++--- 1 file changed, 184 insertions(+), 11 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 61471a2..1478603 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -19,6 +19,141 @@ JavaScript patterns + + captures + + 1 + + name + support.class.js + + 2 + + name + support.constant.js + + + comment + match stuff like: Sound.prototype = { … } when extending an object + match + ([a-zA-Z_?\.$]+\w*)\.(prototype)\s*=\s* + name + meta.class.js + + + captures + + 1 + + name + support.class.js + + 2 + + name + support.constant.js + + 3 + + name + entity.name.function.js + + 4 + + name + storage.type.function.js + + 5 + + name + variable.parameter.function.js + + + comment + match stuff like: Sound.prototype.play = function() { … } + match + ([a-zA-Z_?\.$]+\w*)\.(prototype)\.([a-zA-Z_?\.$]+\w*)\s*=\s*(function)?\s*\((.*?)\) + name + meta.function.prototype.js + + + captures + + 1 + + name + support.class.js + + 2 + + name + support.constant.js + + 3 + + name + entity.name.function.js + + + comment + match stuff like: Sound.prototype.play = myfunc + match + ([a-zA-Z_?\.\$]+\w*)\.(prototype)\.([a-zA-Z_?\.$]+\w*)\s*=\s* + name + meta.function.js + + + captures + + 1 + + name + support.class.js + + 2 + + name + entity.name.function.js + + + comment + match stuff like: Sound.play = { … } + match + ([a-zA-Z_?\.$]+\w*)?\.([a-zA-Z_?\.$]+\w*)\s*=\s* + name + meta.function.js + + + captures + + 1 + + name + support.class.js + + 2 + + name + entity.name.function.js + + 4 + + name + storage.type.function.js + + 5 + + name + variable.parameter.function.js + + + comment + match stuff like: Sound.play = function() { … } or play = function() { … } + match + ([a-zA-Z_?\.\$]+\w*)(\.([a-zA-Z_?\.\$]+\w*))?\s*=\s*(function)?\s*\((.*?)\) + name + meta.function.js + captures @@ -38,6 +173,8 @@ variable.parameter.function.js + comment + match regular function like: function myFunc(arg) { … } match \b(function)\s+([a-zA-Z_$]\w*)?\s*\((.*?)\) name @@ -65,9 +202,9 @@ comment match stuff like: foobar: function() { … } match - \b([a-zA-Z_?\.$]+\w*)\s*:\s+\b(function)?\s*\((.*?)\) + \b([a-zA-Z_?\.$]+\w*)\s*:\s*\b(function)?\s*\((.*?)\) name - meta.function.js + meta.function.json.js captures @@ -75,25 +212,61 @@ 1 name - entity.name.function.js - - 2 - - name - storage.type.function.js + string.quoted.js 3 + + name + object.property.function.js + + 5 + + name + entity.name.function.js + + 6 name variable.parameter.function.js comment - match stuff like: Sound.prototype.play = function() { … } + Attempt to match "foo": function match - \b([a-zA-Z_?\.$]+\w*)\s+=\s+\b(function)?\s*\((.*?)\) + (('|")(.*?)(\2))\s*:\s*\b(function)?\s*\((.*?)\) name - meta.function.js + meta.function.json.js + + + captures + + 1 + + name + keyword.operator.new.js + + 2 + + name + entity.name.instance.js + + + match + (new)\s+(\w+\.?\w*) + name + meta.class.instance.constructor + + + match + \b(console)\b + name + entity.name.object.js.firebug + + + match + \.(warn|info|log|error|time|timeEnd|assert)\b + name + support.function.js.firebug match