Update ace

This commit is contained in:
Tom Needham 2012-04-15 15:09:37 +00:00
parent 9ac65c51f5
commit 712e25bb02
83 changed files with 20117 additions and 9118 deletions

View File

@ -478,13 +478,3 @@ define('pilot/canon', ['require', 'exports', 'module' ], function(require, expor
console.trace();
}
});
;
(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];
});
})();

View File

@ -1 +1 @@
define("pilot/index",["require","exports","module","pilot/browser_focus","pilot/dom","pilot/event","pilot/event_emitter","pilot/fixoldbrowsers","pilot/keys","pilot/lang","pilot/oop","pilot/useragent","pilot/canon"],function(a,b,c){a("pilot/browser_focus"),a("pilot/dom"),a("pilot/event"),a("pilot/event_emitter"),a("pilot/fixoldbrowsers"),a("pilot/keys"),a("pilot/lang"),a("pilot/oop"),a("pilot/useragent"),a("pilot/canon")}),define("pilot/browser_focus",["require","exports","module","ace/lib/browser_focus"],function(a,b,c){console.warn("DEPRECATED: 'pilot/browser_focus' is deprecated. Use 'ace/lib/browser_focus' instead"),c.exports=a("ace/lib/browser_focus")}),define("pilot/dom",["require","exports","module","ace/lib/dom"],function(a,b,c){console.warn("DEPRECATED: 'pilot/dom' is deprecated. Use 'ace/lib/dom' instead"),c.exports=a("ace/lib/dom")}),define("pilot/event",["require","exports","module","ace/lib/event"],function(a,b,c){console.warn("DEPRECATED: 'pilot/event' is deprecated. Use 'ace/lib/event' instead"),c.exports=a("ace/lib/event")}),define("pilot/event_emitter",["require","exports","module","ace/lib/event_emitter"],function(a,b,c){console.warn("DEPRECATED: 'pilot/event_emitter' is deprecated. Use 'ace/lib/event_emitter' instead"),c.exports=a("ace/lib/event_emitter")}),define("pilot/fixoldbrowsers",["require","exports","module","ace/lib/fixoldbrowsers"],function(a,b,c){console.warn("DEPRECATED: 'pilot/fixoldbrowsers' is deprecated. Use 'ace/lib/fixoldbrowsers' instead"),c.exports=a("ace/lib/fixoldbrowsers")}),define("pilot/keys",["require","exports","module","ace/lib/keys"],function(a,b,c){console.warn("DEPRECATED: 'pilot/keys' is deprecated. Use 'ace/lib/keys' instead"),c.exports=a("ace/lib/keys")}),define("pilot/lang",["require","exports","module","ace/lib/lang"],function(a,b,c){console.warn("DEPRECATED: 'pilot/lang' is deprecated. Use 'ace/lib/lang' instead"),c.exports=a("ace/lib/lang")}),define("pilot/oop",["require","exports","module","ace/lib/oop"],function(a,b,c){console.warn("DEPRECATED: 'pilot/oop' is deprecated. Use 'ace/lib/oop' instead"),c.exports=a("ace/lib/oop")}),define("pilot/useragent",["require","exports","module","ace/lib/useragent"],function(a,b,c){console.warn("DEPRECATED: 'pilot/useragent' is deprecated. Use 'ace/lib/useragent' instead"),c.exports=a("ace/lib/useragent")}),define("pilot/canon",["require","exports","module"],function(a,b,c){console.warn("DEPRECATED: 'pilot/canon' is deprecated."),b.addCommand=function(){console.warn("DEPRECATED: 'canon.addCommand()' is deprecated. Use 'editor.commands.addCommand(command)' instead."),console.trace()},b.removeCommand=function(){console.warn("DEPRECATED: 'canon.removeCommand()' is deprecated. Use 'editor.commands.removeCommand(command)' instead."),console.trace()}}),function(){window.require(["ace/ace"],function(a){window.ace||(window.ace={});for(var b in a)a.hasOwnProperty(b)&&(ace[b]=a[b])})}()
define("pilot/index",["require","exports","module","pilot/browser_focus","pilot/dom","pilot/event","pilot/event_emitter","pilot/fixoldbrowsers","pilot/keys","pilot/lang","pilot/oop","pilot/useragent","pilot/canon"],function(a,b,c){a("pilot/browser_focus"),a("pilot/dom"),a("pilot/event"),a("pilot/event_emitter"),a("pilot/fixoldbrowsers"),a("pilot/keys"),a("pilot/lang"),a("pilot/oop"),a("pilot/useragent"),a("pilot/canon")}),define("pilot/browser_focus",["require","exports","module","ace/lib/browser_focus"],function(a,b,c){console.warn("DEPRECATED: 'pilot/browser_focus' is deprecated. Use 'ace/lib/browser_focus' instead"),c.exports=a("ace/lib/browser_focus")}),define("pilot/dom",["require","exports","module","ace/lib/dom"],function(a,b,c){console.warn("DEPRECATED: 'pilot/dom' is deprecated. Use 'ace/lib/dom' instead"),c.exports=a("ace/lib/dom")}),define("pilot/event",["require","exports","module","ace/lib/event"],function(a,b,c){console.warn("DEPRECATED: 'pilot/event' is deprecated. Use 'ace/lib/event' instead"),c.exports=a("ace/lib/event")}),define("pilot/event_emitter",["require","exports","module","ace/lib/event_emitter"],function(a,b,c){console.warn("DEPRECATED: 'pilot/event_emitter' is deprecated. Use 'ace/lib/event_emitter' instead"),c.exports=a("ace/lib/event_emitter")}),define("pilot/fixoldbrowsers",["require","exports","module","ace/lib/fixoldbrowsers"],function(a,b,c){console.warn("DEPRECATED: 'pilot/fixoldbrowsers' is deprecated. Use 'ace/lib/fixoldbrowsers' instead"),c.exports=a("ace/lib/fixoldbrowsers")}),define("pilot/keys",["require","exports","module","ace/lib/keys"],function(a,b,c){console.warn("DEPRECATED: 'pilot/keys' is deprecated. Use 'ace/lib/keys' instead"),c.exports=a("ace/lib/keys")}),define("pilot/lang",["require","exports","module","ace/lib/lang"],function(a,b,c){console.warn("DEPRECATED: 'pilot/lang' is deprecated. Use 'ace/lib/lang' instead"),c.exports=a("ace/lib/lang")}),define("pilot/oop",["require","exports","module","ace/lib/oop"],function(a,b,c){console.warn("DEPRECATED: 'pilot/oop' is deprecated. Use 'ace/lib/oop' instead"),c.exports=a("ace/lib/oop")}),define("pilot/useragent",["require","exports","module","ace/lib/useragent"],function(a,b,c){console.warn("DEPRECATED: 'pilot/useragent' is deprecated. Use 'ace/lib/useragent' instead"),c.exports=a("ace/lib/useragent")}),define("pilot/canon",["require","exports","module"],function(a,b,c){console.warn("DEPRECATED: 'pilot/canon' is deprecated."),b.addCommand=function(){console.warn("DEPRECATED: 'canon.addCommand()' is deprecated. Use 'editor.commands.addCommand(command)' instead."),console.trace()},b.removeCommand=function(){console.warn("DEPRECATED: 'canon.removeCommand()' is deprecated. Use 'editor.commands.removeCommand(command)' instead."),console.trace()}})

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -148,268 +148,3 @@ var emacsState = {
exports.Emacs = new StateHandler(emacsState);
});
/* ***** 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 Mozilla Skywriter.
*
* The Initial Developer of the Original Code is
* Mozilla.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Julian Viereck (julian.viereck@gmail.com)
*
* 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/keyboard/state_handler', ['require', 'exports', 'module' ], function(require, exports, module) {
"use strict";
// If you're developing a new keymapping and want to get an idea what's going
// on, then enable debugging.
var DEBUG = false;
function StateHandler(keymapping) {
this.keymapping = this.$buildKeymappingRegex(keymapping);
}
StateHandler.prototype = {
/**
* Build the RegExp from the keymapping as RegExp can't stored directly
* in the metadata JSON and as the RegExp used to match the keys/buffer
* need to be adapted.
*/
$buildKeymappingRegex: function(keymapping) {
for (var state in keymapping) {
this.$buildBindingsRegex(keymapping[state]);
}
return keymapping;
},
$buildBindingsRegex: function(bindings) {
// Escape a given Regex string.
bindings.forEach(function(binding) {
if (binding.key) {
binding.key = new RegExp('^' + binding.key + '$');
} else if (Array.isArray(binding.regex)) {
if (!('key' in binding))
binding.key = new RegExp('^' + binding.regex[1] + '$');
binding.regex = new RegExp(binding.regex.join('') + '$');
} else if (binding.regex) {
binding.regex = new RegExp(binding.regex + '$');
}
});
},
$composeBuffer: function(data, hashId, key, e) {
// Initialize the data object.
if (data.state == null || data.buffer == null) {
data.state = "start";
data.buffer = "";
}
var keyArray = [];
if (hashId & 1) keyArray.push("ctrl");
if (hashId & 8) keyArray.push("command");
if (hashId & 2) keyArray.push("option");
if (hashId & 4) keyArray.push("shift");
if (key) keyArray.push(key);
var symbolicName = keyArray.join("-");
var bufferToUse = data.buffer + symbolicName;
// Don't add the symbolic name to the key buffer if the alt_ key is
// part of the symbolic name. If it starts with alt_, this means
// that the user hit an alt keycombo and there will be a single,
// new character detected after this event, which then will be
// added to the buffer (e.g. alt_j will result in ∆).
//
// We test for 2 and not for & 2 as we only want to exclude the case where
// the option key is pressed alone.
if (hashId != 2) {
data.buffer = bufferToUse;
}
var bufferObj = {
bufferToUse: bufferToUse,
symbolicName: symbolicName,
};
if (e) {
bufferObj.keyIdentifier = e.keyIdentifier
}
return bufferObj;
},
$find: function(data, buffer, symbolicName, hashId, key, keyIdentifier) {
// Holds the command to execute and the args if a command matched.
var result = {};
// Loop over all the bindings of the keymap until a match is found.
this.keymapping[data.state].some(function(binding) {
var match;
// Check if the key matches.
if (binding.key && !binding.key.test(symbolicName)) {
return false;
}
// Check if the regex matches.
if (binding.regex && !(match = binding.regex.exec(buffer))) {
return false;
}
// Check if the match function matches.
if (binding.match && !binding.match(buffer, hashId, key, symbolicName, keyIdentifier)) {
return false;
}
// Check for disallowed matches.
if (binding.disallowMatches) {
for (var i = 0; i < binding.disallowMatches.length; i++) {
if (!!match[binding.disallowMatches[i]]) {
return false;
}
}
}
// If there is a command to execute, then figure out the
// command and the arguments.
if (binding.exec) {
result.command = binding.exec;
// Build the arguments.
if (binding.params) {
var value;
result.args = {};
binding.params.forEach(function(param) {
if (param.match != null && match != null) {
value = match[param.match] || param.defaultValue;
} else {
value = param.defaultValue;
}
if (param.type === 'number') {
value = parseInt(value);
}
result.args[param.name] = value;
});
}
data.buffer = "";
}
// Handle the 'then' property.
if (binding.then) {
data.state = binding.then;
data.buffer = "";
}
// If no command is set, then execute the "null" fake command.
if (result.command == null) {
result.command = "null";
}
if (DEBUG) {
console.log("KeyboardStateMapper#find", binding);
}
return true;
});
if (result.command) {
return result;
} else {
data.buffer = "";
return false;
}
},
/**
* This function is called by keyBinding.
*/
handleKeyboard: function(data, hashId, key, keyCode, e) {
// If we pressed any command key but no other key, then ignore the input.
// Otherwise "shift-" is added to the buffer, and later on "shift-g"
// which results in "shift-shift-g" which doesn't make sense.
if (hashId != 0 && (key == "" || key == String.fromCharCode(0))) {
return null;
}
// Compute the current value of the keyboard input buffer.
var r = this.$composeBuffer(data, hashId, key, e);
var buffer = r.bufferToUse;
var symbolicName = r.symbolicName;
var keyId = r.keyIdentifier;
r = this.$find(data, buffer, symbolicName, hashId, key, keyId);
if (DEBUG) {
console.log("KeyboardStateMapper#match", buffer, symbolicName, r);
}
return r;
}
}
/**
* This is a useful matching function and therefore is defined here so that
* users of KeyboardStateMapper can use it.
*
* @return boolean
* If no command key (Command|Option|Shift|Ctrl) is pressed, it
* returns true. If the only the Shift key is pressed + a character
* true is returned as well. Otherwise, false is returned.
* Summing up, the function returns true whenever the user typed
* a normal character on the keyboard and no shortcut.
*/
exports.matchCharacterOnly = function(buffer, hashId, key, symbolicName) {
// If no command keys are pressed, then catch the input.
if (hashId == 0) {
return true;
}
// If only the shift key is pressed and a character key, then
// catch that input as well.
else if ((hashId == 4) && key.length == 1) {
return true;
}
// Otherwise, we let the input got through.
else {
return false;
}
};
exports.StateHandler = StateHandler;
});
;
(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];
});
})();

View File

@ -1 +1 @@
define("ace/keyboard/keybinding/emacs",["require","exports","module","ace/keyboard/state_handler"],function(a,b,c){"use strict";var d=a("../state_handler").StateHandler,e=a("../state_handler").matchCharacterOnly,f={start:[{key:"ctrl-x",then:"c-x"},{regex:["(?:command-([0-9]*))*","(down|ctrl-n)"],exec:"golinedown",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["(?:command-([0-9]*))*","(right|ctrl-f)"],exec:"gotoright",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["(?:command-([0-9]*))*","(up|ctrl-p)"],exec:"golineup",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["(?:command-([0-9]*))*","(left|ctrl-b)"],exec:"gotoleft",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{comment:"This binding matches all printable characters except numbers as long as they are no numbers and print them n times.",regex:["(?:command-([0-9]*))","([^0-9]+)*"],match:e,exec:"inserttext",params:[{name:"times",match:1,type:"number",defaultValue:"1"},{name:"text",match:2}]},{comment:"This binding matches numbers as long as there is no meta_number in the buffer.",regex:["(command-[0-9]*)*","([0-9]+)"],match:e,disallowMatches:[1],exec:"inserttext",params:[{name:"text",match:2,type:"text"}]},{regex:["command-([0-9]*)","(command-[0-9]|[0-9])"],comment:"Stops execution if the regex /meta_[0-9]+/ matches to avoid resetting the buffer."}],"c-x":[{key:"ctrl-g",then:"start"},{key:"ctrl-s",exec:"save",then:"start"}]};b.Emacs=new d(f)}),define("ace/keyboard/state_handler",["require","exports","module"],function(a,b,c){function e(a){this.keymapping=this.$buildKeymappingRegex(a)}"use strict";var d=!1;e.prototype={$buildKeymappingRegex:function(a){for(var b in a)this.$buildBindingsRegex(a[b]);return a},$buildBindingsRegex:function(a){a.forEach(function(a){a.key?a.key=new RegExp("^"+a.key+"$"):Array.isArray(a.regex)?("key"in a||(a.key=new RegExp("^"+a.regex[1]+"$")),a.regex=new RegExp(a.regex.join("")+"$")):a.regex&&(a.regex=new RegExp(a.regex+"$"))})},$composeBuffer:function(a,b,c,d){if(a.state==null||a.buffer==null)a.state="start",a.buffer="";var e=[];b&1&&e.push("ctrl"),b&8&&e.push("command"),b&2&&e.push("option"),b&4&&e.push("shift"),c&&e.push(c);var f=e.join("-"),g=a.buffer+f;b!=2&&(a.buffer=g);var h={bufferToUse:g,symbolicName:f};return d&&(h.keyIdentifier=d.keyIdentifier),h},$find:function(a,b,c,e,f,g){var h={};return this.keymapping[a.state].some(function(i){var j;if(i.key&&!i.key.test(c))return!1;if(i.regex&&!(j=i.regex.exec(b)))return!1;if(i.match&&!i.match(b,e,f,c,g))return!1;if(i.disallowMatches)for(var k=0;k<i.disallowMatches.length;k++)if(!!j[i.disallowMatches[k]])return!1;if(i.exec){h.command=i.exec;if(i.params){var l;h.args={},i.params.forEach(function(a){a.match!=null&&j!=null?l=j[a.match]||a.defaultValue:l=a.defaultValue,a.type==="number"&&(l=parseInt(l)),h.args[a.name]=l})}a.buffer=""}return i.then&&(a.state=i.then,a.buffer=""),h.command==null&&(h.command="null"),d&&console.log("KeyboardStateMapper#find",i),!0}),h.command?h:(a.buffer="",!1)},handleKeyboard:function(a,b,c,e,f){if(b==0||c!=""&&c!=String.fromCharCode(0)){var g=this.$composeBuffer(a,b,c,f),h=g.bufferToUse,i=g.symbolicName,j=g.keyIdentifier;return g=this.$find(a,h,i,b,c,j),d&&console.log("KeyboardStateMapper#match",h,i,g),g}return null}},b.matchCharacterOnly=function(a,b,c,d){return b==0?!0:b==4&&c.length==1?!0:!1},b.StateHandler=e}),function(){window.require(["ace/ace"],function(a){window.ace||(window.ace={});for(var b in a)a.hasOwnProperty(b)&&(ace[b]=a[b])})}()
define("ace/keyboard/keybinding/emacs",["require","exports","module","ace/keyboard/state_handler"],function(a,b,c){"use strict";var d=a("../state_handler").StateHandler,e=a("../state_handler").matchCharacterOnly,f={start:[{key:"ctrl-x",then:"c-x"},{regex:["(?:command-([0-9]*))*","(down|ctrl-n)"],exec:"golinedown",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["(?:command-([0-9]*))*","(right|ctrl-f)"],exec:"gotoright",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["(?:command-([0-9]*))*","(up|ctrl-p)"],exec:"golineup",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["(?:command-([0-9]*))*","(left|ctrl-b)"],exec:"gotoleft",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{comment:"This binding matches all printable characters except numbers as long as they are no numbers and print them n times.",regex:["(?:command-([0-9]*))","([^0-9]+)*"],match:e,exec:"inserttext",params:[{name:"times",match:1,type:"number",defaultValue:"1"},{name:"text",match:2}]},{comment:"This binding matches numbers as long as there is no meta_number in the buffer.",regex:["(command-[0-9]*)*","([0-9]+)"],match:e,disallowMatches:[1],exec:"inserttext",params:[{name:"text",match:2,type:"text"}]},{regex:["command-([0-9]*)","(command-[0-9]|[0-9])"],comment:"Stops execution if the regex /meta_[0-9]+/ matches to avoid resetting the buffer."}],"c-x":[{key:"ctrl-g",then:"start"},{key:"ctrl-s",exec:"save",then:"start"}]};b.Emacs=new d(f)})

View File

@ -136,268 +136,3 @@ var vimStates = {
exports.Vim = new StateHandler(vimStates);
});
/* ***** 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 Mozilla Skywriter.
*
* The Initial Developer of the Original Code is
* Mozilla.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Julian Viereck (julian.viereck@gmail.com)
*
* 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/keyboard/state_handler', ['require', 'exports', 'module' ], function(require, exports, module) {
"use strict";
// If you're developing a new keymapping and want to get an idea what's going
// on, then enable debugging.
var DEBUG = false;
function StateHandler(keymapping) {
this.keymapping = this.$buildKeymappingRegex(keymapping);
}
StateHandler.prototype = {
/**
* Build the RegExp from the keymapping as RegExp can't stored directly
* in the metadata JSON and as the RegExp used to match the keys/buffer
* need to be adapted.
*/
$buildKeymappingRegex: function(keymapping) {
for (var state in keymapping) {
this.$buildBindingsRegex(keymapping[state]);
}
return keymapping;
},
$buildBindingsRegex: function(bindings) {
// Escape a given Regex string.
bindings.forEach(function(binding) {
if (binding.key) {
binding.key = new RegExp('^' + binding.key + '$');
} else if (Array.isArray(binding.regex)) {
if (!('key' in binding))
binding.key = new RegExp('^' + binding.regex[1] + '$');
binding.regex = new RegExp(binding.regex.join('') + '$');
} else if (binding.regex) {
binding.regex = new RegExp(binding.regex + '$');
}
});
},
$composeBuffer: function(data, hashId, key, e) {
// Initialize the data object.
if (data.state == null || data.buffer == null) {
data.state = "start";
data.buffer = "";
}
var keyArray = [];
if (hashId & 1) keyArray.push("ctrl");
if (hashId & 8) keyArray.push("command");
if (hashId & 2) keyArray.push("option");
if (hashId & 4) keyArray.push("shift");
if (key) keyArray.push(key);
var symbolicName = keyArray.join("-");
var bufferToUse = data.buffer + symbolicName;
// Don't add the symbolic name to the key buffer if the alt_ key is
// part of the symbolic name. If it starts with alt_, this means
// that the user hit an alt keycombo and there will be a single,
// new character detected after this event, which then will be
// added to the buffer (e.g. alt_j will result in ∆).
//
// We test for 2 and not for & 2 as we only want to exclude the case where
// the option key is pressed alone.
if (hashId != 2) {
data.buffer = bufferToUse;
}
var bufferObj = {
bufferToUse: bufferToUse,
symbolicName: symbolicName,
};
if (e) {
bufferObj.keyIdentifier = e.keyIdentifier
}
return bufferObj;
},
$find: function(data, buffer, symbolicName, hashId, key, keyIdentifier) {
// Holds the command to execute and the args if a command matched.
var result = {};
// Loop over all the bindings of the keymap until a match is found.
this.keymapping[data.state].some(function(binding) {
var match;
// Check if the key matches.
if (binding.key && !binding.key.test(symbolicName)) {
return false;
}
// Check if the regex matches.
if (binding.regex && !(match = binding.regex.exec(buffer))) {
return false;
}
// Check if the match function matches.
if (binding.match && !binding.match(buffer, hashId, key, symbolicName, keyIdentifier)) {
return false;
}
// Check for disallowed matches.
if (binding.disallowMatches) {
for (var i = 0; i < binding.disallowMatches.length; i++) {
if (!!match[binding.disallowMatches[i]]) {
return false;
}
}
}
// If there is a command to execute, then figure out the
// command and the arguments.
if (binding.exec) {
result.command = binding.exec;
// Build the arguments.
if (binding.params) {
var value;
result.args = {};
binding.params.forEach(function(param) {
if (param.match != null && match != null) {
value = match[param.match] || param.defaultValue;
} else {
value = param.defaultValue;
}
if (param.type === 'number') {
value = parseInt(value);
}
result.args[param.name] = value;
});
}
data.buffer = "";
}
// Handle the 'then' property.
if (binding.then) {
data.state = binding.then;
data.buffer = "";
}
// If no command is set, then execute the "null" fake command.
if (result.command == null) {
result.command = "null";
}
if (DEBUG) {
console.log("KeyboardStateMapper#find", binding);
}
return true;
});
if (result.command) {
return result;
} else {
data.buffer = "";
return false;
}
},
/**
* This function is called by keyBinding.
*/
handleKeyboard: function(data, hashId, key, keyCode, e) {
// If we pressed any command key but no other key, then ignore the input.
// Otherwise "shift-" is added to the buffer, and later on "shift-g"
// which results in "shift-shift-g" which doesn't make sense.
if (hashId != 0 && (key == "" || key == String.fromCharCode(0))) {
return null;
}
// Compute the current value of the keyboard input buffer.
var r = this.$composeBuffer(data, hashId, key, e);
var buffer = r.bufferToUse;
var symbolicName = r.symbolicName;
var keyId = r.keyIdentifier;
r = this.$find(data, buffer, symbolicName, hashId, key, keyId);
if (DEBUG) {
console.log("KeyboardStateMapper#match", buffer, symbolicName, r);
}
return r;
}
}
/**
* This is a useful matching function and therefore is defined here so that
* users of KeyboardStateMapper can use it.
*
* @return boolean
* If no command key (Command|Option|Shift|Ctrl) is pressed, it
* returns true. If the only the Shift key is pressed + a character
* true is returned as well. Otherwise, false is returned.
* Summing up, the function returns true whenever the user typed
* a normal character on the keyboard and no shortcut.
*/
exports.matchCharacterOnly = function(buffer, hashId, key, symbolicName) {
// If no command keys are pressed, then catch the input.
if (hashId == 0) {
return true;
}
// If only the shift key is pressed and a character key, then
// catch that input as well.
else if ((hashId == 4) && key.length == 1) {
return true;
}
// Otherwise, we let the input got through.
else {
return false;
}
};
exports.StateHandler = StateHandler;
});
;
(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];
});
})();

View File

@ -1 +1 @@
define("ace/keyboard/keybinding/vim",["require","exports","module","ace/keyboard/state_handler"],function(a,b,c){"use strict";var d=a("../state_handler").StateHandler,e=a("../state_handler").matchCharacterOnly,f=function(a,b,c){return{regex:["([0-9]*)",a],exec:b,params:[{name:"times",match:1,type:"number",defaultValue:1}],then:c}},g={start:[{key:"i",then:"insertMode"},{key:"d",then:"deleteMode"},{key:"a",exec:"gotoright",then:"insertMode"},{key:"shift-i",exec:"gotolinestart",then:"insertMode"},{key:"shift-a",exec:"gotolineend",then:"insertMode"},{key:"shift-c",exec:"removetolineend",then:"insertMode"},{key:"shift-r",exec:"overwrite",then:"replaceMode"},f("(k|up)","golineup"),f("(j|down)","golinedown"),f("(l|right)","gotoright"),f("(h|left)","gotoleft"),{key:"shift-g",exec:"gotoend"},f("b","gotowordleft"),f("e","gotowordright"),f("x","del"),f("shift-x","backspace"),f("shift-d","removetolineend"),f("u","undo"),{comment:"Catch some keyboard input to stop it here",match:e}],insertMode:[{key:"esc",then:"start"}],replaceMode:[{key:"esc",exec:"overwrite",then:"start"}],deleteMode:[{key:"d",exec:"removeline",then:"start"}]};b.Vim=new d(g)}),define("ace/keyboard/state_handler",["require","exports","module"],function(a,b,c){function e(a){this.keymapping=this.$buildKeymappingRegex(a)}"use strict";var d=!1;e.prototype={$buildKeymappingRegex:function(a){for(var b in a)this.$buildBindingsRegex(a[b]);return a},$buildBindingsRegex:function(a){a.forEach(function(a){a.key?a.key=new RegExp("^"+a.key+"$"):Array.isArray(a.regex)?("key"in a||(a.key=new RegExp("^"+a.regex[1]+"$")),a.regex=new RegExp(a.regex.join("")+"$")):a.regex&&(a.regex=new RegExp(a.regex+"$"))})},$composeBuffer:function(a,b,c,d){if(a.state==null||a.buffer==null)a.state="start",a.buffer="";var e=[];b&1&&e.push("ctrl"),b&8&&e.push("command"),b&2&&e.push("option"),b&4&&e.push("shift"),c&&e.push(c);var f=e.join("-"),g=a.buffer+f;b!=2&&(a.buffer=g);var h={bufferToUse:g,symbolicName:f};return d&&(h.keyIdentifier=d.keyIdentifier),h},$find:function(a,b,c,e,f,g){var h={};return this.keymapping[a.state].some(function(i){var j;if(i.key&&!i.key.test(c))return!1;if(i.regex&&!(j=i.regex.exec(b)))return!1;if(i.match&&!i.match(b,e,f,c,g))return!1;if(i.disallowMatches)for(var k=0;k<i.disallowMatches.length;k++)if(!!j[i.disallowMatches[k]])return!1;if(i.exec){h.command=i.exec;if(i.params){var l;h.args={},i.params.forEach(function(a){a.match!=null&&j!=null?l=j[a.match]||a.defaultValue:l=a.defaultValue,a.type==="number"&&(l=parseInt(l)),h.args[a.name]=l})}a.buffer=""}return i.then&&(a.state=i.then,a.buffer=""),h.command==null&&(h.command="null"),d&&console.log("KeyboardStateMapper#find",i),!0}),h.command?h:(a.buffer="",!1)},handleKeyboard:function(a,b,c,e,f){if(b==0||c!=""&&c!=String.fromCharCode(0)){var g=this.$composeBuffer(a,b,c,f),h=g.bufferToUse,i=g.symbolicName,j=g.keyIdentifier;return g=this.$find(a,h,i,b,c,j),d&&console.log("KeyboardStateMapper#match",h,i,g),g}return null}},b.matchCharacterOnly=function(a,b,c,d){return b==0?!0:b==4&&c.length==1?!0:!1},b.StateHandler=e}),function(){window.require(["ace/ace"],function(a){window.ace||(window.ace={});for(var b in a)a.hasOwnProperty(b)&&(ace[b]=a[b])})}()
define("ace/keyboard/keybinding/vim",["require","exports","module","ace/keyboard/state_handler"],function(a,b,c){"use strict";var d=a("../state_handler").StateHandler,e=a("../state_handler").matchCharacterOnly,f=function(a,b,c){return{regex:["([0-9]*)",a],exec:b,params:[{name:"times",match:1,type:"number",defaultValue:1}],then:c}},g={start:[{key:"i",then:"insertMode"},{key:"d",then:"deleteMode"},{key:"a",exec:"gotoright",then:"insertMode"},{key:"shift-i",exec:"gotolinestart",then:"insertMode"},{key:"shift-a",exec:"gotolineend",then:"insertMode"},{key:"shift-c",exec:"removetolineend",then:"insertMode"},{key:"shift-r",exec:"overwrite",then:"replaceMode"},f("(k|up)","golineup"),f("(j|down)","golinedown"),f("(l|right)","gotoright"),f("(h|left)","gotoleft"),{key:"shift-g",exec:"gotoend"},f("b","gotowordleft"),f("e","gotowordright"),f("x","del"),f("shift-x","backspace"),f("shift-d","removetolineend"),f("u","undo"),{comment:"Catch some keyboard input to stop it here",match:e}],insertMode:[{key:"esc",then:"start"}],replaceMode:[{key:"esc",exec:"overwrite",then:"start"}],deleteMode:[{key:"d",exec:"removeline",then:"start"}]};b.Vim=new d(g)})

View File

@ -541,12 +541,12 @@ var CstyleBehaviour = function () {
return {
text: '{' + selected + '}',
selection: false
}
};
} else {
return {
text: '{}',
selection: [1, 1]
}
};
}
} else if (text == '}') {
var cursor = editor.getCursorPosition();
@ -558,7 +558,7 @@ var CstyleBehaviour = function () {
return {
text: '',
selection: [1, 1]
}
};
}
}
} else if (text == "\n") {
@ -576,7 +576,7 @@ var CstyleBehaviour = function () {
return {
text: '\n' + indent + '\n' + next_indent,
selection: [1, indent.length, 1, indent.length]
}
};
}
}
});
@ -601,12 +601,12 @@ var CstyleBehaviour = function () {
return {
text: '(' + selected + ')',
selection: false
}
};
} else {
return {
text: '()',
selection: [1, 1]
}
};
}
} else if (text == ')') {
var cursor = editor.getCursorPosition();
@ -618,7 +618,7 @@ var CstyleBehaviour = function () {
return {
text: '',
selection: [1, 1]
}
};
}
}
}
@ -637,14 +637,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);
@ -665,7 +666,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;
@ -674,19 +675,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]
}
};
}
}
}
@ -695,7 +696,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 == '"') {
@ -705,7 +706,8 @@ var CstyleBehaviour = function () {
}
});
}
};
oop.inherits(CstyleBehaviour, Behaviour);
exports.CstyleBehaviour = CstyleBehaviour;
@ -916,13 +918,3 @@ var FoldMode = exports.FoldMode = function() {};
}).call(FoldMode.prototype);
});
;
(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];
});
})();

File diff suppressed because one or more lines are too long

View File

@ -259,9 +259,9 @@ var ClojureHighlightRules = function() {
token : "comment",
regex : ";.*$"
}, {
token : "comment", // multi line comment
regex : "^\=begin$",
next : "comment"
token : "comment", // multi line comment
regex : "^=begin$",
next : "comment"
}, {
token : "keyword", //parens
regex : "[\\(|\\)]"
@ -314,17 +314,17 @@ var ClojureHighlightRules = function() {
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
}, {
token : "string", // symbol
regex : "[:](?:[a-zA-Z]|\d)+"
regex : "[:](?:[a-zA-Z]|\\d)+"
}, {
token : "string.regexp", //Regular Expressions
regex : '/#"(?:\.|(\\\")|[^\""\n])*"/g'
token : "string.regexp", //Regular Expressions
regex : '/#"(?:\\.|(?:\\\")|[^\""\n])*"/g'
}
],
"comment" : [
{
token : "comment", // closing comment
regex : "^\=end$",
regex : "^=end$",
next : "start"
}, {
token : "comment", // comment spanning whole line
@ -420,13 +420,3 @@ var MatchingParensOutdent = function() {};
exports.MatchingParensOutdent = MatchingParensOutdent;
});
;
(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];
});
})();

File diff suppressed because one or more lines are too long

View File

