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