From 91884280e221826b50431078972d4c460727947d Mon Sep 17 00:00:00 2001 From: DanyaPostfactum Date: Mon, 24 Jun 2013 18:41:57 +1000 Subject: [PATCH 01/14] More stuff for twig sample --- demo/kitchen-sink/docs/html.html | 1 + demo/kitchen-sink/docs/twig.twig | 35 +++++++++++++++++++++++++------- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/demo/kitchen-sink/docs/html.html b/demo/kitchen-sink/docs/html.html index a3a566ff..81398bef 100644 --- a/demo/kitchen-sink/docs/html.html +++ b/demo/kitchen-sink/docs/html.html @@ -1,3 +1,4 @@ + diff --git a/demo/kitchen-sink/docs/twig.twig b/demo/kitchen-sink/docs/twig.twig index 120f33e9..02214f09 100644 --- a/demo/kitchen-sink/docs/twig.twig +++ b/demo/kitchen-sink/docs/twig.twig @@ -1,9 +1,30 @@ -{% autoescape true %} - {{ var }} - {{ var|raw }} {# var won't be escaped #} - {{ var|escape }} {# var won't be doubled-escaped #} -{% endautoescape %} + + + + My Webpage + + + -{{ include('twig.html', sandboxed = true) }} + {% if 1 not in [1, 2, 3] %} -{{"string #{with} \" escapes" 'another#one' }} \ No newline at end of file + {# is equivalent to #} + {% if not (1 in [1, 2, 3]) %} + + {% autoescape true %} + {{ var }} + {{ var|raw }} {# var won't be escaped #} + {{ var|escape }} {# var won't be doubled-escaped #} + {% endautoescape %} + + {{ include('twig.html', sandboxed = true) }} + + {{"string #{with} \" escapes" 'another#one' }} +

My Webpage

+ {{ a_variable }} + + \ No newline at end of file From 5a1948a695cdc6e3e05afa8fc892b296f6c7c9d9 Mon Sep 17 00:00:00 2001 From: DanyaPostfactum Date: Mon, 24 Jun 2013 18:42:40 +1000 Subject: [PATCH 02/14] Fix FreeMarker in ext/modelist --- lib/ace/ext/modelist.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/ace/ext/modelist.js b/lib/ace/ext/modelist.js index ef8cc7d3..2cc550bb 100644 --- a/lib/ace/ext/modelist.js +++ b/lib/ace/ext/modelist.js @@ -65,7 +65,7 @@ var supportedModes = { Erlang: ["erl|hrl"], EJS: ["ejs"], Forth: ["frt|fs|ldr"], - FreeMarker: ["ftl"], + FTL: ["ftl"], Glsl: ["glsl|frag|vert"], golang: ["go"], Groovy: ["groovy"], @@ -143,7 +143,8 @@ var nameOverrides = { golang: "Go", C_Cpp: "C/C++", coffee: "CoffeeScript", - HTML_Ruby: "HTML (Ruby)" + HTML_Ruby: "HTML (Ruby)", + FTL: "FreeMarker" }; var modesByName = {}; for (var name in supportedModes) { From 5f2ee8b32bf1e60a60d9e43da00cc48d7a3ef13b Mon Sep 17 00:00:00 2001 From: DanyaPostfactum Date: Mon, 24 Jun 2013 18:53:09 +1000 Subject: [PATCH 03/14] Prevent double prefixing of "included" rules --- lib/ace/mode/text_highlight_rules.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/ace/mode/text_highlight_rules.js b/lib/ace/mode/text_highlight_rules.js index d6dbd794..b63f6c08 100644 --- a/lib/ace/mode/text_highlight_rules.js +++ b/lib/ace/mode/text_highlight_rules.js @@ -56,10 +56,13 @@ var TextHighlightRules = function() { for (var i = 0; i < state.length; i++) { var rule = state[i]; if (rule.next) { - if (typeof rule.next != "string") - rule.nextState = prefix + rule.nextState; - else - rule.next = prefix + rule.next; + if (typeof rule.next != "string") { + if (rule.nextState && rule.nextState.indexOf(prefix) !== 0) + rule.nextState = prefix + rule.nextState; + } else { + if (rule.next.indexOf(prefix) !== 0) + rule.next = prefix + rule.next; + } } } From ed223cb7fdf7c7baa323013a0ac68e6d77faa153 Mon Sep 17 00:00:00 2001 From: DanyaPostfactum Date: Mon, 24 Jun 2013 18:55:07 +1000 Subject: [PATCH 04/14] Rewrite xml rules. --- lib/ace/mode/behaviour/xml.js | 18 ++- lib/ace/mode/folding/xml.js | 6 +- lib/ace/mode/xml_highlight_rules.js | 179 +++++++++++++++++++++++++--- 3 files changed, 173 insertions(+), 30 deletions(-) diff --git a/lib/ace/mode/behaviour/xml.js b/lib/ace/mode/behaviour/xml.js index 0d03b763..1ee39f39 100644 --- a/lib/ace/mode/behaviour/xml.js +++ b/lib/ace/mode/behaviour/xml.js @@ -37,14 +37,9 @@ var CstyleBehaviour = require("./cstyle").CstyleBehaviour; var TokenIterator = require("../../token_iterator").TokenIterator; function hasType(token, type) { - var hasType = true; - var typeList = token.type.split('.'); - var needleList = type.split('.'); - needleList.forEach(function(needle){ - if (typeList.indexOf(needle) == -1) { - hasType = false; - return false; - } + var tokenTypes = token.type.split('.'); + return type.split('.').every(function(type){ + return (tokenTypes.indexOf(type) !== -1); }); return hasType; } @@ -58,6 +53,9 @@ var XmlBehaviour = function () { var position = editor.getCursorPosition(); var iterator = new TokenIterator(session, position.row, position.column); var token = iterator.getCurrentToken(); + + if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column) + return; var atCursor = false; if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ do { @@ -66,8 +64,8 @@ var XmlBehaviour = function () { } else { atCursor = true; } - if (!token || !hasType(token, 'meta.tag-name') || iterator.stepBackward().value.match('/')) { - return + if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) { + return; } var tag = token.value; if (atCursor){ diff --git a/lib/ace/mode/folding/xml.js b/lib/ace/mode/folding/xml.js index 63842e93..61d103f1 100644 --- a/lib/ace/mode/folding/xml.js +++ b/lib/ace/mode/folding/xml.js @@ -68,7 +68,7 @@ oop.inherits(FoldMode, BaseFoldMode); var value = ""; for (var i = 0; i < tokens.length; i++) { var token = tokens[i]; - if (token.type.indexOf("meta.tag") === 0) + if (token.type.indexOf("meta.tag") !== -1) value += token.value; else value += lang.stringRepeat(" ", token.value.length); @@ -105,7 +105,7 @@ oop.inherits(FoldMode, BaseFoldMode); var start; do { - if (token.type.indexOf("meta.tag") === 0) { + if (token.type.indexOf("meta.tag") !== -1) { if (!start) { var start = { row: iterator.getCurrentTokenRow(), @@ -138,7 +138,7 @@ oop.inherits(FoldMode, BaseFoldMode); var end; do { - if (token.type.indexOf("meta.tag") === 0) { + if (token.type.indexOf("meta.tag") !== -1) { if (!end) { end = { row: iterator.getCurrentTokenRow(), diff --git a/lib/ace/mode/xml_highlight_rules.js b/lib/ace/mode/xml_highlight_rules.js index 02003b3d..0589ee52 100644 --- a/lib/ace/mode/xml_highlight_rules.js +++ b/lib/ace/mode/xml_highlight_rules.js @@ -35,36 +35,181 @@ var oop = require("../lib/oop"); var xmlUtil = require("./xml_util"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var XmlHighlightRules = function() { +var XmlHighlightRules = function(normalize) { this.$rules = { start : [ - {token : "text", regex : "<\\!\\[CDATA\\[", next : "cdata"}, - {token : "xml-pe", regex : "<\\?.*?\\?>"}, - {token : "comment", regex : "<\\!--", next : "comment"}, - {token : "xml-pe", regex : "<\\!.*?>"}, - {token : "meta.tag", regex : "<\\/?", next : "tag"}, - {token : "text", regex : "\\s+"}, + {token : "punctuation.string.begin", regex : "<\\!\\[CDATA\\[", next : "cdata"}, { - token : "constant.character.entity", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - } + token : ["punctuation.instruction.begin", "keyword.instruction"], + regex : "(<\\?)(xml)(?=[\\s])", next : "xml_declaration" + }, + { + token : ["punctuation.instruction.begin", "keyword.instruction"], + regex : "(<\\?)([-_a-zA-Z0-9]+)", next : "instruction" + }, + {token : "comment", regex : "<\\!--", next : "comment"}, + { + token : ["punctuation.doctype.begin", "keyword.doctype"], + regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype" + }, + {include : "tag"}, + {include : "reference"} ], - + + xml_declaration : [ + {include : "attributes"}, + {include : "instruction"} + ], + + instruction : [ + {token : "punctuation.instruction.end", regex : "\\?>", next : "start"} + ], + + doctype : [ + {include : "space"}, + {include : "string"}, + {token : "punctuation.doctype.end", regex : ">", next : "start"}, + {token : "text", regex : "[-_a-zA-Z0-9:]+"}, + {token : "punctuation.begin", regex : "\\[", push : "declarations"} + ], + + declarations : [{ + token : "text", + regex : "\\s+" + }, { + token: "punctuation.end", + regex: "]", + next: "pop" + }, { + token : ["punctuation.begin", "keyword"], + regex : "(<\\!)([-_a-zA-Z0-9]+)", + push : [{ + token : "text", + regex : "\\s+" + }, + { + token : "punctuation.end", + regex : ">", + next : "pop" + }, + {include : "string"}] + }], + cdata : [ - {token : "text", regex : "\\]\\]>", next : "start"}, + {token : "string.end", regex : "\\]\\]>", next : "start"}, {token : "text", regex : "\\s+"}, {token : "text", regex : "(?:[^\\]]|\\](?!\\]>))+"} ], comment : [ - {token : "comment", regex : ".*?-->", next : "start"}, - {token : "comment", regex : ".+"} - ] + {token : "comment", regex : "-->", next : "start"}, + {defaultToken : "comment"} + ], + + tag : [{ + token : ["punctuation.meta.tag.begin", "meta.tag.name"], + regex : "(<)((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)", + next: [ + {include : "attributes"}, + {token : "punctuation.meta.tag.end", regex : "/?>", next : "start"} + ] + }, { + token : ["punctuation.meta.tag.begin", "meta.tag.name"], + regex : "(", next : "start"} + ] + }], + + space : [ + {token : "text", regex : "\\s+"} + ], + + reference : [{ + token : "constant.language.escape", + regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" + }, { + token : "invalid.illegal", regex : "&" + }], + + string: [{ + token : "string", + regex : "'", + push : "string_inner" + }, { + token : "string", + regex : '"', + push : "qqstring_inner" + }], + + qstring_inner: [ + {token : "string", regex: "'", next: "pop"}, + {include : "reference"}, + {defaultToken : "string"} + ], + + qqstring_inner: [ + {token : "string", regex: '"', next: "pop"}, + {include : "reference"}, + {defaultToken : "string"} + ], + + attributes: [{ + token : "entity.other.attribute-name", + regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+" + }, { + token : "keyword.operator.separator", + regex : "=" + }, { + include : "space" + }, { + include : "string" + }] }; - - xmlUtil.tag(this.$rules, "tag", "start"); + + if (this.constructor === XmlHighlightRules) + this.normalizeRules(); }; + +(function() { + + this.embedTagRules = function(HighlightRules, prefix, tag){ + this.$rules.tag.unshift({ + token : ["punctuation.meta.tag.begin." + tag, "meta.tag.name." + tag], + regex : "(<)(" + tag + ")", + next: [ + {include : "space"}, + {include : "attributes"}, + {token : "punctuation.meta.tag.end." + tag, regex : "/?>", next : prefix + "start"} + ] + }); + + this.$rules[tag + "-end"] = [ + {include : "space"}, + {token : "punctuation.meta.tag.end." + tag, regex : ">", next: "start", + onMatch : function(value, currentState, stack) { + stack.splice(0); + return this.token; + }} + ] + + this.embedRules(HighlightRules, prefix, [{ + token: ["punctuation.meta.tag.begin." + tag, "meta.tag.name." + tag], + regex : "(" + }]); + }; + +}).call(TextHighlightRules.prototype); + oop.inherits(XmlHighlightRules, TextHighlightRules); exports.XmlHighlightRules = XmlHighlightRules; From d358fe61b9d3cc31692e9cdfa5ab1c98a366e808 Mon Sep 17 00:00:00 2001 From: DanyaPostfactum Date: Mon, 24 Jun 2013 20:53:37 +1000 Subject: [PATCH 05/14] Allow no prefix in TextHighlightRules.addRules() --- lib/ace/mode/text_highlight_rules.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/ace/mode/text_highlight_rules.js b/lib/ace/mode/text_highlight_rules.js index b63f6c08..fc7bfb67 100644 --- a/lib/ace/mode/text_highlight_rules.js +++ b/lib/ace/mode/text_highlight_rules.js @@ -51,6 +51,11 @@ var TextHighlightRules = function() { (function() { this.addRules = function(rules, prefix) { + if (!prefix) { + for (var key in rules) + this.$rules[key] = rules[key]; + return; + } for (var key in rules) { var state = rules[key]; for (var i = 0; i < state.length; i++) { @@ -96,7 +101,7 @@ var TextHighlightRules = function() { if (!this.$embeds) this.$embeds = []; this.$embeds.push(prefix); - } + }; this.getEmbeds = function() { return this.$embeds; From 7c6f40e41eeb323ca337fa2e487b6a74c68e4dbb Mon Sep 17 00:00:00 2001 From: DanyaPostfactum Date: Mon, 24 Jun 2013 20:56:33 +1000 Subject: [PATCH 06/14] Html HL rules now is extended xml rules --- lib/ace/mode/behaviour/html.js | 17 ++-- lib/ace/mode/html_highlight_rules.js | 122 ++++++++++++--------------- 2 files changed, 59 insertions(+), 80 deletions(-) diff --git a/lib/ace/mode/behaviour/html.js b/lib/ace/mode/behaviour/html.js index e7a74cf9..1d500e0f 100644 --- a/lib/ace/mode/behaviour/html.js +++ b/lib/ace/mode/behaviour/html.js @@ -38,14 +38,9 @@ var TokenIterator = require("../../token_iterator").TokenIterator; var voidElements = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']; function hasType(token, type) { - var hasType = true; - var typeList = token.type.split('.'); - var needleList = type.split('.'); - needleList.forEach(function(needle){ - if (typeList.indexOf(needle) == -1) { - hasType = false; - return false; - } + var tokenTypes = token.type.split('.'); + return type.split('.').every(function(type){ + return (tokenTypes.indexOf(type) !== -1); }); return hasType; } @@ -60,7 +55,7 @@ var HtmlBehaviour = function () { var iterator = new TokenIterator(session, position.row, position.column); var token = iterator.getCurrentToken(); - if (hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column) + if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column) return; var atCursor = false; if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ @@ -70,8 +65,8 @@ var HtmlBehaviour = function () { } else { atCursor = true; } - if (!token || !hasType(token, 'meta.tag-name') || iterator.stepBackward().value.match('/')) { - return + if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) { + return; } var element = token.value; if (atCursor){ diff --git a/lib/ace/mode/html_highlight_rules.js b/lib/ace/mode/html_highlight_rules.js index d80ec2de..fdd7ec6e 100644 --- a/lib/ace/mode/html_highlight_rules.js +++ b/lib/ace/mode/html_highlight_rules.js @@ -35,8 +35,7 @@ var oop = require("../lib/oop"); var lang = require("../lib/lang"); var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var xmlUtil = require("./xml_util"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; +var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; var tagMap = lang.createMap({ a : 'anchor', @@ -58,81 +57,66 @@ var tagMap = lang.createMap({ }); var HtmlHighlightRules = function() { + XmlHighlightRules.call(this); - // regexp must not have capturing parentheses - // regexps are ordered -> the first match is used - this.$rules = { - start : [{ - token : "text", - regex : "<\\!\\[CDATA\\[", - next : "cdata" + this.addRules({ + attributes: [{ + include : "space" }, { - token : "xml-pe", - regex : "<\\?.*?\\?>" + token : "entity.other.attribute-name", + regex : "[-_a-zA-Z0-9:]+" }, { - token : "comment", - regex : "<\\!--", - next : "comment" + token : "keyword.operator.separator", + regex : "=", + push : [{ + include: "space", + }, { + token : "string", + regex : "[^<>='\"`\\s]+", + next : "pop" + }, { + token : "empty", + regex : "", + next : "pop" + }] }, { - token : "xml-pe", - regex : "<\\!.*?>" - }, { - token : "meta.tag", - regex : "<(?=script\\b)", - next : "script" - }, { - token : "meta.tag", - regex : "<(?=style\\b)", - next : "style" - }, { - token : "meta.tag", // opening tag - regex : "<\\/?(?=\\S)", - next : "tag" - }, { - token : "text", - regex : "\\s+" - }, { - token : "constant.character.entity", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" + include : "string" }], - - cdata : [ { - token : "text", - regex : "\\]\\]>", - next : "start" - } ], - - comment : [ { - token : "comment", - regex : ".*?-->", - next : "start" + tag: [{ + token : function(start, tag) { + var group = tagMap[tag]; + return ["punctuation.meta.tag.begin", + "meta.tag.name" + (group ? "." + group : "")]; + }, + regex : "(<)([-_a-zA-Z0-9:]+)", + next: "start_tag_stuff" }, { - defaultToken : "comment" - } ] - }; - - xmlUtil.tag(this.$rules, "tag", "start", tagMap); - xmlUtil.tag(this.$rules, "style", "css-start", tagMap); - xmlUtil.tag(this.$rules, "script", "js-start", tagMap); - - this.embedRules(JavaScriptHighlightRules, "js-", [{ - token: "comment", - regex: "\\/\\/.*(?=<\\/script>)", - next: "tag" - }, { - token: "meta.tag", - regex: "<\\/(?=script)", - next: "tag" - }]); - - this.embedRules(CssHighlightRules, "css-", [{ - token: "meta.tag", - regex: "<\\/(?=style)", - next: "tag" - }]); + token : function(start, tag) { + var group = tagMap[tag]; + return ["punctuation.meta.tag.begin", + "meta.tag.name" + (group ? "." + group : "")]; + }, + regex : "(", next : "start"} + ], + end_tag_stuff: [ + {include : "space"}, + {token : "punctuation.meta.tag.end", regex : ">", next : "start"} + ] + }); + + this.embedTagRules(CssHighlightRules, "css-", "style"); + this.embedTagRules(JavaScriptHighlightRules, "js-", "script"); + + if (this.constructor === HtmlHighlightRules) + this.normalizeRules(); }; -oop.inherits(HtmlHighlightRules, TextHighlightRules); +oop.inherits(HtmlHighlightRules, XmlHighlightRules); exports.HtmlHighlightRules = HtmlHighlightRules; }); From a6ba61e11af76b8636be8639a72a4ded7c61139c Mon Sep 17 00:00:00 2001 From: DanyaPostfactum Date: Mon, 24 Jun 2013 21:03:49 +1000 Subject: [PATCH 07/14] Inherit all HTML+server_side_directives rules from HTML rules. --- lib/ace/mode/coldfusion_highlight_rules.js | 84 +----- lib/ace/mode/curly_highlight_rules.js | 37 +-- lib/ace/mode/ftl_highlight_rules.js | 61 ++-- lib/ace/mode/html_ruby_highlight_rules.js | 39 +-- lib/ace/mode/jsp_highlight_rules.js | 67 +++-- lib/ace/mode/liquid_highlight_rules.js | 86 +----- lib/ace/mode/luapage_highlight_rules.js | 35 ++- lib/ace/mode/markdown_highlight_rules.js | 114 ++++---- lib/ace/mode/php_highlight_rules.js | 26 +- lib/ace/mode/rhtml_highlight_rules.js | 13 +- lib/ace/mode/twig_highlight_rules.js | 42 +-- lib/ace/mode/velocity_highlight_rules.js | 318 +++++++++------------ 12 files changed, 373 insertions(+), 549 deletions(-) diff --git a/lib/ace/mode/coldfusion_highlight_rules.js b/lib/ace/mode/coldfusion_highlight_rules.js index dddf867d..5feff6d6 100644 --- a/lib/ace/mode/coldfusion_highlight_rules.js +++ b/lib/ace/mode/coldfusion_highlight_rules.js @@ -32,92 +32,18 @@ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var xml_util = require("./xml_util"); +var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; var ColdfusionHighlightRules = function() { + HtmlHighlightRules.call(this); - // regexp must not have capturing parentheses - // regexps are ordered -> the first match is used + this.embedTagRules(JavaScriptHighlightRules, "cfjs-", "cfscript"); - this.$rules = { - start : [ { - token : "text", - regex : "<\\!\\[CDATA\\[", - next : "cdata" - }, { - token : "xml-pe", - regex : "<\\?.*?\\?>" - }, { - token : "comment", - regex : "<\\!--", - next : "comment" - }, { - token : "meta.tag", - regex : "<(?=script)", - next : "script" - }, { - token : "meta.tag", - regex : "<(?=cfscript)", - next : "cfscript" - }, { - token : "meta.tag", - regex : "<(?=style)", - next : "style" - }, { - token : "meta.tag", // opening tag - regex : "<\\/?", - next : "tag" - } ], - - cdata : [ { - token : "text", - regex : "\\]\\]>", - next : "start" - } ], - - comment : [ { - token : "comment", - regex : ".*?-->", - next : "start" - }, { - defaultToken : "comment" - } ] - }; - - xml_util.tag(this.$rules, "tag", "start"); - xml_util.tag(this.$rules, "style", "css-start"); - xml_util.tag(this.$rules, "script", "js-start"); - xml_util.tag(this.$rules, "cfscript", "js-start"); - - this.embedRules(JavaScriptHighlightRules, "js-", [{ - token: "comment", - regex: "\\/\\/.*(?=<\\/script>)", - next: "tag" - }, { - token: "meta.tag", - regex: "<\\/(?=script)", - next: "tag" - }, { - token: "comment", - regex: "\\/\\/.*(?=<\\/cfscript>)", - next: "tag" - }, { - token: "meta.tag", - regex: "<\\/(?=cfscript)", - next: "tag" - }]); - - this.embedRules(CssHighlightRules, "css-", [{ - token: "meta.tag", - regex: "<\\/(?=style)", - next: "tag" - }]); + this.normalizeRules(); }; -oop.inherits(ColdfusionHighlightRules, TextHighlightRules); +oop.inherits(ColdfusionHighlightRules, HtmlHighlightRules); exports.ColdfusionHighlightRules = ColdfusionHighlightRules; }); diff --git a/lib/ace/mode/curly_highlight_rules.js b/lib/ace/mode/curly_highlight_rules.js index bcf367e8..92e6f539 100644 --- a/lib/ace/mode/curly_highlight_rules.js +++ b/lib/ace/mode/curly_highlight_rules.js @@ -42,34 +42,21 @@ var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; var CurlyHighlightRules = function() { - var CurlyRules = { - "start" : [ - { - token: "variable", - regex: "{{", - next: "curly_mode" - } - ], + HtmlHighlightRules.call(this); - "curly_mode" : [ - { - token: "variable", - regex: "}}", - next: "start" - } - ] - }; + this.$rules["start"].unshift({ + token: "variable", + regex: "{{", + push: "curly-start" + }); - var htmlRules = new HtmlHighlightRules().getRules(); + this.$rules["curly-start"] = [{ + token: "variable", + regex: "}}", + next: "pop" + }]; - // Inject Curly start array into HTML rules - htmlRules.start = CurlyRules.start.concat(htmlRules.start); - - // Inject Mustach mode array into HTML rules - htmlRules.curly_mode = CurlyRules.curly_mode; - - // Return the augmented HTML rules - this.$rules = htmlRules; + this.normalizeRules(); }; oop.inherits(CurlyHighlightRules, HtmlHighlightRules); diff --git a/lib/ace/mode/ftl_highlight_rules.js b/lib/ace/mode/ftl_highlight_rules.js index 88e12340..0a79520f 100644 --- a/lib/ace/mode/ftl_highlight_rules.js +++ b/lib/ace/mode/ftl_highlight_rules.js @@ -131,14 +131,18 @@ var FtlLangHighlightRules = function () { oop.inherits(FtlLangHighlightRules, TextHighlightRules); var FtlHighlightRules = function() { + HtmlHighlightRules.call(this); + var directives = "assign|attempt|break|case|compress|default|elseif|else|escape|fallback|function|flush|" + "ftl|global|if|import|include|list|local|lt|macro|nested|noescape|noparse|nt|recover|recurse|return|rt|" + "setting|stop|switch|t|visit"; - HtmlHighlightRules.call(this); - - for (var i in this.$rules) { - this.$rules[i].unshift({ + var startRules = [ + { + token : "comment", + regex : "<#--", + next : "ftl-dcomment" + }, { token : "string.interpolated", regex : "\\${", push : "ftl-start" @@ -150,34 +154,35 @@ var FtlHighlightRules = function() { token : "keyword.other", regex : "", + next : "pop" + }, { + token : "string.interpolated", + regex : "}", + next : "pop" + } + ]; - this.$rules["ftl-start"].unshift({ - token : "keyword", - regex : "/?>", - next : "pop" - }, { - token : "string.interpolated", - regex : "}", - next : "pop" - }); + for (var key in this.$rules) + this.$rules[key].unshift.apply(this.$rules[key], startRules); - this.$rules.start.unshift({ - token : "comment", - regex : "<#--", - next : "comment" - }); + this.embedRules(FtlLangHighlightRules, "ftl-", endRules, ["start"]); - this.$rules.comment.unshift({ - token : "comment", - regex : ".*?-->", - next : "start" - }, { - token : "comment", - regex : ".+" + this.addRules({ + "ftl-dcomment" : [{ + token : "comment", + regex : ".*?-->", + next : "pop" + }, { + token : "comment", + regex : ".+" + }] }); this.normalizeRules(); diff --git a/lib/ace/mode/html_ruby_highlight_rules.js b/lib/ace/mode/html_ruby_highlight_rules.js index bcfbf1c4..e86dbe25 100644 --- a/lib/ace/mode/html_ruby_highlight_rules.js +++ b/lib/ace/mode/html_ruby_highlight_rules.js @@ -37,32 +37,37 @@ define(function(require, exports, module) { var HtmlRubyHighlightRules = function() { HtmlHighlightRules.call(this); - - for (var i in this.$rules) { - this.$rules[i].unshift({ + + var startRules = [ + { regex: "<%%|%%>", token: "constant.language.escape" }, { - token : "comment.start.erb", + token : "comment.start.erb", regex : "<%#", push : [{regex: "%>", next: "pop"}] }, { token : "support.ruby_tag", regex : "<%+(?!>)[-=]?", push : "ruby-start" - }); - } - - this.embedRules(RubyHighlightRules, "ruby-"); - - this.$rules["ruby-start"].unshift({ - token : "support.ruby_tag", - regex : "%>", - next : "pop" - }, { - token: "comment", - regex: /#(?:[^%]|%[^>])*/ - }); + } + ]; + + var endRules = [ + { + token : "support.ruby_tag", + regex : "%>", + next : "pop" + }, { + token: "comment", + regex: "#(?:[^%]|%[^>])*" + } + ]; + + for (var key in this.$rules) + this.$rules[key].unshift.apply(this.$rules[key], startRules); + + this.embedRules(RubyHighlightRules, "ruby-", endRules, ["start"]); this.normalizeRules(); }; diff --git a/lib/ace/mode/jsp_highlight_rules.js b/lib/ace/mode/jsp_highlight_rules.js index d639c6bd..e6775f53 100644 --- a/lib/ace/mode/jsp_highlight_rules.js +++ b/lib/ace/mode/jsp_highlight_rules.js @@ -37,45 +37,52 @@ var JavaHighlightRules = require("./java_highlight_rules").JavaHighlightRules; var JspHighlightRules = function() { HtmlHighlightRules.call(this); - for (var i in this.$rules) { - this.$rules[i].unshift({ - token : "meta.tag", // jsp open tag - regex : "<%@?|<%=?|]+>", - next : "jsp-start" - }); - } var builtinVariables = 'request|response|out|session|' + 'application|config|pageContext|page|Exception'; var keywords = 'page|include|taglib'; - this.embedRules(JavaHighlightRules, "jsp-"); + var startRules = [ + { + token : "comment", + regex : "<%--", + push : "jsp-dcomment" + }, { + token : "meta.tag", // jsp open tag + regex : "<%@?|<%=?|]+>", + push : "jsp-start" + } + ]; - this.$rules["start"].unshift({ - token : "comment", - regex : "<%--", - next : "comment" + var endRules = [ + { + token : "meta.tag", // jsp close tag + regex : "%>|<\\/jsp:[^>]+>", + next : "pop" + }, { + token: "variable.language", + regex : builtinVariables + }, { + token: "keyword", + regex : keywords + } + ]; + + for (var key in this.$rules) + this.$rules[key].unshift.apply(this.$rules[key], startRules); + + this.embedRules(JavaHighlightRules, "jsp-", endRules, ["start"]); + + this.addRules({ + "jsp-dcomment" : [{ + token : "comment", + regex : ".*?--%>", + next : "pop" + }] }); - this.$rules["jsp-start"].unshift({ - token : "meta.tag", // jsp close tag - regex : "%>|<\\/jsp:[^>]+>", - next : "start" - }, - { - token: "variable.language", - regex : builtinVariables - }, { - token: "keyword", - regex : keywords - }); - - this.$rules.comment.unshift({ - token : "comment", - regex : ".*?--%>", - next : "start" - }); + this.normalizeRules(); }; oop.inherits(JspHighlightRules, HtmlHighlightRules); diff --git a/lib/ace/mode/liquid_highlight_rules.js b/lib/ace/mode/liquid_highlight_rules.js index 4a94f466..50a9376c 100644 --- a/lib/ace/mode/liquid_highlight_rules.js +++ b/lib/ace/mode/liquid_highlight_rules.js @@ -32,12 +32,11 @@ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var xmlUtil = require("./xml_util"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; +var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; var LiquidHighlightRules = function() { + HtmlHighlightRules.call(this); // see: https://developer.mozilla.org/en/Liquid/Reference/Global_Objects var functions = ( @@ -69,65 +68,28 @@ var LiquidHighlightRules = function() { "keyword.definition": definitions }, "identifier"); - // regexp must not have capturing parentheses. Use (?:) instead. - // regexps are ordered -> the first match is used - - this.$rules = { - start : [{ + // add liquid start tags to the HTML start tags + for (var rule in this.$rules) { + this.$rules[rule].unshift({ token : "variable", regex : "{%", - next : "liquid_start" + push : "liquid-start" }, { token : "variable", regex : "{{", - next : "liquid_start" - }, { - token : "meta.tag", - regex : "<\\!\\[CDATA\\[", - next : "cdata" - }, { - token : "xml-pe", - regex : "<\\?.*?\\?>" - }, { - token : "comment", - regex : "<\\!--", - next : "comment" - }, { - token : "meta.tag", - regex : "<(?=\\s*script\\b)", - next : "script" - }, { - token : "meta.tag", - regex : "<(?=\\s*style\\b)", - next : "style" - }, { - token : "meta.tag", // opening tag - regex : "<\\/?", - next : "tag" - } ], + push : "liquid-start" + }); + } - cdata : [ { - token : "text", - regex : "\\]\\]>", - next : "start" - } ], - - comment : [ { - token : "comment", - regex : ".*?-->", - next : "start" - }, { - defaultToken : "comment" - } ] , - - liquid_start : [{ + this.addRules({ + "liquid-start" : [{ token: "variable", regex: "}}", - next: "start" + next: "pop" }, { token: "variable", regex: "%}", - next: "start" + next: "pop" }, { token : "string", // single line regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' @@ -159,27 +121,9 @@ var LiquidHighlightRules = function() { token : "text", regex : "\\s+" }] - }; + }); - xmlUtil.tag(this.$rules, "tag", "start"); - xmlUtil.tag(this.$rules, "style", "css-start"); - xmlUtil.tag(this.$rules, "script", "js-start"); - - this.embedRules(JavaScriptHighlightRules, "js-", [{ - token: "comment", - regex: "\\/\\/.*(?=<\\/script>)", - next: "tag" - }, { - token: "meta.tag", - regex: "<\\/(?=script)", - next: "tag" - }]); - - this.embedRules(CssHighlightRules, "css-", [{ - token: "meta.tag", - regex: "<\\/(?=style)", - next: "tag" - }]); + this.normalizeRules(); }; oop.inherits(LiquidHighlightRules, TextHighlightRules); diff --git a/lib/ace/mode/luapage_highlight_rules.js b/lib/ace/mode/luapage_highlight_rules.js index 6a79102f..59878999 100644 --- a/lib/ace/mode/luapage_highlight_rules.js +++ b/lib/ace/mode/luapage_highlight_rules.js @@ -8,31 +8,38 @@ var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; var LuaHighlightRules = require("./lua_highlight_rules").LuaHighlightRules; var LuaPageHighlightRules = function() { - this.$rules = new HtmlHighlightRules().getRules(); - - for (var i in this.$rules) { - this.$rules[i].unshift({ + HtmlHighlightRules.call(this); + + var startRules = [ + { token: "keyword", regex: "<\\%\\=?", - next: "lua-start" + push: "lua-start" }, { token: "keyword", regex: "<\\?lua\\=?", - next: "lua-start" - }); - } - this.embedRules(LuaHighlightRules, "lua-", [ + push: "lua-start" + } + ]; + + var endRules = [ { token: "keyword", regex: "\\%>", - next: "start" - }, - { + next: "pop" + }, { token: "keyword", regex: "\\?>", - next: "start" + next: "pop" } - ]); + ]; + + this.embedRules(LuaHighlightRules, "lua-", endRules, ["start"]); + + for (var key in this.$rules) + this.$rules[key].unshift.apply(this.$rules[key], startRules); + + this.normalizeRules(); }; oop.inherits(LuaPageHighlightRules, HtmlHighlightRules); diff --git a/lib/ace/mode/markdown_highlight_rules.js b/lib/ace/mode/markdown_highlight_rules.js index f9591b36..924863e7 100644 --- a/lib/ace/mode/markdown_highlight_rules.js +++ b/lib/ace/mode/markdown_highlight_rules.js @@ -42,16 +42,57 @@ function github_embed(tag, prefix) { return { // Github style block token : "support.function", regex : "^```" + tag + "\\s*$", - next : prefix + "start" + push : prefix + "start" }; } var MarkdownHighlightRules = function() { - + HtmlHighlightRules.call(this); // regexp must not have capturing parentheses // regexps are ordered -> the first match is used - this.$rules = { + this.$rules["start"].unshift({ + token : "empty_line", + regex : '^$', + next: "allowBlock" + }, { // h1 + token: "markup.heading.1", + regex: "^=+(?=\\s*$)" + }, { // h2 + token: "markup.heading.2", + regex: "^\\-+(?=\\s*$)" + }, { + token : function(value) { + return "markup.heading." + value.length; + }, + regex : /^#{1,6}(?=\s*[^ #]|\s+#.)/, + next : "header" + }, + github_embed("(?:javascript|js)", "jscode-"), + github_embed("xml", "xmlcode-"), + github_embed("html", "htmlcode-"), + github_embed("css", "csscode-"), + { // Github style block + token : "support.function", + regex : "^```\\s*[a-zA-Z]*(?:{.*?\\})?\\s*$", + next : "githubblock" + }, { // block quote + token : "string", + regex : "^>[ ].+$", + next : "blockquote" + }, { // HR * - _ + token : "constant", + regex : "^ {0,2}(?:(?: ?\\* ?){3,}|(?: ?\\- ?){3,}|(?: ?\\_ ?){3,})\\s*$", + next: "allowBlock" + }, { // list + token : "markup.list", + regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+", + next : "listblock-start" + }, { + include : "basic" + }); + + this.addRules({ "basic" : [{ token : "constant.language.escape", regex : /\\[\\`*_{}\[\]()#+\-.!]/ @@ -93,47 +134,6 @@ var MarkdownHighlightRules = function() { {token : "empty", regex : "", next : "start"} ], - "start" : [{ - token : "empty_line", - regex : '^$', - next: "allowBlock" - }, { // h1 - token: "markup.heading.1", - regex: "^=+(?=\\s*$)" - }, { // h2 - token: "markup.heading.2", - regex: "^\\-+(?=\\s*$)" - }, { - token : function(value) { - return "markup.heading." + value.length; - }, - regex : /^#{1,6}(?=\s*[^ #]|\s+#.)/, - next : "header" - }, - github_embed("(?:javascript|js)", "js-"), - github_embed("xml", "xml-"), - github_embed("html", "html-"), - github_embed("css", "css-"), - { // Github style block - token : "support.function", - regex : "^```\\s*[a-zA-Z]*(?:{.*?\\})?\\s*$", - next : "githubblock" - }, { // block quote - token : "string", - regex : "^>[ ].+$", - next : "blockquote" - }, { // HR * - _ - token : "constant", - regex : "^ {0,2}(?:(?: ?\\* ?){3,}|(?: ?\\- ?){3,}|(?: ?\\_ ?){3,})\\s*$", - next: "allowBlock" - }, { // list - token : "markup.list", - regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+", - next : "listblock-start" - }, { - include : "basic" - }], - "header" : [{ regex: "$", next : "start" @@ -180,40 +180,32 @@ var MarkdownHighlightRules = function() { token : "support.function", regex : ".+" } ] - }; + }); - this.embedRules(JavaScriptHighlightRules, "js-", [{ + this.embedRules(JavaScriptHighlightRules, "jscode-", [{ token : "support.function", regex : "^```", - next : "start" + next : "pop" }]); - this.embedRules(HtmlHighlightRules, "html-", [{ + this.embedRules(HtmlHighlightRules, "htmlcode-", [{ token : "support.function", regex : "^```", - next : "start" + next : "pop" }]); - this.embedRules(CssHighlightRules, "css-", [{ + this.embedRules(CssHighlightRules, "csscode-", [{ token : "support.function", regex : "^```", - next : "start" + next : "pop" }]); - this.embedRules(XmlHighlightRules, "xml-", [{ + this.embedRules(XmlHighlightRules, "xmlcode-", [{ token : "support.function", regex : "^```", - next : "start" + next : "pop" }]); - var html = new HtmlHighlightRules().getRules(); - for (var i in html) { - if (this.$rules[i]) - this.$rules[i] = this.$rules[i].concat(html[i]); - else - this.$rules[i] = html[i]; - } - this.normalizeRules(); }; oop.inherits(MarkdownHighlightRules, TextHighlightRules); diff --git a/lib/ace/mode/php_highlight_rules.js b/lib/ace/mode/php_highlight_rules.js index 95bec4b3..8c080214 100644 --- a/lib/ace/mode/php_highlight_rules.js +++ b/lib/ace/mode/php_highlight_rules.js @@ -1057,21 +1057,27 @@ oop.inherits(PhpLangHighlightRules, TextHighlightRules); var PhpHighlightRules = function() { HtmlHighlightRules.call(this); - for (var i in this.$rules) { - this.$rules[i].unshift({ + var startRules = [ + { token : "support.php_tag", // php open tag regex : "<\\?(?:php|=)?", push : "php-start" - }); - } + } + ]; - this.embedRules(PhpLangHighlightRules, "php-"); + var endRules = [ + { + token : "support.php_tag", // php close tag + regex : "\\?>", + next : "pop" + } + ]; + + for (var key in this.$rules) + this.$rules[key].unshift.apply(this.$rules[key], startRules); + + this.embedRules(PhpLangHighlightRules, "php-", endRules, ["start"]); - this.$rules["php-start"].unshift({ - token : "support.php_tag", // php close tag - regex : "\\?>", - next : "pop" - }); this.normalizeRules(); }; diff --git a/lib/ace/mode/rhtml_highlight_rules.js b/lib/ace/mode/rhtml_highlight_rules.js index 20cd3bbc..0ab65a92 100644 --- a/lib/ace/mode/rhtml_highlight_rules.js +++ b/lib/ace/mode/rhtml_highlight_rules.js @@ -24,24 +24,21 @@ var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var RHtmlHighlightRules = function() { + HtmlHighlightRules.call(this); - // regexp must not have capturing parentheses - // regexps are ordered -> the first match is used - - this.$rules = new HtmlHighlightRules().getRules(); this.$rules["start"].unshift({ token: "support.function.codebegin", regex: "^<" + "!--\\s*begin.rcode\\s*(?:.*)", next: "r-start" }); - var rRules = new RHighlightRules().getRules(); - this.addRules(rRules, "r-"); - this.$rules["r-start"].unshift({ + this.embedRules(RHighlightRules, "r-", [{ token: "support.function.codeend", regex: "^\\s*end.rcode\\s*-->", next: "start" - }); + }], ["start"]); + + this.normalizeRules(); }; oop.inherits(RHtmlHighlightRules, TextHighlightRules); diff --git a/lib/ace/mode/twig_highlight_rules.js b/lib/ace/mode/twig_highlight_rules.js index 23f94043..4a71973f 100644 --- a/lib/ace/mode/twig_highlight_rules.js +++ b/lib/ace/mode/twig_highlight_rules.js @@ -56,35 +56,37 @@ var TwigHighlightRules = function() { }, "identifier"); // add twig start tags to the HTML start tags - this.$rules.start.unshift({ - token : "variable.other.readwrite.local.twig", - regex : "\\{\\{-?", - next : "twig-start" - }, { - token : "meta.tag.twig", - regex : "\\{%-?", - next : "twig-start" - }, { - token : "comment.block.twig", - regex : "\\{#-?", - next : "comment" - }); + for (var rule in this.$rules) { + this.$rules[rule].unshift({ + token : "variable.other.readwrite.local.twig", + regex : "\\{\\{-?", + push : "twig-start" + }, { + token : "meta.tag.twig", + regex : "\\{%-?", + push : "twig-start" + }, { + token : "comment.block.twig", + regex : "\\{#-?", + push : "twig-comment" + }); + } // add twig closing comment to HTML comments - this.$rules.comment.unshift({ + this.$rules["twig-comment"] = [{ token : "comment.block.twig", regex : ".*-?#\\}", - next : "start" - }); + next : "pop" + }]; this.$rules["twig-start"] = [{ token : "variable.other.readwrite.local.twig", regex : "-?\\}\\}", - next : "start" + next : "pop" }, { token : "meta.tag.twig", regex : "-?%\\}", - next : "start" + next : "pop" }, { token : "string", regex : "'", @@ -131,8 +133,6 @@ var TwigHighlightRules = function() { regex : "\\s+" } ]; - - this.$rules["twig-qqstring"] = [{ token : "constant.language.escape", regex : /\\[\\"$#ntr]|#{[^"}]*}/ @@ -156,6 +156,8 @@ var TwigHighlightRules = function() { defaultToken : "string" } ]; + + this.normalizeRules(); }; oop.inherits(TwigHighlightRules, TextHighlightRules); diff --git a/lib/ace/mode/velocity_highlight_rules.js b/lib/ace/mode/velocity_highlight_rules.js index 9930d565..506a5836 100644 --- a/lib/ace/mode/velocity_highlight_rules.js +++ b/lib/ace/mode/velocity_highlight_rules.js @@ -3,12 +3,12 @@ define(function(require, exports, module) { var oop = require("../lib/oop"); var lang = require("../lib/lang"); -var xmlUtil = require("./xml_util"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; +var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; var VelocityHighlightRules = function() { + HtmlHighlightRules.call(this); + var builtinConstants = lang.arrayToMap( ('true|false|null').split('|') ); @@ -31,198 +31,144 @@ var VelocityHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used - this.$rules = { - "start" : [ - { - token : "meta.tag", - regex : "<\\!\\[CDATA\\[", - next : "cdata" - }, { - token : "xml-pe", - regex : "<\\?.*?\\?>" - }, { - token : "comment", - regex : "<\\!--", - next : "comment" - }, { - token : "meta.tag", - regex : "<(?=\\s*script\\b)", - next : "script" - }, { - token : "meta.tag", - regex : "<(?=\\s*style\\b)", - next : "style" - }, { - token : "meta.tag", // opening tag - regex : "<\\/?(?=[a-z])", - next : "tag" - }, { - token : "comment", - regex : "##.*$" - },{ - token : "comment.block", // multi line comment - regex : "#\\*", - next : "comment" - }, { - token : "string.regexp", - regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - token : "constant.numeric", // hex - regex : "0[xX][0-9a-fA-F]+\\b" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "constant.language.boolean", - regex : "(?:true|false)\\b" - }, { - token : function(value) { - if (keywords.hasOwnProperty(value)) - return "keyword"; - else if (builtinConstants.hasOwnProperty(value)) - return "constant.language"; - else if (builtinVariables.hasOwnProperty(value)) - return "variable.language"; - else if (builtinFunctions.hasOwnProperty(value) || builtinFunctions.hasOwnProperty(value.substring(1))) - return "support.function"; - else if (value == "debugger") - return "invalid.deprecated"; - else - if(value.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*)$/)) - return "variable"; - return "identifier"; - }, - // TODO: Unicode escape sequences - // TODO: Unicode identifiers - regex : "[a-zA-Z$#][a-zA-Z0-9_]*\\b" - }, { - token : "keyword.operator", - regex : "!|&|\\*|\\-|\\+|=|!=|<=|>=|<|>|&&|\\|\\|" - }, { - token : "lparen", - regex : "[[({]" - }, { - token : "rparen", - regex : "[\\])}]" - }, { - token : "text", - regex : "\\s+" - } - ], - "cdata" : [ - { - token : "text", - regex : "\\]\\]>", - next : "start" - }, { - token : "text", - regex : "\\s+" - }, { - token : "text", - regex : ".+" - } - ], - "comment" : [ - { - token : "comment", // closing comment - regex : "\\*#|-->", - next : "start" - }, { - defaultToken: "comment" - } - ], - "vm_start" : [ - { - token: "variable", - regex: "}", - next: "start" - }, { - token : "string.regexp", - regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - token : "constant.numeric", // hex - regex : "0[xX][0-9a-fA-F]+\\b" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "constant.language.boolean", - regex : "(?:true|false)\\b" - }, { - token : function(value) { - if (keywords.hasOwnProperty(value)) - return "keyword"; - else if (builtinConstants.hasOwnProperty(value)) - return "constant.language"; - else if (builtinVariables.hasOwnProperty(value)) - return "variable.language"; - else if (builtinFunctions.hasOwnProperty(value) || builtinFunctions.hasOwnProperty(value.substring(1))) - return "support.function"; - else if (value == "debugger") - return "invalid.deprecated"; - else - if(value.match(/^(\$[a-zA-Z_$][a-zA-Z0-9_]*)$/)) - return "variable"; - return "identifier"; - }, - // TODO: Unicode escape sequences - // TODO: Unicode identifiers - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" - }, { - token : "keyword.operator", - regex : "!|&|\\*|\\-|\\+|=|!=|<=|>=|<|>|&&|\\|\\|" - }, { - token : "lparen", - regex : "[[({]" - }, { - token : "rparen", - regex : "[\\])}]" - }, { - token : "text", - regex : "\\s+" - } - ] - }; + this.$rules.start.push( + { + token : "comment", + regex : "##.*$" + },{ + token : "comment.block", // multi line comment + regex : "#\\*", + next : "vm_comment" + }, { + token : "string.regexp", + regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" + }, { + token : "string", // single line + regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' + }, { + token : "string", // single line + regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" + }, { + token : "constant.numeric", // hex + regex : "0[xX][0-9a-fA-F]+\\b" + }, { + token : "constant.numeric", // float + regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" + }, { + token : "constant.language.boolean", + regex : "(?:true|false)\\b" + }, { + token : function(value) { + if (keywords.hasOwnProperty(value)) + return "keyword"; + else if (builtinConstants.hasOwnProperty(value)) + return "constant.language"; + else if (builtinVariables.hasOwnProperty(value)) + return "variable.language"; + else if (builtinFunctions.hasOwnProperty(value) || builtinFunctions.hasOwnProperty(value.substring(1))) + return "support.function"; + else if (value == "debugger") + return "invalid.deprecated"; + else + if(value.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*)$/)) + return "variable"; + return "identifier"; + }, + // TODO: Unicode escape sequences + // TODO: Unicode identifiers + regex : "[a-zA-Z$#][a-zA-Z0-9_]*\\b" + }, { + token : "keyword.operator", + regex : "!|&|\\*|\\-|\\+|=|!=|<=|>=|<|>|&&|\\|\\|" + }, { + token : "lparen", + regex : "[[({]" + }, { + token : "rparen", + regex : "[\\])}]" + }, { + token : "text", + regex : "\\s+" + } + ); - xmlUtil.tag(this.$rules, "tag", "start"); - xmlUtil.tag(this.$rules, "style", "css-start"); - xmlUtil.tag(this.$rules, "script", "js-start"); + this.$rules["vm_comment"] = [ + { + token : "comment", // closing comment + regex : "\\*#|-->", + next : "start" + }, { + defaultToken: "comment" + } + ]; - this.embedRules(JavaScriptHighlightRules, "js-", [{ - token: "comment", - regex: "\\/\\/.*(?=<\\/script>)", - next: "tag" - }, { - token: "meta.tag", - regex: "<\\/(?=script)", - next: "tag" - }]); - - this.embedRules(CssHighlightRules, "css-", [{ - token: "meta.tag", - regex: "<\\/(?=style)", - next: "tag" - }]); + this.$rules["vm_start"] = [ + { + token: "variable", + regex: "}", + next: "pop" + }, { + token : "string.regexp", + regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" + }, { + token : "string", // single line + regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' + }, { + token : "string", // single line + regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" + }, { + token : "constant.numeric", // hex + regex : "0[xX][0-9a-fA-F]+\\b" + }, { + token : "constant.numeric", // float + regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" + }, { + token : "constant.language.boolean", + regex : "(?:true|false)\\b" + }, { + token : function(value) { + if (keywords.hasOwnProperty(value)) + return "keyword"; + else if (builtinConstants.hasOwnProperty(value)) + return "constant.language"; + else if (builtinVariables.hasOwnProperty(value)) + return "variable.language"; + else if (builtinFunctions.hasOwnProperty(value) || builtinFunctions.hasOwnProperty(value.substring(1))) + return "support.function"; + else if (value == "debugger") + return "invalid.deprecated"; + else + if(value.match(/^(\$[a-zA-Z_$][a-zA-Z0-9_]*)$/)) + return "variable"; + return "identifier"; + }, + // TODO: Unicode escape sequences + // TODO: Unicode identifiers + regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" + }, { + token : "keyword.operator", + regex : "!|&|\\*|\\-|\\+|=|!=|<=|>=|<|>|&&|\\|\\|" + }, { + token : "lparen", + regex : "[[({]" + }, { + token : "rparen", + regex : "[\\])}]" + }, { + token : "text", + regex : "\\s+" + } + ]; for (var i in this.$rules) { this.$rules[i].unshift({ token: "variable", regex: "\\${", - next: "vm_start" + push: "vm_start" }); } + + this.normalizeRules(); }; oop.inherits(VelocityHighlightRules, TextHighlightRules); From 25853c11a1df5a2cb27ae1525754a43f9910add3 Mon Sep 17 00:00:00 2001 From: DanyaPostfactum Date: Mon, 24 Jun 2013 21:04:28 +1000 Subject: [PATCH 08/14] Use push/pop in css highlight rules --- lib/ace/mode/css_highlight_rules.js | 185 +++++++++++----------------- 1 file changed, 75 insertions(+), 110 deletions(-) diff --git a/lib/ace/mode/css_highlight_rules.js b/lib/ace/mode/css_highlight_rules.js index 1cee4d11..12b3d8fa 100644 --- a/lib/ace/mode/css_highlight_rules.js +++ b/lib/ace/mode/css_highlight_rules.js @@ -60,11 +60,80 @@ var CssHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used - var base_ruleset = [ - { + this.$rules = { + "start" : [{ token : "comment", // multi line comment regex : "\\/\\*", - next : "ruleset_comment" + push : "comment" + }, { + token: "paren.lparen", + regex: "\\{", + push: "ruleset" + }, { + token: "string", + regex: "@.*?{", + push: "media" + }, { + token: "keyword", + regex: "#[a-z0-9-_]+" + }, { + token: "variable", + regex: "\\.[a-z0-9-_]+" + }, { + token: "string", + regex: ":[a-z0-9-_]+" + }, { + token: "constant", + regex: "[a-z0-9-_]+" + }, { + caseInsensitive: true + }], + + "media" : [{ + token : "comment", // multi line comment + regex : "\\/\\*", + push : "comment" + }, { + token: "paren.lparen", + regex: "\\{", + push: "ruleset" + }, { + token: "string", + regex: "\\}", + next: "pop" + }, { + token: "keyword", + regex: "#[a-z0-9-_]+" + }, { + token: "variable", + regex: "\\.[a-z0-9-_]+" + }, { + token: "string", + regex: ":[a-z0-9-_]+" + }, { + token: "constant", + regex: "[a-z0-9-_]+" + }, { + caseInsensitive: true + }], + + "comment" : [{ + token : "comment", + regex : "\\*\\/", + next : "pop" + }, { + defaultToken : "comment" + }], + + "ruleset" : [ + { + token : "paren.rparen", + regex : "\\}", + next: "pop" + }, { + token : "comment", // multi line comment + regex : "\\/\\*", + push : "comment" }, { token : "string", // single line regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' @@ -97,114 +166,10 @@ var CssHighlightRules = function() { regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*" }, { caseInsensitive: true - } - ]; - - var ruleset = lang.copyArray(base_ruleset); - ruleset.unshift({ - token : "paren.rparen", - regex : "\\}", - next: "start" - }); - - var media_ruleset = lang.copyArray( base_ruleset ); - media_ruleset.unshift({ - token : "paren.rparen", - regex : "\\}", - next: "media" - }); - - var base_comment = [{ - token : "comment", // comment spanning whole line - regex : ".+" - }]; - - var comment = lang.copyArray(base_comment); - comment.unshift({ - token : "comment", // closing comment - regex : ".*?\\*\\/", - next : "start" - }); - - var media_comment = lang.copyArray(base_comment); - media_comment.unshift({ - token : "comment", // closing comment - regex : ".*?\\*\\/", - next : "media" - }); - - var ruleset_comment = lang.copyArray(base_comment); - ruleset_comment.unshift({ - token : "comment", // closing comment - regex : ".*?\\*\\/", - next : "ruleset" - }); - - this.$rules = { - "start" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - next: "ruleset" - }, { - token: "string", - regex: "@.*?{", - next: "media" - },{ - token: "keyword", - regex: "#[a-z0-9-_]+" - },{ - token: "variable", - regex: "\\.[a-z0-9-_]+" - },{ - token: "string", - regex: ":[a-z0-9-_]+" - },{ - token: "constant", - regex: "[a-z0-9-_]+" - },{ - caseInsensitive: true - }], - - "media" : [ { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "media_comment" - }, { - token: "paren.lparen", - regex: "\\{", - next: "media_ruleset" - },{ - token: "string", - regex: "\\}", - next: "start" - },{ - token: "keyword", - regex: "#[a-z0-9-_]+" - },{ - token: "variable", - regex: "\\.[a-z0-9-_]+" - },{ - token: "string", - regex: ":[a-z0-9-_]+" - },{ - token: "constant", - regex: "[a-z0-9-_]+" - },{ - caseInsensitive: true - }], - - "comment" : comment, - - "ruleset" : ruleset, - "ruleset_comment" : ruleset_comment, - - "media_ruleset" : media_ruleset, - "media_comment" : media_comment + }] }; + + this.normalizeRules(); }; oop.inherits(CssHighlightRules, TextHighlightRules); From e2359b2f9f3c1eb63ac601e25fc26e326488f105 Mon Sep 17 00:00:00 2001 From: DanyaPostfactum Date: Mon, 24 Jun 2013 21:06:32 +1000 Subject: [PATCH 09/14] Let JS line comment rules be not greedy --- lib/ace/mode/javascript_highlight_rules.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/ace/mode/javascript_highlight_rules.js b/lib/ace/mode/javascript_highlight_rules.js index 3984f2c3..35255c68 100644 --- a/lib/ace/mode/javascript_highlight_rules.js +++ b/lib/ace/mode/javascript_highlight_rules.js @@ -215,8 +215,8 @@ var JavaScriptHighlightRules = function() { next : "comment_regex_allowed" }, { token : "comment", - regex : "\\/\\/.*$", - next : "start" + regex : "\\/\\/", + next : "line_comment" }, { token: "string.regexp", regex: "\\/", @@ -309,6 +309,10 @@ var JavaScriptHighlightRules = function() { {token : "comment", regex : "\\*\\/", next : "no_regex"}, {defaultToken : "comment"} ], + "line_comment" : [ + {token : "comment", regex : "$", next : "start"}, + {defaultToken : "comment"} + ], "qqstring" : [ { token : "constant.language.escape", From 722374581a5f4360adf67bbda5337f893ece3f2b Mon Sep 17 00:00:00 2001 From: DanyaPostfactum Date: Mon, 24 Jun 2013 21:06:54 +1000 Subject: [PATCH 10/14] Update svg Highlight rules --- lib/ace/mode/svg_highlight_rules.js | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/lib/ace/mode/svg_highlight_rules.js b/lib/ace/mode/svg_highlight_rules.js index ff03a8d3..25722d72 100644 --- a/lib/ace/mode/svg_highlight_rules.js +++ b/lib/ace/mode/svg_highlight_rules.js @@ -34,28 +34,13 @@ define(function(require, exports, module) { var oop = require("../lib/oop"); var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; -var xmlUtil = require("./xml_util"); var SvgHighlightRules = function() { XmlHighlightRules.call(this); - this.$rules.start.splice(3, 0, { - token : "meta.tag", - regex : "<(?=script)", - next : "script" - }); - - xmlUtil.tag(this.$rules, "script", "js-start"); - - this.embedRules(JavaScriptHighlightRules, "js-", [{ - token: "comment", - regex: "\\/\\/.*(?=<\\/script>)", - next: "tag" - }, { - token: "meta.tag", - regex: "<\\/(?=script)", - next: "tag" - }]); + this.embedTagRules(JavaScriptHighlightRules, "js-", "script"); + + this.normalizeRules(); }; oop.inherits(SvgHighlightRules, XmlHighlightRules); From 969f94d98c94a94bfa4ab7b6e6da28e8bfe1aa1e Mon Sep 17 00:00:00 2001 From: DanyaPostfactum Date: Mon, 24 Jun 2013 21:08:22 +1000 Subject: [PATCH 11/14] Paint xml tag angle brackets in white (monokai theme) --- lib/ace/theme/monokai.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/ace/theme/monokai.css b/lib/ace/theme/monokai.css index 2f34149a..b8041bd2 100644 --- a/lib/ace/theme/monokai.css +++ b/lib/ace/theme/monokai.css @@ -63,6 +63,11 @@ color: #F92672 } +.ace-monokai .ace_punctuation, +.ace-monokai .ace_punctuation.ace_tag { + color: #fff +} + .ace-monokai .ace_constant.ace_character, .ace-monokai .ace_constant.ace_language, .ace-monokai .ace_constant.ace_numeric, From ca97c230f099ceb89df28aa72078db8e5d2ff723 Mon Sep 17 00:00:00 2001 From: DanyaPostfactum Date: Sat, 29 Jun 2013 17:41:16 +1000 Subject: [PATCH 12/14] Proper comment rules in js syntax. --- lib/ace/mode/javascript_highlight_rules.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/ace/mode/javascript_highlight_rules.js b/lib/ace/mode/javascript_highlight_rules.js index 35255c68..f950da89 100644 --- a/lib/ace/mode/javascript_highlight_rules.js +++ b/lib/ace/mode/javascript_highlight_rules.js @@ -86,7 +86,8 @@ var JavaScriptHighlightRules = function() { "no_regex" : [ { token : "comment", - regex : /\/\/.*$/ + regex : "\\/\\/", + next : "line_comment" }, DocCommentHighlightRules.getStartRule("doc-start"), { @@ -216,7 +217,7 @@ var JavaScriptHighlightRules = function() { }, { token : "comment", regex : "\\/\\/", - next : "line_comment" + next : "line_comment_regex_allowed" }, { token: "string.regexp", regex: "\\/", @@ -309,8 +310,12 @@ var JavaScriptHighlightRules = function() { {token : "comment", regex : "\\*\\/", next : "no_regex"}, {defaultToken : "comment"} ], + "line_comment_regex_allowed" : [ + {token : "comment", regex : "$|^", next : "start"}, + {defaultToken : "comment"} + ], "line_comment" : [ - {token : "comment", regex : "$", next : "start"}, + {token : "comment", regex : "$|^", next : "no_regex"}, {defaultToken : "comment"} ], "qqstring" : [ From 88d9a61dc2d408844566056ac524bd332d71b5ab Mon Sep 17 00:00:00 2001 From: DanyaPostfactum Date: Wed, 10 Jul 2013 14:35:24 +1000 Subject: [PATCH 13/14] Fix xml_highlight_rules qstring_inner state name --- lib/ace/mode/xml_highlight_rules.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ace/mode/xml_highlight_rules.js b/lib/ace/mode/xml_highlight_rules.js index 0589ee52..d194b8e7 100644 --- a/lib/ace/mode/xml_highlight_rules.js +++ b/lib/ace/mode/xml_highlight_rules.js @@ -136,7 +136,7 @@ var XmlHighlightRules = function(normalize) { string: [{ token : "string", regex : "'", - push : "string_inner" + push : "qstring_inner" }, { token : "string", regex : '"', From 3c046d2adaad2d57785454abc8b4dd59ccc85085 Mon Sep 17 00:00:00 2001 From: DanyaPostfactum Date: Thu, 11 Jul 2013 00:31:39 +1000 Subject: [PATCH 14/14] Update highlighting tests --- lib/ace/mode/_test/tokens_coldfusion.json | 36 +- lib/ace/mode/_test/tokens_css.json | 16 +- lib/ace/mode/_test/tokens_curly.json | 34 +- lib/ace/mode/_test/tokens_ftl.json | 125 ++--- lib/ace/mode/_test/tokens_html.json | 46 +- lib/ace/mode/_test/tokens_jsp.json | 190 +++---- lib/ace/mode/_test/tokens_liquid.json | 362 +++++++++---- lib/ace/mode/_test/tokens_luapage.json | 599 ++++++++++++++-------- lib/ace/mode/_test/tokens_markdown.json | 12 +- lib/ace/mode/_test/tokens_rhtml.json | 84 +-- lib/ace/mode/_test/tokens_svg.json | 208 ++++---- lib/ace/mode/_test/tokens_xml.json | 38 +- 12 files changed, 1027 insertions(+), 723 deletions(-) diff --git a/lib/ace/mode/_test/tokens_coldfusion.json b/lib/ace/mode/_test/tokens_coldfusion.json index e636d3cf..1f38507a 100644 --- a/lib/ace/mode/_test/tokens_coldfusion.json +++ b/lib/ace/mode/_test/tokens_coldfusion.json @@ -4,23 +4,31 @@ ],[ "start" ],[ - "start", - ["meta.tag","<"], - ["meta.tag.tag-name","cfset"], - ["text"," "], - ["entity.other.attribute-name","welcome"], - ["keyword.operator","="], - ["string","\"Hello World!\""], - ["meta.tag.r",">"] + "start" ],[ "start" ],[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name","cfoutput"], - ["meta.tag.r",">"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","cfset"], + ["text"," "], + ["entity.other.attribute-name","welcome"], + ["keyword.operator.separator","="], + ["string","\"Hello World!\""], + ["punctuation.meta.tag.end",">"] +],[ + "start" +],[ + "start" +],[ + "start" +],[ + "start", + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","cfoutput"], + ["punctuation.meta.tag.end",">"], ["text","#welcome#"], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] ]] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_css.json b/lib/ace/mode/_test/tokens_css.json index 244f0a03..e1a7ba05 100644 --- a/lib/ace/mode/_test/tokens_css.json +++ b/lib/ace/mode/_test/tokens_css.json @@ -76,13 +76,13 @@ "media", ["string","@keyframes blink {"] ],[ - "media_ruleset", + ["ruleset","media"], ["text"," "], ["constant","0"], ["text","% "], ["paren.lparen","{"] ],[ - "media_ruleset", + ["ruleset","media"], ["text"," "], ["support.type","opacity"], ["text",": "], @@ -93,13 +93,13 @@ ["text"," "], ["paren.rparen","}"] ],[ - "media_ruleset", + ["ruleset","media"], ["text"," "], ["constant","40"], ["text","% "], ["paren.lparen","{"] ],[ - "media_ruleset", + ["ruleset","media"], ["text"," "], ["support.type","opacity"], ["text",": "], @@ -110,14 +110,14 @@ ["text"," "], ["paren.rparen","}"] ],[ - "media_ruleset", + ["ruleset","media"], ["text"," "], ["constant","40"], ["variable",".5"], ["text","% "], ["paren.lparen","{"] ],[ - "media_ruleset", + ["ruleset","media"], ["text"," "], ["support.type","opacity"], ["text",": "], @@ -127,13 +127,13 @@ ["text"," "], ["paren.rparen","}"] ],[ - "media_ruleset", + ["ruleset","media"], ["text"," "], ["constant","100"], ["text","% "], ["paren.lparen","{"] ],[ - "media_ruleset", + ["ruleset","media"], ["text"," "], ["support.type","opacity"], ["text",": "], diff --git a/lib/ace/mode/_test/tokens_curly.json b/lib/ace/mode/_test/tokens_curly.json index 14144479..87e39d42 100644 --- a/lib/ace/mode/_test/tokens_curly.json +++ b/lib/ace/mode/_test/tokens_curly.json @@ -9,48 +9,48 @@ ["text","tokenize embedded script"] ],[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name.script","script"], + ["punctuation.meta.tag.begin.script","<"], + ["meta.tag.name.script","script"], ["text"," "], ["entity.other.attribute-name","a"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","'a'"], - ["meta.tag.r",">"], + ["punctuation.meta.tag.end.script",">"], ["storage.type","var"], - ["meta.tag",""], + ["punctuation.meta.tag.begin.script",""], ["text","'123'"] ],[ "start", ["text","tokenize multiline attribute value with double quotes"] ],[ - "tag_qqstring", - ["meta.tag","<"], - ["meta.tag.tag-name.anchor","a"], + ["qqstring_inner","start_tag_stuff"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name.anchor","a"], ["text"," "], ["entity.other.attribute-name","href"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"abc{{xyz}}"] ],[ "start", ["string","def\""], - ["meta.tag.r",">"] + ["punctuation.meta.tag.end",">"] ],[ "start", ["text","tokenize multiline attribute value with single quotes"] ],[ - "tag_qstring", - ["meta.tag","<"], - ["meta.tag.tag-name.anchor","a"], + ["qstring_inner","start_tag_stuff"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name.anchor","a"], ["text"," "], ["entity.other.attribute-name","href"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","'abc"] ],[ "start", ["string","def\\\"'"], - ["meta.tag.r",">"] + ["punctuation.meta.tag.end",">"] ],[ "start" ]] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_ftl.json b/lib/ace/mode/_test/tokens_ftl.json index 19773674..4a1ee640 100644 --- a/lib/ace/mode/_test/tokens_ftl.json +++ b/lib/ace/mode/_test/tokens_ftl.json @@ -28,13 +28,13 @@ ["text"," "], ["keyword","/>"] ],[ - "comment", + "ftl-dcomment", ["comment","<#--"] ],[ - "comment", + "ftl-dcomment", ["comment"," FreeMarker comment"] ],[ - "comment", + "ftl-dcomment", ["comment"," ${abc} <#assign a=12 />"] ],[ "start", @@ -43,100 +43,103 @@ "start" ],[ "start", - ["xml-pe",""] + ["punctuation.doctype.begin",""] ],[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name","html"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","html"], ["text"," "], ["entity.other.attribute-name","lang"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"en-us\""], - ["meta.tag.r",">"] + ["punctuation.meta.tag.end",">"] ],[ "start", ["text"," "], - ["meta.tag","<"], - ["meta.tag.tag-name","head"], - ["meta.tag.r",">"] + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","head"], + ["punctuation.meta.tag.end",">"] ],[ "start", ["text"," "], - ["meta.tag","<"], - ["meta.tag.tag-name","meta"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","meta"], ["text"," "], ["entity.other.attribute-name","charset"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"utf-8\""], ["text"," "], - ["meta.tag.r","/>"] + ["punctuation.meta.tag.end","/>"] ],[ "start", ["text"," "] ],[ "start", ["text"," "], - ["meta.tag","<"], - ["meta.tag.tag-name","title"], - ["meta.tag.r",">"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","title"], + ["punctuation.meta.tag.end",">"], ["string.interpolated","${"], ["variable","title"], ["keyword.operator","!"], ["string","\"FreeMarker\""], ["string.interpolated","}"], - ["meta.tag","<"], - ["meta.tag.tag-name","title"], - ["meta.tag.r",">"] + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","title"], + ["punctuation.meta.tag.end",">"] ],[ "start", ["text"," "], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] ],[ "start", ["text"," "] ],[ "start", ["text"," "], - ["meta.tag","<"], - ["meta.tag.tag-name","body"], - ["meta.tag.r",">"] + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","body"], + ["punctuation.meta.tag.end",">"] ],[ "start", ["text"," "] ],[ "start", ["text"," "], - ["meta.tag","<"], - ["meta.tag.tag-name","h1"], - ["meta.tag.r",">"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","h1"], + ["punctuation.meta.tag.end",">"], ["text","Hello "], ["string.interpolated","${"], ["variable","name"], ["keyword.operator","!"], ["string","\"\""], ["string.interpolated","}"], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] ],[ "start", ["text"," "] ],[ "start", ["text"," "], - ["meta.tag","<"], - ["meta.tag.tag-name","p"], - ["meta.tag.r",">"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","p"], + ["punctuation.meta.tag.end",">"], ["text","Today is: "], ["string.interpolated","${"], ["language.variable",".now"], ["support.function","?date"], ["string.interpolated","}"], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] ],[ "start", ["text"," "] @@ -182,9 +185,9 @@ ],[ "start", ["text"," "], - ["meta.tag","<"], - ["meta.tag.tag-name","ul"], - ["meta.tag.r",">"] + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","ul"], + ["punctuation.meta.tag.end",">"] ],[ "start", ["text"," "], @@ -199,9 +202,9 @@ ],[ "start", ["text"," "], - ["meta.tag","<"], - ["meta.tag.tag-name","li"], - ["meta.tag.r",">"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","li"], + ["punctuation.meta.tag.end",">"], ["string.interpolated","${"], ["variable","item_index"], ["string.interpolated","}"], @@ -219,9 +222,9 @@ ["constant.numeric","0"], ["paren.rparen","]"], ["string.interpolated","}"], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] ],[ "start", ["text"," "], @@ -230,9 +233,9 @@ ],[ "start", ["text"," "], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] ],[ "start", ["text"," "] @@ -306,32 +309,32 @@ ],[ "start", ["text"," "], - ["meta.tag","<"], - ["meta.tag.tag-name.image","img"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name.image","img"], ["text"," "], ["entity.other.attribute-name","src"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"images/"], ["string.interpolated","${"], ["variable","user.id"], ["string.interpolated","}"], ["string",".png\""], ["text"," "], - ["meta.tag.r","/>"] + ["punctuation.meta.tag.end","/>"] ],[ "start", ["text"," "] ],[ "start", ["text"," "], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] ],[ "start", - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] ],[ "start" ]] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_html.json b/lib/ace/mode/_test/tokens_html.json index 726c704f..970ff7d1 100644 --- a/lib/ace/mode/_test/tokens_html.json +++ b/lib/ace/mode/_test/tokens_html.json @@ -1,51 +1,51 @@ [[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name","html"], - ["meta.tag.r",">"] + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","html"], + ["punctuation.meta.tag.end",">"] ],[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name.script","script"], + ["punctuation.meta.tag.begin.script","<"], + ["meta.tag.name.script","script"], ["text"," "], ["entity.other.attribute-name","a"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","'a'"], - ["meta.tag.r",">"], + ["punctuation.meta.tag.end.script",">"], ["storage.type","var"], - ["meta.tag",""], + ["punctuation.meta.tag.begin.script",""], ["text","'123'"] ],[ - "tag_qqstring", - ["meta.tag","<"], - ["meta.tag.tag-name.anchor","a"], + ["qqstring_inner","start_tag_stuff"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name.anchor","a"], ["text"," "], ["entity.other.attribute-name","href"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"abc"] ],[ "start", ["string"," def\""], - ["meta.tag.r",">"] + ["punctuation.meta.tag.end",">"] ],[ - "tag_qstring", - ["meta.tag","<"], - ["meta.tag.tag-name.anchor","a"], + ["qstring_inner","start_tag_stuff"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name.anchor","a"], ["text"," "], ["entity.other.attribute-name","href"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","'abc"] ],[ "start", ["string","def\\'"], - ["meta.tag.r",">"] + ["punctuation.meta.tag.end",">"] ],[ "start" ],[ "start", - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] ]] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_jsp.json b/lib/ace/mode/_test/tokens_jsp.json index b57e5d12..2975fc59 100644 --- a/lib/ace/mode/_test/tokens_jsp.json +++ b/lib/ace/mode/_test/tokens_jsp.json @@ -1,19 +1,19 @@ [[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name","html"], - ["meta.tag.r",">"] + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","html"], + ["punctuation.meta.tag.end",">"] ],[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name","body"], - ["meta.tag.r",">"] + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","body"], + ["punctuation.meta.tag.end",">"] ],[ "js-start", ["text"," "], - ["meta.tag","<"], - ["meta.tag.tag-name.script","script"], - ["meta.tag.r",">"] + ["punctuation.meta.tag.begin.script","<"], + ["meta.tag.name.script","script"], + ["punctuation.meta.tag.end.script",">"] ],[ "js-start", ["text"," "], @@ -40,23 +40,23 @@ ],[ "start", ["text"," "], - ["meta.tag",""] + ["punctuation.meta.tag.begin.script",""] ],[ "css-start", ["text"," "], - ["meta.tag","<"], - ["meta.tag.tag-name.style","style"], - ["meta.tag.r",">"] + ["punctuation.meta.tag.begin.style","<"], + ["meta.tag.name.style","style"], + ["punctuation.meta.tag.end.style",">"] ],[ - "css-ruleset", + ["css-ruleset","css-start"], ["text"," "], ["variable",".class"], ["text"," "], ["paren.lparen","{"] ],[ - "css-ruleset", + ["css-ruleset","css-start"], ["text"," "], ["support.type","background"], ["text",": "], @@ -69,17 +69,17 @@ ],[ "start", ["text"," "], - ["meta.tag",""] + ["punctuation.meta.tag.begin.style",""] ],[ "start" ],[ "start", ["text"," "], - ["meta.tag","<"], - ["meta.tag.tag-name","p"], - ["meta.tag.r",">"] + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","p"], + ["punctuation.meta.tag.end",">"] ],[ "start", ["text"," Today's date: "], @@ -104,9 +104,9 @@ ],[ "start", ["text"," "], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] ],[ "start", ["text"," "], @@ -164,155 +164,155 @@ ],[ "start", ["text"," "], - ["meta.tag","<"], - ["meta.tag.tag-name","h2"], - ["meta.tag.r",">"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","h2"], + ["punctuation.meta.tag.end",">"], ["text","Select Languages:"], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] ],[ "start" ],[ "start", ["text"," "], - ["meta.tag","<"], - ["meta.tag.tag-name.form","form"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name.form","form"], ["text"," "], ["entity.other.attribute-name","ACTION"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"jspCheckBox.jsp\""], - ["meta.tag.r",">"] + ["punctuation.meta.tag.end",">"] ],[ "start", ["text"," "], - ["meta.tag","<"], - ["meta.tag.tag-name.form","input"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name.form","input"], ["text"," "], ["entity.other.attribute-name","type"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"checkbox\""], ["text"," "], ["entity.other.attribute-name","name"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"id\""], ["text"," "], ["entity.other.attribute-name","value"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"Java\""], - ["meta.tag.r",">"], + ["punctuation.meta.tag.end",">"], ["text"," Java"], - ["meta.tag","<"], - ["meta.tag.tag-name","BR"], - ["meta.tag.r",">"] + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","BR"], + ["punctuation.meta.tag.end",">"] ],[ "start", ["text"," "], - ["meta.tag","<"], - ["meta.tag.tag-name.form","input"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name.form","input"], ["text"," "], ["entity.other.attribute-name","type"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"checkbox\""], ["text"," "], ["entity.other.attribute-name","name"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"id\""], ["text"," "], ["entity.other.attribute-name","value"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\".NET\""], - ["meta.tag.r",">"], + ["punctuation.meta.tag.end",">"], ["text"," .NET"], - ["meta.tag","<"], - ["meta.tag.tag-name","BR"], - ["meta.tag.r",">"] + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","BR"], + ["punctuation.meta.tag.end",">"] ],[ "start", ["text"," "], - ["meta.tag","<"], - ["meta.tag.tag-name.form","input"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name.form","input"], ["text"," "], ["entity.other.attribute-name","type"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"checkbox\""], ["text"," "], ["entity.other.attribute-name","name"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"id\""], ["text"," "], ["entity.other.attribute-name","value"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"PHP\""], - ["meta.tag.r",">"], + ["punctuation.meta.tag.end",">"], ["text"," PHP"], - ["meta.tag","<"], - ["meta.tag.tag-name","BR"], - ["meta.tag.r",">"] + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","BR"], + ["punctuation.meta.tag.end",">"] ],[ "start", ["text"," "], - ["meta.tag","<"], - ["meta.tag.tag-name.form","input"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name.form","input"], ["text"," "], ["entity.other.attribute-name","type"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"checkbox\""], ["text"," "], ["entity.other.attribute-name","name"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"id\""], ["text"," "], ["entity.other.attribute-name","value"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"C/C++\""], - ["meta.tag.r",">"], + ["punctuation.meta.tag.end",">"], ["text"," C/C++"], - ["meta.tag","<"], - ["meta.tag.tag-name","BR"], - ["meta.tag.r",">"] + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","BR"], + ["punctuation.meta.tag.end",">"] ],[ "start", ["text"," "], - ["meta.tag","<"], - ["meta.tag.tag-name.form","input"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name.form","input"], ["text"," "], ["entity.other.attribute-name","type"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"checkbox\""], ["text"," "], ["entity.other.attribute-name","name"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"id\""], ["text"," "], ["entity.other.attribute-name","value"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"PERL\""], - ["meta.tag.r",">"], + ["punctuation.meta.tag.end",">"], ["text"," PERL "], - ["meta.tag","<"], - ["meta.tag.tag-name","BR"], - ["meta.tag.r",">"] + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","BR"], + ["punctuation.meta.tag.end",">"] ],[ "start", ["text"," "], - ["meta.tag","<"], - ["meta.tag.tag-name.form","input"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name.form","input"], ["text"," "], ["entity.other.attribute-name","type"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"submit\""], ["text"," "], ["entity.other.attribute-name","value"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"Submit\""], - ["meta.tag.r",">"] + ["punctuation.meta.tag.end",">"] ],[ "start", ["text"," "], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] ],[ "start" ],[ @@ -424,12 +424,12 @@ ["meta.tag","%>"] ],[ "start", - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] ],[ "start", - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] ]] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_liquid.json b/lib/ace/mode/_test/tokens_liquid.json index c218b08e..bd5b085c 100644 --- a/lib/ace/mode/_test/tokens_liquid.json +++ b/lib/ace/mode/_test/tokens_liquid.json @@ -3,51 +3,83 @@ ["text","The following examples can be found in full at http://liquidmarkup.org/"] ],[ "start" +],[ + "start" +],[ + "start" ],[ "start", ["text","Liquid is an extraction from the e-commerce system Shopify."] +],[ + "start" ],[ "start", ["text","Shopify powers many thousands of e-commerce stores which all call for unique designs."] +],[ + "start" ],[ "start", ["text","For this we developed Liquid which allows our customers complete design freedom while"] +],[ + "start" ],[ "start", ["text","maintaining the integrity of our servers."] ],[ "start" +],[ + "start" +],[ + "start" ],[ "start", ["text","Liquid has been in production use since June 2006 and is now used by many other"] +],[ + "start" ],[ "start", ["text","hosted web applications."] ],[ "start" +],[ + "start" +],[ + "start" ],[ "start", ["text","It was developed for usage in Ruby on Rails web applications and integrates seamlessly"] +],[ + "start" ],[ "start", ["text","as a plugin but it also works excellently as a stand alone library."] ],[ "start" +],[ + "start" +],[ + "start" ],[ "start", ["text","Here's what it looks like:"] ],[ "start" +],[ + "start" +],[ + "start" ],[ "start", ["text"," "], - ["meta.tag","<"], - ["meta.tag.tag-name","ul"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","ul"], ["text"," "], ["entity.other.attribute-name","id"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"products\""], - ["meta.tag.r",">"] + ["punctuation.meta.tag.end",">"] +],[ + "start" ],[ "start", ["text"," "], @@ -62,18 +94,22 @@ ["identifier","products"], ["text"," "], ["variable","%}"] +],[ + "start" ],[ "start", ["text"," "], - ["meta.tag","<"], - ["meta.tag.tag-name","li"], - ["meta.tag.r",">"] + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","li"], + ["punctuation.meta.tag.end",">"] +],[ + "start" ],[ "start", ["text"," "], - ["meta.tag","<"], - ["meta.tag.tag-name","h2"], - ["meta.tag.r",">"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","h2"], + ["punctuation.meta.tag.end",">"], ["variable","{{"], ["text"," "], ["identifier","product"], @@ -81,9 +117,11 @@ ["identifier","title"], ["text"," "], ["variable","}}"], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] +],[ + "start" ],[ "start", ["text"," Only "], @@ -98,12 +136,16 @@ ["variable","}}"] ],[ "start" +],[ + "start" +],[ + "start" ],[ "start", ["text"," "], - ["meta.tag","<"], - ["meta.tag.tag-name","p"], - ["meta.tag.r",">"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","p"], + ["punctuation.meta.tag.end",">"], ["variable","{{"], ["text"," "], ["identifier","product"], @@ -117,17 +159,23 @@ ["constant.numeric","200"], ["text"," "], ["variable","}}"], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] +],[ + "start" +],[ + "start" ],[ "start" ],[ "start", ["text"," "], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] +],[ + "start" ],[ "start", ["text"," "], @@ -136,12 +184,20 @@ ["keyword","endfor"], ["text"," "], ["variable","%}"] +],[ + "start" ],[ "start", ["text"," "], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] +],[ + "start" +],[ + "start" +],[ + "start" ],[ "start" ],[ @@ -152,19 +208,25 @@ ],[ "start" ],[ - "start", - ["meta.tag","<"], - ["meta.tag.tag-name","h2"], - ["meta.tag.r",">"], - ["text","Filters"], - ["meta.tag",""] + "start" +],[ + "start" ],[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name","p"], - ["meta.tag.r",">"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","h2"], + ["punctuation.meta.tag.end",">"], + ["text","Filters"], + ["punctuation.meta.tag.begin",""] +],[ + "start" +],[ + "start", + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","p"], + ["punctuation.meta.tag.end",">"], ["text"," The word \"tobi\" in uppercase: "], ["variable","{{"], ["text"," "], @@ -174,14 +236,16 @@ ["text"," "], ["variable","}}"], ["text"," "], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] +],[ + "start" ],[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name","p"], - ["meta.tag.r",">"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","p"], + ["punctuation.meta.tag.end",">"], ["text","The word \"tobi\" has "], ["variable","{{"], ["text"," "], @@ -191,14 +255,16 @@ ["text"," "], ["variable","}}"], ["text"," letters! "], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] +],[ + "start" ],[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name","p"], - ["meta.tag.r",">"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","p"], + ["punctuation.meta.tag.end",">"], ["text","Change \"Hello world\" to \"Hi world\": "], ["variable","{{"], ["text"," "], @@ -212,14 +278,16 @@ ["text"," "], ["variable","}}"], ["text"," "], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] +],[ + "start" ],[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name","p"], - ["meta.tag.r",">"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","p"], + ["punctuation.meta.tag.end",">"], ["text","The date today is "], ["variable","{{"], ["text"," "], @@ -231,27 +299,37 @@ ["text"," "], ["variable","}}"], ["text"," "], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] +],[ + "start" +],[ + "start" +],[ + "start" ],[ "start" ],[ "start" ],[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name","h2"], - ["meta.tag.r",">"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","h2"], + ["punctuation.meta.tag.end",">"], ["text","If"], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] +],[ + "start" ],[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name","p"], - ["meta.tag.r",">"] + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","p"], + ["punctuation.meta.tag.end",">"] +],[ + "start" ],[ "start", ["text"," "], @@ -279,9 +357,13 @@ ["text"," "], ["variable","%}"], ["text"," "] +],[ + "start" ],[ "start", ["text"," hi marc or tobi"] +],[ + "start" ],[ "start", ["text"," "], @@ -290,29 +372,41 @@ ["keyword","endif"], ["text"," "], ["variable","%}"] +],[ + "start" ],[ "start", - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] +],[ + "start" +],[ + "start" +],[ + "start" ],[ "start" ],[ "start" ],[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name","h2"], - ["meta.tag.r",">"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","h2"], + ["punctuation.meta.tag.end",">"], ["text","Case"], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] +],[ + "start" ],[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name","p"], - ["meta.tag.r",">"] + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","p"], + ["punctuation.meta.tag.end",">"] +],[ + "start" ],[ "start", ["text"," "], @@ -323,6 +417,8 @@ ["identifier","template"], ["text"," "], ["variable","%}"] +],[ + "start" ],[ "start", ["text"," "], @@ -333,9 +429,13 @@ ["string","'index'"], ["text"," "], ["variable","%}"] +],[ + "start" ],[ "start", ["text"," Welcome"] +],[ + "start" ],[ "start", ["text"," "], @@ -346,6 +446,8 @@ ["string","'product'"], ["text"," "], ["variable","%}"] +],[ + "start" ],[ "start", ["text"," "], @@ -366,6 +468,8 @@ ["identifier","title"], ["text"," "], ["variable","}}"] +],[ + "start" ],[ "start", ["text"," "], @@ -374,6 +478,8 @@ ["keyword","else"], ["text"," "], ["variable","%}"] +],[ + "start" ],[ "start", ["text"," "], @@ -382,6 +488,8 @@ ["identifier","page_title"], ["text"," "], ["variable","}}"] +],[ + "start" ],[ "start", ["text"," "], @@ -390,29 +498,41 @@ ["keyword","endcase"], ["text"," "], ["variable","%}"] +],[ + "start" ],[ "start", - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] +],[ + "start" +],[ + "start" +],[ + "start" ],[ "start" ],[ "start" ],[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name","h2"], - ["meta.tag.r",">"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","h2"], + ["punctuation.meta.tag.end",">"], ["text","For Loops"], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] +],[ + "start" ],[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name","p"], - ["meta.tag.r",">"] + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","p"], + ["punctuation.meta.tag.end",">"] +],[ + "start" ],[ "start", ["text"," "], @@ -428,6 +548,8 @@ ["text"," "], ["variable","%}"], ["text"," "] +],[ + "start" ],[ "start", ["text"," "], @@ -436,6 +558,8 @@ ["identifier","item"], ["text"," "], ["variable","}}"] +],[ + "start" ],[ "start", ["text"," "], @@ -444,29 +568,41 @@ ["keyword","endfor"], ["text"," "], ["variable","%}"] +],[ + "start" ],[ "start", - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] +],[ + "start" +],[ + "start" +],[ + "start" ],[ "start" ],[ "start" ],[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name","h2"], - ["meta.tag.r",">"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","h2"], + ["punctuation.meta.tag.end",">"], ["text","Tables"], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] +],[ + "start" ],[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name","p"], - ["meta.tag.r",">"] + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","p"], + ["punctuation.meta.tag.end",">"] +],[ + "start" ],[ "start", ["text"," "], @@ -485,6 +621,8 @@ ["constant.numeric","3"], ["text"," "], ["variable","%}"] +],[ + "start" ],[ "start", ["text"," "], @@ -497,6 +635,8 @@ ["identifier","col_first"], ["text"," "], ["variable","%}"] +],[ + "start" ],[ "start", ["text"," First column: "], @@ -507,6 +647,8 @@ ["identifier","variable"], ["text"," "], ["variable","}}"] +],[ + "start" ],[ "start", ["text"," "], @@ -515,6 +657,8 @@ ["keyword","else"], ["text"," "], ["variable","%}"] +],[ + "start" ],[ "start", ["text"," Different column: "], @@ -525,6 +669,8 @@ ["identifier","variable"], ["text"," "], ["variable","}}"] +],[ + "start" ],[ "start", ["text"," "], @@ -533,6 +679,8 @@ ["keyword","endif"], ["text"," "], ["variable","%}"] +],[ + "start" ],[ "start", ["text"," "], @@ -541,11 +689,15 @@ ["keyword","endtablerow"], ["text"," "], ["variable","%}"] +],[ + "start" ],[ "start", - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] +],[ + "start" ],[ "start" ]] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_luapage.json b/lib/ace/mode/_test/tokens_luapage.json index d63f30e9..a460be29 100644 --- a/lib/ace/mode/_test/tokens_luapage.json +++ b/lib/ace/mode/_test/tokens_luapage.json @@ -1,68 +1,81 @@ [[ - "tag_embed_attribute_list", + "doctype", ["text",""], - ["meta.tag","<"], - ["text","!"], - ["entity.other.attribute-name","DOCTYPE"], - ["text"," "], - ["entity.other.attribute-name","html"], - ["text"," "], - ["entity.other.attribute-name","PUBLIC"], - ["text"," "], + ["punctuation.doctype.begin",""] + ["punctuation.doctype.end",">"] +],[ + "start" ],[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name","html"], - ["meta.tag.r",">"] + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","html"], + ["punctuation.meta.tag.end",">"] +],[ + "start" ],[ ["lua-bracketedComment",4,"lua-start"], ["keyword","<%"], ["text"," "], ["comment","--[[--"] +],[ + ["lua-bracketedComment",4,"lua-start"] ],[ ["lua-bracketedComment",4,"lua-start"], ["comment"," index.lp from the Kepler Project's LuaDoc HTML doclet."] +],[ + ["lua-bracketedComment",4,"lua-start"] ],[ ["lua-bracketedComment",4,"lua-start"], ["comment"," http://keplerproject.github.com/luadoc/"] +],[ + ["lua-bracketedComment",4,"lua-start"] ],[ "start", ["comment","--]]"], ["text"," "], ["keyword","%>"] +],[ + "start" ],[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name","head"], - ["meta.tag.r",">"] + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","head"], + ["punctuation.meta.tag.end",">"] +],[ + "start" ],[ "start", ["text"," "], - ["meta.tag","<"], - ["meta.tag.tag-name","title"], - ["meta.tag.r",">"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","title"], + ["punctuation.meta.tag.end",">"], ["text","Reference"], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] +],[ + "start" ],[ "start", ["text"," "], - ["meta.tag","<"], - ["meta.tag.tag-name","link"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","link"], ["text"," "], ["entity.other.attribute-name","rel"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"stylesheet\""], ["text"," "], ["entity.other.attribute-name","href"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\""], ["keyword","<%="], ["identifier","luadoc"], @@ -76,123 +89,161 @@ ["string","\"luadoc.css\""], ["paren.rparen",")"], ["keyword","%>"], - ["text","\" type=\"text/css\" />"] + ["string","\""], + ["text"," "], + ["entity.other.attribute-name","type"], + ["keyword.operator.separator","="], + ["string","\"text/css\""], + ["text"," "], + ["punctuation.meta.tag.end","/>"] +],[ + "start" ],[ "start", ["text","\t"], ["comment",""] +],[ + "start" ],[ "start", - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] +],[ + "start" +],[ + "start" ],[ "start" ],[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name","body"], - ["meta.tag.r",">"] + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","body"], + ["punctuation.meta.tag.end",">"] +],[ + "start" ],[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name","div"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","div"], ["text"," "], ["entity.other.attribute-name","id"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"container\""], - ["meta.tag.r",">"] + ["punctuation.meta.tag.end",">"] +],[ + "start" +],[ + "start" ],[ "start" ],[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name","div"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","div"], ["text"," "], ["entity.other.attribute-name","id"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"product\""], - ["meta.tag.r",">"] + ["punctuation.meta.tag.end",">"] +],[ + "start" ],[ "start", ["text","\t"], - ["meta.tag","<"], - ["meta.tag.tag-name","div"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","div"], ["text"," "], ["entity.other.attribute-name","id"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"product_logo\""], - ["meta.tag.r",">"], - ["meta.tag",""] + ["punctuation.meta.tag.end",">"], + ["punctuation.meta.tag.begin",""] +],[ + "start" ],[ "start", ["text","\t"], - ["meta.tag","<"], - ["meta.tag.tag-name","div"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","div"], ["text"," "], ["entity.other.attribute-name","id"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"product_name\""], - ["meta.tag.r",">"], - ["meta.tag","<"], - ["meta.tag.tag-name","big"], - ["meta.tag.r",">"], - ["meta.tag","<"], - ["meta.tag.tag-name","b"], - ["meta.tag.r",">"], - ["meta.tag",""], - ["meta.tag",""], - ["meta.tag",""] + ["punctuation.meta.tag.end",">"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","big"], + ["punctuation.meta.tag.end",">"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","b"], + ["punctuation.meta.tag.end",">"], + ["punctuation.meta.tag.begin",""], + ["punctuation.meta.tag.begin",""], + ["punctuation.meta.tag.begin",""] +],[ + "start" ],[ "start", ["text","\t"], - ["meta.tag","<"], - ["meta.tag.tag-name","div"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","div"], ["text"," "], ["entity.other.attribute-name","id"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"product_description\""], - ["meta.tag.r",">"], - ["meta.tag",""] + ["punctuation.meta.tag.end",">"], + ["punctuation.meta.tag.begin",""] +],[ + "start" ],[ "start", - ["meta.tag",""], + ["punctuation.meta.tag.begin",""], ["text"," "], ["comment",""] ],[ "start" ],[ - "start", - ["meta.tag","<"], - ["meta.tag.tag-name","div"], - ["text"," "], - ["entity.other.attribute-name","id"], - ["keyword.operator","="], - ["string","\"main\""], - ["meta.tag.r",">"] + "start" ],[ "start" ],[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name","div"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","div"], ["text"," "], ["entity.other.attribute-name","id"], - ["keyword.operator","="], + ["keyword.operator.separator","="], + ["string","\"main\""], + ["punctuation.meta.tag.end",">"] +],[ + "start" +],[ + "start" +],[ + "start" +],[ + "start", + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","div"], + ["text"," "], + ["entity.other.attribute-name","id"], + ["keyword.operator.separator","="], ["string","\"navigation\""], - ["meta.tag.r",">"] + ["punctuation.meta.tag.end",">"] +],[ + "start" ],[ "start", ["keyword","<%="], @@ -216,24 +267,38 @@ ["keyword","%>"] ],[ "start" +],[ + "start" +],[ + "start" ],[ "start", - ["meta.tag",""], + ["punctuation.meta.tag.begin",""], ["text"," "], ["comment",""] ],[ "start" +],[ + "start" +],[ + "start" ],[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name","div"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","div"], ["text"," "], ["entity.other.attribute-name","id"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"content\""], - ["meta.tag.r",">"] + ["punctuation.meta.tag.end",">"] +],[ + "start" +],[ + "start" +],[ + "start" ],[ "start" ],[ @@ -261,26 +326,34 @@ ["text"," "], ["keyword","then%>"] ],[ - "start", - ["meta.tag","<"], - ["meta.tag.tag-name","h2"], - ["meta.tag.r",">"], - ["text","Modules"], - ["meta.tag",""] + "start" ],[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name.table","table"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","h2"], + ["punctuation.meta.tag.end",">"], + ["text","Modules"], + ["punctuation.meta.tag.begin",""] +],[ + "start" +],[ + "start", + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name.table","table"], ["text"," "], ["entity.other.attribute-name","class"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"module_list\""], - ["meta.tag.r",">"] + ["punctuation.meta.tag.end",">"] +],[ + "start" ],[ "start", ["comment",""] +],[ + "start" ],[ "start", ["keyword","<%for"], @@ -299,27 +372,31 @@ ["paren.rparen",")"], ["text"," "], ["keyword","do%>"] +],[ + "start" ],[ "start", ["text","\t"], - ["meta.tag","<"], - ["meta.tag.tag-name.table","tr"], - ["meta.tag.r",">"] + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name.table","tr"], + ["punctuation.meta.tag.end",">"] +],[ + "start" ],[ "start", ["text","\t\t"], - ["meta.tag","<"], - ["meta.tag.tag-name.table","td"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name.table","td"], ["text"," "], ["entity.other.attribute-name","class"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"name\""], - ["meta.tag.r",">"], - ["meta.tag","<"], - ["meta.tag.tag-name.anchor","a"], + ["punctuation.meta.tag.end",">"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name.anchor","a"], ["text"," "], ["entity.other.attribute-name","href"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\""], ["keyword","<%="], ["identifier","luadoc"], @@ -335,26 +412,29 @@ ["identifier","doc"], ["paren.rparen",")"], ["keyword","%>"], - ["text","\">"], + ["string","\""], + ["punctuation.meta.tag.end",">"], ["keyword","<%="], ["identifier","modulename"], ["keyword","%>"], - ["meta.tag",""], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""], + ["punctuation.meta.tag.begin",""] +],[ + "start" ],[ "start", ["text","\t\t"], - ["meta.tag","<"], - ["meta.tag.tag-name.table","td"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name.table","td"], ["text"," "], ["entity.other.attribute-name","class"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"summary\""], - ["meta.tag.r",">"], + ["punctuation.meta.tag.end",">"], ["keyword","<%="], ["identifier","doc"], ["text","."], @@ -365,23 +445,31 @@ ["text","."], ["identifier","summary"], ["keyword","%>"], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] +],[ + "start" ],[ "start", ["text","\t"], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] +],[ + "start" ],[ "start", ["keyword","<%end%>"] +],[ + "start" ],[ "start", - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] +],[ + "start" ],[ "start", ["keyword","<%end%>"] @@ -391,6 +479,14 @@ "start" ],[ "start" +],[ + "start" +],[ + "start" +],[ + "start" +],[ + "start" ],[ "start", ["keyword","<%if"], @@ -414,26 +510,34 @@ ["text"," "], ["keyword","then%>"] ],[ - "start", - ["meta.tag","<"], - ["meta.tag.tag-name","h2"], - ["meta.tag.r",">"], - ["text","Files"], - ["meta.tag",""] + "start" ],[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name.table","table"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","h2"], + ["punctuation.meta.tag.end",">"], + ["text","Files"], + ["punctuation.meta.tag.begin",""] +],[ + "start" +],[ + "start", + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name.table","table"], ["text"," "], ["entity.other.attribute-name","class"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"file_list\""], - ["meta.tag.r",">"] + ["punctuation.meta.tag.end",">"] +],[ + "start" ],[ "start", ["comment",""] +],[ + "start" ],[ "start", ["keyword","<%for"], @@ -452,27 +556,31 @@ ["paren.rparen",")"], ["text"," "], ["keyword","do%>"] +],[ + "start" ],[ "start", ["text","\t"], - ["meta.tag","<"], - ["meta.tag.tag-name.table","tr"], - ["meta.tag.r",">"] + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name.table","tr"], + ["punctuation.meta.tag.end",">"] +],[ + "start" ],[ "start", ["text","\t\t"], - ["meta.tag","<"], - ["meta.tag.tag-name.table","td"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name.table","td"], ["text"," "], ["entity.other.attribute-name","class"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"name\""], - ["meta.tag.r",">"], - ["meta.tag","<"], - ["meta.tag.tag-name.anchor","a"], + ["punctuation.meta.tag.end",">"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name.anchor","a"], ["text"," "], ["entity.other.attribute-name","href"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\""], ["keyword","<%="], ["identifier","luadoc"], @@ -486,43 +594,42 @@ ["identifier","filepath"], ["paren.rparen",")"], ["keyword","%>"], - ["text","\">"], + ["string","\""], + ["punctuation.meta.tag.end",">"], ["keyword","<%="], ["identifier","filepath"], ["keyword","%>"], - ["meta.tag",""], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""], + ["punctuation.meta.tag.begin",""] +],[ + "start" ],[ "start", ["text","\t\t"], - ["meta.tag","<"], - ["meta.tag.tag-name.table","td"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name.table","td"], ["text"," "], ["entity.other.attribute-name","class"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"summary\""], - ["meta.tag.r",">"], - ["meta.tag",""] + ["punctuation.meta.tag.end",">"], + ["punctuation.meta.tag.begin",""] +],[ + "start" ],[ "start", ["text","\t"], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] ],[ - "start", - ["keyword","<%end%>"] -],[ - "start", - ["meta.tag",""] + "start" ],[ "start", ["keyword","<%end%>"] @@ -530,97 +637,135 @@ "start" ],[ "start", - ["meta.tag",""], + ["punctuation.meta.tag.begin",""] +],[ + "start" +],[ + "start", + ["keyword","<%end%>"] +],[ + "start" +],[ + "start" +],[ + "start" +],[ + "start", + ["punctuation.meta.tag.begin",""], ["text"," "], ["comment",""] ],[ "start" +],[ + "start" +],[ + "start" ],[ "start", - ["meta.tag",""], + ["punctuation.meta.tag.begin",""], ["text"," "], ["comment",""] ],[ "start" +],[ + "start" +],[ + "start" ],[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name","div"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","div"], ["text"," "], ["entity.other.attribute-name","id"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"about\""], - ["meta.tag.r",">"] + ["punctuation.meta.tag.end",">"] +],[ + "start" ],[ "start", ["text","\t"], - ["meta.tag","<"], - ["meta.tag.tag-name","p"], - ["meta.tag.r",">"], - ["meta.tag","<"], - ["meta.tag.tag-name.anchor","a"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","p"], + ["punctuation.meta.tag.end",">"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name.anchor","a"], ["text"," "], ["entity.other.attribute-name","href"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"http://validator.w3.org/check?uri=referer\""], - ["meta.tag.r",">"], - ["meta.tag","<"], - ["meta.tag.tag-name.image","img"], + ["punctuation.meta.tag.end",">"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name.image","img"], ["text"," "], ["entity.other.attribute-name","src"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"http://www.w3.org/Icons/valid-xhtml10\""], ["text"," "], ["entity.other.attribute-name","alt"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"Valid XHTML 1.0!\""], ["text"," "], ["entity.other.attribute-name","height"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"31\""], ["text"," "], ["entity.other.attribute-name","width"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"88\""], ["text"," "], - ["meta.tag.r","/>"], - ["meta.tag",""], - ["meta.tag",""] + ["punctuation.meta.tag.end","/>"], + ["punctuation.meta.tag.begin",""], + ["punctuation.meta.tag.begin",""] +],[ + "start" ],[ "start", - ["meta.tag",""], + ["punctuation.meta.tag.begin",""], ["text"," "], ["comment",""] ],[ "start" +],[ + "start" +],[ + "start" ],[ "start", - ["meta.tag",""], + ["punctuation.meta.tag.begin",""], ["text"," "], ["comment",""], ["text","\t"] ],[ - "start", - ["meta.tag",""] + "start" ],[ "start", - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] +],[ + "start" +],[ + "start", + ["punctuation.meta.tag.begin",""] +],[ + "start" ],[ "start" ]] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_markdown.json b/lib/ace/mode/_test/tokens_markdown.json index 91f7f992..12b7cde6 100644 --- a/lib/ace/mode/_test/tokens_markdown.json +++ b/lib/ace/mode/_test/tokens_markdown.json @@ -80,13 +80,13 @@ ],[ "start", ["text","in plain text "], - ["meta.tag","<"], - ["meta.tag.tag-name","b"], - ["meta.tag.r",">"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","b"], + ["punctuation.meta.tag.end",">"], ["text","http://ace.ajaxorg.com"], - ["meta.tag","<"], - ["meta.tag.tag-name","b"], - ["meta.tag.r",">"] + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","b"], + ["punctuation.meta.tag.end",">"] ],[ "allowBlock" ],[ diff --git a/lib/ace/mode/_test/tokens_rhtml.json b/lib/ace/mode/_test/tokens_rhtml.json index e3c1fdf1..4aee9702 100644 --- a/lib/ace/mode/_test/tokens_rhtml.json +++ b/lib/ace/mode/_test/tokens_rhtml.json @@ -1,55 +1,55 @@ [[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name","html"], - ["meta.tag.r",">"] + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","html"], + ["punctuation.meta.tag.end",">"] ],[ "start" ],[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name","head"], - ["meta.tag.r",">"] + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","head"], + ["punctuation.meta.tag.end",">"] ],[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name","title"], - ["meta.tag.r",">"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","title"], + ["punctuation.meta.tag.end",">"], ["text","Title"], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] ],[ "start", - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] ],[ "start" ],[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name","body"], - ["meta.tag.r",">"] + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","body"], + ["punctuation.meta.tag.end",">"] ],[ "start" ],[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name","p"], - ["meta.tag.r",">"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","p"], + ["punctuation.meta.tag.end",">"], ["text","This is an R HTML document. When you click the "], - ["meta.tag","<"], - ["meta.tag.tag-name","b"], - ["meta.tag.r",">"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","b"], + ["punctuation.meta.tag.end",">"], ["text","Knit HTML"], - ["meta.tag",""], + ["punctuation.meta.tag.begin",""], ["text"," button a web page will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:"], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] ],[ "start" ],[ @@ -68,13 +68,13 @@ "start" ],[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name","p"], - ["meta.tag.r",">"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","p"], + ["punctuation.meta.tag.end",">"], ["text","You can also embed plots, for example:"], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] ],[ "start" ],[ @@ -93,14 +93,14 @@ "start" ],[ "start", - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] ],[ "start", - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] ],[ "start" ]] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_svg.json b/lib/ace/mode/_test/tokens_svg.json index efaa0fca..671f2918 100644 --- a/lib/ace/mode/_test/tokens_svg.json +++ b/lib/ace/mode/_test/tokens_svg.json @@ -1,68 +1,65 @@ [[ - "tag_embed_attribute_list", - ["meta.tag","<"], - ["meta.tag.tag-name","svg"] + "punctuation.meta.tag.begin", + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","svg"] ],[ - "tag_embed_attribute_list", + "punctuation.meta.tag.begin", ["text"," "], ["entity.other.attribute-name","width"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"800\""], ["text"," "], ["entity.other.attribute-name","height"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"600\""] ],[ - "tag_embed_attribute_list", + "punctuation.meta.tag.begin", ["text"," "], ["entity.other.attribute-name","xmlns"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"http://www.w3.org/2000/svg\""] ],[ "start", ["text"," "], ["entity.other.attribute-name","onload"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"StartAnimation(evt)\""], - ["meta.tag.r",">"] + ["punctuation.meta.tag.end",">"] ],[ "start" ],[ "start", ["text"," "], - ["meta.tag","<"], - ["meta.tag.tag-name","title"], - ["meta.tag.r",">"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","title"], + ["punctuation.meta.tag.end",">"], ["text","Test Tube Progress Bar"], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] ],[ "start", ["text"," "], - ["meta.tag","<"], - ["meta.tag.tag-name","desc"], - ["meta.tag.r",">"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","desc"], + ["punctuation.meta.tag.end",">"], ["text","Created for the Web Directions SVG competition"], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] ],[ "start" ],[ - "js-start", + "js-no_regex", ["text"," "], - ["meta.tag","<"], - ["meta.tag.tag-name","script"], + ["punctuation.meta.tag.begin.script","<"], + ["meta.tag.name.script","script"], ["text"," "], ["entity.other.attribute-name","type"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"text/ecmascript\""], - ["meta.tag.r",">"], - ["keyword.operator",""], + ["string.begin",""], - ["meta.tag",""] + ["string.end","]]>"], + ["punctuation.meta.tag.begin.script",""] ],[ "start" ],[ - "tag_embed_attribute_list", + "punctuation.meta.tag.begin", ["text"," "], - ["meta.tag","<"], - ["meta.tag.tag-name","rect"] + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","rect"] ],[ - "tag_embed_attribute_list", + "punctuation.meta.tag.begin", ["text"," "], ["entity.other.attribute-name","fill"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"#2e3436\""] ],[ - "tag_embed_attribute_list", + "punctuation.meta.tag.begin", ["text"," "], ["entity.other.attribute-name","fill-rule"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"nonzero\""] ],[ - "tag_embed_attribute_list", + "punctuation.meta.tag.begin", ["text"," "], ["entity.other.attribute-name","stroke-width"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"3\""] ],[ - "tag_embed_attribute_list", + "punctuation.meta.tag.begin", ["text"," "], ["entity.other.attribute-name","y"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"0\""] ],[ - "tag_embed_attribute_list", + "punctuation.meta.tag.begin", ["text"," "], ["entity.other.attribute-name","x"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"0\""] ],[ - "tag_embed_attribute_list", + "punctuation.meta.tag.begin", ["text"," "], ["entity.other.attribute-name","height"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"600\""] ],[ - "tag_embed_attribute_list", + "punctuation.meta.tag.begin", ["text"," "], ["entity.other.attribute-name","width"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"800\""] ],[ "start", ["text"," "], ["entity.other.attribute-name","id"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"rect3590\""], - ["meta.tag.r","/>"] + ["punctuation.meta.tag.end","/>"] ],[ "start" ],[ - "tag_embed_attribute_list", + "punctuation.meta.tag.begin", ["text"," "], - ["meta.tag","<"], - ["meta.tag.tag-name","text"] + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","text"] ],[ - "tag_embed_attribute_list", + "punctuation.meta.tag.begin", ["text"," "], ["entity.other.attribute-name","style"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"font-size:144px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold\""] ],[ - "tag_embed_attribute_list", + "punctuation.meta.tag.begin", ["text"," "], ["entity.other.attribute-name","x"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"50\""] ],[ - "tag_embed_attribute_list", + "punctuation.meta.tag.begin", ["text"," "], ["entity.other.attribute-name","y"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"350\""] ],[ - "tag_embed_attribute_list", + "punctuation.meta.tag.begin", ["text"," "], ["entity.other.attribute-name","id"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"hickory\""] ],[ "start", ["text"," "], ["entity.other.attribute-name","display"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"none\""], - ["meta.tag.r",">"] + ["punctuation.meta.tag.end",">"] ],[ "start", ["text"," Hickory,"], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] ],[ - "tag_embed_attribute_list", + "punctuation.meta.tag.begin", ["text"," "], - ["meta.tag","<"], - ["meta.tag.tag-name","text"] + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","text"] ],[ - "tag_embed_attribute_list", + "punctuation.meta.tag.begin", ["text"," "], ["entity.other.attribute-name","style"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"font-size:144px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold\""] ],[ - "tag_embed_attribute_list", + "punctuation.meta.tag.begin", ["text"," "], ["entity.other.attribute-name","x"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"50\""] ],[ - "tag_embed_attribute_list", + "punctuation.meta.tag.begin", ["text"," "], ["entity.other.attribute-name","y"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"350\""] ],[ - "tag_embed_attribute_list", + "punctuation.meta.tag.begin", ["text"," "], ["entity.other.attribute-name","id"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"dickory\""] ],[ "start", ["text"," "], ["entity.other.attribute-name","display"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"none\""], - ["meta.tag.r",">"] + ["punctuation.meta.tag.end",">"] ],[ "start", ["text"," dickory,"], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] ],[ - "tag_embed_attribute_list", + "punctuation.meta.tag.begin", ["text"," "], - ["meta.tag","<"], - ["meta.tag.tag-name","text"] + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","text"] ],[ - "tag_embed_attribute_list", + "punctuation.meta.tag.begin", ["text"," "], ["entity.other.attribute-name","style"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"font-size:144px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold\""] ],[ - "tag_embed_attribute_list", + "punctuation.meta.tag.begin", ["text"," "], ["entity.other.attribute-name","x"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"50\""] ],[ - "tag_embed_attribute_list", + "punctuation.meta.tag.begin", ["text"," "], ["entity.other.attribute-name","y"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"350\""] ],[ - "tag_embed_attribute_list", + "punctuation.meta.tag.begin", ["text"," "], ["entity.other.attribute-name","id"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"dock\""] ],[ "start", ["text"," "], ["entity.other.attribute-name","display"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"none\""], - ["meta.tag.r",">"] + ["punctuation.meta.tag.end",">"] ],[ "start", ["text"," dock!"], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] ],[ "start", - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] ]] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_xml.json b/lib/ace/mode/_test/tokens_xml.json index f7c1ed64..40c67a5d 100644 --- a/lib/ace/mode/_test/tokens_xml.json +++ b/lib/ace/mode/_test/tokens_xml.json @@ -1,43 +1,43 @@ [[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name","Juhu"], - ["meta.tag.r",">"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","Juhu"], + ["punctuation.meta.tag.end",">"], ["text","//Juhu Kinners"], - ["meta.tag",""] + ["punctuation.meta.tag.begin",""] ],[ "start", ["text","test: two tags in the same lines should be in separate tokens\""] ],[ "start", - ["meta.tag","<"], - ["meta.tag.tag-name","Juhu"], - ["meta.tag.r",">"], - ["meta.tag","<"], - ["meta.tag.tag-name","Kinners"], - ["meta.tag.r",">"] + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","Juhu"], + ["punctuation.meta.tag.end",">"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","Kinners"], + ["punctuation.meta.tag.end",">"] ],[ "start", ["text","test: multiline attributes\""] ],[ - "tag_qqstring", - ["meta.tag","<"], - ["meta.tag.tag-name","copy"], + ["qqstring_inner","punctuation.meta.tag.begin"], + ["punctuation.meta.tag.begin","<"], + ["meta.tag.name","copy"], ["text"," "], ["entity.other.attribute-name","set"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"{"] ],[ - "tag_qqstring", + ["qqstring_inner","punctuation.meta.tag.begin"], ["string","}\""], ["text"," "], ["entity.other.attribute-name","undo"], - ["keyword.operator","="], + ["keyword.operator.separator","="], ["string","\"{"] ],[ "start", ["string","}\""], - ["meta.tag.r","/>"] + ["punctuation.meta.tag.end","/>"] ]] \ No newline at end of file