@ -603,202 +603,3 @@ var FoldMode = exports.FoldMode = function() {};
}).call(FoldMode.prototype);
});
/* ***** 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;
});
;
(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];
});
})();

File diff suppressed because one or more lines are too long

View File

@ -195,6 +195,9 @@ var XmlHighlightRules = function() {
merge : true,
regex : "<\\!--",
next : "comment"
}, {
token : "xml_pe",
regex : "<\\!.*?>"
}, {
token : "meta.tag", // opening tag
regex : "<\\/?",
@ -202,6 +205,9 @@ var XmlHighlightRules = function() {
}, {
token : "text",
regex : "\\s+"
}, {
token : "constant.character.entity",
regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
}, {
token : "text",
regex : "[^<]+"
@ -295,7 +301,7 @@ function string(state) {
token : "string", // multi line string start
merge : true,
regex : '["].*',
next : state + "-qqstring"
next : state + "_qqstring"
}, {
token : "string",
regex : "'.*?'"
@ -303,7 +309,7 @@ function string(state) {
token : "string", // multi line string start
merge : true,
regex : "['].*",
next : state + "-qstring"
next : state + "_qstring"
}];
}
@ -351,18 +357,18 @@ exports.tag = function(states, name, nextState) {
}
},
merge : true,
regex : "[-_a-zA-Z0-9:!]+",
next : name + "embed-attribute-list"
regex : "[-_a-zA-Z0-9:]+",
next : name + "_embed_attribute_list"
}, {
token: "empty",
regex: "",
next : name + "embed-attribute-list"
next : name + "_embed_attribute_list"
}];
states[name + "-qstring"] = multiLineString("'", name + "embed-attribute-list");
states[name + "-qqstring"] = multiLineString("\"", name + "embed-attribute-list");
states[name + "_qstring"] = multiLineString("'", name + "_embed_attribute_list");
states[name + "_qqstring"] = multiLineString("\"", name + "_embed_attribute_list");
states[name + "embed-attribute-list"] = [{
states[name + "_embed_attribute_list"] = [{
token : "meta.tag",
merge : true,
regex : "\/?>",
@ -528,12 +534,12 @@ var CstyleBehaviour = function () {
return {
text: '{' + selected + '}',
selection: false
}
};
} else {
return {
text: '{}',
selection: [1, 1]
}
};
}
} else if (text == '}') {
var cursor = editor.getCursorPosition();
@ -545,7 +551,7 @@ var CstyleBehaviour = function () {
return {
text: '',
selection: [1, 1]
}
};
}
}
} else if (text == "\n") {
@ -563,7 +569,7 @@ var CstyleBehaviour = function () {
return {
text: '\n' + indent + '\n' + next_indent,
selection: [1, indent.length, 1, indent.length]
}
};
}
}
});
@ -588,12 +594,12 @@ var CstyleBehaviour = function () {
return {
text: '(' + selected + ')',
selection: false
}
};
} else {
return {
text: '()',
selection: [1, 1]
}
};
}
} else if (text == ')') {
var cursor = editor.getCursorPosition();
@ -605,7 +611,7 @@ var CstyleBehaviour = function () {
return {
text: '',
selection: [1, 1]
}
};
}
}
}
@ -624,14 +630,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);
@ -652,7 +659,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;
@ -661,19 +668,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]
}
};
}
}
}
@ -682,7 +689,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 == '"') {
@ -692,7 +699,8 @@ var CstyleBehaviour = function () {
}
});
}
};
oop.inherits(CstyleBehaviour, Behaviour);
exports.CstyleBehaviour = CstyleBehaviour;
@ -1329,12 +1337,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
@ -1342,46 +1358,139 @@ 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",
regex : "'",
next : "qstring"
}, {
token : "string", // multi line string start
merge : true,
regex : '["].*\\\\$',
next : "qqstring"
}, {
token : "string", // single line
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
}, {
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))
@ -1389,7 +1498,7 @@ var JavaScriptHighlightRules = function() {
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))
@ -1404,29 +1513,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
@ -1451,7 +1560,7 @@ var JavaScriptHighlightRules = function() {
}, {
// immediately return to the start mode without matching
// anything
token: "empty",
token: "empty",
regex: "",
next: "start"
}
@ -1463,10 +1572,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: "[^\\\\/\\[]+",
@ -1478,9 +1587,9 @@ var JavaScriptHighlightRules = function() {
next: "regex_character_class",
merge: true
}, {
token: "empty",
token: "empty",
regex: "",
next: "start"
next: "start"
}
],
"regex_character_class": [
@ -1499,9 +1608,9 @@ var JavaScriptHighlightRules = function() {
next: "regex_character_class",
merge: true
}, {
token: "empty",
token: "empty",
regex: "",
next: "start"
next: "start"
}
],
"comment_regex_allowed" : [
@ -1530,28 +1639,32 @@ var JavaScriptHighlightRules = function() {
],
"qqstring" : [
{
token : "string",
regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
next : "start"
token : "constant.language.escape",
regex : escapedRe
}, {
token : "string",
merge : true,
regex : '.+'
regex : '[^"\\\\]+'
}, {
token : "string",
regex : '"',
next : "start"
}
],
"qstring" : [
{
token : "string",
regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
next : "start"
token : "constant.language.escape",
regex : escapedRe
}, {
token : "string",
merge : true,
regex : '.+'
regex : "[^'\\\\]+"
}, {
token : "string",
regex : "'",
next : "start"
}
]
};
this.embedRules(DocCommentHighlightRules, "doc-",
[ new DocCommentHighlightRules().getEndRule("start") ]);
};
@ -1736,195 +1849,6 @@ var MatchingBraceOutdent = function() {};
}).call(MatchingBraceOutdent.prototype);
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;
});
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
@ -2177,31 +2101,7 @@ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var CssHighlightRules = function() {
var properties = lang.arrayToMap(
("-moz-appearance|-moz-box-sizing|-webkit-box-sizing|-moz-outline-radius|-moz-transform|-webkit-transform|" +
"appearance|azimuth|background-attachment|background-color|background-image|" +
"background-origin|background-position|background-repeat|background|border-bottom-color|" +
"border-bottom-style|border-bottom-width|border-bottom|border-collapse|" +
"border-color|border-left-color|border-left-style|border-left-width|" +
"border-left|border-right-color|border-right-style|border-right-width|" +
"border-right|border-spacing|border-style|border-top-color|" +
"border-top-style|border-top-width|border-top|border-width|border|" +
"bottom|box-sizing|caption-side|clear|clip|color|content|counter-increment|" +
"counter-reset|cue-after|cue-before|cue|cursor|direction|display|" +
"elevation|empty-cells|float|font-family|font-size-adjust|font-size|" +
"font-stretch|font-style|font-variant|font-weight|font|height|left|" +
"letter-spacing|line-height|list-style-image|list-style-position|" +
"list-style-type|list-style|margin-bottom|margin-left|margin-right|" +
"margin-top|marker-offset|margin|marks|max-height|max-width|min-height|" +
"min-width|-moz-border-radius|opacity|orphans|outline-color|outline-offset|outline-radius|" +
"outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|" +
"padding-left|padding-right|padding-top|padding|page-break-after|" +
"page-break-before|page-break-inside|page|pause-after|pause-before|" +
"pause|pitch-range|pitch|play-during|pointer-events|position|quotes|resize|richness|right|" +
"size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|" +
"stress|table-layout|text-align|text-decoration|text-indent|" +
"text-shadow|text-transform|top|transform|unicode-bidi|vertical-align|" +
"visibility|voice-family|volume|white-space|widows|width|word-spacing|" +
"z-index").split("|")
("animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index").split("|")
);
var functions = lang.arrayToMap(
@ -2209,27 +2109,7 @@ var CssHighlightRules = function() {
);
var constants = lang.arrayToMap(
("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|" +
"block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|" +
"char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|" +
"decimal-leading-zero|decimal|default|disabled|disc|" +
"distribute-all-lines|distribute-letter|distribute-space|" +
"distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|" +
"hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|" +
"ideograph-alpha|ideograph-numeric|ideograph-parenthesis|" +
"ideograph-space|inactive|inherit|inline-block|inline|inset|inside|" +
"inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|" +
"keep-all|left|lighter|line-edge|line-through|line|list-item|loose|" +
"lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|" +
"medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|" +
"nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|" +
"overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|" +
"ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|" +
"solid|square|static|strict|super|sw-resize|table-footer-group|" +
"table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|" +
"transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|" +
"vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|" +
"zero").split("|")
("absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|font-size|font|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero").split("|")
);
var colors = lang.arrayToMap(
@ -2237,32 +2117,49 @@ var CssHighlightRules = function() {
"purple|red|silver|teal|white|yellow").split("|")
);
var fonts = lang.arrayToMap(
("arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|" +
"symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|" +
"serif|monospace").split("|")
);
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
var pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
var pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
var base_ruleset = [
{
token : "comment", // multi line comment
merge : true,
regex : "\\/\\*",
next : "ruleset_comment"
},{
}, {
token : "string", // single line
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
}, {
token : "string", // single line
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
}, {
token : "constant.numeric",
regex : numRe + "(?:em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)"
token : ["constant.numeric", "keyword"],
regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
}, {
token : ["constant.numeric"],
regex : "([0-9]+)"
}, {
token : "constant.numeric", // hex6 color
regex : "#[a-f0-9]{6}"
}, {
token : "constant.numeric", // hex3 color
regex : "#[a-f0-9]{3}"
}, {
token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
regex : pseudoElements
}, {
token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
regex : pseudoClasses
}, {
token : function(value) {
if (properties.hasOwnProperty(value.toLowerCase())) {
@ -2277,12 +2174,15 @@ var CssHighlightRules = function() {
else if (colors.hasOwnProperty(value.toLowerCase())) {
return "support.constant.color";
}
else if (fonts.hasOwnProperty(value.toLowerCase())) {
return "support.constant.fonts";
}
else {
return "text";
}
},
regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
}
}
];
var ruleset = lang.copyArray(base_ruleset);
@ -2468,7 +2368,7 @@ var ColdfusionHighlightRules = function() {
}, {
token : "meta.tag",
regex : "<(?=\s*style)",
next : "css"
next : "style"
}, {
token : "meta.tag", // opening tag
regex : "<\\/?",
@ -2507,7 +2407,7 @@ var ColdfusionHighlightRules = function() {
};
xml_util.tag(this.$rules, "tag", "start");
xml_util.tag(this.$rules, "css", "css-start");
xml_util.tag(this.$rules, "style", "css-start");
xml_util.tag(this.$rules, "script", "js-start");
this.embedRules(JavaScriptHighlightRules, "js-", [{
@ -2531,13 +2431,3 @@ oop.inherits(ColdfusionHighlightRules, TextHighlightRules);
exports.ColdfusionHighlightRules = ColdfusionHighlightRules;
});
;
(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];
});
})();

File diff suppressed because one or more lines are too long

View File

@ -391,12 +391,12 @@ var CstyleBehaviour = function () {
return {
text: '{' + selected + '}',
selection: false
}
};
} else {
return {
text: '{}',
selection: [1, 1]
}
};
}
} else if (text == '}') {
var cursor = editor.getCursorPosition();
@ -408,7 +408,7 @@ var CstyleBehaviour = function () {
return {
text: '',
selection: [1, 1]
}
};
}
}
} else if (text == "\n") {
@ -426,7 +426,7 @@ var CstyleBehaviour = function () {
return {
text: '\n' + indent + '\n' + next_indent,
selection: [1, indent.length, 1, indent.length]
}
};
}
}
});
@ -451,12 +451,12 @@ var CstyleBehaviour = function () {
return {
text: '(' + selected + ')',
selection: false
}
};
} else {
return {
text: '()',
selection: [1, 1]
}
};
}
} else if (text == ')') {
var cursor = editor.getCursorPosition();
@ -468,7 +468,7 @@ var CstyleBehaviour = function () {
return {
text: '',
selection: [1, 1]
}
};
}
}
}
@ -487,14 +487,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);
@ -515,7 +516,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;
@ -524,19 +525,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]
}
};
}
}
}
@ -545,7 +546,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 == '"') {
@ -555,7 +556,8 @@ var CstyleBehaviour = function () {
}
});
}
};
oop.inherits(CstyleBehaviour, Behaviour);
exports.CstyleBehaviour = CstyleBehaviour;
@ -766,13 +768,3 @@ var FoldMode = exports.FoldMode = function() {};
}).call(FoldMode.prototype);
});
;
(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];
});
})();

File diff suppressed because one or more lines are too long

View File

@ -155,31 +155,7 @@ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var CssHighlightRules = function() {
var properties = lang.arrayToMap(
("-moz-appearance|-moz-box-sizing|-webkit-box-sizing|-moz-outline-radius|-moz-transform|-webkit-transform|" +
"appearance|azimuth|background-attachment|background-color|background-image|" +
"background-origin|background-position|background-repeat|background|border-bottom-color|" +
"border-bottom-style|border-bottom-width|border-bottom|border-collapse|" +
"border-color|border-left-color|border-left-style|border-left-width|" +
"border-left|border-right-color|border-right-style|border-right-width|" +
"border-right|border-spacing|border-style|border-top-color|" +
"border-top-style|border-top-width|border-top|border-width|border|" +
"bottom|box-sizing|caption-side|clear|clip|color|content|counter-increment|" +
"counter-reset|cue-after|cue-before|cue|cursor|direction|display|" +
"elevation|empty-cells|float|font-family|font-size-adjust|font-size|" +
"font-stretch|font-style|font-variant|font-weight|font|height|left|" +
"letter-spacing|line-height|list-style-image|list-style-position|" +
"list-style-type|list-style|margin-bottom|margin-left|margin-right|" +
"margin-top|marker-offset|margin|marks|max-height|max-width|min-height|" +
"min-width|-moz-border-radius|opacity|orphans|outline-color|outline-offset|outline-radius|" +
"outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|" +
"padding-left|padding-right|padding-top|padding|page-break-after|" +
"page-break-before|page-break-inside|page|pause-after|pause-before|" +
"pause|pitch-range|pitch|play-during|pointer-events|position|quotes|resize|richness|right|" +
"size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|" +
"stress|table-layout|text-align|text-decoration|text-indent|" +
"text-shadow|text-transform|top|transform|unicode-bidi|vertical-align|" +
"visibility|voice-family|volume|white-space|widows|width|word-spacing|" +
"z-index").split("|")
("animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index").split("|")
);
var functions = lang.arrayToMap(
@ -187,27 +163,7 @@ var CssHighlightRules = function() {
);
var constants = lang.arrayToMap(
("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|" +
"block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|" +
"char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|" +
"decimal-leading-zero|decimal|default|disabled|disc|" +
"distribute-all-lines|distribute-letter|distribute-space|" +
"distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|" +
"hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|" +
"ideograph-alpha|ideograph-numeric|ideograph-parenthesis|" +
"ideograph-space|inactive|inherit|inline-block|inline|inset|inside|" +
"inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|" +
"keep-all|left|lighter|line-edge|line-through|line|list-item|loose|" +
"lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|" +
"medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|" +
"nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|" +
"overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|" +
"ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|" +
"solid|square|static|strict|super|sw-resize|table-footer-group|" +
"table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|" +
"transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|" +
"vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|" +
"zero").split("|")
("absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|font-size|font|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero").split("|")
);
var colors = lang.arrayToMap(
@ -215,32 +171,49 @@ var CssHighlightRules = function() {
"purple|red|silver|teal|white|yellow").split("|")
);
var fonts = lang.arrayToMap(
("arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|" +
"symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|" +
"serif|monospace").split("|")
);
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
var pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
var pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
var base_ruleset = [
{
token : "comment", // multi line comment
merge : true,
regex : "\\/\\*",
next : "ruleset_comment"
},{
}, {
token : "string", // single line
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
}, {
token : "string", // single line
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
}, {
token : "constant.numeric",
regex : numRe + "(?:em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)"
token : ["constant.numeric", "keyword"],
regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
}, {
token : ["constant.numeric"],
regex : "([0-9]+)"
}, {
token : "constant.numeric", // hex6 color
regex : "#[a-f0-9]{6}"
}, {
token : "constant.numeric", // hex3 color
regex : "#[a-f0-9]{3}"
}, {
token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
regex : pseudoElements
}, {
token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
regex : pseudoClasses
}, {
token : function(value) {
if (properties.hasOwnProperty(value.toLowerCase())) {
@ -255,12 +228,15 @@ var CssHighlightRules = function() {
else if (colors.hasOwnProperty(value.toLowerCase())) {
return "support.constant.color";
}
else if (fonts.hasOwnProperty(value.toLowerCase())) {
return "support.constant.fonts";
}
else {
return "text";
}
},
regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
}
}
];
var ruleset = lang.copyArray(base_ruleset);
@ -454,195 +430,6 @@ var MatchingBraceOutdent = function() {};
}).call(MatchingBraceOutdent.prototype);
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;
});
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
@ -851,13 +638,3 @@ var FoldMode = exports.FoldMode = function() {};
}).call(FoldMode.prototype);
});
;
(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];
});
})();

File diff suppressed because one or more lines are too long

View File

@ -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,46 +302,139 @@ 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",
regex : "'",
next : "qstring"
}, {
token : "string", // multi line string start
merge : true,
regex : '["].*\\\\$',
next : "qqstring"
}, {
token : "string", // single line
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
}, {
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))
@ -341,7 +442,7 @@ var JavaScriptHighlightRules = function() {
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 : "string",
regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
next : "start"
token : "constant.language.escape",
regex : escapedRe
}, {
token : "string",
merge : true,
regex : '.+'
regex : '[^"\\\\]+'
}, {
token : "string",
regex : '"',
next : "start"
}
],
"qstring" : [
{
token : "string",
regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
next : "start"
token : "constant.language.escape",
regex : escapedRe
}, {
token : "string",
merge : true,
regex : '.+'
regex : "[^'\\\\]+"
}, {
token : "string",
regex : "'",
next : "start"
}
]
};
this.embedRules(DocCommentHighlightRules, "doc-",
[ new DocCommentHighlightRules().getEndRule("start") ]);
};
@ -688,195 +793,6 @@ var MatchingBraceOutdent = function() {};
}).call(MatchingBraceOutdent.prototype);
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 *****
@ -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];
});
})();

File diff suppressed because one or more lines are too long

View File

@ -391,12 +391,12 @@ var CstyleBehaviour = function () {
return {
text: '{' + selected + '}',
selection: false
}
};
} else {
return {
text: '{}',
selection: [1, 1]
}
};
}
} else if (text == '}') {
var cursor = editor.getCursorPosition();
@ -408,7 +408,7 @@ var CstyleBehaviour = function () {
return {
text: '',
selection: [1, 1]
}
};
}
}
} else if (text == "\n") {
@ -426,7 +426,7 @@ var CstyleBehaviour = function () {
return {
text: '\n' + indent + '\n' + next_indent,
selection: [1, indent.length, 1, indent.length]
}
};
}
}
});
@ -451,12 +451,12 @@ var CstyleBehaviour = function () {
return {
text: '(' + selected + ')',
selection: false
}
};
} else {
return {
text: '()',
selection: [1, 1]
}
};
}
} else if (text == ')') {
var cursor = editor.getCursorPosition();
@ -468,7 +468,7 @@ var CstyleBehaviour = function () {
return {
text: '',
selection: [1, 1]
}
};
}
}
}
@ -487,14 +487,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);
@ -515,7 +516,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;
@ -524,19 +525,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]
}
};
}
}
}
@ -545,7 +546,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 == '"') {
@ -555,7 +556,8 @@ var CstyleBehaviour = function () {
}
});
}
};
oop.inherits(CstyleBehaviour, Behaviour);
exports.CstyleBehaviour = CstyleBehaviour;
@ -766,13 +768,3 @@ var FoldMode = exports.FoldMode = function() {};
}).call(FoldMode.prototype);
});
;
(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];
});
})();

File diff suppressed because one or more lines are too long

View File

@ -340,12 +340,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
@ -353,46 +361,139 @@ 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",
regex : "'",
next : "qstring"
}, {
token : "string", // multi line string start
merge : true,
regex : '["].*\\\\$',
next : "qqstring"
}, {
token : "string", // single line
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
}, {
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))
@ -400,7 +501,7 @@ var JavaScriptHighlightRules = function() {
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))
@ -415,29 +516,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
@ -462,7 +563,7 @@ var JavaScriptHighlightRules = function() {
}, {
// immediately return to the start mode without matching
// anything
token: "empty",
token: "empty",
regex: "",
next: "start"
}
@ -474,10 +575,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: "[^\\\\/\\[]+",
@ -489,9 +590,9 @@ var JavaScriptHighlightRules = function() {
next: "regex_character_class",
merge: true
}, {
token: "empty",
token: "empty",
regex: "",
next: "start"
next: "start"
}
],
"regex_character_class": [
@ -510,9 +611,9 @@ var JavaScriptHighlightRules = function() {
next: "regex_character_class",
merge: true
}, {
token: "empty",
token: "empty",
regex: "",
next: "start"
next: "start"
}
],
"comment_regex_allowed" : [
@ -541,28 +642,32 @@ var JavaScriptHighlightRules = function() {
],
"qqstring" : [
{
token : "string",
regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
next : "start"
token : "constant.language.escape",
regex : escapedRe
}, {
token : "string",
merge : true,
regex : '.+'
regex : '[^"\\\\]+'
}, {
token : "string",
regex : '"',
next : "start"
}
],
"qstring" : [
{
token : "string",
regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
next : "start"
token : "constant.language.escape",
regex : escapedRe
}, {
token : "string",
merge : true,
regex : '.+'
regex : "[^'\\\\]+"
}, {
token : "string",
regex : "'",
next : "start"
}
]
};
this.embedRules(DocCommentHighlightRules, "doc-",
[ new DocCommentHighlightRules().getEndRule("start") ]);
};
@ -747,195 +852,6 @@ var MatchingBraceOutdent = function() {};
}).call(MatchingBraceOutdent.prototype);
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 *****
@ -991,12 +907,12 @@ var CstyleBehaviour = function () {
return {
text: '{' + selected + '}',
selection: false
}
};
} else {
return {
text: '{}',
selection: [1, 1]
}
};
}
} else if (text == '}') {
var cursor = editor.getCursorPosition();
@ -1008,7 +924,7 @@ var CstyleBehaviour = function () {
return {
text: '',
selection: [1, 1]
}
};
}
}
} else if (text == "\n") {
@ -1026,7 +942,7 @@ var CstyleBehaviour = function () {
return {
text: '\n' + indent + '\n' + next_indent,
selection: [1, indent.length, 1, indent.length]
}
};
}
}
});
@ -1051,12 +967,12 @@ var CstyleBehaviour = function () {
return {
text: '(' + selected + ')',
selection: false
}
};
} else {
return {
text: '()',
selection: [1, 1]
}
};
}
} else if (text == ')') {
var cursor = editor.getCursorPosition();
@ -1068,7 +984,7 @@ var CstyleBehaviour = function () {
return {
text: '',
selection: [1, 1]
}
};
}
}
}
@ -1087,14 +1003,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);
@ -1115,7 +1032,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;
@ -1124,19 +1041,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]
}
};
}
}
}
@ -1145,7 +1062,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 == '"') {
@ -1155,7 +1072,8 @@ var CstyleBehaviour = function () {
}
});
}
};
oop.inherits(CstyleBehaviour, Behaviour);
exports.CstyleBehaviour = CstyleBehaviour;
@ -1523,31 +1441,7 @@ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var CssHighlightRules = function() {
var properties = lang.arrayToMap(
("-moz-appearance|-moz-box-sizing|-webkit-box-sizing|-moz-outline-radius|-moz-transform|-webkit-transform|" +
"appearance|azimuth|background-attachment|background-color|background-image|" +
"background-origin|background-position|background-repeat|background|border-bottom-color|" +
"border-bottom-style|border-bottom-width|border-bottom|border-collapse|" +
"border-color|border-left-color|border-left-style|border-left-width|" +
"border-left|border-right-color|border-right-style|border-right-width|" +
"border-right|border-spacing|border-style|border-top-color|" +
"border-top-style|border-top-width|border-top|border-width|border|" +
"bottom|box-sizing|caption-side|clear|clip|color|content|counter-increment|" +
"counter-reset|cue-after|cue-before|cue|cursor|direction|display|" +
"elevation|empty-cells|float|font-family|font-size-adjust|font-size|" +
"font-stretch|font-style|font-variant|font-weight|font|height|left|" +
"letter-spacing|line-height|list-style-image|list-style-position|" +
"list-style-type|list-style|margin-bottom|margin-left|margin-right|" +
"margin-top|marker-offset|margin|marks|max-height|max-width|min-height|" +
"min-width|-moz-border-radius|opacity|orphans|outline-color|outline-offset|outline-radius|" +
"outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|" +
"padding-left|padding-right|padding-top|padding|page-break-after|" +
"page-break-before|page-break-inside|page|pause-after|pause-before|" +
"pause|pitch-range|pitch|play-during|pointer-events|position|quotes|resize|richness|right|" +
"size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|" +
"stress|table-layout|text-align|text-decoration|text-indent|" +
"text-shadow|text-transform|top|transform|unicode-bidi|vertical-align|" +
"visibility|voice-family|volume|white-space|widows|width|word-spacing|" +
"z-index").split("|")
("animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index").split("|")
);
var functions = lang.arrayToMap(
@ -1555,27 +1449,7 @@ var CssHighlightRules = function() {
);
var constants = lang.arrayToMap(
("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|" +
"block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|" +
"char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|" +
"decimal-leading-zero|decimal|default|disabled|disc|" +
"distribute-all-lines|distribute-letter|distribute-space|" +
"distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|" +
"hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|" +
"ideograph-alpha|ideograph-numeric|ideograph-parenthesis|" +
"ideograph-space|inactive|inherit|inline-block|inline|inset|inside|" +
"inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|" +
"keep-all|left|lighter|line-edge|line-through|line|list-item|loose|" +
"lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|" +
"medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|" +
"nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|" +
"overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|" +
"ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|" +
"solid|square|static|strict|super|sw-resize|table-footer-group|" +
"table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|" +
"transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|" +
"vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|" +
"zero").split("|")
("absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|font-size|font|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero").split("|")
);
var colors = lang.arrayToMap(
@ -1583,32 +1457,49 @@ var CssHighlightRules = function() {
"purple|red|silver|teal|white|yellow").split("|")
);
var fonts = lang.arrayToMap(
("arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|" +
"symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|" +
"serif|monospace").split("|")
);
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
var pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
var pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
var base_ruleset = [
{
token : "comment", // multi line comment
merge : true,
regex : "\\/\\*",
next : "ruleset_comment"
},{
}, {
token : "string", // single line
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
}, {
token : "string", // single line
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
}, {
token : "constant.numeric",
regex : numRe + "(?:em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)"
token : ["constant.numeric", "keyword"],
regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
}, {
token : ["constant.numeric"],
regex : "([0-9]+)"
}, {
token : "constant.numeric", // hex6 color
regex : "#[a-f0-9]{6}"
}, {
token : "constant.numeric", // hex3 color
regex : "#[a-f0-9]{3}"
}, {
token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
regex : pseudoElements
}, {
token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
regex : pseudoClasses
}, {
token : function(value) {
if (properties.hasOwnProperty(value.toLowerCase())) {
@ -1623,12 +1514,15 @@ var CssHighlightRules = function() {
else if (colors.hasOwnProperty(value.toLowerCase())) {
return "support.constant.color";
}
else if (fonts.hasOwnProperty(value.toLowerCase())) {
return "support.constant.fonts";
}
else {
return "text";
}
},
regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
}
}
];
var ruleset = lang.copyArray(base_ruleset);
@ -1806,6 +1700,9 @@ var HtmlHighlightRules = function() {
merge : true,
regex : "<\\!--",
next : "comment"
}, {
token : "xml_pe",
regex : "<\\!.*?>"
}, {
token : "meta.tag",
regex : "<(?=\s*script\\b)",
@ -1813,7 +1710,7 @@ var HtmlHighlightRules = function() {
}, {
token : "meta.tag",
regex : "<(?=\s*style\\b)",
next : "css"
next : "style"
}, {
token : "meta.tag", // opening tag
regex : "<\\/?",
@ -1821,6 +1718,9 @@ var HtmlHighlightRules = function() {
}, {
token : "text",
regex : "\\s+"
}, {
token : "constant.character.entity",
regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
}, {
token : "text",
regex : "[^<]+"
@ -1852,7 +1752,7 @@ var HtmlHighlightRules = function() {
};
xmlUtil.tag(this.$rules, "tag", "start");
xmlUtil.tag(this.$rules, "css", "css-start");
xmlUtil.tag(this.$rules, "style", "css-start");
xmlUtil.tag(this.$rules, "script", "js-start");
this.embedRules(JavaScriptHighlightRules, "js-", [{
@ -1934,7 +1834,7 @@ function string(state) {
token : "string", // multi line string start
merge : true,
regex : '["].*',
next : state + "-qqstring"
next : state + "_qqstring"
}, {
token : "string",
regex : "'.*?'"
@ -1942,7 +1842,7 @@ function string(state) {
token : "string", // multi line string start
merge : true,
regex : "['].*",
next : state + "-qstring"
next : state + "_qstring"
}];
}
@ -1990,18 +1890,18 @@ exports.tag = function(states, name, nextState) {
}
},
merge : true,
regex : "[-_a-zA-Z0-9:!]+",
next : name + "embed-attribute-list"
regex : "[-_a-zA-Z0-9:]+",
next : name + "_embed_attribute_list"
}, {
token: "empty",
regex: "",
next : name + "embed-attribute-list"
next : name + "_embed_attribute_list"
}];
states[name + "-qstring"] = multiLineString("'", name + "embed-attribute-list");
states[name + "-qqstring"] = multiLineString("\"", name + "embed-attribute-list");
states[name + "_qstring"] = multiLineString("'", name + "_embed_attribute_list");
states[name + "_qqstring"] = multiLineString("\"", name + "_embed_attribute_list");
states[name + "embed-attribute-list"] = [{
states[name + "_embed_attribute_list"] = [{
token : "meta.tag",
merge : true,
regex : "\/?>",
@ -2546,13 +2446,4 @@ oop.inherits(FoldMode, BaseFoldMode);
}).call(FoldMode.prototype);
});;
(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];
});
})();
});

File diff suppressed because one or more lines are too long

View File

@ -282,12 +282,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
@ -295,46 +303,139 @@ 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",
regex : "'",
next : "qstring"
}, {
token : "string", // multi line string start
merge : true,
regex : '["].*\\\\$',
next : "qqstring"
}, {
token : "string", // single line
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
}, {
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))
@ -342,7 +443,7 @@ var JavaScriptHighlightRules = function() {
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))
@ -357,29 +458,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
@ -404,7 +505,7 @@ var JavaScriptHighlightRules = function() {
}, {
// immediately return to the start mode without matching
// anything
token: "empty",
token: "empty",
regex: "",
next: "start"
}
@ -416,10 +517,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: "[^\\\\/\\[]+",
@ -431,9 +532,9 @@ var JavaScriptHighlightRules = function() {
next: "regex_character_class",
merge: true
}, {
token: "empty",
token: "empty",
regex: "",
next: "start"
next: "start"
}
],
"regex_character_class": [
@ -452,9 +553,9 @@ var JavaScriptHighlightRules = function() {
next: "regex_character_class",
merge: true
}, {
token: "empty",
token: "empty",
regex: "",
next: "start"
next: "start"
}
],
"comment_regex_allowed" : [
@ -483,28 +584,32 @@ var JavaScriptHighlightRules = function() {
],
"qqstring" : [
{
token : "string",
regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
next : "start"
token : "constant.language.escape",
regex : escapedRe
}, {
token : "string",
merge : true,
regex : '.+'
regex : '[^"\\\\]+'
}, {
token : "string",
regex : '"',
next : "start"
}
],
"qstring" : [
{
token : "string",
regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
next : "start"
token : "constant.language.escape",
regex : escapedRe
}, {
token : "string",
merge : true,
regex : '.+'
regex : "[^'\\\\]+"
}, {
token : "string",
regex : "'",
next : "start"
}
]
};
this.embedRules(DocCommentHighlightRules, "doc-",
[ new DocCommentHighlightRules().getEndRule("start") ]);
};
@ -689,195 +794,6 @@ var MatchingBraceOutdent = function() {};
}).call(MatchingBraceOutdent.prototype);
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 *****
@ -933,12 +849,12 @@ var CstyleBehaviour = function () {
return {
text: '{' + selected + '}',
selection: false
}
};
} else {
return {
text: '{}',
selection: [1, 1]
}
};
}
} else if (text == '}') {
var cursor = editor.getCursorPosition();
@ -950,7 +866,7 @@ var CstyleBehaviour = function () {
return {
text: '',
selection: [1, 1]
}
};
}
}
} else if (text == "\n") {
@ -968,7 +884,7 @@ var CstyleBehaviour = function () {
return {
text: '\n' + indent + '\n' + next_indent,
selection: [1, indent.length, 1, indent.length]
}
};
}
}
});
@ -993,12 +909,12 @@ var CstyleBehaviour = function () {
return {
text: '(' + selected + ')',
selection: false
}
};
} else {
return {
text: '()',
selection: [1, 1]
}
};
}
} else if (text == ')') {
var cursor = editor.getCursorPosition();
@ -1010,7 +926,7 @@ var CstyleBehaviour = function () {
return {
text: '',
selection: [1, 1]
}
};
}
}
}
@ -1029,14 +945,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);
@ -1057,7 +974,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;
@ -1066,19 +983,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]
}
};
}
}
}
@ -1087,7 +1004,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 == '"') {
@ -1097,7 +1014,8 @@ var CstyleBehaviour = function () {
}
});
}
};
oop.inherits(CstyleBehaviour, Behaviour);
exports.CstyleBehaviour = CstyleBehaviour;
@ -1452,13 +1370,3 @@ oop.inherits(JavaHighlightRules, TextHighlightRules);
exports.JavaHighlightRules = JavaHighlightRules;
});
;
(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];
});
})();

File diff suppressed because one or more lines are too long

View File

@ -257,12 +257,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
@ -270,46 +278,139 @@ 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",
regex : "'",
next : "qstring"
}, {
token : "string", // multi line string start
merge : true,
regex : '["].*\\\\$',
next : "qqstring"
}, {
token : "string", // single line
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
}, {
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))
@ -317,7 +418,7 @@ var JavaScriptHighlightRules = function() {
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))
@ -332,29 +433,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
@ -379,7 +480,7 @@ var JavaScriptHighlightRules = function() {
}, {
// immediately return to the start mode without matching
// anything
token: "empty",
token: "empty",
regex: "",
next: "start"
}
@ -391,10 +492,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: "[^\\\\/\\[]+",
@ -406,9 +507,9 @@ var JavaScriptHighlightRules = function() {
next: "regex_character_class",
merge: true
}, {
token: "empty",
token: "empty",
regex: "",
next: "start"
next: "start"
}
],
"regex_character_class": [
@ -427,9 +528,9 @@ var JavaScriptHighlightRules = function() {
next: "regex_character_class",
merge: true
}, {
token: "empty",
token: "empty",
regex: "",
next: "start"
next: "start"
}
],
"comment_regex_allowed" : [
@ -458,28 +559,32 @@ var JavaScriptHighlightRules = function() {
],
"qqstring" : [
{
token : "string",
regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
next : "start"
token : "constant.language.escape",
regex : escapedRe
}, {
token : "string",
merge : true,
regex : '.+'
regex : '[^"\\\\]+'
}, {
token : "string",
regex : '"',
next : "start"
}
],
"qstring" : [
{
token : "string",
regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
next : "start"
token : "constant.language.escape",
regex : escapedRe
}, {
token : "string",
merge : true,
regex : '.+'
regex : "[^'\\\\]+"
}, {
token : "string",
regex : "'",
next : "start"
}
]
};
this.embedRules(DocCommentHighlightRules, "doc-",
[ new DocCommentHighlightRules().getEndRule("start") ]);
};
@ -664,195 +769,6 @@ var MatchingBraceOutdent = function() {};
}).call(MatchingBraceOutdent.prototype);
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 *****
@ -908,12 +824,12 @@ var CstyleBehaviour = function () {
return {
text: '{' + selected + '}',
selection: false
}
};
} else {
return {
text: '{}',
selection: [1, 1]
}
};
}
} else if (text == '}') {
var cursor = editor.getCursorPosition();
@ -925,7 +841,7 @@ var CstyleBehaviour = function () {
return {
text: '',
selection: [1, 1]
}
};
}
}
} else if (text == "\n") {
@ -943,7 +859,7 @@ var CstyleBehaviour = function () {
return {
text: '\n' + indent + '\n' + next_indent,
selection: [1, indent.length, 1, indent.length]
}
};
}
}
});
@ -968,12 +884,12 @@ var CstyleBehaviour = function () {
return {
text: '(' + selected + ')',
selection: false
}
};
} else {
return {
text: '()',
selection: [1, 1]
}
};
}
} else if (text == ')') {
var cursor = editor.getCursorPosition();
@ -985,7 +901,7 @@ var CstyleBehaviour = function () {
return {
text: '',
selection: [1, 1]
}
};
}
}
}
@ -1004,14 +920,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);
@ -1032,7 +949,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;
@ -1041,19 +958,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]
}
};
}
}
}
@ -1062,7 +979,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 == '"') {
@ -1072,7 +989,8 @@ var CstyleBehaviour = function () {
}
});
}
};
oop.inherits(CstyleBehaviour, Behaviour);
exports.CstyleBehaviour = CstyleBehaviour;
@ -1283,13 +1201,3 @@ var FoldMode = exports.FoldMode = function() {};
}).call(FoldMode.prototype);
});
;
(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];
});
})();

File diff suppressed because one or more lines are too long

View File

@ -35,7 +35,7 @@
*
* ***** END LICENSE BLOCK ***** */
define('ace/mode/json', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/json_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) {
define('ace/mode/json', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/json_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle', 'ace/worker/worker_client'], function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
@ -45,6 +45,7 @@ var HighlightRules = require("./json_highlight_rules").JsonHighlightRules;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var WorkerClient = require("../worker/worker_client").WorkerClient;
var Mode = function() {
this.$tokenizer = new Tokenizer(new HighlightRules().getRules());
@ -76,7 +77,23 @@ oop.inherits(Mode, TextMode);
this.autoOutdent = function(state, doc, row) {
this.$outdent.autoOutdent(doc, row);
};
this.createWorker = function(session) {
var worker = new WorkerClient(["ace"], "worker-json.js", "ace/mode/json_worker", "JsonWorker");
worker.attachToDocument(session.getDocument());
worker.on("error", function(e) {
session.setAnnotations([e.data]);
});
worker.on("ok", function() {
session.clearAnnotations();
});
return worker;
};
}).call(Mode.prototype);
exports.Mode = Mode;
@ -302,12 +319,12 @@ var CstyleBehaviour = function () {
return {
text: '{' + selected + '}',
selection: false
}
};
} else {
return {
text: '{}',
selection: [1, 1]
}
};
}
} else if (text == '}') {
var cursor = editor.getCursorPosition();
@ -319,7 +336,7 @@ var CstyleBehaviour = function () {
return {
text: '',
selection: [1, 1]
}
};
}
}
} else if (text == "\n") {
@ -337,7 +354,7 @@ var CstyleBehaviour = function () {
return {
text: '\n' + indent + '\n' + next_indent,
selection: [1, indent.length, 1, indent.length]
}
};
}
}
});
@ -362,12 +379,12 @@ var CstyleBehaviour = function () {
return {
text: '(' + selected + ')',
selection: false
}
};
} else {
return {
text: '()',
selection: [1, 1]
}
};
}
} else if (text == ')') {
var cursor = editor.getCursorPosition();
@ -379,7 +396,7 @@ var CstyleBehaviour = function () {
return {
text: '',
selection: [1, 1]
}
};
}
}
}
@ -398,14 +415,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);
@ -426,7 +444,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;
@ -435,19 +453,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]
}
};
}
}
}
@ -456,7 +474,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 == '"') {
@ -466,7 +484,8 @@ var CstyleBehaviour = function () {
}
});
}
};
oop.inherits(CstyleBehaviour, Behaviour);
exports.CstyleBehaviour = CstyleBehaviour;
@ -677,13 +696,3 @@ var FoldMode = exports.FoldMode = function() {};
}).call(FoldMode.prototype);
});
;
(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];
});
})();

