From 37fc6127566867ae49866152690be8b4e13b649d Mon Sep 17 00:00:00 2001 From: nightwing Date: Sat, 7 Sep 2013 19:13:30 +0400 Subject: [PATCH 01/13] generate doclist automatically based on modelist --- demo/kitchen-sink/doclist.js | 114 +++++------------- demo/kitchen-sink/docs/ada.ada | 5 + demo/kitchen-sink/docs/{cpp.cpp => c_cpp.cpp} | 0 demo/kitchen-sink/docs/cobol.CBL | 1 + .../{coffeescript.coffee => coffee.coffee} | 0 demo/kitchen-sink/docs/d.d | 14 +++ demo/kitchen-sink/docs/ejs.ejs | 1 + .../docs/{freemarker.ftl => ftl.ftl} | 0 demo/kitchen-sink/docs/html.htm | 1 + demo/kitchen-sink/docs/ini.ini | 1 + demo/kitchen-sink/docs/jsoniq.jq | 1 + demo/kitchen-sink/docs/matlab.matlab | 1 + demo/kitchen-sink/docs/mysql.mysql | 1 + .../docs/{OpenSCAD.scad => scad.scad} | 0 demo/kitchen-sink/docs/soy_template.soy | 46 +++++++ index.html | 8 +- lib/ace/ext/modelist.js | 18 +-- 17 files changed, 118 insertions(+), 94 deletions(-) create mode 100644 demo/kitchen-sink/docs/ada.ada rename demo/kitchen-sink/docs/{cpp.cpp => c_cpp.cpp} (100%) create mode 100644 demo/kitchen-sink/docs/cobol.CBL rename demo/kitchen-sink/docs/{coffeescript.coffee => coffee.coffee} (100%) create mode 100644 demo/kitchen-sink/docs/d.d create mode 100644 demo/kitchen-sink/docs/ejs.ejs rename demo/kitchen-sink/docs/{freemarker.ftl => ftl.ftl} (100%) create mode 100644 demo/kitchen-sink/docs/html.htm create mode 100644 demo/kitchen-sink/docs/ini.ini create mode 100644 demo/kitchen-sink/docs/jsoniq.jq create mode 100644 demo/kitchen-sink/docs/matlab.matlab create mode 100644 demo/kitchen-sink/docs/mysql.mysql rename demo/kitchen-sink/docs/{OpenSCAD.scad => scad.scad} (100%) create mode 100644 demo/kitchen-sink/docs/soy_template.soy diff --git a/demo/kitchen-sink/doclist.js b/demo/kitchen-sink/doclist.js index 9fdf6a64..3abdf664 100644 --- a/demo/kitchen-sink/doclist.js +++ b/demo/kitchen-sink/doclist.js @@ -66,95 +66,19 @@ function makeHuge(txt) { } var docs = { - "docs/javascript.js": "JavaScript", - "docs/AsciiDoc.asciidoc": "AsciiDoc", - "docs/clojure.clj": "Clojure", - "docs/coffeescript.coffee": "CoffeeScript", - "docs/coldfusion.cfm": "ColdFusion", - "docs/cpp.cpp": "C/C++", - "docs/csharp.cs": "C#", - "docs/css.css": "CSS", - "docs/curly.curly": "Curly", - "docs/dart.dart": "Dart", - "docs/diff.diff": "Diff", - "docs/dot.dot": "Dot", - "docs/freemarker.ftl" : "FreeMarker", - "docs/glsl.glsl": "Glsl", - "docs/golang.go": "Go", - "docs/groovy.groovy": "Groovy", - "docs/haml.haml": "Haml", - "docs/Haxe.hx": "haXe", - "docs/html.html": "HTML", - "docs/html_ruby.erb": "HTML (Ruby)", - "docs/jade.jade": "Jade", - "docs/java.java": "Java", - "docs/jsp.jsp": "JSP", - "docs/json.json": "JSON", - "docs/jsx.jsx": "JSX", + "docs/javascript.js": {order: 1, name: "JavaScript"}, + "docs/latex.tex": {name: "LaTeX", wrapped: true}, - "docs/less.less": "LESS", - "docs/lisp.lisp": "Lisp", - "docs/lsl.lsl": "LSL", - "docs/scheme.scm": "Scheme", - "docs/livescript.ls": "LiveScript", - "docs/liquid.liquid": "Liquid", - "docs/logiql.logic": "LogiQL", - "docs/lua.lua": "Lua", - "docs/lucene.lucene": "Lucene", - "docs/luapage.lp": "LuaPage", - "docs/Makefile": "Makefile", "docs/markdown.md": {name: "Markdown", wrapped: true}, "docs/mushcode.mc": {name: "MUSHCode", wrapped: true}, - "docs/objectivec.m": {name: "Objective-C"}, - "docs/ocaml.ml": "OCaml", - "docs/OpenSCAD.scad": "OpenSCAD", - "docs/pascal.pas": "Pascal", - "docs/perl.pl": "Perl", "docs/pgsql.pgsql": {name: "pgSQL", wrapped: true}, - "docs/php.php": "PHP", "docs/plaintext.txt": {name: "Plain Text", prepare: makeHuge, wrapped: true}, - "docs/powershell.ps1": "Powershell", - "docs/properties.properties": "Properties", - "docs/python.py": "Python", - "docs/r.r": "R", - "docs/rdoc.Rd": "RDoc", - "docs/rhtml.rhtml": "RHTML", - "docs/ruby.rb": "Ruby", - "docs/abap.abap": "SAP - ABAP", - "docs/scala.scala": "Scala", - "docs/scss.scss": "SCSS", - "docs/sass.sass": "SASS", - "docs/sh.sh": "SH", - "docs/space.space": "Space", - "docs/stylus.styl": "Stylus", "docs/sql.sql": {name: "SQL", wrapped: true}, - "docs/svg.svg": "SVG", - "docs/tcl.tcl": "Tcl", - "docs/tex.tex": "Tex", - "docs/textile.textile": {name: "Textile", wrapped: true}, - "docs/snippets.snippets": "snippets", - "docs/toml.toml": "TOML", - "docs/typescript.ts": "Typescript", - "docs/vbscript.vbs": "VBScript", - "docs/velocity.vm": "Velocity", - "docs/xml.xml": "XML", - "docs/xquery.xq": "XQuery", - "docs/yaml.yaml": "YAML", - "docs/c9search.c9search_results": "C9 Search Results", - "docs/actionscript.as": "ActionScript", - "docs/assembly_x86.asm": "Assembly_x86", - "docs/autohotkey.ahk": "AutoHotKey", - "docs/batchfile.bat": "BatchFile", - "docs/erlang.erl": "Erlang", - "docs/forth.frt": "Forth", - "docs/haskell.hs": "Haskell", - "docs/julia.js": "Julia", - "docs/prolog.plg": "Prolog", - "docs/rust.rs": "Rust", - "docs/twig.twig": "Twig", - "docs/Nix.nix": "Nix", - "docs/protobuf.proto": "Protobuf" + "docs/textile.textile": {name: "Textile", wrapped: true}, + + "docs/c9search.c9search_results": "C9 Search Results", + "docs/Nix.nix": "Nix" }; var ownSource = { @@ -166,6 +90,23 @@ var hugeDocs = { "build/src-min/ace.js": "" }; +modelist.modes.forEach(function(m) { + var ext = m.extensions.split("|")[0]; + if (ext[0] === "^") { + path = ext.substr(1); + } else { + var path = m.name + "." + ext + } + path = "docs/" + path; + if (!docs[path]) { + docs[path] = {name: m.caption}; + } else if (typeof docs[path] == "object" && !docs[path].name) { + docs[path].name = m.caption; + } +}) + + + if (window.require && window.require.s) try { for (var path in window.require.s.contexts._.defined) { if (path.indexOf("!") != -1) @@ -176,6 +117,13 @@ if (window.require && window.require.s) try { } } catch(e) {} +function sort(list) { + return list.sort(function(a, b) { + var cmp = (b.order || 0) - (a.order || 0); + return cmp || a.name && a.name.localeCompare(b.name); + }) +} + function prepareDocList(docs) { var list = []; for (var path in docs) { @@ -219,7 +167,7 @@ function loadDoc(name, callback) { module.exports = { fileCache: fileCache, - docs: prepareDocList(docs), + docs: sort(prepareDocList(docs)), ownSource: prepareDocList(ownSource), hugeDocs: prepareDocList(hugeDocs), initDoc: initDoc, diff --git a/demo/kitchen-sink/docs/ada.ada b/demo/kitchen-sink/docs/ada.ada new file mode 100644 index 00000000..90e027f0 --- /dev/null +++ b/demo/kitchen-sink/docs/ada.ada @@ -0,0 +1,5 @@ +with Ada.Text_IO; use Ada.Text_IO; +procedure Hello is +begin + Put_Line("Hello, world!"); +end Hello; \ No newline at end of file diff --git a/demo/kitchen-sink/docs/cpp.cpp b/demo/kitchen-sink/docs/c_cpp.cpp similarity index 100% rename from demo/kitchen-sink/docs/cpp.cpp rename to demo/kitchen-sink/docs/c_cpp.cpp diff --git a/demo/kitchen-sink/docs/cobol.CBL b/demo/kitchen-sink/docs/cobol.CBL new file mode 100644 index 00000000..30404ce4 --- /dev/null +++ b/demo/kitchen-sink/docs/cobol.CBL @@ -0,0 +1 @@ +TODO \ No newline at end of file diff --git a/demo/kitchen-sink/docs/coffeescript.coffee b/demo/kitchen-sink/docs/coffee.coffee similarity index 100% rename from demo/kitchen-sink/docs/coffeescript.coffee rename to demo/kitchen-sink/docs/coffee.coffee diff --git a/demo/kitchen-sink/docs/d.d b/demo/kitchen-sink/docs/d.d new file mode 100644 index 00000000..57069067 --- /dev/null +++ b/demo/kitchen-sink/docs/d.d @@ -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); +} \ No newline at end of file diff --git a/demo/kitchen-sink/docs/ejs.ejs b/demo/kitchen-sink/docs/ejs.ejs new file mode 100644 index 00000000..30404ce4 --- /dev/null +++ b/demo/kitchen-sink/docs/ejs.ejs @@ -0,0 +1 @@ +TODO \ No newline at end of file diff --git a/demo/kitchen-sink/docs/freemarker.ftl b/demo/kitchen-sink/docs/ftl.ftl similarity index 100% rename from demo/kitchen-sink/docs/freemarker.ftl rename to demo/kitchen-sink/docs/ftl.ftl diff --git a/demo/kitchen-sink/docs/html.htm b/demo/kitchen-sink/docs/html.htm new file mode 100644 index 00000000..30404ce4 --- /dev/null +++ b/demo/kitchen-sink/docs/html.htm @@ -0,0 +1 @@ +TODO \ No newline at end of file diff --git a/demo/kitchen-sink/docs/ini.ini b/demo/kitchen-sink/docs/ini.ini new file mode 100644 index 00000000..30404ce4 --- /dev/null +++ b/demo/kitchen-sink/docs/ini.ini @@ -0,0 +1 @@ +TODO \ No newline at end of file diff --git a/demo/kitchen-sink/docs/jsoniq.jq b/demo/kitchen-sink/docs/jsoniq.jq new file mode 100644 index 00000000..30404ce4 --- /dev/null +++ b/demo/kitchen-sink/docs/jsoniq.jq @@ -0,0 +1 @@ +TODO \ No newline at end of file diff --git a/demo/kitchen-sink/docs/matlab.matlab b/demo/kitchen-sink/docs/matlab.matlab new file mode 100644 index 00000000..30404ce4 --- /dev/null +++ b/demo/kitchen-sink/docs/matlab.matlab @@ -0,0 +1 @@ +TODO \ No newline at end of file diff --git a/demo/kitchen-sink/docs/mysql.mysql b/demo/kitchen-sink/docs/mysql.mysql new file mode 100644 index 00000000..30404ce4 --- /dev/null +++ b/demo/kitchen-sink/docs/mysql.mysql @@ -0,0 +1 @@ +TODO \ No newline at end of file diff --git a/demo/kitchen-sink/docs/OpenSCAD.scad b/demo/kitchen-sink/docs/scad.scad similarity index 100% rename from demo/kitchen-sink/docs/OpenSCAD.scad rename to demo/kitchen-sink/docs/scad.scad diff --git a/demo/kitchen-sink/docs/soy_template.soy b/demo/kitchen-sink/docs/soy_template.soy new file mode 100644 index 00000000..3a9e3436 --- /dev/null +++ b/demo/kitchen-sink/docs/soy_template.soy @@ -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" /}
+ // Greet the additional people. + {foreach $additionalName in $additionalNames} + {call .helloName} + {param name: $additionalName /} + {/call} + {if not isLast($additionalName)} +
// 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} \ No newline at end of file diff --git a/index.html b/index.html index 4427356d..75504169 100644 --- a/index.html +++ b/index.html @@ -963,7 +963,7 @@ if (match) { Divshot
  • - Codio
  • @@ -1038,7 +1038,7 @@ if (match) { iKnode
  • -
    sT
    SourceTalk
  • @@ -1079,6 +1079,10 @@ if (match) { Try allong.es +
  • + + Codechat +
  • Sky Edit
  • diff --git a/lib/ace/ext/modelist.js b/lib/ace/ext/modelist.js index b785cd46..496940e6 100644 --- a/lib/ace/ext/modelist.js +++ b/lib/ace/ext/modelist.js @@ -50,10 +50,10 @@ var supportedModes = { AutoHotKey: ["ahk"], BatchFile: ["bat|cmd"], C9Search: ["c9search_results"], - C_Cpp: ["c|cc|cpp|cxx|h|hh|hpp"], + C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp"], Clojure: ["clj"], - Cobol: ["^CBL|COB"], - coffee: ["^Cakefile|coffee|cf|cson"], + Cobol: ["CBL|COB"], + coffee: ["coffee|cf|cson|^Cakefile"], ColdFusion: ["cfm"], CSharp: ["cs"], CSS: ["css"], @@ -74,7 +74,7 @@ var supportedModes = { haXe: ["hx"], HTML: ["htm|html|xhtml"], HTML_Ruby: ["erb|rhtml|html.erb"], - Ini: ["Ini|conf"], + Ini: ["ini|conf"], Jade: ["jade"], Java: ["java"], JavaScript: ["js"], @@ -83,7 +83,7 @@ var supportedModes = { JSP: ["jsp"], JSX: ["jsx"], Julia: ["jl"], - LaTeX: ["latex|tex|ltx|bib"], + LaTeX: ["tex|latex|ltx|bib"], LESS: ["less"], Liquid: ["liquid"], Lisp: ["lisp"], @@ -93,7 +93,7 @@ var supportedModes = { Lua: ["lua"], LuaPage: ["lp"], Lucene: ["lucene"], - Makefile: ["^GNUmakefile|^makefile|^Makefile|^OCamlMakefile|make"], + Makefile: ["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"], MATLAB: ["matlab"], Markdown: ["md|markdown"], MySQL: ["mysql"], @@ -113,14 +113,14 @@ var supportedModes = { R: ["r"], RDoc: ["Rd"], RHTML: ["Rhtml"], - Ruby: ["ru|gemspec|rake|rb"], + Ruby: ["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"], Rust: ["rs"], SASS: ["sass"], SCAD: ["scad"], Scala: ["scala"], Scheme: ["scm|rkt"], SCSS: ["scss"], - SH: ["sh|bash"], + SH: ["sh|bash|^.bashrc"], Space: ["space"], snippets: ["snippets"], SQL: ["sql"], @@ -132,7 +132,7 @@ var supportedModes = { Textile: ["textile"], Toml: ["toml"], Twig: ["twig"], - Typescript: ["typescript|ts|str"], + Typescript: ["ts|typescript|str"], VBScript: ["vbs"], Velocity: ["vm"], XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl"], From 7b80bb793edd93bd1a71ecc2639d096eb58fdd7b Mon Sep 17 00:00:00 2001 From: nightwing Date: Sat, 7 Sep 2013 13:47:52 +0400 Subject: [PATCH 02/13] cleanup --- doc/site/js/main.js | 7 +++++-- index.html | 2 +- lib/ace/autocomplete.js | 2 +- lib/ace/config.js | 10 ++++++++-- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/doc/site/js/main.js b/doc/site/js/main.js index ed9fbff4..7e564fbf 100644 --- a/doc/site/js/main.js +++ b/doc/site/js/main.js @@ -6,10 +6,13 @@ $(function() { editor.container.style.opacity = ""; embedded_editor = ace.edit("embedded_ace_code"); embedded_editor.container.style.opacity = ""; - editor.session.setMode("ace/mode/javascript"); - editor.session.setMode("ace/mode/javascript"); + editor.session.setMode("ace/mode/javascript"); embedded_editor.session.setMode("ace/mode/html"); + editor.setOptions({ + maxLines: 30 + }) + ace.config.loadModule("ace/ext/emmet", function() { ace.require("ace/lib/net").loadScript("http://nightwing.github.io/emmet-core/emmet.js", function() { embedded_editor.setOption("enableEmmet", true); diff --git a/index.html b/index.html index 75504169..f61b619a 100644 --- a/index.html +++ b/index.html @@ -80,7 +80,7 @@ function add(x, y) { var addResult = add(3, 2); console.log(addResult); - +

    Looking for a more full-featured demo? Check out the kitchen sink. diff --git a/lib/ace/autocomplete.js b/lib/ace/autocomplete.js index 8f321800..2500bd9a 100644 --- a/lib/ace/autocomplete.js +++ b/lib/ace/autocomplete.js @@ -90,7 +90,7 @@ var Autocomplete = function() { this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler); this.editor.off("changeSelection", this.changeListener); this.editor.off("blur", this.changeListener); - this.editor.off("mousedown", this.changeListener); + this.editor.off("mousedown", this.mousedownListener); this.editor.off("mousewheel", this.mousewheelListener); this.changeTimer.cancel(); diff --git a/lib/ace/config.js b/lib/ace/config.js index eb3de049..703b1c7f 100644 --- a/lib/ace/config.js +++ b/lib/ace/config.js @@ -217,8 +217,11 @@ var optionsProvider = { if (this["$" + name] === value) return; var opt = this.$options[name]; - if (!opt) + if (!opt) { + if (typeof console != "undefined" && console.error) + console.error('misspelled option "' + name + '"'); return undefined; + } if (opt.forwardTo) return this[opt.forwardTo] && this[opt.forwardTo].setOption(name, value); @@ -229,8 +232,11 @@ var optionsProvider = { }, getOption: function(name) { var opt = this.$options[name]; - if (!opt) + if (!opt) { + if (typeof console != "undefined" && console.error) + console.error('misspelled option "' + name + '"'); return undefined; + } if (opt.forwardTo) return this[opt.forwardTo] && this[opt.forwardTo].getOption(name); return opt && opt.get ? opt.get.call(this) : this["$" + name]; From 3be21b77e5fb1c9e977369ef31f86faf869e8296 Mon Sep 17 00:00:00 2001 From: nightwing Date: Sun, 8 Sep 2013 22:19:15 +0400 Subject: [PATCH 03/13] simple handlebars mode --- demo/kitchen-sink/docs/handlebars.hbs | 8 +++ demo/kitchen-sink/docs/verilog.v | 12 ++++ lib/ace/ext/modelist.js | 6 +- lib/ace/mode/handlebars.js | 31 ++++++++++ lib/ace/mode/handlebars_highlight_rules.js | 72 ++++++++++++++++++++++ lib/ace/mode/markdown.js | 6 +- 6 files changed, 130 insertions(+), 5 deletions(-) create mode 100644 demo/kitchen-sink/docs/handlebars.hbs create mode 100644 demo/kitchen-sink/docs/verilog.v create mode 100644 lib/ace/mode/handlebars.js create mode 100644 lib/ace/mode/handlebars_highlight_rules.js diff --git a/demo/kitchen-sink/docs/handlebars.hbs b/demo/kitchen-sink/docs/handlebars.hbs new file mode 100644 index 00000000..1cdf786e --- /dev/null +++ b/demo/kitchen-sink/docs/handlebars.hbs @@ -0,0 +1,8 @@ +{{!-- Ace + :-}} --}} + +

    + {{#each comments}} +

    {{title}}

    +
    {{body}}
    + {{/each}} +
    diff --git a/demo/kitchen-sink/docs/verilog.v b/demo/kitchen-sink/docs/verilog.v new file mode 100644 index 00000000..b1f79265 --- /dev/null +++ b/demo/kitchen-sink/docs/verilog.v @@ -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]; \ No newline at end of file diff --git a/lib/ace/ext/modelist.js b/lib/ace/ext/modelist.js index 496940e6..5d9a474d 100644 --- a/lib/ace/ext/modelist.js +++ b/lib/ace/ext/modelist.js @@ -70,11 +70,12 @@ var supportedModes = { golang: ["go"], Groovy: ["groovy"], HAML: ["haml"], + Handlebars: ["hbs|handlebars|tpl|mustache"], Haskell: ["hs"], haXe: ["hx"], HTML: ["htm|html|xhtml"], HTML_Ruby: ["erb|rhtml|html.erb"], - Ini: ["ini|conf"], + INI: ["ini|conf|cfg|prefs"], Jade: ["jade"], Java: ["java"], JavaScript: ["js"], @@ -135,9 +136,10 @@ var supportedModes = { Typescript: ["ts|typescript|str"], VBScript: ["vbs"], Velocity: ["vm"], + Verilog: ["v|vh|sv|svh"], XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl"], XQuery: ["xq"], - YAML: ["yaml"] + YAML: ["yaml|yml"] }; var nameOverrides = { diff --git a/lib/ace/mode/handlebars.js b/lib/ace/mode/handlebars.js new file mode 100644 index 00000000..1c1d1cd2 --- /dev/null +++ b/lib/ace/mode/handlebars.js @@ -0,0 +1,31 @@ +/* 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); + var highlighter = new HandlebarsHighlightRules(); + this.$tokenizer = new Tokenizer(highlighter.getRules()); + this.$behaviour = new HtmlBehaviour(); + + this.$embeds = highlighter.getEmbeds(); + + this.foldingRules = new HtmlFoldMode(); +}; + +oop.inherits(Mode, HtmlMode); + +(function() { + +}).call(Mode.prototype); + +exports.Mode = Mode; +}); diff --git a/lib/ace/mode/handlebars_highlight_rules.js b/lib/ace/mode/handlebars_highlight_rules.js new file mode 100644 index 00000000..e224335f --- /dev/null +++ b/lib/ace/mode/handlebars_highlight_rules.js @@ -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; +}); diff --git a/lib/ace/mode/markdown.js b/lib/ace/mode/markdown.js index 678b2a0d..bce60478 100644 --- a/lib/ace/mode/markdown.js +++ b/lib/ace/mode/markdown.js @@ -46,9 +46,9 @@ var Mode = function() { this.$tokenizer = new Tokenizer(highlighter.getRules()); this.$embeds = highlighter.getEmbeds(); this.createModeDelegates({ - "js-": JavaScriptMode, - "xml-": XmlMode, - "html-": HtmlMode + "js-": JavaScriptMode, + "xml-": XmlMode, + "html-": HtmlMode }); this.foldingRules = new MarkdownFoldMode(); From 5ba0212ca21b286e0e7809ec6afd83b68e6e540b Mon Sep 17 00:00:00 2001 From: nightwing Date: Sun, 8 Sep 2013 23:01:11 +0400 Subject: [PATCH 04/13] simple soytemplate highlighter --- lib/ace/ext/modelist.js | 3 +- lib/ace/mode/soy_template.js | 63 ++++ lib/ace/mode/soy_template_highlight_rules.js | 356 +++++++++++++++++++ 3 files changed, 421 insertions(+), 1 deletion(-) create mode 100644 lib/ace/mode/soy_template.js create mode 100644 lib/ace/mode/soy_template_highlight_rules.js diff --git a/lib/ace/ext/modelist.js b/lib/ace/ext/modelist.js index 5d9a474d..df3d75af 100644 --- a/lib/ace/ext/modelist.js +++ b/lib/ace/ext/modelist.js @@ -43,8 +43,8 @@ Mode.prototype.supportsFile = function(filename) { // todo firstlinematch var supportedModes = { ABAP: ["abap"], - ADA: ["ada|adb"], ActionScript:["as"], + ADA: ["ada|adb"], AsciiDoc: ["asciidoc"], Assembly_x86:["asm"], AutoHotKey: ["ahk"], @@ -124,6 +124,7 @@ var supportedModes = { SH: ["sh|bash|^.bashrc"], Space: ["space"], snippets: ["snippets"], + Soy_Template:["soy"], SQL: ["sql"], Stylus: ["styl|stylus"], SVG: ["svg"], diff --git a/lib/ace/mode/soy_template.js b/lib/ace/mode/soy_template.js new file mode 100644 index 00000000..381d1493 --- /dev/null +++ b/lib/ace/mode/soy_template.js @@ -0,0 +1,63 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2012, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * Contributor(s): + * + * + * + * ***** END LICENSE BLOCK ***** */ + +/* + THIS FILE WAS AUTOGENERATED BY mode.tmpl.js +*/ + +define(function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var HtmlMode = require("./html").Mode; +var Tokenizer = require("../tokenizer").Tokenizer; +var SoyTemplateHighlightRules = require("./soy_template_highlight_rules").SoyTemplateHighlightRules; + +var Mode = function() { + HtmlMode.call(this); + var highlighter = new SoyTemplateHighlightRules(); + this.$tokenizer = new Tokenizer(highlighter.getRules()); + this.$keywordList = highlighter.$keywordList; +}; +oop.inherits(Mode, HtmlMode); + +(function() { + this.lineCommentStart = "//"; + this.blockComment = {start: "/*", end: "*/"}; + // Extra logic goes here. +}).call(Mode.prototype); + +exports.Mode = Mode; +}); \ No newline at end of file diff --git a/lib/ace/mode/soy_template_highlight_rules.js b/lib/ace/mode/soy_template_highlight_rules.js new file mode 100644 index 00000000..50e3ae48 --- /dev/null +++ b/lib/ace/mode/soy_template_highlight_rules.js @@ -0,0 +1,356 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2012, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +/* This file was autogenerated from tm bundles\SoyTemplate\Syntaxes\SoyTemplate.tmLanguage (uuid: ) */ +/**************************************************************************************** + * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * + * fileTypes * + ****************************************************************************************/ + +define(function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; + +var SoyTemplateHighlightRules = function() { + HtmlHighlightRules.call(this); + + // regexp must not have capturing parentheses. Use (?:) instead. + // regexps are ordered -> the first match is used + + var soyRules = { start: + [ { include: '#template' }, + { include: '#if' }, + { include: '#comment-line' }, + { include: '#comment-block' }, + { include: '#comment-doc' }, + { include: '#call' }, + { include: '#css' }, + { include: '#param' }, + { include: '#print' }, + { include: '#msg' }, + { include: '#for' }, + { include: '#foreach' }, + { include: '#switch' }, + { include: '#tag' }, + { include: 'text.html.basic' } ], + '#call': + [ { token: + [ 'punctuation.definition.tag.begin.soy', + 'meta.tag.call.soy' ], + regex: '(\\{/?)(\\s*)(?=call|delcall)', + push: + [ { token: 'punctuation.definition.tag.end.soy', + regex: '\\}', + next: 'pop' }, + { include: '#string-quoted-single' }, + { include: '#string-quoted-double' }, + { token: ['entity.name.tag.soy', 'variable.parameter.soy'], + regex: '(call|delcall)(\\s+[\\.\\w]+)'}, + { token: + [ 'entity.other.attribute-name.soy', + 'text', + 'keyword.operator.soy' ], + regex: '\\b(data)(\\s*)(=)' }, + { defaultToken: 'meta.tag.call.soy' } ] } ], + '#comment-line': + [ { token: + [ 'comment.line.double-slash.soy', + 'punctuation.definition.comment.soy', + 'comment.line.double-slash.soy' ], + regex: '(\\s+)(//)(.*$)' } ], + '#comment-block': + [ { token: 'punctuation.definition.comment.begin.soy', + regex: '/\\*(?!\\*)', + push: + [ { token: 'punctuation.definition.comment.end.soy', + regex: '\\*/', + next: 'pop' }, + { defaultToken: 'comment.block.soy' } ] } ], + '#comment-doc': + [ { token: 'punctuation.definition.comment.begin.soy', + regex: '/\\*\\*(?!/)', + push: + [ { token: 'punctuation.definition.comment.end.soy', + regex: '\\*/', + next: 'pop' }, + { token: [ 'support.type.soy', 'text', 'variable.parameter.soy' ], + regex: '(@param|@param\\?)(\\s+)(\\w+)' }, + { defaultToken: 'comment.block.documentation.soy' } ] } ], + '#css': + [ { token: + [ 'punctuation.definition.tag.begin.soy', + 'meta.tag.css.soy', + 'entity.name.tag.soy' ], + regex: '(\\{/?)(\\s*)(css)\\b', + push: + [ { token: 'punctuation.definition.tag.end.soy', + regex: '\\}', + next: 'pop' }, + { token: 'support.constant.soy', + regex: '\\b(?:LITERAL|REFERENCE|BACKEND_SPECIFIC|GOOG)\\b' }, + { defaultToken: 'meta.tag.css.soy' } ] } ], + '#for': + [ { token: + [ 'punctuation.definition.tag.begin.soy', + 'meta.tag.for.soy', + 'entity.name.tag.soy' ], + regex: '(\\{/?)(\\s*)(for)\\b', + push: + [ { token: 'punctuation.definition.tag.end.soy', + regex: '\\}', + next: 'pop' }, + { token: 'keyword.operator.soy', regex: '\\bin\\b' }, + { token: 'support.function.soy', regex: '\\brange\\b' }, + { include: '#variable' }, + { include: '#number' }, + { include: '#primitive' }, + { defaultToken: 'meta.tag.for.soy' } ] } ], + '#foreach': + [ { token: + [ 'punctuation.definition.tag.begin.soy', + 'meta.tag.foreach.soy', + 'entity.name.tag.soy' ], + regex: '(\\{/?)(\\s*)(foreach)\\b', + push: + [ { token: 'punctuation.definition.tag.end.soy', + regex: '\\}', + next: 'pop' }, + { token: 'keyword.operator.soy', regex: '\\bin\\b' }, + { include: '#variable' }, + { defaultToken: 'meta.tag.foreach.soy' } ] } ], + '#function': + [ { token: 'support.function.soy', + regex: '\\b(?:isFirst|isLast|index|hasData|length|keys|round|floor|ceiling|min|max|randomInt)\\b' } ], + '#if': + [ { token: + [ 'punctuation.definition.tag.begin.soy', + 'meta.tag.if.soy', + 'entity.name.tag.soy' ], + regex: '(\\{/?)(\\s*)(if|elseif)\\b', + push: + [ { token: 'punctuation.definition.tag.end.soy', + regex: '\\}', + next: 'pop' }, + { include: '#variable' }, + { include: '#operator' }, + { include: '#function' }, + { include: '#string-quoted-single' }, + { include: '#string-quoted-double' }, + { defaultToken: 'meta.tag.if.soy' } ] } ], + '#namespace': + [ { token: [ 'entity.name.tag.soy', 'text', 'variable.parameter.soy' ], + regex: '(namespace|delpackage)(\\s+)([\\w\\.]+)' } ], + '#number': [ { token: 'constant.numeric', regex: '[\\d]+' } ], + '#operator': + [ { token: 'keyword.operator.soy', + regex: '==|!=|\\band\\b|\\bor\\b|\\bnot\\b|-|\\+|/|\\?:' } ], + '#param': + [ { token: + [ 'punctuation.definition.tag.begin.soy', + 'meta.tag.param.soy', + 'entity.name.tag.soy' ], + regex: '(\\{/?)(\\s*)(param)', + push: + [ { token: 'punctuation.definition.tag.end.soy', + regex: '\\}', + next: 'pop' }, + { include: '#variable' }, + { token: + [ 'entity.other.attribute-name.soy', + 'text', + 'keyword.operator.soy' ], + regex: '\\b([\\w]*)(\\s*)((?::)?)' }, + { defaultToken: 'meta.tag.param.soy' } ] } ], + '#primitive': + [ { token: 'constant.language.soy', + regex: '\\b(?:null|false|true)\\b' } ], + '#msg': + [ { token: + [ 'punctuation.definition.tag.begin.soy', + 'meta.tag.msg.soy', + 'entity.name.tag.soy' ], + regex: '(\\{/?)(\\s*)(msg)\\b', + push: + [ { token: 'punctuation.definition.tag.end.soy', + regex: '\\}', + next: 'pop' }, + { include: '#string-quoted-single' }, + { include: '#string-quoted-double' }, + { token: + [ 'entity.other.attribute-name.soy', + 'text', + 'keyword.operator.soy' ], + regex: '\\b(meaning|desc)(\\s*)(=)' }, + { defaultToken: 'meta.tag.msg.soy' } ] } ], + '#print': + [ { token: + [ 'punctuation.definition.tag.begin.soy', + 'meta.tag.print.soy', + 'entity.name.tag.soy' ], + regex: '(\\{/?)(\\s*)(print)\\b', + push: + [ { token: 'punctuation.definition.tag.end.soy', + regex: '\\}', + next: 'pop' }, + { include: '#variable' }, + { include: '#print-parameter' }, + { include: '#number' }, + { include: '#primitive' }, + { include: '#attribute-lookup' }, + { defaultToken: 'meta.tag.print.soy' } ] } ], + '#print-parameter': + [ { token: 'keyword.operator.soy', regex: '\\|' }, + { token: 'variable.parameter.soy', + regex: 'noAutoescape|id|escapeHtml|escapeJs|insertWorkBreaks|truncate' } ], + '#special-character': + [ { token: 'support.constant.soy', + regex: '\\bsp\\b|\\bnil\\b|\\\\r|\\\\n|\\\\t|\\blb\\b|\\brb\\b' } ], + '#string-quoted-double': [ { token: 'string.quoted.double', regex: '"[^"]*"' } ], + '#string-quoted-single': [ { token: 'string.quoted.single', regex: '\'[^\']*\'' } ], + '#switch': + [ { token: + [ 'punctuation.definition.tag.begin.soy', + 'meta.tag.switch.soy', + 'entity.name.tag.soy' ], + regex: '(\\{/?)(\\s*)(switch|case)\\b', + push: + [ { token: 'punctuation.definition.tag.end.soy', + regex: '\\}', + next: 'pop' }, + { include: '#variable' }, + { include: '#function' }, + { include: '#number' }, + { include: '#string-quoted-single' }, + { include: '#string-quoted-double' }, + { defaultToken: 'meta.tag.switch.soy' } ] } ], + '#attribute-lookup': + [ { token: 'punctuation.definition.attribute-lookup.begin.soy', + regex: '\\[', + push: + [ { token: 'punctuation.definition.attribute-lookup.end.soy', + regex: '\\]', + next: 'pop' }, + { include: '#variable' }, + { include: '#function' }, + { include: '#operator' }, + { include: '#number' }, + { include: '#primitive' }, + { include: '#string-quoted-single' }, + { include: '#string-quoted-double' } ] } ], + '#tag': + [ { token: 'punctuation.definition.tag.begin.soy', + regex: '\\{', + push: + [ { token: 'punctuation.definition.tag.end.soy', + regex: '\\}', + next: 'pop' }, + { include: '#namespace' }, + { include: '#variable' }, + { include: '#special-character' }, + { include: '#tag-simple' }, + { include: '#function' }, + { include: '#operator' }, + { include: '#attribute-lookup' }, + { include: '#number' }, + { include: '#primitive' }, + { include: '#print-parameter' } ] } ], + '#tag-simple': + [ { token: 'entity.name.tag.soy', + regex: '{{\\s*(?:literal|else|ifempty|default)\\s*(?=\\})'} ], + '#template': + [ { token: + [ 'punctuation.definition.tag.begin.soy', + 'meta.tag.template.soy' ], + regex: '(\\{/?)(\\s*)(?=template|deltemplate)', + push: + [ { token: 'punctuation.definition.tag.end.soy', + regex: '\\}', + next: 'pop' }, + { token: ['entity.name.tag.soy', 'text', 'entity.name.function.soy' ], + regex: '(template|deltemplate)(\\s+)([\\.\\w]+)', + originalRegex: '(?<=template|deltemplate)\\s+([\\.\\w]+)' }, + { token: + [ 'entity.other.attribute-name.soy', + 'text', + 'keyword.operator.soy', + 'text', + 'string.quoted.double.soy' ], + regex: '\\b(private)(\\s*)(=)(\\s*)("true"|"false")' }, + { token: + [ 'entity.other.attribute-name.soy', + 'text', + 'keyword.operator.soy', + 'text', + 'string.quoted.single.soy' ], + regex: '\\b(private)(\\s*)(=)(\\s*)(\'true\'|\'false\')' }, + { token: + [ 'entity.other.attribute-name.soy', + 'text', + 'keyword.operator.soy', + 'text', + 'string.quoted.double.soy' ], + regex: '\\b(autoescape)(\\s*)(=)(\\s*)("true"|"false"|"contextual")' }, + { token: + [ 'entity.other.attribute-name.soy', + 'text', + 'keyword.operator.soy', + 'text', + 'string.quoted.single.soy' ], + regex: '\\b(autoescape)(\\s*)(=)(\\s*)(\'true\'|\'false\'|\'contextual\')' }, + { defaultToken: 'meta.tag.template.soy' } ] } ], + '#variable': [ { token: 'variable.other.soy', regex: '\\$[\\w\\.]+' } ] } + + + for (var i in soyRules) { + if (this.$rules[i]) { + this.$rules[i].unshift.call(this.$rules[i], soyRules[i]); + } else { + this.$rules[i] = soyRules[i]; + } + } + + this.normalizeRules(); +}; + +SoyTemplateHighlightRules.metaData = { comment: 'SoyTemplate', + fileTypes: [ 'soy' ], + firstLineMatch: '\\{\\s*namespace\\b', + foldingStartMarker: '\\{\\s*template\\s+[^\\}]*\\}', + foldingStopMarker: '\\{\\s*/\\s*template\\s*\\}', + name: 'SoyTemplate', + scopeName: 'source.soy' } + + +oop.inherits(SoyTemplateHighlightRules, HtmlHighlightRules); + +exports.SoyTemplateHighlightRules = SoyTemplateHighlightRules; +}); \ No newline at end of file From 4670e2201d58d35c464252ddab10e8aa4caddd0b Mon Sep 17 00:00:00 2001 From: nightwing Date: Sun, 8 Sep 2013 23:24:32 +0400 Subject: [PATCH 05/13] fix running Makefile.dryice.js from another directory --- Makefile.dryice.js | 4 ++-- lib/ace/snippets/handlebars.js | 7 +++++++ lib/ace/snippets/handlebars.snippets | 0 lib/ace/snippets/soy_template.js | 7 +++++++ lib/ace/snippets/soy_template.snippets | 0 5 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 lib/ace/snippets/handlebars.js create mode 100644 lib/ace/snippets/handlebars.snippets create mode 100644 lib/ace/snippets/soy_template.js create mode 100644 lib/ace/snippets/soy_template.snippets diff --git a/Makefile.dryice.js b/Makefile.dryice.js index 14ffea23..6c691238 100755 --- a/Makefile.dryice.js +++ b/Makefile.dryice.js @@ -301,7 +301,7 @@ var buildAce = function(options) { noconflict: false, suffix: null, name: "ace", - modes: jsFileList("lib/ace/mode", /_highlight_rules|_test|_worker|xml_util|_outdent|behaviour/), + modes: jsFileList("lib/ace/mode", /_highlight_rules|_test|_worker|xml_util|_outdent|behaviour|completions/), themes: jsFileList("lib/ace/theme"), extensions: jsFileList("lib/ace/ext"), workers: workers("lib/ace/mode"), @@ -522,7 +522,7 @@ function generateThemesModule(themes) { '\n\nmodule.exports.themes = ' + JSON.stringify(themes, null, ' '), ';\n\n});' ].join(''); - fs.writeFileSync('./lib/ace/ext/themelist_utils/themes.js', themelist, 'utf8'); + fs.writeFileSync(__dirname + '/lib/ace/ext/themelist_utils/themes.js', themelist, 'utf8'); } function inlineTextModules(text) { diff --git a/lib/ace/snippets/handlebars.js b/lib/ace/snippets/handlebars.js new file mode 100644 index 00000000..64ba39b3 --- /dev/null +++ b/lib/ace/snippets/handlebars.js @@ -0,0 +1,7 @@ +define(function(require, exports, module) { +"use strict"; + +exports.snippetText = require("../requirejs/text!./handlebars.snippets"); +exports.scope = "handlebars"; + +}); diff --git a/lib/ace/snippets/handlebars.snippets b/lib/ace/snippets/handlebars.snippets new file mode 100644 index 00000000..e69de29b diff --git a/lib/ace/snippets/soy_template.js b/lib/ace/snippets/soy_template.js new file mode 100644 index 00000000..194da757 --- /dev/null +++ b/lib/ace/snippets/soy_template.js @@ -0,0 +1,7 @@ +define(function(require, exports, module) { +"use strict"; + +exports.snippetText = require("../requirejs/text!./soy_template.snippets"); +exports.scope = "soy_template"; + +}); diff --git a/lib/ace/snippets/soy_template.snippets b/lib/ace/snippets/soy_template.snippets new file mode 100644 index 00000000..e69de29b From b4f8e47fe3b455281c4d2eb0b0cad9181e03fa4e Mon Sep 17 00:00:00 2001 From: nightwing Date: Sun, 8 Sep 2013 23:59:53 +0400 Subject: [PATCH 06/13] fix slim cursor setting --- lib/ace/css/editor.css | 10 ++++++++++ lib/ace/keyboard/emacs.js | 2 +- lib/ace/theme/chrome.css | 7 +------ lib/ace/theme/clouds.css | 7 +------ lib/ace/theme/clouds_midnight.css | 7 +------ lib/ace/theme/cobalt.css | 7 +------ lib/ace/theme/crimson_editor.css | 7 +------ lib/ace/theme/dawn.css | 7 +------ lib/ace/theme/dreamweaver.css | 7 +------ lib/ace/theme/eclipse.css | 2 +- lib/ace/theme/github.css | 7 +------ lib/ace/theme/idle_fingers.css | 7 +------ lib/ace/theme/kr_theme.css | 7 +------ lib/ace/theme/merbivore.css | 7 +------ lib/ace/theme/merbivore_soft.css | 7 +------ lib/ace/theme/mono_industrial.css | 7 +------ lib/ace/theme/monokai.css | 7 +------ lib/ace/theme/pastel_on_dark.css | 7 +------ lib/ace/theme/solarized_dark.css | 7 +------ lib/ace/theme/solarized_light.css | 7 +------ lib/ace/theme/terminal.css | 7 +------ lib/ace/theme/textmate.css | 7 +------ lib/ace/theme/tomorrow.css | 7 +------ lib/ace/theme/tomorrow_night.css | 7 +------ lib/ace/theme/tomorrow_night_blue.css | 7 +------ lib/ace/theme/tomorrow_night_bright.css | 7 +------ lib/ace/theme/tomorrow_night_eighties.css | 7 +------ lib/ace/theme/twilight.css | 7 +------ lib/ace/theme/vibrant_ink.css | 7 +------ lib/ace/theme/xcode.css | 7 +------ tool/theme.tmpl.css | 7 +------ tool/tmtheme.js | 1 - 32 files changed, 40 insertions(+), 171 deletions(-) diff --git a/lib/ace/css/editor.css b/lib/ace/css/editor.css index acea6f89..b7450b4e 100644 --- a/lib/ace/css/editor.css +++ b/lib/ace/css/editor.css @@ -167,6 +167,16 @@ -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; + border-left: 2px solid +} + +.ace_slim-cursors .ace_cursor { + border-left-width: 1px; +} + +.ace_overwrite-cursors .ace_cursor { + border-left-width: 0px; + border-bottom: 1px solid; } .ace_hidden-cursors .ace_cursor { diff --git a/lib/ace/keyboard/emacs.js b/lib/ace/keyboard/emacs.js index 1cb84f59..a7350608 100644 --- a/lib/ace/keyboard/emacs.js +++ b/lib/ace/keyboard/emacs.js @@ -71,7 +71,7 @@ exports.handler.attach = function(editor) { background-color: rgba(0,250,0,0.9);\ opacity: 0.5;\ }\ - .emacs-mode .ace_cursor.ace_hidden{\ + .emacs-mode .ace_hidden-cursors .ace_cursor{\ opacity: 1;\ background-color: transparent;\ }\ diff --git a/lib/ace/theme/chrome.css b/lib/ace/theme/chrome.css index f7e65098..5130817d 100644 --- a/lib/ace/theme/chrome.css +++ b/lib/ace/theme/chrome.css @@ -14,12 +14,7 @@ } .ace-chrome .ace_cursor { - border-left: 2px solid black; -} - -.ace-chrome .ace_overwrite-cursors .ace_cursor { - border-left: 0px; - border-bottom: 1px solid black; + color: black; } .ace-chrome .ace_invisible { diff --git a/lib/ace/theme/clouds.css b/lib/ace/theme/clouds.css index 3424088b..e3884e02 100644 --- a/lib/ace/theme/clouds.css +++ b/lib/ace/theme/clouds.css @@ -14,12 +14,7 @@ } .ace-clouds .ace_cursor { - border-left: 2px solid #000000 -} - -.ace-clouds .ace_overwrite-cursors .ace_cursor { - border-left: 0px; - border-bottom: 1px solid #000000 + color: #000000 } .ace-clouds .ace_marker-layer .ace_selection { diff --git a/lib/ace/theme/clouds_midnight.css b/lib/ace/theme/clouds_midnight.css index b84b6706..87e22465 100644 --- a/lib/ace/theme/clouds_midnight.css +++ b/lib/ace/theme/clouds_midnight.css @@ -14,12 +14,7 @@ } .ace-clouds-midnight .ace_cursor { - border-left: 2px solid #7DA5DC -} - -.ace-clouds-midnight .ace_overwrite-cursors .ace_cursor { - border-left: 0px; - border-bottom: 1px solid #7DA5DC + color: #7DA5DC } .ace-clouds-midnight .ace_marker-layer .ace_selection { diff --git a/lib/ace/theme/cobalt.css b/lib/ace/theme/cobalt.css index 36608202..7febd9ac 100644 --- a/lib/ace/theme/cobalt.css +++ b/lib/ace/theme/cobalt.css @@ -14,12 +14,7 @@ } .ace-cobalt .ace_cursor { - border-left: 2px solid #FFFFFF -} - -.ace-cobalt .ace_overwrite-cursors .ace_cursor { - border-left: 0px; - border-bottom: 1px solid #FFFFFF + color: #FFFFFF } .ace-cobalt .ace_marker-layer .ace_selection { diff --git a/lib/ace/theme/crimson_editor.css b/lib/ace/theme/crimson_editor.css index f8e9f653..e84292b4 100644 --- a/lib/ace/theme/crimson_editor.css +++ b/lib/ace/theme/crimson_editor.css @@ -20,12 +20,7 @@ } .ace-crimson-editor .ace_cursor { - border-left: 2px solid black; -} - -.ace-crimson-editor .ace_overwrite-cursors .ace_cursor { - border-left: 0px; - border-bottom: 1px solid black; + color: black; } .ace-crimson-editor .ace_invisible { diff --git a/lib/ace/theme/dawn.css b/lib/ace/theme/dawn.css index 3bbf33fe..c1a89e32 100644 --- a/lib/ace/theme/dawn.css +++ b/lib/ace/theme/dawn.css @@ -14,12 +14,7 @@ } .ace-dawn .ace_cursor { - border-left: 2px solid #000000 -} - -.ace-dawn .ace_overwrite-cursors .ace_cursor { - border-left: 0px; - border-bottom: 1px solid #000000 + color: #000000 } .ace-dawn .ace_marker-layer .ace_selection { diff --git a/lib/ace/theme/dreamweaver.css b/lib/ace/theme/dreamweaver.css index 949be9ca..595927b2 100644 --- a/lib/ace/theme/dreamweaver.css +++ b/lib/ace/theme/dreamweaver.css @@ -17,12 +17,7 @@ } .ace-dreamweaver .ace_cursor { - border-left: 2px solid black; -} - -.ace-dreamweaver .ace_overwrite-cursors .ace_cursor { - border-left: 0px; - border-bottom: 1px solid black; + color: black; } .ace-dreamweaver .ace_invisible { diff --git a/lib/ace/theme/eclipse.css b/lib/ace/theme/eclipse.css index b1c84a74..6deec44b 100644 --- a/lib/ace/theme/eclipse.css +++ b/lib/ace/theme/eclipse.css @@ -18,7 +18,7 @@ } .ace-eclipse .ace_cursor { - border-left: 2px solid black; + color: black; } .ace-eclipse .ace_storage, diff --git a/lib/ace/theme/github.css b/lib/ace/theme/github.css index 318824da..f496f6ee 100644 --- a/lib/ace/theme/github.css +++ b/lib/ace/theme/github.css @@ -65,12 +65,7 @@ } .ace-github .ace_cursor { - border-left: 2px solid black; -} - -.ace-github .ace_overwrite-cursors .ace_cursor { - border-left: 0px; - border-bottom: 1px solid black; + color: black; } .ace-github .ace_marker-layer .ace_active-line { diff --git a/lib/ace/theme/idle_fingers.css b/lib/ace/theme/idle_fingers.css index 640b9389..6a4d02d5 100644 --- a/lib/ace/theme/idle_fingers.css +++ b/lib/ace/theme/idle_fingers.css @@ -14,12 +14,7 @@ } .ace-idle-fingers .ace_cursor { - border-left: 2px solid #91FF00 -} - -.ace-idle-fingers .ace_overwrite-cursors .ace_cursor { - border-left: 0px; - border-bottom: 1px solid #91FF00 + color: #91FF00 } .ace-idle-fingers .ace_marker-layer .ace_selection { diff --git a/lib/ace/theme/kr_theme.css b/lib/ace/theme/kr_theme.css index e9e336f5..ea030d30 100644 --- a/lib/ace/theme/kr_theme.css +++ b/lib/ace/theme/kr_theme.css @@ -14,12 +14,7 @@ } .ace-kr-theme .ace_cursor { - border-left: 2px solid #FF9900 -} - -.ace-kr-theme .ace_overwrite-cursors .ace_cursor { - border-left: 0px; - border-bottom: 1px solid #FF9900 + color: #FF9900 } .ace-kr-theme .ace_marker-layer .ace_selection { diff --git a/lib/ace/theme/merbivore.css b/lib/ace/theme/merbivore.css index 5770ce3b..d0803d82 100644 --- a/lib/ace/theme/merbivore.css +++ b/lib/ace/theme/merbivore.css @@ -14,12 +14,7 @@ } .ace-merbivore .ace_cursor { - border-left: 2px solid #FFFFFF -} - -.ace-merbivore .ace_overwrite-cursors .ace_cursor { - border-left: 0px; - border-bottom: 1px solid #FFFFFF + color: #FFFFFF } .ace-merbivore .ace_marker-layer .ace_selection { diff --git a/lib/ace/theme/merbivore_soft.css b/lib/ace/theme/merbivore_soft.css index 975493c6..7792440d 100644 --- a/lib/ace/theme/merbivore_soft.css +++ b/lib/ace/theme/merbivore_soft.css @@ -14,12 +14,7 @@ } .ace-merbivore-soft .ace_cursor { - border-left: 2px solid #FFFFFF -} - -.ace-merbivore-soft .ace_overwrite-cursors .ace_cursor { - border-left: 0px; - border-bottom: 1px solid #FFFFFF + color: #FFFFFF } .ace-merbivore-soft .ace_marker-layer .ace_selection { diff --git a/lib/ace/theme/mono_industrial.css b/lib/ace/theme/mono_industrial.css index 90aaf5d1..90531fa2 100644 --- a/lib/ace/theme/mono_industrial.css +++ b/lib/ace/theme/mono_industrial.css @@ -14,12 +14,7 @@ } .ace-mono-industrial .ace_cursor { - border-left: 2px solid #FFFFFF -} - -.ace-mono-industrial .ace_overwrite-cursors .ace_cursor { - border-left: 0px; - border-bottom: 1px solid #FFFFFF + color: #FFFFFF } .ace-mono-industrial .ace_marker-layer .ace_selection { diff --git a/lib/ace/theme/monokai.css b/lib/ace/theme/monokai.css index 2c7e3b0d..77d18fe2 100644 --- a/lib/ace/theme/monokai.css +++ b/lib/ace/theme/monokai.css @@ -14,12 +14,7 @@ } .ace-monokai .ace_cursor { - border-left: 2px solid #F8F8F0 -} - -.ace-monokai .ace_overwrite-cursors .ace_cursor { - border-left: 0px; - border-bottom: 1px solid #F8F8F0 + color: #F8F8F0 } .ace-monokai .ace_marker-layer .ace_selection { diff --git a/lib/ace/theme/pastel_on_dark.css b/lib/ace/theme/pastel_on_dark.css index 6f54986b..9e876d4a 100644 --- a/lib/ace/theme/pastel_on_dark.css +++ b/lib/ace/theme/pastel_on_dark.css @@ -14,12 +14,7 @@ } .ace-pastel-on-dark .ace_cursor { - border-left: 2px solid #A7A7A7 -} - -.ace-pastel-on-dark .ace_overwrite-cursors .ace_cursor { - border-left: 0px; - border-bottom: 1px solid #A7A7A7 + color: #A7A7A7 } .ace-pastel-on-dark .ace_marker-layer .ace_selection { diff --git a/lib/ace/theme/solarized_dark.css b/lib/ace/theme/solarized_dark.css index 165bc3c8..1b55f29f 100644 --- a/lib/ace/theme/solarized_dark.css +++ b/lib/ace/theme/solarized_dark.css @@ -19,12 +19,7 @@ } .ace-solarized-dark .ace_cursor { - border-left: 2px solid #D30102 -} - -.ace-solarized-dark .ace_overwrite-cursors .ace_cursor { - border-left: 0px; - border-bottom: 1px solid #D30102 + color: #D30102 } .ace-solarized-dark .ace_marker-layer .ace_active-line, diff --git a/lib/ace/theme/solarized_light.css b/lib/ace/theme/solarized_light.css index 3a99d732..c72a8d21 100644 --- a/lib/ace/theme/solarized_light.css +++ b/lib/ace/theme/solarized_light.css @@ -14,12 +14,7 @@ } .ace-solarized-light .ace_cursor { - border-left: 2px solid #000000 -} - -.ace-solarized-light .ace_overwrite-cursors .ace_cursor { - border-left: 0px; - border-bottom: 1px solid #000000 + color: #000000 } .ace-solarized-light .ace_marker-layer .ace_selection { diff --git a/lib/ace/theme/terminal.css b/lib/ace/theme/terminal.css index 2bafcbc2..3636a03d 100644 --- a/lib/ace/theme/terminal.css +++ b/lib/ace/theme/terminal.css @@ -14,12 +14,7 @@ } .ace-terminal-theme .ace_cursor { - border-left: 2px solid springgreen -} - -.ace-terminal-theme .ace_overwrite-cursors .ace_cursor { - border-left: 0px; - border-bottom: 1px solid #9F9F9F + color: #9F9F9F } .ace-terminal-theme .ace_marker-layer .ace_selection { diff --git a/lib/ace/theme/textmate.css b/lib/ace/theme/textmate.css index 43b8ed36..13c4e848 100644 --- a/lib/ace/theme/textmate.css +++ b/lib/ace/theme/textmate.css @@ -17,12 +17,7 @@ } .ace-tm .ace_cursor { - border-left: 2px solid black; -} - -.ace-tm .ace_overwrite-cursors .ace_cursor { - border-left: 0px; - border-bottom: 1px solid black; + color: black; } .ace-tm .ace_invisible { diff --git a/lib/ace/theme/tomorrow.css b/lib/ace/theme/tomorrow.css index 3776a944..3e59b8b5 100644 --- a/lib/ace/theme/tomorrow.css +++ b/lib/ace/theme/tomorrow.css @@ -14,12 +14,7 @@ } .ace-tomorrow .ace_cursor { - border-left: 2px solid #AEAFAD -} - -.ace-tomorrow .ace_overwrite-cursors .ace_cursor { - border-left: 0px; - border-bottom: 1px solid #AEAFAD + color: #AEAFAD } .ace-tomorrow .ace_marker-layer .ace_selection { diff --git a/lib/ace/theme/tomorrow_night.css b/lib/ace/theme/tomorrow_night.css index 1118799a..a8a9111e 100644 --- a/lib/ace/theme/tomorrow_night.css +++ b/lib/ace/theme/tomorrow_night.css @@ -14,12 +14,7 @@ } .ace-tomorrow-night .ace_cursor { - border-left: 2px solid #AEAFAD -} - -.ace-tomorrow-night .ace_overwrite-cursors .ace_cursor { - border-left: 0px; - border-bottom: 1px solid #AEAFAD + color: #AEAFAD } .ace-tomorrow-night .ace_marker-layer .ace_selection { diff --git a/lib/ace/theme/tomorrow_night_blue.css b/lib/ace/theme/tomorrow_night_blue.css index 51dfe2bf..dbdd4e7d 100644 --- a/lib/ace/theme/tomorrow_night_blue.css +++ b/lib/ace/theme/tomorrow_night_blue.css @@ -18,12 +18,7 @@ } .ace-tomorrow-night-blue .ace_cursor { - border-left: 2px solid #FFFFFF -} - -.ace-tomorrow-night-blue .ace_overwrite-cursors .ace_cursor { - border-left: 0px; - border-bottom: 1px solid #FFFFFF + color: #FFFFFF } .ace-tomorrow-night-blue .ace_marker-layer .ace_selection { diff --git a/lib/ace/theme/tomorrow_night_bright.css b/lib/ace/theme/tomorrow_night_bright.css index a4c182dc..f092a44f 100644 --- a/lib/ace/theme/tomorrow_night_bright.css +++ b/lib/ace/theme/tomorrow_night_bright.css @@ -14,12 +14,7 @@ } .ace-tomorrow-night-bright .ace_cursor { - border-left: 2px solid #9F9F9F -} - -.ace-tomorrow-night-bright .ace_overwrite-cursors .ace_cursor { - border-left: 0px; - border-bottom: 1px solid #9F9F9F + color: #9F9F9F } .ace-tomorrow-night-bright .ace_marker-layer .ace_selection { diff --git a/lib/ace/theme/tomorrow_night_eighties.css b/lib/ace/theme/tomorrow_night_eighties.css index fc3e532f..200044a5 100644 --- a/lib/ace/theme/tomorrow_night_eighties.css +++ b/lib/ace/theme/tomorrow_night_eighties.css @@ -18,12 +18,7 @@ } .ace-tomorrow-night-eighties .ace_cursor { - border-left: 2px solid #CCCCCC -} - -.ace-tomorrow-night-eighties .ace_overwrite-cursors .ace_cursor { - border-left: 0px; - border-bottom: 1px solid #CCCCCC + color: #CCCCCC } .ace-tomorrow-night-eighties .ace_marker-layer .ace_selection { diff --git a/lib/ace/theme/twilight.css b/lib/ace/theme/twilight.css index 3f9d40e6..fd427a23 100644 --- a/lib/ace/theme/twilight.css +++ b/lib/ace/theme/twilight.css @@ -14,12 +14,7 @@ } .ace-twilight .ace_cursor { - border-left: 2px solid #A7A7A7 -} - -.ace-twilight .ace_overwrite-cursors .ace_cursor { - border-left: 0px; - border-bottom: 1px solid #A7A7A7 + color: #A7A7A7 } .ace-twilight .ace_marker-layer .ace_selection { diff --git a/lib/ace/theme/vibrant_ink.css b/lib/ace/theme/vibrant_ink.css index d0cd2582..dd1edb21 100644 --- a/lib/ace/theme/vibrant_ink.css +++ b/lib/ace/theme/vibrant_ink.css @@ -14,12 +14,7 @@ } .ace-vibrant-ink .ace_cursor { - border-left: 2px solid #FFFFFF -} - -.ace-vibrant-ink .ace_overwrite-cursors .ace_cursor { - border-left: 0px; - border-bottom: 1px solid #FFFFFF + color: #FFFFFF } .ace-vibrant-ink .ace_marker-layer .ace_selection { diff --git a/lib/ace/theme/xcode.css b/lib/ace/theme/xcode.css index 782a0837..56eb9a89 100644 --- a/lib/ace/theme/xcode.css +++ b/lib/ace/theme/xcode.css @@ -16,12 +16,7 @@ } .ace-xcode .ace_cursor { - border-left: 2px solid #000000 -} - -.ace-xcode .ace_overwrite-cursors .ace_cursor { - border-left: 0px; - border-bottom: 1px solid #000000 + color: #000000 } .ace-xcode .ace_marker-layer .ace_selection { diff --git a/tool/theme.tmpl.css b/tool/theme.tmpl.css index 58d16360..39bb2437 100644 --- a/tool/theme.tmpl.css +++ b/tool/theme.tmpl.css @@ -16,12 +16,7 @@ } .%cssClass% .ace_cursor { - border-left: 2px solid %cursor%; -} - -.%cssClass% .ace_overwrite-cursors .ace_cursor { - border-left: 0px; - border-bottom: 1px solid %overwrite%; + color: %cursor%; } .%cssClass% .ace_marker-layer .ace_selection { diff --git a/tool/tmtheme.js b/tool/tmtheme.js index c01fb16f..4aa4c402 100755 --- a/tool/tmtheme.js +++ b/tool/tmtheme.js @@ -94,7 +94,6 @@ function extractStyles(theme) { "printMargin": "#e8e8e8", "background": parseColor(globalSettings.background), "foreground": parseColor(globalSettings.foreground), - "overwrite": parseColor(globalSettings.caret), "gutter": "#e8e8e8", "selection": parseColor(globalSettings.selection), "step": "rgb(198, 219, 174)", From bc4b1324b7d1b36664f8a2fb6046d55abedbaf71 Mon Sep 17 00:00:00 2001 From: nightwing Date: Mon, 9 Sep 2013 17:32:19 +0400 Subject: [PATCH 07/13] commandline in demo remains hidden sometimes --- lib/ace/layer/text.js | 4 ++-- lib/ace/virtual_renderer.js | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/ace/layer/text.js b/lib/ace/layer/text.js index 7e81b584..54f0ef46 100644 --- a/lib/ace/layer/text.js +++ b/lib/ace/layer/text.js @@ -63,11 +63,11 @@ var Text = function(parentEl) { }; this.getLineHeight = function() { - return this.$characterSize.height || 1; + return this.$characterSize.height || 0; }; this.getCharacterWidth = function() { - return this.$characterSize.width || 1; + return this.$characterSize.width || 0; }; this.checkForSizeChanges = function() { diff --git a/lib/ace/virtual_renderer.js b/lib/ace/virtual_renderer.js index 5a42513c..c2631c2f 100644 --- a/lib/ace/virtual_renderer.js +++ b/lib/ace/virtual_renderer.js @@ -143,8 +143,8 @@ var VirtualRenderer = function(container, theme) { firstRow : 0, firstRowScreen: 0, lastRow : 0, - lineHeight : 1, - characterWidth : 1, + lineHeight : 0, + characterWidth : 0, minHeight : 1, maxHeight : 1, offset : 0, @@ -748,6 +748,9 @@ var VirtualRenderer = function(container, theme) { this.$changes |= changes; return this.onResize(true); } + if (!this.lineHeight) { + this.$textLayer.checkForSizeChanges(); + } // this.$logChanges(changes); this._signal("beforeRender"); @@ -770,7 +773,6 @@ var VirtualRenderer = function(container, theme) { // full if (changes & this.CHANGE_FULL) { - this.$textLayer.checkForSizeChanges(); // update scrollbar first to not lose scroll position when gutter calls resize this.$updateScrollBarV(); this.$updateScrollBarH(); From 811d190c95c6477fa58fc81a6ddfe77033c0c3a0 Mon Sep 17 00:00:00 2001 From: nightwing Date: Mon, 9 Sep 2013 18:08:23 +0400 Subject: [PATCH 08/13] create tokenizer only when needed --- lib/ace/mode/abap.js | 4 +--- lib/ace/mode/actionscript.js | 4 +--- lib/ace/mode/ada.js | 2 +- lib/ace/mode/asciidoc.js | 3 +-- lib/ace/mode/assembly_x86.js | 4 +--- lib/ace/mode/autohotkey.js | 4 +--- lib/ace/mode/batchfile.js | 4 +--- lib/ace/mode/c9search.js | 2 +- lib/ace/mode/c_cpp.js | 4 +--- lib/ace/mode/clojure.js | 4 +--- lib/ace/mode/cobol.js | 2 +- lib/ace/mode/coffee.js | 4 +--- lib/ace/mode/coldfusion.js | 4 +--- lib/ace/mode/csharp.js | 4 +--- lib/ace/mode/css.js | 4 +--- lib/ace/mode/curly.js | 29 ++--------------------------- lib/ace/mode/d.js | 4 +--- lib/ace/mode/dart.js | 8 ++------ lib/ace/mode/diff.js | 2 +- lib/ace/mode/django.js | 5 ++--- lib/ace/mode/dot.js | 3 +-- lib/ace/mode/ejs.js | 4 +--- lib/ace/mode/erlang.js | 4 +--- lib/ace/mode/forth.js | 4 +--- lib/ace/mode/ftl.js | 3 +-- lib/ace/mode/glsl.js | 4 +--- lib/ace/mode/golang.js | 5 +---- lib/ace/mode/groovy.js | 4 +--- lib/ace/mode/haml.js | 6 ++---- lib/ace/mode/handlebars.js | 4 +--- lib/ace/mode/haskell.js | 4 +--- lib/ace/mode/haxe.js | 4 +--- lib/ace/mode/html.js | 4 +--- lib/ace/mode/html_ruby.js | 4 +--- lib/ace/mode/ini.js | 4 +--- lib/ace/mode/jade.js | 6 ++---- lib/ace/mode/java.js | 5 +---- lib/ace/mode/javascript.js | 4 +--- lib/ace/mode/json.js | 2 +- lib/ace/mode/jsp.js | 3 +-- lib/ace/mode/jsx.js | 2 +- lib/ace/mode/julia.js | 4 +--- lib/ace/mode/latex.js | 2 +- lib/ace/mode/less.js | 2 +- lib/ace/mode/liquid.js | 5 +---- lib/ace/mode/lisp.js | 5 +---- lib/ace/mode/logiql.js | 4 +--- lib/ace/mode/lsl.js | 2 +- lib/ace/mode/lua.js | 4 +--- lib/ace/mode/luapage.js | 5 ++--- lib/ace/mode/makefile.js | 5 +---- lib/ace/mode/markdown.js | 4 +--- lib/ace/mode/matlab.js | 2 +- lib/ace/mode/mushcode.js | 2 +- lib/ace/mode/mysql.js | 2 +- lib/ace/mode/nix.js | 8 ++------ lib/ace/mode/objectivec.js | 4 +--- lib/ace/mode/ocaml.js | 4 +--- lib/ace/mode/pascal.js | 3 +-- lib/ace/mode/perl.js | 4 +--- lib/ace/mode/pgsql.js | 5 +---- lib/ace/mode/php.js | 2 +- lib/ace/mode/plain_text.js | 2 +- lib/ace/mode/powershell.js | 5 +---- lib/ace/mode/prolog.js | 4 +--- lib/ace/mode/properties.js | 3 +-- lib/ace/mode/python.js | 4 +--- lib/ace/mode/r.js | 2 +- lib/ace/mode/rdoc.js | 2 +- lib/ace/mode/rhtml.js | 2 +- lib/ace/mode/ruby.js | 5 +---- lib/ace/mode/rust.js | 4 +--- lib/ace/mode/sass.js | 2 +- lib/ace/mode/scad.js | 5 +---- lib/ace/mode/scala.js | 4 +--- lib/ace/mode/scheme.js | 4 +--- lib/ace/mode/scss.js | 2 +- lib/ace/mode/sh.js | 5 +---- lib/ace/mode/snippets.js | 3 +-- lib/ace/mode/soy_template.js | 5 +---- lib/ace/mode/sql.js | 5 +---- lib/ace/mode/stylus.js | 8 ++------ lib/ace/mode/svg.js | 4 +--- lib/ace/mode/tcl.js | 2 +- lib/ace/mode/tex.js | 4 ++-- lib/ace/mode/text.js | 25 +++++++++++++++++-------- lib/ace/mode/textile.js | 2 +- lib/ace/mode/toml.js | 4 +--- lib/ace/mode/twig.js | 4 +--- lib/ace/mode/typescript.js | 3 +-- lib/ace/mode/vbscript.js | 4 +--- lib/ace/mode/velocity.js | 7 +++---- lib/ace/mode/verilog.js | 2 +- lib/ace/mode/xml.js | 2 +- lib/ace/mode/yaml.js | 2 +- 95 files changed, 122 insertions(+), 281 deletions(-) diff --git a/lib/ace/mode/abap.js b/lib/ace/mode/abap.js index fbd8066a..6ec54c07 100644 --- a/lib/ace/mode/abap.js +++ b/lib/ace/mode/abap.js @@ -39,9 +39,7 @@ var TextMode = require("./text").Mode; var oop = require("../lib/oop"); function Mode() { - var highlighter = new Rules(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); - this.$keywordList = new Rules(highlighter.$keywordList); + this.HighlightRules = Rules; this.foldingRules = new FoldMode(); } diff --git a/lib/ace/mode/actionscript.js b/lib/ace/mode/actionscript.js index 7411413d..47b9345d 100644 --- a/lib/ace/mode/actionscript.js +++ b/lib/ace/mode/actionscript.js @@ -48,16 +48,14 @@ var ActionScriptHighlightRules = require("./actionscript_highlight_rules").Actio var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { - var highlighter = new ActionScriptHighlightRules(); + this.HighlightRules = ActionScriptHighlightRules; this.foldingRules = new FoldMode(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/"}; - // Extra logic goes here. }).call(Mode.prototype); exports.Mode = Mode; diff --git a/lib/ace/mode/ada.js b/lib/ace/mode/ada.js index 8db5a21f..d368bfdd 100644 --- a/lib/ace/mode/ada.js +++ b/lib/ace/mode/ada.js @@ -38,7 +38,7 @@ var AdaHighlightRules = require("./ada_highlight_rules").AdaHighlightRules; var Range = require("../range").Range; var Mode = function() { - this.$tokenizer = new Tokenizer(new AdaHighlightRules().getRules()); + this.HighlightRules = AdaHighlightRules; }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/asciidoc.js b/lib/ace/mode/asciidoc.js index be0bf88b..02979f54 100644 --- a/lib/ace/mode/asciidoc.js +++ b/lib/ace/mode/asciidoc.js @@ -38,9 +38,8 @@ var AsciidocHighlightRules = require("./asciidoc_highlight_rules").AsciidocHighl var AsciidocFoldMode = require("./folding/asciidoc").FoldMode; var Mode = function() { - var highlighter = new AsciidocHighlightRules(); + this.HighlightRules = AsciidocHighlightRules; - this.$tokenizer = new Tokenizer(highlighter.getRules()); this.foldingRules = new AsciidocFoldMode(); }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/assembly_x86.js b/lib/ace/mode/assembly_x86.js index e4d6d8f7..26989198 100644 --- a/lib/ace/mode/assembly_x86.js +++ b/lib/ace/mode/assembly_x86.js @@ -43,15 +43,13 @@ var AssemblyX86HighlightRules = require("./assembly_x86_highlight_rules").Assemb var FoldMode = require("./folding/coffee").FoldMode; var Mode = function() { - var highlighter = new AssemblyX86HighlightRules(); + this.HighlightRules = AssemblyX86HighlightRules; this.foldingRules = new FoldMode(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = ";"; - // Extra logic goes here. }).call(Mode.prototype); exports.Mode = Mode; diff --git a/lib/ace/mode/autohotkey.js b/lib/ace/mode/autohotkey.js index b8e69fd9..2a9ecee5 100644 --- a/lib/ace/mode/autohotkey.js +++ b/lib/ace/mode/autohotkey.js @@ -48,16 +48,14 @@ var AutoHotKeyHighlightRules = require("./autohotkey_highlight_rules").AutoHotKe var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { - var highlighter = new AutoHotKeyHighlightRules(); + this.HighlightRules = AutoHotKeyHighlightRules; this.foldingRules = new FoldMode(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "/\\*"; this.blockComment = {start: "/*", end: "*/"}; - // Extra logic goes here. }).call(Mode.prototype); exports.Mode = Mode; diff --git a/lib/ace/mode/batchfile.js b/lib/ace/mode/batchfile.js index 5b293c0b..2f10957f 100644 --- a/lib/ace/mode/batchfile.js +++ b/lib/ace/mode/batchfile.js @@ -47,16 +47,14 @@ var BatchFileHighlightRules = require("./batchfile_highlight_rules").BatchFileHi var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { - var highlighter = new BatchFileHighlightRules(); + this.HighlightRules = BatchFileHighlightRules; this.foldingRules = new FoldMode(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "::"; this.blockComment = ""; - // Extra logic goes here. }).call(Mode.prototype); exports.Mode = Mode; diff --git a/lib/ace/mode/c9search.js b/lib/ace/mode/c9search.js index 66b26145..18cfdd40 100644 --- a/lib/ace/mode/c9search.js +++ b/lib/ace/mode/c9search.js @@ -39,7 +39,7 @@ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutd var C9StyleFoldMode = require("./folding/c9search").FoldMode; var Mode = function() { - this.$tokenizer = new Tokenizer(new C9SearchHighlightRules().getRules()); + this.HighlightRules = C9SearchHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.foldingRules = new C9StyleFoldMode(); }; diff --git a/lib/ace/mode/c_cpp.js b/lib/ace/mode/c_cpp.js index 6b6f8c09..cb62292f 100644 --- a/lib/ace/mode/c_cpp.js +++ b/lib/ace/mode/c_cpp.js @@ -41,12 +41,10 @@ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { - var highlighter = new c_cppHighlightRules(); + this.HighlightRules = c_cppHighlightRules; - this.$tokenizer = new Tokenizer(highlighter.getRules()); this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new CstyleBehaviour(); - this.$keywordList = highlighter.$keywordList; this.foldingRules = new CStyleFoldMode(); }; diff --git a/lib/ace/mode/clojure.js b/lib/ace/mode/clojure.js index df67dc06..38a6c4f1 100644 --- a/lib/ace/mode/clojure.js +++ b/lib/ace/mode/clojure.js @@ -39,9 +39,7 @@ var MatchingParensOutdent = require("./matching_parens_outdent").MatchingParensO var Range = require("../range").Range; var Mode = function() { - var highlighter = new ClojureHighlightRules(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); - this.$keywordList = highlighter.$keywordList; + this.HighlightRules = ClojureHighlightRules; this.$outdent = new MatchingParensOutdent(); }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/cobol.js b/lib/ace/mode/cobol.js index 4ff2f7ef..a705d9bd 100644 --- a/lib/ace/mode/cobol.js +++ b/lib/ace/mode/cobol.js @@ -38,7 +38,7 @@ var CobolHighlightRules = require("./cobol_highlight_rules").CobolHighlightRules var Range = require("../range").Range; var Mode = function() { - this.$tokenizer = new Tokenizer(new CobolHighlightRules().getRules()); + this.HighlightRules = CobolHighlightRules; }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/coffee.js b/lib/ace/mode/coffee.js index 4a6d2201..02b018bd 100644 --- a/lib/ace/mode/coffee.js +++ b/lib/ace/mode/coffee.js @@ -41,10 +41,8 @@ var WorkerClient = require("../worker/worker_client").WorkerClient; var oop = require("../lib/oop"); function Mode() { - var highlighter = new Rules(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); + this.HighlightRules = Rules; this.$outdent = new Outdent(); - this.$keywordList = highlighter.$keywordList; this.foldingRules = new FoldMode(); } diff --git a/lib/ace/mode/coldfusion.js b/lib/ace/mode/coldfusion.js index fc62a89e..25a2b17a 100644 --- a/lib/ace/mode/coldfusion.js +++ b/lib/ace/mode/coldfusion.js @@ -41,10 +41,8 @@ var ColdfusionHighlightRules = require("./coldfusion_highlight_rules").Coldfusio var Mode = function() { XmlMode.call(this); - var highlighter = new ColdfusionHighlightRules(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); + this.HighlightRules = ColdfusionHighlightRules; - this.$embeds = highlighter.getEmbeds(); this.createModeDelegates({ "js-": JavaScriptMode, "css-": CssMode diff --git a/lib/ace/mode/csharp.js b/lib/ace/mode/csharp.js index 66644b45..94629f3d 100644 --- a/lib/ace/mode/csharp.js +++ b/lib/ace/mode/csharp.js @@ -10,11 +10,9 @@ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { - var highlighter = new CSharpHighlightRules(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); + this.HighlightRules = CSharpHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new CstyleBehaviour(); - this.$keywordList = highlighter.$keywordList; this.foldingRules = new CStyleFoldMode(); }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/css.js b/lib/ace/mode/css.js index fcaa298c..0ee16e75 100644 --- a/lib/ace/mode/css.js +++ b/lib/ace/mode/css.js @@ -41,11 +41,9 @@ var CssBehaviour = require("./behaviour/css").CssBehaviour; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { - var highlighter = new CssHighlightRules(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); + this.HighlightRules = CssHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new CssBehaviour(); - this.$keywordList = highlighter.$keywordList; this.foldingRules = new CStyleFoldMode(); }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/curly.js b/lib/ace/mode/curly.js index 91738f51..c98ab2e9 100644 --- a/lib/ace/mode/curly.js +++ b/lib/ace/mode/curly.js @@ -49,39 +49,14 @@ var HtmlFoldMode = require("./folding/html").FoldMode; var CurlyHighlightRules = require("./curly_highlight_rules").CurlyHighlightRules; var Mode = function() { - // set everything up - var highlighter = new CurlyHighlightRules(); + HtmlMode.call(this); + this.HighlightRules = CurlyHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.foldingRules = new HtmlFoldMode(); - - this.$tokenizer = new Tokenizer(highlighter.getRules()); }; oop.inherits(Mode, HtmlMode); (function() { - // Extra logic goes here--we won't be covering all of this - - /* These are all optional pieces of code! - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - return indent; - }; - - this.checkOutdent = function(state, line, input) { - return this.$outdent.checkOutdent(line, input); - }; - - this.autoOutdent = function(state, doc, row) { - this.$outdent.autoOutdent(doc, row); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/mynew_worker", "NewWorker"); - worker.attachToDocument(session.getDocument()); - - return worker; - }; - */ }).call(Mode.prototype); exports.Mode = Mode; diff --git a/lib/ace/mode/d.js b/lib/ace/mode/d.js index 2dc2de49..26803662 100644 --- a/lib/ace/mode/d.js +++ b/lib/ace/mode/d.js @@ -42,16 +42,14 @@ var DHighlightRules = require("./d_highlight_rules").DHighlightRules; var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { - var highlighter = new DHighlightRules(); + this.HighlightRules = DHighlightRules; this.foldingRules = new FoldMode(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "/\\+"; this.blockComment = {start: "/*", end: "*/"}; - // Extra logic goes here. }).call(Mode.prototype); exports.Mode = Mode; diff --git a/lib/ace/mode/dart.js b/lib/ace/mode/dart.js index cab31e08..a94e33cd 100644 --- a/lib/ace/mode/dart.js +++ b/lib/ace/mode/dart.js @@ -48,16 +48,12 @@ var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { CMode.call(this); - var highlighter = new DartHighlightRules(); + this.HighlightRules = DartHighlightRules; this.foldingRules = new CStyleFoldMode(); - - this.$tokenizer = new Tokenizer(highlighter.getRules()); - this.$keywordList = highlighter.$keywordList; }; oop.inherits(Mode, CMode); -(function() { - // Extra logic goes here. +(function() { this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/"}; }).call(Mode.prototype); diff --git a/lib/ace/mode/diff.js b/lib/ace/mode/diff.js index 9021a5ff..24e156e3 100644 --- a/lib/ace/mode/diff.js +++ b/lib/ace/mode/diff.js @@ -38,7 +38,7 @@ var HighlightRules = require("./diff_highlight_rules").DiffHighlightRules; var FoldMode = require("./folding/diff").FoldMode; var Mode = function() { - this.$tokenizer = new Tokenizer(new HighlightRules().getRules()); + this.HighlightRules = HighlightRules; this.foldingRules = new FoldMode(["diff", "index", "\\+{3}", "@@|\\*{5}"], "i"); }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/django.js b/lib/ace/mode/django.js index ea5c878e..4a68bb7b 100644 --- a/lib/ace/mode/django.js +++ b/lib/ace/mode/django.js @@ -107,9 +107,8 @@ var DjangoHtmlHighlightRules = function() { oop.inherits(DjangoHtmlHighlightRules, HtmlHighlightRules); var Mode = function() { - var highlighter = new DjangoHtmlHighlightRules(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); - this.$embeds = highlighter.getEmbeds(); + HtmlMode.call(this); + this.HighlightRules = DjangoHtmlHighlightRules; }; oop.inherits(Mode, HtmlMode); diff --git a/lib/ace/mode/dot.js b/lib/ace/mode/dot.js index c128ccd6..0f443b10 100644 --- a/lib/ace/mode/dot.js +++ b/lib/ace/mode/dot.js @@ -9,10 +9,9 @@ var DotHighlightRules = require("./dot_highlight_rules").DotHighlightRules; var DotFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { - var highlighter = new DotHighlightRules(); + this.HighlightRules = DotHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.foldingRules = new DotFoldMode(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/ejs.js b/lib/ace/mode/ejs.js index 60713a02..50293e90 100644 --- a/lib/ace/mode/ejs.js +++ b/lib/ace/mode/ejs.js @@ -92,9 +92,7 @@ var RubyMode = require("./ruby").Mode; var Mode = function() { HtmlMode.call(this); - var highlighter = new EjsHighlightRules(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); - this.$embeds = highlighter.getEmbeds(); + this.HighlightRules = EjsHighlightRules; this.createModeDelegates({ "js-": JavaScriptMode, "css-": CssMode, diff --git a/lib/ace/mode/erlang.js b/lib/ace/mode/erlang.js index adcb0a97..d3d2e42e 100644 --- a/lib/ace/mode/erlang.js +++ b/lib/ace/mode/erlang.js @@ -43,16 +43,14 @@ var ErlangHighlightRules = require("./erlang_highlight_rules").ErlangHighlightRu var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { - var highlighter = new ErlangHighlightRules(); + this.HighlightRules = ErlangHighlightRules; this.foldingRules = new FoldMode(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "%"; this.blockComment = {start: "/*", end: "*/"}; - // Extra logic goes here. }).call(Mode.prototype); exports.Mode = Mode; diff --git a/lib/ace/mode/forth.js b/lib/ace/mode/forth.js index 6208434b..1ee65e20 100644 --- a/lib/ace/mode/forth.js +++ b/lib/ace/mode/forth.js @@ -48,16 +48,14 @@ var ForthHighlightRules = require("./forth_highlight_rules").ForthHighlightRules var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { - var highlighter = new ForthHighlightRules(); + this.HighlightRules = ForthHighlightRules; this.foldingRules = new FoldMode(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "(?<=^|\\s)\\.?\\( [^)]*\\)"; this.blockComment = {start: "/*", end: "*/"}; - // Extra logic goes here. }).call(Mode.prototype); exports.Mode = Mode; diff --git a/lib/ace/mode/ftl.js b/lib/ace/mode/ftl.js index 31cbff22..a07dcaac 100644 --- a/lib/ace/mode/ftl.js +++ b/lib/ace/mode/ftl.js @@ -37,8 +37,7 @@ var Tokenizer = require("../tokenizer").Tokenizer; var FtlHighlightRules = require("./ftl_highlight_rules").FtlHighlightRules; var Mode = function() { - var highlighter = new FtlHighlightRules(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); + this.HighlightRules = FtlHighlightRules; }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/glsl.js b/lib/ace/mode/glsl.js index ef2a2b44..202ec9f7 100644 --- a/lib/ace/mode/glsl.js +++ b/lib/ace/mode/glsl.js @@ -41,12 +41,10 @@ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { - var highlighter = new glslHighlightRules(); + this.HighlightRules = glslHighlightRules; - this.$tokenizer = new Tokenizer(highlighter.getRules()); this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new CstyleBehaviour(); - this.$keywordList = highlighter.$keywordList; this.foldingRules = new CStyleFoldMode(); }; oop.inherits(Mode, CMode); diff --git a/lib/ace/mode/golang.js b/lib/ace/mode/golang.js index 91b3e085..c5d1ace0 100644 --- a/lib/ace/mode/golang.js +++ b/lib/ace/mode/golang.js @@ -9,10 +9,7 @@ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { - var highlighter = new GolangHighlightRules(); - - this.$tokenizer = new Tokenizer(highlighter.getRules()); - this.$keywordList = highlighter.$keywordList; + this.HighlightRules = GolangHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.foldingRules = new CStyleFoldMode(); }; diff --git a/lib/ace/mode/groovy.js b/lib/ace/mode/groovy.js index 65d87cd4..91d88e08 100644 --- a/lib/ace/mode/groovy.js +++ b/lib/ace/mode/groovy.js @@ -8,9 +8,7 @@ var GroovyHighlightRules = require("./groovy_highlight_rules").GroovyHighlightRu var Mode = function() { JavaScriptMode.call(this); - var highlighter = new GroovyHighlightRules(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); - this.$keywordList = highlighter.$keywordList; + this.HighlightRules = GroovyHighlightRules; }; oop.inherits(Mode, JavaScriptMode); diff --git a/lib/ace/mode/haml.js b/lib/ace/mode/haml.js index 7970aff2..23ea9e69 100644 --- a/lib/ace/mode/haml.js +++ b/lib/ace/mode/haml.js @@ -47,10 +47,8 @@ var HamlHighlightRules = require("./haml_highlight_rules").HamlHighlightRules; var FoldMode = require("./folding/coffee").FoldMode; var Mode = function() { - var highlighter = new HamlHighlightRules(); - this.foldingRules = new FoldMode(); - - this.$tokenizer = new Tokenizer(highlighter.getRules()); + this.HighlightRules = HamlHighlightRules; + this.foldingRules = new FoldMode(); }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/handlebars.js b/lib/ace/mode/handlebars.js index 1c1d1cd2..55af534c 100644 --- a/lib/ace/mode/handlebars.js +++ b/lib/ace/mode/handlebars.js @@ -12,11 +12,9 @@ var HtmlFoldMode = require("./folding/html").FoldMode; var Mode = function() { HtmlMode.call(this); - var highlighter = new HandlebarsHighlightRules(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); + this.HighlightRules = HandlebarsHighlightRules; this.$behaviour = new HtmlBehaviour(); - this.$embeds = highlighter.getEmbeds(); this.foldingRules = new HtmlFoldMode(); }; diff --git a/lib/ace/mode/haskell.js b/lib/ace/mode/haskell.js index 11e6c17d..5b36905c 100644 --- a/lib/ace/mode/haskell.js +++ b/lib/ace/mode/haskell.js @@ -48,16 +48,14 @@ var HaskellHighlightRules = require("./haskell_highlight_rules").HaskellHighligh var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { - var highlighter = new HaskellHighlightRules(); + this.HighlightRules = HaskellHighlightRules; this.foldingRules = new FoldMode(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "--"; this.blockComment = {start: "/*", end: "*/"}; - // Extra logic goes here. }).call(Mode.prototype); exports.Mode = Mode; diff --git a/lib/ace/mode/haxe.js b/lib/ace/mode/haxe.js index 3933a769..2ae10d0e 100644 --- a/lib/ace/mode/haxe.js +++ b/lib/ace/mode/haxe.js @@ -10,12 +10,10 @@ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { - var highlighter = new HaxeHighlightRules(); + this.HighlightRules = HaxeHighlightRules; - this.$tokenizer = new Tokenizer(highlighter.getRules()); this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new CstyleBehaviour(); - this.$keywordList = highlighter.$keywordList; this.foldingRules = new CStyleFoldMode(); }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/html.js b/lib/ace/mode/html.js index 070978e2..90854002 100644 --- a/lib/ace/mode/html.js +++ b/lib/ace/mode/html.js @@ -42,12 +42,10 @@ var HtmlFoldMode = require("./folding/html").FoldMode; var HtmlCompletions = require("./html_completions").HtmlCompletions; var Mode = function() { - var highlighter = new HtmlHighlightRules(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); + this.HighlightRules = HtmlHighlightRules; this.$behaviour = new HtmlBehaviour(); this.$completer = new HtmlCompletions(); - this.$embeds = highlighter.getEmbeds(); this.createModeDelegates({ "js-": JavaScriptMode, "css-": CssMode diff --git a/lib/ace/mode/html_ruby.js b/lib/ace/mode/html_ruby.js index 5fed54c1..876f3671 100644 --- a/lib/ace/mode/html_ruby.js +++ b/lib/ace/mode/html_ruby.js @@ -42,9 +42,7 @@ var RubyMode = require("./ruby").Mode; var Mode = function() { HtmlMode.call(this); - var highlighter = new HtmlRubyHighlightRules(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); - this.$embeds = highlighter.getEmbeds(); + this.HighlightRules = HtmlRubyHighlightRules; this.createModeDelegates({ "js-": JavaScriptMode, "css-": CssMode, diff --git a/lib/ace/mode/ini.js b/lib/ace/mode/ini.js index cd21990a..6e10cfcf 100644 --- a/lib/ace/mode/ini.js +++ b/lib/ace/mode/ini.js @@ -48,16 +48,14 @@ var IniHighlightRules = require("./ini_highlight_rules").IniHighlightRules; var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { - var highlighter = new IniHighlightRules(); + this.HighlightRules = IniHighlightRules; this.foldingRules = new FoldMode(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = ";"; this.blockComment = {start: "/*", end: "*/"}; - // Extra logic goes here. }).call(Mode.prototype); exports.Mode = Mode; diff --git a/lib/ace/mode/jade.js b/lib/ace/mode/jade.js index 461b60b2..74025633 100644 --- a/lib/ace/mode/jade.js +++ b/lib/ace/mode/jade.js @@ -43,15 +43,13 @@ var JadeHighlightRules = require("./jade_highlight_rules").JadeHighlightRules; var FoldMode = require("./folding/coffee").FoldMode; var Mode = function() { - var highlighter = new JadeHighlightRules(); + this.HighlightRules = JadeHighlightRules; - this.$tokenizer = new Tokenizer(highlighter.getRules()); this.foldingRules = new FoldMode(); }; oop.inherits(Mode, TextMode); -(function() { - // Extra logic goes here. +(function() { this.lineCommentStart = "//"; }).call(Mode.prototype); diff --git a/lib/ace/mode/java.js b/lib/ace/mode/java.js index f132130b..8d37e00e 100644 --- a/lib/ace/mode/java.js +++ b/lib/ace/mode/java.js @@ -8,10 +8,7 @@ var JavaHighlightRules = require("./java_highlight_rules").JavaHighlightRules; var Mode = function() { JavaScriptMode.call(this); - var highlighter = new JavaHighlightRules(); - - this.$tokenizer = new Tokenizer(highlighter.getRules()); - this.$keywordList = highlighter.$keywordList; + this.HighlightRules = JavaHighlightRules; }; oop.inherits(Mode, JavaScriptMode); diff --git a/lib/ace/mode/javascript.js b/lib/ace/mode/javascript.js index 00d8af1a..c0e7ae3d 100644 --- a/lib/ace/mode/javascript.js +++ b/lib/ace/mode/javascript.js @@ -42,12 +42,10 @@ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { - var highlighter = new JavaScriptHighlightRules(); + this.HighlightRules = JavaScriptHighlightRules; - this.$tokenizer = new Tokenizer(highlighter.getRules()); this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new CstyleBehaviour(); - this.$keywordList = highlighter.$keywordList; this.foldingRules = new CStyleFoldMode(); }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/json.js b/lib/ace/mode/json.js index c228c092..1f92c56d 100644 --- a/lib/ace/mode/json.js +++ b/lib/ace/mode/json.js @@ -41,7 +41,7 @@ var CStyleFoldMode = require("./folding/cstyle").FoldMode; var WorkerClient = require("../worker/worker_client").WorkerClient; var Mode = function() { - this.$tokenizer = new Tokenizer(new HighlightRules().getRules()); + this.HighlightRules = HighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new CstyleBehaviour(); this.foldingRules = new CStyleFoldMode(); diff --git a/lib/ace/mode/jsp.js b/lib/ace/mode/jsp.js index a394eab2..03df8d3c 100644 --- a/lib/ace/mode/jsp.js +++ b/lib/ace/mode/jsp.js @@ -40,8 +40,7 @@ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { - var highlighter = new JspHighlightRules(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); + this.HighlightRules = JspHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new CstyleBehaviour(); this.foldingRules = new CStyleFoldMode(); diff --git a/lib/ace/mode/jsx.js b/lib/ace/mode/jsx.js index 608b3385..2131b23f 100644 --- a/lib/ace/mode/jsx.js +++ b/lib/ace/mode/jsx.js @@ -10,7 +10,7 @@ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; var CStyleFoldMode = require("./folding/cstyle").FoldMode; function Mode() { - this.$tokenizer = new Tokenizer(new JsxHighlightRules().getRules()); + this.HighlightRules = JsxHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new CstyleBehaviour(); this.foldingRules = new CStyleFoldMode(); diff --git a/lib/ace/mode/julia.js b/lib/ace/mode/julia.js index cb28d62c..a85ba2f0 100644 --- a/lib/ace/mode/julia.js +++ b/lib/ace/mode/julia.js @@ -48,16 +48,14 @@ var JuliaHighlightRules = require("./julia_highlight_rules").JuliaHighlightRules var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { - var highlighter = new JuliaHighlightRules(); + this.HighlightRules = JuliaHighlightRules; this.foldingRules = new FoldMode(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "#"; this.blockComment = ""; - // Extra logic goes here. }).call(Mode.prototype); exports.Mode = Mode; diff --git a/lib/ace/mode/latex.js b/lib/ace/mode/latex.js index f91d8f32..6d932a6a 100644 --- a/lib/ace/mode/latex.js +++ b/lib/ace/mode/latex.js @@ -9,7 +9,7 @@ var LatexFoldMode = require("./folding/latex").FoldMode; var Range = require("../range").Range; var Mode = function() { - this.$tokenizer = new Tokenizer(new LatexHighlightRules().getRules()); + this.HighlightRules = LatexHighlightRules; this.foldingRules = new LatexFoldMode(); }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/less.js b/lib/ace/mode/less.js index 4343e649..bde7a18e 100644 --- a/lib/ace/mode/less.js +++ b/lib/ace/mode/less.js @@ -40,7 +40,7 @@ var CssBehaviour = require("./behaviour/css").CssBehaviour; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { - this.$tokenizer = new Tokenizer(new LessHighlightRules().getRules()); + this.HighlightRules = LessHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new CssBehaviour(); this.foldingRules = new CStyleFoldMode(); diff --git a/lib/ace/mode/liquid.js b/lib/ace/mode/liquid.js index 247c02a1..41322d27 100644 --- a/lib/ace/mode/liquid.js +++ b/lib/ace/mode/liquid.js @@ -38,10 +38,7 @@ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutd var Range = require("../range").Range; var Mode = function() { - var highlighter = new LiquidHighlightRules(); - - this.$tokenizer = new Tokenizer(highlighter.getRules()); - this.$keywordList = highlighter.$keywordList; + this.HighlightRules = LiquidHighlightRules; this.$outdent = new MatchingBraceOutdent(); }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/lisp.js b/lib/ace/mode/lisp.js index 46427d60..3762c171 100644 --- a/lib/ace/mode/lisp.js +++ b/lib/ace/mode/lisp.js @@ -42,10 +42,7 @@ var Tokenizer = require("../tokenizer").Tokenizer; var LispHighlightRules = require("./lisp_highlight_rules").LispHighlightRules; var Mode = function() { - var highlighter = new LispHighlightRules(); - - this.$tokenizer = new Tokenizer(highlighter.getRules()); - this.$keywordList = highlighter.$keywordList; + this.HighlightRules = LispHighlightRules; }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/logiql.js b/lib/ace/mode/logiql.js index c640bd42..2fdaf5b3 100644 --- a/lib/ace/mode/logiql.js +++ b/lib/ace/mode/logiql.js @@ -42,9 +42,8 @@ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var Mode = function() { - var highlighter = new LogiQLHighlightRules(); + this.HighlightRules = LogiQLHighlightRules; this.foldingRules = new FoldMode(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new CstyleBehaviour(); }; @@ -134,7 +133,6 @@ oop.inherits(Mode, TextMode); var row = it.getCurrentTokenRow(); return new Range(row, col, row, col + tok.value.length); }; - // Extra logic goes here. }).call(Mode.prototype); exports.Mode = Mode; diff --git a/lib/ace/mode/lsl.js b/lib/ace/mode/lsl.js index a10acd0e..b2dcb991 100644 --- a/lib/ace/mode/lsl.js +++ b/lib/ace/mode/lsl.js @@ -41,7 +41,7 @@ var CStyleFoldMode = require("./folding/cstyle").FoldMode; var oop = require("../lib/oop"); var Mode = function() { - this.$tokenizer = new Tokenizer(new Rules().getRules()); + this.HighlightRules = Rules; this.$outdent = new Outdent(); this.$behaviour = new CstyleBehaviour(); this.foldingRules = new CStyleFoldMode(); diff --git a/lib/ace/mode/lua.js b/lib/ace/mode/lua.js index 58a3c822..3beae941 100644 --- a/lib/ace/mode/lua.js +++ b/lib/ace/mode/lua.js @@ -40,11 +40,9 @@ var Range = require("../range").Range; var WorkerClient = require("../worker/worker_client").WorkerClient; var Mode = function() { - var highlighter = new LuaHighlightRules(); + this.HighlightRules = LuaHighlightRules; - this.$tokenizer = new Tokenizer(highlighter.getRules()); this.foldingRules = new LuaFoldMode(); - this.$keywordList = highlighter.$keywordList; }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/luapage.js b/lib/ace/mode/luapage.js index 4a03444c..b6f65480 100644 --- a/lib/ace/mode/luapage.js +++ b/lib/ace/mode/luapage.js @@ -8,10 +8,9 @@ var Tokenizer = require("../tokenizer").Tokenizer; var LuaPageHighlightRules = require("./luapage_highlight_rules").LuaPageHighlightRules; var Mode = function() { - var highlighter = new LuaPageHighlightRules(); + this.HighlightRules = LuaPageHighlightRules; - this.$tokenizer = new Tokenizer(new LuaPageHighlightRules().getRules()); - this.$embeds = highlighter.getEmbeds(); + this.HighlightRules = LuaPageHighlightRules; this.createModeDelegates({ "lua-": LuaMode }); diff --git a/lib/ace/mode/makefile.js b/lib/ace/mode/makefile.js index e51a22bb..bd53cc32 100644 --- a/lib/ace/mode/makefile.js +++ b/lib/ace/mode/makefile.js @@ -47,11 +47,8 @@ var MakefileHighlightRules = require("./makefile_highlight_rules").MakefileHighl var FoldMode = require("./folding/coffee").FoldMode; var Mode = function() { - var highlighter = new MakefileHighlightRules(); + this.HighlightRules = MakefileHighlightRules; this.foldingRules = new FoldMode(); - - this.$tokenizer = new Tokenizer(highlighter.getRules()); - this.$keywordList = highlighter.$keywordList; }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/markdown.js b/lib/ace/mode/markdown.js index bce60478..f2371229 100644 --- a/lib/ace/mode/markdown.js +++ b/lib/ace/mode/markdown.js @@ -41,10 +41,8 @@ var MarkdownHighlightRules = require("./markdown_highlight_rules").MarkdownHighl var MarkdownFoldMode = require("./folding/markdown").FoldMode; var Mode = function() { - var highlighter = new MarkdownHighlightRules(); + this.HighlightRules = MarkdownHighlightRules; - this.$tokenizer = new Tokenizer(highlighter.getRules()); - this.$embeds = highlighter.getEmbeds(); this.createModeDelegates({ "js-": JavaScriptMode, "xml-": XmlMode, diff --git a/lib/ace/mode/matlab.js b/lib/ace/mode/matlab.js index 2b4362d0..ca56b44a 100644 --- a/lib/ace/mode/matlab.js +++ b/lib/ace/mode/matlab.js @@ -38,7 +38,7 @@ var MatlabHighlightRules = require("./matlab_highlight_rules").MatlabHighlightRu var Range = require("../range").Range; var Mode = function() { - this.$tokenizer = new Tokenizer(new MatlabHighlightRules().getRules()); + this.HighlightRules = MatlabHighlightRules; }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/mushcode.js b/lib/ace/mode/mushcode.js index 689ff9df..1a30717b 100644 --- a/lib/ace/mode/mushcode.js +++ b/lib/ace/mode/mushcode.js @@ -39,7 +39,7 @@ var PythonFoldMode = require("./folding/pythonic").FoldMode; var Range = require("../range").Range; var Mode = function() { - this.$tokenizer = new Tokenizer(new MushCodeRules().getRules()); + this.HighlightRules = MushCodeRules; this.foldingRules = new PythonFoldMode("\\:"); }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/mysql.js b/lib/ace/mode/mysql.js index ef7d77dc..2f9754a3 100644 --- a/lib/ace/mode/mysql.js +++ b/lib/ace/mode/mysql.js @@ -37,7 +37,7 @@ var MysqlHighlightRules = require("./mysql_highlight_rules").MysqlHighlightRules var Range = require("../range").Range; var Mode = function() { - this.$tokenizer = new Tokenizer(new MysqlHighlightRules().getRules()); + this.HighlightRules = MysqlHighlightRules; }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/nix.js b/lib/ace/mode/nix.js index b864fc49..a745aca3 100644 --- a/lib/ace/mode/nix.js +++ b/lib/ace/mode/nix.js @@ -48,16 +48,12 @@ var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { CMode.call(this); - var highlighter = new NixHighlightRules(); + this.HighlightRules = NixHighlightRules; this.foldingRules = new CStyleFoldMode(); - - this.$tokenizer = new Tokenizer(highlighter.getRules()); - this.$keywordList = highlighter.$keywordList; }; oop.inherits(Mode, CMode); -(function() { - // Extra logic goes here. +(function() { this.lineCommentStart = "#"; this.blockComment = {start: "/*", end: "*/"}; }).call(Mode.prototype); diff --git a/lib/ace/mode/objectivec.js b/lib/ace/mode/objectivec.js index 10286215..76fdf143 100644 --- a/lib/ace/mode/objectivec.js +++ b/lib/ace/mode/objectivec.js @@ -47,10 +47,8 @@ var ObjectiveCHighlightRules = require("./objectivec_highlight_rules").Objective var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { - var highlighter = new ObjectiveCHighlightRules(); + this.HighlightRules = ObjectiveCHighlightRules; this.foldingRules = new CStyleFoldMode(); - - this.$tokenizer = new Tokenizer(highlighter.getRules()); }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/ocaml.js b/lib/ace/mode/ocaml.js index 9aa6643d..ae369625 100644 --- a/lib/ace/mode/ocaml.js +++ b/lib/ace/mode/ocaml.js @@ -39,11 +39,9 @@ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutd var Range = require("../range").Range; var Mode = function() { - var highlighter = new OcamlHighlightRules(); + this.HighlightRules = OcamlHighlightRules; - this.$tokenizer = new Tokenizer(highlighter.getRules()); this.$outdent = new MatchingBraceOutdent(); - this.$keywordList = highlighter.$keywordList; }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/pascal.js b/lib/ace/mode/pascal.js index cd0739d1..cabdb0dc 100644 --- a/lib/ace/mode/pascal.js +++ b/lib/ace/mode/pascal.js @@ -48,9 +48,8 @@ var PascalHighlightRules = require("./pascal_highlight_rules").PascalHighlightRu var FoldMode = require("./folding/coffee").FoldMode; var Mode = function() { - var highlighter = new PascalHighlightRules(); + this.HighlightRules = PascalHighlightRules; this.foldingRules = new FoldMode(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/perl.js b/lib/ace/mode/perl.js index 46d20065..4a48a52e 100644 --- a/lib/ace/mode/perl.js +++ b/lib/ace/mode/perl.js @@ -40,12 +40,10 @@ var Range = require("../range").Range; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { - var highlighter = new PerlHighlightRules(); + this.HighlightRules = PerlHighlightRules; - this.$tokenizer = new Tokenizer(highlighter.getRules()); this.$outdent = new MatchingBraceOutdent(); this.foldingRules = new CStyleFoldMode({start: "^=(begin|item)\\b", end: "^=(cut)\\b"}); - this.$keywordList = highlighter.$keywordList; }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/pgsql.js b/lib/ace/mode/pgsql.js index 2398ea83..cdcf109a 100755 --- a/lib/ace/mode/pgsql.js +++ b/lib/ace/mode/pgsql.js @@ -37,10 +37,7 @@ var PgsqlHighlightRules = require("./pgsql_highlight_rules").PgsqlHighlightRules var Range = require("../range").Range; var Mode = function() { - var highlighter = new PgsqlHighlightRules(); - - this.$tokenizer = new Tokenizer(highlighter.getRules()); - this.$keywordList = highlighter.$keywordList; + this.HighlightRules = PgsqlHighlightRules; }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/php.js b/lib/ace/mode/php.js index 8e3ecd6c..6b770a9e 100644 --- a/lib/ace/mode/php.js +++ b/lib/ace/mode/php.js @@ -46,7 +46,7 @@ var unicode = require("../unicode"); var Mode = function(opts) { var inline = opts && opts.inline; var HighlightRules = inline ? PhpLangHighlightRules : PhpHighlightRules; - this.$tokenizer = new Tokenizer(new HighlightRules().getRules()); + this.HighlightRules = HighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new CstyleBehaviour(); this.foldingRules = new CStyleFoldMode(); diff --git a/lib/ace/mode/plain_text.js b/lib/ace/mode/plain_text.js index b093e736..f8e61c66 100644 --- a/lib/ace/mode/plain_text.js +++ b/lib/ace/mode/plain_text.js @@ -38,7 +38,7 @@ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var Behaviour = require("./behaviour").Behaviour; var Mode = function() { - this.$tokenizer = new Tokenizer(new TextHighlightRules().getRules()); + this.HighlightRules = TextHighlightRules; this.$behaviour = new Behaviour(); }; diff --git a/lib/ace/mode/powershell.js b/lib/ace/mode/powershell.js index f3bfcdcc..7dc778aa 100644 --- a/lib/ace/mode/powershell.js +++ b/lib/ace/mode/powershell.js @@ -10,10 +10,7 @@ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { - var highlighter = new PowershellHighlightRules(); - - this.$tokenizer = new Tokenizer(highlighter.getRules()); - this.$keywordList = highlighter.$keywordList; + this.HighlightRules = PowershellHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new CstyleBehaviour(); this.foldingRules = new CStyleFoldMode({start: "^\\s*(<#)", end: "^[#\\s]>\\s*$"}); diff --git a/lib/ace/mode/prolog.js b/lib/ace/mode/prolog.js index 10203ce6..6f89e92f 100644 --- a/lib/ace/mode/prolog.js +++ b/lib/ace/mode/prolog.js @@ -48,16 +48,14 @@ var PrologHighlightRules = require("./prolog_highlight_rules").PrologHighlightRu var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { - var highlighter = new PrologHighlightRules(); + this.HighlightRules = PrologHighlightRules; this.foldingRules = new FoldMode(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "/\\*"; this.blockComment = {start: "/*", end: "*/"}; - // Extra logic goes here. }).call(Mode.prototype); exports.Mode = Mode; diff --git a/lib/ace/mode/properties.js b/lib/ace/mode/properties.js index cd71a52c..0f89b75b 100644 --- a/lib/ace/mode/properties.js +++ b/lib/ace/mode/properties.js @@ -37,8 +37,7 @@ var Tokenizer = require("../tokenizer").Tokenizer; var PropertiesHighlightRules = require("./properties_highlight_rules").PropertiesHighlightRules; var Mode = function() { - var highlighter = new PropertiesHighlightRules(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); + this.HighlightRules = PropertiesHighlightRules; }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/python.js b/lib/ace/mode/python.js index 7adaf918..bcd22920 100644 --- a/lib/ace/mode/python.js +++ b/lib/ace/mode/python.js @@ -39,9 +39,7 @@ var PythonFoldMode = require("./folding/pythonic").FoldMode; var Range = require("../range").Range; var Mode = function() { - var highlighter = new PythonHighlightRules(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); - this.$keywordList = highlighter.$keywordList; + this.HighlightRules = PythonHighlightRules; this.foldingRules = new PythonFoldMode("\\:"); }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/r.js b/lib/ace/mode/r.js index a5421a81..520b4c24 100644 --- a/lib/ace/mode/r.js +++ b/lib/ace/mode/r.js @@ -29,7 +29,7 @@ define(function(require, exports, module) { var Mode = function() { - this.$tokenizer = new Tokenizer(new RHighlightRules().getRules()); + this.HighlightRules = RHighlightRules; this.$outdent = new MatchingBraceOutdent(); }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/rdoc.js b/lib/ace/mode/rdoc.js index 1fb9e6e4..9a9671aa 100644 --- a/lib/ace/mode/rdoc.js +++ b/lib/ace/mode/rdoc.js @@ -21,7 +21,7 @@ var RDocHighlightRules = require("./rdoc_highlight_rules").RDocHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var Mode = function(suppressHighlighting) { - this.$tokenizer = new Tokenizer(new RDocHighlightRules().getRules()); + this.HighlightRules = RDocHighlightRules; this.$outdent = new MatchingBraceOutdent(); }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/rhtml.js b/lib/ace/mode/rhtml.js index 99885dbf..8c98dc4b 100644 --- a/lib/ace/mode/rhtml.js +++ b/lib/ace/mode/rhtml.js @@ -31,7 +31,7 @@ var RCodeModel = require("mode/r_code_model").RCodeModel; var Mode = function(doc, session) { this.$session = session; - this.$tokenizer = new Tokenizer(new RHtmlHighlightRules().getRules()); + this.HighlightRules = RHtmlHighlightRules; /* Or these. this.codeModel = new RCodeModel(doc, this.$tokenizer, /^r-/, diff --git a/lib/ace/mode/ruby.js b/lib/ace/mode/ruby.js index ca832137..adb3c96a 100644 --- a/lib/ace/mode/ruby.js +++ b/lib/ace/mode/ruby.js @@ -40,10 +40,7 @@ var Range = require("../range").Range; var FoldMode = require("./folding/coffee").FoldMode; var Mode = function() { - var highlighter = new RubyHighlightRules(); - - this.$tokenizer = new Tokenizer(highlighter.getRules()); - this.$keywordList = highlighter.$keywordList; + this.HighlightRules = RubyHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.foldingRules = new FoldMode(); }; diff --git a/lib/ace/mode/rust.js b/lib/ace/mode/rust.js index 75b02ca9..2a468568 100644 --- a/lib/ace/mode/rust.js +++ b/lib/ace/mode/rust.js @@ -48,16 +48,14 @@ var RustHighlightRules = require("./rust_highlight_rules").RustHighlightRules; var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { - var highlighter = new RustHighlightRules(); + this.HighlightRules = RustHighlightRules; this.foldingRules = new FoldMode(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "/\\*"; this.blockComment = {start: "/*", end: "*/"}; - // Extra logic goes here. }).call(Mode.prototype); exports.Mode = Mode; diff --git a/lib/ace/mode/sass.js b/lib/ace/mode/sass.js index 65f4753e..de78c71b 100644 --- a/lib/ace/mode/sass.js +++ b/lib/ace/mode/sass.js @@ -38,7 +38,7 @@ var SassHighlightRules = require("./sass_highlight_rules").SassHighlightRules; var FoldMode = require("./folding/coffee").FoldMode; var Mode = function() { - this.$tokenizer = new Tokenizer(new SassHighlightRules().getRules()); + this.HighlightRules = SassHighlightRules; this.foldingRules = new FoldMode(); }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/scad.js b/lib/ace/mode/scad.js index 6bd094bc..3860f5af 100644 --- a/lib/ace/mode/scad.js +++ b/lib/ace/mode/scad.js @@ -41,10 +41,7 @@ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { - var highlighter = new scadHighlightRules(); - - this.$tokenizer = new Tokenizer(highlighter.getRules()); - this.$keywordList = highlighter.$keywordList; + this.HighlightRules = scadHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new CstyleBehaviour(); this.foldingRules = new CStyleFoldMode(); diff --git a/lib/ace/mode/scala.js b/lib/ace/mode/scala.js index 97e891fd..5253cec9 100644 --- a/lib/ace/mode/scala.js +++ b/lib/ace/mode/scala.js @@ -9,9 +9,7 @@ var ScalaHighlightRules = require("./scala_highlight_rules").ScalaHighlightRules var Mode = function() { JavaScriptMode.call(this); - var highlighter = new ScalaHighlightRules(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); - this.$keywordList = highlighter.$keywordList; + this.HighlightRules = ScalaHighlightRules; }; oop.inherits(Mode, JavaScriptMode); diff --git a/lib/ace/mode/scheme.js b/lib/ace/mode/scheme.js index 42fb3caf..4accf238 100644 --- a/lib/ace/mode/scheme.js +++ b/lib/ace/mode/scheme.js @@ -42,9 +42,7 @@ var Tokenizer = require("../tokenizer").Tokenizer; var SchemeHighlightRules = require("./scheme_highlight_rules").SchemeHighlightRules; var Mode = function() { - var highlighter = new SchemeHighlightRules(); - - this.$tokenizer = new Tokenizer(highlighter.getRules()); + this.HighlightRules = SchemeHighlightRules; }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/scss.js b/lib/ace/mode/scss.js index 8517ef82..599bdd8d 100644 --- a/lib/ace/mode/scss.js +++ b/lib/ace/mode/scss.js @@ -40,7 +40,7 @@ var CssBehaviour = require("./behaviour/css").CssBehaviour; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { - this.$tokenizer = new Tokenizer(new ScssHighlightRules().getRules()); + this.HighlightRules = ScssHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new CssBehaviour(); this.foldingRules = new CStyleFoldMode(); diff --git a/lib/ace/mode/sh.js b/lib/ace/mode/sh.js index 84496fb3..32c7e75e 100644 --- a/lib/ace/mode/sh.js +++ b/lib/ace/mode/sh.js @@ -38,10 +38,7 @@ var ShHighlightRules = require("./sh_highlight_rules").ShHighlightRules; var Range = require("../range").Range; var Mode = function() { - var highlighter = new ShHighlightRules(); - - this.$tokenizer = new Tokenizer(highlighter.getRules()); - this.$keywordList = highlighter.$keywordList; + this.HighlightRules = ShHighlightRules; }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/snippets.js b/lib/ace/mode/snippets.js index f22efa2d..865e0b3a 100644 --- a/lib/ace/mode/snippets.js +++ b/lib/ace/mode/snippets.js @@ -98,9 +98,8 @@ exports.SnippetGroupHighlightRules = SnippetGroupHighlightRules; var FoldMode = require("./folding/coffee").FoldMode; var Mode = function() { - var highlighter = new SnippetGroupHighlightRules(); + this.HighlightRules = SnippetGroupHighlightRules; this.foldingRules = new FoldMode(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/soy_template.js b/lib/ace/mode/soy_template.js index 381d1493..493c49ce 100644 --- a/lib/ace/mode/soy_template.js +++ b/lib/ace/mode/soy_template.js @@ -47,16 +47,13 @@ var SoyTemplateHighlightRules = require("./soy_template_highlight_rules").SoyTem var Mode = function() { HtmlMode.call(this); - var highlighter = new SoyTemplateHighlightRules(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); - this.$keywordList = highlighter.$keywordList; + this.HighlightRules = SoyTemplateHighlightRules; }; oop.inherits(Mode, HtmlMode); (function() { this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/"}; - // Extra logic goes here. }).call(Mode.prototype); exports.Mode = Mode; diff --git a/lib/ace/mode/sql.js b/lib/ace/mode/sql.js index 6b4d9c6e..d10a4727 100644 --- a/lib/ace/mode/sql.js +++ b/lib/ace/mode/sql.js @@ -38,10 +38,7 @@ var SqlHighlightRules = require("./sql_highlight_rules").SqlHighlightRules; var Range = require("../range").Range; var Mode = function() { - var highlighter = new SqlHighlightRules(); - - this.$tokenizer = new Tokenizer(highlighter.getRules()); - this.$keywordList = highlighter.$keywordList; + this.HighlightRules = SqlHighlightRules; }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/stylus.js b/lib/ace/mode/stylus.js index 065348c6..e33220b5 100644 --- a/lib/ace/mode/stylus.js +++ b/lib/ace/mode/stylus.js @@ -47,16 +47,12 @@ var StylusHighlightRules = require("./stylus_highlight_rules").StylusHighlightRu var FoldMode = require("./folding/coffee").FoldMode; var Mode = function() { - var highlighter = new StylusHighlightRules(); + this.HighlightRules = StylusHighlightRules; this.foldingRules = new FoldMode(); - - this.$tokenizer = new Tokenizer(highlighter.getRules()); - this.$keywordList = highlighter.$keywordList; }; oop.inherits(Mode, TextMode); -(function() { - // Extra logic goes here. +(function() { }).call(Mode.prototype); exports.Mode = Mode; diff --git a/lib/ace/mode/svg.js b/lib/ace/mode/svg.js index 58b250b5..0ca57e10 100644 --- a/lib/ace/mode/svg.js +++ b/lib/ace/mode/svg.js @@ -43,10 +43,8 @@ var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { XmlMode.call(this); - this.highlighter = new SvgHighlightRules(); - this.$tokenizer = new Tokenizer(this.highlighter.getRules()); + this.HighlightRules = SvgHighlightRules; - this.$embeds = this.highlighter.getEmbeds(); this.createModeDelegates({ "js-": JavaScriptMode }); diff --git a/lib/ace/mode/tcl.js b/lib/ace/mode/tcl.js index 2efd0a3b..4dcac180 100644 --- a/lib/ace/mode/tcl.js +++ b/lib/ace/mode/tcl.js @@ -40,7 +40,7 @@ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutd var Range = require("../range").Range; var Mode = function() { - this.$tokenizer = new Tokenizer(new TclHighlightRules().getRules()); + this.HighlightRules = TclHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.foldingRules = new CStyleFoldMode(); }; diff --git a/lib/ace/mode/tex.js b/lib/ace/mode/tex.js index 7d8f859d..3c7f3050 100644 --- a/lib/ace/mode/tex.js +++ b/lib/ace/mode/tex.js @@ -27,9 +27,9 @@ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutd var Mode = function(suppressHighlighting) { if (suppressHighlighting) - this.$tokenizer = new Tokenizer(new TextHighlightRules().getRules()); + this.HighlightRules = TextHighlightRules; else - this.$tokenizer = new Tokenizer(new TexHighlightRules().getRules()); + this.HighlightRules = TexHighlightRules; this.$outdent = new MatchingBraceOutdent(); }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/text.js b/lib/ace/mode/text.js index 4b7312dc..b853c52d 100644 --- a/lib/ace/mode/text.js +++ b/lib/ace/mode/text.js @@ -40,7 +40,7 @@ var TokenIterator = require("../token_iterator").TokenIterator; var Range = require("../range").Range; var Mode = function() { - this.$tokenizer = new Tokenizer(new TextHighlightRules().getRules()); + this.HighlightRules = TextHighlightRules; this.$behaviour = new Behaviour(); }; @@ -61,6 +61,10 @@ var Mode = function() { ); this.getTokenizer = function() { + if (!this.$tokenizer) { + this.$highlightRules = new this.HighlightRules(); + this.$tokenizer = new Tokenizer(this.$highlightRules.getRules()); + } return this.$tokenizer; }; @@ -271,13 +275,12 @@ var Mode = function() { }; this.createModeDelegates = function (mapping) { - if (!this.$embeds) { - return; - } + this.$embeds = []; this.$modes = {}; - for (var i = 0; i < this.$embeds.length; i++) { - if (mapping[this.$embeds[i]]) { - this.$modes[this.$embeds[i]] = new mapping[this.$embeds[i]](); + for (var i in mapping) { + if (mapping[i]) { + this.$embeds.push(i); + this.$modes[i] = new mapping[i](); } } @@ -356,9 +359,15 @@ var Mode = function() { return this.$keywordList; return completionKeywords.concat(this.$keywordList || []); }; + + this.$createKeywordList = function() { + if (!this.$highlightRules) + this.getTokenizer(); + return this.$keywordList = this.$highlightRules.$keywordList || []; + } this.getCompletions = function(state, session, pos, prefix) { - var keywords = this.$keywordList || []; + var keywords = this.$keywordList || this.$createKeywordList(); return keywords.map(function(word) { return { name: word, diff --git a/lib/ace/mode/textile.js b/lib/ace/mode/textile.js index a840d7c1..0c9a86bb 100644 --- a/lib/ace/mode/textile.js +++ b/lib/ace/mode/textile.js @@ -38,7 +38,7 @@ var TextileHighlightRules = require("./textile_highlight_rules").TextileHighligh var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var Mode = function() { - this.$tokenizer = new Tokenizer(new TextileHighlightRules().getRules()); + this.HighlightRules = TextileHighlightRules; this.$outdent = new MatchingBraceOutdent(); }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/toml.js b/lib/ace/mode/toml.js index bd47182f..a5ed1ee3 100644 --- a/lib/ace/mode/toml.js +++ b/lib/ace/mode/toml.js @@ -44,15 +44,13 @@ var TomlHighlightRules = require("./toml_highlight_rules").TomlHighlightRules; var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { - var highlighter = new TomlHighlightRules(); + this.HighlightRules = TomlHighlightRules; this.foldingRules = new FoldMode(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "#"; - // Extra logic goes here. }).call(Mode.prototype); exports.Mode = Mode; diff --git a/lib/ace/mode/twig.js b/lib/ace/mode/twig.js index 4808091e..fc314394 100644 --- a/lib/ace/mode/twig.js +++ b/lib/ace/mode/twig.js @@ -42,12 +42,10 @@ var HtmlFoldMode = require("./folding/html").FoldMode; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var Mode = function() { - var highlighter = new TwigHighlightRules(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); + this.HighlightRules = TwigHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new HtmlBehaviour(); - this.$embeds = highlighter.getEmbeds(); this.createModeDelegates({ "js-": JavaScriptMode, "css-": CssMode diff --git a/lib/ace/mode/typescript.js b/lib/ace/mode/typescript.js index a4978e10..32d24c31 100644 --- a/lib/ace/mode/typescript.js +++ b/lib/ace/mode/typescript.js @@ -44,9 +44,8 @@ var CStyleFoldMode = require("./folding/cstyle").FoldMode; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var Mode = function() { - var highlighter = new TypeScriptHighlightRules(); + this.HighlightRules = TypeScriptHighlightRules; - this.$tokenizer = new Tokenizer(highlighter.getRules()); this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new CstyleBehaviour(); this.foldingRules = new CStyleFoldMode(); diff --git a/lib/ace/mode/vbscript.js b/lib/ace/mode/vbscript.js index 79489139..8060445d 100644 --- a/lib/ace/mode/vbscript.js +++ b/lib/ace/mode/vbscript.js @@ -46,9 +46,7 @@ var Tokenizer = require("../tokenizer").Tokenizer; var VBScriptHighlightRules = require("./vbscript_highlight_rules").VBScriptHighlightRules; var Mode = function() { - var highlighter = new VBScriptHighlightRules(); - - this.$tokenizer = new Tokenizer(highlighter.getRules()); + this.HighlightRules = VBScriptHighlightRules; }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/velocity.js b/lib/ace/mode/velocity.js index c67594d2..c76859f5 100644 --- a/lib/ace/mode/velocity.js +++ b/lib/ace/mode/velocity.js @@ -44,16 +44,15 @@ var FoldMode = require("./folding/velocity").FoldMode; var HtmlBehaviour = require("./behaviour/html").HtmlBehaviour; var Mode = function() { - var highlighter = new VelocityHighlightRules(); + this.HighlightRules = VelocityHighlightRules; this.foldingRules = new FoldMode(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); this.$behaviour = new HtmlBehaviour(); }; oop.inherits(Mode, TextMode); (function() { - this.lineCommentStart = "##"; - this.blockComment = {start: "#*", end: "*#"}; + this.lineCommentStart = "##"; + this.blockComment = {start: "#*", end: "*#"}; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/lib/ace/mode/verilog.js b/lib/ace/mode/verilog.js index a1aa3c40..67e9049e 100644 --- a/lib/ace/mode/verilog.js +++ b/lib/ace/mode/verilog.js @@ -38,7 +38,7 @@ var VerilogHighlightRules = require("./verilog_highlight_rules").VerilogHighligh var Range = require("../range").Range; var Mode = function() { - this.$tokenizer = new Tokenizer(new VerilogHighlightRules().getRules()); + this.HighlightRules = VerilogHighlightRules; }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/xml.js b/lib/ace/mode/xml.js index 24feef0c..c6e18fc6 100644 --- a/lib/ace/mode/xml.js +++ b/lib/ace/mode/xml.js @@ -39,7 +39,7 @@ var XmlBehaviour = require("./behaviour/xml").XmlBehaviour; var XmlFoldMode = require("./folding/xml").FoldMode; var Mode = function() { - this.$tokenizer = new Tokenizer(new XmlHighlightRules().getRules()); + this.HighlightRules = XmlHighlightRules; this.$behaviour = new XmlBehaviour(); this.foldingRules = new XmlFoldMode(); }; diff --git a/lib/ace/mode/yaml.js b/lib/ace/mode/yaml.js index 2035e390..ec0628ae 100644 --- a/lib/ace/mode/yaml.js +++ b/lib/ace/mode/yaml.js @@ -39,7 +39,7 @@ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutd var FoldMode = require("./folding/coffee").FoldMode; var Mode = function() { - this.$tokenizer = new Tokenizer(new YamlHighlightRules().getRules()); + this.HighlightRules = YamlHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.foldingRules = new FoldMode(); }; From b4628d450fd39083902af27dc9d5bb0250a0c116 Mon Sep 17 00:00:00 2001 From: nightwing Date: Mon, 9 Sep 2013 18:57:28 +0400 Subject: [PATCH 09/13] use lazy getTokenizer in getNextLineIndent --- lib/ace/mode/c_cpp.js | 2 +- lib/ace/mode/clojure.js | 2 +- lib/ace/mode/coffee.js | 2 +- lib/ace/mode/csharp.js | 2 +- lib/ace/mode/css.js | 2 +- lib/ace/mode/dot.js | 2 +- lib/ace/mode/golang.js | 2 +- lib/ace/mode/haxe.js | 2 +- lib/ace/mode/javascript.js | 2 +- lib/ace/mode/jsx.js | 2 +- lib/ace/mode/less.js | 2 +- lib/ace/mode/liquid.js | 2 +- lib/ace/mode/logiql.js | 2 +- lib/ace/mode/lsl.js | 2 +- lib/ace/mode/lua.js | 6 +++--- lib/ace/mode/mushcode.js | 4 ++-- lib/ace/mode/ocaml.js | 2 +- lib/ace/mode/perl.js | 2 +- lib/ace/mode/php.js | 2 +- lib/ace/mode/powershell.js | 2 +- lib/ace/mode/python.js | 4 ++-- lib/ace/mode/ruby.js | 2 +- lib/ace/mode/scad.js | 2 +- lib/ace/mode/scss.js | 2 +- lib/ace/mode/sh.js | 4 ++-- lib/ace/mode/tcl.js | 2 +- lib/ace/mode/twig.js | 2 +- 27 files changed, 32 insertions(+), 32 deletions(-) diff --git a/lib/ace/mode/c_cpp.js b/lib/ace/mode/c_cpp.js index cb62292f..08ccf0bb 100644 --- a/lib/ace/mode/c_cpp.js +++ b/lib/ace/mode/c_cpp.js @@ -58,7 +58,7 @@ oop.inherits(Mode, TextMode); this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); - var tokenizedLine = this.$tokenizer.getLineTokens(line, state); + var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; var endState = tokenizedLine.state; diff --git a/lib/ace/mode/clojure.js b/lib/ace/mode/clojure.js index 38a6c4f1..71f842e7 100644 --- a/lib/ace/mode/clojure.js +++ b/lib/ace/mode/clojure.js @@ -51,7 +51,7 @@ oop.inherits(Mode, TextMode); this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); - var tokenizedLine = this.$tokenizer.getLineTokens(line, state); + var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; if (tokens.length && tokens[tokens.length-1].type == "comment") { diff --git a/lib/ace/mode/coffee.js b/lib/ace/mode/coffee.js index 02b018bd..72ed0960 100644 --- a/lib/ace/mode/coffee.js +++ b/lib/ace/mode/coffee.js @@ -57,7 +57,7 @@ oop.inherits(Mode, TextMode); this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); - var tokens = this.$tokenizer.getLineTokens(line, state).tokens; + var tokens = this.getTokenizer().getLineTokens(line, state).tokens; if (!(tokens.length && tokens[tokens.length - 1].type === 'comment') && state === 'start' && indenter.test(line)) diff --git a/lib/ace/mode/csharp.js b/lib/ace/mode/csharp.js index 94629f3d..a6911c6f 100644 --- a/lib/ace/mode/csharp.js +++ b/lib/ace/mode/csharp.js @@ -25,7 +25,7 @@ oop.inherits(Mode, TextMode); this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); - var tokenizedLine = this.$tokenizer.getLineTokens(line, state); + var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; if (tokens.length && tokens[tokens.length-1].type == "comment") { diff --git a/lib/ace/mode/css.js b/lib/ace/mode/css.js index 0ee16e75..9a4234c6 100644 --- a/lib/ace/mode/css.js +++ b/lib/ace/mode/css.js @@ -57,7 +57,7 @@ oop.inherits(Mode, TextMode); var indent = this.$getIndent(line); // ignore braces in comments - var tokens = this.$tokenizer.getLineTokens(line, state).tokens; + var tokens = this.getTokenizer().getLineTokens(line, state).tokens; if (tokens.length && tokens[tokens.length-1].type == "comment") { return indent; } diff --git a/lib/ace/mode/dot.js b/lib/ace/mode/dot.js index 0f443b10..116b2d27 100644 --- a/lib/ace/mode/dot.js +++ b/lib/ace/mode/dot.js @@ -23,7 +23,7 @@ oop.inherits(Mode, TextMode); this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); - var tokenizedLine = this.$tokenizer.getLineTokens(line, state); + var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; var endState = tokenizedLine.state; diff --git a/lib/ace/mode/golang.js b/lib/ace/mode/golang.js index c5d1ace0..62b68755 100644 --- a/lib/ace/mode/golang.js +++ b/lib/ace/mode/golang.js @@ -23,7 +23,7 @@ oop.inherits(Mode, TextMode); this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); - var tokenizedLine = this.$tokenizer.getLineTokens(line, state); + var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; var endState = tokenizedLine.state; diff --git a/lib/ace/mode/haxe.js b/lib/ace/mode/haxe.js index 2ae10d0e..138df420 100644 --- a/lib/ace/mode/haxe.js +++ b/lib/ace/mode/haxe.js @@ -25,7 +25,7 @@ oop.inherits(Mode, TextMode); this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); - var tokenizedLine = this.$tokenizer.getLineTokens(line, state); + var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; if (tokens.length && tokens[tokens.length-1].type == "comment") { diff --git a/lib/ace/mode/javascript.js b/lib/ace/mode/javascript.js index c0e7ae3d..7bfce443 100644 --- a/lib/ace/mode/javascript.js +++ b/lib/ace/mode/javascript.js @@ -58,7 +58,7 @@ oop.inherits(Mode, TextMode); this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); - var tokenizedLine = this.$tokenizer.getLineTokens(line, state); + var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; var endState = tokenizedLine.state; diff --git a/lib/ace/mode/jsx.js b/lib/ace/mode/jsx.js index 2131b23f..999a9777 100644 --- a/lib/ace/mode/jsx.js +++ b/lib/ace/mode/jsx.js @@ -25,7 +25,7 @@ oop.inherits(Mode, TextMode); this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); - var tokenizedLine = this.$tokenizer.getLineTokens(line, state); + var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; if (tokens.length && tokens[tokens.length-1].type == "comment") { diff --git a/lib/ace/mode/less.js b/lib/ace/mode/less.js index bde7a18e..ac40a0a6 100644 --- a/lib/ace/mode/less.js +++ b/lib/ace/mode/less.js @@ -56,7 +56,7 @@ oop.inherits(Mode, TextMode); var indent = this.$getIndent(line); // ignore braces in comments - var tokens = this.$tokenizer.getLineTokens(line, state).tokens; + var tokens = this.getTokenizer().getLineTokens(line, state).tokens; if (tokens.length && tokens[tokens.length-1].type == "comment") { return indent; } diff --git a/lib/ace/mode/liquid.js b/lib/ace/mode/liquid.js index 41322d27..490be895 100644 --- a/lib/ace/mode/liquid.js +++ b/lib/ace/mode/liquid.js @@ -50,7 +50,7 @@ oop.inherits(Mode, TextMode); this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); - var tokenizedLine = this.$tokenizer.getLineTokens(line, state); + var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; var endState = tokenizedLine.state; diff --git a/lib/ace/mode/logiql.js b/lib/ace/mode/logiql.js index 2fdaf5b3..5abf7c83 100644 --- a/lib/ace/mode/logiql.js +++ b/lib/ace/mode/logiql.js @@ -56,7 +56,7 @@ oop.inherits(Mode, TextMode); this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); - var tokenizedLine = this.$tokenizer.getLineTokens(line, state); + var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; var endState = tokenizedLine.state; if (/comment|string/.test(endState)) diff --git a/lib/ace/mode/lsl.js b/lib/ace/mode/lsl.js index b2dcb991..49ecd534 100644 --- a/lib/ace/mode/lsl.js +++ b/lib/ace/mode/lsl.js @@ -60,7 +60,7 @@ oop.inherits(Mode, TextMode); this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); - var tokenizedLine = this.$tokenizer.getLineTokens(line, state); + var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; var endState = tokenizedLine.state; diff --git a/lib/ace/mode/lua.js b/lib/ace/mode/lua.js index 3beae941..92468242 100644 --- a/lib/ace/mode/lua.js +++ b/lib/ace/mode/lua.js @@ -99,7 +99,7 @@ oop.inherits(Mode, TextMode); var indent = this.$getIndent(line); var level = 0; - var tokenizedLine = this.$tokenizer.getLineTokens(line, state); + var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; if (state == "start") { @@ -123,7 +123,7 @@ oop.inherits(Mode, TextMode); if (line.match(/^\s*[\)\}\]]$/)) return true; - var tokens = this.$tokenizer.getLineTokens(line.trim(), state).tokens; + var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens; if (!tokens || !tokens.length) return false; @@ -134,7 +134,7 @@ oop.inherits(Mode, TextMode); this.autoOutdent = function(state, session, row) { var prevLine = session.getLine(row - 1); var prevIndent = this.$getIndent(prevLine).length; - var prevTokens = this.$tokenizer.getLineTokens(prevLine, "start").tokens; + var prevTokens = this.getTokenizer().getLineTokens(prevLine, "start").tokens; var tabLength = session.getTabString().length; var expectedIndent = prevIndent + tabLength * getNetIndentLevel(prevTokens); var curIndent = this.$getIndent(session.getLine(row)).length; diff --git a/lib/ace/mode/mushcode.js b/lib/ace/mode/mushcode.js index 1a30717b..bdaeeb4e 100644 --- a/lib/ace/mode/mushcode.js +++ b/lib/ace/mode/mushcode.js @@ -51,7 +51,7 @@ oop.inherits(Mode, TextMode); this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); - var tokenizedLine = this.$tokenizer.getLineTokens(line, state); + var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; if (tokens.length && tokens[tokens.length-1].type == "comment") { @@ -80,7 +80,7 @@ oop.inherits(Mode, TextMode); if (input !== "\r\n" && input !== "\r" && input !== "\n") return false; - var tokens = this.$tokenizer.getLineTokens(line.trim(), state).tokens; + var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens; if (!tokens) return false; diff --git a/lib/ace/mode/ocaml.js b/lib/ace/mode/ocaml.js index ae369625..1f69977a 100644 --- a/lib/ace/mode/ocaml.js +++ b/lib/ace/mode/ocaml.js @@ -74,7 +74,7 @@ var indenter = /(?:[({[=:]|[-=]>|\b(?:else|try|with))\s*$/; this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); - var tokens = this.$tokenizer.getLineTokens(line, state).tokens; + var tokens = this.getTokenizer().getLineTokens(line, state).tokens; if (!(tokens.length && tokens[tokens.length - 1].type === 'comment') && state === 'start' && indenter.test(line)) diff --git a/lib/ace/mode/perl.js b/lib/ace/mode/perl.js index 4a48a52e..e8d930bc 100644 --- a/lib/ace/mode/perl.js +++ b/lib/ace/mode/perl.js @@ -59,7 +59,7 @@ oop.inherits(Mode, TextMode); this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); - var tokenizedLine = this.$tokenizer.getLineTokens(line, state); + var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; if (tokens.length && tokens[tokens.length-1].type == "comment") { diff --git a/lib/ace/mode/php.js b/lib/ace/mode/php.js index 6b770a9e..18aecb66 100644 --- a/lib/ace/mode/php.js +++ b/lib/ace/mode/php.js @@ -76,7 +76,7 @@ oop.inherits(Mode, TextMode); this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); - var tokenizedLine = this.$tokenizer.getLineTokens(line, state); + var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; var endState = tokenizedLine.state; diff --git a/lib/ace/mode/powershell.js b/lib/ace/mode/powershell.js index 7dc778aa..8cc55684 100644 --- a/lib/ace/mode/powershell.js +++ b/lib/ace/mode/powershell.js @@ -25,7 +25,7 @@ oop.inherits(Mode, TextMode); this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); - var tokenizedLine = this.$tokenizer.getLineTokens(line, state); + var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; if (tokens.length && tokens[tokens.length-1].type == "comment") { diff --git a/lib/ace/mode/python.js b/lib/ace/mode/python.js index bcd22920..d561c084 100644 --- a/lib/ace/mode/python.js +++ b/lib/ace/mode/python.js @@ -51,7 +51,7 @@ oop.inherits(Mode, TextMode); this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); - var tokenizedLine = this.$tokenizer.getLineTokens(line, state); + var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; if (tokens.length && tokens[tokens.length-1].type == "comment") { @@ -80,7 +80,7 @@ oop.inherits(Mode, TextMode); if (input !== "\r\n" && input !== "\r" && input !== "\n") return false; - var tokens = this.$tokenizer.getLineTokens(line.trim(), state).tokens; + var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens; if (!tokens) return false; diff --git a/lib/ace/mode/ruby.js b/lib/ace/mode/ruby.js index adb3c96a..7d14bb57 100644 --- a/lib/ace/mode/ruby.js +++ b/lib/ace/mode/ruby.js @@ -54,7 +54,7 @@ oop.inherits(Mode, TextMode); this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); - var tokenizedLine = this.$tokenizer.getLineTokens(line, state); + var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; if (tokens.length && tokens[tokens.length-1].type == "comment") { diff --git a/lib/ace/mode/scad.js b/lib/ace/mode/scad.js index 3860f5af..ca8dc959 100644 --- a/lib/ace/mode/scad.js +++ b/lib/ace/mode/scad.js @@ -56,7 +56,7 @@ oop.inherits(Mode, TextMode); this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); - var tokenizedLine = this.$tokenizer.getLineTokens(line, state); + var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; var endState = tokenizedLine.state; diff --git a/lib/ace/mode/scss.js b/lib/ace/mode/scss.js index 599bdd8d..111f71aa 100644 --- a/lib/ace/mode/scss.js +++ b/lib/ace/mode/scss.js @@ -56,7 +56,7 @@ oop.inherits(Mode, TextMode); var indent = this.$getIndent(line); // ignore braces in comments - var tokens = this.$tokenizer.getLineTokens(line, state).tokens; + var tokens = this.getTokenizer().getLineTokens(line, state).tokens; if (tokens.length && tokens[tokens.length-1].type == "comment") { return indent; } diff --git a/lib/ace/mode/sh.js b/lib/ace/mode/sh.js index 32c7e75e..c66c2619 100644 --- a/lib/ace/mode/sh.js +++ b/lib/ace/mode/sh.js @@ -50,7 +50,7 @@ oop.inherits(Mode, TextMode); this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); - var tokenizedLine = this.$tokenizer.getLineTokens(line, state); + var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; if (tokens.length && tokens[tokens.length-1].type == "comment") { @@ -79,7 +79,7 @@ oop.inherits(Mode, TextMode); if (input !== "\r\n" && input !== "\r" && input !== "\n") return false; - var tokens = this.$tokenizer.getLineTokens(line.trim(), state).tokens; + var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens; if (!tokens) return false; diff --git a/lib/ace/mode/tcl.js b/lib/ace/mode/tcl.js index 4dcac180..c8e7c436 100644 --- a/lib/ace/mode/tcl.js +++ b/lib/ace/mode/tcl.js @@ -53,7 +53,7 @@ oop.inherits(Mode, TextMode); this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); - var tokenizedLine = this.$tokenizer.getLineTokens(line, state); + var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; if (tokens.length && tokens[tokens.length-1].type == "comment") { diff --git a/lib/ace/mode/twig.js b/lib/ace/mode/twig.js index fc314394..06e4faa1 100644 --- a/lib/ace/mode/twig.js +++ b/lib/ace/mode/twig.js @@ -61,7 +61,7 @@ oop.inherits(Mode, TextMode); this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); - var tokenizedLine = this.$tokenizer.getLineTokens(line, state); + var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; var endState = tokenizedLine.state; From e52a4250fe7918d47b36c22ebf827500e14c69ab Mon Sep 17 00:00:00 2001 From: nightwing Date: Tue, 10 Sep 2013 08:45:31 +0400 Subject: [PATCH 10/13] fix html demo --- demo/kitchen-sink/docs/html.htm | 1 - lib/ace/ext/modelist.js | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) delete mode 100644 demo/kitchen-sink/docs/html.htm diff --git a/demo/kitchen-sink/docs/html.htm b/demo/kitchen-sink/docs/html.htm deleted file mode 100644 index 30404ce4..00000000 --- a/demo/kitchen-sink/docs/html.htm +++ /dev/null @@ -1 +0,0 @@ -TODO \ No newline at end of file diff --git a/lib/ace/ext/modelist.js b/lib/ace/ext/modelist.js index df3d75af..163ed6b7 100644 --- a/lib/ace/ext/modelist.js +++ b/lib/ace/ext/modelist.js @@ -73,12 +73,12 @@ var supportedModes = { Handlebars: ["hbs|handlebars|tpl|mustache"], Haskell: ["hs"], haXe: ["hx"], - HTML: ["htm|html|xhtml"], + HTML: ["html|htm|xhtml"], HTML_Ruby: ["erb|rhtml|html.erb"], INI: ["ini|conf|cfg|prefs"], Jade: ["jade"], Java: ["java"], - JavaScript: ["js"], + JavaScript: ["js|jsm"], JSON: ["json"], JSONiq: ["jq"], JSP: ["jsp"], From 2efe7f203e6dc8237d38b62fa39171429c72bd56 Mon Sep 17 00:00:00 2001 From: nightwing Date: Wed, 11 Sep 2013 23:28:42 +0400 Subject: [PATCH 11/13] fix #1598 Pipe '|' symbol breaks YAML Syntax highlighting --- lib/ace/mode/yaml_highlight_rules.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ace/mode/yaml_highlight_rules.js b/lib/ace/mode/yaml_highlight_rules.js index ccf3ad8c..cf946577 100644 --- a/lib/ace/mode/yaml_highlight_rules.js +++ b/lib/ace/mode/yaml_highlight_rules.js @@ -72,7 +72,7 @@ var YamlHighlightRules = function() { regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' }, { token : "string", // multi line string start - regex : '[\\|>]\\w*', + regex : '[|>][-+\\d\\s]*$', next : "qqstring" }, { token : "string", // single quoted string From 80b8f557f03d728516377c7b4a2f0d35fc179840 Mon Sep 17 00:00:00 2001 From: nightwing Date: Thu, 19 Sep 2013 00:17:12 +0400 Subject: [PATCH 12/13] update mode docs --- index.html | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/index.html b/index.html index 9158c7ce..19b5e4f7 100644 --- a/index.html +++ b/index.html @@ -330,11 +330,9 @@ var MyNewFoldMode = require("./folding/mynew").MyNewFoldMode; var Mode = function() { // set everything up - var highlighter = new MyNewHighlightRules(); + this.HighlightRules = MyNewHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.foldingRules = new MyNewFoldMode(); - - this.$tokenizer = new Tokenizer(highlighter.getRules()); }; oop.inherits(Mode, TextMode); @@ -343,9 +341,8 @@ oop.inherits(Mode, TextMode); this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/"}; - // Extra logic goes here--we won't be covering all of this - - /* These are all optional pieces of code! + // special logic for indent/outdent. + // By default ace keeps indentation of previous line this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); return indent; @@ -358,14 +355,17 @@ oop.inherits(Mode, TextMode); this.autoOutdent = function(state, doc, row) { this.$outdent.autoOutdent(doc, row); }; - + + // create worker for live syntax checking this.createWorker = function(session) { var worker = new WorkerClient(["ace"], "ace/mode/mynew_worker", "NewWorker"); worker.attachToDocument(session.getDocument()); - + worker.on("errors", function(e) { + session.setAnnotations(e.data); + }); return worker; }; - */ + }).call(Mode.prototype); exports.Mode = Mode; @@ -499,7 +499,7 @@ var fonts = lang.arrayToMap(
  • Run npm install to install required dependencies.
  • Run node tmlanguage.js <path_to_tmlanguage_file>; for example, node <path_to_tmlanguage_file> /Users/Elrond/elven.tmLanguage
  • -

    Two files are created and placed in lib/ace/mode: one for the language mode, and one for the set of highlight rules. You will still need to add the code into kitchen_sink.html and demo.js, as well as write any tests for the highlighting.

    +

    Two files are created and placed in lib/ace/mode: one for the language mode, and one for the set of highlight rules. You will still need to add the code into ace/ext/modelist.js, and add a sample file for testing.

    A Note on Accuracy

    Your .tmlanguage 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:

      @@ -642,25 +642,15 @@ if (match) { }

      Testing Your Highlighter

      The best way to test your tokenizer is to see it live, right? To do that, you'll want to modify the live Ace demo to preview your changes. You can find this file in the root Ace directory with the name kitchen-sink.html.

      -

      The file that defines the behavior for this live demo is defined in demo/kitchen-sink/demo.js. You'll want to add lines to two separate objects:

      1. -

        modesByName needs a new entry that defines all the rules regarding your new mode. Entries looks like propertyName: [dropdownName, arrayOfExtensions], where:

        -
          -
        • propertyName is the name of the new language you're highlighting
        • -
        • dropdownName is an arbitrary string that lists your language in the live demo's Mode dropdown menu
        • -
        • arrayOfExtensions is an array of strings (seperated by |) that defines valid extensions to use for the new language.
        • -
        + add an entry to supportedModes in ace/ext/modelist.js
      2. -

        docs also needs a new entry, which defines the location of your sample document showing all the power of your new language. Entries look like filenamePath: modeToUse, where:

        -
          -
        • filenamePath is the path to your example document. This should just be in docs/.
        • -
        • modeToUse is the same arbitrary string as dropdownName
        • -
        +

        add a sample file to demo/kitchen-sink/docs/ with same name as the mode file

      -

      Once you set this up, you should see be able to witness a live demonstration of your new highlighter.

      +

      Once you set this up, you should be able to witness a live demonstration of your new highlighter.

      Adding Automated Tests

      Adding automated tests for a highlighter is trivial so you are not required to do it, but it can help during development.

      In lib/ace/mode/_test create a file named

      text_<modeName>.txt
      with some example code. (You can skip this if the document you have added in demo/docs both looks good and covers various edge cases in your language syntax). From 7d2795bc770727b9a34881ebbaf9207be0b57441 Mon Sep 17 00:00:00 2001 From: nightwing Date: Thu, 19 Sep 2013 11:00:10 +0400 Subject: [PATCH 13/13] update mode.tmpl.js --- tool/mode.tmpl.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tool/mode.tmpl.js b/tool/mode.tmpl.js index bdf8065e..c2597ebb 100644 --- a/tool/mode.tmpl.js +++ b/tool/mode.tmpl.js @@ -48,10 +48,8 @@ var %language%HighlightRules = require("./%languageHighlightFilename%_highlight_ var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { - var highlighter = new %language%HighlightRules(); + this.HighlightRules = new %language%HighlightRules(); this.foldingRules = new FoldMode(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); - this.$keywordList = highlighter.$keywordList; }; oop.inherits(Mode, TextMode);