Update to add param colors and more JS functions

This commit is contained in:
Garen Torikian 2012-03-24 02:47:25 +01:00
commit 5a02205fc8
14 changed files with 68 additions and 16 deletions

View file

@ -1,4 +1,4 @@
function foo(items) {
function foo (items, nada) {
for (var i=0; i<items.length; i++) {
alert(items[i] + "juhu\n");
} // Real Tab.

View file

@ -137,8 +137,8 @@ var JavaScriptHighlightRules = function() {
token : "constant.numeric", // float
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
}, {
token : ["storage.type", "text", "entity.name.function"],
regex : "(function)(\\s+)(" + identifierRe + ")"
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
}, {
token : "constant.language.boolean",
regex : "(?:true|false)\\b"
@ -152,6 +152,9 @@ var JavaScriptHighlightRules = function() {
}, {
token : "support.function.dom",
regex : "\\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(?=\\()"
}, {
token : "support.function.constant",
regex : "\\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(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
}, {
token : ["punctuation.operator", "support.function.firebug"],
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"

View file

@ -117,6 +117,10 @@ exports.cssText = ".ace-chrome .ace_editor {\
color: rgb(109, 121, 222);\
}\
\
.ace-chrome .ace_variable.ace_parameter {\
font-style:italic;\
color:#FD971F;\
}\
.ace-chrome .ace_line .ace_keyword.ace_operator {\
color: rgb(104, 118, 135);\
}\

View file

@ -123,6 +123,10 @@ background-color:#FF0000;\
color:#B83426;\
}\
\
.ace-idle-fingers .ace_variable.ace_parameter {\
font-style:italic;\
}\
\
.ace-idle-fingers .ace_string {\
color:#A5C261;\
}\

View file

@ -135,6 +135,10 @@ background-color:rgba(153, 0, 0, 0.68);\
color:#C23B00;\
}\
\
.ace-mono-industrial .ace_variable.ace_parameter {\
color:#648BD2;\
}\
\
.ace-mono-industrial .ace_comment {\
color:#666C68;\
background-color:#151C19;\

View file

@ -141,6 +141,11 @@ background-color:#AE81FF;\
color:#66D9EF;\
}\
\
.ace-monokai .ace_variable.ace_parameter {\
font-style:italic;\
color:#FD971F;\
}\
\
.ace-monokai .ace_string {\
color:#E6DB74;\
}\

View file

@ -144,6 +144,10 @@ background-color:#8959A8;\
color:#8959A8;\
}\
\
.ace-tomorrow .ace_variable.ace_parameter {\
color:#F5871F;\
}\
\
.ace-tomorrow .ace_string {\
color:#718C00;\
}\

View file

@ -144,6 +144,10 @@ background-color:#B798BF;\
color:#B294BB;\
}\
\
.ace-tomorrow-night .ace_variable.ace_parameter {\
color:#DE935F;\
}\
\
.ace-tomorrow-night .ace_string {\
color:#B5BD68;\
}\

View file

@ -144,6 +144,10 @@ background-color:#EBBBFF;\
color:#EBBBFF;\
}\
\
.ace-tomorrow-night-blue .ace_variable.ace_parameter {\
color:#FFC58F;\
}\
\
.ace-tomorrow-night-blue .ace_string {\
color:#D1F1A9;\
}\

View file

@ -144,6 +144,10 @@ background-color:#B798BF;\
color:#C397D8;\
}\
\
.ace-tomorrow-night-bright .ace_variable.ace_parameter {\
color:#E78C45;\
}\
\
.ace-tomorrow-night-bright .ace_string {\
color:#B9CA4A;\
}\

View file

@ -144,6 +144,10 @@ background-color:#CC99CC;\
color:#CC99CC;\
}\
\
.ace-tomorrow-night-eighties .ace_variable.ace_parameter {\
color:#F99157;\
}\
\
.ace-tomorrow-night-eighties .ace_string {\
color:#99CC99;\
}\

View file

@ -132,6 +132,10 @@ background-color:#000000;\
color:#FFCC00;\
}\
\
.ace-vibrant-ink .ace_variable.ace_parameter {\
font-style:italic;\
}\
\
.ace-vibrant-ink .ace_string {\
color:#66FF00;\
}\

View file

@ -117,6 +117,10 @@
%storage.type%
}
.%cssClass% .ace_variable.ace_parameter {
%variable.parameter%
}
.%cssClass% .ace_function.ace_buildin {
%function.buildin%
}

View file

@ -68,7 +68,8 @@ var supportedScopes = {
"support.function": "support.function",
"support.function.dom": "support.function.dom",
"support.function.firebug": "support.firebug",
"support.function.constant": "support.function.constant",
"function": "function",
"function.buildin": "function.buildin",
@ -88,6 +89,7 @@ var supportedScopes = {
"variable": "variable",
"variable.language": "variable.language",
"variable.parameter": "variable.parameter",
"meta": "meta",
"meta.tag.sgml.doctype": "xml_pe",
@ -136,6 +138,8 @@ function extractStyles(theme) {
var scope = scopes[j];
if (supportedScopes[scope]) {
colors[supportedScopes[scope]] = parseStyles(element.settings);
} else {
//console.log(scope + " is not supported!");
}
}
}
@ -205,7 +209,7 @@ function fillTemplate(template, replacements) {
function createTheme(name, styles, cssTemplate, jsTemplate) {
styles.cssClass = "ace-" + hyphenate(name);
var css = fillTemplate(cssTemplate, styles);
css = css.replace(/[^\{\}]+{\s*}/g, "");
return fillTemplate(jsTemplate, {
name: name,
@ -223,25 +227,25 @@ var cssTemplate = fs.readFileSync(__dirname + "/Theme.tmpl.css", "utf8");
var jsTemplate = fs.readFileSync(__dirname + "/Theme.tmpl.js", "utf8");
var themes = {
"dawn": "Dawn",
"idle_fingers": "idleFingers",
"twilight": "Twilight",
"monokai": "Monokai",
"merbivore": "Merbivore",
"merbivore_soft": "Merbivore Soft",
"pastel_on_dark": "Pastels on Dark",
"cobalt": "Cobalt",
"mono_industrial": "monoindustrial",
"clouds": "Clouds",
"clouds_midnight": "Clouds Midnight",
"cobalt": "Cobalt",
"dawn": "Dawn",
"idle_fingers": "idleFingers",
"kr_theme": "krTheme",
"solarized_light": "Solarized-light",
"merbivore": "Merbivore",
"merbivore_soft": "Merbivore Soft",
"mono_industrial": "monoindustrial",
"monokai": "Monokai",
"pastel_on_dark": "Pastels on Dark",
"solarized_dark": "Solarized-dark",
"solarized_light": "Solarized-light",
"tomorrow": "Tomorrow",
"tomorrow_night": "Tomorrow-Night",
"tomorrow_night_blue": "Tomorrow-Night-Blue",
"tomorrow_night_bright": "Tomorrow-Night-Bright",
"tomorrow_night_eighties": "Tomorrow-Night-Eighties",
"twilight": "Twilight",
"vibrant_ink": "Vibrant Ink"
};
@ -251,4 +255,4 @@ for (var name in themes) {
var styles = extractStyles(parseTheme(tmTheme));
fs.writeFileSync(__dirname + "/../lib/ace/theme/" + name + ".js", createTheme(name, styles, cssTemplate, jsTemplate));
}
}