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"); var oop = require("../lib/oop");
function Mode() { function Mode() {
var highlighter = new Rules(); this.HighlightRules = Rules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$keywordList = new Rules(highlighter.$keywordList);
this.foldingRules = new FoldMode(); this.foldingRules = new FoldMode();
} }

View file

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

View file

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

View file

@ -38,9 +38,8 @@ var AsciidocHighlightRules = require("./asciidoc_highlight_rules").AsciidocHighl
var AsciidocFoldMode = require("./folding/asciidoc").FoldMode; var AsciidocFoldMode = require("./folding/asciidoc").FoldMode;
var Mode = function() { var Mode = function() {
var highlighter = new AsciidocHighlightRules(); this.HighlightRules = AsciidocHighlightRules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.foldingRules = new AsciidocFoldMode(); this.foldingRules = new AsciidocFoldMode();
}; };
oop.inherits(Mode, TextMode); 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 FoldMode = require("./folding/coffee").FoldMode;
var Mode = function() { var Mode = function() {
var highlighter = new AssemblyX86HighlightRules(); this.HighlightRules = AssemblyX86HighlightRules;
this.foldingRules = new FoldMode(); this.foldingRules = new FoldMode();
this.$tokenizer = new Tokenizer(highlighter.getRules());
}; };
oop.inherits(Mode, TextMode); oop.inherits(Mode, TextMode);
(function() { (function() {
this.lineCommentStart = ";"; this.lineCommentStart = ";";
// Extra logic goes here.
}).call(Mode.prototype); }).call(Mode.prototype);
exports.Mode = Mode; exports.Mode = Mode;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -49,39 +49,14 @@ var HtmlFoldMode = require("./folding/html").FoldMode;
var CurlyHighlightRules = require("./curly_highlight_rules").CurlyHighlightRules; var CurlyHighlightRules = require("./curly_highlight_rules").CurlyHighlightRules;
var Mode = function() { var Mode = function() {
// set everything up HtmlMode.call(this);
var highlighter = new CurlyHighlightRules(); this.HighlightRules = CurlyHighlightRules;
this.$outdent = new MatchingBraceOutdent(); this.$outdent = new MatchingBraceOutdent();
this.foldingRules = new HtmlFoldMode(); this.foldingRules = new HtmlFoldMode();
this.$tokenizer = new Tokenizer(highlighter.getRules());
}; };
oop.inherits(Mode, HtmlMode); oop.inherits(Mode, HtmlMode);
(function() { (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); }).call(Mode.prototype);
exports.Mode = Mode; exports.Mode = Mode;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -92,9 +92,7 @@ var RubyMode = require("./ruby").Mode;
var Mode = function() { var Mode = function() {
HtmlMode.call(this); HtmlMode.call(this);
var highlighter = new EjsHighlightRules(); this.HighlightRules = EjsHighlightRules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$embeds = highlighter.getEmbeds();
this.createModeDelegates({ this.createModeDelegates({
"js-": JavaScriptMode, "js-": JavaScriptMode,
"css-": CssMode, "css-": CssMode,

View file

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

View file

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

View file

@ -37,8 +37,7 @@ var Tokenizer = require("../tokenizer").Tokenizer;
var FtlHighlightRules = require("./ftl_highlight_rules").FtlHighlightRules; var FtlHighlightRules = require("./ftl_highlight_rules").FtlHighlightRules;
var Mode = function() { var Mode = function() {
var highlighter = new FtlHighlightRules(); this.HighlightRules = FtlHighlightRules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
}; };
oop.inherits(Mode, TextMode); oop.inherits(Mode, TextMode);

View file

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

View file

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

View file

@ -8,9 +8,7 @@ var GroovyHighlightRules = require("./groovy_highlight_rules").GroovyHighlightRu
var Mode = function() { var Mode = function() {
JavaScriptMode.call(this); JavaScriptMode.call(this);
var highlighter = new GroovyHighlightRules(); this.HighlightRules = GroovyHighlightRules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$keywordList = highlighter.$keywordList;
}; };
oop.inherits(Mode, JavaScriptMode); oop.inherits(Mode, JavaScriptMode);

View file

@ -47,10 +47,8 @@ var HamlHighlightRules = require("./haml_highlight_rules").HamlHighlightRules;
var FoldMode = require("./folding/coffee").FoldMode; var FoldMode = require("./folding/coffee").FoldMode;
var Mode = function() { var Mode = function() {
var highlighter = new HamlHighlightRules(); this.HighlightRules = HamlHighlightRules;
this.foldingRules = new FoldMode(); this.foldingRules = new FoldMode();
this.$tokenizer = new Tokenizer(highlighter.getRules());
}; };
oop.inherits(Mode, TextMode); oop.inherits(Mode, TextMode);

View file

@ -12,11 +12,9 @@ var HtmlFoldMode = require("./folding/html").FoldMode;
var Mode = function() { var Mode = function() {
HtmlMode.call(this); HtmlMode.call(this);
var highlighter = new HandlebarsHighlightRules(); this.HighlightRules = HandlebarsHighlightRules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$behaviour = new HtmlBehaviour(); this.$behaviour = new HtmlBehaviour();
this.$embeds = highlighter.getEmbeds();
this.foldingRules = new HtmlFoldMode(); this.foldingRules = new HtmlFoldMode();
}; };

View file

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

View file

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

View file

@ -42,12 +42,10 @@ var HtmlFoldMode = require("./folding/html").FoldMode;
var HtmlCompletions = require("./html_completions").HtmlCompletions; var HtmlCompletions = require("./html_completions").HtmlCompletions;
var Mode = function() { var Mode = function() {
var highlighter = new HtmlHighlightRules(); this.HighlightRules = HtmlHighlightRules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$behaviour = new HtmlBehaviour(); this.$behaviour = new HtmlBehaviour();
this.$completer = new HtmlCompletions(); this.$completer = new HtmlCompletions();
this.$embeds = highlighter.getEmbeds();
this.createModeDelegates({ this.createModeDelegates({
"js-": JavaScriptMode, "js-": JavaScriptMode,
"css-": CssMode "css-": CssMode

View file

@ -42,9 +42,7 @@ var RubyMode = require("./ruby").Mode;
var Mode = function() { var Mode = function() {
HtmlMode.call(this); HtmlMode.call(this);
var highlighter = new HtmlRubyHighlightRules(); this.HighlightRules = HtmlRubyHighlightRules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$embeds = highlighter.getEmbeds();
this.createModeDelegates({ this.createModeDelegates({
"js-": JavaScriptMode, "js-": JavaScriptMode,
"css-": CssMode, "css-": CssMode,

View file

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

View file

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

View file

@ -8,10 +8,7 @@ var JavaHighlightRules = require("./java_highlight_rules").JavaHighlightRules;
var Mode = function() { var Mode = function() {
JavaScriptMode.call(this); JavaScriptMode.call(this);
var highlighter = new JavaHighlightRules(); this.HighlightRules = JavaHighlightRules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$keywordList = highlighter.$keywordList;
}; };
oop.inherits(Mode, JavaScriptMode); oop.inherits(Mode, JavaScriptMode);

View file

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

View file

@ -41,7 +41,7 @@ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var WorkerClient = require("../worker/worker_client").WorkerClient; var WorkerClient = require("../worker/worker_client").WorkerClient;
var Mode = function() { var Mode = function() {
this.$tokenizer = new Tokenizer(new HighlightRules().getRules()); this.HighlightRules = HighlightRules;
this.$outdent = new MatchingBraceOutdent(); this.$outdent = new MatchingBraceOutdent();
this.$behaviour = new CstyleBehaviour(); this.$behaviour = new CstyleBehaviour();
this.foldingRules = new CStyleFoldMode(); this.foldingRules = new CStyleFoldMode();

View file

@ -40,8 +40,7 @@ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
var CStyleFoldMode = require("./folding/cstyle").FoldMode; var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() { var Mode = function() {
var highlighter = new JspHighlightRules(); this.HighlightRules = JspHighlightRules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$outdent = new MatchingBraceOutdent(); this.$outdent = new MatchingBraceOutdent();
this.$behaviour = new CstyleBehaviour(); this.$behaviour = new CstyleBehaviour();
this.foldingRules = new CStyleFoldMode(); this.foldingRules = new CStyleFoldMode();

View file

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

View file

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

View file

@ -9,7 +9,7 @@ var LatexFoldMode = require("./folding/latex").FoldMode;
var Range = require("../range").Range; var Range = require("../range").Range;
var Mode = function() { var Mode = function() {
this.$tokenizer = new Tokenizer(new LatexHighlightRules().getRules()); this.HighlightRules = LatexHighlightRules;
this.foldingRules = new LatexFoldMode(); this.foldingRules = new LatexFoldMode();
}; };
oop.inherits(Mode, TextMode); oop.inherits(Mode, TextMode);

View file

@ -40,7 +40,7 @@ var CssBehaviour = require("./behaviour/css").CssBehaviour;
var CStyleFoldMode = require("./folding/cstyle").FoldMode; var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() { var Mode = function() {
this.$tokenizer = new Tokenizer(new LessHighlightRules().getRules()); this.HighlightRules = LessHighlightRules;
this.$outdent = new MatchingBraceOutdent(); this.$outdent = new MatchingBraceOutdent();
this.$behaviour = new CssBehaviour(); this.$behaviour = new CssBehaviour();
this.foldingRules = new CStyleFoldMode(); this.foldingRules = new CStyleFoldMode();

View file

@ -38,10 +38,7 @@ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutd
var Range = require("../range").Range; var Range = require("../range").Range;
var Mode = function() { var Mode = function() {
var highlighter = new LiquidHighlightRules(); this.HighlightRules = LiquidHighlightRules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$keywordList = highlighter.$keywordList;
this.$outdent = new MatchingBraceOutdent(); this.$outdent = new MatchingBraceOutdent();
}; };
oop.inherits(Mode, TextMode); oop.inherits(Mode, TextMode);

View file

@ -42,10 +42,7 @@ var Tokenizer = require("../tokenizer").Tokenizer;
var LispHighlightRules = require("./lisp_highlight_rules").LispHighlightRules; var LispHighlightRules = require("./lisp_highlight_rules").LispHighlightRules;
var Mode = function() { var Mode = function() {
var highlighter = new LispHighlightRules(); this.HighlightRules = LispHighlightRules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$keywordList = highlighter.$keywordList;
}; };
oop.inherits(Mode, TextMode); oop.inherits(Mode, TextMode);

View file

@ -42,9 +42,8 @@ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var Mode = function() { var Mode = function() {
var highlighter = new LogiQLHighlightRules(); this.HighlightRules = LogiQLHighlightRules;
this.foldingRules = new FoldMode(); this.foldingRules = new FoldMode();
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$outdent = new MatchingBraceOutdent(); this.$outdent = new MatchingBraceOutdent();
this.$behaviour = new CstyleBehaviour(); this.$behaviour = new CstyleBehaviour();
}; };
@ -134,7 +133,6 @@ oop.inherits(Mode, TextMode);
var row = it.getCurrentTokenRow(); var row = it.getCurrentTokenRow();
return new Range(row, col, row, col + tok.value.length); return new Range(row, col, row, col + tok.value.length);
}; };
// Extra logic goes here.
}).call(Mode.prototype); }).call(Mode.prototype);
exports.Mode = Mode; exports.Mode = Mode;

View file

@ -41,7 +41,7 @@ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var Mode = function() { var Mode = function() {
this.$tokenizer = new Tokenizer(new Rules().getRules()); this.HighlightRules = Rules;
this.$outdent = new Outdent(); this.$outdent = new Outdent();
this.$behaviour = new CstyleBehaviour(); this.$behaviour = new CstyleBehaviour();
this.foldingRules = new CStyleFoldMode(); this.foldingRules = new CStyleFoldMode();

View file

@ -40,11 +40,9 @@ var Range = require("../range").Range;
var WorkerClient = require("../worker/worker_client").WorkerClient; var WorkerClient = require("../worker/worker_client").WorkerClient;
var Mode = function() { var Mode = function() {
var highlighter = new LuaHighlightRules(); this.HighlightRules = LuaHighlightRules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.foldingRules = new LuaFoldMode(); this.foldingRules = new LuaFoldMode();
this.$keywordList = highlighter.$keywordList;
}; };
oop.inherits(Mode, TextMode); oop.inherits(Mode, TextMode);

View file

@ -8,10 +8,9 @@ var Tokenizer = require("../tokenizer").Tokenizer;
var LuaPageHighlightRules = require("./luapage_highlight_rules").LuaPageHighlightRules; var LuaPageHighlightRules = require("./luapage_highlight_rules").LuaPageHighlightRules;
var Mode = function() { var Mode = function() {
var highlighter = new LuaPageHighlightRules(); this.HighlightRules = LuaPageHighlightRules;
this.$tokenizer = new Tokenizer(new LuaPageHighlightRules().getRules()); this.HighlightRules = LuaPageHighlightRules;
this.$embeds = highlighter.getEmbeds();
this.createModeDelegates({ this.createModeDelegates({
"lua-": LuaMode "lua-": LuaMode
}); });

View file

@ -47,11 +47,8 @@ var MakefileHighlightRules = require("./makefile_highlight_rules").MakefileHighl
var FoldMode = require("./folding/coffee").FoldMode; var FoldMode = require("./folding/coffee").FoldMode;
var Mode = function() { var Mode = function() {
var highlighter = new MakefileHighlightRules(); this.HighlightRules = MakefileHighlightRules;
this.foldingRules = new FoldMode(); this.foldingRules = new FoldMode();
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$keywordList = highlighter.$keywordList;
}; };
oop.inherits(Mode, TextMode); oop.inherits(Mode, TextMode);

View file

@ -41,10 +41,8 @@ var MarkdownHighlightRules = require("./markdown_highlight_rules").MarkdownHighl
var MarkdownFoldMode = require("./folding/markdown").FoldMode; var MarkdownFoldMode = require("./folding/markdown").FoldMode;
var Mode = function() { var Mode = function() {
var highlighter = new MarkdownHighlightRules(); this.HighlightRules = MarkdownHighlightRules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$embeds = highlighter.getEmbeds();
this.createModeDelegates({ this.createModeDelegates({
"js-": JavaScriptMode, "js-": JavaScriptMode,
"xml-": XmlMode, "xml-": XmlMode,

View file

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

View file

@ -39,7 +39,7 @@ var PythonFoldMode = require("./folding/pythonic").FoldMode;
var Range = require("../range").Range; var Range = require("../range").Range;
var Mode = function() { var Mode = function() {
this.$tokenizer = new Tokenizer(new MushCodeRules().getRules()); this.HighlightRules = MushCodeRules;
this.foldingRules = new PythonFoldMode("\\:"); this.foldingRules = new PythonFoldMode("\\:");
}; };
oop.inherits(Mode, TextMode); oop.inherits(Mode, TextMode);

View file

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

View file

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

View file

@ -47,10 +47,8 @@ var ObjectiveCHighlightRules = require("./objectivec_highlight_rules").Objective
var CStyleFoldMode = require("./folding/cstyle").FoldMode; var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() { var Mode = function() {
var highlighter = new ObjectiveCHighlightRules(); this.HighlightRules = ObjectiveCHighlightRules;
this.foldingRules = new CStyleFoldMode(); this.foldingRules = new CStyleFoldMode();
this.$tokenizer = new Tokenizer(highlighter.getRules());
}; };
oop.inherits(Mode, TextMode); oop.inherits(Mode, TextMode);

View file

@ -39,11 +39,9 @@ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutd
var Range = require("../range").Range; var Range = require("../range").Range;
var Mode = function() { var Mode = function() {
var highlighter = new OcamlHighlightRules(); this.HighlightRules = OcamlHighlightRules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$outdent = new MatchingBraceOutdent(); this.$outdent = new MatchingBraceOutdent();
this.$keywordList = highlighter.$keywordList;
}; };
oop.inherits(Mode, TextMode); oop.inherits(Mode, TextMode);

View file

@ -48,9 +48,8 @@ var PascalHighlightRules = require("./pascal_highlight_rules").PascalHighlightRu
var FoldMode = require("./folding/coffee").FoldMode; var FoldMode = require("./folding/coffee").FoldMode;
var Mode = function() { var Mode = function() {
var highlighter = new PascalHighlightRules(); this.HighlightRules = PascalHighlightRules;
this.foldingRules = new FoldMode(); this.foldingRules = new FoldMode();
this.$tokenizer = new Tokenizer(highlighter.getRules());
}; };
oop.inherits(Mode, TextMode); oop.inherits(Mode, TextMode);

View file

@ -40,12 +40,10 @@ var Range = require("../range").Range;
var CStyleFoldMode = require("./folding/cstyle").FoldMode; var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() { var Mode = function() {
var highlighter = new PerlHighlightRules(); this.HighlightRules = PerlHighlightRules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$outdent = new MatchingBraceOutdent(); this.$outdent = new MatchingBraceOutdent();
this.foldingRules = new CStyleFoldMode({start: "^=(begin|item)\\b", end: "^=(cut)\\b"}); this.foldingRules = new CStyleFoldMode({start: "^=(begin|item)\\b", end: "^=(cut)\\b"});
this.$keywordList = highlighter.$keywordList;
}; };
oop.inherits(Mode, TextMode); oop.inherits(Mode, TextMode);

View file

@ -37,10 +37,7 @@ var PgsqlHighlightRules = require("./pgsql_highlight_rules").PgsqlHighlightRules
var Range = require("../range").Range; var Range = require("../range").Range;
var Mode = function() { var Mode = function() {
var highlighter = new PgsqlHighlightRules(); this.HighlightRules = PgsqlHighlightRules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$keywordList = highlighter.$keywordList;
}; };
oop.inherits(Mode, TextMode); oop.inherits(Mode, TextMode);

View file

@ -46,7 +46,7 @@ var unicode = require("../unicode");
var Mode = function(opts) { var Mode = function(opts) {
var inline = opts && opts.inline; var inline = opts && opts.inline;
var HighlightRules = inline ? PhpLangHighlightRules : PhpHighlightRules; var HighlightRules = inline ? PhpLangHighlightRules : PhpHighlightRules;
this.$tokenizer = new Tokenizer(new HighlightRules().getRules()); this.HighlightRules = HighlightRules;
this.$outdent = new MatchingBraceOutdent(); this.$outdent = new MatchingBraceOutdent();
this.$behaviour = new CstyleBehaviour(); this.$behaviour = new CstyleBehaviour();
this.foldingRules = new CStyleFoldMode(); this.foldingRules = new CStyleFoldMode();

View file

@ -38,7 +38,7 @@ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var Behaviour = require("./behaviour").Behaviour; var Behaviour = require("./behaviour").Behaviour;
var Mode = function() { var Mode = function() {
this.$tokenizer = new Tokenizer(new TextHighlightRules().getRules()); this.HighlightRules = TextHighlightRules;
this.$behaviour = new Behaviour(); this.$behaviour = new Behaviour();
}; };

View file

@ -10,10 +10,7 @@ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
var CStyleFoldMode = require("./folding/cstyle").FoldMode; var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() { var Mode = function() {
var highlighter = new PowershellHighlightRules(); this.HighlightRules = PowershellHighlightRules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$keywordList = highlighter.$keywordList;
this.$outdent = new MatchingBraceOutdent(); this.$outdent = new MatchingBraceOutdent();
this.$behaviour = new CstyleBehaviour(); this.$behaviour = new CstyleBehaviour();
this.foldingRules = new CStyleFoldMode({start: "^\\s*(<#)", end: "^[#\\s]>\\s*$"}); this.foldingRules = new CStyleFoldMode({start: "^\\s*(<#)", end: "^[#\\s]>\\s*$"});

View file

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

View file

@ -37,8 +37,7 @@ var Tokenizer = require("../tokenizer").Tokenizer;
var PropertiesHighlightRules = require("./properties_highlight_rules").PropertiesHighlightRules; var PropertiesHighlightRules = require("./properties_highlight_rules").PropertiesHighlightRules;
var Mode = function() { var Mode = function() {
var highlighter = new PropertiesHighlightRules(); this.HighlightRules = PropertiesHighlightRules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
}; };
oop.inherits(Mode, TextMode); oop.inherits(Mode, TextMode);

View file

@ -39,9 +39,7 @@ var PythonFoldMode = require("./folding/pythonic").FoldMode;
var Range = require("../range").Range; var Range = require("../range").Range;
var Mode = function() { var Mode = function() {
var highlighter = new PythonHighlightRules(); this.HighlightRules = PythonHighlightRules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$keywordList = highlighter.$keywordList;
this.foldingRules = new PythonFoldMode("\\:"); this.foldingRules = new PythonFoldMode("\\:");
}; };
oop.inherits(Mode, TextMode); oop.inherits(Mode, TextMode);

View file

@ -29,7 +29,7 @@ define(function(require, exports, module) {
var Mode = function() var Mode = function()
{ {
this.$tokenizer = new Tokenizer(new RHighlightRules().getRules()); this.HighlightRules = RHighlightRules;
this.$outdent = new MatchingBraceOutdent(); this.$outdent = new MatchingBraceOutdent();
}; };
oop.inherits(Mode, TextMode); oop.inherits(Mode, TextMode);

View file

@ -21,7 +21,7 @@ var RDocHighlightRules = require("./rdoc_highlight_rules").RDocHighlightRules;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var Mode = function(suppressHighlighting) { var Mode = function(suppressHighlighting) {
this.$tokenizer = new Tokenizer(new RDocHighlightRules().getRules()); this.HighlightRules = RDocHighlightRules;
this.$outdent = new MatchingBraceOutdent(); this.$outdent = new MatchingBraceOutdent();
}; };
oop.inherits(Mode, TextMode); oop.inherits(Mode, TextMode);

View file

@ -31,7 +31,7 @@ var RCodeModel = require("mode/r_code_model").RCodeModel;
var Mode = function(doc, session) { var Mode = function(doc, session) {
this.$session = session; this.$session = session;
this.$tokenizer = new Tokenizer(new RHtmlHighlightRules().getRules()); this.HighlightRules = RHtmlHighlightRules;
/* Or these. /* Or these.
this.codeModel = new RCodeModel(doc, this.$tokenizer, /^r-/, this.codeModel = new RCodeModel(doc, this.$tokenizer, /^r-/,

View file

@ -40,10 +40,7 @@ var Range = require("../range").Range;
var FoldMode = require("./folding/coffee").FoldMode; var FoldMode = require("./folding/coffee").FoldMode;
var Mode = function() { var Mode = function() {
var highlighter = new RubyHighlightRules(); this.HighlightRules = RubyHighlightRules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$keywordList = highlighter.$keywordList;
this.$outdent = new MatchingBraceOutdent(); this.$outdent = new MatchingBraceOutdent();
this.foldingRules = new FoldMode(); this.foldingRules = new FoldMode();
}; };

View file

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

View file

@ -38,7 +38,7 @@ var SassHighlightRules = require("./sass_highlight_rules").SassHighlightRules;
var FoldMode = require("./folding/coffee").FoldMode; var FoldMode = require("./folding/coffee").FoldMode;
var Mode = function() { var Mode = function() {
this.$tokenizer = new Tokenizer(new SassHighlightRules().getRules()); this.HighlightRules = SassHighlightRules;
this.foldingRules = new FoldMode(); this.foldingRules = new FoldMode();
}; };
oop.inherits(Mode, TextMode); oop.inherits(Mode, TextMode);

View file

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

View file

@ -9,9 +9,7 @@ var ScalaHighlightRules = require("./scala_highlight_rules").ScalaHighlightRules
var Mode = function() { var Mode = function() {
JavaScriptMode.call(this); JavaScriptMode.call(this);
var highlighter = new ScalaHighlightRules(); this.HighlightRules = ScalaHighlightRules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$keywordList = highlighter.$keywordList;
}; };
oop.inherits(Mode, JavaScriptMode); oop.inherits(Mode, JavaScriptMode);

View file

@ -42,9 +42,7 @@ var Tokenizer = require("../tokenizer").Tokenizer;
var SchemeHighlightRules = require("./scheme_highlight_rules").SchemeHighlightRules; var SchemeHighlightRules = require("./scheme_highlight_rules").SchemeHighlightRules;
var Mode = function() { var Mode = function() {
var highlighter = new SchemeHighlightRules(); this.HighlightRules = SchemeHighlightRules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
}; };
oop.inherits(Mode, TextMode); oop.inherits(Mode, TextMode);

View file

@ -40,7 +40,7 @@ var CssBehaviour = require("./behaviour/css").CssBehaviour;
var CStyleFoldMode = require("./folding/cstyle").FoldMode; var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() { var Mode = function() {
this.$tokenizer = new Tokenizer(new ScssHighlightRules().getRules()); this.HighlightRules = ScssHighlightRules;
this.$outdent = new MatchingBraceOutdent(); this.$outdent = new MatchingBraceOutdent();
this.$behaviour = new CssBehaviour(); this.$behaviour = new CssBehaviour();
this.foldingRules = new CStyleFoldMode(); this.foldingRules = new CStyleFoldMode();

View file

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

View file

@ -98,9 +98,8 @@ exports.SnippetGroupHighlightRules = SnippetGroupHighlightRules;
var FoldMode = require("./folding/coffee").FoldMode; var FoldMode = require("./folding/coffee").FoldMode;
var Mode = function() { var Mode = function() {
var highlighter = new SnippetGroupHighlightRules(); this.HighlightRules = SnippetGroupHighlightRules;
this.foldingRules = new FoldMode(); this.foldingRules = new FoldMode();
this.$tokenizer = new Tokenizer(highlighter.getRules());
}; };
oop.inherits(Mode, TextMode); oop.inherits(Mode, TextMode);

View file

@ -47,16 +47,13 @@ var SoyTemplateHighlightRules = require("./soy_template_highlight_rules").SoyTem
var Mode = function() { var Mode = function() {
HtmlMode.call(this); HtmlMode.call(this);
var highlighter = new SoyTemplateHighlightRules(); this.HighlightRules = SoyTemplateHighlightRules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$keywordList = highlighter.$keywordList;
}; };
oop.inherits(Mode, HtmlMode); oop.inherits(Mode, HtmlMode);
(function() { (function() {
this.lineCommentStart = "//"; this.lineCommentStart = "//";
this.blockComment = {start: "/*", end: "*/"}; this.blockComment = {start: "/*", end: "*/"};
// Extra logic goes here.
}).call(Mode.prototype); }).call(Mode.prototype);
exports.Mode = Mode; exports.Mode = Mode;

View file

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

View file

@ -47,16 +47,12 @@ var StylusHighlightRules = require("./stylus_highlight_rules").StylusHighlightRu
var FoldMode = require("./folding/coffee").FoldMode; var FoldMode = require("./folding/coffee").FoldMode;
var Mode = function() { var Mode = function() {
var highlighter = new StylusHighlightRules(); this.HighlightRules = StylusHighlightRules;
this.foldingRules = new FoldMode(); this.foldingRules = new FoldMode();
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$keywordList = highlighter.$keywordList;
}; };
oop.inherits(Mode, TextMode); oop.inherits(Mode, TextMode);
(function() { (function() {
// Extra logic goes here.
}).call(Mode.prototype); }).call(Mode.prototype);
exports.Mode = Mode; exports.Mode = Mode;

View file

@ -43,10 +43,8 @@ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() { var Mode = function() {
XmlMode.call(this); XmlMode.call(this);
this.highlighter = new SvgHighlightRules(); this.HighlightRules = SvgHighlightRules;
this.$tokenizer = new Tokenizer(this.highlighter.getRules());
this.$embeds = this.highlighter.getEmbeds();
this.createModeDelegates({ this.createModeDelegates({
"js-": JavaScriptMode "js-": JavaScriptMode
}); });

View file

@ -40,7 +40,7 @@ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutd
var Range = require("../range").Range; var Range = require("../range").Range;
var Mode = function() { var Mode = function() {
this.$tokenizer = new Tokenizer(new TclHighlightRules().getRules()); this.HighlightRules = TclHighlightRules;
this.$outdent = new MatchingBraceOutdent(); this.$outdent = new MatchingBraceOutdent();
this.foldingRules = new CStyleFoldMode(); this.foldingRules = new CStyleFoldMode();
}; };

View file

@ -27,9 +27,9 @@ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutd
var Mode = function(suppressHighlighting) { var Mode = function(suppressHighlighting) {
if (suppressHighlighting) if (suppressHighlighting)
this.$tokenizer = new Tokenizer(new TextHighlightRules().getRules()); this.HighlightRules = TextHighlightRules;
else else
this.$tokenizer = new Tokenizer(new TexHighlightRules().getRules()); this.HighlightRules = TexHighlightRules;
this.$outdent = new MatchingBraceOutdent(); this.$outdent = new MatchingBraceOutdent();
}; };
oop.inherits(Mode, TextMode); oop.inherits(Mode, TextMode);

View file

@ -40,7 +40,7 @@ var TokenIterator = require("../token_iterator").TokenIterator;
var Range = require("../range").Range; var Range = require("../range").Range;
var Mode = function() { var Mode = function() {
this.$tokenizer = new Tokenizer(new TextHighlightRules().getRules()); this.HighlightRules = TextHighlightRules;
this.$behaviour = new Behaviour(); this.$behaviour = new Behaviour();
}; };
@ -61,6 +61,10 @@ var Mode = function() {
); );
this.getTokenizer = function() { this.getTokenizer = function() {
if (!this.$tokenizer) {
this.$highlightRules = new this.HighlightRules();
this.$tokenizer = new Tokenizer(this.$highlightRules.getRules());
}
return this.$tokenizer; return this.$tokenizer;
}; };
@ -271,13 +275,12 @@ var Mode = function() {
}; };
this.createModeDelegates = function (mapping) { this.createModeDelegates = function (mapping) {
if (!this.$embeds) { this.$embeds = [];
return;
}
this.$modes = {}; this.$modes = {};
for (var i = 0; i < this.$embeds.length; i++) { for (var i in mapping) {
if (mapping[this.$embeds[i]]) { if (mapping[i]) {
this.$modes[this.$embeds[i]] = new mapping[this.$embeds[i]](); this.$embeds.push(i);
this.$modes[i] = new mapping[i]();
} }
} }
@ -356,9 +359,15 @@ var Mode = function() {
return this.$keywordList; return this.$keywordList;
return completionKeywords.concat(this.$keywordList || []); return completionKeywords.concat(this.$keywordList || []);
}; };
this.$createKeywordList = function() {
if (!this.$highlightRules)
this.getTokenizer();
return this.$keywordList = this.$highlightRules.$keywordList || [];
}
this.getCompletions = function(state, session, pos, prefix) { this.getCompletions = function(state, session, pos, prefix) {
var keywords = this.$keywordList || []; var keywords = this.$keywordList || this.$createKeywordList();
return keywords.map(function(word) { return keywords.map(function(word) {
return { return {
name: word, name: word,

View file

@ -38,7 +38,7 @@ var TextileHighlightRules = require("./textile_highlight_rules").TextileHighligh
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var Mode = function() { var Mode = function() {
this.$tokenizer = new Tokenizer(new TextileHighlightRules().getRules()); this.HighlightRules = TextileHighlightRules;
this.$outdent = new MatchingBraceOutdent(); this.$outdent = new MatchingBraceOutdent();
}; };
oop.inherits(Mode, TextMode); oop.inherits(Mode, TextMode);

View file

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

View file

@ -42,12 +42,10 @@ var HtmlFoldMode = require("./folding/html").FoldMode;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var Mode = function() { var Mode = function() {
var highlighter = new TwigHighlightRules(); this.HighlightRules = TwigHighlightRules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$outdent = new MatchingBraceOutdent(); this.$outdent = new MatchingBraceOutdent();
this.$behaviour = new HtmlBehaviour(); this.$behaviour = new HtmlBehaviour();
this.$embeds = highlighter.getEmbeds();
this.createModeDelegates({ this.createModeDelegates({
"js-": JavaScriptMode, "js-": JavaScriptMode,
"css-": CssMode "css-": CssMode

View file

@ -44,9 +44,8 @@ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var Mode = function() { var Mode = function() {
var highlighter = new TypeScriptHighlightRules(); this.HighlightRules = TypeScriptHighlightRules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$outdent = new MatchingBraceOutdent(); this.$outdent = new MatchingBraceOutdent();
this.$behaviour = new CstyleBehaviour(); this.$behaviour = new CstyleBehaviour();
this.foldingRules = new CStyleFoldMode(); this.foldingRules = new CStyleFoldMode();

View file

@ -46,9 +46,7 @@ var Tokenizer = require("../tokenizer").Tokenizer;
var VBScriptHighlightRules = require("./vbscript_highlight_rules").VBScriptHighlightRules; var VBScriptHighlightRules = require("./vbscript_highlight_rules").VBScriptHighlightRules;
var Mode = function() { var Mode = function() {
var highlighter = new VBScriptHighlightRules(); this.HighlightRules = VBScriptHighlightRules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
}; };
oop.inherits(Mode, TextMode); oop.inherits(Mode, TextMode);

View file

@ -44,16 +44,15 @@ var FoldMode = require("./folding/velocity").FoldMode;
var HtmlBehaviour = require("./behaviour/html").HtmlBehaviour; var HtmlBehaviour = require("./behaviour/html").HtmlBehaviour;
var Mode = function() { var Mode = function() {
var highlighter = new VelocityHighlightRules(); this.HighlightRules = VelocityHighlightRules;
this.foldingRules = new FoldMode(); this.foldingRules = new FoldMode();
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$behaviour = new HtmlBehaviour(); this.$behaviour = new HtmlBehaviour();
}; };
oop.inherits(Mode, TextMode); oop.inherits(Mode, TextMode);
(function() { (function() {
this.lineCommentStart = "##"; this.lineCommentStart = "##";
this.blockComment = {start: "#*", end: "*#"}; this.blockComment = {start: "#*", end: "*#"};
}).call(Mode.prototype); }).call(Mode.prototype);
exports.Mode = Mode; exports.Mode = Mode;

View file

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

View file

@ -39,7 +39,7 @@ var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
var XmlFoldMode = require("./folding/xml").FoldMode; var XmlFoldMode = require("./folding/xml").FoldMode;
var Mode = function() { var Mode = function() {
this.$tokenizer = new Tokenizer(new XmlHighlightRules().getRules()); this.HighlightRules = XmlHighlightRules;
this.$behaviour = new XmlBehaviour(); this.$behaviour = new XmlBehaviour();
this.foldingRules = new XmlFoldMode(); this.foldingRules = new XmlFoldMode();
}; };

View file

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