From 2adc4c7c964373a9f92d729b619d89549265beef Mon Sep 17 00:00:00 2001 From: nightwing Date: Sat, 4 May 2013 16:03:27 +0400 Subject: [PATCH 01/11] fix python string highlighting --- lib/ace/mode/python_highlight_rules.js | 70 ++++++++++++++++++-------- 1 file changed, 50 insertions(+), 20 deletions(-) diff --git a/lib/ace/mode/python_highlight_rules.js b/lib/ace/mode/python_highlight_rules.js index 0e7a8bde..ccb40675 100644 --- a/lib/ace/mode/python_highlight_rules.js +++ b/lib/ace/mode/python_highlight_rules.js @@ -84,30 +84,28 @@ var PythonHighlightRules = function() { var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + exponent + ")"; var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")"; + var stringEscape = "\\\\(x[0-9A-Fa-f]{2}|[0-7]{3}|[\\\\abfnrtv'\"]|U[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})"; + this.$rules = { "start" : [ { token : "comment", regex : "#.*$" - }, { - token : "string", // """ string - regex : strPre + '"{3}(?:[^\\\\]|\\\\.)*?"{3}' }, { token : "string", // multi line """ string start - regex : strPre + '"{3}.*$', - next : "qqstring" + regex : strPre + '"{3}', + next : "qqstring3" }, { token : "string", // " string - regex : strPre + '"(?:[^\\\\]|\\\\.)*?"' - }, { - token : "string", // ''' string - regex : strPre + "'{3}(?:[^\\\\]|\\\\.)*?'{3}" + regex : strPre + '"(?=.)', + next : "qqstring" }, { token : "string", // multi line ''' string start - regex : strPre + "'{3}.*$", - next : "qstring" + regex : strPre + "'{3}", + next : "qstring3" }, { token : "string", // ' string - regex : strPre + "'(?:[^\\\\]|\\\\.)*?'" + regex : strPre + "'(?=.)", + next : "qstring" }, { token : "constant.numeric", // imaginary regex : "(?:" + floatNumber + "|\\d+)[jJ]\\b" @@ -136,22 +134,54 @@ var PythonHighlightRules = function() { token : "text", regex : "\\s+" } ], - "qqstring" : [ { + "qqstring3" : [ { + token : "constant.language.escape", + regex : stringEscape + }, { token : "string", // multi line """ string end - regex : '(?:[^\\\\]|\\\\.)*?"{3}', + regex : '"{3}', next : "start" }, { - token : "string", - regex : '.+' + defaultToken : "string" } ], - "qstring" : [ { + "qstring3" : [ { + token : "constant.language.escape", + regex : stringEscape + }, { token : "string", // multi line ''' string end - regex : "(?:[^\\\\]|\\\\.)*?'{3}", + regex : "'{3}", next : "start" + }, { + defaultToken : "string" + } ], + "qqstring" : [{ + token : "constant.language.escape", + regex : stringEscape }, { token : "string", - regex : '.+' - } ] + regex : "\\\\$", + next : "qqstring" + }, { + token : "string", + regex : '"|$', + next : "start" + }, { + defaultToken: "string" + }], + "qstring" : [{ + token : "constant.language.escape", + regex : stringEscape + }, { + token : "string", + regex : "\\\\$", + next : "qstring" + }, { + token : "string", + regex : "'|$", + next : "start" + }, { + defaultToken: "string" + }] }; }; From e0334c6f6c8b96a4f22985e639f246439b459ad8 Mon Sep 17 00:00:00 2001 From: nightwing Date: Tue, 7 May 2013 21:45:18 +0400 Subject: [PATCH 02/11] fix embedding of rules with push/pop --- lib/ace/mode/text_highlight_rules.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ace/mode/text_highlight_rules.js b/lib/ace/mode/text_highlight_rules.js index e3d7163f..5d418ec8 100644 --- a/lib/ace/mode/text_highlight_rules.js +++ b/lib/ace/mode/text_highlight_rules.js @@ -56,7 +56,11 @@ var TextHighlightRules = function() { for (var i = 0; i < state.length; i++) { var rule = state[i]; if (rule.next) { - rule.next = prefix + rule.next; + if (typeof rule.next != "string") + rule.nextState = prefix + rule.nextState; + else + rule.next = prefix + rule.next; + } } this.$rules[prefix + key] = state; From 5e2ee7a45e00c6b6d5b3bb11f464d9507ed07956 Mon Sep 17 00:00:00 2001 From: nightwing Date: Tue, 7 May 2013 22:49:28 +0400 Subject: [PATCH 03/11] update tests --- lib/ace/mode/_test/tokens_python.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/ace/mode/_test/tokens_python.json b/lib/ace/mode/_test/tokens_python.json index bab30374..293c8ff2 100644 --- a/lib/ace/mode/_test/tokens_python.json +++ b/lib/ace/mode/_test/tokens_python.json @@ -29,7 +29,7 @@ ["constant.numeric","1"], ["text",":"] ],[ - "qstring", + "qstring3", ["text"," "], ["keyword","print"], ["text"," "], @@ -129,7 +129,11 @@ ["text"," "], ["keyword","print"], ["text"," "], - ["string","'%i\\260F = %i\\260C'"], + ["string","'%i"], + ["constant.language.escape","\\260"], + ["string","F = %i"], + ["constant.language.escape","\\260"], + ["string","C'"], ["text"," "], ["keyword.operator","%"], ["text"," "], From d7b62038c0fff9236ece65e00c53295d76ad8921 Mon Sep 17 00:00:00 2001 From: nightwing Date: Wed, 8 May 2013 15:04:16 +0400 Subject: [PATCH 04/11] disable broken r behaviors --- lib/ace/mode/r.js | 6 ++++-- lib/ace/mode/rhtml.js | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/ace/mode/r.js b/lib/ace/mode/r.js index 0c60c120..a5421a81 100644 --- a/lib/ace/mode/r.js +++ b/lib/ace/mode/r.js @@ -36,7 +36,9 @@ define(function(require, exports, module) { (function() { - this.tokenRe = new RegExp("^[" + this.lineCommentStart = "#"; + // todo import codeModel from RStudio + /*this.tokenRe = new RegExp("^[" + unicode.packages.L + unicode.packages.Mn + unicode.packages.Mc + unicode.packages.Nd @@ -126,7 +128,7 @@ define(function(require, exports, module) { } } return false; - }; + };*/ }).call(Mode.prototype); exports.Mode = Mode; }); diff --git a/lib/ace/mode/rhtml.js b/lib/ace/mode/rhtml.js index c45f85ac..99885dbf 100644 --- a/lib/ace/mode/rhtml.js +++ b/lib/ace/mode/rhtml.js @@ -56,10 +56,10 @@ oop.inherits(Mode, HtmlMode); return this.$session.getState(position.row).match(/^r-/) ? 'R' : 'HTML'; }; - this.getNextLineIndent = function(state, line, tab, tabSize, row) + /* this.getNextLineIndent = function(state, line, tab, tabSize, row) { return this.codeModel.getNextLineIndent(row, line, state, tab, tabSize); - }; + }; */ }).call(Mode.prototype); From 495318ef6b57f61aa1edae9067e60ad84177a84b Mon Sep 17 00:00:00 2001 From: nightwing Date: Wed, 8 May 2013 15:37:12 +0400 Subject: [PATCH 05/11] fix #1413 Invalid number value breaks CSS mode --- demo/kitchen-sink/docs/css.css | 2 +- lib/ace/mode/_test/tokens_css.json | 2 +- lib/ace/tokenizer.js | 9 ++++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/demo/kitchen-sink/docs/css.css b/demo/kitchen-sink/docs/css.css index a4c3b4fd..0ebe5f2d 100644 --- a/demo/kitchen-sink/docs/css.css +++ b/demo/kitchen-sink/docs/css.css @@ -1,6 +1,6 @@ .text-layer { font-family: Monaco, "Courier New", monospace; - font-size: 12px; + font-size: 12pX; cursor: text; } diff --git a/lib/ace/mode/_test/tokens_css.json b/lib/ace/mode/_test/tokens_css.json index dec51e37..244f0a03 100644 --- a/lib/ace/mode/_test/tokens_css.json +++ b/lib/ace/mode/_test/tokens_css.json @@ -18,7 +18,7 @@ ["support.type","font-size"], ["text",": "], ["constant.numeric","12"], - ["keyword","px"], + ["keyword","pX"], ["text",";"] ],[ "ruleset", diff --git a/lib/ace/tokenizer.js b/lib/ace/tokenizer.js index 3b683fa5..c4c3a928 100644 --- a/lib/ace/tokenizer.js +++ b/lib/ace/tokenizer.js @@ -58,6 +58,7 @@ var Tokenizer = function(rules) { var mapping = this.matchMappings[key] = {defaultToken: "text"}; var flag = "g"; + var spliterRurles = []; for (var i = 0; i < state.length; i++) { var rule = state[i]; if (rule.defaultToken) @@ -104,7 +105,7 @@ var Tokenizer = function(rules) { adjustedregex = this.removeCapturingGroups(rule.regex); } if (!rule.splitRegex && typeof rule.token != "string") - rule.splitRegex = this.createSplitterRegexp(rule.regex, flag); + spliterRurles.push(rule); // flag will be known only at the very end } mapping[matchTotal] = i; @@ -117,6 +118,10 @@ var Tokenizer = function(rules) { rule.onMatch = null; rule.__proto__ = null; } + + spliterRurles.forEach(function(rule) { + rule.splitRegex = this.createSplitterRegexp(rule.regex, flag); + }, this); this.regExps[key] = new RegExp("(" + ruleRegExps.join(")|(") + ")|($)", flag); } @@ -146,6 +151,8 @@ var Tokenizer = function(rules) { if (!str) return []; var values = this.splitRegex.exec(str); + if (!values) + return "text"; var tokens = []; var types = this.tokenArray; for (var i = 0, l = types.length; i < l; i++) { From d3cc3ab5aa9446d2205c5cb557800c0291678fe6 Mon Sep 17 00:00:00 2001 From: nightwing Date: Wed, 8 May 2013 15:38:40 +0400 Subject: [PATCH 06/11] do not autoclose tags after %#? etc --- lib/ace/mode/behaviour/html.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/ace/mode/behaviour/html.js b/lib/ace/mode/behaviour/html.js index c15aa8b4..cc084ef2 100644 --- a/lib/ace/mode/behaviour/html.js +++ b/lib/ace/mode/behaviour/html.js @@ -59,6 +59,9 @@ var HtmlBehaviour = function () { var position = editor.getCursorPosition(); var iterator = new TokenIterator(session, position.row, position.column); var token = iterator.getCurrentToken(); + var ch = session.getLine(position.row)[position.column - 1]; + if (!/[\w:."'\s]/.test(ch)) + return; var atCursor = false; if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ do { From 790bc5e87a059f7d539811428776cb2f1c6c19e1 Mon Sep 17 00:00:00 2001 From: nightwing Date: Wed, 8 May 2013 18:44:37 +0400 Subject: [PATCH 07/11] add erb mode --- demo/kitchen-sink/doclist.js | 1 + demo/kitchen-sink/docs/html_ruby.erb | 25 ++++++++ lib/ace/ext/modelist.js | 4 +- lib/ace/mode/html_highlight_rules.js | 2 +- lib/ace/mode/html_ruby.js | 61 +++++++++++++++++++ lib/ace/mode/html_ruby_highlight_rules.js | 74 +++++++++++++++++++++++ 6 files changed, 165 insertions(+), 2 deletions(-) create mode 100644 demo/kitchen-sink/docs/html_ruby.erb create mode 100644 lib/ace/mode/html_ruby.js create mode 100644 lib/ace/mode/html_ruby_highlight_rules.js diff --git a/demo/kitchen-sink/doclist.js b/demo/kitchen-sink/doclist.js index 5c4a528d..de77b359 100644 --- a/demo/kitchen-sink/doclist.js +++ b/demo/kitchen-sink/doclist.js @@ -85,6 +85,7 @@ var docs = { "docs/haml.haml": "Haml", "docs/Haxe.hx": "haXe", "docs/html.html": "HTML", + "docs/html_ruby.erb": "HTML (Ruby)", "docs/jade.jade": "Jade", "docs/java.java": "Java", "docs/jsp.jsp": "JSP", diff --git a/demo/kitchen-sink/docs/html_ruby.erb b/demo/kitchen-sink/docs/html_ruby.erb new file mode 100644 index 00000000..4ece6c8b --- /dev/null +++ b/demo/kitchen-sink/docs/html_ruby.erb @@ -0,0 +1,25 @@ +

Listing Books

+ + + + + + + + + + +<% @books.each do |book| %> + + + + + + + +<% end %> +
TitleSummary
<%= book.title %><%= book.content %><%= link_to 'Show', book %><%= link_to 'Edit', edit_book_path(book) %><%= link_to 'Remove', book, :confirm => 'Are you sure?', :method => :delete %>
+ +
+ +<%= link_to 'New book', new_book_path %> \ No newline at end of file diff --git a/lib/ace/ext/modelist.js b/lib/ace/ext/modelist.js index 536d9430..2414688c 100644 --- a/lib/ace/ext/modelist.js +++ b/lib/ace/ext/modelist.js @@ -68,6 +68,7 @@ var supportedModes = { Haskell: ["hs"], haXe: ["hx"], HTML: ["htm|html|xhtml"], + HTML_Ruby: ["erb|rhtml|html.erb"], Ini: ["Ini|conf"], Jade: ["jade"], Java: ["java"], @@ -133,7 +134,8 @@ var nameOverrides = { CSharp: "C#", golang: "Go", C_Cpp: "C/C++", - coffee: "CoffeeScript" + coffee: "CoffeeScript", + HTML_Ruby: "HTML (Ruby)" }; var modesByName = {}; for (var name in supportedModes) { diff --git a/lib/ace/mode/html_highlight_rules.js b/lib/ace/mode/html_highlight_rules.js index d072a933..b7e73805 100644 --- a/lib/ace/mode/html_highlight_rules.js +++ b/lib/ace/mode/html_highlight_rules.js @@ -86,7 +86,7 @@ var HtmlHighlightRules = function() { next : "style" }, { token : "meta.tag", // opening tag - regex : "<\\/?", + regex : "<\\/?(?=\\w)", next : "tag" }, { token : "text", diff --git a/lib/ace/mode/html_ruby.js b/lib/ace/mode/html_ruby.js new file mode 100644 index 00000000..5fed54c1 --- /dev/null +++ b/lib/ace/mode/html_ruby.js @@ -0,0 +1,61 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2012, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + + +define(function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var Tokenizer = require("../tokenizer").Tokenizer; +var HtmlRubyHighlightRules = require("./html_ruby_highlight_rules").HtmlRubyHighlightRules; +var HtmlMode = require("./html").Mode; +var JavaScriptMode = require("./javascript").Mode; +var CssMode = require("./css").Mode; +var RubyMode = require("./ruby").Mode; + +var Mode = function() { + HtmlMode.call(this); + var highlighter = new HtmlRubyHighlightRules(); + this.$tokenizer = new Tokenizer(highlighter.getRules()); + this.$embeds = highlighter.getEmbeds(); + this.createModeDelegates({ + "js-": JavaScriptMode, + "css-": CssMode, + "ruby-": RubyMode + }); +}; +oop.inherits(Mode, HtmlMode); + +(function() { + +}).call(Mode.prototype); + +exports.Mode = Mode; +}); \ No newline at end of file diff --git a/lib/ace/mode/html_ruby_highlight_rules.js b/lib/ace/mode/html_ruby_highlight_rules.js new file mode 100644 index 00000000..bcfbf1c4 --- /dev/null +++ b/lib/ace/mode/html_ruby_highlight_rules.js @@ -0,0 +1,74 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2012, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { + "use strict"; + + var oop = require("../lib/oop"); + var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; + var RubyHighlightRules = require("./ruby_highlight_rules").RubyHighlightRules; + + var HtmlRubyHighlightRules = function() { + HtmlHighlightRules.call(this); + + for (var i in this.$rules) { + this.$rules[i].unshift({ + regex: "<%%|%%>", + token: "constant.language.escape" + }, { + 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: /#(?:[^%]|%[^>])*/ + }); + + this.normalizeRules(); + }; + + + oop.inherits(HtmlRubyHighlightRules, HtmlHighlightRules); + + exports.HtmlRubyHighlightRules = HtmlRubyHighlightRules; +}); \ No newline at end of file From c4aa28793f9c75a6e12cd48433c5f46b712381ca Mon Sep 17 00:00:00 2001 From: nightwing Date: Wed, 8 May 2013 19:03:57 +0400 Subject: [PATCH 08/11] fix tests --- lib/ace/mode/html_highlight_rules.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ace/mode/html_highlight_rules.js b/lib/ace/mode/html_highlight_rules.js index b7e73805..d80ec2de 100644 --- a/lib/ace/mode/html_highlight_rules.js +++ b/lib/ace/mode/html_highlight_rules.js @@ -86,7 +86,7 @@ var HtmlHighlightRules = function() { next : "style" }, { token : "meta.tag", // opening tag - regex : "<\\/?(?=\\w)", + regex : "<\\/?(?=\\S)", next : "tag" }, { token : "text", From e84ec9e27a20d8dd980ed44e0e920a047de84f7a Mon Sep 17 00:00:00 2001 From: nightwing Date: Thu, 9 May 2013 15:22:14 +0400 Subject: [PATCH 09/11] do not autoclose tags inside of strings --- lib/ace/mode/behaviour/html.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ace/mode/behaviour/html.js b/lib/ace/mode/behaviour/html.js index cc084ef2..e7a74cf9 100644 --- a/lib/ace/mode/behaviour/html.js +++ b/lib/ace/mode/behaviour/html.js @@ -59,8 +59,8 @@ var HtmlBehaviour = function () { var position = editor.getCursorPosition(); var iterator = new TokenIterator(session, position.row, position.column); var token = iterator.getCurrentToken(); - var ch = session.getLine(position.row)[position.column - 1]; - if (!/[\w:."'\s]/.test(ch)) + + if (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('/'))){ From a09165c64bc8c821b09ca4333d5d4dfebf011a63 Mon Sep 17 00:00:00 2001 From: nightwing Date: Thu, 9 May 2013 19:50:14 +0400 Subject: [PATCH 10/11] fix #1417 vbFalse typo --- lib/ace/mode/vbscript_highlight_rules.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ace/mode/vbscript_highlight_rules.js b/lib/ace/mode/vbscript_highlight_rules.js index e588dfe3..b276736a 100644 --- a/lib/ace/mode/vbscript_highlight_rules.js +++ b/lib/ace/mode/vbscript_highlight_rules.js @@ -181,7 +181,7 @@ var VBScriptHighlightRules = function() { token: [ "support.type.vb.asp" ], - regex: "(?:\\b(vbtrue|fvbalse|vbcr|vbcrlf|vbformfeed|vblf|vbnewline|vbnullchar|vbnullstring|int32|vbtab|vbverticaltab|vbbinarycompare|vbtextcomparevbsunday|vbmonday|vbtuesday|vbwednesday|vbthursday|vbfriday|vbsaturday|vbusesystemdayofweek|vbfirstjan1|vbfirstfourdays|vbfirstfullweek|vbgeneraldate|vblongdate|vbshortdate|vblongtime|vbshorttime|vbobjecterror|vbEmpty|vbNull|vbInteger|vbLong|vbSingle|vbDouble|vbCurrency|vbDate|vbString|vbObject|vbError|vbBoolean|vbVariant|vbDataObject|vbDecimal|vbByte|vbArray)\\b)" + regex: "(?:\\b(vbtrue|vbfalse|vbcr|vbcrlf|vbformfeed|vblf|vbnewline|vbnullchar|vbnullstring|int32|vbtab|vbverticaltab|vbbinarycompare|vbtextcomparevbsunday|vbmonday|vbtuesday|vbwednesday|vbthursday|vbfriday|vbsaturday|vbusesystemdayofweek|vbfirstjan1|vbfirstfourdays|vbfirstfullweek|vbgeneraldate|vblongdate|vbshortdate|vblongtime|vbshorttime|vbobjecterror|vbEmpty|vbNull|vbInteger|vbLong|vbSingle|vbDouble|vbCurrency|vbDate|vbString|vbObject|vbError|vbBoolean|vbVariant|vbDataObject|vbDecimal|vbByte|vbArray)\\b)" }, { token: [ From 127b769c5048daffceca1eab69c332fa55dea02b Mon Sep 17 00:00:00 2001 From: nightwing Date: Sat, 11 May 2013 16:38:58 +0400 Subject: [PATCH 11/11] fix typo --- lib/ace/ext/modelist.js | 2 +- lib/ace/tokenizer.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ace/ext/modelist.js b/lib/ace/ext/modelist.js index 2414688c..5e42f0c7 100644 --- a/lib/ace/ext/modelist.js +++ b/lib/ace/ext/modelist.js @@ -91,7 +91,7 @@ var supportedModes = { Makefile: ["^GNUmakefile|^makefile|^Makefile|^OCamlMakefile|make"], Markdown: ["md|markdown"], MUSHCode: ["mc|mush"], - ObjectiveC: ["m"], + ObjectiveC: ["m|mm"], OCaml: ["ml|mli"], Pascal: ["pas|p"], Perl: ["pl|pm"], diff --git a/lib/ace/tokenizer.js b/lib/ace/tokenizer.js index c4c3a928..b4ef627b 100644 --- a/lib/ace/tokenizer.js +++ b/lib/ace/tokenizer.js @@ -58,7 +58,7 @@ var Tokenizer = function(rules) { var mapping = this.matchMappings[key] = {defaultToken: "text"}; var flag = "g"; - var spliterRurles = []; + var splitterRurles = []; for (var i = 0; i < state.length; i++) { var rule = state[i]; if (rule.defaultToken) @@ -105,7 +105,7 @@ var Tokenizer = function(rules) { adjustedregex = this.removeCapturingGroups(rule.regex); } if (!rule.splitRegex && typeof rule.token != "string") - spliterRurles.push(rule); // flag will be known only at the very end + splitterRurles.push(rule); // flag will be known only at the very end } mapping[matchTotal] = i; @@ -119,7 +119,7 @@ var Tokenizer = function(rules) { rule.__proto__ = null; } - spliterRurles.forEach(function(rule) { + splitterRurles.forEach(function(rule) { rule.splitRegex = this.createSplitterRegexp(rule.regex, flag); }, this);