make getStartRule getEndRule static

This commit is contained in:
nightwing 2012-04-15 19:02:18 +04:00
commit 68d0799554
10 changed files with 34 additions and 37 deletions

View file

@ -72,7 +72,7 @@ var c_cppHighlightRules = function() {
token : "comment",
regex : "\\/\\/.*$"
},
new DocCommentHighlightRules().getStartRule("doc-start"),
DocCommentHighlightRules.getStartRule("doc-start"),
{
token : "comment", // multi line comment
merge : true,
@ -171,7 +171,7 @@ var c_cppHighlightRules = function() {
};
this.embedRules(DocCommentHighlightRules, "doc-",
[ new DocCommentHighlightRules().getEndRule("start") ]);
[ DocCommentHighlightRules.getEndRule("start") ]);
};
oop.inherits(c_cppHighlightRules, TextHighlightRules);

View file

@ -69,27 +69,24 @@ var DocCommentHighlightRules = function() {
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
(function() {
this.getStartRule = function(start) {
return {
token : "comment.doc", // doc comment
merge : true,
regex : "\\/\\*(?=\\*)",
next : start
};
};
this.getEndRule = function (start) {
return {
token : "comment.doc", // closing comment
merge : true,
regex : "\\*\\/",
next : start
};
DocCommentHighlightRules.getStartRule = function(start) {
return {
token : "comment.doc", // doc comment
merge : true,
regex : "\\/\\*(?=\\*)",
next : start
};
};
DocCommentHighlightRules.getEndRule = function (start) {
return {
token : "comment.doc", // closing comment
merge : true,
regex : "\\*\\/",
next : start
};
};
}).call(DocCommentHighlightRules.prototype);
exports.DocCommentHighlightRules = DocCommentHighlightRules;

View file

@ -64,7 +64,7 @@ var GroovyHighlightRules = function() {
token : "comment",
regex : "\\/\\/.*$"
},
new DocCommentHighlightRules().getStartRule("doc-start"),
DocCommentHighlightRules.getStartRule("doc-start"),
{
token : "comment", // multi line comment
merge : true,
@ -134,7 +134,7 @@ var GroovyHighlightRules = function() {
};
this.embedRules(DocCommentHighlightRules, "doc-",
[ new DocCommentHighlightRules().getEndRule("start") ]);
[ DocCommentHighlightRules.getEndRule("start") ]);
};
oop.inherits(GroovyHighlightRules, TextHighlightRules);

View file

@ -26,7 +26,7 @@ var HaxeHighlightRules = function() {
token : "comment",
regex : "\\/\\/.*$"
},
new DocCommentHighlightRules().getStartRule("doc-start"),
DocCommentHighlightRules.getStartRule("doc-start"),
{
token : "comment", // multi line comment
regex : "\\/\\*",
@ -95,7 +95,7 @@ var HaxeHighlightRules = function() {
};
this.embedRules(DocCommentHighlightRules, "doc-",
[ new DocCommentHighlightRules().getEndRule("start") ]);
[ DocCommentHighlightRules.getEndRule("start") ]);
};
oop.inherits(HaxeHighlightRules, TextHighlightRules);

View file

@ -65,7 +65,7 @@ var JavaHighlightRules = function() {
token : "comment",
regex : "\\/\\/.*$"
},
new DocCommentHighlightRules().getStartRule("doc-start"),
DocCommentHighlightRules.getStartRule("doc-start"),
{
token : "comment", // multi line comment
merge : true,
@ -135,7 +135,7 @@ var JavaHighlightRules = function() {
};
this.embedRules(DocCommentHighlightRules, "doc-",
[ new DocCommentHighlightRules().getEndRule("start") ]);
[ DocCommentHighlightRules.getEndRule("start") ]);
};
oop.inherits(JavaHighlightRules, TextHighlightRules);

View file

@ -116,7 +116,7 @@ var JavaScriptHighlightRules = function() {
token : "comment",
regex : /\/\/.*$/
},
new DocCommentHighlightRules().getStartRule("doc-start"),
DocCommentHighlightRules.getStartRule("doc-start"),
{
token : "comment", // multi line comment
merge : true,
@ -445,7 +445,7 @@ var JavaScriptHighlightRules = function() {
};
this.embedRules(DocCommentHighlightRules, "doc-",
[ new DocCommentHighlightRules().getEndRule("start") ]);
[ DocCommentHighlightRules.getEndRule("start") ]);
};
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);

View file

@ -442,7 +442,7 @@ var PgsqlHighlightRules = function() {
token : "comment",
regex : "--.*$"
},
new DocCommentHighlightRules().getStartRule("doc-start"),
DocCommentHighlightRules.getStartRule("doc-start"),
{
token : "comment", // multi-line comment
merge : true,
@ -571,7 +571,7 @@ var PgsqlHighlightRules = function() {
]
};
this.embedRules(DocCommentHighlightRules, "doc-", [ new DocCommentHighlightRules().getEndRule("start") ]);
this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]);
this.embedRules(PerlHighlightRules, "perl-", [{token : "string", regex : "\\$perl\\$", next : "statement"}]);
this.embedRules(PythonHighlightRules, "python-", [{token : "string", regex : "\\$python\\$", next : "statement"}]);
};

View file

@ -45,7 +45,7 @@ var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocComme
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var PhpHighlightRules = function() {
var docComment = new DocCommentHighlightRules();
var docComment = DocCommentHighlightRules;
// http://php.net/quickref.php
var builtinFunctions = lang.arrayToMap(
('abs|acos|acosh|addcslashes|addslashes|aggregate|aggregate_info|aggregate_methods|aggregate_methods_by_list|aggregate_methods_by_regexp|' +
@ -1150,7 +1150,7 @@ var PhpHighlightRules = function() {
};
this.embedRules(DocCommentHighlightRules, "doc-",
[ new DocCommentHighlightRules().getEndRule("start") ]);
[ DocCommentHighlightRules.getEndRule("start") ]);
};
oop.inherits(PhpHighlightRules, TextHighlightRules);

View file

@ -65,7 +65,7 @@ var scadHighlightRules = function() {
token : "comment",
regex : "\\/\\/.*$"
},
new DocCommentHighlightRules().getStartRule("start"),
DocCommentHighlightRules.getStartRule("start"),
{
token : "comment", // multi line comment
merge : true,
@ -159,7 +159,7 @@ var scadHighlightRules = function() {
};
this.embedRules(DocCommentHighlightRules, "doc-",
[ new DocCommentHighlightRules().getEndRule("start") ]);
[ DocCommentHighlightRules.getEndRule("start") ]);
};
oop.inherits(scadHighlightRules, TextHighlightRules);

View file

@ -65,7 +65,7 @@ var ScalaHighlightRules = function() {
token : "comment",
regex : "\\/\\/.*$"
},
new DocCommentHighlightRules().getStartRule("doc-start"),
DocCommentHighlightRules.getStartRule("doc-start"),
{
token : "comment", // multi line comment
merge : true,
@ -135,7 +135,7 @@ var ScalaHighlightRules = function() {
};
this.embedRules(DocCommentHighlightRules, "doc-",
[ new DocCommentHighlightRules().getEndRule("start") ]);
[ DocCommentHighlightRules.getEndRule("start") ]);
};
oop.inherits(ScalaHighlightRules, TextHighlightRules);