summaryrefslogtreecommitdiffstats
path: root/apps/files_texteditor/js/aceeditor/mode-groovy-uncompressed.js
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_texteditor/js/aceeditor/mode-groovy-uncompressed.js')
-rwxr-xr-xapps/files_texteditor/js/aceeditor/mode-groovy-uncompressed.js438
1 files changed, 173 insertions, 265 deletions
diff --git a/apps/files_texteditor/js/aceeditor/mode-groovy-uncompressed.js b/apps/files_texteditor/js/aceeditor/mode-groovy-uncompressed.js
index b6067e87773..8fc01d4054c 100755
--- a/apps/files_texteditor/js/aceeditor/mode-groovy-uncompressed.js
+++ b/apps/files_texteditor/js/aceeditor/mode-groovy-uncompressed.js
@@ -281,12 +281,20 @@ var JavaScriptHighlightRules = function() {
);
// TODO: Unicode escape sequences
- var identifierRe = "[" + unicode.packages.L + "\\$_]["
+ var identifierRe = "[" + unicode.packages.L + "\\$_]["
+ unicode.packages.L
+ unicode.packages.Mn + unicode.packages.Mc
+ unicode.packages.Nd
+ unicode.packages.Pc + "\\$_]*\\b";
-
+
+ var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
+ "u[0-9a-fA-F]{4}|" + // unicode
+ "[0-2][0-7]{0,2}|" + // oct
+ "3[0-6][0-7]?|" + // oct
+ "37[0-7]?|" + // oct
+ "[4-7][0-7]?|" + //oct
+ ".)";
+
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
@@ -294,54 +302,147 @@ var JavaScriptHighlightRules = function() {
"start" : [
{
token : "comment",
- regex : "\\/\\/.*$"
+ regex : /\/\/.*$/
},
new DocCommentHighlightRules().getStartRule("doc-start"),
{
token : "comment", // multi line comment
merge : true,
- regex : "\\/\\*",
+ regex : /\/\*/,
next : "comment"
}, {
- token : "string", // single line
- regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
- }, {
- token : "string", // multi line string start
- merge : true,
- regex : '["].*\\\\$',
- next : "qqstring"
- }, {
- token : "string", // single line
- regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
+ token : "string",
+ regex : "'",
+ next : "qstring"
}, {
- token : "string", // multi line string start
- merge : true,
- regex : "['].*\\\\$",
- next : "qstring"
+ token : "string",
+ regex : '"',
+ next : "qqstring"
}, {
token : "constant.numeric", // hex
- regex : "0[xX][0-9a-fA-F]+\\b"
+ regex : /0[xX][0-9a-fA-F]+\b/
}, {
token : "constant.numeric", // float
- regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
- }, {
- token : ["keyword.definition", "text", "entity.name.function"],
- regex : "(function)(\\s+)(" + identifierRe + ")"
+ regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
+ }, { // 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"
+ ],
+ regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
+ }, { // match stuff like: Sound.prototype.play = myfunc
+ token : [
+ "storage.type",
+ "punctuation.operator",
+ "support.function",
+ "punctuation.operator",
+ "entity.name.function",
+ "text",
+ "keyword.operator",
+ "text"
+ ],
+ regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
+ }, { // 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"
+ ],
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
+ }, { // match stuff like: play = function() { }
+ token : [
+ "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) { }
+ token : [
+ "storage.type",
+ "text",
+ "entity.name.function",
+ "text",
+ "paren.lparen",
+ "variable.parameter",
+ "paren.rparen"
+ ],
+ regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
+ }, { // match stuff like: foobar: function() { }
+ token : [
+ "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() { })
+ token : [
+ "text",
+ "text",
+ "storage.type",
+ "text",
+ "paren.lparen",
+ "variable.parameter",
+ "paren.rparen"
+ ],
+ regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
}, {
token : "constant.language.boolean",
- regex : "(?:true|false)\\b"
+ regex : /(?:true|false)\b/
}, {
token : "keyword",
regex : "(?:" + kwBeforeRe + ")\\b",
next : "regex_allowed"
}, {
+ token : ["punctuation.operator", "support.function"],
+ regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:opzzzz|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 : ["punctuation.operator", "support.function.dom"],
+ regex : /(\.)(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 : ["punctuation.operator", "support.constant"],
+ regex : /(\.)(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 : ["storage.type", "punctuation.operator", "support.function.firebug"],
+ regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
+ }, {
token : function(value) {
if (globals.hasOwnProperty(value))
return "variable.language";
else if (deprecated.hasOwnProperty(value))
return "invalid.deprecated";
else if (definitions.hasOwnProperty(value))
- return "keyword.definition";
+ return "storage.type";
else if (keywords.hasOwnProperty(value))
return "keyword";
else if (buildinConstants.hasOwnProperty(value))
@@ -356,29 +457,29 @@ var JavaScriptHighlightRules = function() {
regex : identifierRe
}, {
token : "keyword.operator",
- regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
+ regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
next : "regex_allowed"
}, {
token : "punctuation.operator",
- regex : "\\?|\\:|\\,|\\;|\\.",
+ regex : /\?|\:|\,|\;|\./,
next : "regex_allowed"
}, {
token : "paren.lparen",
- regex : "[[({]",
+ regex : /[\[({]/,
next : "regex_allowed"
}, {
token : "paren.rparen",
- regex : "[\\])}]"
+ regex : /[\])}]/
}, {
token : "keyword.operator",
- regex : "\\/=?",
+ regex : /\/=?/,
next : "regex_allowed"
}, {
token: "comment",
- regex: "^#!.*$"
+ regex: /^#!.*$/
}, {
token : "text",
- regex : "\\s+"
+ regex : /\s+/
}
],
// regular expressions are only allowed after certain tokens. This
@@ -403,7 +504,7 @@ var JavaScriptHighlightRules = function() {
}, {
// immediately return to the start mode without matching
// anything
- token: "empty",
+ token: "empty",
regex: "",
next: "start"
}
@@ -415,10 +516,10 @@ var JavaScriptHighlightRules = function() {
next: "regex"
}, {
// flag
- token: "string.regexp",
+ token: "string.regexp",
regex: "/\\w*",
next: "start",
- merge: true
+ merge: true
}, {
token: "string.regexp",
regex: "[^\\\\/\\[]+",
@@ -430,9 +531,9 @@ var JavaScriptHighlightRules = function() {
next: "regex_character_class",
merge: true
}, {
- token: "empty",
+ token: "empty",
regex: "",
- next: "start"
+ next: "start"
}
],
"regex_character_class": [
@@ -451,9 +552,9 @@ var JavaScriptHighlightRules = function() {
next: "regex_character_class",
merge: true
}, {
- token: "empty",
+ token: "empty",
regex: "",
- next: "start"
+ next: "start"
}
],
"comment_regex_allowed" : [
@@ -482,28 +583,32 @@ var JavaScriptHighlightRules = function() {
],
"qqstring" : [
{
+ token : "constant.language.escape",
+ regex : escapedRe
+ }, {
token : "string",
- regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
- next : "start"
+ regex : '[^"\\\\]+'
}, {
token : "string",
- merge : true,
- regex : '.+'
+ regex : '"',
+ next : "start"
}
],
"qstring" : [
{
+ token : "constant.language.escape",
+ regex : escapedRe
+ }, {
token : "string",
- regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
- next : "start"
+ regex : "[^'\\\\]+"
}, {
token : "string",
- merge : true,
- regex : '.+'
+ regex : "'",
+ next : "start"
}
]
};
-
+
this.embedRules(DocCommentHighlightRules, "doc-",
[ new DocCommentHighlightRules().getEndRule("start") ]);
};
@@ -689,195 +794,6 @@ var MatchingBraceOutdent = function() {};
exports.MatchingBraceOutdent = MatchingBraceOutdent;
});
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Ajax.org Code Editor (ACE).
- *
- * The Initial Developer of the Original Code is
- * Ajax.org B.V.
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Fabian Jakobs <fabian AT ajax DOT org>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-define('ace/worker/worker_client', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event_emitter'], function(require, exports, module) {
-"use strict";
-
-var oop = require("../lib/oop");
-var EventEmitter = require("../lib/event_emitter").EventEmitter;
-
-var WorkerClient = function(topLevelNamespaces, packagedJs, mod, classname) {
-
- this.changeListener = this.changeListener.bind(this);
-
- if (module.packaged) {
- var base = this.$guessBasePath();
- this.$worker = new Worker(base + packagedJs);
- }
- else {
- var workerUrl = this.$normalizePath(require.nameToUrl("ace/worker/worker", null, "_"));
- this.$worker = new Worker(workerUrl);
-
- var tlns = {};
- for (var i=0; i<topLevelNamespaces.length; i++) {
- var ns = topLevelNamespaces[i];
- var path = this.$normalizePath(require.nameToUrl(ns, null, "_").replace(/.js$/, ""));
-
- tlns[ns] = path;
- }
- }
-
- this.$worker.postMessage({
- init : true,
- tlns: tlns,
- module: mod,
- classname: classname
- });
-
- this.callbackId = 1;
- this.callbacks = {};
-
- var _self = this;
- this.$worker.onerror = function(e) {
- window.console && console.log && console.log(e);
- throw e;
- };
- this.$worker.onmessage = function(e) {
- var msg = e.data;
- switch(msg.type) {
- case "log":
- window.console && console.log && console.log(msg.data);
- break;
-
- case "event":
- _self._emit(msg.name, {data: msg.data});
- break;
-
- case "call":
- var callback = _self.callbacks[msg.id];
- if (callback) {
- callback(msg.data);
- delete _self.callbacks[msg.id];
- }
- break;
- }
- };
-};
-
-(function(){
-
- oop.implement(this, EventEmitter);
-
- this.$normalizePath = function(path) {
- path = path.replace(/^[a-z]+:\/\/[^\/]+\//, ""); // Remove domain name and rebuild it
- path = location.protocol + "//" + location.host
- // paths starting with a slash are relative to the root (host)
- + (path.charAt(0) == "/" ? "" : location.pathname.replace(/\/[^\/]*$/, ""))
- + "/" + path.replace(/^[\/]+/, "");
- return path;
- };
-
- this.$guessBasePath = function() {
- if (require.aceBaseUrl)
- return require.aceBaseUrl;
-
- var scripts = document.getElementsByTagName("script");
- for (var i=0; i<scripts.length; i++) {
- var script = scripts[i];
-
- var base = script.getAttribute("data-ace-base");
- if (base)
- return base.replace(/\/*$/, "/");
-
- var src = script.src || script.getAttribute("src");
- if (!src) {
- continue;
- }
- var m = src.match(/^(?:(.*\/)ace\.js|(.*\/)ace(-uncompressed)?(-noconflict)?\.js)(?:\?|$)/);
- if (m)
- return m[1] || m[2];
- }
- return "";
- };
-
- this.terminate = function() {
- this._emit("terminate", {});
- this.$worker.terminate();
- this.$worker = null;
- this.$doc.removeEventListener("change", this.changeListener);
- this.$doc = null;
- };
-
- this.send = function(cmd, args) {
- this.$worker.postMessage({command: cmd, args: args});
- };
-
- this.call = function(cmd, args, callback) {
- if (callback) {
- var id = this.callbackId++;
- this.callbacks[id] = callback;
- args.push(id);
- }
- this.send(cmd, args);
- };
-
- this.emit = function(event, data) {
- try {
- // firefox refuses to clone objects which have function properties
- // TODO: cleanup event
- this.$worker.postMessage({event: event, data: {data: data.data}});
- }
- catch(ex) {}
- };
-
- this.attachToDocument = function(doc) {
- if(this.$doc)
- this.terminate();
-
- this.$doc = doc;
- this.call("setValue", [doc.getValue()]);
- doc.on("change", this.changeListener);
- };
-
- this.changeListener = function(e) {
- e.range = {
- start: e.data.range.start,
- end: e.data.range.end
- };
- this.emit("change", e);
- };
-
-}).call(WorkerClient.prototype);
-
-exports.WorkerClient = WorkerClient;
-
-});
/* vim:ts=4:sts=4:sw=4:
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
@@ -932,12 +848,12 @@ var CstyleBehaviour = function () {
return {
text: '{' + selected + '}',
selection: false
- }
+ };
} else {
return {
text: '{}',
selection: [1, 1]
- }
+ };
}
} else if (text == '}') {
var cursor = editor.getCursorPosition();
@@ -949,7 +865,7 @@ var CstyleBehaviour = function () {
return {
text: '',
selection: [1, 1]
- }
+ };
}
}
} else if (text == "\n") {
@@ -967,7 +883,7 @@ var CstyleBehaviour = function () {
return {
text: '\n' + indent + '\n' + next_indent,
selection: [1, indent.length, 1, indent.length]
- }
+ };
}
}
});
@@ -992,12 +908,12 @@ var CstyleBehaviour = function () {
return {
text: '(' + selected + ')',
selection: false
- }
+ };
} else {
return {
text: '()',
selection: [1, 1]
- }
+ };
}
} else if (text == ')') {
var cursor = editor.getCursorPosition();
@@ -1009,7 +925,7 @@ var CstyleBehaviour = function () {
return {
text: '',
selection: [1, 1]
- }
+ };
}
}
}
@@ -1028,14 +944,15 @@ var CstyleBehaviour = function () {
});
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
- if (text == '"') {
+ if (text == '"' || text == "'") {
+ var quote = text;
var selection = editor.getSelectionRange();
var selected = session.doc.getTextRange(selection);
if (selected !== "") {
return {
- text: '"' + selected + '"',
+ text: quote + selected + quote,
selection: false
- }
+ };
} else {
var cursor = editor.getCursorPosition();
var line = session.doc.getLine(cursor.row);
@@ -1056,7 +973,7 @@ var CstyleBehaviour = function () {
if (token.type == "string") {
quotepos = -1;
} else if (quotepos < 0) {
- quotepos = token.value.indexOf('"');
+ quotepos = token.value.indexOf(quote);
}
if ((token.value.length + col) > selection.start.column) {
break;
@@ -1065,19 +982,19 @@ var CstyleBehaviour = function () {
}
// 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 {
- text: '""',
+ text: quote + quote,
selection: [1,1]
- }
+ };
} else if (token && token.type === "string") {
// Ignore input and move right one if we're typing over the closing quote.
var rightChar = line.substring(cursor.column, cursor.column + 1);
- if (rightChar == '"') {
+ if (rightChar == quote) {
return {
text: '',
selection: [1, 1]
- }
+ };
}
}
}
@@ -1086,7 +1003,7 @@ var CstyleBehaviour = function () {
this.add("string_dquotes", "deletion", function (state, action, editor, session, 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 rightChar = line.substring(range.start.column + 1, range.start.column + 2);
if (rightChar == '"') {
@@ -1096,7 +1013,8 @@ var CstyleBehaviour = function () {
}
});
-}
+};
+
oop.inherits(CstyleBehaviour, Behaviour);
exports.CstyleBehaviour = CstyleBehaviour;
@@ -1450,13 +1368,3 @@ oop.inherits(GroovyHighlightRules, TextHighlightRules);
exports.GroovyHighlightRules = GroovyHighlightRules;
});
-;
- (function() {
- window.require(["ace/ace"], function(a) {
- if (!window.ace)
- window.ace = {};
- for (var key in a) if (a.hasOwnProperty(key))
- ace[key] = a[key];
- });
- })();
- \ No newline at end of file