Merge git://github.com/ajaxorg/ace
This commit is contained in:
commit
811abefc45
176 changed files with 17244 additions and 8551 deletions
|
|
@ -244,7 +244,7 @@ exportAce(ACE_NAMESPACE);
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
|
||||||
define('kitchen-sink/demo', ['require', 'exports', 'module' , 'ace/lib/fixoldbrowsers', 'ace/config', 'ace/lib/event', 'ace/theme/textmate', 'ace/edit_session', 'ace/undomanager', 'ace/keyboard/keybinding/vim', 'ace/keyboard/keybinding/emacs', 'ace/keyboard/hash_handler', 'text!kitchen-sink/docs/plaintext.txt', 'text!kitchen-sink/docs/javascript.js', 'text!kitchen-sink/docs/coffeescript.coffee', 'text!kitchen-sink/docs/json.json', 'text!kitchen-sink/docs/css.css', 'text!kitchen-sink/docs/scss.scss', 'text!kitchen-sink/docs/html.html', 'text!kitchen-sink/docs/xml.xml', 'text!kitchen-sink/docs/svg.svg', 'text!kitchen-sink/docs/php.php', 'text!kitchen-sink/docs/coldfusion.cfm', 'text!kitchen-sink/docs/python.py', 'text!kitchen-sink/docs/ruby.rb', 'text!kitchen-sink/docs/perl.pl', 'text!kitchen-sink/docs/ocaml.ml', 'text!kitchen-sink/docs/lua.lua', 'text!kitchen-sink/docs/java.java', 'text!kitchen-sink/docs/clojure.clj', 'text!kitchen-sink/docs/groovy.groovy', 'text!kitchen-sink/docs/scala.scala', 'text!kitchen-sink/docs/csharp.cs', 'text!kitchen-sink/docs/powershell.ps1', 'text!kitchen-sink/docs/cpp.cpp', 'text!kitchen-sink/docs/Haxe.hx', 'text!kitchen-sink/docs/sh.sh', 'text!kitchen-sink/docs/xquery.xq', 'text!kitchen-sink/docs/markdown.md', 'text!kitchen-sink/docs/textile.textile', 'text!kitchen-sink/docs/latex.tex', 'text!kitchen-sink/docs/sql.sql', 'text!kitchen-sink/docs/pgsql.pgsql', 'ace/split'], function(require, exports, module) {
|
define('kitchen-sink/demo', ['require', 'exports', 'module' , 'ace/lib/fixoldbrowsers', 'ace/config', 'ace/lib/event', 'ace/theme/textmate', 'ace/edit_session', 'ace/undomanager', 'ace/keyboard/keybinding/vim', 'ace/keyboard/keybinding/emacs', 'ace/keyboard/hash_handler', 'text!kitchen-sink/docs/plaintext.txt', 'text!kitchen-sink/docs/javascript.js', 'text!kitchen-sink/docs/coffeescript.coffee', 'text!kitchen-sink/docs/json.json', 'text!kitchen-sink/docs/css.css', 'text!kitchen-sink/docs/scss.scss', 'text!kitchen-sink/docs/html.html', 'text!kitchen-sink/docs/xml.xml', 'text!kitchen-sink/docs/svg.svg', 'text!kitchen-sink/docs/php.php', 'text!kitchen-sink/docs/coldfusion.cfm', 'text!kitchen-sink/docs/python.py', 'text!kitchen-sink/docs/ruby.rb', 'text!kitchen-sink/docs/perl.pl', 'text!kitchen-sink/docs/ocaml.ml', 'text!kitchen-sink/docs/lua.lua', 'text!kitchen-sink/docs/liquid.liquid', 'text!kitchen-sink/docs/java.java', 'text!kitchen-sink/docs/clojure.clj', 'text!kitchen-sink/docs/groovy.groovy', 'text!kitchen-sink/docs/scala.scala', 'text!kitchen-sink/docs/csharp.cs', 'text!kitchen-sink/docs/powershell.ps1', 'text!kitchen-sink/docs/cpp.cpp', 'text!kitchen-sink/docs/Haxe.hx', 'text!kitchen-sink/docs/sh.sh', 'text!kitchen-sink/docs/xquery.xq', 'text!kitchen-sink/docs/markdown.md', 'text!kitchen-sink/docs/textile.textile', 'text!kitchen-sink/docs/latex.tex', 'text!kitchen-sink/docs/sql.sql', 'text!kitchen-sink/docs/pgsql.pgsql', 'ace/split'], function(require, exports, module) {
|
||||||
|
|
||||||
require("ace/lib/fixoldbrowsers");
|
require("ace/lib/fixoldbrowsers");
|
||||||
require("ace/config").init();
|
require("ace/config").init();
|
||||||
|
|
@ -266,7 +266,6 @@ var Doc = function(name, desc, file) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.desc = desc;
|
this.desc = desc;
|
||||||
this.doc = new EditSession(file);
|
this.doc = new EditSession(file);
|
||||||
this.doc.setMode(modesByName[name].mode);
|
|
||||||
this.doc.modeName = name;
|
this.doc.modeName = name;
|
||||||
this.doc.setUndoManager(new UndoManager());
|
this.doc.setUndoManager(new UndoManager());
|
||||||
};
|
};
|
||||||
|
|
@ -304,6 +303,7 @@ var modes = [
|
||||||
new Mode("json", "JSON", ["json"]),
|
new Mode("json", "JSON", ["json"]),
|
||||||
new Mode("latex", "LaTeX", ["tex"]),
|
new Mode("latex", "LaTeX", ["tex"]),
|
||||||
new Mode("lua", "Lua", ["lua"]),
|
new Mode("lua", "Lua", ["lua"]),
|
||||||
|
new Mode("liquid", "Liquid", ["liquid"]),
|
||||||
new Mode("markdown", "Markdown", ["md", "markdown"]),
|
new Mode("markdown", "Markdown", ["md", "markdown"]),
|
||||||
new Mode("ocaml", "OCaml", ["ml", "mli"]),
|
new Mode("ocaml", "OCaml", ["ml", "mli"]),
|
||||||
new Mode("perl", "Perl", ["pl", "pm"]),
|
new Mode("perl", "Perl", ["pl", "pm"]),
|
||||||
|
|
@ -395,6 +395,10 @@ var docs = [
|
||||||
"lua", "Lua",
|
"lua", "Lua",
|
||||||
require("text!./docs/lua.lua")
|
require("text!./docs/lua.lua")
|
||||||
),
|
),
|
||||||
|
new Doc(
|
||||||
|
"liquid", "Liquid",
|
||||||
|
require("text!./docs/liquid.liquid")
|
||||||
|
),
|
||||||
new Doc(
|
new Doc(
|
||||||
"java", "Java",
|
"java", "Java",
|
||||||
require("text!./docs/java.java")
|
require("text!./docs/java.java")
|
||||||
|
|
@ -522,6 +526,12 @@ modes.forEach(function(mode) {
|
||||||
|
|
||||||
bindDropdown("doc", function(value) {
|
bindDropdown("doc", function(value) {
|
||||||
var doc = docsByName[value].doc;
|
var doc = docsByName[value].doc;
|
||||||
|
|
||||||
|
if (!docsByName[value].initialized) {
|
||||||
|
docsByName[value].initialized = true;
|
||||||
|
doc.setMode(modesByName[docsByName[value].name].mode);
|
||||||
|
}
|
||||||
|
|
||||||
var session = env.split.setSession(doc);
|
var session = env.split.setSession(doc);
|
||||||
session.name = doc.name;
|
session.name = doc.name;
|
||||||
|
|
||||||
|
|
@ -3858,6 +3868,10 @@ var EditSession = function(text, mode) {
|
||||||
return callback(_self.$modes[mode]);
|
return callback(_self.$modes[mode]);
|
||||||
|
|
||||||
_self.$modes[mode] = new module.Mode();
|
_self.$modes[mode] = new module.Mode();
|
||||||
|
_self._emit("loadmode", {
|
||||||
|
name: mode,
|
||||||
|
mode: _self.$modes[mode]
|
||||||
|
});
|
||||||
callback(_self.$modes[mode]);
|
callback(_self.$modes[mode]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6400,6 +6414,10 @@ var Tokenizer = function(rules, flag) {
|
||||||
var mapping = this.matchMappings[key] = {};
|
var mapping = this.matchMappings[key] = {};
|
||||||
|
|
||||||
for ( var i = 0; i < state.length; i++) {
|
for ( var i = 0; i < state.length; i++) {
|
||||||
|
|
||||||
|
if (state[i].regex instanceof RegExp)
|
||||||
|
state[i].regex = state[i].regex.toString().slice(1, -1);
|
||||||
|
|
||||||
// Count number of matching groups. 2 extra groups from the full match
|
// Count number of matching groups. 2 extra groups from the full match
|
||||||
// And the catch-all on the end (used to force a match);
|
// And the catch-all on the end (used to force a match);
|
||||||
var matchcount = new RegExp("(?:(" + state[i].regex + ")|(.))").exec("a").length - 2;
|
var matchcount = new RegExp("(?:(" + state[i].regex + ")|(.))").exec("a").length - 2;
|
||||||
|
|
@ -6409,6 +6427,9 @@ var Tokenizer = function(rules, flag) {
|
||||||
return "\\" + (parseInt(digit, 10) + matchTotal + 1);
|
return "\\" + (parseInt(digit, 10) + matchTotal + 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (matchcount > 1 && state[i].token.length !== matchcount-1)
|
||||||
|
throw new Error("Matching groups and length of the token array don't match in rule #" + i + " of state " + key);
|
||||||
|
|
||||||
mapping[matchTotal] = {
|
mapping[matchTotal] = {
|
||||||
rule: i,
|
rule: i,
|
||||||
len: matchcount
|
len: matchcount
|
||||||
|
|
@ -6446,31 +6467,31 @@ var Tokenizer = function(rules, flag) {
|
||||||
var value = [match[0]];
|
var value = [match[0]];
|
||||||
|
|
||||||
for (var i = 0; i < match.length-2; i++) {
|
for (var i = 0; i < match.length-2; i++) {
|
||||||
if (match[i + 1] !== undefined) {
|
if (match[i + 1] === undefined)
|
||||||
rule = state[mapping[i].rule];
|
continue;
|
||||||
|
|
||||||
if (mapping[i].len > 1) {
|
rule = state[mapping[i].rule];
|
||||||
value = match.slice(i+2, i+1+mapping[i].len);
|
|
||||||
}
|
|
||||||
|
|
||||||
// compute token type
|
if (mapping[i].len > 1)
|
||||||
if (typeof rule.token == "function")
|
value = match.slice(i+2, i+1+mapping[i].len);
|
||||||
type = rule.token.apply(this, value);
|
|
||||||
else
|
|
||||||
type = rule.token;
|
|
||||||
|
|
||||||
var next = rule.next;
|
// compute token type
|
||||||
if (next && next !== currentState) {
|
if (typeof rule.token == "function")
|
||||||
currentState = next;
|
type = rule.token.apply(this, value);
|
||||||
state = this.rules[currentState];
|
else
|
||||||
mapping = this.matchMappings[currentState];
|
type = rule.token;
|
||||||
lastIndex = re.lastIndex;
|
|
||||||
|
|
||||||
re = this.regExps[currentState];
|
var next = rule.next;
|
||||||
re.lastIndex = lastIndex;
|
if (next && next !== currentState) {
|
||||||
}
|
currentState = next;
|
||||||
break;
|
state = this.rules[currentState];
|
||||||
|
mapping = this.matchMappings[currentState];
|
||||||
|
lastIndex = re.lastIndex;
|
||||||
|
|
||||||
|
re = this.regExps[currentState];
|
||||||
|
re.lastIndex = lastIndex;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value[0]) {
|
if (value[0]) {
|
||||||
|
|
@ -6479,12 +6500,14 @@ var Tokenizer = function(rules, flag) {
|
||||||
type = [type];
|
type = [type];
|
||||||
}
|
}
|
||||||
for (var i = 0; i < value.length; i++) {
|
for (var i = 0; i < value.length; i++) {
|
||||||
|
if (!value[i])
|
||||||
|
continue;
|
||||||
|
|
||||||
if ((!rule || rule.merge || type[i] === "text") && token.type === type[i]) {
|
if ((!rule || rule.merge || type[i] === "text") && token.type === type[i]) {
|
||||||
token.value += value[i];
|
token.value += value[i];
|
||||||
} else {
|
} else {
|
||||||
if (token.type) {
|
if (token.type)
|
||||||
tokens.push(token);
|
tokens.push(token);
|
||||||
}
|
|
||||||
|
|
||||||
token = {
|
token = {
|
||||||
type: type[i],
|
type: type[i],
|
||||||
|
|
@ -7007,7 +7030,8 @@ var Document = function(text) {
|
||||||
|
|
||||||
position = this.$clipPosition(position);
|
position = this.$clipPosition(position);
|
||||||
|
|
||||||
if (this.getLength() >= 1)
|
// only detect new lines if the document has no line break yet
|
||||||
|
if (this.getLength() <= 1)
|
||||||
this.$detectNewLine(text);
|
this.$detectNewLine(text);
|
||||||
|
|
||||||
var lines = this.$split(text);
|
var lines = this.$split(text);
|
||||||
|
|
@ -10263,6 +10287,84 @@ define("text!kitchen-sink/docs/lua.lua", [], "--[[--\n" +
|
||||||
"print(table.maxn{1,2,[4]=4,[8]=8) -- outputs 8 instead of 2\n" +
|
"print(table.maxn{1,2,[4]=4,[8]=8) -- outputs 8 instead of 2\n" +
|
||||||
"");
|
"");
|
||||||
|
|
||||||
|
define("text!kitchen-sink/docs/liquid.liquid", [], "The following examples can be found in full at http://liquidmarkup.org/\n" +
|
||||||
|
"\n" +
|
||||||
|
"Liquid is an extraction from the e-commerce system Shopify.\n" +
|
||||||
|
"Shopify powers many thousands of e-commerce stores which all call for unique designs.\n" +
|
||||||
|
"For this we developed Liquid which allows our customers complete design freedom while\n" +
|
||||||
|
"maintaining the integrity of our servers.\n" +
|
||||||
|
"\n" +
|
||||||
|
"Liquid has been in production use since June 2006 and is now used by many other\n" +
|
||||||
|
"hosted web applications.\n" +
|
||||||
|
"\n" +
|
||||||
|
"It was developed for usage in Ruby on Rails web applications and integrates seamlessly\n" +
|
||||||
|
"as a plugin but it also works excellently as a stand alone library.\n" +
|
||||||
|
"\n" +
|
||||||
|
"Here's what it looks like:\n" +
|
||||||
|
"\n" +
|
||||||
|
" <ul id=\"products\">\n" +
|
||||||
|
" {% for product in products %}\n" +
|
||||||
|
" <li>\n" +
|
||||||
|
" <h2>{{ product.title }}</h2>\n" +
|
||||||
|
" Only {{ product.price | format_as_money }}\n" +
|
||||||
|
"\n" +
|
||||||
|
" <p>{{ product.description | prettyprint | truncate: 200 }}</p>\n" +
|
||||||
|
"\n" +
|
||||||
|
" </li>\n" +
|
||||||
|
" {% endfor %}\n" +
|
||||||
|
" </ul>\n" +
|
||||||
|
"\n" +
|
||||||
|
"\n" +
|
||||||
|
"Some more features include:\n" +
|
||||||
|
"\n" +
|
||||||
|
"<h2>Filters</h2>\n" +
|
||||||
|
"<p> The word \"tobi\" in uppercase: {{ 'tobi' | upcase }} </p>\n" +
|
||||||
|
"<p>The word \"tobi\" has {{ 'tobi' | size }} letters! </p>\n" +
|
||||||
|
"<p>Change \"Hello world\" to \"Hi world\": {{ 'Hello world' | replace: 'Hello', 'Hi' }} </p>\n" +
|
||||||
|
"<p>The date today is {{ 'now' | date: \"%Y %b %d\" }} </p>\n" +
|
||||||
|
"\n" +
|
||||||
|
"\n" +
|
||||||
|
"<h2>If</h2>\n" +
|
||||||
|
"<p>\n" +
|
||||||
|
" {% if user.name == 'tobi' or user.name == 'marc' %} \n" +
|
||||||
|
" hi marc or tobi\n" +
|
||||||
|
" {% endif %}\n" +
|
||||||
|
"</p>\n" +
|
||||||
|
"\n" +
|
||||||
|
"\n" +
|
||||||
|
"<h2>Case</h2>\n" +
|
||||||
|
"<p>\n" +
|
||||||
|
" {% case template %}\n" +
|
||||||
|
" {% when 'index' %}\n" +
|
||||||
|
" Welcome\n" +
|
||||||
|
" {% when 'product' %}\n" +
|
||||||
|
" {{ product.vendor | link_to_vendor }} / {{ product.title }}\n" +
|
||||||
|
" {% else %}\n" +
|
||||||
|
" {{ page_title }}\n" +
|
||||||
|
" {% endcase %}\n" +
|
||||||
|
"</p>\n" +
|
||||||
|
"\n" +
|
||||||
|
"\n" +
|
||||||
|
"<h2>For Loops</h2>\n" +
|
||||||
|
"<p>\n" +
|
||||||
|
" {% for item in array %} \n" +
|
||||||
|
" {{ item }}\n" +
|
||||||
|
" {% endfor %}\n" +
|
||||||
|
"</p>\n" +
|
||||||
|
"\n" +
|
||||||
|
"\n" +
|
||||||
|
"<h2>Tables</h2>\n" +
|
||||||
|
"<p>\n" +
|
||||||
|
" {% tablerow item in items cols: 3 %}\n" +
|
||||||
|
" {% if tablerowloop.col_first %}\n" +
|
||||||
|
" First column: {{ item.variable }}\n" +
|
||||||
|
" {% else %}\n" +
|
||||||
|
" Different column: {{ item.variable }}\n" +
|
||||||
|
" {% endif %}\n" +
|
||||||
|
" {% endtablerow %}\n" +
|
||||||
|
"</p>\n" +
|
||||||
|
"");
|
||||||
|
|
||||||
define("text!kitchen-sink/docs/java.java", [], "public class InfiniteLoop {\n" +
|
define("text!kitchen-sink/docs/java.java", [], "public class InfiniteLoop {\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
" /*\n" +
|
" /*\n" +
|
||||||
|
|
@ -11485,7 +11587,11 @@ var Editor = function(renderer, session) {
|
||||||
this.renderer.updateCursor();
|
this.renderer.updateCursor();
|
||||||
|
|
||||||
if (!this.$blockScrolling) {
|
if (!this.$blockScrolling) {
|
||||||
this.renderer.scrollCursorIntoView();
|
var selection = this.getSelection();
|
||||||
|
if (selection.isEmpty())
|
||||||
|
this.renderer.scrollCursorIntoView(selection.getCursor());
|
||||||
|
else
|
||||||
|
this.renderer.scrollSelectionIntoView(selection.getSelectionLead(), selection.getSelectionAnchor());
|
||||||
}
|
}
|
||||||
|
|
||||||
// move text input over the cursor
|
// move text input over the cursor
|
||||||
|
|
@ -12398,8 +12504,7 @@ var Editor = function(renderer, session) {
|
||||||
|
|
||||||
|
|
||||||
exports.Editor = Editor;
|
exports.Editor = Editor;
|
||||||
});
|
});/* vim:ts=4:sts=4:sw=4:
|
||||||
/* vim:ts=4:sts=4:sw=4:
|
|
||||||
* ***** BEGIN LICENSE BLOCK *****
|
* ***** BEGIN LICENSE BLOCK *****
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
*
|
*
|
||||||
|
|
@ -13923,13 +14028,13 @@ exports.commands = [{
|
||||||
}, {
|
}, {
|
||||||
name: "backspace",
|
name: "backspace",
|
||||||
bindKey: bindKey(
|
bindKey: bindKey(
|
||||||
"Ctrl-Backspace|Command-Backspace|Option-Backspace|Shift-Backspace|Backspace",
|
"Command-Backspace|Option-Backspace|Shift-Backspace|Backspace",
|
||||||
"Ctrl-Backspace|Command-Backspace|Shift-Backspace|Backspace|Ctrl-H"
|
"Ctrl-Backspace|Command-Backspace|Shift-Backspace|Backspace|Ctrl-H"
|
||||||
),
|
),
|
||||||
exec: function(editor) { editor.remove("left"); }
|
exec: function(editor) { editor.remove("left"); }
|
||||||
}, {
|
}, {
|
||||||
name: "removetolinestart",
|
name: "removetolinestart",
|
||||||
bindKey: bindKey("Alt-Backspace", "Option-Backspace"),
|
bindKey: bindKey("Alt-Backspace", "Command-Backspace"),
|
||||||
exec: function(editor) { editor.removeToLineStart(); }
|
exec: function(editor) { editor.removeToLineStart(); }
|
||||||
}, {
|
}, {
|
||||||
name: "removetolineend",
|
name: "removetolineend",
|
||||||
|
|
@ -14414,7 +14519,7 @@ var CommandManager = function(platform, commands) {
|
||||||
|
|
||||||
var key = typeof binding == "string" ? binding: binding[this.platform];
|
var key = typeof binding == "string" ? binding: binding[this.platform];
|
||||||
this.bindKey(key, command);
|
this.bindKey(key, command);
|
||||||
}
|
};
|
||||||
|
|
||||||
function parseKeys(keys, val, ret) {
|
function parseKeys(keys, val, ret) {
|
||||||
var key;
|
var key;
|
||||||
|
|
@ -14431,10 +14536,10 @@ var CommandManager = function(platform, commands) {
|
||||||
return {
|
return {
|
||||||
key: key,
|
key: key,
|
||||||
hashId: hashId
|
hashId: hashId
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function splitSafe(s, separator) {
|
function splitSafe(s) {
|
||||||
return (s.toLowerCase()
|
return (s.toLowerCase()
|
||||||
.trim()
|
.trim()
|
||||||
.split(new RegExp("[\\s ]*\\-[\\s ]*", "g"), 999));
|
.split(new RegExp("[\\s ]*\\-[\\s ]*", "g"), 999));
|
||||||
|
|
@ -14448,7 +14553,7 @@ var CommandManager = function(platform, commands) {
|
||||||
|
|
||||||
var ckbr = this.commmandKeyBinding;
|
var ckbr = this.commmandKeyBinding;
|
||||||
return ckbr[hashId] && ckbr[hashId][textOrKey.toLowerCase()];
|
return ckbr[hashId] && ckbr[hashId][textOrKey.toLowerCase()];
|
||||||
}
|
};
|
||||||
|
|
||||||
this.exec = function(command, editor, args) {
|
this.exec = function(command, editor, args) {
|
||||||
if (typeof command === 'string')
|
if (typeof command === 'string')
|
||||||
|
|
@ -14500,7 +14605,7 @@ var CommandManager = function(platform, commands) {
|
||||||
this.exec(x, editor);
|
this.exec(x, editor);
|
||||||
else
|
else
|
||||||
this.exec(x[0], editor, x[1]);
|
this.exec(x[0], editor, x[1]);
|
||||||
}, this)
|
}, this);
|
||||||
} finally {
|
} finally {
|
||||||
this.$inReplay = false;
|
this.$inReplay = false;
|
||||||
}
|
}
|
||||||
|
|
@ -14512,9 +14617,9 @@ var CommandManager = function(platform, commands) {
|
||||||
x[0] = x[0].name;
|
x[0] = x[0].name;
|
||||||
if (!x[1])
|
if (!x[1])
|
||||||
x = x[0];
|
x = x[0];
|
||||||
return x
|
return x;
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
}).call(CommandManager.prototype);
|
}).call(CommandManager.prototype);
|
||||||
|
|
||||||
|
|
@ -15170,12 +15275,18 @@ var VirtualRenderer = function(container, theme) {
|
||||||
this.$cursorLayer.showCursor();
|
this.$cursorLayer.showCursor();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.scrollCursorIntoView = function() {
|
this.scrollSelectionIntoView = function(anchor, lead) {
|
||||||
|
// first scroll anchor into view then scroll lead into view
|
||||||
|
this.scrollCursorIntoView(anchor);
|
||||||
|
this.scrollCursorIntoView(lead);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.scrollCursorIntoView = function(cursor) {
|
||||||
// the editor is not visible
|
// the editor is not visible
|
||||||
if (this.$size.scrollerHeight === 0)
|
if (this.$size.scrollerHeight === 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var pos = this.$cursorLayer.getPixelPosition();
|
var pos = this.$cursorLayer.getPixelPosition(cursor);
|
||||||
|
|
||||||
var left = pos.left;
|
var left = pos.left;
|
||||||
var top = pos.top;
|
var top = pos.top;
|
||||||
|
|
|
||||||
|
|
@ -541,12 +541,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -558,7 +558,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -576,7 +576,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -601,12 +601,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -618,7 +618,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -637,14 +637,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -665,7 +666,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -674,19 +675,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -695,7 +696,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -705,7 +706,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -259,9 +259,9 @@ var ClojureHighlightRules = function() {
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : ";.*$"
|
regex : ";.*$"
|
||||||
}, {
|
}, {
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
regex : "^\=begin$",
|
regex : "^=begin$",
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "keyword", //parens
|
token : "keyword", //parens
|
||||||
regex : "[\\(|\\)]"
|
regex : "[\\(|\\)]"
|
||||||
|
|
@ -314,17 +314,17 @@ var ClojureHighlightRules = function() {
|
||||||
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||||
}, {
|
}, {
|
||||||
token : "string", // symbol
|
token : "string", // symbol
|
||||||
regex : "[:](?:[a-zA-Z]|\d)+"
|
regex : "[:](?:[a-zA-Z]|\\d)+"
|
||||||
}, {
|
}, {
|
||||||
token : "string.regexp", //Regular Expressions
|
token : "string.regexp", //Regular Expressions
|
||||||
regex : '/#"(?:\.|(\\\")|[^\""\n])*"/g'
|
regex : '/#"(?:\\.|(?:\\\")|[^\""\n])*"/g'
|
||||||
}
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
"comment" : [
|
"comment" : [
|
||||||
{
|
{
|
||||||
token : "comment", // closing comment
|
token : "comment", // closing comment
|
||||||
regex : "^\=end$",
|
regex : "^=end$",
|
||||||
next : "start"
|
next : "start"
|
||||||
}, {
|
}, {
|
||||||
token : "comment", // comment spanning whole line
|
token : "comment", // comment spanning whole line
|
||||||
|
|
|
||||||
|
|
@ -528,12 +528,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -545,7 +545,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -563,7 +563,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -588,12 +588,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -605,7 +605,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -624,14 +624,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -652,7 +653,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -661,19 +662,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -682,7 +683,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -692,7 +693,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
@ -1350,13 +1352,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -1368,51 +1370,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : "support.function",
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : "support.function.dom",
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : "support.constant",
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /\b(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -1435,29 +1507,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
|
||||||
|
|
@ -391,12 +391,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -408,7 +408,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -426,7 +426,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -451,12 +451,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -468,7 +468,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -487,14 +487,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -515,7 +516,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -524,19 +525,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -545,7 +546,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -555,7 +556,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -302,13 +302,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -320,51 +320,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : "support.function",
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : "support.function.dom",
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : "support.constant",
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /\b(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -387,29 +457,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
@ -944,12 +1014,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -961,7 +1031,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -979,7 +1049,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -1004,12 +1074,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -1021,7 +1091,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1040,14 +1110,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -1068,7 +1139,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -1077,19 +1148,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1098,7 +1169,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -1108,7 +1179,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -391,12 +391,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -408,7 +408,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -426,7 +426,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -451,12 +451,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -468,7 +468,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -487,14 +487,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -515,7 +516,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -524,19 +525,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -545,7 +546,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -555,7 +556,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -361,13 +361,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -379,51 +379,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : "support.function",
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : "support.function.dom",
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : "support.constant",
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /\b(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -446,29 +516,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
@ -1003,12 +1073,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -1020,7 +1090,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -1038,7 +1108,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -1063,12 +1133,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -1080,7 +1150,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1099,14 +1169,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -1127,7 +1198,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -1136,19 +1207,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1157,7 +1228,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -1167,7 +1238,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -303,13 +303,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -321,51 +321,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : "support.function",
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : "support.function.dom",
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : "support.constant",
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /\b(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -388,29 +458,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
@ -945,12 +1015,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -962,7 +1032,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -980,7 +1050,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -1005,12 +1075,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -1022,7 +1092,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1041,14 +1111,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -1069,7 +1140,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -1078,19 +1149,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1099,7 +1170,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -1109,7 +1180,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -278,13 +278,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -296,51 +296,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : "support.function",
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : "support.function.dom",
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : "support.constant",
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /\b(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -363,29 +433,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
@ -920,12 +990,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -937,7 +1007,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -955,7 +1025,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -980,12 +1050,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -997,7 +1067,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1016,14 +1086,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -1044,7 +1115,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -1053,19 +1124,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1074,7 +1145,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -1084,7 +1155,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -319,12 +319,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -336,7 +336,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -354,7 +354,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -379,12 +379,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -396,7 +396,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -415,14 +415,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -443,7 +444,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -452,19 +453,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -473,7 +474,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -483,7 +484,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
1368
build/demo/kitchen-sink/mode-liquid-uncompressed.js
Normal file
1368
build/demo/kitchen-sink/mode-liquid-uncompressed.js
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -358,13 +358,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -376,51 +376,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : "support.function",
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : "support.function.dom",
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : "support.constant",
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /\b(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -443,29 +513,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
@ -1000,12 +1070,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -1017,7 +1087,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -1035,7 +1105,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -1060,12 +1130,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -1077,7 +1147,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1096,14 +1166,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -1124,7 +1195,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -1133,19 +1204,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1154,7 +1225,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -1164,7 +1235,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
@ -2884,7 +2956,7 @@ var MarkdownHighlightRules = function() {
|
||||||
token : "empty_line",
|
token : "empty_line",
|
||||||
regex : '^$'
|
regex : '^$'
|
||||||
}, { // code span `
|
}, { // code span `
|
||||||
token : "support.function",
|
token : ["support.function", "support.function", "support.function"],
|
||||||
regex : "(`+)([^\\r]*?[^`])(\\1)"
|
regex : "(`+)([^\\r]*?[^`])(\\1)"
|
||||||
}, { // code block
|
}, { // code block
|
||||||
token : "support.function",
|
token : "support.function",
|
||||||
|
|
@ -2914,7 +2986,7 @@ var MarkdownHighlightRules = function() {
|
||||||
next : "blockquote"
|
next : "blockquote"
|
||||||
}, { // reference
|
}, { // reference
|
||||||
token : ["text", "constant", "text", "url", "string", "text"],
|
token : ["text", "constant", "text", "url", "string", "text"],
|
||||||
regex : "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?\\s*)$"
|
regex : "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?(\\s*))$"
|
||||||
}, { // link by reference
|
}, { // link by reference
|
||||||
token : ["text", "string", "text", "constant", "text"],
|
token : ["text", "string", "text", "constant", "text"],
|
||||||
regex : "(\\[)((?:[[^\\]]*\\]|[^\\[\\]])*)(\\][ ]?(?:\\n[ ]*)?\\[)(.*?)(\\])"
|
regex : "(\\[)((?:[[^\\]]*\\]|[^\\[\\]])*)(\\][ ]?(?:\\n[ ]*)?\\[)(.*?)(\\])"
|
||||||
|
|
@ -2940,10 +3012,10 @@ var MarkdownHighlightRules = function() {
|
||||||
regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
|
regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
|
||||||
next : "listblock"
|
next : "listblock"
|
||||||
}, { // strong ** __
|
}, { // strong ** __
|
||||||
token : "string",
|
token : ["string", "string", "string"],
|
||||||
regex : "([*]{2}|[_]{2}(?=\\S))([^\\r]*?\\S[*_]*)(\\1)"
|
regex : "([*]{2}|[_]{2}(?=\\S))([^\\r]*?\\S[*_]*)(\\1)"
|
||||||
}, { // emphasis * _
|
}, { // emphasis * _
|
||||||
token : "string",
|
token : ["string", "string", "string"],
|
||||||
regex : "([*]|[_](?=\\S))([^\\r]*?\\S[*_]*)(\\1)"
|
regex : "([*]|[_](?=\\S))([^\\r]*?\\S[*_]*)(\\1)"
|
||||||
}, { //
|
}, { //
|
||||||
token : ["text", "url", "text"],
|
token : ["text", "url", "text"],
|
||||||
|
|
|
||||||
|
|
@ -1165,7 +1165,7 @@ var PhpHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
regex : '[^"]+'
|
regex : '[^"]+'
|
||||||
},
|
}
|
||||||
],
|
],
|
||||||
"qstring" : [
|
"qstring" : [
|
||||||
{
|
{
|
||||||
|
|
@ -1213,7 +1213,7 @@ var PhpHighlightRules = function() {
|
||||||
next : "htmltag"
|
next : "htmltag"
|
||||||
}, {
|
}, {
|
||||||
token : "meta.tag",
|
token : "meta.tag",
|
||||||
regex : ">",
|
regex : ">"
|
||||||
}, {
|
}, {
|
||||||
token : 'text',
|
token : 'text',
|
||||||
regex : "(?:media|type|href)"
|
regex : "(?:media|type|href)"
|
||||||
|
|
@ -1223,7 +1223,7 @@ var PhpHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "\{",
|
regex : "\{",
|
||||||
next : "cssdeclaration",
|
next : "cssdeclaration"
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "#[A-Za-z0-9\-\_\.]+"
|
regex : "#[A-Za-z0-9\-\_\.]+"
|
||||||
|
|
@ -1265,7 +1265,7 @@ var PhpHighlightRules = function() {
|
||||||
regex : ";",
|
regex : ";",
|
||||||
next : "cssdeclaration"
|
next : "cssdeclaration"
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||||
|
|
@ -1507,12 +1507,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -1524,7 +1524,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -1542,7 +1542,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -1567,12 +1567,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -1584,7 +1584,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1603,14 +1603,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -1631,7 +1632,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -1640,19 +1641,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1661,7 +1662,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -1671,7 +1672,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -329,12 +329,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -346,7 +346,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -364,7 +364,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -389,12 +389,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -406,7 +406,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -425,14 +425,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -453,7 +454,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -462,19 +463,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -483,7 +484,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -493,7 +494,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -529,12 +529,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -546,7 +546,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -564,7 +564,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -589,12 +589,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -606,7 +606,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -625,14 +625,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -653,7 +654,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -662,19 +663,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -683,7 +684,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -693,7 +694,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -303,13 +303,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -321,51 +321,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : "support.function",
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : "support.function.dom",
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : "support.constant",
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /\b(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -388,29 +458,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
@ -945,12 +1015,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -962,7 +1032,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -980,7 +1050,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -1005,12 +1075,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -1022,7 +1092,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1041,14 +1111,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -1069,7 +1140,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -1078,19 +1149,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1099,7 +1170,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -1109,7 +1180,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -535,12 +535,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -552,7 +552,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -570,7 +570,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -595,12 +595,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -612,7 +612,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -631,14 +631,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -659,7 +660,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -668,19 +669,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -689,7 +690,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -699,7 +700,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
@ -1357,13 +1359,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -1375,51 +1377,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : "support.function",
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : "support.function.dom",
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : "support.constant",
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /\b(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -1442,29 +1514,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
|
||||||
|
|
@ -457,12 +457,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -474,7 +474,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -492,7 +492,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -517,12 +517,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -534,7 +534,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -553,14 +553,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -581,7 +582,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -590,19 +591,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -611,7 +612,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -621,7 +622,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -367,12 +367,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -384,7 +384,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -402,7 +402,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -427,12 +427,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -444,7 +444,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -463,14 +463,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -491,7 +492,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -500,19 +501,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -521,7 +522,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -531,7 +532,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,6 @@ exports.cssText = ".ace-chrome .ace_editor {\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-chrome .ace_gutter {\
|
.ace-chrome .ace_gutter {\
|
||||||
width: 50px;\
|
|
||||||
background: #e8e8e8;\
|
background: #e8e8e8;\
|
||||||
color: #333;\
|
color: #333;\
|
||||||
overflow : hidden;\
|
overflow : hidden;\
|
||||||
|
|
@ -58,10 +57,6 @@ exports.cssText = ".ace-chrome .ace_editor {\
|
||||||
text-align: right;\
|
text-align: right;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-chrome .ace_gutter-layer .ace_gutter-cell {\
|
|
||||||
padding-right: 6px;\
|
|
||||||
}\
|
|
||||||
\
|
|
||||||
.ace-chrome .ace_print_margin {\
|
.ace-chrome .ace_print_margin {\
|
||||||
width: 1px;\
|
width: 1px;\
|
||||||
background: #e8e8e8;\
|
background: #e8e8e8;\
|
||||||
|
|
|
||||||
|
|
@ -1816,7 +1816,8 @@ var Document = function(text) {
|
||||||
|
|
||||||
position = this.$clipPosition(position);
|
position = this.$clipPosition(position);
|
||||||
|
|
||||||
if (this.getLength() >= 1)
|
// only detect new lines if the document has no line break yet
|
||||||
|
if (this.getLength() <= 1)
|
||||||
this.$detectNewLine(text);
|
this.$detectNewLine(text);
|
||||||
|
|
||||||
var lines = this.$split(text);
|
var lines = this.$split(text);
|
||||||
|
|
|
||||||
|
|
@ -1790,7 +1790,8 @@ var Document = function(text) {
|
||||||
|
|
||||||
position = this.$clipPosition(position);
|
position = this.$clipPosition(position);
|
||||||
|
|
||||||
if (this.getLength() >= 1)
|
// only detect new lines if the document has no line break yet
|
||||||
|
if (this.getLength() <= 1)
|
||||||
this.$detectNewLine(text);
|
this.$detectNewLine(text);
|
||||||
|
|
||||||
var lines = this.$split(text);
|
var lines = this.$split(text);
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1827,7 +1827,8 @@ var Document = function(text) {
|
||||||
|
|
||||||
position = this.$clipPosition(position);
|
position = this.$clipPosition(position);
|
||||||
|
|
||||||
if (this.getLength() >= 1)
|
// only detect new lines if the document has no line break yet
|
||||||
|
if (this.getLength() <= 1)
|
||||||
this.$detectNewLine(text);
|
this.$detectNewLine(text);
|
||||||
|
|
||||||
var lines = this.$split(text);
|
var lines = this.$split(text);
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
Ace
|
Ace
|
||||||
version 0.2.0
|
version 0.2.0
|
||||||
commit ac797eefe7872d482afaa5ea7f322150cab6fae1
|
commit cbd29bc541998e7c2bee817d048aead94760f557
|
||||||
|
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -2701,7 +2701,11 @@ var Editor = function(renderer, session) {
|
||||||
this.renderer.updateCursor();
|
this.renderer.updateCursor();
|
||||||
|
|
||||||
if (!this.$blockScrolling) {
|
if (!this.$blockScrolling) {
|
||||||
this.renderer.scrollCursorIntoView();
|
var selection = this.getSelection();
|
||||||
|
if (selection.isEmpty())
|
||||||
|
this.renderer.scrollCursorIntoView(selection.getCursor());
|
||||||
|
else
|
||||||
|
this.renderer.scrollSelectionIntoView(selection.getSelectionLead(), selection.getSelectionAnchor());
|
||||||
}
|
}
|
||||||
|
|
||||||
// move text input over the cursor
|
// move text input over the cursor
|
||||||
|
|
@ -3614,8 +3618,7 @@ var Editor = function(renderer, session) {
|
||||||
|
|
||||||
|
|
||||||
exports.Editor = Editor;
|
exports.Editor = Editor;
|
||||||
});
|
});/* ***** BEGIN LICENSE BLOCK *****
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License Version
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
|
@ -5409,13 +5412,13 @@ exports.commands = [{
|
||||||
}, {
|
}, {
|
||||||
name: "backspace",
|
name: "backspace",
|
||||||
bindKey: bindKey(
|
bindKey: bindKey(
|
||||||
"Ctrl-Backspace|Command-Backspace|Option-Backspace|Shift-Backspace|Backspace",
|
"Command-Backspace|Option-Backspace|Shift-Backspace|Backspace",
|
||||||
"Ctrl-Backspace|Command-Backspace|Shift-Backspace|Backspace|Ctrl-H"
|
"Ctrl-Backspace|Command-Backspace|Shift-Backspace|Backspace|Ctrl-H"
|
||||||
),
|
),
|
||||||
exec: function(editor) { editor.remove("left"); }
|
exec: function(editor) { editor.remove("left"); }
|
||||||
}, {
|
}, {
|
||||||
name: "removetolinestart",
|
name: "removetolinestart",
|
||||||
bindKey: bindKey("Alt-Backspace", "Option-Backspace"),
|
bindKey: bindKey("Alt-Backspace", "Command-Backspace"),
|
||||||
exec: function(editor) { editor.removeToLineStart(); }
|
exec: function(editor) { editor.removeToLineStart(); }
|
||||||
}, {
|
}, {
|
||||||
name: "removetolineend",
|
name: "removetolineend",
|
||||||
|
|
@ -5974,6 +5977,10 @@ var EditSession = function(text, mode) {
|
||||||
return callback(_self.$modes[mode]);
|
return callback(_self.$modes[mode]);
|
||||||
|
|
||||||
_self.$modes[mode] = new module.Mode();
|
_self.$modes[mode] = new module.Mode();
|
||||||
|
_self._emit("loadmode", {
|
||||||
|
name: mode,
|
||||||
|
mode: _self.$modes[mode]
|
||||||
|
});
|
||||||
callback(_self.$modes[mode]);
|
callback(_self.$modes[mode]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -8523,6 +8530,10 @@ var Tokenizer = function(rules, flag) {
|
||||||
var mapping = this.matchMappings[key] = {};
|
var mapping = this.matchMappings[key] = {};
|
||||||
|
|
||||||
for ( var i = 0; i < state.length; i++) {
|
for ( var i = 0; i < state.length; i++) {
|
||||||
|
|
||||||
|
if (state[i].regex instanceof RegExp)
|
||||||
|
state[i].regex = state[i].regex.toString().slice(1, -1);
|
||||||
|
|
||||||
// Count number of matching groups. 2 extra groups from the full match
|
// Count number of matching groups. 2 extra groups from the full match
|
||||||
// And the catch-all on the end (used to force a match);
|
// And the catch-all on the end (used to force a match);
|
||||||
var matchcount = new RegExp("(?:(" + state[i].regex + ")|(.))").exec("a").length - 2;
|
var matchcount = new RegExp("(?:(" + state[i].regex + ")|(.))").exec("a").length - 2;
|
||||||
|
|
@ -8532,6 +8543,9 @@ var Tokenizer = function(rules, flag) {
|
||||||
return "\\" + (parseInt(digit, 10) + matchTotal + 1);
|
return "\\" + (parseInt(digit, 10) + matchTotal + 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (matchcount > 1 && state[i].token.length !== matchcount-1)
|
||||||
|
throw new Error("Matching groups and length of the token array don't match in rule #" + i + " of state " + key);
|
||||||
|
|
||||||
mapping[matchTotal] = {
|
mapping[matchTotal] = {
|
||||||
rule: i,
|
rule: i,
|
||||||
len: matchcount
|
len: matchcount
|
||||||
|
|
@ -8569,31 +8583,31 @@ var Tokenizer = function(rules, flag) {
|
||||||
var value = [match[0]];
|
var value = [match[0]];
|
||||||
|
|
||||||
for (var i = 0; i < match.length-2; i++) {
|
for (var i = 0; i < match.length-2; i++) {
|
||||||
if (match[i + 1] !== undefined) {
|
if (match[i + 1] === undefined)
|
||||||
rule = state[mapping[i].rule];
|
continue;
|
||||||
|
|
||||||
if (mapping[i].len > 1) {
|
rule = state[mapping[i].rule];
|
||||||
value = match.slice(i+2, i+1+mapping[i].len);
|
|
||||||
}
|
|
||||||
|
|
||||||
// compute token type
|
if (mapping[i].len > 1)
|
||||||
if (typeof rule.token == "function")
|
value = match.slice(i+2, i+1+mapping[i].len);
|
||||||
type = rule.token.apply(this, value);
|
|
||||||
else
|
|
||||||
type = rule.token;
|
|
||||||
|
|
||||||
var next = rule.next;
|
// compute token type
|
||||||
if (next && next !== currentState) {
|
if (typeof rule.token == "function")
|
||||||
currentState = next;
|
type = rule.token.apply(this, value);
|
||||||
state = this.rules[currentState];
|
else
|
||||||
mapping = this.matchMappings[currentState];
|
type = rule.token;
|
||||||
lastIndex = re.lastIndex;
|
|
||||||
|
|
||||||
re = this.regExps[currentState];
|
var next = rule.next;
|
||||||
re.lastIndex = lastIndex;
|
if (next && next !== currentState) {
|
||||||
}
|
currentState = next;
|
||||||
break;
|
state = this.rules[currentState];
|
||||||
|
mapping = this.matchMappings[currentState];
|
||||||
|
lastIndex = re.lastIndex;
|
||||||
|
|
||||||
|
re = this.regExps[currentState];
|
||||||
|
re.lastIndex = lastIndex;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value[0]) {
|
if (value[0]) {
|
||||||
|
|
@ -8602,12 +8616,14 @@ var Tokenizer = function(rules, flag) {
|
||||||
type = [type];
|
type = [type];
|
||||||
}
|
}
|
||||||
for (var i = 0; i < value.length; i++) {
|
for (var i = 0; i < value.length; i++) {
|
||||||
|
if (!value[i])
|
||||||
|
continue;
|
||||||
|
|
||||||
if ((!rule || rule.merge || type[i] === "text") && token.type === type[i]) {
|
if ((!rule || rule.merge || type[i] === "text") && token.type === type[i]) {
|
||||||
token.value += value[i];
|
token.value += value[i];
|
||||||
} else {
|
} else {
|
||||||
if (token.type) {
|
if (token.type)
|
||||||
tokens.push(token);
|
tokens.push(token);
|
||||||
}
|
|
||||||
|
|
||||||
token = {
|
token = {
|
||||||
type: type[i],
|
type: type[i],
|
||||||
|
|
@ -9130,7 +9146,8 @@ var Document = function(text) {
|
||||||
|
|
||||||
position = this.$clipPosition(position);
|
position = this.$clipPosition(position);
|
||||||
|
|
||||||
if (this.getLength() >= 1)
|
// only detect new lines if the document has no line break yet
|
||||||
|
if (this.getLength() <= 1)
|
||||||
this.$detectNewLine(text);
|
this.$detectNewLine(text);
|
||||||
|
|
||||||
var lines = this.$split(text);
|
var lines = this.$split(text);
|
||||||
|
|
@ -11603,7 +11620,7 @@ var CommandManager = function(platform, commands) {
|
||||||
|
|
||||||
var key = typeof binding == "string" ? binding: binding[this.platform];
|
var key = typeof binding == "string" ? binding: binding[this.platform];
|
||||||
this.bindKey(key, command);
|
this.bindKey(key, command);
|
||||||
}
|
};
|
||||||
|
|
||||||
function parseKeys(keys, val, ret) {
|
function parseKeys(keys, val, ret) {
|
||||||
var key;
|
var key;
|
||||||
|
|
@ -11620,10 +11637,10 @@ var CommandManager = function(platform, commands) {
|
||||||
return {
|
return {
|
||||||
key: key,
|
key: key,
|
||||||
hashId: hashId
|
hashId: hashId
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function splitSafe(s, separator) {
|
function splitSafe(s) {
|
||||||
return (s.toLowerCase()
|
return (s.toLowerCase()
|
||||||
.trim()
|
.trim()
|
||||||
.split(new RegExp("[\\s ]*\\-[\\s ]*", "g"), 999));
|
.split(new RegExp("[\\s ]*\\-[\\s ]*", "g"), 999));
|
||||||
|
|
@ -11637,7 +11654,7 @@ var CommandManager = function(platform, commands) {
|
||||||
|
|
||||||
var ckbr = this.commmandKeyBinding;
|
var ckbr = this.commmandKeyBinding;
|
||||||
return ckbr[hashId] && ckbr[hashId][textOrKey.toLowerCase()];
|
return ckbr[hashId] && ckbr[hashId][textOrKey.toLowerCase()];
|
||||||
}
|
};
|
||||||
|
|
||||||
this.exec = function(command, editor, args) {
|
this.exec = function(command, editor, args) {
|
||||||
if (typeof command === 'string')
|
if (typeof command === 'string')
|
||||||
|
|
@ -11689,7 +11706,7 @@ var CommandManager = function(platform, commands) {
|
||||||
this.exec(x, editor);
|
this.exec(x, editor);
|
||||||
else
|
else
|
||||||
this.exec(x[0], editor, x[1]);
|
this.exec(x[0], editor, x[1]);
|
||||||
}, this)
|
}, this);
|
||||||
} finally {
|
} finally {
|
||||||
this.$inReplay = false;
|
this.$inReplay = false;
|
||||||
}
|
}
|
||||||
|
|
@ -11701,9 +11718,9 @@ var CommandManager = function(platform, commands) {
|
||||||
x[0] = x[0].name;
|
x[0] = x[0].name;
|
||||||
if (!x[1])
|
if (!x[1])
|
||||||
x = x[0];
|
x = x[0];
|
||||||
return x
|
return x;
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
}).call(CommandManager.prototype);
|
}).call(CommandManager.prototype);
|
||||||
|
|
||||||
|
|
@ -12453,12 +12470,18 @@ var VirtualRenderer = function(container, theme) {
|
||||||
this.$cursorLayer.showCursor();
|
this.$cursorLayer.showCursor();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.scrollCursorIntoView = function() {
|
this.scrollSelectionIntoView = function(anchor, lead) {
|
||||||
|
// first scroll anchor into view then scroll lead into view
|
||||||
|
this.scrollCursorIntoView(anchor);
|
||||||
|
this.scrollCursorIntoView(lead);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.scrollCursorIntoView = function(cursor) {
|
||||||
// the editor is not visible
|
// the editor is not visible
|
||||||
if (this.$size.scrollerHeight === 0)
|
if (this.$size.scrollerHeight === 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var pos = this.$cursorLayer.getPixelPosition();
|
var pos = this.$cursorLayer.getPixelPosition(cursor);
|
||||||
|
|
||||||
var left = pos.left;
|
var left = pos.left;
|
||||||
var top = pos.top;
|
var top = pos.top;
|
||||||
|
|
|
||||||
|
|
@ -2701,7 +2701,11 @@ var Editor = function(renderer, session) {
|
||||||
this.renderer.updateCursor();
|
this.renderer.updateCursor();
|
||||||
|
|
||||||
if (!this.$blockScrolling) {
|
if (!this.$blockScrolling) {
|
||||||
this.renderer.scrollCursorIntoView();
|
var selection = this.getSelection();
|
||||||
|
if (selection.isEmpty())
|
||||||
|
this.renderer.scrollCursorIntoView(selection.getCursor());
|
||||||
|
else
|
||||||
|
this.renderer.scrollSelectionIntoView(selection.getSelectionLead(), selection.getSelectionAnchor());
|
||||||
}
|
}
|
||||||
|
|
||||||
// move text input over the cursor
|
// move text input over the cursor
|
||||||
|
|
@ -3614,8 +3618,7 @@ var Editor = function(renderer, session) {
|
||||||
|
|
||||||
|
|
||||||
exports.Editor = Editor;
|
exports.Editor = Editor;
|
||||||
});
|
});/* ***** BEGIN LICENSE BLOCK *****
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License Version
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
|
@ -5409,13 +5412,13 @@ exports.commands = [{
|
||||||
}, {
|
}, {
|
||||||
name: "backspace",
|
name: "backspace",
|
||||||
bindKey: bindKey(
|
bindKey: bindKey(
|
||||||
"Ctrl-Backspace|Command-Backspace|Option-Backspace|Shift-Backspace|Backspace",
|
"Command-Backspace|Option-Backspace|Shift-Backspace|Backspace",
|
||||||
"Ctrl-Backspace|Command-Backspace|Shift-Backspace|Backspace|Ctrl-H"
|
"Ctrl-Backspace|Command-Backspace|Shift-Backspace|Backspace|Ctrl-H"
|
||||||
),
|
),
|
||||||
exec: function(editor) { editor.remove("left"); }
|
exec: function(editor) { editor.remove("left"); }
|
||||||
}, {
|
}, {
|
||||||
name: "removetolinestart",
|
name: "removetolinestart",
|
||||||
bindKey: bindKey("Alt-Backspace", "Option-Backspace"),
|
bindKey: bindKey("Alt-Backspace", "Command-Backspace"),
|
||||||
exec: function(editor) { editor.removeToLineStart(); }
|
exec: function(editor) { editor.removeToLineStart(); }
|
||||||
}, {
|
}, {
|
||||||
name: "removetolineend",
|
name: "removetolineend",
|
||||||
|
|
@ -5974,6 +5977,10 @@ var EditSession = function(text, mode) {
|
||||||
return callback(_self.$modes[mode]);
|
return callback(_self.$modes[mode]);
|
||||||
|
|
||||||
_self.$modes[mode] = new module.Mode();
|
_self.$modes[mode] = new module.Mode();
|
||||||
|
_self._emit("loadmode", {
|
||||||
|
name: mode,
|
||||||
|
mode: _self.$modes[mode]
|
||||||
|
});
|
||||||
callback(_self.$modes[mode]);
|
callback(_self.$modes[mode]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -8523,6 +8530,10 @@ var Tokenizer = function(rules, flag) {
|
||||||
var mapping = this.matchMappings[key] = {};
|
var mapping = this.matchMappings[key] = {};
|
||||||
|
|
||||||
for ( var i = 0; i < state.length; i++) {
|
for ( var i = 0; i < state.length; i++) {
|
||||||
|
|
||||||
|
if (state[i].regex instanceof RegExp)
|
||||||
|
state[i].regex = state[i].regex.toString().slice(1, -1);
|
||||||
|
|
||||||
// Count number of matching groups. 2 extra groups from the full match
|
// Count number of matching groups. 2 extra groups from the full match
|
||||||
// And the catch-all on the end (used to force a match);
|
// And the catch-all on the end (used to force a match);
|
||||||
var matchcount = new RegExp("(?:(" + state[i].regex + ")|(.))").exec("a").length - 2;
|
var matchcount = new RegExp("(?:(" + state[i].regex + ")|(.))").exec("a").length - 2;
|
||||||
|
|
@ -8532,6 +8543,9 @@ var Tokenizer = function(rules, flag) {
|
||||||
return "\\" + (parseInt(digit, 10) + matchTotal + 1);
|
return "\\" + (parseInt(digit, 10) + matchTotal + 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (matchcount > 1 && state[i].token.length !== matchcount-1)
|
||||||
|
throw new Error("Matching groups and length of the token array don't match in rule #" + i + " of state " + key);
|
||||||
|
|
||||||
mapping[matchTotal] = {
|
mapping[matchTotal] = {
|
||||||
rule: i,
|
rule: i,
|
||||||
len: matchcount
|
len: matchcount
|
||||||
|
|
@ -8569,31 +8583,31 @@ var Tokenizer = function(rules, flag) {
|
||||||
var value = [match[0]];
|
var value = [match[0]];
|
||||||
|
|
||||||
for (var i = 0; i < match.length-2; i++) {
|
for (var i = 0; i < match.length-2; i++) {
|
||||||
if (match[i + 1] !== undefined) {
|
if (match[i + 1] === undefined)
|
||||||
rule = state[mapping[i].rule];
|
continue;
|
||||||
|
|
||||||
if (mapping[i].len > 1) {
|
rule = state[mapping[i].rule];
|
||||||
value = match.slice(i+2, i+1+mapping[i].len);
|
|
||||||
}
|
|
||||||
|
|
||||||
// compute token type
|
if (mapping[i].len > 1)
|
||||||
if (typeof rule.token == "function")
|
value = match.slice(i+2, i+1+mapping[i].len);
|
||||||
type = rule.token.apply(this, value);
|
|
||||||
else
|
|
||||||
type = rule.token;
|
|
||||||
|
|
||||||
var next = rule.next;
|
// compute token type
|
||||||
if (next && next !== currentState) {
|
if (typeof rule.token == "function")
|
||||||
currentState = next;
|
type = rule.token.apply(this, value);
|
||||||
state = this.rules[currentState];
|
else
|
||||||
mapping = this.matchMappings[currentState];
|
type = rule.token;
|
||||||
lastIndex = re.lastIndex;
|
|
||||||
|
|
||||||
re = this.regExps[currentState];
|
var next = rule.next;
|
||||||
re.lastIndex = lastIndex;
|
if (next && next !== currentState) {
|
||||||
}
|
currentState = next;
|
||||||
break;
|
state = this.rules[currentState];
|
||||||
|
mapping = this.matchMappings[currentState];
|
||||||
|
lastIndex = re.lastIndex;
|
||||||
|
|
||||||
|
re = this.regExps[currentState];
|
||||||
|
re.lastIndex = lastIndex;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value[0]) {
|
if (value[0]) {
|
||||||
|
|
@ -8602,12 +8616,14 @@ var Tokenizer = function(rules, flag) {
|
||||||
type = [type];
|
type = [type];
|
||||||
}
|
}
|
||||||
for (var i = 0; i < value.length; i++) {
|
for (var i = 0; i < value.length; i++) {
|
||||||
|
if (!value[i])
|
||||||
|
continue;
|
||||||
|
|
||||||
if ((!rule || rule.merge || type[i] === "text") && token.type === type[i]) {
|
if ((!rule || rule.merge || type[i] === "text") && token.type === type[i]) {
|
||||||
token.value += value[i];
|
token.value += value[i];
|
||||||
} else {
|
} else {
|
||||||
if (token.type) {
|
if (token.type)
|
||||||
tokens.push(token);
|
tokens.push(token);
|
||||||
}
|
|
||||||
|
|
||||||
token = {
|
token = {
|
||||||
type: type[i],
|
type: type[i],
|
||||||
|
|
@ -9130,7 +9146,8 @@ var Document = function(text) {
|
||||||
|
|
||||||
position = this.$clipPosition(position);
|
position = this.$clipPosition(position);
|
||||||
|
|
||||||
if (this.getLength() >= 1)
|
// only detect new lines if the document has no line break yet
|
||||||
|
if (this.getLength() <= 1)
|
||||||
this.$detectNewLine(text);
|
this.$detectNewLine(text);
|
||||||
|
|
||||||
var lines = this.$split(text);
|
var lines = this.$split(text);
|
||||||
|
|
@ -11603,7 +11620,7 @@ var CommandManager = function(platform, commands) {
|
||||||
|
|
||||||
var key = typeof binding == "string" ? binding: binding[this.platform];
|
var key = typeof binding == "string" ? binding: binding[this.platform];
|
||||||
this.bindKey(key, command);
|
this.bindKey(key, command);
|
||||||
}
|
};
|
||||||
|
|
||||||
function parseKeys(keys, val, ret) {
|
function parseKeys(keys, val, ret) {
|
||||||
var key;
|
var key;
|
||||||
|
|
@ -11620,10 +11637,10 @@ var CommandManager = function(platform, commands) {
|
||||||
return {
|
return {
|
||||||
key: key,
|
key: key,
|
||||||
hashId: hashId
|
hashId: hashId
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function splitSafe(s, separator) {
|
function splitSafe(s) {
|
||||||
return (s.toLowerCase()
|
return (s.toLowerCase()
|
||||||
.trim()
|
.trim()
|
||||||
.split(new RegExp("[\\s ]*\\-[\\s ]*", "g"), 999));
|
.split(new RegExp("[\\s ]*\\-[\\s ]*", "g"), 999));
|
||||||
|
|
@ -11637,7 +11654,7 @@ var CommandManager = function(platform, commands) {
|
||||||
|
|
||||||
var ckbr = this.commmandKeyBinding;
|
var ckbr = this.commmandKeyBinding;
|
||||||
return ckbr[hashId] && ckbr[hashId][textOrKey.toLowerCase()];
|
return ckbr[hashId] && ckbr[hashId][textOrKey.toLowerCase()];
|
||||||
}
|
};
|
||||||
|
|
||||||
this.exec = function(command, editor, args) {
|
this.exec = function(command, editor, args) {
|
||||||
if (typeof command === 'string')
|
if (typeof command === 'string')
|
||||||
|
|
@ -11689,7 +11706,7 @@ var CommandManager = function(platform, commands) {
|
||||||
this.exec(x, editor);
|
this.exec(x, editor);
|
||||||
else
|
else
|
||||||
this.exec(x[0], editor, x[1]);
|
this.exec(x[0], editor, x[1]);
|
||||||
}, this)
|
}, this);
|
||||||
} finally {
|
} finally {
|
||||||
this.$inReplay = false;
|
this.$inReplay = false;
|
||||||
}
|
}
|
||||||
|
|
@ -11701,9 +11718,9 @@ var CommandManager = function(platform, commands) {
|
||||||
x[0] = x[0].name;
|
x[0] = x[0].name;
|
||||||
if (!x[1])
|
if (!x[1])
|
||||||
x = x[0];
|
x = x[0];
|
||||||
return x
|
return x;
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
}).call(CommandManager.prototype);
|
}).call(CommandManager.prototype);
|
||||||
|
|
||||||
|
|
@ -12453,12 +12470,18 @@ var VirtualRenderer = function(container, theme) {
|
||||||
this.$cursorLayer.showCursor();
|
this.$cursorLayer.showCursor();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.scrollCursorIntoView = function() {
|
this.scrollSelectionIntoView = function(anchor, lead) {
|
||||||
|
// first scroll anchor into view then scroll lead into view
|
||||||
|
this.scrollCursorIntoView(anchor);
|
||||||
|
this.scrollCursorIntoView(lead);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.scrollCursorIntoView = function(cursor) {
|
||||||
// the editor is not visible
|
// the editor is not visible
|
||||||
if (this.$size.scrollerHeight === 0)
|
if (this.$size.scrollerHeight === 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var pos = this.$cursorLayer.getPixelPosition();
|
var pos = this.$cursorLayer.getPixelPosition(cursor);
|
||||||
|
|
||||||
var left = pos.left;
|
var left = pos.left;
|
||||||
var top = pos.top;
|
var top = pos.top;
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -541,12 +541,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -558,7 +558,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -576,7 +576,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -601,12 +601,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -618,7 +618,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -637,14 +637,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -665,7 +666,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -674,19 +675,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -695,7 +696,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -705,7 +706,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -541,12 +541,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -558,7 +558,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -576,7 +576,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -601,12 +601,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -618,7 +618,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -637,14 +637,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -665,7 +666,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -674,19 +675,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -695,7 +696,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -705,7 +706,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -259,9 +259,9 @@ var ClojureHighlightRules = function() {
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : ";.*$"
|
regex : ";.*$"
|
||||||
}, {
|
}, {
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
regex : "^\=begin$",
|
regex : "^=begin$",
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "keyword", //parens
|
token : "keyword", //parens
|
||||||
regex : "[\\(|\\)]"
|
regex : "[\\(|\\)]"
|
||||||
|
|
@ -314,17 +314,17 @@ var ClojureHighlightRules = function() {
|
||||||
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||||
}, {
|
}, {
|
||||||
token : "string", // symbol
|
token : "string", // symbol
|
||||||
regex : "[:](?:[a-zA-Z]|\d)+"
|
regex : "[:](?:[a-zA-Z]|\\d)+"
|
||||||
}, {
|
}, {
|
||||||
token : "string.regexp", //Regular Expressions
|
token : "string.regexp", //Regular Expressions
|
||||||
regex : '/#"(?:\.|(\\\")|[^\""\n])*"/g'
|
regex : '/#"(?:\\.|(?:\\\")|[^\""\n])*"/g'
|
||||||
}
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
"comment" : [
|
"comment" : [
|
||||||
{
|
{
|
||||||
token : "comment", // closing comment
|
token : "comment", // closing comment
|
||||||
regex : "^\=end$",
|
regex : "^=end$",
|
||||||
next : "start"
|
next : "start"
|
||||||
}, {
|
}, {
|
||||||
token : "comment", // comment spanning whole line
|
token : "comment", // comment spanning whole line
|
||||||
|
|
|
||||||
|
|
@ -259,9 +259,9 @@ var ClojureHighlightRules = function() {
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : ";.*$"
|
regex : ";.*$"
|
||||||
}, {
|
}, {
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
regex : "^\=begin$",
|
regex : "^=begin$",
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "keyword", //parens
|
token : "keyword", //parens
|
||||||
regex : "[\\(|\\)]"
|
regex : "[\\(|\\)]"
|
||||||
|
|
@ -314,17 +314,17 @@ var ClojureHighlightRules = function() {
|
||||||
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||||
}, {
|
}, {
|
||||||
token : "string", // symbol
|
token : "string", // symbol
|
||||||
regex : "[:](?:[a-zA-Z]|\d)+"
|
regex : "[:](?:[a-zA-Z]|\\d)+"
|
||||||
}, {
|
}, {
|
||||||
token : "string.regexp", //Regular Expressions
|
token : "string.regexp", //Regular Expressions
|
||||||
regex : '/#"(?:\.|(\\\")|[^\""\n])*"/g'
|
regex : '/#"(?:\\.|(?:\\\")|[^\""\n])*"/g'
|
||||||
}
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
"comment" : [
|
"comment" : [
|
||||||
{
|
{
|
||||||
token : "comment", // closing comment
|
token : "comment", // closing comment
|
||||||
regex : "^\=end$",
|
regex : "^=end$",
|
||||||
next : "start"
|
next : "start"
|
||||||
}, {
|
}, {
|
||||||
token : "comment", // comment spanning whole line
|
token : "comment", // comment spanning whole line
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -528,12 +528,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -545,7 +545,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -563,7 +563,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -588,12 +588,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -605,7 +605,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -624,14 +624,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -652,7 +653,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -661,19 +662,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -682,7 +683,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -692,7 +693,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
@ -1350,13 +1352,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -1368,51 +1370,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : "support.function",
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : "support.function.dom",
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : "support.constant",
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /\b(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -1435,29 +1507,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
|
||||||
|
|
@ -528,12 +528,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -545,7 +545,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -563,7 +563,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -588,12 +588,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -605,7 +605,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -624,14 +624,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -652,7 +653,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -661,19 +662,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -682,7 +683,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -692,7 +693,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
@ -1350,13 +1352,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -1368,51 +1370,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : "support.function",
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : "support.function.dom",
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : "support.constant",
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /\b(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -1435,29 +1507,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -391,12 +391,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -408,7 +408,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -426,7 +426,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -451,12 +451,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -468,7 +468,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -487,14 +487,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -515,7 +516,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -524,19 +525,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -545,7 +546,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -555,7 +556,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -391,12 +391,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -408,7 +408,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -426,7 +426,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -451,12 +451,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -468,7 +468,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -487,14 +487,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -515,7 +516,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -524,19 +525,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -545,7 +546,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -555,7 +556,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -302,13 +302,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -320,51 +320,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : "support.function",
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : "support.function.dom",
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : "support.constant",
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /\b(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -387,29 +457,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
@ -778,12 +848,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -795,7 +865,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -813,7 +883,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -838,12 +908,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -855,7 +925,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -874,14 +944,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -902,7 +973,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -911,19 +982,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -932,7 +1003,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -942,7 +1013,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -302,13 +302,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -320,51 +320,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : "support.function",
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : "support.function.dom",
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : "support.constant",
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /\b(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -387,29 +457,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
@ -778,12 +848,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -795,7 +865,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -813,7 +883,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -838,12 +908,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -855,7 +925,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -874,14 +944,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -902,7 +973,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -911,19 +982,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -932,7 +1003,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -942,7 +1013,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -391,12 +391,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -408,7 +408,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -426,7 +426,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -451,12 +451,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -468,7 +468,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -487,14 +487,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -515,7 +516,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -524,19 +525,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -545,7 +546,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -555,7 +556,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -391,12 +391,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -408,7 +408,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -426,7 +426,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -451,12 +451,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -468,7 +468,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -487,14 +487,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -515,7 +516,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -524,19 +525,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -545,7 +546,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -555,7 +556,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -361,13 +361,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -379,51 +379,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : "support.function",
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : "support.function.dom",
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : "support.constant",
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /\b(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -446,29 +516,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
@ -837,12 +907,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -854,7 +924,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -872,7 +942,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -897,12 +967,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -914,7 +984,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -933,14 +1003,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -961,7 +1032,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -970,19 +1041,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -991,7 +1062,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -1001,7 +1072,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -361,13 +361,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -379,51 +379,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : "support.function",
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : "support.function.dom",
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : "support.constant",
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /\b(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -446,29 +516,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
@ -837,12 +907,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -854,7 +924,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -872,7 +942,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -897,12 +967,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -914,7 +984,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -933,14 +1003,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -961,7 +1032,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -970,19 +1041,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -991,7 +1062,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -1001,7 +1072,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -303,13 +303,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -321,51 +321,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : "support.function",
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : "support.function.dom",
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : "support.constant",
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /\b(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -388,29 +458,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
@ -779,12 +849,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -796,7 +866,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -814,7 +884,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -839,12 +909,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -856,7 +926,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -875,14 +945,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -903,7 +974,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -912,19 +983,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -933,7 +1004,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -943,7 +1014,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -303,13 +303,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -321,51 +321,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : "support.function",
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : "support.function.dom",
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : "support.constant",
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /\b(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -388,29 +458,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
@ -779,12 +849,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -796,7 +866,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -814,7 +884,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -839,12 +909,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -856,7 +926,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -875,14 +945,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -903,7 +974,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -912,19 +983,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -933,7 +1004,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -943,7 +1014,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -278,13 +278,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -296,51 +296,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : "support.function",
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : "support.function.dom",
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : "support.constant",
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /\b(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -363,29 +433,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
@ -754,12 +824,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -771,7 +841,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -789,7 +859,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -814,12 +884,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -831,7 +901,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -850,14 +920,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -878,7 +949,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -887,19 +958,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -908,7 +979,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -918,7 +989,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -278,13 +278,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -296,51 +296,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : "support.function",
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : "support.function.dom",
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : "support.constant",
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /\b(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -363,29 +433,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
@ -754,12 +824,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -771,7 +841,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -789,7 +859,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -814,12 +884,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -831,7 +901,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -850,14 +920,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -878,7 +949,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -887,19 +958,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -908,7 +979,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -918,7 +989,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -319,12 +319,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -336,7 +336,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -354,7 +354,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -379,12 +379,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -396,7 +396,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -415,14 +415,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -443,7 +444,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -452,19 +453,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -473,7 +474,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -483,7 +484,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -319,12 +319,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -336,7 +336,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -354,7 +354,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -379,12 +379,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -396,7 +396,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -415,14 +415,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -443,7 +444,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -452,19 +453,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -473,7 +474,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -483,7 +484,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
1
build/src/mode-liquid-noconflict.js
Normal file
1
build/src/mode-liquid-noconflict.js
Normal file
File diff suppressed because one or more lines are too long
1368
build/src/mode-liquid-uncompressed-noconflict.js
Normal file
1368
build/src/mode-liquid-uncompressed-noconflict.js
Normal file
File diff suppressed because it is too large
Load diff
1368
build/src/mode-liquid-uncompressed.js
Normal file
1368
build/src/mode-liquid-uncompressed.js
Normal file
File diff suppressed because it is too large
Load diff
1
build/src/mode-liquid.js
Normal file
1
build/src/mode-liquid.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -358,13 +358,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -376,51 +376,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : "support.function",
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : "support.function.dom",
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : "support.constant",
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /\b(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -443,29 +513,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
@ -834,12 +904,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -851,7 +921,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -869,7 +939,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -894,12 +964,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -911,7 +981,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -930,14 +1000,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -958,7 +1029,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -967,19 +1038,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -988,7 +1059,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -998,7 +1069,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
@ -2718,7 +2790,7 @@ var MarkdownHighlightRules = function() {
|
||||||
token : "empty_line",
|
token : "empty_line",
|
||||||
regex : '^$'
|
regex : '^$'
|
||||||
}, { // code span `
|
}, { // code span `
|
||||||
token : "support.function",
|
token : ["support.function", "support.function", "support.function"],
|
||||||
regex : "(`+)([^\\r]*?[^`])(\\1)"
|
regex : "(`+)([^\\r]*?[^`])(\\1)"
|
||||||
}, { // code block
|
}, { // code block
|
||||||
token : "support.function",
|
token : "support.function",
|
||||||
|
|
@ -2748,7 +2820,7 @@ var MarkdownHighlightRules = function() {
|
||||||
next : "blockquote"
|
next : "blockquote"
|
||||||
}, { // reference
|
}, { // reference
|
||||||
token : ["text", "constant", "text", "url", "string", "text"],
|
token : ["text", "constant", "text", "url", "string", "text"],
|
||||||
regex : "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?\\s*)$"
|
regex : "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?(\\s*))$"
|
||||||
}, { // link by reference
|
}, { // link by reference
|
||||||
token : ["text", "string", "text", "constant", "text"],
|
token : ["text", "string", "text", "constant", "text"],
|
||||||
regex : "(\\[)((?:[[^\\]]*\\]|[^\\[\\]])*)(\\][ ]?(?:\\n[ ]*)?\\[)(.*?)(\\])"
|
regex : "(\\[)((?:[[^\\]]*\\]|[^\\[\\]])*)(\\][ ]?(?:\\n[ ]*)?\\[)(.*?)(\\])"
|
||||||
|
|
@ -2774,10 +2846,10 @@ var MarkdownHighlightRules = function() {
|
||||||
regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
|
regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
|
||||||
next : "listblock"
|
next : "listblock"
|
||||||
}, { // strong ** __
|
}, { // strong ** __
|
||||||
token : "string",
|
token : ["string", "string", "string"],
|
||||||
regex : "([*]{2}|[_]{2}(?=\\S))([^\\r]*?\\S[*_]*)(\\1)"
|
regex : "([*]{2}|[_]{2}(?=\\S))([^\\r]*?\\S[*_]*)(\\1)"
|
||||||
}, { // emphasis * _
|
}, { // emphasis * _
|
||||||
token : "string",
|
token : ["string", "string", "string"],
|
||||||
regex : "([*]|[_](?=\\S))([^\\r]*?\\S[*_]*)(\\1)"
|
regex : "([*]|[_](?=\\S))([^\\r]*?\\S[*_]*)(\\1)"
|
||||||
}, { //
|
}, { //
|
||||||
token : ["text", "url", "text"],
|
token : ["text", "url", "text"],
|
||||||
|
|
|
||||||
|
|
@ -358,13 +358,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -376,51 +376,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : "support.function",
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : "support.function.dom",
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : "support.constant",
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /\b(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -443,29 +513,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
@ -834,12 +904,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -851,7 +921,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -869,7 +939,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -894,12 +964,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -911,7 +981,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -930,14 +1000,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -958,7 +1029,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -967,19 +1038,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -988,7 +1059,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -998,7 +1069,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
@ -2718,7 +2790,7 @@ var MarkdownHighlightRules = function() {
|
||||||
token : "empty_line",
|
token : "empty_line",
|
||||||
regex : '^$'
|
regex : '^$'
|
||||||
}, { // code span `
|
}, { // code span `
|
||||||
token : "support.function",
|
token : ["support.function", "support.function", "support.function"],
|
||||||
regex : "(`+)([^\\r]*?[^`])(\\1)"
|
regex : "(`+)([^\\r]*?[^`])(\\1)"
|
||||||
}, { // code block
|
}, { // code block
|
||||||
token : "support.function",
|
token : "support.function",
|
||||||
|
|
@ -2748,7 +2820,7 @@ var MarkdownHighlightRules = function() {
|
||||||
next : "blockquote"
|
next : "blockquote"
|
||||||
}, { // reference
|
}, { // reference
|
||||||
token : ["text", "constant", "text", "url", "string", "text"],
|
token : ["text", "constant", "text", "url", "string", "text"],
|
||||||
regex : "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?\\s*)$"
|
regex : "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?(\\s*))$"
|
||||||
}, { // link by reference
|
}, { // link by reference
|
||||||
token : ["text", "string", "text", "constant", "text"],
|
token : ["text", "string", "text", "constant", "text"],
|
||||||
regex : "(\\[)((?:[[^\\]]*\\]|[^\\[\\]])*)(\\][ ]?(?:\\n[ ]*)?\\[)(.*?)(\\])"
|
regex : "(\\[)((?:[[^\\]]*\\]|[^\\[\\]])*)(\\][ ]?(?:\\n[ ]*)?\\[)(.*?)(\\])"
|
||||||
|
|
@ -2774,10 +2846,10 @@ var MarkdownHighlightRules = function() {
|
||||||
regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
|
regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
|
||||||
next : "listblock"
|
next : "listblock"
|
||||||
}, { // strong ** __
|
}, { // strong ** __
|
||||||
token : "string",
|
token : ["string", "string", "string"],
|
||||||
regex : "([*]{2}|[_]{2}(?=\\S))([^\\r]*?\\S[*_]*)(\\1)"
|
regex : "([*]{2}|[_]{2}(?=\\S))([^\\r]*?\\S[*_]*)(\\1)"
|
||||||
}, { // emphasis * _
|
}, { // emphasis * _
|
||||||
token : "string",
|
token : ["string", "string", "string"],
|
||||||
regex : "([*]|[_](?=\\S))([^\\r]*?\\S[*_]*)(\\1)"
|
regex : "([*]|[_](?=\\S))([^\\r]*?\\S[*_]*)(\\1)"
|
||||||
}, { //
|
}, { //
|
||||||
token : ["text", "url", "text"],
|
token : ["text", "url", "text"],
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1165,7 +1165,7 @@ var PhpHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
regex : '[^"]+'
|
regex : '[^"]+'
|
||||||
},
|
}
|
||||||
],
|
],
|
||||||
"qstring" : [
|
"qstring" : [
|
||||||
{
|
{
|
||||||
|
|
@ -1213,7 +1213,7 @@ var PhpHighlightRules = function() {
|
||||||
next : "htmltag"
|
next : "htmltag"
|
||||||
}, {
|
}, {
|
||||||
token : "meta.tag",
|
token : "meta.tag",
|
||||||
regex : ">",
|
regex : ">"
|
||||||
}, {
|
}, {
|
||||||
token : 'text',
|
token : 'text',
|
||||||
regex : "(?:media|type|href)"
|
regex : "(?:media|type|href)"
|
||||||
|
|
@ -1223,7 +1223,7 @@ var PhpHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "\{",
|
regex : "\{",
|
||||||
next : "cssdeclaration",
|
next : "cssdeclaration"
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "#[A-Za-z0-9\-\_\.]+"
|
regex : "#[A-Za-z0-9\-\_\.]+"
|
||||||
|
|
@ -1265,7 +1265,7 @@ var PhpHighlightRules = function() {
|
||||||
regex : ";",
|
regex : ";",
|
||||||
next : "cssdeclaration"
|
next : "cssdeclaration"
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||||
|
|
@ -1507,12 +1507,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -1524,7 +1524,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -1542,7 +1542,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -1567,12 +1567,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -1584,7 +1584,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1603,14 +1603,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -1631,7 +1632,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -1640,19 +1641,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1661,7 +1662,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -1671,7 +1672,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -1165,7 +1165,7 @@ var PhpHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
regex : '[^"]+'
|
regex : '[^"]+'
|
||||||
},
|
}
|
||||||
],
|
],
|
||||||
"qstring" : [
|
"qstring" : [
|
||||||
{
|
{
|
||||||
|
|
@ -1213,7 +1213,7 @@ var PhpHighlightRules = function() {
|
||||||
next : "htmltag"
|
next : "htmltag"
|
||||||
}, {
|
}, {
|
||||||
token : "meta.tag",
|
token : "meta.tag",
|
||||||
regex : ">",
|
regex : ">"
|
||||||
}, {
|
}, {
|
||||||
token : 'text',
|
token : 'text',
|
||||||
regex : "(?:media|type|href)"
|
regex : "(?:media|type|href)"
|
||||||
|
|
@ -1223,7 +1223,7 @@ var PhpHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "\{",
|
regex : "\{",
|
||||||
next : "cssdeclaration",
|
next : "cssdeclaration"
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "#[A-Za-z0-9\-\_\.]+"
|
regex : "#[A-Za-z0-9\-\_\.]+"
|
||||||
|
|
@ -1265,7 +1265,7 @@ var PhpHighlightRules = function() {
|
||||||
regex : ";",
|
regex : ";",
|
||||||
next : "cssdeclaration"
|
next : "cssdeclaration"
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||||
|
|
@ -1507,12 +1507,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -1524,7 +1524,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -1542,7 +1542,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -1567,12 +1567,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -1584,7 +1584,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1603,14 +1603,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -1631,7 +1632,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -1640,19 +1641,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1661,7 +1662,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -1671,7 +1672,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -329,12 +329,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -346,7 +346,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -364,7 +364,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -389,12 +389,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -406,7 +406,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -425,14 +425,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -453,7 +454,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -462,19 +463,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -483,7 +484,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -493,7 +494,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -329,12 +329,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -346,7 +346,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -364,7 +364,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -389,12 +389,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -406,7 +406,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -425,14 +425,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -453,7 +454,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -462,19 +463,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -483,7 +484,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -493,7 +494,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -529,12 +529,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -546,7 +546,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -564,7 +564,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -589,12 +589,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -606,7 +606,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -625,14 +625,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -653,7 +654,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -662,19 +663,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -683,7 +684,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -693,7 +694,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue