Merge pull request #1595 from ajaxorg/highlighting/mixed
Improvements for highlighting mixed languages
This commit is contained in:
commit
5f3ba2cfe2
161 changed files with 906 additions and 619 deletions
|
|
@ -301,7 +301,7 @@ var buildAce = function(options) {
|
||||||
noconflict: false,
|
noconflict: false,
|
||||||
suffix: null,
|
suffix: null,
|
||||||
name: "ace",
|
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"),
|
themes: jsFileList("lib/ace/theme"),
|
||||||
extensions: jsFileList("lib/ace/ext"),
|
extensions: jsFileList("lib/ace/ext"),
|
||||||
workers: workers("lib/ace/mode"),
|
workers: workers("lib/ace/mode"),
|
||||||
|
|
@ -522,7 +522,7 @@ function generateThemesModule(themes) {
|
||||||
'\n\nmodule.exports.themes = ' + JSON.stringify(themes, null, ' '),
|
'\n\nmodule.exports.themes = ' + JSON.stringify(themes, null, ' '),
|
||||||
';\n\n});'
|
';\n\n});'
|
||||||
].join('');
|
].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) {
|
function inlineTextModules(text) {
|
||||||
|
|
|
||||||
2
build
2
build
|
|
@ -1 +1 @@
|
||||||
Subproject commit 8f2423d10a7cc5680dcdb42a2dd57d9b192e3b34
|
Subproject commit 995de31e6513ddfd5e9f66b8216f5b316fcd2253
|
||||||
|
|
@ -66,95 +66,19 @@ function makeHuge(txt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var docs = {
|
var docs = {
|
||||||
"docs/javascript.js": "JavaScript",
|
"docs/javascript.js": {order: 1, name: "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/latex.tex": {name: "LaTeX", wrapped: true},
|
"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/markdown.md": {name: "Markdown", wrapped: true},
|
||||||
"docs/mushcode.mc": {name: "MUSHCode", 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/pgsql.pgsql": {name: "pgSQL", wrapped: true},
|
||||||
"docs/php.php": "PHP",
|
|
||||||
"docs/plaintext.txt": {name: "Plain Text", prepare: makeHuge, wrapped: true},
|
"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/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/textile.textile": {name: "Textile", wrapped: true},
|
||||||
"docs/assembly_x86.asm": "Assembly_x86",
|
|
||||||
"docs/autohotkey.ahk": "AutoHotKey",
|
"docs/c9search.c9search_results": "C9 Search Results",
|
||||||
"docs/batchfile.bat": "BatchFile",
|
"docs/Nix.nix": "Nix"
|
||||||
"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"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var ownSource = {
|
var ownSource = {
|
||||||
|
|
@ -166,6 +90,23 @@ var hugeDocs = {
|
||||||
"build/src-min/ace.js": ""
|
"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 {
|
if (window.require && window.require.s) try {
|
||||||
for (var path in window.require.s.contexts._.defined) {
|
for (var path in window.require.s.contexts._.defined) {
|
||||||
if (path.indexOf("!") != -1)
|
if (path.indexOf("!") != -1)
|
||||||
|
|
@ -176,6 +117,13 @@ if (window.require && window.require.s) try {
|
||||||
}
|
}
|
||||||
} catch(e) {}
|
} 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) {
|
function prepareDocList(docs) {
|
||||||
var list = [];
|
var list = [];
|
||||||
for (var path in docs) {
|
for (var path in docs) {
|
||||||
|
|
@ -219,7 +167,7 @@ function loadDoc(name, callback) {
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
fileCache: fileCache,
|
fileCache: fileCache,
|
||||||
docs: prepareDocList(docs),
|
docs: sort(prepareDocList(docs)),
|
||||||
ownSource: prepareDocList(ownSource),
|
ownSource: prepareDocList(ownSource),
|
||||||
hugeDocs: prepareDocList(hugeDocs),
|
hugeDocs: prepareDocList(hugeDocs),
|
||||||
initDoc: initDoc,
|
initDoc: initDoc,
|
||||||
|
|
|
||||||
5
demo/kitchen-sink/docs/ada.ada
Normal file
5
demo/kitchen-sink/docs/ada.ada
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
with Ada.Text_IO; use Ada.Text_IO;
|
||||||
|
procedure Hello is
|
||||||
|
begin
|
||||||
|
Put_Line("Hello, world!");
|
||||||
|
end Hello;
|
||||||
1
demo/kitchen-sink/docs/cobol.CBL
Normal file
1
demo/kitchen-sink/docs/cobol.CBL
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
TODO
|
||||||
14
demo/kitchen-sink/docs/d.d
Normal file
14
demo/kitchen-sink/docs/d.d
Normal 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);
|
||||||
|
}
|
||||||
1
demo/kitchen-sink/docs/ejs.ejs
Normal file
1
demo/kitchen-sink/docs/ejs.ejs
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
TODO
|
||||||
8
demo/kitchen-sink/docs/handlebars.hbs
Normal file
8
demo/kitchen-sink/docs/handlebars.hbs
Normal 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>
|
||||||
1
demo/kitchen-sink/docs/ini.ini
Normal file
1
demo/kitchen-sink/docs/ini.ini
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
TODO
|
||||||
1
demo/kitchen-sink/docs/jsoniq.jq
Normal file
1
demo/kitchen-sink/docs/jsoniq.jq
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
TODO
|
||||||
1
demo/kitchen-sink/docs/matlab.matlab
Normal file
1
demo/kitchen-sink/docs/matlab.matlab
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
TODO
|
||||||
1
demo/kitchen-sink/docs/mysql.mysql
Normal file
1
demo/kitchen-sink/docs/mysql.mysql
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
TODO
|
||||||
46
demo/kitchen-sink/docs/soy_template.soy
Normal file
46
demo/kitchen-sink/docs/soy_template.soy
Normal 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}
|
||||||
12
demo/kitchen-sink/docs/verilog.v
Normal file
12
demo/kitchen-sink/docs/verilog.v
Normal 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];
|
||||||
|
|
@ -6,10 +6,13 @@ $(function() {
|
||||||
editor.container.style.opacity = "";
|
editor.container.style.opacity = "";
|
||||||
embedded_editor = ace.edit("embedded_ace_code");
|
embedded_editor = ace.edit("embedded_ace_code");
|
||||||
embedded_editor.container.style.opacity = "";
|
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");
|
embedded_editor.session.setMode("ace/mode/html");
|
||||||
|
|
||||||
|
editor.setOptions({
|
||||||
|
maxLines: 30
|
||||||
|
})
|
||||||
|
|
||||||
ace.config.loadModule("ace/ext/emmet", function() {
|
ace.config.loadModule("ace/ext/emmet", function() {
|
||||||
ace.require("ace/lib/net").loadScript("http://nightwing.github.io/emmet-core/emmet.js", function() {
|
ace.require("ace/lib/net").loadScript("http://nightwing.github.io/emmet-core/emmet.js", function() {
|
||||||
embedded_editor.setOption("enableEmmet", true);
|
embedded_editor.setOption("enableEmmet", true);
|
||||||
|
|
|
||||||
2
doc/wiki
2
doc/wiki
|
|
@ -1 +1 @@
|
||||||
Subproject commit a3d6d69286903155bc7e1e5cd9c0f541791d384b
|
Subproject commit d93670b47d776987b38bb2c31777c4e488338fac
|
||||||
40
index.html
40
index.html
|
|
@ -80,7 +80,7 @@ function add(x, y) {
|
||||||
|
|
||||||
var addResult = add(3, 2);
|
var addResult = add(3, 2);
|
||||||
console.log(addResult);
|
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 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
|
<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>.
|
<a href="build/kitchen-sink.html" target="_blank">kitchen sink</a>.
|
||||||
|
|
@ -330,11 +330,9 @@ var MyNewFoldMode = require("./folding/mynew").MyNewFoldMode;
|
||||||
|
|
||||||
var Mode = function() {
|
var Mode = function() {
|
||||||
// set everything up
|
// set everything up
|
||||||
var highlighter = new MyNewHighlightRules();
|
this.HighlightRules = MyNewHighlightRules;
|
||||||
this.$outdent = new MatchingBraceOutdent();
|
this.$outdent = new MatchingBraceOutdent();
|
||||||
this.foldingRules = new MyNewFoldMode();
|
this.foldingRules = new MyNewFoldMode();
|
||||||
|
|
||||||
this.$tokenizer = new Tokenizer(highlighter.getRules());
|
|
||||||
};
|
};
|
||||||
oop.inherits(Mode, TextMode);
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
|
@ -343,9 +341,8 @@ oop.inherits(Mode, TextMode);
|
||||||
this.lineCommentStart = "//";
|
this.lineCommentStart = "//";
|
||||||
this.blockComment = {start: "/*", end: "*/"};
|
this.blockComment = {start: "/*", end: "*/"};
|
||||||
|
|
||||||
// Extra logic goes here--we won't be covering all of this
|
// special logic for indent/outdent.
|
||||||
|
// By default ace keeps indentation of previous line
|
||||||
/* These are all optional pieces of code!
|
|
||||||
this.getNextLineIndent = function(state, line, tab) {
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
var indent = this.$getIndent(line);
|
var indent = this.$getIndent(line);
|
||||||
return indent;
|
return indent;
|
||||||
|
|
@ -358,14 +355,17 @@ oop.inherits(Mode, TextMode);
|
||||||
this.autoOutdent = function(state, doc, row) {
|
this.autoOutdent = function(state, doc, row) {
|
||||||
this.$outdent.autoOutdent(doc, row);
|
this.$outdent.autoOutdent(doc, row);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// create worker for live syntax checking
|
||||||
this.createWorker = function(session) {
|
this.createWorker = function(session) {
|
||||||
var worker = new WorkerClient(["ace"], "ace/mode/mynew_worker", "NewWorker");
|
var worker = new WorkerClient(["ace"], "ace/mode/mynew_worker", "NewWorker");
|
||||||
worker.attachToDocument(session.getDocument());
|
worker.attachToDocument(session.getDocument());
|
||||||
|
worker.on("errors", function(e) {
|
||||||
|
session.setAnnotations(e.data);
|
||||||
|
});
|
||||||
return worker;
|
return worker;
|
||||||
};
|
};
|
||||||
*/
|
|
||||||
}).call(Mode.prototype);
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
exports.Mode = Mode;
|
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>npm install</code> to install required dependencies.</li>
|
||||||
<li>Run <code>node tmlanguage.js <path_to_tmlanguage_file></code>; for example, <code>node <path_to_tmlanguage_file> /Users/Elrond/elven.tmLanguage</code></li>
|
<li>Run <code>node tmlanguage.js <path_to_tmlanguage_file></code>; for example, <code>node <path_to_tmlanguage_file> /Users/Elrond/elven.tmLanguage</code></li>
|
||||||
</ol>
|
</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>
|
<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 converter’s 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>
|
<p>Your <em>.tmlanguage</em> file will then be converted to the best of the converter’s 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>
|
<ul>
|
||||||
|
|
@ -642,25 +642,15 @@ if (match) {
|
||||||
}</code></pre>
|
}</code></pre>
|
||||||
<h2>Testing Your Highlighter</h2>
|
<h2>Testing Your Highlighter</h2>
|
||||||
<p>The best way to test your tokenizer is to see it live, right? To do that, you'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 best way to test your tokenizer is to see it live, right? To do that, you'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'll want to add lines to two separate objects:</p>
|
|
||||||
<ol>
|
<ol>
|
||||||
<li>
|
<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>
|
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>
|
||||||
<ul>
|
|
||||||
<li><code>propertyName</code> is the name of the new language you're highlighting</li>
|
|
||||||
<li><code>dropdownName</code> is an arbitrary string that lists your language in the live demo'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>
|
|
||||||
</li>
|
</li>
|
||||||
<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>
|
<p>add a sample file to <code>demo/kitchen-sink/docs/</code> with same name as the mode file
|
||||||
<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>
|
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</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>
|
<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>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"><modeName></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).
|
<p>In <code>lib/ace/mode/_test</code> create a file named <code><pre>text_<span style="color:#AA0D91"><modeName></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>
|
<a href="http://iknode.com/">iKnode</a>
|
||||||
</li>
|
</li>
|
||||||
<li title="Online conference and code review tool">
|
<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>
|
font-size: 68px;text-align: center;font-weight: bold;font-family: inherit;line-height: normal;">sT</div>
|
||||||
<a href="http://sourcetalk.net/">SourceTalk</a>
|
<a href="http://sourcetalk.net/">SourceTalk</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ var Autocomplete = function() {
|
||||||
this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);
|
this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);
|
||||||
this.editor.off("changeSelection", this.changeListener);
|
this.editor.off("changeSelection", this.changeListener);
|
||||||
this.editor.off("blur", 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.editor.off("mousewheel", this.mousewheelListener);
|
||||||
this.changeTimer.cancel();
|
this.changeTimer.cancel();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -217,8 +217,11 @@ var optionsProvider = {
|
||||||
if (this["$" + name] === value)
|
if (this["$" + name] === value)
|
||||||
return;
|
return;
|
||||||
var opt = this.$options[name];
|
var opt = this.$options[name];
|
||||||
if (!opt)
|
if (!opt) {
|
||||||
|
if (typeof console != "undefined" && console.error)
|
||||||
|
console.error('misspelled option "' + name + '"');
|
||||||
return undefined;
|
return undefined;
|
||||||
|
}
|
||||||
if (opt.forwardTo)
|
if (opt.forwardTo)
|
||||||
return this[opt.forwardTo] && this[opt.forwardTo].setOption(name, value);
|
return this[opt.forwardTo] && this[opt.forwardTo].setOption(name, value);
|
||||||
|
|
||||||
|
|
@ -229,8 +232,11 @@ var optionsProvider = {
|
||||||
},
|
},
|
||||||
getOption: function(name) {
|
getOption: function(name) {
|
||||||
var opt = this.$options[name];
|
var opt = this.$options[name];
|
||||||
if (!opt)
|
if (!opt) {
|
||||||
|
if (typeof console != "undefined" && console.error)
|
||||||
|
console.error('misspelled option "' + name + '"');
|
||||||
return undefined;
|
return undefined;
|
||||||
|
}
|
||||||
if (opt.forwardTo)
|
if (opt.forwardTo)
|
||||||
return this[opt.forwardTo] && this[opt.forwardTo].getOption(name);
|
return this[opt.forwardTo] && this[opt.forwardTo].getOption(name);
|
||||||
return opt && opt.get ? opt.get.call(this) : this["$" + name];
|
return opt && opt.get ? opt.get.call(this) : this["$" + name];
|
||||||
|
|
|
||||||
|
|
@ -193,6 +193,16 @@
|
||||||
-moz-box-sizing: border-box;
|
-moz-box-sizing: border-box;
|
||||||
-webkit-box-sizing: border-box;
|
-webkit-box-sizing: border-box;
|
||||||
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 {
|
.ace_hidden-cursors .ace_cursor {
|
||||||
|
|
|
||||||
|
|
@ -43,17 +43,17 @@ Mode.prototype.supportsFile = function(filename) {
|
||||||
// todo firstlinematch
|
// todo firstlinematch
|
||||||
var supportedModes = {
|
var supportedModes = {
|
||||||
ABAP: ["abap"],
|
ABAP: ["abap"],
|
||||||
ADA: ["ada|adb"],
|
|
||||||
ActionScript:["as"],
|
ActionScript:["as"],
|
||||||
|
ADA: ["ada|adb"],
|
||||||
AsciiDoc: ["asciidoc"],
|
AsciiDoc: ["asciidoc"],
|
||||||
Assembly_x86:["asm"],
|
Assembly_x86:["asm"],
|
||||||
AutoHotKey: ["ahk"],
|
AutoHotKey: ["ahk"],
|
||||||
BatchFile: ["bat|cmd"],
|
BatchFile: ["bat|cmd"],
|
||||||
C9Search: ["c9search_results"],
|
C9Search: ["c9search_results"],
|
||||||
C_Cpp: ["c|cc|cpp|cxx|h|hh|hpp"],
|
C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp"],
|
||||||
Clojure: ["clj"],
|
Clojure: ["clj"],
|
||||||
Cobol: ["^CBL|COB"],
|
Cobol: ["CBL|COB"],
|
||||||
coffee: ["^Cakefile|coffee|cf|cson"],
|
coffee: ["coffee|cf|cson|^Cakefile"],
|
||||||
ColdFusion: ["cfm"],
|
ColdFusion: ["cfm"],
|
||||||
CSharp: ["cs"],
|
CSharp: ["cs"],
|
||||||
CSS: ["css"],
|
CSS: ["css"],
|
||||||
|
|
@ -70,20 +70,21 @@ var supportedModes = {
|
||||||
golang: ["go"],
|
golang: ["go"],
|
||||||
Groovy: ["groovy"],
|
Groovy: ["groovy"],
|
||||||
HAML: ["haml"],
|
HAML: ["haml"],
|
||||||
|
Handlebars: ["hbs|handlebars|tpl|mustache"],
|
||||||
Haskell: ["hs"],
|
Haskell: ["hs"],
|
||||||
haXe: ["hx"],
|
haXe: ["hx"],
|
||||||
HTML: ["htm|html|xhtml"],
|
HTML: ["html|htm|xhtml"],
|
||||||
HTML_Ruby: ["erb|rhtml|html.erb"],
|
HTML_Ruby: ["erb|rhtml|html.erb"],
|
||||||
Ini: ["Ini|conf"],
|
INI: ["ini|conf|cfg|prefs"],
|
||||||
Jade: ["jade"],
|
Jade: ["jade"],
|
||||||
Java: ["java"],
|
Java: ["java"],
|
||||||
JavaScript: ["js"],
|
JavaScript: ["js|jsm"],
|
||||||
JSON: ["json"],
|
JSON: ["json"],
|
||||||
JSONiq: ["jq"],
|
JSONiq: ["jq"],
|
||||||
JSP: ["jsp"],
|
JSP: ["jsp"],
|
||||||
JSX: ["jsx"],
|
JSX: ["jsx"],
|
||||||
Julia: ["jl"],
|
Julia: ["jl"],
|
||||||
LaTeX: ["latex|tex|ltx|bib"],
|
LaTeX: ["tex|latex|ltx|bib"],
|
||||||
LESS: ["less"],
|
LESS: ["less"],
|
||||||
Liquid: ["liquid"],
|
Liquid: ["liquid"],
|
||||||
Lisp: ["lisp"],
|
Lisp: ["lisp"],
|
||||||
|
|
@ -93,7 +94,7 @@ var supportedModes = {
|
||||||
Lua: ["lua"],
|
Lua: ["lua"],
|
||||||
LuaPage: ["lp"],
|
LuaPage: ["lp"],
|
||||||
Lucene: ["lucene"],
|
Lucene: ["lucene"],
|
||||||
Makefile: ["^GNUmakefile|^makefile|^Makefile|^OCamlMakefile|make"],
|
Makefile: ["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"],
|
||||||
MATLAB: ["matlab"],
|
MATLAB: ["matlab"],
|
||||||
Markdown: ["md|markdown"],
|
Markdown: ["md|markdown"],
|
||||||
MySQL: ["mysql"],
|
MySQL: ["mysql"],
|
||||||
|
|
@ -113,16 +114,17 @@ var supportedModes = {
|
||||||
R: ["r"],
|
R: ["r"],
|
||||||
RDoc: ["Rd"],
|
RDoc: ["Rd"],
|
||||||
RHTML: ["Rhtml"],
|
RHTML: ["Rhtml"],
|
||||||
Ruby: ["ru|gemspec|rake|rb"],
|
Ruby: ["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"],
|
||||||
Rust: ["rs"],
|
Rust: ["rs"],
|
||||||
SASS: ["sass"],
|
SASS: ["sass"],
|
||||||
SCAD: ["scad"],
|
SCAD: ["scad"],
|
||||||
Scala: ["scala"],
|
Scala: ["scala"],
|
||||||
Scheme: ["scm|rkt"],
|
Scheme: ["scm|rkt"],
|
||||||
SCSS: ["scss"],
|
SCSS: ["scss"],
|
||||||
SH: ["sh|bash"],
|
SH: ["sh|bash|^.bashrc"],
|
||||||
Space: ["space"],
|
Space: ["space"],
|
||||||
snippets: ["snippets"],
|
snippets: ["snippets"],
|
||||||
|
Soy_Template:["soy"],
|
||||||
SQL: ["sql"],
|
SQL: ["sql"],
|
||||||
Stylus: ["styl|stylus"],
|
Stylus: ["styl|stylus"],
|
||||||
SVG: ["svg"],
|
SVG: ["svg"],
|
||||||
|
|
@ -132,12 +134,13 @@ var supportedModes = {
|
||||||
Textile: ["textile"],
|
Textile: ["textile"],
|
||||||
Toml: ["toml"],
|
Toml: ["toml"],
|
||||||
Twig: ["twig"],
|
Twig: ["twig"],
|
||||||
Typescript: ["typescript|ts|str"],
|
Typescript: ["ts|typescript|str"],
|
||||||
VBScript: ["vbs"],
|
VBScript: ["vbs"],
|
||||||
Velocity: ["vm"],
|
Velocity: ["vm"],
|
||||||
|
Verilog: ["v|vh|sv|svh"],
|
||||||
XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl"],
|
XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl"],
|
||||||
XQuery: ["xq"],
|
XQuery: ["xq"],
|
||||||
YAML: ["yaml"]
|
YAML: ["yaml|yml"]
|
||||||
};
|
};
|
||||||
|
|
||||||
var nameOverrides = {
|
var nameOverrides = {
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ exports.handler.attach = function(editor) {
|
||||||
background-color: rgba(0,250,0,0.9);\
|
background-color: rgba(0,250,0,0.9);\
|
||||||
opacity: 0.5;\
|
opacity: 0.5;\
|
||||||
}\
|
}\
|
||||||
.emacs-mode .ace_cursor.ace_hidden{\
|
.emacs-mode .ace_hidden-cursors .ace_cursor{\
|
||||||
opacity: 1;\
|
opacity: 1;\
|
||||||
background-color: transparent;\
|
background-color: transparent;\
|
||||||
}\
|
}\
|
||||||
|
|
|
||||||
|
|
@ -63,11 +63,11 @@ var Text = function(parentEl) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getLineHeight = function() {
|
this.getLineHeight = function() {
|
||||||
return this.$characterSize.height || 1;
|
return this.$characterSize.height || 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getCharacterWidth = function() {
|
this.getCharacterWidth = function() {
|
||||||
return this.$characterSize.width || 1;
|
return this.$characterSize.width || 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.checkForSizeChanges = function() {
|
this.checkForSizeChanges = function() {
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
};
|
};
|
||||||
|
|
@ -60,7 +58,7 @@ oop.inherits(Mode, TextMode);
|
||||||
this.getNextLineIndent = function(state, line, tab) {
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
var indent = this.$getIndent(line);
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
var tokens = tokenizedLine.tokens;
|
var tokens = tokenizedLine.tokens;
|
||||||
var endState = tokenizedLine.state;
|
var endState = tokenizedLine.state;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
@ -53,7 +51,7 @@ oop.inherits(Mode, TextMode);
|
||||||
this.getNextLineIndent = function(state, line, tab) {
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
var indent = this.$getIndent(line);
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
var tokens = tokenizedLine.tokens;
|
var tokens = tokenizedLine.tokens;
|
||||||
|
|
||||||
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -59,7 +57,7 @@ oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
this.getNextLineIndent = function(state, line, tab) {
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
var indent = this.$getIndent(line);
|
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') &&
|
if (!(tokens.length && tokens[tokens.length - 1].type === 'comment') &&
|
||||||
state === 'start' && indenter.test(line))
|
state === 'start' && indenter.test(line))
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,9 @@ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
||||||
var CStyleFoldMode = require("./folding/csharp").FoldMode;
|
var CStyleFoldMode = require("./folding/csharp").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);
|
||||||
|
|
@ -27,7 +25,7 @@ oop.inherits(Mode, TextMode);
|
||||||
this.getNextLineIndent = function(state, line, tab) {
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
var indent = this.$getIndent(line);
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
var tokens = tokenizedLine.tokens;
|
var tokens = tokenizedLine.tokens;
|
||||||
|
|
||||||
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
@ -59,7 +57,7 @@ oop.inherits(Mode, TextMode);
|
||||||
var indent = this.$getIndent(line);
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
// ignore braces in comments
|
// 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") {
|
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||||
return indent;
|
return indent;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
||||||
|
|
@ -24,7 +23,7 @@ oop.inherits(Mode, TextMode);
|
||||||
this.getNextLineIndent = function(state, line, tab) {
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
var indent = this.$getIndent(line);
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
var tokens = tokenizedLine.tokens;
|
var tokens = tokenizedLine.tokens;
|
||||||
var endState = tokenizedLine.state;
|
var endState = tokenizedLine.state;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
};
|
};
|
||||||
|
|
@ -26,7 +23,7 @@ oop.inherits(Mode, TextMode);
|
||||||
this.getNextLineIndent = function(state, line, tab) {
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
var indent = this.$getIndent(line);
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
var tokens = tokenizedLine.tokens;
|
var tokens = tokenizedLine.tokens;
|
||||||
var endState = tokenizedLine.state;
|
var endState = tokenizedLine.state;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
||||||
29
lib/ace/mode/handlebars.js
Normal file
29
lib/ace/mode/handlebars.js
Normal 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;
|
||||||
|
});
|
||||||
72
lib/ace/mode/handlebars_highlight_rules.js
Normal file
72
lib/ace/mode/handlebars_highlight_rules.js
Normal 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;
|
||||||
|
});
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
@ -27,7 +25,7 @@ oop.inherits(Mode, TextMode);
|
||||||
this.getNextLineIndent = function(state, line, tab) {
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
var indent = this.$getIndent(line);
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
var tokens = tokenizedLine.tokens;
|
var tokens = tokenizedLine.tokens;
|
||||||
|
|
||||||
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
|
|
|
||||||
|
|
@ -39,16 +39,14 @@ var IniHighlightRules = require("./ini_highlight_rules").IniHighlightRules;
|
||||||
var FoldMode = require("./folding/ini").FoldMode;
|
var FoldMode = require("./folding/ini").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;
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
@ -60,7 +58,7 @@ oop.inherits(Mode, TextMode);
|
||||||
this.getNextLineIndent = function(state, line, tab) {
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
var indent = this.$getIndent(line);
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
var tokens = tokenizedLine.tokens;
|
var tokens = tokenizedLine.tokens;
|
||||||
var endState = tokenizedLine.state;
|
var endState = tokenizedLine.state;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
|
|
@ -25,7 +25,7 @@ oop.inherits(Mode, TextMode);
|
||||||
this.getNextLineIndent = function(state, line, tab) {
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
var indent = this.$getIndent(line);
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
var tokens = tokenizedLine.tokens;
|
var tokens = tokenizedLine.tokens;
|
||||||
|
|
||||||
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
|
|
@ -56,7 +56,7 @@ oop.inherits(Mode, TextMode);
|
||||||
var indent = this.$getIndent(line);
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
// ignore braces in comments
|
// 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") {
|
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||||
return indent;
|
return indent;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
@ -53,7 +50,7 @@ oop.inherits(Mode, TextMode);
|
||||||
this.getNextLineIndent = function(state, line, tab) {
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
var indent = this.$getIndent(line);
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
var tokens = tokenizedLine.tokens;
|
var tokens = tokenizedLine.tokens;
|
||||||
var endState = tokenizedLine.state;
|
var endState = tokenizedLine.state;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
};
|
};
|
||||||
|
|
@ -57,7 +56,7 @@ oop.inherits(Mode, TextMode);
|
||||||
this.getNextLineIndent = function(state, line, tab) {
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
var indent = this.$getIndent(line);
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
var tokens = tokenizedLine.tokens;
|
var tokens = tokenizedLine.tokens;
|
||||||
var endState = tokenizedLine.state;
|
var endState = tokenizedLine.state;
|
||||||
if (/comment|string/.test(endState))
|
if (/comment|string/.test(endState))
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
|
|
@ -60,7 +60,7 @@ oop.inherits(Mode, TextMode);
|
||||||
this.getNextLineIndent = function(state, line, tab) {
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
var indent = this.$getIndent(line);
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
var tokens = tokenizedLine.tokens;
|
var tokens = tokenizedLine.tokens;
|
||||||
var endState = tokenizedLine.state;
|
var endState = tokenizedLine.state;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
||||||
|
|
@ -101,7 +99,7 @@ oop.inherits(Mode, TextMode);
|
||||||
var indent = this.$getIndent(line);
|
var indent = this.$getIndent(line);
|
||||||
var level = 0;
|
var level = 0;
|
||||||
|
|
||||||
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
var tokens = tokenizedLine.tokens;
|
var tokens = tokenizedLine.tokens;
|
||||||
|
|
||||||
if (state == "start") {
|
if (state == "start") {
|
||||||
|
|
@ -125,7 +123,7 @@ oop.inherits(Mode, TextMode);
|
||||||
if (line.match(/^\s*[\)\}\]]$/))
|
if (line.match(/^\s*[\)\}\]]$/))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
var tokens = this.$tokenizer.getLineTokens(line.trim(), state).tokens;
|
var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens;
|
||||||
|
|
||||||
if (!tokens || !tokens.length)
|
if (!tokens || !tokens.length)
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -136,7 +134,7 @@ oop.inherits(Mode, TextMode);
|
||||||
this.autoOutdent = function(state, session, row) {
|
this.autoOutdent = function(state, session, row) {
|
||||||
var prevLine = session.getLine(row - 1);
|
var prevLine = session.getLine(row - 1);
|
||||||
var prevIndent = this.$getIndent(prevLine).length;
|
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 tabLength = session.getTabString().length;
|
||||||
var expectedIndent = prevIndent + tabLength * getNetIndentLevel(prevTokens);
|
var expectedIndent = prevIndent + tabLength * getNetIndentLevel(prevTokens);
|
||||||
var curIndent = this.$getIndent(session.getLine(row)).length;
|
var curIndent = this.$getIndent(session.getLine(row)).length;
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,14 +41,12 @@ 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,
|
||||||
"html-": HtmlMode
|
"html-": HtmlMode
|
||||||
});
|
});
|
||||||
|
|
||||||
this.foldingRules = new MarkdownFoldMode();
|
this.foldingRules = new MarkdownFoldMode();
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
@ -51,7 +51,7 @@ oop.inherits(Mode, TextMode);
|
||||||
this.getNextLineIndent = function(state, line, tab) {
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
var indent = this.$getIndent(line);
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
var tokens = tokenizedLine.tokens;
|
var tokens = tokenizedLine.tokens;
|
||||||
|
|
||||||
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
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")
|
if (input !== "\r\n" && input !== "\r" && input !== "\n")
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var tokens = this.$tokenizer.getLineTokens(line.trim(), state).tokens;
|
var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens;
|
||||||
|
|
||||||
if (!tokens)
|
if (!tokens)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
||||||
|
|
@ -76,7 +74,7 @@ var indenter = /(?:[({[=:]|[-=]>|\b(?:else|try|with))\s*$/;
|
||||||
|
|
||||||
this.getNextLineIndent = function(state, line, tab) {
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
var indent = this.$getIndent(line);
|
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') &&
|
if (!(tokens.length && tokens[tokens.length - 1].type === 'comment') &&
|
||||||
state === 'start' && indenter.test(line))
|
state === 'start' && indenter.test(line))
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
||||||
|
|
@ -61,7 +59,7 @@ oop.inherits(Mode, TextMode);
|
||||||
this.getNextLineIndent = function(state, line, tab) {
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
var indent = this.$getIndent(line);
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
var tokens = tokenizedLine.tokens;
|
var tokens = tokenizedLine.tokens;
|
||||||
|
|
||||||
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
|
|
@ -76,7 +76,7 @@ oop.inherits(Mode, TextMode);
|
||||||
this.getNextLineIndent = function(state, line, tab) {
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
var indent = this.$getIndent(line);
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
var tokens = tokenizedLine.tokens;
|
var tokens = tokenizedLine.tokens;
|
||||||
var endState = tokenizedLine.state;
|
var endState = tokenizedLine.state;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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*$"});
|
||||||
|
|
@ -28,7 +25,7 @@ oop.inherits(Mode, TextMode);
|
||||||
this.getNextLineIndent = function(state, line, tab) {
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
var indent = this.$getIndent(line);
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
var tokens = tokenizedLine.tokens;
|
var tokens = tokenizedLine.tokens;
|
||||||
|
|
||||||
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
@ -53,7 +51,7 @@ oop.inherits(Mode, TextMode);
|
||||||
this.getNextLineIndent = function(state, line, tab) {
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
var indent = this.$getIndent(line);
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
var tokens = tokenizedLine.tokens;
|
var tokens = tokenizedLine.tokens;
|
||||||
|
|
||||||
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
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")
|
if (input !== "\r\n" && input !== "\r" && input !== "\n")
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var tokens = this.$tokenizer.getLineTokens(line.trim(), state).tokens;
|
var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens;
|
||||||
|
|
||||||
if (!tokens)
|
if (!tokens)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
|
||||||
|
|
@ -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-/,
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
};
|
};
|
||||||
|
|
@ -57,7 +54,7 @@ oop.inherits(Mode, TextMode);
|
||||||
this.getNextLineIndent = function(state, line, tab) {
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
var indent = this.$getIndent(line);
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
var tokens = tokenizedLine.tokens;
|
var tokens = tokenizedLine.tokens;
|
||||||
|
|
||||||
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue