From 79bc5ba34e94384781bceb63f342fa07ec51e8af Mon Sep 17 00:00:00 2001 From: duff Date: Tue, 1 Feb 2005 02:31:31 +0000 Subject: [PATCH 001/243] JavaScript syntax by Caio Chassot. git-svn-id: http://macromates.com/svn/Bundles/trunk/JavaScript.tmbundle@166 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Syntaxes/JavaScript.plist diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist new file mode 100644 index 0000000..614668c --- /dev/null +++ b/Syntaxes/JavaScript.plist @@ -0,0 +1,41 @@ +{ + name = "JavaScript"; + uuid = "93E017CC-6F27-11D9-90EB-000D93589AF6"; + fileTypes = ( js, htc ); + + foldingStartMarker = "^\\s*([A-Za-z0-9.]+?\\s*=\\s*)?(function)\\>"; + foldingStopMarker = "(^\\s*\\}"; + increaseIndentPattern = "^\\s*(function\\s*\\w*\\s*\\([^)]*\)\s*{.*$"; + smartTypingPairs = ( + ( "(", ")" ), ( "[", "]" ), ( "{", "}" ), + ( "\"", "\"" ), ( "'", "'" ) + ); + highlightPairs = ( + ( "(", ")" ), ( "[", "]" ), ( "{", "}" ) + ); + + foregroundColor = "#dddddd"; + backgroundColor = "#111111"; + + patterns = ( + { name = "Keyword"; foregroundColor = "#CC7833"; match = "\\<(this|typeof|new|true|false|undefined|null|for|in|break|continue|while|do|function|return|if|else|case|switch|var)\\>"; }, + { name = "Numeric Constant"; match = "\\<((0(x|X)[0-9a-fA-F]+)|([0-9]+(\\.[0-9]+)?))\\>"; foregroundColor = "#3387CC"; }, + + { name = "method or function"; match = "(\\<|\\.)([a-zA-Z_]\\w*(?=\s*\\())"; + "foregroundColor[2]" = "#CC3833"; + }, + + { name = "Single String"; begin = "'"; end = "'"; swallow = "\\\\."; foregroundColor = "#66CC33"; }, + { name = "Double Quoted String"; begin = "\""; end = "\""; swallow = "\\\\."; foregroundColor = "#66CC33"; }, + + { name = "Regular Expression"; begin = "/"; end = "/([igm]+)?"; foregroundColor = "#CCCC33"; + patterns = ( + { name = "Escaped slash"; match = "\\\\/"; foregroundColor = "#CCCC33"; } + ); + }, + + { name = "Multiline Comment"; begin = "\\/\\*"; end = "\\*\\/"; swallow = "\\\\."; foregroundColor = "#9933CC"; }, + { name = "Comment"; match = "\\/\\/.*$"; "fontStyle" = ( italic ); foregroundColor = "#9933CC"; }, + ); +} + From da2be44dd399f67faf490b6887c400c0dd501873 Mon Sep 17 00:00:00 2001 From: duff Date: Tue, 1 Feb 2005 02:38:12 +0000 Subject: [PATCH 002/243] SQL by Carl Forde (and JavaScript meta info). git-svn-id: http://macromates.com/svn/Bundles/trunk/JavaScript.tmbundle@167 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- info.plist | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 info.plist diff --git a/info.plist b/info.plist new file mode 100644 index 0000000..00f87b7 --- /dev/null +++ b/info.plist @@ -0,0 +1,10 @@ + + + + + name + JavaScript + uuid + AAB4FD74-73F9-11D9-B89A-000D93589AF6 + + From 71559750694cc9f33fb92c529242e1990bfee0f1 Mon Sep 17 00:00:00 2001 From: chris Date: Wed, 2 Feb 2005 05:53:42 +0000 Subject: [PATCH 003/243] Convert JavaScript to new scheme git-svn-id: http://macromates.com/svn/Bundles/trunk/JavaScript.tmbundle@182 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 614668c..cd5436c 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -18,24 +18,24 @@ backgroundColor = "#111111"; patterns = ( - { name = "Keyword"; foregroundColor = "#CC7833"; match = "\\<(this|typeof|new|true|false|undefined|null|for|in|break|continue|while|do|function|return|if|else|case|switch|var)\\>"; }, - { name = "Numeric Constant"; match = "\\<((0(x|X)[0-9a-fA-F]+)|([0-9]+(\\.[0-9]+)?))\\>"; foregroundColor = "#3387CC"; }, + { name = "keywords.js"; foregroundColor = "#CC7833"; match = "\\<(this|typeof|new|true|false|undefined|null|for|in|break|continue|while|do|function|return|if|else|case|switch|var)\\>"; }, + { name = "constants.numeric.js"; match = "\\<((0(x|X)[0-9a-fA-F]+)|([0-9]+(\\.[0-9]+)?))\\>"; foregroundColor = "#3387CC"; }, - { name = "method or function"; match = "(\\<|\\.)([a-zA-Z_]\\w*(?=\s*\\())"; + { name = "keywords.functions.js"; match = "(\\<|\\.)([a-zA-Z_]\\w*(?=\s*\\())"; "foregroundColor[2]" = "#CC3833"; }, - { name = "Single String"; begin = "'"; end = "'"; swallow = "\\\\."; foregroundColor = "#66CC33"; }, - { name = "Double Quoted String"; begin = "\""; end = "\""; swallow = "\\\\."; foregroundColor = "#66CC33"; }, + { name = "strings.single-quoted.js"; begin = "'"; end = "'"; swallow = "\\\\."; foregroundColor = "#66CC33"; }, + { name = "strings.double-quoted.js"; begin = "\""; end = "\""; swallow = "\\\\."; foregroundColor = "#66CC33"; }, - { name = "Regular Expression"; begin = "/"; end = "/([igm]+)?"; foregroundColor = "#CCCC33"; + { name = "strings.regex.js"; begin = "/"; end = "/([igm]+)?"; foregroundColor = "#CCCC33"; patterns = ( - { name = "Escaped slash"; match = "\\\\/"; foregroundColor = "#CCCC33"; } + { name = "strings.escaped-slash.js"; match = "\\\\/"; foregroundColor = "#CCCC33"; } ); }, - { name = "Multiline Comment"; begin = "\\/\\*"; end = "\\*\\/"; swallow = "\\\\."; foregroundColor = "#9933CC"; }, - { name = "Comment"; match = "\\/\\/.*$"; "fontStyle" = ( italic ); foregroundColor = "#9933CC"; }, + { name = "comments.block.js"; begin = "\\/\\*"; end = "\\*\\/"; swallow = "\\\\."; foregroundColor = "#9933CC"; }, + { name = "comments.line.js"; match = "\\/\\/.*$"; "fontStyle" = ( italic ); foregroundColor = "#9933CC"; }, ); } From d7093479d0ce6ea109c1c8faa3f42ef89918dd9f Mon Sep 17 00:00:00 2001 From: neoneye Date: Tue, 22 Mar 2005 11:13:31 +0000 Subject: [PATCH 004/243] I noticed that RegExp.$3 wasn't colored correct. The '3' was colored as it were a number.. in this context its an instance variable. I added a rule to recognize instance variables. git-svn-id: http://macromates.com/svn/Bundles/trunk/JavaScript.tmbundle@526 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index cd5436c..e755b2d 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -21,8 +21,25 @@ { name = "keywords.js"; foregroundColor = "#CC7833"; match = "\\<(this|typeof|new|true|false|undefined|null|for|in|break|continue|while|do|function|return|if|else|case|switch|var)\\>"; }, { name = "constants.numeric.js"; match = "\\<((0(x|X)[0-9a-fA-F]+)|([0-9]+(\\.[0-9]+)?))\\>"; foregroundColor = "#3387CC"; }, - { name = "keywords.functions.js"; match = "(\\<|\\.)([a-zA-Z_]\\w*(?=\s*\\())"; - "foregroundColor[2]" = "#CC3833"; + { + /* + Methods: + obj.method(arguments) + */ + name = "keywords.functions.js"; + match = "(\\<|\\.)([a-zA-Z_]\\w*(?=\\s*\\())"; + "foregroundColor[2]" = "#CC3833"; + }, + + { + /* + Instance Variables: + RegExp.$3 + ary.lengh + */ + name = "keywords.instance-variables.js"; + match = "\\.([a-zA-Z_]\\w*|\\$\\d{1,2})(?!\\s*\\()"; + "foregroundColor[1]" = "#779938"; }, { name = "strings.single-quoted.js"; begin = "'"; end = "'"; swallow = "\\\\."; foregroundColor = "#66CC33"; }, From 8e51a1f42ff91d4584f7283164f7b1944ada0fc8 Mon Sep 17 00:00:00 2001 From: duff Date: Thu, 21 Apr 2005 07:08:56 +0000 Subject: [PATCH 005/243] =?UTF-8?q?=E2=80=A2=20Added=20scopeName=20key=20t?= =?UTF-8?q?o=20all=20languages.=20Most=20of=20them=20as=20source..=20=E2=80=A2=20Added=20a=20language=20for=20plain=20text=20fi?= =?UTF-8?q?les,=20currently=20just=20markups=20bullet=20points=20(so=20I?= =?UTF-8?q?=20can=20continue=20these=20on=20'enter'=20using=20a=20scoped?= =?UTF-8?q?=20snippet).=20=E2=80=A2=20Added=20a=20new=20=E2=80=9CfirstLine?= =?UTF-8?q?Match=E2=80=9D=20key=20to=20Perl,=20Ruby,=20and=20Shell=20langu?= =?UTF-8?q?ages.=20=E2=80=A2=20The=20C/Objective-C=20languages=20use=20the?= =?UTF-8?q?=20scopeName=20in=20their=20include=20directives,=20this=20does?= =?UTF-8?q?n't=20work=20for=20beta=205.=20=E2=80=A2=20Ruby=20now=20include?= =?UTF-8?q?s=20=E2=80=9Csource.ruby=E2=80=9D=20when=20using=20#{=20...=20}?= =?UTF-8?q?=20in=20strings.=20=E2=80=A2=20Added=20capture=20names=20to=20a?= =?UTF-8?q?=20few=20languages=20(objective-c=20methods,=20though=20it's=20?= =?UTF-8?q?not=20very=20consistant,=20we'll=20need=20to=20discuss=20how=20?= =?UTF-8?q?to=20split=20up=20functions=20and=20name=20the=20various=20part?= =?UTF-8?q?s).=20=E2=80=A2=20Removed=20plist=20filetype=20from=20XML,=20as?= =?UTF-8?q?suming=20that=20people=20loading=20a=20plist=20into=20a=20text?= =?UTF-8?q?=20editor=20would=20generally=20use=20the=20old-style=20format.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/JavaScript.tmbundle@612 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 1 + 1 file changed, 1 insertion(+) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index e755b2d..75a52ee 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -1,5 +1,6 @@ { name = "JavaScript"; + scopeName = "source.javascript"; uuid = "93E017CC-6F27-11D9-90EB-000D93589AF6"; fileTypes = ( js, htc ); From 38760e4b29fcbd7ac8802c1e4683801d6dd248ec Mon Sep 17 00:00:00 2001 From: duff Date: Thu, 21 Apr 2005 07:41:17 +0000 Subject: [PATCH 006/243] =?UTF-8?q?Moved=20all=20bundles.=20I'm=20not=20su?= =?UTF-8?q?re=20what=20happens=20if=20you=20do=20=E2=80=9Csvn=20up?= =?UTF-8?q?=E2=80=9D=20and=20you=20have=20modified=20stuff=20inside=20one?= =?UTF-8?q?=20of=20the=20bundles.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@622 dfb7d73b-c2ec-0310-8fea-fb051d288c6d From 2b96a7f41b46899c585eb90e9519440faec7965c Mon Sep 17 00:00:00 2001 From: duff Date: Fri, 22 Apr 2005 08:47:20 +0000 Subject: [PATCH 007/243] Changed all names to singular form. git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@649 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 75a52ee..d943801 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -19,15 +19,15 @@ backgroundColor = "#111111"; patterns = ( - { name = "keywords.js"; foregroundColor = "#CC7833"; match = "\\<(this|typeof|new|true|false|undefined|null|for|in|break|continue|while|do|function|return|if|else|case|switch|var)\\>"; }, - { name = "constants.numeric.js"; match = "\\<((0(x|X)[0-9a-fA-F]+)|([0-9]+(\\.[0-9]+)?))\\>"; foregroundColor = "#3387CC"; }, + { name = "keyword.js"; foregroundColor = "#CC7833"; match = "\\<(this|typeof|new|true|false|undefined|null|for|in|break|continue|while|do|function|return|if|else|case|switch|var)\\>"; }, + { name = "constant.numeric.js"; match = "\\<((0(x|X)[0-9a-fA-F]+)|([0-9]+(\\.[0-9]+)?))\\>"; foregroundColor = "#3387CC"; }, { /* Methods: obj.method(arguments) */ - name = "keywords.functions.js"; + name = "keyword.function.js"; match = "(\\<|\\.)([a-zA-Z_]\\w*(?=\\s*\\())"; "foregroundColor[2]" = "#CC3833"; }, @@ -38,22 +38,22 @@ RegExp.$3 ary.lengh */ - name = "keywords.instance-variables.js"; + name = "keyword.instance-variables.js"; match = "\\.([a-zA-Z_]\\w*|\\$\\d{1,2})(?!\\s*\\()"; "foregroundColor[1]" = "#779938"; }, - { name = "strings.single-quoted.js"; begin = "'"; end = "'"; swallow = "\\\\."; foregroundColor = "#66CC33"; }, - { name = "strings.double-quoted.js"; begin = "\""; end = "\""; swallow = "\\\\."; foregroundColor = "#66CC33"; }, + { name = "string.single-quoted.js"; begin = "'"; end = "'"; swallow = "\\\\."; foregroundColor = "#66CC33"; }, + { name = "string.double-quoted.js"; begin = "\""; end = "\""; swallow = "\\\\."; foregroundColor = "#66CC33"; }, - { name = "strings.regex.js"; begin = "/"; end = "/([igm]+)?"; foregroundColor = "#CCCC33"; + { name = "string.regex.js"; begin = "/"; end = "/([igm]+)?"; foregroundColor = "#CCCC33"; patterns = ( - { name = "strings.escaped-slash.js"; match = "\\\\/"; foregroundColor = "#CCCC33"; } + { name = "string.escaped-slash.js"; match = "\\\\/"; foregroundColor = "#CCCC33"; } ); }, - { name = "comments.block.js"; begin = "\\/\\*"; end = "\\*\\/"; swallow = "\\\\."; foregroundColor = "#9933CC"; }, - { name = "comments.line.js"; match = "\\/\\/.*$"; "fontStyle" = ( italic ); foregroundColor = "#9933CC"; }, + { name = "comment.block.js"; begin = "\\/\\*"; end = "\\*\\/"; swallow = "\\\\."; foregroundColor = "#9933CC"; }, + { name = "comment.line.js"; match = "\\/\\/.*$"; "fontStyle" = ( italic ); foregroundColor = "#9933CC"; }, ); } From d99e47abb8bf3e50bd1e3f1f29cf50fe02cbac8b Mon Sep 17 00:00:00 2001 From: kevin Date: Tue, 26 Apr 2005 08:05:12 +0000 Subject: [PATCH 008/243] Update JavaScript syntax definition for b6 Fix the regex matching to only match regexes (defined as starting a line or following a "=" or "(" with optional whitespace) git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@742 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 119 ++++++++++++++++++++------------------ 1 file changed, 62 insertions(+), 57 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index d943801..80413ff 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -1,59 +1,64 @@ { - name = "JavaScript"; - scopeName = "source.javascript"; - uuid = "93E017CC-6F27-11D9-90EB-000D93589AF6"; - fileTypes = ( js, htc ); - - foldingStartMarker = "^\\s*([A-Za-z0-9.]+?\\s*=\\s*)?(function)\\>"; - foldingStopMarker = "(^\\s*\\}"; - increaseIndentPattern = "^\\s*(function\\s*\\w*\\s*\\([^)]*\)\s*{.*$"; - smartTypingPairs = ( - ( "(", ")" ), ( "[", "]" ), ( "{", "}" ), - ( "\"", "\"" ), ( "'", "'" ) - ); - highlightPairs = ( - ( "(", ")" ), ( "[", "]" ), ( "{", "}" ) - ); - - foregroundColor = "#dddddd"; - backgroundColor = "#111111"; - - patterns = ( - { name = "keyword.js"; foregroundColor = "#CC7833"; match = "\\<(this|typeof|new|true|false|undefined|null|for|in|break|continue|while|do|function|return|if|else|case|switch|var)\\>"; }, - { name = "constant.numeric.js"; match = "\\<((0(x|X)[0-9a-fA-F]+)|([0-9]+(\\.[0-9]+)?))\\>"; foregroundColor = "#3387CC"; }, - - { - /* - Methods: - obj.method(arguments) - */ - name = "keyword.function.js"; - match = "(\\<|\\.)([a-zA-Z_]\\w*(?=\\s*\\())"; - "foregroundColor[2]" = "#CC3833"; - }, - - { - /* - Instance Variables: - RegExp.$3 - ary.lengh - */ - name = "keyword.instance-variables.js"; - match = "\\.([a-zA-Z_]\\w*|\\$\\d{1,2})(?!\\s*\\()"; - "foregroundColor[1]" = "#779938"; - }, - - { name = "string.single-quoted.js"; begin = "'"; end = "'"; swallow = "\\\\."; foregroundColor = "#66CC33"; }, - { name = "string.double-quoted.js"; begin = "\""; end = "\""; swallow = "\\\\."; foregroundColor = "#66CC33"; }, - - { name = "string.regex.js"; begin = "/"; end = "/([igm]+)?"; foregroundColor = "#CCCC33"; - patterns = ( - { name = "string.escaped-slash.js"; match = "\\\\/"; foregroundColor = "#CCCC33"; } - ); - }, - - { name = "comment.block.js"; begin = "\\/\\*"; end = "\\*\\/"; swallow = "\\\\."; foregroundColor = "#9933CC"; }, - { name = "comment.line.js"; match = "\\/\\/.*$"; "fontStyle" = ( italic ); foregroundColor = "#9933CC"; }, - ); -} + name = "JavaScript"; + scopeName = "source.javascript"; + uuid = "93E017CC-6F27-11D9-90EB-000D93589AF6"; + fileTypes = ( js, htc ); + + foldingStartMarker = "^\\s*([A-Za-z0-9.]+\s*=\\s*)?(function)\\>"; + foldingStopMarker = "^\\s*\\}"; + + patterns = ( + { name = "declaration.function.js"; + match = "^\\s*(function)\\s*([a-zA-Z_]\\w*)\\s*\\(([^)]*)\\)"; + captures = { + 1 = { name = "keyword.js"; }; + 2 = { name = "function-name"; }; + 3 = { name = "function-argument"; }; + }; + }, + + { name = "keyword.js"; match = "\\<(this|typeof|new|true|false|undefined|null|for|in|break|continue|while|do|return|if|else|case|switch|var)\\>"; }, + { name = "constant.numeric.js"; match = "\\<((0(x|X)[0-9a-fA-F]+)|([0-9]+(\\.[0-9]+)?))\\>"; }, + + /*{ // This is useless - why match called methods? + /* + Methods: + obj.method(arguments) + * / + name = "keyword.function.js"; + match = "(\\<|\\.)([a-zA-Z_]\\w*(?=\\s*\\())"; + "foregroundColor[2]" = "#CC3833"; + }, + { // This is also useless - why match used instance vars? + /* + Instance Variables: + RegExp.$3 + ary.length + * / + name = "keyword.instance-variables.js"; + match = "\\.([a-zA-Z_]\\w*|\\$\\d{1,2})(?!\\s*\\()"; + "foregroundColor[1]" = "#779938"; + },*/ + + { name = "string.single-quoted.js"; begin = "'"; end = "'"; swallow = "\\\\."; }, + { name = "string.double-quoted.js"; begin = "\""; end = "\""; swallow = "\\\\."; }, + + { name = "comment.block.js"; begin = "/\\*"; end = "\\*/"; swallow = "\\\\."; }, + { name = "comment.line.js"; match = "//.*"; }, + + { begin = "(([=(]|^)\\s*)(/)(?!/)"; end = "(/([igm]+)?)"; + beginCaptures = { + 1 = { name = "dummy.regexp-start"; }; + 3 = { name = "string.regexp.js"; }; + }; + endCaptures = { + 1 = { name = "string.regexp.js"; }; + }; + patterns = ( + { name = "string.regexp.js"; match = "[^/]*"; }, + { name = "string.regexp.js"; match = "\\\\/"; } + ); + }, + ); +} From 6854a952c38a8bcf1e70ac7842ac369a42b8c54a Mon Sep 17 00:00:00 2001 From: kevin Date: Tue, 26 Apr 2005 08:15:27 +0000 Subject: [PATCH 009/243] Fix JavaScript regex to not override block comments git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@743 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 80413ff..bcc5744 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -47,7 +47,7 @@ { name = "comment.block.js"; begin = "/\\*"; end = "\\*/"; swallow = "\\\\."; }, { name = "comment.line.js"; match = "//.*"; }, - { begin = "(([=(]|^)\\s*)(/)(?!/)"; end = "(/([igm]+)?)"; + { begin = "(([=(]|^)\\s*)(/)(?![*/])"; end = "(/([igm]+)?)"; beginCaptures = { 1 = { name = "dummy.regexp-start"; }; 3 = { name = "string.regexp.js"; }; From 6a3fdd55e60ec94b782c3ee77dc9ba4339e3dc18 Mon Sep 17 00:00:00 2001 From: kevin Date: Tue, 26 Apr 2005 09:18:33 +0000 Subject: [PATCH 010/243] Update JavaScript syntax to include all of the niceties of the JavaScript (PHP) syntax Update the White background settings to color all of the special JavaScript keyword types nicely git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@744 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 69 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 65 insertions(+), 4 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index bcc5744..69e539d 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -1,4 +1,14 @@ { + /* ----------------- + + JavaScript + ========== + + Created by god knows who, but extensively modified by Kevin Ballard + Modifications based in part on the JavaScript (PHP) syntax by Mats Persson (mats@imediatec.co.uk) + + ----------------- */ + name = "JavaScript"; scopeName = "source.javascript"; uuid = "93E017CC-6F27-11D9-90EB-000D93589AF6"; @@ -8,16 +18,15 @@ foldingStopMarker = "^\\s*\\}"; patterns = ( - { name = "declaration.function.js"; + { name = "declaration.function.js"; match = "^\\s*(function)\\s*([a-zA-Z_]\\w*)\\s*\\(([^)]*)\\)"; captures = { - 1 = { name = "keyword.js"; }; + 1 = { name = "keyword.declaration.js"; }; 2 = { name = "function-name"; }; 3 = { name = "function-argument"; }; }; }, - { name = "keyword.js"; match = "\\<(this|typeof|new|true|false|undefined|null|for|in|break|continue|while|do|return|if|else|case|switch|var)\\>"; }, { name = "constant.numeric.js"; match = "\\<((0(x|X)[0-9a-fA-F]+)|([0-9]+(\\.[0-9]+)?))\\>"; }, /*{ // This is useless - why match called methods? @@ -46,8 +55,60 @@ { name = "comment.block.js"; begin = "/\\*"; end = "\\*/"; swallow = "\\\\."; }, { name = "comment.line.js"; match = "//.*"; }, + + /* HTML COMMENTS: inside embedded in a HTML page */ + { name = "comment.html.js"; + match = "()"; + }, + + /* KEYWORDS: */ + { name = "keyword.declaration.js"; + match = "\\<(function)\\>"; + }, + + /* KEYWORDS: Reserved */ + { name = "keyword.reserved.js"; + match = "\\<(boolean|break|byte|case|catch|char|class|const|continue|debugger|default|delete|do|double|else|enum|export|extends|false|final|finally|float|for|goto|if|implements|import|in|instanceof|int|interface|long|native|new|null|package|private|protected|public|return|short|static|super|switch|synchronized|this|throw|throws|transient|true|try|typeof|var|void|volatile|while|with)\\>"; + }, + + /* OBJECTS:: */ + { name = "keyword.object.js"; + /* CASE Sensitive Objects * / + match = "\\<(Anchor|Applet|Area|Array|Boolean|Button|Checkbox|Date|document|event|FileUpload|Form|Frame|Function|Hidden|History|Image|JavaArray|JavaClass|JavaObject|JavaPackage|java|Layer|Link|Location|Math|MimeType|Number|navigator|netscape|Object|Option|Packages|Password|Plugin|Radio|RegExp|Reset|Select|String|Style|Submit|screen|sun|Text|Textarea|window|XMLHttpRequest)\\>"; + /* */ + /* CASE InSensitive Objects */ + match = "\\<((?i:Anchor|Applet|Area|Array|Boolean|Button|Checkbox|Date|document|event|FileUpload|Form|Frame|Function|Hidden|History|Image|JavaArray|JavaClass|JavaObject|JavaPackage|java|Layer|Link|Location|Math|MimeType|Number|navigator|netscape|Object|Option|Packages|Password|Plugin|Radio|RegExp|Reset|Select|String|Style|Submit|screen|sun|Text|Textarea|window|XMLHttpRequest))\\>"; + /* */ + }, + + /* OBJECTS:: Methods */ + { name = "keyword.method.js"; + match = "\\<(abort|abs|acos|alert|anchor|apply|asin|atan|atan2|atob|attachEvent|back|big|blink|blur|bold|borderWidths|btoa|call|captureEvents|ceil|charAt|charCodeAt|clear|clearInterval|clearTimeout|click|close|compile|concat|confirm|contextual|cos|createElement|createEventObject|createPopup|createStyleSheet|createTextNode|detachEvent|disableExternalCapture|dump|elementFromPoint|enableExternalCapture|escape|eval|exec|execCommand|execScript|exp|fileCreatedDate|fileModifiedDate|fileSize|fileUpdatedDate|find|firstChild|fixed|floor|focus|fontcolor|fontsize|fromCharCode|forward|getAllResponseHeaders|getAttention|getDate|getDay|getElementById|getElementsByName|getElementsByTagName|getFullYear|getHours|getMilliseconds|getMinutes|getMonth|getResponseHeader|getSeconds|getSelection|getTime|getTimezoneOffset|getUTCDate|getUTCDay|getUTCFullYear|getUTCHours|getUTCMilliseconds|getUTCMinutes|getUTCMonth|getUTCSeconds|getYear|go|handleEvent|home|indexOf|isFinite|isNaN|italics|javaEnabled|join|lastIndexOf|link|load|log|margins|match|max|mergeAttributes|min|moveAbove|moveBelow|moveBy|moveTo|moveToAbsolute|navigate|open|paddings|parse|parseFloat|parseInt|plugins.refresh|pop|pow|preference|print|prompt|push|queryCommandEnabled|queryCommandIndeterm|queryCommandState|queryCommandValue|random|recalc|releaseCapture|releaseEvents|reload|replace|reset|resizeBy|resizeTo|returnValue|reverse|round|routeEvents|savePreferences|scroll|scrollBy|scrollByLines|scrollByPages|scrollTo|scrollX|scrollY|search|select|send|setDate|setFullYear|setActive|setCursor|setHotKeys|setHours|setInterval|setMilliseconds|setMinutes|setMonth|setResizable|setRequestHeader|setSeconds|setTime|setTimeout|setUTCDate|setUTCFullYear|setUTCHours|setUTCMilliseconds|setUTCMinutes|setUTCMonth|setUTCSeconds|setYear|setZOptions|shift|showHelp|showModalDialog|showModelessDialog|sidebar|sin|signText|sizeToContent|slice|small|sort|splice|split|sqrt|strike|stop|sub|submit|substr|substring|sup|taint|taintEnabled|tan|test|toGMTString|toLocaleString|toLowerCase|toSource|toString|toUpperCase|toUTCString|UTC|unescape|unshift|untaint|updateCommands|unwatch|valueOf|watch|write|writeln)\\>(?=\\()"; + }, + + /* OBJECTS:: Properties */ + { match = "\\.\\<(_content|above|action|align|aLinkcolor|all|anchors|appCodeName|appCore|appMinorVersion|appName|applets|appVersion|arguments|arguments.callee|arguments.caller|arguments.length|arity|attributes|availHeight|availLeft|availTop|availWidth|background|backgroundColor|backgroundImage|below|bgColor|body|border|borderBottomWidth|borderColor|borderLeftWidth|borderRightWidth|borderStyle|borderTopWidth|bottom|bufferDepth|characterSet|checked|childNodes|classes|className|clientInformation|clip|clipboardData|closed|colorDepth|complete|components|constructor|controllers|cookie|cookieEnabled|cpuClass|crypto|current|data|defaultCharset|defaultChecked|defaultStatus|defaultValue|defaultView|description|dialogArguments|dialogHeight|dialogLeft|dialogTop|dialogWidth|dir|directories|display|doctype|documentElement|domain|E|elements|embeds|enabledPlugin|encoding|expando|external|fgColor|filename|fontFamily|fontSize|fontWeight|form|formName|forms|frameElement|frames|global|hasFocus|hash|height|history|host|hostname|href|hspace|ids|ignoreCase|images|implementation|input|innerHeight|innerWidth|index|LN10|LN2|LOG10E|LOG2E|language|lastChild|lastIndex|lastMatch|lastModified|lastParen|layers|layerX|left|leftContext|length|lineHeight|linkColor|links|listStyleType|localName|location|locationbar|lowsrc|MAX_VALUE|MIN_VALUE|marginBottom|marginLeft|marginRight|marginTop|media|method|menubar|mimeTypes|multiline|NEGATIVE_INFINITY|name|nameProp|namespaces|namespaceURI|next|nextSibling|nodeName|nodeType|nodeValue|offscreenBuffering|onLine|onreadystatechange|opener|opsProfile|oscpu|options|outerHeight|outerWidth|ownerDocument|POSITIVE_INFINITY|PI|paddingBottom|paddingLeft|paddingRight|paddingTop|pageX|pageY|pageXOffset|pageYOffset|parent|parentLayer|parentNode|parentWindow|pathname|personalbar|pixelDepth|platform|plugins|pkcs11|port|prefix|previous|previousSibling|product|productSub|prompter|protocol|prototype|readyState|referrer|responseText|responseXML|right|rightContext|SQRT1_2|SQRT2|screenLeft|screenTop|screenX|screenY|scripts|scrollbars|security|securityPolicy|selected|selection|selectedIndex|self|siblingAbove|siblingBelow|src|source|status|statusbar|statusText|styleSheets|suffixes|systemLanguage|tags|target|text|textAlign|textDecoration|textIndent|textTransform|title|toolbar|top|type|URL|URLUnencoded|undefined|uniqueID|updateInterval|userAgent|userLanguage|userProfile|value|vendor|vendorSub|visibility|vLinkcolor|vspace|whiteSpace|width|XMLDocument|XSLDocument|x|y|zIndex)\\>"; + captures = { + 1 = { name = "keyword.property.js"; }; + }; + }, + + /* OBJECTS:: Event Handlers:: */ + { name = "keyword.event-handler.js"; + match = "\\<(onAbort|onActivate|onAfterprint|onAfterupdate|onBeforeactivate|onBeforecut|onBeforedeactivate|onBeforeeditfocus|onBeforepaste|onBeforeprint|onBeforeunload|onBeforeupdate|onBlur|onCellchange|onChange|onClick|onClose|onContextmenu|onControlselect|onCut|onDataavailable|onDatasetchanged|onDatasetcomplete|onDblclick|onDeactivate|onDrag|onDragdrop|onDragend|onDragenter|onDragleave|onDragover|onDragstart|onDrop|onError|onErrorupdate|onFocus|onHelp|onKeydown|onKeypress|onKeyup|onLoad|onMousedown|onMousemove|onMouseout|onMouseover|onMouseup|onPaste|onPropertychange|onReadystatechange|onReset|onResize|onResizeend|onResizestart|onRowenter|onRowexit|onRowsdelete|onRowsinserted|onScroll|onSelect|onSelectionchange|onSelectstart|onStop|onSubmit|onUnload)\\>"; + }, + + /* OPERATORS:: */ + { name = "keyword.operator.js"; + match = "(!|\\$|%|&|\\*|\\+|\\-|\\-\\-|\\+\\+|~|==|===|!=|!==|<>|<|>|<=|>=|!|&&|\\|\\||\\?\\:|\\*=|/=|%=|\\+=|\\-=|<<=|>>=|>>>=|&=|\\^=|\\|=)|\\<(in|instanceof|new|delete|typeof|void)\\>"; + }, + + /* CONSTANTS:: */ + { name = "constant.js"; + match = "\\<(Infinity|NaN|Undefined)\\>"; + }, - { begin = "(([=(]|^)\\s*)(/)(?![*/])"; end = "(/([igm]+)?)"; + { begin = "(([=(]|^)\\s*)(/)(?![*/])"; end = "(/([igm]+)?)"; beginCaptures = { 1 = { name = "dummy.regexp-start"; }; 3 = { name = "string.regexp.js"; }; From 2faba0dbea4aed53f5ca75ddffb94a46d2638870 Mon Sep 17 00:00:00 2001 From: kevin Date: Tue, 26 Apr 2005 09:59:07 +0000 Subject: [PATCH 011/243] Switch JavaScript object matching to be case-sensitive git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@746 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 69e539d..4971229 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -73,10 +73,10 @@ /* OBJECTS:: */ { name = "keyword.object.js"; - /* CASE Sensitive Objects * / + /* CASE Sensitive Objects */ match = "\\<(Anchor|Applet|Area|Array|Boolean|Button|Checkbox|Date|document|event|FileUpload|Form|Frame|Function|Hidden|History|Image|JavaArray|JavaClass|JavaObject|JavaPackage|java|Layer|Link|Location|Math|MimeType|Number|navigator|netscape|Object|Option|Packages|Password|Plugin|Radio|RegExp|Reset|Select|String|Style|Submit|screen|sun|Text|Textarea|window|XMLHttpRequest)\\>"; /* */ - /* CASE InSensitive Objects */ + /* CASE InSensitive Objects * / match = "\\<((?i:Anchor|Applet|Area|Array|Boolean|Button|Checkbox|Date|document|event|FileUpload|Form|Frame|Function|Hidden|History|Image|JavaArray|JavaClass|JavaObject|JavaPackage|java|Layer|Link|Location|Math|MimeType|Number|navigator|netscape|Object|Option|Packages|Password|Plugin|Radio|RegExp|Reset|Select|String|Style|Submit|screen|sun|Text|Textarea|window|XMLHttpRequest))\\>"; /* */ }, From 8b9c84f956278a1e2521bac3afc10b1f7737fd4a Mon Sep 17 00:00:00 2001 From: mats Date: Tue, 26 Apr 2005 16:00:30 +0000 Subject: [PATCH 012/243] -- Changed scopeName to "source.js" instead of "source.javascript". Didn't see the need for such a long name. (Might be missing something) -- Added some comments and cleaned it slightly. This file now will replace the soon to be deleted JavaScript (PHP) file. git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@751 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 49 +++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 4971229..df98d83 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -10,7 +10,7 @@ ----------------- */ name = "JavaScript"; - scopeName = "source.javascript"; + scopeName = "source.js"; uuid = "93E017CC-6F27-11D9-90EB-000D93589AF6"; fileTypes = ( js, htc ); @@ -26,8 +26,11 @@ 3 = { name = "function-argument"; }; }; }, - - { name = "constant.numeric.js"; match = "\\<((0(x|X)[0-9a-fA-F]+)|([0-9]+(\\.[0-9]+)?))\\>"; }, + + /* CONSTANTS:: Numeric */ + { name = "constant.numeric.js"; + match = "\\<((0(x|X)[0-9a-fA-F]+)|([0-9]+(\\.[0-9]+)?))\\>"; + }, /*{ // This is useless - why match called methods? /* @@ -50,22 +53,36 @@ "foregroundColor[1]" = "#779938"; },*/ - { name = "string.single-quoted.js"; begin = "'"; end = "'"; swallow = "\\\\."; }, - { name = "string.double-quoted.js"; begin = "\""; end = "\""; swallow = "\\\\."; }, - - { name = "comment.block.js"; begin = "/\\*"; end = "\\*/"; swallow = "\\\\."; }, - { name = "comment.line.js"; match = "//.*"; }, - + /* STRINGS: Single */ + { name = "string.single-quoted.js"; + begin = "'"; + end = "'"; + swallow = "\\\\."; + }, + /* STRINGS: Double */ + { name = "string.double-quoted.js"; + begin = "\""; + end = "\""; + swallow = "\\\\."; + }, + /* COMMENTS: Block */ + { name = "comment.block.js"; + begin = "/\\*"; + end = "\\*/"; + swallow = "\\\\."; + }, + /* COMMENTS: Single Line */ + { name = "comment.line.js"; + match = "//.*"; + }, /* HTML COMMENTS: inside embedded in a HTML page */ { name = "comment.html.js"; match = "()"; - }, - + }, /* KEYWORDS: */ { name = "keyword.declaration.js"; match = "\\<(function)\\>"; - }, - + }, /* KEYWORDS: Reserved */ { name = "keyword.reserved.js"; match = "\\<(boolean|break|byte|case|catch|char|class|const|continue|debugger|default|delete|do|double|else|enum|export|extends|false|final|finally|float|for|goto|if|implements|import|in|instanceof|int|interface|long|native|new|null|package|private|protected|public|return|short|static|super|switch|synchronized|this|throw|throws|transient|true|try|typeof|var|void|volatile|while|with)\\>"; @@ -107,8 +124,10 @@ { name = "constant.js"; match = "\\<(Infinity|NaN|Undefined)\\>"; }, - - { begin = "(([=(]|^)\\s*)(/)(?![*/])"; end = "(/([igm]+)?)"; + + /* STRINGS REGEX:: */ + { begin = "(([=(]|^)\\s*)(/)(?![*/])"; + end = "(/([igm]+)?)"; beginCaptures = { 1 = { name = "dummy.regexp-start"; }; 3 = { name = "string.regexp.js"; }; From 115c45cf85f7f790573a7c93792950c1290dee37 Mon Sep 17 00:00:00 2001 From: duff Date: Tue, 3 May 2005 22:36:01 +0000 Subject: [PATCH 013/243] Using the new entity.* hierarchy for functions, classes, and tags. git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@829 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index df98d83..e61941d 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -22,8 +22,8 @@ match = "^\\s*(function)\\s*([a-zA-Z_]\\w*)\\s*\\(([^)]*)\\)"; captures = { 1 = { name = "keyword.declaration.js"; }; - 2 = { name = "function-name"; }; - 3 = { name = "function-argument"; }; + 2 = { name = "entity.name.function"; }; + 3 = { name = "entity.parameter.variable.function"; }; }; }, From e5d5ecca6e6db22f030f9f4fd74b52a7e0df0cda Mon Sep 17 00:00:00 2001 From: duff Date: Wed, 4 May 2005 01:18:00 +0000 Subject: [PATCH 014/243] Minor changes made to rule names. git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@835 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index e61941d..5344b0d 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -72,7 +72,7 @@ swallow = "\\\\."; }, /* COMMENTS: Single Line */ - { name = "comment.line.js"; + { name = "comment.line.double-slash.js"; match = "//.*"; }, /* HTML COMMENTS: inside embedded in a HTML page */ @@ -99,7 +99,7 @@ }, /* OBJECTS:: Methods */ - { name = "keyword.method.js"; + { name = "keyword.function.method.js"; match = "\\<(abort|abs|acos|alert|anchor|apply|asin|atan|atan2|atob|attachEvent|back|big|blink|blur|bold|borderWidths|btoa|call|captureEvents|ceil|charAt|charCodeAt|clear|clearInterval|clearTimeout|click|close|compile|concat|confirm|contextual|cos|createElement|createEventObject|createPopup|createStyleSheet|createTextNode|detachEvent|disableExternalCapture|dump|elementFromPoint|enableExternalCapture|escape|eval|exec|execCommand|execScript|exp|fileCreatedDate|fileModifiedDate|fileSize|fileUpdatedDate|find|firstChild|fixed|floor|focus|fontcolor|fontsize|fromCharCode|forward|getAllResponseHeaders|getAttention|getDate|getDay|getElementById|getElementsByName|getElementsByTagName|getFullYear|getHours|getMilliseconds|getMinutes|getMonth|getResponseHeader|getSeconds|getSelection|getTime|getTimezoneOffset|getUTCDate|getUTCDay|getUTCFullYear|getUTCHours|getUTCMilliseconds|getUTCMinutes|getUTCMonth|getUTCSeconds|getYear|go|handleEvent|home|indexOf|isFinite|isNaN|italics|javaEnabled|join|lastIndexOf|link|load|log|margins|match|max|mergeAttributes|min|moveAbove|moveBelow|moveBy|moveTo|moveToAbsolute|navigate|open|paddings|parse|parseFloat|parseInt|plugins.refresh|pop|pow|preference|print|prompt|push|queryCommandEnabled|queryCommandIndeterm|queryCommandState|queryCommandValue|random|recalc|releaseCapture|releaseEvents|reload|replace|reset|resizeBy|resizeTo|returnValue|reverse|round|routeEvents|savePreferences|scroll|scrollBy|scrollByLines|scrollByPages|scrollTo|scrollX|scrollY|search|select|send|setDate|setFullYear|setActive|setCursor|setHotKeys|setHours|setInterval|setMilliseconds|setMinutes|setMonth|setResizable|setRequestHeader|setSeconds|setTime|setTimeout|setUTCDate|setUTCFullYear|setUTCHours|setUTCMilliseconds|setUTCMinutes|setUTCMonth|setUTCSeconds|setYear|setZOptions|shift|showHelp|showModalDialog|showModelessDialog|sidebar|sin|signText|sizeToContent|slice|small|sort|splice|split|sqrt|strike|stop|sub|submit|substr|substring|sup|taint|taintEnabled|tan|test|toGMTString|toLocaleString|toLowerCase|toSource|toString|toUpperCase|toUTCString|UTC|unescape|unshift|untaint|updateCommands|unwatch|valueOf|watch|write|writeln)\\>(?=\\()"; }, From 876f09c79445667361205a3628e3e3fb704424a4 Mon Sep 17 00:00:00 2001 From: duff Date: Sun, 15 May 2005 02:18:40 +0000 Subject: [PATCH 015/243] Changed all uses of \< and \> to \b. Beta 9 uses oniguruma as regular expression library and doesn't have the former. Other than that, and lack of conditions (?(n):) (and different syntax for (?R)) then there shouldn't be any compatibility problems. On the positive side, oniguruma has recursive sub-groups, look-behind, is faster, and gives proper error codes for bad regular expressions! git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@916 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 5344b0d..d1cac3a 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -14,7 +14,7 @@ uuid = "93E017CC-6F27-11D9-90EB-000D93589AF6"; fileTypes = ( js, htc ); - foldingStartMarker = "^\\s*([A-Za-z0-9.]+\s*=\\s*)?(function)\\>"; + foldingStartMarker = "^\\s*([A-Za-z0-9.]+\s*=\\s*)?(function)\\b"; foldingStopMarker = "^\\s*\\}"; patterns = ( @@ -29,7 +29,7 @@ /* CONSTANTS:: Numeric */ { name = "constant.numeric.js"; - match = "\\<((0(x|X)[0-9a-fA-F]+)|([0-9]+(\\.[0-9]+)?))\\>"; + match = "\\b((0(x|X)[0-9a-fA-F]+)|([0-9]+(\\.[0-9]+)?))\\b"; }, /*{ // This is useless - why match called methods? @@ -38,7 +38,7 @@ obj.method(arguments) * / name = "keyword.function.js"; - match = "(\\<|\\.)([a-zA-Z_]\\w*(?=\\s*\\())"; + match = "(\\b|\\.)([a-zA-Z_]\\w*(?=\\s*\\())"; "foregroundColor[2]" = "#CC3833"; }, @@ -81,30 +81,30 @@ }, /* KEYWORDS: */ { name = "keyword.declaration.js"; - match = "\\<(function)\\>"; + match = "\\b(function)\\b"; }, /* KEYWORDS: Reserved */ { name = "keyword.reserved.js"; - match = "\\<(boolean|break|byte|case|catch|char|class|const|continue|debugger|default|delete|do|double|else|enum|export|extends|false|final|finally|float|for|goto|if|implements|import|in|instanceof|int|interface|long|native|new|null|package|private|protected|public|return|short|static|super|switch|synchronized|this|throw|throws|transient|true|try|typeof|var|void|volatile|while|with)\\>"; + match = "\\b(boolean|break|byte|case|catch|char|class|const|continue|debugger|default|delete|do|double|else|enum|export|extends|false|final|finally|float|for|goto|if|implements|import|in|instanceof|int|interface|long|native|new|null|package|private|protected|public|return|short|static|super|switch|synchronized|this|throw|throws|transient|true|try|typeof|var|void|volatile|while|with)\\b"; }, /* OBJECTS:: */ { name = "keyword.object.js"; /* CASE Sensitive Objects */ - match = "\\<(Anchor|Applet|Area|Array|Boolean|Button|Checkbox|Date|document|event|FileUpload|Form|Frame|Function|Hidden|History|Image|JavaArray|JavaClass|JavaObject|JavaPackage|java|Layer|Link|Location|Math|MimeType|Number|navigator|netscape|Object|Option|Packages|Password|Plugin|Radio|RegExp|Reset|Select|String|Style|Submit|screen|sun|Text|Textarea|window|XMLHttpRequest)\\>"; + match = "\\b(Anchor|Applet|Area|Array|Boolean|Button|Checkbox|Date|document|event|FileUpload|Form|Frame|Function|Hidden|History|Image|JavaArray|JavaClass|JavaObject|JavaPackage|java|Layer|Link|Location|Math|MimeType|Number|navigator|netscape|Object|Option|Packages|Password|Plugin|Radio|RegExp|Reset|Select|String|Style|Submit|screen|sun|Text|Textarea|window|XMLHttpRequest)\\b"; /* */ /* CASE InSensitive Objects * / - match = "\\<((?i:Anchor|Applet|Area|Array|Boolean|Button|Checkbox|Date|document|event|FileUpload|Form|Frame|Function|Hidden|History|Image|JavaArray|JavaClass|JavaObject|JavaPackage|java|Layer|Link|Location|Math|MimeType|Number|navigator|netscape|Object|Option|Packages|Password|Plugin|Radio|RegExp|Reset|Select|String|Style|Submit|screen|sun|Text|Textarea|window|XMLHttpRequest))\\>"; + match = "\\b((?i:Anchor|Applet|Area|Array|Boolean|Button|Checkbox|Date|document|event|FileUpload|Form|Frame|Function|Hidden|History|Image|JavaArray|JavaClass|JavaObject|JavaPackage|java|Layer|Link|Location|Math|MimeType|Number|navigator|netscape|Object|Option|Packages|Password|Plugin|Radio|RegExp|Reset|Select|String|Style|Submit|screen|sun|Text|Textarea|window|XMLHttpRequest))\\b"; /* */ }, /* OBJECTS:: Methods */ { name = "keyword.function.method.js"; - match = "\\<(abort|abs|acos|alert|anchor|apply|asin|atan|atan2|atob|attachEvent|back|big|blink|blur|bold|borderWidths|btoa|call|captureEvents|ceil|charAt|charCodeAt|clear|clearInterval|clearTimeout|click|close|compile|concat|confirm|contextual|cos|createElement|createEventObject|createPopup|createStyleSheet|createTextNode|detachEvent|disableExternalCapture|dump|elementFromPoint|enableExternalCapture|escape|eval|exec|execCommand|execScript|exp|fileCreatedDate|fileModifiedDate|fileSize|fileUpdatedDate|find|firstChild|fixed|floor|focus|fontcolor|fontsize|fromCharCode|forward|getAllResponseHeaders|getAttention|getDate|getDay|getElementById|getElementsByName|getElementsByTagName|getFullYear|getHours|getMilliseconds|getMinutes|getMonth|getResponseHeader|getSeconds|getSelection|getTime|getTimezoneOffset|getUTCDate|getUTCDay|getUTCFullYear|getUTCHours|getUTCMilliseconds|getUTCMinutes|getUTCMonth|getUTCSeconds|getYear|go|handleEvent|home|indexOf|isFinite|isNaN|italics|javaEnabled|join|lastIndexOf|link|load|log|margins|match|max|mergeAttributes|min|moveAbove|moveBelow|moveBy|moveTo|moveToAbsolute|navigate|open|paddings|parse|parseFloat|parseInt|plugins.refresh|pop|pow|preference|print|prompt|push|queryCommandEnabled|queryCommandIndeterm|queryCommandState|queryCommandValue|random|recalc|releaseCapture|releaseEvents|reload|replace|reset|resizeBy|resizeTo|returnValue|reverse|round|routeEvents|savePreferences|scroll|scrollBy|scrollByLines|scrollByPages|scrollTo|scrollX|scrollY|search|select|send|setDate|setFullYear|setActive|setCursor|setHotKeys|setHours|setInterval|setMilliseconds|setMinutes|setMonth|setResizable|setRequestHeader|setSeconds|setTime|setTimeout|setUTCDate|setUTCFullYear|setUTCHours|setUTCMilliseconds|setUTCMinutes|setUTCMonth|setUTCSeconds|setYear|setZOptions|shift|showHelp|showModalDialog|showModelessDialog|sidebar|sin|signText|sizeToContent|slice|small|sort|splice|split|sqrt|strike|stop|sub|submit|substr|substring|sup|taint|taintEnabled|tan|test|toGMTString|toLocaleString|toLowerCase|toSource|toString|toUpperCase|toUTCString|UTC|unescape|unshift|untaint|updateCommands|unwatch|valueOf|watch|write|writeln)\\>(?=\\()"; + match = "\\b(abort|abs|acos|alert|anchor|apply|asin|atan|atan2|atob|attachEvent|back|big|blink|blur|bold|borderWidths|btoa|call|captureEvents|ceil|charAt|charCodeAt|clear|clearInterval|clearTimeout|click|close|compile|concat|confirm|contextual|cos|createElement|createEventObject|createPopup|createStyleSheet|createTextNode|detachEvent|disableExternalCapture|dump|elementFromPoint|enableExternalCapture|escape|eval|exec|execCommand|execScript|exp|fileCreatedDate|fileModifiedDate|fileSize|fileUpdatedDate|find|firstChild|fixed|floor|focus|fontcolor|fontsize|fromCharCode|forward|getAllResponseHeaders|getAttention|getDate|getDay|getElementById|getElementsByName|getElementsByTagName|getFullYear|getHours|getMilliseconds|getMinutes|getMonth|getResponseHeader|getSeconds|getSelection|getTime|getTimezoneOffset|getUTCDate|getUTCDay|getUTCFullYear|getUTCHours|getUTCMilliseconds|getUTCMinutes|getUTCMonth|getUTCSeconds|getYear|go|handleEvent|home|indexOf|isFinite|isNaN|italics|javaEnabled|join|lastIndexOf|link|load|log|margins|match|max|mergeAttributes|min|moveAbove|moveBelow|moveBy|moveTo|moveToAbsolute|navigate|open|paddings|parse|parseFloat|parseInt|plugins.refresh|pop|pow|preference|print|prompt|push|queryCommandEnabled|queryCommandIndeterm|queryCommandState|queryCommandValue|random|recalc|releaseCapture|releaseEvents|reload|replace|reset|resizeBy|resizeTo|returnValue|reverse|round|routeEvents|savePreferences|scroll|scrollBy|scrollByLines|scrollByPages|scrollTo|scrollX|scrollY|search|select|send|setDate|setFullYear|setActive|setCursor|setHotKeys|setHours|setInterval|setMilliseconds|setMinutes|setMonth|setResizable|setRequestHeader|setSeconds|setTime|setTimeout|setUTCDate|setUTCFullYear|setUTCHours|setUTCMilliseconds|setUTCMinutes|setUTCMonth|setUTCSeconds|setYear|setZOptions|shift|showHelp|showModalDialog|showModelessDialog|sidebar|sin|signText|sizeToContent|slice|small|sort|splice|split|sqrt|strike|stop|sub|submit|substr|substring|sup|taint|taintEnabled|tan|test|toGMTString|toLocaleString|toLowerCase|toSource|toString|toUpperCase|toUTCString|UTC|unescape|unshift|untaint|updateCommands|unwatch|valueOf|watch|write|writeln)\\b(?=\\()"; }, /* OBJECTS:: Properties */ - { match = "\\.\\<(_content|above|action|align|aLinkcolor|all|anchors|appCodeName|appCore|appMinorVersion|appName|applets|appVersion|arguments|arguments.callee|arguments.caller|arguments.length|arity|attributes|availHeight|availLeft|availTop|availWidth|background|backgroundColor|backgroundImage|below|bgColor|body|border|borderBottomWidth|borderColor|borderLeftWidth|borderRightWidth|borderStyle|borderTopWidth|bottom|bufferDepth|characterSet|checked|childNodes|classes|className|clientInformation|clip|clipboardData|closed|colorDepth|complete|components|constructor|controllers|cookie|cookieEnabled|cpuClass|crypto|current|data|defaultCharset|defaultChecked|defaultStatus|defaultValue|defaultView|description|dialogArguments|dialogHeight|dialogLeft|dialogTop|dialogWidth|dir|directories|display|doctype|documentElement|domain|E|elements|embeds|enabledPlugin|encoding|expando|external|fgColor|filename|fontFamily|fontSize|fontWeight|form|formName|forms|frameElement|frames|global|hasFocus|hash|height|history|host|hostname|href|hspace|ids|ignoreCase|images|implementation|input|innerHeight|innerWidth|index|LN10|LN2|LOG10E|LOG2E|language|lastChild|lastIndex|lastMatch|lastModified|lastParen|layers|layerX|left|leftContext|length|lineHeight|linkColor|links|listStyleType|localName|location|locationbar|lowsrc|MAX_VALUE|MIN_VALUE|marginBottom|marginLeft|marginRight|marginTop|media|method|menubar|mimeTypes|multiline|NEGATIVE_INFINITY|name|nameProp|namespaces|namespaceURI|next|nextSibling|nodeName|nodeType|nodeValue|offscreenBuffering|onLine|onreadystatechange|opener|opsProfile|oscpu|options|outerHeight|outerWidth|ownerDocument|POSITIVE_INFINITY|PI|paddingBottom|paddingLeft|paddingRight|paddingTop|pageX|pageY|pageXOffset|pageYOffset|parent|parentLayer|parentNode|parentWindow|pathname|personalbar|pixelDepth|platform|plugins|pkcs11|port|prefix|previous|previousSibling|product|productSub|prompter|protocol|prototype|readyState|referrer|responseText|responseXML|right|rightContext|SQRT1_2|SQRT2|screenLeft|screenTop|screenX|screenY|scripts|scrollbars|security|securityPolicy|selected|selection|selectedIndex|self|siblingAbove|siblingBelow|src|source|status|statusbar|statusText|styleSheets|suffixes|systemLanguage|tags|target|text|textAlign|textDecoration|textIndent|textTransform|title|toolbar|top|type|URL|URLUnencoded|undefined|uniqueID|updateInterval|userAgent|userLanguage|userProfile|value|vendor|vendorSub|visibility|vLinkcolor|vspace|whiteSpace|width|XMLDocument|XSLDocument|x|y|zIndex)\\>"; + { match = "\\.\\b(_content|above|action|align|aLinkcolor|all|anchors|appCodeName|appCore|appMinorVersion|appName|applets|appVersion|arguments|arguments.callee|arguments.caller|arguments.length|arity|attributes|availHeight|availLeft|availTop|availWidth|background|backgroundColor|backgroundImage|below|bgColor|body|border|borderBottomWidth|borderColor|borderLeftWidth|borderRightWidth|borderStyle|borderTopWidth|bottom|bufferDepth|characterSet|checked|childNodes|classes|className|clientInformation|clip|clipboardData|closed|colorDepth|complete|components|constructor|controllers|cookie|cookieEnabled|cpuClass|crypto|current|data|defaultCharset|defaultChecked|defaultStatus|defaultValue|defaultView|description|dialogArguments|dialogHeight|dialogLeft|dialogTop|dialogWidth|dir|directories|display|doctype|documentElement|domain|E|elements|embeds|enabledPlugin|encoding|expando|external|fgColor|filename|fontFamily|fontSize|fontWeight|form|formName|forms|frameElement|frames|global|hasFocus|hash|height|history|host|hostname|href|hspace|ids|ignoreCase|images|implementation|input|innerHeight|innerWidth|index|LN10|LN2|LOG10E|LOG2E|language|lastChild|lastIndex|lastMatch|lastModified|lastParen|layers|layerX|left|leftContext|length|lineHeight|linkColor|links|listStyleType|localName|location|locationbar|lowsrc|MAX_VALUE|MIN_VALUE|marginBottom|marginLeft|marginRight|marginTop|media|method|menubar|mimeTypes|multiline|NEGATIVE_INFINITY|name|nameProp|namespaces|namespaceURI|next|nextSibling|nodeName|nodeType|nodeValue|offscreenBuffering|onLine|onreadystatechange|opener|opsProfile|oscpu|options|outerHeight|outerWidth|ownerDocument|POSITIVE_INFINITY|PI|paddingBottom|paddingLeft|paddingRight|paddingTop|pageX|pageY|pageXOffset|pageYOffset|parent|parentLayer|parentNode|parentWindow|pathname|personalbar|pixelDepth|platform|plugins|pkcs11|port|prefix|previous|previousSibling|product|productSub|prompter|protocol|prototype|readyState|referrer|responseText|responseXML|right|rightContext|SQRT1_2|SQRT2|screenLeft|screenTop|screenX|screenY|scripts|scrollbars|security|securityPolicy|selected|selection|selectedIndex|self|siblingAbove|siblingBelow|src|source|status|statusbar|statusText|styleSheets|suffixes|systemLanguage|tags|target|text|textAlign|textDecoration|textIndent|textTransform|title|toolbar|top|type|URL|URLUnencoded|undefined|uniqueID|updateInterval|userAgent|userLanguage|userProfile|value|vendor|vendorSub|visibility|vLinkcolor|vspace|whiteSpace|width|XMLDocument|XSLDocument|x|y|zIndex)\\b"; captures = { 1 = { name = "keyword.property.js"; }; }; @@ -112,17 +112,17 @@ /* OBJECTS:: Event Handlers:: */ { name = "keyword.event-handler.js"; - match = "\\<(onAbort|onActivate|onAfterprint|onAfterupdate|onBeforeactivate|onBeforecut|onBeforedeactivate|onBeforeeditfocus|onBeforepaste|onBeforeprint|onBeforeunload|onBeforeupdate|onBlur|onCellchange|onChange|onClick|onClose|onContextmenu|onControlselect|onCut|onDataavailable|onDatasetchanged|onDatasetcomplete|onDblclick|onDeactivate|onDrag|onDragdrop|onDragend|onDragenter|onDragleave|onDragover|onDragstart|onDrop|onError|onErrorupdate|onFocus|onHelp|onKeydown|onKeypress|onKeyup|onLoad|onMousedown|onMousemove|onMouseout|onMouseover|onMouseup|onPaste|onPropertychange|onReadystatechange|onReset|onResize|onResizeend|onResizestart|onRowenter|onRowexit|onRowsdelete|onRowsinserted|onScroll|onSelect|onSelectionchange|onSelectstart|onStop|onSubmit|onUnload)\\>"; + match = "\\b(onAbort|onActivate|onAfterprint|onAfterupdate|onBeforeactivate|onBeforecut|onBeforedeactivate|onBeforeeditfocus|onBeforepaste|onBeforeprint|onBeforeunload|onBeforeupdate|onBlur|onCellchange|onChange|onClick|onClose|onContextmenu|onControlselect|onCut|onDataavailable|onDatasetchanged|onDatasetcomplete|onDblclick|onDeactivate|onDrag|onDragdrop|onDragend|onDragenter|onDragleave|onDragover|onDragstart|onDrop|onError|onErrorupdate|onFocus|onHelp|onKeydown|onKeypress|onKeyup|onLoad|onMousedown|onMousemove|onMouseout|onMouseover|onMouseup|onPaste|onPropertychange|onReadystatechange|onReset|onResize|onResizeend|onResizestart|onRowenter|onRowexit|onRowsdelete|onRowsinserted|onScroll|onSelect|onSelectionchange|onSelectstart|onStop|onSubmit|onUnload)\\b"; }, /* OPERATORS:: */ { name = "keyword.operator.js"; - match = "(!|\\$|%|&|\\*|\\+|\\-|\\-\\-|\\+\\+|~|==|===|!=|!==|<>|<|>|<=|>=|!|&&|\\|\\||\\?\\:|\\*=|/=|%=|\\+=|\\-=|<<=|>>=|>>>=|&=|\\^=|\\|=)|\\<(in|instanceof|new|delete|typeof|void)\\>"; + match = "(!|\\$|%|&|\\*|\\+|\\-|\\-\\-|\\+\\+|~|==|===|!=|!==|<>|<|>|<=|>=|!|&&|\\|\\||\\?\\:|\\*=|/=|%=|\\+=|\\-=|<<=|>>=|>>>=|&=|\\^=|\\|=)|\\b(in|instanceof|new|delete|typeof|void)\\b"; }, /* CONSTANTS:: */ { name = "constant.js"; - match = "\\<(Infinity|NaN|Undefined)\\>"; + match = "\\b(Infinity|NaN|Undefined)\\b"; }, /* STRINGS REGEX:: */ From 856b3badbda29910a3c4538eb9dd5ab2a88811bf Mon Sep 17 00:00:00 2001 From: mats Date: Thu, 19 May 2005 16:52:40 +0000 Subject: [PATCH 016/243] -- minor reworking of "keyword.operator.js" group to work around a HL bug not working on some operators git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@980 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index d1cac3a..0a029e1 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -117,7 +117,7 @@ /* OPERATORS:: */ { name = "keyword.operator.js"; - match = "(!|\\$|%|&|\\*|\\+|\\-|\\-\\-|\\+\\+|~|==|===|!=|!==|<>|<|>|<=|>=|!|&&|\\|\\||\\?\\:|\\*=|/=|%=|\\+=|\\-=|<<=|>>=|>>>=|&=|\\^=|\\|=)|\\b(in|instanceof|new|delete|typeof|void)\\b"; + match = "(!|\\$|%|&|\\*|\\+|\\-|\\-\\-|\\+\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|/=|%=|\\+=|\\-=|&=|\\^=|\\)|\\b(in|instanceof|new|delete|typeof|void)\\b"; }, /* CONSTANTS:: */ From b67473bf1ee6bb8c36e14f68d9cfa3341238f3ef Mon Sep 17 00:00:00 2001 From: duff Date: Sat, 21 May 2005 04:48:41 +0000 Subject: [PATCH 017/243] =?UTF-8?q?=E2=80=A2=C2=A0Removed=20start=20parent?= =?UTF-8?q?hesis=20(had=20no=20matching=20end=20parenthesis=20and=20was=20?= =?UTF-8?q?anyway=20redundant)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@1031 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 0a029e1..bb3030b 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -117,7 +117,7 @@ /* OPERATORS:: */ { name = "keyword.operator.js"; - match = "(!|\\$|%|&|\\*|\\+|\\-|\\-\\-|\\+\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|/=|%=|\\+=|\\-=|&=|\\^=|\\)|\\b(in|instanceof|new|delete|typeof|void)\\b"; + match = "!|\\$|%|&|\\*|\\+|\\-|\\-\\-|\\+\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|/=|%=|\\+=|\\-=|&=|\\^=|\\)|\\b(in|instanceof|new|delete|typeof|void)\\b"; }, /* CONSTANTS:: */ From a14cbab7241f9f57a8071be1dffa13ba5f088953 Mon Sep 17 00:00:00 2001 From: mats Date: Fri, 3 Jun 2005 13:50:37 +0000 Subject: [PATCH 018/243] -- corrected an error in "keyword.operator.js" where a ) was included. git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@1147 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index bb3030b..4f08b1c 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -117,7 +117,7 @@ /* OPERATORS:: */ { name = "keyword.operator.js"; - match = "!|\\$|%|&|\\*|\\+|\\-|\\-\\-|\\+\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|/=|%=|\\+=|\\-=|&=|\\^=|\\)|\\b(in|instanceof|new|delete|typeof|void)\\b"; + match = "!|\\$|%|&|\\*|\\+|\\-|\\-\\-|\\+\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|/=|%=|\\+=|\\-=|&=|\\^=|\\b(in|instanceof|new|delete|typeof|void)\\b"; }, /* CONSTANTS:: */ From 73e2f676155a4e2124227d187500896ce7c04685 Mon Sep 17 00:00:00 2001 From: duff Date: Sat, 11 Jun 2005 15:25:41 +0000 Subject: [PATCH 019/243] More languages updated to new naming scheme. git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@1177 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 64 ++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 4f08b1c..07f9a61 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -21,9 +21,9 @@ { name = "declaration.function.js"; match = "^\\s*(function)\\s*([a-zA-Z_]\\w*)\\s*\\(([^)]*)\\)"; captures = { - 1 = { name = "keyword.declaration.js"; }; - 2 = { name = "entity.name.function"; }; - 3 = { name = "entity.parameter.variable.function"; }; + 1 = { name = "storage.type.function.js"; }; + 2 = { name = "entity.name.function.js"; }; + 3 = { name = "variable.parameter.function.js"; }; }; }, @@ -54,21 +54,16 @@ },*/ /* STRINGS: Single */ - { name = "string.single-quoted.js"; - begin = "'"; - end = "'"; - swallow = "\\\\."; + { name = "string.quoted.single.js"; + begin = "'"; end = "'"; swallow = "\\\\."; }, /* STRINGS: Double */ - { name = "string.double-quoted.js"; - begin = "\""; - end = "\""; - swallow = "\\\\."; + { name = "string.quoted.double.js"; + begin = "\""; end = "\""; swallow = "\\\\."; }, /* COMMENTS: Block */ { name = "comment.block.js"; - begin = "/\\*"; - end = "\\*/"; + begin = "/\\*"; end = "\\*/"; swallow = "\\\\."; }, /* COMMENTS: Single Line */ @@ -76,42 +71,49 @@ match = "//.*"; }, /* HTML COMMENTS: inside embedded in a HTML page */ - { name = "comment.html.js"; + { name = "comment.block.html.js"; match = "()"; }, - /* KEYWORDS: */ - { name = "keyword.declaration.js"; - match = "\\b(function)\\b"; - }, - /* KEYWORDS: Reserved */ - { name = "keyword.reserved.js"; - match = "\\b(boolean|break|byte|case|catch|char|class|const|continue|debugger|default|delete|do|double|else|enum|export|extends|false|final|finally|float|for|goto|if|implements|import|in|instanceof|int|interface|long|native|new|null|package|private|protected|public|return|short|static|super|switch|synchronized|this|throw|throws|transient|true|try|typeof|var|void|volatile|while|with)\\b"; + + { name = "storage.type.js"; + match = "\\b(boolean|byte|char|class|double|enum|float|function|int|interface|long|short|var|void)\\b"; }, - + { name = "storage.modifier.js"; + match = "\\b(const|export|extends|final|implements|native|private|protected|public|static|synchronized|throws|transient|volatile)\\b"; + }, + { name = "keyword.control.js"; + match = "\\b(break|case|catch|continue|default|do|else|finally|for|goto|if|import|package|return|switch|throw|try|while)\\b"; + }, + { name = "keyword.operator.js"; + match = "\\b(delete|in|instanceof|new|typeof|with)\\b"; + }, + { name = "constant.language.js"; + match = "\\b(false|null|super|this|true)\\b"; + }, + { name = "keyword.other.js"; + match = "\\b(debugger)\\b"; + }, + /* OBJECTS:: */ - { name = "keyword.object.js"; + { name = "support.class.js"; /* CASE Sensitive Objects */ match = "\\b(Anchor|Applet|Area|Array|Boolean|Button|Checkbox|Date|document|event|FileUpload|Form|Frame|Function|Hidden|History|Image|JavaArray|JavaClass|JavaObject|JavaPackage|java|Layer|Link|Location|Math|MimeType|Number|navigator|netscape|Object|Option|Packages|Password|Plugin|Radio|RegExp|Reset|Select|String|Style|Submit|screen|sun|Text|Textarea|window|XMLHttpRequest)\\b"; - /* */ - /* CASE InSensitive Objects * / - match = "\\b((?i:Anchor|Applet|Area|Array|Boolean|Button|Checkbox|Date|document|event|FileUpload|Form|Frame|Function|Hidden|History|Image|JavaArray|JavaClass|JavaObject|JavaPackage|java|Layer|Link|Location|Math|MimeType|Number|navigator|netscape|Object|Option|Packages|Password|Plugin|Radio|RegExp|Reset|Select|String|Style|Submit|screen|sun|Text|Textarea|window|XMLHttpRequest))\\b"; - /* */ }, /* OBJECTS:: Methods */ - { name = "keyword.function.method.js"; + { name = "support.function.js"; match = "\\b(abort|abs|acos|alert|anchor|apply|asin|atan|atan2|atob|attachEvent|back|big|blink|blur|bold|borderWidths|btoa|call|captureEvents|ceil|charAt|charCodeAt|clear|clearInterval|clearTimeout|click|close|compile|concat|confirm|contextual|cos|createElement|createEventObject|createPopup|createStyleSheet|createTextNode|detachEvent|disableExternalCapture|dump|elementFromPoint|enableExternalCapture|escape|eval|exec|execCommand|execScript|exp|fileCreatedDate|fileModifiedDate|fileSize|fileUpdatedDate|find|firstChild|fixed|floor|focus|fontcolor|fontsize|fromCharCode|forward|getAllResponseHeaders|getAttention|getDate|getDay|getElementById|getElementsByName|getElementsByTagName|getFullYear|getHours|getMilliseconds|getMinutes|getMonth|getResponseHeader|getSeconds|getSelection|getTime|getTimezoneOffset|getUTCDate|getUTCDay|getUTCFullYear|getUTCHours|getUTCMilliseconds|getUTCMinutes|getUTCMonth|getUTCSeconds|getYear|go|handleEvent|home|indexOf|isFinite|isNaN|italics|javaEnabled|join|lastIndexOf|link|load|log|margins|match|max|mergeAttributes|min|moveAbove|moveBelow|moveBy|moveTo|moveToAbsolute|navigate|open|paddings|parse|parseFloat|parseInt|plugins.refresh|pop|pow|preference|print|prompt|push|queryCommandEnabled|queryCommandIndeterm|queryCommandState|queryCommandValue|random|recalc|releaseCapture|releaseEvents|reload|replace|reset|resizeBy|resizeTo|returnValue|reverse|round|routeEvents|savePreferences|scroll|scrollBy|scrollByLines|scrollByPages|scrollTo|scrollX|scrollY|search|select|send|setDate|setFullYear|setActive|setCursor|setHotKeys|setHours|setInterval|setMilliseconds|setMinutes|setMonth|setResizable|setRequestHeader|setSeconds|setTime|setTimeout|setUTCDate|setUTCFullYear|setUTCHours|setUTCMilliseconds|setUTCMinutes|setUTCMonth|setUTCSeconds|setYear|setZOptions|shift|showHelp|showModalDialog|showModelessDialog|sidebar|sin|signText|sizeToContent|slice|small|sort|splice|split|sqrt|strike|stop|sub|submit|substr|substring|sup|taint|taintEnabled|tan|test|toGMTString|toLocaleString|toLowerCase|toSource|toString|toUpperCase|toUTCString|UTC|unescape|unshift|untaint|updateCommands|unwatch|valueOf|watch|write|writeln)\\b(?=\\()"; }, /* OBJECTS:: Properties */ { match = "\\.\\b(_content|above|action|align|aLinkcolor|all|anchors|appCodeName|appCore|appMinorVersion|appName|applets|appVersion|arguments|arguments.callee|arguments.caller|arguments.length|arity|attributes|availHeight|availLeft|availTop|availWidth|background|backgroundColor|backgroundImage|below|bgColor|body|border|borderBottomWidth|borderColor|borderLeftWidth|borderRightWidth|borderStyle|borderTopWidth|bottom|bufferDepth|characterSet|checked|childNodes|classes|className|clientInformation|clip|clipboardData|closed|colorDepth|complete|components|constructor|controllers|cookie|cookieEnabled|cpuClass|crypto|current|data|defaultCharset|defaultChecked|defaultStatus|defaultValue|defaultView|description|dialogArguments|dialogHeight|dialogLeft|dialogTop|dialogWidth|dir|directories|display|doctype|documentElement|domain|E|elements|embeds|enabledPlugin|encoding|expando|external|fgColor|filename|fontFamily|fontSize|fontWeight|form|formName|forms|frameElement|frames|global|hasFocus|hash|height|history|host|hostname|href|hspace|ids|ignoreCase|images|implementation|input|innerHeight|innerWidth|index|LN10|LN2|LOG10E|LOG2E|language|lastChild|lastIndex|lastMatch|lastModified|lastParen|layers|layerX|left|leftContext|length|lineHeight|linkColor|links|listStyleType|localName|location|locationbar|lowsrc|MAX_VALUE|MIN_VALUE|marginBottom|marginLeft|marginRight|marginTop|media|method|menubar|mimeTypes|multiline|NEGATIVE_INFINITY|name|nameProp|namespaces|namespaceURI|next|nextSibling|nodeName|nodeType|nodeValue|offscreenBuffering|onLine|onreadystatechange|opener|opsProfile|oscpu|options|outerHeight|outerWidth|ownerDocument|POSITIVE_INFINITY|PI|paddingBottom|paddingLeft|paddingRight|paddingTop|pageX|pageY|pageXOffset|pageYOffset|parent|parentLayer|parentNode|parentWindow|pathname|personalbar|pixelDepth|platform|plugins|pkcs11|port|prefix|previous|previousSibling|product|productSub|prompter|protocol|prototype|readyState|referrer|responseText|responseXML|right|rightContext|SQRT1_2|SQRT2|screenLeft|screenTop|screenX|screenY|scripts|scrollbars|security|securityPolicy|selected|selection|selectedIndex|self|siblingAbove|siblingBelow|src|source|status|statusbar|statusText|styleSheets|suffixes|systemLanguage|tags|target|text|textAlign|textDecoration|textIndent|textTransform|title|toolbar|top|type|URL|URLUnencoded|undefined|uniqueID|updateInterval|userAgent|userLanguage|userProfile|value|vendor|vendorSub|visibility|vLinkcolor|vspace|whiteSpace|width|XMLDocument|XSLDocument|x|y|zIndex)\\b"; captures = { - 1 = { name = "keyword.property.js"; }; + 1 = { name = "support.constant.js"; }; }; }, /* OBJECTS:: Event Handlers:: */ - { name = "keyword.event-handler.js"; + { name = "support.function.event-handler.js"; match = "\\b(onAbort|onActivate|onAfterprint|onAfterupdate|onBeforeactivate|onBeforecut|onBeforedeactivate|onBeforeeditfocus|onBeforepaste|onBeforeprint|onBeforeunload|onBeforeupdate|onBlur|onCellchange|onChange|onClick|onClose|onContextmenu|onControlselect|onCut|onDataavailable|onDatasetchanged|onDatasetcomplete|onDblclick|onDeactivate|onDrag|onDragdrop|onDragend|onDragenter|onDragleave|onDragover|onDragstart|onDrop|onError|onErrorupdate|onFocus|onHelp|onKeydown|onKeypress|onKeyup|onLoad|onMousedown|onMousemove|onMouseout|onMouseover|onMouseup|onPaste|onPropertychange|onReadystatechange|onReset|onResize|onResizeend|onResizestart|onRowenter|onRowexit|onRowsdelete|onRowsinserted|onScroll|onSelect|onSelectionchange|onSelectstart|onStop|onSubmit|onUnload)\\b"; }, @@ -121,7 +123,7 @@ }, /* CONSTANTS:: */ - { name = "constant.js"; + { name = "constant.language.js"; match = "\\b(Infinity|NaN|Undefined)\\b"; }, From ca95a4796dcae518f428d738b8e0263afb8f84bb Mon Sep 17 00:00:00 2001 From: kevin Date: Fri, 1 Jul 2005 02:03:11 +0000 Subject: [PATCH 020/243] Add opt-ctrl-shift-J shortcut for JavaScript git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@1275 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 1 + 1 file changed, 1 insertion(+) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 07f9a61..4e65ace 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -13,6 +13,7 @@ scopeName = "source.js"; uuid = "93E017CC-6F27-11D9-90EB-000D93589AF6"; fileTypes = ( js, htc ); + keyEquivalent = "~^J"; foldingStartMarker = "^\\s*([A-Za-z0-9.]+\s*=\\s*)?(function)\\b"; foldingStopMarker = "^\\s*\\}"; From 558a9b210236181e2bf1d9d8c5c74b0319d52c10 Mon Sep 17 00:00:00 2001 From: duff Date: Mon, 11 Jul 2005 23:49:10 +0000 Subject: [PATCH 021/243] =?UTF-8?q?=E2=80=A2=C2=A0snippet=20to=20create=20?= =?UTF-8?q?a=20js=20function?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@1325 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Snippets/function (fun).plist | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Snippets/function (fun).plist diff --git a/Snippets/function (fun).plist b/Snippets/function (fun).plist new file mode 100644 index 0000000..3b61a5b --- /dev/null +++ b/Snippets/function (fun).plist @@ -0,0 +1,19 @@ + + + + + content + function ${1:function_name} (${2:first_argument}) +{ + ${0:# body...} +} + name + function (fun) + scope + source.js + tabTrigger + fun + uuid + F0E4FB6A-4878-48C6-A777-62438DF1E14F + + From 0d5f8bbcf60733cea7d0a6c79bdf0f50a93049fe Mon Sep 17 00:00:00 2001 From: mats Date: Sat, 23 Jul 2005 16:22:50 +0000 Subject: [PATCH 022/243] -- changed "declaration.*" to "meta.*" -- corrected some syntax highlighting bugs around the place git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@1369 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 367 +++++++++++++++++++++++--------------- 1 file changed, 220 insertions(+), 147 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 4e65ace..0b3fcb5 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -1,147 +1,220 @@ -{ - /* ----------------- - - JavaScript - ========== - - Created by god knows who, but extensively modified by Kevin Ballard - Modifications based in part on the JavaScript (PHP) syntax by Mats Persson (mats@imediatec.co.uk) - - ----------------- */ - - name = "JavaScript"; - scopeName = "source.js"; - uuid = "93E017CC-6F27-11D9-90EB-000D93589AF6"; - fileTypes = ( js, htc ); - keyEquivalent = "~^J"; - - foldingStartMarker = "^\\s*([A-Za-z0-9.]+\s*=\\s*)?(function)\\b"; - foldingStopMarker = "^\\s*\\}"; - - patterns = ( - { name = "declaration.function.js"; - match = "^\\s*(function)\\s*([a-zA-Z_]\\w*)\\s*\\(([^)]*)\\)"; - captures = { - 1 = { name = "storage.type.function.js"; }; - 2 = { name = "entity.name.function.js"; }; - 3 = { name = "variable.parameter.function.js"; }; - }; - }, - - /* CONSTANTS:: Numeric */ - { name = "constant.numeric.js"; - match = "\\b((0(x|X)[0-9a-fA-F]+)|([0-9]+(\\.[0-9]+)?))\\b"; - }, - - /*{ // This is useless - why match called methods? - /* - Methods: - obj.method(arguments) - * / - name = "keyword.function.js"; - match = "(\\b|\\.)([a-zA-Z_]\\w*(?=\\s*\\())"; - "foregroundColor[2]" = "#CC3833"; - }, - - { // This is also useless - why match used instance vars? - /* - Instance Variables: - RegExp.$3 - ary.length - * / - name = "keyword.instance-variables.js"; - match = "\\.([a-zA-Z_]\\w*|\\$\\d{1,2})(?!\\s*\\()"; - "foregroundColor[1]" = "#779938"; - },*/ - - /* STRINGS: Single */ - { name = "string.quoted.single.js"; - begin = "'"; end = "'"; swallow = "\\\\."; - }, - /* STRINGS: Double */ - { name = "string.quoted.double.js"; - begin = "\""; end = "\""; swallow = "\\\\."; - }, - /* COMMENTS: Block */ - { name = "comment.block.js"; - begin = "/\\*"; end = "\\*/"; - swallow = "\\\\."; - }, - /* COMMENTS: Single Line */ - { name = "comment.line.double-slash.js"; - match = "//.*"; - }, - /* HTML COMMENTS: inside embedded in a HTML page */ - { name = "comment.block.html.js"; - match = "()"; - }, - - { name = "storage.type.js"; - match = "\\b(boolean|byte|char|class|double|enum|float|function|int|interface|long|short|var|void)\\b"; - }, - { name = "storage.modifier.js"; - match = "\\b(const|export|extends|final|implements|native|private|protected|public|static|synchronized|throws|transient|volatile)\\b"; - }, - { name = "keyword.control.js"; - match = "\\b(break|case|catch|continue|default|do|else|finally|for|goto|if|import|package|return|switch|throw|try|while)\\b"; - }, - { name = "keyword.operator.js"; - match = "\\b(delete|in|instanceof|new|typeof|with)\\b"; - }, - { name = "constant.language.js"; - match = "\\b(false|null|super|this|true)\\b"; - }, - { name = "keyword.other.js"; - match = "\\b(debugger)\\b"; - }, - - /* OBJECTS:: */ - { name = "support.class.js"; - /* CASE Sensitive Objects */ - match = "\\b(Anchor|Applet|Area|Array|Boolean|Button|Checkbox|Date|document|event|FileUpload|Form|Frame|Function|Hidden|History|Image|JavaArray|JavaClass|JavaObject|JavaPackage|java|Layer|Link|Location|Math|MimeType|Number|navigator|netscape|Object|Option|Packages|Password|Plugin|Radio|RegExp|Reset|Select|String|Style|Submit|screen|sun|Text|Textarea|window|XMLHttpRequest)\\b"; - }, - - /* OBJECTS:: Methods */ - { name = "support.function.js"; - match = "\\b(abort|abs|acos|alert|anchor|apply|asin|atan|atan2|atob|attachEvent|back|big|blink|blur|bold|borderWidths|btoa|call|captureEvents|ceil|charAt|charCodeAt|clear|clearInterval|clearTimeout|click|close|compile|concat|confirm|contextual|cos|createElement|createEventObject|createPopup|createStyleSheet|createTextNode|detachEvent|disableExternalCapture|dump|elementFromPoint|enableExternalCapture|escape|eval|exec|execCommand|execScript|exp|fileCreatedDate|fileModifiedDate|fileSize|fileUpdatedDate|find|firstChild|fixed|floor|focus|fontcolor|fontsize|fromCharCode|forward|getAllResponseHeaders|getAttention|getDate|getDay|getElementById|getElementsByName|getElementsByTagName|getFullYear|getHours|getMilliseconds|getMinutes|getMonth|getResponseHeader|getSeconds|getSelection|getTime|getTimezoneOffset|getUTCDate|getUTCDay|getUTCFullYear|getUTCHours|getUTCMilliseconds|getUTCMinutes|getUTCMonth|getUTCSeconds|getYear|go|handleEvent|home|indexOf|isFinite|isNaN|italics|javaEnabled|join|lastIndexOf|link|load|log|margins|match|max|mergeAttributes|min|moveAbove|moveBelow|moveBy|moveTo|moveToAbsolute|navigate|open|paddings|parse|parseFloat|parseInt|plugins.refresh|pop|pow|preference|print|prompt|push|queryCommandEnabled|queryCommandIndeterm|queryCommandState|queryCommandValue|random|recalc|releaseCapture|releaseEvents|reload|replace|reset|resizeBy|resizeTo|returnValue|reverse|round|routeEvents|savePreferences|scroll|scrollBy|scrollByLines|scrollByPages|scrollTo|scrollX|scrollY|search|select|send|setDate|setFullYear|setActive|setCursor|setHotKeys|setHours|setInterval|setMilliseconds|setMinutes|setMonth|setResizable|setRequestHeader|setSeconds|setTime|setTimeout|setUTCDate|setUTCFullYear|setUTCHours|setUTCMilliseconds|setUTCMinutes|setUTCMonth|setUTCSeconds|setYear|setZOptions|shift|showHelp|showModalDialog|showModelessDialog|sidebar|sin|signText|sizeToContent|slice|small|sort|splice|split|sqrt|strike|stop|sub|submit|substr|substring|sup|taint|taintEnabled|tan|test|toGMTString|toLocaleString|toLowerCase|toSource|toString|toUpperCase|toUTCString|UTC|unescape|unshift|untaint|updateCommands|unwatch|valueOf|watch|write|writeln)\\b(?=\\()"; - }, - - /* OBJECTS:: Properties */ - { match = "\\.\\b(_content|above|action|align|aLinkcolor|all|anchors|appCodeName|appCore|appMinorVersion|appName|applets|appVersion|arguments|arguments.callee|arguments.caller|arguments.length|arity|attributes|availHeight|availLeft|availTop|availWidth|background|backgroundColor|backgroundImage|below|bgColor|body|border|borderBottomWidth|borderColor|borderLeftWidth|borderRightWidth|borderStyle|borderTopWidth|bottom|bufferDepth|characterSet|checked|childNodes|classes|className|clientInformation|clip|clipboardData|closed|colorDepth|complete|components|constructor|controllers|cookie|cookieEnabled|cpuClass|crypto|current|data|defaultCharset|defaultChecked|defaultStatus|defaultValue|defaultView|description|dialogArguments|dialogHeight|dialogLeft|dialogTop|dialogWidth|dir|directories|display|doctype|documentElement|domain|E|elements|embeds|enabledPlugin|encoding|expando|external|fgColor|filename|fontFamily|fontSize|fontWeight|form|formName|forms|frameElement|frames|global|hasFocus|hash|height|history|host|hostname|href|hspace|ids|ignoreCase|images|implementation|input|innerHeight|innerWidth|index|LN10|LN2|LOG10E|LOG2E|language|lastChild|lastIndex|lastMatch|lastModified|lastParen|layers|layerX|left|leftContext|length|lineHeight|linkColor|links|listStyleType|localName|location|locationbar|lowsrc|MAX_VALUE|MIN_VALUE|marginBottom|marginLeft|marginRight|marginTop|media|method|menubar|mimeTypes|multiline|NEGATIVE_INFINITY|name|nameProp|namespaces|namespaceURI|next|nextSibling|nodeName|nodeType|nodeValue|offscreenBuffering|onLine|onreadystatechange|opener|opsProfile|oscpu|options|outerHeight|outerWidth|ownerDocument|POSITIVE_INFINITY|PI|paddingBottom|paddingLeft|paddingRight|paddingTop|pageX|pageY|pageXOffset|pageYOffset|parent|parentLayer|parentNode|parentWindow|pathname|personalbar|pixelDepth|platform|plugins|pkcs11|port|prefix|previous|previousSibling|product|productSub|prompter|protocol|prototype|readyState|referrer|responseText|responseXML|right|rightContext|SQRT1_2|SQRT2|screenLeft|screenTop|screenX|screenY|scripts|scrollbars|security|securityPolicy|selected|selection|selectedIndex|self|siblingAbove|siblingBelow|src|source|status|statusbar|statusText|styleSheets|suffixes|systemLanguage|tags|target|text|textAlign|textDecoration|textIndent|textTransform|title|toolbar|top|type|URL|URLUnencoded|undefined|uniqueID|updateInterval|userAgent|userLanguage|userProfile|value|vendor|vendorSub|visibility|vLinkcolor|vspace|whiteSpace|width|XMLDocument|XSLDocument|x|y|zIndex)\\b"; - captures = { - 1 = { name = "support.constant.js"; }; - }; - }, - - /* OBJECTS:: Event Handlers:: */ - { name = "support.function.event-handler.js"; - match = "\\b(onAbort|onActivate|onAfterprint|onAfterupdate|onBeforeactivate|onBeforecut|onBeforedeactivate|onBeforeeditfocus|onBeforepaste|onBeforeprint|onBeforeunload|onBeforeupdate|onBlur|onCellchange|onChange|onClick|onClose|onContextmenu|onControlselect|onCut|onDataavailable|onDatasetchanged|onDatasetcomplete|onDblclick|onDeactivate|onDrag|onDragdrop|onDragend|onDragenter|onDragleave|onDragover|onDragstart|onDrop|onError|onErrorupdate|onFocus|onHelp|onKeydown|onKeypress|onKeyup|onLoad|onMousedown|onMousemove|onMouseout|onMouseover|onMouseup|onPaste|onPropertychange|onReadystatechange|onReset|onResize|onResizeend|onResizestart|onRowenter|onRowexit|onRowsdelete|onRowsinserted|onScroll|onSelect|onSelectionchange|onSelectstart|onStop|onSubmit|onUnload)\\b"; - }, - - /* OPERATORS:: */ - { name = "keyword.operator.js"; - match = "!|\\$|%|&|\\*|\\+|\\-|\\-\\-|\\+\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|/=|%=|\\+=|\\-=|&=|\\^=|\\b(in|instanceof|new|delete|typeof|void)\\b"; - }, - - /* CONSTANTS:: */ - { name = "constant.language.js"; - match = "\\b(Infinity|NaN|Undefined)\\b"; - }, - - /* STRINGS REGEX:: */ - { begin = "(([=(]|^)\\s*)(/)(?![*/])"; - end = "(/([igm]+)?)"; - beginCaptures = { - 1 = { name = "dummy.regexp-start"; }; - 3 = { name = "string.regexp.js"; }; - }; - endCaptures = { - 1 = { name = "string.regexp.js"; }; - }; - patterns = ( - { name = "string.regexp.js"; match = "[^/]*"; }, - { name = "string.regexp.js"; match = "\\\\/"; } - ); - }, - ); -} + + + + + comment + JavaScript Syntax: version 2.0 + fileTypes + + js + htc + + foldingStartMarker + ^\s*([A-Za-z0-9.]+s*=\s*)?(function)\b + foldingStopMarker + ^\s*\} + keyEquivalent + ~^J + name + JavaScript + patterns + + + captures + + 1 + + name + storage.type.function.js + + 2 + + name + entity.name.function.js + + 3 + + name + variable.parameter.function.js + + + match + ^\s*(function)\s*([a-zA-Z_]\w*)\s*\(([^)]*)\) + name + meta.function.js + + + match + \b((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?))\b + name + constant.numeric.js + + + begin + ' + end + ' + name + string.quoted.single.js + swallow + \\. + + + begin + " + end + " + name + string.quoted.double.js + swallow + \\. + + + begin + /\* + end + \*/ + name + comment.block.js + swallow + \\. + + + match + //.* + name + comment.line.double-slash.js + + + match + (<!--|-->) + name + comment.block.html.js + + + match + \b(boolean|byte|char|class|double|enum|float|function|int|interface|long|short|var|void)\b + name + storage.type.js + + + match + \b(const|export|extends|final|implements|native|private|protected|public|static|synchronized|throws|transient|volatile)\b + name + storage.modifier.js + + + match + \b(break|case|catch|continue|default|do|else|finally|for|goto|if|import|package|return|switch|throw|try|while)\b + name + keyword.control.js + + + match + \b(delete|in|instanceof|new|typeof|with)\b + name + keyword.operator.js + + + match + \b(false|null|super|this|true)\b + name + constant.language.js + + + match + \b(debugger)\b + name + keyword.other.js + + + match + \b(Anchor|Applet|Area|Array|Boolean|Button|Checkbox|Date|document|event|FileUpload|Form|Frame|Function|Hidden|History|Image|JavaArray|JavaClass|JavaObject|JavaPackage|java|Layer|Link|Location|Math|MimeType|Number|navigator|netscape|Object|Option|Packages|Password|Plugin|Radio|RegExp|Reset|Select|String|Style|Submit|screen|sun|Text|Textarea|window|XMLHttpRequest)\b + name + support.class.js + + + match + \b(abort|abs|acos|alert|anchor|apply|asin|atan|atan2|atob|attachEvent|back|big|blink|blur|bold|borderWidths|btoa|call|captureEvents|ceil|charAt|charCodeAt|clear|clearInterval|clearTimeout|click|close|compile|concat|confirm|contextual|cos|createElement|createEventObject|createPopup|createStyleSheet|createTextNode|detachEvent|disableExternalCapture|dump|elementFromPoint|enableExternalCapture|escape|eval|exec|execCommand|execScript|exp|fileCreatedDate|fileModifiedDate|fileSize|fileUpdatedDate|find|firstChild|fixed|floor|focus|fontcolor|fontsize|fromCharCode|forward|getAllResponseHeaders|getAttention|getDate|getDay|getElementById|getElementsByName|getElementsByTagName|getFullYear|getHours|getMilliseconds|getMinutes|getMonth|getResponseHeader|getSeconds|getSelection|getTime|getTimezoneOffset|getUTCDate|getUTCDay|getUTCFullYear|getUTCHours|getUTCMilliseconds|getUTCMinutes|getUTCMonth|getUTCSeconds|getYear|go|handleEvent|home|indexOf|isFinite|isNaN|italics|javaEnabled|join|lastIndexOf|link|load|log|margins|match|max|mergeAttributes|min|moveAbove|moveBelow|moveBy|moveTo|moveToAbsolute|navigate|open|paddings|parse|parseFloat|parseInt|plugins.refresh|pop|pow|preference|print|prompt|push|queryCommandEnabled|queryCommandIndeterm|queryCommandState|queryCommandValue|random|recalc|releaseCapture|releaseEvents|reload|replace|reset|resizeBy|resizeTo|returnValue|reverse|round|routeEvents|savePreferences|scroll|scrollBy|scrollByLines|scrollByPages|scrollTo|scrollX|scrollY|search|select|send|setDate|setFullYear|setActive|setCursor|setHotKeys|setHours|setInterval|setMilliseconds|setMinutes|setMonth|setResizable|setRequestHeader|setSeconds|setTime|setTimeout|setUTCDate|setUTCFullYear|setUTCHours|setUTCMilliseconds|setUTCMinutes|setUTCMonth|setUTCSeconds|setYear|setZOptions|shift|showHelp|showModalDialog|showModelessDialog|sidebar|sin|signText|sizeToContent|slice|small|sort|splice|split|sqrt|strike|stop|sub|submit|substr|substring|sup|taint|taintEnabled|tan|test|toGMTString|toLocaleString|toLowerCase|toSource|toString|toUpperCase|toUTCString|UTC|unescape|unshift|untaint|updateCommands|unwatch|valueOf|watch|write|writeln)\b(?=\() + name + support.function.js + + + captures + + 1 + + name + support.constant.js + + + match + \.\b(_content|above|action|align|aLinkcolor|all|anchors|appCodeName|appCore|appMinorVersion|appName|applets|appVersion|arguments.callee|arguments.caller|arguments.length|arguments|arity|attributes|availHeight|availLeft|availTop|availWidth|backgroundColor|backgroundImage|background|below|bgColor|body|borderBottomWidth|borderColor|borderLeftWidth|borderRightWidth|borderStyle|borderTopWidth|border|bottom|bufferDepth|characterSet|checked|childNodes|classes|className|clientInformation|clipboardData|clip|closed|colorDepth|complete|components|constructor|controllers|cookieEnabled|cookie|cpuClass|crypto|current|data|defaultCharset|defaultChecked|defaultStatus|defaultValue|defaultView|description|dialogArguments|dialogHeight|dialogLeft|dialogTop|dialogWidth|directories|dir|display|doctype|documentElement|domain|E|elements|embeds|enabledPlugin|encoding|expando|external|fgColor|filename|fontFamily|fontSize|fontWeight|formName|forms|form|frameElement|frames|global|hasFocus|hash|height|history|hostname|host|href|hspace|ids|ignoreCase|images|implementation|input|innerHeight|innerWidth|index|LN10|LN2|LOG10E|LOG2E|language|lastChild|lastIndex|lastMatch|lastModified|lastParen|layers|layerX|leftContext|left|length|lineHeight|linkColor|links|listStyleType|localName|locationbar|location|lowsrc|MAX_VALUE|MIN_VALUE|marginBottom|marginLeft|marginRight|marginTop|media|method|menubar|mimeTypes|multiline|NEGATIVE_INFINITY|nameProp|namespaces|namespaceURI|name|nextSibling|next|nodeName|nodeType|nodeValue|offscreenBuffering|onLine|onreadystatechange|opener|opsProfile|oscpu|options|outerHeight|outerWidth|ownerDocument|POSITIVE_INFINITY|PI|paddingBottom|paddingLeft|paddingRight|paddingTop|pageXOffset|pageYOffset|pageX|pageY|parentLayer|parentNode|parentWindow|parent|pathname|personalbar|pixelDepth|platform|plugins|pkcs11|port|prefix|previousSibling|previous|productSub|product|prompter|protocol|prototype|readyState|referrer|responseText|responseXML|rightContext|right|SQRT1_2|SQRT2|screenLeft|screenTop|screenX|screenY|scripts|scrollbars|securityPolicy|security|selectedIndex|selected|selection|self|siblingAbove|siblingBelow|src|source|statusbar|statusText|status|styleSheets|suffixes|systemLanguage|tags|target|textAlign|textDecoration|textIndent|textTransform|text|title|toolbar|top|type|URLUnencoded|URL|undefined|uniqueID|updateInterval|userAgent|userLanguage|userProfile|value|vendorSub|vendor|visibility|vLinkcolor|vspace|whiteSpace|width|XMLDocument|XSLDocument|x|y|zIndex)\b + + + match + \b(onAbort|onActivate|onAfterprint|onAfterupdate|onBeforeactivate|onBeforecut|onBeforedeactivate|onBeforeeditfocus|onBeforepaste|onBeforeprint|onBeforeunload|onBeforeupdate|onBlur|onCellchange|onChange|onClick|onClose|onContextmenu|onControlselect|onCut|onDataavailable|onDatasetchanged|onDatasetcomplete|onDblclick|onDeactivate|onDrag|onDragdrop|onDragend|onDragenter|onDragleave|onDragover|onDragstart|onDrop|onError|onErrorupdate|onFocus|onHelp|onKeydown|onKeypress|onKeyup|onLoad|onMousedown|onMousemove|onMouseout|onMouseover|onMouseup|onPaste|onPropertychange|onReadystatechange|onReset|onResize|onResizeend|onResizestart|onRowenter|onRowexit|onRowsdelete|onRowsinserted|onScroll|onSelect|onSelectionchange|onSelectstart|onStop|onSubmit|onUnload)\b + name + support.function.event-handler.js + + + match + !|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|/=|%=|\+=|\-=|&=|\^=|\b(in|instanceof|new|delete|typeof|void)\b + name + keyword.operator.js + + + match + \b(Infinity|NaN|Undefined)\b + name + constant.language.js + + + begin + (([=(]|^)\s*)(/)(?![*/]) + beginCaptures + + 1 + + name + dummy.regexp-start + + 3 + + name + string.regexp.js + + + end + (/([igm]+)?) + endCaptures + + 1 + + name + string.regexp.js + + + patterns + + + match + [^/]* + name + string.regexp.js + + + match + \\/ + name + string.regexp.js + + + + + scopeName + source.js + uuid + 93E017CC-6F27-11D9-90EB-000D93589AF6 + + From 22fd97014e7988a1816a55716c3b35be87a300c5 Mon Sep 17 00:00:00 2001 From: duff Date: Tue, 2 Aug 2005 17:22:02 +0000 Subject: [PATCH 023/243] =?UTF-8?q?=E2=80=A2=C2=A0changed=20*=20to=20+=20i?= =?UTF-8?q?n=20regexp=20match=20to=20avoid=20zero-width=20matches?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@1407 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 0b3fcb5..5f77436 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -199,7 +199,7 @@ match - [^/]* + [^/]+ name string.regexp.js From 61e19ee6582608b6af8bcf5eca7b051ed4498ef2 Mon Sep 17 00:00:00 2001 From: duff Date: Tue, 13 Sep 2005 13:12:17 +0000 Subject: [PATCH 024/243] =?UTF-8?q?=E2=80=A2=20fixed=20function=20pattern?= =?UTF-8?q?=20(both=20in=20folding=20and=20meta.function)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@1786 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 5f77436..5226546 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -10,7 +10,7 @@ htc foldingStartMarker - ^\s*([A-Za-z0-9.]+s*=\s*)?(function)\b + ^\s*([A-Za-z0-9.]+\s*=\s*)?(function)\b foldingStopMarker ^\s*\} keyEquivalent @@ -39,7 +39,7 @@ match - ^\s*(function)\s*([a-zA-Z_]\w*)\s*\(([^)]*)\) + ^\s*(function)\s+([a-zA-Z_]\w*)\s*\(([^)]*)\) name meta.function.js From 2bb829e0817d071c02c95b09c8760f4c7a9d5a57 Mon Sep 17 00:00:00 2001 From: duff Date: Thu, 6 Oct 2005 08:34:44 +0000 Subject: [PATCH 025/243] =?UTF-8?q?=E2=80=A2=C2=A0new=20folding=20marker?= =?UTF-8?q?=20patterns=20(from=20Caio=20Chassot)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@1886 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 5226546..31044d1 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -10,7 +10,7 @@ htc foldingStartMarker - ^\s*([A-Za-z0-9.]+\s*=\s*)?(function)\b + ^.*\bfunction\s*(\w+\s*)?\([^\)]*\)(\s*\{[^\}]*)?\s*$ foldingStopMarker ^\s*\} keyEquivalent From 55bc1657aa1eb114c26891211590e51a36797d46 Mon Sep 17 00:00:00 2001 From: duff Date: Sun, 9 Oct 2005 14:26:32 +0000 Subject: [PATCH 026/243] =?UTF-8?q?=E2=80=A2=C2=A0use=20pattern=20for=20Ja?= =?UTF-8?q?vaScript=20functions=20from=20Gavin=20Kistner?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@1915 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 31044d1..80affc0 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -39,7 +39,7 @@ match - ^\s*(function)\s+([a-zA-Z_]\w*)\s*\(([^)]*)\) + \b(function)(\s+[a-zA-Z_]\w*)?\s*\((.*?)\) name meta.function.js From 8cc766b82982c8a0c01ef67802d03953316a4576 Mon Sep 17 00:00:00 2001 From: duff Date: Wed, 26 Oct 2005 15:23:36 +0000 Subject: [PATCH 027/243] =?UTF-8?q?=E2=80=A2=20updated=20JavaScript=20rege?= =?UTF-8?q?xp=20to=20use=20look-behind=20assertion=20and=20match=20escapes?= =?UTF-8?q?=20inside=20regexp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@2017 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 37 ++++++------------------------------- 1 file changed, 6 insertions(+), 31 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 80affc0..56a1523 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -171,43 +171,18 @@ begin - (([=(]|^)\s*)(/)(?![*/]) - beginCaptures - - 1 - - name - dummy.regexp-start - - 3 - - name - string.regexp.js - - + (?<=[=(]|^)\s*/(?![*+{}?]) end - (/([igm]+)?) - endCaptures - - 1 - - name - string.regexp.js - - + /[igm]* + name + string.regexp.js patterns match - [^/]+ - name - string.regexp.js - - - match - \\/ + \\. name - string.regexp.js + constant.character.escape.js From 7644a06f2f72cf86063f8e623a9040a812f7deb6 Mon Sep 17 00:00:00 2001 From: duff Date: Fri, 28 Oct 2005 18:07:42 +0000 Subject: [PATCH 028/243] =?UTF-8?q?=E2=80=A2=20fix=20regexp=20rule=20to=20?= =?UTF-8?q?not=20match=20the=20//=20part=20of=20comments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@2033 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 56a1523..14a66ac 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -81,7 +81,7 @@ match - //.* + //.*$ name comment.line.double-slash.js @@ -171,7 +171,7 @@ begin - (?<=[=(]|^)\s*/(?![*+{}?]) + (?<=[=(]|^)\s*/(?![/*+{}?]) end /[igm]* name From 3afecd1a354c8f4510738d9e10ce69288d13b945 Mon Sep 17 00:00:00 2001 From: duff Date: Sun, 13 Nov 2005 14:13:20 +0000 Subject: [PATCH 029/243] =?UTF-8?q?=E2=80=A2=20do=20not=20markup=20leading?= =?UTF-8?q?=20spaces=20as=20entity.name.function?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@2137 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 14a66ac..c88c158 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -39,7 +39,7 @@ match - \b(function)(\s+[a-zA-Z_]\w*)?\s*\((.*?)\) + \b(function)\s+([a-zA-Z_]\w*)?\s*\((.*?)\) name meta.function.js From aad1c3e5ed3ea7f642850834f44031cb1ebe4b54 Mon Sep 17 00:00:00 2001 From: duff Date: Thu, 17 Nov 2005 14:34:20 +0000 Subject: [PATCH 030/243] =?UTF-8?q?=E2=80=A2=20add=20rule=20to=20markup=20?= =?UTF-8?q?=C2=ABsomething=C2=BB=20=3D=20function=20(=E2=80=A6)=20as=20fun?= =?UTF-8?q?ctions=20(from=20Tony=20Arnold)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@2172 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index c88c158..9dc1f85 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -43,6 +43,32 @@ name meta.function.js + + captures + + 1 + + name + entity.name.function.js + + 2 + + name + storage.type.function.js + + 3 + + name + variable.parameter.function.js + + + comment + match stuff like: Sound.prototype.play = function() { … } + match + \b([a-zA-Z_?\.]+\w*)\s+=\s+\b(function)?\s*\((.*?)\) + name + meta.function.js + match \b((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?))\b From a120f904cb1d7ff66ab54ae304cb86f285174c26 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 17 Nov 2005 19:16:58 +0000 Subject: [PATCH 031/243] Add $ as a possible character to start a function name with I don't know what is actually legal, google tells me word and underscore, but $ is obviously legal as I have code here that has methods starting with it. git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@2173 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 9dc1f85..50108a3 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -39,7 +39,7 @@ match - \b(function)\s+([a-zA-Z_]\w*)?\s*\((.*?)\) + \b(function)\s+([a-zA-Z_$]\w*)?\s*\((.*?)\) name meta.function.js @@ -65,7 +65,7 @@ comment match stuff like: Sound.prototype.play = 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 From 6bfebbed4c956d238246eef62bec93f8d53c4a1a Mon Sep 17 00:00:00 2001 From: cskiadas Date: Tue, 13 Dec 2005 16:52:15 +0000 Subject: [PATCH 032/243] Updating the list of dom methods, attributes and constants supported. Work in progress git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@2438 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 50108a3..ea9ceab 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -161,10 +161,16 @@ match - \b(abort|abs|acos|alert|anchor|apply|asin|atan|atan2|atob|attachEvent|back|big|blink|blur|bold|borderWidths|btoa|call|captureEvents|ceil|charAt|charCodeAt|clear|clearInterval|clearTimeout|click|close|compile|concat|confirm|contextual|cos|createElement|createEventObject|createPopup|createStyleSheet|createTextNode|detachEvent|disableExternalCapture|dump|elementFromPoint|enableExternalCapture|escape|eval|exec|execCommand|execScript|exp|fileCreatedDate|fileModifiedDate|fileSize|fileUpdatedDate|find|firstChild|fixed|floor|focus|fontcolor|fontsize|fromCharCode|forward|getAllResponseHeaders|getAttention|getDate|getDay|getElementById|getElementsByName|getElementsByTagName|getFullYear|getHours|getMilliseconds|getMinutes|getMonth|getResponseHeader|getSeconds|getSelection|getTime|getTimezoneOffset|getUTCDate|getUTCDay|getUTCFullYear|getUTCHours|getUTCMilliseconds|getUTCMinutes|getUTCMonth|getUTCSeconds|getYear|go|handleEvent|home|indexOf|isFinite|isNaN|italics|javaEnabled|join|lastIndexOf|link|load|log|margins|match|max|mergeAttributes|min|moveAbove|moveBelow|moveBy|moveTo|moveToAbsolute|navigate|open|paddings|parse|parseFloat|parseInt|plugins.refresh|pop|pow|preference|print|prompt|push|queryCommandEnabled|queryCommandIndeterm|queryCommandState|queryCommandValue|random|recalc|releaseCapture|releaseEvents|reload|replace|reset|resizeBy|resizeTo|returnValue|reverse|round|routeEvents|savePreferences|scroll|scrollBy|scrollByLines|scrollByPages|scrollTo|scrollX|scrollY|search|select|send|setDate|setFullYear|setActive|setCursor|setHotKeys|setHours|setInterval|setMilliseconds|setMinutes|setMonth|setResizable|setRequestHeader|setSeconds|setTime|setTimeout|setUTCDate|setUTCFullYear|setUTCHours|setUTCMilliseconds|setUTCMinutes|setUTCMonth|setUTCSeconds|setYear|setZOptions|shift|showHelp|showModalDialog|showModelessDialog|sidebar|sin|signText|sizeToContent|slice|small|sort|splice|split|sqrt|strike|stop|sub|submit|substr|substring|sup|taint|taintEnabled|tan|test|toGMTString|toLocaleString|toLowerCase|toSource|toString|toUpperCase|toUTCString|UTC|unescape|unshift|untaint|updateCommands|unwatch|valueOf|watch|write|writeln)\b(?=\() + \b(abort|abs|acos|alert|anchor|apply|asin|atan|atan2|atob|attachEvent|back|big|blink|blur|bold|borderWidths|btoa|call|captureEvents|ceil|charAt|charCodeAt|clear|clearInterval|clearTimeout|click|close|compile|concat|confirm|contextual|cos|createEventObject|createPopup|createStyleSheet|detachEvent|disableExternalCapture|dump|elementFromPoint|enableExternalCapture|escape|eval|exec|execCommand|execScript|exp|fileCreatedDate|fileModifiedDate|fileSize|fileUpdatedDate|find|fixed|floor|focus|fontcolor|fontsize|fromCharCode|forward|getAllResponseHeaders|getAttention|getDate|getDay|getFullYear|getHours|getMilliseconds|getMinutes|getMonth|getResponseHeader|getSeconds|getSelection|getTime|getTimezoneOffset|getUTCDate|getUTCDay|getUTCFullYear|getUTCHours|getUTCMilliseconds|getUTCMinutes|getUTCMonth|getUTCSeconds|getYear|go|handleEvent|home|indexOf|isFinite|isNaN|italics|javaEnabled|join|lastIndexOf|link|load|log|margins|match|max|mergeAttributes|min|moveAbove|moveBelow|moveBy|moveTo|moveToAbsolute|navigate|open|paddings|parse|parseFloat|parseInt|plugins.refresh|pop|pow|preference|print|prompt|push|queryCommandEnabled|queryCommandIndeterm|queryCommandState|queryCommandValue|random|recalc|releaseCapture|releaseEvents|reload|replace|reset|resizeBy|resizeTo|returnValue|reverse|round|routeEvents|savePreferences|scroll|scrollBy|scrollByLines|scrollByPages|scrollTo|scrollX|scrollY|search|select|send|setAttribute|setDate|setFullYear|setActive|setCursor|setHotKeys|setHours|setInterval|setMilliseconds|setMinutes|setMonth|setResizable|setRequestHeader|setSeconds|setTime|setTimeout|setUTCDate|setUTCFullYear|setUTCHours|setUTCMilliseconds|setUTCMinutes|setUTCMonth|setUTCSeconds|setYear|setZOptions|shift|showHelp|showModalDialog|showModelessDialog|sidebar|sin|signText|sizeToContent|slice|small|sort|splice|split|splitText|sqrt|strike|stop|sub|submit|substr|substring|sup|taint|taintEnabled|tan|test|toGMTString|toLocaleString|toLowerCase|toSource|toString|toUpperCase|toUTCString|UTC|unescape|unshift|untaint|updateCommands|unwatch|valueOf|watch|write|writeln)\b(?=\() name support.function.js + + match + \b(appendChild|cloneNode|createAttribute|createCDATASection|createComment|createDocumentFragment|createElement|createEntityReference|createTextNode|createProcessingInstruction|getElementById|getElementsByName|getElementsByTagName|insertBefore|item|hasChildNodes|hasFeature|removeChild|replaceChild)\b(?=\() + name + support.function.dom.js + captures @@ -175,7 +181,25 @@ match - \.\b(_content|above|action|align|aLinkcolor|all|anchors|appCodeName|appCore|appMinorVersion|appName|applets|appVersion|arguments.callee|arguments.caller|arguments.length|arguments|arity|attributes|availHeight|availLeft|availTop|availWidth|backgroundColor|backgroundImage|background|below|bgColor|body|borderBottomWidth|borderColor|borderLeftWidth|borderRightWidth|borderStyle|borderTopWidth|border|bottom|bufferDepth|characterSet|checked|childNodes|classes|className|clientInformation|clipboardData|clip|closed|colorDepth|complete|components|constructor|controllers|cookieEnabled|cookie|cpuClass|crypto|current|data|defaultCharset|defaultChecked|defaultStatus|defaultValue|defaultView|description|dialogArguments|dialogHeight|dialogLeft|dialogTop|dialogWidth|directories|dir|display|doctype|documentElement|domain|E|elements|embeds|enabledPlugin|encoding|expando|external|fgColor|filename|fontFamily|fontSize|fontWeight|formName|forms|form|frameElement|frames|global|hasFocus|hash|height|history|hostname|host|href|hspace|ids|ignoreCase|images|implementation|input|innerHeight|innerWidth|index|LN10|LN2|LOG10E|LOG2E|language|lastChild|lastIndex|lastMatch|lastModified|lastParen|layers|layerX|leftContext|left|length|lineHeight|linkColor|links|listStyleType|localName|locationbar|location|lowsrc|MAX_VALUE|MIN_VALUE|marginBottom|marginLeft|marginRight|marginTop|media|method|menubar|mimeTypes|multiline|NEGATIVE_INFINITY|nameProp|namespaces|namespaceURI|name|nextSibling|next|nodeName|nodeType|nodeValue|offscreenBuffering|onLine|onreadystatechange|opener|opsProfile|oscpu|options|outerHeight|outerWidth|ownerDocument|POSITIVE_INFINITY|PI|paddingBottom|paddingLeft|paddingRight|paddingTop|pageXOffset|pageYOffset|pageX|pageY|parentLayer|parentNode|parentWindow|parent|pathname|personalbar|pixelDepth|platform|plugins|pkcs11|port|prefix|previousSibling|previous|productSub|product|prompter|protocol|prototype|readyState|referrer|responseText|responseXML|rightContext|right|SQRT1_2|SQRT2|screenLeft|screenTop|screenX|screenY|scripts|scrollbars|securityPolicy|security|selectedIndex|selected|selection|self|siblingAbove|siblingBelow|src|source|statusbar|statusText|status|styleSheets|suffixes|systemLanguage|tags|target|textAlign|textDecoration|textIndent|textTransform|text|title|toolbar|top|type|URLUnencoded|URL|undefined|uniqueID|updateInterval|userAgent|userLanguage|userProfile|value|vendorSub|vendor|visibility|vLinkcolor|vspace|whiteSpace|width|XMLDocument|XSLDocument|x|y|zIndex)\b + \.\b(_content|above|action|align|aLinkcolor|all|anchors|appCodeName|appCore|appMinorVersion|appName|applets|appVersion|arguments|arity|availHeight|availLeft|availTop|availWidth|backgroundColor|backgroundImage|background|below|bgColor|body|borderBottomWidth|borderColor|borderLeftWidth|borderRightWidth|borderStyle|borderTopWidth|border|bottom|bufferDepth|callee|caller|characterSet|checked|classes|className|clientInformation|clipboardData|clip|closed|colorDepth|complete|components|constructor|controllers|cookieEnabled|cookie|cpuClass|crypto|current|data|defaultCharset|defaultChecked|defaultStatus|defaultValue|defaultView|description|dialogArguments|dialogHeight|dialogLeft|dialogTop|dialogWidth|directories|dir|display|domain|E|elements|embeds|enabledPlugin|encoding|expando|external|fgColor|filename|fontFamily|fontSize|fontWeight|formName|forms|form|frameElement|frames|global|hasFocus|hash|height|history|hostname|host|href|hspace|ids|ignoreCase|images|input|innerHeight|innerWidth|index|LN10|LN2|LOG10E|LOG2E|language|lastIndex|lastMatch|lastModified|lastParen|layers|layerX|leftContext|left|length|lineHeight|linkColor|links|listStyleType|localName|locationbar|location|lowsrc|MAX_VALUE|MIN_VALUE|marginBottom|marginLeft|marginRight|marginTop|media|method|menubar|mimeTypes|multiline|NEGATIVE_INFINITY|nameProp|namespaces|namespaceURI|name|next|offscreenBuffering|onLine|onreadystatechange|opener|opsProfile|oscpu|options|outerHeight|outerWidth|POSITIVE_INFINITY|PI|paddingBottom|paddingLeft|paddingRight|paddingTop|pageXOffset|pageYOffset|pageX|pageY|parentLayer|parentWindow|parent|pathname|personalbar|pixelDepth|platform|plugins|pkcs11|port|prefix|previous|productSub|product|prompter|protocol|prototype|readyState|referrer|responseText|responseXML|rightContext|right|SQRT1_2|SQRT2|screenLeft|screenTop|screenX|screenY|scripts|scrollbars|securityPolicy|security|selectedIndex|selected|selection|self|siblingAbove|siblingBelow|src|source|statusbar|statusText|status|style|styleSheets|suffixes|systemLanguage|tagName|tags|target|textAlign|textDecoration|textIndent|textTransform|text|title|toolbar|top|type|URLUnencoded|URL|undefined|uniqueID|updateInterval|userAgent|userLanguage|userProfile|value|vendorSub|vendor|visibility|vLinkcolor|vspace|whiteSpace|width|XMLDocument|XSLDocument|x|y|zIndex)\b + + + captures + + 1 + + name + support.constant.dom.js + + + match + \.\b(attributes|childNodes|doctype|documentElement|firstChild|implementation|lastChild|nextSibling|nodeName|nodeType|nodeValue|ownerDocument|parentNode|previousSibling)\b + + + match + \b(ELEMENT_NODE|ATTRIBUTE_NODE|TEXT_NODE|CDATA_SECTION_NODE|ENTITY_REFERENCE_NODE|ENTITY_NODE|PROCESSING_INSTRUCTION_NODE|COMMENT_NODE|DOCUMENT_NODE|DOCUMENT_TYPE_NODE|DOCUMENT_FRAGMENT_NODE|NOTATION_NODE|INDEX_SIZE_ERR|DOMSTRING_SIZE_ERR|HIERARCHY_REQUEST_ERR|WRONG_DOCUMENT_ERR|INVALID_CHARACTER_ERR|NO_DATA_ALLOWED_ERR|NO_MODIFICATION_ALLOWED_ERR|NOT_FOUND_ERR|NOT_SUPPORTED_ERR|INUSE_ATTRIBUTE_ERR)\b + name + support.constant.dom.js match From edda9e4917e9f5db6a10100108cad42a4c6c0f76 Mon Sep 17 00:00:00 2001 From: kevin Date: Wed, 14 Dec 2005 00:36:31 +0000 Subject: [PATCH 033/243] Commit patch by h0h from #textmate support.function.event-handler.js names are all lowercased, as required by XHTML Regexps are now matched more liberally git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@2446 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index ea9ceab..4756965 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -203,7 +203,7 @@ match - \b(onAbort|onActivate|onAfterprint|onAfterupdate|onBeforeactivate|onBeforecut|onBeforedeactivate|onBeforeeditfocus|onBeforepaste|onBeforeprint|onBeforeunload|onBeforeupdate|onBlur|onCellchange|onChange|onClick|onClose|onContextmenu|onControlselect|onCut|onDataavailable|onDatasetchanged|onDatasetcomplete|onDblclick|onDeactivate|onDrag|onDragdrop|onDragend|onDragenter|onDragleave|onDragover|onDragstart|onDrop|onError|onErrorupdate|onFocus|onHelp|onKeydown|onKeypress|onKeyup|onLoad|onMousedown|onMousemove|onMouseout|onMouseover|onMouseup|onPaste|onPropertychange|onReadystatechange|onReset|onResize|onResizeend|onResizestart|onRowenter|onRowexit|onRowsdelete|onRowsinserted|onScroll|onSelect|onSelectionchange|onSelectstart|onStop|onSubmit|onUnload)\b + \b(onabort|onactivate|onafterprint|onafterupdate|onbeforeactivate|onbeforecut|onbeforedeactivate|onbeforeeditfocus|onbeforepaste|onbeforeprint|onbeforeunload|onbeforeupdate|onblur|oncellchange|onchange|onclick|onclose|oncontextmenu|oncontrolselect|oncut|ondataavailable|ondatasetchanged|ondatasetcomplete|ondblclick|ondeactivate|ondrag|ondragdrop|ondragend|ondragenter|ondragleave|ondragover|ondragstart|ondrop|onerror|onerrorupdate|onfocus|onhelp|onkeydown|onkeypress|onkeyup|onload|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onpaste|onpropertychange|onreadystatechange|onreset|onresize|onresizeend|onresizestart|onrowenter|onrowexit|onrowsdelete|onrowsinserted|onscroll|onselect|onselectionchange|onselectstart|onstop|onsubmit|onunload)\b name support.function.event-handler.js @@ -221,7 +221,7 @@ begin - (?<=[=(]|^)\s*/(?![/*+{}?]) + (?<=^|[(=&|!+<~>^*%,:?-]|\btypeof|void|/\s)\s*/(?![/*+{}?]) end /[igm]* name From 077f0e465cff90b420f37cae8c97d732e09f54db Mon Sep 17 00:00:00 2001 From: cskiadas Date: Wed, 14 Dec 2005 06:36:11 +0000 Subject: [PATCH 034/243] More updating of dom dictionary. git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@2447 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 4756965..baebe93 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -161,13 +161,13 @@ match - \b(abort|abs|acos|alert|anchor|apply|asin|atan|atan2|atob|attachEvent|back|big|blink|blur|bold|borderWidths|btoa|call|captureEvents|ceil|charAt|charCodeAt|clear|clearInterval|clearTimeout|click|close|compile|concat|confirm|contextual|cos|createEventObject|createPopup|createStyleSheet|detachEvent|disableExternalCapture|dump|elementFromPoint|enableExternalCapture|escape|eval|exec|execCommand|execScript|exp|fileCreatedDate|fileModifiedDate|fileSize|fileUpdatedDate|find|fixed|floor|focus|fontcolor|fontsize|fromCharCode|forward|getAllResponseHeaders|getAttention|getDate|getDay|getFullYear|getHours|getMilliseconds|getMinutes|getMonth|getResponseHeader|getSeconds|getSelection|getTime|getTimezoneOffset|getUTCDate|getUTCDay|getUTCFullYear|getUTCHours|getUTCMilliseconds|getUTCMinutes|getUTCMonth|getUTCSeconds|getYear|go|handleEvent|home|indexOf|isFinite|isNaN|italics|javaEnabled|join|lastIndexOf|link|load|log|margins|match|max|mergeAttributes|min|moveAbove|moveBelow|moveBy|moveTo|moveToAbsolute|navigate|open|paddings|parse|parseFloat|parseInt|plugins.refresh|pop|pow|preference|print|prompt|push|queryCommandEnabled|queryCommandIndeterm|queryCommandState|queryCommandValue|random|recalc|releaseCapture|releaseEvents|reload|replace|reset|resizeBy|resizeTo|returnValue|reverse|round|routeEvents|savePreferences|scroll|scrollBy|scrollByLines|scrollByPages|scrollTo|scrollX|scrollY|search|select|send|setAttribute|setDate|setFullYear|setActive|setCursor|setHotKeys|setHours|setInterval|setMilliseconds|setMinutes|setMonth|setResizable|setRequestHeader|setSeconds|setTime|setTimeout|setUTCDate|setUTCFullYear|setUTCHours|setUTCMilliseconds|setUTCMinutes|setUTCMonth|setUTCSeconds|setYear|setZOptions|shift|showHelp|showModalDialog|showModelessDialog|sidebar|sin|signText|sizeToContent|slice|small|sort|splice|split|splitText|sqrt|strike|stop|sub|submit|substr|substring|sup|taint|taintEnabled|tan|test|toGMTString|toLocaleString|toLowerCase|toSource|toString|toUpperCase|toUTCString|UTC|unescape|unshift|untaint|updateCommands|unwatch|valueOf|watch|write|writeln)\b(?=\() + \b(abort|abs|acos|alert|anchor|apply|asin|atan|atan2|atob|attachEvent|back|big|blink|blur|bold|borderWidths|btoa|call|captureEvents|ceil|charAt|charCodeAt|clear|clearInterval|clearTimeout|click|compile|concat|confirm|contextual|cos|createEventObject|createPopup|createStyleSheet|detachEvent|disableExternalCapture|dump|elementFromPoint|enableExternalCapture|escape|eval|exec|execCommand|execScript|exp|fileCreatedDate|fileModifiedDate|fileSize|fileUpdatedDate|find|fixed|floor|focus|fontcolor|fontsize|fromCharCode|forward|getAllResponseHeaders|getAttention|getDate|getDay|getFullYear|getHours|getMilliseconds|getMinutes|getMonth|getResponseHeader|getSeconds|getSelection|getTime|getTimezoneOffset|getUTCDate|getUTCDay|getUTCFullYear|getUTCHours|getUTCMilliseconds|getUTCMinutes|getUTCMonth|getUTCSeconds|getYear|go|handleEvent|home|indexOf|isFinite|isNaN|italics|javaEnabled|join|lastIndexOf|link|load|log|margins|match|max|mergeAttributes|min|moveAbove|moveBelow|moveBy|moveTo|moveToAbsolute|navigate|paddings|parse|parseFloat|parseInt|plugins.refresh|pop|pow|preference|print|prompt|push|queryCommandEnabled|queryCommandIndeterm|queryCommandState|queryCommandValue|random|recalc|releaseCapture|releaseEvents|reload|replace|reset|resizeBy|resizeTo|returnValue|reverse|round|routeEvents|savePreferences|scroll|scrollBy|scrollByLines|scrollByPages|scrollTo|scrollX|scrollY|search|select|send|setDate|setFullYear|setActive|setCursor|setHotKeys|setHours|setInterval|setMilliseconds|setMinutes|setMonth|setResizable|setRequestHeader|setSeconds|setTime|setTimeout|setUTCDate|setUTCFullYear|setUTCHours|setUTCMilliseconds|setUTCMinutes|setUTCMonth|setUTCSeconds|setYear|setZOptions|shift|showHelp|showModalDialog|showModelessDialog|sidebar|sin|signText|sizeToContent|slice|small|sort|splice|split|sqrt|strike|stop|sub|submit|substr|substring|sup|taint|taintEnabled|tan|test|toGMTString|toLocaleString|toLowerCase|toSource|toString|toUpperCase|toUTCString|UTC|unescape|unshift|untaint|updateCommands|unwatch|valueOf|watch)\b(?=\() name support.function.js match - \b(appendChild|cloneNode|createAttribute|createCDATASection|createComment|createDocumentFragment|createElement|createEntityReference|createTextNode|createProcessingInstruction|getElementById|getElementsByName|getElementsByTagName|insertBefore|item|hasChildNodes|hasFeature|removeChild|replaceChild)\b(?=\() + \b(appendChild|appendData|cloneNode|close|createAttribute|createCDATASection|createComment|createDocumentFragment|createElement|createEntityReference|createTextNode|createProcessingInstruction|deleteData|getElementById|getElementsByName|getElementsByTagName|getAttributeNode|getAttribute|getNamedItem|insertBefore|insertData|item|hasChildNodes|hasFeature|namedItem|open|removeAttributeNode|removeAttribute|removeChild|removeNamedItem|replaceChild|replaceData|setAttributeNode|setAttribute|setNamedItem|splitText|substringData|write|writeln)\b(?=\() name support.function.dom.js @@ -181,7 +181,7 @@ match - \.\b(_content|above|action|align|aLinkcolor|all|anchors|appCodeName|appCore|appMinorVersion|appName|applets|appVersion|arguments|arity|availHeight|availLeft|availTop|availWidth|backgroundColor|backgroundImage|background|below|bgColor|body|borderBottomWidth|borderColor|borderLeftWidth|borderRightWidth|borderStyle|borderTopWidth|border|bottom|bufferDepth|callee|caller|characterSet|checked|classes|className|clientInformation|clipboardData|clip|closed|colorDepth|complete|components|constructor|controllers|cookieEnabled|cookie|cpuClass|crypto|current|data|defaultCharset|defaultChecked|defaultStatus|defaultValue|defaultView|description|dialogArguments|dialogHeight|dialogLeft|dialogTop|dialogWidth|directories|dir|display|domain|E|elements|embeds|enabledPlugin|encoding|expando|external|fgColor|filename|fontFamily|fontSize|fontWeight|formName|forms|form|frameElement|frames|global|hasFocus|hash|height|history|hostname|host|href|hspace|ids|ignoreCase|images|input|innerHeight|innerWidth|index|LN10|LN2|LOG10E|LOG2E|language|lastIndex|lastMatch|lastModified|lastParen|layers|layerX|leftContext|left|length|lineHeight|linkColor|links|listStyleType|localName|locationbar|location|lowsrc|MAX_VALUE|MIN_VALUE|marginBottom|marginLeft|marginRight|marginTop|media|method|menubar|mimeTypes|multiline|NEGATIVE_INFINITY|nameProp|namespaces|namespaceURI|name|next|offscreenBuffering|onLine|onreadystatechange|opener|opsProfile|oscpu|options|outerHeight|outerWidth|POSITIVE_INFINITY|PI|paddingBottom|paddingLeft|paddingRight|paddingTop|pageXOffset|pageYOffset|pageX|pageY|parentLayer|parentWindow|parent|pathname|personalbar|pixelDepth|platform|plugins|pkcs11|port|prefix|previous|productSub|product|prompter|protocol|prototype|readyState|referrer|responseText|responseXML|rightContext|right|SQRT1_2|SQRT2|screenLeft|screenTop|screenX|screenY|scripts|scrollbars|securityPolicy|security|selectedIndex|selected|selection|self|siblingAbove|siblingBelow|src|source|statusbar|statusText|status|style|styleSheets|suffixes|systemLanguage|tagName|tags|target|textAlign|textDecoration|textIndent|textTransform|text|title|toolbar|top|type|URLUnencoded|URL|undefined|uniqueID|updateInterval|userAgent|userLanguage|userProfile|value|vendorSub|vendor|visibility|vLinkcolor|vspace|whiteSpace|width|XMLDocument|XSLDocument|x|y|zIndex)\b + \.\b(_content|above|action|align|aLinkcolor|all|appCodeName|appCore|appMinorVersion|appName|appVersion|arguments|arity|availHeight|availLeft|availTop|availWidth|backgroundColor|backgroundImage|below|borderBottomWidth|borderColor|borderLeftWidth|borderRightWidth|borderStyle|borderTopWidth|border|bottom|bufferDepth|callee|caller|characterSet|checked|classes|clientInformation|clipboardData|clip|closed|colorDepth|complete|components|constructor|controllers|cookieEnabled|cpuClass|crypto|current|defaultCharset|defaultChecked|defaultStatus|defaultValue|defaultView|description|dialogArguments|dialogHeight|dialogLeft|dialogTop|dialogWidth|directories|display|E|elements|embeds|enabledPlugin|encoding|expando|external|fgColor|filename|fontFamily|fontSize|fontWeight|formName|frameElement|frames|global|hasFocus|hash|height|history|hostname|host|hspace|ids|ignoreCase|input|innerHeight|innerWidth|index|LN10|LN2|LOG10E|LOG2E|language|lastIndex|lastMatch|lastModified|lastParen|layers|layerX|leftContext|left|length|lineHeight|linkColor|listStyleType|localName|locationbar|location|lowsrc|MAX_VALUE|MIN_VALUE|marginBottom|marginLeft|marginRight|marginTop|method|menubar|mimeTypes|multiline|NEGATIVE_INFINITY|nameProp|namespaces|namespaceURI|next|offscreenBuffering|onLine|onreadystatechange|opener|opsProfile|oscpu|options|outerHeight|outerWidth|POSITIVE_INFINITY|PI|paddingBottom|paddingLeft|paddingRight|paddingTop|pageXOffset|pageYOffset|pageX|pageY|parentLayer|parentWindow|parent|pathname|personalbar|pixelDepth|platform|plugins|pkcs11|port|prefix|previous|productSub|product|prompter|protocol|prototype|readyState|responseText|responseXML|rightContext|right|SQRT1_2|SQRT2|screenLeft|screenTop|screenX|screenY|scripts|scrollbars|securityPolicy|security|selectedIndex|selected|selection|self|siblingAbove|siblingBelow|src|source|statusbar|statusText|status|style|styleSheets|suffixes|systemLanguage|tags|textAlign|textDecoration|textIndent|textTransform|toolbar|top|URLUnencoded|undefined|uniqueID|updateInterval|userAgent|userLanguage|userProfile|vendorSub|vendor|visibility|vLinkcolor|vspace|whiteSpace|width|XMLDocument|XSLDocument|x|y|zIndex)\b captures @@ -193,7 +193,7 @@ match - \.\b(attributes|childNodes|doctype|documentElement|firstChild|implementation|lastChild|nextSibling|nodeName|nodeType|nodeValue|ownerDocument|parentNode|previousSibling)\b + \.\b(aLink|anchors|applets|attributes|background|bgColor|body|charset|childNodes|className|content|cookie|data|dir|disabled|doctype|documentElement|domain|entities|firstChild|form|forms|href|hreflang|httpEquiv|id|images|implementation|lang|lastChild|links|media|name|nextSibling|nodeName|nodeType|nodeValue|notationName|notations|ownerDocument|parentNode|previousSibling|profile|publicId|rel|referrer|rev|scheme|specified|systemId|tagName|target|text|title|type|URL|value|version)\b match @@ -203,7 +203,7 @@ match - \b(onabort|onactivate|onafterprint|onafterupdate|onbeforeactivate|onbeforecut|onbeforedeactivate|onbeforeeditfocus|onbeforepaste|onbeforeprint|onbeforeunload|onbeforeupdate|onblur|oncellchange|onchange|onclick|onclose|oncontextmenu|oncontrolselect|oncut|ondataavailable|ondatasetchanged|ondatasetcomplete|ondblclick|ondeactivate|ondrag|ondragdrop|ondragend|ondragenter|ondragleave|ondragover|ondragstart|ondrop|onerror|onerrorupdate|onfocus|onhelp|onkeydown|onkeypress|onkeyup|onload|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onpaste|onpropertychange|onreadystatechange|onreset|onresize|onresizeend|onresizestart|onrowenter|onrowexit|onrowsdelete|onrowsinserted|onscroll|onselect|onselectionchange|onselectstart|onstop|onsubmit|onunload)\b + \b(onAbort|onActivate|onAfterprint|onAfterupdate|onBeforeactivate|onBeforecut|onBeforedeactivate|onBeforeeditfocus|onBeforepaste|onBeforeprint|onBeforeunload|onBeforeupdate|onBlur|onCellchange|onChange|onClick|onClose|onContextmenu|onControlselect|onCut|onDataavailable|onDatasetchanged|onDatasetcomplete|onDblclick|onDeactivate|onDrag|onDragdrop|onDragend|onDragenter|onDragleave|onDragover|onDragstart|onDrop|onError|onErrorupdate|onFocus|onHelp|onKeydown|onKeypress|onKeyup|onLoad|onMousedown|onMousemove|onMouseout|onMouseover|onMouseup|onPaste|onPropertychange|onReadystatechange|onReset|onResize|onResizeend|onResizestart|onRowenter|onRowexit|onRowsdelete|onRowsinserted|onScroll|onSelect|onSelectionchange|onSelectstart|onStop|onSubmit|onUnload)\b name support.function.event-handler.js @@ -221,7 +221,7 @@ begin - (?<=^|[(=&|!+<~>^*%,:?-]|\btypeof|void|/\s)\s*/(?![/*+{}?]) + (?<=[=(]|^)\s*/(?![/*+{}?]) end /[igm]* name From 44039bf8f65f11c98115ad6a958f3f20dd8dfbc2 Mon Sep 17 00:00:00 2001 From: cskiadas Date: Wed, 14 Dec 2005 12:56:42 +0000 Subject: [PATCH 035/243] Simplified regexp for support.constant.js to do look-behind for the dot in front. Helps with the highlight if there is a function and a constant with the same name ( eg prompt, link). git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@2448 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index baebe93..5fdacfb 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -172,28 +172,16 @@ support.function.dom.js - captures - - 1 - - name - support.constant.js - - match - \.\b(_content|above|action|align|aLinkcolor|all|appCodeName|appCore|appMinorVersion|appName|appVersion|arguments|arity|availHeight|availLeft|availTop|availWidth|backgroundColor|backgroundImage|below|borderBottomWidth|borderColor|borderLeftWidth|borderRightWidth|borderStyle|borderTopWidth|border|bottom|bufferDepth|callee|caller|characterSet|checked|classes|clientInformation|clipboardData|clip|closed|colorDepth|complete|components|constructor|controllers|cookieEnabled|cpuClass|crypto|current|defaultCharset|defaultChecked|defaultStatus|defaultValue|defaultView|description|dialogArguments|dialogHeight|dialogLeft|dialogTop|dialogWidth|directories|display|E|elements|embeds|enabledPlugin|encoding|expando|external|fgColor|filename|fontFamily|fontSize|fontWeight|formName|frameElement|frames|global|hasFocus|hash|height|history|hostname|host|hspace|ids|ignoreCase|input|innerHeight|innerWidth|index|LN10|LN2|LOG10E|LOG2E|language|lastIndex|lastMatch|lastModified|lastParen|layers|layerX|leftContext|left|length|lineHeight|linkColor|listStyleType|localName|locationbar|location|lowsrc|MAX_VALUE|MIN_VALUE|marginBottom|marginLeft|marginRight|marginTop|method|menubar|mimeTypes|multiline|NEGATIVE_INFINITY|nameProp|namespaces|namespaceURI|next|offscreenBuffering|onLine|onreadystatechange|opener|opsProfile|oscpu|options|outerHeight|outerWidth|POSITIVE_INFINITY|PI|paddingBottom|paddingLeft|paddingRight|paddingTop|pageXOffset|pageYOffset|pageX|pageY|parentLayer|parentWindow|parent|pathname|personalbar|pixelDepth|platform|plugins|pkcs11|port|prefix|previous|productSub|product|prompter|protocol|prototype|readyState|responseText|responseXML|rightContext|right|SQRT1_2|SQRT2|screenLeft|screenTop|screenX|screenY|scripts|scrollbars|securityPolicy|security|selectedIndex|selected|selection|self|siblingAbove|siblingBelow|src|source|statusbar|statusText|status|style|styleSheets|suffixes|systemLanguage|tags|textAlign|textDecoration|textIndent|textTransform|toolbar|top|URLUnencoded|undefined|uniqueID|updateInterval|userAgent|userLanguage|userProfile|vendorSub|vendor|visibility|vLinkcolor|vspace|whiteSpace|width|XMLDocument|XSLDocument|x|y|zIndex)\b + (?<=\.)(_content|above|action|align|aLinkcolor|all|appCodeName|appCore|appMinorVersion|appName|appVersion|arguments|arity|availHeight|availLeft|availTop|availWidth|backgroundColor|backgroundImage|below|borderBottomWidth|borderColor|borderLeftWidth|borderRightWidth|borderStyle|borderTopWidth|border|bottom|bufferDepth|callee|caller|characterSet|checked|classes|clientInformation|clipboardData|clip|closed|colorDepth|complete|components|constructor|controllers|cookieEnabled|cpuClass|crypto|current|defaultCharset|defaultChecked|defaultStatus|defaultValue|defaultView|description|dialogArguments|dialogHeight|dialogLeft|dialogTop|dialogWidth|directories|display|E|elements|embeds|enabledPlugin|encoding|expando|external|fgColor|filename|fontFamily|fontSize|fontWeight|formName|frameElement|frames|global|hasFocus|hash|height|history|hostname|host|hspace|ids|ignoreCase|input|innerHeight|innerWidth|index|LN10|LN2|LOG10E|LOG2E|language|lastIndex|lastMatch|lastModified|lastParen|layers|layerX|leftContext|left|length|lineHeight|linkColor|listStyleType|localName|locationbar|location|lowsrc|MAX_VALUE|MIN_VALUE|marginBottom|marginLeft|marginRight|marginTop|method|menubar|mimeTypes|multiline|NEGATIVE_INFINITY|nameProp|namespaces|namespaceURI|next|offscreenBuffering|onLine|onreadystatechange|opener|opsProfile|oscpu|options|outerHeight|outerWidth|POSITIVE_INFINITY|PI|paddingBottom|paddingLeft|paddingRight|paddingTop|pageXOffset|pageYOffset|pageX|pageY|parentLayer|parentWindow|parent|pathname|personalbar|pixelDepth|platform|plugins|pkcs11|port|prefix|previous|productSub|product|prompter|protocol|prototype|readyState|responseText|responseXML|rightContext|right|SQRT1_2|SQRT2|screenLeft|screenTop|screenX|screenY|scripts|scrollbars|securityPolicy|security|selectedIndex|selected|selection|self|siblingAbove|siblingBelow|src|source|statusbar|statusText|status|style|styleSheets|suffixes|systemLanguage|tags|textAlign|textDecoration|textIndent|textTransform|toolbar|top|URLUnencoded|undefined|uniqueID|updateInterval|userAgent|userLanguage|userProfile|vendorSub|vendor|visibility|vLinkcolor|vspace|whiteSpace|width|XMLDocument|XSLDocument|x|y|zIndex)\b + name + support.constant.js - captures - - 1 - - name - support.constant.dom.js - - match - \.\b(aLink|anchors|applets|attributes|background|bgColor|body|charset|childNodes|className|content|cookie|data|dir|disabled|doctype|documentElement|domain|entities|firstChild|form|forms|href|hreflang|httpEquiv|id|images|implementation|lang|lastChild|links|media|name|nextSibling|nodeName|nodeType|nodeValue|notationName|notations|ownerDocument|parentNode|previousSibling|profile|publicId|rel|referrer|rev|scheme|specified|systemId|tagName|target|text|title|type|URL|value|version)\b + (?<=\.)(aLink|anchors|applets|attributes|background|bgColor|body|charset|childNodes|className|content|cookie|data|dir|disabled|doctype|documentElement|domain|entities|firstChild|form|forms|href|hreflang|httpEquiv|id|images|implementation|lang|lastChild|link|links|media|name|nextSibling|nodeName|nodeType|nodeValue|notationName|notations|ownerDocument|parentNode|previousSibling|profile|prompt|publicId|rel|referrer|rev|scheme|specified|systemId|tagName|target|text|title|type|URL|value|version)\b + name + support.constant.dom.js match @@ -203,7 +191,7 @@ match - \b(onAbort|onActivate|onAfterprint|onAfterupdate|onBeforeactivate|onBeforecut|onBeforedeactivate|onBeforeeditfocus|onBeforepaste|onBeforeprint|onBeforeunload|onBeforeupdate|onBlur|onCellchange|onChange|onClick|onClose|onContextmenu|onControlselect|onCut|onDataavailable|onDatasetchanged|onDatasetcomplete|onDblclick|onDeactivate|onDrag|onDragdrop|onDragend|onDragenter|onDragleave|onDragover|onDragstart|onDrop|onError|onErrorupdate|onFocus|onHelp|onKeydown|onKeypress|onKeyup|onLoad|onMousedown|onMousemove|onMouseout|onMouseover|onMouseup|onPaste|onPropertychange|onReadystatechange|onReset|onResize|onResizeend|onResizestart|onRowenter|onRowexit|onRowsdelete|onRowsinserted|onScroll|onSelect|onSelectionchange|onSelectstart|onStop|onSubmit|onUnload)\b + \b(onAbort|onActivate|onAfterprint|onAfterupdate|onBeforeactivate|onBeforecut|onBeforedeactivate|onBeforeeditfocus|onBeforepaste|onBeforeprint|onBeforeunload|onBeforeupdate|onBlur|onCellchange|onChange|onClick|onClose|onContextmenu|onControlselect|onCut|onDataavailable|onDatasetchanged|onDatasetcomplete|onDblclick|onDeactivate|onDrag|onDragdrop|onDragend|onDragenter|onDragleave|onDragover|onDragstart|onDrop|onError|onErrorupdate|onFocus|onHelp|onHover|onKeydown|onKeypress|onKeyup|onLoad|onMousedown|onMousemove|onMouseout|onMouseover|onMouseup|onPaste|onPropertychange|onReadystatechange|onReset|onResize|onResizeend|onResizestart|onRowenter|onRowexit|onRowsdelete|onRowsinserted|onScroll|onSelect|onSelectionchange|onSelectstart|onStop|onSubmit|onUnload)\b name support.function.event-handler.js From 3e88431c47c4c27ef969101e4b6a15cb5ecf8e7e Mon Sep 17 00:00:00 2001 From: cskiadas Date: Thu, 15 Dec 2005 04:42:54 +0000 Subject: [PATCH 036/243] Finished updating dom-1 dictionary. git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@2461 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 5fdacfb..c20ae68 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -161,25 +161,25 @@ match - \b(abort|abs|acos|alert|anchor|apply|asin|atan|atan2|atob|attachEvent|back|big|blink|blur|bold|borderWidths|btoa|call|captureEvents|ceil|charAt|charCodeAt|clear|clearInterval|clearTimeout|click|compile|concat|confirm|contextual|cos|createEventObject|createPopup|createStyleSheet|detachEvent|disableExternalCapture|dump|elementFromPoint|enableExternalCapture|escape|eval|exec|execCommand|execScript|exp|fileCreatedDate|fileModifiedDate|fileSize|fileUpdatedDate|find|fixed|floor|focus|fontcolor|fontsize|fromCharCode|forward|getAllResponseHeaders|getAttention|getDate|getDay|getFullYear|getHours|getMilliseconds|getMinutes|getMonth|getResponseHeader|getSeconds|getSelection|getTime|getTimezoneOffset|getUTCDate|getUTCDay|getUTCFullYear|getUTCHours|getUTCMilliseconds|getUTCMinutes|getUTCMonth|getUTCSeconds|getYear|go|handleEvent|home|indexOf|isFinite|isNaN|italics|javaEnabled|join|lastIndexOf|link|load|log|margins|match|max|mergeAttributes|min|moveAbove|moveBelow|moveBy|moveTo|moveToAbsolute|navigate|paddings|parse|parseFloat|parseInt|plugins.refresh|pop|pow|preference|print|prompt|push|queryCommandEnabled|queryCommandIndeterm|queryCommandState|queryCommandValue|random|recalc|releaseCapture|releaseEvents|reload|replace|reset|resizeBy|resizeTo|returnValue|reverse|round|routeEvents|savePreferences|scroll|scrollBy|scrollByLines|scrollByPages|scrollTo|scrollX|scrollY|search|select|send|setDate|setFullYear|setActive|setCursor|setHotKeys|setHours|setInterval|setMilliseconds|setMinutes|setMonth|setResizable|setRequestHeader|setSeconds|setTime|setTimeout|setUTCDate|setUTCFullYear|setUTCHours|setUTCMilliseconds|setUTCMinutes|setUTCMonth|setUTCSeconds|setYear|setZOptions|shift|showHelp|showModalDialog|showModelessDialog|sidebar|sin|signText|sizeToContent|slice|small|sort|splice|split|sqrt|strike|stop|sub|submit|substr|substring|sup|taint|taintEnabled|tan|test|toGMTString|toLocaleString|toLowerCase|toSource|toString|toUpperCase|toUTCString|UTC|unescape|unshift|untaint|updateCommands|unwatch|valueOf|watch)\b(?=\() + \b(abort|abs|acos|alert|anchor|apply|asin|atan|atan2|atob|attachEvent|back|big|blink|bold|borderWidths|btoa|call|captureEvents|ceil|charAt|charCodeAt|clear|clearInterval|clearTimeout|compile|concat|confirm|contextual|cos|createEventObject|createPopup|createStyleSheet|detachEvent|disableExternalCapture|dump|elementFromPoint|enableExternalCapture|escape|eval|exec|execCommand|execScript|exp|fileCreatedDate|fileModifiedDate|fileSize|fileUpdatedDate|find|fixed|floor|fontcolor|fontsize|fromCharCode|forward|getAllResponseHeaders|getAttention|getDate|getDay|getFullYear|getHours|getMilliseconds|getMinutes|getMonth|getResponseHeader|getSeconds|getSelection|getTime|getTimezoneOffset|getUTCDate|getUTCDay|getUTCFullYear|getUTCHours|getUTCMilliseconds|getUTCMinutes|getUTCMonth|getUTCSeconds|getYear|go|handleEvent|home|indexOf|isFinite|isNaN|italics|javaEnabled|join|lastIndexOf|link|load|log|margins|match|max|mergeAttributes|min|moveAbove|moveBelow|moveBy|moveTo|moveToAbsolute|navigate|paddings|parse|parseFloat|parseInt|plugins.refresh|pop|pow|preference|print|prompt|push|queryCommandEnabled|queryCommandIndeterm|queryCommandState|queryCommandValue|random|recalc|releaseCapture|releaseEvents|reload|replace|resizeBy|resizeTo|returnValue|reverse|round|routeEvents|savePreferences|scroll|scrollBy|scrollByLines|scrollByPages|scrollTo|scrollX|scrollY|search|send|setDate|setFullYear|setActive|setCursor|setHotKeys|setHours|setInterval|setMilliseconds|setMinutes|setMonth|setResizable|setRequestHeader|setSeconds|setTime|setTimeout|setUTCDate|setUTCFullYear|setUTCHours|setUTCMilliseconds|setUTCMinutes|setUTCMonth|setUTCSeconds|setYear|setZOptions|shift|showHelp|showModalDialog|showModelessDialog|sidebar|sin|signText|sizeToContent|slice|small|sort|splice|split|sqrt|strike|stop|sub|substr|substring|sup|taint|taintEnabled|tan|test|toGMTString|toLocaleString|toLowerCase|toSource|toString|toUpperCase|toUTCString|UTC|unescape|unshift|untaint|updateCommands|unwatch|valueOf|watch)\b(?=\() name support.function.js match - \b(appendChild|appendData|cloneNode|close|createAttribute|createCDATASection|createComment|createDocumentFragment|createElement|createEntityReference|createTextNode|createProcessingInstruction|deleteData|getElementById|getElementsByName|getElementsByTagName|getAttributeNode|getAttribute|getNamedItem|insertBefore|insertData|item|hasChildNodes|hasFeature|namedItem|open|removeAttributeNode|removeAttribute|removeChild|removeNamedItem|replaceChild|replaceData|setAttributeNode|setAttribute|setNamedItem|splitText|substringData|write|writeln)\b(?=\() + \b(add|appendChild|appendData|blur|cloneNode|close|click|createAttribute|createCaption|createCDATASection|createComment|createDocumentFragment|createElement|createEntityReference|createTextNode|createTFoot|createTHead|createProcessingInstruction|deleteCaption|deleteCell|deleteData|deleteRow|deleteTFoot|deleteTHead|focus|getElementById|getElementsByName|getElementsByTagName|getAttributeNode|getAttribute|getNamedItem|insertBefore|insertCell|insertData|insertRow|item|hasChildNodes|hasFeature|namedItem|open|remove|removeAttributeNode|removeAttribute|removeChild|removeNamedItem|replaceChild|replaceData|reset|select|setAttributeNode|setAttribute|setNamedItem|splitText|submit|substringData|tabIndex|write|writeln)\b(?=\() name support.function.dom.js match - (?<=\.)(_content|above|action|align|aLinkcolor|all|appCodeName|appCore|appMinorVersion|appName|appVersion|arguments|arity|availHeight|availLeft|availTop|availWidth|backgroundColor|backgroundImage|below|borderBottomWidth|borderColor|borderLeftWidth|borderRightWidth|borderStyle|borderTopWidth|border|bottom|bufferDepth|callee|caller|characterSet|checked|classes|clientInformation|clipboardData|clip|closed|colorDepth|complete|components|constructor|controllers|cookieEnabled|cpuClass|crypto|current|defaultCharset|defaultChecked|defaultStatus|defaultValue|defaultView|description|dialogArguments|dialogHeight|dialogLeft|dialogTop|dialogWidth|directories|display|E|elements|embeds|enabledPlugin|encoding|expando|external|fgColor|filename|fontFamily|fontSize|fontWeight|formName|frameElement|frames|global|hasFocus|hash|height|history|hostname|host|hspace|ids|ignoreCase|input|innerHeight|innerWidth|index|LN10|LN2|LOG10E|LOG2E|language|lastIndex|lastMatch|lastModified|lastParen|layers|layerX|leftContext|left|length|lineHeight|linkColor|listStyleType|localName|locationbar|location|lowsrc|MAX_VALUE|MIN_VALUE|marginBottom|marginLeft|marginRight|marginTop|method|menubar|mimeTypes|multiline|NEGATIVE_INFINITY|nameProp|namespaces|namespaceURI|next|offscreenBuffering|onLine|onreadystatechange|opener|opsProfile|oscpu|options|outerHeight|outerWidth|POSITIVE_INFINITY|PI|paddingBottom|paddingLeft|paddingRight|paddingTop|pageXOffset|pageYOffset|pageX|pageY|parentLayer|parentWindow|parent|pathname|personalbar|pixelDepth|platform|plugins|pkcs11|port|prefix|previous|productSub|product|prompter|protocol|prototype|readyState|responseText|responseXML|rightContext|right|SQRT1_2|SQRT2|screenLeft|screenTop|screenX|screenY|scripts|scrollbars|securityPolicy|security|selectedIndex|selected|selection|self|siblingAbove|siblingBelow|src|source|statusbar|statusText|status|style|styleSheets|suffixes|systemLanguage|tags|textAlign|textDecoration|textIndent|textTransform|toolbar|top|URLUnencoded|undefined|uniqueID|updateInterval|userAgent|userLanguage|userProfile|vendorSub|vendor|visibility|vLinkcolor|vspace|whiteSpace|width|XMLDocument|XSLDocument|x|y|zIndex)\b + (?<=\.)(_content|above|aLinkcolor|all|appCodeName|appCore|appMinorVersion|appName|appVersion|arguments|arity|availHeight|availLeft|availTop|availWidth|backgroundColor|backgroundImage|below|borderBottomWidth|borderColor|borderLeftWidth|borderRightWidth|borderStyle|borderTopWidth|bottom|bufferDepth|callee|caller|characterSet|classes|clientInformation|clipboardData|clip|closed|colorDepth|complete|components|constructor|controllers|cookieEnabled|cpuClass|crypto|current|defaultCharset|defaultChecked|defaultStatus|defaultView|description|dialogArguments|dialogHeight|dialogLeft|dialogTop|dialogWidth|directories|display|E|embeds|enabledPlugin|encoding|expando|external|fgColor|filename|fontFamily|fontSize|fontWeight|formName|frameElement|frames|global|hasFocus|hash|history|hostname|host|ids|ignoreCase|input|innerHeight|innerWidth|LN10|LN2|LOG10E|LOG2E|language|lastIndex|lastMatch|lastModified|lastParen|layers|layerX|leftContext|left|length|lineHeight|linkColor|listStyleType|localName|locationbar|location|lowsrc|MAX_VALUE|MIN_VALUE|marginBottom|marginLeft|marginRight|marginTop|menubar|mimeTypes|multiline|NEGATIVE_INFINITY|nameProp|namespaces|namespaceURI|next|offscreenBuffering|onLine|onreadystatechange|opener|opsProfile|oscpu|outerHeight|outerWidth|POSITIVE_INFINITY|PI|paddingBottom|paddingLeft|paddingRight|paddingTop|pageXOffset|pageYOffset|pageX|pageY|parentLayer|parentWindow|parent|pathname|personalbar|pixelDepth|platform|plugins|pkcs11|port|prefix|previous|productSub|product|prompter|protocol|prototype|readyState|responseText|responseXML|rightContext|right|SQRT1_2|SQRT2|screenLeft|screenTop|screenX|screenY|scripts|scrollbars|securityPolicy|security|selection|self|siblingAbove|siblingBelow|source|statusbar|statusText|status|style|styleSheets|suffixes|systemLanguage|tags|textAlign|textDecoration|textIndent|textTransform|toolbar|top|URLUnencoded|undefined|uniqueID|updateInterval|userAgent|userLanguage|userProfile|vendorSub|vendor|visibility|vLinkcolor|whiteSpace|XMLDocument|XSLDocument|x|y|zIndex)\b name support.constant.js match - (?<=\.)(aLink|anchors|applets|attributes|background|bgColor|body|charset|childNodes|className|content|cookie|data|dir|disabled|doctype|documentElement|domain|entities|firstChild|form|forms|href|hreflang|httpEquiv|id|images|implementation|lang|lastChild|link|links|media|name|nextSibling|nodeName|nodeType|nodeValue|notationName|notations|ownerDocument|parentNode|previousSibling|profile|prompt|publicId|rel|referrer|rev|scheme|specified|systemId|tagName|target|text|title|type|URL|value|version)\b + (?<=\.)(abbr|accept|acceptCharset|accessKey|action|aLink|align|alt|anchors|applets|areas|archive|attributes|axis|background|bgColor|body|border|caption|charset|cellPadding|cells|cellSpacing|ch|checked|childNodes|chOff|cite|className|clear|colSpan|code|codeBase|codeType|color|cols|compact|content|cookie|coords|data|dateTime|declare|defaultChecked|defaultSelected|defaultValue|defer|dir|disabled|doctype|documentElement|domain|elements|enctype|entities|event|face|firstChild|form|forms|frame|frameBorder|headers|height|hspace|href|hreflang|htmlFor|httpEquiv|id|images|implementation|index|isMap|label|lang|lastChild|link|links|longDesc|lowSrc|maxLength|marginHeight|marginWidth|media|method|multiple|name|nextSibling|nodeName|nodeType|nodeValue|noHref|noResize|noShade|notationName|notations|noWrap|object|options|ownerDocument|parentNode|previousSibling|profile|prompt|publicId|readOnly|rel|referrer|rev|rowIndex|rows|rowSpan|rules|scheme|scope|scrolling|sectionRowIndex|selected|selectedIndex|shape|size|specified|src|standby|start|summary|systemId|tagName|target|text|tBodies|tFoot|tHead|title|type|URL|useMap|vAlign|value|valueType|version|vLink|vspace|width)\b name support.constant.dom.js From 5a2572890b80f139d63a47535b92ad2b19fba183 Mon Sep 17 00:00:00 2001 From: duff Date: Mon, 20 Feb 2006 11:02:30 +0000 Subject: [PATCH 037/243] =?UTF-8?q?=E2=80=A2=20add=20prototype=20snippet?= =?UTF-8?q?=20from=20Mike=20Ter=20Louw=20=E2=80=A2=20fix=20comment=20chara?= =?UTF-8?q?cter=20in=20function=20snippet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@2721 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Snippets/Prototype (proto).plist | 20 ++++++++++++++++++++ Snippets/function (fun).plist | 4 ++-- info.plist | 6 ++++++ 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 Snippets/Prototype (proto).plist diff --git a/Snippets/Prototype (proto).plist b/Snippets/Prototype (proto).plist new file mode 100644 index 0000000..fc12720 --- /dev/null +++ b/Snippets/Prototype (proto).plist @@ -0,0 +1,20 @@ + + + + + content + ${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) +{ + ${0:// body...} +}; + + name + Prototype (proto) + scope + source.js + tabTrigger + proto + uuid + 2F96136B-0193-42F5-90FC-B6F456A3AD77 + + diff --git a/Snippets/function (fun).plist b/Snippets/function (fun).plist index 3b61a5b..7d9bcc0 100644 --- a/Snippets/function (fun).plist +++ b/Snippets/function (fun).plist @@ -5,10 +5,10 @@ content function ${1:function_name} (${2:first_argument}) { - ${0:# body...} + ${0:// body...} } name - function (fun) + Function (fun) scope source.js tabTrigger diff --git a/info.plist b/info.plist index 00f87b7..95e5ba3 100644 --- a/info.plist +++ b/info.plist @@ -4,6 +4,12 @@ name JavaScript + ordering + + F0E4FB6A-4878-48C6-A777-62438DF1E14F + 2F96136B-0193-42F5-90FC-B6F456A3AD77 + 93E017CC-6F27-11D9-90EB-000D93589AF6 + uuid AAB4FD74-73F9-11D9-B89A-000D93589AF6 From 95f61930805d033067f11a42ed6f3e3885a79511 Mon Sep 17 00:00:00 2001 From: duff Date: Sun, 9 Apr 2006 21:31:30 +0000 Subject: [PATCH 038/243] =?UTF-8?q?=E2=80=A2=C2=A0all=20single=20line=20co?= =?UTF-8?q?mments,=20bullet=20points=20(plain=20text),=20and=20quoted=20li?= =?UTF-8?q?nes=20(mail)=20now=20optionally=20match=20the=20newline=20chara?= =?UTF-8?q?cter=20=E2=80=94=20this=20is=20so=20that=20when=20the=20caret?= =?UTF-8?q?=20is=20at=20the=20end=20of=20the=20line,=20the=20scope=20is=20?= =?UTF-8?q?still=20that=20of=20=E2=80=9Cthe=20line.=E2=80=9D=20This=20is?= =?UTF-8?q?=20so=20key=20equivalents=20bound=20to=20a=20given=20scope=20(l?= =?UTF-8?q?ike=20the=20=E2=80=98enter=E2=80=99=20key)=20also=20work=20when?= =?UTF-8?q?=20typing=20at=20the=20end=20of=20the=20line,=20which=20would?= =?UTF-8?q?=20be=20expected.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@2977 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index c20ae68..4c17275 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -107,7 +107,7 @@ match - //.*$ + //.*$\n? name comment.line.double-slash.js From 75994f3bf75d90fe44e37172d80e21685dd63254 Mon Sep 17 00:00:00 2001 From: duff Date: Wed, 12 Apr 2006 01:22:15 +0000 Subject: [PATCH 039/243] =?UTF-8?q?=E2=80=A2=20a=20quick=20lookup=20comman?= =?UTF-8?q?d=20for=20JavaScript=20using=20the=20index=20from=20http://devg?= =?UTF-8?q?uru.com/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@3006 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Commands/Documentation for Word.plist | 30 ++++++++++++++++++++++++++ Support/dev_guru_index.gz | Bin 0 -> 1987 bytes 2 files changed, 30 insertions(+) create mode 100644 Commands/Documentation for Word.plist create mode 100644 Support/dev_guru_index.gz diff --git a/Commands/Documentation for Word.plist b/Commands/Documentation for Word.plist new file mode 100644 index 0000000..d9d98f9 --- /dev/null +++ b/Commands/Documentation for Word.plist @@ -0,0 +1,30 @@ + + + + + beforeRunningCommand + nop + command + # index created using: curl -s 'http://devguru.com/technologies/javascript/index.asp'|grep -o '<a href="[0-9]*.asp">[a-z][a-zA-Z]*</a>'|perl -pe 's/<a href="([^"]*)">([^<]*)<\/a>/$2\t$1/'|sort|uniq|gzip >dev_guru_index.gz + +ref=$(zgrep -w "^${TM_SELECTED_TEXT:-$TM_CURRENT_WORD}" "$TM_BUNDLE_SUPPORT/dev_guru_index.gz"|cut -f2) + +[[ -n "$ref" ]] && exit_show_html "<meta http-equiv='Refresh' content='0;URL=http://devguru.com/technologies/javascript/$ref'>" + +echo "No documentation found." + fallbackInput + word + input + selection + keyEquivalent + ^h + name + Documentation for Word / Selection + output + showAsTooltip + scope + source.js + uuid + B4874A14-2491-465A-A349-61E4EBCF4700 + + diff --git a/Support/dev_guru_index.gz b/Support/dev_guru_index.gz new file mode 100644 index 0000000000000000000000000000000000000000..b657fbc5e6f3c00e0a58727ccbf2308915e9ebe9 GIT binary patch literal 1987 zcmV;!2R!&6iwFQ|R6Ilg19h0)m!q~0z@OVcrUwWZ^Ef*nw{vc1x2H4P+dewPN!%fr z+K^=Sudl2RAlq{v{j-rJS(aqX)}QSUc~)onPbLmOnr%#@azmrm)3D^>=zI@AX(NyHWHdBnmCwd?KU;S=j*04Oq5pHc z@raO?ZcY1s2!85!=vLBbYde3zF?n+94(JflWt-fFV={B=JN&q5co=pT9GK@D-Xd57 z>+`ZE-CNUjXbMfY)^(^mNpFuP+$FVjmdzl!n<2~StO?KkXv5j0ueDzBH+Qmr!sWVP z?4wOe>WVi_r~Y6E_62Y4PlM~y32xZ%MBub6S|f}4y$dH4E{pon^^-*tH;nwdvv|g` zh9Z+Z)=nY70izR0>JCmYEmvgo&bDCj*WaE~wDLzYy9cFwkKe;&!;^b6b>pk;Y&#}P z^P;+)8O=CF^Z@T@*|4f0m+V|L+s-~-!KuCJ?#(bx!J?fMKRbUi7b+iWo?@{+x2ueQZQWwoyZo<$=g zpRxj+9Zl~KOG=I)zVnnYIIZj<9$FTmIgk>I?i*UpYV3VDQNnE$#2Ud`%gB|b2F}UrN4jJ-9E%?DCl2uwSe!~1%HMyV{*L5yJ#P&OyDVCWYR3f;UA-Ly= zs1)?N`nXzPif_*9)hshzcwDH~@_)xFC>n?>@ggf#3$D~OfIF$ z8GSaNaZDa@BNX2jLp!50_zTL@BPI*XUYuh7@|bZdKI?b;L7@*pNrF2A#R|2PaetV= z1e8%SisLgW4Q8ra#)>yHeKBKu#Fh2JAmi*EUV1g}8^>P_WN}=onSI#s2d4320e@l{ z-zVWAyglmLR6+~kJm?Zex0@_M@XFhwdY`O zHe!Q-g4YbTw-lDF7lK}jpzg1Cs@jDiV>Y>o^zfJ96X9`2^N}4Y<{>41-&eJuoAK9WS7jk;leyWeE4i* z8?5aqg;y&=Cp!~Q4;U`}1U}*OjO7w~!}`p%o)DZ27QLF>6<7VbxsZzhMST2uU<~&*)lVCH2JL7+|FM=W9pX&G?%5Rmym8ajZFRG zYWeKK-C!+WMH}u87+K(XGU{xwu<>jE?BEVSBZmL7Y7UI^Z9_}a&)%g2thhd(=f?{- z&hy@!NiRo-W5v3_82{vy{Ajii781V>4RuOW^*dS}v#)afeT4RbyJ V;rPax8tfs}{{eh_3F)O20084W^o0Nb literal 0 HcmV?d00001 From 4bab9c7fec726a56ae2bac2358b418a7e6d15fb4 Mon Sep 17 00:00:00 2001 From: duff Date: Wed, 3 May 2006 09:21:09 +0000 Subject: [PATCH 040/243] =?UTF-8?q?=E2=80=A2=20add=20:=20as=20a=20valid=20?= =?UTF-8?q?character=20in=20front=20of=20regexps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@3217 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 4c17275..6a7c29f 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -209,7 +209,7 @@ begin - (?<=[=(]|^)\s*/(?![/*+{}?]) + (?<=[=(:]|^)\s*/(?![/*+{}?]) end /[igm]* name From b199a53986b2b6677149f3ce4c4e2855f7d41659 Mon Sep 17 00:00:00 2001 From: duff Date: Sat, 27 May 2006 06:17:24 +0000 Subject: [PATCH 041/243] =?UTF-8?q?=E2=80=A2=20add=20matching=20of=20funct?= =?UTF-8?q?ions=20declared=20as=20=E2=80=98foobar:=20function()=20{=20?= =?UTF-8?q?=E2=80=A6=20}=E2=80=99=20(from=20Aparajita=20Fishman)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@3432 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 6a7c29f..ec53e72 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -14,7 +14,7 @@ foldingStopMarker ^\s*\} keyEquivalent - ~^J + ^~J name JavaScript patterns @@ -43,6 +43,32 @@ name meta.function.js + + captures + + 1 + + name + entity.name.function.js + + 2 + + name + storage.type.function.js + + 3 + + name + variable.parameter.function.js + + + comment + match stuff like: foobar: function() { … } + match + ^\s*\b([a-zA-Z_?\.$]+\w*):\s+\b(function)?\s*\((.*?)\) + name + meta.function.js + captures From ca22160d0d98fc0a6e70dda874aaa73f6a672f00 Mon Sep 17 00:00:00 2001 From: duff Date: Fri, 2 Jun 2006 14:58:27 +0000 Subject: [PATCH 042/243] =?UTF-8?q?=E2=80=A2=20menu=20structure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@3504 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- info.plist | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/info.plist b/info.plist index 95e5ba3..922e0e7 100644 --- a/info.plist +++ b/info.plist @@ -2,10 +2,23 @@ + mainMenu + + items + + B4874A14-2491-465A-A349-61E4EBCF4700 + ------------------------------------ + F0E4FB6A-4878-48C6-A777-62438DF1E14F + 2F96136B-0193-42F5-90FC-B6F456A3AD77 + + submenus + + name JavaScript ordering + B4874A14-2491-465A-A349-61E4EBCF4700 F0E4FB6A-4878-48C6-A777-62438DF1E14F 2F96136B-0193-42F5-90FC-B6F456A3AD77 93E017CC-6F27-11D9-90EB-000D93589AF6 From 6392496e9083caf60fc170859782c5d2909bc421 Mon Sep 17 00:00:00 2001 From: duff Date: Wed, 14 Jun 2006 02:52:10 +0000 Subject: [PATCH 043/243] =?UTF-8?q?=E2=80=A2=20remove=20mention=20of=20tab?= =?UTF-8?q?=20trigger=20from=20the=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@3648 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Snippets/Prototype (proto).plist | 2 +- Snippets/function (fun).plist | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Snippets/Prototype (proto).plist b/Snippets/Prototype (proto).plist index fc12720..d29abe2 100644 --- a/Snippets/Prototype (proto).plist +++ b/Snippets/Prototype (proto).plist @@ -9,7 +9,7 @@ }; name - Prototype (proto) + Prototype scope source.js tabTrigger diff --git a/Snippets/function (fun).plist b/Snippets/function (fun).plist index 7d9bcc0..e02e7c2 100644 --- a/Snippets/function (fun).plist +++ b/Snippets/function (fun).plist @@ -8,7 +8,7 @@ ${0:// body...} } name - Function (fun) + Function scope source.js tabTrigger From 4cee5c665002e31d7b66aaa5cf1a7c2f04dff4d9 Mon Sep 17 00:00:00 2001 From: duff Date: Mon, 3 Jul 2006 06:22:39 +0000 Subject: [PATCH 044/243] =?UTF-8?q?=E2=80=A2=20remove=20swallow=20pattern?= =?UTF-8?q?=20for=20block=20comments=20(I=20believe=20this=20was=20a=20cut?= =?UTF-8?q?=E2=80=99n=E2=80=99paste=20mistake,=20as=20escape=20characters?= =?UTF-8?q?=20should=20have=20no=20special=20meaning=20in=20JavaScript=20c?= =?UTF-8?q?omments=20AFAIK)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@3979 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 2 -- 1 file changed, 2 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index ec53e72..5649ce8 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -128,8 +128,6 @@ \*/ name comment.block.js - swallow - \\. match From 3f366bbbbb13b46e2cc9a0bd26a9c63f00b0f618 Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Mon, 17 Jul 2006 07:55:50 +0000 Subject: [PATCH 045/243] Added a better indent pref. Added some handy snippets. Added some handy scopes to the language git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@4352 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Preferences/JavaScript Indent.tmPreferences | 19 +++++ ...r (\342\200\246) {\342\200\246}.tmSnippet" | 18 +++++ Snippets/function.tmSnippet | 16 +++++ Snippets/if ___ else.tmSnippet | 16 +++++ Snippets/if.tmSnippet | 16 +++++ Snippets/setTimeout function.tmSnippet | 16 +++++ Syntaxes/JavaScript.plist | 70 +++++++++++++++++-- info.plist | 13 ++++ 8 files changed, 179 insertions(+), 5 deletions(-) create mode 100644 Preferences/JavaScript Indent.tmPreferences create mode 100644 "Snippets/for (\342\200\246) {\342\200\246}.tmSnippet" create mode 100644 Snippets/function.tmSnippet create mode 100644 Snippets/if ___ else.tmSnippet create mode 100644 Snippets/if.tmSnippet create mode 100644 Snippets/setTimeout function.tmSnippet diff --git a/Preferences/JavaScript Indent.tmPreferences b/Preferences/JavaScript Indent.tmPreferences new file mode 100644 index 0000000..b6b6ffc --- /dev/null +++ b/Preferences/JavaScript Indent.tmPreferences @@ -0,0 +1,19 @@ + + + + + name + JavaScript Indent + scope + source.js + settings + + decreaseIndentPattern + ^(.*\*/)?\s*(\}|\))([^{]*\{)?([;,]?\s*|\.[^{]*|\s*\)[;\s]*)$ + increaseIndentPattern + ^.*(\{[^}"']*|\([^)"']*)$ + + uuid + BC062860-3346-4D3B-8421-C5543F83D11F + + diff --git "a/Snippets/for (\342\200\246) {\342\200\246}.tmSnippet" "b/Snippets/for (\342\200\246) {\342\200\246}.tmSnippet" new file mode 100644 index 0000000..d41b047 --- /dev/null +++ "b/Snippets/for (\342\200\246) {\342\200\246}.tmSnippet" @@ -0,0 +1,18 @@ + + + + + content + for (var ${20:i}=0; ${20:i} < ${1:Things}.length; ${20:i}++) { + ${100:${1:Things}[${20:i}]}$0 +}; + name + for (…) {…} + scope + source.js + tabTrigger + for + uuid + 011C4681-FBEC-4891-9326-3DECFCDED6D6 + + diff --git a/Snippets/function.tmSnippet b/Snippets/function.tmSnippet new file mode 100644 index 0000000..49cb8db --- /dev/null +++ b/Snippets/function.tmSnippet @@ -0,0 +1,16 @@ + + + + + content + function($1){${0:$TM_SELECTED_TEXT}}; + name + function(){}; + scope + source.js + tabTrigger + f + uuid + 4C6EDB43-3E2E-411B-A016-13C135C59833 + + diff --git a/Snippets/if ___ else.tmSnippet b/Snippets/if ___ else.tmSnippet new file mode 100644 index 0000000..77595ff --- /dev/null +++ b/Snippets/if ___ else.tmSnippet @@ -0,0 +1,16 @@ + + + + + content + if(${1:true}){${0:$TM_SELECTED_TEXT}}else{}; + name + if ... else + scope + source.js + tabTrigger + ife + uuid + 31964029-9D71-4ADC-8213-DFE5C4E222B3 + + diff --git a/Snippets/if.tmSnippet b/Snippets/if.tmSnippet new file mode 100644 index 0000000..452efe9 --- /dev/null +++ b/Snippets/if.tmSnippet @@ -0,0 +1,16 @@ + + + + + content + if(${1:true}){${0:$TM_SELECTED_TEXT}}; + name + if + scope + source.js + tabTrigger + if + uuid + F19F3732-39A7-48EC-A72B-A8F477A01795 + + diff --git a/Snippets/setTimeout function.tmSnippet b/Snippets/setTimeout function.tmSnippet new file mode 100644 index 0000000..04ce12a --- /dev/null +++ b/Snippets/setTimeout function.tmSnippet @@ -0,0 +1,16 @@ + + + + + content + setTimeout((function() {$0})${2:}, ${1:10}); + name + setTimeout function + scope + source.js + tabTrigger + timeout + uuid + 009A3E6C-FE3F-4A18-8759-2DC31F17BBE2 + + diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 5649ce8..db77896 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -65,7 +65,7 @@ comment match stuff like: foobar: function() { … } match - ^\s*\b([a-zA-Z_?\.$]+\w*):\s+\b(function)?\s*\((.*?)\) + \b([a-zA-Z_?\.$]+\w*):\s+\b(function)?\s*\((.*?)\) name meta.function.js @@ -104,26 +104,50 @@ begin ' + captures + + 0 + + name + string.quoted.single.brace.js + + + contentName + string.quoted.single.js end ' - name - string.quoted.single.js swallow \\. begin " + captures + + 0 + + name + string.quoted.double.brace.js + + + contentName + string.quoted.double.js end " - name - string.quoted.double.js swallow \\. begin /\* + captures + + 0 + + name + meta.brace.comment.block.js + + end \*/ name @@ -248,6 +272,42 @@ + + match + \; + name + meta.delimiter.statement.semicolon.js + + + match + ,[ |\t]* + name + meta.delimiter.object.comma.js + + + match + \. + name + meta.delimiter.method.period.js + + + match + \{|\} + name + meta.brace.curly.js + + + match + \(|\) + name + meta.brace.round.js + + + match + \[|\] + name + meta.brace.square.js + scopeName source.js diff --git a/info.plist b/info.plist index 922e0e7..dfd09f5 100644 --- a/info.plist +++ b/info.plist @@ -10,6 +10,13 @@ ------------------------------------ F0E4FB6A-4878-48C6-A777-62438DF1E14F 2F96136B-0193-42F5-90FC-B6F456A3AD77 + ------------------------------------ + F19F3732-39A7-48EC-A72B-A8F477A01795 + 31964029-9D71-4ADC-8213-DFE5C4E222B3 + 011C4681-FBEC-4891-9326-3DECFCDED6D6 + 4C6EDB43-3E2E-411B-A016-13C135C59833 + ------------------------------------ + 009A3E6C-FE3F-4A18-8759-2DC31F17BBE2 submenus @@ -22,6 +29,12 @@ F0E4FB6A-4878-48C6-A777-62438DF1E14F 2F96136B-0193-42F5-90FC-B6F456A3AD77 93E017CC-6F27-11D9-90EB-000D93589AF6 + BC062860-3346-4D3B-8421-C5543F83D11F + F19F3732-39A7-48EC-A72B-A8F477A01795 + 31964029-9D71-4ADC-8213-DFE5C4E222B3 + 4C6EDB43-3E2E-411B-A016-13C135C59833 + 011C4681-FBEC-4891-9326-3DECFCDED6D6 + 009A3E6C-FE3F-4A18-8759-2DC31F17BBE2 uuid AAB4FD74-73F9-11D9-B89A-000D93589AF6 From fa12f1385a17c36973d0d6b0f41a0a77ad2e5a25 Mon Sep 17 00:00:00 2001 From: duff Date: Mon, 17 Jul 2006 11:24:53 +0000 Subject: [PATCH 046/243] =?UTF-8?q?=E2=80=A2=20use=20the=20ellipsis=20glyp?= =?UTF-8?q?h=20(=E2=80=A6)=20instead=20of=20three=20periods?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@4374 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Snippets/if ___ else.tmSnippet | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Snippets/if ___ else.tmSnippet b/Snippets/if ___ else.tmSnippet index 77595ff..672f4aa 100644 --- a/Snippets/if ___ else.tmSnippet +++ b/Snippets/if ___ else.tmSnippet @@ -5,7 +5,7 @@ content if(${1:true}){${0:$TM_SELECTED_TEXT}}else{}; name - if ... else + if … else scope source.js tabTrigger From ffed18bc0c76e1b0de5ceb3b717394d66cc0feb8 Mon Sep 17 00:00:00 2001 From: msheets Date: Thu, 10 Aug 2006 05:04:18 +0000 Subject: [PATCH 047/243] Remove swallow use in favor of a constant.character.escape pattern. git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@4645 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index db77896..76a0f15 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -116,8 +116,15 @@ string.quoted.single.js end ' - swallow - \\. + patterns + + + match + \\. + name + constant.character.escape.js + + begin @@ -134,8 +141,15 @@ string.quoted.double.js end " - swallow - \\. + patterns + + + match + \\. + name + constant.character.escape.js + + begin From d526582b546d00ff2457489e9ecd64adb481e5bb Mon Sep 17 00:00:00 2001 From: msheets Date: Mon, 14 Aug 2006 08:14:15 +0000 Subject: [PATCH 048/243] Move this & super to a new variable.language rule, though oddly best I can tell super doesn't exist in javascript outside some kind of extension? git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@4734 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 76a0f15..cb30254 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -205,10 +205,16 @@ match - \b(false|null|super|this|true)\b + \b(false|null|true)\b name constant.language.js + + match + \b(super|this)\b + name + variable.language.js + match \b(debugger)\b From 269f63f493352d1c160db176cb246df2316c393b Mon Sep 17 00:00:00 2001 From: duff Date: Mon, 21 Aug 2006 12:10:57 +0000 Subject: [PATCH 049/243] =?UTF-8?q?=E2=80=A2=20allow=20whitespace=20before?= =?UTF-8?q?=20colon=20when=20declaring=20functions=20as=20=E2=80=98foo:=20?= =?UTF-8?q?function=20()=20{=20=E2=80=A6=20}=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@4874 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index cb30254..67f7736 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -65,7 +65,7 @@ comment match stuff like: foobar: function() { … } match - \b([a-zA-Z_?\.$]+\w*):\s+\b(function)?\s*\((.*?)\) + \b([a-zA-Z_?\.$]+\w*)\s*:\s+\b(function)?\s*\((.*?)\) name meta.function.js From b766a2309c7e06099e50d5d54c6b9e383f588269 Mon Sep 17 00:00:00 2001 From: duff Date: Wed, 13 Sep 2006 18:33:01 +0000 Subject: [PATCH 050/243] =?UTF-8?q?=E2=80=A2=20markup=20hex=20(\xHH)=20and?= =?UTF-8?q?=20octal=20(\377)=20sequences=20in=20strings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@5202 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 67f7736..e5726a2 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -120,7 +120,7 @@ match - \\. + \\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]?|37[0-7]?|.) name constant.character.escape.js @@ -145,7 +145,7 @@ match - \\. + \\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]|37[0-7]?|.) name constant.character.escape.js From 4a0e3a094ffb6558f9c9efc8403a3cdc967ac152 Mon Sep 17 00:00:00 2001 From: duff Date: Wed, 13 Sep 2006 18:35:54 +0000 Subject: [PATCH 051/243] =?UTF-8?q?=E2=80=A2=20forgot=20octal=20numbers=20?= =?UTF-8?q?(in=20strings)=20with=20the=20first=20digit=20higher=20than=203?= =?UTF-8?q?=20(e.g.=20\57=20or=20\7)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@5203 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index e5726a2..61471a2 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -120,7 +120,7 @@ match - \\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]?|37[0-7]?|.) + \\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.) name constant.character.escape.js @@ -145,7 +145,7 @@ match - \\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]|37[0-7]?|.) + \\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.) name constant.character.escape.js From 9fff45d36d5c6c72a3415444e749b67a30b8f119 Mon Sep 17 00:00:00 2001 From: haraldmartin Date: Tue, 26 Sep 2006 14:07:21 +0000 Subject: [PATCH 052/243] =?UTF-8?q?=E2=80=A2=20Moved=20a=20lot=20of=20the?= =?UTF-8?q?=20generic=20JS=20stuff=20from=20the=20Prototype=20bundle=20to?= =?UTF-8?q?=20the=20JS=20bundle=20and=20removed=20duplicated=20rules.=20?= =?UTF-8?q?=E2=80=A2=20Improved=20some=20rules=20to=20catch=20more=20funct?= =?UTF-8?q?ions=20(like=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 | 189 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 181 insertions(+), 8 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 61471a2..1478603 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -25,21 +25,80 @@ 1 name - storage.type.function.js + support.class.js 2 name - entity.name.function.js + 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 - \b(function)\s+([a-zA-Z_$]\w*)?\s*\((.*?)\) + ([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 @@ -47,15 +106,67 @@ 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 + + 1 name storage.type.function.js + 2 + + name + entity.name.function.js + 3 name @@ -63,9 +174,9 @@ comment - match stuff like: foobar: function() { … } + match regular function like: function myFunc(arg) { … } match - \b([a-zA-Z_?\.$]+\w*)\s*:\s+\b(function)?\s*\((.*?)\) + \b(function)\s+([a-zA-Z_$]\w*)?\s*\((.*?)\) name meta.function.js @@ -89,11 +200,73 @@ comment - match stuff like: Sound.prototype.play = function() { … } + 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 + + 1 + + name + string.quoted.js + + 3 + + name + object.property.function.js + + 5 + + name + entity.name.function.js + + 6 + + name + variable.parameter.function.js + + + comment + Attempt to match "foo": function + match + (('|")(.*?)(\2))\s*:\s*\b(function)?\s*\((.*?)\) + name + 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 From 7c8a8d1c75d4486538bc3eb401e25f45e677b61b Mon Sep 17 00:00:00 2001 From: haraldmartin Date: Tue, 26 Sep 2006 15:20:02 +0000 Subject: [PATCH 053/243] =?UTF-8?q?=E2=80=A2=20=E2=87=A7=E2=86=A9=20(shift?= =?UTF-8?q?=20+=20enter)=20will=20turn=20the=20current=20word=20as=20a=20f?= =?UTF-8?q?unction=20(like=20the=20ruby=20one=20does).=20=E2=87=A7?= =?UTF-8?q?=E2=8C=83=E2=86=A9=20(shift=20+=20control=20+=20enter)=20will?= =?UTF-8?q?=20make=20it=20into=20a=20method=20instead=20(blah:=20function(?= =?UTF-8?q?)=20{=20...=20})=20=E2=80=A2=20Cleaned=20up=20some=20snippets?= =?UTF-8?q?=20like=20setTimeout=20and=20the=20if/if=20else/function=20and?= =?UTF-8?q?=20others?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@5308 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Commands/New Function.tmCommand | 28 +++++++++++++++++++ Commands/New Method.tmCommand | 28 +++++++++++++++++++ ...key \342\200\224 key: \"value\".tmSnippet" | 16 +++++++++++ Snippets/Prototype (proto).plist | 3 +- Snippets/function (fun).plist | 3 +- Snippets/function.tmSnippet | 2 +- Snippets/if ___ else.tmSnippet | 2 +- Snippets/if.tmSnippet | 2 +- Snippets/setTimeout function.tmSnippet | 2 +- info.plist | 10 +++++-- 10 files changed, 86 insertions(+), 10 deletions(-) create mode 100644 Commands/New Function.tmCommand create mode 100644 Commands/New Method.tmCommand create mode 100644 "Snippets/Object key \342\200\224 key: \"value\".tmSnippet" diff --git a/Commands/New Function.tmCommand b/Commands/New Function.tmCommand new file mode 100644 index 0000000..064d364 --- /dev/null +++ b/Commands/New Function.tmCommand @@ -0,0 +1,28 @@ + + + + + beforeRunningCommand + nop + command + cat <<SNIPPET +function ${TM_SELECTED_TEXT:-$TM_CURRENT_WORD}(\${1:args}) { + \$0 +} +SNIPPET + fallbackInput + word + input + selection + keyEquivalent + $ + name + New Function + output + insertAsSnippet + scope + source.js + uuid + 73951799-AC15-40A6-81DB-EC051AB4A033 + + diff --git a/Commands/New Method.tmCommand b/Commands/New Method.tmCommand new file mode 100644 index 0000000..2e02018 --- /dev/null +++ b/Commands/New Method.tmCommand @@ -0,0 +1,28 @@ + + + + + beforeRunningCommand + nop + command + cat <<SNIPPET +${TM_SELECTED_TEXT:-$TM_CURRENT_WORD}: function(\${1:args}) { + \$0 +}\${2:,} +SNIPPET + fallbackInput + word + input + selection + keyEquivalent + ~$ + name + New Method + output + insertAsSnippet + scope + source.js + uuid + 1717B5AE-209B-4548-9155-9E88A7230C1C + + diff --git "a/Snippets/Object key \342\200\224 key: \"value\".tmSnippet" "b/Snippets/Object key \342\200\224 key: \"value\".tmSnippet" new file mode 100644 index 0000000..d54893d --- /dev/null +++ "b/Snippets/Object key \342\200\224 key: \"value\".tmSnippet" @@ -0,0 +1,16 @@ + + + + + content + ${1:key}: ${2:"${3:value}"}${4:, } + name + Object key — key: "value" + scope + source.js + tabTrigger + : + uuid + DC8B46FB-8ADA-45EA-8F36-94C807A0D302 + + diff --git a/Snippets/Prototype (proto).plist b/Snippets/Prototype (proto).plist index d29abe2..252c279 100644 --- a/Snippets/Prototype (proto).plist +++ b/Snippets/Prototype (proto).plist @@ -3,8 +3,7 @@ content - ${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) -{ + ${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) { ${0:// body...} }; diff --git a/Snippets/function (fun).plist b/Snippets/function (fun).plist index e02e7c2..0ca6d4e 100644 --- a/Snippets/function (fun).plist +++ b/Snippets/function (fun).plist @@ -3,8 +3,7 @@ content - function ${1:function_name} (${2:first_argument}) -{ + function ${1:function_name} (${2:argument}) { ${0:// body...} } name diff --git a/Snippets/function.tmSnippet b/Snippets/function.tmSnippet index 49cb8db..2a8cf77 100644 --- a/Snippets/function.tmSnippet +++ b/Snippets/function.tmSnippet @@ -3,7 +3,7 @@ content - function($1){${0:$TM_SELECTED_TEXT}}; + function($1) {${0:$TM_SELECTED_TEXT}}; name function(){}; scope diff --git a/Snippets/if ___ else.tmSnippet b/Snippets/if ___ else.tmSnippet index 672f4aa..421f45e 100644 --- a/Snippets/if ___ else.tmSnippet +++ b/Snippets/if ___ else.tmSnippet @@ -3,7 +3,7 @@ content - if(${1:true}){${0:$TM_SELECTED_TEXT}}else{}; + if (${1:true}) {${0:$TM_SELECTED_TEXT}} else{}; name if … else scope diff --git a/Snippets/if.tmSnippet b/Snippets/if.tmSnippet index 452efe9..dbfb7e7 100644 --- a/Snippets/if.tmSnippet +++ b/Snippets/if.tmSnippet @@ -3,7 +3,7 @@ content - if(${1:true}){${0:$TM_SELECTED_TEXT}}; + if (${1:true}) {${0:$TM_SELECTED_TEXT}}; name if scope diff --git a/Snippets/setTimeout function.tmSnippet b/Snippets/setTimeout function.tmSnippet index 04ce12a..5d9894e 100644 --- a/Snippets/setTimeout function.tmSnippet +++ b/Snippets/setTimeout function.tmSnippet @@ -3,7 +3,7 @@ content - setTimeout((function() {$0})${2:}, ${1:10}); + setTimeout(function() {$0}${2:}, ${1:10}); name setTimeout function scope diff --git a/info.plist b/info.plist index dfd09f5..9397618 100644 --- a/info.plist +++ b/info.plist @@ -10,13 +10,16 @@ ------------------------------------ F0E4FB6A-4878-48C6-A777-62438DF1E14F 2F96136B-0193-42F5-90FC-B6F456A3AD77 + 4C6EDB43-3E2E-411B-A016-13C135C59833 + 73951799-AC15-40A6-81DB-EC051AB4A033 + 1717B5AE-209B-4548-9155-9E88A7230C1C ------------------------------------ F19F3732-39A7-48EC-A72B-A8F477A01795 31964029-9D71-4ADC-8213-DFE5C4E222B3 011C4681-FBEC-4891-9326-3DECFCDED6D6 - 4C6EDB43-3E2E-411B-A016-13C135C59833 ------------------------------------ 009A3E6C-FE3F-4A18-8759-2DC31F17BBE2 + DC8B46FB-8ADA-45EA-8F36-94C807A0D302 submenus @@ -28,13 +31,16 @@ B4874A14-2491-465A-A349-61E4EBCF4700 F0E4FB6A-4878-48C6-A777-62438DF1E14F 2F96136B-0193-42F5-90FC-B6F456A3AD77 + 73951799-AC15-40A6-81DB-EC051AB4A033 + 1717B5AE-209B-4548-9155-9E88A7230C1C + 4C6EDB43-3E2E-411B-A016-13C135C59833 93E017CC-6F27-11D9-90EB-000D93589AF6 BC062860-3346-4D3B-8421-C5543F83D11F F19F3732-39A7-48EC-A72B-A8F477A01795 31964029-9D71-4ADC-8213-DFE5C4E222B3 - 4C6EDB43-3E2E-411B-A016-13C135C59833 011C4681-FBEC-4891-9326-3DECFCDED6D6 009A3E6C-FE3F-4A18-8759-2DC31F17BBE2 + DC8B46FB-8ADA-45EA-8F36-94C807A0D302 uuid AAB4FD74-73F9-11D9-B89A-000D93589AF6 From 704e02f030e0e077ece9afcf3fd0fadf91dd8d2c Mon Sep 17 00:00:00 2001 From: haraldmartin Date: Tue, 26 Sep 2006 15:50:54 +0000 Subject: [PATCH 054/243] =?UTF-8?q?=E2=80=A2=20Added=20a=20really=20handy?= =?UTF-8?q?=20snippet=20for=20all=20iteration=20methods.=20Instead=20of=20?= =?UTF-8?q?typing=20'each'=20and=20then=20=E2=87=A5=20(tab)=20to=20get=20t?= =?UTF-8?q?he=20each=20snippet,=20you=20now=20press=20=E2=87=A7=E2=8C=83?= =?UTF-8?q?=E2=8C=98(=20and=20you'll=20get=20the=20iterator=20function.=20?= =?UTF-8?q?Therefore=20this=20works=20for=20all=20iterator=20functions=20(?= =?UTF-8?q?inject,=20reject,=20each,=20map=20etc)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Moved more of the genreric JavaScript snippets (subtleGradient's?) from Prototype → JS bundle • Added whitespace around '=' and ':' in the Create Class alt snippet (we aren't afraid of whitespace, are we?) git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@5310 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Preferences/Symbol List Banned.tmPreferences | 17 +++++++++++ Preferences/Symbol List Class.tmPreferences | 21 ++++++++++++++ .../Symbol List Instance.tmPreferences | 21 ++++++++++++++ Preferences/Symbol List Sub 1.tmPreferences | 21 ++++++++++++++ Preferences/Symbol List Sub 2.tmPreferences | 21 ++++++++++++++ Snippets/Object Method String.tmSnippet | 18 ++++++++++++ Snippets/Object Method.tmSnippet | 18 ++++++++++++ Snippets/Object Value JS.tmSnippet | 16 +++++++++++ info.plist | 28 +++++++++++++++++-- 9 files changed, 178 insertions(+), 3 deletions(-) create mode 100644 Preferences/Symbol List Banned.tmPreferences create mode 100644 Preferences/Symbol List Class.tmPreferences create mode 100644 Preferences/Symbol List Instance.tmPreferences create mode 100644 Preferences/Symbol List Sub 1.tmPreferences create mode 100644 Preferences/Symbol List Sub 2.tmPreferences create mode 100644 Snippets/Object Method String.tmSnippet create mode 100644 Snippets/Object Method.tmSnippet create mode 100644 Snippets/Object Value JS.tmSnippet diff --git a/Preferences/Symbol List Banned.tmPreferences b/Preferences/Symbol List Banned.tmPreferences new file mode 100644 index 0000000..c51de2a --- /dev/null +++ b/Preferences/Symbol List Banned.tmPreferences @@ -0,0 +1,17 @@ + + + + + name + Symbol List Banned + scope + source.js meta.property.function entity.name.function + settings + + showInSymbolList + 0 + + uuid + 834BC727-6B31-4073-A161-4823227219EF + + diff --git a/Preferences/Symbol List Class.tmPreferences b/Preferences/Symbol List Class.tmPreferences new file mode 100644 index 0000000..50d8a7f --- /dev/null +++ b/Preferences/Symbol List Class.tmPreferences @@ -0,0 +1,21 @@ + + + + + name + Symbol List Class + scope + source.js entity.name.type.class + settings + + showInSymbolList + 1 + symbolTransformation + + s/^/• /g; + + + uuid + 3CEA49B2-A5C5-405C-82E2-B8B668877C37 + + diff --git a/Preferences/Symbol List Instance.tmPreferences b/Preferences/Symbol List Instance.tmPreferences new file mode 100644 index 0000000..55ebd5f --- /dev/null +++ b/Preferences/Symbol List Instance.tmPreferences @@ -0,0 +1,21 @@ + + + + + name + Symbol List Instance + scope + source.js entity.name.instance + settings + + showInSymbolList + 1 + symbolTransformation + + s/^/\t/g; + + + uuid + E6EB7CC8-04E8-43A9-93B2-BC9EF5BA862B + + diff --git a/Preferences/Symbol List Sub 1.tmPreferences b/Preferences/Symbol List Sub 1.tmPreferences new file mode 100644 index 0000000..28acc13 --- /dev/null +++ b/Preferences/Symbol List Sub 1.tmPreferences @@ -0,0 +1,21 @@ + + + + + name + Symbol List Sub 1 + scope + source.js object.property.function -(meta.group meta.group) + settings + + showInSymbolList + 1 + symbolTransformation + + s/^/ :/g; + + + uuid + 73557394-4F0F-4DD3-8029-EEE8201AC7F5 + + diff --git a/Preferences/Symbol List Sub 2.tmPreferences b/Preferences/Symbol List Sub 2.tmPreferences new file mode 100644 index 0000000..be4beb8 --- /dev/null +++ b/Preferences/Symbol List Sub 2.tmPreferences @@ -0,0 +1,21 @@ + + + + + name + Symbol List Sub 2 + scope + source.js meta.group meta.group object.property.function + settings + + showInSymbolList + 1 + symbolTransformation + + s/^/  :/g; + + + uuid + 51841DDB-C2A4-461C-A8AB-6C124AD50EAE + + diff --git a/Snippets/Object Method String.tmSnippet b/Snippets/Object Method String.tmSnippet new file mode 100644 index 0000000..8b7ec64 --- /dev/null +++ b/Snippets/Object Method String.tmSnippet @@ -0,0 +1,18 @@ + + + + + content + '${1:${2:#thing}:${3:click}}': function(element){ + $0 +}${10:,} + name + Object Method String + scope + source.js + tabTrigger + '':f + uuid + 7B9AEFCC-B450-416D-8527-430FE2A08568 + + diff --git a/Snippets/Object Method.tmSnippet b/Snippets/Object Method.tmSnippet new file mode 100644 index 0000000..5ee0d08 --- /dev/null +++ b/Snippets/Object Method.tmSnippet @@ -0,0 +1,18 @@ + + + + + content + ${1:method_name}: function(${3:attribute}){ + $0 +}${10:,} + name + Object Method + scope + source.js + tabTrigger + :f + uuid + 77065D69-742A-4FF0-9A41-AD211DFBE72F + + diff --git a/Snippets/Object Value JS.tmSnippet b/Snippets/Object Value JS.tmSnippet new file mode 100644 index 0000000..b741217 --- /dev/null +++ b/Snippets/Object Value JS.tmSnippet @@ -0,0 +1,16 @@ + + + + + content + ${1:value_name}:${0:value}, + name + Object Value JS + scope + source.js + tabTrigger + :, + uuid + AD506BEC-B33C-4168-A900-0A4D386A4B05 + + diff --git a/info.plist b/info.plist index 9397618..ab0aa41 100644 --- a/info.plist +++ b/info.plist @@ -18,16 +18,31 @@ 31964029-9D71-4ADC-8213-DFE5C4E222B3 011C4681-FBEC-4891-9326-3DECFCDED6D6 ------------------------------------ - 009A3E6C-FE3F-4A18-8759-2DC31F17BBE2 DC8B46FB-8ADA-45EA-8F36-94C807A0D302 + ------------------------------------ + 6E3C53BB-9F61-4299-8F4D-0A026BCCA975 submenus - + + 6E3C53BB-9F61-4299-8F4D-0A026BCCA975 + + items + + 009A3E6C-FE3F-4A18-8759-2DC31F17BBE2 + AD506BEC-B33C-4168-A900-0A4D386A4B05 + 77065D69-742A-4FF0-9A41-AD211DFBE72F + 7B9AEFCC-B450-416D-8527-430FE2A08568 + + name + Extras + + name JavaScript ordering + 77065D69-742A-4FF0-9A41-AD211DFBE72F B4874A14-2491-465A-A349-61E4EBCF4700 F0E4FB6A-4878-48C6-A777-62438DF1E14F 2F96136B-0193-42F5-90FC-B6F456A3AD77 @@ -36,11 +51,18 @@ 4C6EDB43-3E2E-411B-A016-13C135C59833 93E017CC-6F27-11D9-90EB-000D93589AF6 BC062860-3346-4D3B-8421-C5543F83D11F + 834BC727-6B31-4073-A161-4823227219EF + 3CEA49B2-A5C5-405C-82E2-B8B668877C37 + E6EB7CC8-04E8-43A9-93B2-BC9EF5BA862B + 73557394-4F0F-4DD3-8029-EEE8201AC7F5 + 51841DDB-C2A4-461C-A8AB-6C124AD50EAE F19F3732-39A7-48EC-A72B-A8F477A01795 31964029-9D71-4ADC-8213-DFE5C4E222B3 011C4681-FBEC-4891-9326-3DECFCDED6D6 - 009A3E6C-FE3F-4A18-8759-2DC31F17BBE2 + AD506BEC-B33C-4168-A900-0A4D386A4B05 DC8B46FB-8ADA-45EA-8F36-94C807A0D302 + 009A3E6C-FE3F-4A18-8759-2DC31F17BBE2 + 7B9AEFCC-B450-416D-8527-430FE2A08568 uuid AAB4FD74-73F9-11D9-B89A-000D93589AF6 From d60113b0ba99ef6a12d9e18b979f36af2378bb6b Mon Sep 17 00:00:00 2001 From: msheets Date: Thu, 5 Oct 2006 02:56:50 +0000 Subject: [PATCH 055/243] =?UTF-8?q?=E2=80=A2=20Added=20puctuation=20scopes?= =?UTF-8?q?.=20=E2=80=A2=20Change=20meta.delimiter.statement=20to=20punctu?= =?UTF-8?q?ation.terminator.statement=20=E2=80=A2=20Better=20scope=20strin?= =?UTF-8?q?gs=20in=20meta.function.json=20=E2=80=A2=20Optimize=20a=20few?= =?UTF-8?q?=20of=20the=20larger=20regex=20matches.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@5373 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 181 +++++++++++++++++++++++++++++++++----- 1 file changed, 157 insertions(+), 24 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 1478603..8a5b4de 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -64,15 +64,25 @@ storage.type.function.js 5 + + name + punctuation.definition.parameters.begin.js + + 6 name variable.parameter.function.js + 7 + + name + punctuation.definition.parameters.end.js + comment match stuff like: Sound.prototype.play = function() { … } match - ([a-zA-Z_?\.$]+\w*)\.(prototype)\.([a-zA-Z_?\.$]+\w*)\s*=\s*(function)?\s*\((.*?)\) + ([a-zA-Z_?\.$]+\w*)\.(prototype)\.([a-zA-Z_?\.$]+\w*)\s*=\s*(function)?\s*(\()(.*?)(\)) name meta.function.prototype.js @@ -142,15 +152,25 @@ storage.type.function.js 5 + + name + punctuation.definition.parameters.begin.js + + 6 name variable.parameter.function.js + 7 + + name + punctuation.definition.parameters.end.js + comment match stuff like: Sound.play = function() { … } or play = function() { … } match - ([a-zA-Z_?\.\$]+\w*)(\.([a-zA-Z_?\.\$]+\w*))?\s*=\s*(function)?\s*\((.*?)\) + ([a-zA-Z_?\.\$]+\w*)(\.([a-zA-Z_?\.\$]+\w*))?\s*=\s*(function)?\s*(\()(.*?)(\)) name meta.function.js @@ -168,15 +188,25 @@ entity.name.function.js 3 + + name + punctuation.definition.parameters.begin.js + + 4 name variable.parameter.function.js + 5 + + name + punctuation.definition.parameters.end.js + comment match regular function like: function myFunc(arg) { … } match - \b(function)\s+([a-zA-Z_$]\w*)?\s*\((.*?)\) + \b(function)\s+([a-zA-Z_$]\w*)?\s*(\()(.*?)(\)) name meta.function.js @@ -194,15 +224,25 @@ storage.type.function.js 3 + + name + punctuation.definition.parameters.begin.js + + 4 name variable.parameter.function.js + 5 + + name + punctuation.definition.parameters.end.js + 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.json.js @@ -212,28 +252,68 @@ 1 name - string.quoted.js + string.quoted.single.js + + 10 + + name + punctuation.definition.parameters.begin.js + + 11 + + name + variable.parameter.function.js + + 12 + + name + punctuation.definition.parameters.end.js + + 2 + + name + punctuation.definition.string.begin.js 3 name object.property.function.js + 4 + + name + punctuation.definition.string.end.js + 5 name - entity.name.function.js + string.quoted.double.js 6 name - variable.parameter.function.js + punctuation.definition.string.begin.js + + 7 + + name + object.property.function.js + + 8 + + name + punctuation.definition.string.end.js + + 9 + + name + entity.name.function.js comment Attempt to match "foo": function match - (('|")(.*?)(\2))\s*:\s*\b(function)?\s*\((.*?)\) + (?:((')(.*?)('))|((")(.*?)(")))\s*:\s*\b(function)?\s*(\()(.*?)(\)) name meta.function.json.js @@ -277,18 +357,26 @@ begin ' - captures + beginCaptures 0 name - string.quoted.single.brace.js + punctuation.definition.string.begin.js contentName string.quoted.single.js end ' + endCaptures + + 0 + + name + punctuation.definition.string.end.js + + patterns @@ -302,18 +390,26 @@ begin " - captures + beginCaptures 0 name - string.quoted.double.brace.js + punctuation.definition.string.begin.js - contentName - string.quoted.double.js end " + endCaptures + + 0 + + name + punctuation.definition.string.end.js + + + name + string.quoted.double.js patterns @@ -332,7 +428,7 @@ 0 name - meta.brace.comment.block.js + punctuation.definition.comment.js end @@ -341,12 +437,33 @@ comment.block.js + captures + + 1 + + name + punctuation.definition.comment.js + + match - //.*$\n? + (//).*$\n? name comment.line.double-slash.js + captures + + 0 + + name + punctuation.definition.comment.html.js + + 2 + + name + punctuation.definition.comment.html.js + + match (<!--|-->) name @@ -402,25 +519,25 @@ match - \b(abort|abs|acos|alert|anchor|apply|asin|atan|atan2|atob|attachEvent|back|big|blink|bold|borderWidths|btoa|call|captureEvents|ceil|charAt|charCodeAt|clear|clearInterval|clearTimeout|compile|concat|confirm|contextual|cos|createEventObject|createPopup|createStyleSheet|detachEvent|disableExternalCapture|dump|elementFromPoint|enableExternalCapture|escape|eval|exec|execCommand|execScript|exp|fileCreatedDate|fileModifiedDate|fileSize|fileUpdatedDate|find|fixed|floor|fontcolor|fontsize|fromCharCode|forward|getAllResponseHeaders|getAttention|getDate|getDay|getFullYear|getHours|getMilliseconds|getMinutes|getMonth|getResponseHeader|getSeconds|getSelection|getTime|getTimezoneOffset|getUTCDate|getUTCDay|getUTCFullYear|getUTCHours|getUTCMilliseconds|getUTCMinutes|getUTCMonth|getUTCSeconds|getYear|go|handleEvent|home|indexOf|isFinite|isNaN|italics|javaEnabled|join|lastIndexOf|link|load|log|margins|match|max|mergeAttributes|min|moveAbove|moveBelow|moveBy|moveTo|moveToAbsolute|navigate|paddings|parse|parseFloat|parseInt|plugins.refresh|pop|pow|preference|print|prompt|push|queryCommandEnabled|queryCommandIndeterm|queryCommandState|queryCommandValue|random|recalc|releaseCapture|releaseEvents|reload|replace|resizeBy|resizeTo|returnValue|reverse|round|routeEvents|savePreferences|scroll|scrollBy|scrollByLines|scrollByPages|scrollTo|scrollX|scrollY|search|send|setDate|setFullYear|setActive|setCursor|setHotKeys|setHours|setInterval|setMilliseconds|setMinutes|setMonth|setResizable|setRequestHeader|setSeconds|setTime|setTimeout|setUTCDate|setUTCFullYear|setUTCHours|setUTCMilliseconds|setUTCMinutes|setUTCMonth|setUTCSeconds|setYear|setZOptions|shift|showHelp|showModalDialog|showModelessDialog|sidebar|sin|signText|sizeToContent|slice|small|sort|splice|split|sqrt|strike|stop|sub|substr|substring|sup|taint|taintEnabled|tan|test|toGMTString|toLocaleString|toLowerCase|toSource|toString|toUpperCase|toUTCString|UTC|unescape|unshift|untaint|updateCommands|unwatch|valueOf|watch)\b(?=\() + \b(s(h(ift|ow(Mod(elessDialog|alDialog)|Help))|croll(X|By(Pages|Lines)?|Y|To)?|t(op|rike)|i(n|zeToContent|debar|gnText)|ort|u(p|b(str(ing)?)?)|pli(ce|t)|e(nd|t(Re(sizable|questHeader)|M(i(nutes|lliseconds)|onth)|Seconds|Ho(tKeys|urs)|Year|Cursor|Time(out)?|Interval|ZOptions|Date|UTC(M(i(nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(ome|andleEvent)|navigate|c(har(CodeAt|At)|o(s|n(cat|textual|firm)|mpile)|eil|lear(Timeout|Interval)?|a(ptureEvents|ll)|reate(StyleSheet|Popup|EventObject))|t(o(GMTString|S(tring|ource)|U(TCString|pperCase)|Lo(caleString|werCase))|est|a(n|int(Enabled)?))|i(s(NaN|Finite)|ndexOf|talics)|d(isableExternalCapture|ump|etachEvent)|u(n(shift|taint|escape|watch)|pdateCommands)|j(oin|avaEnabled)|p(o(p|w)|ush|lugins.refresh|a(ddings|rse(Int|Float)?)|r(int|ompt|eference))|e(scape|nableExternalCapture|val|lementFromPoint|x(p|ec(Script|Command)?))|valueOf|UTC|queryCommand(State|Indeterm|Enabled|Value)|f(i(nd|le(ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(nt(size|color)|rward)|loor|romCharCode)|watch|l(ink|o(ad|g)|astIndexOf)|a(sin|nchor|cos|t(tachEvent|ob|an(2)?)|pply|lert|b(s|ort))|r(ou(nd|teEvents)|e(size(By|To)|calc|turnValue|place|verse|l(oad|ease(Capture|Events)))|andom)|g(o|et(ResponseHeader|M(i(nutes|lliseconds)|onth)|Se(conds|lection)|Hours|Year|Time(zoneOffset)?|Da(y|te)|UTC(M(i(nutes|lliseconds)|onth)|Seconds|Hours|Da(y|te)|FullYear)|FullYear|A(ttention|llResponseHeaders)))|m(in|ove(B(y|elow)|To(Absolute)?|Above)|ergeAttributes|a(tch|rgins|x))|b(toa|ig|o(ld|rderWidths)|link|ack))\b(?=\() name support.function.js match - \b(add|appendChild|appendData|blur|cloneNode|close|click|createAttribute|createCaption|createCDATASection|createComment|createDocumentFragment|createElement|createEntityReference|createTextNode|createTFoot|createTHead|createProcessingInstruction|deleteCaption|deleteCell|deleteData|deleteRow|deleteTFoot|deleteTHead|focus|getElementById|getElementsByName|getElementsByTagName|getAttributeNode|getAttribute|getNamedItem|insertBefore|insertCell|insertData|insertRow|item|hasChildNodes|hasFeature|namedItem|open|remove|removeAttributeNode|removeAttribute|removeChild|removeNamedItem|replaceChild|replaceData|reset|select|setAttributeNode|setAttribute|setNamedItem|splitText|submit|substringData|tabIndex|write|writeln)\b(?=\() + \b(s(ub(stringData|mit)|plitText|e(t(NamedItem|Attribute(Node)?)|lect))|has(ChildNodes|Feature)|namedItem|c(l(ick|o(se|neNode))|reate(C(omment|DATASection|aption)|T(Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(ntityReference|lement)|Attribute))|tabIndex|i(nsert(Row|Before|Cell|Data)|tem)|open|delete(Row|C(ell|aption)|T(Head|Foot)|Data)|focus|write(ln)?|a(dd|ppend(Child|Data))|re(set|place(Child|Data)|move(NamedItem|Child|Attribute(Node)?)?)|get(NamedItem|Element(sBy(Name|TagName)|ById)|Attribute(Node)?)|blur)\b(?=\() name support.function.dom.js match - (?<=\.)(_content|above|aLinkcolor|all|appCodeName|appCore|appMinorVersion|appName|appVersion|arguments|arity|availHeight|availLeft|availTop|availWidth|backgroundColor|backgroundImage|below|borderBottomWidth|borderColor|borderLeftWidth|borderRightWidth|borderStyle|borderTopWidth|bottom|bufferDepth|callee|caller|characterSet|classes|clientInformation|clipboardData|clip|closed|colorDepth|complete|components|constructor|controllers|cookieEnabled|cpuClass|crypto|current|defaultCharset|defaultChecked|defaultStatus|defaultView|description|dialogArguments|dialogHeight|dialogLeft|dialogTop|dialogWidth|directories|display|E|embeds|enabledPlugin|encoding|expando|external|fgColor|filename|fontFamily|fontSize|fontWeight|formName|frameElement|frames|global|hasFocus|hash|history|hostname|host|ids|ignoreCase|input|innerHeight|innerWidth|LN10|LN2|LOG10E|LOG2E|language|lastIndex|lastMatch|lastModified|lastParen|layers|layerX|leftContext|left|length|lineHeight|linkColor|listStyleType|localName|locationbar|location|lowsrc|MAX_VALUE|MIN_VALUE|marginBottom|marginLeft|marginRight|marginTop|menubar|mimeTypes|multiline|NEGATIVE_INFINITY|nameProp|namespaces|namespaceURI|next|offscreenBuffering|onLine|onreadystatechange|opener|opsProfile|oscpu|outerHeight|outerWidth|POSITIVE_INFINITY|PI|paddingBottom|paddingLeft|paddingRight|paddingTop|pageXOffset|pageYOffset|pageX|pageY|parentLayer|parentWindow|parent|pathname|personalbar|pixelDepth|platform|plugins|pkcs11|port|prefix|previous|productSub|product|prompter|protocol|prototype|readyState|responseText|responseXML|rightContext|right|SQRT1_2|SQRT2|screenLeft|screenTop|screenX|screenY|scripts|scrollbars|securityPolicy|security|selection|self|siblingAbove|siblingBelow|source|statusbar|statusText|status|style|styleSheets|suffixes|systemLanguage|tags|textAlign|textDecoration|textIndent|textTransform|toolbar|top|URLUnencoded|undefined|uniqueID|updateInterval|userAgent|userLanguage|userProfile|vendorSub|vendor|visibility|vLinkcolor|whiteSpace|XMLDocument|XSLDocument|x|y|zIndex)\b + (?<=\.)(s(ystemLanguage|cr(ipts|ollbars|een(X|Y|Top|Left))|t(yle(Sheets)?|atus(Text|bar)?)|ibling(Below|Above)|ource|uffixes|e(curity(Policy)?|l(ection|f)))|h(istory|ost(name)?|as(h|Focus))|y|X(MLDocument|SLDocument)|n(ext|ame(space(s|URI)|Prop))|M(IN_VALUE|AX_VALUE)|c(haracterSet|o(n(structor|trollers)|okieEnabled|lorDepth|mp(onents|lete))|urrent|puClass|l(i(p(boardData)?|entInformation)|osed|asses)|alle(e|r)|rypto)|t(o(olbar|p)|ext(Transform|Indent|Decoration|Align)|ags)|SQRT(1_2|2)|i(n(ner(Height|Width)|put)|ds|gnoreCase)|zIndex|o(scpu|n(readystatechange|Line)|uter(Height|Width)|p(sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(i(splay|alog(Height|Top|Width|Left|Arguments)|rectories)|e(scription|fault(Status|Ch(ecked|arset)|View)))|u(ser(Profile|Language|Agent)|n(iqueID|defined)|pdateInterval)|_content|p(ixelDepth|ort|ersonalbar|kcs11|l(ugins|atform)|a(thname|dding(Right|Bottom|Top|Left)|rent(Window|Layer)?|ge(X(Offset)?|Y(Offset)?))|r(o(to(col|type)|duct(Sub)?|mpter)|e(vious|fix)))|e(n(coding|abledPlugin)|x(ternal|pando)|mbeds)|v(isibility|endor(Sub)?|Linkcolor)|URLUnencoded|P(I|OSITIVE_INFINITY)|f(ilename|o(nt(Size|Family|Weight)|rmName)|rame(s|Element)|gColor)|E|whiteSpace|l(i(stStyleType|n(eHeight|kColor))|o(ca(tion(bar)?|lName)|wsrc)|e(ngth|ft(Context)?)|a(st(M(odified|atch)|Index|Paren)|yer(s|X)|nguage))|a(pp(MinorVersion|Name|Co(deName|re)|Version)|vail(Height|Top|Width|Left)|ll|r(ity|guments)|Linkcolor|bove)|r(ight(Context)?|e(sponse(XML|Text)|adyState))|global|x|m(imeTypes|ultiline|enubar|argin(Right|Bottom|Top|Left))|L(N(10|2)|OG(10E|2E))|b(o(ttom|rder(RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(Color|Image)))\b name support.constant.js match - (?<=\.)(abbr|accept|acceptCharset|accessKey|action|aLink|align|alt|anchors|applets|areas|archive|attributes|axis|background|bgColor|body|border|caption|charset|cellPadding|cells|cellSpacing|ch|checked|childNodes|chOff|cite|className|clear|colSpan|code|codeBase|codeType|color|cols|compact|content|cookie|coords|data|dateTime|declare|defaultChecked|defaultSelected|defaultValue|defer|dir|disabled|doctype|documentElement|domain|elements|enctype|entities|event|face|firstChild|form|forms|frame|frameBorder|headers|height|hspace|href|hreflang|htmlFor|httpEquiv|id|images|implementation|index|isMap|label|lang|lastChild|link|links|longDesc|lowSrc|maxLength|marginHeight|marginWidth|media|method|multiple|name|nextSibling|nodeName|nodeType|nodeValue|noHref|noResize|noShade|notationName|notations|noWrap|object|options|ownerDocument|parentNode|previousSibling|profile|prompt|publicId|readOnly|rel|referrer|rev|rowIndex|rows|rowSpan|rules|scheme|scope|scrolling|sectionRowIndex|selected|selectedIndex|shape|size|specified|src|standby|start|summary|systemId|tagName|target|text|tBodies|tFoot|tHead|title|type|URL|useMap|vAlign|value|valueType|version|vLink|vspace|width)\b + (?<=\.)(s(hape|ystemId|c(heme|ope|rolling)|ta(ndby|rt)|ize|ummary|pecified|e(ctionRowIndex|lected(Index)?)|rc)|h(space|t(tpEquiv|mlFor)|e(ight|aders)|ref(lang)?)|n(o(Resize|tation(s|Name)|Shade|Href|de(Name|Type|Value)|Wrap)|extSibling|ame)|c(h(ildNodes|Off|ecked|arset)?|ite|o(ntent|o(kie|rds)|de(Base|Type)?|l(s|Span|or)|mpact)|ell(s|Spacing|Padding)|l(ear|assName)|aption)|t(ype|Bodies|itle|Head|ext|a(rget|gName)|Foot)|i(sMap|ndex|d|m(plementation|ages))|o(ptions|wnerDocument|bject)|d(i(sabled|r)|o(c(type|umentElement)|main)|e(clare|f(er|ault(Selected|Checked|Value)))|at(eTime|a))|useMap|p(ublicId|arentNode|r(o(file|mpt)|eviousSibling))|e(n(ctype|tities)|vent|lements)|v(space|ersion|alue(Type)?|Link|Align)|URL|f(irstChild|orm(s)?|ace|rame(Border)?)|width|l(ink(s)?|o(ngDesc|wSrc)|a(stChild|ng|bel))|a(nchors|c(ce(ssKey|pt(Charset)?)|tion)|ttributes|pplets|l(t|ign)|r(chive|eas)|xis|Link|bbr)|r(ow(s|Span|Index)|ules|e(v|ferrer|l|adOnly))|m(ultiple|e(thod|dia)|a(rgin(Height|Width)|xLength))|b(o(dy|rder)|ackground|gColor))\b name support.constant.dom.js @@ -432,7 +549,7 @@ match - \b(onAbort|onActivate|onAfterprint|onAfterupdate|onBeforeactivate|onBeforecut|onBeforedeactivate|onBeforeeditfocus|onBeforepaste|onBeforeprint|onBeforeunload|onBeforeupdate|onBlur|onCellchange|onChange|onClick|onClose|onContextmenu|onControlselect|onCut|onDataavailable|onDatasetchanged|onDatasetcomplete|onDblclick|onDeactivate|onDrag|onDragdrop|onDragend|onDragenter|onDragleave|onDragover|onDragstart|onDrop|onError|onErrorupdate|onFocus|onHelp|onHover|onKeydown|onKeypress|onKeyup|onLoad|onMousedown|onMousemove|onMouseout|onMouseover|onMouseup|onPaste|onPropertychange|onReadystatechange|onReset|onResize|onResizeend|onResizestart|onRowenter|onRowexit|onRowsdelete|onRowsinserted|onScroll|onSelect|onSelectionchange|onSelectstart|onStop|onSubmit|onUnload)\b + \bon(R(ow(s(inserted|delete)|e(nter|xit))|e(s(ize(start|end)?|et)|adystatechange))|Mouse(o(ut|ver)|down|up|move)|B(efore(cut|deactivate|u(nload|pdate)|p(aste|rint)|editfocus|activate)|lur)|S(croll|top|ubmit|elect(start|ionchange)?)|H(over|elp)|C(hange|ont(extmenu|rolselect)|ut|ellchange|l(ick|ose))|D(eactivate|ata(setc(hanged|omplete)|available)|r(op|ag(start|over|drop|en(ter|d)|leave)?)|blclick)|Unload|P(aste|ropertychange)|Error(update)?|Key(down|up|press)|Focus|Load|A(ctivate|fter(update|print)|bort))\b name support.function.event-handler.js @@ -450,9 +567,25 @@ begin - (?<=[=(:]|^)\s*/(?![/*+{}?]) + (?<=[=(:]|^)\s*(/)(?![/*+{}?]) + beginCaptures + + 1 + + name + punctuation.definition.string.begin.js + + end - /[igm]* + (/)[igm]* + endCaptures + + 1 + + name + punctuation.definition.string.end.js + + name string.regexp.js patterns @@ -469,7 +602,7 @@ match \; name - meta.delimiter.statement.semicolon.js + punctuation.terminator.statement.js match From 6fef2d6b80275ff1fbfb0844b299c45bed5f4818 Mon Sep 17 00:00:00 2001 From: msheets Date: Thu, 26 Oct 2006 20:39:09 +0000 Subject: [PATCH 056/243] Add more specific scopes for true|false|null: constant.language.boolean.true.js, constant.language.boolean.false.js, constant.language.null.js From james on the mailing list. git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@5650 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 8a5b4de..d2773fe 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -495,9 +495,21 @@ match - \b(false|null|true)\b + \btrue\b name - constant.language.js + constant.language.boolean.true.js + + + match + \bfalse\b + name + constant.language.boolean.false.js + + + match + \bnull\b + name + constant.language.null.js match From 5fdf24b4faea8de4dbe5c22085113c4c1d00c510 Mon Sep 17 00:00:00 2001 From: cskiadas Date: Sun, 29 Oct 2006 19:52:42 +0000 Subject: [PATCH 057/243] First attempt at rearranging. Added getElement snippet. git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@5720 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Snippets/Get Elements.tmSnippet | 16 +++++++ Snippets/function.tmSnippet | 2 +- info.plist | 81 ++++++++++++++++++++++++++------- 3 files changed, 81 insertions(+), 18 deletions(-) create mode 100644 Snippets/Get Elements.tmSnippet diff --git a/Snippets/Get Elements.tmSnippet b/Snippets/Get Elements.tmSnippet new file mode 100644 index 0000000..3031d9f --- /dev/null +++ b/Snippets/Get Elements.tmSnippet @@ -0,0 +1,16 @@ + + + + + content + getElement${1/(T)|.*/(?1:s)/}By${1:T}${1/(T)|(I)|.*/(?1:agName)(?2:d)/}('$2') + name + Get Elements + scope + source.js + tabTrigger + get + uuid + 9E0E3BCC-7F20-4D6B-891D-A44D6EC56E31 + + diff --git a/Snippets/function.tmSnippet b/Snippets/function.tmSnippet index 2a8cf77..8a3cf1e 100644 --- a/Snippets/function.tmSnippet +++ b/Snippets/function.tmSnippet @@ -5,7 +5,7 @@ content function($1) {${0:$TM_SELECTED_TEXT}}; name - function(){}; + Anonymous Function scope source.js tabTrigger diff --git a/info.plist b/info.plist index ab0aa41..edf11eb 100644 --- a/info.plist +++ b/info.plist @@ -6,35 +6,82 @@ items - B4874A14-2491-465A-A349-61E4EBCF4700 - ------------------------------------ - F0E4FB6A-4878-48C6-A777-62438DF1E14F - 2F96136B-0193-42F5-90FC-B6F456A3AD77 - 4C6EDB43-3E2E-411B-A016-13C135C59833 - 73951799-AC15-40A6-81DB-EC051AB4A033 - 1717B5AE-209B-4548-9155-9E88A7230C1C - ------------------------------------ - F19F3732-39A7-48EC-A72B-A8F477A01795 - 31964029-9D71-4ADC-8213-DFE5C4E222B3 - 011C4681-FBEC-4891-9326-3DECFCDED6D6 + D2E6A1FE-2881-4754-B399-B65F61F29C2F + 43F40EB6-5839-4BE8-99C8-4976D0534E5D + 52090C49-D8B2-49A0-9597-80574354B3CD ------------------------------------ - DC8B46FB-8ADA-45EA-8F36-94C807A0D302 - ------------------------------------ - 6E3C53BB-9F61-4299-8F4D-0A026BCCA975 + B4874A14-2491-465A-A349-61E4EBCF4700 submenus - 6E3C53BB-9F61-4299-8F4D-0A026BCCA975 + 43F40EB6-5839-4BE8-99C8-4976D0534E5D + + items + + 9E0E3BCC-7F20-4D6B-891D-A44D6EC56E31 + + name + DOM + + 52090C49-D8B2-49A0-9597-80574354B3CD items 009A3E6C-FE3F-4A18-8759-2DC31F17BBE2 - AD506BEC-B33C-4168-A900-0A4D386A4B05 + + name + BOM + + 66778C58-CE08-4F21-AD36-562149AEEE80 + + items + + 4C6EDB43-3E2E-411B-A016-13C135C59833 + F0E4FB6A-4878-48C6-A777-62438DF1E14F + ------------------------------------ + 73951799-AC15-40A6-81DB-EC051AB4A033 + 1717B5AE-209B-4548-9155-9E88A7230C1C + ------------------------------------ 77065D69-742A-4FF0-9A41-AD211DFBE72F 7B9AEFCC-B450-416D-8527-430FE2A08568 name - Extras + Function + + 7699AC1A-80AC-4120-A375-9371D1591F79 + + items + + F19F3732-39A7-48EC-A72B-A8F477A01795 + 31964029-9D71-4ADC-8213-DFE5C4E222B3 + ------------------------------------ + 011C4681-FBEC-4891-9326-3DECFCDED6D6 + + name + Control + + D2E6A1FE-2881-4754-B399-B65F61F29C2F + + items + + 7699AC1A-80AC-4120-A375-9371D1591F79 + EC690F46-1906-4F55-9089-3C2929D5BB69 + 66778C58-CE08-4F21-AD36-562149AEEE80 + + name + Core + + EC690F46-1906-4F55-9089-3C2929D5BB69 + + items + + DC8B46FB-8ADA-45EA-8F36-94C807A0D302 + AD506BEC-B33C-4168-A900-0A4D386A4B05 + ------------------------------------ + 2F96136B-0193-42F5-90FC-B6F456A3AD77 + + name + Language From bb4b016f3251e10994d151c73b8db360f8cb0849 Mon Sep 17 00:00:00 2001 From: msheets Date: Sun, 29 Oct 2006 20:27:04 +0000 Subject: [PATCH 058/243] =?UTF-8?q?=E2=80=A2=20Change=20entity.name.object?= =?UTF-8?q?.js.firebug=20to=20entity.name.type.object.js.firebug=20?= =?UTF-8?q?=E2=80=A2=20Change=20entity.name.instance=20to=20entity.name.ty?= =?UTF-8?q?pe.instance?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@5728 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index d2773fe..469af15 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -328,7 +328,7 @@ 2 name - entity.name.instance.js + entity.name.type.instance.js match @@ -340,7 +340,7 @@ match \b(console)\b name - entity.name.object.js.firebug + entity.name.type.object.js.firebug match From 82f10d6ae36105f4efa0c2640c9c45b861f73488 Mon Sep 17 00:00:00 2001 From: msheets Date: Tue, 7 Nov 2006 22:05:57 +0000 Subject: [PATCH 059/243] Include the delimiters in the string.quoted.single scope rather than just the content. git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@5998 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 469af15..456ab49 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -365,8 +365,6 @@ punctuation.definition.string.begin.js - contentName - string.quoted.single.js end ' endCaptures @@ -377,6 +375,8 @@ punctuation.definition.string.end.js + name + string.quoted.single.js patterns From 1d19d9c16972546ccbf2e37565792a4fc29e1c98 Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Tue, 28 Nov 2006 03:07:25 +0000 Subject: [PATCH 060/243] Remove the rule that incorrectly turns anything with a dot before an = into a class. this grammar still needs some serious work imho. git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@6257 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 456ab49..58f4aa1 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -112,27 +112,6 @@ 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 From f7e26af2b95d4676b947239d1f389a25f61d04f2 Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Tue, 28 Nov 2006 05:53:13 +0000 Subject: [PATCH 061/243] http://pastie.textmate.org/24618 Javascript commenting should use // method like with PHP, not /* ... */ Now it does. Yay comments! git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@6258 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Preferences/Comments.tmPreferences | 36 ++++++++++++++++++++++++++++++ info.plist | 2 ++ 2 files changed, 38 insertions(+) create mode 100644 Preferences/Comments.tmPreferences diff --git a/Preferences/Comments.tmPreferences b/Preferences/Comments.tmPreferences new file mode 100644 index 0000000..02e5f2e --- /dev/null +++ b/Preferences/Comments.tmPreferences @@ -0,0 +1,36 @@ + + + + + name + Comments + scope + source.js + settings + + shellVariables + + + name + TM_COMMENT_START + value + // + + + name + TM_COMMENT_START_3 + value + /* + + + name + TM_COMMENT_END_3 + value + */ + + + + uuid + A67A8BD9-A951-406F-9175-018DD4B52FD1 + + diff --git a/info.plist b/info.plist index edf11eb..bba3a77 100644 --- a/info.plist +++ b/info.plist @@ -97,6 +97,7 @@ 1717B5AE-209B-4548-9155-9E88A7230C1C 4C6EDB43-3E2E-411B-A016-13C135C59833 93E017CC-6F27-11D9-90EB-000D93589AF6 + A67A8BD9-A951-406F-9175-018DD4B52FD1 BC062860-3346-4D3B-8421-C5543F83D11F 834BC727-6B31-4073-A161-4823227219EF 3CEA49B2-A5C5-405C-82E2-B8B668877C37 @@ -110,6 +111,7 @@ DC8B46FB-8ADA-45EA-8F36-94C807A0D302 009A3E6C-FE3F-4A18-8759-2DC31F17BBE2 7B9AEFCC-B450-416D-8527-430FE2A08568 + 9E0E3BCC-7F20-4D6B-891D-A44D6EC56E31 uuid AAB4FD74-73F9-11D9-B89A-000D93589AF6 From 494487abe6cd43edaee5f9bfe52d42653f88e8bc Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Tue, 12 Dec 2006 21:11:31 +0000 Subject: [PATCH 062/243] Fix for javascript "fred = (whatever)" being considered a function git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@6341 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 58f4aa1..23e7df1 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -149,7 +149,7 @@ comment match stuff like: Sound.play = function() { … } or play = function() { … } match - ([a-zA-Z_?\.\$]+\w*)(\.([a-zA-Z_?\.\$]+\w*))?\s*=\s*(function)?\s*(\()(.*?)(\)) + ([a-zA-Z_?\.\$]+\w*)(\.([a-zA-Z_?\.\$]+\w*))?\s*=\s*(function)\s*(\()(.*?)(\)) name meta.function.js From 8918fc038063f51e149fce0962afe0aafa119b27 Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Sat, 3 Feb 2007 07:52:40 +0000 Subject: [PATCH 063/243] Added the "Improved Native For-Loop" snippet from http://solutoire.com/2007/02/02/efficient-looping-in-javascript/ git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@6518 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- ...200\246) {\342\200\246} (faster).tmSnippet" | 18 ++++++++++++++++++ info.plist | 2 ++ 2 files changed, 20 insertions(+) create mode 100644 "Snippets/for (\342\200\246) {\342\200\246} (faster).tmSnippet" diff --git "a/Snippets/for (\342\200\246) {\342\200\246} (faster).tmSnippet" "b/Snippets/for (\342\200\246) {\342\200\246} (faster).tmSnippet" new file mode 100644 index 0000000..2f5aa00 --- /dev/null +++ "b/Snippets/for (\342\200\246) {\342\200\246} (faster).tmSnippet" @@ -0,0 +1,18 @@ + + + + + content + for (var ${20:i} = ${1:Things}.length - 1; ${20:i} >= 0; ${20:i}–){ + ${100:${1:Things}[${20:i}]}$0 +}; + name + for (…) {…} (Improved Native For-Loop) + scope + source.js + tabTrigger + forf + uuid + C207B7C3-5597-4873-8AAD-C46FB8842AF2 + + diff --git a/info.plist b/info.plist index bba3a77..bf8c19f 100644 --- a/info.plist +++ b/info.plist @@ -56,6 +56,7 @@ 31964029-9D71-4ADC-8213-DFE5C4E222B3 ------------------------------------ 011C4681-FBEC-4891-9326-3DECFCDED6D6 + C207B7C3-5597-4873-8AAD-C46FB8842AF2 name Control @@ -107,6 +108,7 @@ F19F3732-39A7-48EC-A72B-A8F477A01795 31964029-9D71-4ADC-8213-DFE5C4E222B3 011C4681-FBEC-4891-9326-3DECFCDED6D6 + C207B7C3-5597-4873-8AAD-C46FB8842AF2 AD506BEC-B33C-4168-A900-0A4D386A4B05 DC8B46FB-8ADA-45EA-8F36-94C807A0D302 009A3E6C-FE3F-4A18-8759-2DC31F17BBE2 From dcb51d605c6e8ec2c31769ea2bb819cc76d07735 Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Fri, 9 Feb 2007 15:37:15 +0000 Subject: [PATCH 064/243] Fixed bad copy/paste. It was an em-dash not a -- :/ git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@6542 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- "Snippets/for (\342\200\246) {\342\200\246} (faster).tmSnippet" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/Snippets/for (\342\200\246) {\342\200\246} (faster).tmSnippet" "b/Snippets/for (\342\200\246) {\342\200\246} (faster).tmSnippet" index 2f5aa00..d680d23 100644 --- "a/Snippets/for (\342\200\246) {\342\200\246} (faster).tmSnippet" +++ "b/Snippets/for (\342\200\246) {\342\200\246} (faster).tmSnippet" @@ -3,7 +3,7 @@ content - for (var ${20:i} = ${1:Things}.length - 1; ${20:i} >= 0; ${20:i}–){ + for (var ${20:i} = ${1:Things}.length - 1; ${20:i} >= 0; ${20:i}--){ ${100:${1:Things}[${20:i}]}$0 }; name From 9ec26daccca3401fd5fe64245b12a335d8b8e4ed Mon Sep 17 00:00:00 2001 From: duff Date: Tue, 13 Feb 2007 04:48:32 +0000 Subject: [PATCH 065/243] =?UTF-8?q?=E2=80=A2=20recognize=20documentation?= =?UTF-8?q?=20comments=20(/**=20=E2=80=A6=20*/)=20=E2=80=94=20patch=20from?= =?UTF-8?q?=20Dave=20Grijalva?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@6575 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 23e7df1..d4c213d 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -399,6 +399,22 @@ + + begin + /\*\* + captures + + 0 + + name + punctuation.definition.comment.js + + + end + \*/ + name + comment.block.documentation.js + begin /\* From 0539e44989dbc293e039ed0643d73666854d34d8 Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Thu, 15 Feb 2007 04:34:38 +0000 Subject: [PATCH 066/243] =?UTF-8?q?Removed=20old=20bas=20scope=20Set=20?= =?UTF-8?q?=E2=8C=A5=E2=87=A7:=20as=20the=20shortcut=20for=20object=20keys?= =?UTF-8?q?=20Set=20the=20trigger=20for=20"for=20faster"=20to=20"for"=20to?= =?UTF-8?q?=20get=20the=20menu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@6595 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- "Snippets/Object key \342\200\224 key: \"value\".tmSnippet" | 2 ++ .../for (\342\200\246) {\342\200\246} (faster).tmSnippet" | 2 +- Syntaxes/JavaScript.plist | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git "a/Snippets/Object key \342\200\224 key: \"value\".tmSnippet" "b/Snippets/Object key \342\200\224 key: \"value\".tmSnippet" index d54893d..12bc4e1 100644 --- "a/Snippets/Object key \342\200\224 key: \"value\".tmSnippet" +++ "b/Snippets/Object key \342\200\224 key: \"value\".tmSnippet" @@ -4,6 +4,8 @@ content ${1:key}: ${2:"${3:value}"}${4:, } + keyEquivalent + ~: name Object key — key: "value" scope diff --git "a/Snippets/for (\342\200\246) {\342\200\246} (faster).tmSnippet" "b/Snippets/for (\342\200\246) {\342\200\246} (faster).tmSnippet" index d680d23..34e6b71 100644 --- "a/Snippets/for (\342\200\246) {\342\200\246} (faster).tmSnippet" +++ "b/Snippets/for (\342\200\246) {\342\200\246} (faster).tmSnippet" @@ -11,7 +11,7 @@ scope source.js tabTrigger - forf + for uuid C207B7C3-5597-4873-8AAD-C46FB8842AF2 diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index d4c213d..5e8128b 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -256,7 +256,7 @@ 3 name - object.property.function.js + entity.name.function.js 4 @@ -276,7 +276,7 @@ 7 name - object.property.function.js + entity.name.function.js 8 From 596c67401936d9b33f5521a3640b2242853e2016 Mon Sep 17 00:00:00 2001 From: duff Date: Sun, 4 Mar 2007 20:11:31 +0000 Subject: [PATCH 067/243] =?UTF-8?q?Add=20the=20following=20keys=20to=20the?= =?UTF-8?q?=20bundle=E2=80=99s=20info.plist:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit contactName: The full name of the contact for this bundle. contactEmailRot13: A ROT13 encoded email address for the bundle contact (we obfuscate it to avoid spammers from picking up the files, seeing how bundles will often be available via anonymous svn over http). description: A short description for this bundle. Do link to more info about the language (or whatever) the bundle is about. I decided on using HTML for this (but leave out the initial paragraph tag) since it seemed like overkill to run a single line of text through Markdown.pl, just to convert [foo](link) into foo Many of the current descriptions could use some improvements, I just wanted to get the ball rolling :) git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@6718 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- info.plist | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/info.plist b/info.plist index bf8c19f..2b16c32 100644 --- a/info.plist +++ b/info.plist @@ -2,6 +2,12 @@ + contactEmailRot13 + boyvivbhf@fhogyrTenqvrag.pbz + contactName + Thomas Aylott + description + Support for <a href="http://developer.mozilla.org/en/docs/About_JavaScript">JavaScript</a>. mainMenu items From f405e6a31e8613eb8cdfa07dad07da22ccd1c53a Mon Sep 17 00:00:00 2001 From: duff Date: Fri, 9 Mar 2007 20:03:31 +0000 Subject: [PATCH 068/243] =?UTF-8?q?=E2=80=A2=20make=20/*=20=E2=80=A6=20*/?= =?UTF-8?q?=20work=20again=20(for=20uncommenting)=20=E2=80=94=20ticket=20A?= =?UTF-8?q?2F2DDD2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@6761 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Preferences/Comments.tmPreferences | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Preferences/Comments.tmPreferences b/Preferences/Comments.tmPreferences index 02e5f2e..2b7a183 100644 --- a/Preferences/Comments.tmPreferences +++ b/Preferences/Comments.tmPreferences @@ -18,13 +18,13 @@ name - TM_COMMENT_START_3 + TM_COMMENT_START_2 value /* name - TM_COMMENT_END_3 + TM_COMMENT_END_2 value */ From d01c07ff38001851841fa559e4de117b0b0ce879 Mon Sep 17 00:00:00 2001 From: duff Date: Mon, 12 Mar 2007 14:44:56 +0000 Subject: [PATCH 069/243] =?UTF-8?q?=E2=80=A2=20handle=20com.some.namespace?= =?UTF-8?q?.Function=20=3D=20test()=20{=20}=20=E2=80=94=20ticket=202629590?= =?UTF-8?q?E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@6787 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 46 ++++++++++++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 5 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 5e8128b..ac64115 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -125,31 +125,67 @@ name entity.name.function.js - 4 + 3 name storage.type.function.js - 5 + 4 name punctuation.definition.parameters.begin.js + 5 + + name + variable.parameter.function.js + 6 + + name + punctuation.definition.parameters.end.js + + + comment + match stuff like: Sound.play = function() { … } + match + ([a-zA-Z_?\.\$]+\w*)\.([a-zA-Z_?\.\$]+\w*)\s*=\s*(function)\s*(\()(.*?)(\)) + name + meta.function.js + + + captures + + 1 + + name + entity.name.function.js + + 2 + + name + storage.type.function.js + + 3 + + name + punctuation.definition.parameters.begin.js + + 4 name variable.parameter.function.js - 7 + 5 name punctuation.definition.parameters.end.js comment - match stuff like: Sound.play = function() { … } or play = function() { … } + match stuff like: play = function() { … } match - ([a-zA-Z_?\.\$]+\w*)(\.([a-zA-Z_?\.\$]+\w*))?\s*=\s*(function)\s*(\()(.*?)(\)) + ([a-zA-Z_?\$]+\w*)\s*=\s*(function)\s*(\()(.*?)(\)) name meta.function.js From 29989a44d7cddbbd6ddb5806bf64fd57594ad00c Mon Sep 17 00:00:00 2001 From: duff Date: Tue, 20 Mar 2007 11:51:44 +0000 Subject: [PATCH 070/243] =?UTF-8?q?=E2=80=A2=20change=20several=20patterns?= =?UTF-8?q?=20of=20the=20form:=20[A-Za-z=E2=80=A6]+\w*=20into=20[A-Za-z?= =?UTF-8?q?=E2=80=A6][\w=E2=80=A6]*=20=E2=80=94=20I=20am=20thinking=20thou?= =?UTF-8?q?gh,=20that=20=E2=80=98=E2=80=A6=E2=80=99=20should=20not=20be=20?= =?UTF-8?q?allowed=20for=20anything=20but=20the=20first=20character=20?= =?UTF-8?q?=E2=80=A2=20change=20a=20pattern=20of=20the=20fork:=20\w+=20\.?= =?UTF-8?q?=3F=20\w*=20into=20\w+=20(\.=20\w*)=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both of the above would previously result in potential really bad performance, because two greedy repeats basically matching the same thing, was after each other, and that leads to exponential time complexity in input size. git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@6859 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index ac64115..9785580 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -36,7 +36,7 @@ comment match stuff like: Sound.prototype = { … } when extending an object match - ([a-zA-Z_?\.$]+\w*)\.(prototype)\s*=\s* + ([a-zA-Z_?.$][\w?.$]*)\.(prototype)\s*=\s* name meta.class.js @@ -82,7 +82,7 @@ comment match stuff like: Sound.prototype.play = function() { … } match - ([a-zA-Z_?\.$]+\w*)\.(prototype)\.([a-zA-Z_?\.$]+\w*)\s*=\s*(function)?\s*(\()(.*?)(\)) + ([a-zA-Z_?.$][\w?.$]*)\.(prototype)\.([a-zA-Z_?.$][\w?.$]*)\s*=\s*(function)?\s*(\()(.*?)(\)) name meta.function.prototype.js @@ -108,7 +108,7 @@ comment match stuff like: Sound.prototype.play = myfunc match - ([a-zA-Z_?\.\$]+\w*)\.(prototype)\.([a-zA-Z_?\.$]+\w*)\s*=\s* + ([a-zA-Z_?.$][\w?.$]*)\.(prototype)\.([a-zA-Z_?.$][\w?.$]*)\s*=\s* name meta.function.js @@ -149,7 +149,7 @@ comment match stuff like: Sound.play = function() { … } match - ([a-zA-Z_?\.\$]+\w*)\.([a-zA-Z_?\.\$]+\w*)\s*=\s*(function)\s*(\()(.*?)(\)) + ([a-zA-Z_?.$][\w?.$]*)\.([a-zA-Z_?.$][\w?.$]*)\s*=\s*(function)\s*(\()(.*?)(\)) name meta.function.js @@ -185,7 +185,7 @@ comment match stuff like: play = function() { … } match - ([a-zA-Z_?\$]+\w*)\s*=\s*(function)\s*(\()(.*?)(\)) + ([a-zA-Z_?$][\w?$]*)\s*=\s*(function)\s*(\()(.*?)(\)) name meta.function.js @@ -257,7 +257,7 @@ 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.json.js @@ -347,7 +347,7 @@ match - (new)\s+(\w+\.?\w*) + (new)\s+(\w+(?:\.\w*)?) name meta.class.instance.constructor From c9ca65bb807f00eba6f2b3df0e21f6f3285f6615 Mon Sep 17 00:00:00 2001 From: duff Date: Thu, 19 Apr 2007 22:02:41 +0000 Subject: [PATCH 071/243] =?UTF-8?q?=E2=80=A2=20add=20jsx=20as=20a=20recogn?= =?UTF-8?q?ized=20file=20type,=20apparently=20what=20Photoshop=20CS2=20and?= =?UTF-8?q?=20CS3=20uses=20for=20JavaScript?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@7017 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 1 + 1 file changed, 1 insertion(+) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 9785580..5ac2b8c 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -8,6 +8,7 @@ js htc + jsx foldingStartMarker ^.*\bfunction\s*(\w+\s*)?\([^\)]*\)(\s*\{[^\}]*)?\s*$ From 093215cd0bf626828d07a3491ae4d0d802c16150 Mon Sep 17 00:00:00 2001 From: duff Date: Thu, 26 Apr 2007 23:15:46 +0000 Subject: [PATCH 072/243] =?UTF-8?q?=E2=80=A2=20match=20regexps=20that=20fo?= =?UTF-8?q?llow=20a=20=E2=80=98return=E2=80=99=20keyword,=20example:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit return /^[a-zA-Z]([a-zA-Z0-9+-.])*:/.test(s); git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/JavaScript.tmbundle@7067 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 5ac2b8c..8430d8e 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -611,7 +611,7 @@ begin - (?<=[=(:]|^)\s*(/)(?![/*+{}?]) + (?<=[=(:]|^|return)\s*(/)(?![/*+{}?]) beginCaptures 1 From 5335a0d6765146a4facc238ab6960e83d3906d96 Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Wed, 5 Dec 2007 18:44:38 +0000 Subject: [PATCH 073/243] Copying JavaScript to review git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@8600 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Preferences/JavaScript Indent.tmPreferences | 6 +- Snippets/function.tmSnippet | 4 +- Syntaxes/JavaScript.plist | 989 ++++++++++---------- info.plist | 20 +- 4 files changed, 501 insertions(+), 518 deletions(-) diff --git a/Preferences/JavaScript Indent.tmPreferences b/Preferences/JavaScript Indent.tmPreferences index b6b6ffc..1ace8e8 100644 --- a/Preferences/JavaScript Indent.tmPreferences +++ b/Preferences/JavaScript Indent.tmPreferences @@ -9,9 +9,11 @@ settings decreaseIndentPattern - ^(.*\*/)?\s*(\}|\))([^{]*\{)?([;,]?\s*|\.[^{]*|\s*\)[;\s]*)$ + ^((.*\*/)?\s*(\}|\))([^{]*\{)?([;,]?\s*|\.[^{]*|\s*\)[;\s]*)$|\s*[}]while.*$) increaseIndentPattern - ^.*(\{[^}"']*|\([^)"']*)$ + ^(\/(?!\/)|[^\/])*((\{[^}"']*|\([^)"']*)|\=\s*)$ + indentNextLinePattern + ^\s*((if|while|for|switch|else if).*[)]|else)\s*$ uuid BC062860-3346-4D3B-8421-C5543F83D11F diff --git a/Snippets/function.tmSnippet b/Snippets/function.tmSnippet index 8a3cf1e..b9bf6f6 100644 --- a/Snippets/function.tmSnippet +++ b/Snippets/function.tmSnippet @@ -1,9 +1,9 @@ - + content - function($1) {${0:$TM_SELECTED_TEXT}}; + function($1){${0:$TM_SELECTED_TEXT}} name Anonymous Function scope diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 8430d8e..a98d717 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -1,19 +1,11 @@ - + - comment - JavaScript Syntax: version 2.0 - fileTypes - - js - htc - jsx - foldingStartMarker - ^.*\bfunction\s*(\w+\s*)?\([^\)]*\)(\s*\{[^\}]*)?\s*$ + ^.*(\bfunction\s*(\w+\s*)?\([^\)]*\)(\s*\{[^\}]*)?\s*$)|(={\s*$)|(\({$) foldingStopMarker - ^\s*\} + (^\s*\})|(^}\)); keyEquivalent ^~J name @@ -21,138 +13,49 @@ 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 + include + #conditional-compilation - 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 - punctuation.definition.parameters.begin.js - - 6 - - name - variable.parameter.function.js - - 7 - - name - punctuation.definition.parameters.end.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 + include + #brackets - captures + begin + (?x) (function) (?= (\s+ ([_$a-zA-Z][_$\w]*))? \s* \(.*?\)) + beginCaptures 1 name - support.class.js - - 2 - - name - support.constant.js - - 3 - - name - entity.name.function.js + storage.type.function.js comment - match stuff like: Sound.prototype.play = myfunc - match - ([a-zA-Z_?.$][\w?.$]*)\.(prototype)\.([a-zA-Z_?.$][\w?.$]*)\s*=\s* + function(one,two,...)\n?{...} + end + (?<=})(\s*\n)? name meta.function.js - - - captures - - 1 - - name - support.class.js - - 2 + patterns + - name - entity.name.function.js + include + #function-params - 3 - name - storage.type.function.js + include + #leading-space - 4 - name - punctuation.definition.parameters.begin.js + include + #function-block - 5 - - name - variable.parameter.function.js - - 6 - - name - punctuation.definition.parameters.end.js - - - comment - match stuff like: Sound.play = function() { … } - match - ([a-zA-Z_?.$][\w?.$]*)\.([a-zA-Z_?.$][\w?.$]*)\s*=\s*(function)\s*(\()(.*?)(\)) - name - meta.function.js + + + + include + source.js.basic captures @@ -165,66 +68,32 @@ 2 name - storage.type.function.js + meta.group.braces.round.function.arguments.js 3 name - punctuation.definition.parameters.begin.js - - 4 - - name - variable.parameter.function.js - - 5 - - name - punctuation.definition.parameters.end.js + punctuation.section.scope.round.js - comment - match stuff like: play = function() { … } match - ([a-zA-Z_?$][\w?$]*)\s*=\s*(function)\s*(\()(.*?)(\)) + (?x)(?<= \. ) ([_$a-zA-Z][_$\w]*) ((\( \s* \))) name - meta.function.js + meta.function-call.method.without-arguments.js captures 1 - - name - storage.type.function.js - - 2 name entity.name.function.js - 3 - - name - punctuation.definition.parameters.begin.js - - 4 - - name - variable.parameter.function.js - - 5 - - name - punctuation.definition.parameters.end.js - - comment - match regular function like: function myFunc(arg) { … } match - \b(function)\s+([a-zA-Z_$]\w*)?\s*(\()(.*?)(\)) + (?x)(?<= \. ) ([_$a-zA-Z][_$\w]*) (?=\() name - meta.function.js + meta.function-call.method.with-arguments.js captures @@ -237,448 +106,548 @@ 2 name - storage.type.function.js + meta.group.braces.round.function.arguments.js 3 name - punctuation.definition.parameters.begin.js - - 4 - - name - variable.parameter.function.js - - 5 - - name - punctuation.definition.parameters.end.js + punctuation.section.scope.js - comment - match stuff like: foobar: function() { … } match - \b([a-zA-Z_?.$][\w?.$]*)\s*:\s*\b(function)?\s*(\()(.*?)(\)) + (?x)(?<! [_$\w] ) ([_$a-zA-Z][_$\w]*) ((\( \s* \))) name - meta.function.json.js + meta.function-call.static.without-arguments.js captures 1 - - name - string.quoted.single.js - - 10 - - name - punctuation.definition.parameters.begin.js - - 11 - - name - variable.parameter.function.js - - 12 - - name - punctuation.definition.parameters.end.js - - 2 - - name - punctuation.definition.string.begin.js - - 3 - - name - entity.name.function.js - - 4 - - name - punctuation.definition.string.end.js - - 5 - - name - string.quoted.double.js - - 6 - - name - punctuation.definition.string.begin.js - - 7 - - name - entity.name.function.js - - 8 - - name - punctuation.definition.string.end.js - - 9 name entity.name.function.js - comment - Attempt to match "foo": function match - (?:((')(.*?)('))|((")(.*?)(")))\s*:\s*\b(function)?\s*(\()(.*?)(\)) + (?x)(?<! [_$\w] ) ([_$a-zA-Z][_$\w]*) (?=\() name - meta.function.json.js + meta.function-call.static.with-arguments.js - captures - - 1 - - name - keyword.operator.new.js - - 2 - - name - entity.name.type.instance.js - - match - (new)\s+(\w+(?:\.\w*)?) + (?x)(?<= \. ) ([_$a-zA-Z][_$\w]*) name - meta.class.instance.constructor + variable.other.property.js match - \b(console)\b + (?x) + (?<! [\._$a-zA-Z] ) [_$] [_$\w]* + |(?<= var \s ) [_$a-zA-Z] [_$\w]* + |(?<! [_$\w] ) [_$a-zA-Z] [_$\w]* (?=( + \[ + |\s*(&|\*|\-|\+|~|=|!=|<|>|!|\||/=|%=|\^=) + )) name - entity.name.type.object.js.firebug + variable.other.js - match - \.(warn|info|log|error|time|timeEnd|assert)\b - name - support.function.js.firebug + include + #leading-space + + repository + + brackets - match - \b((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?))\b - name - constant.numeric.js + patterns + + + begin + (\{) + captures + + 1 + + name + punctuation.section.scope.curly.js + + 2 + + name + punctuation.separator.objects.js + + + end + (\})(,)?\s* + name + meta.group.braces.curly + patterns + + + captures + + 1 + + name + invalid.illegal.delimiter.object.comma.js + + + match + (,)\s*+(?=\}) + + + captures + + 1 + + name + string.quoted.double.js + + 2 + + name + punctuation.definition.string.js + + 3 + + name + constant.other.object.key.js + + 4 + + name + punctuation.definition.string.js + + 5 + + name + punctuation.separator.objects.js + + + comment + "something" : + match + ((")([^"]*)(")\s*)(:)\s*+(?!function) + + + captures + + 1 + + name + string.quoted.single.js + + 2 + + name + punctuation.definition.string.js + + 3 + + name + constant.other.object.key.js + + 4 + + name + punctuation.definition.string.js + + 5 + + name + punctuation.separator.objects.js + + + comment + 'something' : + match + ((')([^']*)(')\s*)(:)\s*+(?!function) + + + captures + + 1 + + name + constant.other.object.key.js + + 2 + + name + punctuation.separator.objects.js + + + comment + something : + match + \b(\w+\b\s*)(:)\s*+(?!function) + + + include + $base + + + + + begin + (\()(?!\)) + captures + + 1 + + name + punctuation.section.scope.round.js + + + end + (\)) + name + meta.group.braces.round + patterns + + + include + $base + + + + + begin + (\[)(?!\]) + captures + + 1 + + name + punctuation.section.scope.square.js + + + end + (\]) + name + meta.group.braces.square + patterns + + + include + $base + + + + + conditional-compilation - begin - ' - beginCaptures - - 0 + patterns + + begin + /\*(?=@) + captures + + 0 + + name + punctuation.definition.comment.js + + + end + (?<=@)\*/ + name + comment.block.conditional.js + patterns + + + include + $base + + + + + captures + + 1 + + name + punctuation.definition.keyword.js + + + match + (@)(if|elif|else|end) name - punctuation.definition.string.begin.js + keyword.control.conditional.js - - end - ' - endCaptures - - 0 + captures + + 1 + + name + punctuation.definition.keyword.js + + + match + (@)(cc_on|set) name - punctuation.definition.string.end.js + keyword.operator.conditional.js - - name - string.quoted.single.js - patterns - + captures + + 1 + + name + punctuation.definition.variable.js + + match - \\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.) + (@)(_win32|_win16|_mac|_alpha|_x86|_mc680x0|_PowerPC|_jscript_build|_jscript_version|_jscript|_debug|_fast|[a-zA-Z]\w+) name - constant.character.escape.js + variable.other.conditional.js + function-block begin - " - beginCaptures + ({) + captures - 0 + 1 name - punctuation.definition.string.begin.js + punctuation.section.function.js - - end - " - endCaptures - - 0 + 2 name - punctuation.definition.string.end.js + punctuation.terminator.statement.js + end + (}) name - string.quoted.double.js + meta.group.braces.curly.function.js patterns - match - \\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.) - name - constant.character.escape.js + include + $base + function-params begin - /\*\* - captures + (?x)(?<=function) (?:\s+ ([_$a-zA-Z][_$\w]*))? \s* (\() + beginCaptures - 0 + 1 name - punctuation.definition.comment.js + entity.name.function.js - - end - \*/ - name - comment.block.documentation.js - - - begin - /\* - captures - - 0 + 2 name - punctuation.definition.comment.js + punctuation.definition.parameters.js end - \*/ - name - comment.block.js - - - captures + \) + endCaptures - 1 + 0 name - punctuation.definition.comment.js + punctuation.definition.parameters.js - match - (//).*$\n? name - comment.line.double-slash.js - - - captures - - 0 + meta.group.braces.round.function.arguments.js + patterns + - name - punctuation.definition.comment.html.js + captures + + 1 + + name + invalid.illegal.delimiter.js + + + match + (,)\s*+(?=\)) - 2 + match + , name - punctuation.definition.comment.html.js + punctuation.separator.parameters.function.js - - match - (<!--|-->) - name - comment.block.html.js - - - match - \b(boolean|byte|char|class|double|enum|float|function|int|interface|long|short|var|void)\b - name - storage.type.js - - - match - \b(const|export|extends|final|implements|native|private|protected|public|static|synchronized|throws|transient|volatile)\b - name - storage.modifier.js - - - match - \b(break|case|catch|continue|default|do|else|finally|for|goto|if|import|package|return|switch|throw|try|while)\b - name - keyword.control.js - - - match - \b(delete|in|instanceof|new|typeof|with)\b - name - keyword.operator.js - - - match - \btrue\b - name - constant.language.boolean.true.js - - - match - \bfalse\b - name - constant.language.boolean.false.js - - - match - \bnull\b - name - constant.language.null.js - - - match - \b(super|this)\b - name - variable.language.js - - - match - \b(debugger)\b - name - keyword.other.js - - - match - \b(Anchor|Applet|Area|Array|Boolean|Button|Checkbox|Date|document|event|FileUpload|Form|Frame|Function|Hidden|History|Image|JavaArray|JavaClass|JavaObject|JavaPackage|java|Layer|Link|Location|Math|MimeType|Number|navigator|netscape|Object|Option|Packages|Password|Plugin|Radio|RegExp|Reset|Select|String|Style|Submit|screen|sun|Text|Textarea|window|XMLHttpRequest)\b - name - support.class.js - - - match - \b(s(h(ift|ow(Mod(elessDialog|alDialog)|Help))|croll(X|By(Pages|Lines)?|Y|To)?|t(op|rike)|i(n|zeToContent|debar|gnText)|ort|u(p|b(str(ing)?)?)|pli(ce|t)|e(nd|t(Re(sizable|questHeader)|M(i(nutes|lliseconds)|onth)|Seconds|Ho(tKeys|urs)|Year|Cursor|Time(out)?|Interval|ZOptions|Date|UTC(M(i(nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(ome|andleEvent)|navigate|c(har(CodeAt|At)|o(s|n(cat|textual|firm)|mpile)|eil|lear(Timeout|Interval)?|a(ptureEvents|ll)|reate(StyleSheet|Popup|EventObject))|t(o(GMTString|S(tring|ource)|U(TCString|pperCase)|Lo(caleString|werCase))|est|a(n|int(Enabled)?))|i(s(NaN|Finite)|ndexOf|talics)|d(isableExternalCapture|ump|etachEvent)|u(n(shift|taint|escape|watch)|pdateCommands)|j(oin|avaEnabled)|p(o(p|w)|ush|lugins.refresh|a(ddings|rse(Int|Float)?)|r(int|ompt|eference))|e(scape|nableExternalCapture|val|lementFromPoint|x(p|ec(Script|Command)?))|valueOf|UTC|queryCommand(State|Indeterm|Enabled|Value)|f(i(nd|le(ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(nt(size|color)|rward)|loor|romCharCode)|watch|l(ink|o(ad|g)|astIndexOf)|a(sin|nchor|cos|t(tachEvent|ob|an(2)?)|pply|lert|b(s|ort))|r(ou(nd|teEvents)|e(size(By|To)|calc|turnValue|place|verse|l(oad|ease(Capture|Events)))|andom)|g(o|et(ResponseHeader|M(i(nutes|lliseconds)|onth)|Se(conds|lection)|Hours|Year|Time(zoneOffset)?|Da(y|te)|UTC(M(i(nutes|lliseconds)|onth)|Seconds|Hours|Da(y|te)|FullYear)|FullYear|A(ttention|llResponseHeaders)))|m(in|ove(B(y|elow)|To(Absolute)?|Above)|ergeAttributes|a(tch|rgins|x))|b(toa|ig|o(ld|rderWidths)|link|ack))\b(?=\() - name - support.function.js - - - match - \b(s(ub(stringData|mit)|plitText|e(t(NamedItem|Attribute(Node)?)|lect))|has(ChildNodes|Feature)|namedItem|c(l(ick|o(se|neNode))|reate(C(omment|DATASection|aption)|T(Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(ntityReference|lement)|Attribute))|tabIndex|i(nsert(Row|Before|Cell|Data)|tem)|open|delete(Row|C(ell|aption)|T(Head|Foot)|Data)|focus|write(ln)?|a(dd|ppend(Child|Data))|re(set|place(Child|Data)|move(NamedItem|Child|Attribute(Node)?)?)|get(NamedItem|Element(sBy(Name|TagName)|ById)|Attribute(Node)?)|blur)\b(?=\() - name - support.function.dom.js - - - match - (?<=\.)(s(ystemLanguage|cr(ipts|ollbars|een(X|Y|Top|Left))|t(yle(Sheets)?|atus(Text|bar)?)|ibling(Below|Above)|ource|uffixes|e(curity(Policy)?|l(ection|f)))|h(istory|ost(name)?|as(h|Focus))|y|X(MLDocument|SLDocument)|n(ext|ame(space(s|URI)|Prop))|M(IN_VALUE|AX_VALUE)|c(haracterSet|o(n(structor|trollers)|okieEnabled|lorDepth|mp(onents|lete))|urrent|puClass|l(i(p(boardData)?|entInformation)|osed|asses)|alle(e|r)|rypto)|t(o(olbar|p)|ext(Transform|Indent|Decoration|Align)|ags)|SQRT(1_2|2)|i(n(ner(Height|Width)|put)|ds|gnoreCase)|zIndex|o(scpu|n(readystatechange|Line)|uter(Height|Width)|p(sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(i(splay|alog(Height|Top|Width|Left|Arguments)|rectories)|e(scription|fault(Status|Ch(ecked|arset)|View)))|u(ser(Profile|Language|Agent)|n(iqueID|defined)|pdateInterval)|_content|p(ixelDepth|ort|ersonalbar|kcs11|l(ugins|atform)|a(thname|dding(Right|Bottom|Top|Left)|rent(Window|Layer)?|ge(X(Offset)?|Y(Offset)?))|r(o(to(col|type)|duct(Sub)?|mpter)|e(vious|fix)))|e(n(coding|abledPlugin)|x(ternal|pando)|mbeds)|v(isibility|endor(Sub)?|Linkcolor)|URLUnencoded|P(I|OSITIVE_INFINITY)|f(ilename|o(nt(Size|Family|Weight)|rmName)|rame(s|Element)|gColor)|E|whiteSpace|l(i(stStyleType|n(eHeight|kColor))|o(ca(tion(bar)?|lName)|wsrc)|e(ngth|ft(Context)?)|a(st(M(odified|atch)|Index|Paren)|yer(s|X)|nguage))|a(pp(MinorVersion|Name|Co(deName|re)|Version)|vail(Height|Top|Width|Left)|ll|r(ity|guments)|Linkcolor|bove)|r(ight(Context)?|e(sponse(XML|Text)|adyState))|global|x|m(imeTypes|ultiline|enubar|argin(Right|Bottom|Top|Left))|L(N(10|2)|OG(10E|2E))|b(o(ttom|rder(RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(Color|Image)))\b - name - support.constant.js - - - match - (?<=\.)(s(hape|ystemId|c(heme|ope|rolling)|ta(ndby|rt)|ize|ummary|pecified|e(ctionRowIndex|lected(Index)?)|rc)|h(space|t(tpEquiv|mlFor)|e(ight|aders)|ref(lang)?)|n(o(Resize|tation(s|Name)|Shade|Href|de(Name|Type|Value)|Wrap)|extSibling|ame)|c(h(ildNodes|Off|ecked|arset)?|ite|o(ntent|o(kie|rds)|de(Base|Type)?|l(s|Span|or)|mpact)|ell(s|Spacing|Padding)|l(ear|assName)|aption)|t(ype|Bodies|itle|Head|ext|a(rget|gName)|Foot)|i(sMap|ndex|d|m(plementation|ages))|o(ptions|wnerDocument|bject)|d(i(sabled|r)|o(c(type|umentElement)|main)|e(clare|f(er|ault(Selected|Checked|Value)))|at(eTime|a))|useMap|p(ublicId|arentNode|r(o(file|mpt)|eviousSibling))|e(n(ctype|tities)|vent|lements)|v(space|ersion|alue(Type)?|Link|Align)|URL|f(irstChild|orm(s)?|ace|rame(Border)?)|width|l(ink(s)?|o(ngDesc|wSrc)|a(stChild|ng|bel))|a(nchors|c(ce(ssKey|pt(Charset)?)|tion)|ttributes|pplets|l(t|ign)|r(chive|eas)|xis|Link|bbr)|r(ow(s|Span|Index)|ules|e(v|ferrer|l|adOnly))|m(ultiple|e(thod|dia)|a(rgin(Height|Width)|xLength))|b(o(dy|rder)|ackground|gColor))\b - name - support.constant.dom.js - - - match - \b(ELEMENT_NODE|ATTRIBUTE_NODE|TEXT_NODE|CDATA_SECTION_NODE|ENTITY_REFERENCE_NODE|ENTITY_NODE|PROCESSING_INSTRUCTION_NODE|COMMENT_NODE|DOCUMENT_NODE|DOCUMENT_TYPE_NODE|DOCUMENT_FRAGMENT_NODE|NOTATION_NODE|INDEX_SIZE_ERR|DOMSTRING_SIZE_ERR|HIERARCHY_REQUEST_ERR|WRONG_DOCUMENT_ERR|INVALID_CHARACTER_ERR|NO_DATA_ALLOWED_ERR|NO_MODIFICATION_ALLOWED_ERR|NOT_FOUND_ERR|NOT_SUPPORTED_ERR|INUSE_ATTRIBUTE_ERR)\b - name - support.constant.dom.js - - - match - \bon(R(ow(s(inserted|delete)|e(nter|xit))|e(s(ize(start|end)?|et)|adystatechange))|Mouse(o(ut|ver)|down|up|move)|B(efore(cut|deactivate|u(nload|pdate)|p(aste|rint)|editfocus|activate)|lur)|S(croll|top|ubmit|elect(start|ionchange)?)|H(over|elp)|C(hange|ont(extmenu|rolselect)|ut|ellchange|l(ick|ose))|D(eactivate|ata(setc(hanged|omplete)|available)|r(op|ag(start|over|drop|en(ter|d)|leave)?)|blclick)|Unload|P(aste|ropertychange)|Error(update)?|Key(down|up|press)|Focus|Load|A(ctivate|fter(update|print)|bort))\b - name - support.function.event-handler.js - - - match - !|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|/=|%=|\+=|\-=|&=|\^=|\b(in|instanceof|new|delete|typeof|void)\b - name - keyword.operator.js - - - match - \b(Infinity|NaN|Undefined)\b - name - constant.language.js - - - begin - (?<=[=(:]|^|return)\s*(/)(?![/*+{}?]) - beginCaptures - - 1 - name - punctuation.definition.string.begin.js + captures + + 1 + + name + invalid.illegal.delimiter.js + + + match + (?<![_$\w])([^_$a-zA-Z),\s]+) - - end - (/)[igm]* - endCaptures - - 1 + match + (?<![_$\w])([_$a-zA-Z][_$\w]*) name - punctuation.definition.string.end.js + variable.parameter.function.js - - name - string.regexp.js + + + leading-space + patterns - match - \\. - name - constant.character.escape.js + begin + ^(?=(\t| )) + end + (?=[^\t\s]) + name + meta.leading-tabs + patterns + + + captures + + 1 + + name + meta.odd-tab.group1.spaces + + 10 + + name + meta.even-tab.group10.spaces + + 11 + + name + meta.odd-tab.group11.spaces + + 2 + + name + meta.even-tab.group2.spaces + + 3 + + name + meta.odd-tab.group3.spaces + + 4 + + name + meta.even-tab.group4.spaces + + 5 + + name + meta.odd-tab.group5.spaces + + 6 + + name + meta.even-tab.group6.spaces + + 7 + + name + meta.odd-tab.group7.spaces + + 8 + + name + meta.even-tab.group8.spaces + + 9 + + name + meta.odd-tab.group9.spaces + + + match + ( )( )?( )?( )?( )?( )?( )?( )?( )?( )?( )? + + + captures + + 1 + + name + meta.odd-tab.group1.tab + + 10 + + name + meta.even-tab.group10.tab + + 11 + + name + meta.odd-tab.group11.tab + + 2 + + name + meta.even-tab.group2.tab + + 3 + + name + meta.odd-tab.group3.tab + + 4 + + name + meta.even-tab.group4.tab + + 5 + + name + meta.odd-tab.group5.tab + + 6 + + name + meta.even-tab.group6.tab + + 7 + + name + meta.odd-tab.group7.tab + + 8 + + name + meta.even-tab.group8.tab + + 9 + + name + meta.odd-tab.group9.tab + + + match + (\t)(\t)?(\t)?(\t)?(\t)?(\t)?(\t)?(\t)?(\t)?(\t)?(\t)? + + - - match - \; - name - punctuation.terminator.statement.js - - - match - ,[ |\t]* - name - meta.delimiter.object.comma.js - - - match - \. - name - meta.delimiter.method.period.js - - - match - \{|\} - name - meta.brace.curly.js - - - match - \(|\) - name - meta.brace.round.js - - - match - \[|\] - name - meta.brace.square.js - - + scopeName source.js uuid diff --git a/info.plist b/info.plist index 2b16c32..16ac3e7 100644 --- a/info.plist +++ b/info.plist @@ -1,5 +1,5 @@ - + contactEmailRot13 @@ -12,14 +12,24 @@ items + B4874A14-2491-465A-A349-61E4EBCF4700 + ------------------------------------ D2E6A1FE-2881-4754-B399-B65F61F29C2F 43F40EB6-5839-4BE8-99C8-4976D0534E5D 52090C49-D8B2-49A0-9597-80574354B3CD - ------------------------------------ - B4874A14-2491-465A-A349-61E4EBCF4700 + 28B33806-DCD4-4D5D-A422-B6041A6D9FAA submenus + 28B33806-DCD4-4D5D-A422-B6041A6D9FAA + + items + + 0C6DE5D1-2AAA-4327-A746-94FCCD7A45C9 + + name + Idioms + 43F40EB6-5839-4BE8-99C8-4976D0534E5D items @@ -104,8 +114,8 @@ 1717B5AE-209B-4548-9155-9E88A7230C1C 4C6EDB43-3E2E-411B-A016-13C135C59833 93E017CC-6F27-11D9-90EB-000D93589AF6 + 0D2D03B9-F18B-4D9D-A960-716FDEC35331 A67A8BD9-A951-406F-9175-018DD4B52FD1 - BC062860-3346-4D3B-8421-C5543F83D11F 834BC727-6B31-4073-A161-4823227219EF 3CEA49B2-A5C5-405C-82E2-B8B668877C37 E6EB7CC8-04E8-43A9-93B2-BC9EF5BA862B @@ -120,6 +130,8 @@ 009A3E6C-FE3F-4A18-8759-2DC31F17BBE2 7B9AEFCC-B450-416D-8527-430FE2A08568 9E0E3BCC-7F20-4D6B-891D-A44D6EC56E31 + 0C6DE5D1-2AAA-4327-A746-94FCCD7A45C9 + 6D3097A0-7065-480A-9DE2-D7EEE181E783 uuid AAB4FD74-73F9-11D9-B89A-000D93589AF6 From 97c40c67f16dd77aec4073402f9e6b5c4a7fa015 Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Wed, 5 Dec 2007 19:41:09 +0000 Subject: [PATCH 074/243] Merged changes from stable git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@8601 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- ...Copy as Bookmarklet to Clipboard.tmCommand | 54 ++ .../Reformat Document : Selection.tmCommand | 591 ++++++++++++++++ Syntaxes/JavaScript Basic.tmLanguage | 651 ++++++++++++++++++ info.plist | 1 - 4 files changed, 1296 insertions(+), 1 deletion(-) create mode 100644 Commands/Copy as Bookmarklet to Clipboard.tmCommand create mode 100644 Commands/Reformat Document : Selection.tmCommand create mode 100644 Syntaxes/JavaScript Basic.tmLanguage diff --git a/Commands/Copy as Bookmarklet to Clipboard.tmCommand b/Commands/Copy as Bookmarklet to Clipboard.tmCommand new file mode 100644 index 0000000..7410fbf --- /dev/null +++ b/Commands/Copy as Bookmarklet to Clipboard.tmCommand @@ -0,0 +1,54 @@ + + + + + beforeRunningCommand + nop + command + #!/usr/bin/env perl +# +# Written by John Gruber, taken with permission from: +# http://daringfireball.net/2007/03/javascript_bookmarklet_builder + +use strict; +use warnings; +use URI::Escape qw(uri_escape_utf8); +use open IO => ":utf8", # UTF8 by default + ":std"; # Apply to STDIN/STDOUT/STDERR + +my $src = do { local $/; <> }; + +# Zap the first line if there's already a bookmarklet comment: +$src =~ s{^// ?javascript:.+\n}{}; +my $bookmarklet = $src; + +$bookmarklet =~ s{^\s*//.+\n}{}gm; # Kill comments. +$bookmarklet =~ s{\t}{ }gm; # Tabs to spaces +$bookmarklet =~ s{ +}{ }gm; # Space runs to one space +$bookmarklet =~ s{^\s+}{}gm; # Kill line-leading whitespace +$bookmarklet =~ s{\s+$}{}gm; # Kill line-ending whitespace +$bookmarklet =~ s{\n}{}gm; # Kill newlines + +# Escape single- and double-quotes, spaces, control chars, unicode: +$bookmarklet = "javascript:" . + uri_escape_utf8($bookmarklet, qq('" \x00-\x1f\x7f-\xff)); + +print "// $bookmarklet\n" . $src; + +# Put bookmarklet on clipboard: +`/bin/echo -n '$bookmarklet' | /usr/bin/pbcopy`; + + input + selection + keyEquivalent + ^H + name + Copy as Bookmarklet to Clipboard + output + replaceSelectedText + scope + source.js + uuid + 20E61C43-B81F-4FB9-9362-BFFE668EB9C9 + + diff --git a/Commands/Reformat Document : Selection.tmCommand b/Commands/Reformat Document : Selection.tmCommand new file mode 100644 index 0000000..4ef9cec --- /dev/null +++ b/Commands/Reformat Document : Selection.tmCommand @@ -0,0 +1,591 @@ + + + + + beforeRunningCommand + nop + command + #!/usr/bin/env php +<?php +/* + +JS Beautifier + +(c) 2007, Einars "elfz" Lielmanis + +http://elfz.laacz.lv/beautify/ + +You are free to use this in any way you want, in case you find this useful or working for you. + +Ported with permission to TextMate by Ale Muñoz. + +(Based on v35 of JS Beautifier) + +*/ + +error_reporting(E_ALL); +ini_set('display_errors', 'on'); + + +$n = 1; +define('IN_EXPR', ++$n); +define('IN_BLOCK', ++$n); + + +define('TK_UNKNOWN', ++$n); +define('TK_WORD', ++$n); +define('TK_START_EXPR', ++$n); +define('TK_END_EXPR', ++$n); +define('TK_START_BLOCK', ++$n); +define('TK_END_BLOCK', ++$n); +define('TK_END_COMMAND', ++$n); +define('TK_EOF', ++$n); +define('TK_STRING', ++$n); + +define('TK_BLOCK_COMMENT', ++$n); +define('TK_COMMENT', ++$n); + +define('TK_OPERATOR', ++$n); + +// internal flags +define('PRINT_NONE', ++$n); +define('PRINT_SPACE', ++$n); +define('PRINT_NL', ++$n); + + +function js_beautify($js_source_text, $tab_size = 4) +{ + global $output, $token_text, $last_type, $last_text, $in, $ins, $indent, $tab_string, $is_last_nl; + + global $input, $input_length; + + $tab_string = str_repeat(' ', $tab_size); + + $input = $js_source_text; + $input_length = strlen($input); + + $last_word = ''; // last TK_WORD passed + $last_type = TK_START_EXPR; // last token type + $last_text = ''; // last token text + $output = ''; + + $is_last_nl = true; // was the last character written a newline? + + // words which should always start on new line. + // simple hack for cases when lines aren't ending with semicolon. + // feel free to tell me about the ones that need to be added. + $line_starters = explode(',', 'continue,try,throw,return,var,if,switch,case,default,for,while,break,function'); + + // states showing if we are currently in expression (i.e. "if" case) - IN_EXPR, or in usual block (like, procedure), IN_BLOCK. + // some formatting depends on that. + $in = IN_BLOCK; + $ins = array($in); + + + $indent = 0; + $pos = 0; // parser position + $in_case = false; // flag for parser that case/default has been processed, and next colon needs special attention + + while (true) { + list($token_text, $token_type) = get_next_token($pos); + if ($token_type == TK_EOF) { + break; + } + + // $output .= " [$token_type:$last_type]"; + + switch($token_type) { + + case TK_START_EXPR: + + in(IN_EXPR); + if ($last_type == TK_END_EXPR or $last_type == TK_START_EXPR) { + // do nothing on (( and )( and ][ and ]( .. + } elseif ($last_type != TK_WORD and $last_type != TK_OPERATOR) { + space(); + } elseif (in_array($last_word, $line_starters) and $last_word != 'function') { + space(); + } + token(); + break; + + case TK_END_EXPR: + + token(); + in_pop(); + break; + + case TK_START_BLOCK: + + in(IN_BLOCK); + if ($last_type != TK_OPERATOR and $last_type != TK_START_EXPR) { + if ($last_type == TK_START_BLOCK) { + nl(); + } else { + space(); + } + } + token(); + indent(); + break; + + case TK_END_BLOCK: + + if ($last_type == TK_END_EXPR) { + unindent(); + nl(false); + } elseif ($last_type == TK_END_BLOCK) { + unindent(); + nl(false); + } elseif ($last_type == TK_START_BLOCK) { + // nothing + unindent(); + } else { + unindent(); + nl(false); + } + token(); + in_pop(); + break; + + case TK_WORD: + + if ($token_text == 'case' or $token_text == 'default') { + if ($last_text == ':') { + // switch cases following one another + remove_indent(); + } else { + $indent--; + nl(); + $indent++; + } + token(); + $in_case = true; + break; + } + + $prefix = PRINT_NONE; + if ($last_type == TK_END_BLOCK) { + if (!in_array(strtolower($token_text), array('else', 'catch', 'finally'))) { + $prefix = PRINT_NL; + } else { + $prefix = PRINT_SPACE; + space(); + } + } elseif ($last_type == TK_END_COMMAND && $in == IN_BLOCK) { + $prefix = PRINT_NL; + } elseif ($last_type == TK_END_COMMAND && $in == IN_EXPR) { + $prefix = PRINT_SPACE; + } elseif ($last_type == TK_WORD) { + if ($last_word == 'else') { // else if + $prefix = PRINT_SPACE; + } else { + $prefix = PRINT_SPACE; + } + } elseif ($last_type == TK_START_BLOCK) { + $prefix = PRINT_NL; + } elseif ($last_type == TK_END_EXPR) { + space(); + } + + if (in_array($token_text, $line_starters) or $prefix == PRINT_NL) { + + if ($last_text == 'else') { + // no need to force newline on else break + // DONOTHING + space(); + } elseif (($last_type == TK_START_EXPR or $last_text == '=') and $token_text == 'function') { + // no need to force newline on 'function': (function + // DONOTHING + } else + if ($last_type != TK_END_EXPR) { + if (($last_type != TK_START_EXPR or $token_text != 'var') and $last_text != ':') { + // no need to force newline on 'var': for (var x = 0...) + if ($token_text == 'if' and $last_type == TK_WORD and $last_word == 'else') { + // no newline for } else if { + space(); + } else { + nl(); + } + } + } + } elseif ($prefix == PRINT_SPACE) { + space(); + } + token(); + $last_word = strtolower($token_text); + break; + + case TK_END_COMMAND: + + token(); + break; + + case TK_STRING: + + if ($last_type == TK_START_BLOCK or $last_type == TK_END_BLOCK) { + nl(); + } elseif ($last_type == TK_WORD) { + space(); + } + token(); + break; + + case TK_OPERATOR: + $start_delim = true; + $end_delim = true; + + if ($token_text == ':' and $in_case) { + token(); // colon really asks for separate treatment + nl(); + $expecting_case = false; + break; + } + + $in_case = false; + + + + if ($token_text == ',') { + if ($last_type == TK_END_BLOCK) { + token(); + nl(); + } else { + if ($in == IN_BLOCK) { + token(); + nl(); + } else { + token(); + space(); + } + } + break; + } elseif ($token_text == '--' or $token_text == '++') { // unary operators special case + if ($last_text == ';') { + // space for (;; ++i) + $start_delim = true; + $end_delim = false; + } else { + $start_delim = false; + $end_delim = false; + } + } elseif ($token_text == '!' and $last_type == TK_START_EXPR) { + // special case handling: if (!a) + $start_delim = false; + $end_delim = false; + } elseif ($last_type == TK_OPERATOR) { + $start_delim = false; + $end_delim = false; + } elseif ($last_type == TK_END_EXPR) { + $start_delim = true; + $end_delim = true; + } elseif ($token_text == '.') { + // decimal digits or object.property + $start_delim = false; + $end_delim = false; + + } elseif ($token_text == ':') { + // zz: xx + // can't differentiate ternary op, so for now it's a ? b: c; without space before colon + $start_delim = false; + } + if ($start_delim) { + space(); + } + + token(); + + if ($end_delim) { + space(); + } + break; + + case TK_BLOCK_COMMENT: + + nl(); + token(); + nl(); + break; + + case TK_COMMENT: + + //if ($last_type != TK_COMMENT) { + nl(); + //} + token(); + nl(); + break; + + case TK_UNKNOWN: + token(); + break; + } + + if ($token_type != TK_COMMENT) { + $last_type = $token_type; + $last_text = $token_text; + } + } + + // clean empty lines from redundant spaces + $output = preg_replace('/^ +$/m', '', $output); + + return $output; +} + + + + +function nl($ignore_repeated = true) +{ + global $indent, $output, $tab_string, $is_last_nl; + + if ($output == '') return; // no newline on start of file + + if ($ignore_repeated and $is_last_nl) { + return; + } + + $is_last_nl = true; + + $output .= "\n" . str_repeat($tab_string, $indent); +} + + +// hack for correct multiple newline handling +function safe_nl($newlines = 1) +{ + global $output; + if ($newlines) { + $output .= str_repeat("\n", $newlines - 1); + } + nl(); +} + + +function space() +{ + global $output, $is_last_nl; + + $is_last_nl = false; + + if ($output and substr($output, -1) != ' ') { // prevent occassional duplicate space + $output .= ' '; + } +} + + +function token() +{ + global $token_text, $output, $is_last_nl; + $output .= $token_text; + $is_last_nl = false; +} + +function indent() +{ + global $indent; + $indent ++; +} + + +function unindent() +{ + global $indent; + if ($indent) { + $indent --; + } +} + + +function remove_indent() +{ + global $tab_string, $output; + $tab_string_len = strlen($tab_string); + if (substr($output, -$tab_string_len) == $tab_string) { + $output = substr($output, 0, -$tab_string_len); + } +} + + +function in($where) +{ + global $ins, $in; + array_push($ins, $in); + $in = $where; +} + + +function in_pop() +{ + global $ins, $in; + $in = array_pop($ins); +} + + + +function make_array($str) +{ + $res = array(); + for ($i = 0; $i < strlen($str); $i++) { + $res[] = $str[$i]; + } + return $res; +} + + + +function get_next_token(&$pos) +{ + global $last_type, $last_text; + global $whitespace, $wordchar, $punct; + global $input, $input_length, $is_last_nl; + + + if (!$whitespace) $whitespace = make_array("\n\r\t "); + if (!$wordchar) $wordchar = make_array('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$'); + if (!$punct) $punct = explode(' ', '+ - * / % & ++ -- = += -= *= /= %= == === != !== > < >= <= >> << >>> <<< >>= <<= && &= | || ! !! , : ? ^ ^= |='); + + $n_newlines = 0; + do { + if ($pos >= $input_length) { + return array('', TK_EOF); + } + $c = $input[$pos]; + $pos += 1; + if ($c == "\n") { + $n_newlines += 1; + } + } while (in_array($c, $whitespace)); + + if ($n_newlines) { + safe_nl($n_newlines); + } + + if (in_array($c, $wordchar)) { + if ($pos < $input_length) { + while (in_array($input[$pos], $wordchar)) { + $c .= $input[$pos]; + $pos += 1; + if ($pos == $input_length) break; + } + } + if ($c == 'in') { // hack for 'in' operator + return array($c, TK_OPERATOR); + } + return array($c, TK_WORD); + } + + if ($c == '(' || $c == '[') { + return array($c, TK_START_EXPR); + } + + if ($c == ')' || $c == ']') { + return array($c, TK_END_EXPR); + } + + if ($c == '{') { + return array($c, TK_START_BLOCK); + } + + if ($c == '}') { + return array($c, TK_END_BLOCK); + } + + if ($c == ';') { + return array($c, TK_END_COMMAND); + } + + if ($c == '/') { + // peek for comment /* ... */ + if ($input[$pos] == '*') { + $comment = ''; + $pos += 1; + if ($pos < $input_length){ + while (!($input[$pos] == '*' && isset($input[$pos + 1]) && $input[$pos + 1] == '/') && $pos < $input_length) { + $comment .= $input[$pos]; + $pos += 1; + if ($pos >= $input_length) break; + } + } + $pos +=2; + return array("/*$comment*/", TK_BLOCK_COMMENT); + } + // peek for comment // ... + if ($input[$pos] == '/') { + $comment = $c; + while ($input[$pos] != "\x0d" && $input[$pos] != "\x0a") { + $comment .= $input[$pos]; + $pos += 1; + if ($pos >= $input_length) break; + } + $pos += 1; + return array($comment, TK_COMMENT); + } + + } + + if ($c == "'" || // string + $c == '"' || // string + ($c == '/' && + (($last_type == TK_WORD and $last_text == 'return') or ($last_type == TK_START_EXPR || $last_type == TK_END_BLOCK || $last_type == TK_OPERATOR || $last_type == TK_EOF || $last_type == TK_END_COMMAND)))) { // regexp + $sep = $c; + $c = ''; + $esc = false; + + if ($pos < $input_length) { + + while ($esc || $input[$pos] != $sep) { + $c .= $input[$pos]; + if (!$esc) { + $esc = $input[$pos] == '\\'; + } else { + $esc = false; + } + $pos += 1; + if ($pos >= $input_length) break; + } + + } + + $pos += 1; + if ($last_type == TK_END_COMMAND) { + nl(); + } + return array($sep . $c . $sep, TK_STRING); + } + + if (in_array($c, $punct)) { + while (in_array($c . $input[$pos], $punct)) { + $c .= $input[$pos]; + $pos += 1; + if ($pos >= $input_length) break; + } + return array($c, TK_OPERATOR); + } + + return array($c, TK_UNKNOWN); +} + +if (isset($_ENV['TM_SELECTED_TEXT'])) { + $input = get_magic_quotes_gpc() ? stripslashes($_ENV['TM_SELECTED_TEXT']) : $_ENV['TM_SELECTED_TEXT']; +} else { + $input = file_get_contents('php://stdin'); +} + +print js_beautify($input); +?> + input + selection + keyEquivalent + ^H + name + Reformat Document / Selection + output + replaceSelectedText + scope + source.js + uuid + 36EC03E9-EFF4-479A-AB90-8DFA16800642 + + diff --git a/Syntaxes/JavaScript Basic.tmLanguage b/Syntaxes/JavaScript Basic.tmLanguage new file mode 100644 index 0000000..e4771e9 --- /dev/null +++ b/Syntaxes/JavaScript Basic.tmLanguage @@ -0,0 +1,651 @@ + + + + + comment + JavaScript Syntax: version 2.0 + fileTypes + + js + htc + jsx + + foldingStartMarker + ^.*(\bfunction\s*(\w+\s*)?\([^\)]*\)(\s*\{[^\}]*)?\s*$)|(={\s*$)|(\({$) + foldingStopMarker + (^\s*\})|(^}\)); + keyEquivalent + ^~J + name + JavaScript Basic + 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 + punctuation.definition.parameters.begin.js + + 6 + + name + variable.parameter.function.js + + 7 + + name + punctuation.definition.parameters.end.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 + + 3 + + name + storage.type.function.js + + 4 + + name + punctuation.definition.parameters.begin.js + + 5 + + name + variable.parameter.function.js + + 6 + + name + punctuation.definition.parameters.end.js + + + comment + match stuff like: Sound.play = function() { … } + match + ([a-zA-Z_?.$][\w?.$]*)\.([a-zA-Z_?.$][\w?.$]*)\s*=\s*(function)\s*(\()(.*?)(\)) + name + meta.function.js + + + captures + + 1 + + name + storage.type.function.js + + 2 + + name + entity.name.function.js + + 3 + + name + punctuation.definition.parameters.begin.js + + 4 + + name + variable.parameter.function.js + + 5 + + name + punctuation.definition.parameters.end.js + + + comment + match regular function like: function myFunc(arg) { … } + match + \b(function)\s+([a-zA-Z_$]\w*)?\s*(\()(.*?)(\)) + name + meta.function.js + + + captures + + 1 + + name + entity.name.function.js + + 2 + + name + storage.type.function.js + + 3 + + name + punctuation.definition.parameters.begin.js + + 4 + + name + variable.parameter.function.js + + 5 + + name + punctuation.definition.parameters.end.js + + + comment + match stuff like: foobar: function() { … } + match + \b([a-zA-Z_?.$][\w?.$]*)\s*:\s*\b(function)?\s*(\()(.*?)(\)) + name + meta.function.json.js + + + captures + + 1 + + name + string.quoted.single.js + + 10 + + name + punctuation.definition.parameters.begin.js + + 11 + + name + variable.parameter.function.js + + 12 + + name + punctuation.definition.parameters.end.js + + 2 + + name + punctuation.definition.string.begin.js + + 3 + + name + entity.name.function.js + + 4 + + name + punctuation.definition.string.end.js + + 5 + + name + string.quoted.double.js + + 6 + + name + punctuation.definition.string.begin.js + + 7 + + name + entity.name.function.js + + 8 + + name + punctuation.definition.string.end.js + + 9 + + name + entity.name.function.js + + + comment + Attempt to match "foo": function + match + (?:((')(.*?)('))|((")(.*?)(")))\s*:\s*\b(function)?\s*(\()(.*?)(\)) + name + meta.function.json.js + + + captures + + 1 + + name + keyword.operator.new.js + + 2 + + name + entity.name.type.instance.js + + + match + (new)\s+(\w+(?:\.\w*)?) + name + meta.class.instance.constructor + + + match + \b(console)\b + name + entity.name.type.object.js.firebug + + + match + \.(warn|info|log|error|time|timeEnd|assert)\b + name + support.function.js.firebug + + + match + \b((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?))\b + name + constant.numeric.js + + + begin + ' + beginCaptures + + 0 + + name + punctuation.definition.string.begin.js + + + end + ' + endCaptures + + 0 + + name + punctuation.definition.string.end.js + + + name + string.quoted.single.js + patterns + + + match + \\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.) + name + constant.character.escape.js + + + + + begin + " + beginCaptures + + 0 + + name + punctuation.definition.string.begin.js + + + end + " + endCaptures + + 0 + + name + punctuation.definition.string.end.js + + + name + string.quoted.double.js + patterns + + + match + \\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.) + name + constant.character.escape.js + + + + + begin + /\*\* + captures + + 0 + + name + punctuation.definition.comment.js + + + end + \*/ + name + comment.block.documentation.js + + + begin + /\* + captures + + 0 + + name + punctuation.definition.comment.js + + + end + \*/ + name + comment.block.js + + + captures + + 1 + + name + punctuation.definition.comment.js + + + match + (//).*$\n? + name + comment.line.double-slash.js + + + captures + + 0 + + name + punctuation.definition.comment.html.js + + 2 + + name + punctuation.definition.comment.html.js + + + match + (<!--|-->) + name + comment.block.html.js + + + match + \b(boolean|byte|char|class|double|enum|float|function|int|interface|long|short|var|void)\b + name + storage.type.js + + + match + \b(const|export|extends|final|implements|native|private|protected|public|static|synchronized|throws|transient|volatile)\b + name + storage.modifier.js + + + match + \b(break|case|catch|continue|default|do|else|finally|for|goto|if|import|package|return|switch|throw|try|while)\b + name + keyword.control.js + + + match + \b(delete|in|instanceof|new|typeof|with)\b + name + keyword.operator.js + + + match + \btrue\b + name + constant.language.boolean.true.js + + + match + \bfalse\b + name + constant.language.boolean.false.js + + + match + \bnull\b + name + constant.language.null.js + + + match + \b(super|this)\b + name + variable.language.js + + + match + \b(debugger)\b + name + keyword.other.js + + + match + \b(Anchor|Applet|Area|Array|Boolean|Button|Checkbox|Date|document|event|FileUpload|Form|Frame|Function|Hidden|History|Image|JavaArray|JavaClass|JavaObject|JavaPackage|java|Layer|Link|Location|Math|MimeType|Number|navigator|netscape|Object|Option|Packages|Password|Plugin|Radio|RegExp|Reset|Select|String|Style|Submit|screen|sun|Text|Textarea|window|XMLHttpRequest)\b + name + support.class.js + + + match + \b(s(h(ift|ow(Mod(elessDialog|alDialog)|Help))|croll(X|By(Pages|Lines)?|Y|To)?|t(op|rike)|i(n|zeToContent|debar|gnText)|ort|u(p|b(str(ing)?)?)|pli(ce|t)|e(nd|t(Re(sizable|questHeader)|M(i(nutes|lliseconds)|onth)|Seconds|Ho(tKeys|urs)|Year|Cursor|Time(out)?|Interval|ZOptions|Date|UTC(M(i(nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(ome|andleEvent)|navigate|c(har(CodeAt|At)|o(s|n(cat|textual|firm)|mpile)|eil|lear(Timeout|Interval)?|a(ptureEvents|ll)|reate(StyleSheet|Popup|EventObject))|t(o(GMTString|S(tring|ource)|U(TCString|pperCase)|Lo(caleString|werCase))|est|a(n|int(Enabled)?))|i(s(NaN|Finite)|ndexOf|talics)|d(isableExternalCapture|ump|etachEvent)|u(n(shift|taint|escape|watch)|pdateCommands)|j(oin|avaEnabled)|p(o(p|w)|ush|lugins.refresh|a(ddings|rse(Int|Float)?)|r(int|ompt|eference))|e(scape|nableExternalCapture|val|lementFromPoint|x(p|ec(Script|Command)?))|valueOf|UTC|queryCommand(State|Indeterm|Enabled|Value)|f(i(nd|le(ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(nt(size|color)|rward)|loor|romCharCode)|watch|l(ink|o(ad|g)|astIndexOf)|a(sin|nchor|cos|t(tachEvent|ob|an(2)?)|pply|lert|b(s|ort))|r(ou(nd|teEvents)|e(size(By|To)|calc|turnValue|place|verse|l(oad|ease(Capture|Events)))|andom)|g(o|et(ResponseHeader|M(i(nutes|lliseconds)|onth)|Se(conds|lection)|Hours|Year|Time(zoneOffset)?|Da(y|te)|UTC(M(i(nutes|lliseconds)|onth)|Seconds|Hours|Da(y|te)|FullYear)|FullYear|A(ttention|llResponseHeaders)))|m(in|ove(B(y|elow)|To(Absolute)?|Above)|ergeAttributes|a(tch|rgins|x))|b(toa|ig|o(ld|rderWidths)|link|ack))\b(?=\() + name + support.function.js + + + match + \b(s(ub(stringData|mit)|plitText|e(t(NamedItem|Attribute(Node)?)|lect))|has(ChildNodes|Feature)|namedItem|c(l(ick|o(se|neNode))|reate(C(omment|DATASection|aption)|T(Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(ntityReference|lement)|Attribute))|tabIndex|i(nsert(Row|Before|Cell|Data)|tem)|open|delete(Row|C(ell|aption)|T(Head|Foot)|Data)|focus|write(ln)?|a(dd|ppend(Child|Data))|re(set|place(Child|Data)|move(NamedItem|Child|Attribute(Node)?)?)|get(NamedItem|Element(sBy(Name|TagName)|ById)|Attribute(Node)?)|blur)\b(?=\() + name + support.function.dom.js + + + match + (?<=\.)(s(ystemLanguage|cr(ipts|ollbars|een(X|Y|Top|Left))|t(yle(Sheets)?|atus(Text|bar)?)|ibling(Below|Above)|ource|uffixes|e(curity(Policy)?|l(ection|f)))|h(istory|ost(name)?|as(h|Focus))|y|X(MLDocument|SLDocument)|n(ext|ame(space(s|URI)|Prop))|M(IN_VALUE|AX_VALUE)|c(haracterSet|o(n(structor|trollers)|okieEnabled|lorDepth|mp(onents|lete))|urrent|puClass|l(i(p(boardData)?|entInformation)|osed|asses)|alle(e|r)|rypto)|t(o(olbar|p)|ext(Transform|Indent|Decoration|Align)|ags)|SQRT(1_2|2)|i(n(ner(Height|Width)|put)|ds|gnoreCase)|zIndex|o(scpu|n(readystatechange|Line)|uter(Height|Width)|p(sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(i(splay|alog(Height|Top|Width|Left|Arguments)|rectories)|e(scription|fault(Status|Ch(ecked|arset)|View)))|u(ser(Profile|Language|Agent)|n(iqueID|defined)|pdateInterval)|_content|p(ixelDepth|ort|ersonalbar|kcs11|l(ugins|atform)|a(thname|dding(Right|Bottom|Top|Left)|rent(Window|Layer)?|ge(X(Offset)?|Y(Offset)?))|r(o(to(col|type)|duct(Sub)?|mpter)|e(vious|fix)))|e(n(coding|abledPlugin)|x(ternal|pando)|mbeds)|v(isibility|endor(Sub)?|Linkcolor)|URLUnencoded|P(I|OSITIVE_INFINITY)|f(ilename|o(nt(Size|Family|Weight)|rmName)|rame(s|Element)|gColor)|E|whiteSpace|l(i(stStyleType|n(eHeight|kColor))|o(ca(tion(bar)?|lName)|wsrc)|e(ngth|ft(Context)?)|a(st(M(odified|atch)|Index|Paren)|yer(s|X)|nguage))|a(pp(MinorVersion|Name|Co(deName|re)|Version)|vail(Height|Top|Width|Left)|ll|r(ity|guments)|Linkcolor|bove)|r(ight(Context)?|e(sponse(XML|Text)|adyState))|global|x|m(imeTypes|ultiline|enubar|argin(Right|Bottom|Top|Left))|L(N(10|2)|OG(10E|2E))|b(o(ttom|rder(RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(Color|Image)))\b + name + support.constant.js + + + match + (?<=\.)(s(hape|ystemId|c(heme|ope|rolling)|ta(ndby|rt)|ize|ummary|pecified|e(ctionRowIndex|lected(Index)?)|rc)|h(space|t(tpEquiv|mlFor)|e(ight|aders)|ref(lang)?)|n(o(Resize|tation(s|Name)|Shade|Href|de(Name|Type|Value)|Wrap)|extSibling|ame)|c(h(ildNodes|Off|ecked|arset)?|ite|o(ntent|o(kie|rds)|de(Base|Type)?|l(s|Span|or)|mpact)|ell(s|Spacing|Padding)|l(ear|assName)|aption)|t(ype|Bodies|itle|Head|ext|a(rget|gName)|Foot)|i(sMap|ndex|d|m(plementation|ages))|o(ptions|wnerDocument|bject)|d(i(sabled|r)|o(c(type|umentElement)|main)|e(clare|f(er|ault(Selected|Checked|Value)))|at(eTime|a))|useMap|p(ublicId|arentNode|r(o(file|mpt)|eviousSibling))|e(n(ctype|tities)|vent|lements)|v(space|ersion|alue(Type)?|Link|Align)|URL|f(irstChild|orm(s)?|ace|rame(Border)?)|width|l(ink(s)?|o(ngDesc|wSrc)|a(stChild|ng|bel))|a(nchors|c(ce(ssKey|pt(Charset)?)|tion)|ttributes|pplets|l(t|ign)|r(chive|eas)|xis|Link|bbr)|r(ow(s|Span|Index)|ules|e(v|ferrer|l|adOnly))|m(ultiple|e(thod|dia)|a(rgin(Height|Width)|xLength))|b(o(dy|rder)|ackground|gColor))\b + name + support.constant.dom.js + + + match + \b(ELEMENT_NODE|ATTRIBUTE_NODE|TEXT_NODE|CDATA_SECTION_NODE|ENTITY_REFERENCE_NODE|ENTITY_NODE|PROCESSING_INSTRUCTION_NODE|COMMENT_NODE|DOCUMENT_NODE|DOCUMENT_TYPE_NODE|DOCUMENT_FRAGMENT_NODE|NOTATION_NODE|INDEX_SIZE_ERR|DOMSTRING_SIZE_ERR|HIERARCHY_REQUEST_ERR|WRONG_DOCUMENT_ERR|INVALID_CHARACTER_ERR|NO_DATA_ALLOWED_ERR|NO_MODIFICATION_ALLOWED_ERR|NOT_FOUND_ERR|NOT_SUPPORTED_ERR|INUSE_ATTRIBUTE_ERR)\b + name + support.constant.dom.js + + + match + \bon(R(ow(s(inserted|delete)|e(nter|xit))|e(s(ize(start|end)?|et)|adystatechange))|Mouse(o(ut|ver)|down|up|move)|B(efore(cut|deactivate|u(nload|pdate)|p(aste|rint)|editfocus|activate)|lur)|S(croll|top|ubmit|elect(start|ionchange)?)|H(over|elp)|C(hange|ont(extmenu|rolselect)|ut|ellchange|l(ick|ose))|D(eactivate|ata(setc(hanged|omplete)|available)|r(op|ag(start|over|drop|en(ter|d)|leave)?)|blclick)|Unload|P(aste|ropertychange)|Error(update)?|Key(down|up|press)|Focus|Load|A(ctivate|fter(update|print)|bort))\b + name + support.function.event-handler.js + + + match + !|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|/=|%=|\+=|\-=|&=|\^=|\b(in|instanceof|new|delete|typeof|void)\b + name + keyword.operator.js + + + match + \b(Infinity|NaN|Undefined)\b + name + constant.language.js + + + begin + (?<=[=(:]|^|return)\s*(/)(?![/*+{}?]) + beginCaptures + + 1 + + name + punctuation.definition.string.begin.js + + + end + (/)[igm]* + endCaptures + + 1 + + name + punctuation.definition.string.end.js + + + name + string.regexp.js + patterns + + + match + \\. + name + constant.character.escape.js + + + + + match + \; + name + punctuation.terminator.statement.js + + + match + ,[ |\t]* + name + meta.delimiter.object.comma.js + + + match + \. + name + meta.delimiter.method.period.js + + + match + \{|\} + name + meta.brace.curly.js + + + match + \(|\) + name + meta.brace.round.js + + + match + \[|\] + name + meta.brace.square.js + + + scopeName + source.js.basic + uuid + 0D2D03B9-F18B-4D9D-A960-716FDEC35331 + + diff --git a/info.plist b/info.plist index 16ac3e7..b804b73 100644 --- a/info.plist +++ b/info.plist @@ -130,7 +130,6 @@ 009A3E6C-FE3F-4A18-8759-2DC31F17BBE2 7B9AEFCC-B450-416D-8527-430FE2A08568 9E0E3BCC-7F20-4D6B-891D-A44D6EC56E31 - 0C6DE5D1-2AAA-4327-A746-94FCCD7A45C9 6D3097A0-7065-480A-9DE2-D7EEE181E783 uuid From 581d5ad997676085d9725c871c0af11dbfc1879e Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Wed, 5 Dec 2007 21:22:56 +0000 Subject: [PATCH 075/243] Changes scopes. source.js => source.js.base, source.js.basic => source.js Include source.js.basic if you want embedded javascript in your language. Include source.js.base if you want to extend javascript, EG: MooTools git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@8614 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript Basic.tmLanguage | 2 +- Syntaxes/JavaScript.plist | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Syntaxes/JavaScript Basic.tmLanguage b/Syntaxes/JavaScript Basic.tmLanguage index e4771e9..fe92bfe 100644 --- a/Syntaxes/JavaScript Basic.tmLanguage +++ b/Syntaxes/JavaScript Basic.tmLanguage @@ -644,7 +644,7 @@ scopeName - source.js.basic + source.js uuid 0D2D03B9-F18B-4D9D-A960-716FDEC35331 diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index a98d717..1895106 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -55,7 +55,7 @@ include - source.js.basic + source.js captures @@ -649,7 +649,7 @@ scopeName - source.js + source.js.base uuid 93E017CC-6F27-11D9-90EB-000D93589AF6 From f577ae87e4f5b39ac26ebfd04fefb2ebe76504f6 Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Sun, 9 Dec 2007 08:18:54 +0000 Subject: [PATCH 076/243] Renamed "Javascript Basic" to "Javascript Embedded" Thanks Infin. New scope: meta.complete.method for the first character of white space after a dot. git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@8631 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript Basic.tmLanguage | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Syntaxes/JavaScript Basic.tmLanguage b/Syntaxes/JavaScript Basic.tmLanguage index fe92bfe..e4d8f91 100644 --- a/Syntaxes/JavaScript Basic.tmLanguage +++ b/Syntaxes/JavaScript Basic.tmLanguage @@ -17,7 +17,7 @@ keyEquivalent ^~J name - JavaScript Basic + Embedded JavaScript patterns @@ -642,6 +642,12 @@ name meta.brace.square.js + + match + (?<=\.)\s + name + meta.complete.method + scopeName source.js From f6ff90bedcc468f230a776f3d04f9b5278109d4e Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Sun, 9 Dec 2007 08:19:12 +0000 Subject: [PATCH 077/243] Split out object-properties into the repository to keep things clean git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@8632 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 204 ++++++++++++++++++++------------------ 1 file changed, 107 insertions(+), 97 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 1895106..89128cd 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -185,103 +185,8 @@ patterns - captures - - 1 - - name - invalid.illegal.delimiter.object.comma.js - - - match - (,)\s*+(?=\}) - - - captures - - 1 - - name - string.quoted.double.js - - 2 - - name - punctuation.definition.string.js - - 3 - - name - constant.other.object.key.js - - 4 - - name - punctuation.definition.string.js - - 5 - - name - punctuation.separator.objects.js - - - comment - "something" : - match - ((")([^"]*)(")\s*)(:)\s*+(?!function) - - - captures - - 1 - - name - string.quoted.single.js - - 2 - - name - punctuation.definition.string.js - - 3 - - name - constant.other.object.key.js - - 4 - - name - punctuation.definition.string.js - - 5 - - name - punctuation.separator.objects.js - - - comment - 'something' : - match - ((')([^']*)(')\s*)(:)\s*+(?!function) - - - captures - - 1 - - name - constant.other.object.key.js - - 2 - - name - punctuation.separator.objects.js - - - comment - something : - match - \b(\w+\b\s*)(:)\s*+(?!function) + include + #object-properties include @@ -647,6 +552,111 @@ + object-properties + + patterns + + + captures + + 1 + + name + invalid.illegal.delimiter.object.comma.js + + + match + (,)\s*+(?=\}) + + + captures + + 1 + + name + string.quoted.double.js + + 2 + + name + punctuation.definition.string.js + + 3 + + name + constant.other.object.key.js + + 4 + + name + punctuation.definition.string.js + + 5 + + name + punctuation.separator.objects.js + + + comment + "something" : + match + ((")([^"]*)(")\s*)(:)\s*+(?!function) + + + captures + + 1 + + name + string.quoted.single.js + + 2 + + name + punctuation.definition.string.js + + 3 + + name + constant.other.object.key.js + + 4 + + name + punctuation.definition.string.js + + 5 + + name + punctuation.separator.objects.js + + + comment + 'something' : + match + ((')([^']*)(')\s*)(:)\s*+(?!function) + + + captures + + 1 + + name + constant.other.object.key.js + + 2 + + name + punctuation.separator.objects.js + + + comment + something : + match + \b(\w+\b\s*)(:)\s*+(?!function) + + + scopeName source.js.base From 1f347c3df7f02591464aa7a9fa78b9d29ca0dadc Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Sun, 9 Dec 2007 08:19:31 +0000 Subject: [PATCH 078/243] Cleaned up snippets git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@8633 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Snippets/Object Method.tmSnippet | 6 +++--- Snippets/function (fun).plist | 4 ++-- Snippets/function.tmSnippet | 2 +- Snippets/setTimeout function.tmSnippet | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Snippets/Object Method.tmSnippet b/Snippets/Object Method.tmSnippet index 5ee0d08..62b3489 100644 --- a/Snippets/Object Method.tmSnippet +++ b/Snippets/Object Method.tmSnippet @@ -1,11 +1,11 @@ - + content - ${1:method_name}: function(${3:attribute}){ + ${1:}: function(${3:argument}){ $0 -}${10:,} +}, name Object Method scope diff --git a/Snippets/function (fun).plist b/Snippets/function (fun).plist index 0ca6d4e..f8a5177 100644 --- a/Snippets/function (fun).plist +++ b/Snippets/function (fun).plist @@ -1,9 +1,9 @@ - + content - function ${1:function_name} (${2:argument}) { + function ${1:function_name}(${2:argument}) { ${0:// body...} } name diff --git a/Snippets/function.tmSnippet b/Snippets/function.tmSnippet index b9bf6f6..f95fea1 100644 --- a/Snippets/function.tmSnippet +++ b/Snippets/function.tmSnippet @@ -3,7 +3,7 @@ content - function($1){${0:$TM_SELECTED_TEXT}} + function($1){${0:${TM_SELECTED_TEXT}}} name Anonymous Function scope diff --git a/Snippets/setTimeout function.tmSnippet b/Snippets/setTimeout function.tmSnippet index 5d9894e..b248c4e 100644 --- a/Snippets/setTimeout function.tmSnippet +++ b/Snippets/setTimeout function.tmSnippet @@ -1,9 +1,9 @@ - + content - setTimeout(function() {$0}${2:}, ${1:10}); + setTimeout(${20:function(){$0\}}, ${10:10}); name setTimeout function scope From b6f84d2641cd2926b2a882b666262c461d8555d1 Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Sun, 9 Dec 2007 08:20:27 +0000 Subject: [PATCH 079/243] =?UTF-8?q?New=20"for=20(in){=E2=80=A6}"=20snippet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@8634 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- "Snippets/for (in) {\342\200\246}.tmSnippet" | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 "Snippets/for (in) {\342\200\246}.tmSnippet" diff --git "a/Snippets/for (in) {\342\200\246}.tmSnippet" "b/Snippets/for (in) {\342\200\246}.tmSnippet" new file mode 100644 index 0000000..fd70d9b --- /dev/null +++ "b/Snippets/for (in) {\342\200\246}.tmSnippet" @@ -0,0 +1,18 @@ + + + + + content + for (${1:x} in ${2:Things}) { + ${0:${1:x}} +}; + name + for (in) {…} + scope + source.js + tabTrigger + forin + uuid + 3F4AB53B-210C-4E0C-8D04-12192DECC3D1 + + From bc39c3bdca5c2e13b810b6a280af279ddc7033b6 Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Fri, 14 Mar 2008 18:31:48 +0000 Subject: [PATCH 080/243] Cleaned up "for in" snippets and added a new ultra-fast one from quirksmode. git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@9114 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- "Snippets/for (in) {\342\200\246}.tmSnippet" | 2 +- ...2\200\246) {\342\200\246} (PPK).tmSnippet" | 19 +++++++++++++++++++ ...r (\342\200\246) {\342\200\246}.tmSnippet" | 2 +- info.plist | 5 ++++- 4 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 "Snippets/for (\342\200\246) {\342\200\246} (PPK).tmSnippet" diff --git "a/Snippets/for (in) {\342\200\246}.tmSnippet" "b/Snippets/for (in) {\342\200\246}.tmSnippet" index fd70d9b..d7e0848 100644 --- "a/Snippets/for (in) {\342\200\246}.tmSnippet" +++ "b/Snippets/for (in) {\342\200\246}.tmSnippet" @@ -3,7 +3,7 @@ content - for (${1:x} in ${2:Things}) { + for (var ${1:x} in ${2:Things}) { ${0:${1:x}} }; name diff --git "a/Snippets/for (\342\200\246) {\342\200\246} (PPK).tmSnippet" "b/Snippets/for (\342\200\246) {\342\200\246} (PPK).tmSnippet" new file mode 100644 index 0000000..b1a0630 --- /dev/null +++ "b/Snippets/for (\342\200\246) {\342\200\246} (PPK).tmSnippet" @@ -0,0 +1,19 @@ + + + + + content + for (var ${20:i}=0,${30:${1/(.+)(s)?/$0/}}; ${2:thing}=${1:Things}[${20:i}]; ${20:i}++){ + $0 +}; + + name + for (…) {…} (PPK) + scope + source.js + tabTrigger + for + uuid + 9BF3315C-88FF-46A1-89E1-9A5E9EAC78D0 + + diff --git "a/Snippets/for (\342\200\246) {\342\200\246}.tmSnippet" "b/Snippets/for (\342\200\246) {\342\200\246}.tmSnippet" index d41b047..6208a16 100644 --- "a/Snippets/for (\342\200\246) {\342\200\246}.tmSnippet" +++ "b/Snippets/for (\342\200\246) {\342\200\246}.tmSnippet" @@ -1,5 +1,5 @@ - + content diff --git a/info.plist b/info.plist index b804b73..c181afb 100644 --- a/info.plist +++ b/info.plist @@ -125,12 +125,15 @@ 31964029-9D71-4ADC-8213-DFE5C4E222B3 011C4681-FBEC-4891-9326-3DECFCDED6D6 C207B7C3-5597-4873-8AAD-C46FB8842AF2 + 9BF3315C-88FF-46A1-89E1-9A5E9EAC78D0 AD506BEC-B33C-4168-A900-0A4D386A4B05 DC8B46FB-8ADA-45EA-8F36-94C807A0D302 009A3E6C-FE3F-4A18-8759-2DC31F17BBE2 7B9AEFCC-B450-416D-8527-430FE2A08568 9E0E3BCC-7F20-4D6B-891D-A44D6EC56E31 - 6D3097A0-7065-480A-9DE2-D7EEE181E783 + 20E61C43-B81F-4FB9-9362-BFFE668EB9C9 + 36EC03E9-EFF4-479A-AB90-8DFA16800642 + 3F4AB53B-210C-4E0C-8D04-12192DECC3D1 uuid AAB4FD74-73F9-11D9-B89A-000D93589AF6 From d72e54c64da7afab96e5fa510de182ba37627eb5 Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Sun, 16 Mar 2008 02:38:15 +0000 Subject: [PATCH 081/243] Fixed the parsing of object values that are regular expression literal. Thanks Daniel Stockman git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@9126 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 89128cd..6f849c5 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -600,7 +600,7 @@ comment "something" : match - ((")([^"]*)(")\s*)(:)\s*+(?!function) + ((")([^"]*)(")\s*)(:)(?!\s*+function) captures @@ -634,7 +634,7 @@ comment 'something' : match - ((')([^']*)(')\s*)(:)\s*+(?!function) + ((')([^']*)(')\s*)(:)(?!\s*+function) captures @@ -653,7 +653,7 @@ comment something : match - \b(\w+\b\s*)(:)\s*+(?!function) + \b(\w+\b\s*)(:)(?!\s*+function) From 151f7a83eb8392c3e76771dd075f2a4902b1fb5d Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Sun, 16 Mar 2008 03:24:13 +0000 Subject: [PATCH 082/243] Don't match a single slash (/) as a regex literal unless there's another one on the same line. Force Regex literals to end at the end of the line. This helps solve some performance issues while coding. Thanks Daniel Stockman git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@9128 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript Basic.tmLanguage | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Syntaxes/JavaScript Basic.tmLanguage b/Syntaxes/JavaScript Basic.tmLanguage index e4d8f91..25bf7c0 100644 --- a/Syntaxes/JavaScript Basic.tmLanguage +++ b/Syntaxes/JavaScript Basic.tmLanguage @@ -575,7 +575,7 @@ begin - (?<=[=(:]|^|return)\s*(/)(?![/*+{}?]) + (?<=[=(:]|^|return)\s*(/)(?![/*+{}?]|$) beginCaptures 1 @@ -585,7 +585,7 @@ end - (/)[igm]* + (/)[igm]*|$ endCaptures 1 From 7a80c6d2ab11f13932932109f7418db7d33dc2b3 Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Sun, 16 Mar 2008 06:14:13 +0000 Subject: [PATCH 083/243] Fixed snippet. I'd accidentally sent a half-finished version :'( git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@9129 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- "Snippets/for (\342\200\246) {\342\200\246} (PPK).tmSnippet" | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git "a/Snippets/for (\342\200\246) {\342\200\246} (PPK).tmSnippet" "b/Snippets/for (\342\200\246) {\342\200\246} (PPK).tmSnippet" index b1a0630..b34c0f5 100644 --- "a/Snippets/for (\342\200\246) {\342\200\246} (PPK).tmSnippet" +++ "b/Snippets/for (\342\200\246) {\342\200\246} (PPK).tmSnippet" @@ -3,8 +3,8 @@ content - for (var ${20:i}=0,${30:${1/(.+)(s)?/$0/}}; ${2:thing}=${1:Things}[${20:i}]; ${20:i}++){ - $0 + for (var ${20:i}=0,${2:thing}; ${2:thing}=${1:Things}[${20:i}]; ${20:i}++){ + ${2:thing}$0 }; name From bb8deef61d79009bd231360c9475cf6f3e40fdee Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Sun, 16 Mar 2008 06:16:45 +0000 Subject: [PATCH 084/243] 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 From b84367b1268645397f72462d59e51043f638071a Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Sun, 16 Mar 2008 06:35:43 +0000 Subject: [PATCH 085/243] Fixed regression with nested groups and functions git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@9131 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 8915844..3a00f44 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -169,7 +169,7 @@ begin - (?<!\))(\{) + (\{) captures 1 From 7e0e08cd6aa835ced1b2ea04ae97c5505ffc4cf8 Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Wed, 2 Jul 2008 11:04:01 -0400 Subject: [PATCH 086/243] =?UTF-8?q?Unifying=20the=20"for"=20snippets=20dif?= =?UTF-8?q?f=20--git=20"a/Snippets/for=20(in)=20{\342\200\246}.tmSnippet"?= =?UTF-8?q?=20"b/Snippets/for=20(in)=20{\342\200\246}.tmSnippet"=20index?= =?UTF-8?q?=20d7e0848..b64dede=20100644=20---=20"a/Snippets/for=20(in)=20{?= =?UTF-8?q?\342\200\246}.tmSnippet"=20+++=20"b/Snippets/for=20(in)=20{\342?= =?UTF-8?q?\200\246}.tmSnippet"=20@@=20-3,8=20+3,8=20@@=20=20=20=20=20=20=09content=20-=09for=20(var=20${1:x}=20in=20${2:Things})=20{=20-=09${0:${1:x}?= =?UTF-8?q?}=20+=09for=20(var=20${1:thing}=20in=20${2:Things})=20{?= =?UTF-8?q?=20+=09$0${1:thing}=20=20};=20=20=09name=20?= =?UTF-8?q?=20=09for=20(in)=20{=E2=80=A6}=20diff=20--git?= =?UTF-8?q?=20"a/Snippets/for=20(\342\200\246)=20{\342\200\246}=20(PPK).tm?= =?UTF-8?q?Snippet"=20"b/Snippets/for=20(\342\200\246)=20{\342\200\246}=20?= =?UTF-8?q?(PPK).tmSnippet"=20index=20b34c0f5..9408455=20100644=20---=20"a?= =?UTF-8?q?/Snippets/for=20(\342\200\246)=20{\342\200\246}=20(PPK).tmSnipp?= =?UTF-8?q?et"=20+++=20"b/Snippets/for=20(\342\200\246)=20{\342\200\246}?= =?UTF-8?q?=20(PPK).tmSnippet"=20@@=20-4,7=20+4,7=20@@=20=20=20=20?= =?UTF-8?q?=09content=20=20=09for=20(var=20${20:i}=3D0,?= =?UTF-8?q?${2:thing};=20${2:thing}=3D${1:Things}[${20:i}];=20${20:i}++){?= =?UTF-8?q?=20-=09${2:thing}$0=20+=09$0${2:thing}=20=20};=20=20?= =?UTF-8?q?=20=20=09name=20diff=20--git=20"a/Snippets/for=20(\3?= =?UTF-8?q?42\200\246)=20{\342\200\246}=20(faster).tmSnippet"=20"b/Snippet?= =?UTF-8?q?s/for=20(\342\200\246)=20{\342\200\246}=20(faster).tmSnippet"?= =?UTF-8?q?=20index=2034e6b71..2853eb2=20100644=20---=20"a/Snippets/for=20?= =?UTF-8?q?(\342\200\246)=20{\342\200\246}=20(faster).tmSnippet"=20+++=20"?= =?UTF-8?q?b/Snippets/for=20(\342\200\246)=20{\342\200\246}=20(faster).tmS?= =?UTF-8?q?nippet"=20@@=20-1,10=20+1,10=20@@=20=20<=3Fxml=20version=3D"1.0?= =?UTF-8?q?"=20encoding=3D"UTF-8"=3F>=20-=20+=20=20=20=20=20=20=09content=20=20=09for=20(var=20${20:?= =?UTF-8?q?i}=20=3D=20${1:Things}.length=20-=201;=20${20:i}=20>=3D=200;?= =?UTF-8?q?=20${20:i}--){=20-=09${100:${1:Things}[${20:i}]}$0=20+=09$0${10?= =?UTF-8?q?0:${1:Things}[${20:i}]}=20=20};=20=20=09name=20=20=09for=20(=E2=80=A6)=20{=E2=80=A6}=20(Improved?= =?UTF-8?q?=20Native=20For-Loop)=20diff=20--git=20"a/Snippets/for?= =?UTF-8?q?=20(\342\200\246)=20{\342\200\246}.tmSnippet"=20"b/Snippets/for?= =?UTF-8?q?=20(\342\200\246)=20{\342\200\246}.tmSnippet"=20index=206208a16?= =?UTF-8?q?..852d3f5=20100644=20---=20"a/Snippets/for=20(\342\200\246)=20{?= =?UTF-8?q?\342\200\246}.tmSnippet"=20+++=20"b/Snippets/for=20(\342\200\24?= =?UTF-8?q?6)=20{\342\200\246}.tmSnippet"=20@@=20-4,7=20+4,7=20@@=20=20=20=20=09content=20=20=09for=20(var=20${2?= =?UTF-8?q?0:i}=3D0;=20${20:i}=20<=20${1:Things}.length;=20${20:i}++)?= =?UTF-8?q?=20{=20-=09${100:${1:Things}[${20:i}]}$0=20+=09$0${100:${1:Thin?= =?UTF-8?q?gs}[${20:i}]}=20=20};=20=20=09name=20=20=09?= =?UTF-8?q?for=20(=E2=80=A6)=20{=E2=80=A6}?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "Snippets/for (in) {\342\200\246}.tmSnippet" | 4 ++-- "Snippets/for (\342\200\246) {\342\200\246} (PPK).tmSnippet" | 2 +- .../for (\342\200\246) {\342\200\246} (faster).tmSnippet" | 4 ++-- "Snippets/for (\342\200\246) {\342\200\246}.tmSnippet" | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git "a/Snippets/for (in) {\342\200\246}.tmSnippet" "b/Snippets/for (in) {\342\200\246}.tmSnippet" index d7e0848..b64dede 100644 --- "a/Snippets/for (in) {\342\200\246}.tmSnippet" +++ "b/Snippets/for (in) {\342\200\246}.tmSnippet" @@ -3,8 +3,8 @@ content - for (var ${1:x} in ${2:Things}) { - ${0:${1:x}} + for (var ${1:thing} in ${2:Things}) { + $0${1:thing} }; name for (in) {…} diff --git "a/Snippets/for (\342\200\246) {\342\200\246} (PPK).tmSnippet" "b/Snippets/for (\342\200\246) {\342\200\246} (PPK).tmSnippet" index b34c0f5..9408455 100644 --- "a/Snippets/for (\342\200\246) {\342\200\246} (PPK).tmSnippet" +++ "b/Snippets/for (\342\200\246) {\342\200\246} (PPK).tmSnippet" @@ -4,7 +4,7 @@ content for (var ${20:i}=0,${2:thing}; ${2:thing}=${1:Things}[${20:i}]; ${20:i}++){ - ${2:thing}$0 + $0${2:thing} }; name diff --git "a/Snippets/for (\342\200\246) {\342\200\246} (faster).tmSnippet" "b/Snippets/for (\342\200\246) {\342\200\246} (faster).tmSnippet" index 34e6b71..2853eb2 100644 --- "a/Snippets/for (\342\200\246) {\342\200\246} (faster).tmSnippet" +++ "b/Snippets/for (\342\200\246) {\342\200\246} (faster).tmSnippet" @@ -1,10 +1,10 @@ - + content for (var ${20:i} = ${1:Things}.length - 1; ${20:i} >= 0; ${20:i}--){ - ${100:${1:Things}[${20:i}]}$0 + $0${100:${1:Things}[${20:i}]} }; name for (…) {…} (Improved Native For-Loop) diff --git "a/Snippets/for (\342\200\246) {\342\200\246}.tmSnippet" "b/Snippets/for (\342\200\246) {\342\200\246}.tmSnippet" index 6208a16..852d3f5 100644 --- "a/Snippets/for (\342\200\246) {\342\200\246}.tmSnippet" +++ "b/Snippets/for (\342\200\246) {\342\200\246}.tmSnippet" @@ -4,7 +4,7 @@ content for (var ${20:i}=0; ${20:i} < ${1:Things}.length; ${20:i}++) { - ${100:${1:Things}[${20:i}]}$0 + $0${100:${1:Things}[${20:i}]} }; name for (…) {…} From 16eb9fd50438b87d5c0ed3220fe2dfc7a830ffd9 Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Wed, 2 Jul 2008 11:04:44 -0400 Subject: [PATCH 087/243] Added a tests folder with some starter files --- Tests/Embedded Javascript Test.html | 16 ++++++++++++++++ Tests/Javascript Syntax Test.js | 0 2 files changed, 16 insertions(+) create mode 100644 Tests/Embedded Javascript Test.html create mode 100644 Tests/Javascript Syntax Test.js diff --git a/Tests/Embedded Javascript Test.html b/Tests/Embedded Javascript Test.html new file mode 100644 index 0000000..1c08ebb --- /dev/null +++ b/Tests/Embedded Javascript Test.html @@ -0,0 +1,16 @@ + + + + + Embedded Javascript Test.html + + + + + + diff --git a/Tests/Javascript Syntax Test.js b/Tests/Javascript Syntax Test.js new file mode 100644 index 0000000..e69de29 From 2be7a89002c454bc369a7791963a2ede41757ae5 Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Wed, 2 Jul 2008 11:44:06 -0400 Subject: [PATCH 088/243] Improved meta.function.json.js with punctuation and proper storage.type --- Syntaxes/JavaScript Basic.tmLanguage | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/Syntaxes/JavaScript Basic.tmLanguage b/Syntaxes/JavaScript Basic.tmLanguage index 25bf7c0..a71d8be 100644 --- a/Syntaxes/JavaScript Basic.tmLanguage +++ b/Syntaxes/JavaScript Basic.tmLanguage @@ -201,19 +201,24 @@ 2 name - storage.type.function.js + punctuation.separator.key-value.js 3 name - punctuation.definition.parameters.begin.js + storage.type.function.js 4 name - variable.parameter.function.js + punctuation.definition.parameters.begin.js 5 + + name + variable.parameter.function.js + + 6 name punctuation.definition.parameters.end.js @@ -222,7 +227,7 @@ 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.json.js @@ -237,14 +242,19 @@ 10 name - punctuation.definition.parameters.begin.js + storage.type.function.js 11 name - variable.parameter.function.js + punctuation.definition.parameters.begin.js 12 + + name + variable.parameter.function.js + + 13 name punctuation.definition.parameters.end.js @@ -287,13 +297,13 @@ 9 name - entity.name.function.js + punctuation.separator.key-value.js comment Attempt to match "foo": function match - (?:((')(.*?)('))|((")(.*?)(")))\s*:\s*\b(function)?\s*(\()(.*?)(\)) + (?:((')(.*?)('))|((")(.*?)(")))\s*(:)\s*\b(function)?\s*(\()(.*?)(\)) name meta.function.json.js From f355cab4ce90198bc5ed101db5643836f492d06b Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Wed, 2 Jul 2008 11:47:48 -0400 Subject: [PATCH 089/243] Undefined -> undefined --- Syntaxes/JavaScript Basic.tmLanguage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/JavaScript Basic.tmLanguage b/Syntaxes/JavaScript Basic.tmLanguage index a71d8be..19e49f5 100644 --- a/Syntaxes/JavaScript Basic.tmLanguage +++ b/Syntaxes/JavaScript Basic.tmLanguage @@ -579,7 +579,7 @@ match - \b(Infinity|NaN|Undefined)\b + \b(Infinity|NaN|undefined)\b name constant.language.js From ee10b85ff540bb7684bc440f84bf1aa6eb1af229 Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Wed, 2 Jul 2008 12:17:34 -0400 Subject: [PATCH 090/243] Impriving regexp literals --- Syntaxes/JavaScript Basic.tmLanguage | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/Syntaxes/JavaScript Basic.tmLanguage b/Syntaxes/JavaScript Basic.tmLanguage index 19e49f5..c8e67f0 100644 --- a/Syntaxes/JavaScript Basic.tmLanguage +++ b/Syntaxes/JavaScript Basic.tmLanguage @@ -585,27 +585,44 @@ begin - (?<=[=(:]|^|return)\s*(/)(?![/*+{}?]|$) + (?x) + (?<= [=(:] | ^ | return ) + \s*((/)) (?! [/*+{}?] | $ ) beginCaptures 1 + + name + string.regexp.js + + 2 name punctuation.definition.string.begin.js + contentName + string.regexp.js end - (/)[igm]*|$ + ((/([igm]*)))|$ endCaptures 1 + + name + string.regexp.js + + 2 name punctuation.definition.string.end.js + 3 + + name + keyword.other.js + - name - string.regexp.js patterns From b33bf433e432e49c8d4dfc89b1840010adc2880b Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Wed, 2 Jul 2008 12:19:40 -0400 Subject: [PATCH 091/243] Some syntax tests --- Tests/Javascript Syntax Test.js | 112 ++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) diff --git a/Tests/Javascript Syntax Test.js b/Tests/Javascript Syntax Test.js index e69de29..926f05c 100644 --- a/Tests/Javascript Syntax Test.js +++ b/Tests/Javascript Syntax Test.js @@ -0,0 +1,112 @@ +// ============= +// = FUNCTIONS = +// ============= + +function(argument1,argument2){return argument1 + argument1;}; +function (argument1, argument2) {return argument1 + argument1;}; + + +function funkName(argument1, argument2) { + return argument1 + argument1; +}; +function funkName(argument1, argument2) +{ + return argument1 + argument1; +}; + + +function(argument1, argument2){ + return argument1 + argument1; +}; +function(argument1, argument2) +{ + return argument1 + argument1; +}; + + +new Function("argument1", "argument2", "return argument1 + argument1;"); +var funkName=new Function("argument1", "argument2", "return argument1 + argument1;"); + + +var funkName1 = function funkName (argument1, argument2) {return argument1 + argument1;}; +var funkName1=function funkName(argument1,argument2){return argument1 + argument1;}; + + +// =================== +// = OBJECT LITERALS = +// =================== +var objectName = {}; + +var objectName = { + + stringName : '', + 'stringName' : '', + "stringName" : '', + stringName : "", + 'stringName' : "", + "stringName" : "", + + numberName : 999.999, + 'numberName' : 999.999, + "numberName" : 999.999, + + funkName : function(argument1, argument2){}, + 'funkName' : function(argument1, argument2){}, + "funkName" : function(argument1, argument2){}, + + nullName : null + +}; + +var objectName = { + + keyName : 0, + 'keyName' : 0, + "keyName" : 0 + +}; +objectName[funkName()] = 0; + + +// ============= +// = ARGUMENTS = +// ============= + +funkName(variableName, funkName(), 999.999, "stringName", 'stringName', function(){}, {objectName:{}}, /regex/, null, true, false, undefined); +funkName( + variableName, + funkName(), + 999.999, + "stringName", + 'stringName', + function(){}, + {objectName:{}}, + /regex/, + null, + true, + false, + undefined +); + + +// ========= +// = REGEX = +// ========= +var regexName = /regex/ + +funkName(/regex/, /regex/i) + +[/regex/, /regex/i] + +{keyName : /regex/} + +/regex/ +/regex/i +/regex/g +/regex/m +/regex/igm + +function(){ + return /regex/ +} + From 0bdaea84f64ad44643a070872af47503de4686c7 Mon Sep 17 00:00:00 2001 From: Joseph Pecoraro Date: Wed, 2 Jul 2008 12:36:52 -0400 Subject: [PATCH 092/243] Merging in the regex fixes from Joseph Pecoraro as seen here: http://lists.macromates.com/textmate/2008-June/025973.html --- Syntaxes/JavaScript Basic.tmLanguage | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Syntaxes/JavaScript Basic.tmLanguage b/Syntaxes/JavaScript Basic.tmLanguage index c8e67f0..1d9ac7d 100644 --- a/Syntaxes/JavaScript Basic.tmLanguage +++ b/Syntaxes/JavaScript Basic.tmLanguage @@ -586,7 +586,7 @@ begin (?x) - (?<= [=(:] | ^ | return ) + (?<= [\[,=(:] | ^ | && | return ) \s*((/)) (?! [/*+{}?] | $ ) beginCaptures @@ -641,7 +641,7 @@ match - ,[ |\t]* + , name meta.delimiter.object.comma.js From 6fa933fc137216550a741ea95d245856648c1993 Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Wed, 2 Jul 2008 12:42:58 -0400 Subject: [PATCH 093/243] Don't require a space after the function keyword Merging in a modified version of Joseph Pecoraro's fix here: http://pastie.textmate.org/private/hxkpy8qkahofrxwyvp4coq --- Syntaxes/JavaScript Basic.tmLanguage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/JavaScript Basic.tmLanguage b/Syntaxes/JavaScript Basic.tmLanguage index 1d9ac7d..e15d70e 100644 --- a/Syntaxes/JavaScript Basic.tmLanguage +++ b/Syntaxes/JavaScript Basic.tmLanguage @@ -186,7 +186,7 @@ comment match regular function like: function myFunc(arg) { … } match - \b(function)\s+([a-zA-Z_$]\w*)?\s*(\()(.*?)(\)) + \b(function)(?:\s+([a-zA-Z_$]\w*))?\s*(\()(.*?)(\)) name meta.function.js From 73900868d5f95ba4fbf0ca873b219749130e5abf Mon Sep 17 00:00:00 2001 From: Joseph Pecoraro Date: Wed, 2 Jul 2008 12:52:49 -0400 Subject: [PATCH 094/243] Scientific notation => Ex, 1e5 and 2.5E5 from Joseph Pecoraro --- Syntaxes/JavaScript Basic.tmLanguage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/JavaScript Basic.tmLanguage b/Syntaxes/JavaScript Basic.tmLanguage index e15d70e..2b5a46c 100644 --- a/Syntaxes/JavaScript Basic.tmLanguage +++ b/Syntaxes/JavaScript Basic.tmLanguage @@ -340,7 +340,7 @@ match - \b((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?))\b + \b((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?([eE][-+]?[0-9]+)?))\b name constant.numeric.js From 205fd81c21838749c7158aa8e8262198ba1c3e6a Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Wed, 2 Jul 2008 12:57:25 -0400 Subject: [PATCH 095/243] More syntax tests --- Tests/Javascript Syntax Test.js | 86 +++++++++++++++++++++++++++++++-- 1 file changed, 83 insertions(+), 3 deletions(-) diff --git a/Tests/Javascript Syntax Test.js b/Tests/Javascript Syntax Test.js index 926f05c..e0ab648 100644 --- a/Tests/Javascript Syntax Test.js +++ b/Tests/Javascript Syntax Test.js @@ -94,19 +94,99 @@ funkName( // ========= var regexName = /regex/ +"stringName".match(/regex/) + funkName(/regex/, /regex/i) [/regex/, /regex/i] {keyName : /regex/} +/regex/ && /regex/ /regex/ /regex/i /regex/g /regex/m /regex/igm -function(){ - return /regex/ -} +function(){ return /regex/ } + +/regex/.test('test') +1==1 && /regex/.test('test') + + + +// =========== +// = Numbers = +// =========== +// http://www.hunlock.com/blogs/The_Complete_Javascript_Number_Reference + +999 +.999 +999.999 +4 +16 +256 +65536 +4294967296 +18446744073709552000 +3.402823669209385e+38 +1.157920892373162e+77 +1.3407807929942597e+154 +Infinity +0377 // octal +0xFF // hex +0xff // hex + +-999 +-.999 +-999.999 +-4 +-16 +-256 +-65536 +-4294967296 +-18446744073709552000 +-3.402823669209385e+38 +-1.157920892373162e+77 +-1.3407807929942597e+154 +-Infinity +-0377 // octal +-0xFF // hex +-0xff // hex + +1e5 +2.5E5 + +5e-324 +1.7976931348623157e+308 + +x = x+5; // is the same as x += 5; +x = x-5; // is the same as x -= 5; +x = x*5; // is the same as x *= 5; +x = x/5; // is the same as x /= 5; +x = x%5; // is the same as x %= 5; + +x += 5 +x -= 5 +x *= 5 +x /= 5 +x %= 5 + +x ++ +x -- + +x = x&5; // is the same as x &= 5; +x = x|5; // is the same as x |= 5; +x = x^5; // is the same as x ^= 5; +x = x<<5; // is the same as x <<= 5; +x = x>>5; // is the same as x >>= 5; +x = x>>>5; // is the same as x >>>= 5; + +x &= 5 +x |= 5 +x ^= 5 +x <<= 5 +x >>= 5 +x >>>= 5 From 3c2791d816340c53e9dd85e082b54510ec2fff40 Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Wed, 2 Jul 2008 12:57:58 -0400 Subject: [PATCH 096/243] Removed redundant group scope --- Syntaxes/JavaScript.plist | 2 -- 1 file changed, 2 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 3a00f44..4509038 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -339,8 +339,6 @@ end (}) - name - meta.group.braces.curly.function.js patterns From 1899a8afde5417307025931645f16f606cc938bf Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Wed, 2 Jul 2008 13:00:07 -0400 Subject: [PATCH 097/243] Internet Explorer Conditional Comment snippets --- ...Explorer Conditional Comment Escape.tmSnippet | 16 ++++++++++++++++ ...ternet Explorer Conditional Comment.tmSnippet | 16 ++++++++++++++++ info.plist | 2 ++ 3 files changed, 34 insertions(+) create mode 100644 Snippets/Internet Explorer Conditional Comment Escape.tmSnippet create mode 100644 Snippets/Internet Explorer Conditional Comment.tmSnippet diff --git a/Snippets/Internet Explorer Conditional Comment Escape.tmSnippet b/Snippets/Internet Explorer Conditional Comment Escape.tmSnippet new file mode 100644 index 0000000..ecea148 --- /dev/null +++ b/Snippets/Internet Explorer Conditional Comment Escape.tmSnippet @@ -0,0 +1,16 @@ + + + + + content + @*/${0:$TM_SELECTED_TEXT}/*@ + name + Internet Explorer Conditional Comment Escape + scope + source.js comment.block.conditional + tabTrigger + @ + uuid + 603A6D98-A136-4766-828B-C39178AB8003 + + diff --git a/Snippets/Internet Explorer Conditional Comment.tmSnippet b/Snippets/Internet Explorer Conditional Comment.tmSnippet new file mode 100644 index 0000000..b86ce88 --- /dev/null +++ b/Snippets/Internet Explorer Conditional Comment.tmSnippet @@ -0,0 +1,16 @@ + + + + + content + /*@cc_on ${0:$TM_SELECTED_TEXT} @*/ + name + Internet Explorer Conditional Comment + scope + source.js + tabTrigger + @ + uuid + E1B2FC98-AF98-4392-8069-C82C2C192617 + + diff --git a/info.plist b/info.plist index c181afb..abb63a5 100644 --- a/info.plist +++ b/info.plist @@ -134,6 +134,8 @@ 20E61C43-B81F-4FB9-9362-BFFE668EB9C9 36EC03E9-EFF4-479A-AB90-8DFA16800642 3F4AB53B-210C-4E0C-8D04-12192DECC3D1 + E1B2FC98-AF98-4392-8069-C82C2C192617 + 603A6D98-A136-4766-828B-C39178AB8003 uuid AAB4FD74-73F9-11D9-B89A-000D93589AF6 From 7ca0d476cfe4d4db6f8eb303cc894b3daa2c5621 Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Wed, 2 Jul 2008 17:00:59 +0000 Subject: [PATCH 098/243] =?UTF-8?q?Unifying=20the=20"for"=20snippets=20dif?= =?UTF-8?q?f=20--git=20"a/Snippets/for=20(in)=20{\342\200\246}.tmSnippet"?= =?UTF-8?q?=20"b/Snippets/for=20(in)=20{\342\200\246}.tmSnippet"=20index?= =?UTF-8?q?=20d7e0848..b64dede=20100644=20---=20"a/Snippets/for=20(in)=20{?= =?UTF-8?q?\342\200\246}.tmSnippet"=20+++=20"b/Snippets/for=20(in)=20{\342?= =?UTF-8?q?\200\246}.tmSnippet"=20@@=20-3,8=20+3,8=20@@=20=20=20=20=20=20=09content=20-=09for=20(var=20${1:x}=20in=20${2:Things})=20{=20-=09${0:${1:x}?= =?UTF-8?q?}=20+=09for=20(var=20${1:thing}=20in=20${2:Things})=20{?= =?UTF-8?q?=20+=09$0${1:thing}=20=20};=20=20=09name=20?= =?UTF-8?q?=20=09for=20(in)=20{=E2=80=A6}=20diff=20--git?= =?UTF-8?q?=20"a/Snippets/for=20(\342\200\246)=20{\342\200\246}=20(PPK).tm?= =?UTF-8?q?Snippet"=20"b/Snippets/for=20(\342\200\246)=20{\342\200\246}=20?= =?UTF-8?q?(PPK).tmSnippet"=20index=20b34c0f5..9408455=20100644=20---=20"a?= =?UTF-8?q?/Snippets/for=20(\342\200\246)=20{\342\200\246}=20(PPK).tmSnipp?= =?UTF-8?q?et"=20+++=20"b/Snippets/for=20(\342\200\246)=20{\342\200\246}?= =?UTF-8?q?=20(PPK).tmSnippet"=20@@=20-4,7=20+4,7=20@@=20=20=20=20?= =?UTF-8?q?=09content=20=20=09for=20(var=20${20:i}=3D0,?= =?UTF-8?q?${2:thing};=20${2:thing}=3D${1:Things}[${20:i}];=20${20:i}++){?= =?UTF-8?q?=20-=09${2:thing}$0=20+=09$0${2:thing}=20=20};=20=20?= =?UTF-8?q?=20=20=09name=20diff=20--git=20"a/Snippets/for=20(\3?= =?UTF-8?q?42\200\246)=20{\342\200\246}=20(faster).tmSnippet"=20"b/Snippet?= =?UTF-8?q?s/for=20(\342\200\246)=20{\342\200\246}=20(faster).tmSnippet"?= =?UTF-8?q?=20index=2034e6b71..2853eb2=20100644=20---=20"a/Snippets/for=20?= =?UTF-8?q?(\342\200\246)=20{\342\200\246}=20(faster).tmSnippet"=20+++=20"?= =?UTF-8?q?b/Snippets/for=20(\342\200\246)=20{\342\200\246}=20(faster).tmS?= =?UTF-8?q?nippet"=20@@=20-1,10=20+1,10=20@@=20=20<=3Fxml=20version=3D"1.0?= =?UTF-8?q?"=20encoding=3D"UTF-8"=3F>=20-=20+=20=20=20=20=20=20=09content=20=20=09for=20(var=20${20:?= =?UTF-8?q?i}=20=3D=20${1:Things}.length=20-=201;=20${20:i}=20>=3D=200;?= =?UTF-8?q?=20${20:i}--){=20-=09${100:${1:Things}[${20:i}]}$0=20+=09$0${10?= =?UTF-8?q?0:${1:Things}[${20:i}]}=20=20};=20=20=09name=20=20=09for=20(=E2=80=A6)=20{=E2=80=A6}=20(Improved?= =?UTF-8?q?=20Native=20For-Loop)=20diff=20--git=20"a/Snippets/for?= =?UTF-8?q?=20(\342\200\246)=20{\342\200\246}.tmSnippet"=20"b/Snippets/for?= =?UTF-8?q?=20(\342\200\246)=20{\342\200\246}.tmSnippet"=20index=206208a16?= =?UTF-8?q?..852d3f5=20100644=20---=20"a/Snippets/for=20(\342\200\246)=20{?= =?UTF-8?q?\342\200\246}.tmSnippet"=20+++=20"b/Snippets/for=20(\342\200\24?= =?UTF-8?q?6)=20{\342\200\246}.tmSnippet"=20@@=20-4,7=20+4,7=20@@=20=20=20=20=09content=20=20=09for=20(var=20${2?= =?UTF-8?q?0:i}=3D0;=20${20:i}=20<=20${1:Things}.length;=20${20:i}++)?= =?UTF-8?q?=20{=20-=09${100:${1:Things}[${20:i}]}$0=20+=09$0${100:${1:Thin?= =?UTF-8?q?gs}[${20:i}]}=20=20};=20=20=09name=20=20=09?= =?UTF-8?q?for=20(=E2=80=A6)=20{=E2=80=A6}?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@10103 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- "Snippets/for (in) {\342\200\246}.tmSnippet" | 4 ++-- "Snippets/for (\342\200\246) {\342\200\246} (PPK).tmSnippet" | 2 +- .../for (\342\200\246) {\342\200\246} (faster).tmSnippet" | 4 ++-- "Snippets/for (\342\200\246) {\342\200\246}.tmSnippet" | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git "a/Snippets/for (in) {\342\200\246}.tmSnippet" "b/Snippets/for (in) {\342\200\246}.tmSnippet" index d7e0848..b64dede 100644 --- "a/Snippets/for (in) {\342\200\246}.tmSnippet" +++ "b/Snippets/for (in) {\342\200\246}.tmSnippet" @@ -3,8 +3,8 @@ content - for (var ${1:x} in ${2:Things}) { - ${0:${1:x}} + for (var ${1:thing} in ${2:Things}) { + $0${1:thing} }; name for (in) {…} diff --git "a/Snippets/for (\342\200\246) {\342\200\246} (PPK).tmSnippet" "b/Snippets/for (\342\200\246) {\342\200\246} (PPK).tmSnippet" index b34c0f5..9408455 100644 --- "a/Snippets/for (\342\200\246) {\342\200\246} (PPK).tmSnippet" +++ "b/Snippets/for (\342\200\246) {\342\200\246} (PPK).tmSnippet" @@ -4,7 +4,7 @@ content for (var ${20:i}=0,${2:thing}; ${2:thing}=${1:Things}[${20:i}]; ${20:i}++){ - ${2:thing}$0 + $0${2:thing} }; name diff --git "a/Snippets/for (\342\200\246) {\342\200\246} (faster).tmSnippet" "b/Snippets/for (\342\200\246) {\342\200\246} (faster).tmSnippet" index 34e6b71..2853eb2 100644 --- "a/Snippets/for (\342\200\246) {\342\200\246} (faster).tmSnippet" +++ "b/Snippets/for (\342\200\246) {\342\200\246} (faster).tmSnippet" @@ -1,10 +1,10 @@ - + content for (var ${20:i} = ${1:Things}.length - 1; ${20:i} >= 0; ${20:i}--){ - ${100:${1:Things}[${20:i}]}$0 + $0${100:${1:Things}[${20:i}]} }; name for (…) {…} (Improved Native For-Loop) diff --git "a/Snippets/for (\342\200\246) {\342\200\246}.tmSnippet" "b/Snippets/for (\342\200\246) {\342\200\246}.tmSnippet" index 6208a16..852d3f5 100644 --- "a/Snippets/for (\342\200\246) {\342\200\246}.tmSnippet" +++ "b/Snippets/for (\342\200\246) {\342\200\246}.tmSnippet" @@ -4,7 +4,7 @@ content for (var ${20:i}=0; ${20:i} < ${1:Things}.length; ${20:i}++) { - ${100:${1:Things}[${20:i}]}$0 + $0${100:${1:Things}[${20:i}]} }; name for (…) {…} From a8f3f40b774fcd7737d5b873e7d8f5eebd7112fc Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Wed, 2 Jul 2008 17:01:05 +0000 Subject: [PATCH 099/243] Added a tests folder with some starter files git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@10104 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Tests/Embedded Javascript Test.html | 16 ++++++++++++++++ Tests/Javascript Syntax Test.js | 0 2 files changed, 16 insertions(+) create mode 100644 Tests/Embedded Javascript Test.html create mode 100644 Tests/Javascript Syntax Test.js diff --git a/Tests/Embedded Javascript Test.html b/Tests/Embedded Javascript Test.html new file mode 100644 index 0000000..1c08ebb --- /dev/null +++ b/Tests/Embedded Javascript Test.html @@ -0,0 +1,16 @@ + + + + + Embedded Javascript Test.html + + + + + + diff --git a/Tests/Javascript Syntax Test.js b/Tests/Javascript Syntax Test.js new file mode 100644 index 0000000..e69de29 From efa328fc9321f7501dac2dd261fba0e50bff2aeb Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Wed, 2 Jul 2008 17:01:10 +0000 Subject: [PATCH 100/243] Improved meta.function.json.js with punctuation and proper storage.type git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@10105 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript Basic.tmLanguage | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/Syntaxes/JavaScript Basic.tmLanguage b/Syntaxes/JavaScript Basic.tmLanguage index 25bf7c0..a71d8be 100644 --- a/Syntaxes/JavaScript Basic.tmLanguage +++ b/Syntaxes/JavaScript Basic.tmLanguage @@ -201,19 +201,24 @@ 2 name - storage.type.function.js + punctuation.separator.key-value.js 3 name - punctuation.definition.parameters.begin.js + storage.type.function.js 4 name - variable.parameter.function.js + punctuation.definition.parameters.begin.js 5 + + name + variable.parameter.function.js + + 6 name punctuation.definition.parameters.end.js @@ -222,7 +227,7 @@ 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.json.js @@ -237,14 +242,19 @@ 10 name - punctuation.definition.parameters.begin.js + storage.type.function.js 11 name - variable.parameter.function.js + punctuation.definition.parameters.begin.js 12 + + name + variable.parameter.function.js + + 13 name punctuation.definition.parameters.end.js @@ -287,13 +297,13 @@ 9 name - entity.name.function.js + punctuation.separator.key-value.js comment Attempt to match "foo": function match - (?:((')(.*?)('))|((")(.*?)(")))\s*:\s*\b(function)?\s*(\()(.*?)(\)) + (?:((')(.*?)('))|((")(.*?)(")))\s*(:)\s*\b(function)?\s*(\()(.*?)(\)) name meta.function.json.js From b5363c34e5d69b3ad53f7089c4da9f4faa3afbce Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Wed, 2 Jul 2008 17:01:15 +0000 Subject: [PATCH 101/243] Undefined -> undefined git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@10106 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript Basic.tmLanguage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/JavaScript Basic.tmLanguage b/Syntaxes/JavaScript Basic.tmLanguage index a71d8be..19e49f5 100644 --- a/Syntaxes/JavaScript Basic.tmLanguage +++ b/Syntaxes/JavaScript Basic.tmLanguage @@ -579,7 +579,7 @@ match - \b(Infinity|NaN|Undefined)\b + \b(Infinity|NaN|undefined)\b name constant.language.js From a09b74f57168b05205c77be88fdbde6a5aec786c Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Wed, 2 Jul 2008 17:01:20 +0000 Subject: [PATCH 102/243] Impriving regexp literals git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@10107 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript Basic.tmLanguage | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/Syntaxes/JavaScript Basic.tmLanguage b/Syntaxes/JavaScript Basic.tmLanguage index 19e49f5..c8e67f0 100644 --- a/Syntaxes/JavaScript Basic.tmLanguage +++ b/Syntaxes/JavaScript Basic.tmLanguage @@ -585,27 +585,44 @@ begin - (?<=[=(:]|^|return)\s*(/)(?![/*+{}?]|$) + (?x) + (?<= [=(:] | ^ | return ) + \s*((/)) (?! [/*+{}?] | $ ) beginCaptures 1 + + name + string.regexp.js + + 2 name punctuation.definition.string.begin.js + contentName + string.regexp.js end - (/)[igm]*|$ + ((/([igm]*)))|$ endCaptures 1 + + name + string.regexp.js + + 2 name punctuation.definition.string.end.js + 3 + + name + keyword.other.js + - name - string.regexp.js patterns From 65981d95f279536edee886075116bf7ad8389f44 Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Wed, 2 Jul 2008 17:01:25 +0000 Subject: [PATCH 103/243] Some syntax tests git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@10108 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Tests/Javascript Syntax Test.js | 112 ++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) diff --git a/Tests/Javascript Syntax Test.js b/Tests/Javascript Syntax Test.js index e69de29..926f05c 100644 --- a/Tests/Javascript Syntax Test.js +++ b/Tests/Javascript Syntax Test.js @@ -0,0 +1,112 @@ +// ============= +// = FUNCTIONS = +// ============= + +function(argument1,argument2){return argument1 + argument1;}; +function (argument1, argument2) {return argument1 + argument1;}; + + +function funkName(argument1, argument2) { + return argument1 + argument1; +}; +function funkName(argument1, argument2) +{ + return argument1 + argument1; +}; + + +function(argument1, argument2){ + return argument1 + argument1; +}; +function(argument1, argument2) +{ + return argument1 + argument1; +}; + + +new Function("argument1", "argument2", "return argument1 + argument1;"); +var funkName=new Function("argument1", "argument2", "return argument1 + argument1;"); + + +var funkName1 = function funkName (argument1, argument2) {return argument1 + argument1;}; +var funkName1=function funkName(argument1,argument2){return argument1 + argument1;}; + + +// =================== +// = OBJECT LITERALS = +// =================== +var objectName = {}; + +var objectName = { + + stringName : '', + 'stringName' : '', + "stringName" : '', + stringName : "", + 'stringName' : "", + "stringName" : "", + + numberName : 999.999, + 'numberName' : 999.999, + "numberName" : 999.999, + + funkName : function(argument1, argument2){}, + 'funkName' : function(argument1, argument2){}, + "funkName" : function(argument1, argument2){}, + + nullName : null + +}; + +var objectName = { + + keyName : 0, + 'keyName' : 0, + "keyName" : 0 + +}; +objectName[funkName()] = 0; + + +// ============= +// = ARGUMENTS = +// ============= + +funkName(variableName, funkName(), 999.999, "stringName", 'stringName', function(){}, {objectName:{}}, /regex/, null, true, false, undefined); +funkName( + variableName, + funkName(), + 999.999, + "stringName", + 'stringName', + function(){}, + {objectName:{}}, + /regex/, + null, + true, + false, + undefined +); + + +// ========= +// = REGEX = +// ========= +var regexName = /regex/ + +funkName(/regex/, /regex/i) + +[/regex/, /regex/i] + +{keyName : /regex/} + +/regex/ +/regex/i +/regex/g +/regex/m +/regex/igm + +function(){ + return /regex/ +} + From 60c8151e9b093ad8b7866221e2c33675faadd3f1 Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Wed, 2 Jul 2008 17:01:31 +0000 Subject: [PATCH 104/243] Merging in the regex fixes from Joseph Pecoraro as seen here: http://lists.macromates.com/textmate/2008-June/025973.html git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@10109 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript Basic.tmLanguage | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Syntaxes/JavaScript Basic.tmLanguage b/Syntaxes/JavaScript Basic.tmLanguage index c8e67f0..1d9ac7d 100644 --- a/Syntaxes/JavaScript Basic.tmLanguage +++ b/Syntaxes/JavaScript Basic.tmLanguage @@ -586,7 +586,7 @@ begin (?x) - (?<= [=(:] | ^ | return ) + (?<= [\[,=(:] | ^ | && | return ) \s*((/)) (?! [/*+{}?] | $ ) beginCaptures @@ -641,7 +641,7 @@ match - ,[ |\t]* + , name meta.delimiter.object.comma.js From 87f90e9d19b8384e325a42ef0a0e67d06c21eced Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Wed, 2 Jul 2008 17:01:36 +0000 Subject: [PATCH 105/243] Don't require a space after the function keyword Merging in a modified version of Joseph Pecoraro's fix here: http://pastie.textmate.org/private/hxkpy8qkahofrxwyvp4coq git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@10110 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript Basic.tmLanguage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/JavaScript Basic.tmLanguage b/Syntaxes/JavaScript Basic.tmLanguage index 1d9ac7d..e15d70e 100644 --- a/Syntaxes/JavaScript Basic.tmLanguage +++ b/Syntaxes/JavaScript Basic.tmLanguage @@ -186,7 +186,7 @@ comment match regular function like: function myFunc(arg) { … } match - \b(function)\s+([a-zA-Z_$]\w*)?\s*(\()(.*?)(\)) + \b(function)(?:\s+([a-zA-Z_$]\w*))?\s*(\()(.*?)(\)) name meta.function.js From 743c785083f582284aee0a32e4f8259e1e0022b6 Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Wed, 2 Jul 2008 17:01:42 +0000 Subject: [PATCH 106/243] Scientific notation => Ex, 1e5 and 2.5E5 from Joseph Pecoraro git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@10111 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript Basic.tmLanguage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/JavaScript Basic.tmLanguage b/Syntaxes/JavaScript Basic.tmLanguage index e15d70e..2b5a46c 100644 --- a/Syntaxes/JavaScript Basic.tmLanguage +++ b/Syntaxes/JavaScript Basic.tmLanguage @@ -340,7 +340,7 @@ match - \b((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?))\b + \b((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?([eE][-+]?[0-9]+)?))\b name constant.numeric.js From 535a98f1f702d3e6b4da7bbf74577dfc947043e0 Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Wed, 2 Jul 2008 17:01:46 +0000 Subject: [PATCH 107/243] More syntax tests git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@10112 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Tests/Javascript Syntax Test.js | 86 +++++++++++++++++++++++++++++++-- 1 file changed, 83 insertions(+), 3 deletions(-) diff --git a/Tests/Javascript Syntax Test.js b/Tests/Javascript Syntax Test.js index 926f05c..e0ab648 100644 --- a/Tests/Javascript Syntax Test.js +++ b/Tests/Javascript Syntax Test.js @@ -94,19 +94,99 @@ funkName( // ========= var regexName = /regex/ +"stringName".match(/regex/) + funkName(/regex/, /regex/i) [/regex/, /regex/i] {keyName : /regex/} +/regex/ && /regex/ /regex/ /regex/i /regex/g /regex/m /regex/igm -function(){ - return /regex/ -} +function(){ return /regex/ } + +/regex/.test('test') +1==1 && /regex/.test('test') + + + +// =========== +// = Numbers = +// =========== +// http://www.hunlock.com/blogs/The_Complete_Javascript_Number_Reference + +999 +.999 +999.999 +4 +16 +256 +65536 +4294967296 +18446744073709552000 +3.402823669209385e+38 +1.157920892373162e+77 +1.3407807929942597e+154 +Infinity +0377 // octal +0xFF // hex +0xff // hex + +-999 +-.999 +-999.999 +-4 +-16 +-256 +-65536 +-4294967296 +-18446744073709552000 +-3.402823669209385e+38 +-1.157920892373162e+77 +-1.3407807929942597e+154 +-Infinity +-0377 // octal +-0xFF // hex +-0xff // hex + +1e5 +2.5E5 + +5e-324 +1.7976931348623157e+308 + +x = x+5; // is the same as x += 5; +x = x-5; // is the same as x -= 5; +x = x*5; // is the same as x *= 5; +x = x/5; // is the same as x /= 5; +x = x%5; // is the same as x %= 5; + +x += 5 +x -= 5 +x *= 5 +x /= 5 +x %= 5 + +x ++ +x -- + +x = x&5; // is the same as x &= 5; +x = x|5; // is the same as x |= 5; +x = x^5; // is the same as x ^= 5; +x = x<<5; // is the same as x <<= 5; +x = x>>5; // is the same as x >>= 5; +x = x>>>5; // is the same as x >>>= 5; + +x &= 5 +x |= 5 +x ^= 5 +x <<= 5 +x >>= 5 +x >>>= 5 From 5692efe8c1d78a2da70137e8702242948f1bfda6 Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Wed, 2 Jul 2008 17:01:52 +0000 Subject: [PATCH 108/243] Removed redundant group scope git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@10113 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript.plist | 2 -- 1 file changed, 2 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 3a00f44..4509038 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -339,8 +339,6 @@ end (}) - name - meta.group.braces.curly.function.js patterns From be9de4befd5f0b7bc2fb379017e6dfb4e7658730 Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Wed, 2 Jul 2008 17:01:58 +0000 Subject: [PATCH 109/243] Internet Explorer Conditional Comment snippets git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@10114 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- ...Explorer Conditional Comment Escape.tmSnippet | 16 ++++++++++++++++ ...ternet Explorer Conditional Comment.tmSnippet | 16 ++++++++++++++++ info.plist | 2 ++ 3 files changed, 34 insertions(+) create mode 100644 Snippets/Internet Explorer Conditional Comment Escape.tmSnippet create mode 100644 Snippets/Internet Explorer Conditional Comment.tmSnippet diff --git a/Snippets/Internet Explorer Conditional Comment Escape.tmSnippet b/Snippets/Internet Explorer Conditional Comment Escape.tmSnippet new file mode 100644 index 0000000..ecea148 --- /dev/null +++ b/Snippets/Internet Explorer Conditional Comment Escape.tmSnippet @@ -0,0 +1,16 @@ + + + + + content + @*/${0:$TM_SELECTED_TEXT}/*@ + name + Internet Explorer Conditional Comment Escape + scope + source.js comment.block.conditional + tabTrigger + @ + uuid + 603A6D98-A136-4766-828B-C39178AB8003 + + diff --git a/Snippets/Internet Explorer Conditional Comment.tmSnippet b/Snippets/Internet Explorer Conditional Comment.tmSnippet new file mode 100644 index 0000000..b86ce88 --- /dev/null +++ b/Snippets/Internet Explorer Conditional Comment.tmSnippet @@ -0,0 +1,16 @@ + + + + + content + /*@cc_on ${0:$TM_SELECTED_TEXT} @*/ + name + Internet Explorer Conditional Comment + scope + source.js + tabTrigger + @ + uuid + E1B2FC98-AF98-4392-8069-C82C2C192617 + + diff --git a/info.plist b/info.plist index c181afb..abb63a5 100644 --- a/info.plist +++ b/info.plist @@ -134,6 +134,8 @@ 20E61C43-B81F-4FB9-9362-BFFE668EB9C9 36EC03E9-EFF4-479A-AB90-8DFA16800642 3F4AB53B-210C-4E0C-8D04-12192DECC3D1 + E1B2FC98-AF98-4392-8069-C82C2C192617 + 603A6D98-A136-4766-828B-C39178AB8003 uuid AAB4FD74-73F9-11D9-B89A-000D93589AF6 From 37132a7244906e0d188f351e80775b48d4e7aa81 Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Sat, 5 Jul 2008 23:42:13 +0000 Subject: [PATCH 110/243] More and more syntax tests git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@10169 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Tests/Embedded Javascript Test Invalid.html | 62 +++++++++++++++++++++ Tests/Javascript Syntax Test.js | 62 +++++++++++++++++++++ 2 files changed, 124 insertions(+) create mode 100644 Tests/Embedded Javascript Test Invalid.html diff --git a/Tests/Embedded Javascript Test Invalid.html b/Tests/Embedded Javascript Test Invalid.html new file mode 100644 index 0000000..6c93a36 --- /dev/null +++ b/Tests/Embedded Javascript Test Invalid.html @@ -0,0 +1,62 @@ + + + + + Embedded Javascript Test.html + + + + +1 Link!
+2 Link!
+3 Link!
+4 Link!
+ +5 "
+ +6 "
+ +7 "
+8
+ +End the string if the /script tag is followed by a newline. Don't if not. +9 +" +
+ +10 +' +
+ +11 " + +
+ +12 ' + +
+ + + + + + + diff --git a/Tests/Javascript Syntax Test.js b/Tests/Javascript Syntax Test.js index e0ab648..763981a 100644 --- a/Tests/Javascript Syntax Test.js +++ b/Tests/Javascript Syntax Test.js @@ -92,6 +92,8 @@ funkName( // ========= // = REGEX = // ========= +// WARNING: regular expressions should be preceded by a left parenthesis, assignment, colon, or comma + var regexName = /regex/ "stringName".match(/regex/) @@ -190,3 +192,63 @@ x <<= 5 x >>= 5 x >>>= 5 + +// =========== +// = Strings = +// =========== + +var stringName = ""; +var stringName = ''; + +var stringName0 = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; + +var stringName1 = "Lorem ipsum dolor sit amet, consectetur adipisicing e" + +"lit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." + +" Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nis" + +"i ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehen" + +"derit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. E" + +"xcepteur sint occaecat cupidatat non proident, sunt in culpa qui offici" + +"a deserunt mollit anim id est laborum."; + +// Allow escaped newline +var stringName2 = "Lorem ipsum dolor sit amet, consectetur adipisicing e\ +SHOULD be scoped as string" +var stringName2 = 'Lorem ipsum dolor sit amet, consectetur adipisicing e\ +SHOULD be scoped as string' +// First newline should be scoped as constant.character.escape.newline.js + +// End string at unescaped newline +// SYNTAX ERROR: unterminated string literal +var stringName3 = "Lorem ipsum dolor sit amet, consectetur adipisicing e +Should NOT be scoped as string" +var stringName3 = 'Lorem ipsum dolor sit amet, consectetur adipisicing e +Should NOT be scoped as string' +// First newline SHOULD be scoped as invalid + +var stringName4 = "Lorem ipsum dolor sit amet"; +"" SHOULD be scoped as string & invalid.deprecated +var stringName5 = "Lorem ipsum dolor sit amet +"" Should NOT be scoped as string + +// WARNING: regular expressions should be preceded by a left parenthesis, assignment, colon, or comma + + {unquotedString: null} + {'singleQuotedString': null}// SYNTAX ERROR: invalid label + {"doubleQuotedString": null}// SYNTAX ERROR: invalid label +({'singleQuotedString': null}) +({"doubleQuotedString": null}) + +switch (something){ + case "stringName" : + break; + case unquotedString : + break; + case /regex/ : + break; + case 999.999 : + break; + case funkName() : + break; + default : + // do something +} From ac0c3b2f56b2e21792ad4b47316dc08d8e4b231d Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Sat, 5 Jul 2008 23:42:19 +0000 Subject: [PATCH 111/243] Improved String Literal syntax. Fixed the "bug" where an unclosed string extends past the closign script tag in html. String should end on \n with a syntax error String should end on \n with a syntax error String should mark as invalid git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@10170 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript Basic.tmLanguage | 45 ++++++++++++++++++++++++++-- Tests/Javascript Syntax Test.js | 4 +-- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/Syntaxes/JavaScript Basic.tmLanguage b/Syntaxes/JavaScript Basic.tmLanguage index 2b5a46c..283c571 100644 --- a/Syntaxes/JavaScript Basic.tmLanguage +++ b/Syntaxes/JavaScript Basic.tmLanguage @@ -356,7 +356,7 @@
end - ' + (?i)'|(?=</\s*script\s*>\s*\n)|(?<=[^\\]\n) endCaptures 0 @@ -375,6 +375,24 @@ name constant.character.escape.js + + match + \\\n + name + constant.character.escape.newline.js + + + match + \n + name + invalid.illegal.newline.js + + + match + (?i)</\s*script\s*> + name + invalid.deprecated.inconsistent.js +
@@ -389,7 +407,7 @@
end - " + (?i)"|(?=</\s*script\s*>\s*\n)|(?<=[^\\]\n) endCaptures 0 @@ -408,6 +426,24 @@ name constant.character.escape.js + + match + \\\n + name + constant.character.escape.newline.js + + + match + \n + name + invalid.illegal.newline.js + + + match + (?i)</\s*script\s*> + name + invalid.deprecated.inconsistent.js +
@@ -676,6 +712,11 @@ meta.complete.method + repository + + string-double + + scopeName source.js uuid diff --git a/Tests/Javascript Syntax Test.js b/Tests/Javascript Syntax Test.js index 763981a..e170168 100644 --- a/Tests/Javascript Syntax Test.js +++ b/Tests/Javascript Syntax Test.js @@ -226,9 +226,9 @@ Should NOT be scoped as string' // First newline SHOULD be scoped as invalid var stringName4 = "Lorem ipsum dolor sit amet"; -"" SHOULD be scoped as string & invalid.deprecated +// "" SHOULD be scoped as string & invalid.deprecated var stringName5 = "Lorem ipsum dolor sit amet -"" Should NOT be scoped as string +// "" Should NOT be scoped as string // WARNING: regular expressions should be preceded by a left parenthesis, assignment, colon, or comma From bba6f216d7cdb8d3cd5621465dfed401c6de495c Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Sat, 5 Jul 2008 23:42:24 +0000 Subject: [PATCH 112/243] Degault the Get Elements snippet to getElementById instead of getElementsByTagName git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@10171 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Snippets/Get Elements.tmSnippet | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Snippets/Get Elements.tmSnippet b/Snippets/Get Elements.tmSnippet index 3031d9f..f20c8be 100644 --- a/Snippets/Get Elements.tmSnippet +++ b/Snippets/Get Elements.tmSnippet @@ -1,15 +1,15 @@ - + content - getElement${1/(T)|.*/(?1:s)/}By${1:T}${1/(T)|(I)|.*/(?1:agName)(?2:d)/}('$2') + .getElement${1/(T)|.*/(?1:s)/}By${1:I}${1/(I)|(T)|.*/(?2:agName)(?1:d)/}($2)$0 name - Get Elements + get Elements scope source.js tabTrigger - get + .get uuid 9E0E3BCC-7F20-4D6B-891D-A44D6EC56E31 From 78f785b43d1aa84eea5e7ffaaaa863f43e6e1e5c Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Sat, 5 Jul 2008 23:42:29 +0000 Subject: [PATCH 113/243] Removed the anonymous function from the timeout snippet. You can easily add your own with the f snippet git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@10172 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Snippets/setTimeout function.tmSnippet | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Snippets/setTimeout function.tmSnippet b/Snippets/setTimeout function.tmSnippet index b248c4e..53790f9 100644 --- a/Snippets/setTimeout function.tmSnippet +++ b/Snippets/setTimeout function.tmSnippet @@ -3,9 +3,9 @@ content - setTimeout(${20:function(){$0\}}, ${10:10}); + setTimeout($0, ${10:10}); name - setTimeout function + setTimeout scope source.js tabTrigger From de7b84b470b2f6d3a3d2439cd41a4488364583b1 Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Sat, 5 Jul 2008 23:42:37 +0000 Subject: [PATCH 114/243] Attempting to unify the style of the various snippets. The idea is that if it's fewer characters to add something than to remove it, then it gets removed from the snippet. git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@10173 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Commands/New Function.tmCommand | 6 ++---- Commands/New Method.tmCommand | 9 ++++----- Snippets/function (fun).plist | 18 ------------------ Snippets/function.tmSnippet | 6 +++--- 4 files changed, 9 insertions(+), 30 deletions(-) delete mode 100644 Snippets/function (fun).plist diff --git a/Commands/New Function.tmCommand b/Commands/New Function.tmCommand index 064d364..df612f6 100644 --- a/Commands/New Function.tmCommand +++ b/Commands/New Function.tmCommand @@ -1,14 +1,12 @@ - + beforeRunningCommand nop command cat <<SNIPPET -function ${TM_SELECTED_TEXT:-$TM_CURRENT_WORD}(\${1:args}) { - \$0 -} +function ${TM_SELECTED_TEXT:-$TM_CURRENT_WORD}(\$1){\$0}; SNIPPET fallbackInput word diff --git a/Commands/New Method.tmCommand b/Commands/New Method.tmCommand index 2e02018..6d48573 100644 --- a/Commands/New Method.tmCommand +++ b/Commands/New Method.tmCommand @@ -1,15 +1,14 @@ - + beforeRunningCommand nop command cat <<SNIPPET -${TM_SELECTED_TEXT:-$TM_CURRENT_WORD}: function(\${1:args}) { - \$0 -}\${2:,} -SNIPPET +${TM_SELECTED_TEXT:-$TM_CURRENT_WORD}: function(\$1){\$0}, +SNIPPET +
fallbackInput word input diff --git a/Snippets/function (fun).plist b/Snippets/function (fun).plist deleted file mode 100644 index f8a5177..0000000 --- a/Snippets/function (fun).plist +++ /dev/null @@ -1,18 +0,0 @@ - - - - - content - function ${1:function_name}(${2:argument}) { - ${0:// body...} -} - name - Function - scope - source.js - tabTrigger - fun - uuid - F0E4FB6A-4878-48C6-A777-62438DF1E14F - - diff --git a/Snippets/function.tmSnippet b/Snippets/function.tmSnippet index f95fea1..b90dba6 100644 --- a/Snippets/function.tmSnippet +++ b/Snippets/function.tmSnippet @@ -3,14 +3,14 @@ content - function($1){${0:${TM_SELECTED_TEXT}}} + function$1($2){$0} name - Anonymous Function + Function scope source.js tabTrigger f uuid - 4C6EDB43-3E2E-411B-A016-13C135C59833 + F0E4FB6A-4878-48C6-A777-62438DF1E14F From 52fedbc92004dc5ec95b55f50665c075b2ae899b Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Sat, 5 Jul 2008 23:42:42 +0000 Subject: [PATCH 115/243] New document. snippet, because you end up typing that a billion times git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@10174 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Snippets/document_.tmSnippet | 16 ++++++++++++++++ info.plist | 23 ++++++++++++++++++----- 2 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 Snippets/document_.tmSnippet diff --git a/Snippets/document_.tmSnippet b/Snippets/document_.tmSnippet new file mode 100644 index 0000000..2c8b87e --- /dev/null +++ b/Snippets/document_.tmSnippet @@ -0,0 +1,16 @@ + + + + + content + document. + name + document. + scope + source.js + tabTrigger + d + uuid + C1197E58-D065-4EDC-9BAB-EB41622C1630 + + diff --git a/info.plist b/info.plist index abb63a5..9f27e42 100644 --- a/info.plist +++ b/info.plist @@ -17,16 +17,17 @@ D2E6A1FE-2881-4754-B399-B65F61F29C2F 43F40EB6-5839-4BE8-99C8-4976D0534E5D 52090C49-D8B2-49A0-9597-80574354B3CD + 6F601764-6A78-4857-A866-B617890F0DEC 28B33806-DCD4-4D5D-A422-B6041A6D9FAA + 20E61C43-B81F-4FB9-9362-BFFE668EB9C9 + 36EC03E9-EFF4-479A-AB90-8DFA16800642 submenus 28B33806-DCD4-4D5D-A422-B6041A6D9FAA items - - 0C6DE5D1-2AAA-4327-A746-94FCCD7A45C9 - + name Idioms @@ -34,6 +35,7 @@ items + C1197E58-D065-4EDC-9BAB-EB41622C1630 9E0E3BCC-7F20-4D6B-891D-A44D6EC56E31 name @@ -52,7 +54,6 @@ items - 4C6EDB43-3E2E-411B-A016-13C135C59833 F0E4FB6A-4878-48C6-A777-62438DF1E14F ------------------------------------ 73951799-AC15-40A6-81DB-EC051AB4A033 @@ -64,6 +65,16 @@ name Function + 6F601764-6A78-4857-A866-B617890F0DEC + + items + + E1B2FC98-AF98-4392-8069-C82C2C192617 + 603A6D98-A136-4766-828B-C39178AB8003 + + name + Special + 7699AC1A-80AC-4120-A375-9371D1591F79 items @@ -73,6 +84,8 @@ ------------------------------------ 011C4681-FBEC-4891-9326-3DECFCDED6D6 C207B7C3-5597-4873-8AAD-C46FB8842AF2 + 9BF3315C-88FF-46A1-89E1-9A5E9EAC78D0 + 3F4AB53B-210C-4E0C-8D04-12192DECC3D1 name Control @@ -109,10 +122,10 @@ 77065D69-742A-4FF0-9A41-AD211DFBE72F B4874A14-2491-465A-A349-61E4EBCF4700 F0E4FB6A-4878-48C6-A777-62438DF1E14F + C1197E58-D065-4EDC-9BAB-EB41622C1630 2F96136B-0193-42F5-90FC-B6F456A3AD77 73951799-AC15-40A6-81DB-EC051AB4A033 1717B5AE-209B-4548-9155-9E88A7230C1C - 4C6EDB43-3E2E-411B-A016-13C135C59833 93E017CC-6F27-11D9-90EB-000D93589AF6 0D2D03B9-F18B-4D9D-A960-716FDEC35331 A67A8BD9-A951-406F-9175-018DD4B52FD1 From a8b22dbdda1faa78d43c3157ef8fd2bbb2794a44 Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Sat, 5 Jul 2008 23:42:13 +0000 Subject: [PATCH 116/243] More and more syntax tests git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@10169 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Tests/Embedded Javascript Test Invalid.html | 62 +++++++++++++++++++++ Tests/Javascript Syntax Test.js | 62 +++++++++++++++++++++ 2 files changed, 124 insertions(+) create mode 100644 Tests/Embedded Javascript Test Invalid.html diff --git a/Tests/Embedded Javascript Test Invalid.html b/Tests/Embedded Javascript Test Invalid.html new file mode 100644 index 0000000..6c93a36 --- /dev/null +++ b/Tests/Embedded Javascript Test Invalid.html @@ -0,0 +1,62 @@ + + + + + Embedded Javascript Test.html + + + + +1 Link!
+2 Link!
+3 Link!
+4 Link!
+ +5 "
+ +6 "
+ +7 "
+8
+ +End the string if the /script tag is followed by a newline. Don't if not. +9 +" +
+ +10 +' +
+ +11 " + +
+ +12 ' + +
+ + + + + + + diff --git a/Tests/Javascript Syntax Test.js b/Tests/Javascript Syntax Test.js index e0ab648..763981a 100644 --- a/Tests/Javascript Syntax Test.js +++ b/Tests/Javascript Syntax Test.js @@ -92,6 +92,8 @@ funkName( // ========= // = REGEX = // ========= +// WARNING: regular expressions should be preceded by a left parenthesis, assignment, colon, or comma + var regexName = /regex/ "stringName".match(/regex/) @@ -190,3 +192,63 @@ x <<= 5 x >>= 5 x >>>= 5 + +// =========== +// = Strings = +// =========== + +var stringName = ""; +var stringName = ''; + +var stringName0 = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; + +var stringName1 = "Lorem ipsum dolor sit amet, consectetur adipisicing e" + +"lit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." + +" Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nis" + +"i ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehen" + +"derit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. E" + +"xcepteur sint occaecat cupidatat non proident, sunt in culpa qui offici" + +"a deserunt mollit anim id est laborum."; + +// Allow escaped newline +var stringName2 = "Lorem ipsum dolor sit amet, consectetur adipisicing e\ +SHOULD be scoped as string" +var stringName2 = 'Lorem ipsum dolor sit amet, consectetur adipisicing e\ +SHOULD be scoped as string' +// First newline should be scoped as constant.character.escape.newline.js + +// End string at unescaped newline +// SYNTAX ERROR: unterminated string literal +var stringName3 = "Lorem ipsum dolor sit amet, consectetur adipisicing e +Should NOT be scoped as string" +var stringName3 = 'Lorem ipsum dolor sit amet, consectetur adipisicing e +Should NOT be scoped as string' +// First newline SHOULD be scoped as invalid + +var stringName4 = "Lorem ipsum dolor sit amet"; +"" SHOULD be scoped as string & invalid.deprecated +var stringName5 = "Lorem ipsum dolor sit amet +"" Should NOT be scoped as string + +// WARNING: regular expressions should be preceded by a left parenthesis, assignment, colon, or comma + + {unquotedString: null} + {'singleQuotedString': null}// SYNTAX ERROR: invalid label + {"doubleQuotedString": null}// SYNTAX ERROR: invalid label +({'singleQuotedString': null}) +({"doubleQuotedString": null}) + +switch (something){ + case "stringName" : + break; + case unquotedString : + break; + case /regex/ : + break; + case 999.999 : + break; + case funkName() : + break; + default : + // do something +} From c18a767790ee9e52148bab02a812f1d17aefe917 Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Sat, 5 Jul 2008 23:42:19 +0000 Subject: [PATCH 117/243] Improved String Literal syntax. Fixed the "bug" where an unclosed string extends past the closign script tag in html. String should end on \n with a syntax error String should end on \n with a syntax error String should mark as invalid git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@10170 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript Basic.tmLanguage | 45 ++++++++++++++++++++++++++-- Tests/Javascript Syntax Test.js | 4 +-- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/Syntaxes/JavaScript Basic.tmLanguage b/Syntaxes/JavaScript Basic.tmLanguage index 2b5a46c..283c571 100644 --- a/Syntaxes/JavaScript Basic.tmLanguage +++ b/Syntaxes/JavaScript Basic.tmLanguage @@ -356,7 +356,7 @@
end - ' + (?i)'|(?=</\s*script\s*>\s*\n)|(?<=[^\\]\n) endCaptures 0 @@ -375,6 +375,24 @@ name constant.character.escape.js + + match + \\\n + name + constant.character.escape.newline.js + + + match + \n + name + invalid.illegal.newline.js + + + match + (?i)</\s*script\s*> + name + invalid.deprecated.inconsistent.js +
@@ -389,7 +407,7 @@
end - " + (?i)"|(?=</\s*script\s*>\s*\n)|(?<=[^\\]\n) endCaptures 0 @@ -408,6 +426,24 @@ name constant.character.escape.js + + match + \\\n + name + constant.character.escape.newline.js + + + match + \n + name + invalid.illegal.newline.js + + + match + (?i)</\s*script\s*> + name + invalid.deprecated.inconsistent.js +
@@ -676,6 +712,11 @@ meta.complete.method + repository + + string-double + + scopeName source.js uuid diff --git a/Tests/Javascript Syntax Test.js b/Tests/Javascript Syntax Test.js index 763981a..e170168 100644 --- a/Tests/Javascript Syntax Test.js +++ b/Tests/Javascript Syntax Test.js @@ -226,9 +226,9 @@ Should NOT be scoped as string' // First newline SHOULD be scoped as invalid var stringName4 = "Lorem ipsum dolor sit amet"; -"" SHOULD be scoped as string & invalid.deprecated +// "" SHOULD be scoped as string & invalid.deprecated var stringName5 = "Lorem ipsum dolor sit amet -"" Should NOT be scoped as string +// "" Should NOT be scoped as string // WARNING: regular expressions should be preceded by a left parenthesis, assignment, colon, or comma From 7a68cfb531a91d6bae46fc1a98ed4d6a6bd0a49c Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Sat, 5 Jul 2008 23:42:24 +0000 Subject: [PATCH 118/243] Degault the Get Elements snippet to getElementById instead of getElementsByTagName git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@10171 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Snippets/Get Elements.tmSnippet | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Snippets/Get Elements.tmSnippet b/Snippets/Get Elements.tmSnippet index 3031d9f..f20c8be 100644 --- a/Snippets/Get Elements.tmSnippet +++ b/Snippets/Get Elements.tmSnippet @@ -1,15 +1,15 @@ - + content - getElement${1/(T)|.*/(?1:s)/}By${1:T}${1/(T)|(I)|.*/(?1:agName)(?2:d)/}('$2') + .getElement${1/(T)|.*/(?1:s)/}By${1:I}${1/(I)|(T)|.*/(?2:agName)(?1:d)/}($2)$0 name - Get Elements + get Elements scope source.js tabTrigger - get + .get uuid 9E0E3BCC-7F20-4D6B-891D-A44D6EC56E31 From ec99bb4c5ccae54b0bbbd98d138248f5403644ef Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Sat, 5 Jul 2008 23:42:29 +0000 Subject: [PATCH 119/243] Removed the anonymous function from the timeout snippet. You can easily add your own with the f snippet git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@10172 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Snippets/setTimeout function.tmSnippet | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Snippets/setTimeout function.tmSnippet b/Snippets/setTimeout function.tmSnippet index b248c4e..53790f9 100644 --- a/Snippets/setTimeout function.tmSnippet +++ b/Snippets/setTimeout function.tmSnippet @@ -3,9 +3,9 @@ content - setTimeout(${20:function(){$0\}}, ${10:10}); + setTimeout($0, ${10:10}); name - setTimeout function + setTimeout scope source.js tabTrigger From 9befbaa4c537c6f83a47d38409cc5de17c873c4a Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Sat, 5 Jul 2008 23:42:37 +0000 Subject: [PATCH 120/243] Attempting to unify the style of the various snippets. The idea is that if it's fewer characters to add something than to remove it, then it gets removed from the snippet. git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@10173 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Commands/New Function.tmCommand | 6 ++---- Commands/New Method.tmCommand | 9 ++++----- Snippets/function (fun).plist | 18 ------------------ Snippets/function.tmSnippet | 6 +++--- 4 files changed, 9 insertions(+), 30 deletions(-) delete mode 100644 Snippets/function (fun).plist diff --git a/Commands/New Function.tmCommand b/Commands/New Function.tmCommand index 064d364..df612f6 100644 --- a/Commands/New Function.tmCommand +++ b/Commands/New Function.tmCommand @@ -1,14 +1,12 @@ - + beforeRunningCommand nop command cat <<SNIPPET -function ${TM_SELECTED_TEXT:-$TM_CURRENT_WORD}(\${1:args}) { - \$0 -} +function ${TM_SELECTED_TEXT:-$TM_CURRENT_WORD}(\$1){\$0}; SNIPPET fallbackInput word diff --git a/Commands/New Method.tmCommand b/Commands/New Method.tmCommand index 2e02018..6d48573 100644 --- a/Commands/New Method.tmCommand +++ b/Commands/New Method.tmCommand @@ -1,15 +1,14 @@ - + beforeRunningCommand nop command cat <<SNIPPET -${TM_SELECTED_TEXT:-$TM_CURRENT_WORD}: function(\${1:args}) { - \$0 -}\${2:,} -SNIPPET +${TM_SELECTED_TEXT:-$TM_CURRENT_WORD}: function(\$1){\$0}, +SNIPPET + fallbackInput word input diff --git a/Snippets/function (fun).plist b/Snippets/function (fun).plist deleted file mode 100644 index f8a5177..0000000 --- a/Snippets/function (fun).plist +++ /dev/null @@ -1,18 +0,0 @@ - - - - - content - function ${1:function_name}(${2:argument}) { - ${0:// body...} -} - name - Function - scope - source.js - tabTrigger - fun - uuid - F0E4FB6A-4878-48C6-A777-62438DF1E14F - - diff --git a/Snippets/function.tmSnippet b/Snippets/function.tmSnippet index f95fea1..b90dba6 100644 --- a/Snippets/function.tmSnippet +++ b/Snippets/function.tmSnippet @@ -3,14 +3,14 @@ content - function($1){${0:${TM_SELECTED_TEXT}}} + function$1($2){$0} name - Anonymous Function + Function scope source.js tabTrigger f uuid - 4C6EDB43-3E2E-411B-A016-13C135C59833 + F0E4FB6A-4878-48C6-A777-62438DF1E14F From 3e3082b4d480d9c619bad5ea3df03a2e25b5ba4b Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Sat, 5 Jul 2008 23:42:42 +0000 Subject: [PATCH 121/243] New document. snippet, because you end up typing that a billion times git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@10174 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Snippets/document_.tmSnippet | 16 ++++++++++++++++ info.plist | 23 ++++++++++++++++++----- 2 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 Snippets/document_.tmSnippet diff --git a/Snippets/document_.tmSnippet b/Snippets/document_.tmSnippet new file mode 100644 index 0000000..2c8b87e --- /dev/null +++ b/Snippets/document_.tmSnippet @@ -0,0 +1,16 @@ + + + + + content + document. + name + document. + scope + source.js + tabTrigger + d + uuid + C1197E58-D065-4EDC-9BAB-EB41622C1630 + + diff --git a/info.plist b/info.plist index abb63a5..9f27e42 100644 --- a/info.plist +++ b/info.plist @@ -17,16 +17,17 @@ D2E6A1FE-2881-4754-B399-B65F61F29C2F 43F40EB6-5839-4BE8-99C8-4976D0534E5D 52090C49-D8B2-49A0-9597-80574354B3CD + 6F601764-6A78-4857-A866-B617890F0DEC 28B33806-DCD4-4D5D-A422-B6041A6D9FAA + 20E61C43-B81F-4FB9-9362-BFFE668EB9C9 + 36EC03E9-EFF4-479A-AB90-8DFA16800642 submenus 28B33806-DCD4-4D5D-A422-B6041A6D9FAA items - - 0C6DE5D1-2AAA-4327-A746-94FCCD7A45C9 - + name Idioms @@ -34,6 +35,7 @@ items + C1197E58-D065-4EDC-9BAB-EB41622C1630 9E0E3BCC-7F20-4D6B-891D-A44D6EC56E31 name @@ -52,7 +54,6 @@ items - 4C6EDB43-3E2E-411B-A016-13C135C59833 F0E4FB6A-4878-48C6-A777-62438DF1E14F ------------------------------------ 73951799-AC15-40A6-81DB-EC051AB4A033 @@ -64,6 +65,16 @@ name Function + 6F601764-6A78-4857-A866-B617890F0DEC + + items + + E1B2FC98-AF98-4392-8069-C82C2C192617 + 603A6D98-A136-4766-828B-C39178AB8003 + + name + Special + 7699AC1A-80AC-4120-A375-9371D1591F79 items @@ -73,6 +84,8 @@ ------------------------------------ 011C4681-FBEC-4891-9326-3DECFCDED6D6 C207B7C3-5597-4873-8AAD-C46FB8842AF2 + 9BF3315C-88FF-46A1-89E1-9A5E9EAC78D0 + 3F4AB53B-210C-4E0C-8D04-12192DECC3D1 name Control @@ -109,10 +122,10 @@ 77065D69-742A-4FF0-9A41-AD211DFBE72F B4874A14-2491-465A-A349-61E4EBCF4700 F0E4FB6A-4878-48C6-A777-62438DF1E14F + C1197E58-D065-4EDC-9BAB-EB41622C1630 2F96136B-0193-42F5-90FC-B6F456A3AD77 73951799-AC15-40A6-81DB-EC051AB4A033 1717B5AE-209B-4548-9155-9E88A7230C1C - 4C6EDB43-3E2E-411B-A016-13C135C59833 93E017CC-6F27-11D9-90EB-000D93589AF6 0D2D03B9-F18B-4D9D-A960-716FDEC35331 A67A8BD9-A951-406F-9175-018DD4B52FD1 From dad2829a899a6bbfd973434c3217388b9ffc7b42 Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Mon, 7 Jul 2008 12:09:58 -0400 Subject: [PATCH 122/243] Reorganize the JavaScript Basic syntax. Moved everything into the repository. --- Syntaxes/JavaScript Basic.tmLanguage | 1140 ++++++++++++++------------ Tests/Javascript Syntax Test.js | 26 + 2 files changed, 655 insertions(+), 511 deletions(-) diff --git a/Syntaxes/JavaScript Basic.tmLanguage b/Syntaxes/JavaScript Basic.tmLanguage index 283c571..7abbb41 100644 --- a/Syntaxes/JavaScript Basic.tmLanguage +++ b/Syntaxes/JavaScript Basic.tmLanguage @@ -21,357 +21,718 @@ 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 + include + #core - captures - - 1 + include + #special + + + include + #support + + + repository + + core + + patterns + - name - support.class.js + include + #core-comments - 2 - name - support.constant.js + include + #core-number - 3 - name - entity.name.function.js + include + #core-string - 4 - name - storage.type.function.js + include + #core-regex - 5 - name - punctuation.definition.parameters.begin.js + include + #core-function - 6 - name - variable.parameter.function.js + include + #core-keywords - 7 - name - punctuation.definition.parameters.end.js + include + #core-punctuation - - 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 + + core-comments - captures - - 1 - - name - support.class.js - - 2 - - name - support.constant.js - - 3 + patterns + + begin + /\*\* + captures + + 0 + + name + punctuation.definition.comment.js + + + end + \*/ + name + comment.block.documentation.js + + + begin + /\* + captures + + 0 + + name + punctuation.definition.comment.js + + + end + \*/ + name + comment.block.js + + + captures + + 1 + + name + punctuation.definition.comment.js + + + match + (//).*$\n? + name + comment.line.double-slash.js + + + captures + + 0 + + name + punctuation.definition.comment.html.js + + 2 + + name + punctuation.definition.comment.html.js + + + match + (<!--|-->) name - entity.name.function.js + comment.block.html.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 + + core-function - captures - - 1 - - name - support.class.js - - 2 - - name - entity.name.function.js - - 3 - - name - storage.type.function.js - - 4 - - name - punctuation.definition.parameters.begin.js - - 5 - - name - variable.parameter.function.js - - 6 + patterns + + captures + + 1 + + name + storage.type.function.js + + 2 + + name + entity.name.function.js + + 3 + + name + punctuation.definition.parameters.begin.js + + 4 + + name + variable.parameter.function.js + + 5 + + name + punctuation.definition.parameters.end.js + + + comment + match regular function like: function myFunc(arg) { … } + match + \b(function)(?:\s+([a-zA-Z_$]\w*))?\s*(\()(.*?)(\)) + name + meta.function.js + + + 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 + punctuation.definition.parameters.begin.js + + 6 + + name + variable.parameter.function.js + + 7 + + name + punctuation.definition.parameters.end.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 + + 3 + + name + storage.type.function.js + + 4 + + name + punctuation.definition.parameters.begin.js + + 5 + + name + variable.parameter.function.js + + 6 + + name + punctuation.definition.parameters.end.js + + + comment + match stuff like: Sound.play = function() { … } + match + ([a-zA-Z_?.$][\w?.$]*)\.([a-zA-Z_?.$][\w?.$]*)\s*=\s*(function)\s*(\()(.*?)(\)) + name + meta.function.js + + + captures + + 1 + + name + entity.name.function.js + + 2 + + name + punctuation.separator.key-value.js + + 3 + + name + storage.type.function.js + + 4 + + name + punctuation.definition.parameters.begin.js + + 5 + + name + variable.parameter.function.js + + 6 + + name + punctuation.definition.parameters.end.js + + + comment + match stuff like: foobar: function() { … } + match + \b([a-zA-Z_?.$][\w?.$]*)\s*(:)\s*\b(function)?\s*(\()(.*?)(\)) + name + meta.function.json.js + + + captures + + 1 + + name + string.quoted.single.js + + 10 + + name + storage.type.function.js + + 11 + + name + punctuation.definition.parameters.begin.js + + 12 + + name + variable.parameter.function.js + + 13 + + name + punctuation.definition.parameters.end.js + + 2 + + name + punctuation.definition.string.begin.js + + 3 + + name + entity.name.function.js + + 4 + + name + punctuation.definition.string.end.js + + 5 + + name + string.quoted.double.js + + 6 + + name + punctuation.definition.string.begin.js + + 7 + + name + entity.name.function.js + + 8 + + name + punctuation.definition.string.end.js + + 9 + + name + punctuation.separator.key-value.js + + + comment + Attempt to match "foo": function + match + (?:((')(.*?)('))|((")(.*?)(")))\s*(:)\s*\b(function)?\s*(\()(.*?)(\)) name - punctuation.definition.parameters.end.js + meta.function.json.js - - comment - match stuff like: Sound.play = function() { … } - match - ([a-zA-Z_?.$][\w?.$]*)\.([a-zA-Z_?.$][\w?.$]*)\s*=\s*(function)\s*(\()(.*?)(\)) - name - meta.function.js + + core-keywords - captures - - 1 + patterns + + captures + + 1 + + name + keyword.operator.new.js + + 2 + + name + entity.name.type.instance.js + + + match + (new)\s+(\w+(?:\.\w*)?) name - storage.type.function.js + meta.class.instance.constructor - 2 + match + \b(boolean|byte|char|class|double|enum|float|function|int|interface|long|short|var|void)\b name - entity.name.function.js + storage.type.js - 3 + match + \b(const|export|extends|final|implements|native|private|protected|public|static|synchronized|throws|transient|volatile)\b name - punctuation.definition.parameters.begin.js + storage.modifier.js - 4 + match + \b(break|case|catch|continue|default|do|else|finally|for|goto|if|import|package|return|switch|throw|try|while)\b name - variable.parameter.function.js + keyword.control.js - 5 + match + \b(delete|in|instanceof|new|typeof|with)\b name - punctuation.definition.parameters.end.js + keyword.operator.js - - comment - match regular function like: function myFunc(arg) { … } - match - \b(function)(?:\s+([a-zA-Z_$]\w*))?\s*(\()(.*?)(\)) - name - meta.function.js - - - captures - - 1 + match + \btrue\b name - entity.name.function.js + constant.language.boolean.true.js - 2 + match + \bfalse\b name - punctuation.separator.key-value.js + constant.language.boolean.false.js - 3 + match + \bnull\b name - storage.type.function.js + constant.language.null.js - 4 + match + \b(super|this)\b name - punctuation.definition.parameters.begin.js + variable.language.js - 5 + match + !|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|/=|%=|\+=|\-=|&=|\^=|\b(in|instanceof|new|delete|typeof|void)\b name - variable.parameter.function.js + keyword.operator.js - 6 + match + \b(Infinity|NaN|undefined)\b name - punctuation.definition.parameters.end.js + constant.language.js - - comment - match stuff like: foobar: function() { … } - match - \b([a-zA-Z_?.$][\w?.$]*)\s*(:)\s*\b(function)?\s*(\()(.*?)(\)) - name - meta.function.json.js + + core-number - captures - - 1 - - name - string.quoted.single.js - - 10 - - name - storage.type.function.js - - 11 + patterns + + match + \b((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?([eE][-+]?[0-9]+)?))\b name - punctuation.definition.parameters.begin.js + constant.numeric.js - 12 + + + core-punctuation + + patterns + + match + \; name - variable.parameter.function.js + punctuation.terminator.statement.js - 13 + match + , name - punctuation.definition.parameters.end.js + meta.delimiter.object.comma.js - 2 + match + \. name - punctuation.definition.string.begin.js + meta.delimiter.method.period.js - 3 + match + \{|\} name - entity.name.function.js + meta.brace.curly.js - 4 + match + \(|\) name - punctuation.definition.string.end.js + meta.brace.round.js - 5 + match + \[|\] name - string.quoted.double.js + meta.brace.square.js - 6 + match + (?<=\.)\s name - punctuation.definition.string.begin.js + meta.complete.method - 7 + + + core-regex + + patterns + - name - entity.name.function.js + begin + (?x) + (?<= [\[,=(:] | ^ | && | return ) + \s*((/)) (?! [/*+{}?] | $ ) + beginCaptures + + 1 + + name + string.regexp.js + + 2 + + name + punctuation.definition.string.begin.js + + + contentName + string.regexp.js + end + ((/([igm]*)))|$ + endCaptures + + 1 + + name + string.regexp.js + + 2 + + name + punctuation.definition.string.end.js + + 3 + + name + keyword.other.js + + + patterns + + + match + \\. + name + constant.character.escape.js + + - 8 + + + core-string + + patterns + + begin + ' + beginCaptures + + 0 + + name + punctuation.definition.string.begin.js + + + end + (?i)'|(?=</\s*script\s*>\s*\n)|(?<=[^\\]\n) + endCaptures + + 0 + + name + punctuation.definition.string.end.js + + name - punctuation.definition.string.end.js - - 9 - + string.quoted.single.js + patterns + + + include + #string-single-innards + + + + + begin + " + beginCaptures + + 0 + + name + punctuation.definition.string.begin.js + + + end + (?i)"|(?=</\s*script\s*>\s*\n)|(?<=[^\\]\n) + endCaptures + + 0 + + name + punctuation.definition.string.end.js + + name - punctuation.separator.key-value.js + string.quoted.double.js + patterns + + + include + #string-double-innards + + - - comment - Attempt to match "foo": function - match - (?:((')(.*?)('))|((")(.*?)(")))\s*(:)\s*\b(function)?\s*(\()(.*?)(\)) - name - meta.function.json.js + + special - captures - - 1 - - name - keyword.operator.new.js - - 2 + patterns + + match + \b(console)\b name - entity.name.type.instance.js + entity.name.type.object.js.firebug - - match - (new)\s+(\w+(?:\.\w*)?) - name - meta.class.instance.constructor - - - match - \b(console)\b - name - entity.name.type.object.js.firebug - - - match - \.(warn|info|log|error|time|timeEnd|assert)\b - name - support.function.js.firebug - - - match - \b((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?([eE][-+]?[0-9]+)?))\b - name - constant.numeric.js - - - begin - ' - beginCaptures - - 0 + match + \.(warn|info|log|error|time|timeEnd|assert)\b name - punctuation.definition.string.begin.js + support.function.js.firebug - - end - (?i)'|(?=</\s*script\s*>\s*\n)|(?<=[^\\]\n) - endCaptures - - 0 + match + \b(debugger)\b name - punctuation.definition.string.end.js + keyword.other.js - - name - string.quoted.single.js + + + string-double-innards + patterns match - \\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.) + \\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.) name constant.character.escape.js @@ -395,34 +756,13 @@ + string-single-innards - begin - " - beginCaptures - - 0 - - name - punctuation.definition.string.begin.js - - - end - (?i)"|(?=</\s*script\s*>\s*\n)|(?<=[^\\]\n) - endCaptures - - 0 - - name - punctuation.definition.string.end.js - - - name - string.quoted.double.js patterns match - \\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.) + \\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.) name constant.character.escape.js @@ -446,276 +786,54 @@ + support - begin - /\*\* - captures - - 0 - - name - punctuation.definition.comment.js - - - end - \*/ - name - comment.block.documentation.js - - - begin - /\* - captures - - 0 - - name - punctuation.definition.comment.js - - - end - \*/ - name - comment.block.js - - - captures - - 1 - - name - punctuation.definition.comment.js - - - match - (//).*$\n? - name - comment.line.double-slash.js - - - captures - - 0 - - name - punctuation.definition.comment.html.js - - 2 + patterns + + match + \b(Anchor|Applet|Area|Array|Boolean|Button|Checkbox|Date|document|event|FileUpload|Form|Frame|Function|Hidden|History|Image|JavaArray|JavaClass|JavaObject|JavaPackage|java|Layer|Link|Location|Math|MimeType|Number|navigator|netscape|Object|Option|Packages|Password|Plugin|Radio|RegExp|Reset|Select|String|Style|Submit|screen|sun|Text|Textarea|window|XMLHttpRequest)\b name - punctuation.definition.comment.html.js + support.class.js - - match - (<!--|-->) - name - comment.block.html.js - - - match - \b(boolean|byte|char|class|double|enum|float|function|int|interface|long|short|var|void)\b - name - storage.type.js - - - match - \b(const|export|extends|final|implements|native|private|protected|public|static|synchronized|throws|transient|volatile)\b - name - storage.modifier.js - - - match - \b(break|case|catch|continue|default|do|else|finally|for|goto|if|import|package|return|switch|throw|try|while)\b - name - keyword.control.js - - - match - \b(delete|in|instanceof|new|typeof|with)\b - name - keyword.operator.js - - - match - \btrue\b - name - constant.language.boolean.true.js - - - match - \bfalse\b - name - constant.language.boolean.false.js - - - match - \bnull\b - name - constant.language.null.js - - - match - \b(super|this)\b - name - variable.language.js - - - match - \b(debugger)\b - name - keyword.other.js - - - match - \b(Anchor|Applet|Area|Array|Boolean|Button|Checkbox|Date|document|event|FileUpload|Form|Frame|Function|Hidden|History|Image|JavaArray|JavaClass|JavaObject|JavaPackage|java|Layer|Link|Location|Math|MimeType|Number|navigator|netscape|Object|Option|Packages|Password|Plugin|Radio|RegExp|Reset|Select|String|Style|Submit|screen|sun|Text|Textarea|window|XMLHttpRequest)\b - name - support.class.js - - - match - \b(s(h(ift|ow(Mod(elessDialog|alDialog)|Help))|croll(X|By(Pages|Lines)?|Y|To)?|t(op|rike)|i(n|zeToContent|debar|gnText)|ort|u(p|b(str(ing)?)?)|pli(ce|t)|e(nd|t(Re(sizable|questHeader)|M(i(nutes|lliseconds)|onth)|Seconds|Ho(tKeys|urs)|Year|Cursor|Time(out)?|Interval|ZOptions|Date|UTC(M(i(nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(ome|andleEvent)|navigate|c(har(CodeAt|At)|o(s|n(cat|textual|firm)|mpile)|eil|lear(Timeout|Interval)?|a(ptureEvents|ll)|reate(StyleSheet|Popup|EventObject))|t(o(GMTString|S(tring|ource)|U(TCString|pperCase)|Lo(caleString|werCase))|est|a(n|int(Enabled)?))|i(s(NaN|Finite)|ndexOf|talics)|d(isableExternalCapture|ump|etachEvent)|u(n(shift|taint|escape|watch)|pdateCommands)|j(oin|avaEnabled)|p(o(p|w)|ush|lugins.refresh|a(ddings|rse(Int|Float)?)|r(int|ompt|eference))|e(scape|nableExternalCapture|val|lementFromPoint|x(p|ec(Script|Command)?))|valueOf|UTC|queryCommand(State|Indeterm|Enabled|Value)|f(i(nd|le(ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(nt(size|color)|rward)|loor|romCharCode)|watch|l(ink|o(ad|g)|astIndexOf)|a(sin|nchor|cos|t(tachEvent|ob|an(2)?)|pply|lert|b(s|ort))|r(ou(nd|teEvents)|e(size(By|To)|calc|turnValue|place|verse|l(oad|ease(Capture|Events)))|andom)|g(o|et(ResponseHeader|M(i(nutes|lliseconds)|onth)|Se(conds|lection)|Hours|Year|Time(zoneOffset)?|Da(y|te)|UTC(M(i(nutes|lliseconds)|onth)|Seconds|Hours|Da(y|te)|FullYear)|FullYear|A(ttention|llResponseHeaders)))|m(in|ove(B(y|elow)|To(Absolute)?|Above)|ergeAttributes|a(tch|rgins|x))|b(toa|ig|o(ld|rderWidths)|link|ack))\b(?=\() - name - support.function.js - - - match - \b(s(ub(stringData|mit)|plitText|e(t(NamedItem|Attribute(Node)?)|lect))|has(ChildNodes|Feature)|namedItem|c(l(ick|o(se|neNode))|reate(C(omment|DATASection|aption)|T(Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(ntityReference|lement)|Attribute))|tabIndex|i(nsert(Row|Before|Cell|Data)|tem)|open|delete(Row|C(ell|aption)|T(Head|Foot)|Data)|focus|write(ln)?|a(dd|ppend(Child|Data))|re(set|place(Child|Data)|move(NamedItem|Child|Attribute(Node)?)?)|get(NamedItem|Element(sBy(Name|TagName)|ById)|Attribute(Node)?)|blur)\b(?=\() - name - support.function.dom.js - - - match - (?<=\.)(s(ystemLanguage|cr(ipts|ollbars|een(X|Y|Top|Left))|t(yle(Sheets)?|atus(Text|bar)?)|ibling(Below|Above)|ource|uffixes|e(curity(Policy)?|l(ection|f)))|h(istory|ost(name)?|as(h|Focus))|y|X(MLDocument|SLDocument)|n(ext|ame(space(s|URI)|Prop))|M(IN_VALUE|AX_VALUE)|c(haracterSet|o(n(structor|trollers)|okieEnabled|lorDepth|mp(onents|lete))|urrent|puClass|l(i(p(boardData)?|entInformation)|osed|asses)|alle(e|r)|rypto)|t(o(olbar|p)|ext(Transform|Indent|Decoration|Align)|ags)|SQRT(1_2|2)|i(n(ner(Height|Width)|put)|ds|gnoreCase)|zIndex|o(scpu|n(readystatechange|Line)|uter(Height|Width)|p(sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(i(splay|alog(Height|Top|Width|Left|Arguments)|rectories)|e(scription|fault(Status|Ch(ecked|arset)|View)))|u(ser(Profile|Language|Agent)|n(iqueID|defined)|pdateInterval)|_content|p(ixelDepth|ort|ersonalbar|kcs11|l(ugins|atform)|a(thname|dding(Right|Bottom|Top|Left)|rent(Window|Layer)?|ge(X(Offset)?|Y(Offset)?))|r(o(to(col|type)|duct(Sub)?|mpter)|e(vious|fix)))|e(n(coding|abledPlugin)|x(ternal|pando)|mbeds)|v(isibility|endor(Sub)?|Linkcolor)|URLUnencoded|P(I|OSITIVE_INFINITY)|f(ilename|o(nt(Size|Family|Weight)|rmName)|rame(s|Element)|gColor)|E|whiteSpace|l(i(stStyleType|n(eHeight|kColor))|o(ca(tion(bar)?|lName)|wsrc)|e(ngth|ft(Context)?)|a(st(M(odified|atch)|Index|Paren)|yer(s|X)|nguage))|a(pp(MinorVersion|Name|Co(deName|re)|Version)|vail(Height|Top|Width|Left)|ll|r(ity|guments)|Linkcolor|bove)|r(ight(Context)?|e(sponse(XML|Text)|adyState))|global|x|m(imeTypes|ultiline|enubar|argin(Right|Bottom|Top|Left))|L(N(10|2)|OG(10E|2E))|b(o(ttom|rder(RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(Color|Image)))\b - name - support.constant.js - - - match - (?<=\.)(s(hape|ystemId|c(heme|ope|rolling)|ta(ndby|rt)|ize|ummary|pecified|e(ctionRowIndex|lected(Index)?)|rc)|h(space|t(tpEquiv|mlFor)|e(ight|aders)|ref(lang)?)|n(o(Resize|tation(s|Name)|Shade|Href|de(Name|Type|Value)|Wrap)|extSibling|ame)|c(h(ildNodes|Off|ecked|arset)?|ite|o(ntent|o(kie|rds)|de(Base|Type)?|l(s|Span|or)|mpact)|ell(s|Spacing|Padding)|l(ear|assName)|aption)|t(ype|Bodies|itle|Head|ext|a(rget|gName)|Foot)|i(sMap|ndex|d|m(plementation|ages))|o(ptions|wnerDocument|bject)|d(i(sabled|r)|o(c(type|umentElement)|main)|e(clare|f(er|ault(Selected|Checked|Value)))|at(eTime|a))|useMap|p(ublicId|arentNode|r(o(file|mpt)|eviousSibling))|e(n(ctype|tities)|vent|lements)|v(space|ersion|alue(Type)?|Link|Align)|URL|f(irstChild|orm(s)?|ace|rame(Border)?)|width|l(ink(s)?|o(ngDesc|wSrc)|a(stChild|ng|bel))|a(nchors|c(ce(ssKey|pt(Charset)?)|tion)|ttributes|pplets|l(t|ign)|r(chive|eas)|xis|Link|bbr)|r(ow(s|Span|Index)|ules|e(v|ferrer|l|adOnly))|m(ultiple|e(thod|dia)|a(rgin(Height|Width)|xLength))|b(o(dy|rder)|ackground|gColor))\b - name - support.constant.dom.js - - - match - \b(ELEMENT_NODE|ATTRIBUTE_NODE|TEXT_NODE|CDATA_SECTION_NODE|ENTITY_REFERENCE_NODE|ENTITY_NODE|PROCESSING_INSTRUCTION_NODE|COMMENT_NODE|DOCUMENT_NODE|DOCUMENT_TYPE_NODE|DOCUMENT_FRAGMENT_NODE|NOTATION_NODE|INDEX_SIZE_ERR|DOMSTRING_SIZE_ERR|HIERARCHY_REQUEST_ERR|WRONG_DOCUMENT_ERR|INVALID_CHARACTER_ERR|NO_DATA_ALLOWED_ERR|NO_MODIFICATION_ALLOWED_ERR|NOT_FOUND_ERR|NOT_SUPPORTED_ERR|INUSE_ATTRIBUTE_ERR)\b - name - support.constant.dom.js - - - match - \bon(R(ow(s(inserted|delete)|e(nter|xit))|e(s(ize(start|end)?|et)|adystatechange))|Mouse(o(ut|ver)|down|up|move)|B(efore(cut|deactivate|u(nload|pdate)|p(aste|rint)|editfocus|activate)|lur)|S(croll|top|ubmit|elect(start|ionchange)?)|H(over|elp)|C(hange|ont(extmenu|rolselect)|ut|ellchange|l(ick|ose))|D(eactivate|ata(setc(hanged|omplete)|available)|r(op|ag(start|over|drop|en(ter|d)|leave)?)|blclick)|Unload|P(aste|ropertychange)|Error(update)?|Key(down|up|press)|Focus|Load|A(ctivate|fter(update|print)|bort))\b - name - support.function.event-handler.js - - - match - !|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|/=|%=|\+=|\-=|&=|\^=|\b(in|instanceof|new|delete|typeof|void)\b - name - keyword.operator.js - - - match - \b(Infinity|NaN|undefined)\b - name - constant.language.js - - - begin - (?x) - (?<= [\[,=(:] | ^ | && | return ) - \s*((/)) (?! [/*+{}?] | $ ) - beginCaptures - - 1 + match + \b(s(h(ift|ow(Mod(elessDialog|alDialog)|Help))|croll(X|By(Pages|Lines)?|Y|To)?|t(op|rike)|i(n|zeToContent|debar|gnText)|ort|u(p|b(str(ing)?)?)|pli(ce|t)|e(nd|t(Re(sizable|questHeader)|M(i(nutes|lliseconds)|onth)|Seconds|Ho(tKeys|urs)|Year|Cursor|Time(out)?|Interval|ZOptions|Date|UTC(M(i(nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(ome|andleEvent)|navigate|c(har(CodeAt|At)|o(s|n(cat|textual|firm)|mpile)|eil|lear(Timeout|Interval)?|a(ptureEvents|ll)|reate(StyleSheet|Popup|EventObject))|t(o(GMTString|S(tring|ource)|U(TCString|pperCase)|Lo(caleString|werCase))|est|a(n|int(Enabled)?))|i(s(NaN|Finite)|ndexOf|talics)|d(isableExternalCapture|ump|etachEvent)|u(n(shift|taint|escape|watch)|pdateCommands)|j(oin|avaEnabled)|p(o(p|w)|ush|lugins.refresh|a(ddings|rse(Int|Float)?)|r(int|ompt|eference))|e(scape|nableExternalCapture|val|lementFromPoint|x(p|ec(Script|Command)?))|valueOf|UTC|queryCommand(State|Indeterm|Enabled|Value)|f(i(nd|le(ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(nt(size|color)|rward)|loor|romCharCode)|watch|l(ink|o(ad|g)|astIndexOf)|a(sin|nchor|cos|t(tachEvent|ob|an(2)?)|pply|lert|b(s|ort))|r(ou(nd|teEvents)|e(size(By|To)|calc|turnValue|place|verse|l(oad|ease(Capture|Events)))|andom)|g(o|et(ResponseHeader|M(i(nutes|lliseconds)|onth)|Se(conds|lection)|Hours|Year|Time(zoneOffset)?|Da(y|te)|UTC(M(i(nutes|lliseconds)|onth)|Seconds|Hours|Da(y|te)|FullYear)|FullYear|A(ttention|llResponseHeaders)))|m(in|ove(B(y|elow)|To(Absolute)?|Above)|ergeAttributes|a(tch|rgins|x))|b(toa|ig|o(ld|rderWidths)|link|ack))\b(?=\() name - string.regexp.js + support.function.js - 2 + match + \b(s(ub(stringData|mit)|plitText|e(t(NamedItem|Attribute(Node)?)|lect))|has(ChildNodes|Feature)|namedItem|c(l(ick|o(se|neNode))|reate(C(omment|DATASection|aption)|T(Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(ntityReference|lement)|Attribute))|tabIndex|i(nsert(Row|Before|Cell|Data)|tem)|open|delete(Row|C(ell|aption)|T(Head|Foot)|Data)|focus|write(ln)?|a(dd|ppend(Child|Data))|re(set|place(Child|Data)|move(NamedItem|Child|Attribute(Node)?)?)|get(NamedItem|Element(sBy(Name|TagName)|ById)|Attribute(Node)?)|blur)\b(?=\() name - punctuation.definition.string.begin.js + support.function.dom.js - - contentName - string.regexp.js - end - ((/([igm]*)))|$ - endCaptures - - 1 + match + (?<=\.)(s(ystemLanguage|cr(ipts|ollbars|een(X|Y|Top|Left))|t(yle(Sheets)?|atus(Text|bar)?)|ibling(Below|Above)|ource|uffixes|e(curity(Policy)?|l(ection|f)))|h(istory|ost(name)?|as(h|Focus))|y|X(MLDocument|SLDocument)|n(ext|ame(space(s|URI)|Prop))|M(IN_VALUE|AX_VALUE)|c(haracterSet|o(n(structor|trollers)|okieEnabled|lorDepth|mp(onents|lete))|urrent|puClass|l(i(p(boardData)?|entInformation)|osed|asses)|alle(e|r)|rypto)|t(o(olbar|p)|ext(Transform|Indent|Decoration|Align)|ags)|SQRT(1_2|2)|i(n(ner(Height|Width)|put)|ds|gnoreCase)|zIndex|o(scpu|n(readystatechange|Line)|uter(Height|Width)|p(sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(i(splay|alog(Height|Top|Width|Left|Arguments)|rectories)|e(scription|fault(Status|Ch(ecked|arset)|View)))|u(ser(Profile|Language|Agent)|n(iqueID|defined)|pdateInterval)|_content|p(ixelDepth|ort|ersonalbar|kcs11|l(ugins|atform)|a(thname|dding(Right|Bottom|Top|Left)|rent(Window|Layer)?|ge(X(Offset)?|Y(Offset)?))|r(o(to(col|type)|duct(Sub)?|mpter)|e(vious|fix)))|e(n(coding|abledPlugin)|x(ternal|pando)|mbeds)|v(isibility|endor(Sub)?|Linkcolor)|URLUnencoded|P(I|OSITIVE_INFINITY)|f(ilename|o(nt(Size|Family|Weight)|rmName)|rame(s|Element)|gColor)|E|whiteSpace|l(i(stStyleType|n(eHeight|kColor))|o(ca(tion(bar)?|lName)|wsrc)|e(ngth|ft(Context)?)|a(st(M(odified|atch)|Index|Paren)|yer(s|X)|nguage))|a(pp(MinorVersion|Name|Co(deName|re)|Version)|vail(Height|Top|Width|Left)|ll|r(ity|guments)|Linkcolor|bove)|r(ight(Context)?|e(sponse(XML|Text)|adyState))|global|x|m(imeTypes|ultiline|enubar|argin(Right|Bottom|Top|Left))|L(N(10|2)|OG(10E|2E))|b(o(ttom|rder(RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(Color|Image)))\b name - string.regexp.js + support.constant.js - 2 + match + (?<=\.)(s(hape|ystemId|c(heme|ope|rolling)|ta(ndby|rt)|ize|ummary|pecified|e(ctionRowIndex|lected(Index)?)|rc)|h(space|t(tpEquiv|mlFor)|e(ight|aders)|ref(lang)?)|n(o(Resize|tation(s|Name)|Shade|Href|de(Name|Type|Value)|Wrap)|extSibling|ame)|c(h(ildNodes|Off|ecked|arset)?|ite|o(ntent|o(kie|rds)|de(Base|Type)?|l(s|Span|or)|mpact)|ell(s|Spacing|Padding)|l(ear|assName)|aption)|t(ype|Bodies|itle|Head|ext|a(rget|gName)|Foot)|i(sMap|ndex|d|m(plementation|ages))|o(ptions|wnerDocument|bject)|d(i(sabled|r)|o(c(type|umentElement)|main)|e(clare|f(er|ault(Selected|Checked|Value)))|at(eTime|a))|useMap|p(ublicId|arentNode|r(o(file|mpt)|eviousSibling))|e(n(ctype|tities)|vent|lements)|v(space|ersion|alue(Type)?|Link|Align)|URL|f(irstChild|orm(s)?|ace|rame(Border)?)|width|l(ink(s)?|o(ngDesc|wSrc)|a(stChild|ng|bel))|a(nchors|c(ce(ssKey|pt(Charset)?)|tion)|ttributes|pplets|l(t|ign)|r(chive|eas)|xis|Link|bbr)|r(ow(s|Span|Index)|ules|e(v|ferrer|l|adOnly))|m(ultiple|e(thod|dia)|a(rgin(Height|Width)|xLength))|b(o(dy|rder)|ackground|gColor))\b name - punctuation.definition.string.end.js + support.constant.dom.js - 3 + match + \b(ELEMENT_NODE|ATTRIBUTE_NODE|TEXT_NODE|CDATA_SECTION_NODE|ENTITY_REFERENCE_NODE|ENTITY_NODE|PROCESSING_INSTRUCTION_NODE|COMMENT_NODE|DOCUMENT_NODE|DOCUMENT_TYPE_NODE|DOCUMENT_FRAGMENT_NODE|NOTATION_NODE|INDEX_SIZE_ERR|DOMSTRING_SIZE_ERR|HIERARCHY_REQUEST_ERR|WRONG_DOCUMENT_ERR|INVALID_CHARACTER_ERR|NO_DATA_ALLOWED_ERR|NO_MODIFICATION_ALLOWED_ERR|NOT_FOUND_ERR|NOT_SUPPORTED_ERR|INUSE_ATTRIBUTE_ERR)\b name - keyword.other.js + support.constant.dom.js - - patterns - match - \\. + \bon(R(ow(s(inserted|delete)|e(nter|xit))|e(s(ize(start|end)?|et)|adystatechange))|Mouse(o(ut|ver)|down|up|move)|B(efore(cut|deactivate|u(nload|pdate)|p(aste|rint)|editfocus|activate)|lur)|S(croll|top|ubmit|elect(start|ionchange)?)|H(over|elp)|C(hange|ont(extmenu|rolselect)|ut|ellchange|l(ick|ose))|D(eactivate|ata(setc(hanged|omplete)|available)|r(op|ag(start|over|drop|en(ter|d)|leave)?)|blclick)|Unload|P(aste|ropertychange)|Error(update)?|Key(down|up|press)|Focus|Load|A(ctivate|fter(update|print)|bort))\b name - constant.character.escape.js + support.function.event-handler.js - - match - \; - name - punctuation.terminator.statement.js - - - match - , - name - meta.delimiter.object.comma.js - - - match - \. - name - meta.delimiter.method.period.js - - - match - \{|\} - name - meta.brace.curly.js - - - match - \(|\) - name - meta.brace.round.js - - - match - \[|\] - name - meta.brace.square.js - - - match - (?<=\.)\s - name - meta.complete.method - - - repository - - string-double - scopeName source.js diff --git a/Tests/Javascript Syntax Test.js b/Tests/Javascript Syntax Test.js index e170168..d82e8c8 100644 --- a/Tests/Javascript Syntax Test.js +++ b/Tests/Javascript Syntax Test.js @@ -1,3 +1,18 @@ +// Root +// + + + + + + + + + + + + + // ============= // = FUNCTIONS = // ============= @@ -31,6 +46,17 @@ var funkName=new Function("argument1", "argument2", "return argument1 + argument var funkName1 = function funkName (argument1, argument2) {return argument1 + argument1;}; var funkName1=function funkName(argument1,argument2){return argument1 + argument1;}; +function myFunc(argument1, argument2){} + +Sound.prototype = {} +Sound.prototype.play = function(){} +Sound.prototype.play = myfunc +Sound.play = function(){} +var objectName = { + foobar: function(){}, + 'foo': function(){}, + "foo": function(){} +} // =================== // = OBJECT LITERALS = From 7d3632c085b13bf8bb6fbe9d22065757bbc87c20 Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Mon, 7 Jul 2008 13:07:57 -0400 Subject: [PATCH 123/243] .999 numbers.invalid scopes for octal and hex. -999 and +999 numbers --- Syntaxes/JavaScript Basic.tmLanguage | 27 ++++++++++++-- Tests/Javascript Syntax Test.js | 53 +++++++++++++++++++++++++++- 2 files changed, 77 insertions(+), 3 deletions(-) diff --git a/Syntaxes/JavaScript Basic.tmLanguage b/Syntaxes/JavaScript Basic.tmLanguage index 7abbb41..7599d4b 100644 --- a/Syntaxes/JavaScript Basic.tmLanguage +++ b/Syntaxes/JavaScript Basic.tmLanguage @@ -512,7 +512,7 @@ match - \b(Infinity|NaN|undefined)\b + \b(NaN|undefined)\b name constant.language.js @@ -524,10 +524,33 @@ match - \b((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?([eE][-+]?[0-9]+)?))\b + (?i)\B[-+]?0x[0-9a-f]*\.(\B|\b[0-9]+) + name + invalid.illegal.numeric.hex.js + + + match + \B[-+]?0[0-9]+\.(\B|\b[0-9]+) + name + invalid.illegal.numeric.octal.js + + + match + (?xi)(?:\B[-+])?(?: + 0x[0-9a-f]* # HEX + |( \B\.[0-9]+ # EG: .999 + | \b[0-9]+ (\.[0-9]*)? # EG: 999.999 or 999. or 999 + )(e[-+]?[0-9]+)? # EG: e+123 or E-123 + ) name constant.numeric.js + + match + (?:\B[-+]|\b)(Infinity)\b + name + constant.language.js + core-punctuation diff --git a/Tests/Javascript Syntax Test.js b/Tests/Javascript Syntax Test.js index d82e8c8..8187eb1 100644 --- a/Tests/Javascript Syntax Test.js +++ b/Tests/Javascript Syntax Test.js @@ -151,6 +151,8 @@ function(){ return /regex/ } 999 .999 +(.999) +999. == 999; 999.999 4 16 @@ -161,10 +163,27 @@ function(){ return /regex/ } 3.402823669209385e+38 1.157920892373162e+77 1.3407807929942597e+154 +.3407807929942597e+154 +.3407807929942597E-154 +3407807929942597.E-154.5 // SYNTAX ERROR: missing ; before statement +//....................^ Infinity +Infinity.propertyName +Infinity.methodName() + 0377 // octal +0377. // SYNTAX ERROR +0377.5 // SYNTAX ERROR +0377.propertyName // number property +0377.methodName() // number method + +0x // HEX +0XFF // HEX 0xFF // hex -0xff // hex +0xff. // SYNTAX ERROR +0xff.5 // SYNTAX ERROR +0xff.propertyName // number property +0xff.methodName() // number method -999 -.999 @@ -180,15 +199,47 @@ Infinity -1.3407807929942597e+154 -Infinity -0377 // octal +-0x // hex +-0xFF // hex +-0377 // octal -0xFF // hex -0xff // hex ++999 ++.999 ++999.999 ++4 ++16 ++256 ++65536 ++4294967296 ++18446744073709552000 ++3.402823669209385e+38 ++1.157920892373162e+77 ++1.3407807929942597e+154 ++Infinity ++0377 // octal ++0x // hex ++0xFF // hex ++0377 // octal ++0xFF // hex ++0xff // hex + 1e5 2.5E5 5e-324 1.7976931348623157e+308 +x == 5; +x > 5; +x >= 5; +x < 5; +x <= 5; +x <=> 5; // Syntax Error + +x = x +5; // is the same as x += 5; +x = x -5; // is the same as x -= 5; x = x+5; // is the same as x += 5; x = x-5; // is the same as x -= 5; x = x*5; // is the same as x *= 5; From 3441b11cc2711c656223c80af0ae64d0c4cf899f Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Mon, 7 Jul 2008 13:16:07 -0400 Subject: [PATCH 124/243] Fixed the illegal number scopes --- Syntaxes/JavaScript Basic.tmLanguage | 6 ++-- Tests/Javascript Syntax Test.js | 48 +++++++++++++++++++++++----- 2 files changed, 43 insertions(+), 11 deletions(-) diff --git a/Syntaxes/JavaScript Basic.tmLanguage b/Syntaxes/JavaScript Basic.tmLanguage index 7599d4b..06a547b 100644 --- a/Syntaxes/JavaScript Basic.tmLanguage +++ b/Syntaxes/JavaScript Basic.tmLanguage @@ -524,20 +524,20 @@ match - (?i)\B[-+]?0x[0-9a-f]*\.(\B|\b[0-9]+) + (?i)(?:\B[-+]|\b)0x[0-9a-f]*\.(\B|\b[0-9]+) name invalid.illegal.numeric.hex.js match - \B[-+]?0[0-9]+\.(\B|\b[0-9]+) + (?:\B[-+]|\b)0[0-9]+\.(\B|\b[0-9]+) name invalid.illegal.numeric.octal.js match (?xi)(?:\B[-+])?(?: - 0x[0-9a-f]* # HEX + \b0x[0-9a-f]* # HEX |( \B\.[0-9]+ # EG: .999 | \b[0-9]+ (\.[0-9]*)? # EG: 999.999 or 999. or 999 )(e[-+]?[0-9]+)? # EG: e+123 or E-123 diff --git a/Tests/Javascript Syntax Test.js b/Tests/Javascript Syntax Test.js index 8187eb1..61417dd 100644 --- a/Tests/Javascript Syntax Test.js +++ b/Tests/Javascript Syntax Test.js @@ -187,6 +187,8 @@ Infinity.methodName() -999 -.999 +(-.999) +-999. == -999; -999.999 -4 -16 @@ -197,16 +199,32 @@ Infinity.methodName() -3.402823669209385e+38 -1.157920892373162e+77 -1.3407807929942597e+154 +-.3407807929942597e+154 +-.3407807929942597E-154 +-3407807929942597.E-154.5 // SYNTAX ERROR: missing ; before statement +//.....................^ -Infinity +-Infinity.propertyName +-Infinity.methodName() + -0377 // octal --0x // hex --0xFF // hex --0377 // octal +-0377. // SYNTAX ERROR +-0377.5 // SYNTAX ERROR +-0377.propertyName // number property +-0377.methodName() // number method + +-0x // HEX +-0XFF // HEX -0xFF // hex --0xff // hex +-0xff. // SYNTAX ERROR +-0xff.5 // SYNTAX ERROR +-0xff.propertyName // number property +-0xff.methodName() // number method +999 +.999 +(+.999) ++999. == +999; +999.999 +4 +16 @@ -217,13 +235,27 @@ Infinity.methodName() +3.402823669209385e+38 +1.157920892373162e+77 +1.3407807929942597e+154 ++.3407807929942597e+154 ++.3407807929942597E+154 ++3407807929942597.E+154.5 // SYNTAX ERROR: missing ; before statement +//.....................^ +Infinity ++Infinity.propertyName ++Infinity.methodName() + +0377 // octal -+0x // hex -+0xFF // hex -+0377 // octal ++0377. // SYNTAX ERROR ++0377.5 // SYNTAX ERROR ++0377.propertyName // number property ++0377.methodName() // number method + ++0x // HEX ++0XFF // HEX +0xFF // hex -+0xff // hex ++0xff. // SYNTAX ERROR ++0xff.5 // SYNTAX ERROR ++0xff.propertyName // number property ++0xff.methodName() // number method 1e5 2.5E5 From 1a60d48c2a715d279ae60f953a3bc71fb26a4085 Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Mon, 7 Jul 2008 17:17:26 +0000 Subject: [PATCH 125/243] Reorganize the JavaScript Basic syntax. Moved everything into the repository. git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@10183 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript Basic.tmLanguage | 1140 ++++++++++++++------------ Tests/Javascript Syntax Test.js | 26 + 2 files changed, 655 insertions(+), 511 deletions(-) diff --git a/Syntaxes/JavaScript Basic.tmLanguage b/Syntaxes/JavaScript Basic.tmLanguage index 283c571..7abbb41 100644 --- a/Syntaxes/JavaScript Basic.tmLanguage +++ b/Syntaxes/JavaScript Basic.tmLanguage @@ -21,357 +21,718 @@ 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 + include + #core - captures - - 1 + include + #special + + + include + #support + + + repository + + core + + patterns + - name - support.class.js + include + #core-comments - 2 - name - support.constant.js + include + #core-number - 3 - name - entity.name.function.js + include + #core-string - 4 - name - storage.type.function.js + include + #core-regex - 5 - name - punctuation.definition.parameters.begin.js + include + #core-function - 6 - name - variable.parameter.function.js + include + #core-keywords - 7 - name - punctuation.definition.parameters.end.js + include + #core-punctuation - - 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 + + core-comments - captures - - 1 - - name - support.class.js - - 2 - - name - support.constant.js - - 3 + patterns + + begin + /\*\* + captures + + 0 + + name + punctuation.definition.comment.js + + + end + \*/ + name + comment.block.documentation.js + + + begin + /\* + captures + + 0 + + name + punctuation.definition.comment.js + + + end + \*/ + name + comment.block.js + + + captures + + 1 + + name + punctuation.definition.comment.js + + + match + (//).*$\n? + name + comment.line.double-slash.js + + + captures + + 0 + + name + punctuation.definition.comment.html.js + + 2 + + name + punctuation.definition.comment.html.js + + + match + (<!--|-->) name - entity.name.function.js + comment.block.html.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 + + core-function - captures - - 1 - - name - support.class.js - - 2 - - name - entity.name.function.js - - 3 - - name - storage.type.function.js - - 4 - - name - punctuation.definition.parameters.begin.js - - 5 - - name - variable.parameter.function.js - - 6 + patterns + + captures + + 1 + + name + storage.type.function.js + + 2 + + name + entity.name.function.js + + 3 + + name + punctuation.definition.parameters.begin.js + + 4 + + name + variable.parameter.function.js + + 5 + + name + punctuation.definition.parameters.end.js + + + comment + match regular function like: function myFunc(arg) { … } + match + \b(function)(?:\s+([a-zA-Z_$]\w*))?\s*(\()(.*?)(\)) + name + meta.function.js + + + 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 + punctuation.definition.parameters.begin.js + + 6 + + name + variable.parameter.function.js + + 7 + + name + punctuation.definition.parameters.end.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 + + 3 + + name + storage.type.function.js + + 4 + + name + punctuation.definition.parameters.begin.js + + 5 + + name + variable.parameter.function.js + + 6 + + name + punctuation.definition.parameters.end.js + + + comment + match stuff like: Sound.play = function() { … } + match + ([a-zA-Z_?.$][\w?.$]*)\.([a-zA-Z_?.$][\w?.$]*)\s*=\s*(function)\s*(\()(.*?)(\)) + name + meta.function.js + + + captures + + 1 + + name + entity.name.function.js + + 2 + + name + punctuation.separator.key-value.js + + 3 + + name + storage.type.function.js + + 4 + + name + punctuation.definition.parameters.begin.js + + 5 + + name + variable.parameter.function.js + + 6 + + name + punctuation.definition.parameters.end.js + + + comment + match stuff like: foobar: function() { … } + match + \b([a-zA-Z_?.$][\w?.$]*)\s*(:)\s*\b(function)?\s*(\()(.*?)(\)) + name + meta.function.json.js + + + captures + + 1 + + name + string.quoted.single.js + + 10 + + name + storage.type.function.js + + 11 + + name + punctuation.definition.parameters.begin.js + + 12 + + name + variable.parameter.function.js + + 13 + + name + punctuation.definition.parameters.end.js + + 2 + + name + punctuation.definition.string.begin.js + + 3 + + name + entity.name.function.js + + 4 + + name + punctuation.definition.string.end.js + + 5 + + name + string.quoted.double.js + + 6 + + name + punctuation.definition.string.begin.js + + 7 + + name + entity.name.function.js + + 8 + + name + punctuation.definition.string.end.js + + 9 + + name + punctuation.separator.key-value.js + + + comment + Attempt to match "foo": function + match + (?:((')(.*?)('))|((")(.*?)(")))\s*(:)\s*\b(function)?\s*(\()(.*?)(\)) name - punctuation.definition.parameters.end.js + meta.function.json.js - - comment - match stuff like: Sound.play = function() { … } - match - ([a-zA-Z_?.$][\w?.$]*)\.([a-zA-Z_?.$][\w?.$]*)\s*=\s*(function)\s*(\()(.*?)(\)) - name - meta.function.js + + core-keywords - captures - - 1 + patterns + + captures + + 1 + + name + keyword.operator.new.js + + 2 + + name + entity.name.type.instance.js + + + match + (new)\s+(\w+(?:\.\w*)?) name - storage.type.function.js + meta.class.instance.constructor - 2 + match + \b(boolean|byte|char|class|double|enum|float|function|int|interface|long|short|var|void)\b name - entity.name.function.js + storage.type.js - 3 + match + \b(const|export|extends|final|implements|native|private|protected|public|static|synchronized|throws|transient|volatile)\b name - punctuation.definition.parameters.begin.js + storage.modifier.js - 4 + match + \b(break|case|catch|continue|default|do|else|finally|for|goto|if|import|package|return|switch|throw|try|while)\b name - variable.parameter.function.js + keyword.control.js - 5 + match + \b(delete|in|instanceof|new|typeof|with)\b name - punctuation.definition.parameters.end.js + keyword.operator.js - - comment - match regular function like: function myFunc(arg) { … } - match - \b(function)(?:\s+([a-zA-Z_$]\w*))?\s*(\()(.*?)(\)) - name - meta.function.js - - - captures - - 1 + match + \btrue\b name - entity.name.function.js + constant.language.boolean.true.js - 2 + match + \bfalse\b name - punctuation.separator.key-value.js + constant.language.boolean.false.js - 3 + match + \bnull\b name - storage.type.function.js + constant.language.null.js - 4 + match + \b(super|this)\b name - punctuation.definition.parameters.begin.js + variable.language.js - 5 + match + !|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|/=|%=|\+=|\-=|&=|\^=|\b(in|instanceof|new|delete|typeof|void)\b name - variable.parameter.function.js + keyword.operator.js - 6 + match + \b(Infinity|NaN|undefined)\b name - punctuation.definition.parameters.end.js + constant.language.js - - comment - match stuff like: foobar: function() { … } - match - \b([a-zA-Z_?.$][\w?.$]*)\s*(:)\s*\b(function)?\s*(\()(.*?)(\)) - name - meta.function.json.js + + core-number - captures - - 1 - - name - string.quoted.single.js - - 10 - - name - storage.type.function.js - - 11 + patterns + + match + \b((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?([eE][-+]?[0-9]+)?))\b name - punctuation.definition.parameters.begin.js + constant.numeric.js - 12 + + + core-punctuation + + patterns + + match + \; name - variable.parameter.function.js + punctuation.terminator.statement.js - 13 + match + , name - punctuation.definition.parameters.end.js + meta.delimiter.object.comma.js - 2 + match + \. name - punctuation.definition.string.begin.js + meta.delimiter.method.period.js - 3 + match + \{|\} name - entity.name.function.js + meta.brace.curly.js - 4 + match + \(|\) name - punctuation.definition.string.end.js + meta.brace.round.js - 5 + match + \[|\] name - string.quoted.double.js + meta.brace.square.js - 6 + match + (?<=\.)\s name - punctuation.definition.string.begin.js + meta.complete.method - 7 + + + core-regex + + patterns + - name - entity.name.function.js + begin + (?x) + (?<= [\[,=(:] | ^ | && | return ) + \s*((/)) (?! [/*+{}?] | $ ) + beginCaptures + + 1 + + name + string.regexp.js + + 2 + + name + punctuation.definition.string.begin.js + + + contentName + string.regexp.js + end + ((/([igm]*)))|$ + endCaptures + + 1 + + name + string.regexp.js + + 2 + + name + punctuation.definition.string.end.js + + 3 + + name + keyword.other.js + + + patterns + + + match + \\. + name + constant.character.escape.js + + - 8 + + + core-string + + patterns + + begin + ' + beginCaptures + + 0 + + name + punctuation.definition.string.begin.js + + + end + (?i)'|(?=</\s*script\s*>\s*\n)|(?<=[^\\]\n) + endCaptures + + 0 + + name + punctuation.definition.string.end.js + + name - punctuation.definition.string.end.js - - 9 - + string.quoted.single.js + patterns + + + include + #string-single-innards + + + + + begin + " + beginCaptures + + 0 + + name + punctuation.definition.string.begin.js + + + end + (?i)"|(?=</\s*script\s*>\s*\n)|(?<=[^\\]\n) + endCaptures + + 0 + + name + punctuation.definition.string.end.js + + name - punctuation.separator.key-value.js + string.quoted.double.js + patterns + + + include + #string-double-innards + + - - comment - Attempt to match "foo": function - match - (?:((')(.*?)('))|((")(.*?)(")))\s*(:)\s*\b(function)?\s*(\()(.*?)(\)) - name - meta.function.json.js + + special - captures - - 1 - - name - keyword.operator.new.js - - 2 + patterns + + match + \b(console)\b name - entity.name.type.instance.js + entity.name.type.object.js.firebug - - match - (new)\s+(\w+(?:\.\w*)?) - name - meta.class.instance.constructor - - - match - \b(console)\b - name - entity.name.type.object.js.firebug - - - match - \.(warn|info|log|error|time|timeEnd|assert)\b - name - support.function.js.firebug - - - match - \b((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?([eE][-+]?[0-9]+)?))\b - name - constant.numeric.js - - - begin - ' - beginCaptures - - 0 + match + \.(warn|info|log|error|time|timeEnd|assert)\b name - punctuation.definition.string.begin.js + support.function.js.firebug - - end - (?i)'|(?=</\s*script\s*>\s*\n)|(?<=[^\\]\n) - endCaptures - - 0 + match + \b(debugger)\b name - punctuation.definition.string.end.js + keyword.other.js - - name - string.quoted.single.js + + + string-double-innards + patterns match - \\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.) + \\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.) name constant.character.escape.js @@ -395,34 +756,13 @@ + string-single-innards - begin - " - beginCaptures - - 0 - - name - punctuation.definition.string.begin.js - - - end - (?i)"|(?=</\s*script\s*>\s*\n)|(?<=[^\\]\n) - endCaptures - - 0 - - name - punctuation.definition.string.end.js - - - name - string.quoted.double.js patterns match - \\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.) + \\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.) name constant.character.escape.js @@ -446,276 +786,54 @@ + support - begin - /\*\* - captures - - 0 - - name - punctuation.definition.comment.js - - - end - \*/ - name - comment.block.documentation.js - - - begin - /\* - captures - - 0 - - name - punctuation.definition.comment.js - - - end - \*/ - name - comment.block.js - - - captures - - 1 - - name - punctuation.definition.comment.js - - - match - (//).*$\n? - name - comment.line.double-slash.js - - - captures - - 0 - - name - punctuation.definition.comment.html.js - - 2 + patterns + + match + \b(Anchor|Applet|Area|Array|Boolean|Button|Checkbox|Date|document|event|FileUpload|Form|Frame|Function|Hidden|History|Image|JavaArray|JavaClass|JavaObject|JavaPackage|java|Layer|Link|Location|Math|MimeType|Number|navigator|netscape|Object|Option|Packages|Password|Plugin|Radio|RegExp|Reset|Select|String|Style|Submit|screen|sun|Text|Textarea|window|XMLHttpRequest)\b name - punctuation.definition.comment.html.js + support.class.js - - match - (<!--|-->) - name - comment.block.html.js - - - match - \b(boolean|byte|char|class|double|enum|float|function|int|interface|long|short|var|void)\b - name - storage.type.js - - - match - \b(const|export|extends|final|implements|native|private|protected|public|static|synchronized|throws|transient|volatile)\b - name - storage.modifier.js - - - match - \b(break|case|catch|continue|default|do|else|finally|for|goto|if|import|package|return|switch|throw|try|while)\b - name - keyword.control.js - - - match - \b(delete|in|instanceof|new|typeof|with)\b - name - keyword.operator.js - - - match - \btrue\b - name - constant.language.boolean.true.js - - - match - \bfalse\b - name - constant.language.boolean.false.js - - - match - \bnull\b - name - constant.language.null.js - - - match - \b(super|this)\b - name - variable.language.js - - - match - \b(debugger)\b - name - keyword.other.js - - - match - \b(Anchor|Applet|Area|Array|Boolean|Button|Checkbox|Date|document|event|FileUpload|Form|Frame|Function|Hidden|History|Image|JavaArray|JavaClass|JavaObject|JavaPackage|java|Layer|Link|Location|Math|MimeType|Number|navigator|netscape|Object|Option|Packages|Password|Plugin|Radio|RegExp|Reset|Select|String|Style|Submit|screen|sun|Text|Textarea|window|XMLHttpRequest)\b - name - support.class.js - - - match - \b(s(h(ift|ow(Mod(elessDialog|alDialog)|Help))|croll(X|By(Pages|Lines)?|Y|To)?|t(op|rike)|i(n|zeToContent|debar|gnText)|ort|u(p|b(str(ing)?)?)|pli(ce|t)|e(nd|t(Re(sizable|questHeader)|M(i(nutes|lliseconds)|onth)|Seconds|Ho(tKeys|urs)|Year|Cursor|Time(out)?|Interval|ZOptions|Date|UTC(M(i(nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(ome|andleEvent)|navigate|c(har(CodeAt|At)|o(s|n(cat|textual|firm)|mpile)|eil|lear(Timeout|Interval)?|a(ptureEvents|ll)|reate(StyleSheet|Popup|EventObject))|t(o(GMTString|S(tring|ource)|U(TCString|pperCase)|Lo(caleString|werCase))|est|a(n|int(Enabled)?))|i(s(NaN|Finite)|ndexOf|talics)|d(isableExternalCapture|ump|etachEvent)|u(n(shift|taint|escape|watch)|pdateCommands)|j(oin|avaEnabled)|p(o(p|w)|ush|lugins.refresh|a(ddings|rse(Int|Float)?)|r(int|ompt|eference))|e(scape|nableExternalCapture|val|lementFromPoint|x(p|ec(Script|Command)?))|valueOf|UTC|queryCommand(State|Indeterm|Enabled|Value)|f(i(nd|le(ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(nt(size|color)|rward)|loor|romCharCode)|watch|l(ink|o(ad|g)|astIndexOf)|a(sin|nchor|cos|t(tachEvent|ob|an(2)?)|pply|lert|b(s|ort))|r(ou(nd|teEvents)|e(size(By|To)|calc|turnValue|place|verse|l(oad|ease(Capture|Events)))|andom)|g(o|et(ResponseHeader|M(i(nutes|lliseconds)|onth)|Se(conds|lection)|Hours|Year|Time(zoneOffset)?|Da(y|te)|UTC(M(i(nutes|lliseconds)|onth)|Seconds|Hours|Da(y|te)|FullYear)|FullYear|A(ttention|llResponseHeaders)))|m(in|ove(B(y|elow)|To(Absolute)?|Above)|ergeAttributes|a(tch|rgins|x))|b(toa|ig|o(ld|rderWidths)|link|ack))\b(?=\() - name - support.function.js - - - match - \b(s(ub(stringData|mit)|plitText|e(t(NamedItem|Attribute(Node)?)|lect))|has(ChildNodes|Feature)|namedItem|c(l(ick|o(se|neNode))|reate(C(omment|DATASection|aption)|T(Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(ntityReference|lement)|Attribute))|tabIndex|i(nsert(Row|Before|Cell|Data)|tem)|open|delete(Row|C(ell|aption)|T(Head|Foot)|Data)|focus|write(ln)?|a(dd|ppend(Child|Data))|re(set|place(Child|Data)|move(NamedItem|Child|Attribute(Node)?)?)|get(NamedItem|Element(sBy(Name|TagName)|ById)|Attribute(Node)?)|blur)\b(?=\() - name - support.function.dom.js - - - match - (?<=\.)(s(ystemLanguage|cr(ipts|ollbars|een(X|Y|Top|Left))|t(yle(Sheets)?|atus(Text|bar)?)|ibling(Below|Above)|ource|uffixes|e(curity(Policy)?|l(ection|f)))|h(istory|ost(name)?|as(h|Focus))|y|X(MLDocument|SLDocument)|n(ext|ame(space(s|URI)|Prop))|M(IN_VALUE|AX_VALUE)|c(haracterSet|o(n(structor|trollers)|okieEnabled|lorDepth|mp(onents|lete))|urrent|puClass|l(i(p(boardData)?|entInformation)|osed|asses)|alle(e|r)|rypto)|t(o(olbar|p)|ext(Transform|Indent|Decoration|Align)|ags)|SQRT(1_2|2)|i(n(ner(Height|Width)|put)|ds|gnoreCase)|zIndex|o(scpu|n(readystatechange|Line)|uter(Height|Width)|p(sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(i(splay|alog(Height|Top|Width|Left|Arguments)|rectories)|e(scription|fault(Status|Ch(ecked|arset)|View)))|u(ser(Profile|Language|Agent)|n(iqueID|defined)|pdateInterval)|_content|p(ixelDepth|ort|ersonalbar|kcs11|l(ugins|atform)|a(thname|dding(Right|Bottom|Top|Left)|rent(Window|Layer)?|ge(X(Offset)?|Y(Offset)?))|r(o(to(col|type)|duct(Sub)?|mpter)|e(vious|fix)))|e(n(coding|abledPlugin)|x(ternal|pando)|mbeds)|v(isibility|endor(Sub)?|Linkcolor)|URLUnencoded|P(I|OSITIVE_INFINITY)|f(ilename|o(nt(Size|Family|Weight)|rmName)|rame(s|Element)|gColor)|E|whiteSpace|l(i(stStyleType|n(eHeight|kColor))|o(ca(tion(bar)?|lName)|wsrc)|e(ngth|ft(Context)?)|a(st(M(odified|atch)|Index|Paren)|yer(s|X)|nguage))|a(pp(MinorVersion|Name|Co(deName|re)|Version)|vail(Height|Top|Width|Left)|ll|r(ity|guments)|Linkcolor|bove)|r(ight(Context)?|e(sponse(XML|Text)|adyState))|global|x|m(imeTypes|ultiline|enubar|argin(Right|Bottom|Top|Left))|L(N(10|2)|OG(10E|2E))|b(o(ttom|rder(RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(Color|Image)))\b - name - support.constant.js - - - match - (?<=\.)(s(hape|ystemId|c(heme|ope|rolling)|ta(ndby|rt)|ize|ummary|pecified|e(ctionRowIndex|lected(Index)?)|rc)|h(space|t(tpEquiv|mlFor)|e(ight|aders)|ref(lang)?)|n(o(Resize|tation(s|Name)|Shade|Href|de(Name|Type|Value)|Wrap)|extSibling|ame)|c(h(ildNodes|Off|ecked|arset)?|ite|o(ntent|o(kie|rds)|de(Base|Type)?|l(s|Span|or)|mpact)|ell(s|Spacing|Padding)|l(ear|assName)|aption)|t(ype|Bodies|itle|Head|ext|a(rget|gName)|Foot)|i(sMap|ndex|d|m(plementation|ages))|o(ptions|wnerDocument|bject)|d(i(sabled|r)|o(c(type|umentElement)|main)|e(clare|f(er|ault(Selected|Checked|Value)))|at(eTime|a))|useMap|p(ublicId|arentNode|r(o(file|mpt)|eviousSibling))|e(n(ctype|tities)|vent|lements)|v(space|ersion|alue(Type)?|Link|Align)|URL|f(irstChild|orm(s)?|ace|rame(Border)?)|width|l(ink(s)?|o(ngDesc|wSrc)|a(stChild|ng|bel))|a(nchors|c(ce(ssKey|pt(Charset)?)|tion)|ttributes|pplets|l(t|ign)|r(chive|eas)|xis|Link|bbr)|r(ow(s|Span|Index)|ules|e(v|ferrer|l|adOnly))|m(ultiple|e(thod|dia)|a(rgin(Height|Width)|xLength))|b(o(dy|rder)|ackground|gColor))\b - name - support.constant.dom.js - - - match - \b(ELEMENT_NODE|ATTRIBUTE_NODE|TEXT_NODE|CDATA_SECTION_NODE|ENTITY_REFERENCE_NODE|ENTITY_NODE|PROCESSING_INSTRUCTION_NODE|COMMENT_NODE|DOCUMENT_NODE|DOCUMENT_TYPE_NODE|DOCUMENT_FRAGMENT_NODE|NOTATION_NODE|INDEX_SIZE_ERR|DOMSTRING_SIZE_ERR|HIERARCHY_REQUEST_ERR|WRONG_DOCUMENT_ERR|INVALID_CHARACTER_ERR|NO_DATA_ALLOWED_ERR|NO_MODIFICATION_ALLOWED_ERR|NOT_FOUND_ERR|NOT_SUPPORTED_ERR|INUSE_ATTRIBUTE_ERR)\b - name - support.constant.dom.js - - - match - \bon(R(ow(s(inserted|delete)|e(nter|xit))|e(s(ize(start|end)?|et)|adystatechange))|Mouse(o(ut|ver)|down|up|move)|B(efore(cut|deactivate|u(nload|pdate)|p(aste|rint)|editfocus|activate)|lur)|S(croll|top|ubmit|elect(start|ionchange)?)|H(over|elp)|C(hange|ont(extmenu|rolselect)|ut|ellchange|l(ick|ose))|D(eactivate|ata(setc(hanged|omplete)|available)|r(op|ag(start|over|drop|en(ter|d)|leave)?)|blclick)|Unload|P(aste|ropertychange)|Error(update)?|Key(down|up|press)|Focus|Load|A(ctivate|fter(update|print)|bort))\b - name - support.function.event-handler.js - - - match - !|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|/=|%=|\+=|\-=|&=|\^=|\b(in|instanceof|new|delete|typeof|void)\b - name - keyword.operator.js - - - match - \b(Infinity|NaN|undefined)\b - name - constant.language.js - - - begin - (?x) - (?<= [\[,=(:] | ^ | && | return ) - \s*((/)) (?! [/*+{}?] | $ ) - beginCaptures - - 1 + match + \b(s(h(ift|ow(Mod(elessDialog|alDialog)|Help))|croll(X|By(Pages|Lines)?|Y|To)?|t(op|rike)|i(n|zeToContent|debar|gnText)|ort|u(p|b(str(ing)?)?)|pli(ce|t)|e(nd|t(Re(sizable|questHeader)|M(i(nutes|lliseconds)|onth)|Seconds|Ho(tKeys|urs)|Year|Cursor|Time(out)?|Interval|ZOptions|Date|UTC(M(i(nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(ome|andleEvent)|navigate|c(har(CodeAt|At)|o(s|n(cat|textual|firm)|mpile)|eil|lear(Timeout|Interval)?|a(ptureEvents|ll)|reate(StyleSheet|Popup|EventObject))|t(o(GMTString|S(tring|ource)|U(TCString|pperCase)|Lo(caleString|werCase))|est|a(n|int(Enabled)?))|i(s(NaN|Finite)|ndexOf|talics)|d(isableExternalCapture|ump|etachEvent)|u(n(shift|taint|escape|watch)|pdateCommands)|j(oin|avaEnabled)|p(o(p|w)|ush|lugins.refresh|a(ddings|rse(Int|Float)?)|r(int|ompt|eference))|e(scape|nableExternalCapture|val|lementFromPoint|x(p|ec(Script|Command)?))|valueOf|UTC|queryCommand(State|Indeterm|Enabled|Value)|f(i(nd|le(ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(nt(size|color)|rward)|loor|romCharCode)|watch|l(ink|o(ad|g)|astIndexOf)|a(sin|nchor|cos|t(tachEvent|ob|an(2)?)|pply|lert|b(s|ort))|r(ou(nd|teEvents)|e(size(By|To)|calc|turnValue|place|verse|l(oad|ease(Capture|Events)))|andom)|g(o|et(ResponseHeader|M(i(nutes|lliseconds)|onth)|Se(conds|lection)|Hours|Year|Time(zoneOffset)?|Da(y|te)|UTC(M(i(nutes|lliseconds)|onth)|Seconds|Hours|Da(y|te)|FullYear)|FullYear|A(ttention|llResponseHeaders)))|m(in|ove(B(y|elow)|To(Absolute)?|Above)|ergeAttributes|a(tch|rgins|x))|b(toa|ig|o(ld|rderWidths)|link|ack))\b(?=\() name - string.regexp.js + support.function.js - 2 + match + \b(s(ub(stringData|mit)|plitText|e(t(NamedItem|Attribute(Node)?)|lect))|has(ChildNodes|Feature)|namedItem|c(l(ick|o(se|neNode))|reate(C(omment|DATASection|aption)|T(Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(ntityReference|lement)|Attribute))|tabIndex|i(nsert(Row|Before|Cell|Data)|tem)|open|delete(Row|C(ell|aption)|T(Head|Foot)|Data)|focus|write(ln)?|a(dd|ppend(Child|Data))|re(set|place(Child|Data)|move(NamedItem|Child|Attribute(Node)?)?)|get(NamedItem|Element(sBy(Name|TagName)|ById)|Attribute(Node)?)|blur)\b(?=\() name - punctuation.definition.string.begin.js + support.function.dom.js - - contentName - string.regexp.js - end - ((/([igm]*)))|$ - endCaptures - - 1 + match + (?<=\.)(s(ystemLanguage|cr(ipts|ollbars|een(X|Y|Top|Left))|t(yle(Sheets)?|atus(Text|bar)?)|ibling(Below|Above)|ource|uffixes|e(curity(Policy)?|l(ection|f)))|h(istory|ost(name)?|as(h|Focus))|y|X(MLDocument|SLDocument)|n(ext|ame(space(s|URI)|Prop))|M(IN_VALUE|AX_VALUE)|c(haracterSet|o(n(structor|trollers)|okieEnabled|lorDepth|mp(onents|lete))|urrent|puClass|l(i(p(boardData)?|entInformation)|osed|asses)|alle(e|r)|rypto)|t(o(olbar|p)|ext(Transform|Indent|Decoration|Align)|ags)|SQRT(1_2|2)|i(n(ner(Height|Width)|put)|ds|gnoreCase)|zIndex|o(scpu|n(readystatechange|Line)|uter(Height|Width)|p(sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(i(splay|alog(Height|Top|Width|Left|Arguments)|rectories)|e(scription|fault(Status|Ch(ecked|arset)|View)))|u(ser(Profile|Language|Agent)|n(iqueID|defined)|pdateInterval)|_content|p(ixelDepth|ort|ersonalbar|kcs11|l(ugins|atform)|a(thname|dding(Right|Bottom|Top|Left)|rent(Window|Layer)?|ge(X(Offset)?|Y(Offset)?))|r(o(to(col|type)|duct(Sub)?|mpter)|e(vious|fix)))|e(n(coding|abledPlugin)|x(ternal|pando)|mbeds)|v(isibility|endor(Sub)?|Linkcolor)|URLUnencoded|P(I|OSITIVE_INFINITY)|f(ilename|o(nt(Size|Family|Weight)|rmName)|rame(s|Element)|gColor)|E|whiteSpace|l(i(stStyleType|n(eHeight|kColor))|o(ca(tion(bar)?|lName)|wsrc)|e(ngth|ft(Context)?)|a(st(M(odified|atch)|Index|Paren)|yer(s|X)|nguage))|a(pp(MinorVersion|Name|Co(deName|re)|Version)|vail(Height|Top|Width|Left)|ll|r(ity|guments)|Linkcolor|bove)|r(ight(Context)?|e(sponse(XML|Text)|adyState))|global|x|m(imeTypes|ultiline|enubar|argin(Right|Bottom|Top|Left))|L(N(10|2)|OG(10E|2E))|b(o(ttom|rder(RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(Color|Image)))\b name - string.regexp.js + support.constant.js - 2 + match + (?<=\.)(s(hape|ystemId|c(heme|ope|rolling)|ta(ndby|rt)|ize|ummary|pecified|e(ctionRowIndex|lected(Index)?)|rc)|h(space|t(tpEquiv|mlFor)|e(ight|aders)|ref(lang)?)|n(o(Resize|tation(s|Name)|Shade|Href|de(Name|Type|Value)|Wrap)|extSibling|ame)|c(h(ildNodes|Off|ecked|arset)?|ite|o(ntent|o(kie|rds)|de(Base|Type)?|l(s|Span|or)|mpact)|ell(s|Spacing|Padding)|l(ear|assName)|aption)|t(ype|Bodies|itle|Head|ext|a(rget|gName)|Foot)|i(sMap|ndex|d|m(plementation|ages))|o(ptions|wnerDocument|bject)|d(i(sabled|r)|o(c(type|umentElement)|main)|e(clare|f(er|ault(Selected|Checked|Value)))|at(eTime|a))|useMap|p(ublicId|arentNode|r(o(file|mpt)|eviousSibling))|e(n(ctype|tities)|vent|lements)|v(space|ersion|alue(Type)?|Link|Align)|URL|f(irstChild|orm(s)?|ace|rame(Border)?)|width|l(ink(s)?|o(ngDesc|wSrc)|a(stChild|ng|bel))|a(nchors|c(ce(ssKey|pt(Charset)?)|tion)|ttributes|pplets|l(t|ign)|r(chive|eas)|xis|Link|bbr)|r(ow(s|Span|Index)|ules|e(v|ferrer|l|adOnly))|m(ultiple|e(thod|dia)|a(rgin(Height|Width)|xLength))|b(o(dy|rder)|ackground|gColor))\b name - punctuation.definition.string.end.js + support.constant.dom.js - 3 + match + \b(ELEMENT_NODE|ATTRIBUTE_NODE|TEXT_NODE|CDATA_SECTION_NODE|ENTITY_REFERENCE_NODE|ENTITY_NODE|PROCESSING_INSTRUCTION_NODE|COMMENT_NODE|DOCUMENT_NODE|DOCUMENT_TYPE_NODE|DOCUMENT_FRAGMENT_NODE|NOTATION_NODE|INDEX_SIZE_ERR|DOMSTRING_SIZE_ERR|HIERARCHY_REQUEST_ERR|WRONG_DOCUMENT_ERR|INVALID_CHARACTER_ERR|NO_DATA_ALLOWED_ERR|NO_MODIFICATION_ALLOWED_ERR|NOT_FOUND_ERR|NOT_SUPPORTED_ERR|INUSE_ATTRIBUTE_ERR)\b name - keyword.other.js + support.constant.dom.js - - patterns - match - \\. + \bon(R(ow(s(inserted|delete)|e(nter|xit))|e(s(ize(start|end)?|et)|adystatechange))|Mouse(o(ut|ver)|down|up|move)|B(efore(cut|deactivate|u(nload|pdate)|p(aste|rint)|editfocus|activate)|lur)|S(croll|top|ubmit|elect(start|ionchange)?)|H(over|elp)|C(hange|ont(extmenu|rolselect)|ut|ellchange|l(ick|ose))|D(eactivate|ata(setc(hanged|omplete)|available)|r(op|ag(start|over|drop|en(ter|d)|leave)?)|blclick)|Unload|P(aste|ropertychange)|Error(update)?|Key(down|up|press)|Focus|Load|A(ctivate|fter(update|print)|bort))\b name - constant.character.escape.js + support.function.event-handler.js - - match - \; - name - punctuation.terminator.statement.js - - - match - , - name - meta.delimiter.object.comma.js - - - match - \. - name - meta.delimiter.method.period.js - - - match - \{|\} - name - meta.brace.curly.js - - - match - \(|\) - name - meta.brace.round.js - - - match - \[|\] - name - meta.brace.square.js - - - match - (?<=\.)\s - name - meta.complete.method - - - repository - - string-double - scopeName source.js diff --git a/Tests/Javascript Syntax Test.js b/Tests/Javascript Syntax Test.js index e170168..d82e8c8 100644 --- a/Tests/Javascript Syntax Test.js +++ b/Tests/Javascript Syntax Test.js @@ -1,3 +1,18 @@ +// Root +// + + + + + + + + + + + + + // ============= // = FUNCTIONS = // ============= @@ -31,6 +46,17 @@ var funkName=new Function("argument1", "argument2", "return argument1 + argument var funkName1 = function funkName (argument1, argument2) {return argument1 + argument1;}; var funkName1=function funkName(argument1,argument2){return argument1 + argument1;}; +function myFunc(argument1, argument2){} + +Sound.prototype = {} +Sound.prototype.play = function(){} +Sound.prototype.play = myfunc +Sound.play = function(){} +var objectName = { + foobar: function(){}, + 'foo': function(){}, + "foo": function(){} +} // =================== // = OBJECT LITERALS = From d99f721b825bea4506cf45106cbf3488cbeb3707 Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Mon, 7 Jul 2008 17:17:32 +0000 Subject: [PATCH 126/243] .999 numbers.invalid scopes for octal and hex. -999 and +999 numbers git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@10184 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript Basic.tmLanguage | 27 ++++++++++++-- Tests/Javascript Syntax Test.js | 53 +++++++++++++++++++++++++++- 2 files changed, 77 insertions(+), 3 deletions(-) diff --git a/Syntaxes/JavaScript Basic.tmLanguage b/Syntaxes/JavaScript Basic.tmLanguage index 7abbb41..7599d4b 100644 --- a/Syntaxes/JavaScript Basic.tmLanguage +++ b/Syntaxes/JavaScript Basic.tmLanguage @@ -512,7 +512,7 @@ match - \b(Infinity|NaN|undefined)\b + \b(NaN|undefined)\b name constant.language.js @@ -524,10 +524,33 @@ match - \b((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?([eE][-+]?[0-9]+)?))\b + (?i)\B[-+]?0x[0-9a-f]*\.(\B|\b[0-9]+) + name + invalid.illegal.numeric.hex.js + + + match + \B[-+]?0[0-9]+\.(\B|\b[0-9]+) + name + invalid.illegal.numeric.octal.js + + + match + (?xi)(?:\B[-+])?(?: + 0x[0-9a-f]* # HEX + |( \B\.[0-9]+ # EG: .999 + | \b[0-9]+ (\.[0-9]*)? # EG: 999.999 or 999. or 999 + )(e[-+]?[0-9]+)? # EG: e+123 or E-123 + ) name constant.numeric.js + + match + (?:\B[-+]|\b)(Infinity)\b + name + constant.language.js + core-punctuation diff --git a/Tests/Javascript Syntax Test.js b/Tests/Javascript Syntax Test.js index d82e8c8..8187eb1 100644 --- a/Tests/Javascript Syntax Test.js +++ b/Tests/Javascript Syntax Test.js @@ -151,6 +151,8 @@ function(){ return /regex/ } 999 .999 +(.999) +999. == 999; 999.999 4 16 @@ -161,10 +163,27 @@ function(){ return /regex/ } 3.402823669209385e+38 1.157920892373162e+77 1.3407807929942597e+154 +.3407807929942597e+154 +.3407807929942597E-154 +3407807929942597.E-154.5 // SYNTAX ERROR: missing ; before statement +//....................^ Infinity +Infinity.propertyName +Infinity.methodName() + 0377 // octal +0377. // SYNTAX ERROR +0377.5 // SYNTAX ERROR +0377.propertyName // number property +0377.methodName() // number method + +0x // HEX +0XFF // HEX 0xFF // hex -0xff // hex +0xff. // SYNTAX ERROR +0xff.5 // SYNTAX ERROR +0xff.propertyName // number property +0xff.methodName() // number method -999 -.999 @@ -180,15 +199,47 @@ Infinity -1.3407807929942597e+154 -Infinity -0377 // octal +-0x // hex +-0xFF // hex +-0377 // octal -0xFF // hex -0xff // hex ++999 ++.999 ++999.999 ++4 ++16 ++256 ++65536 ++4294967296 ++18446744073709552000 ++3.402823669209385e+38 ++1.157920892373162e+77 ++1.3407807929942597e+154 ++Infinity ++0377 // octal ++0x // hex ++0xFF // hex ++0377 // octal ++0xFF // hex ++0xff // hex + 1e5 2.5E5 5e-324 1.7976931348623157e+308 +x == 5; +x > 5; +x >= 5; +x < 5; +x <= 5; +x <=> 5; // Syntax Error + +x = x +5; // is the same as x += 5; +x = x -5; // is the same as x -= 5; x = x+5; // is the same as x += 5; x = x-5; // is the same as x -= 5; x = x*5; // is the same as x *= 5; From 8b7b886f82e7752279bb08b926c211b9a1a6801b Mon Sep 17 00:00:00 2001 From: subtlegradient Date: Mon, 7 Jul 2008 17:17:39 +0000 Subject: [PATCH 127/243] Fixed the illegal number scopes git-svn-id: http://macromates.com/svn/Bundles/trunk/Review/Bundles/JavaScript.tmbundle@10185 dfb7d73b-c2ec-0310-8fea-fb051d288c6d --- Syntaxes/JavaScript Basic.tmLanguage | 6 ++-- Tests/Javascript Syntax Test.js | 48 +++++++++++++++++++++++----- 2 files changed, 43 insertions(+), 11 deletions(-) diff --git a/Syntaxes/JavaScript Basic.tmLanguage b/Syntaxes/JavaScript Basic.tmLanguage index 7599d4b..06a547b 100644 --- a/Syntaxes/JavaScript Basic.tmLanguage +++ b/Syntaxes/JavaScript Basic.tmLanguage @@ -524,20 +524,20 @@ match - (?i)\B[-+]?0x[0-9a-f]*\.(\B|\b[0-9]+) + (?i)(?:\B[-+]|\b)0x[0-9a-f]*\.(\B|\b[0-9]+) name invalid.illegal.numeric.hex.js match - \B[-+]?0[0-9]+\.(\B|\b[0-9]+) + (?:\B[-+]|\b)0[0-9]+\.(\B|\b[0-9]+) name invalid.illegal.numeric.octal.js match (?xi)(?:\B[-+])?(?: - 0x[0-9a-f]* # HEX + \b0x[0-9a-f]* # HEX |( \B\.[0-9]+ # EG: .999 | \b[0-9]+ (\.[0-9]*)? # EG: 999.999 or 999. or 999 )(e[-+]?[0-9]+)? # EG: e+123 or E-123 diff --git a/Tests/Javascript Syntax Test.js b/Tests/Javascript Syntax Test.js index 8187eb1..61417dd 100644 --- a/Tests/Javascript Syntax Test.js +++ b/Tests/Javascript Syntax Test.js @@ -187,6 +187,8 @@ Infinity.methodName() -999 -.999 +(-.999) +-999. == -999; -999.999 -4 -16 @@ -197,16 +199,32 @@ Infinity.methodName() -3.402823669209385e+38 -1.157920892373162e+77 -1.3407807929942597e+154 +-.3407807929942597e+154 +-.3407807929942597E-154 +-3407807929942597.E-154.5 // SYNTAX ERROR: missing ; before statement +//.....................^ -Infinity +-Infinity.propertyName +-Infinity.methodName() + -0377 // octal --0x // hex --0xFF // hex --0377 // octal +-0377. // SYNTAX ERROR +-0377.5 // SYNTAX ERROR +-0377.propertyName // number property +-0377.methodName() // number method + +-0x // HEX +-0XFF // HEX -0xFF // hex --0xff // hex +-0xff. // SYNTAX ERROR +-0xff.5 // SYNTAX ERROR +-0xff.propertyName // number property +-0xff.methodName() // number method +999 +.999 +(+.999) ++999. == +999; +999.999 +4 +16 @@ -217,13 +235,27 @@ Infinity.methodName() +3.402823669209385e+38 +1.157920892373162e+77 +1.3407807929942597e+154 ++.3407807929942597e+154 ++.3407807929942597E+154 ++3407807929942597.E+154.5 // SYNTAX ERROR: missing ; before statement +//.....................^ +Infinity ++Infinity.propertyName ++Infinity.methodName() + +0377 // octal -+0x // hex -+0xFF // hex -+0377 // octal ++0377. // SYNTAX ERROR ++0377.5 // SYNTAX ERROR ++0377.propertyName // number property ++0377.methodName() // number method + ++0x // HEX ++0XFF // HEX +0xFF // hex -+0xff // hex ++0xff. // SYNTAX ERROR ++0xff.5 // SYNTAX ERROR ++0xff.propertyName // number property ++0xff.methodName() // number method 1e5 2.5E5 From 8f08e77bdd63e8e603a98e4a9ee40bfb51d77b80 Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Tue, 8 Jul 2008 16:54:39 -0400 Subject: [PATCH 128/243] =?UTF-8?q?Snippet:=20try=20=E2=80=A6=20catch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "Snippets/try \342\200\246 catch.tmSnippet" | 16 ++++++++++++++++ info.plist | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 "Snippets/try \342\200\246 catch.tmSnippet" diff --git "a/Snippets/try \342\200\246 catch.tmSnippet" "b/Snippets/try \342\200\246 catch.tmSnippet" new file mode 100644 index 0000000..511f7d0 --- /dev/null +++ "b/Snippets/try \342\200\246 catch.tmSnippet" @@ -0,0 +1,16 @@ + + + + + content + try{${1:$TM_SELECTED_TEXT}}catch(e){$0}; + name + try … catch + scope + source.js + tabTrigger + try + uuid + 12767C79-C781-4BFC-8BA3-D108DB14292D + + diff --git a/info.plist b/info.plist index 9f27e42..d404937 100644 --- a/info.plist +++ b/info.plist @@ -139,6 +139,7 @@ 011C4681-FBEC-4891-9326-3DECFCDED6D6 C207B7C3-5597-4873-8AAD-C46FB8842AF2 9BF3315C-88FF-46A1-89E1-9A5E9EAC78D0 + 3F4AB53B-210C-4E0C-8D04-12192DECC3D1 AD506BEC-B33C-4168-A900-0A4D386A4B05 DC8B46FB-8ADA-45EA-8F36-94C807A0D302 009A3E6C-FE3F-4A18-8759-2DC31F17BBE2 @@ -146,9 +147,9 @@ 9E0E3BCC-7F20-4D6B-891D-A44D6EC56E31 20E61C43-B81F-4FB9-9362-BFFE668EB9C9 36EC03E9-EFF4-479A-AB90-8DFA16800642 - 3F4AB53B-210C-4E0C-8D04-12192DECC3D1 E1B2FC98-AF98-4392-8069-C82C2C192617 603A6D98-A136-4766-828B-C39178AB8003 + 12767C79-C781-4BFC-8BA3-D108DB14292D uuid AAB4FD74-73F9-11D9-B89A-000D93589AF6 From 60bf481bf50285ebd7e9391ada3985b2aba0dac5 Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Tue, 8 Jul 2008 16:55:46 -0400 Subject: [PATCH 129/243] Added special-comments-conditional-compilation for IE; Added leading-space scopes --- Syntaxes/JavaScript Basic.tmLanguage | 233 +++++++++++++++++++++++++++ Tests/Javascript Syntax Test.js | 15 -- 2 files changed, 233 insertions(+), 15 deletions(-) diff --git a/Syntaxes/JavaScript Basic.tmLanguage b/Syntaxes/JavaScript Basic.tmLanguage index 06a547b..541c71f 100644 --- a/Syntaxes/JavaScript Basic.tmLanguage +++ b/Syntaxes/JavaScript Basic.tmLanguage @@ -32,6 +32,10 @@ include #support + + include + #sugar + repository @@ -73,6 +77,10 @@ patterns + + include + #special-comments-conditional-compilation + begin /\*\* @@ -749,6 +757,90 @@ + special-comments-conditional-compilation + + patterns + + + begin + /\*(?=@) + captures + + 0 + + name + punctuation.definition.comment.js + + + end + /\*((@)end)\s*@\*/|(?<=@)\*/ + endCaptures + + 1 + + name + keyword.control.conditional.js + + 2 + + name + punctuation.definition.keyword.js + + + name + comment.block.conditional.js + patterns + + + include + $base + + + + + captures + + 1 + + name + punctuation.definition.keyword.js + + + match + (@)(if|elif|else|end) + name + keyword.control.conditional.js + + + captures + + 1 + + name + punctuation.definition.keyword.js + + + match + (@)(cc_on|set) + name + keyword.operator.conditional.js + + + captures + + 1 + + name + punctuation.definition.variable.js + + + match + (@)(_win32|_win16|_mac|_alpha|_x86|_mc680x0|_PowerPC|_jscript_build|_jscript_version|_jscript|_debug|_fast|[a-zA-Z]\w+) + name + variable.other.conditional.js + + + string-double-innards patterns @@ -809,6 +901,147 @@ + sugar + + patterns + + + begin + ^(?=(\t| )) + end + (?=[^\t\s]) + name + meta.leading-tabs + patterns + + + captures + + 1 + + name + meta.odd-tab.group1.spaces + + 10 + + name + meta.even-tab.group10.spaces + + 11 + + name + meta.odd-tab.group11.spaces + + 2 + + name + meta.even-tab.group2.spaces + + 3 + + name + meta.odd-tab.group3.spaces + + 4 + + name + meta.even-tab.group4.spaces + + 5 + + name + meta.odd-tab.group5.spaces + + 6 + + name + meta.even-tab.group6.spaces + + 7 + + name + meta.odd-tab.group7.spaces + + 8 + + name + meta.even-tab.group8.spaces + + 9 + + name + meta.odd-tab.group9.spaces + + + match + ( )( )?( )?( )?( )?( )?( )?( )?( )?( )?( )? + + + captures + + 1 + + name + meta.odd-tab.group1.tab + + 10 + + name + meta.even-tab.group10.tab + + 11 + + name + meta.odd-tab.group11.tab + + 2 + + name + meta.even-tab.group2.tab + + 3 + + name + meta.odd-tab.group3.tab + + 4 + + name + meta.even-tab.group4.tab + + 5 + + name + meta.odd-tab.group5.tab + + 6 + + name + meta.even-tab.group6.tab + + 7 + + name + meta.odd-tab.group7.tab + + 8 + + name + meta.even-tab.group8.tab + + 9 + + name + meta.odd-tab.group9.tab + + + match + (\t)(\t)?(\t)?(\t)?(\t)?(\t)?(\t)?(\t)?(\t)?(\t)?(\t)? + + + + + support patterns diff --git a/Tests/Javascript Syntax Test.js b/Tests/Javascript Syntax Test.js index 61417dd..2686d30 100644 --- a/Tests/Javascript Syntax Test.js +++ b/Tests/Javascript Syntax Test.js @@ -1,18 +1,3 @@ -// Root -// - - - - - - - - - - - - - // ============= // = FUNCTIONS = // ============= From 879f4c5c9dba137fcdaa3448a80c18407eacdf12 Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Tue, 8 Jul 2008 16:57:47 -0400 Subject: [PATCH 130/243] Changed the forin snippet to match what it actually does --- "Snippets/for (in) {\342\200\246}.tmSnippet" | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git "a/Snippets/for (in) {\342\200\246}.tmSnippet" "b/Snippets/for (in) {\342\200\246}.tmSnippet" index b64dede..e54db34 100644 --- "a/Snippets/for (in) {\342\200\246}.tmSnippet" +++ "b/Snippets/for (in) {\342\200\246}.tmSnippet" @@ -3,8 +3,8 @@ content - for (var ${1:thing} in ${2:Things}) { - $0${1:thing} + for (var ${1:key} in ${2:object}) { + ${0:key} }; name for (in) {…} From 4edcfcb0c779570efd2baafac471c38824aaf449 Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Tue, 8 Jul 2008 16:59:55 -0400 Subject: [PATCH 131/243] Removed the conditional-compilation since I moved it into the other syntax --- Syntaxes/JavaScript.plist | 75 --------------------------------------- 1 file changed, 75 deletions(-) diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist index 4509038..b4a0ea9 100644 --- a/Syntaxes/JavaScript.plist +++ b/Syntaxes/JavaScript.plist @@ -12,10 +12,6 @@ JavaScript patterns - - include - #conditional-compilation - include #brackets @@ -249,77 +245,6 @@ - conditional-compilation - - patterns - - - begin - /\*(?=@) - captures - - 0 - - name - punctuation.definition.comment.js - - - end - (?<=@)\*/ - name - comment.block.conditional.js - patterns - - - include - $base - - - - - captures - - 1 - - name - punctuation.definition.keyword.js - - - match - (@)(if|elif|else|end) - name - keyword.control.conditional.js - - - captures - - 1 - - name - punctuation.definition.keyword.js - - - match - (@)(cc_on|set) - name - keyword.operator.conditional.js - - - captures - - 1 - - name - punctuation.definition.variable.js - - - match - (@)(_win32|_win16|_mac|_alpha|_x86|_mc680x0|_PowerPC|_jscript_build|_jscript_version|_jscript|_debug|_fast|[a-zA-Z]\w+) - name - variable.other.conditional.js - - - function-block begin From cf8398b67d6acf125c2ced841ba2bac746c2e079 Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Tue, 8 Jul 2008 17:11:56 -0400 Subject: [PATCH 132/243] Syntax Tests for Function Calls and Variables / Properties --- Tests/Javascript Syntax Test.js | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/Tests/Javascript Syntax Test.js b/Tests/Javascript Syntax Test.js index 2686d30..0f749e7 100644 --- a/Tests/Javascript Syntax Test.js +++ b/Tests/Javascript Syntax Test.js @@ -43,6 +43,40 @@ var objectName = { "foo": function(){} } +// ================== +// = Function Calls = +// ================== +funkName(parameter1, parameter2) +objectName.methodName(parameter1, parameter2) +objectName.objectName.methodName(parameter1, parameter2) + +funkName(funkName(parameter1, parameter2), parameter2) +funkName(parameter1, funkName(parameter1, parameter2)) + +objectName.methodName(objectName.methodName(parameter1, parameter2), parameter2) +objectName.methodName(parameter1,objectName.methodName(parameter1, parameter2)) + +objectName.objectName.methodName(objectName.objectName.methodName(parameter1, parameter2), parameter2) +objectName.objectName.methodName(parameter1,objectName.objectName.methodName(parameter1, parameter2)) + + +// ========================== +// = Variables / Properties = +// ========================== +variableName +variableName == "stringName" +variableName = "stringName" + +objectName.propertyName +objectName.propertyName.propertyName + +objectName.propertyName == "stringName" +objectName.propertyName.propertyName == "stringName" + +objectName.propertyName = "stringName" +objectName.propertyName.propertyName = "stringName" + + // =================== // = OBJECT LITERALS = // =================== From a6b41e8392ef4055b0819d2ba5fabd47684c144c Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Tue, 8 Jul 2008 18:41:48 -0400 Subject: [PATCH 133/243] Trying to come up with an exhaustive list of all literal syntax --- Tests/Javascript Syntax Test.js | 149 ++++++++++++++++++++++++++++++-- 1 file changed, 141 insertions(+), 8 deletions(-) diff --git a/Tests/Javascript Syntax Test.js b/Tests/Javascript Syntax Test.js index 0f749e7..8f32d81 100644 --- a/Tests/Javascript Syntax Test.js +++ b/Tests/Javascript Syntax Test.js @@ -37,11 +37,11 @@ Sound.prototype = {} Sound.prototype.play = function(){} Sound.prototype.play = myfunc Sound.play = function(){} -var objectName = { +({ foobar: function(){}, 'foo': function(){}, "foo": function(){} -} +}) // ================== // = Function Calls = @@ -67,6 +67,140 @@ variableName variableName == "stringName" variableName = "stringName" +objectName.5 // SYNTAX ERROR +objectName().5 // SYNTAX ERROR +objectName .5 // SYNTAX ERROR +objectName() .5 // SYNTAX ERROR + + + +/** +#!/usr/bin/env ruby +code = <<-JS +*/ + a ==variableName ; // Comparison + a > variableName ; // Comparison + a >=variableName ; // Comparison + a < variableName ; // Comparison + a <=variableName ; // Comparison + a +variableName ; // Arithmetic + a -variableName ; // Arithmetic + a + +variableName ; // Arithmetic + a + -variableName ; // Arithmetic + a + ~variableName ; // Arithmetic + a *variableName ; // Arithmetic + a /variableName ; // Arithmetic + a %variableName ; // Arithmetic + a &variableName ; // Arithmetic + a |variableName ; // Arithmetic + a ^variableName ; // Arithmetic + a <>variableName ; // Arithmetic + a >>>variableName ; // Arithmetic + a +=variableName ; // Assignment + a -=variableName ; // Assignment + a *=variableName ; // Assignment + a /=variableName ; // Assignment + a %=variableName ; // Assignment + a &=variableName ; // Assignment + a |=variableName ; // Assignment + a ^=variableName ; // Assignment + a <<=variableName ; // Assignment + a >>=variableName ; // Assignment + a >>>=variableName ; // Assignment + variableName== a ; // Comparison + variableName> a ; // Comparison + variableName>= a ; // Comparison + variableName< a ; // Comparison + variableName<= a ; // Comparison + variableName+ a ; // Arithmetic + variableName- a ; // Arithmetic + variableName+ +a ; // Arithmetic + variableName+ -a ; // Arithmetic + variableName+ ~a ; // Arithmetic + variableName* a ; // Arithmetic + variableName/ a ; // Arithmetic + variableName% a ; // Arithmetic + variableName& a ; // Arithmetic + variableName| a ; // Arithmetic + variableName^ a ; // Arithmetic + variableName<< a ; // Arithmetic + variableName>> a ; // Arithmetic + variableName>>> a ; // Arithmetic + variableName+= a ; // Assignment + variableName-= a ; // Assignment + variableName*= a ; // Assignment + variableName/= a ; // Assignment + variableName%= a ; // Assignment + variableName&= a ; // Assignment + variableName|= a ; // Assignment + variableName^= a ; // Assignment + variableName<<= a ; // Assignment + variableName>>= a ; // Assignment + variableName>>>= a ; // Assignment + variableName++ ; // Assignment + variableName-- ; // Assignment + var variableName ; // Assignment + var variableName,a ; // Assignment + var variableName,a= a ; // Assignment + var variableName= a ; // Assignment + var a,variableName ; // Assignment + var a= a,variableName ; // Assignment + variableName() ; // function call + funkName(variableName) ; // function call + funkName(variableName,a) ; // function call + funkName(a,variableName) ; // function call + a.variableName() ; // function call method + variableName.a() ; // objectName + a.funkName(variableName) ; // function call + a.funkName(variableName,a) ; // function call + a.funkName(a,variableName) ; // function call + new Class(variableName) ; // class instantiation + new Class(variableName,a) ; // class instantiation + new Class(a,variableName) ; // class instantiation + (variableName) ; // logical grouping + [variableName] ; // arrayLiteral + [a,variableName] ; // arrayLiteral + [variableName,a] ; // arrayLiteral + ({variableName:a}) ; // objectLiteral + ({a:variableName}) ; // objectLiteral + ({'a':variableName}) ; // objectLiteral + ({"a":variableName}) ; // objectLiteral + a = {variableName:a} ; // objectLiteral + a = {a:variableName} ; // objectLiteral + a = {'a':variableName} ; // objectLiteral + a = {"a":variableName} ; // objectLiteral + function(){variableName;} ; // function definition + function(){variableName} ; // function definition + a.prototype =variableName ; // class definition + a.prototype.a =variableName ; // method definition + ({'variableName':a}) ; // objectLiteral + ({"variableName":a}) ; // objectLiteral + a = {'variableName':a} ; // objectLiteral + a = {"variableName":a} ; // objectLiteral + ({"variableName":function(){},a:a}) ; // objectLiteral method + ({'variableName':function(){},a:a}) ; // objectLiteral method + function(variableName){} ; // function definition + function(variableName,a){} ; // function definition + function(a,variableName){} ; // function definition + function variableName(){} ; // function definition + function variableName(a){} ; // function definition + ({variableName: function(){},a:a}) ; // method definition + a.prototype.variableName= a ; // class definition + a.prototype.variableName= function(){} ; // method definition + a.variableName= function(){} ; // method definition + variableName.a = function(){} ; // method definition + variableName.prototype = a ; // class definition + variableName.prototype.a = a ; // method definition + variableName.prototype.a = function(){} ; // method definition + new variableName ; // class instantiation + new variableName() ; // class instantiation +/* +JS +%w`$$$$ 999 999. 999.999 .999 [arrayLiteral]`.each{|key| puts code.gsub('variableName',key); puts code.gsub('variableName',' '+key+' ') } +**/ + + objectName.propertyName objectName.propertyName.propertyName @@ -287,15 +421,14 @@ x > 5; x >= 5; x < 5; x <= 5; -x <=> 5; // Syntax Error x = x +5; // is the same as x += 5; x = x -5; // is the same as x -= 5; -x = x+5; // is the same as x += 5; -x = x-5; // is the same as x -= 5; -x = x*5; // is the same as x *= 5; -x = x/5; // is the same as x /= 5; -x = x%5; // is the same as x %= 5; +x = x+5; // is the same as x += 5; +x = x-5; // is the same as x -= 5; +x = x*5; // is the same as x *= 5; +x = x/5; // is the same as x /= 5; +x = x%5; // is the same as x %= 5; x += 5 x -= 5 From f62ab505b7003aec166dc5ea7311b75bc87777db Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Sat, 19 Jul 2008 18:11:57 -0400 Subject: [PATCH 134/243] Unifying snippet formats --- Snippets/Object Method.tmSnippet | 4 +--- "Snippets/for (in) {\342\200\246}.tmSnippet" | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Snippets/Object Method.tmSnippet b/Snippets/Object Method.tmSnippet index 62b3489..9ec093d 100644 --- a/Snippets/Object Method.tmSnippet +++ b/Snippets/Object Method.tmSnippet @@ -3,9 +3,7 @@ content - ${1:}: function(${3:argument}){ - $0 -}, + ${1:}: function(${3:}){$0}, name Object Method scope diff --git "a/Snippets/for (in) {\342\200\246}.tmSnippet" "b/Snippets/for (in) {\342\200\246}.tmSnippet" index e54db34..80c7499 100644 --- "a/Snippets/for (in) {\342\200\246}.tmSnippet" +++ "b/Snippets/for (in) {\342\200\246}.tmSnippet" @@ -3,8 +3,8 @@ content - for (var ${1:key} in ${2:object}) { - ${0:key} + for (var ${1:property} in ${2:object}) { + ${0:$1} }; name for (in) {…} From 1fcef564b00cab96eb9c886c9a8a5aed01f1f54b Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Sat, 19 Jul 2008 18:13:17 -0400 Subject: [PATCH 135/243] Added operators to the syntax tests and more examples --- Tests/Javascript Syntax Test.js | 478 +++++++++++++++++++++++++++----- 1 file changed, 414 insertions(+), 64 deletions(-) diff --git a/Tests/Javascript Syntax Test.js b/Tests/Javascript Syntax Test.js index 8f32d81..73226cd 100644 --- a/Tests/Javascript Syntax Test.js +++ b/Tests/Javascript Syntax Test.js @@ -78,66 +78,83 @@ objectName() .5 // SYNTAX ERROR #!/usr/bin/env ruby code = <<-JS */ - a ==variableName ; // Comparison - a > variableName ; // Comparison - a >=variableName ; // Comparison - a < variableName ; // Comparison - a <=variableName ; // Comparison - a +variableName ; // Arithmetic - a -variableName ; // Arithmetic - a + +variableName ; // Arithmetic - a + -variableName ; // Arithmetic - a + ~variableName ; // Arithmetic - a *variableName ; // Arithmetic - a /variableName ; // Arithmetic - a %variableName ; // Arithmetic - a &variableName ; // Arithmetic - a |variableName ; // Arithmetic - a ^variableName ; // Arithmetic - a <>variableName ; // Arithmetic - a >>>variableName ; // Arithmetic - a +=variableName ; // Assignment - a -=variableName ; // Assignment - a *=variableName ; // Assignment - a /=variableName ; // Assignment - a %=variableName ; // Assignment - a &=variableName ; // Assignment - a |=variableName ; // Assignment - a ^=variableName ; // Assignment - a <<=variableName ; // Assignment - a >>=variableName ; // Assignment - a >>>=variableName ; // Assignment - variableName== a ; // Comparison - variableName> a ; // Comparison - variableName>= a ; // Comparison - variableName< a ; // Comparison - variableName<= a ; // Comparison - variableName+ a ; // Arithmetic - variableName- a ; // Arithmetic - variableName+ +a ; // Arithmetic - variableName+ -a ; // Arithmetic - variableName+ ~a ; // Arithmetic - variableName* a ; // Arithmetic - variableName/ a ; // Arithmetic - variableName% a ; // Arithmetic - variableName& a ; // Arithmetic - variableName| a ; // Arithmetic - variableName^ a ; // Arithmetic - variableName<< a ; // Arithmetic - variableName>> a ; // Arithmetic - variableName>>> a ; // Arithmetic - variableName+= a ; // Assignment - variableName-= a ; // Assignment - variableName*= a ; // Assignment - variableName/= a ; // Assignment - variableName%= a ; // Assignment - variableName&= a ; // Assignment - variableName|= a ; // Assignment - variableName^= a ; // Assignment - variableName<<= a ; // Assignment - variableName>>= a ; // Assignment - variableName>>>= a ; // Assignment + a +variableName ; // Arithmetic Operator + a -variableName ; // Arithmetic Operator + a *variableName ; // Arithmetic Operator + a /variableName ; // Arithmetic Operator + a %variableName ; // Arithmetic Operator + a ++variableName ; // Arithmetic Operator + a --variableName ; // Arithmetic Operator + a -variableName ; // Arithmetic Operator Unary + a =variableName ; // Assignment Operator + a +=variableName ; // Assignment Operator + a -=variableName ; // Assignment Operator + a *=variableName ; // Assignment Operator + a /=variableName ; // Assignment Operator + a >>=variableName ; // Assignment Operator + a <<=variableName ; // Assignment Operator + a >>>=variableName ; // Assignment Operator + a &=variableName ; // Assignment Operator + a |=variableName ; // Assignment Operator + a ^=variableName ; // Assignment Operator + variableName+a ; // Arithmetic Operator + variableName-a ; // Arithmetic Operator + variableName*a ; // Arithmetic Operator + variableName/a ; // Arithmetic Operator + variableName%a ; // Arithmetic Operator + variableName++ ; // Arithmetic Operator + variableName-- ; // Arithmetic Operator + variableName-a ; // Arithmetic Operator Unary + variableName=a ; // Assignment Operator + variableName+=a ; // Assignment Operator + variableName-=a ; // Assignment Operator + variableName*=a ; // Assignment Operator + variableName/=a ; // Assignment Operator + variableName>>=a ; // Assignment Operator + variableName<<=a ; // Assignment Operator + variableName>>>=a ; // Assignment Operator + variableName&=a ; // Assignment Operator + variableName|=a ; // Assignment Operator + variableName^=a ; // Assignment Operator + a &variableName ; // Bitwise Operator + a |variableName ; // Bitwise Operator + a ^variableName ; // Bitwise Operator + ~variableName ; // Bitwise Operator + a <>variableName ; // Bitwise Operator + a >>>variableName ; // Bitwise Operator + variableName&a ; // Bitwise Operator + variableName|a ; // Bitwise Operator + variableName^a ; // Bitwise Operator + variableName<>a ; // Bitwise Operator + variableName>>>a ; // Bitwise Operator + a ==variableName ; // Comparison Operator + a !=variableName ; // Comparison Operator + a ===variableName ; // Comparison Operator + a !==variableName ; // Comparison Operator + a >variableName ; // Comparison Operator + a >=variableName ; // Comparison Operator + a a ; // Comparison Operator + variableName>=a ; // Comparison Operator + variableName 5; x >= 5; @@ -513,3 +540,326 @@ switch (something){ default : // do something } +switch(expression){case expression:statements;break;default:statements;} + +while(condition){statements;} +do{statements;}while(condition); + +for(initialization;condition;update){statements;} + +for(variable in object){statements;} +for(variable in object)if(filter){statements;} + +try{statements;}catch(variable){statements;}finally{statements;} + +eval("expressions") +Function("expressions") +setTimeout("expressions",999) +setInterval("expressions",999) + +for (var i=0, j=9; i <= 9; i++, j--) + document.writeln("a["+i+"]["+j+"]= " + a[i][j]); + +// ======================= +// = Getters and Setters = +// ======================= + +// {get prop [ funname ]() { . . . } } +var o = { + get latest () { + if (this.log.length > 0) { + return this.log[this.log.length - 1]; + } + else { + return null; + } + }, + log: [] +} +delete o.latest; + +// {set prop [ funname ](val) { . . . } +var o = { + set current (str) { + return this.log[this.log.length] = str; + }, + log: [] +} +delete o.current; + +// =============== +// = in Operator = +// =============== + +// Arrays +var trees = new Array("redwood", "bay", "cedar", "oak", "maple"); +0 in trees // returns true +3 in trees // returns true +6 in trees // returns false +"bay" in trees // returns false (you must specify the index number, + // not the value at that index) +"length" in trees // returns true (length is an Array property) + +// Predefined objects +"PI" in Math // returns true + +// Custom objects +var mycar = {make: "Honda", model: "Accord", year: 1998}; +"make" in mycar // returns true +"model" in mycar // returns true + +var color1 = new String("green"); +"length" in color1 // returns true +var color2 = "coral"; +"length" in color2 // generates an error (color is not a String object) + +var mycar = {make: "Honda", model: "Accord", year: 1998}; +delete mycar.make; +"make" in mycar; // returns false + +var trees = new Array("redwood", "bay", "cedar", "oak", "maple"); +delete trees[3]; +3 in trees; // returns false + +var mycar = {make: "Honda", model: "Accord", year: 1998}; +mycar.make = undefined; +"make" in mycar; // returns true + +var trees = new Array("redwood", "bay", "cedar", "oak", "maple"); +trees[3] = undefined; +3 in trees; // returns true + + +// ============== +// = instanceof = +// ============== + +var isInstance = objectName instanceof objectType; + +var color1 = new String("green"); +color1 instanceof String; // returns true +var color2 = "coral"; +color2 instanceof String; // returns false (color2 is not a String object) + +var theDay = new Date(1995, 11, 17); // Dec. 17, 1995 +if (theDay instanceof Date) +{ + print("theDay is a Date object"); + // whatever else... +} + +var myString = new String(); +var myDate = new Date(); + +myString instanceof String; // returns true +myString instanceof Object; // returns true +myString instanceof Date; // returns false + +myDate instanceof Date; // returns true +myDate instanceof Object; // returns true +myDate instanceof String; // returns false + +function Car(make, model, year) +{ + this.make = make; + this.model = model; + this.year = year; +} +var mycar = new Car("Honda", "Accord", 1998); +var a = mycar instanceof Car; // returns true +var b = mycar instanceof Object; // returns true + + +// ======= +// = new = +// ======= +// objectName = new objectType(param1 [,param2] ...[,paramN]) + + function Car() {} + car1 = new Car() + + alert(car1.color) // undefined + + Car.prototype.color = null + alert(car1.color) // null + + car1.color = "black" + alert(car1.color) // black + +function car(make, model, year) { + this.make = make; + this.model = model; + this.year = year; +} +mycar = new car("Eagle", "Talon TSi", 1993); +kenscar = new car("Nissan", "300ZX", 1992); + + +function person(name, age, sex) { + this.name = name; + this.age = age; + this.sex = sex; +} +rand = new person("Rand McNally", 33, "M"); +ken = new person("Ken Jones", 39, "M"); + +function car(make, model, year, owner) { + this.make = make; + this.model = model; + this.year = year; + this.owner = owner; +} + +car1 = new car("Eagle", "Talon TSi", 1993, rand); +car2 = new car("Nissan", "300ZX", 1992, ken); + +car2.owner.name + + + +// ============= +// = Operators = +// ============= + +//Individual operators ;// Precedence Operator type Associativity Proximity +a = b ;// 16 assignment right-to-left both +a %= b ;// 16 assignment right-to-left both +a &= b ;// 16 assignment right-to-left both +a *= b ;// 16 assignment right-to-left both +a += b ;// 16 assignment right-to-left both +a -= b ;// 16 assignment right-to-left both +a /= b ;// 16 assignment right-to-left both +a ^= b ;// 16 assignment right-to-left both +a |= b ;// 16 assignment right-to-left both +a <<= b ;// 16 assignment right-to-left both +a >>= b ;// 16 assignment right-to-left both +a >>>= b ;// 16 assignment right-to-left both +a ? b : c ;// 15 conditional right-to-left both +a in b ;// 8 in left-to-right both +a in( b ) ;// 8 in left-to-right both +a , b ;// 17 comma left-to-right both +a . b ;// 1 member left-to-right both +a % b ;// 5 modulus left-to-right both +a / b ;// 5 division left-to-right both +a + b ;// 6 addition left-to-right both +a != b ;// 9 equality left-to-right both +a == b ;// 9 equality left-to-right both +a !== b ;// 9 equality left-to-right both +a === b ;// 9 equality left-to-right both +a instanceof b ;// 8 instanceof left-to-right both +a instanceof(b) ;// 8 instanceof left-to-right both +a < b ;// 8 relational left-to-right both +a > b ;// 8 relational left-to-right both +a <= b ;// 8 relational left-to-right both +a >= b ;// 8 relational left-to-right both +a | b ;// 12 bitwise-or left-to-right both +a || b ;// 14 logical-or left-to-right both +a & b ;// 10 bitwise-and left-to-right both +a && b ;// 13 logical-and left-to-right both +a - b ;// 6 subtraction left-to-right both +a ^ b ;// 11 bitwise-xor left-to-right both +a << b ;// 7 bitwise shift left-to-right both +a >> b ;// 7 bitwise shift left-to-right both +a >>> b ;// 7 bitwise shift left-to-right both +a * b ;// 5 multiplication left-to-right both +a [ b ] ;// 1 member left-to-right inside + left +a ( b ) ;// 2 function call left-to-right inside + left +a -- ;// 3 decrement n/a right-or-left +a ++ ;// 3 increment n/a right-or-left + -- b ;// 3 decrement n/a right-or-left + ++ b ;// 3 increment n/a right-or-left + new b ;// 1 new right-to-left right + void b ;// 4 void right-to-left right + void( b ) ;// 4 void right-to-left right + delete b ;// 4 delete right-to-left right + delete( b ) ;// 4 delete right-to-left right + typeof b ;// 4 typeof right-to-left right + typeof( b ) ;// 4 typeof right-to-left right + + b ;// 4 unary + right-to-left right + ~ b ;// 4 bitwise not right-to-left right + ! b ;// 4 logical-not right-to-left right + - b ;// 4 unary negation right-to-left right + + +// ============== +// = Deprecated = +// ============== + +// The escape and unescape functions are deprecated. Use encodeURI, encodeURIComponent, decodeURI or decodeURIComponent to encode and decode escape sequences for special characters. + +escape() +unescape() +encodeURI() +encodeURIComponent() +decodeURI() +decodeURIComponent() + +// ================== +// = Reserved Words = +// ================== +// The following are reserved words and may not be used as variables, functions, methods, or object identifiers. +// The following are reserved as existing keywords by the ECMAScript specification: +break +case +catch +continue +default +delete +do +else +finally +for +function +if +in +instanceof +new +return +switch +this +throw +try +typeof +var +void +while +with + +// The following are reserved as future keywords by the ECMAScript specification: +abstract +boolean +byte +char +class +const +debugger +double +enum +export +extends +final +float +goto +implements +import +int +interface +long +native +package +private +protected +public +short +static +super +synchronized +throws +transient +volatile + +// Take note that while not specified in ECMA-262, const, export, and import have been implemented in Mozilla. +const +export +import + From cd58b837942c01f4fe3312a39652c535bcc38664 Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Fri, 25 Jul 2008 18:27:42 -0400 Subject: [PATCH 136/243] Removed some poorly thought out snippets. Unified the for snippets some more New for snippet for fast DOM iteration --- Snippets/Object Method String.tmSnippet | 18 ------------------ Snippets/Object Value JS.tmSnippet | 16 ---------------- ... key \342\200\224 key: \"value\".tmSnippet" | 6 +++--- "Snippets/for (in) {\342\200\246}.tmSnippet" | 4 ++-- ...42\200\246) {\342\200\246} (DOM).tmSnippet" | 18 ++++++++++++++++++ ...42\200\246) {\342\200\246} (PPK).tmSnippet" | 5 ++--- ...200\246) {\342\200\246} (faster).tmSnippet" | 4 ++-- ...or (\342\200\246) {\342\200\246}.tmSnippet" | 4 ++-- info.plist | 7 +++++-- 9 files changed, 34 insertions(+), 48 deletions(-) delete mode 100644 Snippets/Object Method String.tmSnippet delete mode 100644 Snippets/Object Value JS.tmSnippet create mode 100644 "Snippets/for (\342\200\246) {\342\200\246} (DOM).tmSnippet" diff --git a/Snippets/Object Method String.tmSnippet b/Snippets/Object Method String.tmSnippet deleted file mode 100644 index 8b7ec64..0000000 --- a/Snippets/Object Method String.tmSnippet +++ /dev/null @@ -1,18 +0,0 @@ - - - - - content - '${1:${2:#thing}:${3:click}}': function(element){ - $0 -}${10:,} - name - Object Method String - scope - source.js - tabTrigger - '':f - uuid - 7B9AEFCC-B450-416D-8527-430FE2A08568 - - diff --git a/Snippets/Object Value JS.tmSnippet b/Snippets/Object Value JS.tmSnippet deleted file mode 100644 index b741217..0000000 --- a/Snippets/Object Value JS.tmSnippet +++ /dev/null @@ -1,16 +0,0 @@ - - - - - content - ${1:value_name}:${0:value}, - name - Object Value JS - scope - source.js - tabTrigger - :, - uuid - AD506BEC-B33C-4168-A900-0A4D386A4B05 - - diff --git "a/Snippets/Object key \342\200\224 key: \"value\".tmSnippet" "b/Snippets/Object key \342\200\224 key: \"value\".tmSnippet" index 12bc4e1..96ab6c8 100644 --- "a/Snippets/Object key \342\200\224 key: \"value\".tmSnippet" +++ "b/Snippets/Object key \342\200\224 key: \"value\".tmSnippet" @@ -1,13 +1,13 @@ - + content - ${1:key}: ${2:"${3:value}"}${4:, } + ${1:key}: ${2:${3:value}}${4:,} keyEquivalent ~: name - Object key — key: "value" + Object Literal—key: "value" scope source.js tabTrigger diff --git "a/Snippets/for (in) {\342\200\246}.tmSnippet" "b/Snippets/for (in) {\342\200\246}.tmSnippet" index 80c7499..28a12e3 100644 --- "a/Snippets/for (in) {\342\200\246}.tmSnippet" +++ "b/Snippets/for (in) {\342\200\246}.tmSnippet" @@ -4,8 +4,8 @@ content for (var ${1:property} in ${2:object}) { - ${0:$1} -}; + ${0:$2[$1]} +} name for (in) {…} scope diff --git "a/Snippets/for (\342\200\246) {\342\200\246} (DOM).tmSnippet" "b/Snippets/for (\342\200\246) {\342\200\246} (DOM).tmSnippet" new file mode 100644 index 0000000..538cd68 --- /dev/null +++ "b/Snippets/for (\342\200\246) {\342\200\246} (DOM).tmSnippet" @@ -0,0 +1,18 @@ + + + + + content + for (var ${20:i}=0, ${2:node}; ${2:node} = ${1:Nodes}[${20:i}++];) { + ${0:${2:node}} +} + name + for (…) {…} (DOM) + scope + source.js + tabTrigger + for + uuid + 92D6EE80-615E-45B7-B2E2-FF5C200A8478 + + diff --git "a/Snippets/for (\342\200\246) {\342\200\246} (PPK).tmSnippet" "b/Snippets/for (\342\200\246) {\342\200\246} (PPK).tmSnippet" index 9408455..cd55daf 100644 --- "a/Snippets/for (\342\200\246) {\342\200\246} (PPK).tmSnippet" +++ "b/Snippets/for (\342\200\246) {\342\200\246} (PPK).tmSnippet" @@ -3,10 +3,9 @@ content - for (var ${20:i}=0,${2:thing}; ${2:thing}=${1:Things}[${20:i}]; ${20:i}++){ + for (var ${20:i}=0, ${2:thing}; ${2:thing} = ${1:Things}[${20:i}]; ${20:i}++){ $0${2:thing} -}; - +} name for (…) {…} (PPK) scope diff --git "a/Snippets/for (\342\200\246) {\342\200\246} (faster).tmSnippet" "b/Snippets/for (\342\200\246) {\342\200\246} (faster).tmSnippet" index 2853eb2..9ac79c6 100644 --- "a/Snippets/for (\342\200\246) {\342\200\246} (faster).tmSnippet" +++ "b/Snippets/for (\342\200\246) {\342\200\246} (faster).tmSnippet" @@ -4,8 +4,8 @@ content for (var ${20:i} = ${1:Things}.length - 1; ${20:i} >= 0; ${20:i}--){ - $0${100:${1:Things}[${20:i}]} -}; + ${0:$1[$20]} +} name for (…) {…} (Improved Native For-Loop) scope diff --git "a/Snippets/for (\342\200\246) {\342\200\246}.tmSnippet" "b/Snippets/for (\342\200\246) {\342\200\246}.tmSnippet" index 852d3f5..9001c98 100644 --- "a/Snippets/for (\342\200\246) {\342\200\246}.tmSnippet" +++ "b/Snippets/for (\342\200\246) {\342\200\246}.tmSnippet" @@ -4,8 +4,8 @@ content for (var ${20:i}=0; ${20:i} < ${1:Things}.length; ${20:i}++) { - $0${100:${1:Things}[${20:i}]} -}; + ${0:$1[$20]} +} name for (…) {…} scope diff --git a/info.plist b/info.plist index d404937..ff85a4e 100644 --- a/info.plist +++ b/info.plist @@ -21,6 +21,7 @@ 28B33806-DCD4-4D5D-A422-B6041A6D9FAA 20E61C43-B81F-4FB9-9362-BFFE668EB9C9 36EC03E9-EFF4-479A-AB90-8DFA16800642 + 12767C79-C781-4BFC-8BA3-D108DB14292D submenus @@ -85,6 +86,7 @@ 011C4681-FBEC-4891-9326-3DECFCDED6D6 C207B7C3-5597-4873-8AAD-C46FB8842AF2 9BF3315C-88FF-46A1-89E1-9A5E9EAC78D0 + ------------------------------------ 3F4AB53B-210C-4E0C-8D04-12192DECC3D1 name @@ -119,6 +121,7 @@ JavaScript ordering + EB00F356-06C8-4267-8226-AA8F3943E5B1 77065D69-742A-4FF0-9A41-AD211DFBE72F B4874A14-2491-465A-A349-61E4EBCF4700 F0E4FB6A-4878-48C6-A777-62438DF1E14F @@ -139,17 +142,17 @@ 011C4681-FBEC-4891-9326-3DECFCDED6D6 C207B7C3-5597-4873-8AAD-C46FB8842AF2 9BF3315C-88FF-46A1-89E1-9A5E9EAC78D0 + 92D6EE80-615E-45B7-B2E2-FF5C200A8478 3F4AB53B-210C-4E0C-8D04-12192DECC3D1 - AD506BEC-B33C-4168-A900-0A4D386A4B05 DC8B46FB-8ADA-45EA-8F36-94C807A0D302 009A3E6C-FE3F-4A18-8759-2DC31F17BBE2 - 7B9AEFCC-B450-416D-8527-430FE2A08568 9E0E3BCC-7F20-4D6B-891D-A44D6EC56E31 20E61C43-B81F-4FB9-9362-BFFE668EB9C9 36EC03E9-EFF4-479A-AB90-8DFA16800642 E1B2FC98-AF98-4392-8069-C82C2C192617 603A6D98-A136-4766-828B-C39178AB8003 12767C79-C781-4BFC-8BA3-D108DB14292D + CB7ACED9-DA02-4A85-A75B-D9D8527CF5C9 uuid AAB4FD74-73F9-11D9-B89A-000D93589AF6 From e696cf88a38293f8a09118ff755e048baadf1707 Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Mon, 28 Jul 2008 10:49:24 -0400 Subject: [PATCH 137/243] Tests for labels and new new --- Tests/Javascript Syntax Test.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Tests/Javascript Syntax Test.js b/Tests/Javascript Syntax Test.js index 73226cd..883b24c 100644 --- a/Tests/Javascript Syntax Test.js +++ b/Tests/Javascript Syntax Test.js @@ -863,3 +863,27 @@ const export import +// Labels +checkiandj: +while (i < 4) { + document.write(i + "
"); + i += 1; + + checkj: + while (j > 4) { + document.write(j + "
"); + j -= 1; + if ((j % 2) == 0) + continue checkj; + document.write(j + " is odd.
"); + } + document.write("i = " + i + "
"); + document.write("j = " + j + "
"); +} + +// Unorganized + +new new Function(); +new (function(){})(); +new(function(){})(); + From ec65f333b5a3d3eda4b5f55d4cbaf9832f21713b Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Sun, 3 Aug 2008 12:37:11 -0400 Subject: [PATCH 138/243] Folding & Indent Test --- Tests/Javascript Folding & Indent.js | 265 +++++++++++++++++++++++++++ 1 file changed, 265 insertions(+) create mode 100644 Tests/Javascript Folding & Indent.js diff --git a/Tests/Javascript Folding & Indent.js b/Tests/Javascript Folding & Indent.js new file mode 100644 index 0000000..57e442a --- /dev/null +++ b/Tests/Javascript Folding & Indent.js @@ -0,0 +1,265 @@ +// -*- Mode: Embedded JavaScript; tab-width: 4; indent-tabs-mode: nil; -*- + +// Select everything and hit Text > Indent Line +// Then run a Diff > Document with Saved Copy +// If there are any differences then the indent rules are broken + +/* +Block Comment +*/ +/* +Block Comment +*/ // Comment + +/** +Documentation Comment (idiom) +**/ // Comment + +/* Documentation Comment (idiom) + * + * Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do + * eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim + * ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut + * aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit + * in voluptate velit esse cillum dolore eu fugiat nulla pariatur. + * Excepteur sint occaecat cupidatat non proident, sunt in culpa qui + * officia deserunt mollit anim id est laborum. + */ + + +[1,2,3] +[ + 1, + 2, + 3 +] +myArray[ + 0 +] +(statement) +( + statement +) +myFunction( + statement +) +{ + label:'value' +} +function(){ + statement; +} + +// With ; +[1,2,3]; +[ + 1, + 2, + 3 +]; +myArray[ + 0 +]; +(statement) +( + statement +); +myFunction( + statement +); +{ + label:'value' +}; +function(){ + statement; +}; + + + +// Object +var myObj = { + label: [1,2,3], + label: [ + 1, + 2, + 3 + ], + label: myArray[ + 0 + ], + label: (statement), + label: ( + statement + ), + label: myFunction( + statement + ), + label: { + label:'value' + }, + label: function(){ + statement; + }, + label: 0 +}; + + +// ======================== +// = With inline comments = +// ======================== +[1,2,3] // Comment +[ // Comment + 1, // Comment + 2, // Comment + 3 // Comment +] // Comment +myArray[ // Comment + 0 // Comment +] // Comment +(statement) // Comment +( // Comment + statement // Comment +) // Comment +myFunction( // Comment + statement // Comment +) // Comment +{ // Comment + label:'value' // Comment +} // Comment +function(){ // Comment + statement; // Comment +} // Comment + + +[1,2,3]; // Comment +[ // Comment + 1, // Comment + 2, // Comment + 3 // Comment +]; // Comment +myArray[ // Comment + 0 // Comment +]; // Comment +(statement) // Comment +( // Comment + statement // Comment +); // Comment +myFunction( // Comment + statement // Comment +); // Comment +{ // Comment + label:'value' // Comment +}; // Comment +function(){ // Comment + statement; // Comment +}; // Comment + + +var myObj = { // Comment + label: [1,2,3], // Comment + label: [ // Comment + 1, // Comment + 2, // Comment + 3 // Comment + ], // Comment + label: myArray[ // Comment + 0 // Comment + ], // Comment + label: (statement), // Comment + label: ( // Comment + statement // Comment + ), // Comment + label: myFunction( // Comment + statement // Comment + ), // Comment + label: { // Comment + label:'value' // Comment + }, // Comment + label: function(){ // Comment + statement; // Comment + }, // Comment + label: 0 // Comment +}; // Comment + + +// ================= +// = With Comments = +// ================= +[1,2,3] /* Comment */ +[ /* Comment */ + 1, /* Comment */ + 2, /* Comment */ + 3 /* Comment */ +] /* Comment */ +myArray[ /* Comment */ + 0 /* Comment */ +] /* Comment */ +(statement) /* Comment */ +( /* Comment */ + statement /* Comment */ +) /* Comment */ +myFunction( /* Comment */ + statement /* Comment */ +) /* Comment */ +{ /* Comment */ + label:'value' /* Comment */ +} /* Comment */ +function(){ /* Comment */ + statement; /* Comment */ +} /* Comment */ + +// With ; /* Comment */ +[1,2,3]; /* Comment */ +[ /* Comment */ + 1, /* Comment */ + 2, /* Comment */ + 3 /* Comment */ +]; /* Comment */ +myArray[ /* Comment */ + 1, /* Comment */ + 2, /* Comment */ + 3 /* Comment */ +]; /* Comment */ +(statement) /* Comment */ +( /* Comment */ + statement /* Comment */ +); /* Comment */ +myFunction( /* Comment */ + statement /* Comment */ +); /* Comment */ +{ /* Comment */ + label:'value' /* Comment */ +}; /* Comment */ +function(){ /* Comment */ + statement; /* Comment */ +}; /* Comment */ + + +// Object /* Comment */ +var myObj = { /* Comment */ + label: [1,2,3], /* Comment */ + label: [ /* Comment */ + 1, /* Comment */ + 2, /* Comment */ + 3 /* Comment */ + ], /* Comment */ + label: myArray[ /* Comment */ + 0 /* Comment */ + ], /* Comment */ + label: (statement), /* Comment */ + label: ( /* Comment */ + statement /* Comment */ + ), /* Comment */ + label: myFunction( /* Comment */ + statement /* Comment */ + ), /* Comment */ + label: { /* Comment */ + label:'value' /* Comment */ + }, /* Comment */ + label: function(){ /* Comment */ + statement; /* Comment */ + }, /* Comment */ + label: 0 /* Comment */ +}; /* Comment */ + + From f7b1a5c13949895e31e93266069e6b299c92ad17 Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Mon, 4 Aug 2008 10:41:36 -0400 Subject: [PATCH 139/243] NEW: Advanced folding rules Added more Tests for folding and indent --- Syntaxes/JavaScript Basic.tmLanguage | 14 +++- Tests/Embedded Javascript Test.html | 2 +- Tests/Javascript Folding & Indent.js | 99 +++++++++++++++++++++++++++- Tests/Javascript Syntax Test.js | 27 +++++++- 4 files changed, 135 insertions(+), 7 deletions(-) diff --git a/Syntaxes/JavaScript Basic.tmLanguage b/Syntaxes/JavaScript Basic.tmLanguage index 541c71f..988d0f9 100644 --- a/Syntaxes/JavaScript Basic.tmLanguage +++ b/Syntaxes/JavaScript Basic.tmLanguage @@ -11,9 +11,19 @@ jsx foldingStartMarker - ^.*(\bfunction\s*(\w+\s*)?\([^\)]*\)(\s*\{[^\}]*)?\s*$)|(={\s*$)|(\({$) + (?x)^ \s* ([^\s].*)? + # Open (nothing | no parens | (no parens? (nested parens ) no parens?)+ ) + ( \[ (?: | (?<noR>[^\[\]]++) | (\g<noR>? (?<round> \[ (?: \g<noR> | \g<round> )* \] ) \g<noR>? )++ ) + | \( (?: | (?<noS>[^\(\)]++) | (\g<noS>? (?<squar> \( (?: \g<noS> | \g<squar> )* \) ) \g<noS>? )++ ) + | \{ (?: | (?<noC>[^\{\}]++) | (\g<noC>? (?<curly> \{ (?: \g<noC> | \g<curly> )* \} ) \g<noC>? )++ ) + )$ foldingStopMarker - (^\s*\})|(^}\)); + (?x)^ \s* + # (nothing | no parens | (no parens? (nested parens ) no parens?)+ ) Close + ( (?: | (?<noR>[^\[\]]++) | (\g<noR>? (?<round> \[ (?: \g<noR> | \g<round> )* \] ) \g<noR>? )++ ) \] + | (?: | (?<noS>[^\(\)]++) | (\g<noS>? (?<squar> \( (?: \g<noS> | \g<squar> )* \) ) \g<noS>? )++ ) \) + | (?: | (?<noC>[^\{\}]++) | (\g<noC>? (?<curly> \{ (?: \g<noC> | \g<curly> )* \} ) \g<noC>? )++ ) \} + ) keyEquivalent ^~J name diff --git a/Tests/Embedded Javascript Test.html b/Tests/Embedded Javascript Test.html index 1c08ebb..8f8d9f1 100644 --- a/Tests/Embedded Javascript Test.html +++ b/Tests/Embedded Javascript Test.html @@ -10,7 +10,7 @@ diff --git a/Tests/Javascript Folding & Indent.js b/Tests/Javascript Folding & Indent.js index 57e442a..8f2b17f 100644 --- a/Tests/Javascript Folding & Indent.js +++ b/Tests/Javascript Folding & Indent.js @@ -46,7 +46,11 @@ myFunction( { label:'value' } -function(){ +var myObj = { + label:'value' +} + +function (){ statement; } @@ -76,6 +80,32 @@ function(){ +// With () +[1,2,3]() +[ + 1, + 2, + 3 +]() +myArray[ + 0 +]() +(statement) +( + statement +)() +myFunction( + statement +)() +{ + label:'value' +}() +function(){ + statement() +}() + + + // Object var myObj = { label: [1,2,3], @@ -263,3 +293,70 @@ var myObj = { /* Comment */ }; /* Comment */ +// ============== +// = Mixed line = +// ============== + +[ [1,2,3],[1,2,3], + [1,2,3],[1,2,3], +][0] +myArray[ myArray[0] + myArray[0] + + 0 +][ 0 +] +( (statement) + + statement +) +myFunction( myFunction() + myFunction() +) +var myObj = { label:{ label:'value' }, label:{ label:'value' }, + label:'value' +} +function(){ function(){ statement }; function(){ statement }; + statement; +} + + +// ======== +// = Bugs = +// ======== + +myFunction() + +myFunction( +)myFunction + +myFunction(() +)myFunction + +myFunction(()() +{()()()())()()} + +myFunction(something() +) + +myFunction(()something +) + +myFunction((something) +) + + myFunction(something(something)something + something(something)something) + + + +myFunction(something()() +) + +myFunction(()something() +) + +myFunction((something)() +) + +myFunction(()something()(something)()something() +) + + + diff --git a/Tests/Javascript Syntax Test.js b/Tests/Javascript Syntax Test.js index 883b24c..2d65146 100644 --- a/Tests/Javascript Syntax Test.js +++ b/Tests/Javascript Syntax Test.js @@ -864,17 +864,21 @@ export import // Labels -checkiandj: +var objectName = { + labelName: "", + labelName2: "" +} +labelName: while (i < 4) { document.write(i + "
"); i += 1; - checkj: + labelName2: while (j > 4) { document.write(j + "
"); j -= 1; if ((j % 2) == 0) - continue checkj; + continue labelName2; document.write(j + " is odd.
"); } document.write("i = " + i + "
"); @@ -887,3 +891,20 @@ new new Function(); new (function(){})(); new(function(){})(); + +// Comments +/**/ +/* */ +/** **/ +// + + +/* +Block Comment +*/ +/** +Documentation Comment (idiom) +**/ +// Inline Comment + + From 32eedf8f106284356372a81cf6179bc5edf4e4b3 Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Mon, 4 Aug 2008 10:44:42 -0400 Subject: [PATCH 140/243] New Help command Beginning Help document / GitHub readme --- Commands/Help.tmCommand | 26 ++++++++++++++++++++++++++ README.md | 14 ++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 Commands/Help.tmCommand create mode 100644 README.md diff --git a/Commands/Help.tmCommand b/Commands/Help.tmCommand new file mode 100644 index 0000000..470f724 --- /dev/null +++ b/Commands/Help.tmCommand @@ -0,0 +1,26 @@ + + + + + beforeRunningCommand + nop + command + . "$TM_SUPPORT_PATH/lib/webpreview.sh" +html_header "Javascript Bundle Help" "Javascript" + +"$TM_SUPPORT_PATH/lib/markdown_to_help.rb" "$TM_BUNDLE_SUPPORT/../README.md" + + dontFollowNewOutput + + input + none + name + Help + output + showAsHTML + scope + source.js + uuid + EB00F356-06C8-4267-8226-AA8F3943E5B1 + + diff --git a/README.md b/README.md new file mode 100644 index 0000000..3b7370e --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +This document describes the commands of the TextMate Javascript bundle. + +# Command Reference + +* **Documentation for Word / Selection** (WebView Window) + + Searches your selection in a Javascript documentation website. + +# Snippets + +if +if ... else +for +for (in) From bff49bbc0068392db4b58a51f8b28ea4f79a996c Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Mon, 4 Aug 2008 10:46:40 -0400 Subject: [PATCH 141/243] Updated proto snippet to match the new style of snippets for this bundle --- Snippets/Prototype (proto).plist | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Snippets/Prototype (proto).plist b/Snippets/Prototype (proto).plist index 252c279..997f11a 100644 --- a/Snippets/Prototype (proto).plist +++ b/Snippets/Prototype (proto).plist @@ -1,18 +1,15 @@ - + content - ${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) { - ${0:// body...} -}; - + .prototype.${2:methodName} = f$0 name - Prototype + .prototype.method = f scope source.js tabTrigger - proto + .p uuid 2F96136B-0193-42F5-90FC-B6F456A3AD77 From 7013ea591186f6a33f07a2de28861c8cc521c008 Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Mon, 4 Aug 2008 10:47:07 -0400 Subject: [PATCH 142/243] new window. snippet like the current document. snippet --- Snippets/window_.tmSnippet | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Snippets/window_.tmSnippet diff --git a/Snippets/window_.tmSnippet b/Snippets/window_.tmSnippet new file mode 100644 index 0000000..12829fe --- /dev/null +++ b/Snippets/window_.tmSnippet @@ -0,0 +1,16 @@ + + + + + content + window. + name + window. + scope + source.js + tabTrigger + w + uuid + 5CAA9822-629C-4362-B02A-FCEF38C79BD5 + + From 3b07658fe577bcf02ffbf2fad5a453375404b811 Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Mon, 4 Aug 2008 10:47:45 -0400 Subject: [PATCH 143/243] onload listener snippet --- .../window_addEventListener_load.tmSnippet | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Snippets/window_addEventListener_load.tmSnippet diff --git a/Snippets/window_addEventListener_load.tmSnippet b/Snippets/window_addEventListener_load.tmSnippet new file mode 100644 index 0000000..f1f4820 --- /dev/null +++ b/Snippets/window_addEventListener_load.tmSnippet @@ -0,0 +1,20 @@ + + + + + content + window.addEventListener('load',function(){ + + $0${TM_SELECTED_TEXT: +} +},true); + name + window.addEventListener('load') + scope + source.js + tabTrigger + load + uuid + 523E9E93-6E43-4E2F-9F6F-465A8A24714E + + From 80a418e66b441ff5dfac10120cf2a9927f5b9f7e Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Mon, 4 Aug 2008 10:48:10 -0400 Subject: [PATCH 144/243] updated info.plist for new stuff --- info.plist | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/info.plist b/info.plist index ff85a4e..a48c96b 100644 --- a/info.plist +++ b/info.plist @@ -12,6 +12,8 @@ items + EB00F356-06C8-4267-8226-AA8F3943E5B1 + ------------------------------------ B4874A14-2491-465A-A349-61E4EBCF4700 ------------------------------------ D2E6A1FE-2881-4754-B399-B65F61F29C2F @@ -19,16 +21,18 @@ 52090C49-D8B2-49A0-9597-80574354B3CD 6F601764-6A78-4857-A866-B617890F0DEC 28B33806-DCD4-4D5D-A422-B6041A6D9FAA + ------------------------------------ 20E61C43-B81F-4FB9-9362-BFFE668EB9C9 36EC03E9-EFF4-479A-AB90-8DFA16800642 - 12767C79-C781-4BFC-8BA3-D108DB14292D submenus 28B33806-DCD4-4D5D-A422-B6041A6D9FAA items - + + 523E9E93-6E43-4E2F-9F6F-465A8A24714E + name Idioms @@ -61,7 +65,6 @@ 1717B5AE-209B-4548-9155-9E88A7230C1C ------------------------------------ 77065D69-742A-4FF0-9A41-AD211DFBE72F - 7B9AEFCC-B450-416D-8527-430FE2A08568 name Function @@ -80,12 +83,15 @@ items + 12767C79-C781-4BFC-8BA3-D108DB14292D + ------------------------------------ F19F3732-39A7-48EC-A72B-A8F477A01795 31964029-9D71-4ADC-8213-DFE5C4E222B3 ------------------------------------ 011C4681-FBEC-4891-9326-3DECFCDED6D6 C207B7C3-5597-4873-8AAD-C46FB8842AF2 9BF3315C-88FF-46A1-89E1-9A5E9EAC78D0 + 92D6EE80-615E-45B7-B2E2-FF5C200A8478 ------------------------------------ 3F4AB53B-210C-4E0C-8D04-12192DECC3D1 @@ -108,7 +114,6 @@ items DC8B46FB-8ADA-45EA-8F36-94C807A0D302 - AD506BEC-B33C-4168-A900-0A4D386A4B05 ------------------------------------ 2F96136B-0193-42F5-90FC-B6F456A3AD77 @@ -126,6 +131,7 @@ B4874A14-2491-465A-A349-61E4EBCF4700 F0E4FB6A-4878-48C6-A777-62438DF1E14F C1197E58-D065-4EDC-9BAB-EB41622C1630 + 5CAA9822-629C-4362-B02A-FCEF38C79BD5 2F96136B-0193-42F5-90FC-B6F456A3AD77 73951799-AC15-40A6-81DB-EC051AB4A033 1717B5AE-209B-4548-9155-9E88A7230C1C @@ -153,6 +159,7 @@ 603A6D98-A136-4766-828B-C39178AB8003 12767C79-C781-4BFC-8BA3-D108DB14292D CB7ACED9-DA02-4A85-A75B-D9D8527CF5C9 + 523E9E93-6E43-4E2F-9F6F-465A8A24714E uuid AAB4FD74-73F9-11D9-B89A-000D93589AF6 From b8efd98c2a3245b232f8b60a5b91cbd8fcb0b3b6 Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Mon, 4 Aug 2008 11:02:00 -0400 Subject: [PATCH 145/243] Special indent/folding tests --- Tests/Javascript Folding & Indent.js | 37 ++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/Tests/Javascript Folding & Indent.js b/Tests/Javascript Folding & Indent.js index 8f2b17f..c47b069 100644 --- a/Tests/Javascript Folding & Indent.js +++ b/Tests/Javascript Folding & Indent.js @@ -26,6 +26,7 @@ Documentation Comment (idiom) * officia deserunt mollit anim id est laborum. */ +// nothing [1,2,3] [ @@ -341,8 +342,8 @@ myFunction(()something myFunction((something) ) - myFunction(something(something)something - something(something)something) +myFunction(something(something)something +something(something)something) @@ -360,3 +361,35 @@ myFunction(()something()(something)()something() +// =========== +// = Special = +// =========== +switch (statement){ + case 'label': + statement; + break; + case 'label': + statement; + break; + case 'label': + statement; + break; + default: + statement; +} + +if (statement) statement; + +if (statement) + statement; + +if (statement){ + statement;} + +if (statement){ + statement; +} + + + + From 3c47885cfa7e9e6b7fd5bf66ca6b3f98ad32c44e Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Mon, 4 Aug 2008 12:16:54 -0400 Subject: [PATCH 146/243] More advanced indent & folding tests --- Tests/Javascript Folding & Indent.js | 133 +++++++++++++++++++++++++-- 1 file changed, 123 insertions(+), 10 deletions(-) diff --git a/Tests/Javascript Folding & Indent.js b/Tests/Javascript Folding & Indent.js index c47b069..b8803fb 100644 --- a/Tests/Javascript Folding & Indent.js +++ b/Tests/Javascript Folding & Indent.js @@ -98,12 +98,12 @@ myArray[ myFunction( statement )() -{ +({ label:'value' -}() -function(){ +})['label']() +(function(){ statement() -}() +})() @@ -325,13 +325,10 @@ function(){ function(){ statement }; function(){ statement }; myFunction() myFunction( -)myFunction - -myFunction(() -)myFunction +);myFunction -myFunction(()() -{()()()())()()} +myFunction((0) +);myFunction myFunction(something() ) @@ -378,6 +375,7 @@ switch (statement){ statement; } +// No fold if (statement) statement; if (statement) @@ -386,10 +384,125 @@ if (statement) if (statement){ statement;} +// Fold if (statement){ statement; } +// =========== +// = Strings = +// =========== +// No Fold; No Indent +myFunction(")" + // Fold; Indent +"(") +// No Fold; No Indent +myArray = ["]", + // Fold; Indent +"["] +// No Fold; No Indent +function(){"}" + // Fold; Indent +"{"} +// No Fold; No Indent +myFunction("\")" + // Fold; Indent +"\"(") +// No Fold; No Indent +myArray = ["\"]", + // Fold; Indent +"\"["] +// No Fold; No Indent +function(){"\"}" + // Fold; Indent +"\"{"} +// No Fold; No Indent +myFunction(')' + // Fold; Indent +'(') +// No Fold; No Indent +myArray = [']', + // Fold; Indent +'['] +// No Fold; No Indent +function(){'}' + // Fold; Indent +'{'} +// No Fold; No Indent +myFunction('\')' + // Fold; Indent +'\'(') +// No Fold; No Indent +myArray = ['\']', + // Fold; Indent +'\'['] +// No Fold; No Indent +function(){'\'}' + // Fold; Indent +'\'{'} +// No Fold; No Indent +myFunction(/)/ + // Fold; Indent +/(/) +// No Fold; No Indent +myArray = [/]/, + // Fold; Indent +/[/] +// No Fold; No Indent +function(){/}/ + // Fold; Indent +/{/} +// No Fold; No Indent +myFunction(/\/)/ + // Fold; Indent +/\/(/) +// No Fold; No Indent +myArray = [/\/]/, + // Fold; Indent +/\/[/] +// No Fold; No Indent +function(){/\/}/ + // Fold; Indent +/\/{/} + +// No Fold; No Indent +function(){" { "} +function(){"\" { "} +function(){' { '} +function(){'\' { '} +function(){/ \{ /} +function(){/\/\{ /} +myArray = [" [ "] +myArray = ["\" [ "] +myArray = [' [ '] +myArray = ['\' [ '] +myArray = [/ \[ /] +myArray = [/\/\[ /] +myFunction(" ( ") +myFunction("\" ( ") +myFunction(' ( ') +myFunction('\' ( ') +myFunction(/ \( /) +myFunction(/\/\( /) +// No Fold; No Indent +function(){" } "} +function(){"\" } "} +function(){' } '} +function(){'\' } '} +function(){/ } /} +function(){/\/ } /} +myArray = [" ] "] +myArray = ["\" ] "] +myArray = [' ] '] +myArray = ['\' ] '] +myArray = [/ ] /] +myArray = [/\/ ] /] +myFunction(" ) ") +myFunction("\" ) ") +myFunction(' ) ') +myFunction('\' ) ') +myFunction(/ \) /) +myFunction(/\/\) /) From e3900be05a3a30ce2fcbe06f7db43574b26fa6c8 Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Mon, 4 Aug 2008 14:34:18 -0400 Subject: [PATCH 147/243] =?UTF-8?q?NEW=20Advanced=20Folding=20and=20Indent?= =?UTF-8?q?=20patterns!=20Added=20switch=E2=80=A6case=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Preferences/Indent.tmPreferences | 35 ++++++ Preferences/JavaScript Indent.tmPreferences | 21 ---- Syntaxes/JavaScript Basic.tmLanguage | 20 ++-- Tests/Javascript Folding & Indent.js | 123 +++++++++++++++++--- 4 files changed, 149 insertions(+), 50 deletions(-) create mode 100644 Preferences/Indent.tmPreferences delete mode 100644 Preferences/JavaScript Indent.tmPreferences diff --git a/Preferences/Indent.tmPreferences b/Preferences/Indent.tmPreferences new file mode 100644 index 0000000..684085a --- /dev/null +++ b/Preferences/Indent.tmPreferences @@ -0,0 +1,35 @@ + + + + + name + Indent + scope + source.js + settings + + decreaseIndentPattern + (?x)^ \s* (?!//|/\*) + # (nothing | ( string | no parens )+ | (no parens? (nested parens ) no parens?)+ ) Close + ( (?: | ( (?<str> '(\\'|[^'])*+' | "(\\"|[^"])*+" | /(\\/|[^/])*+/) | (?<noR>[^\[\]'"/]++) )++ | (\g<noR>? (?<round> \[ (?: \g<str> | \g<noR> | \g<round> )* \] ) \g<noR>? )++ ) \] + | (?: | ( \g<str> | (?<noS>[^\(\)'"/]++) )++ | (\g<noS>? (?<squar> \( (?: \g<str> | \g<noS> | \g<squar> )* \) ) \g<noS>? )++ ) \) + | (?: | ( \g<str> | (?<noC>[^\{\}'"/]++) )++ | (\g<noC>? (?<curly> \{ (?: \g<str> | \g<noC> | \g<curly> )* \} ) \g<noC>? )++ ) \} + | \b(?:case|default)\b .*$# [^;]*$ + ) + increaseIndentPattern + (?x)^ \s* (?!//|/\*)([^\s].*)? + # Open (nothing | ( string | no parens )+ | (no parens? (nested parens ) no parens?)+ ) + ( \[ (?: | ( (?<str> '(\\'|[^'])*+' | "(\\"|[^"])*+" | /(\\/|[^/])*+/) | (?<noR>[^\[\]'"/]++) )++ | (\g<noR>? (?<round> \[ (?: \g<str> | \g<noR> | \g<round> )* \] ) \g<noR>? )++ ) + | \( (?: | ( \g<str> | (?<noS>[^\(\)'"/]++) )++ | (\g<noS>? (?<squar> \( (?: \g<str> | \g<noS> | \g<squar> )* \) ) \g<noS>? )++ ) + | \{ (?: | ( \g<str> | (?<noC>[^\{\}'"/]++) )++ | (\g<noC>? (?<curly> \{ (?: \g<str> | \g<noC> | \g<curly> )* \} ) \g<noC>? )++ ) + | \b(?:case|default)\b .*# [^;]* + )$ + indentNextLinePattern + ^\s*((if|while|for|switch|else if).*[)]|else)\s*$ + unIndentedLinePattern + ^\s*((/\*|\*/\s*$|\ \*).*)?$ + + uuid + BC062860-3346-4D3B-8421-C5543F83D11F + + diff --git a/Preferences/JavaScript Indent.tmPreferences b/Preferences/JavaScript Indent.tmPreferences deleted file mode 100644 index 1ace8e8..0000000 --- a/Preferences/JavaScript Indent.tmPreferences +++ /dev/null @@ -1,21 +0,0 @@ - - - - - name - JavaScript Indent - scope - source.js - settings - - decreaseIndentPattern - ^((.*\*/)?\s*(\}|\))([^{]*\{)?([;,]?\s*|\.[^{]*|\s*\)[;\s]*)$|\s*[}]while.*$) - increaseIndentPattern - ^(\/(?!\/)|[^\/])*((\{[^}"']*|\([^)"']*)|\=\s*)$ - indentNextLinePattern - ^\s*((if|while|for|switch|else if).*[)]|else)\s*$ - - uuid - BC062860-3346-4D3B-8421-C5543F83D11F - - diff --git a/Syntaxes/JavaScript Basic.tmLanguage b/Syntaxes/JavaScript Basic.tmLanguage index 988d0f9..d588fc3 100644 --- a/Syntaxes/JavaScript Basic.tmLanguage +++ b/Syntaxes/JavaScript Basic.tmLanguage @@ -11,18 +11,18 @@ jsx foldingStartMarker - (?x)^ \s* ([^\s].*)? - # Open (nothing | no parens | (no parens? (nested parens ) no parens?)+ ) - ( \[ (?: | (?<noR>[^\[\]]++) | (\g<noR>? (?<round> \[ (?: \g<noR> | \g<round> )* \] ) \g<noR>? )++ ) - | \( (?: | (?<noS>[^\(\)]++) | (\g<noS>? (?<squar> \( (?: \g<noS> | \g<squar> )* \) ) \g<noS>? )++ ) - | \{ (?: | (?<noC>[^\{\}]++) | (\g<noC>? (?<curly> \{ (?: \g<noC> | \g<curly> )* \} ) \g<noC>? )++ ) + (?x)^ \s* (?!//|/\*)([^\s].*)? + # Open (nothing | ( string | no parens )+ | (no parens? (nested parens ) no parens?)+ ) + ( \[ (?: | ( (?<str> '(\\'|[^'])*+' | "(\\"|[^"])*+" | /(\\/|[^/])*+/) | (?<noR>[^\[\]'"/]++) )++ | (\g<noR>? (?<round> \[ (?: \g<str> | \g<noR> | \g<round> )* \] ) \g<noR>? )++ ) + | \( (?: | ( \g<str> | (?<noS>[^\(\)'"/]++) )++ | (\g<noS>? (?<squar> \( (?: \g<str> | \g<noS> | \g<squar> )* \) ) \g<noS>? )++ ) + | \{ (?: | ( \g<str> | (?<noC>[^\{\}'"/]++) )++ | (\g<noC>? (?<curly> \{ (?: \g<str> | \g<noC> | \g<curly> )* \} ) \g<noC>? )++ ) )$ foldingStopMarker - (?x)^ \s* - # (nothing | no parens | (no parens? (nested parens ) no parens?)+ ) Close - ( (?: | (?<noR>[^\[\]]++) | (\g<noR>? (?<round> \[ (?: \g<noR> | \g<round> )* \] ) \g<noR>? )++ ) \] - | (?: | (?<noS>[^\(\)]++) | (\g<noS>? (?<squar> \( (?: \g<noS> | \g<squar> )* \) ) \g<noS>? )++ ) \) - | (?: | (?<noC>[^\{\}]++) | (\g<noC>? (?<curly> \{ (?: \g<noC> | \g<curly> )* \} ) \g<noC>? )++ ) \} + (?x)^ \s* (?!//|/\*) + # (nothing | ( string | no parens )+ | (no parens? (nested parens ) no parens?)+ ) Close + ( (?: | ( (?<str> '(\\'|[^'])*+' | "(\\"|[^"])*+" | /(\\/|[^/])*+/) | (?<noR>[^\[\]'"/]++) )++ | (\g<noR>? (?<round> \[ (?: \g<str> | \g<noR> | \g<round> )* \] ) \g<noR>? )++ ) \] + | (?: | ( \g<str> | (?<noS>[^\(\)'"/]++) )++ | (\g<noS>? (?<squar> \( (?: \g<str> | \g<noS> | \g<squar> )* \) ) \g<noS>? )++ ) \) + | (?: | ( \g<str> | (?<noC>[^\{\}'"/]++) )++ | (\g<noC>? (?<curly> \{ (?: \g<str> | \g<noC> | \g<curly> )* \} ) \g<noC>? )++ ) \} ) keyEquivalent ^~J diff --git a/Tests/Javascript Folding & Indent.js b/Tests/Javascript Folding & Indent.js index b8803fb..7d9791a 100644 --- a/Tests/Javascript Folding & Indent.js +++ b/Tests/Javascript Folding & Indent.js @@ -26,6 +26,7 @@ Documentation Comment (idiom) * officia deserunt mollit anim id est laborum. */ + // nothing [1,2,3] @@ -325,35 +326,45 @@ function(){ function(){ statement }; function(){ statement }; myFunction() myFunction( + // Fold; Indent );myFunction myFunction((0) + // Fold; Indent );myFunction myFunction(something() + // Fold; Indent ) myFunction(()something + // Fold; Indent ) myFunction((something) + // Fold; Indent ) myFunction(something(something)something + // Fold; Indent something(something)something) myFunction(something()() + // Fold; Indent ) myFunction(()something() + // Fold; Indent ) myFunction((something)() + // Fold; Indent ) myFunction(()something()(something)()something() + // Fold; Indent ) @@ -362,6 +373,22 @@ myFunction(()something()(something)()something() // = Special = // =========== switch (statement){ +case 'label': + statement; + break; +case 'label': + statement; + break; +case 'label': + statement; + break; +default: + statement; +} + +function(){ + + switch (statement){ case 'label': statement; break; @@ -373,8 +400,20 @@ switch (statement){ break; default: statement; + } + + switch (statement){ + case 'label': statement; break; + case 'label': statement; break; + case 'label': statement; break; + default: statement; + } + } + + + // No fold if (statement) statement; @@ -382,13 +421,26 @@ if (statement) statement; if (statement){ - statement;} +statement;} // Fold if (statement){ statement; } +if () + statement; +else if () + statement; +else + statement; +while () + statement; +for () + statement; +switch () + statement; + // =========== // = Strings = @@ -396,75 +448,75 @@ if (statement){ // No Fold; No Indent myFunction(")" - // Fold; Indent + statement; // Fold; Indent "(") // No Fold; No Indent myArray = ["]", - // Fold; Indent + statement; // Fold; Indent "["] // No Fold; No Indent function(){"}" - // Fold; Indent + statement; // Fold; Indent "{"} // No Fold; No Indent myFunction("\")" - // Fold; Indent + statement; // Fold; Indent "\"(") // No Fold; No Indent myArray = ["\"]", - // Fold; Indent + statement; // Fold; Indent "\"["] // No Fold; No Indent function(){"\"}" - // Fold; Indent + statement; // Fold; Indent "\"{"} // No Fold; No Indent myFunction(')' - // Fold; Indent + statement; // Fold; Indent '(') // No Fold; No Indent myArray = [']', - // Fold; Indent + statement; // Fold; Indent '['] // No Fold; No Indent function(){'}' - // Fold; Indent + statement; // Fold; Indent '{'} // No Fold; No Indent myFunction('\')' - // Fold; Indent + statement; // Fold; Indent '\'(') // No Fold; No Indent myArray = ['\']', - // Fold; Indent + statement; // Fold; Indent '\'['] // No Fold; No Indent function(){'\'}' - // Fold; Indent + statement; // Fold; Indent '\'{'} // No Fold; No Indent myFunction(/)/ - // Fold; Indent + statement; // Fold; Indent /(/) // No Fold; No Indent myArray = [/]/, - // Fold; Indent + statement; // Fold; Indent /[/] // No Fold; No Indent function(){/}/ - // Fold; Indent + statement; // Fold; Indent /{/} // No Fold; No Indent myFunction(/\/)/ - // Fold; Indent + statement; // Fold; Indent /\/(/) // No Fold; No Indent myArray = [/\/]/, - // Fold; Indent + statement; // Fold; Indent /\/[/] // No Fold; No Indent function(){/\/}/ - // Fold; Indent + statement; // Fold; Indent /\/{/} // No Fold; No Indent @@ -506,3 +558,36 @@ myFunction('\' ) ') myFunction(/ \) /) myFunction(/\/\) /) + +// ============ +// = Comments = +// ============ + +// myFunction( +// No Fold; No Indent +// ) +// myArray = [ +// No Fold; No Indent +// ] +// function(){ +// No Fold; No Indent +// } + + +function(){ + some_function(); + +/* ignore_first(); + ignore_second(); +*/ + + more_functions(); +} + + +"" +'' +() +[] +{} + From 6216d42c75e0d96cf69a9d042a4f585ce095a81a Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Mon, 4 Aug 2008 16:35:06 -0400 Subject: [PATCH 148/243] Fixed indent rules for single-line case statements --- Preferences/Indent.tmPreferences | 7 +++++-- Tests/Javascript Folding & Indent.js | 27 +++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/Preferences/Indent.tmPreferences b/Preferences/Indent.tmPreferences index 684085a..c898002 100644 --- a/Preferences/Indent.tmPreferences +++ b/Preferences/Indent.tmPreferences @@ -14,7 +14,9 @@ ( (?: | ( (?<str> '(\\'|[^'])*+' | "(\\"|[^"])*+" | /(\\/|[^/])*+/) | (?<noR>[^\[\]'"/]++) )++ | (\g<noR>? (?<round> \[ (?: \g<str> | \g<noR> | \g<round> )* \] ) \g<noR>? )++ ) \] | (?: | ( \g<str> | (?<noS>[^\(\)'"/]++) )++ | (\g<noS>? (?<squar> \( (?: \g<str> | \g<noS> | \g<squar> )* \) ) \g<noS>? )++ ) \) | (?: | ( \g<str> | (?<noC>[^\{\}'"/]++) )++ | (\g<noC>? (?<curly> \{ (?: \g<str> | \g<noC> | \g<curly> )* \} ) \g<noC>? )++ ) \} - | \b(?:case|default)\b .*$# [^;]*$ + | \b(?:case|default)\b + (\g<str> | \g<noC> | \g<noC>? \g<curly> \b<noC>?)++ (?!\}) + $ ) increaseIndentPattern (?x)^ \s* (?!//|/\*)([^\s].*)? @@ -22,7 +24,8 @@ ( \[ (?: | ( (?<str> '(\\'|[^'])*+' | "(\\"|[^"])*+" | /(\\/|[^/])*+/) | (?<noR>[^\[\]'"/]++) )++ | (\g<noR>? (?<round> \[ (?: \g<str> | \g<noR> | \g<round> )* \] ) \g<noR>? )++ ) | \( (?: | ( \g<str> | (?<noS>[^\(\)'"/]++) )++ | (\g<noS>? (?<squar> \( (?: \g<str> | \g<noS> | \g<squar> )* \) ) \g<noS>? )++ ) | \{ (?: | ( \g<str> | (?<noC>[^\{\}'"/]++) )++ | (\g<noC>? (?<curly> \{ (?: \g<str> | \g<noC> | \g<curly> )* \} ) \g<noC>? )++ ) - | \b(?:case|default)\b .*# [^;]* + | \b(?:case|default)\b + (\g<str> | \g<noC> | \g<noC>? \g<curly> \b<noC>?)++ (?!\}) )$ indentNextLinePattern ^\s*((if|while|for|switch|else if).*[)]|else)\s*$ diff --git a/Tests/Javascript Folding & Indent.js b/Tests/Javascript Folding & Indent.js index 7d9791a..5de7340 100644 --- a/Tests/Javascript Folding & Indent.js +++ b/Tests/Javascript Folding & Indent.js @@ -402,6 +402,16 @@ function(){ statement; } + switch (statement){ + case 'label': statement; break; + case 'label': + statement; + break; + case 'label': statement; break; + default: + statement; + } + switch (statement){ case 'label': statement; break; case 'label': statement; break; @@ -409,6 +419,23 @@ function(){ default: statement; } + switch(expression){case expression:statements;break;default:statements;} + statements; // No More Indent + + switch(expression){ default:function(){" { "}; } + switch(expression){ default:function(){" } "}; } + switch(expression){ default:function(){"\" { "}; } + switch(expression){ default:function(){"\" } "}; } + switch(expression){ default:function(){' { '}; } + switch(expression){ default:function(){' } '}; } + switch(expression){ default:function(){'\' { '}; } + switch(expression){ default:function(){'\' } '}; } + switch(expression){ default:function(){/ } /}; } + switch(expression){ default:function(){/ \{ /}; } + switch(expression){ default:function(){/\/ } /}; } + switch(expression){ default:function(){/\/\{ /}; } + // No More Indent + } From adf5c194b25bb50b5ab6fc1cc41dd47445a010f7 Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Mon, 4 Aug 2008 16:36:19 -0400 Subject: [PATCH 149/243] smartTypingPairs, highlightPairs; Regular and in Strings --- Preferences/Misc.tmPreferences | 85 +++++++++++++++++++ ...ng Pairs: String and Comment.tmPreferences | 85 +++++++++++++++++++ 2 files changed, 170 insertions(+) create mode 100644 Preferences/Misc.tmPreferences create mode 100644 Preferences/Typing Pairs: String and Comment.tmPreferences diff --git a/Preferences/Misc.tmPreferences b/Preferences/Misc.tmPreferences new file mode 100644 index 0000000..46d79ba --- /dev/null +++ b/Preferences/Misc.tmPreferences @@ -0,0 +1,85 @@ + + + + + name + Misc + scope + source.js + settings + + highlightPairs + + + ' + ' + + + " + " + + + / + / + + + ( + ) + + + [ + ] + + + { + } + + + ‘ + ’ + + + “ + ” + + + smartTypingPairs + + + ' + ' + + + " + " + + + / + / + + + ( + ) + + + [ + ] + + + { + } + + + ‘ + ’ + + + “ + ” + + + + uuid + AC6FAAC0-07C4-4DB3-B493-28A64B96A258 + + diff --git a/Preferences/Typing Pairs: String and Comment.tmPreferences b/Preferences/Typing Pairs: String and Comment.tmPreferences new file mode 100644 index 0000000..ceaa76d --- /dev/null +++ b/Preferences/Typing Pairs: String and Comment.tmPreferences @@ -0,0 +1,85 @@ + + + + + name + Typing Pairs: String and Comment + scope + string.quoted, comment + settings + + highlightPairs + + + ' + ' + + + " + " + + + ( + ) + + + < + > + + + [ + ] + + + { + } + + + ‘ + ’ + + + “ + ” + + + smartTypingPairs + + + ' + ' + + + " + " + + + ( + ) + + + < + > + + + [ + ] + + + { + } + + + ‘ + ’ + + + “ + ” + + + + uuid + B8541849-2B39-440E-928F-E3C55E8D1BED + + From d6b73efb6b75c7bb531df0bd2e54cdf7be734131 Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Mon, 4 Aug 2008 16:37:54 -0400 Subject: [PATCH 150/243] Updated info.plist --- info.plist | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/info.plist b/info.plist index a48c96b..a61847f 100644 --- a/info.plist +++ b/info.plist @@ -137,6 +137,10 @@ 1717B5AE-209B-4548-9155-9E88A7230C1C 93E017CC-6F27-11D9-90EB-000D93589AF6 0D2D03B9-F18B-4D9D-A960-716FDEC35331 + BC062860-3346-4D3B-8421-C5543F83D11F + CB7ACED9-DA02-4A85-A75B-D9D8527CF5C9 + AC6FAAC0-07C4-4DB3-B493-28A64B96A258 + B8541849-2B39-440E-928F-E3C55E8D1BED A67A8BD9-A951-406F-9175-018DD4B52FD1 834BC727-6B31-4073-A161-4823227219EF 3CEA49B2-A5C5-405C-82E2-B8B668877C37 @@ -158,7 +162,6 @@ E1B2FC98-AF98-4392-8069-C82C2C192617 603A6D98-A136-4766-828B-C39178AB8003 12767C79-C781-4BFC-8BA3-D108DB14292D - CB7ACED9-DA02-4A85-A75B-D9D8527CF5C9 523E9E93-6E43-4E2F-9F6F-465A8A24714E uuid From c37f9a25524e1d0c132a76f7667c2abda45d3dc9 Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Mon, 18 Aug 2008 10:30:37 -0400 Subject: [PATCH 151/243] Fix an issue where a @ in a block comment would cause IE conditional comment matching for the rest of the document --- Syntaxes/JavaScript Basic.tmLanguage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/JavaScript Basic.tmLanguage b/Syntaxes/JavaScript Basic.tmLanguage index d588fc3..ff69a8c 100644 --- a/Syntaxes/JavaScript Basic.tmLanguage +++ b/Syntaxes/JavaScript Basic.tmLanguage @@ -783,7 +783,7 @@ end - /\*((@)end)\s*@\*/|(?<=@)\*/ + \*/ endCaptures 1 From b62b480d16bc2720244a93273352452f69b23b78 Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Mon, 18 Aug 2008 10:32:07 -0400 Subject: [PATCH 152/243] New snippets for switch / case --- Snippets/case.tmSnippet | 19 ++++++++++++++++ ...2\200\246) {\342\200\246} (DOM).tmSnippet" | 2 +- Snippets/switch case.tmSnippet | 22 +++++++++++++++++++ info.plist | 5 ++++- 4 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 Snippets/case.tmSnippet create mode 100644 Snippets/switch case.tmSnippet diff --git a/Snippets/case.tmSnippet b/Snippets/case.tmSnippet new file mode 100644 index 0000000..a40b381 --- /dev/null +++ b/Snippets/case.tmSnippet @@ -0,0 +1,19 @@ + + + + + content + break; +case ${20:/*Expression*/}: + ${0:} + break; + name + case + scope + source.js + tabTrigger + break; + uuid + 77750C34-3335-4766-900D-FFFF412DB7F5 + + diff --git "a/Snippets/for (\342\200\246) {\342\200\246} (DOM).tmSnippet" "b/Snippets/for (\342\200\246) {\342\200\246} (DOM).tmSnippet" index 538cd68..a377f28 100644 --- "a/Snippets/for (\342\200\246) {\342\200\246} (DOM).tmSnippet" +++ "b/Snippets/for (\342\200\246) {\342\200\246} (DOM).tmSnippet" @@ -4,7 +4,7 @@ content for (var ${20:i}=0, ${2:node}; ${2:node} = ${1:Nodes}[${20:i}++];) { - ${0:${2:node}} + ${0:${2:node}} } name for (…) {…} (DOM) diff --git a/Snippets/switch case.tmSnippet b/Snippets/switch case.tmSnippet new file mode 100644 index 0000000..a7f0b54 --- /dev/null +++ b/Snippets/switch case.tmSnippet @@ -0,0 +1,22 @@ + + + + + content + switch(${10:/*Expression*/}){ +case ${20:/*Expression*/}: + ${0:} + break; +default: + +} + name + switch … case + scope + source.js + tabTrigger + switch + uuid + 65AAF33F-7706-4FC0-B5E0-E9AABEF0731E + + diff --git a/info.plist b/info.plist index a61847f..17b9605 100644 --- a/info.plist +++ b/info.plist @@ -126,6 +126,8 @@ JavaScript ordering + BC062860-3346-4D3B-8421-C5543F83D11F + C09ABCA9-7558-4385-8E29-10E42093D8B6 EB00F356-06C8-4267-8226-AA8F3943E5B1 77065D69-742A-4FF0-9A41-AD211DFBE72F B4874A14-2491-465A-A349-61E4EBCF4700 @@ -137,7 +139,6 @@ 1717B5AE-209B-4548-9155-9E88A7230C1C 93E017CC-6F27-11D9-90EB-000D93589AF6 0D2D03B9-F18B-4D9D-A960-716FDEC35331 - BC062860-3346-4D3B-8421-C5543F83D11F CB7ACED9-DA02-4A85-A75B-D9D8527CF5C9 AC6FAAC0-07C4-4DB3-B493-28A64B96A258 B8541849-2B39-440E-928F-E3C55E8D1BED @@ -163,6 +164,8 @@ 603A6D98-A136-4766-828B-C39178AB8003 12767C79-C781-4BFC-8BA3-D108DB14292D 523E9E93-6E43-4E2F-9F6F-465A8A24714E + 65AAF33F-7706-4FC0-B5E0-E9AABEF0731E + 77750C34-3335-4766-900D-FFFF412DB7F5 uuid AAB4FD74-73F9-11D9-B89A-000D93589AF6 From 2fec3ebc31bc32ea8eb40cb4d15b6f144f309656 Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Mon, 18 Aug 2008 10:33:34 -0400 Subject: [PATCH 153/243] Removed the // smart string --- Preferences/Misc.tmPreferences | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Preferences/Misc.tmPreferences b/Preferences/Misc.tmPreferences index 46d79ba..c7ee4bf 100644 --- a/Preferences/Misc.tmPreferences +++ b/Preferences/Misc.tmPreferences @@ -18,10 +18,6 @@ " " - - / - / - ( ) @@ -53,10 +49,6 @@ " " - - / - / - ( ) From 66fc39c57a6a98df4b9eb9f3dc183826075c7fbe Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Sat, 20 Sep 2008 14:47:53 -0400 Subject: [PATCH 154/243] don't show function-calls in the symbol list --- Preferences/Symbol List Banned.tmPreferences | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Preferences/Symbol List Banned.tmPreferences b/Preferences/Symbol List Banned.tmPreferences index c51de2a..14907e0 100644 --- a/Preferences/Symbol List Banned.tmPreferences +++ b/Preferences/Symbol List Banned.tmPreferences @@ -1,11 +1,11 @@ - + name Symbol List Banned scope - source.js meta.property.function entity.name.function + source.js meta.property.function entity.name.function, source.js meta.function-call entity.name.function settings showInSymbolList From b99d9c40d150221284a01619c67a05ade49ed6fc Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Sat, 20 Sep 2008 14:49:42 -0400 Subject: [PATCH 155/243] Updated Javascript syntax test --- Tests/Javascript Syntax Test.js | 244 ++++++++++++++++++++++---------- 1 file changed, 173 insertions(+), 71 deletions(-) diff --git a/Tests/Javascript Syntax Test.js b/Tests/Javascript Syntax Test.js index 2d65146..39ac1f2 100644 --- a/Tests/Javascript Syntax Test.js +++ b/Tests/Javascript Syntax Test.js @@ -721,64 +721,59 @@ car2.owner.name // = Operators = // ============= -//Individual operators ;// Precedence Operator type Associativity Proximity -a = b ;// 16 assignment right-to-left both -a %= b ;// 16 assignment right-to-left both -a &= b ;// 16 assignment right-to-left both -a *= b ;// 16 assignment right-to-left both -a += b ;// 16 assignment right-to-left both -a -= b ;// 16 assignment right-to-left both -a /= b ;// 16 assignment right-to-left both -a ^= b ;// 16 assignment right-to-left both -a |= b ;// 16 assignment right-to-left both -a <<= b ;// 16 assignment right-to-left both -a >>= b ;// 16 assignment right-to-left both -a >>>= b ;// 16 assignment right-to-left both -a ? b : c ;// 15 conditional right-to-left both -a in b ;// 8 in left-to-right both -a in( b ) ;// 8 in left-to-right both -a , b ;// 17 comma left-to-right both -a . b ;// 1 member left-to-right both -a % b ;// 5 modulus left-to-right both -a / b ;// 5 division left-to-right both -a + b ;// 6 addition left-to-right both -a != b ;// 9 equality left-to-right both -a == b ;// 9 equality left-to-right both -a !== b ;// 9 equality left-to-right both -a === b ;// 9 equality left-to-right both -a instanceof b ;// 8 instanceof left-to-right both -a instanceof(b) ;// 8 instanceof left-to-right both -a < b ;// 8 relational left-to-right both -a > b ;// 8 relational left-to-right both -a <= b ;// 8 relational left-to-right both -a >= b ;// 8 relational left-to-right both -a | b ;// 12 bitwise-or left-to-right both -a || b ;// 14 logical-or left-to-right both -a & b ;// 10 bitwise-and left-to-right both -a && b ;// 13 logical-and left-to-right both -a - b ;// 6 subtraction left-to-right both -a ^ b ;// 11 bitwise-xor left-to-right both -a << b ;// 7 bitwise shift left-to-right both -a >> b ;// 7 bitwise shift left-to-right both -a >>> b ;// 7 bitwise shift left-to-right both -a * b ;// 5 multiplication left-to-right both -a [ b ] ;// 1 member left-to-right inside + left -a ( b ) ;// 2 function call left-to-right inside + left -a -- ;// 3 decrement n/a right-or-left -a ++ ;// 3 increment n/a right-or-left - -- b ;// 3 decrement n/a right-or-left - ++ b ;// 3 increment n/a right-or-left - new b ;// 1 new right-to-left right - void b ;// 4 void right-to-left right - void( b ) ;// 4 void right-to-left right - delete b ;// 4 delete right-to-left right - delete( b ) ;// 4 delete right-to-left right - typeof b ;// 4 typeof right-to-left right - typeof( b ) ;// 4 typeof right-to-left right - + b ;// 4 unary + right-to-left right - ~ b ;// 4 bitwise not right-to-left right - ! b ;// 4 logical-not right-to-left right - - b ;// 4 unary negation right-to-left right +/* Precedence Operator type Associativity Proximity */ //Individual operators ; +/* 1 member left-to-right both */ a . b ; +/* 1 member left-to-right inside + left */ a [ b ] ; +/* 1 new right-to-left right */ new b ; +/* 2 function-call left-to-right inside + left */ a ( b ) ; +/* 3 decrement n/a right-or-left */ -- b ; +/* 3 decrement n/a right-or-left */ a -- ; +/* 3 increment n/a right-or-left */ ++ b ; +/* 3 increment n/a right-or-left */ a ++ ; +/* 4 bitwise-not right-to-left right */ ~ b ; +/* 4 delete right-to-left right */ delete b ; +/* 4 logical-not right-to-left right */ ! b ; +/* 4 typeof right-to-left right */ typeof b ; +/* 4 unary-+ right-to-left right */ + b ; +/* 4 unary-negation right-to-left right */ - b ; +/* 4 void right-to-left right */ void b ; +/* 5 division left-to-right both */ a / b ; +/* 5 modulus left-to-right both */ a % b ; +/* 5 multiplication left-to-right both */ a * b ; +/* 6 addition left-to-right both */ a + b ; +/* 6 subtraction left-to-right both */ a - b ; +/* 7 bitwise-shift left-to-right both */ a << b ; +/* 7 bitwise-shift left-to-right both */ a >> b ; +/* 7 bitwise-shift left-to-right both */ a >>> b ; +/* 8 in left-to-right both */ a in b ; +/* 8 instanceof left-to-right both */ a instanceof b ; +/* 8 relational left-to-right both */ a < b ; +/* 8 relational left-to-right both */ a > b ; +/* 8 relational left-to-right both */ a <= b ; +/* 8 relational left-to-right both */ a >= b ; +/* 9 equality left-to-right both */ a != b ; +/* 9 equality left-to-right both */ a == b ; +/* 9 equality left-to-right both */ a !== b ; +/* 9 equality left-to-right both */ a === b ; +/* 10 bitwise-and left-to-right both */ a & b ; +/* 11 bitwise-xor left-to-right both */ a ^ b ; +/* 12 bitwise-or left-to-right both */ a | b ; +/* 13 logical-and left-to-right both */ a && b ; +/* 14 logical-or left-to-right both */ a || b ; +/* 15 conditional right-to-left both */ a ? b : c ; +/* 16 assignment right-to-left both */ a = b ; +/* 16 assignment right-to-left both */ a %= b ; +/* 16 assignment right-to-left both */ a &= b ; +/* 16 assignment right-to-left both */ a *= b ; +/* 16 assignment right-to-left both */ a += b ; +/* 16 assignment right-to-left both */ a -= b ; +/* 16 assignment right-to-left both */ a /= b ; +/* 16 assignment right-to-left both */ a ^= b ; +/* 16 assignment right-to-left both */ a |= b ; +/* 16 assignment right-to-left both */ a <<= b ; +/* 16 assignment right-to-left both */ a >>= b ; +/* 16 assignment right-to-left both */ a >>>= b ; +/* 17 comma left-to-right both */ a , b ; // ============== @@ -870,19 +865,19 @@ var objectName = { } labelName: while (i < 4) { - document.write(i + "
"); - i += 1; - - labelName2: - while (j > 4) { - document.write(j + "
"); - j -= 1; - if ((j % 2) == 0) - continue labelName2; - document.write(j + " is odd.
"); - } - document.write("i = " + i + "
"); - document.write("j = " + j + "
"); + document.write(i + "
"); + i += 1; + + labelName2: + while (j > 4) { + document.write(j + "
"); + j -= 1; + if ((j % 2) == 0) + continue labelName2; + document.write(j + " is odd.
"); + } + document.write("i = " + i + "
"); + document.write("j = " + j + "
"); } // Unorganized @@ -908,3 +903,110 @@ Documentation Comment (idiom) // Inline Comment +// ========== +// = Blocks = +// ========== + +/* Comment Block */ +"stringiness"; /* String */ +'stringiness'; /* String */ +/regex/; /* Regex */ +function myFunction(param1, param2){}; /* parameters */ +myFunction=function(param1, param2){}; /* parameters */ +myFunction(arg1, arg2); /* arguments */ +label: +'label': +"label": + +for(initialization;condition;update){ statements; } +for(variable in object){ statements; } + +[1, 2, 3]; /* Array */ +var myObj = { label:'value' }; /* Object Block */ +var myFunction = function(){ statements; }; /* Function Block */ +myFunction(arg1, +arg2); /* arguments on multiple lines */ + + +// =========== +// = Invalid = +// =========== + +/* Precedence Operator type Associativity Proximity */ //Individual operators ; +/* 1 member left-to-right both */ a . b ; +/* 1 member left-to-right inside + left */ a [ b ] ; +/* 1 new right-to-left right */ new b ; +/* 2 function-call left-to-right inside + left */ a ( b ) ; +/* 3 decrement n/a right-or-left */ -- b ; +/* 3 decrement n/a right-or-left */ a -- ; +/* 3 increment n/a right-or-left */ ++ b ; +/* 3 increment n/a right-or-left */ a ++ ; +/* 4 bitwise-not right-to-left right */ ~ b ; +/* 4 delete right-to-left right */ delete b ; +/* 4 logical-not right-to-left right */ ! b ; +/* 4 typeof right-to-left right */ typeof b ; +/* 4 unary-+ right-to-left right */ + b ; +/* 4 unary-negation right-to-left right */ - b ; +/* 4 void right-to-left right */ void b ; +/* 5 division left-to-right both */ a / b ; +/* 5 modulus left-to-right both */ a % b ; +/* 5 multiplication left-to-right both */ a * b ; +/* 6 addition left-to-right both */ a + b ; +/* 6 subtraction left-to-right both */ a - b ; +/* 7 bitwise-shift left-to-right both */ a << b ; +/* 7 bitwise-shift left-to-right both */ a >> b ; +/* 7 bitwise-shift left-to-right both */ a >>> b ; +/* 8 in left-to-right both */ a in b ; +/* 8 instanceof left-to-right both */ a instanceof b ; +/* 8 relational left-to-right both */ a < b ; +/* 8 relational left-to-right both */ a > b ; +/* 8 relational left-to-right both */ a <= b ; +/* 8 relational left-to-right both */ a >= b ; +/* 9 equality left-to-right both */ a != b ; +/* 9 equality left-to-right both */ a == b ; +/* 9 equality left-to-right both */ a !== b ; +/* 9 equality left-to-right both */ a === b ; +/* 10 bitwise-and left-to-right both */ a & b ; +/* 11 bitwise-xor left-to-right both */ a ^ b ; +/* 12 bitwise-or left-to-right both */ a | b ; +/* 13 logical-and left-to-right both */ a && b ; +/* 14 logical-or left-to-right both */ a || b ; +/* 15 conditional right-to-left both */ a ? b : c ; +/* 16 assignment right-to-left both */ a = b ; +/* 16 assignment right-to-left both */ a %= b ; +/* 16 assignment right-to-left both */ a &= b ; +/* 16 assignment right-to-left both */ a *= b ; +/* 16 assignment right-to-left both */ a += b ; +/* 16 assignment right-to-left both */ a -= b ; +/* 16 assignment right-to-left both */ a /= b ; +/* 16 assignment right-to-left both */ a ^= b ; +/* 16 assignment right-to-left both */ a |= b ; +/* 16 assignment right-to-left both */ a <<= b ; +/* 16 assignment right-to-left both */ a >>= b ; +/* 16 assignment right-to-left both */ a >>>= b ; +/* 17 comma left-to-right both */ a , b ; + +// SYNTAX ERROR +myVar myVar +myVar$ myVar +myVar_ myVar +myVar0 myVar + +() myVar +() _myVar +() $myVar + +00 () +A0 () //ok + +() , //ok +() ; //ok +() /*operator*/ //ok + +myVar /*both operator*/ myVar //valid +() /*both operator*/ () //valid +/*right operator*/ myVar //valid +/*right operator*/ () //valid + + + From bd303072134f40af7a8d7e10e28f016d8b0e0e5d Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Sat, 20 Sep 2008 14:57:48 -0400 Subject: [PATCH 156/243] =?UTF-8?q?Renamed=20the=20"normal"=20for=20loop?= =?UTF-8?q?=20to=20"for=20(=E2=80=A6)=20{=E2=80=A6}=20(Classic)"=20diff=20?= =?UTF-8?q?--git=20"a/Snippets/for=20(\342\200\246)=20{\342\200\246}.tmSni?= =?UTF-8?q?ppet"=20"b/Snippets/for=20(\342\200\246)=20{\342\200\246}.tmSni?= =?UTF-8?q?ppet"=20index=209001c98..c6ddbf7=20100644=20---=20"a/Snippets/f?= =?UTF-8?q?or=20(\342\200\246)=20{\342\200\246}.tmSnippet"=20+++=20"b/Snip?= =?UTF-8?q?pets/for=20(\342\200\246)=20{\342\200\246}.tmSnippet"=20@@=20-7?= =?UTF-8?q?,7=20+7,7=20@@=20=20=09${0:$1[$20]}=20=20}=20=20=09name=20-=09for=20(=E2=80=A6)=20{=E2=80=A6}=20+=09for=20(=E2=80=A6)=20{=E2=80=A6}=20(Classic)=20=20=09scope=20=20=09source.js=20=20=09tabTrigger?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "Snippets/for (\342\200\246) {\342\200\246}.tmSnippet" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/Snippets/for (\342\200\246) {\342\200\246}.tmSnippet" "b/Snippets/for (\342\200\246) {\342\200\246}.tmSnippet" index 9001c98..c6ddbf7 100644 --- "a/Snippets/for (\342\200\246) {\342\200\246}.tmSnippet" +++ "b/Snippets/for (\342\200\246) {\342\200\246}.tmSnippet" @@ -7,7 +7,7 @@ ${0:$1[$20]} } name - for (…) {…} + for (…) {…} (Classic) scope source.js tabTrigger From b19167e1c182a3fb8263449404105a9d19de8d17 Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Sun, 21 Sep 2008 04:04:09 -0400 Subject: [PATCH 157/243] Beginning README addEventListener snippet default to bubbling Updated info.plist --- README.md | 52 +++++++++++++++---- .../window_addEventListener_load.tmSnippet | 2 +- info.plist | 6 +++ 3 files changed, 48 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 3b7370e..81cd1f9 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,44 @@ -This document describes the commands of the TextMate Javascript bundle. +The Javascript Bundle +===================== -# Command Reference +Integrated Quirksmode.org Docs +------------------------------ -* **Documentation for Word / Selection** (WebView Window) - - Searches your selection in a Javascript documentation website. - -# Snippets +The DOM code completions and tooltip data were generated from +the excellent [Quirksmode W3C DOM Compatibility Tables](http://www.quirksmode.org/dom/compatibility.html "W3C DOM Compatibility Tables") by [PPK](http://quirksmode.org/blogs.shtml "QuirksMode Blogs") (used with permission). +Scraped, reformatted and converted for use in the bundle by [Thomas Aylott / subtlegradient](http://subtlegradient.com/ "subtleGradient"). -if -if ... else -for -for (in) +Code Completion +--------------- + +Code Completion as-you-type for Methods and Properties of... + +* Cross-Platform Browser Object Model API +* Cross-Platform Document Object Model API +* String, Number, Array + +### Dumb Completion + +The code completion is mostly dumb. It doesn't understand your code and just suggests the same things in almost all contexts. + +### Smart Completion + +For some things with known types, the list of completions is filtered to only include known methods and properties of that type. + +*Requires the latest cutting edge build of TextMate* + +Snippets +-------- +Cut your keystroke count in half with snippets for common javascript idioms. + + +Learn Javascript +---------------- +* [Quirksmode W3C DOM Compatibility Tables](http://www.quirksmode.org/dom/compatibility.html "W3C DOM Compatibility Tables") by [PPK](http://quirksmode.org/blogs.shtml "QuirksMode Blogs") +* [Eloquent JavaScript -- interactive tutorial](http://eloquentjavascript.net/ "Eloquent JavaScript -- interactive tutorial") +* [A re-introduction to JavaScript - MDC](http://developer.mozilla.org/en/A_re-introduction_to_JavaScript "A re-introduction to JavaScript - MDC") +* [Mozilla Javascript](http://developer.mozilla.org/En/About_JavaScript "About JavaScript - MDC") +* [Microsoft JScript](http://msdn.microsoft.com/en-us/library/72bd815a%28VS.80%29.aspx "JScript") +* [Safari JavaScript Reference](http://developer.apple.com/documentation/AppleApplications/Reference/SafariJSRef/Intro/Intro.html "Safari JavaScript Reference") +* [Web Kit DOM Programming Topics](http://developer.apple.com/documentation/AppleApplications/Conceptual/SafariJSProgTopics/ "Web Kit DOM Programming Topics") +* [JavaScript Madness: Keyboard Events](http://unixpapa.com/js/key.html "JavaScript Madness: Keyboard Events") diff --git a/Snippets/window_addEventListener_load.tmSnippet b/Snippets/window_addEventListener_load.tmSnippet index f1f4820..030676d 100644 --- a/Snippets/window_addEventListener_load.tmSnippet +++ b/Snippets/window_addEventListener_load.tmSnippet @@ -7,7 +7,7 @@ $0${TM_SELECTED_TEXT: } -},true); +},false); name window.addEventListener('load') scope diff --git a/info.plist b/info.plist index 17b9605..d820940 100644 --- a/info.plist +++ b/info.plist @@ -16,6 +16,8 @@ ------------------------------------ B4874A14-2491-465A-A349-61E4EBCF4700 ------------------------------------ + C09ABCA9-7558-4385-8E29-10E42093D8B6 + ------------------------------------ D2E6A1FE-2881-4754-B399-B65F61F29C2F 43F40EB6-5839-4BE8-99C8-4976D0534E5D 52090C49-D8B2-49A0-9597-80574354B3CD @@ -40,6 +42,7 @@ items + 5CAA9822-629C-4362-B02A-FCEF38C79BD5 C1197E58-D065-4EDC-9BAB-EB41622C1630 9E0E3BCC-7F20-4D6B-891D-A44D6EC56E31 @@ -94,6 +97,9 @@ 92D6EE80-615E-45B7-B2E2-FF5C200A8478 ------------------------------------ 3F4AB53B-210C-4E0C-8D04-12192DECC3D1 + ------------------------------------ + 65AAF33F-7706-4FC0-B5E0-E9AABEF0731E + 77750C34-3335-4766-900D-FFFF412DB7F5
name Control From bc10783ef429ed9b9cd5803a925f578d5ca02007 Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Sun, 21 Sep 2008 04:05:40 -0400 Subject: [PATCH 158/243] Code Completion with tooltips from Quirksmode.org (with permission) --- Commands/Complete.tmCommand | 25 + Preferences/Completions.tmPreferences | 1444 +++++++++++++++++ Support/Array.instance.completions.json | 8 + Support/completions.json | 14 + ...org.quirksmode.dom.events.completions.json | 89 + ...g.quirksmode.dom.w3c_core.completions.json | 62 + ...rg.quirksmode.dom.w3c_css.completions.json | 23 + ....quirksmode.dom.w3c_cssom.completions.json | 42 + ...quirksmode.dom.w3c_events.completions.json | 29 + ...g.quirksmode.dom.w3c_html.completions.json | 41 + TODO | 18 + 11 files changed, 1795 insertions(+) create mode 100644 Commands/Complete.tmCommand create mode 100644 Preferences/Completions.tmPreferences create mode 100644 Support/Array.instance.completions.json create mode 100644 Support/completions.json create mode 100644 Support/org.quirksmode.dom.events.completions.json create mode 100644 Support/org.quirksmode.dom.w3c_core.completions.json create mode 100644 Support/org.quirksmode.dom.w3c_css.completions.json create mode 100644 Support/org.quirksmode.dom.w3c_cssom.completions.json create mode 100644 Support/org.quirksmode.dom.w3c_events.completions.json create mode 100644 Support/org.quirksmode.dom.w3c_html.completions.json create mode 100644 TODO diff --git a/Commands/Complete.tmCommand b/Commands/Complete.tmCommand new file mode 100644 index 0000000..4685b40 --- /dev/null +++ b/Commands/Complete.tmCommand @@ -0,0 +1,25 @@ + + + + + beforeRunningCommand + nop + command + #!/usr/bin/env ruby +require ENV['TM_SUPPORT_PATH'] + '/lib/tm/complete' +TextMate::Complete.new.complete! + + input + none + keyEquivalent + ~ + name + Code Completion + output + showAsTooltip + scope + source.js + uuid + C09ABCA9-7558-4385-8E29-10E42093D8B6 + + diff --git a/Preferences/Completions.tmPreferences b/Preferences/Completions.tmPreferences new file mode 100644 index 0000000..5918829 --- /dev/null +++ b/Preferences/Completions.tmPreferences @@ -0,0 +1,1444 @@ + + + + + name + Completions + scope + source.js + settings + + completions + + blur + change + click + contextmenu + copy + cut + dblclick + error + focus + keydown + keypress + keyup + mousedown + mousemove + mouseout + mouseover + mouseup + mousewheel + paste + reset + resize + scroll + select + submit + DOMActivate + DOMAttrModified + DOMCharacterDataModified + DOMFocusIn + DOMFocusOut + DOMMouseScroll + DOMNodeInserted + DOMNodeRemoved + DOMSubtreeModified + textInput + activate + beforecopy + beforecut + beforepaste + deactivate + focusin + focusout + hashchange + mouseenter + mouseleave + createElement() + createTextNode() + getElementById() + getElementsByClassName() + getElementsByTagName() + querySelectorAll() + nodeName + nodeType + nodeValue + tagName + childNodes[] + children[] + firstChild + hasChildNodes() + lastChild + nextSibling + parentNode + previousSibling + sourceIndex + appendChild() + cloneNode() + insertBefore() + removeChild() + replaceChild() + appendData() + data + deleteData() + insertData() + replaceData() + substringData() + attributes[index] + attributes[key] + createAttribute() + setAttributeNode() + getAttribute() + getAttributeNode() + hasAttribute() + hasAttributes() + name + removeAttribute() + removeAttributeNode() + setAttribute() + setAttributeNode() + value + contains() + createDocument() + createDocumentFragment() + documentElement + getElementsByName() + hasFeature() + isSupported() + item() + normalize() + ownerDocument + splitText() + applyElement() + clearAttributes() + mergeAttributes() + removeNode() + replaceNode() + swapNode() + currentStyle + getComputedStyle() + style + cssRules[] + imports[] + rules[] + styleSheets[] + addRule() + deleteRule() + insertRule() + removeRule() + cssText + disabled + href + selectorText + createStyleSheet() + getPropertyPriority() + getPropertyValue() + ownerNode + parentStyleSheet + removeProperty() + setProperty() + innerWidth + innerHeight + outerWidth + outerHeight + pageXOffset + pageYOffset + screenX + screenY + availWidth + availHeight + colorDepth + pixelDepth + width + height + elementFromPoint() + getBoundingClientRect() + getClientRects() + scrollIntoView() + clientLeft + clientTop + clientWidth + clientHeight + offsetLeft + offsetTop + offsetParent + offsetWidth + offsetHeight + scrollLeft + scrollTop + scrollWidth + scrollHeight + clientX + clientY + offsetX + offsetY + pageX + pageY + screenX + screenY + x + y + currentTarget + fromElement + toElement + relatedTarget + srcElement + target + altKey + altLeft + charCode + ctrlKey + ctrlLeft + keyCode + metaKey + modifiers + repeat + shiftKey + shiftLeft + which + button + detail + timeStamp + type + wheelDelta + which + addEventListener() + attachEvent() + detachEvent() + removeEventListener() + className + dir + id + innerHTML + innerText + outerHTML + outerText + textContent + title + body + compatMode + createHTMLDocument() + defaultView + parentWindow + add() + remove() + caption + cellIndex + cellPadding + cells[] + cellSpacing + createCaption() + createTFoot() + createTHead() + deleteCaption() + deleteCell() + deleteRow() + deleteTFoot() + deleteTHead() + frame + insertCell() + insertRow() + moveRow() + rowIndex + rows[] + rules + sectionRowIndex + tBodies[] + tFoot + tHead + ADDITION + ANY_TYPE + ANY_UNORDERED_NODE_TYPE + ATTRIBUTE_NODE + AT_TARGET + Attr + Audio + Audio() + BAD_BOUNDARYPOINTS_ERR + BLUR + BOOLEAN_TYPE + BOTH + BUBBLING_PHASE + CAN_PLAY + CAN_PLAY_THROUGH + CAN_SHOW_CURRENT_FRAME + CAPTURING_PHASE + CDATASection + CDATA_SECTION_NODE + CHANGE + CHARSET_RULE + CLICK + COMMENT_NODE + CSSCharsetRule + CSSFontFaceRule + CSSImportRule + CSSMediaRule + CSSPageRule + CSSPrimitiveValue + CSSRule + CSSRuleList + CSSStyleDeclaration + CSSStyleRule + CSSStyleSheet + CSSValue + CSSValueList + CSS_ATTR + CSS_CM + CSS_COUNTER + CSS_CUSTOM + CSS_DEG + CSS_DIMENSION + CSS_EMS + CSS_EXS + CSS_GRAD + CSS_HZ + CSS_IDENT + CSS_IN + CSS_INHERIT + CSS_KHZ + CSS_MM + CSS_MS + CSS_NUMBER + CSS_PC + CSS_PERCENTAGE + CSS_PRIMITIVE_VALUE + CSS_PT + CSS_PX + CSS_RAD + CSS_RECT + CSS_RGBCOLOR + CSS_S + CSS_STRING + CSS_UNKNOWN + CSS_URI + CSS_VALUE_LIST + CharacterData + Comment + Components + Counter + DATA_UNAVAILABLE + DBLCLICK + DOCUMENT_FRAGMENT_NODE + DOCUMENT_NODE + DOCUMENT_POSITION_CONTAINED_BY + DOCUMENT_POSITION_CONTAINS + DOCUMENT_POSITION_DISCONNECTED + DOCUMENT_POSITION_FOLLOWING + DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC + DOCUMENT_POSITION_PRECEDING + DOCUMENT_TYPE_NODE + DOMException + DOMImplementation + DOMParser + DOMParser() + DOMSTRING_SIZE_ERR + DRAGDROP + Document + DocumentFragment + DocumentType + ELEMENT_NODE + EMPTY + END_TO_END + END_TO_START + ENTITY_NODE + ENTITY_REFERENCE_NODE + Element + Entity + EntityReference + EvalError() + Event + EventException + FILTER_ACCEPT + FILTER_REJECT + FILTER_SKIP + FIRST_ORDERED_NODE_TYPE + FOCUS + FONT_FACE_RULE + HIERARCHY_REQUEST_ERR + HORIZONTAL + HTMLAnchorElement + HTMLAppletElement + HTMLAreaElement + HTMLAudioElement + HTMLBRElement + HTMLBaseElement + HTMLBaseFontElement + HTMLBlockquoteElement + HTMLBodyElement + HTMLButtonElement + HTMLCanvasElement + HTMLDListElement + HTMLDirectoryElement + HTMLDivElement + HTMLDocument + HTMLElement + HTMLEmbedElement + HTMLFieldSetElement + HTMLFontElement + HTMLFormElement + HTMLFrameElement + HTMLFrameSetElement + HTMLHRElement + HTMLHeadElement + HTMLHeadingElement + HTMLHtmlElement + HTMLIFrameElement + HTMLImageElement + HTMLInputElement + HTMLIsIndexElement + HTMLLIElement + HTMLLabelElement + HTMLLegendElement + HTMLLinkElement + HTMLMapElement + HTMLMarqueeElement + HTMLMediaElement + HTMLMenuElement + HTMLMetaElement + HTMLModElement + HTMLOListElement + HTMLObjectElement + HTMLOptGroupElement + HTMLOptionElement + HTMLParagraphElement + HTMLParamElement + HTMLPreElement + HTMLQuoteElement + HTMLScriptElement + HTMLSelectElement + HTMLStyleElement + HTMLTableCaptionElement + HTMLTableCellElement + HTMLTableColElement + HTMLTableElement + HTMLTableRowElement + HTMLTableSectionElement + HTMLTextAreaElement + HTMLTitleElement + HTMLUListElement + HTMLVideoElement + IMPORT_RULE + INDEX_SIZE_ERR + INUSE_ATTRIBUTE_ERR + INVALID_ACCESS_ERR + INVALID_CHARACTER_ERR + INVALID_EXPRESSION_ERR + INVALID_MODIFICATION_ERR + INVALID_NODE_TYPE_ERR + INVALID_STATE_ERR + Image + Image() + ImageData() + KEYDOWN + KEYPRESS + KEYUP + KeyboardEvent + LENGTHADJUST_SPACING + LENGTHADJUST_SPACINGANDGLYPHS + LENGTHADJUST_UNKNOWN + LOADED + LOADED_FIRST_FRAME + LOADED_METADATA + LOADING + MEDIA_ERR_ABORTED + MEDIA_ERR_DECODE + MEDIA_ERR_NETWORK + MEDIA_RULE + MODE_ASYNCHRONOUS + MODE_SYNCHRONOUS + MODIFICATION + MOUSEDOWN + MOUSEDRAG + MOUSEMOVE + MOUSEOUT + MOUSEOVER + MOUSEUP + MediaError + MediaList + MouseEvent + MutationEvent + NAMESPACE_ERR + NETWORK_ERR + NODE_AFTER + NODE_BEFORE + NODE_BEFORE_AND_AFTER + NODE_INSIDE + NOTATION_NODE + NOT_FOUND_ERR + NOT_SUPPORTED_ERR + NO_DATA_ALLOWED_ERR + NO_MODIFICATION_ALLOWED_ERR + NUMBER_TYPE + NamedNodeMap + Node + NodeFilter + NodeList + Notation + ORDERED_NODE_ITERATOR_TYPE + ORDERED_NODE_SNAPSHOT_TYPE + Option + Option() + OverflowEvent + PAGE_RULE + PATHSEG_ARC_ABS + PATHSEG_ARC_REL + PATHSEG_CLOSEPATH + PATHSEG_CURVETO_CUBIC_ABS + PATHSEG_CURVETO_CUBIC_REL + PATHSEG_CURVETO_CUBIC_SMOOTH_ABS + PATHSEG_CURVETO_CUBIC_SMOOTH_REL + PATHSEG_CURVETO_QUADRATIC_ABS + PATHSEG_CURVETO_QUADRATIC_REL + PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS + PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL + PATHSEG_LINETO_ABS + PATHSEG_LINETO_HORIZONTAL_ABS + PATHSEG_LINETO_HORIZONTAL_REL + PATHSEG_LINETO_REL + PATHSEG_LINETO_VERTICAL_ABS + PATHSEG_LINETO_VERTICAL_REL + PATHSEG_MOVETO_ABS + PATHSEG_MOVETO_REL + PATHSEG_UNKNOWN + PROCESSING_INSTRUCTION_NODE + Packages + ProcessingInstruction + ProgressEvent + QueryInterface() + REMOVAL + RENDERING_INTENT_ABSOLUTE_COLORIMETRIC + RENDERING_INTENT_AUTO + RENDERING_INTENT_PERCEPTUAL + RENDERING_INTENT_RELATIVE_COLORIMETRIC + RENDERING_INTENT_SATURATION + RENDERING_INTENT_UNKNOWN + Range + RangeError() + RangeException + Rect + ReferenceError() + RegExp + SELECT + SHOW_ALL + SHOW_ATTRIBUTE + SHOW_CDATA_SECTION + SHOW_COMMENT + SHOW_DOCUMENT + SHOW_DOCUMENT_FRAGMENT + SHOW_DOCUMENT_TYPE + SHOW_ELEMENT + SHOW_ENTITY + SHOW_ENTITY_REFERENCE + SHOW_NOTATION + SHOW_PROCESSING_INSTRUCTION + SHOW_TEXT + START_TO_END + START_TO_START + STRING_TYPE + STYLE_RULE + SVGAngle + SVGColor + SVGException + SVGGradientElement + SVGLength + SVGMarkerElement + SVGPaint + SVGPathSeg + SVGPreserveAspectRatio + SVGRenderingIntent + SVGTextContentElement + SVGTextPathElement + SVGTransform + SVGUnitTypes + SVGUnitTypes() + SVGZoomAndPan() + SVG_ANGLETYPE_DEG + SVG_ANGLETYPE_GRAD + SVG_ANGLETYPE_RAD + SVG_ANGLETYPE_UNKNOWN + SVG_ANGLETYPE_UNSPECIFIED + SVG_COLORTYPE_CURRENTCOLOR + SVG_COLORTYPE_RGBCOLOR + SVG_COLORTYPE_RGBCOLOR_ICCCOLOR + SVG_COLORTYPE_UNKNOWN + SVG_INVALID_VALUE_ERR + SVG_LENGTHTYPE_CM + SVG_LENGTHTYPE_EMS + SVG_LENGTHTYPE_EXS + SVG_LENGTHTYPE_IN + SVG_LENGTHTYPE_MM + SVG_LENGTHTYPE_NUMBER + SVG_LENGTHTYPE_PC + SVG_LENGTHTYPE_PERCENTAGE + SVG_LENGTHTYPE_PT + SVG_LENGTHTYPE_PX + SVG_LENGTHTYPE_UNKNOWN + SVG_MARKERUNITS_STROKEWIDTH + SVG_MARKERUNITS_UNKNOWN + SVG_MARKERUNITS_USERSPACEONUSE + SVG_MARKER_ORIENT_ANGLE + SVG_MARKER_ORIENT_AUTO + SVG_MARKER_ORIENT_UNKNOWN + SVG_MATRIX_NOT_INVERTABLE + SVG_MEETORSLICE_MEET + SVG_MEETORSLICE_SLICE + SVG_MEETORSLICE_UNKNOWN + SVG_PAINTTYPE_CURRENTCOLOR + SVG_PAINTTYPE_NONE + SVG_PAINTTYPE_RGBCOLOR + SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR + SVG_PAINTTYPE_UNKNOWN + SVG_PAINTTYPE_URI + SVG_PAINTTYPE_URI_CURRENTCOLOR + SVG_PAINTTYPE_URI_NONE + SVG_PAINTTYPE_URI_RGBCOLOR + SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR + SVG_PRESERVEASPECTRATIO_NONE + SVG_PRESERVEASPECTRATIO_UNKNOWN + SVG_PRESERVEASPECTRATIO_XMAXYMAX + SVG_PRESERVEASPECTRATIO_XMAXYMID + SVG_PRESERVEASPECTRATIO_XMAXYMIN + SVG_PRESERVEASPECTRATIO_XMIDYMAX + SVG_PRESERVEASPECTRATIO_XMIDYMID + SVG_PRESERVEASPECTRATIO_XMIDYMIN + SVG_PRESERVEASPECTRATIO_XMINYMAX + SVG_PRESERVEASPECTRATIO_XMINYMID + SVG_PRESERVEASPECTRATIO_XMINYMIN + SVG_SPREADMETHOD_PAD + SVG_SPREADMETHOD_REFLECT + SVG_SPREADMETHOD_REPEAT + SVG_SPREADMETHOD_UNKNOWN + SVG_TRANSFORM_MATRIX + SVG_TRANSFORM_ROTATE + SVG_TRANSFORM_SCALE + SVG_TRANSFORM_SKEWX + SVG_TRANSFORM_SKEWY + SVG_TRANSFORM_TRANSLATE + SVG_TRANSFORM_UNKNOWN + SVG_UNIT_TYPE_OBJECTBOUNDINGBOX + SVG_UNIT_TYPE_UNKNOWN + SVG_UNIT_TYPE_USERSPACEONUSE + SVG_WRONG_TYPE_ERR + SYNTAX_ERR + StyleSheet + StyleSheetList + SyntaxError() + TEXTPATH_METHODTYPE_ALIGN + TEXTPATH_METHODTYPE_STRETCH + TEXTPATH_METHODTYPE_UNKNOWN + TEXTPATH_SPACINGTYPE_AUTO + TEXTPATH_SPACINGTYPE_EXACT + TEXTPATH_SPACINGTYPE_UNKNOWN + TEXT_NODE + TYPE_ERR + TYPE_MISMATCH_ERR + Text + TextEvent + TypeError() + UIEvent + UNKNOWN_RULE + UNORDERED_NODE_ITERATOR_TYPE + UNORDERED_NODE_SNAPSHOT_TYPE + UNSPECIFIED_EVENT_TYPE_ERR + URIError() + URL + URLUnencoded + VALIDATION_ERR + VERTICAL + WRONG_DOCUMENT_ERR + WheelEvent + XMLDocument + XMLHttpRequest + XMLHttpRequest() + XMLHttpRequestException + XMLSerializer + XMLSerializer() + XPCNativeWrapper() + XPCSafeJSObjectWrapper() + XPathEvaluator + XPathEvaluator() + XPathException + XPathResult + XSLTProcessor + XSLTProcessor() + abort() + accelerator + acceptNode() + accessKey + activeElement + add() + addBinding() + addEventListener() + addEventSource() + addEventStream() + addmodule() + adoptNode() + alert() + alinkColor + all + anchors + appCodeName + appMinorVersion + appName + appVersion + appendChild() + appendController() + appendData() + appendMedium() + applets + applicationCache + assign() + atob() + atomic + attachEvent() + attributes + availHeight + availLeft + availTop + availWidth + back() + background + backgroundAttachment + backgroundColor + backgroundImage + backgroundPosition + backgroundPositionX + backgroundPositionY + backgroundRepeat + baseURI + behavior + behaviorUrns + bgColor + blur() + body + border + borderBottom + borderBottomColor + borderBottomStyle + borderBottomWidth + borderCollapse + borderColor + borderLeft + borderLeftColor + borderLeftStyle + borderLeftWidth + borderRight + borderRightColor + borderRightStyle + borderRightWidth + borderStyle + borderTop + borderTopColor + borderTopStyle + borderTopWidth + borderWidth + bottom + browserLanguage + btoa() + buildID + buildNumber() + canHaveChildren + canHaveHTML + captureEvents() + characterSet + charset + childNodes + children + className + clear + clear() + clearInterval() + clearParameters() + clearTimeout() + click() + clientHeight + clientInformation + clientLeft + clientTop + clientWidth + clip + clipboardData + cloneNode() + close() + closed + collect() + color + colorDepth + compareDocumentPosition() + compatMode + confirm() + connect() + console + constructor() + contains() + content + contentEditable + contentType + controllers + convertToSpecifiedUnits() + cookie + cookieEnabled + cpuClass + createAttribute() + createAttributeNS() + createCDATASection() + createCSSStyleSheet() + createCaption() + createComment() + createDocument() + createDocumentFragment() + createDocumentType() + createElement() + createElementNS() + createEntityReference() + createEvent() + createExpression() + createHTMLDocument() + createHTTPRequest() + createLSInput() + createLSOutput() + createLSParser() + createLSSerializer() + createNSResolver() + createNodeIterator() + createProcessingInstruction() + createRange() + createTFoot() + createTHead() + createTextNode() + createTreeWalker() + crypto + cssText + current + currentStyle + cursor + data + defaultCharset + defaultStatus + defaultView + defaultstatus + defineMagicFunction() + defineMagicVariable() + deleteCaption() + deleteCell() + deleteData() + deleteMedium() + deleteRow() + deleteRule() + deleteTFoot() + deleteTHead() + deletemodule() + description + designMode + detachEvent() + devicePixelRatio + dir + direction + directories + disableExternalCapture() + disableRightClick() + disabled + disconnect() + dispatchEvent() + display + doctype + document + documentElement + documentURI + document["frames[object WindowCollection]"] + domConfig + domain + dump() + elementFromPoint() + embeds + enableExternalCapture() + enableSmartCardEvents + enableStyleSheetsForSet() + entities + error() + evaluate() + event + execCommand() + execCommandShowHelp() + external + fgColor + fileCreatedDate + fileModifiedDate + fileSize + fileUpdatedDate + filename + filter + filters + find() + firstChild + focus() + font + fontFamily + fontSize + fontStyle + fontVariant + fontWeight + forms + forward() + frameElement + frames + fullScreen + generateCRMFRequest() + getAllResponseHeaders() + getAnonymousElementByAttribute() + getAnonymousNodes() + getAttribute() + getAttributeNS() + getAttributeNode() + getAttributeNodeNS() + getBindingParent() + getBoxObjectFor() + getCharNumAtPosition() + getComputedStyle() + getComputedTextLength() + getContext() + getControllerAt() + getControllerById() + getControllerCount() + getControllerForCommand() + getControllerId() + getCounterValue() + getElementById() + getElementsByClassName() + getElementsByName() + getElementsByTagName() + getElementsByTagNameNS() + getEndPositionOfChar() + getExtentOfChar() + getFeature() + getFloatValue() + getInterface() + getMatchedCSSRules() + getNamedItem() + getNamedItemNS() + getNumberOfChars() + getOverrideHistoryNavigationMode() + getOverrideStyle() + getParameter() + getPreference() + getPreferenceDefault() + getPresentationAttribute() + getPropertyCSSValue() + getPropertyPriority() + getPropertyShorthand() + getPropertyValue() + getRGBColorValue() + getRectValue() + getResponseHeader() + getRotationOfChar() + getSVGDocument() + getSelection() + getStartPositionOfChar() + getStringValue() + getSubStringLength() + getUserData() + globalStorage + go() + hasAttribute() + hasAttributeNS() + hasAttributes() + hasChildNodes() + hasExtension() + hasFeature() + hasFocus() + hash + height + hideFocus + history + home() + host + hostname + href + id + images + imeMode + implementation + importNode() + importStylesheet() + importUserCertificates() + info() + initEvent() + initKeyboardEvent() + initMouseEvent() + initMutationEvent() + initOverflowEvent() + initProgressEvent() + initTextEvent() + initUIEvent() + innerHTML + innerHeight + innerText + innerWidth + input + inputEncoding + insertAdjacentElement() + insertBefore() + insertCell() + insertControllerAt() + insertData() + insertRow() + insertRule() + internalSubset + isConnected() + isContentEditable + isDefaultNamespace() + isDisabled + isEqualNode() + isMultiLine + isPropertyImplicit() + isSameNode() + isSupported() + isTextEdit + item() + iterateNext() + java + javaEnabled() + lang + language + lastChild + lastMatch + lastModified + lastParen + lastStyleSheetSet + layoutFlow + layoutGrid + layoutGridChar + layoutGridLine + layoutGridMode + layoutGridType + left + leftContext + length + letterSpacing + lineBreak + lineHeight + linkColor + links + listStyle + listStyleImage + listStylePosition + listStyleType + load() + loadBindingDocument() + localName + location + locationbar + log() + logout() + lookupNamespaceURI() + lookupPrefix() + margin + marginBottom + marginLeft + marginRight + marginTop + maxHeight + maxWidth + media + menubar + mimeType + mimeTypes + minHeight + minWidth + moveBy() + moveFocusDown() + moveFocusLeft() + moveFocusRight() + moveFocusUp() + moveTo() + mozIsLocallyAvailable() + msInterpolationMode + multiline + name + nameProp + namedItem() + namespaceURI + namespaces + navigate() + navigationMode + navigator + netscape + newValueSpecifiedUnits() + new_object_name + nextSibling + nodeName + nodeType + nodeValue + normalize() + normalizeDocument() + notations + object_proto + offscreenBuffering + offsetHeight + offsetLeft + offsetParent + offsetTop + offsetWidth + onLine + onabort + onactivate + onafterprint + onafterupdate + onbeforeactivate + onbeforecopy + onbeforecut + onbeforedeactivate + onbeforeeditfocus + onbeforepaste + onbeforeprint + onbeforeunload + onbeforeupdate + onblur + oncellchange + onchange + onclick + oncontextmenu + oncontrolselect + oncopy + oncut + ondataavailable + ondatasetchanged + ondatasetcomplete + ondblclick + ondeactivate + ondrag + ondragend + ondragenter + ondragleave + ondragover + ondragstart + ondrop + onerror + onerrorupdate + onfilterchange + onfocus + onfocusin + onfocusout + onhelp + onkeydown + onkeypress + onkeyup + onlayoutcomplete + onload + onlosecapture + onmousedown + onmouseenter + onmouseleave + onmousemove + onmouseout + onmouseover + onmouseup + onmousewheel + onmove + onmoveend + onmovestart + onpage + onpaste + onpropertychange + onreadystatechange + onreset + onresize + onresizeend + onresizestart + onrowenter + onrowexit + onrowsdelete + onrowsinserted + onscroll + onsearch + onselect + onselectionchange + onselectstart + onstop + onsubmit + onunload + open() + openDatabase() + openDialog() + opener + opera + opsProfile + oscpu + outerHTML + outerHeight + outerText + outerWidth + overflow + overflowX + overflowY + overrideMimeType() + ownerDocument + padding + paddingBottom + paddingLeft + paddingRight + paddingTop + pageBreakAfter + pageBreakBefore + pageXOffset + pageYOffset + parent + parentElement + parentNode + parentTextEdit + parentWindow + parseFromString() + pathname + pause() + personalbar + pixelDepth + pkcs11 + platform + play() + plugins + plugins["0"] + plugins["1"] + plugins["2"] + plugins["3"] + popChallengeResponse() + port + posBottom + posHeight + posLeft + posRight + posTop + posWidth + position + postError() + postMessage() + preference() + preferredStyleSheetSet + preferredStylesheetSet + prefix + preventDefault() + previousSibling + print() + product + productSub + prompt() + protocol + prototype + publicId + queryCommandEnabled() + queryCommandIndeterm() + queryCommandState() + queryCommandSupported() + queryCommandText() + queryCommandValue() + querySelector() + querySelectorAll() + random() + readyState + recordNumber + referrer + refresh() + registerContentHandler() + registerProtocolHandler() + releaseEvents() + reload() + remove() + removeAttribute() + removeAttributeNS() + removeAttributeNode() + removeBinding() + removeChild() + removeController() + removeControllerAt() + removeEventListener() + removeEventSource() + removeEventStream() + removeNamedItem() + removeNamedItemNS() + removeParameter() + removeProperty() + renameNode() + replace() + replaceChild() + replaceData() + reset() + resizeBy() + resizeTo() + right + rightContext + routeEvent() + rubyAlign + rubyOverhang + rubyPosition + runtimeStyle + scopeName + screen + screenLeft + screenTop + screenX + screenY + scripts + scroll() + scrollBy() + scrollByLines() + scrollByPages() + scrollHeight + scrollIntoView() + scrollIntoViewIfNeeded() + scrollLeft + scrollMaxX + scrollMaxY + scrollTo() + scrollTop + scrollWidth + scrollX + scrollY + scrollbar3dLightColor + scrollbarArrowColor + scrollbarBaseColor + scrollbarDarkShadowColor + scrollbarFaceColor + scrollbarHighlightColor + scrollbarShadowColor + scrollbarTrackColor + scrollbars + search + security + securityPolicy + select() + selectNodes() + selectSingleNode() + selectSubString() + selectedStyleSheetSet + selectedStylesheetSet + selection + self + send() + serializeToString() + sessionStorage + setAttribute() + setAttributeNS() + setAttributeNode() + setAttributeNodeNS() + setColor() + setDocument() + setFloatValue() + setInterval() + setMatrix() + setNamedItem() + setNamedItemNS() + setOrientToAngle() + setOrientToAuto() + setOverrideHistoryNavigationMode() + setPaint() + setParameter() + setPreference() + setProperty() + setRGBColor() + setRGBColorICCColor() + setRequestHeader() + setResizable() + setRotate() + setScale() + setSelectionRange() + setSkewX() + setSkewY() + setStringValue() + setTimeout() + setTranslate() + setUri() + setUserData() + showModalDialog() + signText() + sizeToContent() + snapshotItem() + sourceIndex + splitText() + start() + status + statusbar + stop() + stopPropagation() + strictErrorChecking + style + styleFloat + styleSheetSets + styleSheets + submit() + substringData() + sun + systemId + systemLanguage + tabIndex + tableLayout + tagName + tagUrn + taintEnabled() + text + textAlign + textAlignLast + textAutospace + textContent + textDecoration + textDecorationBlink + textDecorationLineThrough + textDecorationNone + textDecorationOverline + textDecorationUnderline + textIndent + textJustify + textJustifyTrim + textKashida + textKashidaSpace + textOverflow + textTransform + textUnderlinePosition + title + toString() + toolbar + top + transformToDocument() + transformToFragment() + unicodeBidi + updateCommands() + userAgent + userLanguage + userProfile + valueOf() + vendor + vendorSub + version + version() + verticalAlign + visibility + visible + vlinkColor + warn() + whiteSpace + width + window + wordBreak + wordSpacing + wordWrap + write() + writeln() + writingMode + xmlEncoding + xmlStandalone + xmlVersion + zIndex + zoom + + shellVariables + + + name + TM_COMPLETIONS_FILES + value + "completions.json" "Array.instance.completions.json" "org.quirksmode.dom.w3c_core.completions.json" "org.quirksmode.dom.w3c_html.completions.json" "org.quirksmode.dom.w3c_css.completions.json" "org.quirksmode.dom.w3c_cssom.completions.json" "org.quirksmode.dom.w3c_events.completions.json" "org.quirksmode.dom.events.completions.json" + + + + uuid + CB7ACED9-DA02-4A85-A75B-D9D8527CF5C9 + + diff --git a/Support/Array.instance.completions.json b/Support/Array.instance.completions.json new file mode 100644 index 0000000..bd654c9 --- /dev/null +++ b/Support/Array.instance.completions.json @@ -0,0 +1,8 @@ +{ + "suggestions": [ + { "image":"Array", "display": "constructor", "match": "constructor", "tool_tip": "Specifies the function that creates an object's prototype." }, + { "image":"Array", "display": "index", "match": "index", "tool_tip": "This is pseudo-property of Array prototypes because it is not inherited by default. It is, in fact, only present in arrays created by regular expression matches. The property represents the zero-based index of the match in the string." }, + { "image":"Array", "display": "input", "match": "input", "tool_tip": "This property is only present in arrays created by regular expression matches. It reflects the original string against which the regular expression was matched." }, + { "image":"Array", "display": "length", "match": "length", "tool_tip": "Reflects the number of elements in an array." } + ] +} diff --git a/Support/completions.json b/Support/completions.json new file mode 100644 index 0000000..a27586d --- /dev/null +++ b/Support/completions.json @@ -0,0 +1,14 @@ +{ + "extra_chars": "_$", + "images": { + "String" : "String.png", + "RegExp" : "RegExp.png", + "Number" : "Number.png", + "Array" : "Array.png", + "Function": "Function.png", + "Object" : "Object.png", + "Node" : "Node.png", + "NodeList": "NodeList.png", + "mixed" : "mixed.png" + } +} diff --git a/Support/org.quirksmode.dom.events.completions.json b/Support/org.quirksmode.dom.events.completions.json new file mode 100644 index 0000000..7673886 --- /dev/null +++ b/Support/org.quirksmode.dom.events.completions.json @@ -0,0 +1,89 @@ +{"tool_tip_prefix":" + CSS +end + +print <<-HTML + + + + +HTML + +__END__ diff --git a/Tests/run_js.test.js b/Tests/run_js.test.js new file mode 100644 index 0000000..a426205 --- /dev/null +++ b/Tests/run_js.test.js @@ -0,0 +1,25 @@ +// Relative Paths +// @require 'relative_path.js'; +// @require 'relative_path.css'; + +// Urls +// @require 'http://ajax.googleapis.com/ajax/libs/mootools/1.2.1/mootools.js'; + +// Libraries +// @require 'mootools'; +// @require 'jsspec'; + +window.alert('alerts') + +window.confirm('confirms') + ? window.alert('confirmed') + : window.alert('not confirmed') +; + +try{throw {}}catch(e){ console.log(e.line); }; FRED++ + + + + + + From 1e3869017a1a2e29a01425c13ecc8f835ad07c2e Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Fri, 17 Apr 2009 17:41:53 -0400 Subject: [PATCH 208/243] many snippets for common idioms --- .../Google AJAX Libs: MooTools 1_2_1.tmSnippet | 14 ++++++++++++++ Snippets/console_assert.tmSnippet | 16 ++++++++++++++++ Snippets/console_log.tmSnippet | 16 ++++++++++++++++ ... (\342\200\246) {\342\200\246} 2.tmSnippet" | 18 ++++++++++++++++++ Snippets/if !null.tmSnippet | 16 ++++++++++++++++ Snippets/if !undefined.tmSnippet | 16 ++++++++++++++++ Snippets/if.tmSnippet | 5 +---- info.plist | 15 +++++++++++++-- 8 files changed, 110 insertions(+), 6 deletions(-) create mode 100644 Snippets/Google AJAX Libs: MooTools 1_2_1.tmSnippet create mode 100644 Snippets/console_assert.tmSnippet create mode 100644 Snippets/console_log.tmSnippet create mode 100644 "Snippets/for (\342\200\246) {\342\200\246} 2.tmSnippet" create mode 100644 Snippets/if !null.tmSnippet create mode 100644 Snippets/if !undefined.tmSnippet diff --git a/Snippets/Google AJAX Libs: MooTools 1_2_1.tmSnippet b/Snippets/Google AJAX Libs: MooTools 1_2_1.tmSnippet new file mode 100644 index 0000000..ea24145 --- /dev/null +++ b/Snippets/Google AJAX Libs: MooTools 1_2_1.tmSnippet @@ -0,0 +1,14 @@ + + + + + content + http://ajax.googleapis.com/ajax/libs/mootools/1.2.1/mootools.js + name + Google AJAX Libs: MooTools 1.2.1 + tabTrigger + moo + uuid + B914AE71-B1B3-48A1-A4AE-6E5F9425C3B6 + + diff --git a/Snippets/console_assert.tmSnippet b/Snippets/console_assert.tmSnippet new file mode 100644 index 0000000..2e9461d --- /dev/null +++ b/Snippets/console_assert.tmSnippet @@ -0,0 +1,16 @@ + + + + + content + console.assert(${10:false}, '${100:Should $110}');$0 + name + console.assert + scope + source.js + tabTrigger + a + uuid + 19479745-D001-4EB3-8A66-6679C2273C58 + + diff --git a/Snippets/console_log.tmSnippet b/Snippets/console_log.tmSnippet new file mode 100644 index 0000000..a0e0741 --- /dev/null +++ b/Snippets/console_log.tmSnippet @@ -0,0 +1,16 @@ + + + + + content + console.log($0) + name + console.log + scope + source.js + tabTrigger + l + uuid + A1E0F62C-CE89-4F5A-93F9-B6F1A36A4784 + + diff --git "a/Snippets/for (\342\200\246) {\342\200\246} 2.tmSnippet" "b/Snippets/for (\342\200\246) {\342\200\246} 2.tmSnippet" new file mode 100644 index 0000000..9bbdf11 --- /dev/null +++ "b/Snippets/for (\342\200\246) {\342\200\246} 2.tmSnippet" @@ -0,0 +1,18 @@ + + + + + content + for (${1:before_all}; ${2:test_before_each}; ${3:after_each}) { + ${0:// statement} +} + name + for (…) {…} + scope + source.js + tabTrigger + for + uuid + 6976CD86-07BB-4419-BE5E-10F60944DB1A + + diff --git a/Snippets/if !null.tmSnippet b/Snippets/if !null.tmSnippet new file mode 100644 index 0000000..bfbfd25 --- /dev/null +++ b/Snippets/if !null.tmSnippet @@ -0,0 +1,16 @@ + + + + + content + if (${1:${TM_SELECTED_TEXT:myVar}} != null) $0 + name + if !null + scope + source.js + tabTrigger + ifn + uuid + 75783526-1546-4967-B37B-5CDA089593B3 + + diff --git a/Snippets/if !undefined.tmSnippet b/Snippets/if !undefined.tmSnippet new file mode 100644 index 0000000..ff2a9be --- /dev/null +++ b/Snippets/if !undefined.tmSnippet @@ -0,0 +1,16 @@ + + + + + content + if (typeof ${1:${TM_SELECTED_TEXT:myVar}} != 'undefined') $0 + name + if !undefined + scope + source.js + tabTrigger + ifu + uuid + 2831C11D-1907-4BC1-9A4D-BEE70EAFD0CF + + diff --git a/Snippets/if.tmSnippet b/Snippets/if.tmSnippet index 4535475..711ce3c 100644 --- a/Snippets/if.tmSnippet +++ b/Snippets/if.tmSnippet @@ -3,10 +3,7 @@ content - ${100:if (${1:true}) { -${0:${TM_SELECTED_TEXT: -}}\}; -} + if (${1:true}) {${0:${TM_SELECTED_TEXT:}}} keyEquivalent ^W name diff --git a/info.plist b/info.plist index 0c62223..71ff687 100644 --- a/info.plist +++ b/info.plist @@ -29,6 +29,9 @@ ------------------------------------ 20E61C43-B81F-4FB9-9362-BFFE668EB9C9 36EC03E9-EFF4-479A-AB90-8DFA16800642 + 3DAB45A8-21C8-4581-809B-2D3C1E8FF1B0 + 092B230D-ACAB-4C38-B2E4-F7E013C7CDCB + A1E0F62C-CE89-4F5A-93F9-B6F1A36A4784 submenus @@ -95,6 +98,7 @@ F19F3732-39A7-48EC-A72B-A8F477A01795 31964029-9D71-4ADC-8213-DFE5C4E222B3 ------------------------------------ + 6976CD86-07BB-4419-BE5E-10F60944DB1A 011C4681-FBEC-4891-9326-3DECFCDED6D6 C207B7C3-5597-4873-8AAD-C46FB8842AF2 9BF3315C-88FF-46A1-89E1-9A5E9EAC78D0 @@ -140,6 +144,9 @@ 0D2D03B9-F18B-4D9D-A960-716FDEC35331 BC062860-3346-4D3B-8421-C5543F83D11F EA26235D-2A24-4ED4-8BC2-5424B9E80CFF + D061BCDC-FD43-4E90-BA2C-104999A6E7BA + 19479745-D001-4EB3-8A66-6679C2273C58 + 3D646DE2-D2E6-4790-862F-F53EF26A0F07 C09ABCA9-7558-4385-8E29-10E42093D8B6 44006EE0-7476-418F-B8F3-D98F21A22DF6 EB00F356-06C8-4267-8226-AA8F3943E5B1 @@ -163,7 +170,9 @@ 73557394-4F0F-4DD3-8029-EEE8201AC7F5 51841DDB-C2A4-461C-A8AB-6C124AD50EAE F19F3732-39A7-48EC-A72B-A8F477A01795 + 04489CA2-2E85-4839-B929-1A22AD8DF7B7 31964029-9D71-4ADC-8213-DFE5C4E222B3 + 6976CD86-07BB-4419-BE5E-10F60944DB1A 011C4681-FBEC-4891-9326-3DECFCDED6D6 C207B7C3-5597-4873-8AAD-C46FB8842AF2 9BF3315C-88FF-46A1-89E1-9A5E9EAC78D0 @@ -181,8 +190,10 @@ 65AAF33F-7706-4FC0-B5E0-E9AABEF0731E 77750C34-3335-4766-900D-FFFF412DB7F5 9655FB2D-E7ED-4189-9050-6F5B5D305975 - 7B9AEFCC-B450-416D-8527-430FE2A08568 - AD506BEC-B33C-4168-A900-0A4D386A4B05 + A1E0F62C-CE89-4F5A-93F9-B6F1A36A4784 + B914AE71-B1B3-48A1-A4AE-6E5F9425C3B6 + 75783526-1546-4967-B37B-5CDA089593B3 + 2831C11D-1907-4BC1-9A4D-BEE70EAFD0CF uuid AAB4FD74-73F9-11D9-B89A-000D93589AF6 From f7d792a102c5f5a8f8e6b82a3bfa770cf29f04d5 Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Fri, 17 Apr 2009 17:42:50 -0400 Subject: [PATCH 209/243] Moved complete inside the bundle for those without the latest review support --- Commands/Complete.tmCommand | 2 +- ... for Word : Selection (tool tip).tmCommand | 2 +- Support/lib/current_word.rb | 176 ++++++ Support/lib/tm/complete.rb | 501 ++++++++++++++++++ 4 files changed, 679 insertions(+), 2 deletions(-) create mode 100644 Support/lib/current_word.rb create mode 100644 Support/lib/tm/complete.rb diff --git a/Commands/Complete.tmCommand b/Commands/Complete.tmCommand index b1cc7ef..2b5fe25 100644 --- a/Commands/Complete.tmCommand +++ b/Commands/Complete.tmCommand @@ -6,7 +6,7 @@ nop command #!/usr/bin/env ruby -require ENV['TM_SUPPORT_PATH'] + '/lib/tm/complete' +require ENV['TM_BUNDLE_SUPPORT'] + '/lib/tm/complete' TextMate::Complete.new.complete! input diff --git a/Commands/Documentation for Word : Selection (tool tip).tmCommand b/Commands/Documentation for Word : Selection (tool tip).tmCommand index 28a263b..239ac9b 100644 --- a/Commands/Documentation for Word : Selection (tool tip).tmCommand +++ b/Commands/Documentation for Word : Selection (tool tip).tmCommand @@ -6,7 +6,7 @@ nop command #!/usr/bin/env ruby -require ENV['TM_SUPPORT_PATH'] + '/lib/tm/complete' +require ENV['TM_BUNDLE_SUPPORT'] + '/lib/tm/complete' TextMate::Complete.new.tip! fallbackInput diff --git a/Support/lib/current_word.rb b/Support/lib/current_word.rb new file mode 100644 index 0000000..84d97c7 --- /dev/null +++ b/Support/lib/current_word.rb @@ -0,0 +1,176 @@ +# When creating a custom regex for Word.current_word, you need to keep a few things in mind: +# The regex matches from your caret, so your caret position will always be the beginning of the line +# Everything before your caret is reversed for the match, so the left of your caret will also match your caret position as ^ +# You must use a capture group () for the text you're trying to match +# You must use a capture group () for the text before/after your match +# +# EG: /(^[a-z]*)(.*$)/ +# The first capture group in that regex will match from your caret out until it can't find anymore lowercase letters. +# Then it'll match everything else in the line as the before/after match part. +# You can currently only use a single regex to match before and after your caret. +# +# Since your regex matches what's before your caret in reverse, you'll have to reverse specific stuff in your regex, eg: +# /(.*):/ wouldn't match 'color' in ` color: `, but /:(.*)/ would. +# It's reversed you see +# +module Word + def self.current_word(pat='a-zA-Z0-9', direction=:both) + word = ENV['TM_SELECTED_TEXT'] + + if word.nil? or word.empty? + line, col = ENV['TM_CURRENT_LINE'], ENV['TM_LINE_INDEX'].to_i + + if pat.kind_of? Regexp + @reg = pat + else + @reg = /(^[#{pat}]*)(.*$\r?\n?)/ + end + + left, before_match = *( line[0...col].reverse.match(@reg) ||[])[1..2] + right, after_match = *( line[col..-1] .match(@reg) ||[])[1..2] + + (before_match||='').reverse! + (left||='').reverse! + + # p before_match, left, right, after_match + + case direction + when :both then word = [left, right].join('') + when :left then word = left + when :right then word = right + when :hash then word = { + :line => [before_match, left, right, after_match].join(''), + :before_match => before_match, + :left => left, + :right => right, + :after_match => after_match, + } + end + end + + word + end +end + +if __FILE__ == $0 + require "test/unit" + class TestWord < Test::Unit::TestCase +# =begin + def test_with_spaces + ENV['TM_SELECTED_TEXT']= nil + ENV['TM_CURRENT_LINE'] = <<-EOF + BeforeAfter + EOF + ENV['TM_LINE_INDEX'] = '10' + ENV['TM_TAB_SIZE'] = '2' + assert_equal 'BeforeAfter', Word.current_word + assert_equal 'Before', Word.current_word('a-zA-Z0-9',:left) + assert_equal 'After', Word.current_word('a-zA-Z0-9',:right) + + assert_equal ' Before', Word.current_word(" a-zA-Z",:left) + assert_equal 'After ', Word.current_word(" a-zA-Z",:right) + end + + def test_with_tabs + ENV['TM_SELECTED_TEXT']= nil + ENV['TM_CURRENT_LINE'] = <<-EOF + BeforeAfter + EOF + ENV['TM_LINE_INDEX'] = '8' + ENV['TM_TAB_SIZE'] = '2' + assert_equal 'BeforeAfter', Word.current_word + assert_equal 'Before', Word.current_word('a-zA-Z0-9',:left) + assert_equal 'After', Word.current_word('a-zA-Z0-9',:right) + + assert_equal "\t\tBefore", Word.current_word("\ta-zA-Z",:left) + assert_equal "After\t\t", Word.current_word("\ta-zA-Z",:right) + end + + def test_with_dash + ENV['TM_SELECTED_TEXT']= nil + ENV['TM_CURRENT_LINE'] = <<-EOF + Before--After + EOF + ENV['TM_LINE_INDEX'] = '11' + ENV['TM_TAB_SIZE'] = '2' + assert_equal 'Before--After', Word.current_word('-a-zA-Z0-9') + assert_equal 'Before-', Word.current_word('-a-zA-Z0-9',:left) + assert_equal '-After', Word.current_word('-a-zA-Z0-9',:right) + + assert_equal 'Before-', Word.current_word("\ta-zA-Z\-",:left) + end + + def test_hash_result + ENV['TM_SELECTED_TEXT']= nil + ENV['TM_CURRENT_LINE'] = <<-EOF + before_match BeforeAfter after_match + EOF + ENV['TM_LINE_INDEX'] = '22' + ENV['TM_TAB_SIZE'] = '2' + + word = Word.current_word("a-zA-Z",:hash) + + assert_equal ENV['TM_CURRENT_LINE'], "#{word[:line]}" + assert_equal 'Before', word[:left] + assert_equal 'After', word[:right] + end +=begin +=end + def test_both_result + ENV['TM_SELECTED_TEXT']= nil + ENV['TM_CURRENT_LINE'] = <<-EOF + before_match BeforeAfter after_match + EOF + ENV['TM_LINE_INDEX'] = '22' + ENV['TM_TAB_SIZE'] = '2' + + assert_equal 'BeforeAfter', Word.current_word("a-zA-Z",:both) + end + + def test_should_support_custom_regex + ENV['TM_SELECTED_TEXT']= nil + ENV['TM_CURRENT_LINE'] = <<-EOF + before_match BeforeAfter after_match + EOF + ENV['TM_LINE_INDEX'] = '22' + ENV['TM_TAB_SIZE'] = '2' + + assert_equal '', Word.current_word(/[a-zA-Z]/,:both) # No match since no capture group was used! + + assert_equal 'ef', Word.current_word(/([a-z])/,:both) # Capture group, but only selecting a single caracter before and after the caret + assert_equal 'eforefter', Word.current_word(/([a-z]+)/,:both) # Only lowercase characters + assert_equal 'BeforeAfter', Word.current_word(/^([a-z]*)/i,:both) # Ignore case + assert_equal 'BeforeAfter', Word.current_word(/^([a-zA-Z]*)/,:both) # Explicit case + end + + def test_should_support_custom_regex_example1 + ENV['TM_SELECTED_TEXT']= nil + ENV['TM_CURRENT_LINE'] = <<-EOF + background-color: ; + EOF + ENV['TM_LINE_INDEX'] = '20' + ENV['TM_TAB_SIZE'] = '2' + + assert_equal ' background-color: ', Word.current_word(/^(.*)/,:left) + assert_equal 'background-color', Word.current_word(/:([-a-z]+)/,:left) + end + + def test_should_support_custom_regex_example2 + ENV['TM_SELECTED_TEXT']= nil + ENV['TM_CURRENT_LINE'] = <<-EOF +

Lorem ipsum dolor sit amet

+ EOF + ENV['TM_LINE_INDEX'] = '44' + ENV['TM_TAB_SIZE'] = '2' + + assert_equal %Q{\t

Lorem ipsum}, Word.current_word(/^(.*)/,:left) + assert_equal 'Lorem ipsum dolor sit amet', Word.current_word(/^([^<>]+)/i,:both) + + # You have to reverse the regex since it's matching against the reverse of the text before the caret + assert_equal 'p', Word.current_word(/([-:a-z]+) "/Applications/TextMate.app/Contents/Resources/Bundle Item Icons/Commands.png", + "D" => "/Applications/TextMate.app/Contents/Resources/Bundle Item Icons/Drag Commands.png", + "L" => "/Applications/TextMate.app/Contents/Resources/Bundle Item Icons/Languages.png", + "M" => "/Applications/TextMate.app/Contents/Resources/Bundle Item Icons/Macros.png", + "P" => "/Applications/TextMate.app/Contents/Resources/Bundle Item Icons/Preferences.png", + "S" => "/Applications/TextMate.app/Contents/Resources/Bundle Item Icons/Snippets.png", + "T" => "/Applications/TextMate.app/Contents/Resources/Bundle Item Icons/Templates.png", + "Doc" => "/Applications/TextMate.app/Contents/Resources/Bundle Item Icons/Template Files.png", + } + + def initialize + end + + # 0-config completion command using environment variables for everything + def complete! + return choices unless choices + TextMate::UI.complete(choices, {:images => images, :extra_chars => extra_chars}) + end + + def tip! + # If there is no current_word, then check the next current_word + # If there really is no current_word, then show a menu of choices + + chars = "a-zA-Z0-9" # Hard-coded into D2 + chars += Regexp.escape(extra_chars) if extra_chars + current_word ||= Word.current_word chars, :both + + result = nil + menu_choices = nil + choices = nil + choice = 0 + + [current_word, current_method_name, current_collection_name].each do |initial_filter| + next unless initial_filter and not initial_filter.empty? + # p initial_filter + + choices = self.choices.select { |c| (c['match'] || c['display']) =~ /^#{Regexp.quote(initial_filter)}/ } + + # p choices + break if choices and not choices.empty? + end + choices ||= self.choices + + menu_choices = choices.map { |c| c['display'] } + choice = TextMate::UI.menu(menu_choices) if menu_choices and menu_choices.length > 1 + if choice + result = choices[choice] + end + + TextMate::UI.tool_tip( result['tool_tip'], {:format => result['tool_tip_format'] || :text }) if result + end + + def choices + @choices ||= data['suggestions'] + end + def choices= choice_array + @choices = array_to_suggestions(choice_array) + end + + def images + @images = data['images'] || IMAGES + + data['images']||{}.each_pair do |name,path| + @images[name] = path + next if File.exists? @images[name] + @images[name] = ENV['TM_BUNDLE_SUPPORT'] + "/#{IMAGES_FOLDER_NAME}/" + path + next if File.exists? @images[name] + @images[name] = ENV['TM_SUPPORT_PATH'] + "/#{IMAGES_FOLDER_NAME}/" + path + next if File.exists? @images[name] + end + + @images + end + + def tool_tip_prefix + @tool_tip_prefix ||= data['tool_tip_prefix'] + end + + def extra_chars + ENV['TM_COMPLETIONS_EXTRACHARS'] || data['extra_chars'] + end + + def chars + "a-zA-Z0-9" + end + + private + def data(raw_data=nil) + fix_legacy + + raw_data ||= read_data + return {} unless raw_data and not raw_data.empty? + + @data = parse_data raw_data + return @data + end + + def read_data + raw_data = read_file + raw_data ||= read_string + raw_data + end + + def read_file + paths = [ENV['TM_COMPLETIONS_FILE']] if ENV['TM_COMPLETIONS_FILE'] + paths ||= Shellwords.shellwords( ENV['TM_COMPLETIONS_FILES'] ) if ENV.has_key?('TM_COMPLETIONS_FILES') + return nil unless paths + + paths.map do |path| + next unless path and not path.empty? + path = ENV['TM_BUNDLE_SUPPORT'] + '/' + path unless File.exists? path + next unless File.exists? path + + { :data => File.read(path), + :format => path.scan(/\.([^\.]+)$/).last.last + } + end + end + + def read_string + [{:data => ENV['TM_COMPLETIONS'], + :format => ENV['TM_COMPLETIONS_SPLIT'] + }] + end + + attr_accessor :filepath + + def parse_data(raw_datas) + return @parsed if @parsed + parsed = {"suggestions"=>[]} + + raw_datas.each do |raw_data| + suggestions = parsed['suggestions'] + + case raw_data[:format] + when 'plist' + par = parse_plist(raw_data) + when 'json' + par = parse_json(raw_data) + when "txt" + raw_data[:format] = "\n" + par = parse_string(raw_data) + when nil + raw_data[:format] = "," + par = parse_string(raw_data) + else + par = parse_string(raw_data) + end + + if par['tool_tip_prefix'] + par['suggestions'] = par['suggestions'].map do |suggestion| + suggestion['tool_tip'] = par['tool_tip_prefix'] + suggestion['tool_tip'] + suggestion + end + end + + parsed.merge! par + parsed['suggestions'] = suggestions + parsed['suggestions'] + end + + @parsed = parsed + end + def parse_string(raw_data) + return {} unless raw_data and raw_data[:data] + return raw_data[:data] unless raw_data[:data].respond_to? :to_str + raw_data[:data] = raw_data[:data].to_str + + data = {} + data['suggestions'] = array_to_suggestions(raw_data[:data].split(raw_data[:format])) + data + end + def parse_plist(raw_data) + OSX::PropertyList.load(raw_data[:data]) + end + def parse_json(raw_data) + JSON.parse(raw_data[:data]) + end + + def array_to_suggestions(suggestions) + suggestions.delete('') + + suggestions.map! do |c| + {'display' => c} + end + + suggestions + end + def current_method_name + # Regex for finding a method or function name that's close to your caret position using Word.current_word + # TODO: Allow completion prefs to define their own Complete.tip! method_name + + characters = "a-zA-Z0-9" # Hard-coded into D2 + characters += Regexp.escape(extra_chars) if extra_chars + + regex = %r/ + (?> [^\(\)]+ | \) (?> [^\(\)]+ | \) (?> [^\(\)]+ | \) (?> [^\(\)]+ | \) (?> [^\(\)]+ | \) (?> [^\(\)]* ) \( | )+ \( | )+ \( | )+ \( | )+ \( | )+ + (?: \(([#{characters}]+) )?/ix + + Word.current_word(regex,:left) + end + def current_collection_name + characters = "a-zA-Z0-9" # Hard-coded into D2 + characters += Regexp.escape(extra_chars) if extra_chars + + regex = %r/ + (?> [^\[\]]+ | \] (?> [^\[\]]+ | \] (?> [^\[\]]+ | \] (?> [^\[\]]+ | \] (?> [^\[\]]+ | \] (?> [^\[\]]* ) \[ | )+ \[ | )+ \[ | )+ \[ | )+ \[ | )+ + (?: \[([#{characters}]+) )?/ix + + Word.current_word(regex,:left) + end + + def fix_legacy + ENV['TM_COMPLETIONS_SPLIT'] ||= ENV['TM_COMPLETIONS_split'] + end + end +end + +if __FILE__ == $0 + +`open "txmt://open?url=file://$TM_FILEPATH"` #For testing purposes, make this document the topmost so that the complete popup works +ENV['WEB_PREVIEW_RUBY']='NO-RUN' +require "test/unit" +# require "complete" + +class TestComplete < Test::Unit::TestCase + def setup + @string_raw = 'ad(),adipisicing,aliqua,aliquip,amet,anim,aute,cillum,commodo,consectetur,consequat,culpa,cupidatat,deserunt,do,dolor,dolore,Duis,ea,eiusmod,elit,enim,esse,est,et,eu,ex,Excepteur,exercitation,fugiat,id,in,incididunt,ipsum,irure,labore,laboris,laborum,Lorem,magna,minim,mollit,nisi,non,nostrud,nulla,occaecat,officia,pariatur,proident,qui,quis,reprehenderit,sed,sint,sit,sunt,tempor,ullamco,Ut,ut,velit,veniam,voluptate,' + + @plist_raw = <<-'PLIST' + { suggestions = ( + { display = moo; image = Drag; insert = "(${1:one}, ${2:one}, ${3:three}${4:, ${5:five}, ${6:six}})"; tool_tip = "moo(one, two, four[, five])\n This method does something or other maybe.\n Insert longer description of it here."; }, + { display = foo; image = Macro; insert = "(${1:one}, \"${2:one}\", ${3:three}${4:, ${5:five}, ${6:six}})"; tool_tip = "foo(one, two)\n This method does something or other maybe.\n Insert longer description of it here."; }, + { display = bar; image = Command; insert = "(${1:one}, ${2:one}, \"${3:three}\"${4:, \"${5:five}\", ${6:six}})"; tool_tip = "bar(one, two[, three])\n This method does something or other maybe.\n Insert longer description of it here."; } + ); + extra_chars = '.'; + images = { + Command = "Commands.png"; + Drag = "Drag Commands.png"; + Language = "Languages.png"; + Macro = "Macros.png"; + Preference = "Preferences.png"; + Snippet = "Snippets.png"; + Template = "Template Files.png"; + Templates = "Templates.png"; + }; + } + PLIST + + @json_raw = <<-'JSON' + { + "extra_chars": "-_$.", + "suggestions": [ + { "display": ".moo", "image": "", "insert": "(${1:one}, ${2:one}, ${3:three}${4:, ${5:five}, ${6:six}})", "tool_tip": "moo(one, two, four[, five])\n This method does something or other maybe.\n Insert longer description of it here." }, + { "display": "foo", "image": "", "insert": "(${1:one}, \"${2:one}\", ${3:three}${4:, ${5:five}, ${6:six}})", "tool_tip": "foo(one, two)\n This method does something or other maybe.\n Insert longer description of it here." }, + { "display": "bar", "image": "", "insert": "(${1:one}, ${2:one}, \"${3:three}\"${4:, \"${5:five}\", ${6:six}})", "tool_tip": "bar(one, two[, three])\n This method does something or other maybe.\n Insert longer description of it here." } + ], + "images": { + "String" : "String.png", + "RegExp" : "RegExp.png", + "Number" : "Number.png", + "Array" : "Array.png", + "Function": "Function.png", + "Object" : "Object.png", + "Node" : "Node.png", + "NodeList": "NodeList.png" + } + } + JSON + end + + def test_basic_complete + ENV['TM_COMPLETIONS'] = @string_raw + + assert_equal ENV['TM_COMPLETIONS'].split(','), TextMate::Complete.new.choices.map{|c| c['display']} + assert_equal TextMate::Complete::IMAGES, TextMate::Complete.new.images + + TextMate::Complete.new.complete! + end + # + def test_should_support_plist + ENV['TM_COMPLETIONS_SPLIT']='plist' + ENV['TM_COMPLETIONS'] = @plist_raw + TextMate::Complete.new.complete! + end + # + def test_should_support_json + ENV.delete 'TM_COMPLETIONS' + assert_nil(ENV['TM_COMPLETIONS']) + ENV.delete 'TM_COMPLETIONS_SPLIT' + assert_nil(ENV['TM_COMPLETIONS_SPLIT']) + + ENV['TM_COMPLETIONS_SPLIT']='json' + ENV['TM_COMPLETIONS'] = @json_raw + fred = TextMate::Complete.new + assert_equal(3, fred.choices.length) + end + # + def test_should_be_able_to_modify_the_choices + ENV['TM_COMPLETIONS'] = @string_raw + + fred = TextMate::Complete.new + + assert_not_nil fred.choices + assert_equal ENV['TM_COMPLETIONS'].split(','), fred.choices.map{|c| c['display']} + fred.choices.reject!{|choice| choice['display'] !~ /^a/ } + assert_equal ENV['TM_COMPLETIONS'].split(',').grep(/^a/), fred.choices.map{|c| c['display']} + + fred.choices=%w[fred is not my name] + assert_equal %w[fred is not my name], fred.choices.map{|c| c['display']} + end + # + def test_should_parse_files_based_on_extension_plist + ENV['TM_COMPLETIONS_FILE'] = '/tmp/completions_test.plist' + + File.open(ENV['TM_COMPLETIONS_FILE'],'w'){|file| file.write @plist_raw } + assert File.exists?(ENV['TM_COMPLETIONS_FILE']) + + fred = TextMate::Complete.new + assert_equal(['moo', 'foo', 'bar'], fred.choices.map{|c| c['display']}) + end + # + def test_should_parse_files_based_on_extension_txt + ENV.delete 'TM_COMPLETIONS' + assert_nil(ENV['TM_COMPLETIONS']) + ENV.delete 'TM_COMPLETIONS_SPLIT' + assert_nil(ENV['TM_COMPLETIONS_SPLIT']) + + ENV['TM_COMPLETIONS_FILE'] = '/tmp/completions_test.txt' + + File.open(ENV['TM_COMPLETIONS_FILE'],'w'){|file| file.write @string_raw.gsub(',',"\n") } + assert File.exists?(ENV['TM_COMPLETIONS_FILE']) + + fred = TextMate::Complete.new + + assert_equal(@string_raw.split(','), fred.choices.map{|c| c['display']}) + end + # + def test_should_parse_multiple_files + ENV.delete 'TM_COMPLETIONS' + assert_nil(ENV['TM_COMPLETIONS']) + ENV.delete 'TM_COMPLETIONS_SPLIT' + assert_nil(ENV['TM_COMPLETIONS_SPLIT']) + ENV.delete 'TM_COMPLETIONS_FILE' + assert_nil(ENV['TM_COMPLETIONS_FILE']) + + ENV['TM_COMPLETIONS_FILES'] = "'/tmp/completions_test.txt' '/tmp/completions_test1.txt' '/tmp/completions_test2.txt'" + + require 'shellwords' + Shellwords.shellwords( ENV['TM_COMPLETIONS_FILES'] ).each_with_index do |filepath,i| + File.open(filepath,'w'){|file| file.write @string_raw.gsub(',',"#{i}\n") } + assert File.exists?(filepath) + end + + fred = TextMate::Complete.new + + assert_equal(@string_raw.split(',').uniq.length * 3, fred.choices.map{|c| c['display']}.length ) + end + # + def test_should_override_split_with_extension + ENV['TM_COMPLETIONS_SPLIT'] = ',' + ENV['TM_COMPLETIONS_FILE'] = '/tmp/completions_test.plist' + + File.open(ENV['TM_COMPLETIONS_FILE'],'w'){|file| file.write @plist_raw } + assert File.exists?(ENV['TM_COMPLETIONS_FILE']) + + fred = TextMate::Complete.new + assert_equal(['moo', 'foo', 'bar'], fred.choices.map{|c| c['display']}) + end + # + def test_should_get_extra_chars_from_var + ENV['TM_COMPLETIONS_SPLIT']=',' + ENV['TM_COMPLETIONS'] = @string_raw + ENV['TM_COMPLETIONS_EXTRACHARS'] = '.' + + fred = TextMate::Complete.new + assert_equal('.', fred.extra_chars) + end + # + def test_should_get_extra_chars_from_plist + ENV['TM_COMPLETIONS_SPLIT']='plist' + ENV['TM_COMPLETIONS'] = @plist_raw + + assert_nil(ENV['TM_COMPLETIONS_EXTRACHARS']) + + fred = TextMate::Complete.new + assert_equal('.', fred.extra_chars) + end + # TODO: should_fix_image_paths +=begin + def test_should_fix_image_paths + ENV['TM_COMPLETIONS_SPLIT'] = 'plist' + ENV['TM_COMPLETIONS'] = @plist_raw + ENV['TM_BUNDLE_SUPPORT'] = '/tmp' + ENV['TM_SUPPORT_PATH'] = '/tmp' + + images = OSX::PropertyList.load(@plist_raw)['images'] + + FileUtils.mkdir_p "#{ENV['TM_SUPPORT_PATH']}/#{TextMate::Complete::IMAGES_FOLDER_NAME}" + images.each_pair do |name,path| + File.open("#{ENV['TM_SUPPORT_PATH']}/#{TextMate::Complete::IMAGES_FOLDER_NAME}/#{path}", 'w'){ |file| file.write('') } + end + + TextMate::Complete.new.images.each_pair do |name,path| + assert File.exists?(path) + end + + end +=end + def test_should_apply_prefix + ENV.delete 'TM_COMPLETIONS' + assert_nil(ENV['TM_COMPLETIONS']) + ENV.delete 'TM_COMPLETIONS_SPLIT' + assert_nil(ENV['TM_COMPLETIONS_SPLIT']) + + @json_raw = <<-'JSON' + { + "extra_chars": "-_$.", + "tool_tip_prefix":"prefix", + "suggestions": [ + { "display": ".moo", "image": "", "insert": "(${1:one}, ${2:one}, ${3:three}${4:, ${5:five}, ${6:six}})", "tool_tip": "moo(one, two, four[, five])\n This method does something or other maybe.\n Insert longer description of it here." }, + { "display": "foo", "image": "", "insert": "(${1:one}, \"${2:one}\", ${3:three}${4:, ${5:five}, ${6:six}})", "tool_tip": "foo(one, two)\n This method does something or other maybe.\n Insert longer description of it here." }, + { "display": "bar", "image": "", "insert": "(${1:one}, ${2:one}, \"${3:three}\"${4:, \"${5:five}\", ${6:six}})", "tool_tip": "bar(one, two[, three])\n This method does something or other maybe.\n Insert longer description of it here." } + ], + "images": { + "String" : "String.png", + "RegExp" : "RegExp.png", + "Number" : "Number.png", + "Array" : "Array.png", + "Function": "Function.png", + "Object" : "Object.png", + "Node" : "Node.png", + "NodeList": "NodeList.png" + } + } + JSON + + ENV['TM_COMPLETIONS_SPLIT']='json' + ENV['TM_COMPLETIONS'] = @json_raw + fred = TextMate::Complete.new + assert_equal(3, fred.choices.length) + assert fred.choices.first['tool_tip'].match(/^prefix/) + end + # + def test_should_show_tooltip_without_inserting_anything + # This method passes if it shows a tooltip when selecting a menu-item + # and DOESN'T insert anything or cause the document think anything has changed + ENV.delete 'TM_COMPLETIONS' + assert_nil(ENV['TM_COMPLETIONS']) + ENV.delete 'TM_COMPLETIONS_SPLIT' + assert_nil(ENV['TM_COMPLETIONS_SPLIT']) + + ENV['TM_COMPLETIONS_SPLIT']='json' + ENV['TM_COMPLETIONS'] = @json_raw + fred = TextMate::Complete.new + assert_equal(3, fred.choices.length) + + TextMate::Complete.new.tip! + end + # + def test_tip_should_look_for_the_current_word_and_then_try_the_closest_function_name + ENV.delete 'TM_COMPLETIONS' + assert_nil(ENV['TM_COMPLETIONS']) + ENV.delete 'TM_COMPLETIONS_SPLIT' + assert_nil(ENV['TM_COMPLETIONS_SPLIT']) + + ENV['TM_COMPLETIONS_SPLIT']='json' + ENV['TM_COMPLETIONS'] = @json_raw + fred = TextMate::Complete.new + assert_equal(3, fred.choices.length) + + TextMate::Complete.new.tip! + # + # This test passes if, when run, you see the tooltip for closest function + # Be sure to more your caret around and try a few times + # Showing a menu is a fail + # + # foo( bar( ), '.moo' ) + # ^ Caret here should give the tip for 'foo' + # ^ Caret here should give the tip for 'bar' + # ^ Caret here should give the tip for 'bar' + # ^ Caret here should give the tip for '.moo' + # foo( bar(one,two,foo), '.moo' ) + # foo['bar'] + end + # +end + +end#if From a2e8cae16605c8304bc863cbb034cf4270907646 Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Tue, 21 Apr 2009 23:59:43 -0400 Subject: [PATCH 210/243] always show a tooltip when asked to --- Support/lib/tm/complete.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Support/lib/tm/complete.rb b/Support/lib/tm/complete.rb index 3c22b84..546c5cb 100644 --- a/Support/lib/tm/complete.rb +++ b/Support/lib/tm/complete.rb @@ -59,8 +59,9 @@ def tip! if choice result = choices[choice] end + result = {'tool_tip' => 'No information'} unless result - TextMate::UI.tool_tip( result['tool_tip'], {:format => result['tool_tip_format'] || :text }) if result + TextMate::UI.tool_tip( result['tool_tip'], {:format => result['tool_tip_format'] || :text }) end def choices From 24df8f3728a966d110883d63c821599d3ec87cb3 Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Wed, 22 Apr 2009 00:00:07 -0400 Subject: [PATCH 211/243] added mutator scope for special styling mutating method names --- Syntaxes/JavaScript Basic.tmLanguage | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/Syntaxes/JavaScript Basic.tmLanguage b/Syntaxes/JavaScript Basic.tmLanguage index fff620e..a74bbfb 100644 --- a/Syntaxes/JavaScript Basic.tmLanguage +++ b/Syntaxes/JavaScript Basic.tmLanguage @@ -1306,10 +1306,32 @@ support.class.js + captures + + 0 + + name + support.function.js + + + match + \b(s(hift|ort|plice)|unshift|p(op|ush)|reverse)\b(?=\() + name + entity.name.function.mutator.js + + + captures + + 0 + + name + support.function.js + + match \b(s(h(ift|ow(Mod(elessDialog|alDialog)|Help))|croll(X|By(Pages|Lines)?|Y|To)?|t(op|rike)|i(n|zeToContent|debar|gnText)|ort|u(p|b(str(ing)?)?)|pli(ce|t)|e(nd|t(Re(sizable|questHeader)|M(i(nutes|lliseconds)|onth)|Seconds|Ho(tKeys|urs)|Year|Cursor|Time(out)?|Interval|ZOptions|Date|UTC(M(i(nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(ome|andleEvent)|navigate|c(har(CodeAt|At)|o(s|n(cat|textual|firm)|mpile)|eil|lear(Timeout|Interval)?|a(ptureEvents|ll)|reate(StyleSheet|Popup|EventObject))|t(o(GMTString|S(tring|ource)|U(TCString|pperCase)|Lo(caleString|werCase))|est|a(n|int(Enabled)?))|i(s(NaN|Finite)|ndexOf|talics)|d(isableExternalCapture|ump|etachEvent)|u(n(shift|taint|escape|watch)|pdateCommands)|j(oin|avaEnabled)|p(o(p|w)|ush|lugins.refresh|a(ddings|rse(Int|Float)?)|r(int|ompt|eference))|e(scape|nableExternalCapture|val|lementFromPoint|x(p|ec(Script|Command)?))|valueOf|UTC|queryCommand(State|Indeterm|Enabled|Value)|f(i(nd|le(ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(nt(size|color)|rward)|loor|romCharCode)|watch|l(ink|o(ad|g)|astIndexOf)|a(sin|nchor|cos|t(tachEvent|ob|an(2)?)|pply|lert|b(s|ort))|r(ou(nd|teEvents)|e(size(By|To)|calc|turnValue|place|verse|l(oad|ease(Capture|Events)))|andom)|g(o|et(ResponseHeader|M(i(nutes|lliseconds)|onth)|Se(conds|lection)|Hours|Year|Time(zoneOffset)?|Da(y|te)|UTC(M(i(nutes|lliseconds)|onth)|Seconds|Hours|Da(y|te)|FullYear)|FullYear|A(ttention|llResponseHeaders)))|m(in|ove(B(y|elow)|To(Absolute)?|Above)|ergeAttributes|a(tch|rgins|x))|b(toa|ig|o(ld|rderWidths)|link|ack))\b(?=\() name - support.function.js + entity.name.function.js match From 33ff847d49f0e7b5bc2de08599c6ebd402202adc Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Mon, 27 Apr 2009 02:02:17 -0700 Subject: [PATCH 212/243] FIXED completions giant images. never did figure out what the deal is, must be a problem in tm_dialog itselg --- ...rg.quirksmode.dom.w3c_css.completions.json | 44 +++++----- ...g.quirksmode.dom.w3c_html.completions.json | 80 +++++++++---------- 2 files changed, 62 insertions(+), 62 deletions(-) diff --git a/Support/org.quirksmode.dom.w3c_css.completions.json b/Support/org.quirksmode.dom.w3c_css.completions.json index 5d552cd..e9aa6ac 100644 --- a/Support/org.quirksmode.dom.w3c_css.completions.json +++ b/Support/org.quirksmode.dom.w3c_css.completions.json @@ -1,23 +1,23 @@ {"tool_tip_prefix":"