create tokenizer only when needed

This commit is contained in:
nightwing 2013-09-09 18:08:23 +04:00
commit 811d190c95
95 changed files with 122 additions and 281 deletions

View file

@ -39,9 +39,7 @@ var TextMode = require("./text").Mode;
var oop = require("../lib/oop");
function Mode() {
var highlighter = new Rules();
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$keywordList = new Rules(highlighter.$keywordList);
this.HighlightRules = Rules;
this.foldingRules = new FoldMode();
}

View file

@ -48,16 +48,14 @@ var ActionScriptHighlightRules = require("./actionscript_highlight_rules").Actio
var FoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
var highlighter = new ActionScriptHighlightRules();
this.HighlightRules = ActionScriptHighlightRules;
this.foldingRules = new FoldMode();
this.$tokenizer = new Tokenizer(highlighter.getRules());
};
oop.inherits(Mode, TextMode);
(function() {
this.lineCommentStart = "//";
this.blockComment = {start: "/*", end: "*/"};
// Extra logic goes here.
}).call(Mode.prototype);
exports.Mode = Mode;

View file

@ -38,7 +38,7 @@ var AdaHighlightRules = require("./ada_highlight_rules").AdaHighlightRules;
var Range = require("../range").Range;
var Mode = function() {
this.$tokenizer = new Tokenizer(new AdaHighlightRules().getRules());
this.HighlightRules = AdaHighlightRules;
};
oop.inherits(Mode, TextMode);

View file

@ -38,9 +38,8 @@ var AsciidocHighlightRules = require("./asciidoc_highlight_rules").AsciidocHighl
var AsciidocFoldMode = require("./folding/asciidoc").FoldMode;
var Mode = function() {
var highlighter = new AsciidocHighlightRules();
this.HighlightRules = AsciidocHighlightRules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.foldingRules = new AsciidocFoldMode();
};
oop.inherits(Mode, TextMode);

View file

@ -43,15 +43,13 @@ var AssemblyX86HighlightRules = require("./assembly_x86_highlight_rules").Assemb
var FoldMode = require("./folding/coffee").FoldMode;
var Mode = function() {
var highlighter = new AssemblyX86HighlightRules();
this.HighlightRules = AssemblyX86HighlightRules;
this.foldingRules = new FoldMode();
this.$tokenizer = new Tokenizer(highlighter.getRules());
};
oop.inherits(Mode, TextMode);
(function() {
this.lineCommentStart = ";";
// Extra logic goes here.
}).call(Mode.prototype);
exports.Mode = Mode;

View file

@ -48,16 +48,14 @@ var AutoHotKeyHighlightRules = require("./autohotkey_highlight_rules").AutoHotKe
var FoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
var highlighter = new AutoHotKeyHighlightRules();
this.HighlightRules = AutoHotKeyHighlightRules;
this.foldingRules = new FoldMode();
this.$tokenizer = new Tokenizer(highlighter.getRules());
};
oop.inherits(Mode, TextMode);
(function() {
this.lineCommentStart = "/\\*";
this.blockComment = {start: "/*", end: "*/"};
// Extra logic goes here.
}).call(Mode.prototype);
exports.Mode = Mode;

View file

@ -47,16 +47,14 @@ var BatchFileHighlightRules = require("./batchfile_highlight_rules").BatchFileHi
var FoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
var highlighter = new BatchFileHighlightRules();
this.HighlightRules = BatchFileHighlightRules;
this.foldingRules = new FoldMode();
this.$tokenizer = new Tokenizer(highlighter.getRules());
};
oop.inherits(Mode, TextMode);
(function() {
this.lineCommentStart = "::";
this.blockComment = "";
// Extra logic goes here.
}).call(Mode.prototype);
exports.Mode = Mode;

View file

@ -39,7 +39,7 @@ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutd
var C9StyleFoldMode = require("./folding/c9search").FoldMode;
var Mode = function() {
this.$tokenizer = new Tokenizer(new C9SearchHighlightRules().getRules());
this.HighlightRules = C9SearchHighlightRules;
this.$outdent = new MatchingBraceOutdent();
this.foldingRules = new C9StyleFoldMode();
};

View file

@ -41,12 +41,10 @@ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
var highlighter = new c_cppHighlightRules();
this.HighlightRules = c_cppHighlightRules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$outdent = new MatchingBraceOutdent();
this.$behaviour = new CstyleBehaviour();
this.$keywordList = highlighter.$keywordList;
this.foldingRules = new CStyleFoldMode();
};

View file

@ -39,9 +39,7 @@ var MatchingParensOutdent = require("./matching_parens_outdent").MatchingParensO
var Range = require("../range").Range;
var Mode = function() {
var highlighter = new ClojureHighlightRules();
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$keywordList = highlighter.$keywordList;
this.HighlightRules = ClojureHighlightRules;
this.$outdent = new MatchingParensOutdent();
};
oop.inherits(Mode, TextMode);

View file