File diff suppressed because one or more lines are too long

View File

@ -93,13 +93,3 @@ oop.inherits(LatexHighlightRules, TextHighlightRules);
exports.LatexHighlightRules = LatexHighlightRules;
});
;
(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];
});
})();

View File

@ -1 +1 @@
define("ace/mode/latex",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/latex_highlight_rules","ace/range"],function(a,b,c){"use strict";var d=a("../lib/oop"),e=a("./text").Mode,f=a("../tokenizer").Tokenizer,g=a("./latex_highlight_rules").LatexHighlightRules,h=a("../range").Range,i=function(){this.$tokenizer=new f((new g).getRules())};d.inherits(i,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=/^(\s*)\%/;for(var g=c;g<=d;g++)if(!f.test(b.getLine(g))){e=!1;break}if(e){var i=new h(0,0,0,0);for(var g=c;g<=d;g++){var j=b.getLine(g),k=j.match(f);i.start.row=g,i.end.row=g,i.end.column=k[0].length,b.replace(i,k[1])}}else b.indentRows(c,d,"%")},this.getNextLineIndent=function(a,b,c){return this.$getIndent(b)}}.call(i.prototype),b.Mode=i}),define("ace/mode/latex_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(a,b,c){"use strict";var d=a("../lib/oop"),e=a("./text_highlight_rules").TextHighlightRules,f=function(){this.$rules={start:[{token:"keyword",regex:"\\\\(?:[^a-zA-Z]|[a-zA-Z]+)"},{token:"lparen",regex:"[[({]"},{token:"rparen",regex:"[\\])}]"},{token:"string",regex:"\\$(?:(?:\\\\.)|(?:[^\\$\\\\]))*?\\$"},{token:"comment",regex:"%.*$"}]}};d.inherits(f,e),b.LatexHighlightRules=f}),function(){window.require(["ace/ace"],function(a){window.ace||(window.ace={});for(var b in a)a.hasOwnProperty(b)&&(ace[b]=a[b])})}()
define("ace/mode/latex",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/latex_highlight_rules","ace/range"],function(a,b,c){"use strict";var d=a("../lib/oop"),e=a("./text").Mode,f=a("../tokenizer").Tokenizer,g=a("./latex_highlight_rules").LatexHighlightRules,h=a("../range").Range,i=function(){this.$tokenizer=new f((new g).getRules())};d.inherits(i,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=/^(\s*)\%/;for(var g=c;g<=d;g++)if(!f.test(b.getLine(g))){e=!1;break}if(e){var i=new h(0,0,0,0);for(var g=c;g<=d;g++){var j=b.getLine(g),k=j.match(f);i.start.row=g,i.end.row=g,i.end.column=k[0].length,b.replace(i,k[1])}}else b.indentRows(c,d,"%")},this.getNextLineIndent=function(a,b,c){return this.$getIndent(b)}}.call(i.prototype),b.Mode=i}),define("ace/mode/latex_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(a,b,c){"use strict";var d=a("../lib/oop"),e=a("./text_highlight_rules").TextHighlightRules,f=function(){this.$rules={start:[{token:"keyword",regex:"\\\\(?:[^a-zA-Z]|[a-zA-Z]+)"},{token:"lparen",regex:"[[({]"},{token:"rparen",regex:"[\\])}]"},{token:"string",regex:"\\$(?:(?:\\\\.)|(?:[^\\$\\\\]))*?\\$"},{token:"comment",regex:"%.*$"}]}};d.inherits(f,e),b.LatexHighlightRules=f})

View File

@ -0,0 +1,654 @@
/* ***** 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>
* John Roepke <john AT justjohn DOT us>
*
* 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/mode/less', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/less_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/folding/cstyle'], function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var LessHighlightRules = require("./less_highlight_rules").LessHighlightRules;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
this.$tokenizer = new Tokenizer(new LessHighlightRules().getRules(), "i");
this.$outdent = new MatchingBraceOutdent();
this.foldingRules = new CStyleFoldMode();
};
oop.inherits(Mode, TextMode);
(function() {
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
// ignore braces in comments
var tokens = this.$tokenizer.getLineTokens(line, state).tokens;
if (tokens.length && tokens[tokens.length-1].type == "comment") {
return indent;
}
var match = line.match(/^.*\{\s*$/);
if (match) {
indent += tab;
}
return indent;
};
this.checkOutdent = function(state, line, input) {
return this.$outdent.checkOutdent(line, input);
};
this.autoOutdent = function(state, doc, row) {
this.$outdent.autoOutdent(doc, row);
};
}).call(Mode.prototype);
exports.Mode = Mode;
});
/* ***** 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>
* John Roepke <john AT justjohn DOT us>
*
* 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/mode/less_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var lang = require("../lib/lang");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var LessHighlightRules = function() {
var properties = lang.arrayToMap( (function () {
var browserPrefix = ("-webkit-|-moz-|-o-|-ms-|-svg-|-pie-|-khtml-").split("|");
var prefixProperties = ("appearance|background-clip|background-inline-policy|background-origin|" +
"background-size|binding|border-bottom-colors|border-left-colors|" +
"border-right-colors|border-top-colors|border-end|border-end-color|" +
"border-end-style|border-end-width|border-image|border-start|" +
"border-start-color|border-start-style|border-start-width|box-align|" +
"box-direction|box-flex|box-flexgroup|box-ordinal-group|box-orient|" +
"box-pack|box-sizing|column-count|column-gap|column-width|column-rule|" +
"column-rule-width|column-rule-style|column-rule-color|float-edge|" +
"font-feature-settings|font-language-override|force-broken-image-icon|" +
"image-region|margin-end|margin-start|opacity|outline|outline-color|" +
"outline-offset|outline-radius|outline-radius-bottomleft|" +
"outline-radius-bottomright|outline-radius-topleft|outline-radius-topright|" +
"outline-style|outline-width|padding-end|padding-start|stack-sizing|" +
"tab-size|text-blink|text-decoration-color|text-decoration-line|" +
"text-decoration-style|transform|transform-origin|transition|" +
"transition-delay|transition-duration|transition-property|" +
"transition-timing-function|user-focus|user-input|user-modify|user-select|" +
"window-shadow|border-radius").split("|");
var properties = ("azimuth|background-attachment|background-color|background-image|" +
"background-position|background-repeat|background|border-bottom-color|" +
"border-bottom-style|border-bottom-width|border-bottom|border-collapse|" +
"border-color|border-left-color|border-left-style|border-left-width|" +
"border-left|border-right-color|border-right-style|border-right-width|" +
"border-right|border-spacing|border-style|border-top-color|" +
"border-top-style|border-top-width|border-top|border-width|border|" +
"bottom|box-sizing|caption-side|clear|clip|color|content|counter-increment|" +
"counter-reset|cue-after|cue-before|cue|cursor|direction|display|" +
"elevation|empty-cells|float|font-family|font-size-adjust|font-size|" +
"font-stretch|font-style|font-variant|font-weight|font|height|left|" +
"letter-spacing|line-height|list-style-image|list-style-position|" +
"list-style-type|list-style|margin-bottom|margin-left|margin-right|" +
"margin-top|marker-offset|margin|marks|max-height|max-width|min-height|" +
"min-width|opacity|orphans|outline-color|" +
"outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|" +
"padding-left|padding-right|padding-top|padding|page-break-after|" +
"page-break-before|page-break-inside|page|pause-after|pause-before|" +
"pause|pitch-range|pitch|play-during|position|quotes|richness|right|" +
"size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|" +
"stress|table-layout|text-align|text-decoration|text-indent|" +
"text-shadow|text-transform|top|unicode-bidi|vertical-align|" +
"visibility|voice-family|volume|white-space|widows|width|word-spacing|" +
"z-index").split("|");
//The return array
var ret = [];
//All prefixProperties will get the browserPrefix in
//the begning by join the prefixProperties array with the value of browserPrefix
for (var i=0, ln=browserPrefix.length; i<ln; i++) {
Array.prototype.push.apply(
ret,
(( browserPrefix[i] + prefixProperties.join("|" + browserPrefix[i]) ).split("|"))
);
}
//Add also prefixProperties and properties without any browser prefix
Array.prototype.push.apply(ret, prefixProperties);
Array.prototype.push.apply(ret, properties);
return ret;
})() );
var functions = lang.arrayToMap(
("hsl|hsla|rgb|rgba|url|attr|counter|counters|lighten|darken|saturate|" +
"desaturate|fadein|fadeout|fade|spin|mix|hue|saturation|lightness|" +
"alpha|round|ceil|floor|percentage|color|iscolor|isnumber|isstring|" +
"iskeyword|isurl|ispixel|ispercentage|isem").split("|")
);
var constants = lang.arrayToMap(
("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|" +
"block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|" +
"char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|" +
"decimal-leading-zero|decimal|default|disabled|disc|" +
"distribute-all-lines|distribute-letter|distribute-space|" +
"distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|" +
"hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|" +
"ideograph-alpha|ideograph-numeric|ideograph-parenthesis|" +
"ideograph-space|inactive|inherit|inline-block|inline|inset|inside|" +
"inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|" +
"keep-all|left|lighter|line-edge|line-through|line|list-item|loose|" +
"lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|" +
"medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|" +
"nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|" +
"overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|" +
"ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|" +
"solid|square|static|strict|super|sw-resize|table-footer-group|" +
"table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|" +
"transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|" +
"vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|" +
"zero").split("|")
);
var colors = lang.arrayToMap(
("aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|" +
"purple|red|silver|teal|white|yellow").split("|")
);
var keywords = lang.arrayToMap(
("@mixin|@extend|@include|@import|@media|@debug|@warn|@if|@for|@each|" +
"@while|@else|@font-face|@-webkit-keyframes|if|and|!default|module|" +
"def|end|declare|when|not|and").split("|")
);
var tags = lang.arrayToMap(
("a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|" +
"big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|" +
"command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|" +
"figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|" +
"header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|" +
"link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|" +
"option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|" +
"small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|" +
"textarea|tfoot|th|thead|time|title|tr|tt|u|ul|var|video|wbr|xmp").split("|")
);
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
this.$rules = {
"start" : [
{
token : "comment",
regex : "\\/\\/.*$"
},
{
token : "comment", // multi line comment
merge : true,
regex : "\\/\\*",
next : "comment"
}, {
token : "string", // single line
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
}, {
token : "string", // single line
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
}, {
token : "constant.numeric",
regex : numRe + "(?:em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)"
}, {
token : "constant.numeric", // hex6 color
regex : "#[a-f0-9]{6}"
}, {
token : "constant.numeric", // hex3 color
regex : "#[a-f0-9]{3}"
}, {
token : "constant.numeric",
regex : numRe
}, {
token : function(value) {
if (keywords.hasOwnProperty(value))
return "keyword";
else
return "variable";
},
regex : "@[a-z0-9_\\-@]*\\b"
}, {
token : function(value) {
if (properties.hasOwnProperty(value.toLowerCase()))
return "support.type";
else if (keywords.hasOwnProperty(value))
return "keyword";
else if (constants.hasOwnProperty(value))
return "constant.language";
else if (functions.hasOwnProperty(value))
return "support.function";
else if (colors.hasOwnProperty(value.toLowerCase()))
return "support.constant.color";
else if (tags.hasOwnProperty(value.toLowerCase()))
return "variable.language";
else
return "text";
},
regex : "\\-?[@a-z_][@a-z0-9_\\-]*"
}, {
token: "variable.language",
regex: "#[a-z0-9-_]+"
}, {
token: "variable.language",
regex: "\\.[a-z0-9-_]+"
}, {
token: "variable.language",
regex: ":[a-z0-9-_]+"
}, {
token: "constant",
regex: "[a-z0-9-_]+"
}, {
token : "keyword.operator",
regex : "<|>|<=|>=|==|!=|-|%|#|\\+|\\$|\\+|\\*"
}, {
token : "paren.lparen",
regex : "[[({]"
}, {
token : "paren.rparen",
regex : "[\\])}]"
}, {
token : "text",
regex : "\\s+"
}
],
"comment" : [
{
token : "comment", // closing comment
regex : ".*?\\*\\/",
next : "start"
}, {
token : "comment", // comment spanning whole line
merge : true,
regex : ".+"
}
]
};
};
oop.inherits(LessHighlightRules, TextHighlightRules);
exports.LessHighlightRules = LessHighlightRules;
});
/* ***** 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/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
"use strict";
var Range = require("../range").Range;
var MatchingBraceOutdent = function() {};
(function() {
this.checkOutdent = function(line, input) {
if (! /^\s+$/.test(line))
return false;
return /^\s*\}/.test(input);
};
this.autoOutdent = function(doc, row) {
var line = doc.getLine(row);
var match = line.match(/^(\s*\})/);
if (!match) return 0;
var column = match[1].length;
var openBracePos = doc.findMatchingBracket({row: row, column: column});
if (!openBracePos || openBracePos.row == row) return 0;
var indent = this.$getIndent(doc.getLine(openBracePos.row));
doc.replace(new Range(row, 0, row, column-1), indent);
};
this.$getIndent = function(line) {
var match = line.match(/^(\s+)/);
if (match) {
return match[1];
}
return "";
};
}).call(MatchingBraceOutdent.prototype);
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/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
"use strict";
var oop = require("../../lib/oop");
var Range = require("../../range").Range;
var BaseFoldMode = require("./fold_mode").FoldMode;
var FoldMode = exports.FoldMode = function() {};
oop.inherits(FoldMode, BaseFoldMode);
(function() {
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
this.getFoldWidgetRange = function(session, foldStyle, row) {
var line = session.getLine(row);
var match = line.match(this.foldingStartMarker);
if (match) {
var i = match.index;
if (match[1])
return this.openingBracketBlock(session, match[1], row, i);
var range = session.getCommentFoldRange(row, i + match[0].length);
range.end.column -= 2;
return range;
}
if (foldStyle !== "markbeginend")
return;
var match = line.match(this.foldingStopMarker);
if (match) {
var i = match.index + match[0].length;
if (match[2]) {
var range = session.getCommentFoldRange(row, i);
range.end.column -= 2;
return range;
}
var end = {row: row, column: i};
var start = session.$findOpeningBracket(match[1], end);
if (!start)
return;
start.column++;
end.column--;
return Range.fromPoints(start, end);
}
};
}).call(FoldMode.prototype);
});/* ***** 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/mode/folding/fold_mode', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
"use strict";
var Range = require("../../range").Range;
var FoldMode = exports.FoldMode = function() {};
(function() {
this.foldingStartMarker = null;
this.foldingStopMarker = null;
// must return "" if there's no fold, to enable caching
this.getFoldWidget = function(session, foldStyle, row) {
var line = session.getLine(row);
if (this.foldingStartMarker.test(line))
return "start";
if (foldStyle == "markbeginend"
&& this.foldingStopMarker
&& this.foldingStopMarker.test(line))
return "end";
return "";
};
this.getFoldWidgetRange = function(session, foldStyle, row) {
return null;
};
this.indentationBlock = function(session, row, column) {
var re = /^\s*/;
var startRow = row;
var endRow = row;
var line = session.getLine(row);
var startColumn = column || line.length;
var startLevel = line.match(re)[0].length;
var maxRow = session.getLength()
while (++row < maxRow) {
line = session.getLine(row);
var level = line.match(re)[0].length;
if (level == line.length)
continue;
if (level <= startLevel)
break;
endRow = row;
}
if (endRow > startRow) {
var endColumn = session.getLine(endRow).length;
return new Range(startRow, startColumn, endRow, endColumn);
}
};
this.openingBracketBlock = function(session, bracket, row, column) {
var start = {row: row, column: column + 1};
var end = session.$findClosingBracket(bracket, start);
if (!end)
return;
var fw = session.foldWidgets[end.row];
if (fw == null)
fw = this.getFoldWidget(session, end.row);
if (fw == "start") {
end.row --;
end.column = session.getLine(end.row).length;
}
return Range.fromPoints(start, end);
};
}).call(FoldMode.prototype);
});

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -521,13 +521,3 @@ oop.inherits(LuaHighlightRules, TextHighlightRules);
exports.LuaHighlightRules = LuaHighlightRules;
});
;
(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];
});
})();

File diff suppressed because one or more lines are too long

View File

