code style improvements

Conflicts:

	lib/ace/virtual_renderer.js
This commit is contained in:
Adam Jimenez 2011-12-14 13:38:47 +00:00 • committed by Fabian Jakobs
commit 50e6df7e15
2 changed files with 125 additions and 125 deletions

View file

@ -44,7 +44,7 @@ var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocComme
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var PhpHighlightRules = function() { var PhpHighlightRules = function() {
var docComment = new DocCommentHighlightRules(); var docComment = new DocCommentHighlightRules();
// http://php.net/quickref.php // http://php.net/quickref.php
var builtinFunctions = lang.arrayToMap( var builtinFunctions = lang.arrayToMap(
('abs|acos|acosh|addcslashes|addslashes|aggregate|aggregate_info|aggregate_methods|aggregate_methods_by_list|aggregate_methods_by_regexp|' + ('abs|acos|acosh|addcslashes|addslashes|aggregate|aggregate_info|aggregate_methods|aggregate_methods_by_list|aggregate_methods_by_regexp|' +
@ -912,23 +912,23 @@ var PhpHighlightRules = function() {
regex : "\\?>" regex : "\\?>"
}, },
{ {
token : "comment", token : "comment",
regex : "<\\!--", regex : "<\\!--",
next : "htmlcomment" next : "htmlcomment"
}, },
{
token : "meta.tag",
regex : "<style",
next : "css"
},
{
token : "meta.tag", // opening tag
regex : "<\\/?[-_a-zA-Z0-9:]+",
next : "htmltag"
},
{ {
token : 'meta.tag', token : "meta.tag",
regex : '<\!DOCTYPE.*?>' regex : "<style",
next : "css"
},
{
token : "meta.tag", // opening tag
regex : "<\\/?[-_a-zA-Z0-9:]+",
next : "htmltag"
},
{
token : 'meta.tag',
regex : '<\!DOCTYPE.*?>'
}, },
{ {
token : "comment", token : "comment",
@ -1059,93 +1059,93 @@ var PhpHighlightRules = function() {
], ],
"htmlcomment" : [ "htmlcomment" : [
{ {
token : "comment", token : "comment",
regex : ".*?-->", regex : ".*?-->",
next : "start" next : "start"
}, { }, {
token : "comment", token : "comment",
regex : ".+" regex : ".+"
} }
], ],
"htmltag" : [ "htmltag" : [
{ {
token : "meta.tag", token : "meta.tag",
regex : ">", regex : ">",
next : "start" next : "start"
}, { }, {
token : "text", token : "text",
regex : "[-_a-zA-Z0-9:]+" regex : "[-_a-zA-Z0-9:]+"
}, { }, {
token : "text", token : "text",
regex : "\\s+" regex : "\\s+"
}, { }, {
token : "string", token : "string",
regex : '".*?"' regex : '".*?"'
}, { }, {
token : "string", token : "string",
regex : "'.*?'" regex : "'.*?'"
} }
], ],
"css" : [ "css" : [
{ {
token : "meta.tag", token : "meta.tag",
regex : "<\/style>", regex : "<\/style>",
next : "htmltag" next : "htmltag"
}, { }, {
token : "meta.tag", token : "meta.tag",
regex : ">", regex : ">",
}, { }, {
token : 'text', token : 'text',
regex : "(?:media|type|href)" regex : "(?:media|type|href)"
}, { }, {
token : 'string', token : 'string',
regex : '=".*?"' regex : '=".*?"'
}, { }, {
token : "paren.lparen", token : "paren.lparen",
regex : "\{", regex : "\{",
next : "cssdeclaration", next : "cssdeclaration",
}, { }, {
token : "keyword", token : "keyword",
regex : "#[A-Za-z0-9\-\_\.]+" regex : "#[A-Za-z0-9\-\_\.]+"
}, { }, {
token : "variable", token : "variable",
regex : "\\.[A-Za-z0-9\-\_\.]+" regex : "\\.[A-Za-z0-9\-\_\.]+"
}, { }, {
token : "constant", token : "constant",
regex : "[A-Za-z0-9]+" regex : "[A-Za-z0-9]+"
} }
], ],
"cssdeclaration" : [ "cssdeclaration" : [
{ {
token : "support.type", token : "support.type",
regex : "[\-a-zA-Z]+", regex : "[\-a-zA-Z]+",
next : "cssvalue" next : "cssvalue"
}, },
{ {
token : "paren.rparen", token : "paren.rparen",
regex : '\}', regex : '\}',
next : "css" next : "css"
} }
], ],
"cssvalue" : [ "cssvalue" : [
{ {
token : "text", token : "text",
regex : "\:" regex : "\:"
}, },
{ {
token : "constant", token : "constant",
regex : "#[0-9a-zA-Z]+" regex : "#[0-9a-zA-Z]+"
}, },
{ {
token : "text", token : "text",
regex : "[\-\_0-9a-zA-Z\"' ,%]+" regex : "[\-\_0-9a-zA-Z\"' ,%]+"
}, },
{ {
token : "text", token : "text",
regex : ";", regex : ";",
next : "cssdeclaration" next : "cssdeclaration"
} }
], ],
}; };
this.embedRules(DocCommentHighlightRules, "doc-", this.embedRules(DocCommentHighlightRules, "doc-",

View file

@ -36,12 +36,12 @@
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) { define(function(require, exports, module) {
var lang = require("../lib/lang"); var lang = require("../lib/lang");
var formTags = lang.arrayToMap( var formTags = lang.arrayToMap(
("button|form|input|label|select|textarea").split("|") ("button|form|input|label|select|textarea").split("|")
); );
var tableTags = lang.arrayToMap( var tableTags = lang.arrayToMap(
("table|tbody|td|tfoot|th|tr").split("|") ("table|tbody|td|tfoot|th|tr").split("|")
); );
@ -85,30 +85,30 @@ exports.tag = function(states, name, nextState) {
regex : "\\s+" regex : "\\s+"
}, { }, {
//token : "meta.tag", //token : "meta.tag",
token : function(value) { token : function(value) {
if ( value==='a' ) { if ( value==='a' ) {
return "meta.tag.anchor"; return "meta.tag.anchor";
} }
else if ( value==='img' ) { else if ( value==='img' ) {
return "meta.tag.image"; return "meta.tag.image";
} }
else if ( value==='script' ) { else if ( value==='script' ) {
return "meta.tag.script"; return "meta.tag.script";
} }
else if ( value==='style' ) { else if ( value==='style' ) {
return "meta.tag.style"; return "meta.tag.style";
} }
else if (formTags.hasOwnProperty(value.toLowerCase())) { else if (formTags.hasOwnProperty(value.toLowerCase())) {
return "meta.tag.form"; return "meta.tag.form";
} }
else if (tableTags.hasOwnProperty(value.toLowerCase())) { else if (tableTags.hasOwnProperty(value.toLowerCase())) {
return "meta.tag.table"; return "meta.tag.table";
} }
else { else {
return "meta.tag"; return "meta.tag";
} }
}, },
merge : true, merge : true,
regex : "[-_a-zA-Z0-9:!]+", regex : "[-_a-zA-Z0-9:!]+",
next : name + "embed-attribute-list" next : name + "embed-attribute-list"