@ -38,7 +38,7 @@ var CobolHighlightRules = require("./cobol_highlight_rules").CobolHighlightRules
var Range = require("../range").Range;
var Mode = function() {
this.$tokenizer = new Tokenizer(new CobolHighlightRules().getRules());
this.HighlightRules = CobolHighlightRules;
};
oop.inherits(Mode, TextMode);

View file

@ -41,10 +41,8 @@ var WorkerClient = require("../worker/worker_client").WorkerClient;
var oop = require("../lib/oop");
function Mode() {
var highlighter = new Rules();
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.HighlightRules = Rules;
this.$outdent = new Outdent();
this.$keywordList = highlighter.$keywordList;
this.foldingRules = new FoldMode();
}

View file

@ -41,10 +41,8 @@ var ColdfusionHighlightRules = require("./coldfusion_highlight_rules").Coldfusio
var Mode = function() {
XmlMode.call(this);
var highlighter = new ColdfusionHighlightRules();
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.HighlightRules = ColdfusionHighlightRules;
this.$embeds = highlighter.getEmbeds();
this.createModeDelegates({
"js-": JavaScriptMode,
"css-": CssMode

View file

@ -10,11 +10,9 @@ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
var highlighter = new CSharpHighlightRules();
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.HighlightRules = CSharpHighlightRules;
this.$outdent = new MatchingBraceOutdent();
this.$behaviour = new CstyleBehaviour();
this.$keywordList = highlighter.$keywordList;
this.foldingRules = new CStyleFoldMode();
};
oop.inherits(Mode, TextMode);

View file

@ -41,11 +41,9 @@ var CssBehaviour = require("./behaviour/css").CssBehaviour;
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
var highlighter = new CssHighlightRules();
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.HighlightRules = CssHighlightRules;
this.$outdent = new MatchingBraceOutdent();
this.$behaviour = new CssBehaviour();
this.$keywordList = highlighter.$keywordList;
this.foldingRules = new CStyleFoldMode();
};
oop.inherits(Mode, TextMode);

View file

@ -49,39 +49,14 @@ var HtmlFoldMode = require("./folding/html").FoldMode;
var CurlyHighlightRules = require("./curly_highlight_rules").CurlyHighlightRules;
var Mode = function() {
// set everything up
var highlighter = new CurlyHighlightRules();
HtmlMode.call(this);
this.HighlightRules = CurlyHighlightRules;
this.$outdent = new MatchingBraceOutdent();
this.foldingRules = new HtmlFoldMode();
this.$tokenizer = new Tokenizer(highlighter.getRules());
};
oop.inherits(Mode, HtmlMode);
(function() {
// Extra logic goes here--we won't be covering all of this
/* These are all optional pieces of code!
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
return indent;
};
this.checkOutdent = function(state, line, input) {
return this.$outdent.checkOutdent(line, input);
};
this.autoOutdent = function(state, doc, row) {
this.$outdent.autoOutdent(doc, row);
};
this.createWorker = function(session) {
var worker = new WorkerClient(["ace"], "ace/mode/mynew_worker", "NewWorker");
worker.attachToDocument(session.getDocument());
return worker;
};
*/
}).call(Mode.prototype);
exports.Mode = Mode;

View file

@ -42,16 +42,14 @@ var DHighlightRules = require("./d_highlight_rules").DHighlightRules;
var FoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
var highlighter = new DHighlightRules();
this.HighlightRules = DHighlightRules;
this.foldingRules = new FoldMode();
this.$tokenizer = new Tokenizer(highlighter.getRules());
};
oop.inherits(Mode, TextMode);
(function() {
this.lineCommentStart = "/\\+";
this.blockComment = {start: "/*", end: "*/"};
// Extra logic goes here.
}).call(Mode.prototype);
exports.Mode = Mode;

View file

@ -48,16 +48,12 @@ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
CMode.call(this);
var highlighter = new DartHighlightRules();
this.HighlightRules = DartHighlightRules;
this.foldingRules = new CStyleFoldMode();
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$keywordList = highlighter.$keywordList;
};
oop.inherits(Mode, CMode);
(function() {
// Extra logic goes here.
(function() {
this.lineCommentStart = "//";
this.blockComment = {start: "/*", end: "*/"};
}).call(Mode.prototype);

View file

@ -38,7 +38,7 @@ var HighlightRules = require("./diff_highlight_rules").DiffHighlightRules;
var FoldMode = require("./folding/diff").FoldMode;
var Mode = function() {
this.$tokenizer = new Tokenizer(new HighlightRules().getRules());
this.HighlightRules = HighlightRules;
this.foldingRules = new FoldMode(["diff", "index", "\\+{3}", "@@|\\*{5}"], "i");
};
oop.inherits(Mode, TextMode);

View file

@ -107,9 +107,8 @@ var DjangoHtmlHighlightRules = function() {
oop.inherits(DjangoHtmlHighlightRules, HtmlHighlightRules);
var Mode = function() {
var highlighter = new DjangoHtmlHighlightRules();
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$embeds = highlighter.getEmbeds();
HtmlMode.call(this);
this.HighlightRules = DjangoHtmlHighlightRules;
};
oop.inherits(Mode, HtmlMode);

Some files were not shown because too many files have changed in this diff Show more