@ -337,12 +337,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
@ -350,46 +358,139 @@ 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",
regex : "'",
next : "qstring"
}, {
token : "string", // multi line string start
merge : true,
regex : '["].*\\\\$',
next : "qqstring"
}, {
token : "string", // single line
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
}, {
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))
@ -397,7 +498,7 @@ var JavaScriptHighlightRules = function() {
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))
@ -412,29 +513,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
@ -459,7 +560,7 @@ var JavaScriptHighlightRules = function() {
}, {
// immediately return to the start mode without matching
// anything
token: "empty",
token: "empty",
regex: "",
next: "start"
}
@ -471,10 +572,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: "[^\\\\/\\[]+",
@ -486,9 +587,9 @@ var JavaScriptHighlightRules = function() {
next: "regex_character_class",
merge: true
}, {
token: "empty",
token: "empty",
regex: "",
next: "start"
next: "start"
}
],
"regex_character_class": [
@ -507,9 +608,9 @@ var JavaScriptHighlightRules = function() {
next: "regex_character_class",
merge: true
}, {
token: "empty",
token: "empty",
regex: "",
next: "start"
next: "start"
}
],
"comment_regex_allowed" : [
@ -538,28 +639,32 @@ var JavaScriptHighlightRules = function() {
],
"qqstring" : [
{
token : "string",
regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
next : "start"
token : "constant.language.escape",
regex : escapedRe
}, {
token : "string",
merge : true,
regex : '.+'
regex : '[^"\\\\]+'
}, {
token : "string",
regex : '"',
next : "start"
}
],
"qstring" : [
{
token : "string",
regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
next : "start"
token : "constant.language.escape",
regex : escapedRe
}, {
token : "string",
merge : true,
regex : '.+'
regex : "[^'\\\\]+"
}, {
token : "string",
regex : "'",
next : "start"
}
]
};
this.embedRules(DocCommentHighlightRules, "doc-",
[ new DocCommentHighlightRules().getEndRule("start") ]);
};
@ -744,195 +849,6 @@ var MatchingBraceOutdent = function() {};
}).call(MatchingBraceOutdent.prototype);
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 *****
@ -988,12 +904,12 @@ var CstyleBehaviour = function () {
return {
text: '{' + selected + '}',
selection: false
}
};
} else {
return {
text: '{}',
selection: [1, 1]
}
};
}
} else if (text == '}') {
var cursor = editor.getCursorPosition();
@ -1005,7 +921,7 @@ var CstyleBehaviour = function () {
return {
text: '',
selection: [1, 1]
}
};
}
}
} else if (text == "\n") {
@ -1023,7 +939,7 @@ var CstyleBehaviour = function () {
return {
text: '\n' + indent + '\n' + next_indent,
selection: [1, indent.length, 1, indent.length]
}
};
}
}
});
@ -1048,12 +964,12 @@ var CstyleBehaviour = function () {
return {
text: '(' + selected + ')',
selection: false
}
};
} else {
return {
text: '()',
selection: [1, 1]
}
};
}
} else if (text == ')') {
var cursor = editor.getCursorPosition();
@ -1065,7 +981,7 @@ var CstyleBehaviour = function () {
return {
text: '',
selection: [1, 1]
}
};
}
}
}
@ -1084,14 +1000,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);
@ -1112,7 +1029,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;
@ -1121,19 +1038,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]
}
};
}
}
}
@ -1142,7 +1059,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 == '"') {
@ -1152,7 +1069,8 @@ var CstyleBehaviour = function () {
}
});
}
};
oop.inherits(CstyleBehaviour, Behaviour);
exports.CstyleBehaviour = CstyleBehaviour;
@ -1489,6 +1407,9 @@ var XmlHighlightRules = function() {
merge : true,
regex : "<\\!--",
next : "comment"
}, {
token : "xml_pe",
regex : "<\\!.*?>"
}, {
token : "meta.tag", // opening tag
regex : "<\\/?",
@ -1496,6 +1417,9 @@ var XmlHighlightRules = function() {
}, {
token : "text",
regex : "\\s+"
}, {
token : "constant.character.entity",
regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
}, {
token : "text",
regex : "[^<]+"
@ -1589,7 +1513,7 @@ function string(state) {
token : "string", // multi line string start
merge : true,
regex : '["].*',
next : state + "-qqstring"
next : state + "_qqstring"
}, {
token : "string",
regex : "'.*?'"
@ -1597,7 +1521,7 @@ function string(state) {
token : "string", // multi line string start
merge : true,
regex : "['].*",
next : state + "-qstring"
next : state + "_qstring"
}];
}
@ -1645,18 +1569,18 @@ exports.tag = function(states, name, nextState) {
}
},
merge : true,
regex : "[-_a-zA-Z0-9:!]+",
next : name + "embed-attribute-list"
regex : "[-_a-zA-Z0-9:]+",
next : name + "_embed_attribute_list"
}, {
token: "empty",
regex: "",
next : name + "embed-attribute-list"
next : name + "_embed_attribute_list"
}];
states[name + "-qstring"] = multiLineString("'", name + "embed-attribute-list");
states[name + "-qqstring"] = multiLineString("\"", name + "embed-attribute-list");
states[name + "_qstring"] = multiLineString("'", name + "_embed_attribute_list");
states[name + "_qqstring"] = multiLineString("\"", name + "_embed_attribute_list");
states[name + "embed-attribute-list"] = [{
states[name + "_embed_attribute_list"] = [{
token : "meta.tag",
merge : true,
regex : "\/?>",
@ -2269,31 +2193,7 @@ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var CssHighlightRules = function() {
var properties = lang.arrayToMap(
("-moz-appearance|-moz-box-sizing|-webkit-box-sizing|-moz-outline-radius|-moz-transform|-webkit-transform|" +
"appearance|azimuth|background-attachment|background-color|background-image|" +
"background-origin|background-position|background-repeat|background|border-bottom-color|" +
"border-bottom-style|border-bottom-width|border-bottom|border-collapse|" +
"border-color|border-left-color|border-left-style|border-left-width|" +
"border-left|border-right-color|border-right-style|border-right-width|" +
"border-right|border-spacing|border-style|border-top-color|" +
"border-top-style|border-top-width|border-top|border-width|border|" +
"bottom|box-sizing|caption-side|clear|clip|color|content|counter-increment|" +
"counter-reset|cue-after|cue-before|cue|cursor|direction|display|" +
"elevation|empty-cells|float|font-family|font-size-adjust|font-size|" +
"font-stretch|font-style|font-variant|font-weight|font|height|left|" +
"letter-spacing|line-height|list-style-image|list-style-position|" +
"list-style-type|list-style|margin-bottom|margin-left|margin-right|" +
"margin-top|marker-offset|margin|marks|max-height|max-width|min-height|" +
"min-width|-moz-border-radius|opacity|orphans|outline-color|outline-offset|outline-radius|" +
"outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|" +
"padding-left|padding-right|padding-top|padding|page-break-after|" +
"page-break-before|page-break-inside|page|pause-after|pause-before|" +
"pause|pitch-range|pitch|play-during|pointer-events|position|quotes|resize|richness|right|" +
"size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|" +
"stress|table-layout|text-align|text-decoration|text-indent|" +
"text-shadow|text-transform|top|transform|unicode-bidi|vertical-align|" +
"visibility|voice-family|volume|white-space|widows|width|word-spacing|" +
"z-index").split("|")
("animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index").split("|")
);
var functions = lang.arrayToMap(
@ -2301,27 +2201,7 @@ var CssHighlightRules = function() {
);
var constants = lang.arrayToMap(
("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|" +
"block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|" +
"char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|" +
"decimal-leading-zero|decimal|default|disabled|disc|" +
"distribute-all-lines|distribute-letter|distribute-space|" +
"distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|" +
"hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|" +
"ideograph-alpha|ideograph-numeric|ideograph-parenthesis|" +
"ideograph-space|inactive|inherit|inline-block|inline|inset|inside|" +
"inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|" +
"keep-all|left|lighter|line-edge|line-through|line|list-item|loose|" +
"lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|" +
"medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|" +
"nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|" +
"overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|" +
"ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|" +
"solid|square|static|strict|super|sw-resize|table-footer-group|" +
"table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|" +
"transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|" +
"vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|" +
"zero").split("|")
("absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|font-size|font|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero").split("|")
);
var colors = lang.arrayToMap(
@ -2329,32 +2209,49 @@ var CssHighlightRules = function() {
"purple|red|silver|teal|white|yellow").split("|")
);
var fonts = lang.arrayToMap(
("arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|" +
"symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|" +
"serif|monospace").split("|")
);
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
var pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
var pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
var base_ruleset = [
{
token : "comment", // multi line comment
merge : true,
regex : "\\/\\*",
next : "ruleset_comment"
},{
}, {
token : "string", // single line
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
}, {
token : "string", // single line
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
}, {
token : "constant.numeric",
regex : numRe + "(?:em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)"
token : ["constant.numeric", "keyword"],
regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
}, {
token : ["constant.numeric"],
regex : "([0-9]+)"
}, {
token : "constant.numeric", // hex6 color
regex : "#[a-f0-9]{6}"
}, {
token : "constant.numeric", // hex3 color
regex : "#[a-f0-9]{3}"
}, {
token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
regex : pseudoElements
}, {
token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
regex : pseudoClasses
}, {
token : function(value) {
if (properties.hasOwnProperty(value.toLowerCase())) {
@ -2369,12 +2266,15 @@ var CssHighlightRules = function() {
else if (colors.hasOwnProperty(value.toLowerCase())) {
return "support.constant.color";
}
else if (fonts.hasOwnProperty(value.toLowerCase())) {
return "support.constant.fonts";
}
else {
return "text";
}
},
regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
}
}
];
var ruleset = lang.copyArray(base_ruleset);
@ -2552,6 +2452,9 @@ var HtmlHighlightRules = function() {
merge : true,
regex : "<\\!--",
next : "comment"
}, {
token : "xml_pe",
regex : "<\\!.*?>"
}, {
token : "meta.tag",
regex : "<(?=\s*script\\b)",
@ -2559,7 +2462,7 @@ var HtmlHighlightRules = function() {
}, {
token : "meta.tag",
regex : "<(?=\s*style\\b)",
next : "css"
next : "style"
}, {
token : "meta.tag", // opening tag
regex : "<\\/?",
@ -2567,6 +2470,9 @@ var HtmlHighlightRules = function() {
}, {
token : "text",
regex : "\\s+"
}, {
token : "constant.character.entity",
regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
}, {
token : "text",
regex : "[^<]+"
@ -2598,7 +2504,7 @@ var HtmlHighlightRules = function() {
};
xmlUtil.tag(this.$rules, "tag", "start");
xmlUtil.tag(this.$rules, "css", "css-start");
xmlUtil.tag(this.$rules, "style", "css-start");
xmlUtil.tag(this.$rules, "script", "js-start");
this.embedRules(JavaScriptHighlightRules, "js-", [{
@ -2860,7 +2766,7 @@ var MarkdownHighlightRules = function() {
token : "empty_line",
regex : '^$'
}, { // code span `
token : "support.function",
token : ["support.function", "support.function", "support.function"],
regex : "(`+)([^\\r]*?[^`])(\\1)"
}, { // code block
token : "support.function",
@ -2890,7 +2796,7 @@ var MarkdownHighlightRules = function() {
next : "blockquote"
}, { // reference
token : ["text", "constant", "text", "url", "string", "text"],
regex : "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?\\s*)$"
regex : "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?(\\s*))$"
}, { // link by reference
token : ["text", "string", "text", "constant", "text"],
regex : "(\\[)((?:[[^\\]]*\\]|[^\\[\\]])*)(\\][ ]?(?:\\n[ ]*)?\\[)(.*?)(\\])"
@ -2916,10 +2822,10 @@ var MarkdownHighlightRules = function() {
regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
next : "listblock"
}, { // strong ** __
token : "string",
token : ["string", "string", "string"],
regex : "([*]{2}|[_]{2}(?=\\S))([^\\r]*?\\S[*_]*)(\\1)"
}, { // emphasis * _
token : "string",
token : ["string", "string", "string"],
regex : "([*]|[_](?=\\S))([^\\r]*?\\S[*_]*)(\\1)"
}, { //
token : ["text", "url", "text"],
@ -2988,13 +2894,4 @@ var MarkdownHighlightRules = function() {
oop.inherits(MarkdownHighlightRules, TextHighlightRules);
exports.MarkdownHighlightRules = MarkdownHighlightRules;
});;
(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];
});
})();
});

File diff suppressed because one or more lines are too long

View File

@ -537,13 +537,3 @@ var MatchingBraceOutdent = function() {};
exports.MatchingBraceOutdent = MatchingBraceOutdent;
});
;
(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];
});
})();

File diff suppressed because one or more lines are too long

View File

@ -571,13 +571,3 @@ var FoldMode = exports.FoldMode = function() {};
}).call(FoldMode.prototype);
});
;
(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];
});
})();

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1071,14 +1071,14 @@ var PhpHighlightRules = function() {
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
}, {
token : "string", // multi line string start
regex : '["].*\\\\$',
regex : '["][\\s\\S]*',
next : "qqstring"
}, {
token : "string", // single line
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
}, {
token : "string", // multi line string start
regex : "['].*\\\\$",
regex : "['][\\s\\S]+",
next : "qstring"
}, {
token : "constant.numeric", // hex
@ -1160,21 +1160,21 @@ var PhpHighlightRules = function() {
"qqstring" : [
{
token : "string",
regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
regex : '"',
next : "start"
}, {
token : "string",
regex : '.+'
regex : '[^"]+'
}
],
"qstring" : [
{
token : "string",
regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
regex : "'",
next : "start"
}, {
token : "string",
regex : '.+'
regex : "[^']+"
}
],
"htmlcomment" : [
@ -1213,7 +1213,7 @@ var PhpHighlightRules = function() {
next : "htmltag"
}, {
token : "meta.tag",
regex : ">",
regex : ">"
}, {
token : 'text',
regex : "(?:media|type|href)"
@ -1223,7 +1223,7 @@ var PhpHighlightRules = function() {
}, {
token : "paren.lparen",
regex : "\{",
next : "cssdeclaration",
next : "cssdeclaration"
}, {
token : "keyword",
regex : "#[A-Za-z0-9\-\_\.]+"
@ -1265,7 +1265,7 @@ var PhpHighlightRules = function() {
regex : ";",
next : "cssdeclaration"
}
],
]
};
this.embedRules(DocCommentHighlightRules, "doc-",
@ -1507,12 +1507,12 @@ var CstyleBehaviour = function () {
return {
text: '{' + selected + '}',
selection: false
}
};
} else {
return {
text: '{}',
selection: [1, 1]
}
};
}
} else if (text == '}') {
var cursor = editor.getCursorPosition();
@ -1524,7 +1524,7 @@ var CstyleBehaviour = function () {
return {
text: '',
selection: [1, 1]
}
};
}
}
} else if (text == "\n") {
@ -1542,7 +1542,7 @@ var CstyleBehaviour = function () {
return {
text: '\n' + indent + '\n' + next_indent,
selection: [1, indent.length, 1, indent.length]
}
};
}
}
});
@ -1567,12 +1567,12 @@ var CstyleBehaviour = function () {
return {
text: '(' + selected + ')',
selection: false
}
};
} else {
return {
text: '()',
selection: [1, 1]
}
};
}
} else if (text == ')') {
var cursor = editor.getCursorPosition();
@ -1584,7 +1584,7 @@ var CstyleBehaviour = function () {
return {
text: '',
selection: [1, 1]
}
};
}
}
}
@ -1603,14 +1603,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);
@ -1631,7 +1632,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;
@ -1640,19 +1641,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]
}
};
}
}
}
@ -1661,7 +1662,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 == '"') {
@ -1671,7 +1672,8 @@ var CstyleBehaviour = function () {
}
});
}
};
oop.inherits(CstyleBehaviour, Behaviour);
exports.CstyleBehaviour = CstyleBehaviour;
@ -1882,13 +1884,3 @@ var FoldMode = exports.FoldMode = function() {};
}).call(FoldMode.prototype);
});
;
(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];
});
})();

File diff suppressed because one or more lines are too long

View File

@ -329,12 +329,12 @@ var CstyleBehaviour = function () {
return {
text: '{' + selected + '}',
selection: false
}
};
} else {
return {
text: '{}',
selection: [1, 1]
}
};
}
} else if (text == '}') {
var cursor = editor.getCursorPosition();
@ -346,7 +346,7 @@ var CstyleBehaviour = function () {
return {
text: '',
selection: [1, 1]
}
};
}
}
} else if (text == "\n") {
@ -364,7 +364,7 @@ var CstyleBehaviour = function () {
return {
text: '\n' + indent + '\n' + next_indent,
selection: [1, indent.length, 1, indent.length]
}
};
}
}
});
@ -389,12 +389,12 @@ var CstyleBehaviour = function () {
return {
text: '(' + selected + ')',
selection: false
}
};
} else {
return {
text: '()',
selection: [1, 1]
}
};
}
} else if (text == ')') {
var cursor = editor.getCursorPosition();
@ -406,7 +406,7 @@ var CstyleBehaviour = function () {
return {
text: '',
selection: [1, 1]
}
};
}
}
}
@ -425,14 +425,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);
@ -453,7 +454,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;
@ -462,19 +463,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]
}
};
}
}
}
@ -483,7 +484,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 == '"') {
@ -493,7 +494,8 @@ var CstyleBehaviour = function () {
}
});
}
};
oop.inherits(CstyleBehaviour, Behaviour);
exports.CstyleBehaviour = CstyleBehaviour;
@ -704,13 +706,3 @@ var FoldMode = exports.FoldMode = function() {};
}).call(FoldMode.prototype);
});
;
(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];
});
})();

File diff suppressed because one or more lines are too long

View File

@ -504,13 +504,3 @@ var FoldMode = exports.FoldMode = function() {};
}).call(FoldMode.prototype);
});
;
(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];
});
})();

File diff suppressed because one or more lines are too long

View File

@ -389,13 +389,3 @@ var MatchingBraceOutdent = function() {};
exports.MatchingBraceOutdent = MatchingBraceOutdent;
});
;
(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];
});
})();

File diff suppressed because one or more lines are too long

View File

@ -529,12 +529,12 @@ var CstyleBehaviour = function () {
return {
text: '{' + selected + '}',
selection: false
}
};
} else {
return {
text: '{}',
selection: [1, 1]
}
};
}
} else if (text == '}') {
var cursor = editor.getCursorPosition();
@ -546,7 +546,7 @@ var CstyleBehaviour = function () {
return {
text: '',
selection: [1, 1]
}
};
}
}
} else if (text == "\n") {
@ -564,7 +564,7 @@ var CstyleBehaviour = function () {
return {
text: '\n' + indent + '\n' + next_indent,
selection: [1, indent.length, 1, indent.length]
}
};
}
}
});
@ -589,12 +589,12 @@ var CstyleBehaviour = function () {
return {
text: '(' + selected + ')',
selection: false
}
};
} else {
return {
text: '()',
selection: [1, 1]
}
};
}
} else if (text == ')') {
var cursor = editor.getCursorPosition();
@ -606,7 +606,7 @@ var CstyleBehaviour = function () {
return {
text: '',
selection: [1, 1]
}
};
}
}
}
@ -625,14 +625,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);
@ -653,7 +654,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;
@ -662,19 +663,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]
}
};
}
}
}
@ -683,7 +684,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 == '"') {
@ -693,7 +694,8 @@ var CstyleBehaviour = function () {
}
});
}
};
oop.inherits(CstyleBehaviour, Behaviour);
exports.CstyleBehaviour = CstyleBehaviour;
@ -904,13 +906,3 @@ var FoldMode = exports.FoldMode = function() {};
}).call(FoldMode.prototype);
});
;
(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];
});
})();

File diff suppressed because one or more lines are too long

View File

@ -282,12 +282,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
@ -295,46 +303,139 @@ 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",
regex : "'",
next : "qstring"
}, {
token : "string", // multi line string start
merge : true,
regex : '["].*\\\\$',
next : "qqstring"
}, {
token : "string", // single line
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
}, {
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))
@ -342,7 +443,7 @@ var JavaScriptHighlightRules = function() {
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))
@ -357,29 +458,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
@ -404,7 +505,7 @@ var JavaScriptHighlightRules = function() {
}, {
// immediately return to the start mode without matching
// anything
token: "empty",
token: "empty",
regex: "",
next: "start"
}
@ -416,10 +517,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: "[^\\\\/\\[]+",
@ -431,9 +532,9 @@ var JavaScriptHighlightRules = function() {
next: "regex_character_class",
merge: true
}, {
token: "empty",
token: "empty",
regex: "",
next: "start"
next: "start"
}
],
"regex_character_class": [
@ -452,9 +553,9 @@ var JavaScriptHighlightRules = function() {
next: "regex_character_class",
merge: true
}, {
token: "empty",
token: "empty",
regex: "",
next: "start"
next: "start"
}
],
"comment_regex_allowed" : [
@ -483,28 +584,32 @@ var JavaScriptHighlightRules = function() {
],
"qqstring" : [
{
token : "string",
regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
next : "start"
token : "constant.language.escape",
regex : escapedRe
}, {
token : "string",
merge : true,
regex : '.+'
regex : '[^"\\\\]+'
}, {
token : "string",
regex : '"',
next : "start"
}
],
"qstring" : [
{
token : "string",
regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
next : "start"
token : "constant.language.escape",
regex : escapedRe
}, {
token : "string",
merge : true,
regex : '.+'
regex : "[^'\\\\]+"
}, {
token : "string",
regex : "'",
next : "start"
}
]
};
this.embedRules(DocCommentHighlightRules, "doc-",
[ new DocCommentHighlightRules().getEndRule("start") ]);
};
@ -689,195 +794,6 @@ var MatchingBraceOutdent = function() {};
}).call(MatchingBraceOutdent.prototype);
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 *****
@ -933,12 +849,12 @@ var CstyleBehaviour = function () {
return {
text: '{' + selected + '}',
selection: false
}
};
} else {
return {
text: '{}',
selection: [1, 1]
}
};
}
} else if (text == '}') {
var cursor = editor.getCursorPosition();
@ -950,7 +866,7 @@ var CstyleBehaviour = function () {
return {
text: '',
selection: [1, 1]
}
};
}
}
} else if (text == "\n") {
@ -968,7 +884,7 @@ var CstyleBehaviour = function () {
return {
text: '\n' + indent + '\n' + next_indent,
selection: [1, indent.length, 1, indent.length]
}
};
}
}
});
@ -993,12 +909,12 @@ var CstyleBehaviour = function () {
return {
text: '(' + selected + ')',
selection: false
}
};
} else {
return {
text: '()',
selection: [1, 1]
}
};
}
} else if (text == ')') {
var cursor = editor.getCursorPosition();
@ -1010,7 +926,7 @@ var CstyleBehaviour = function () {
return {
text: '',
selection: [1, 1]
}
};
}
}
}
@ -1029,14 +945,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);
@ -1057,7 +974,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;
@ -1066,19 +983,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]
}
};
}
}
}
@ -1087,7 +1004,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 == '"') {
@ -1097,7 +1014,8 @@ var CstyleBehaviour = function () {
}
});
}
};
oop.inherits(CstyleBehaviour, Behaviour);
exports.CstyleBehaviour = CstyleBehaviour;
@ -1452,13 +1370,3 @@ oop.inherits(ScalaHighlightRules, TextHighlightRules);
exports.ScalaHighlightRules = ScalaHighlightRules;
});
;
(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];
});
})();

File diff suppressed because one or more lines are too long

View File

