Merge pull request #1595 from ajaxorg/highlighting/mixed

Improvements for highlighting mixed languages
This commit is contained in:
Lennart Kats 2013-09-24 02:56:08 -07:00
commit 5f3ba2cfe2
161 changed files with 906 additions and 619 deletions

View file

@ -301,7 +301,7 @@ var buildAce = function(options) {
noconflict: false,
suffix: null,
name: "ace",
modes: jsFileList("lib/ace/mode", /_highlight_rules|_test|_worker|xml_util|_outdent|behaviour/),
modes: jsFileList("lib/ace/mode", /_highlight_rules|_test|_worker|xml_util|_outdent|behaviour|completions/),
themes: jsFileList("lib/ace/theme"),
extensions: jsFileList("lib/ace/ext"),
workers: workers("lib/ace/mode"),
@ -522,7 +522,7 @@ function generateThemesModule(themes) {
'\n\nmodule.exports.themes = ' + JSON.stringify(themes, null, ' '),
';\n\n});'
].join('');
fs.writeFileSync('./lib/ace/ext/themelist_utils/themes.js', themelist, 'utf8');
fs.writeFileSync(__dirname + '/lib/ace/ext/themelist_utils/themes.js', themelist, 'utf8');
}
function inlineTextModules(text) {

2
build

@ -1 +1 @@
Subproject commit 8f2423d10a7cc5680dcdb42a2dd57d9b192e3b34
Subproject commit 995de31e6513ddfd5e9f66b8216f5b316fcd2253

View file

@ -66,95 +66,19 @@ function makeHuge(txt) {
}
var docs = {
"docs/javascript.js": "JavaScript",
"docs/AsciiDoc.asciidoc": "AsciiDoc",
"docs/clojure.clj": "Clojure",
"docs/coffeescript.coffee": "CoffeeScript",
"docs/coldfusion.cfm": "ColdFusion",
"docs/cpp.cpp": "C/C++",
"docs/csharp.cs": "C#",
"docs/css.css": "CSS",
"docs/curly.curly": "Curly",
"docs/dart.dart": "Dart",
"docs/diff.diff": "Diff",
"docs/dot.dot": "Dot",
"docs/freemarker.ftl" : "FreeMarker",
"docs/glsl.glsl": "Glsl",
"docs/golang.go": "Go",
"docs/groovy.groovy": "Groovy",
"docs/haml.haml": "Haml",
"docs/Haxe.hx": "haXe",
"docs/html.html": "HTML",
"docs/html_ruby.erb": "HTML (Ruby)",
"docs/jade.jade": "Jade",
"docs/java.java": "Java",
"docs/jsp.jsp": "JSP",
"docs/json.json": "JSON",
"docs/jsx.jsx": "JSX",
"docs/javascript.js": {order: 1, name: "JavaScript"},
"docs/latex.tex": {name: "LaTeX", wrapped: true},
"docs/less.less": "LESS",
"docs/lisp.lisp": "Lisp",
"docs/lsl.lsl": "LSL",
"docs/scheme.scm": "Scheme",
"docs/livescript.ls": "LiveScript",
"docs/liquid.liquid": "Liquid",
"docs/logiql.logic": "LogiQL",
"docs/lua.lua": "Lua",
"docs/lucene.lucene": "Lucene",
"docs/luapage.lp": "LuaPage",
"docs/Makefile": "Makefile",
"docs/markdown.md": {name: "Markdown", wrapped: true},
"docs/mushcode.mc": {name: "MUSHCode", wrapped: true},
"docs/objectivec.m": {name: "Objective-C"},
"docs/ocaml.ml": "OCaml",
"docs/OpenSCAD.scad": "OpenSCAD",
"docs/pascal.pas": "Pascal",
"docs/perl.pl": "Perl",
"docs/pgsql.pgsql": {name: "pgSQL", wrapped: true},
"docs/php.php": "PHP",
"docs/plaintext.txt": {name: "Plain Text", prepare: makeHuge, wrapped: true},
"docs/powershell.ps1": "Powershell",
"docs/properties.properties": "Properties",
"docs/python.py": "Python",
"docs/r.r": "R",
"docs/rdoc.Rd": "RDoc",
"docs/rhtml.rhtml": "RHTML",
"docs/ruby.rb": "Ruby",
"docs/abap.abap": "SAP - ABAP",
"docs/scala.scala": "Scala",
"docs/scss.scss": "SCSS",
"docs/sass.sass": "SASS",
"docs/sh.sh": "SH",
"docs/space.space": "Space",
"docs/stylus.styl": "Stylus",
"docs/sql.sql": {name: "SQL", wrapped: true},
"docs/svg.svg": "SVG",
"docs/tcl.tcl": "Tcl",
"docs/tex.tex": "Tex",
"docs/textile.textile": {name: "Textile", wrapped: true},
"docs/snippets.snippets": "snippets",
"docs/toml.toml": "TOML",
"docs/typescript.ts": "Typescript",
"docs/vbscript.vbs": "VBScript",
"docs/velocity.vm": "Velocity",
"docs/xml.xml": "XML",
"docs/xquery.xq": "XQuery",
"docs/yaml.yaml": "YAML",
"docs/c9search.c9search_results": "C9 Search Results",
"docs/actionscript.as": "ActionScript",
"docs/assembly_x86.asm": "Assembly_x86",
"docs/autohotkey.ahk": "AutoHotKey",
"docs/batchfile.bat": "BatchFile",
"docs/erlang.erl": "Erlang",
"docs/forth.frt": "Forth",
"docs/haskell.hs": "Haskell",
"docs/julia.js": "Julia",
"docs/prolog.plg": "Prolog",
"docs/rust.rs": "Rust",
"docs/twig.twig": "Twig",
"docs/Nix.nix": "Nix",
"docs/protobuf.proto": "Protobuf"
"docs/textile.textile": {name: "Textile", wrapped: true},
"docs/c9search.c9search_results": "C9 Search Results",
"docs/Nix.nix": "Nix"
};
var ownSource = {
@ -166,6 +90,23 @@ var hugeDocs = {
"build/src-min/ace.js": ""
};
modelist.modes.forEach(function(m) {
var ext = m.extensions.split("|")[0];
if (ext[0] === "^") {
path = ext.substr(1);
} else {
var path = m.name + "." + ext
}
path = "docs/" + path;
if (!docs[path]) {
docs[path] = {name: m.caption};
} else if (typeof docs[path] == "object" && !docs[path].name) {
docs[path].name = m.caption;
}
})
if (window.require && window.require.s) try {
for (var path in window.require.s.contexts._.defined) {
if (path.indexOf("!") != -1)
@ -176,6 +117,13 @@ if (window.require && window.require.s) try {
}
} catch(e) {}
function sort(list) {
return list.sort(function(a, b) {
var cmp = (b.order || 0) - (a.order || 0);
return cmp || a.name && a.name.localeCompare(b.name);
})
}
function prepareDocList(docs) {
var list = [];
for (var path in docs) {
@ -219,7 +167,7 @@ function loadDoc(name, callback) {
module.exports = {
fileCache: fileCache,
docs: prepareDocList(docs),
docs: sort(prepareDocList(docs)),
ownSource: prepareDocList(ownSource),
hugeDocs: prepareDocList(hugeDocs),
initDoc: initDoc,

View file

@ -0,0 +1,5 @@
with Ada.Text_IO; use Ada.Text_IO;
procedure Hello is
begin
Put_Line("Hello, world!");
end Hello;

View file

@ -0,0 +1 @@
TODO

View file

@ -0,0 +1,14 @@
#!/usr/bin/env rdmd
// Computes average line length for standard input.
import std.stdio;
void main() {
ulong lines = 0;
double sumLength = 0;
foreach (line; stdin.byLine()) {
++lines;
sumLength += line.length;
}
writeln("Average line length: ",
lines ? sumLength / lines : 0);
}

View file

@ -0,0 +1 @@
TODO

View file

@ -0,0 +1,8 @@
{{!-- Ace + :-}} --}}
<div id="comments">
{{#each comments}}
<h2><a href="/posts/{{../permalink}}#{{id}}">{{title}}</a></h2>
<div>{{body}}</div>
{{/each}}
</div>

View file

@ -0,0 +1 @@
TODO

View file

@ -0,0 +1 @@
TODO

View file

@ -0,0 +1 @@
TODO

View file

@ -0,0 +1 @@
TODO

View file

@ -0,0 +1,46 @@
/**
* Greets a person using "Hello" by default.
* @param name The name of the person.
* @param? greetingWord Optional greeting word to use instead of "Hello".
*/
{template .helloName #eee}
{if not $greetingWord}
Hello {$name}!
{else}
{$greetingWord} {$name}!
{/if}
{/template}
/**
* Greets a person and optionally a list of other people.
* @param name The name of the person.
* @param additionalNames The additional names to greet. May be an empty list.
*/
{template .helloNames}
// Greet the person.
{call .helloName data="all" /}<br>
// Greet the additional people.
{foreach $additionalName in $additionalNames}
{call .helloName}
{param name: $additionalName /}
{/call}
{if not isLast($additionalName)}
<br> // break after every line except the last
{/if}
{ifempty}
No additional people to greet.
{/foreach}
{/template}
{/foreach}
{if length($items) > 5}
{msg desc="Says hello to the user."}
{namespace ns autoescape="contextual"}
/** Example. */
{template .example}
foo is {$ij.foo}
{/template}

View file

@ -0,0 +1,12 @@
always @(negedge reset or posedge clk) begin
if (reset == 0) begin
d_out <= 16'h0000;
d_out_mem[resetcount] <= d_out;
laststoredvalue <= d_out;
end else begin
d_out <= d_out + 1'b1;
end
end
always @(bufreadaddr)
bufreadval = d_out_mem[bufreadaddr];

View file

@ -6,10 +6,13 @@ $(function() {
editor.container.style.opacity = "";
embedded_editor = ace.edit("embedded_ace_code");
embedded_editor.container.style.opacity = "";
editor.session.setMode("ace/mode/javascript");
editor.session.setMode("ace/mode/javascript");
editor.session.setMode("ace/mode/javascript");
embedded_editor.session.setMode("ace/mode/html");
editor.setOptions({
maxLines: 30
})
ace.config.loadModule("ace/ext/emmet", function() {
ace.require("ace/lib/net").loadScript("http://nightwing.github.io/emmet-core/emmet.js", function() {
embedded_editor.setOption("enableEmmet", true);

@ -1 +1 @@
Subproject commit a3d6d69286903155bc7e1e5cd9c0f541791d384b
Subproject commit d93670b47d776987b38bb2c31777c4e488338fac

View file

@ -80,7 +80,7 @@ function add(x, y) {
var addResult = add(3, 2);
console.log(addResult);
</div>
</div>
<p id="embed_link"><a href="#nav=embedding">Learn how to embed this in your own site</a></p>
<p class="highlight_note">Looking for a more full-featured demo? Check out the
<a href="build/kitchen-sink.html" target="_blank">kitchen sink</a>.
@ -330,11 +330,9 @@ var MyNewFoldMode = require("./folding/mynew").MyNewFoldMode;
var Mode = function() {
// set everything up
var highlighter = new MyNewHighlightRules();
this.HighlightRules = MyNewHighlightRules;
this.$outdent = new MatchingBraceOutdent();
this.foldingRules = new MyNewFoldMode();
this.$tokenizer = new Tokenizer(highlighter.getRules());
};
oop.inherits(Mode, TextMode);
@ -343,9 +341,8 @@ oop.inherits(Mode, TextMode);
this.lineCommentStart = "//";
this.blockComment = {start: "/*", end: "*/"};
// Extra logic goes here--we won't be covering all of this
/* These are all optional pieces of code!
// special logic for indent/outdent.
// By default ace keeps indentation of previous line
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
return indent;
@ -358,14 +355,17 @@ oop.inherits(Mode, TextMode);
this.autoOutdent = function(state, doc, row) {
this.$outdent.autoOutdent(doc, row);
};
// create worker for live syntax checking
this.createWorker = function(session) {
var worker = new WorkerClient(["ace"], "ace/mode/mynew_worker", "NewWorker");
worker.attachToDocument(session.getDocument());
worker.on("errors", function(e) {
session.setAnnotations(e.data);
});
return worker;
};
*/
}).call(Mode.prototype);
exports.Mode = Mode;
@ -499,7 +499,7 @@ var fonts = lang.arrayToMap(
<li>Run <code>npm install</code> to install required dependencies.</li>
<li>Run <code>node tmlanguage.js &lt;path_to_tmlanguage_file&gt;</code>; for example, <code>node &lt;path_to_tmlanguage_file&gt; /Users/Elrond/elven.tmLanguage</code></li>
</ol>
<p>Two files are created and placed in <em>lib/ace/mode</em>: one for the language mode, and one for the set of highlight rules. You will still need to add the code into <em>kitchen_sink.html</em> and <em>demo.js</em>, as well as write any tests for the highlighting.</p>
<p>Two files are created and placed in <em>lib/ace/mode</em>: one for the language mode, and one for the set of highlight rules. You will still need to add the code into <em>ace/ext/modelist.js</em>, and add a sample file for testing.</p>
<h3 id="a-note-on-accuracy"><a class="heading_anchor" href="#a-note-on-accuracy"><i class="headerLinkIcon"></i></a>A Note on Accuracy</h3>
<p>Your <em>.tmlanguage</em> file will then be converted to the best of the converters ability. It is an understatement to say that the tool is imperfect. Probably, language mode creation will never be able to be fully autogenerated. There's a list of non-determinable items; for example:</p>
<ul>
@ -642,25 +642,15 @@ if (match) {
}</code></pre>
<h2>Testing Your Highlighter</h2>
<p>The best way to test your tokenizer is to see it live, right? To do that, you&#39;ll want to modify the <a href="build/kitchen-sink.html">live Ace demo</a> to preview your changes. You can find this file in the root Ace directory with the name <em>kitchen-sink.html</em>.</p>
<p>The file that defines the behavior for this live demo is defined in <em>demo/kitchen-sink/demo.js</em>. You&#39;ll want to add lines to two separate objects:</p>
<ol>
<li>
<p><code>modesByName</code> needs a new entry that defines all the rules regarding your new mode. Entries looks like <code>propertyName: [dropdownName, arrayOfExtensions]</code>, where:</p>
<ul>
<li><code>propertyName</code> is the name of the new language you&#39;re highlighting</li>
<li><code>dropdownName</code> is an arbitrary string that lists your language in the live demo&#39;s <strong>Mode</strong> dropdown menu</li>
<li><code>arrayOfExtensions</code> is an array of strings (seperated by <code>|</code>) that defines valid extensions to use for the new language. </li>
</ul>
add an entry to <code>supportedModes</code> in <a href="https://github.com/ajaxorg/ace/blob/master/lib/ace/ext/modelist.js#L53"><code>ace/ext/modelist.js</code></a>
</li>
<li>
<p><code>docs</code> also needs a new entry, which defines the location of your sample document showing all the power of your new language. Entries look like <code>filenamePath: modeToUse</code>, where:</p>
<ul>
<li><code>filenamePath</code> is the path to your example document. This should just be in <em>docs/</em>.</li>
<li><code>modeToUse</code> is the same arbitrary string as <code>dropdownName</code></li>
</ul>
<p>add a sample file to <code>demo/kitchen-sink/docs/</code> with same name as the mode file
</li>
</ol>
<p>Once you set this up, you should see be able to witness a live demonstration of your new highlighter.</p>
<p>Once you set this up, you should be able to witness a live demonstration of your new highlighter.</p>
<h3 id="adding-automated-tests"><a class="heading_anchor" href="#adding-automated-tests"><i class="headerLinkIcon"></i></a>Adding Automated Tests</h3>
<p>Adding automated tests for a highlighter is trivial so you are not required to do it, but it can help during development.</p>
<p>In <code>lib/ace/mode/_test</code> create a file named <code><pre>text_<span style="color:#AA0D91">&lt;modeName&gt;</span>.txt</pre></code> with some example code. (You can skip this if the document you have added in <code>demo/docs</code> both looks good and covers various edge cases in your language syntax).
@ -1037,7 +1027,7 @@ if (match) {
<a href="http://iknode.com/">iKnode</a>
</li>
<li title="Online conference and code review tool">
<div style="width: 90px; left: 10px; top: 0px;background:rgb(24,73,92);color: white;position:absolute;
<div style="width: 90px; left: 5px; top: 0px;background:rgb(24,73,92);color: white;position: absolute;
font-size: 68px;text-align: center;font-weight: bold;font-family: inherit;line-height: normal;">sT</div>
<a href="http://sourcetalk.net/">SourceTalk</a>
</li>

View file

@ -90,7 +90,7 @@ var Autocomplete = function() {
this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);
this.editor.off("changeSelection", this.changeListener);
this.editor.off("blur", this.changeListener);
this.editor.off("mousedown", this.changeListener);
this.editor.off("mousedown", this.mousedownListener);
this.editor.off("mousewheel", this.mousewheelListener);
this.changeTimer.cancel();

View file

@ -217,8 +217,11 @@ var optionsProvider = {
if (this["$" + name] === value)
return;
var opt = this.$options[name];
if (!opt)
if (!opt) {
if (typeof console != "undefined" && console.error)
console.error('misspelled option "' + name + '"');
return undefined;
}
if (opt.forwardTo)
return this[opt.forwardTo] && this[opt.forwardTo].setOption(name, value);
@ -229,8 +232,11 @@ var optionsProvider = {
},
getOption: function(name) {
var opt = this.$options[name];
if (!opt)
if (!opt) {
if (typeof console != "undefined" && console.error)
console.error('misspelled option "' + name + '"');
return undefined;
}
if (opt.forwardTo)
return this[opt.forwardTo] && this[opt.forwardTo].getOption(name);
return opt && opt.get ? opt.get.call(this) : this["$" + name];

View file

@ -193,6 +193,16 @@
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
border-left: 2px solid
}
.ace_slim-cursors .ace_cursor {
border-left-width: 1px;
}
.ace_overwrite-cursors .ace_cursor {
border-left-width: 0px;
border-bottom: 1px solid;
}
.ace_hidden-cursors .ace_cursor {

View file

@ -43,17 +43,17 @@ Mode.prototype.supportsFile = function(filename) {
// todo firstlinematch
var supportedModes = {
ABAP: ["abap"],
ADA: ["ada|adb"],
ActionScript:["as"],
ADA: ["ada|adb"],
AsciiDoc: ["asciidoc"],
Assembly_x86:["asm"],
AutoHotKey: ["ahk"],
BatchFile: ["bat|cmd"],
C9Search: ["c9search_results"],
C_Cpp: ["c|cc|cpp|cxx|h|hh|hpp"],
C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp"],
Clojure: ["clj"],
Cobol: ["^CBL|COB"],
coffee: ["^Cakefile|coffee|cf|cson"],
Cobol: ["CBL|COB"],
coffee: ["coffee|cf|cson|^Cakefile"],
ColdFusion: ["cfm"],
CSharp: ["cs"],
CSS: ["css"],
@ -70,20 +70,21 @@ var supportedModes = {
golang: ["go"],
Groovy: ["groovy"],
HAML: ["haml"],
Handlebars: ["hbs|handlebars|tpl|mustache"],
Haskell: ["hs"],
haXe: ["hx"],
HTML: ["htm|html|xhtml"],
HTML: ["html|htm|xhtml"],
HTML_Ruby: ["erb|rhtml|html.erb"],
Ini: ["Ini|conf"],
INI: ["ini|conf|cfg|prefs"],
Jade: ["jade"],
Java: ["java"],
JavaScript: ["js"],
JavaScript: ["js|jsm"],
JSON: ["json"],
JSONiq: ["jq"],
JSP: ["jsp"],
JSX: ["jsx"],
Julia: ["jl"],
LaTeX: ["latex|tex|ltx|bib"],
LaTeX: ["tex|latex|ltx|bib"],
LESS: ["less"],
Liquid: ["liquid"],
Lisp: ["lisp"],
@ -93,7 +94,7 @@ var supportedModes = {
Lua: ["lua"],
LuaPage: ["lp"],
Lucene: ["lucene"],
Makefile: ["^GNUmakefile|^makefile|^Makefile|^OCamlMakefile|make"],
Makefile: ["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"],
MATLAB: ["matlab"],
Markdown: ["md|markdown"],
MySQL: ["mysql"],
@ -113,16 +114,17 @@ var supportedModes = {
R: ["r"],
RDoc: ["Rd"],
RHTML: ["Rhtml"],
Ruby: ["ru|gemspec|rake|rb"],
Ruby: ["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"],
Rust: ["rs"],
SASS: ["sass"],
SCAD: ["scad"],
Scala: ["scala"],
Scheme: ["scm|rkt"],
SCSS: ["scss"],
SH: ["sh|bash"],
SH: ["sh|bash|^.bashrc"],
Space: ["space"],
snippets: ["snippets"],
Soy_Template:["soy"],
SQL: ["sql"],
Stylus: ["styl|stylus"],
SVG: ["svg"],
@ -132,12 +134,13 @@ var supportedModes = {
Textile: ["textile"],
Toml: ["toml"],
Twig: ["twig"],
Typescript: ["typescript|ts|str"],
Typescript: ["ts|typescript|str"],
VBScript: ["vbs"],
Velocity: ["vm"],
Verilog: ["v|vh|sv|svh"],
XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl"],
XQuery: ["xq"],
YAML: ["yaml"]
YAML: ["yaml|yml"]
};
var nameOverrides = {

View file

@ -71,7 +71,7 @@ exports.handler.attach = function(editor) {
background-color: rgba(0,250,0,0.9);\
opacity: 0.5;\
}\
.emacs-mode .ace_cursor.ace_hidden{\
.emacs-mode .ace_hidden-cursors .ace_cursor{\
opacity: 1;\
background-color: transparent;\
}\

View file

@ -63,11 +63,11 @@ var Text = function(parentEl) {
};
this.getLineHeight = function() {
return this.$characterSize.height || 1;
return this.$characterSize.height || 0;
};
this.getCharacterWidth = function() {
return this.$characterSize.width || 1;
return this.$characterSize.width || 0;
};
this.checkForSizeChanges = function() {

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();
};
@ -60,7 +58,7 @@ oop.inherits(Mode, TextMode);
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
var tokens = tokenizedLine.tokens;
var endState = tokenizedLine.state;

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);
@ -53,7 +51,7 @@ oop.inherits(Mode, TextMode);
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
var tokens = tokenizedLine.tokens;
if (tokens.length && tokens[tokens.length-1].type == "comment") {

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();
}
@ -59,7 +57,7 @@ oop.inherits(Mode, TextMode);
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
var tokens = this.$tokenizer.getLineTokens(line, state).tokens;
var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
if (!(tokens.length && tokens[tokens.length - 1].type === 'comment') &&
state === 'start' && indenter.test(line))

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/csharp").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);
@ -27,7 +25,7 @@ oop.inherits(Mode, TextMode);
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
var tokens = tokenizedLine.tokens;
if (tokens.length && tokens[tokens.length-1].type == "comment") {

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);
@ -59,7 +57,7 @@ oop.inherits(Mode, TextMode);
var indent = this.$getIndent(line);
// ignore braces in comments
var tokens = this.$tokenizer.getLineTokens(line, state).tokens;
var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
if (tokens.length && tokens[tokens.length-1].type == "comment") {
return indent;
}

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);

View file

@ -9,10 +9,9 @@ var DotHighlightRules = require("./dot_highlight_rules").DotHighlightRules;
var DotFoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
var highlighter = new DotHighlightRules();
this.HighlightRules = DotHighlightRules;
this.$outdent = new MatchingBraceOutdent();
this.foldingRules = new DotFoldMode();
this.$tokenizer = new Tokenizer(highlighter.getRules());
};
oop.inherits(Mode, TextMode);
@ -24,7 +23,7 @@ oop.inherits(Mode, TextMode);
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
var tokens = tokenizedLine.tokens;
var endState = tokenizedLine.state;

View file

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

View file

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

View file

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

View file

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

View file

@ -9,10 +9,7 @@ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
var highlighter = new GolangHighlightRules();
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$keywordList = highlighter.$keywordList;
this.HighlightRules = GolangHighlightRules;
this.$outdent = new MatchingBraceOutdent();
this.foldingRules = new CStyleFoldMode();
};
@ -26,7 +23,7 @@ oop.inherits(Mode, TextMode);
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
var tokens = tokenizedLine.tokens;
var endState = tokenizedLine.state;

View file

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

View file

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

View file

@ -0,0 +1,29 @@
/* global define */
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var HtmlMode = require("./html").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var HandlebarsHighlightRules = require("./handlebars_highlight_rules").HandlebarsHighlightRules;
var HtmlBehaviour = require("./behaviour/html").HtmlBehaviour;
var HtmlFoldMode = require("./folding/html").FoldMode;
var Mode = function() {
HtmlMode.call(this);
this.HighlightRules = HandlebarsHighlightRules;
this.$behaviour = new HtmlBehaviour();
this.foldingRules = new HtmlFoldMode();
};
oop.inherits(Mode, HtmlMode);
(function() {
}).call(Mode.prototype);
exports.Mode = Mode;
});

View file

@ -0,0 +1,72 @@
/* global define */
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
var xmlUtil = require("./xml_util");
function pop2(currentState, stack) {
stack.splice(0, 3);
return stack.shift() || "start";
}
var HandlebarsHighlightRules = function() {
HtmlHighlightRules.call(this);
var hbs = {
regex : "(?={{)",
push : "handlebars"
}
for (var key in this.$rules) {
this.$rules[key].unshift(hbs);
}
this.$rules.handlebars = [{
token : "comment.start",
regex : "{{!--",
push : [{
token : "comment.end",
regex : "--}}",
next : pop2
}, {
defaultToken : "comment"
}]
}, {
token : "comment.start",
regex : "{{!",
push : [{
token : "comment.end",
regex : "}}",
next : pop2
}, {
defaultToken : "comment"
}]
}, {
token : "storage.type.start", // begin section
regex : "{{[#\\^/&]?",
push : [{
token : "storage.type.end",
regex : "}}",
next : pop2
}, {
token : "variable.parameter",
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*"
}]
}, {
token : "support.function", // unescaped variable
regex : "{{{",
push : [{
token : "support.function",
regex : "}}}",
next : pop2
}, {
token : "variable.parameter",
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*"
}]
}];
this.normalizeRules();
};
oop.inherits(HandlebarsHighlightRules, HtmlHighlightRules);
exports.HandlebarsHighlightRules = HandlebarsHighlightRules;
});

View file

@ -48,16 +48,14 @@ var HaskellHighlightRules = require("./haskell_highlight_rules").HaskellHighligh
var FoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
var highlighter = new HaskellHighlightRules();
this.HighlightRules = HaskellHighlightRules;
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

@ -10,12 +10,10 @@ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
var highlighter = new HaxeHighlightRules();
this.HighlightRules = HaxeHighlightRules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$outdent = new MatchingBraceOutdent();
this.$behaviour = new CstyleBehaviour();
this.$keywordList = highlighter.$keywordList;
this.foldingRules = new CStyleFoldMode();
};
oop.inherits(Mode, TextMode);
@ -27,7 +25,7 @@ oop.inherits(Mode, TextMode);
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
var tokens = tokenizedLine.tokens;
if (tokens.length && tokens[tokens.length-1].type == "comment") {

View file

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

View file

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

View file

@ -39,16 +39,14 @@ var IniHighlightRules = require("./ini_highlight_rules").IniHighlightRules;
var FoldMode = require("./folding/ini").FoldMode;
var Mode = function() {
var highlighter = new IniHighlightRules();
this.HighlightRules = IniHighlightRules;
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

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

View file

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

View file

@ -42,12 +42,10 @@ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
var highlighter = new JavaScriptHighlightRules();
this.HighlightRules = JavaScriptHighlightRules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$outdent = new MatchingBraceOutdent();
this.$behaviour = new CstyleBehaviour();
this.$keywordList = highlighter.$keywordList;
this.foldingRules = new CStyleFoldMode();
};
oop.inherits(Mode, TextMode);
@ -60,7 +58,7 @@ oop.inherits(Mode, TextMode);
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
var tokens = tokenizedLine.tokens;
var endState = tokenizedLine.state;

View file

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

View file

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

View file

@ -10,7 +10,7 @@ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
function Mode() {
this.$tokenizer = new Tokenizer(new JsxHighlightRules().getRules());
this.HighlightRules = JsxHighlightRules;
this.$outdent = new MatchingBraceOutdent();
this.$behaviour = new CstyleBehaviour();
this.foldingRules = new CStyleFoldMode();
@ -25,7 +25,7 @@ oop.inherits(Mode, TextMode);
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
var tokens = tokenizedLine.tokens;
if (tokens.length && tokens[tokens.length-1].type == "comment") {

View file

@ -48,16 +48,14 @@ var JuliaHighlightRules = require("./julia_highlight_rules").JuliaHighlightRules
var FoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
var highlighter = new JuliaHighlightRules();
this.HighlightRules = JuliaHighlightRules;
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

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

View file

@ -40,7 +40,7 @@ var CssBehaviour = require("./behaviour/css").CssBehaviour;
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
this.$tokenizer = new Tokenizer(new LessHighlightRules().getRules());
this.HighlightRules = LessHighlightRules;
this.$outdent = new MatchingBraceOutdent();
this.$behaviour = new CssBehaviour();
this.foldingRules = new CStyleFoldMode();
@ -56,7 +56,7 @@ oop.inherits(Mode, TextMode);
var indent = this.$getIndent(line);
// ignore braces in comments
var tokens = this.$tokenizer.getLineTokens(line, state).tokens;
var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
if (tokens.length && tokens[tokens.length-1].type == "comment") {
return indent;
}

View file

@ -38,10 +38,7 @@ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutd
var Range = require("../range").Range;
var Mode = function() {
var highlighter = new LiquidHighlightRules();
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$keywordList = highlighter.$keywordList;
this.HighlightRules = LiquidHighlightRules;
this.$outdent = new MatchingBraceOutdent();
};
oop.inherits(Mode, TextMode);
@ -53,7 +50,7 @@ oop.inherits(Mode, TextMode);
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
var tokens = tokenizedLine.tokens;
var endState = tokenizedLine.state;

View file

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

View file

@ -42,9 +42,8 @@ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var Mode = function() {
var highlighter = new LogiQLHighlightRules();
this.HighlightRules = LogiQLHighlightRules;
this.foldingRules = new FoldMode();
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$outdent = new MatchingBraceOutdent();
this.$behaviour = new CstyleBehaviour();
};
@ -57,7 +56,7 @@ oop.inherits(Mode, TextMode);
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
var tokens = tokenizedLine.tokens;
var endState = tokenizedLine.state;
if (/comment|string/.test(endState))
@ -134,7 +133,6 @@ oop.inherits(Mode, TextMode);
var row = it.getCurrentTokenRow();
return new Range(row, col, row, col + tok.value.length);
};
// Extra logic goes here.
}).call(Mode.prototype);
exports.Mode = Mode;

View file

@ -41,7 +41,7 @@ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var oop = require("../lib/oop");
var Mode = function() {
this.$tokenizer = new Tokenizer(new Rules().getRules());
this.HighlightRules = Rules;
this.$outdent = new Outdent();
this.$behaviour = new CstyleBehaviour();
this.foldingRules = new CStyleFoldMode();
@ -60,7 +60,7 @@ oop.inherits(Mode, TextMode);
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
var tokens = tokenizedLine.tokens;
var endState = tokenizedLine.state;

View file

@ -40,11 +40,9 @@ var Range = require("../range").Range;
var WorkerClient = require("../worker/worker_client").WorkerClient;
var Mode = function() {
var highlighter = new LuaHighlightRules();
this.HighlightRules = LuaHighlightRules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.foldingRules = new LuaFoldMode();
this.$keywordList = highlighter.$keywordList;
};
oop.inherits(Mode, TextMode);
@ -101,7 +99,7 @@ oop.inherits(Mode, TextMode);
var indent = this.$getIndent(line);
var level = 0;
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
var tokens = tokenizedLine.tokens;
if (state == "start") {
@ -125,7 +123,7 @@ oop.inherits(Mode, TextMode);
if (line.match(/^\s*[\)\}\]]$/))
return true;
var tokens = this.$tokenizer.getLineTokens(line.trim(), state).tokens;
var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens;
if (!tokens || !tokens.length)
return false;
@ -136,7 +134,7 @@ oop.inherits(Mode, TextMode);
this.autoOutdent = function(state, session, row) {
var prevLine = session.getLine(row - 1);
var prevIndent = this.$getIndent(prevLine).length;
var prevTokens = this.$tokenizer.getLineTokens(prevLine, "start").tokens;
var prevTokens = this.getTokenizer().getLineTokens(prevLine, "start").tokens;
var tabLength = session.getTabString().length;
var expectedIndent = prevIndent + tabLength * getNetIndentLevel(prevTokens);
var curIndent = this.$getIndent(session.getLine(row)).length;

View file

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

View file

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

View file

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

View file

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

View file

@ -39,7 +39,7 @@ var PythonFoldMode = require("./folding/pythonic").FoldMode;
var Range = require("../range").Range;
var Mode = function() {
this.$tokenizer = new Tokenizer(new MushCodeRules().getRules());
this.HighlightRules = MushCodeRules;
this.foldingRules = new PythonFoldMode("\\:");
};
oop.inherits(Mode, TextMode);
@ -51,7 +51,7 @@ oop.inherits(Mode, TextMode);
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
var tokens = tokenizedLine.tokens;
if (tokens.length && tokens[tokens.length-1].type == "comment") {
@ -80,7 +80,7 @@ oop.inherits(Mode, TextMode);
if (input !== "\r\n" && input !== "\r" && input !== "\n")
return false;
var tokens = this.$tokenizer.getLineTokens(line.trim(), state).tokens;
var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens;
if (!tokens)
return false;

View file

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

View file

@ -48,16 +48,12 @@ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
CMode.call(this);
var highlighter = new NixHighlightRules();
this.HighlightRules = NixHighlightRules;
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

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

View file

@ -39,11 +39,9 @@ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutd
var Range = require("../range").Range;
var Mode = function() {
var highlighter = new OcamlHighlightRules();
this.HighlightRules = OcamlHighlightRules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$outdent = new MatchingBraceOutdent();
this.$keywordList = highlighter.$keywordList;
};
oop.inherits(Mode, TextMode);
@ -76,7 +74,7 @@ var indenter = /(?:[({[=:]|[-=]>|\b(?:else|try|with))\s*$/;
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
var tokens = this.$tokenizer.getLineTokens(line, state).tokens;
var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
if (!(tokens.length && tokens[tokens.length - 1].type === 'comment') &&
state === 'start' && indenter.test(line))

View file

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

View file

@ -40,12 +40,10 @@ var Range = require("../range").Range;
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
var highlighter = new PerlHighlightRules();
this.HighlightRules = PerlHighlightRules;
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$outdent = new MatchingBraceOutdent();
this.foldingRules = new CStyleFoldMode({start: "^=(begin|item)\\b", end: "^=(cut)\\b"});
this.$keywordList = highlighter.$keywordList;
};
oop.inherits(Mode, TextMode);
@ -61,7 +59,7 @@ oop.inherits(Mode, TextMode);
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
var tokens = tokenizedLine.tokens;
if (tokens.length && tokens[tokens.length-1].type == "comment") {

View file

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

View file

@ -46,7 +46,7 @@ var unicode = require("../unicode");
var Mode = function(opts) {
var inline = opts && opts.inline;
var HighlightRules = inline ? PhpLangHighlightRules : PhpHighlightRules;
this.$tokenizer = new Tokenizer(new HighlightRules().getRules());
this.HighlightRules = HighlightRules;
this.$outdent = new MatchingBraceOutdent();
this.$behaviour = new CstyleBehaviour();
this.foldingRules = new CStyleFoldMode();
@ -76,7 +76,7 @@ oop.inherits(Mode, TextMode);
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
var tokens = tokenizedLine.tokens;
var endState = tokenizedLine.state;

View file

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

View file

@ -10,10 +10,7 @@ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
var highlighter = new PowershellHighlightRules();
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$keywordList = highlighter.$keywordList;
this.HighlightRules = PowershellHighlightRules;
this.$outdent = new MatchingBraceOutdent();
this.$behaviour = new CstyleBehaviour();
this.foldingRules = new CStyleFoldMode({start: "^\\s*(<#)", end: "^[#\\s]>\\s*$"});
@ -28,7 +25,7 @@ oop.inherits(Mode, TextMode);
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
var tokens = tokenizedLine.tokens;
if (tokens.length && tokens[tokens.length-1].type == "comment") {

View file

@ -48,16 +48,14 @@ var PrologHighlightRules = require("./prolog_highlight_rules").PrologHighlightRu
var FoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
var highlighter = new PrologHighlightRules();
this.HighlightRules = PrologHighlightRules;
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

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

View file

@ -39,9 +39,7 @@ var PythonFoldMode = require("./folding/pythonic").FoldMode;
var Range = require("../range").Range;
var Mode = function() {
var highlighter = new PythonHighlightRules();
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$keywordList = highlighter.$keywordList;
this.HighlightRules = PythonHighlightRules;
this.foldingRules = new PythonFoldMode("\\:");
};
oop.inherits(Mode, TextMode);
@ -53,7 +51,7 @@ oop.inherits(Mode, TextMode);
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
var tokens = tokenizedLine.tokens;
if (tokens.length && tokens[tokens.length-1].type == "comment") {
@ -82,7 +80,7 @@ oop.inherits(Mode, TextMode);
if (input !== "\r\n" && input !== "\r" && input !== "\n")
return false;
var tokens = this.$tokenizer.getLineTokens(line.trim(), state).tokens;
var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens;
if (!tokens)
return false;

View file

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

View file

@ -31,7 +31,7 @@ var RCodeModel = require("mode/r_code_model").RCodeModel;
var Mode = function(doc, session) {
this.$session = session;
this.$tokenizer = new Tokenizer(new RHtmlHighlightRules().getRules());
this.HighlightRules = RHtmlHighlightRules;
/* Or these.
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 Mode = function() {
var highlighter = new RubyHighlightRules();
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$keywordList = highlighter.$keywordList;
this.HighlightRules = RubyHighlightRules;
this.$outdent = new MatchingBraceOutdent();
this.foldingRules = new FoldMode();
};
@ -57,7 +54,7 @@ oop.inherits(Mode, TextMode);
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
var tokens = tokenizedLine.tokens;
if (tokens.length && tokens[tokens.length-1].type == "comment") {

View file

@ -48,16 +48,14 @@ var RustHighlightRules = require("./rust_highlight_rules").RustHighlightRules;
var FoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
var highlighter = new RustHighlightRules();
this.HighlightRules = RustHighlightRules;
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;

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