@ -676,13 +676,3 @@ var FoldMode = exports.FoldMode = function() {};
}).call(FoldMode.prototype);
});
;
(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];
});
})();

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,281 @@
/* ***** 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):
* Rich Healey <richo AT psych0tik DOT net>
*
* 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/mode/sh', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/sh_highlight_rules', 'ace/range'], function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var ShHighlightRules = require("./sh_highlight_rules").ShHighlightRules;
var Range = require("../range").Range;
var Mode = function() {
this.$tokenizer = new Tokenizer(new ShHighlightRules().getRules());
};
oop.inherits(Mode, TextMode);
(function() {
this.toggleCommentLines = function(state, doc, startRow, endRow) {
var outdent = true;
var re = /^(\s*)#/;
for (var i=startRow; i<= endRow; i++) {
if (!re.test(doc.getLine(i))) {
outdent = false;
break;
}
}
if (outdent) {
var deleteRange = new Range(0, 0, 0, 0);
for (var i=startRow; i<= endRow; i++)
{
var line = doc.getLine(i);
var m = line.match(re);
deleteRange.start.row = i;
deleteRange.end.row = i;
deleteRange.end.column = m[0].length;
doc.replace(deleteRange, m[1]);
}
}
else {
doc.indentRows(startRow, endRow, "#");
}
};
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
var tokens = tokenizedLine.tokens;
if (tokens.length && tokens[tokens.length-1].type == "comment") {
return indent;
}
if (state == "start") {
var match = line.match(/^.*[\{\(\[\:]\s*$/);
if (match) {
indent += tab;
}
}
return indent;
};
var outdents = {
"pass": 1,
"return": 1,
"raise": 1,
"break": 1,
"continue": 1
};
this.checkOutdent = function(state, line, input) {
if (input !== "\r\n" && input !== "\r" && input !== "\n")
return false;
var tokens = this.$tokenizer.getLineTokens(line.trim(), state).tokens;
if (!tokens)
return false;
// ignore trailing comments
do {
var last = tokens.pop();
} while (last && (last.type == "comment" || (last.type == "text" && last.value.match(/^\s+$/))));
if (!last)
return false;
return (last.type == "keyword" && outdents[last.value]);
};
this.autoOutdent = function(state, doc, row) {
// outdenting in sh is slightly different because it always applies
// to the next line and only of a new line is inserted
row += 1;
var indent = this.$getIndent(doc.getLine(row));
var tab = doc.getTabString();
if (indent.slice(-tab.length) == tab)
doc.remove(new Range(row, indent.length-tab.length, row, indent.length));
};
}).call(Mode.prototype);
exports.Mode = Mode;
});
/* ***** 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):
* Rich Healey <richo AT psych0tik DOT net>
*
* 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/mode/sh_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var lang = require("../lib/lang");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var ShHighlightRules = function() {
var reservedKeywords = lang.arrayToMap(
('!|{|}|case|do|done|elif|else|'+
'esac|fi|for|if|in|then|until|while|'+
'&|;'
).split('|')
);
var languageConstructs = lang.arrayToMap(
// TODO
('echo|exit|eval|source|[|]|test|'+
'true|false|read'
).split('|')
);
var integer = "(?:(?:[1-9]\\d*)|(?:0))";
// var integer = "(?:" + decimalInteger + ")";
var fraction = "(?:\\.\\d+)";
var intPart = "(?:\\d+)";
var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + ")";
var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
var fileDescriptor = "(?:&" + intPart + ")";
var variableName = "[a-zA-Z][a-zA-Z0-9_]*";
var variable = "(?:(?:\\$" + variableName + ")|(?:" + variableName + "=))";
var builtinVariable = "(?:\\$(?:SHLVL|\\$|\\!|\\?))";
var func = "(?:" + variableName + "\\s*\\(\\))";
this.$rules = {
"start" : [ {
token : "comment",
regex : "#.*$"
}, {
token : "string", // " string
regex : '"(?:[^\\\\]|\\\\.)*?"'
}, {
token : "variable.language",
regex : builtinVariable
}, {
token : "variable",
regex : variable
}, {
token : "support.function",
regex : func,
}, {
token : "support.function",
regex : fileDescriptor
}, {
token : "string", // ' string
regex : "'(?:[^\\\\]|\\\\.)*?'"
}, {
token : "constant.numeric", // float
regex : floatNumber
}, {
token : "constant.numeric", // integer
regex : integer + "\\b"
}, {
token : function(value) {
if (reservedKeywords.hasOwnProperty(value))
return "keyword";
else if (languageConstructs.hasOwnProperty(value))
return "constant.language";
else if (value == "debugger")
return "invalid.deprecated";
else
return "identifier";
},
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
}, {
token : "keyword.operator",
regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|~|<|>|<=|=>|=|!="
}, {
token : "lparen.paren",
regex : "[\\[\\(\\{]"
}, {
token : "paren.rparen",
regex : "[\\]\\)\\}]"
}, {
token : "text",
regex : "\\s+"
} ]
};
};
oop.inherits(ShHighlightRules, TextHighlightRules);
exports.ShHighlightRules = ShHighlightRules;
});

View File

@ -0,0 +1 @@
define("ace/mode/sh",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/sh_highlight_rules","ace/range"],function(a,b,c){"use strict";var d=a("../lib/oop"),e=a("./text").Mode,f=a("../tokenizer").Tokenizer,g=a("./sh_highlight_rules").ShHighlightRules,h=a("../range").Range,i=function(){this.$tokenizer=new f((new g).getRules())};d.inherits(i,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=/^(\s*)#/;for(var g=c;g<=d;g++)if(!f.test(b.getLine(g))){e=!1;break}if(e){var i=new h(0,0,0,0);for(var g=c;g<=d;g++){var j=b.getLine(g),k=j.match(f);i.start.row=g,i.end.row=g,i.end.column=k[0].length,b.replace(i,k[1])}}else b.indentRows(c,d,"#")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var g=b.match(/^.*[\{\(\[\:]\s*$/);g&&(d+=c)}return d};var a={pass:1,"return":1,raise:1,"break":1,"continue":1};this.checkOutdent=function(b,c,d){if(d!=="\r\n"&&d!=="\r"&&d!=="\n")return!1;var e=this.$tokenizer.getLineTokens(c.trim(),b).tokens;if(!e)return!1;do var f=e.pop();while(f&&(f.type=="comment"||f.type=="text"&&f.value.match(/^\s+$/)));return f?f.type=="keyword"&&a[f.value]:!1},this.autoOutdent=function(a,b,c){c+=1;var d=this.$getIndent(b.getLine(c)),e=b.getTabString();d.slice(-e.length)==e&&b.remove(new h(c,d.length-e.length,c,d.length))}}.call(i.prototype),b.Mode=i}),define("ace/mode/sh_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"],function(a,b,c){"use strict";var d=a("../lib/oop"),e=a("../lib/lang"),f=a("./text_highlight_rules").TextHighlightRules,g=function(){var a=e.arrayToMap("!|{|}|case|do|done|elif|else|esac|fi|for|if|in|then|until|while|&|;".split("|")),b=e.arrayToMap("echo|exit|eval|source|[|]|test|true|false|read".split("|")),c="(?:(?:[1-9]\\d*)|(?:0))",d="(?:\\.\\d+)",f="(?:\\d+)",g="(?:(?:"+f+"?"+d+")|(?:"+f+"\\.))",h="(?:(?:"+g+"|"+f+")"+")",i="(?:"+h+"|"+g+")",j="(?:&"+f+")",k="[a-zA-Z][a-zA-Z0-9_]*",l="(?:(?:\\$"+k+")|(?:"+k+"=))",m="(?:\\$(?:SHLVL|\\$|\\!|\\?))",n="(?:"+k+"\\s*\\(\\))";this.$rules={start:[{token:"comment",regex:"#.*$"},{token:"string",regex:'"(?:[^\\\\]|\\\\.)*?"'},{token:"variable.language",regex:m},{token:"variable",regex:l},{token:"support.function",regex:n},{token:"support.function",regex:j},{token:"string",regex:"'(?:[^\\\\]|\\\\.)*?'"},{token:"constant.numeric",regex:i},{token:"constant.numeric",regex:c+"\\b"},{token:function(c){return a.hasOwnProperty(c)?"keyword":b.hasOwnProperty(c)?"constant.language":c=="debugger"?"invalid.deprecated":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|~|<|>|<=|=>|=|!="},{token:"lparen.paren",regex:"[\\[\\(\\{]"},{token:"paren.rparen",regex:"[\\]\\)\\}]"},{token:"text",regex:"\\s+"}]}};d.inherits(g,f),b.ShHighlightRules=g})

View File

@ -157,13 +157,3 @@ oop.inherits(SqlHighlightRules, TextHighlightRules);
exports.SqlHighlightRules = SqlHighlightRules;
});
;
(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];
});
})();

View File

@ -1 +1 @@
define("ace/mode/sql",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/sql_highlight_rules","ace/range"],function(a,b,c){"use strict";var d=a("../lib/oop"),e=a("./text").Mode,f=a("../tokenizer").Tokenizer,g=a("./sql_highlight_rules").SqlHighlightRules,h=a("../range").Range,i=function(){this.$tokenizer=new f((new g).getRules())};d.inherits(i,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)--/;for(var i=c;i<=d;i++)if(!g.test(b.getLine(i))){e=!1;break}if(e){var j=new h(0,0,0,0);for(var i=c;i<=d;i++){var k=b.getLine(i),l=k.match(g);j.start.row=i,j.end.row=i,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"--")}}.call(i.prototype),b.Mode=i}),define("ace/mode/sql_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"],function(a,b,c){"use strict";var d=a("../lib/oop"),e=a("../lib/lang"),f=a("./text_highlight_rules").TextHighlightRules,g=function(){var a=e.arrayToMap("select|from|where|and|or|group|by|order|limit|offset|having|as|case|when|else|end|type|left|right|join|on|outer|desc|asc".split("|")),b=e.arrayToMap("true|false|null".split("|")),c=e.arrayToMap("count|min|max|avg|sum|rank|now|coalesce".split("|"));this.$rules={start:[{token:"comment",regex:"--.*$"},{token:"string",regex:'".*"'},{token:"string",regex:"'.*'"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:function(d){return d=d.toLowerCase(),a.hasOwnProperty(d)?"keyword":b.hasOwnProperty(d)?"constant.language":c.hasOwnProperty(d)?"support.function":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="},{token:"lparen.paren",regex:"[\\(]"},{token:"paren.rparen",regex:"[\\)]"},{token:"text",regex:"\\s+"}]}};d.inherits(g,f),b.SqlHighlightRules=g}),function(){window.require(["ace/ace"],function(a){window.ace||(window.ace={});for(var b in a)a.hasOwnProperty(b)&&(ace[b]=a[b])})}()
define("ace/mode/sql",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/sql_highlight_rules","ace/range"],function(a,b,c){"use strict";var d=a("../lib/oop"),e=a("./text").Mode,f=a("../tokenizer").Tokenizer,g=a("./sql_highlight_rules").SqlHighlightRules,h=a("../range").Range,i=function(){this.$tokenizer=new f((new g).getRules())};d.inherits(i,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)--/;for(var i=c;i<=d;i++)if(!g.test(b.getLine(i))){e=!1;break}if(e){var j=new h(0,0,0,0);for(var i=c;i<=d;i++){var k=b.getLine(i),l=k.match(g);j.start.row=i,j.end.row=i,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"--")}}.call(i.prototype),b.Mode=i}),define("ace/mode/sql_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"],function(a,b,c){"use strict";var d=a("../lib/oop"),e=a("../lib/lang"),f=a("./text_highlight_rules").TextHighlightRules,g=function(){var a=e.arrayToMap("select|from|where|and|or|group|by|order|limit|offset|having|as|case|when|else|end|type|left|right|join|on|outer|desc|asc".split("|")),b=e.arrayToMap("true|false|null".split("|")),c=e.arrayToMap("count|min|max|avg|sum|rank|now|coalesce".split("|"));this.$rules={start:[{token:"comment",regex:"--.*$"},{token:"string",regex:'".*"'},{token:"string",regex:"'.*'"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:function(d){return d=d.toLowerCase(),a.hasOwnProperty(d)?"keyword":b.hasOwnProperty(d)?"constant.language":c.hasOwnProperty(d)?"support.function":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="},{token:"lparen.paren",regex:"[\\(]"},{token:"paren.rparen",regex:"[\\)]"},{token:"text",regex:"\\s+"}]}};d.inherits(g,f),b.SqlHighlightRules=g})

View File

@ -202,6 +202,9 @@ var XmlHighlightRules = function() {
merge : true,
regex : "<\\!--",
next : "comment"
}, {
token : "xml_pe",
regex : "<\\!.*?>"
}, {
token : "meta.tag", // opening tag
regex : "<\\/?",
@ -209,6 +212,9 @@ var XmlHighlightRules = function() {
}, {
token : "text",
regex : "\\s+"
}, {
token : "constant.character.entity",
regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
}, {
token : "text",
regex : "[^<]+"
@ -302,7 +308,7 @@ function string(state) {
token : "string", // multi line string start
merge : true,
regex : '["].*',
next : state + "-qqstring"
next : state + "_qqstring"
}, {
token : "string",
regex : "'.*?'"
@ -310,7 +316,7 @@ function string(state) {
token : "string", // multi line string start
merge : true,
regex : "['].*",
next : state + "-qstring"
next : state + "_qstring"
}];
}
@ -358,18 +364,18 @@ exports.tag = function(states, name, nextState) {
}
},
merge : true,
regex : "[-_a-zA-Z0-9:!]+",
next : name + "embed-attribute-list"
regex : "[-_a-zA-Z0-9:]+",
next : name + "_embed_attribute_list"
}, {
token: "empty",
regex: "",
next : name + "embed-attribute-list"
next : name + "_embed_attribute_list"
}];
states[name + "-qstring"] = multiLineString("'", name + "embed-attribute-list");
states[name + "-qqstring"] = multiLineString("\"", name + "embed-attribute-list");
states[name + "_qstring"] = multiLineString("'", name + "_embed_attribute_list");
states[name + "_qqstring"] = multiLineString("\"", name + "_embed_attribute_list");
states[name + "embed-attribute-list"] = [{
states[name + "_embed_attribute_list"] = [{
token : "meta.tag",
merge : true,
regex : "\/?>",
@ -535,12 +541,12 @@ var CstyleBehaviour = function () {
return {
text: '{' + selected + '}',
selection: false
}
};
} else {
return {
text: '{}',
selection: [1, 1]
}
};
}
} else if (text == '}') {
var cursor = editor.getCursorPosition();
@ -552,7 +558,7 @@ var CstyleBehaviour = function () {
return {
text: '',
selection: [1, 1]
}
};
}
}
} else if (text == "\n") {
@ -570,7 +576,7 @@ var CstyleBehaviour = function () {
return {
text: '\n' + indent + '\n' + next_indent,
selection: [1, indent.length, 1, indent.length]
}
};
}
}
});
@ -595,12 +601,12 @@ var CstyleBehaviour = function () {
return {
text: '(' + selected + ')',
selection: false
}
};
} else {
return {
text: '()',
selection: [1, 1]
}
};
}
} else if (text == ')') {
var cursor = editor.getCursorPosition();
@ -612,7 +618,7 @@ var CstyleBehaviour = function () {
return {
text: '',
selection: [1, 1]
}
};
}
}
}
@ -631,14 +637,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);
@ -659,7 +666,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;
@ -668,19 +675,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]
}
};
}
}
}
@ -689,7 +696,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 == '"') {
@ -699,7 +706,8 @@ var CstyleBehaviour = function () {
}
});
}
};
oop.inherits(CstyleBehaviour, Behaviour);
exports.CstyleBehaviour = CstyleBehaviour;
@ -1336,12 +1344,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
@ -1349,46 +1365,139 @@ 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",
regex : "'",
next : "qstring"
}, {
token : "string", // multi line string start
merge : true,
regex : '["].*\\\\$',
next : "qqstring"
}, {
token : "string", // single line
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
}, {
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))
@ -1396,7 +1505,7 @@ var JavaScriptHighlightRules = function() {
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))
@ -1411,29 +1520,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
@ -1458,7 +1567,7 @@ var JavaScriptHighlightRules = function() {
}, {
// immediately return to the start mode without matching
// anything
token: "empty",
token: "empty",
regex: "",
next: "start"
}
@ -1470,10 +1579,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: "[^\\\\/\\[]+",
@ -1485,9 +1594,9 @@ var JavaScriptHighlightRules = function() {
next: "regex_character_class",
merge: true
}, {
token: "empty",
token: "empty",
regex: "",
next: "start"
next: "start"
}
],
"regex_character_class": [
@ -1506,9 +1615,9 @@ var JavaScriptHighlightRules = function() {
next: "regex_character_class",
merge: true
}, {
token: "empty",
token: "empty",
regex: "",
next: "start"
next: "start"
}
],
"comment_regex_allowed" : [
@ -1537,28 +1646,32 @@ var JavaScriptHighlightRules = function() {
],
"qqstring" : [
{
token : "string",
regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
next : "start"
token : "constant.language.escape",
regex : escapedRe
}, {
token : "string",
merge : true,
regex : '.+'
regex : '[^"\\\\]+'
}, {
token : "string",
regex : '"',
next : "start"
}
],
"qstring" : [
{
token : "string",
regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
next : "start"
token : "constant.language.escape",
regex : escapedRe
}, {
token : "string",
merge : true,
regex : '.+'
regex : "[^'\\\\]+"
}, {
token : "string",
regex : "'",
next : "start"
}
]
};
this.embedRules(DocCommentHighlightRules, "doc-",
[ new DocCommentHighlightRules().getEndRule("start") ]);
};
@ -1743,195 +1856,6 @@ var MatchingBraceOutdent = function() {};
}).call(MatchingBraceOutdent.prototype);
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;
});
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
@ -2185,13 +2109,4 @@ oop.inherits(FoldMode, BaseFoldMode);
}).call(FoldMode.prototype);
});;
(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];
});
})();
});

File diff suppressed because one or more lines are too long

View File

@ -252,13 +252,3 @@ var MatchingBraceOutdent = function() {};
exports.MatchingBraceOutdent = MatchingBraceOutdent;
});
;
(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];
});
})();

View File

@ -1 +1 @@
define("ace/mode/textile",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/textile_highlight_rules","ace/mode/matching_brace_outdent"],function(a,b,c){"use strict";var d=a("../lib/oop"),e=a("./text").Mode,f=a("../tokenizer").Tokenizer,g=a("./textile_highlight_rules").TextileHighlightRules,h=a("./matching_brace_outdent").MatchingBraceOutdent,i=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(i,e),function(){this.getNextLineIndent=function(a,b,c){return a=="intag"?c:""},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)}}.call(i.prototype),b.Mode=i}),define("ace/mode/textile_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(a,b,c){"use strict";var d=a("../lib/oop"),e=a("./text_highlight_rules").TextHighlightRules,f=function(){this.$rules={start:[{token:function(a){return a.match(/^h\d$/)?"markup.heading."+a.charAt(1):"markup.heading"},regex:"h1|h2|h3|h4|h5|h6|bq|p|bc|pre",next:"blocktag"},{token:"keyword",regex:"[\\*]+|[#]+"},{token:"text",regex:".+"}],blocktag:[{token:"keyword",regex:"\\. ",next:"start"},{token:"keyword",regex:"\\(",next:"blocktagproperties"}],blocktagproperties:[{token:"keyword",regex:"\\)",next:"blocktag"},{token:"string",regex:"[a-zA-Z0-9\\-_]+"},{token:"keyword",regex:"#"}]}};d.inherits(f,e),b.TextileHighlightRules=f}),define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(a,b,c){"use strict";var d=a("../range").Range,e=function(){};((function(){this.checkOutdent=function(a,b){return/^\s+$/.test(a)?/^\s*\}/.test(b):!1},this.autoOutdent=function(a,b){var c=a.getLine(b),e=c.match(/^(\s*\})/);if(!e)return 0;var f=e[1].length,g=a.findMatchingBracket({row:b,column:f});if(!g||g.row==b)return 0;var h=this.$getIndent(a.getLine(g.row));a.replace(new d(b,0,b,f-1),h)},this.$getIndent=function(a){var b=a.match(/^(\s+)/);return b?b[1]:""}})).call(e.prototype),b.MatchingBraceOutdent=e}),function(){window.require(["ace/ace"],function(a){window.ace||(window.ace={});for(var b in a)a.hasOwnProperty(b)&&(ace[b]=a[b])})}()
define("ace/mode/textile",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/textile_highlight_rules","ace/mode/matching_brace_outdent"],function(a,b,c){"use strict";var d=a("../lib/oop"),e=a("./text").Mode,f=a("../tokenizer").Tokenizer,g=a("./textile_highlight_rules").TextileHighlightRules,h=a("./matching_brace_outdent").MatchingBraceOutdent,i=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(i,e),function(){this.getNextLineIndent=function(a,b,c){return a=="intag"?c:""},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)}}.call(i.prototype),b.Mode=i}),define("ace/mode/textile_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(a,b,c){"use strict";var d=a("../lib/oop"),e=a("./text_highlight_rules").TextHighlightRules,f=function(){this.$rules={start:[{token:function(a){return a.match(/^h\d$/)?"markup.heading."+a.charAt(1):"markup.heading"},regex:"h1|h2|h3|h4|h5|h6|bq|p|bc|pre",next:"blocktag"},{token:"keyword",regex:"[\\*]+|[#]+"},{token:"text",regex:".+"}],blocktag:[{token:"keyword",regex:"\\. ",next:"start"},{token:"keyword",regex:"\\(",next:"blocktagproperties"}],blocktagproperties:[{token:"keyword",regex:"\\)",next:"blocktag"},{token:"string",regex:"[a-zA-Z0-9\\-_]+"},{token:"keyword",regex:"#"}]}};d.inherits(f,e),b.TextileHighlightRules=f}),define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(a,b,c){"use strict";var d=a("../range").Range,e=function(){};(function(){this.checkOutdent=function(a,b){return/^\s+$/.test(a)?/^\s*\}/.test(b):!1},this.autoOutdent=function(a,b){var c=a.getLine(b),e=c.match(/^(\s*\})/);if(!e)return 0;var f=e[1].length,g=a.findMatchingBracket({row:b,column:f});if(!g||g.row==b)return 0;var h=this.$getIndent(a.getLine(g.row));a.replace(new d(b,0,b,f-1),h)},this.$getIndent=function(a){var b=a.match(/^(\s+)/);return b?b[1]:""}}).call(e.prototype),b.MatchingBraceOutdent=e})

View File

@ -124,6 +124,9 @@ var XmlHighlightRules = function() {
merge : true,
regex : "<\\!--",
next : "comment"
}, {
token : "xml_pe",
regex : "<\\!.*?>"
}, {
token : "meta.tag", // opening tag
regex : "<\\/?",
@ -131,6 +134,9 @@ var XmlHighlightRules = function() {
}, {
token : "text",
regex : "\\s+"
}, {
token : "constant.character.entity",
regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
}, {
token : "text",
regex : "[^<]+"
@ -224,7 +230,7 @@ function string(state) {
token : "string", // multi line string start
merge : true,
regex : '["].*',
next : state + "-qqstring"
next : state + "_qqstring"
}, {
token : "string",
regex : "'.*?'"
@ -232,7 +238,7 @@ function string(state) {
token : "string", // multi line string start
merge : true,
regex : "['].*",
next : state + "-qstring"
next : state + "_qstring"
}];
}
@ -280,18 +286,18 @@ exports.tag = function(states, name, nextState) {
}
},
merge : true,
regex : "[-_a-zA-Z0-9:!]+",
next : name + "embed-attribute-list"
regex : "[-_a-zA-Z0-9:]+",
next : name + "_embed_attribute_list"
}, {
token: "empty",
regex: "",
next : name + "embed-attribute-list"
next : name + "_embed_attribute_list"
}];
states[name + "-qstring"] = multiLineString("'", name + "embed-attribute-list");
states[name + "-qqstring"] = multiLineString("\"", name + "embed-attribute-list");
states[name + "_qstring"] = multiLineString("'", name + "_embed_attribute_list");
states[name + "_qqstring"] = multiLineString("\"", name + "_embed_attribute_list");
states[name + "embed-attribute-list"] = [{
states[name + "_embed_attribute_list"] = [{
token : "meta.tag",
merge : true,
regex : "\/?>",
@ -457,12 +463,12 @@ var CstyleBehaviour = function () {
return {
text: '{' + selected + '}',
selection: false
}
};
} else {
return {
text: '{}',
selection: [1, 1]
}
};
}
} else if (text == '}') {
var cursor = editor.getCursorPosition();
@ -474,7 +480,7 @@ var CstyleBehaviour = function () {
return {
text: '',
selection: [1, 1]
}
};
}
}
} else if (text == "\n") {
@ -492,7 +498,7 @@ var CstyleBehaviour = function () {
return {
text: '\n' + indent + '\n' + next_indent,
selection: [1, indent.length, 1, indent.length]
}
};
}
}
});
@ -517,12 +523,12 @@ var CstyleBehaviour = function () {
return {
text: '(' + selected + ')',
selection: false
}
};
} else {
return {
text: '()',
selection: [1, 1]
}
};
}
} else if (text == ')') {
var cursor = editor.getCursorPosition();
@ -534,7 +540,7 @@ var CstyleBehaviour = function () {
return {
text: '',
selection: [1, 1]
}
};
}
}
}
@ -553,14 +559,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);
@ -581,7 +588,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;
@ -590,19 +597,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]
}
};
}
}
}
@ -611,7 +618,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 == '"') {
@ -621,7 +628,8 @@ var CstyleBehaviour = function () {
}
});
}
};
oop.inherits(CstyleBehaviour, Behaviour);
exports.CstyleBehaviour = CstyleBehaviour;
@ -999,13 +1007,3 @@ var FoldMode = exports.FoldMode = function() {};
}).call(FoldMode.prototype);
});
;
(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];
});
})();

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,540 @@
/*
* eXide - web-based XQuery IDE
*
* Copyright (C) 2011 Wolfgang Meier
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
define('ace/mode/xquery', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/xquery_highlight_rules', 'ace/mode/behaviour/xquery', 'ace/range'], function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var XQueryHighlightRules = require("./xquery_highlight_rules").XQueryHighlightRules;
var XQueryBehaviour = require("./behaviour/xquery").XQueryBehaviour;
var Range = require("../range").Range;
var Mode = function(parent) {
this.$tokenizer = new Tokenizer(new XQueryHighlightRules().getRules());
this.$behaviour = new XQueryBehaviour(parent);
};
oop.inherits(Mode, TextMode);
(function() {
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
var match = line.match(/\s*(?:then|else|return|[{\(]|<\w+>)\s*$/);
if (match)
indent += tab;
return indent;
};
this.checkOutdent = function(state, line, input) {
if (! /^\s+$/.test(line))
return false;
return /^\s*[\}\)]/.test(input);
};
this.autoOutdent = function(state, doc, row) {
var line = doc.getLine(row);
var match = line.match(/^(\s*[\}\)])/);
if (!match) return 0;
var column = match[1].length;
var openBracePos = doc.findMatchingBracket({row: row, column: column});
if (!openBracePos || openBracePos.row == row) return 0;
var indent = this.$getIndent(doc.getLine(openBracePos.row));
doc.replace(new Range(row, 0, row, column-1), indent);
};
this.$getIndent = function(line) {
var match = line.match(/^(\s+)/);
if (match) {
return match[1];
}
return "";
};
this.toggleCommentLines = function(state, doc, startRow, endRow) {
var i, line;
var outdent = true;
var re = /^\s*\(:(.*):\)/;
for (i=startRow; i<= endRow; i++) {
if (!re.test(doc.getLine(i))) {
outdent = false;
break;
}
}
var range = new Range(0, 0, 0, 0);
for (i=startRow; i<= endRow; i++) {
line = doc.getLine(i);
range.start.row = i;
range.end.row = i;
range.end.column = line.length;
doc.replace(range, outdent ? line.match(re)[1] : "(:" + line + ":)");
}
};
}).call(Mode.prototype);
exports.Mode = Mode;
});
/*
* eXide - web-based XQuery IDE
*
* Copyright (C) 2011 Wolfgang Meier
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
define('ace/mode/xquery_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var lang = require("../lib/lang");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var XQueryHighlightRules = function() {
var keywords = lang.arrayToMap(
("return|for|let|where|order|by|declare|function|variable|xquery|version|option|namespace|import|module|when|encoding|" +
"switch|default|try|catch|group|tumbling|sliding|window|start|end|at|only|" +
"using|stemming|" +
"while|" +
"external|" +
"if|then|else|as|and|or|typeswitch|case|ascending|descending|empty|in|count|updating|insert|delete|replace|value|node|attribute|text|element|into|of|with|contains").split("|")
);
// regexp must not have capturing parentheses
// regexps are ordered -> the first match is used
this.$rules = {
start : [ {
token : "text",
regex : "<\\!\\[CDATA\\[",
next : "cdata"
}, {
token : "xml_pe",
regex : "<\\?.*?\\?>"
}, {
token : "comment",
regex : "<\\!--",
next : "comment"
}, {
token : "comment",
regex : "\\(:",
next : "comment"
}, {
token : "text", // opening tag
regex : "<\\/?",
next : "tag"
}, {
token : "constant", // number
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
}, {
token : "variable", // variable
regex : "\\$[a-zA-Z_][a-zA-Z0-9_\\-:]*\\b"
}, {
token: "string",
regex : '".*?"'
}, {
token: "string",
regex : "'.*?'"
}, {
token : "text",
regex : "\\s+"
}, {
token: "support.function",
regex: "\\w[\\w+_\\-:]+(?=\\()"
}, {
token : function(value) {
if (keywords[value])
return "keyword";
else
return "identifier";
},
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
}, {
token: "keyword.operator",
regex: "\\*|=|<|>|\\-|\\+|and|or|eq|ne|lt|gt"
}, {
token: "lparen",
regex: "[[({]"
}, {
token: "rparen",
regex: "[\\])}]"
} ],
tag : [ {
token : "text",
regex : ">",
next : "start"
}, {
token : "meta.tag",
regex : "[-_a-zA-Z0-9:]+"
}, {
token : "text",
regex : "\\s+"
}, {
token : "string",
regex : '".*?"'
}, {
token : "string",
regex : "'.*?'"
} ],
cdata : [ {
token : "text",
regex : "\\]\\]>",
next : "start"
}, {
token : "text",
regex : "\\s+"
}, {
token : "text",
regex : "(?:[^\\]]|\\](?!\\]>))+"
} ],
comment : [ {
token : "comment",
regex : ".*?-->",
next : "start"
}, {
token: "comment",
regex : ".*:\\)",
next : "start"
}, {
token : "comment",
regex : ".+"
} ]
};
};
oop.inherits(XQueryHighlightRules, TextHighlightRules);
exports.XQueryHighlightRules = XQueryHighlightRules;
});
/*
* eXide - web-based XQuery IDE
*
* Copyright (C) 2011 Wolfgang Meier
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
define('ace/mode/behaviour/xquery', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle'], function(require, exports, module) {
"use strict";
var oop = require("../../lib/oop");
var Behaviour = require('../behaviour').Behaviour;
var CstyleBehaviour = require('./cstyle').CstyleBehaviour;
var XQueryBehaviour = function (parent) {
this.inherit(CstyleBehaviour, ["braces", "parens", "string_dquotes"]); // Get string behaviour
this.parent = parent;
this.add("brackets", "insertion", function (state, action, editor, session, text) {
if (text == "\n") {
var cursor = editor.getCursorPosition();
var line = session.doc.getLine(cursor.row);
var rightChars = line.substring(cursor.column, cursor.column + 2);
if (rightChars == '</') {
var indent = this.$getIndent(session.doc.getLine(cursor.row)) + session.getTabString();
var next_indent = this.$getIndent(session.doc.getLine(cursor.row));
return {
text: '\n' + indent + '\n' + next_indent,
selection: [1, indent.length, 1, indent.length]
}
}
}
return false;
});
// Check for open tag if user enters / and auto-close it.
this.add("slash", "insertion", function (state, action, editor, session, text) {
if (text == "/") {
var cursor = editor.getCursorPosition();
var line = session.doc.getLine(cursor.row);
if (cursor.column > 0 && line.charAt(cursor.column - 1) == "<") {
line = line.substring(0, cursor.column) + "/" + line.substring(cursor.column);
var lines = session.doc.getAllLines();
lines[cursor.row] = line;
// call mode helper to close the tag if possible
parent.exec("closeTag", lines.join(session.doc.getNewLineCharacter()), cursor.row);
}
}
return false;
});
}
oop.inherits(XQueryBehaviour, Behaviour);
exports.XQueryBehaviour = XQueryBehaviour;
});
/* vim:ts=4:sts=4:sw=4:
* ***** 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):
* Chris Spencer <chris.ag.spencer AT googlemail DOT com>
*
* 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/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour'], function(require, exports, module) {
"use strict";
var oop = require("../../lib/oop");
var Behaviour = require('../behaviour').Behaviour;
var CstyleBehaviour = function () {
this.add("braces", "insertion", function (state, action, editor, session, text) {
if (text == '{') {
var selection = editor.getSelectionRange();
var selected = session.doc.getTextRange(selection);
if (selected !== "") {
return {
text: '{' + selected + '}',
selection: false
};
} else {
return {
text: '{}',
selection: [1, 1]
};
}
} else if (text == '}') {
var cursor = editor.getCursorPosition();
var line = session.doc.getLine(cursor.row);
var rightChar = line.substring(cursor.column, cursor.column + 1);
if (rightChar == '}') {
var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
if (matching !== null) {
return {
text: '',
selection: [1, 1]
};
}
}
} else if (text == "\n") {
var cursor = editor.getCursorPosition();
var line = session.doc.getLine(cursor.row);
var rightChar = line.substring(cursor.column, cursor.column + 1);
if (rightChar == '}') {
var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column + 1});
if (!openBracePos)
return null;
var indent = this.getNextLineIndent(state, line.substring(0, line.length - 1), session.getTabString());
var next_indent = this.$getIndent(session.doc.getLine(openBracePos.row));
return {
text: '\n' + indent + '\n' + next_indent,
selection: [1, indent.length, 1, indent.length]
};
}
}
});
this.add("braces", "deletion", function (state, action, editor, session, range) {
var selected = session.doc.getTextRange(range);
if (!range.isMultiLine() && selected == '{') {
var line = session.doc.getLine(range.start.row);
var rightChar = line.substring(range.end.column, range.end.column + 1);
if (rightChar == '}') {
range.end.column++;
return range;
}
}
});
this.add("parens", "insertion", function (state, action, editor, session, text) {
if (text == '(') {
var selection = editor.getSelectionRange();
var selected = session.doc.getTextRange(selection);
if (selected !== "") {
return {
text: '(' + selected + ')',
selection: false
};
} else {
return {
text: '()',
selection: [1, 1]
};
}
} else if (text == ')') {
var cursor = editor.getCursorPosition();
var line = session.doc.getLine(cursor.row);
var rightChar = line.substring(cursor.column, cursor.column + 1);
if (rightChar == ')') {
var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
if (matching !== null) {
return {
text: '',
selection: [1, 1]
};
}
}
}
});
this.add("parens", "deletion", function (state, action, editor, session, range) {
var selected = session.doc.getTextRange(range);
if (!range.isMultiLine() && selected == '(') {
var line = session.doc.getLine(range.start.row);
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
if (rightChar == ')') {
range.end.column++;
return range;
}
}
});
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
if (text == '"' || text == "'") {
var quote = text;
var selection = editor.getSelectionRange();
var selected = session.doc.getTextRange(selection);
if (selected !== "") {
return {
text: quote + selected + quote,
selection: false
};
} else {
var cursor = editor.getCursorPosition();
var line = session.doc.getLine(cursor.row);
var leftChar = line.substring(cursor.column-1, cursor.column);
// We're escaped.
if (leftChar == '\\') {
return null;
}
// Find what token we're inside.
var tokens = session.getTokens(selection.start.row, selection.start.row)[0].tokens;
var col = 0, token;
var quotepos = -1; // Track whether we're inside an open quote.
for (var x = 0; x < tokens.length; x++) {
token = tokens[x];
if (token.type == "string") {
quotepos = -1;
} else if (quotepos < 0) {
quotepos = token.value.indexOf(quote);
}
if ((token.value.length + col) > selection.start.column) {
break;
}
col += tokens[x].value.length;
}
// 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(quote) === token.value.length-1)))) {
return {
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 == quote) {
return {
text: '',
selection: [1, 1]
};
}
}
}
}
});
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
var selected = session.doc.getTextRange(range);
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 == '"') {
range.end.column++;
return range;
}
}
});
};
oop.inherits(CstyleBehaviour, Behaviour);
exports.CstyleBehaviour = CstyleBehaviour;
});

File diff suppressed because one or more lines are too long

View File

@ -35,7 +35,7 @@
*
* ***** END LICENSE BLOCK ***** */
define('ace/theme/clouds', ['require', 'exports', 'module' ], function(require, exports, module) {
define('ace/theme/clouds', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
exports.isDark = false;
exports.cssClass = "ace-clouds";
@ -68,14 +68,14 @@ exports.cssText = "\
}\
\
.ace-clouds .ace_cursor {\
border-left: 2px solid #000000;\
border-left: 1px solid #000000;\
}\
\
.ace-clouds .ace_cursor.ace_overwrite {\
border-left: 0px;\
border-bottom: 1px solid #000000;\
}\
\
\
.ace-clouds .ace_marker-layer .ace_selection {\
background: #BDD5FC;\
}\
@ -96,12 +96,12 @@ exports.cssText = "\
.ace-clouds .ace_marker-layer .ace_selected_word {\
border: 1px solid #BDD5FC;\
}\
\
\
.ace-clouds .ace_invisible {\
color: #BFBFBF;\
}\
\
.ace-clouds .ace_keyword {\
.ace-clouds .ace_keyword, .ace-clouds .ace_meta {\
color:#AF956F;\
}\
\
@ -130,6 +130,10 @@ exports.cssText = "\
color:#C52727;\
}\
\
.ace-clouds .ace_storage {\
color:#C52727;\
}\
\
.ace-clouds .ace_string {\
color:#5D90CD;\
}\
@ -146,17 +150,6 @@ exports.cssText = "\
text-decoration:underline;\
}";
var dom = require("../lib/dom");
dom.importCssString(exports.cssText, exports.cssClass);
var dom = require("../lib/dom");
dom.importCssString(exports.cssText, exports.cssClass);
});
;
(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];
});
})();

View File

@ -1 +1 @@
define("ace/theme/clouds",["require","exports","module"],function(a,b,c){b.isDark=!1,b.cssClass="ace-clouds",b.cssText=".ace-clouds .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-clouds .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-clouds .ace_gutter { background: #e8e8e8; color: #333;}.ace-clouds .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-clouds .ace_scroller { background-color: #FFFFFF;}.ace-clouds .ace_text-layer { cursor: text; color: #000000;}.ace-clouds .ace_cursor { border-left: 2px solid #000000;}.ace-clouds .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #000000;} .ace-clouds .ace_marker-layer .ace_selection { background: #BDD5FC;}.ace-clouds .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-clouds .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid #BFBFBF;}.ace-clouds .ace_marker-layer .ace_active_line { background: #FFFBD1;}.ace-clouds .ace_marker-layer .ace_selected_word { border: 1px solid #BDD5FC;} .ace-clouds .ace_invisible { color: #BFBFBF;}.ace-clouds .ace_keyword { color:#AF956F;}.ace-clouds .ace_keyword.ace_operator { color:#484848;}.ace-clouds .ace_constant.ace_language { color:#39946A;}.ace-clouds .ace_constant.ace_numeric { color:#46A609;}.ace-clouds .ace_invalid { background-color:#FF002A;}.ace-clouds .ace_fold { background-color: #AF956F; border-color: #000000;}.ace-clouds .ace_support.ace_function { color:#C52727;}.ace-clouds .ace_string { color:#5D90CD;}.ace-clouds .ace_comment { color:#BCC8BA;}.ace-clouds .ace_entity.ace_other.ace_attribute-name { color:#606060;}.ace-clouds .ace_markup.ace_underline { text-decoration:underline;}";var d=a("../lib/dom");d.importCssString(b.cssText,b.cssClass)}),function(){window.require(["ace/ace"],function(a){window.ace||(window.ace={});for(var b in a)a.hasOwnProperty(b)&&(ace[b]=a[b])})}()
define("ace/theme/clouds",["require","exports","module","ace/lib/dom"],function(a,b,c){b.isDark=!1,b.cssClass="ace-clouds",b.cssText=".ace-clouds .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-clouds .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-clouds .ace_gutter { background: #e8e8e8; color: #333;}.ace-clouds .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-clouds .ace_scroller { background-color: #FFFFFF;}.ace-clouds .ace_text-layer { cursor: text; color: #000000;}.ace-clouds .ace_cursor { border-left: 1px solid #000000;}.ace-clouds .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #000000;}.ace-clouds .ace_marker-layer .ace_selection { background: #BDD5FC;}.ace-clouds .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-clouds .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid #BFBFBF;}.ace-clouds .ace_marker-layer .ace_active_line { background: #FFFBD1;}.ace-clouds .ace_marker-layer .ace_selected_word { border: 1px solid #BDD5FC;}.ace-clouds .ace_invisible { color: #BFBFBF;}.ace-clouds .ace_keyword, .ace-clouds .ace_meta { color:#AF956F;}.ace-clouds .ace_keyword.ace_operator { color:#484848;}.ace-clouds .ace_constant.ace_language { color:#39946A;}.ace-clouds .ace_constant.ace_numeric { color:#46A609;}.ace-clouds .ace_invalid { background-color:#FF002A;}.ace-clouds .ace_fold { background-color: #AF956F; border-color: #000000;}.ace-clouds .ace_support.ace_function { color:#C52727;}.ace-clouds .ace_storage { color:#C52727;}.ace-clouds .ace_string { color:#5D90CD;}.ace-clouds .ace_comment { color:#BCC8BA;}.ace-clouds .ace_entity.ace_other.ace_attribute-name { color:#606060;}.ace-clouds .ace_markup.ace_underline { text-decoration:underline;}";var d=a("../lib/dom");d.importCssString(b.cssText,b.cssClass)})

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -29,6 +29,7 @@ function setSyntaxMode(ext){
filetype["jsm"] = "javascript";
filetype["json"] = "json";
filetype["latex"] = "latex";
filetype["less"] = "less";
filetype["ly"] = "latex";
filetype["ily"] = "latex";
filetype["lua"] = "lua";
@ -47,6 +48,7 @@ function setSyntaxMode(ext){
filetype["scad"] = "scad"; // seems to be something like 3d model files printed with e.g. reprap
filetype["scala"] = "scala";
filetype["scss"] = "scss"; // "sassy css"
filetype["sh"] = "sh";
filetype["sql"] = "sql";
filetype["svg"] = "svg";
filetype["textile"] = "textile"; // related to markdown