diff --git a/addons/editor/ace/ace.js b/addons/editor/ace/ace.js old mode 100644 new mode 100755 index 82e91fe3..773f2279 --- a/addons/editor/ace/ace.js +++ b/addons/editor/ace/ace.js @@ -28,149 +28,14 @@ * * ***** END LICENSE BLOCK ***** */ -(function() { - -var ACE_NAMESPACE = ""; - -var global = (function() { - return this; -})(); - - -if (!ACE_NAMESPACE && typeof requirejs !== "undefined") - return; - - -var _define = function(module, deps, payload) { - if (typeof module !== 'string') { - if (_define.original) - _define.original.apply(window, arguments); - else { - console.error('dropping module because define wasn\'t a string.'); - console.trace(); - } - return; - } - - if (arguments.length == 2) - payload = deps; - - if (!_define.modules) { - _define.modules = {}; - _define.payloads = {}; - } - - _define.payloads[module] = payload; - _define.modules[module] = null; -}; -var _require = function(parentId, module, callback) { - if (Object.prototype.toString.call(module) === "[object Array]") { - var params = []; - for (var i = 0, l = module.length; i < l; ++i) { - var dep = lookup(parentId, module[i]); - if (!dep && _require.original) - return _require.original.apply(window, arguments); - params.push(dep); - } - if (callback) { - callback.apply(null, params); - } - } - else if (typeof module === 'string') { - var payload = lookup(parentId, module); - if (!payload && _require.original) - return _require.original.apply(window, arguments); - - if (callback) { - callback(); - } - - return payload; - } - else { - if (_require.original) - return _require.original.apply(window, arguments); - } -}; - -var normalizeModule = function(parentId, moduleName) { - if (moduleName.indexOf("!") !== -1) { - var chunks = moduleName.split("!"); - return normalizeModule(parentId, chunks[0]) + "!" + normalizeModule(parentId, chunks[1]); - } - if (moduleName.charAt(0) == ".") { - var base = parentId.split("/").slice(0, -1).join("/"); - moduleName = base + "/" + moduleName; - - while(moduleName.indexOf(".") !== -1 && previous != moduleName) { - var previous = moduleName; - moduleName = moduleName.replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, ""); - } - } - - return moduleName; -}; -var lookup = function(parentId, moduleName) { - - moduleName = normalizeModule(parentId, moduleName); - - var module = _define.modules[moduleName]; - if (!module) { - module = _define.payloads[moduleName]; - if (typeof module === 'function') { - var exports = {}; - var mod = { - id: moduleName, - uri: '', - exports: exports, - packaged: true - }; - - var req = function(module, callback) { - return _require(moduleName, module, callback); - }; - - var returnValue = module(req, exports, mod); - exports = returnValue || mod.exports; - _define.modules[moduleName] = exports; - delete _define.payloads[moduleName]; - } - module = _define.modules[moduleName] = exports || module; - } - return module; -}; - -function exportAce(ns) { - var require = function(module, callback) { - return _require("", module, callback); - }; - - var root = global; - if (ns) { - if (!global[ns]) - global[ns] = {}; - root = global[ns]; - } - - if (!root.define || !root.define.packaged) { - _define.original = root.define; - root.define = _define; - root.define.packaged = true; - } - - if (!root.require || !root.require.packaged) { - _require.original = root.require; - root.require = require; - root.require.packaged = true; - } -} - -exportAce(ACE_NAMESPACE); - -})(); - -define('ace/ace', ['require', 'exports', 'module' , 'ace/lib/fixoldbrowsers', 'ace/lib/dom', 'ace/lib/event', 'ace/editor', 'ace/edit_session', 'ace/undomanager', 'ace/virtual_renderer', 'ace/multi_select', 'ace/worker/worker_client', 'ace/keyboard/hash_handler', 'ace/placeholder', 'ace/mode/folding/fold_mode', 'ace/theme/textmate', 'ace/config'], function(require, exports, module) { +/** + * The main class required to set up an Ace instance in the browser. + * + * @class Ace + **/ +define(function(require, exports, module) { +"use strict"; require("./lib/fixoldbrowsers"); @@ -182,6 +47,8 @@ var EditSession = require("./edit_session").EditSession; var UndoManager = require("./undomanager").UndoManager; var Renderer = require("./virtual_renderer").VirtualRenderer; var MultiSelect = require("./multi_select").MultiSelect; + +// The following require()s are for inclusion in the built ace file require("./worker/worker_client"); require("./keyboard/hash_handler"); require("./placeholder"); @@ -189,7 +56,20 @@ require("./mode/folding/fold_mode"); require("./theme/textmate"); exports.config = require("./config"); + +/** + * Provides access to require in packed noconflict mode + * @param {String} moduleName + * @returns {Object} + * + **/ exports.require = require; + +/** + * Embeds the Ace editor into the DOM, at the element provided by `el`. + * @param {String | DOMElement} el Either the id of an element, or the element itself + * + **/ exports.edit = function(el) { if (typeof(el) == "string") { var _id = el; @@ -220,6 +100,13 @@ exports.edit = function(el) { el.env = editor.env = env; return editor; }; + +/** + * Creates a new [[EditSession]], and returns the associated [[Document]]. + * @param {Document | String} text {:textParam} + * @param {TextMode} mode {:modeParam} + * + **/ exports.createEditSession = function(text, mode) { var doc = new EditSession(text, mode); doc.setUndoManager(new UndoManager()); @@ -228,16307 +115,3 @@ exports.createEditSession = function(text, mode) { exports.EditSession = EditSession; exports.UndoManager = UndoManager; }); - -define('ace/lib/fixoldbrowsers', ['require', 'exports', 'module' , 'ace/lib/regexp', 'ace/lib/es5-shim'], function(require, exports, module) { - - -require("./regexp"); -require("./es5-shim"); - -}); - -define('ace/lib/regexp', ['require', 'exports', 'module' ], function(require, exports, module) { - - var real = { - exec: RegExp.prototype.exec, - test: RegExp.prototype.test, - match: String.prototype.match, - replace: String.prototype.replace, - split: String.prototype.split - }, - compliantExecNpcg = real.exec.call(/()??/, "")[1] === undefined, // check `exec` handling of nonparticipating capturing groups - compliantLastIndexIncrement = function () { - var x = /^/g; - real.test.call(x, ""); - return !x.lastIndex; - }(); - - if (compliantLastIndexIncrement && compliantExecNpcg) - return; - RegExp.prototype.exec = function (str) { - var match = real.exec.apply(this, arguments), - name, r2; - if ( typeof(str) == 'string' && match) { - if (!compliantExecNpcg && match.length > 1 && indexOf(match, "") > -1) { - r2 = RegExp(this.source, real.replace.call(getNativeFlags(this), "g", "")); - real.replace.call(str.slice(match.index), r2, function () { - for (var i = 1; i < arguments.length - 2; i++) { - if (arguments[i] === undefined) - match[i] = undefined; - } - }); - } - if (this._xregexp && this._xregexp.captureNames) { - for (var i = 1; i < match.length; i++) { - name = this._xregexp.captureNames[i - 1]; - if (name) - match[name] = match[i]; - } - } - if (!compliantLastIndexIncrement && this.global && !match[0].length && (this.lastIndex > match.index)) - this.lastIndex--; - } - return match; - }; - if (!compliantLastIndexIncrement) { - RegExp.prototype.test = function (str) { - var match = real.exec.call(this, str); - if (match && this.global && !match[0].length && (this.lastIndex > match.index)) - this.lastIndex--; - return !!match; - }; - } - - function getNativeFlags (regex) { - return (regex.global ? "g" : "") + - (regex.ignoreCase ? "i" : "") + - (regex.multiline ? "m" : "") + - (regex.extended ? "x" : "") + // Proposed for ES4; included in AS3 - (regex.sticky ? "y" : ""); - } - - function indexOf (array, item, from) { - if (Array.prototype.indexOf) // Use the native array method if available - return array.indexOf(item, from); - for (var i = from || 0; i < array.length; i++) { - if (array[i] === item) - return i; - } - return -1; - } - -}); - -define('ace/lib/es5-shim', ['require', 'exports', 'module' ], function(require, exports, module) { - -function Empty() {} - -if (!Function.prototype.bind) { - Function.prototype.bind = function bind(that) { // .length is 1 - var target = this; - if (typeof target != "function") { - throw new TypeError("Function.prototype.bind called on incompatible " + target); - } - var args = slice.call(arguments, 1); // for normal call - var bound = function () { - - if (this instanceof bound) { - - var result = target.apply( - this, - args.concat(slice.call(arguments)) - ); - if (Object(result) === result) { - return result; - } - return this; - - } else { - return target.apply( - that, - args.concat(slice.call(arguments)) - ); - - } - - }; - if(target.prototype) { - Empty.prototype = target.prototype; - bound.prototype = new Empty(); - Empty.prototype = null; - } - return bound; - }; -} -var call = Function.prototype.call; -var prototypeOfArray = Array.prototype; -var prototypeOfObject = Object.prototype; -var slice = prototypeOfArray.slice; -var _toString = call.bind(prototypeOfObject.toString); -var owns = call.bind(prototypeOfObject.hasOwnProperty); -var defineGetter; -var defineSetter; -var lookupGetter; -var lookupSetter; -var supportsAccessors; -if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) { - defineGetter = call.bind(prototypeOfObject.__defineGetter__); - defineSetter = call.bind(prototypeOfObject.__defineSetter__); - lookupGetter = call.bind(prototypeOfObject.__lookupGetter__); - lookupSetter = call.bind(prototypeOfObject.__lookupSetter__); -} -if ([1,2].splice(0).length != 2) { - if(function() { // test IE < 9 to splice bug - see issue #138 - function makeArray(l) { - var a = new Array(l+2); - a[0] = a[1] = 0; - return a; - } - var array = [], lengthBefore; - - array.splice.apply(array, makeArray(20)); - array.splice.apply(array, makeArray(26)); - - lengthBefore = array.length; //46 - array.splice(5, 0, "XXX"); // add one element - - lengthBefore + 1 == array.length - - if (lengthBefore + 1 == array.length) { - return true;// has right splice implementation without bugs - } - }()) {//IE 6/7 - var array_splice = Array.prototype.splice; - Array.prototype.splice = function(start, deleteCount) { - if (!arguments.length) { - return []; - } else { - return array_splice.apply(this, [ - start === void 0 ? 0 : start, - deleteCount === void 0 ? (this.length - start) : deleteCount - ].concat(slice.call(arguments, 2))) - } - }; - } else {//IE8 - Array.prototype.splice = function(pos, removeCount){ - var length = this.length; - if (pos > 0) { - if (pos > length) - pos = length; - } else if (pos == void 0) { - pos = 0; - } else if (pos < 0) { - pos = Math.max(length + pos, 0); - } - - if (!(pos+removeCount < length)) - removeCount = length - pos; - - var removed = this.slice(pos, pos+removeCount); - var insert = slice.call(arguments, 2); - var add = insert.length; - if (pos === length) { - if (add) { - this.push.apply(this, insert); - } - } else { - var remove = Math.min(removeCount, length - pos); - var tailOldPos = pos + remove; - var tailNewPos = tailOldPos + add - remove; - var tailCount = length - tailOldPos; - var lengthAfterRemove = length - remove; - - if (tailNewPos < tailOldPos) { // case A - for (var i = 0; i < tailCount; ++i) { - this[tailNewPos+i] = this[tailOldPos+i]; - } - } else if (tailNewPos > tailOldPos) { // case B - for (i = tailCount; i--; ) { - this[tailNewPos+i] = this[tailOldPos+i]; - } - } // else, add == remove (nothing to do) - - if (add && pos === lengthAfterRemove) { - this.length = lengthAfterRemove; // truncate array - this.push.apply(this, insert); - } else { - this.length = lengthAfterRemove + add; // reserves space - for (i = 0; i < add; ++i) { - this[pos+i] = insert[i]; - } - } - } - return removed; - }; - } -} -if (!Array.isArray) { - Array.isArray = function isArray(obj) { - return _toString(obj) == "[object Array]"; - }; -} -var boxedString = Object("a"), - splitString = boxedString[0] != "a" || !(0 in boxedString); - -if (!Array.prototype.forEach) { - Array.prototype.forEach = function forEach(fun /*, thisp*/) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - thisp = arguments[1], - i = -1, - length = self.length >>> 0; - if (_toString(fun) != "[object Function]") { - throw new TypeError(); // TODO message - } - - while (++i < length) { - if (i in self) { - fun.call(thisp, self[i], i, object); - } - } - }; -} -if (!Array.prototype.map) { - Array.prototype.map = function map(fun /*, thisp*/) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0, - result = Array(length), - thisp = arguments[1]; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - - for (var i = 0; i < length; i++) { - if (i in self) - result[i] = fun.call(thisp, self[i], i, object); - } - return result; - }; -} -if (!Array.prototype.filter) { - Array.prototype.filter = function filter(fun /*, thisp */) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0, - result = [], - value, - thisp = arguments[1]; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - - for (var i = 0; i < length; i++) { - if (i in self) { - value = self[i]; - if (fun.call(thisp, value, i, object)) { - result.push(value); - } - } - } - return result; - }; -} -if (!Array.prototype.every) { - Array.prototype.every = function every(fun /*, thisp */) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0, - thisp = arguments[1]; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - - for (var i = 0; i < length; i++) { - if (i in self && !fun.call(thisp, self[i], i, object)) { - return false; - } - } - return true; - }; -} -if (!Array.prototype.some) { - Array.prototype.some = function some(fun /*, thisp */) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0, - thisp = arguments[1]; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - - for (var i = 0; i < length; i++) { - if (i in self && fun.call(thisp, self[i], i, object)) { - return true; - } - } - return false; - }; -} -if (!Array.prototype.reduce) { - Array.prototype.reduce = function reduce(fun /*, initial*/) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - if (!length && arguments.length == 1) { - throw new TypeError("reduce of empty array with no initial value"); - } - - var i = 0; - var result; - if (arguments.length >= 2) { - result = arguments[1]; - } else { - do { - if (i in self) { - result = self[i++]; - break; - } - if (++i >= length) { - throw new TypeError("reduce of empty array with no initial value"); - } - } while (true); - } - - for (; i < length; i++) { - if (i in self) { - result = fun.call(void 0, result, self[i], i, object); - } - } - - return result; - }; -} -if (!Array.prototype.reduceRight) { - Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - if (!length && arguments.length == 1) { - throw new TypeError("reduceRight of empty array with no initial value"); - } - - var result, i = length - 1; - if (arguments.length >= 2) { - result = arguments[1]; - } else { - do { - if (i in self) { - result = self[i--]; - break; - } - if (--i < 0) { - throw new TypeError("reduceRight of empty array with no initial value"); - } - } while (true); - } - - do { - if (i in this) { - result = fun.call(void 0, result, self[i], i, object); - } - } while (i--); - - return result; - }; -} -if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) { - Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) { - var self = splitString && _toString(this) == "[object String]" ? - this.split("") : - toObject(this), - length = self.length >>> 0; - - if (!length) { - return -1; - } - - var i = 0; - if (arguments.length > 1) { - i = toInteger(arguments[1]); - } - i = i >= 0 ? i : Math.max(0, length + i); - for (; i < length; i++) { - if (i in self && self[i] === sought) { - return i; - } - } - return -1; - }; -} -if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) { - Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) { - var self = splitString && _toString(this) == "[object String]" ? - this.split("") : - toObject(this), - length = self.length >>> 0; - - if (!length) { - return -1; - } - var i = length - 1; - if (arguments.length > 1) { - i = Math.min(i, toInteger(arguments[1])); - } - i = i >= 0 ? i : length - Math.abs(i); - for (; i >= 0; i--) { - if (i in self && sought === self[i]) { - return i; - } - } - return -1; - }; -} -if (!Object.getPrototypeOf) { - Object.getPrototypeOf = function getPrototypeOf(object) { - return object.__proto__ || ( - object.constructor ? - object.constructor.prototype : - prototypeOfObject - ); - }; -} -if (!Object.getOwnPropertyDescriptor) { - var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " + - "non-object: "; - Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) { - if ((typeof object != "object" && typeof object != "function") || object === null) - throw new TypeError(ERR_NON_OBJECT + object); - if (!owns(object, property)) - return; - - var descriptor, getter, setter; - descriptor = { enumerable: true, configurable: true }; - if (supportsAccessors) { - var prototype = object.__proto__; - object.__proto__ = prototypeOfObject; - - var getter = lookupGetter(object, property); - var setter = lookupSetter(object, property); - object.__proto__ = prototype; - - if (getter || setter) { - if (getter) descriptor.get = getter; - if (setter) descriptor.set = setter; - return descriptor; - } - } - descriptor.value = object[property]; - return descriptor; - }; -} -if (!Object.getOwnPropertyNames) { - Object.getOwnPropertyNames = function getOwnPropertyNames(object) { - return Object.keys(object); - }; -} -if (!Object.create) { - var createEmpty; - if (Object.prototype.__proto__ === null) { - createEmpty = function () { - return { "__proto__": null }; - }; - } else { - createEmpty = function () { - var empty = {}; - for (var i in empty) - empty[i] = null; - empty.constructor = - empty.hasOwnProperty = - empty.propertyIsEnumerable = - empty.isPrototypeOf = - empty.toLocaleString = - empty.toString = - empty.valueOf = - empty.__proto__ = null; - return empty; - } - } - - Object.create = function create(prototype, properties) { - var object; - if (prototype === null) { - object = createEmpty(); - } else { - if (typeof prototype != "object") - throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'"); - var Type = function () {}; - Type.prototype = prototype; - object = new Type(); - object.__proto__ = prototype; - } - if (properties !== void 0) - Object.defineProperties(object, properties); - return object; - }; -} - -function doesDefinePropertyWork(object) { - try { - Object.defineProperty(object, "sentinel", {}); - return "sentinel" in object; - } catch (exception) { - } -} -if (Object.defineProperty) { - var definePropertyWorksOnObject = doesDefinePropertyWork({}); - var definePropertyWorksOnDom = typeof document == "undefined" || - doesDefinePropertyWork(document.createElement("div")); - if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) { - var definePropertyFallback = Object.defineProperty; - } -} - -if (!Object.defineProperty || definePropertyFallback) { - var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: "; - var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: " - var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " + - "on this javascript engine"; - - Object.defineProperty = function defineProperty(object, property, descriptor) { - if ((typeof object != "object" && typeof object != "function") || object === null) - throw new TypeError(ERR_NON_OBJECT_TARGET + object); - if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null) - throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor); - if (definePropertyFallback) { - try { - return definePropertyFallback.call(Object, object, property, descriptor); - } catch (exception) { - } - } - if (owns(descriptor, "value")) { - - if (supportsAccessors && (lookupGetter(object, property) || - lookupSetter(object, property))) - { - var prototype = object.__proto__; - object.__proto__ = prototypeOfObject; - delete object[property]; - object[property] = descriptor.value; - object.__proto__ = prototype; - } else { - object[property] = descriptor.value; - } - } else { - if (!supportsAccessors) - throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED); - if (owns(descriptor, "get")) - defineGetter(object, property, descriptor.get); - if (owns(descriptor, "set")) - defineSetter(object, property, descriptor.set); - } - - return object; - }; -} -if (!Object.defineProperties) { - Object.defineProperties = function defineProperties(object, properties) { - for (var property in properties) { - if (owns(properties, property)) - Object.defineProperty(object, property, properties[property]); - } - return object; - }; -} -if (!Object.seal) { - Object.seal = function seal(object) { - return object; - }; -} -if (!Object.freeze) { - Object.freeze = function freeze(object) { - return object; - }; -} -try { - Object.freeze(function () {}); -} catch (exception) { - Object.freeze = (function freeze(freezeObject) { - return function freeze(object) { - if (typeof object == "function") { - return object; - } else { - return freezeObject(object); - } - }; - })(Object.freeze); -} -if (!Object.preventExtensions) { - Object.preventExtensions = function preventExtensions(object) { - return object; - }; -} -if (!Object.isSealed) { - Object.isSealed = function isSealed(object) { - return false; - }; -} -if (!Object.isFrozen) { - Object.isFrozen = function isFrozen(object) { - return false; - }; -} -if (!Object.isExtensible) { - Object.isExtensible = function isExtensible(object) { - if (Object(object) === object) { - throw new TypeError(); // TODO message - } - var name = ''; - while (owns(object, name)) { - name += '?'; - } - object[name] = true; - var returnValue = owns(object, name); - delete object[name]; - return returnValue; - }; -} -if (!Object.keys) { - var hasDontEnumBug = true, - dontEnums = [ - "toString", - "toLocaleString", - "valueOf", - "hasOwnProperty", - "isPrototypeOf", - "propertyIsEnumerable", - "constructor" - ], - dontEnumsLength = dontEnums.length; - - for (var key in {"toString": null}) { - hasDontEnumBug = false; - } - - Object.keys = function keys(object) { - - if ( - (typeof object != "object" && typeof object != "function") || - object === null - ) { - throw new TypeError("Object.keys called on a non-object"); - } - - var keys = []; - for (var name in object) { - if (owns(object, name)) { - keys.push(name); - } - } - - if (hasDontEnumBug) { - for (var i = 0, ii = dontEnumsLength; i < ii; i++) { - var dontEnum = dontEnums[i]; - if (owns(object, dontEnum)) { - keys.push(dontEnum); - } - } - } - return keys; - }; - -} -if (!Date.now) { - Date.now = function now() { - return new Date().getTime(); - }; -} -var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" + - "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" + - "\u2029\uFEFF"; -if (!String.prototype.trim || ws.trim()) { - ws = "[" + ws + "]"; - var trimBeginRegexp = new RegExp("^" + ws + ws + "*"), - trimEndRegexp = new RegExp(ws + ws + "*$"); - String.prototype.trim = function trim() { - return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, ""); - }; -} - -function toInteger(n) { - n = +n; - if (n !== n) { // isNaN - n = 0; - } else if (n !== 0 && n !== (1/0) && n !== -(1/0)) { - n = (n > 0 || -1) * Math.floor(Math.abs(n)); - } - return n; -} - -function isPrimitive(input) { - var type = typeof input; - return ( - input === null || - type === "undefined" || - type === "boolean" || - type === "number" || - type === "string" - ); -} - -function toPrimitive(input) { - var val, valueOf, toString; - if (isPrimitive(input)) { - return input; - } - valueOf = input.valueOf; - if (typeof valueOf === "function") { - val = valueOf.call(input); - if (isPrimitive(val)) { - return val; - } - } - toString = input.toString; - if (typeof toString === "function") { - val = toString.call(input); - if (isPrimitive(val)) { - return val; - } - } - throw new TypeError(); -} -var toObject = function (o) { - if (o == null) { // this matches both null and undefined - throw new TypeError("can't convert "+o+" to object"); - } - return Object(o); -}; - -}); - -define('ace/lib/dom', ['require', 'exports', 'module' ], function(require, exports, module) { - - -if (typeof document == "undefined") - return; - -var XHTML_NS = "http://www.w3.org/1999/xhtml"; - -exports.getDocumentHead = function(doc) { - if (!doc) - doc = document; - return doc.head || doc.getElementsByTagName("head")[0] || doc.documentElement; -} - -exports.createElement = function(tag, ns) { - return document.createElementNS ? - document.createElementNS(ns || XHTML_NS, tag) : - document.createElement(tag); -}; - -exports.hasCssClass = function(el, name) { - var classes = el.className.split(/\s+/g); - return classes.indexOf(name) !== -1; -}; -exports.addCssClass = function(el, name) { - if (!exports.hasCssClass(el, name)) { - el.className += " " + name; - } -}; -exports.removeCssClass = function(el, name) { - var classes = el.className.split(/\s+/g); - while (true) { - var index = classes.indexOf(name); - if (index == -1) { - break; - } - classes.splice(index, 1); - } - el.className = classes.join(" "); -}; - -exports.toggleCssClass = function(el, name) { - var classes = el.className.split(/\s+/g), add = true; - while (true) { - var index = classes.indexOf(name); - if (index == -1) { - break; - } - add = false; - classes.splice(index, 1); - } - if(add) - classes.push(name); - - el.className = classes.join(" "); - return add; -}; -exports.setCssClass = function(node, className, include) { - if (include) { - exports.addCssClass(node, className); - } else { - exports.removeCssClass(node, className); - } -}; - -exports.hasCssString = function(id, doc) { - var index = 0, sheets; - doc = doc || document; - - if (doc.createStyleSheet && (sheets = doc.styleSheets)) { - while (index < sheets.length) - if (sheets[index++].owningElement.id === id) return true; - } else if ((sheets = doc.getElementsByTagName("style"))) { - while (index < sheets.length) - if (sheets[index++].id === id) return true; - } - - return false; -}; - -exports.importCssString = function importCssString(cssText, id, doc) { - doc = doc || document; - if (id && exports.hasCssString(id, doc)) - return null; - - var style; - - if (doc.createStyleSheet) { - style = doc.createStyleSheet(); - style.cssText = cssText; - if (id) - style.owningElement.id = id; - } else { - style = doc.createElementNS - ? doc.createElementNS(XHTML_NS, "style") - : doc.createElement("style"); - - style.appendChild(doc.createTextNode(cssText)); - if (id) - style.id = id; - - exports.getDocumentHead(doc).appendChild(style); - } -}; - -exports.importCssStylsheet = function(uri, doc) { - if (doc.createStyleSheet) { - doc.createStyleSheet(uri); - } else { - var link = exports.createElement('link'); - link.rel = 'stylesheet'; - link.href = uri; - - exports.getDocumentHead(doc).appendChild(link); - } -}; - -exports.getInnerWidth = function(element) { - return ( - parseInt(exports.computedStyle(element, "paddingLeft"), 10) + - parseInt(exports.computedStyle(element, "paddingRight"), 10) + - element.clientWidth - ); -}; - -exports.getInnerHeight = function(element) { - return ( - parseInt(exports.computedStyle(element, "paddingTop"), 10) + - parseInt(exports.computedStyle(element, "paddingBottom"), 10) + - element.clientHeight - ); -}; - -if (window.pageYOffset !== undefined) { - exports.getPageScrollTop = function() { - return window.pageYOffset; - }; - - exports.getPageScrollLeft = function() { - return window.pageXOffset; - }; -} -else { - exports.getPageScrollTop = function() { - return document.body.scrollTop; - }; - - exports.getPageScrollLeft = function() { - return document.body.scrollLeft; - }; -} - -if (window.getComputedStyle) - exports.computedStyle = function(element, style) { - if (style) - return (window.getComputedStyle(element, "") || {})[style] || ""; - return window.getComputedStyle(element, "") || {}; - }; -else - exports.computedStyle = function(element, style) { - if (style) - return element.currentStyle[style]; - return element.currentStyle; - }; - -exports.scrollbarWidth = function(document) { - var inner = exports.createElement("ace_inner"); - inner.style.width = "100%"; - inner.style.minWidth = "0px"; - inner.style.height = "200px"; - inner.style.display = "block"; - - var outer = exports.createElement("ace_outer"); - var style = outer.style; - - style.position = "absolute"; - style.left = "-10000px"; - style.overflow = "hidden"; - style.width = "200px"; - style.minWidth = "0px"; - style.height = "150px"; - style.display = "block"; - - outer.appendChild(inner); - - var body = document.documentElement; - body.appendChild(outer); - - var noScrollbar = inner.offsetWidth; - - style.overflow = "scroll"; - var withScrollbar = inner.offsetWidth; - - if (noScrollbar == withScrollbar) { - withScrollbar = outer.clientWidth; - } - - body.removeChild(outer); - - return noScrollbar-withScrollbar; -}; -exports.setInnerHtml = function(el, innerHtml) { - var element = el.cloneNode(false);//document.createElement("div"); - element.innerHTML = innerHtml; - el.parentNode.replaceChild(element, el); - return element; -}; - -if ("textContent" in document.documentElement) { - exports.setInnerText = function(el, innerText) { - el.textContent = innerText; - }; - - exports.getInnerText = function(el) { - return el.textContent; - }; -} -else { - exports.setInnerText = function(el, innerText) { - el.innerText = innerText; - }; - - exports.getInnerText = function(el) { - return el.innerText; - }; -} - -exports.getParentWindow = function(document) { - return document.defaultView || document.parentWindow; -}; - -}); - -define('ace/lib/event', ['require', 'exports', 'module' , 'ace/lib/keys', 'ace/lib/useragent', 'ace/lib/dom'], function(require, exports, module) { - - -var keys = require("./keys"); -var useragent = require("./useragent"); -var dom = require("./dom"); - -exports.addListener = function(elem, type, callback) { - if (elem.addEventListener) { - return elem.addEventListener(type, callback, false); - } - if (elem.attachEvent) { - var wrapper = function() { - callback.call(elem, window.event); - }; - callback._wrapper = wrapper; - elem.attachEvent("on" + type, wrapper); - } -}; - -exports.removeListener = function(elem, type, callback) { - if (elem.removeEventListener) { - return elem.removeEventListener(type, callback, false); - } - if (elem.detachEvent) { - elem.detachEvent("on" + type, callback._wrapper || callback); - } -}; -exports.stopEvent = function(e) { - exports.stopPropagation(e); - exports.preventDefault(e); - return false; -}; - -exports.stopPropagation = function(e) { - if (e.stopPropagation) - e.stopPropagation(); - else - e.cancelBubble = true; -}; - -exports.preventDefault = function(e) { - if (e.preventDefault) - e.preventDefault(); - else - e.returnValue = false; -}; -exports.getButton = function(e) { - if (e.type == "dblclick") - return 0; - if (e.type == "contextmenu" || (e.ctrlKey && useragent.isMac)) - return 2; - if (e.preventDefault) { - return e.button; - } - else { - return {1:0, 2:2, 4:1}[e.button]; - } -}; - -exports.capture = function(el, eventHandler, releaseCaptureHandler) { - function onMouseUp(e) { - eventHandler && eventHandler(e); - releaseCaptureHandler && releaseCaptureHandler(e); - - exports.removeListener(document, "mousemove", eventHandler, true); - exports.removeListener(document, "mouseup", onMouseUp, true); - exports.removeListener(document, "dragstart", onMouseUp, true); - } - - exports.addListener(document, "mousemove", eventHandler, true); - exports.addListener(document, "mouseup", onMouseUp, true); - exports.addListener(document, "dragstart", onMouseUp, true); -}; - -exports.addMouseWheelListener = function(el, callback) { - if ("onmousewheel" in el) { - var factor = 8; - exports.addListener(el, "mousewheel", function(e) { - if (e.wheelDeltaX !== undefined) { - e.wheelX = -e.wheelDeltaX / factor; - e.wheelY = -e.wheelDeltaY / factor; - } else { - e.wheelX = 0; - e.wheelY = -e.wheelDelta / factor; - } - callback(e); - }); - } else if ("onwheel" in el) { - exports.addListener(el, "wheel", function(e) { - e.wheelX = (e.deltaX || 0) * 5; - e.wheelY = (e.deltaY || 0) * 5; - callback(e); - }); - } else { - exports.addListener(el, "DOMMouseScroll", function(e) { - if (e.axis && e.axis == e.HORIZONTAL_AXIS) { - e.wheelX = (e.detail || 0) * 5; - e.wheelY = 0; - } else { - e.wheelX = 0; - e.wheelY = (e.detail || 0) * 5; - } - callback(e); - }); - } -}; - -exports.addMultiMouseDownListener = function(el, timeouts, eventHandler, callbackName) { - var clicks = 0; - var startX, startY, timer; - var eventNames = { - 2: "dblclick", - 3: "tripleclick", - 4: "quadclick" - }; - - exports.addListener(el, "mousedown", function(e) { - if (exports.getButton(e) != 0) { - clicks = 0; - } else if (e.detail > 1) { - clicks++; - if (clicks > 4) - clicks = 1; - } else { - clicks = 1; - } - if (useragent.isIE) { - var isNewClick = Math.abs(e.clientX - startX) > 5 || Math.abs(e.clientY - startY) > 5; - if (isNewClick) { - clicks = 1; - } - if (clicks == 1) { - startX = e.clientX; - startY = e.clientY; - } - } - - eventHandler[callbackName]("mousedown", e); - - if (clicks > 4) - clicks = 0; - else if (clicks > 1) - return eventHandler[callbackName](eventNames[clicks], e); - }); - - if (useragent.isOldIE) { - exports.addListener(el, "dblclick", function(e) { - clicks = 2; - if (timer) - clearTimeout(timer); - timer = setTimeout(function() {timer = null}, timeouts[clicks - 1] || 600); - eventHandler[callbackName]("mousedown", e); - eventHandler[callbackName](eventNames[clicks], e); - }); - } -}; - -function normalizeCommandKeys(callback, e, keyCode) { - var hashId = 0; - if ((useragent.isOpera && !("KeyboardEvent" in window)) && useragent.isMac) { - hashId = 0 | (e.metaKey ? 1 : 0) | (e.altKey ? 2 : 0) - | (e.shiftKey ? 4 : 0) | (e.ctrlKey ? 8 : 0); - } else { - hashId = 0 | (e.ctrlKey ? 1 : 0) | (e.altKey ? 2 : 0) - | (e.shiftKey ? 4 : 0) | (e.metaKey ? 8 : 0); - } - - if (!useragent.isMac && pressedKeys) { - if (pressedKeys[91] || pressedKeys[92]) - hashId |= 8; - if (pressedKeys.altGr) { - if ((3 & hashId) != 3) - pressedKeys.altGr = 0 - else - return; - } - if (keyCode === 18 || keyCode === 17) { - var location = e.location || e.keyLocation; - if (keyCode === 17 && location === 1) { - ts = e.timeStamp; - } else if (keyCode === 18 && hashId === 3 && location === 2) { - var dt = -ts; - ts = e.timeStamp; - dt += ts; - if (dt < 3) - pressedKeys.altGr = true; - } - } - } - - if (keyCode in keys.MODIFIER_KEYS) { - switch (keys.MODIFIER_KEYS[keyCode]) { - case "Alt": - hashId = 2; - break; - case "Shift": - hashId = 4; - break; - case "Ctrl": - hashId = 1; - break; - default: - hashId = 8; - break; - } - keyCode = 0; - } - - if (hashId & 8 && (keyCode === 91 || keyCode === 93)) { - keyCode = 0; - } - - if (!hashId && keyCode === 13) { - if (e.location || e.keyLocation === 3) { - callback(e, hashId, -keyCode) - if (e.defaultPrevented) - return; - } - } - if (!hashId && !(keyCode in keys.FUNCTION_KEYS) && !(keyCode in keys.PRINTABLE_KEYS)) { - return false; - } - - - - return callback(e, hashId, keyCode); -} - -var pressedKeys = null; -var ts = 0; -exports.addCommandKeyListener = function(el, callback) { - var addListener = exports.addListener; - if (useragent.isOldGecko || (useragent.isOpera && !("KeyboardEvent" in window))) { - var lastKeyDownKeyCode = null; - addListener(el, "keydown", function(e) { - lastKeyDownKeyCode = e.keyCode; - }); - addListener(el, "keypress", function(e) { - return normalizeCommandKeys(callback, e, lastKeyDownKeyCode); - }); - } else { - var lastDefaultPrevented = null; - - addListener(el, "keydown", function(e) { - pressedKeys[e.keyCode] = true; - var result = normalizeCommandKeys(callback, e, e.keyCode); - lastDefaultPrevented = e.defaultPrevented; - return result; - }); - - addListener(el, "keypress", function(e) { - if (lastDefaultPrevented && (e.ctrlKey || e.altKey || e.shiftKey || e.metaKey)) { - exports.stopEvent(e); - lastDefaultPrevented = null; - } - }); - - addListener(el, "keyup", function(e) { - pressedKeys[e.keyCode] = null; - }); - - if (!pressedKeys) { - pressedKeys = Object.create(null); - addListener(window, "focus", function(e) { - pressedKeys = Object.create(null); - }); - } - } -}; - -if (window.postMessage && !useragent.isOldIE) { - var postMessageId = 1; - exports.nextTick = function(callback, win) { - win = win || window; - var messageName = "zero-timeout-message-" + postMessageId; - exports.addListener(win, "message", function listener(e) { - if (e.data == messageName) { - exports.stopPropagation(e); - exports.removeListener(win, "message", listener); - callback(); - } - }); - win.postMessage(messageName, "*"); - }; -} - - -exports.nextFrame = window.requestAnimationFrame || - window.mozRequestAnimationFrame || - window.webkitRequestAnimationFrame || - window.msRequestAnimationFrame || - window.oRequestAnimationFrame; - -if (exports.nextFrame) - exports.nextFrame = exports.nextFrame.bind(window); -else - exports.nextFrame = function(callback) { - setTimeout(callback, 17); - }; -}); - -define('ace/lib/keys', ['require', 'exports', 'module' , 'ace/lib/oop'], function(require, exports, module) { - - -var oop = require("./oop"); -var Keys = (function() { - var ret = { - MODIFIER_KEYS: { - 16: 'Shift', 17: 'Ctrl', 18: 'Alt', 224: 'Meta' - }, - - KEY_MODS: { - "ctrl": 1, "alt": 2, "option" : 2, - "shift": 4, "meta": 8, "command": 8, "cmd": 8 - }, - - FUNCTION_KEYS : { - 8 : "Backspace", - 9 : "Tab", - 13 : "Return", - 19 : "Pause", - 27 : "Esc", - 32 : "Space", - 33 : "PageUp", - 34 : "PageDown", - 35 : "End", - 36 : "Home", - 37 : "Left", - 38 : "Up", - 39 : "Right", - 40 : "Down", - 44 : "Print", - 45 : "Insert", - 46 : "Delete", - 96 : "Numpad0", - 97 : "Numpad1", - 98 : "Numpad2", - 99 : "Numpad3", - 100: "Numpad4", - 101: "Numpad5", - 102: "Numpad6", - 103: "Numpad7", - 104: "Numpad8", - 105: "Numpad9", - '-13': "NumpadEnter", - 112: "F1", - 113: "F2", - 114: "F3", - 115: "F4", - 116: "F5", - 117: "F6", - 118: "F7", - 119: "F8", - 120: "F9", - 121: "F10", - 122: "F11", - 123: "F12", - 144: "Numlock", - 145: "Scrolllock" - }, - - PRINTABLE_KEYS: { - 32: ' ', 48: '0', 49: '1', 50: '2', 51: '3', 52: '4', 53: '5', - 54: '6', 55: '7', 56: '8', 57: '9', 59: ';', 61: '=', 65: 'a', - 66: 'b', 67: 'c', 68: 'd', 69: 'e', 70: 'f', 71: 'g', 72: 'h', - 73: 'i', 74: 'j', 75: 'k', 76: 'l', 77: 'm', 78: 'n', 79: 'o', - 80: 'p', 81: 'q', 82: 'r', 83: 's', 84: 't', 85: 'u', 86: 'v', - 87: 'w', 88: 'x', 89: 'y', 90: 'z', 107: '+', 109: '-', 110: '.', - 188: ',', 190: '.', 191: '/', 192: '`', 219: '[', 220: '\\', - 221: ']', 222: '\'' - } - }; - for (var i in ret.FUNCTION_KEYS) { - var name = ret.FUNCTION_KEYS[i].toLowerCase(); - ret[name] = parseInt(i, 10); - } - oop.mixin(ret, ret.MODIFIER_KEYS); - oop.mixin(ret, ret.PRINTABLE_KEYS); - oop.mixin(ret, ret.FUNCTION_KEYS); - ret.enter = ret["return"]; - ret.escape = ret.esc; - ret.del = ret["delete"]; - ret[173] = '-'; - - return ret; -})(); -oop.mixin(exports, Keys); - -exports.keyCodeToString = function(keyCode) { - return (Keys[keyCode] || String.fromCharCode(keyCode)).toLowerCase(); -} - -}); - -define('ace/lib/oop', ['require', 'exports', 'module' ], function(require, exports, module) { - - -exports.inherits = (function() { - var tempCtor = function() {}; - return function(ctor, superCtor) { - tempCtor.prototype = superCtor.prototype; - ctor.super_ = superCtor.prototype; - ctor.prototype = new tempCtor(); - ctor.prototype.constructor = ctor; - }; -}()); - -exports.mixin = function(obj, mixin) { - for (var key in mixin) { - obj[key] = mixin[key]; - } - return obj; -}; - -exports.implement = function(proto, mixin) { - exports.mixin(proto, mixin); -}; - -}); - -define('ace/lib/useragent', ['require', 'exports', 'module' ], function(require, exports, module) { -exports.OS = { - LINUX: "LINUX", - MAC: "MAC", - WINDOWS: "WINDOWS" -}; -exports.getOS = function() { - if (exports.isMac) { - return exports.OS.MAC; - } else if (exports.isLinux) { - return exports.OS.LINUX; - } else { - return exports.OS.WINDOWS; - } -}; -if (typeof navigator != "object") - return; - -var os = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase(); -var ua = navigator.userAgent; -exports.isWin = (os == "win"); -exports.isMac = (os == "mac"); -exports.isLinux = (os == "linux"); -exports.isIE = - (navigator.appName == "Microsoft Internet Explorer" || navigator.appName.indexOf("MSAppHost") >= 0) - && parseFloat(navigator.userAgent.match(/MSIE ([0-9]+[\.0-9]+)/)[1]); - -exports.isOldIE = exports.isIE && exports.isIE < 9; -exports.isGecko = exports.isMozilla = window.controllers && window.navigator.product === "Gecko"; -exports.isOldGecko = exports.isGecko && parseInt((navigator.userAgent.match(/rv\:(\d+)/)||[])[1], 10) < 4; -exports.isOpera = window.opera && Object.prototype.toString.call(window.opera) == "[object Opera]"; -exports.isWebKit = parseFloat(ua.split("WebKit/")[1]) || undefined; - -exports.isChrome = parseFloat(ua.split(" Chrome/")[1]) || undefined; - -exports.isAIR = ua.indexOf("AdobeAIR") >= 0; - -exports.isIPad = ua.indexOf("iPad") >= 0; - -exports.isTouchPad = ua.indexOf("TouchPad") >= 0; - -}); - -define('ace/editor', ['require', 'exports', 'module' , 'ace/lib/fixoldbrowsers', 'ace/lib/oop', 'ace/lib/dom', 'ace/lib/lang', 'ace/lib/useragent', 'ace/keyboard/textinput', 'ace/mouse/mouse_handler', 'ace/mouse/fold_handler', 'ace/keyboard/keybinding', 'ace/edit_session', 'ace/search', 'ace/range', 'ace/lib/event_emitter', 'ace/commands/command_manager', 'ace/commands/default_commands', 'ace/config'], function(require, exports, module) { - - -require("./lib/fixoldbrowsers"); - -var oop = require("./lib/oop"); -var dom = require("./lib/dom"); -var lang = require("./lib/lang"); -var useragent = require("./lib/useragent"); -var TextInput = require("./keyboard/textinput").TextInput; -var MouseHandler = require("./mouse/mouse_handler").MouseHandler; -var FoldHandler = require("./mouse/fold_handler").FoldHandler; -var KeyBinding = require("./keyboard/keybinding").KeyBinding; -var EditSession = require("./edit_session").EditSession; -var Search = require("./search").Search; -var Range = require("./range").Range; -var EventEmitter = require("./lib/event_emitter").EventEmitter; -var CommandManager = require("./commands/command_manager").CommandManager; -var defaultCommands = require("./commands/default_commands").commands; -var config = require("./config"); -var Editor = function(renderer, session) { - var container = renderer.getContainerElement(); - this.container = container; - this.renderer = renderer; - - this.commands = new CommandManager(useragent.isMac ? "mac" : "win", defaultCommands); - this.textInput = new TextInput(renderer.getTextAreaContainer(), this); - this.renderer.textarea = this.textInput.getElement(); - this.keyBinding = new KeyBinding(this); - this.$mouseHandler = new MouseHandler(this); - new FoldHandler(this); - - this.$blockScrolling = 0; - this.$search = new Search().set({ - wrap: true - }); - - this.$historyTracker = this.$historyTracker.bind(this); - this.commands.on("exec", this.$historyTracker); - - this.$initOperationListeners(); - - this._$emitInputEvent = lang.delayedCall(function() { - this._signal("input", {}); - this.session.bgTokenizer && this.session.bgTokenizer.scheduleStart(); - }.bind(this)); - - this.on("change", function(_, _self) { - _self._$emitInputEvent.schedule(31); - }); - - this.setSession(session || new EditSession("")); - config.resetOptions(this); - config._emit("editor", this); -}; - -(function(){ - - oop.implement(this, EventEmitter); - - this.$initOperationListeners = function() { - function last(a) {return a[a.length - 1]}; - - this.selections = []; - this.commands.on("exec", function(e) { - this.startOperation(e); - - var command = e.command; - if (command.group == "fileJump") { - var prev = this.prevOp; - if (!prev || prev.command.group != "fileJump") { - this.lastFileJumpPos = last(this.selections) - } - } else { - this.lastFileJumpPos = null; - } - }.bind(this), true); - - this.commands.on("afterExec", function(e) { - var command = e.command; - - if (command.group == "fileJump") { - if (this.lastFileJumpPos && !this.curOp.selectionChanged) { - this.selection.fromJSON(this.lastFileJumpPos); - return - } - } - this.endOperation(e); - }.bind(this), true); - - this.$opResetTimer = lang.delayedCall(this.endOperation.bind(this)); - - this.on("change", function() { - this.curOp || this.startOperation(); - this.curOp.docChanged = true; - }.bind(this), true); - - this.on("changeSelection", function() { - this.curOp || this.startOperation(); - this.curOp.selectionChanged = true; - }.bind(this), true); - } - - this.curOp = null; - this.prevOp = {}; - this.startOperation = function(commadEvent) { - if (this.curOp) { - if (!commadEvent || this.curOp.command) - return; - this.prevOp = this.curOp; - } - if (!commadEvent) { - this.previousCommand = null; - commadEvent = {}; - } - - this.$opResetTimer.schedule(); - this.curOp = { - command: commadEvent.command || {}, - args: commadEvent.args - }; - - this.selections.push(this.selection.toJSON()); - }; - - this.endOperation = function() { - if (this.curOp) { - this.prevOp = this.curOp; - this.curOp = null; - } - }; - - this.$historyTracker = function(e) { - if (!this.$mergeUndoDeltas) - return; - - - var prev = this.prevOp; - var mergeableCommands = ["backspace", "del", "insertstring"]; - var shouldMerge = prev.command && (e.command.name == prev.command.name); - if (e.command.name == "insertstring") { - var text = e.args; - if (this.mergeNextCommand === undefined) - this.mergeNextCommand = true; - - shouldMerge = shouldMerge - && this.mergeNextCommand // previous command allows to coalesce with - && (!/\s/.test(text) || /\s/.test(prev.args)) // previous insertion was of same type - - this.mergeNextCommand = true; - } else { - shouldMerge = shouldMerge - && mergeableCommands.indexOf(e.command.name) !== -1// the command is mergeable - } - - if ( - this.$mergeUndoDeltas != "always" - && Date.now() - this.sequenceStartTime > 2000 - ) { - shouldMerge = false; // the sequence is too long - } - - if (shouldMerge) - this.session.mergeUndoDeltas = true; - else if (mergeableCommands.indexOf(e.command.name) !== -1) - this.sequenceStartTime = Date.now(); - }; - this.setKeyboardHandler = function(keyboardHandler) { - if (!keyboardHandler) { - this.keyBinding.setKeyboardHandler(null); - } else if (typeof keyboardHandler == "string") { - this.$keybindingId = keyboardHandler; - var _self = this; - config.loadModule(["keybinding", keyboardHandler], function(module) { - if (_self.$keybindingId == keyboardHandler) - _self.keyBinding.setKeyboardHandler(module && module.handler); - }); - } else { - this.$keybindingId = null; - this.keyBinding.setKeyboardHandler(keyboardHandler); - } - }; - this.getKeyboardHandler = function() { - return this.keyBinding.getKeyboardHandler(); - }; - this.setSession = function(session) { - if (this.session == session) - return; - - if (this.session) { - var oldSession = this.session; - this.session.removeEventListener("change", this.$onDocumentChange); - this.session.removeEventListener("changeMode", this.$onChangeMode); - this.session.removeEventListener("tokenizerUpdate", this.$onTokenizerUpdate); - this.session.removeEventListener("changeTabSize", this.$onChangeTabSize); - this.session.removeEventListener("changeWrapLimit", this.$onChangeWrapLimit); - this.session.removeEventListener("changeWrapMode", this.$onChangeWrapMode); - this.session.removeEventListener("onChangeFold", this.$onChangeFold); - this.session.removeEventListener("changeFrontMarker", this.$onChangeFrontMarker); - this.session.removeEventListener("changeBackMarker", this.$onChangeBackMarker); - this.session.removeEventListener("changeBreakpoint", this.$onChangeBreakpoint); - this.session.removeEventListener("changeAnnotation", this.$onChangeAnnotation); - this.session.removeEventListener("changeOverwrite", this.$onCursorChange); - this.session.removeEventListener("changeScrollTop", this.$onScrollTopChange); - this.session.removeEventListener("changeScrollLeft", this.$onScrollLeftChange); - - var selection = this.session.getSelection(); - selection.removeEventListener("changeCursor", this.$onCursorChange); - selection.removeEventListener("changeSelection", this.$onSelectionChange); - } - - this.session = session; - - this.$onDocumentChange = this.onDocumentChange.bind(this); - session.addEventListener("change", this.$onDocumentChange); - this.renderer.setSession(session); - - this.$onChangeMode = this.onChangeMode.bind(this); - session.addEventListener("changeMode", this.$onChangeMode); - - this.$onTokenizerUpdate = this.onTokenizerUpdate.bind(this); - session.addEventListener("tokenizerUpdate", this.$onTokenizerUpdate); - - this.$onChangeTabSize = this.renderer.onChangeTabSize.bind(this.renderer); - session.addEventListener("changeTabSize", this.$onChangeTabSize); - - this.$onChangeWrapLimit = this.onChangeWrapLimit.bind(this); - session.addEventListener("changeWrapLimit", this.$onChangeWrapLimit); - - this.$onChangeWrapMode = this.onChangeWrapMode.bind(this); - session.addEventListener("changeWrapMode", this.$onChangeWrapMode); - - this.$onChangeFold = this.onChangeFold.bind(this); - session.addEventListener("changeFold", this.$onChangeFold); - - this.$onChangeFrontMarker = this.onChangeFrontMarker.bind(this); - this.session.addEventListener("changeFrontMarker", this.$onChangeFrontMarker); - - this.$onChangeBackMarker = this.onChangeBackMarker.bind(this); - this.session.addEventListener("changeBackMarker", this.$onChangeBackMarker); - - this.$onChangeBreakpoint = this.onChangeBreakpoint.bind(this); - this.session.addEventListener("changeBreakpoint", this.$onChangeBreakpoint); - - this.$onChangeAnnotation = this.onChangeAnnotation.bind(this); - this.session.addEventListener("changeAnnotation", this.$onChangeAnnotation); - - this.$onCursorChange = this.onCursorChange.bind(this); - this.session.addEventListener("changeOverwrite", this.$onCursorChange); - - this.$onScrollTopChange = this.onScrollTopChange.bind(this); - this.session.addEventListener("changeScrollTop", this.$onScrollTopChange); - - this.$onScrollLeftChange = this.onScrollLeftChange.bind(this); - this.session.addEventListener("changeScrollLeft", this.$onScrollLeftChange); - - this.selection = session.getSelection(); - this.selection.addEventListener("changeCursor", this.$onCursorChange); - - this.$onSelectionChange = this.onSelectionChange.bind(this); - this.selection.addEventListener("changeSelection", this.$onSelectionChange); - - this.onChangeMode(); - - this.$blockScrolling += 1; - this.onCursorChange(); - this.$blockScrolling -= 1; - - this.onScrollTopChange(); - this.onScrollLeftChange(); - this.onSelectionChange(); - this.onChangeFrontMarker(); - this.onChangeBackMarker(); - this.onChangeBreakpoint(); - this.onChangeAnnotation(); - this.session.getUseWrapMode() && this.renderer.adjustWrapLimit(); - this.renderer.updateFull(); - - this._emit("changeSession", { - session: session, - oldSession: oldSession - }); - }; - this.getSession = function() { - return this.session; - }; - this.setValue = function(val, cursorPos) { - this.session.doc.setValue(val); - - if (!cursorPos) - this.selectAll(); - else if (cursorPos == 1) - this.navigateFileEnd(); - else if (cursorPos == -1) - this.navigateFileStart(); - - return val; - }; - this.getValue = function() { - return this.session.getValue(); - }; - this.getSelection = function() { - return this.selection; - }; - this.resize = function(force) { - this.renderer.onResize(force); - }; - this.setTheme = function(theme) { - this.renderer.setTheme(theme); - }; - this.getTheme = function() { - return this.renderer.getTheme(); - }; - this.setStyle = function(style) { - this.renderer.setStyle(style); - }; - this.unsetStyle = function(style) { - this.renderer.unsetStyle(style); - }; - this.getFontSize = function () { - return this.getOption("fontSize") || - dom.computedStyle(this.container, "fontSize"); - }; - this.setFontSize = function(size) { - this.setOption("fontSize", size); - }; - - this.$highlightBrackets = function() { - if (this.session.$bracketHighlight) { - this.session.removeMarker(this.session.$bracketHighlight); - this.session.$bracketHighlight = null; - } - - if (this.$highlightPending) { - return; - } - var self = this; - this.$highlightPending = true; - setTimeout(function() { - self.$highlightPending = false; - - var pos = self.session.findMatchingBracket(self.getCursorPosition()); - if (pos) { - var range = new Range(pos.row, pos.column, pos.row, pos.column+1); - } else if (self.session.$mode.getMatching) { - var range = self.session.$mode.getMatching(self.session); - } - if (range) - self.session.$bracketHighlight = self.session.addMarker(range, "ace_bracket", "text"); - }, 50); - }; - this.focus = function() { - var _self = this; - setTimeout(function() { - _self.textInput.focus(); - }); - this.textInput.focus(); - }; - this.isFocused = function() { - return this.textInput.isFocused(); - }; - this.blur = function() { - this.textInput.blur(); - }; - this.onFocus = function() { - if (this.$isFocused) - return; - this.$isFocused = true; - this.renderer.showCursor(); - this.renderer.visualizeFocus(); - this._emit("focus"); - }; - this.onBlur = function() { - if (!this.$isFocused) - return; - this.$isFocused = false; - this.renderer.hideCursor(); - this.renderer.visualizeBlur(); - this._emit("blur"); - }; - - this.$cursorChange = function() { - this.renderer.updateCursor(); - }; - this.onDocumentChange = function(e) { - var delta = e.data; - var range = delta.range; - var lastRow; - - if (range.start.row == range.end.row && delta.action != "insertLines" && delta.action != "removeLines") - lastRow = range.end.row; - else - lastRow = Infinity; - this.renderer.updateLines(range.start.row, lastRow); - - this._emit("change", e); - this.$cursorChange(); - }; - - this.onTokenizerUpdate = function(e) { - var rows = e.data; - this.renderer.updateLines(rows.first, rows.last); - }; - - - this.onScrollTopChange = function() { - this.renderer.scrollToY(this.session.getScrollTop()); - }; - - this.onScrollLeftChange = function() { - this.renderer.scrollToX(this.session.getScrollLeft()); - }; - this.onCursorChange = function() { - this.$cursorChange(); - - if (!this.$blockScrolling) { - this.renderer.scrollCursorIntoView(); - } - - this.$highlightBrackets(); - this.$updateHighlightActiveLine(); - this._emit("changeSelection"); - }; - - this.$updateHighlightActiveLine = function() { - var session = this.getSession(); - - var highlight; - if (this.$highlightActiveLine) { - if ((this.$selectionStyle != "line" || !this.selection.isMultiLine())) - highlight = this.getCursorPosition(); - if (this.renderer.$maxLines && this.session.getLength() === 1) - highlight = false; - } - - if (session.$highlightLineMarker && !highlight) { - session.removeMarker(session.$highlightLineMarker.id); - session.$highlightLineMarker = null; - } else if (!session.$highlightLineMarker && highlight) { - var range = new Range(highlight.row, highlight.column, highlight.row, Infinity); - range.id = session.addMarker(range, "ace_active-line", "screenLine"); - session.$highlightLineMarker = range; - } else if (highlight) { - session.$highlightLineMarker.start.row = highlight.row; - session.$highlightLineMarker.end.row = highlight.row; - session.$highlightLineMarker.start.column = highlight.column; - session._emit("changeBackMarker"); - } - }; - - this.onSelectionChange = function(e) { - var session = this.session; - - if (session.$selectionMarker) { - session.removeMarker(session.$selectionMarker); - } - session.$selectionMarker = null; - - if (!this.selection.isEmpty()) { - var range = this.selection.getRange(); - var style = this.getSelectionStyle(); - session.$selectionMarker = session.addMarker(range, "ace_selection", style); - } else { - this.$updateHighlightActiveLine(); - } - - var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp() - this.session.highlight(re); - - this._emit("changeSelection"); - }; - - this.$getSelectionHighLightRegexp = function() { - var session = this.session; - - var selection = this.getSelectionRange(); - if (selection.isEmpty() || selection.isMultiLine()) - return; - - var startOuter = selection.start.column - 1; - var endOuter = selection.end.column + 1; - var line = session.getLine(selection.start.row); - var lineCols = line.length; - var needle = line.substring(Math.max(startOuter, 0), - Math.min(endOuter, lineCols)); - if ((startOuter >= 0 && /^[\w\d]/.test(needle)) || - (endOuter <= lineCols && /[\w\d]$/.test(needle))) - return; - - needle = line.substring(selection.start.column, selection.end.column); - if (!/^[\w\d]+$/.test(needle)) - return; - - var re = this.$search.$assembleRegExp({ - wholeWord: true, - caseSensitive: true, - needle: needle - }); - - return re; - }; - - - this.onChangeFrontMarker = function() { - this.renderer.updateFrontMarkers(); - }; - - this.onChangeBackMarker = function() { - this.renderer.updateBackMarkers(); - }; - - - this.onChangeBreakpoint = function() { - this.renderer.updateBreakpoints(); - }; - - this.onChangeAnnotation = function() { - this.renderer.setAnnotations(this.session.getAnnotations()); - }; - - - this.onChangeMode = function(e) { - this.renderer.updateText(); - this._emit("changeMode", e); - }; - - - this.onChangeWrapLimit = function() { - this.renderer.updateFull(); - }; - - this.onChangeWrapMode = function() { - this.renderer.onResize(true); - }; - - - this.onChangeFold = function() { - this.$updateHighlightActiveLine(); - this.renderer.updateFull(); - }; - this.getSelectedText = function() { - return this.session.getTextRange(this.getSelectionRange()); - }; - this.getCopyText = function() { - var text = this.getSelectedText(); - this._signal("copy", text); - return text; - }; - this.onCopy = function() { - this.commands.exec("copy", this); - }; - this.onCut = function() { - this.commands.exec("cut", this); - }; - this.onPaste = function(text) { - if (this.$readOnly) - return; - this._emit("paste", text); - this.insert(text); - }; - - - this.execCommand = function(command, args) { - this.commands.exec(command, this, args); - }; - this.insert = function(text) { - var session = this.session; - var mode = session.getMode(); - var cursor = this.getCursorPosition(); - - if (this.getBehavioursEnabled()) { - var transform = mode.transformAction(session.getState(cursor.row), 'insertion', this, session, text); - if (transform) { - if (text !== transform.text) { - this.session.mergeUndoDeltas = false; - this.$mergeNextCommand = false; - } - text = transform.text; - - } - } - - if (text == "\t") - text = this.session.getTabString(); - if (!this.selection.isEmpty()) { - var range = this.getSelectionRange(); - cursor = this.session.remove(range); - this.clearSelection(); - } - else if (this.session.getOverwrite()) { - var range = new Range.fromPoints(cursor, cursor); - range.end.column += text.length; - this.session.remove(range); - } - - if (text == "\n" || text == "\r\n") { - var line = session.getLine(cursor.row) - if (cursor.column > line.search(/\S|$/)) { - var d = line.substr(cursor.column).search(/\S|$/); - session.doc.removeInLine(cursor.row, cursor.column, cursor.column + d); - } - } - this.clearSelection(); - - var start = cursor.column; - var lineState = session.getState(cursor.row); - var line = session.getLine(cursor.row); - var shouldOutdent = mode.checkOutdent(lineState, line, text); - var end = session.insert(cursor, text); - - if (transform && transform.selection) { - if (transform.selection.length == 2) { // Transform relative to the current column - this.selection.setSelectionRange( - new Range(cursor.row, start + transform.selection[0], - cursor.row, start + transform.selection[1])); - } else { // Transform relative to the current row. - this.selection.setSelectionRange( - new Range(cursor.row + transform.selection[0], - transform.selection[1], - cursor.row + transform.selection[2], - transform.selection[3])); - } - } - - if (session.getDocument().isNewLine(text)) { - var lineIndent = mode.getNextLineIndent(lineState, line.slice(0, cursor.column), session.getTabString()); - - session.insert({row: cursor.row+1, column: 0}, lineIndent); - } - if (shouldOutdent) - mode.autoOutdent(lineState, session, cursor.row); - }; - - this.onTextInput = function(text) { - this.keyBinding.onTextInput(text); - }; - - this.onCommandKey = function(e, hashId, keyCode) { - this.keyBinding.onCommandKey(e, hashId, keyCode); - }; - this.setOverwrite = function(overwrite) { - this.session.setOverwrite(overwrite); - }; - this.getOverwrite = function() { - return this.session.getOverwrite(); - }; - this.toggleOverwrite = function() { - this.session.toggleOverwrite(); - }; - this.setScrollSpeed = function(speed) { - this.setOption("scrollSpeed", speed); - }; - this.getScrollSpeed = function() { - return this.getOption("scrollSpeed"); - }; - this.setDragDelay = function(dragDelay) { - this.setOption("dragDelay", dragDelay); - }; - this.getDragDelay = function() { - return this.getOption("dragDelay"); - }; - this.setSelectionStyle = function(val) { - this.setOption("selectionStyle", val); - }; - this.getSelectionStyle = function() { - return this.getOption("selectionStyle"); - }; - this.setHighlightActiveLine = function(shouldHighlight) { - this.setOption("highlightActiveLine", shouldHighlight); - }; - this.getHighlightActiveLine = function() { - return this.getOption("highlightActiveLine"); - }; - this.setHighlightGutterLine = function(shouldHighlight) { - this.setOption("highlightGutterLine", shouldHighlight); - }; - - this.getHighlightGutterLine = function() { - return this.getOption("highlightGutterLine"); - }; - this.setHighlightSelectedWord = function(shouldHighlight) { - this.setOption("highlightSelectedWord", shouldHighlight); - }; - this.getHighlightSelectedWord = function() { - return this.$highlightSelectedWord; - }; - - this.setAnimatedScroll = function(shouldAnimate){ - this.renderer.setAnimatedScroll(shouldAnimate); - }; - - this.getAnimatedScroll = function(){ - return this.renderer.getAnimatedScroll(); - }; - this.setShowInvisibles = function(showInvisibles) { - this.renderer.setShowInvisibles(showInvisibles); - }; - this.getShowInvisibles = function() { - return this.renderer.getShowInvisibles(); - }; - - this.setDisplayIndentGuides = function(display) { - this.renderer.setDisplayIndentGuides(display); - }; - - this.getDisplayIndentGuides = function() { - return this.renderer.getDisplayIndentGuides(); - }; - this.setShowPrintMargin = function(showPrintMargin) { - this.renderer.setShowPrintMargin(showPrintMargin); - }; - this.getShowPrintMargin = function() { - return this.renderer.getShowPrintMargin(); - }; - this.setPrintMarginColumn = function(showPrintMargin) { - this.renderer.setPrintMarginColumn(showPrintMargin); - }; - this.getPrintMarginColumn = function() { - return this.renderer.getPrintMarginColumn(); - }; - this.setReadOnly = function(readOnly) { - this.setOption("readOnly", readOnly); - }; - this.getReadOnly = function() { - return this.getOption("readOnly"); - }; - this.setBehavioursEnabled = function (enabled) { - this.setOption("behavioursEnabled", enabled); - }; - this.getBehavioursEnabled = function () { - return this.getOption("behavioursEnabled"); - }; - this.setWrapBehavioursEnabled = function (enabled) { - this.setOption("wrapBehavioursEnabled", enabled); - }; - this.getWrapBehavioursEnabled = function () { - return this.getOption("wrapBehavioursEnabled"); - }; - this.setShowFoldWidgets = function(show) { - this.setOption("showFoldWidgets", show); - - }; - this.getShowFoldWidgets = function() { - return this.getOption("showFoldWidgets"); - }; - - this.setFadeFoldWidgets = function(fade) { - this.setOption("fadeFoldWidgets", fade); - }; - - this.getFadeFoldWidgets = function() { - return this.getOption("fadeFoldWidgets"); - }; - this.remove = function(dir) { - if (this.selection.isEmpty()){ - if (dir == "left") - this.selection.selectLeft(); - else - this.selection.selectRight(); - } - - var range = this.getSelectionRange(); - if (this.getBehavioursEnabled()) { - var session = this.session; - var state = session.getState(range.start.row); - var new_range = session.getMode().transformAction(state, 'deletion', this, session, range); - - if (range.end.column == 0) { - var text = session.getTextRange(range); - if (text[text.length - 1] == "\n") { - var line = session.getLine(range.end.row) - if (/^\s+$/.test(line)) { - range.end.column = line.length - } - } - } - if (new_range) - range = new_range; - } - - this.session.remove(range); - this.clearSelection(); - }; - this.removeWordRight = function() { - if (this.selection.isEmpty()) - this.selection.selectWordRight(); - - this.session.remove(this.getSelectionRange()); - this.clearSelection(); - }; - this.removeWordLeft = function() { - if (this.selection.isEmpty()) - this.selection.selectWordLeft(); - - this.session.remove(this.getSelectionRange()); - this.clearSelection(); - }; - this.removeToLineStart = function() { - if (this.selection.isEmpty()) - this.selection.selectLineStart(); - - this.session.remove(this.getSelectionRange()); - this.clearSelection(); - }; - this.removeToLineEnd = function() { - if (this.selection.isEmpty()) - this.selection.selectLineEnd(); - - var range = this.getSelectionRange(); - if (range.start.column == range.end.column && range.start.row == range.end.row) { - range.end.column = 0; - range.end.row++; - } - - this.session.remove(range); - this.clearSelection(); - }; - this.splitLine = function() { - if (!this.selection.isEmpty()) { - this.session.remove(this.getSelectionRange()); - this.clearSelection(); - } - - var cursor = this.getCursorPosition(); - this.insert("\n"); - this.moveCursorToPosition(cursor); - }; - this.transposeLetters = function() { - if (!this.selection.isEmpty()) { - return; - } - - var cursor = this.getCursorPosition(); - var column = cursor.column; - if (column === 0) - return; - - var line = this.session.getLine(cursor.row); - var swap, range; - if (column < line.length) { - swap = line.charAt(column) + line.charAt(column-1); - range = new Range(cursor.row, column-1, cursor.row, column+1); - } - else { - swap = line.charAt(column-1) + line.charAt(column-2); - range = new Range(cursor.row, column-2, cursor.row, column); - } - this.session.replace(range, swap); - }; - this.toLowerCase = function() { - var originalRange = this.getSelectionRange(); - if (this.selection.isEmpty()) { - this.selection.selectWord(); - } - - var range = this.getSelectionRange(); - var text = this.session.getTextRange(range); - this.session.replace(range, text.toLowerCase()); - this.selection.setSelectionRange(originalRange); - }; - this.toUpperCase = function() { - var originalRange = this.getSelectionRange(); - if (this.selection.isEmpty()) { - this.selection.selectWord(); - } - - var range = this.getSelectionRange(); - var text = this.session.getTextRange(range); - this.session.replace(range, text.toUpperCase()); - this.selection.setSelectionRange(originalRange); - }; - this.indent = function() { - var session = this.session; - var range = this.getSelectionRange(); - - if (range.start.row < range.end.row) { - var rows = this.$getSelectedRows(); - session.indentRows(rows.first, rows.last, "\t"); - return; - } else if (range.start.column < range.end.column) { - var text = session.getTextRange(range) - if (!/^\s+$/.test(text)) { - var rows = this.$getSelectedRows(); - session.indentRows(rows.first, rows.last, "\t"); - return; - } - } - - var line = session.getLine(range.start.row) - var position = range.start; - var size = session.getTabSize(); - var column = session.documentToScreenColumn(position.row, position.column); - - if (this.session.getUseSoftTabs()) { - var count = (size - column % size); - var indentString = lang.stringRepeat(" ", count); - } else { - var count = column % size; - while (line[range.start.column] == " " && count) { - range.start.column--; - count--; - } - this.selection.setSelectionRange(range); - indentString = "\t"; - } - return this.insert(indentString); - }; - this.blockIndent = function() { - var rows = this.$getSelectedRows(); - this.session.indentRows(rows.first, rows.last, "\t"); - }; - this.blockOutdent = function() { - var selection = this.session.getSelection(); - this.session.outdentRows(selection.getRange()); - }; - this.sortLines = function() { - var rows = this.$getSelectedRows(); - var session = this.session; - - var lines = []; - for (i = rows.first; i <= rows.last; i++) - lines.push(session.getLine(i)); - - lines.sort(function(a, b) { - if (a.toLowerCase() < b.toLowerCase()) return -1; - if (a.toLowerCase() > b.toLowerCase()) return 1; - return 0; - }); - - var deleteRange = new Range(0, 0, 0, 0); - for (var i = rows.first; i <= rows.last; i++) { - var line = session.getLine(i); - deleteRange.start.row = i; - deleteRange.end.row = i; - deleteRange.end.column = line.length; - session.replace(deleteRange, lines[i-rows.first]); - } - }; - this.toggleCommentLines = function() { - var state = this.session.getState(this.getCursorPosition().row); - var rows = this.$getSelectedRows(); - this.session.getMode().toggleCommentLines(state, this.session, rows.first, rows.last); - }; - - this.toggleBlockComment = function() { - var cursor = this.getCursorPosition(); - var state = this.session.getState(cursor.row); - var range = this.getSelectionRange(); - this.session.getMode().toggleBlockComment(state, this.session, range, cursor); - }; - this.getNumberAt = function( row, column ) { - var _numberRx = /[\-]?[0-9]+(?:\.[0-9]+)?/g - _numberRx.lastIndex = 0 - - var s = this.session.getLine(row) - while (_numberRx.lastIndex < column) { - var m = _numberRx.exec(s) - if(m.index <= column && m.index+m[0].length >= column){ - var number = { - value: m[0], - start: m.index, - end: m.index+m[0].length - } - return number; - } - } - return null; - }; - this.modifyNumber = function(amount) { - var row = this.selection.getCursor().row; - var column = this.selection.getCursor().column; - var charRange = new Range(row, column-1, row, column); - - var c = this.session.getTextRange(charRange); - if (!isNaN(parseFloat(c)) && isFinite(c)) { - var nr = this.getNumberAt(row, column); - if (nr) { - var fp = nr.value.indexOf(".") >= 0 ? nr.start + nr.value.indexOf(".") + 1 : nr.end; - var decimals = nr.start + nr.value.length - fp; - - var t = parseFloat(nr.value); - t *= Math.pow(10, decimals); - - - if(fp !== nr.end && column < fp){ - amount *= Math.pow(10, nr.end - column - 1); - } else { - amount *= Math.pow(10, nr.end - column); - } - - t += amount; - t /= Math.pow(10, decimals); - var nnr = t.toFixed(decimals); - var replaceRange = new Range(row, nr.start, row, nr.end); - this.session.replace(replaceRange, nnr); - this.moveCursorTo(row, Math.max(nr.start +1, column + nnr.length - nr.value.length)); - - } - } - }; - this.removeLines = function() { - var rows = this.$getSelectedRows(); - var range; - if (rows.first === 0 || rows.last+1 < this.session.getLength()) - range = new Range(rows.first, 0, rows.last+1, 0); - else - range = new Range( - rows.first-1, this.session.getLine(rows.first-1).length, - rows.last, this.session.getLine(rows.last).length - ); - this.session.remove(range); - this.clearSelection(); - }; - - this.duplicateSelection = function() { - var sel = this.selection; - var doc = this.session; - var range = sel.getRange(); - var reverse = sel.isBackwards(); - if (range.isEmpty()) { - var row = range.start.row; - doc.duplicateLines(row, row); - } else { - var point = reverse ? range.start : range.end; - var endPoint = doc.insert(point, doc.getTextRange(range), false); - range.start = point; - range.end = endPoint; - - sel.setSelectionRange(range, reverse) - } - }; - this.moveLinesDown = function() { - this.$moveLines(function(firstRow, lastRow) { - return this.session.moveLinesDown(firstRow, lastRow); - }); - }; - this.moveLinesUp = function() { - this.$moveLines(function(firstRow, lastRow) { - return this.session.moveLinesUp(firstRow, lastRow); - }); - }; - this.moveText = function(range, toPosition, copy) { - return this.session.moveText(range, toPosition, copy); - }; - this.copyLinesUp = function() { - this.$moveLines(function(firstRow, lastRow) { - this.session.duplicateLines(firstRow, lastRow); - return 0; - }); - }; - this.copyLinesDown = function() { - this.$moveLines(function(firstRow, lastRow) { - return this.session.duplicateLines(firstRow, lastRow); - }); - }; - this.$moveLines = function(mover) { - var selection = this.selection; - if (!selection.inMultiSelectMode || this.inVirtualSelectionMode) { - var range = selection.toOrientedRange(); - var rows = this.$getSelectedRows(range); - var linesMoved = mover.call(this, rows.first, rows.last); - range.moveBy(linesMoved, 0); - selection.fromOrientedRange(range); - } else { - var ranges = selection.rangeList.ranges; - selection.rangeList.detach(this.session); - - for (var i = ranges.length; i--; ) { - var rangeIndex = i; - var rows = ranges[i].collapseRows(); - var last = rows.end.row; - var first = rows.start.row; - while (i--) { - var rows = ranges[i].collapseRows(); - if (first - rows.end.row <= 1) - first = rows.end.row; - else - break; - } - i++; - - var linesMoved = mover.call(this, first, last); - while (rangeIndex >= i) { - ranges[rangeIndex].moveBy(linesMoved, 0); - rangeIndex--; - } - } - selection.fromOrientedRange(selection.ranges[0]); - selection.rangeList.attach(this.session); - } - }; - this.$getSelectedRows = function() { - var range = this.getSelectionRange().collapseRows(); - - return { - first: range.start.row, - last: range.end.row - }; - }; - - this.onCompositionStart = function(text) { - this.renderer.showComposition(this.getCursorPosition()); - }; - - this.onCompositionUpdate = function(text) { - this.renderer.setCompositionText(text); - }; - - this.onCompositionEnd = function() { - this.renderer.hideComposition(); - }; - this.getFirstVisibleRow = function() { - return this.renderer.getFirstVisibleRow(); - }; - this.getLastVisibleRow = function() { - return this.renderer.getLastVisibleRow(); - }; - this.isRowVisible = function(row) { - return (row >= this.getFirstVisibleRow() && row <= this.getLastVisibleRow()); - }; - this.isRowFullyVisible = function(row) { - return (row >= this.renderer.getFirstFullyVisibleRow() && row <= this.renderer.getLastFullyVisibleRow()); - }; - this.$getVisibleRowCount = function() { - return this.renderer.getScrollBottomRow() - this.renderer.getScrollTopRow() + 1; - }; - - this.$moveByPage = function(dir, select) { - var renderer = this.renderer; - var config = this.renderer.layerConfig; - var rows = dir * Math.floor(config.height / config.lineHeight); - - this.$blockScrolling++; - if (select == true) { - this.selection.$moveSelection(function(){ - this.moveCursorBy(rows, 0); - }); - } else if (select == false) { - this.selection.moveCursorBy(rows, 0); - this.selection.clearSelection(); - } - this.$blockScrolling--; - - var scrollTop = renderer.scrollTop; - - renderer.scrollBy(0, rows * config.lineHeight); - if (select != null) - renderer.scrollCursorIntoView(null, 0.5); - - renderer.animateScrolling(scrollTop); - }; - this.selectPageDown = function() { - this.$moveByPage(1, true); - }; - this.selectPageUp = function() { - this.$moveByPage(-1, true); - }; - this.gotoPageDown = function() { - this.$moveByPage(1, false); - }; - this.gotoPageUp = function() { - this.$moveByPage(-1, false); - }; - this.scrollPageDown = function() { - this.$moveByPage(1); - }; - this.scrollPageUp = function() { - this.$moveByPage(-1); - }; - this.scrollToRow = function(row) { - this.renderer.scrollToRow(row); - }; - this.scrollToLine = function(line, center, animate, callback) { - this.renderer.scrollToLine(line, center, animate, callback); - }; - this.centerSelection = function() { - var range = this.getSelectionRange(); - var pos = { - row: Math.floor(range.start.row + (range.end.row - range.start.row) / 2), - column: Math.floor(range.start.column + (range.end.column - range.start.column) / 2) - } - this.renderer.alignCursor(pos, 0.5); - }; - this.getCursorPosition = function() { - return this.selection.getCursor(); - }; - this.getCursorPositionScreen = function() { - return this.session.documentToScreenPosition(this.getCursorPosition()); - }; - this.getSelectionRange = function() { - return this.selection.getRange(); - }; - this.selectAll = function() { - this.$blockScrolling += 1; - this.selection.selectAll(); - this.$blockScrolling -= 1; - }; - this.clearSelection = function() { - this.selection.clearSelection(); - }; - this.moveCursorTo = function(row, column) { - this.selection.moveCursorTo(row, column); - }; - this.moveCursorToPosition = function(pos) { - this.selection.moveCursorToPosition(pos); - }; - this.jumpToMatching = function(select) { - var cursor = this.getCursorPosition(); - - var range = this.session.getBracketRange(cursor); - if (!range) { - range = this.find({ - needle: /[{}()\[\]]/g, - preventScroll:true, - start: {row: cursor.row, column: cursor.column - 1} - }); - if (!range) - return; - var pos = range.start; - if (pos.row == cursor.row && Math.abs(pos.column - cursor.column) < 2) - range = this.session.getBracketRange(pos); - } - - pos = range && range.cursor || pos; - if (pos) { - if (select) { - if (range && range.isEqual(this.getSelectionRange())) - this.clearSelection(); - else - this.selection.selectTo(pos.row, pos.column); - } else { - this.clearSelection(); - this.moveCursorTo(pos.row, pos.column); - } - } - }; - this.gotoLine = function(lineNumber, column, animate) { - this.selection.clearSelection(); - this.session.unfold({row: lineNumber - 1, column: column || 0}); - - this.$blockScrolling += 1; - this.exitMultiSelectMode && this.exitMultiSelectMode(); - this.moveCursorTo(lineNumber - 1, column || 0); - this.$blockScrolling -= 1; - - if (!this.isRowFullyVisible(lineNumber - 1)) - this.scrollToLine(lineNumber - 1, true, animate); - }; - this.navigateTo = function(row, column) { - this.clearSelection(); - this.moveCursorTo(row, column); - }; - this.navigateUp = function(times) { - if (this.selection.isMultiLine() && !this.selection.isBackwards()) { - var selectionStart = this.selection.anchor.getPosition(); - return this.moveCursorToPosition(selectionStart); - } - this.selection.clearSelection(); - times = times || 1; - this.selection.moveCursorBy(-times, 0); - }; - this.navigateDown = function(times) { - if (this.selection.isMultiLine() && this.selection.isBackwards()) { - var selectionEnd = this.selection.anchor.getPosition(); - return this.moveCursorToPosition(selectionEnd); - } - this.selection.clearSelection(); - times = times || 1; - this.selection.moveCursorBy(times, 0); - }; - this.navigateLeft = function(times) { - if (!this.selection.isEmpty()) { - var selectionStart = this.getSelectionRange().start; - this.moveCursorToPosition(selectionStart); - } - else { - times = times || 1; - while (times--) { - this.selection.moveCursorLeft(); - } - } - this.clearSelection(); - }; - this.navigateRight = function(times) { - if (!this.selection.isEmpty()) { - var selectionEnd = this.getSelectionRange().end; - this.moveCursorToPosition(selectionEnd); - } - else { - times = times || 1; - while (times--) { - this.selection.moveCursorRight(); - } - } - this.clearSelection(); - }; - this.navigateLineStart = function() { - this.selection.moveCursorLineStart(); - this.clearSelection(); - }; - this.navigateLineEnd = function() { - this.selection.moveCursorLineEnd(); - this.clearSelection(); - }; - this.navigateFileEnd = function() { - var scrollTop = this.renderer.scrollTop; - this.selection.moveCursorFileEnd(); - this.clearSelection(); - this.renderer.animateScrolling(scrollTop); - }; - this.navigateFileStart = function() { - var scrollTop = this.renderer.scrollTop; - this.selection.moveCursorFileStart(); - this.clearSelection(); - this.renderer.animateScrolling(scrollTop); - }; - this.navigateWordRight = function() { - this.selection.moveCursorWordRight(); - this.clearSelection(); - }; - this.navigateWordLeft = function() { - this.selection.moveCursorWordLeft(); - this.clearSelection(); - }; - this.replace = function(replacement, options) { - if (options) - this.$search.set(options); - - var range = this.$search.find(this.session); - var replaced = 0; - if (!range) - return replaced; - - if (this.$tryReplace(range, replacement)) { - replaced = 1; - } - if (range !== null) { - this.selection.setSelectionRange(range); - this.renderer.scrollSelectionIntoView(range.start, range.end); - } - - return replaced; - }; - this.replaceAll = function(replacement, options) { - if (options) { - this.$search.set(options); - } - - var ranges = this.$search.findAll(this.session); - var replaced = 0; - if (!ranges.length) - return replaced; - - this.$blockScrolling += 1; - - var selection = this.getSelectionRange(); - this.clearSelection(); - this.selection.moveCursorTo(0, 0); - - for (var i = ranges.length - 1; i >= 0; --i) { - if(this.$tryReplace(ranges[i], replacement)) { - replaced++; - } - } - - this.selection.setSelectionRange(selection); - this.$blockScrolling -= 1; - - return replaced; - }; - - this.$tryReplace = function(range, replacement) { - var input = this.session.getTextRange(range); - replacement = this.$search.replace(input, replacement); - if (replacement !== null) { - range.end = this.session.replace(range, replacement); - return range; - } else { - return null; - } - }; - this.getLastSearchOptions = function() { - return this.$search.getOptions(); - }; - this.find = function(needle, options, animate) { - if (!options) - options = {}; - - if (typeof needle == "string" || needle instanceof RegExp) - options.needle = needle; - else if (typeof needle == "object") - oop.mixin(options, needle); - - var range = this.selection.getRange(); - if (options.needle == null) { - needle = this.session.getTextRange(range) - || this.$search.$options.needle; - if (!needle) { - range = this.session.getWordRange(range.start.row, range.start.column); - needle = this.session.getTextRange(range); - } - this.$search.set({needle: needle}); - } - - this.$search.set(options); - if (!options.start) - this.$search.set({start: range}); - - var newRange = this.$search.find(this.session); - if (options.preventScroll) - return newRange; - if (newRange) { - this.revealRange(newRange, animate); - return newRange; - } - if (options.backwards) - range.start = range.end; - else - range.end = range.start; - this.selection.setRange(range); - }; - this.findNext = function(options, animate) { - this.find({skipCurrent: true, backwards: false}, options, animate); - }; - this.findPrevious = function(options, animate) { - this.find(options, {skipCurrent: true, backwards: true}, animate); - }; - - this.revealRange = function(range, animate) { - this.$blockScrolling += 1; - this.session.unfold(range); - this.selection.setSelectionRange(range); - this.$blockScrolling -= 1; - - var scrollTop = this.renderer.scrollTop; - this.renderer.scrollSelectionIntoView(range.start, range.end, 0.5); - if (animate != false) - this.renderer.animateScrolling(scrollTop); - }; - this.undo = function() { - this.$blockScrolling++; - this.session.getUndoManager().undo(); - this.$blockScrolling--; - this.renderer.scrollCursorIntoView(null, 0.5); - }; - this.redo = function() { - this.$blockScrolling++; - this.session.getUndoManager().redo(); - this.$blockScrolling--; - this.renderer.scrollCursorIntoView(null, 0.5); - }; - this.destroy = function() { - this.renderer.destroy(); - this._emit("destroy", this); - }; - this.setAutoScrollEditorIntoView = function(enable) { - if (enable === false) - return; - var rect; - var self = this; - var shouldScroll = false; - if (!this.$scrollAnchor) - this.$scrollAnchor = document.createElement("div"); - var scrollAnchor = this.$scrollAnchor; - scrollAnchor.style.cssText = "position:absolute"; - this.container.insertBefore(scrollAnchor, this.container.firstChild); - var onChangeSelection = this.on("changeSelection", function() { - shouldScroll = true; - }); - var onBeforeRender = this.renderer.on("beforeRender", function() { - if (shouldScroll) - rect = self.renderer.container.getBoundingClientRect(); - }); - var onAfterRender = this.renderer.on("afterRender", function() { - if (shouldScroll && rect && self.isFocused()) { - var renderer = self.renderer; - var pos = renderer.$cursorLayer.$pixelPos; - var config = renderer.layerConfig; - var top = pos.top - config.offset; - if (pos.top >= 0 && top + rect.top < 0) { - shouldScroll = true; - } else if (pos.top < config.height && - pos.top + rect.top + config.lineHeight > window.innerHeight) { - shouldScroll = false; - } else { - shouldScroll = null; - } - if (shouldScroll != null) { - scrollAnchor.style.top = top + "px"; - scrollAnchor.style.left = pos.left + "px"; - scrollAnchor.style.height = config.lineHeight + "px"; - scrollAnchor.scrollIntoView(shouldScroll); - } - shouldScroll = rect = null; - } - }); - this.setAutoScrollEditorIntoView = function(enable) { - if (enable === true) - return; - delete this.setAutoScrollEditorIntoView; - this.removeEventListener("changeSelection", onChangeSelection); - this.renderer.removeEventListener("afterRender", onAfterRender); - this.renderer.removeEventListener("beforeRender", onBeforeRender); - }; - }; - - - this.$resetCursorStyle = function() { - var style = this.$cursorStyle || "ace"; - var cursorLayer = this.renderer.$cursorLayer; - if (!cursorLayer) - return; - cursorLayer.setSmoothBlinking(style == "smooth"); - cursorLayer.isBlinking = !this.$readOnly && style != "wide"; - }; - -}).call(Editor.prototype); - - - -config.defineOptions(Editor.prototype, "editor", { - selectionStyle: { - set: function(style) { - this.onSelectionChange(); - this._emit("changeSelectionStyle", {data: style}); - }, - initialValue: "line" - }, - highlightActiveLine: { - set: function() {this.$updateHighlightActiveLine();}, - initialValue: true - }, - highlightSelectedWord: { - set: function(shouldHighlight) {this.$onSelectionChange();}, - initialValue: true - }, - readOnly: { - set: function(readOnly) { - this.textInput.setReadOnly(readOnly); - this.$resetCursorStyle(); - }, - initialValue: false - }, - cursorStyle: { - set: function(val) { this.$resetCursorStyle(); }, - values: ["ace", "slim", "smooth", "wide"], - initialValue: "ace" - }, - mergeUndoDeltas: { - values: [false, true, "always"], - initialValue: true - }, - behavioursEnabled: {initialValue: true}, - wrapBehavioursEnabled: {initialValue: true}, - - hScrollBarAlwaysVisible: "renderer", - vScrollBarAlwaysVisible: "renderer", - highlightGutterLine: "renderer", - animatedScroll: "renderer", - showInvisibles: "renderer", - showPrintMargin: "renderer", - printMarginColumn: "renderer", - printMargin: "renderer", - fadeFoldWidgets: "renderer", - showFoldWidgets: "renderer", - showGutter: "renderer", - displayIndentGuides: "renderer", - fontSize: "renderer", - fontFamily: "renderer", - maxLines: "renderer", - minLines: "renderer", - scrollPastEnd: "renderer", - fixedWidthGutter: "renderer", - - scrollSpeed: "$mouseHandler", - dragDelay: "$mouseHandler", - dragEnabled: "$mouseHandler", - focusTimout: "$mouseHandler", - - firstLineNumber: "session", - overwrite: "session", - newLineMode: "session", - useWorker: "session", - useSoftTabs: "session", - tabSize: "session", - wrap: "session", - foldStyle: "session" -}); - -exports.Editor = Editor; -}); - -define('ace/lib/lang', ['require', 'exports', 'module' ], function(require, exports, module) { - - -exports.stringReverse = function(string) { - return string.split("").reverse().join(""); -}; - -exports.stringRepeat = function (string, count) { - var result = ''; - while (count > 0) { - if (count & 1) - result += string; - - if (count >>= 1) - string += string; - } - return result; -}; - -var trimBeginRegexp = /^\s\s*/; -var trimEndRegexp = /\s\s*$/; - -exports.stringTrimLeft = function (string) { - return string.replace(trimBeginRegexp, ''); -}; - -exports.stringTrimRight = function (string) { - return string.replace(trimEndRegexp, ''); -}; - -exports.copyObject = function(obj) { - var copy = {}; - for (var key in obj) { - copy[key] = obj[key]; - } - return copy; -}; - -exports.copyArray = function(array){ - var copy = []; - for (var i=0, l=array.length; i= 0) { - anchor = this.$clickSelection.start; - if (range.start.row != cursor.row || range.start.column != cursor.column) - cursor = range.end; - } else if (cmpStart == -1 && cmpEnd == 1) { - cursor = range.end; - anchor = range.start; - } else { - var orientedRange = calcRangeOrientation(this.$clickSelection, cursor); - cursor = orientedRange.cursor; - anchor = orientedRange.anchor; - } - editor.selection.setSelectionAnchor(anchor.row, anchor.column); - } - editor.selection.selectToPosition(cursor); - - editor.renderer.scrollCursorIntoView(); - }; - - this.selectEnd = - this.selectAllEnd = - this.selectByWordsEnd = - this.selectByLinesEnd = function() { - this.editor.unsetStyle("ace_selecting"); - if (this.editor.container.releaseCapture) { - this.editor.container.releaseCapture(); - } - }; - - this.focusWait = function() { - var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y); - var time = (new Date()).getTime(); - - if (distance > DRAG_OFFSET || time - this.mousedownEvent.time > this.$focusTimout) - this.startSelect(this.mousedownEvent.getDocumentPosition()); - }; - - this.onDoubleClick = function(ev) { - var pos = ev.getDocumentPosition(); - var editor = this.editor; - var session = editor.session; - - var range = session.getBracketRange(pos); - if (range) { - if (range.isEmpty()) { - range.start.column--; - range.end.column++; - } - this.$clickSelection = range; - this.setState("select"); - return; - } - - this.$clickSelection = editor.selection.getWordRange(pos.row, pos.column); - this.setState("selectByWords"); - }; - - this.onTripleClick = function(ev) { - var pos = ev.getDocumentPosition(); - var editor = this.editor; - - this.setState("selectByLines"); - this.$clickSelection = editor.selection.getLineRange(pos.row); - }; - - this.onQuadClick = function(ev) { - var editor = this.editor; - - editor.selectAll(); - this.$clickSelection = editor.getSelectionRange(); - this.setState("selectAll"); - }; - - this.onMouseWheel = function(ev) { - if (ev.getShiftKey() || ev.getAccelKey()) - return; - var t = ev.domEvent.timeStamp; - var dt = t - (this.$lastScrollTime||0); - - var editor = this.editor; - var isScrolable = editor.renderer.isScrollableBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed); - if (isScrolable || dt < 200) { - this.$lastScrollTime = t; - editor.renderer.scrollBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed); - return ev.stop(); - } - }; - -}).call(DefaultHandlers.prototype); - -exports.DefaultHandlers = DefaultHandlers; - -function calcDistance(ax, ay, bx, by) { - return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2)); -} - -function calcRangeOrientation(range, cursor) { - if (range.start.row == range.end.row) - var cmp = 2 * cursor.column - range.start.column - range.end.column; - else if (range.start.row == range.end.row - 1 && !range.start.column && !range.end.column) - var cmp = cursor.column - 4; - else - var cmp = 2 * cursor.row - range.start.row - range.end.row; - - if (cmp < 0) - return {cursor: range.start, anchor: range.end}; - else - return {cursor: range.end, anchor: range.start}; -} - -}); - -define('ace/mouse/default_gutter_handler', ['require', 'exports', 'module' , 'ace/lib/dom', 'ace/lib/event'], function(require, exports, module) { - -var dom = require("../lib/dom"); -var event = require("../lib/event"); - -function GutterHandler(mouseHandler) { - var editor = mouseHandler.editor; - var gutter = editor.renderer.$gutterLayer; - - mouseHandler.editor.setDefaultHandler("guttermousedown", function(e) { - if (!editor.isFocused() || e.getButton() != 0) - return; - var gutterRegion = gutter.getRegion(e); - - if (gutterRegion == "foldWidgets") - return; - - var row = e.getDocumentPosition().row; - var selection = editor.session.selection; - - if (e.getShiftKey()) - selection.selectTo(row, 0); - else { - if (e.domEvent.detail == 2) { - editor.selectAll(); - return e.preventDefault(); - } - mouseHandler.$clickSelection = editor.selection.getLineRange(row); - } - mouseHandler.setState("selectByLines"); - mouseHandler.captureMouse(e); - return e.preventDefault(); - }); - - - var tooltipTimeout, mouseEvent, tooltip, tooltipAnnotation; - function createTooltip() { - tooltip = dom.createElement("div"); - tooltip.className = "ace_gutter-tooltip"; - tooltip.style.display = "none"; - editor.container.appendChild(tooltip); - } - - function showTooltip() { - if (!tooltip) { - createTooltip(); - } - var row = mouseEvent.getDocumentPosition().row; - var annotation = gutter.$annotations[row]; - if (!annotation) - return hideTooltip(); - - var maxRow = editor.session.getLength(); - if (row == maxRow) { - var screenRow = editor.renderer.pixelToScreenCoordinates(0, mouseEvent.y).row; - var pos = mouseEvent.$pos; - if (screenRow > editor.session.documentToScreenRow(pos.row, pos.column)) - return hideTooltip(); - } - - if (tooltipAnnotation == annotation) - return; - tooltipAnnotation = annotation.text.join("
"); - - tooltip.style.display = "block"; - tooltip.innerHTML = tooltipAnnotation; - editor.on("mousewheel", hideTooltip); - - moveTooltip(mouseEvent); - } - - function hideTooltip() { - if (tooltipTimeout) - tooltipTimeout = clearTimeout(tooltipTimeout); - if (tooltipAnnotation) { - tooltip.style.display = "none"; - tooltipAnnotation = null; - editor.removeEventListener("mousewheel", hideTooltip); - } - } - - function moveTooltip(e) { - var rect = editor.renderer.$gutter.getBoundingClientRect(); - tooltip.style.left = e.x + 15 + "px"; - if (e.y + 3 * editor.renderer.lineHeight + 15 < rect.bottom) { - tooltip.style.bottom = ""; - tooltip.style.top = e.y + 15 + "px"; - } else { - tooltip.style.top = ""; - var innerHeight = window.innerHeight || document.documentElement.clientHeight; - tooltip.style.bottom = innerHeight - e.y + 5 + "px"; - } - } - - mouseHandler.editor.setDefaultHandler("guttermousemove", function(e) { - var target = e.domEvent.target || e.domEvent.srcElement; - if (dom.hasCssClass(target, "ace_fold-widget")) - return hideTooltip(); - - if (tooltipAnnotation) - moveTooltip(e); - - mouseEvent = e; - if (tooltipTimeout) - return; - tooltipTimeout = setTimeout(function() { - tooltipTimeout = null; - if (mouseEvent && !mouseHandler.isMousePressed) - showTooltip(); - else - hideTooltip(); - }, 50); - }); - - event.addListener(editor.renderer.$gutter, "mouseout", function(e) { - mouseEvent = null; - if (!tooltipAnnotation || tooltipTimeout) - return; - - tooltipTimeout = setTimeout(function() { - tooltipTimeout = null; - hideTooltip(); - }, 50); - }); - - editor.on("changeSession", hideTooltip); -} - -exports.GutterHandler = GutterHandler; - -}); - -define('ace/mouse/mouse_event', ['require', 'exports', 'module' , 'ace/lib/event', 'ace/lib/useragent'], function(require, exports, module) { - - -var event = require("../lib/event"); -var useragent = require("../lib/useragent"); -var MouseEvent = exports.MouseEvent = function(domEvent, editor) { - this.domEvent = domEvent; - this.editor = editor; - - this.x = this.clientX = domEvent.clientX; - this.y = this.clientY = domEvent.clientY; - - this.$pos = null; - this.$inSelection = null; - - this.propagationStopped = false; - this.defaultPrevented = false; -}; - -(function() { - - this.stopPropagation = function() { - event.stopPropagation(this.domEvent); - this.propagationStopped = true; - }; - - this.preventDefault = function() { - event.preventDefault(this.domEvent); - this.defaultPrevented = true; - }; - - this.stop = function() { - this.stopPropagation(); - this.preventDefault(); - }; - this.getDocumentPosition = function() { - if (this.$pos) - return this.$pos; - - this.$pos = this.editor.renderer.screenToTextCoordinates(this.clientX, this.clientY); - return this.$pos; - }; - this.inSelection = function() { - if (this.$inSelection !== null) - return this.$inSelection; - - var editor = this.editor; - - - var selectionRange = editor.getSelectionRange(); - if (selectionRange.isEmpty()) - this.$inSelection = false; - else { - var pos = this.getDocumentPosition(); - this.$inSelection = selectionRange.contains(pos.row, pos.column); - } - - return this.$inSelection; - }; - this.getButton = function() { - return event.getButton(this.domEvent); - }; - this.getShiftKey = function() { - return this.domEvent.shiftKey; - }; - - this.getAccelKey = useragent.isMac - ? function() { return this.domEvent.metaKey; } - : function() { return this.domEvent.ctrlKey; }; - -}).call(MouseEvent.prototype); - -}); - -define('ace/mouse/dragdrop_handler', ['require', 'exports', 'module' , 'ace/lib/dom', 'ace/lib/event', 'ace/lib/useragent'], function(require, exports, module) { - - -var dom = require("../lib/dom"); -var event = require("../lib/event"); -var useragent = require("../lib/useragent"); - -var AUTOSCROLL_DELAY = 200; -var SCROLL_CURSOR_DELAY = 200; -var SCROLL_CURSOR_HYSTERESIS = 5; - -function DragdropHandler(mouseHandler) { - - var editor = mouseHandler.editor; - var proxy = dom.createElement("img"); - proxy.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="; - - if (useragent.isOpera) { - proxy.style.cssText = "width:1px;height:1px;position:fixed;top:0;left:0;z-index:2147483647;opacity:0;visibility:hidden"; - editor.container.appendChild(proxy); - } - - var exports = ["dragWait", "dragWaitEnd", "startDrag", "dragReadyEnd", "onMouseDrag"]; - - exports.forEach(function(x) { - mouseHandler[x] = this[x]; - }, this); - editor.addEventListener("mousedown", this.onMouseDown.bind(mouseHandler)); - - - var mouseTarget = editor.container; - var dragSelectionMarker, x, y; - var timerId, range; - var dragCursor, counter = 0; - var dragOperation; - var autoScrollStartTime; - var cursorMovedTime; - var cursorPointOnCaretMoved; - - this.onDragStart = function(e) { - if (this.cancelDrag || !mouseTarget.draggable) { - var self = this; - setTimeout(function(){ - self.startSelect(); - self.captureMouse(e); - }, 0); - return e.preventDefault(); - } - if (useragent.isOpera) { - proxy.style.visibility = "visible"; - setTimeout(function(){ - proxy.style.visibility = "hidden"; - }, 0); - } - range = editor.getSelectionRange(); - - var dataTransfer = e.dataTransfer; - dataTransfer.effectAllowed = editor.getReadOnly() ? "copy" : "copyMove"; - dataTransfer.setDragImage && dataTransfer.setDragImage(proxy, 0, 0); - dataTransfer.clearData(); - dataTransfer.setData("Text", editor.session.getTextRange()); - - this.setState("drag"); - }; - - this.onDragEnd = function(e) { - mouseTarget.draggable = false; - this.setState(null); - if (!editor.getReadOnly()) { - var dropEffect = e.dataTransfer.dropEffect; - if (!dragOperation && dropEffect == "move") - editor.session.remove(editor.getSelectionRange()); - editor.renderer.$cursorLayer.setBlinking(true); - } - this.editor.unsetStyle("ace_dragging"); - }; - - this.onDragEnter = function(e) { - if (editor.getReadOnly() || !canAccept(e.dataTransfer)) - return; - if (!dragSelectionMarker) - addDragMarker(); - counter++; - e.dataTransfer.dropEffect = dragOperation = getDropEffect(e); - return event.preventDefault(e); - }; - - this.onDragOver = function(e) { - if (editor.getReadOnly() || !canAccept(e.dataTransfer)) - return; - if (!dragSelectionMarker) { - addDragMarker(); - counter++; - } - if (onMouseMoveTimer !== null) - onMouseMoveTimer = null; - x = e.clientX; - y = e.clientY; - - e.dataTransfer.dropEffect = dragOperation = getDropEffect(e); - return event.preventDefault(e); - }; - - this.onDragLeave = function(e) { - counter--; - if (counter <= 0 && dragSelectionMarker) { - clearDragMarker(); - dragOperation = null; - return event.preventDefault(e); - } - }; - - this.onDrop = function(e) { - if (!dragSelectionMarker) - return; - var dataTransfer = e.dataTransfer; - var isInternal = this.state == "drag"; - if (isInternal) { - switch (dragOperation) { - case "move": - if (range.contains(dragCursor.row, dragCursor.column)) { - range = { - start: dragCursor, - end: dragCursor - }; - } else { - range = editor.moveText(range, dragCursor); - } - break; - case "copy": - range = editor.moveText(range, dragCursor, true); - break; - } - } else { - var dropData = dataTransfer.getData('Text'); - range = { - start: dragCursor, - end: editor.session.insert(dragCursor, dropData) - }; - editor.focus(); - dragOperation = null; - } - clearDragMarker(); - return event.preventDefault(e); - }; - - event.addListener(mouseTarget, "dragstart", this.onDragStart.bind(mouseHandler)); - event.addListener(mouseTarget, "dragend", this.onDragEnd.bind(mouseHandler)); - event.addListener(mouseTarget, "dragenter", this.onDragEnter.bind(mouseHandler)); - event.addListener(mouseTarget, "dragover", this.onDragOver.bind(mouseHandler)); - event.addListener(mouseTarget, "dragleave", this.onDragLeave.bind(mouseHandler)); - event.addListener(mouseTarget, "drop", this.onDrop.bind(mouseHandler)); - - function scrollCursorIntoView(cursor, prevCursor) { - var now = new Date().getTime(); - var vMovement = !prevCursor || cursor.row != prevCursor.row; - var hMovement = !prevCursor || cursor.column != prevCursor.column; - if (!cursorMovedTime || vMovement || hMovement) { - editor.$blockScrolling += 1; - editor.moveCursorToPosition(cursor); - editor.$blockScrolling -= 1; - cursorMovedTime = now; - cursorPointOnCaretMoved = {x: x, y: y}; - } else { - var distance = calcDistance(cursorPointOnCaretMoved.x, cursorPointOnCaretMoved.y, x, y); - if (distance > SCROLL_CURSOR_HYSTERESIS) { - cursorMovedTime = null; - } else if (now - cursorMovedTime >= SCROLL_CURSOR_DELAY) { - editor.renderer.scrollCursorIntoView(); - cursorMovedTime = null; - } - } - } - - function autoScroll(cursor, prevCursor) { - var now = new Date().getTime(); - var lineHeight = editor.renderer.layerConfig.lineHeight; - var characterWidth = editor.renderer.layerConfig.characterWidth; - var editorRect = editor.renderer.scroller.getBoundingClientRect(); - var offsets = { - x: { - left: x - editorRect.left, - right: editorRect.right - x - }, - y: { - top: y - editorRect.top, - bottom: editorRect.bottom - y - } - }; - var nearestXOffset = Math.min(offsets.x.left, offsets.x.right); - var nearestYOffset = Math.min(offsets.y.top, offsets.y.bottom); - var scrollCursor = {row: cursor.row, column: cursor.column}; - if (nearestXOffset / characterWidth <= 2) { - scrollCursor.column += (offsets.x.left < offsets.x.right ? -3 : +2); - } - if (nearestYOffset / lineHeight <= 1) { - scrollCursor.row += (offsets.y.top < offsets.y.bottom ? -1 : +1); - } - var vScroll = cursor.row != scrollCursor.row; - var hScroll = cursor.column != scrollCursor.column; - var vMovement = !prevCursor || cursor.row != prevCursor.row; - if (vScroll || (hScroll && !vMovement)) { - if (!autoScrollStartTime) - autoScrollStartTime = now; - else if (now - autoScrollStartTime >= AUTOSCROLL_DELAY) - editor.renderer.scrollCursorIntoView(scrollCursor); - } else { - autoScrollStartTime = null; - } - } - - function onDragInterval() { - var prevCursor = dragCursor; - dragCursor = editor.renderer.screenToTextCoordinates(x, y); - scrollCursorIntoView(dragCursor, prevCursor); - autoScroll(dragCursor, prevCursor); - } - - function addDragMarker() { - range = editor.selection.toOrientedRange(); - dragSelectionMarker = editor.session.addMarker(range, "ace_selection", editor.getSelectionStyle()); - editor.clearSelection(); - clearInterval(timerId); - timerId = setInterval(onDragInterval, 20); - counter = 0; - event.addListener(document, "mousemove", onMouseMove); - } - - function clearDragMarker() { - clearInterval(timerId); - editor.session.removeMarker(dragSelectionMarker); - dragSelectionMarker = null; - editor.$blockScrolling += 1; - editor.selection.fromOrientedRange(range); - editor.$blockScrolling -= 1; - range = null; - counter = 0; - autoScrollStartTime = null; - cursorMovedTime = null; - event.removeListener(document, "mousemove", onMouseMove); - } - var onMouseMoveTimer = null; - function onMouseMove() { - if (onMouseMoveTimer == null) { - onMouseMoveTimer = setTimeout(function() { - if (onMouseMoveTimer != null && dragSelectionMarker) - clearDragMarker(); - }, 20); - } - } - - function canAccept(dataTransfer) { - var types = dataTransfer.types; - return !types || Array.prototype.some.call(types, function(type) { - return type == 'text/plain' || type == 'Text'; - }); - } - - function getDropEffect(e) { - var copyAllowed = ['copy', 'copymove', 'all', 'uninitialized']; - var moveAllowed = ['move', 'copymove', 'linkmove', 'all', 'uninitialized']; - - var copyModifierState = useragent.isMac ? e.altKey : e.ctrlKey; - var effectAllowed = "uninitialized"; - try { - effectAllowed = e.dataTransfer.effectAllowed.toLowerCase(); - } catch (e) {} - var dropEffect = "none"; - - if (copyModifierState && copyAllowed.indexOf(effectAllowed) >= 0) - dropEffect = "copy"; - else if (moveAllowed.indexOf(effectAllowed) >= 0) - dropEffect = "move"; - else if (copyAllowed.indexOf(effectAllowed) >= 0) - dropEffect = "copy"; - - return dropEffect; - } -} - -(function() { - - this.dragWait = function() { - var interval = (new Date()).getTime() - this.mousedownEvent.time; - if (interval > this.editor.getDragDelay()) - this.startDrag(); - }; - - this.dragWaitEnd = function() { - var target = this.editor.container; - target.draggable = false; - this.startSelect(this.mousedownEvent.getDocumentPosition()); - this.selectEnd(); - }; - - this.dragReadyEnd = function(e) { - this.editor.renderer.$cursorLayer.setBlinking(!this.editor.getReadOnly()); - this.editor.unsetStyle("ace_dragging"); - this.dragWaitEnd(); - }; - - this.startDrag = function(){ - this.cancelDrag = false; - var target = this.editor.container; - target.draggable = true; - this.editor.renderer.$cursorLayer.setBlinking(false); - this.editor.setStyle("ace_dragging"); - this.setState("dragReady"); - }; - - this.onMouseDrag = function(e) { - var target = this.editor.container; - if (useragent.isIE && this.state == "dragReady") { - var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y); - if (distance > 3) - target.dragDrop(); - } - if (this.state === "dragWait") { - var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y); - if (distance > 0) { - target.draggable = false; - this.startSelect(this.mousedownEvent.getDocumentPosition()); - } - } - }; - - this.onMouseDown = function(e) { - if (!this.$dragEnabled) - return; - this.mousedownEvent = e; - var editor = this.editor; - - var inSelection = e.inSelection(); - var button = e.getButton(); - var clickCount = e.domEvent.detail || 1; - if (clickCount === 1 && button === 0 && inSelection) { - this.mousedownEvent.time = (new Date()).getTime(); - var eventTarget = e.domEvent.target || e.domEvent.srcElement; - if ("unselectable" in eventTarget) - eventTarget.unselectable = "on"; - if (editor.getDragDelay()) { - if (useragent.isWebKit) { - self.cancelDrag = true; - var mouseTarget = editor.container; - mouseTarget.draggable = true; - } - this.setState("dragWait"); - } else { - this.startDrag(); - } - this.captureMouse(e, this.onMouseDrag.bind(this)); - e.defaultPrevented = true; - } - }; - -}).call(DragdropHandler.prototype); - - -function calcDistance(ax, ay, bx, by) { - return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2)); -} - -exports.DragdropHandler = DragdropHandler; - -}); - -define('ace/config', ['require', 'exports', 'module' , 'ace/lib/lang', 'ace/lib/oop', 'ace/lib/net', 'ace/lib/event_emitter'], function(require, exports, module) { -"no use strict"; - -var lang = require("./lib/lang"); -var oop = require("./lib/oop"); -var net = require("./lib/net"); -var EventEmitter = require("./lib/event_emitter").EventEmitter; - -var global = (function() { - return this; -})(); - -var options = { - packaged: false, - workerPath: null, - modePath: null, - themePath: null, - basePath: "", - suffix: ".js", - $moduleUrls: {} -}; - -exports.get = function(key) { - if (!options.hasOwnProperty(key)) - throw new Error("Unknown config key: " + key); - - return options[key]; -}; - -exports.set = function(key, value) { - if (!options.hasOwnProperty(key)) - throw new Error("Unknown config key: " + key); - - options[key] = value; -}; - -exports.all = function() { - return lang.copyObject(options); -}; -oop.implement(exports, EventEmitter); - -exports.moduleUrl = function(name, component) { - if (options.$moduleUrls[name]) - return options.$moduleUrls[name]; - - var parts = name.split("/"); - component = component || parts[parts.length - 2] || ""; - var sep = component == "snippets" ? "/" : "-"; - var base = parts[parts.length - 1]; - if (sep == "-") { - var re = new RegExp("^" + component + "[\\-_]|[\\-_]" + component + "$", "g"); - base = base.replace(re, ""); - } - - if ((!base || base == component) && parts.length > 1) - base = parts[parts.length - 2]; - var path = options[component + "Path"]; - if (path == null) { - path = options.basePath; - } else if (sep == "/") { - component = sep = ""; - } - if (path && path.slice(-1) != "/") - path += "/"; - return path + component + sep + base + this.get("suffix"); -}; - -exports.setModuleUrl = function(name, subst) { - return options.$moduleUrls[name] = subst; -}; - -exports.$loading = {}; -exports.loadModule = function(moduleName, onLoad) { - var module, moduleType; - if (Array.isArray(moduleName)) { - moduleType = moduleName[0]; - moduleName = moduleName[1]; - } - - try { - module = require(moduleName); - } catch (e) {} - if (module && !exports.$loading[moduleName]) - return onLoad && onLoad(module); - - if (!exports.$loading[moduleName]) - exports.$loading[moduleName] = []; - - exports.$loading[moduleName].push(onLoad); - - if (exports.$loading[moduleName].length > 1) - return; - - var afterLoad = function() { - require([moduleName], function(module) { - exports._emit("load.module", {name: moduleName, module: module}); - var listeners = exports.$loading[moduleName]; - exports.$loading[moduleName] = null; - listeners.forEach(function(onLoad) { - onLoad && onLoad(module); - }); - }); - }; - - if (!exports.get("packaged")) - return afterLoad(); - net.loadScript(exports.moduleUrl(moduleName, moduleType), afterLoad); -}; -exports.init = function() { - options.packaged = require.packaged || module.packaged || (global.define && define.packaged); - - if (!global.document) - return ""; - - var scriptOptions = {}; - var scriptUrl = ""; - - var scripts = document.getElementsByTagName("script"); - for (var i=0; i i) { - this.$docRowCache.splice(i, l); - this.$screenRowCache.splice(i, l); - } - }; - - this.$getRowCacheIndex = function(cacheArray, val) { - var low = 0; - var hi = cacheArray.length - 1; - - while (low <= hi) { - var mid = (low + hi) >> 1; - var c = cacheArray[mid]; - - if (val > c) - low = mid + 1; - else if (val < c) - hi = mid - 1; - else - return mid; - } - - return low -1; - }; - - this.resetCaches = function() { - this.$modified = true; - this.$wrapData = []; - this.$rowLengthCache = []; - this.$resetRowCache(0); - if (this.bgTokenizer) - this.bgTokenizer.start(0); - }; - - this.onChangeFold = function(e) { - var fold = e.data; - this.$resetRowCache(fold.start.row); - }; - - this.onChange = function(e) { - var delta = e.data; - this.$modified = true; - - this.$resetRowCache(delta.range.start.row); - - var removedFolds = this.$updateInternalDataOnChange(e); - if (!this.$fromUndo && this.$undoManager && !delta.ignore) { - this.$deltasDoc.push(delta); - if (removedFolds && removedFolds.length != 0) { - this.$deltasFold.push({ - action: "removeFolds", - folds: removedFolds - }); - } - - this.$informUndoManager.schedule(); - } - - this.bgTokenizer.$updateOnChange(delta); - this._emit("change", e); - }; - this.setValue = function(text) { - this.doc.setValue(text); - this.selection.moveCursorTo(0, 0); - this.selection.clearSelection(); - - this.$resetRowCache(0); - this.$deltas = []; - this.$deltasDoc = []; - this.$deltasFold = []; - this.getUndoManager().reset(); - }; - this.getValue = - this.toString = function() { - return this.doc.getValue(); - }; - this.getSelection = function() { - return this.selection; - }; - this.getState = function(row) { - return this.bgTokenizer.getState(row); - }; - this.getTokens = function(row) { - return this.bgTokenizer.getTokens(row); - }; - this.getTokenAt = function(row, column) { - var tokens = this.bgTokenizer.getTokens(row); - var token, c = 0; - if (column == null) { - i = tokens.length - 1; - c = this.getLine(row).length; - } else { - for (var i = 0; i < tokens.length; i++) { - c += tokens[i].value.length; - if (c >= column) - break; - } - } - token = tokens[i]; - if (!token) - return null; - token.index = i; - token.start = c - token.value.length; - return token; - }; - this.setUndoManager = function(undoManager) { - this.$undoManager = undoManager; - this.$deltas = []; - this.$deltasDoc = []; - this.$deltasFold = []; - - if (this.$informUndoManager) - this.$informUndoManager.cancel(); - - if (undoManager) { - var self = this; - - this.$syncInformUndoManager = function() { - self.$informUndoManager.cancel(); - - if (self.$deltasFold.length) { - self.$deltas.push({ - group: "fold", - deltas: self.$deltasFold - }); - self.$deltasFold = []; - } - - if (self.$deltasDoc.length) { - self.$deltas.push({ - group: "doc", - deltas: self.$deltasDoc - }); - self.$deltasDoc = []; - } - - if (self.$deltas.length > 0) { - undoManager.execute({ - action: "aceupdate", - args: [self.$deltas, self], - merge: self.mergeUndoDeltas - }); - } - self.mergeUndoDeltas = false; - self.$deltas = []; - } - this.$informUndoManager = lang.delayedCall(this.$syncInformUndoManager); - } - }; - this.markUndoGroup = function() { - if (this.$syncInformUndoManager) - this.$syncInformUndoManager(); - }; - - this.$defaultUndoManager = { - undo: function() {}, - redo: function() {}, - reset: function() {} - }; - this.getUndoManager = function() { - return this.$undoManager || this.$defaultUndoManager; - }; - this.getTabString = function() { - if (this.getUseSoftTabs()) { - return lang.stringRepeat(" ", this.getTabSize()); - } else { - return "\t"; - } - }; - this.setUseSoftTabs = function(val) { - this.setOption("useSoftTabs", val); - }; - this.getUseSoftTabs = function() { - return this.$useSoftTabs && !this.$mode.$indentWithTabs; - }; - this.setTabSize = function(tabSize) { - this.setOption("tabSize", tabSize) - }; - this.getTabSize = function() { - return this.$tabSize; - }; - this.isTabStop = function(position) { - return this.$useSoftTabs && (position.column % this.$tabSize == 0); - }; - - this.$overwrite = false; - this.setOverwrite = function(overwrite) { - this.setOption("overwrite", overwrite) - }; - this.getOverwrite = function() { - return this.$overwrite; - }; - this.toggleOverwrite = function() { - this.setOverwrite(!this.$overwrite); - }; - this.addGutterDecoration = function(row, className) { - if (!this.$decorations[row]) - this.$decorations[row] = ""; - this.$decorations[row] += " " + className; - this._emit("changeBreakpoint", {}); - }; - this.removeGutterDecoration = function(row, className) { - this.$decorations[row] = (this.$decorations[row] || "").replace(" " + className, ""); - this._emit("changeBreakpoint", {}); - }; - this.getBreakpoints = function() { - return this.$breakpoints; - }; - this.setBreakpoints = function(rows) { - this.$breakpoints = []; - for (var i=0; i 0) - inToken = !!line.charAt(column - 1).match(this.tokenRe); - - if (!inToken) - inToken = !!line.charAt(column).match(this.tokenRe); - - if (inToken) - var re = this.tokenRe; - else if (/^\s+$/.test(line.slice(column-1, column+1))) - var re = /\s/; - else - var re = this.nonTokenRe; - - var start = column; - if (start > 0) { - do { - start--; - } - while (start >= 0 && line.charAt(start).match(re)); - start++; - } - - var end = column; - while (end < line.length && line.charAt(end).match(re)) { - end++; - } - - return new Range(row, start, row, end); - }; - this.getAWordRange = function(row, column) { - var wordRange = this.getWordRange(row, column); - var line = this.getLine(wordRange.end.row); - - while (line.charAt(wordRange.end.column).match(/[ \t]/)) { - wordRange.end.column += 1; - } - return wordRange; - }; - this.setNewLineMode = function(newLineMode) { - this.doc.setNewLineMode(newLineMode); - }; - this.getNewLineMode = function() { - return this.doc.getNewLineMode(); - }; - this.setUseWorker = function(useWorker) { this.setOption("useWorker", useWorker); }; - this.getUseWorker = function() { return this.$useWorker; }; - this.onReloadTokenizer = function(e) { - var rows = e.data; - this.bgTokenizer.start(rows.first); - this._emit("tokenizerUpdate", e); - }; - - this.$modes = {}; - this.$mode = null; - this.$modeId = null; - this.setMode = function(mode, cb) { - if (mode && typeof mode === "object") { - if (mode.getTokenizer) - return this.$onChangeMode(mode); - var options = mode; - var path = options.path; - } else { - path = mode || "ace/mode/text"; - } - if (!this.$modes["ace/mode/text"]) - this.$modes["ace/mode/text"] = new TextMode(); - - if (this.$modes[path] && !options) { - this.$onChangeMode(this.$modes[path]); - cb && cb(); - return; - } - this.$modeId = path; - config.loadModule(["mode", path], function(m) { - if (this.$modeId !== path) - return cb && cb(); - if (this.$modes[path] && !options) - return this.$onChangeMode(this.$modes[path]); - if (m && m.Mode) { - m = new m.Mode(options); - if (!options) { - this.$modes[path] = m; - m.$id = path; - } - this.$onChangeMode(m); - cb && cb(); - } - }.bind(this)); - if (!this.$mode) - this.$onChangeMode(this.$modes["ace/mode/text"], true); - }; - - this.$onChangeMode = function(mode, $isPlaceholder) { - if (!$isPlaceholder) - this.$modeId = mode.$id; - if (this.$mode === mode) - return; - - this.$mode = mode; - - this.$stopWorker(); - - if (this.$useWorker) - this.$startWorker(); - - var tokenizer = mode.getTokenizer(); - - if(tokenizer.addEventListener !== undefined) { - var onReloadTokenizer = this.onReloadTokenizer.bind(this); - tokenizer.addEventListener("update", onReloadTokenizer); - } - - if (!this.bgTokenizer) { - this.bgTokenizer = new BackgroundTokenizer(tokenizer); - var _self = this; - this.bgTokenizer.addEventListener("update", function(e) { - _self._emit("tokenizerUpdate", e); - }); - } else { - this.bgTokenizer.setTokenizer(tokenizer); - } - - this.bgTokenizer.setDocument(this.getDocument()); - - this.tokenRe = mode.tokenRe; - this.nonTokenRe = mode.nonTokenRe; - - this.$options.wrapMethod.set.call(this, this.$wrapMethod); - - if (!$isPlaceholder) { - this.$setFolding(mode.foldingRules); - this._emit("changeMode"); - this.bgTokenizer.start(0); - } - }; - - - this.$stopWorker = function() { - if (this.$worker) - this.$worker.terminate(); - - this.$worker = null; - }; - - this.$startWorker = function() { - if (typeof Worker !== "undefined" && !require.noWorker) { - try { - this.$worker = this.$mode.createWorker(this); - } catch (e) { - console.log("Could not load worker"); - console.log(e); - this.$worker = null; - } - } - else - this.$worker = null; - }; - this.getMode = function() { - return this.$mode; - }; - - this.$scrollTop = 0; - this.setScrollTop = function(scrollTop) { - if (this.$scrollTop === scrollTop || isNaN(scrollTop)) - return; - - this.$scrollTop = scrollTop; - this._signal("changeScrollTop", scrollTop); - }; - this.getScrollTop = function() { - return this.$scrollTop; - }; - - this.$scrollLeft = 0; - this.setScrollLeft = function(scrollLeft) { - if (this.$scrollLeft === scrollLeft || isNaN(scrollLeft)) - return; - - this.$scrollLeft = scrollLeft; - this._signal("changeScrollLeft", scrollLeft); - }; - this.getScrollLeft = function() { - return this.$scrollLeft; - }; - this.getScreenWidth = function() { - this.$computeWidth(); - return this.screenWidth; - }; - - this.$computeWidth = function(force) { - if (this.$modified || force) { - this.$modified = false; - - if (this.$useWrapMode) - return this.screenWidth = this.$wrapLimit; - - var lines = this.doc.getAllLines(); - var cache = this.$rowLengthCache; - var longestScreenLine = 0; - var foldIndex = 0; - var foldLine = this.$foldData[foldIndex]; - var foldStart = foldLine ? foldLine.start.row : Infinity; - var len = lines.length; - - for (var i = 0; i < len; i++) { - if (i > foldStart) { - i = foldLine.end.row + 1; - if (i >= len) - break; - foldLine = this.$foldData[foldIndex++]; - foldStart = foldLine ? foldLine.start.row : Infinity; - } - - if (cache[i] == null) - cache[i] = this.$getStringScreenWidth(lines[i])[0]; - - if (cache[i] > longestScreenLine) - longestScreenLine = cache[i]; - } - this.screenWidth = longestScreenLine; - } - }; - this.getLine = function(row) { - return this.doc.getLine(row); - }; - this.getLines = function(firstRow, lastRow) { - return this.doc.getLines(firstRow, lastRow); - }; - this.getLength = function() { - return this.doc.getLength(); - }; - this.getTextRange = function(range) { - return this.doc.getTextRange(range || this.selection.getRange()); - }; - this.insert = function(position, text) { - return this.doc.insert(position, text); - }; - this.remove = function(range) { - return this.doc.remove(range); - }; - this.undoChanges = function(deltas, dontSelect) { - if (!deltas.length) - return; - - this.$fromUndo = true; - var lastUndoRange = null; - for (var i = deltas.length - 1; i != -1; i--) { - var delta = deltas[i]; - if (delta.group == "doc") { - this.doc.revertDeltas(delta.deltas); - lastUndoRange = - this.$getUndoSelection(delta.deltas, true, lastUndoRange); - } else { - delta.deltas.forEach(function(foldDelta) { - this.addFolds(foldDelta.folds); - }, this); - } - } - this.$fromUndo = false; - lastUndoRange && - this.$undoSelect && - !dontSelect && - this.selection.setSelectionRange(lastUndoRange); - return lastUndoRange; - }; - this.redoChanges = function(deltas, dontSelect) { - if (!deltas.length) - return; - - this.$fromUndo = true; - var lastUndoRange = null; - for (var i = 0; i < deltas.length; i++) { - var delta = deltas[i]; - if (delta.group == "doc") { - this.doc.applyDeltas(delta.deltas); - lastUndoRange = - this.$getUndoSelection(delta.deltas, false, lastUndoRange); - } - } - this.$fromUndo = false; - lastUndoRange && - this.$undoSelect && - !dontSelect && - this.selection.setSelectionRange(lastUndoRange); - return lastUndoRange; - }; - this.setUndoSelect = function(enable) { - this.$undoSelect = enable; - }; - - this.$getUndoSelection = function(deltas, isUndo, lastUndoRange) { - function isInsert(delta) { - var insert = - delta.action === "insertText" || delta.action === "insertLines"; - return isUndo ? !insert : insert; - } - - var delta = deltas[0]; - var range, point; - var lastDeltaIsInsert = false; - if (isInsert(delta)) { - range = Range.fromPoints(delta.range.start, delta.range.end); - lastDeltaIsInsert = true; - } else { - range = Range.fromPoints(delta.range.start, delta.range.start); - lastDeltaIsInsert = false; - } - - for (var i = 1; i < deltas.length; i++) { - delta = deltas[i]; - if (isInsert(delta)) { - point = delta.range.start; - if (range.compare(point.row, point.column) == -1) { - range.setStart(delta.range.start); - } - point = delta.range.end; - if (range.compare(point.row, point.column) == 1) { - range.setEnd(delta.range.end); - } - lastDeltaIsInsert = true; - } else { - point = delta.range.start; - if (range.compare(point.row, point.column) == -1) { - range = - Range.fromPoints(delta.range.start, delta.range.start); - } - lastDeltaIsInsert = false; - } - } - if (lastUndoRange != null) { - if (Range.comparePoints(lastUndoRange.start, range.start) == 0) { - lastUndoRange.start.column += range.end.column - range.start.column; - lastUndoRange.end.column += range.end.column - range.start.column; - } - - var cmp = lastUndoRange.compareRange(range); - if (cmp == 1) { - range.setStart(lastUndoRange.start); - } else if (cmp == -1) { - range.setEnd(lastUndoRange.end); - } - } - - return range; - }; - this.replace = function(range, text) { - return this.doc.replace(range, text); - }; - this.moveText = function(fromRange, toPosition, copy) { - var text = this.getTextRange(fromRange); - var folds = this.getFoldsInRange(fromRange); - - var toRange = Range.fromPoints(toPosition, toPosition); - if (!copy) { - this.remove(fromRange); - var rowDiff = fromRange.start.row - fromRange.end.row; - var collDiff = rowDiff ? -fromRange.end.column : fromRange.start.column - fromRange.end.column; - if (collDiff) { - if (toRange.start.row == fromRange.end.row && toRange.start.column > fromRange.end.column) - toRange.start.column += collDiff; - if (toRange.end.row == fromRange.end.row && toRange.end.column > fromRange.end.column) - toRange.end.column += collDiff; - } - if (rowDiff && toRange.start.row >= fromRange.end.row) { - toRange.start.row += rowDiff; - toRange.end.row += rowDiff; - } - } - - toRange.end = this.insert(toRange.start, text); - if (folds.length) { - var oldStart = fromRange.start; - var newStart = toRange.start; - var rowDiff = newStart.row - oldStart.row; - var collDiff = newStart.column - oldStart.column; - this.addFolds(folds.map(function(x) { - x = x.clone(); - if (x.start.row == oldStart.row) - x.start.column += collDiff; - if (x.end.row == oldStart.row) - x.end.column += collDiff; - x.start.row += rowDiff; - x.end.row += rowDiff; - return x; - })); - } - - return toRange; - }; - this.indentRows = function(startRow, endRow, indentString) { - indentString = indentString.replace(/\t/g, this.getTabString()); - for (var row=startRow; row<=endRow; row++) - this.insert({row: row, column:0}, indentString); - }; - this.outdentRows = function (range) { - var rowRange = range.collapseRows(); - var deleteRange = new Range(0, 0, 0, 0); - var size = this.getTabSize(); - - for (var i = rowRange.start.row; i <= rowRange.end.row; ++i) { - var line = this.getLine(i); - - deleteRange.start.row = i; - deleteRange.end.row = i; - for (var j = 0; j < size; ++j) - if (line.charAt(j) != ' ') - break; - if (j < size && line.charAt(j) == '\t') { - deleteRange.start.column = j; - deleteRange.end.column = j + 1; - } else { - deleteRange.start.column = 0; - deleteRange.end.column = j; - } - this.remove(deleteRange); - } - }; - - this.$moveLines = function(firstRow, lastRow, dir) { - firstRow = this.getRowFoldStart(firstRow); - lastRow = this.getRowFoldEnd(lastRow); - if (dir < 0) { - var row = this.getRowFoldStart(firstRow + dir); - if (row < 0) return 0; - var diff = row-firstRow; - } else if (dir > 0) { - var row = this.getRowFoldEnd(lastRow + dir); - if (row > this.doc.getLength()-1) return 0; - var diff = row-lastRow; - } else { - firstRow = this.$clipRowToDocument(firstRow); - lastRow = this.$clipRowToDocument(lastRow); - var diff = lastRow - firstRow + 1; - } - - var range = new Range(firstRow, 0, lastRow, Number.MAX_VALUE); - var folds = this.getFoldsInRange(range).map(function(x){ - x = x.clone(); - x.start.row += diff; - x.end.row += diff; - return x; - }); - - var lines = dir == 0 - ? this.doc.getLines(firstRow, lastRow) - : this.doc.removeLines(firstRow, lastRow); - this.doc.insertLines(firstRow+diff, lines); - folds.length && this.addFolds(folds); - return diff; - }; - this.moveLinesUp = function(firstRow, lastRow) { - return this.$moveLines(firstRow, lastRow, -1); - }; - this.moveLinesDown = function(firstRow, lastRow) { - return this.$moveLines(firstRow, lastRow, 1); - }; - this.duplicateLines = function(firstRow, lastRow) { - return this.$moveLines(firstRow, lastRow, 0); - }; - - - this.$clipRowToDocument = function(row) { - return Math.max(0, Math.min(row, this.doc.getLength()-1)); - }; - - this.$clipColumnToRow = function(row, column) { - if (column < 0) - return 0; - return Math.min(this.doc.getLine(row).length, column); - }; - - - this.$clipPositionToDocument = function(row, column) { - column = Math.max(0, column); - - if (row < 0) { - row = 0; - column = 0; - } else { - var len = this.doc.getLength(); - if (row >= len) { - row = len - 1; - column = this.doc.getLine(len-1).length; - } else { - column = Math.min(this.doc.getLine(row).length, column); - } - } - - return { - row: row, - column: column - }; - }; - - this.$clipRangeToDocument = function(range) { - if (range.start.row < 0) { - range.start.row = 0; - range.start.column = 0; - } else { - range.start.column = this.$clipColumnToRow( - range.start.row, - range.start.column - ); - } - - var len = this.doc.getLength() - 1; - if (range.end.row > len) { - range.end.row = len; - range.end.column = this.doc.getLine(len).length; - } else { - range.end.column = this.$clipColumnToRow( - range.end.row, - range.end.column - ); - } - return range; - }; - this.$wrapLimit = 80; - this.$useWrapMode = false; - this.$wrapLimitRange = { - min : null, - max : null - }; - this.setUseWrapMode = function(useWrapMode) { - if (useWrapMode != this.$useWrapMode) { - this.$useWrapMode = useWrapMode; - this.$modified = true; - this.$resetRowCache(0); - if (useWrapMode) { - var len = this.getLength(); - this.$wrapData = []; - for (var i = 0; i < len; i++) { - this.$wrapData.push([]); - } - this.$updateWrapData(0, len - 1); - } - - this._emit("changeWrapMode"); - } - }; - this.getUseWrapMode = function() { - return this.$useWrapMode; - }; - this.setWrapLimitRange = function(min, max) { - if (this.$wrapLimitRange.min !== min || this.$wrapLimitRange.max !== max) { - this.$wrapLimitRange = { - min: min, - max: max - }; - this.$modified = true; - this._emit("changeWrapMode"); - } - }; - this.adjustWrapLimit = function(desiredLimit, $printMargin) { - var limits = this.$wrapLimitRange - if (limits.max < 0) - limits = {min: $printMargin, max: $printMargin}; - var wrapLimit = this.$constrainWrapLimit(desiredLimit, limits.min, limits.max); - if (wrapLimit != this.$wrapLimit && wrapLimit > 1) { - this.$wrapLimit = wrapLimit; - this.$modified = true; - if (this.$useWrapMode) { - this.$updateWrapData(0, this.getLength() - 1); - this.$resetRowCache(0); - this._emit("changeWrapLimit"); - } - return true; - } - return false; - }; - - this.$constrainWrapLimit = function(wrapLimit, min, max) { - if (min) - wrapLimit = Math.max(min, wrapLimit); - - if (max) - wrapLimit = Math.min(max, wrapLimit); - - return wrapLimit; - }; - this.getWrapLimit = function() { - return this.$wrapLimit; - }; - this.setWrapLimit = function (limit) { - this.setWrapLimitRange(limit, limit); - }; - this.getWrapLimitRange = function() { - return { - min : this.$wrapLimitRange.min, - max : this.$wrapLimitRange.max - }; - }; - - this.$updateInternalDataOnChange = function(e) { - var useWrapMode = this.$useWrapMode; - var len; - var action = e.data.action; - var firstRow = e.data.range.start.row; - var lastRow = e.data.range.end.row; - var start = e.data.range.start; - var end = e.data.range.end; - var removedFolds = null; - - if (action.indexOf("Lines") != -1) { - if (action == "insertLines") { - lastRow = firstRow + (e.data.lines.length); - } else { - lastRow = firstRow; - } - len = e.data.lines ? e.data.lines.length : lastRow - firstRow; - } else { - len = lastRow - firstRow; - } - - this.$updating = true; - if (len != 0) { - if (action.indexOf("remove") != -1) { - this[useWrapMode ? "$wrapData" : "$rowLengthCache"].splice(firstRow, len); - - var foldLines = this.$foldData; - removedFolds = this.getFoldsInRange(e.data.range); - this.removeFolds(removedFolds); - - var foldLine = this.getFoldLine(end.row); - var idx = 0; - if (foldLine) { - foldLine.addRemoveChars(end.row, end.column, start.column - end.column); - foldLine.shiftRow(-len); - - var foldLineBefore = this.getFoldLine(firstRow); - if (foldLineBefore && foldLineBefore !== foldLine) { - foldLineBefore.merge(foldLine); - foldLine = foldLineBefore; - } - idx = foldLines.indexOf(foldLine) + 1; - } - - for (idx; idx < foldLines.length; idx++) { - var foldLine = foldLines[idx]; - if (foldLine.start.row >= end.row) { - foldLine.shiftRow(-len); - } - } - - lastRow = firstRow; - } else { - var args; - if (useWrapMode) { - args = [firstRow, 0]; - for (var i = 0; i < len; i++) args.push([]); - this.$wrapData.splice.apply(this.$wrapData, args); - } else { - args = Array(len); - args.unshift(firstRow, 0); - this.$rowLengthCache.splice.apply(this.$rowLengthCache, args); - } - var foldLines = this.$foldData; - var foldLine = this.getFoldLine(firstRow); - var idx = 0; - if (foldLine) { - var cmp = foldLine.range.compareInside(start.row, start.column) - if (cmp == 0) { - foldLine = foldLine.split(start.row, start.column); - foldLine.shiftRow(len); - foldLine.addRemoveChars( - lastRow, 0, end.column - start.column); - } else - if (cmp == -1) { - foldLine.addRemoveChars(firstRow, 0, end.column - start.column); - foldLine.shiftRow(len); - } - idx = foldLines.indexOf(foldLine) + 1; - } - - for (idx; idx < foldLines.length; idx++) { - var foldLine = foldLines[idx]; - if (foldLine.start.row >= firstRow) { - foldLine.shiftRow(len); - } - } - } - } else { - len = Math.abs(e.data.range.start.column - e.data.range.end.column); - if (action.indexOf("remove") != -1) { - removedFolds = this.getFoldsInRange(e.data.range); - this.removeFolds(removedFolds); - - len = -len; - } - var foldLine = this.getFoldLine(firstRow); - if (foldLine) { - foldLine.addRemoveChars(firstRow, start.column, len); - } - } - - if (useWrapMode && this.$wrapData.length != this.doc.getLength()) { - console.error("doc.getLength() and $wrapData.length have to be the same!"); - } - this.$updating = false; - - if (useWrapMode) - this.$updateWrapData(firstRow, lastRow); - else - this.$updateRowLengthCache(firstRow, lastRow); - - return removedFolds; - }; - - this.$updateRowLengthCache = function(firstRow, lastRow, b) { - this.$rowLengthCache[firstRow] = null; - this.$rowLengthCache[lastRow] = null; - }; - - this.$updateWrapData = function(firstRow, lastRow) { - var lines = this.doc.getAllLines(); - var tabSize = this.getTabSize(); - var wrapData = this.$wrapData; - var wrapLimit = this.$wrapLimit; - var tokens; - var foldLine; - - var row = firstRow; - lastRow = Math.min(lastRow, lines.length - 1); - while (row <= lastRow) { - foldLine = this.getFoldLine(row, foldLine); - if (!foldLine) { - tokens = this.$getDisplayTokens(lines[row]); - wrapData[row] = this.$computeWrapSplits(tokens, wrapLimit, tabSize); - row ++; - } else { - tokens = []; - foldLine.walk(function(placeholder, row, column, lastColumn) { - var walkTokens; - if (placeholder != null) { - walkTokens = this.$getDisplayTokens( - placeholder, tokens.length); - walkTokens[0] = PLACEHOLDER_START; - for (var i = 1; i < walkTokens.length; i++) { - walkTokens[i] = PLACEHOLDER_BODY; - } - } else { - walkTokens = this.$getDisplayTokens( - lines[row].substring(lastColumn, column), - tokens.length); - } - tokens = tokens.concat(walkTokens); - }.bind(this), - foldLine.end.row, - lines[foldLine.end.row].length + 1 - ); - - wrapData[foldLine.start.row] - = this.$computeWrapSplits(tokens, wrapLimit, tabSize); - row = foldLine.end.row + 1; - } - } - }; - var CHAR = 1, - CHAR_EXT = 2, - PLACEHOLDER_START = 3, - PLACEHOLDER_BODY = 4, - PUNCTUATION = 9, - SPACE = 10, - TAB = 11, - TAB_SPACE = 12; - - - this.$computeWrapSplits = function(tokens, wrapLimit) { - if (tokens.length == 0) { - return []; - } - - var splits = []; - var displayLength = tokens.length; - var lastSplit = 0, lastDocSplit = 0; - - var isCode = this.$wrapAsCode; - - function addSplit(screenPos) { - var displayed = tokens.slice(lastSplit, screenPos); - var len = displayed.length; - displayed.join(""). - replace(/12/g, function() { - len -= 1; - }). - replace(/2/g, function() { - len -= 1; - }); - - lastDocSplit += len; - splits.push(lastDocSplit); - lastSplit = screenPos; - } - - while (displayLength - lastSplit > wrapLimit) { - var split = lastSplit + wrapLimit; - if (tokens[split - 1] >= SPACE && tokens[split] >= SPACE) { - addSplit(split); - continue; - } - if (tokens[split] == PLACEHOLDER_START || tokens[split] == PLACEHOLDER_BODY) { - for (split; split != lastSplit - 1; split--) { - if (tokens[split] == PLACEHOLDER_START) { - break; - } - } - if (split > lastSplit) { - addSplit(split); - continue; - } - split = lastSplit + wrapLimit; - for (split; split < tokens.length; split++) { - if (tokens[split] != PLACEHOLDER_BODY) { - break; - } - } - if (split == tokens.length) { - break; // Breaks the while-loop. - } - addSplit(split); - continue; - } - var minSplit = Math.max(split - (isCode ? 10 : wrapLimit-(wrapLimit>>2)), lastSplit - 1); - while (split > minSplit && tokens[split] < PLACEHOLDER_START) { - split --; - } - if (isCode) { - while (split > minSplit && tokens[split] < PLACEHOLDER_START) { - split --; - } - while (split > minSplit && tokens[split] == PUNCTUATION) { - split --; - } - } else { - while (split > minSplit && tokens[split] < SPACE) { - split --; - } - } - if (split > minSplit) { - addSplit(++split); - continue; - } - split = lastSplit + wrapLimit; - addSplit(split); - } - return splits; - }; - this.$getDisplayTokens = function(str, offset) { - var arr = []; - var tabSize; - offset = offset || 0; - - for (var i = 0; i < str.length; i++) { - var c = str.charCodeAt(i); - if (c == 9) { - tabSize = this.getScreenTabSize(arr.length + offset); - arr.push(TAB); - for (var n = 1; n < tabSize; n++) { - arr.push(TAB_SPACE); - } - } - else if (c == 32) { - arr.push(SPACE); - } else if((c > 39 && c < 48) || (c > 57 && c < 64)) { - arr.push(PUNCTUATION); - } - else if (c >= 0x1100 && isFullWidth(c)) { - arr.push(CHAR, CHAR_EXT); - } else { - arr.push(CHAR); - } - } - return arr; - }; - this.$getStringScreenWidth = function(str, maxScreenColumn, screenColumn) { - if (maxScreenColumn == 0) - return [0, 0]; - if (maxScreenColumn == null) - maxScreenColumn = Infinity; - screenColumn = screenColumn || 0; - - var c, column; - for (column = 0; column < str.length; column++) { - c = str.charCodeAt(column); - if (c == 9) { - screenColumn += this.getScreenTabSize(screenColumn); - } - else if (c >= 0x1100 && isFullWidth(c)) { - screenColumn += 2; - } else { - screenColumn += 1; - } - if (screenColumn > maxScreenColumn) { - break; - } - } - - return [screenColumn, column]; - }; - this.getRowLength = function(row) { - if (!this.$useWrapMode || !this.$wrapData[row]) { - return 1; - } else { - return this.$wrapData[row].length + 1; - } - }; - this.getScreenLastRowColumn = function(screenRow) { - var pos = this.screenToDocumentPosition(screenRow, Number.MAX_VALUE); - return this.documentToScreenColumn(pos.row, pos.column); - }; - this.getDocumentLastRowColumn = function(docRow, docColumn) { - var screenRow = this.documentToScreenRow(docRow, docColumn); - return this.getScreenLastRowColumn(screenRow); - }; - this.getDocumentLastRowColumnPosition = function(docRow, docColumn) { - var screenRow = this.documentToScreenRow(docRow, docColumn); - return this.screenToDocumentPosition(screenRow, Number.MAX_VALUE / 10); - }; - this.getRowSplitData = function(row) { - if (!this.$useWrapMode) { - return undefined; - } else { - return this.$wrapData[row]; - } - }; - this.getScreenTabSize = function(screenColumn) { - return this.$tabSize - screenColumn % this.$tabSize; - }; - - - this.screenToDocumentRow = function(screenRow, screenColumn) { - return this.screenToDocumentPosition(screenRow, screenColumn).row; - }; - - - this.screenToDocumentColumn = function(screenRow, screenColumn) { - return this.screenToDocumentPosition(screenRow, screenColumn).column; - }; - this.screenToDocumentPosition = function(screenRow, screenColumn) { - if (screenRow < 0) - return {row: 0, column: 0}; - - var line; - var docRow = 0; - var docColumn = 0; - var column; - var row = 0; - var rowLength = 0; - - var rowCache = this.$screenRowCache; - var i = this.$getRowCacheIndex(rowCache, screenRow); - var l = rowCache.length; - if (l && i >= 0) { - var row = rowCache[i]; - var docRow = this.$docRowCache[i]; - var doCache = screenRow > rowCache[l - 1]; - } else { - var doCache = !l; - } - - var maxRow = this.getLength() - 1; - var foldLine = this.getNextFoldLine(docRow); - var foldStart = foldLine ? foldLine.start.row : Infinity; - - while (row <= screenRow) { - rowLength = this.getRowLength(docRow); - if (row + rowLength - 1 >= screenRow || docRow >= maxRow) { - break; - } else { - row += rowLength; - docRow++; - if (docRow > foldStart) { - docRow = foldLine.end.row+1; - foldLine = this.getNextFoldLine(docRow, foldLine); - foldStart = foldLine ? foldLine.start.row : Infinity; - } - } - - if (doCache) { - this.$docRowCache.push(docRow); - this.$screenRowCache.push(row); - } - } - - if (foldLine && foldLine.start.row <= docRow) { - line = this.getFoldDisplayLine(foldLine); - docRow = foldLine.start.row; - } else if (row + rowLength <= screenRow || docRow > maxRow) { - return { - row: maxRow, - column: this.getLine(maxRow).length - } - } else { - line = this.getLine(docRow); - foldLine = null; - } - - if (this.$useWrapMode) { - var splits = this.$wrapData[docRow]; - if (splits) { - column = splits[screenRow - row]; - if(screenRow > row && splits.length) { - docColumn = splits[screenRow - row - 1] || splits[splits.length - 1]; - line = line.substring(docColumn); - } - } - } - - docColumn += this.$getStringScreenWidth(line, screenColumn)[1]; - if (this.$useWrapMode && docColumn >= column) - docColumn = column - 1; - - if (foldLine) - return foldLine.idxToPosition(docColumn); - - return {row: docRow, column: docColumn}; - }; - this.documentToScreenPosition = function(docRow, docColumn) { - if (typeof docColumn === "undefined") - var pos = this.$clipPositionToDocument(docRow.row, docRow.column); - else - pos = this.$clipPositionToDocument(docRow, docColumn); - - docRow = pos.row; - docColumn = pos.column; - - var screenRow = 0; - var foldStartRow = null; - var fold = null; - fold = this.getFoldAt(docRow, docColumn, 1); - if (fold) { - docRow = fold.start.row; - docColumn = fold.start.column; - } - - var rowEnd, row = 0; - - - var rowCache = this.$docRowCache; - var i = this.$getRowCacheIndex(rowCache, docRow); - var l = rowCache.length; - if (l && i >= 0) { - var row = rowCache[i]; - var screenRow = this.$screenRowCache[i]; - var doCache = docRow > rowCache[l - 1]; - } else { - var doCache = !l; - } - - var foldLine = this.getNextFoldLine(row); - var foldStart = foldLine ?foldLine.start.row :Infinity; - - while (row < docRow) { - if (row >= foldStart) { - rowEnd = foldLine.end.row + 1; - if (rowEnd > docRow) - break; - foldLine = this.getNextFoldLine(rowEnd, foldLine); - foldStart = foldLine ?foldLine.start.row :Infinity; - } - else { - rowEnd = row + 1; - } - - screenRow += this.getRowLength(row); - row = rowEnd; - - if (doCache) { - this.$docRowCache.push(row); - this.$screenRowCache.push(screenRow); - } - } - var textLine = ""; - if (foldLine && row >= foldStart) { - textLine = this.getFoldDisplayLine(foldLine, docRow, docColumn); - foldStartRow = foldLine.start.row; - } else { - textLine = this.getLine(docRow).substring(0, docColumn); - foldStartRow = docRow; - } - if (this.$useWrapMode) { - var wrapRow = this.$wrapData[foldStartRow]; - var screenRowOffset = 0; - while (textLine.length >= wrapRow[screenRowOffset]) { - screenRow ++; - screenRowOffset++; - } - textLine = textLine.substring( - wrapRow[screenRowOffset - 1] || 0, textLine.length - ); - } - - return { - row: screenRow, - column: this.$getStringScreenWidth(textLine)[0] - }; - }; - this.documentToScreenColumn = function(row, docColumn) { - return this.documentToScreenPosition(row, docColumn).column; - }; - this.documentToScreenRow = function(docRow, docColumn) { - return this.documentToScreenPosition(docRow, docColumn).row; - }; - this.getScreenLength = function() { - var screenRows = 0; - var fold = null; - if (!this.$useWrapMode) { - screenRows = this.getLength(); - var foldData = this.$foldData; - for (var i = 0; i < foldData.length; i++) { - fold = foldData[i]; - screenRows -= fold.end.row - fold.start.row; - } - } else { - var lastRow = this.$wrapData.length; - var row = 0, i = 0; - var fold = this.$foldData[i++]; - var foldStart = fold ? fold.start.row :Infinity; - - while (row < lastRow) { - screenRows += this.$wrapData[row].length + 1; - row ++; - if (row > foldStart) { - row = fold.end.row+1; - fold = this.$foldData[i++]; - foldStart = fold ?fold.start.row :Infinity; - } - } - } - - return screenRows; - }; - function isFullWidth(c) { - if (c < 0x1100) - return false; - return c >= 0x1100 && c <= 0x115F || - c >= 0x11A3 && c <= 0x11A7 || - c >= 0x11FA && c <= 0x11FF || - c >= 0x2329 && c <= 0x232A || - c >= 0x2E80 && c <= 0x2E99 || - c >= 0x2E9B && c <= 0x2EF3 || - c >= 0x2F00 && c <= 0x2FD5 || - c >= 0x2FF0 && c <= 0x2FFB || - c >= 0x3000 && c <= 0x303E || - c >= 0x3041 && c <= 0x3096 || - c >= 0x3099 && c <= 0x30FF || - c >= 0x3105 && c <= 0x312D || - c >= 0x3131 && c <= 0x318E || - c >= 0x3190 && c <= 0x31BA || - c >= 0x31C0 && c <= 0x31E3 || - c >= 0x31F0 && c <= 0x321E || - c >= 0x3220 && c <= 0x3247 || - c >= 0x3250 && c <= 0x32FE || - c >= 0x3300 && c <= 0x4DBF || - c >= 0x4E00 && c <= 0xA48C || - c >= 0xA490 && c <= 0xA4C6 || - c >= 0xA960 && c <= 0xA97C || - c >= 0xAC00 && c <= 0xD7A3 || - c >= 0xD7B0 && c <= 0xD7C6 || - c >= 0xD7CB && c <= 0xD7FB || - c >= 0xF900 && c <= 0xFAFF || - c >= 0xFE10 && c <= 0xFE19 || - c >= 0xFE30 && c <= 0xFE52 || - c >= 0xFE54 && c <= 0xFE66 || - c >= 0xFE68 && c <= 0xFE6B || - c >= 0xFF01 && c <= 0xFF60 || - c >= 0xFFE0 && c <= 0xFFE6; - }; - -}).call(EditSession.prototype); - -require("./edit_session/folding").Folding.call(EditSession.prototype); -require("./edit_session/bracket_match").BracketMatch.call(EditSession.prototype); - - -config.defineOptions(EditSession.prototype, "session", { - wrap: { - set: function(value) { - if (!value || value == "off") - value = false; - else if (value == "free") - value = true; - else if (value == "printMargin") - value = -1; - else if (typeof value == "string") - value = parseInt(value, 10) || false; - - if (this.$wrap == value) - return; - if (!value) { - this.setUseWrapMode(false); - } else { - var col = typeof value == "number" ? value : null; - this.setWrapLimitRange(col, col); - this.setUseWrapMode(true); - } - this.$wrap = value; - }, - get: function() { - return this.getUseWrapMode() ? this.getWrapLimitRange().min || "free" : "off"; - }, - handlesSet: true - }, - wrapMethod: { - set: function(val) { - if (val == "auto") - this.$wrapAsCode = this.$mode.type != "text"; - else - this.$wrapAsCode = val != "text"; - }, - initialValue: "auto" - }, - firstLineNumber: { - set: function() {this._emit("changeBreakpoint");}, - initialValue: 1 - }, - useWorker: { - set: function(useWorker) { - this.$useWorker = useWorker; - - this.$stopWorker(); - if (useWorker) - this.$startWorker(); - }, - initialValue: true - }, - useSoftTabs: {initialValue: true}, - tabSize: { - set: function(tabSize) { - if (isNaN(tabSize) || this.$tabSize === tabSize) return; - - this.$modified = true; - this.$rowLengthCache = []; - this.$tabSize = tabSize; - this._emit("changeTabSize"); - }, - initialValue: 4, - handlesSet: true - }, - overwrite: { - set: function(val) {this._emit("changeOverwrite");}, - initialValue: false - }, - newLineMode: { - set: function(val) {this.doc.setNewLineMode(val)}, - get: function() {return this.doc.getNewLineMode()}, - handlesSet: true - } -}); - -exports.EditSession = EditSession; -}); - -define('ace/selection', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/lib/event_emitter', 'ace/range'], function(require, exports, module) { - - -var oop = require("./lib/oop"); -var lang = require("./lib/lang"); -var EventEmitter = require("./lib/event_emitter").EventEmitter; -var Range = require("./range").Range; -var Selection = function(session) { - this.session = session; - this.doc = session.getDocument(); - - this.clearSelection(); - this.lead = this.selectionLead = this.doc.createAnchor(0, 0); - this.anchor = this.selectionAnchor = this.doc.createAnchor(0, 0); - - var self = this; - this.lead.on("change", function(e) { - self._emit("changeCursor"); - if (!self.$isEmpty) - self._emit("changeSelection"); - if (!self.$keepDesiredColumnOnChange && e.old.column != e.value.column) - self.$desiredColumn = null; - }); - - this.selectionAnchor.on("change", function() { - if (!self.$isEmpty) - self._emit("changeSelection"); - }); -}; - -(function() { - - oop.implement(this, EventEmitter); - this.isEmpty = function() { - return (this.$isEmpty || ( - this.anchor.row == this.lead.row && - this.anchor.column == this.lead.column - )); - }; - this.isMultiLine = function() { - if (this.isEmpty()) { - return false; - } - - return this.getRange().isMultiLine(); - }; - this.getCursor = function() { - return this.lead.getPosition(); - }; - this.setSelectionAnchor = function(row, column) { - this.anchor.setPosition(row, column); - - if (this.$isEmpty) { - this.$isEmpty = false; - this._emit("changeSelection"); - } - }; - this.getSelectionAnchor = function() { - if (this.$isEmpty) - return this.getSelectionLead() - else - return this.anchor.getPosition(); - }; - this.getSelectionLead = function() { - return this.lead.getPosition(); - }; - this.shiftSelection = function(columns) { - if (this.$isEmpty) { - this.moveCursorTo(this.lead.row, this.lead.column + columns); - return; - }; - - var anchor = this.getSelectionAnchor(); - var lead = this.getSelectionLead(); - - var isBackwards = this.isBackwards(); - - if (!isBackwards || anchor.column !== 0) - this.setSelectionAnchor(anchor.row, anchor.column + columns); - - if (isBackwards || lead.column !== 0) { - this.$moveSelection(function() { - this.moveCursorTo(lead.row, lead.column + columns); - }); - } - }; - this.isBackwards = function() { - var anchor = this.anchor; - var lead = this.lead; - return (anchor.row > lead.row || (anchor.row == lead.row && anchor.column > lead.column)); - }; - this.getRange = function() { - var anchor = this.anchor; - var lead = this.lead; - - if (this.isEmpty()) - return Range.fromPoints(lead, lead); - - if (this.isBackwards()) { - return Range.fromPoints(lead, anchor); - } - else { - return Range.fromPoints(anchor, lead); - } - }; - this.clearSelection = function() { - if (!this.$isEmpty) { - this.$isEmpty = true; - this._emit("changeSelection"); - } - }; - this.selectAll = function() { - var lastRow = this.doc.getLength() - 1; - this.setSelectionAnchor(0, 0); - this.moveCursorTo(lastRow, this.doc.getLine(lastRow).length); - }; - this.setRange = - this.setSelectionRange = function(range, reverse) { - if (reverse) { - this.setSelectionAnchor(range.end.row, range.end.column); - this.selectTo(range.start.row, range.start.column); - } else { - this.setSelectionAnchor(range.start.row, range.start.column); - this.selectTo(range.end.row, range.end.column); - } - if (this.getRange().isEmpty()) - this.$isEmpty = true; - this.$desiredColumn = null; - }; - - this.$moveSelection = function(mover) { - var lead = this.lead; - if (this.$isEmpty) - this.setSelectionAnchor(lead.row, lead.column); - - mover.call(this); - }; - this.selectTo = function(row, column) { - this.$moveSelection(function() { - this.moveCursorTo(row, column); - }); - }; - this.selectToPosition = function(pos) { - this.$moveSelection(function() { - this.moveCursorToPosition(pos); - }); - }; - this.selectUp = function() { - this.$moveSelection(this.moveCursorUp); - }; - this.selectDown = function() { - this.$moveSelection(this.moveCursorDown); - }; - this.selectRight = function() { - this.$moveSelection(this.moveCursorRight); - }; - this.selectLeft = function() { - this.$moveSelection(this.moveCursorLeft); - }; - this.selectLineStart = function() { - this.$moveSelection(this.moveCursorLineStart); - }; - this.selectLineEnd = function() { - this.$moveSelection(this.moveCursorLineEnd); - }; - this.selectFileEnd = function() { - this.$moveSelection(this.moveCursorFileEnd); - }; - this.selectFileStart = function() { - this.$moveSelection(this.moveCursorFileStart); - }; - this.selectWordRight = function() { - this.$moveSelection(this.moveCursorWordRight); - }; - this.selectWordLeft = function() { - this.$moveSelection(this.moveCursorWordLeft); - }; - this.getWordRange = function(row, column) { - if (typeof column == "undefined") { - var cursor = row || this.lead; - row = cursor.row; - column = cursor.column; - } - return this.session.getWordRange(row, column); - }; - this.selectWord = function() { - this.setSelectionRange(this.getWordRange()); - }; - this.selectAWord = function() { - var cursor = this.getCursor(); - var range = this.session.getAWordRange(cursor.row, cursor.column); - this.setSelectionRange(range); - }; - - this.getLineRange = function(row, excludeLastChar) { - var rowStart = typeof row == "number" ? row : this.lead.row; - var rowEnd; - - var foldLine = this.session.getFoldLine(rowStart); - if (foldLine) { - rowStart = foldLine.start.row; - rowEnd = foldLine.end.row; - } else { - rowEnd = rowStart; - } - if (excludeLastChar === true) - return new Range(rowStart, 0, rowEnd, this.session.getLine(rowEnd).length); - else - return new Range(rowStart, 0, rowEnd + 1, 0); - }; - this.selectLine = function() { - this.setSelectionRange(this.getLineRange()); - }; - this.moveCursorUp = function() { - this.moveCursorBy(-1, 0); - }; - this.moveCursorDown = function() { - this.moveCursorBy(1, 0); - }; - this.moveCursorLeft = function() { - var cursor = this.lead.getPosition(), - fold; - - if (fold = this.session.getFoldAt(cursor.row, cursor.column, -1)) { - this.moveCursorTo(fold.start.row, fold.start.column); - } else if (cursor.column == 0) { - if (cursor.row > 0) { - this.moveCursorTo(cursor.row - 1, this.doc.getLine(cursor.row - 1).length); - } - } - else { - var tabSize = this.session.getTabSize(); - if (this.session.isTabStop(cursor) && this.doc.getLine(cursor.row).slice(cursor.column-tabSize, cursor.column).split(" ").length-1 == tabSize) - this.moveCursorBy(0, -tabSize); - else - this.moveCursorBy(0, -1); - } - }; - this.moveCursorRight = function() { - var cursor = this.lead.getPosition(), - fold; - if (fold = this.session.getFoldAt(cursor.row, cursor.column, 1)) { - this.moveCursorTo(fold.end.row, fold.end.column); - } - else if (this.lead.column == this.doc.getLine(this.lead.row).length) { - if (this.lead.row < this.doc.getLength() - 1) { - this.moveCursorTo(this.lead.row + 1, 0); - } - } - else { - var tabSize = this.session.getTabSize(); - var cursor = this.lead; - if (this.session.isTabStop(cursor) && this.doc.getLine(cursor.row).slice(cursor.column, cursor.column+tabSize).split(" ").length-1 == tabSize) - this.moveCursorBy(0, tabSize); - else - this.moveCursorBy(0, 1); - } - }; - this.moveCursorLineStart = function() { - var row = this.lead.row; - var column = this.lead.column; - var screenRow = this.session.documentToScreenRow(row, column); - var firstColumnPosition = this.session.screenToDocumentPosition(screenRow, 0); - var beforeCursor = this.session.getDisplayLine( - row, null, firstColumnPosition.row, - firstColumnPosition.column - ); - - var leadingSpace = beforeCursor.match(/^\s*/); - if (leadingSpace[0].length != column && !this.session.$useEmacsStyleLineStart) - firstColumnPosition.column += leadingSpace[0].length; - this.moveCursorToPosition(firstColumnPosition); - }; - this.moveCursorLineEnd = function() { - var lead = this.lead; - var lineEnd = this.session.getDocumentLastRowColumnPosition(lead.row, lead.column); - if (this.lead.column == lineEnd.column) { - var line = this.session.getLine(lineEnd.row); - if (lineEnd.column == line.length) { - var textEnd = line.search(/\s+$/); - if (textEnd > 0) - lineEnd.column = textEnd; - } - } - - this.moveCursorTo(lineEnd.row, lineEnd.column); - }; - this.moveCursorFileEnd = function() { - var row = this.doc.getLength() - 1; - var column = this.doc.getLine(row).length; - this.moveCursorTo(row, column); - }; - this.moveCursorFileStart = function() { - this.moveCursorTo(0, 0); - }; - this.moveCursorLongWordRight = function() { - var row = this.lead.row; - var column = this.lead.column; - var line = this.doc.getLine(row); - var rightOfCursor = line.substring(column); - - var match; - this.session.nonTokenRe.lastIndex = 0; - this.session.tokenRe.lastIndex = 0; - var fold = this.session.getFoldAt(row, column, 1); - if (fold) { - this.moveCursorTo(fold.end.row, fold.end.column); - return; - } - if (match = this.session.nonTokenRe.exec(rightOfCursor)) { - column += this.session.nonTokenRe.lastIndex; - this.session.nonTokenRe.lastIndex = 0; - rightOfCursor = line.substring(column); - } - if (column >= line.length) { - this.moveCursorTo(row, line.length); - this.moveCursorRight(); - if (row < this.doc.getLength() - 1) - this.moveCursorWordRight(); - return; - } - if (match = this.session.tokenRe.exec(rightOfCursor)) { - column += this.session.tokenRe.lastIndex; - this.session.tokenRe.lastIndex = 0; - } - - this.moveCursorTo(row, column); - }; - this.moveCursorLongWordLeft = function() { - var row = this.lead.row; - var column = this.lead.column; - var fold; - if (fold = this.session.getFoldAt(row, column, -1)) { - this.moveCursorTo(fold.start.row, fold.start.column); - return; - } - - var str = this.session.getFoldStringAt(row, column, -1); - if (str == null) { - str = this.doc.getLine(row).substring(0, column) - } - - var leftOfCursor = lang.stringReverse(str); - var match; - this.session.nonTokenRe.lastIndex = 0; - this.session.tokenRe.lastIndex = 0; - if (match = this.session.nonTokenRe.exec(leftOfCursor)) { - column -= this.session.nonTokenRe.lastIndex; - leftOfCursor = leftOfCursor.slice(this.session.nonTokenRe.lastIndex); - this.session.nonTokenRe.lastIndex = 0; - } - if (column <= 0) { - this.moveCursorTo(row, 0); - this.moveCursorLeft(); - if (row > 0) - this.moveCursorWordLeft(); - return; - } - if (match = this.session.tokenRe.exec(leftOfCursor)) { - column -= this.session.tokenRe.lastIndex; - this.session.tokenRe.lastIndex = 0; - } - - this.moveCursorTo(row, column); - }; - - this.$shortWordEndIndex = function(rightOfCursor) { - var match, index = 0, ch; - var whitespaceRe = /\s/; - var tokenRe = this.session.tokenRe; - - tokenRe.lastIndex = 0; - if (match = this.session.tokenRe.exec(rightOfCursor)) { - index = this.session.tokenRe.lastIndex; - } else { - while ((ch = rightOfCursor[index]) && whitespaceRe.test(ch)) - index ++; - - if (index < 1) { - tokenRe.lastIndex = 0; - while ((ch = rightOfCursor[index]) && !tokenRe.test(ch)) { - tokenRe.lastIndex = 0; - index ++; - if (whitespaceRe.test(ch)) { - if (index > 2) { - index-- - break; - } else { - while ((ch = rightOfCursor[index]) && whitespaceRe.test(ch)) - index ++; - if (index > 2) - break - } - } - } - } - } - tokenRe.lastIndex = 0; - - return index; - }; - - this.moveCursorShortWordRight = function() { - var row = this.lead.row; - var column = this.lead.column; - var line = this.doc.getLine(row); - var rightOfCursor = line.substring(column); - - var fold = this.session.getFoldAt(row, column, 1); - if (fold) - return this.moveCursorTo(fold.end.row, fold.end.column); - - if (column == line.length) { - var l = this.doc.getLength(); - do { - row++; - rightOfCursor = this.doc.getLine(row) - } while (row < l && /^\s*$/.test(rightOfCursor)) - - if (!/^\s+/.test(rightOfCursor)) - rightOfCursor = "" - column = 0; - } - - var index = this.$shortWordEndIndex(rightOfCursor); - - this.moveCursorTo(row, column + index); - }; - - this.moveCursorShortWordLeft = function() { - var row = this.lead.row; - var column = this.lead.column; - - var fold; - if (fold = this.session.getFoldAt(row, column, -1)) - return this.moveCursorTo(fold.start.row, fold.start.column); - - var line = this.session.getLine(row).substring(0, column); - if (column == 0) { - do { - row--; - line = this.doc.getLine(row); - } while (row > 0 && /^\s*$/.test(line)) - - column = line.length; - if (!/\s+$/.test(line)) - line = "" - } - - var leftOfCursor = lang.stringReverse(line); - var index = this.$shortWordEndIndex(leftOfCursor); - - return this.moveCursorTo(row, column - index); - }; - - this.moveCursorWordRight = function() { - if (this.session.$selectLongWords) - this.moveCursorLongWordRight(); - else - this.moveCursorShortWordRight(); - }; - - this.moveCursorWordLeft = function() { - if (this.session.$selectLongWords) - this.moveCursorLongWordLeft(); - else - this.moveCursorShortWordLeft(); - }; - this.moveCursorBy = function(rows, chars) { - var screenPos = this.session.documentToScreenPosition( - this.lead.row, - this.lead.column - ); - - if (chars === 0) { - if (this.$desiredColumn) - screenPos.column = this.$desiredColumn; - else - this.$desiredColumn = screenPos.column; - } - - var docPos = this.session.screenToDocumentPosition(screenPos.row + rows, screenPos.column); - this.moveCursorTo(docPos.row, docPos.column + chars, chars === 0); - }; - this.moveCursorToPosition = function(position) { - this.moveCursorTo(position.row, position.column); - }; - this.moveCursorTo = function(row, column, keepDesiredColumn) { - var fold = this.session.getFoldAt(row, column, 1); - if (fold) { - row = fold.start.row; - column = fold.start.column; - } - - this.$keepDesiredColumnOnChange = true; - this.lead.setPosition(row, column); - this.$keepDesiredColumnOnChange = false; - - if (!keepDesiredColumn) - this.$desiredColumn = null; - }; - this.moveCursorToScreen = function(row, column, keepDesiredColumn) { - var pos = this.session.screenToDocumentPosition(row, column); - this.moveCursorTo(pos.row, pos.column, keepDesiredColumn); - }; - this.detach = function() { - this.lead.detach(); - this.anchor.detach(); - this.session = this.doc = null; - } - - this.fromOrientedRange = function(range) { - this.setSelectionRange(range, range.cursor == range.start); - this.$desiredColumn = range.desiredColumn || this.$desiredColumn; - } - - this.toOrientedRange = function(range) { - var r = this.getRange(); - if (range) { - range.start.column = r.start.column; - range.start.row = r.start.row; - range.end.column = r.end.column; - range.end.row = r.end.row; - } else { - range = r; - } - - range.cursor = this.isBackwards() ? range.start : range.end; - range.desiredColumn = this.$desiredColumn; - return range; - } - - this.toJSON = function() { - if (this.rangeCount) { - var data = this.ranges.map(function(r) { - var r1 = r.clone(); - r1.isBackwards = r.cursor == r.start; - return r1; - }); - } else { - var data = this.getRange(); - data.isBackwards = this.isBackwards(); - } - return data; - }; - - this.fromJSON = function(data) { - if (data.start == undefined) { - if (this.rangeList) { - this.toSingleRange(data[0]); - for (var i = data.length; i--; ) { - var r = Range.fromPoints(data[i].start, data[i].end); - if (data.isBackwards) - r.cursor = r.start; - this.addRange(r, true); - } - return; - } else - data = data[0]; - } - if (this.rangeList) - this.toSingleRange(data); - this.setSelectionRange(data, data.isBackwards); - }; - - this.isEqual = function(data) { - if ((data.length || this.rangeCount) && data.length != this.rangeCount) - return false; - if (!data.length || !this.ranges) - return this.getRange().isEqual(data); - - for (var i = this.ranges.length; i--; ) { - if (!this.ranges[i].isEqual(data[i])) - return false - } - return true; - } - -}).call(Selection.prototype); - -exports.Selection = Selection; -}); - -define('ace/range', ['require', 'exports', 'module' ], function(require, exports, module) { - -var comparePoints = function(p1, p2) { - return p1.row - p2.row || p1.column - p2.column; -}; -var Range = function(startRow, startColumn, endRow, endColumn) { - this.start = { - row: startRow, - column: startColumn - }; - - this.end = { - row: endRow, - column: endColumn - }; -}; - -(function() { - this.isEqual = function(range) { - return this.start.row === range.start.row && - this.end.row === range.end.row && - this.start.column === range.start.column && - this.end.column === range.end.column; - }; - this.toString = function() { - return ("Range: [" + this.start.row + "/" + this.start.column + - "] -> [" + this.end.row + "/" + this.end.column + "]"); - }; - - this.contains = function(row, column) { - return this.compare(row, column) == 0; - }; - this.compareRange = function(range) { - var cmp, - end = range.end, - start = range.start; - - cmp = this.compare(end.row, end.column); - if (cmp == 1) { - cmp = this.compare(start.row, start.column); - if (cmp == 1) { - return 2; - } else if (cmp == 0) { - return 1; - } else { - return 0; - } - } else if (cmp == -1) { - return -2; - } else { - cmp = this.compare(start.row, start.column); - if (cmp == -1) { - return -1; - } else if (cmp == 1) { - return 42; - } else { - return 0; - } - } - }; - this.comparePoint = function(p) { - return this.compare(p.row, p.column); - }; - this.containsRange = function(range) { - return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0; - }; - this.intersects = function(range) { - var cmp = this.compareRange(range); - return (cmp == -1 || cmp == 0 || cmp == 1); - }; - this.isEnd = function(row, column) { - return this.end.row == row && this.end.column == column; - }; - this.isStart = function(row, column) { - return this.start.row == row && this.start.column == column; - }; - this.setStart = function(row, column) { - if (typeof row == "object") { - this.start.column = row.column; - this.start.row = row.row; - } else { - this.start.row = row; - this.start.column = column; - } - }; - this.setEnd = function(row, column) { - if (typeof row == "object") { - this.end.column = row.column; - this.end.row = row.row; - } else { - this.end.row = row; - this.end.column = column; - } - }; - this.inside = function(row, column) { - if (this.compare(row, column) == 0) { - if (this.isEnd(row, column) || this.isStart(row, column)) { - return false; - } else { - return true; - } - } - return false; - }; - this.insideStart = function(row, column) { - if (this.compare(row, column) == 0) { - if (this.isEnd(row, column)) { - return false; - } else { - return true; - } - } - return false; - }; - this.insideEnd = function(row, column) { - if (this.compare(row, column) == 0) { - if (this.isStart(row, column)) { - return false; - } else { - return true; - } - } - return false; - }; - this.compare = function(row, column) { - if (!this.isMultiLine()) { - if (row === this.start.row) { - return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0); - }; - } - - if (row < this.start.row) - return -1; - - if (row > this.end.row) - return 1; - - if (this.start.row === row) - return column >= this.start.column ? 0 : -1; - - if (this.end.row === row) - return column <= this.end.column ? 0 : 1; - - return 0; - }; - this.compareStart = function(row, column) { - if (this.start.row == row && this.start.column == column) { - return -1; - } else { - return this.compare(row, column); - } - }; - this.compareEnd = function(row, column) { - if (this.end.row == row && this.end.column == column) { - return 1; - } else { - return this.compare(row, column); - } - }; - this.compareInside = function(row, column) { - if (this.end.row == row && this.end.column == column) { - return 1; - } else if (this.start.row == row && this.start.column == column) { - return -1; - } else { - return this.compare(row, column); - } - }; - this.clipRows = function(firstRow, lastRow) { - if (this.end.row > lastRow) - var end = {row: lastRow + 1, column: 0}; - else if (this.end.row < firstRow) - var end = {row: firstRow, column: 0}; - - if (this.start.row > lastRow) - var start = {row: lastRow + 1, column: 0}; - else if (this.start.row < firstRow) - var start = {row: firstRow, column: 0}; - - return Range.fromPoints(start || this.start, end || this.end); - }; - this.extend = function(row, column) { - var cmp = this.compare(row, column); - - if (cmp == 0) - return this; - else if (cmp == -1) - var start = {row: row, column: column}; - else - var end = {row: row, column: column}; - - return Range.fromPoints(start || this.start, end || this.end); - }; - - this.isEmpty = function() { - return (this.start.row === this.end.row && this.start.column === this.end.column); - }; - this.isMultiLine = function() { - return (this.start.row !== this.end.row); - }; - this.clone = function() { - return Range.fromPoints(this.start, this.end); - }; - this.collapseRows = function() { - if (this.end.column == 0) - return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0) - else - return new Range(this.start.row, 0, this.end.row, 0) - }; - this.toScreenRange = function(session) { - var screenPosStart = session.documentToScreenPosition(this.start); - var screenPosEnd = session.documentToScreenPosition(this.end); - - return new Range( - screenPosStart.row, screenPosStart.column, - screenPosEnd.row, screenPosEnd.column - ); - }; - this.moveBy = function(row, column) { - this.start.row += row; - this.start.column += column; - this.end.row += row; - this.end.column += column; - }; - -}).call(Range.prototype); -Range.fromPoints = function(start, end) { - return new Range(start.row, start.column, end.row, end.column); -}; -Range.comparePoints = comparePoints; - -Range.comparePoints = function(p1, p2) { - return p1.row - p2.row || p1.column - p2.column; -}; - - -exports.Range = Range; -}); - -define('ace/mode/text', ['require', 'exports', 'module' , 'ace/tokenizer', 'ace/mode/text_highlight_rules', 'ace/mode/behaviour', 'ace/unicode', 'ace/lib/lang', 'ace/token_iterator', 'ace/range'], function(require, exports, module) { - - -var Tokenizer = require("../tokenizer").Tokenizer; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var Behaviour = require("./behaviour").Behaviour; -var unicode = require("../unicode"); -var lang = require("../lib/lang"); -var TokenIterator = require("../token_iterator").TokenIterator; -var Range = require("../range").Range; - -var Mode = function() { - this.HighlightRules = TextHighlightRules; - this.$behaviour = new Behaviour(); -}; - -(function() { - - this.tokenRe = new RegExp("^[" - + unicode.packages.L - + unicode.packages.Mn + unicode.packages.Mc - + unicode.packages.Nd - + unicode.packages.Pc + "\\$_]+", "g" - ); - - this.nonTokenRe = new RegExp("^(?:[^" - + unicode.packages.L - + unicode.packages.Mn + unicode.packages.Mc - + unicode.packages.Nd - + unicode.packages.Pc + "\\$_]|\s])+", "g" - ); - - this.getTokenizer = function() { - if (!this.$tokenizer) { - this.$highlightRules = new this.HighlightRules(); - this.$tokenizer = new Tokenizer(this.$highlightRules.getRules()); - } - return this.$tokenizer; - }; - - this.lineCommentStart = ""; - this.blockComment = ""; - - this.toggleCommentLines = function(state, session, startRow, endRow) { - var doc = session.doc; - - var ignoreBlankLines = true; - var shouldRemove = true; - var minIndent = Infinity; - var tabSize = session.getTabSize(); - var insertAtTabStop = false; - - if (!this.lineCommentStart) { - if (!this.blockComment) - return false; - var lineCommentStart = this.blockComment.start; - var lineCommentEnd = this.blockComment.end; - var regexpStart = new RegExp("^(\\s*)(?:" + lang.escapeRegExp(lineCommentStart) + ")"); - var regexpEnd = new RegExp("(?:" + lang.escapeRegExp(lineCommentEnd) + ")\\s*$"); - - var comment = function(line, i) { - if (testRemove(line, i)) - return; - if (!ignoreBlankLines || /\S/.test(line)) { - doc.insertInLine({row: i, column: line.length}, lineCommentEnd); - doc.insertInLine({row: i, column: minIndent}, lineCommentStart); - } - }; - - var uncomment = function(line, i) { - var m; - if (m = line.match(regexpEnd)) - doc.removeInLine(i, line.length - m[0].length, line.length); - if (m = line.match(regexpStart)) - doc.removeInLine(i, m[1].length, m[0].length); - }; - - var testRemove = function(line, row) { - if (regexpStart.test(line)) - return true; - var tokens = session.getTokens(row); - for (var i = 0; i < tokens.length; i++) { - if (tokens[i].type === 'comment') - return true; - } - }; - } else { - if (Array.isArray(this.lineCommentStart)) { - var regexpStart = this.lineCommentStart.map(lang.escapeRegExp).join("|"); - var lineCommentStart = this.lineCommentStart[0]; - } else { - var regexpStart = lang.escapeRegExp(this.lineCommentStart); - var lineCommentStart = this.lineCommentStart; - } - regexpStart = new RegExp("^(\\s*)(?:" + regexpStart + ") ?"); - - insertAtTabStop = session.getUseSoftTabs(); - - var uncomment = function(line, i) { - var m = line.match(regexpStart); - if (!m) return; - var start = m[1].length, end = m[0].length; - if (!shouldInsertSpace(line, start, end) && m[0][end - 1] == " ") - end--; - doc.removeInLine(i, start, end); - }; - var commentWithSpace = lineCommentStart + " "; - var comment = function(line, i) { - if (!ignoreBlankLines || /\S/.test(line)) { - if (shouldInsertSpace(line, minIndent, minIndent)) - doc.insertInLine({row: i, column: minIndent}, commentWithSpace); - else - doc.insertInLine({row: i, column: minIndent}, lineCommentStart); - } - }; - var testRemove = function(line, i) { - return regexpStart.test(line); - }; - - var shouldInsertSpace = function(line, before, after) { - var spaces = 0; - while (before-- && line.charAt(before) == " ") - spaces++; - if (spaces % tabSize != 0) - return false; - var spaces = 0; - while (line.charAt(after++) == " ") - spaces++; - if (tabSize > 2) - return spaces % tabSize != tabSize - 1; - else - return spaces % tabSize == 0; - return true; - }; - } - - function iter(fun) { - for (var i = startRow; i <= endRow; i++) - fun(doc.getLine(i), i); - } - - - var minEmptyLength = Infinity; - iter(function(line, i) { - var indent = line.search(/\S/); - if (indent !== -1) { - if (indent < minIndent) - minIndent = indent; - if (shouldRemove && !testRemove(line, i)) - shouldRemove = false; - } else if (minEmptyLength > line.length) { - minEmptyLength = line.length; - } - }); - - if (minIndent == Infinity) { - minIndent = minEmptyLength; - ignoreBlankLines = false; - shouldRemove = false; - } - - if (insertAtTabStop && minIndent % tabSize != 0) - minIndent = Math.floor(minIndent / tabSize) * tabSize; - - iter(shouldRemove ? uncomment : comment); - }; - - this.toggleBlockComment = function(state, session, range, cursor) { - var comment = this.blockComment; - if (!comment) - return; - if (!comment.start && comment[0]) - comment = comment[0]; - - var iterator = new TokenIterator(session, cursor.row, cursor.column); - var token = iterator.getCurrentToken(); - - var sel = session.selection; - var initialRange = session.selection.toOrientedRange(); - var startRow, colDiff; - - if (token && /comment/.test(token.type)) { - var startRange, endRange; - while (token && /comment/.test(token.type)) { - var i = token.value.indexOf(comment.start); - if (i != -1) { - var row = iterator.getCurrentTokenRow(); - var column = iterator.getCurrentTokenColumn() + i; - startRange = new Range(row, column, row, column + comment.start.length); - break - } - token = iterator.stepBackward(); - }; - - var iterator = new TokenIterator(session, cursor.row, cursor.column); - var token = iterator.getCurrentToken(); - while (token && /comment/.test(token.type)) { - var i = token.value.indexOf(comment.end); - if (i != -1) { - var row = iterator.getCurrentTokenRow(); - var column = iterator.getCurrentTokenColumn() + i; - endRange = new Range(row, column, row, column + comment.end.length); - break; - } - token = iterator.stepForward(); - } - if (endRange) - session.remove(endRange); - if (startRange) { - session.remove(startRange); - startRow = startRange.start.row; - colDiff = -comment.start.length - } - } else { - colDiff = comment.start.length - startRow = range.start.row; - session.insert(range.end, comment.end); - session.insert(range.start, comment.start); - } - if (initialRange.start.row == startRow) - initialRange.start.column += colDiff; - if (initialRange.end.row == startRow) - initialRange.end.column += colDiff; - session.selection.fromOrientedRange(initialRange); - }; - - this.getNextLineIndent = function(state, line, tab) { - return this.$getIndent(line); - }; - - this.checkOutdent = function(state, line, input) { - return false; - }; - - this.autoOutdent = function(state, doc, row) { - }; - - this.$getIndent = function(line) { - return line.match(/^\s*/)[0]; - }; - - this.createWorker = function(session) { - return null; - }; - - this.createModeDelegates = function (mapping) { - this.$embeds = []; - this.$modes = {}; - for (var i in mapping) { - if (mapping[i]) { - this.$embeds.push(i); - this.$modes[i] = new mapping[i](); - } - } - - var delegations = ['toggleCommentLines', 'getNextLineIndent', 'checkOutdent', 'autoOutdent', 'transformAction', 'getCompletions']; - - for (var i = 0; i < delegations.length; i++) { - (function(scope) { - var functionName = delegations[i]; - var defaultHandler = scope[functionName]; - scope[delegations[i]] = function() { - return this.$delegator(functionName, arguments, defaultHandler); - } - } (this)); - } - }; - - this.$delegator = function(method, args, defaultHandler) { - var state = args[0]; - if (typeof state != "string") - state = state[0]; - for (var i = 0; i < this.$embeds.length; i++) { - if (!this.$modes[this.$embeds[i]]) continue; - - var split = state.split(this.$embeds[i]); - if (!split[0] && split[1]) { - args[0] = split[1]; - var mode = this.$modes[this.$embeds[i]]; - return mode[method].apply(mode, args); - } - } - var ret = defaultHandler.apply(this, args); - return defaultHandler ? ret : undefined; - }; - - this.transformAction = function(state, action, editor, session, param) { - if (this.$behaviour) { - var behaviours = this.$behaviour.getBehaviours(); - for (var key in behaviours) { - if (behaviours[key][action]) { - var ret = behaviours[key][action].apply(this, arguments); - if (ret) { - return ret; - } - } - } - } - }; - - this.getKeywords = function(append) { - if (!this.completionKeywords) { - var rules = this.$tokenizer.rules; - var completionKeywords = []; - for (var rule in rules) { - var ruleItr = rules[rule]; - for (var r = 0, l = ruleItr.length; r < l; r++) { - if (typeof ruleItr[r].token === "string") { - if (/keyword|support|storage/.test(ruleItr[r].token)) - completionKeywords.push(ruleItr[r].regex); - } - else if (typeof ruleItr[r].token === "object") { - for (var a = 0, aLength = ruleItr[r].token.length; a < aLength; a++) { - if (/keyword|support|storage/.test(ruleItr[r].token[a])) { - var rule = ruleItr[r].regex.match(/\(.+?\)/g)[a]; - completionKeywords.push(rule.substr(1, rule.length - 2)); - } - } - } - } - } - this.completionKeywords = completionKeywords; - } - if (!append) - return this.$keywordList; - return completionKeywords.concat(this.$keywordList || []); - }; - - this.$createKeywordList = function() { - if (!this.$highlightRules) - this.getTokenizer(); - return this.$keywordList = this.$highlightRules.$keywordList || []; - } - - this.getCompletions = function(state, session, pos, prefix) { - var keywords = this.$keywordList || this.$createKeywordList(); - return keywords.map(function(word) { - return { - name: word, - value: word, - score: 0, - meta: "keyword" - }; - }); - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/tokenizer', ['require', 'exports', 'module' ], function(require, exports, module) { -var MAX_TOKEN_COUNT = 1000; -var Tokenizer = function(rules) { - this.states = rules; - - this.regExps = {}; - this.matchMappings = {}; - for (var key in this.states) { - var state = this.states[key]; - var ruleRegExps = []; - var matchTotal = 0; - var mapping = this.matchMappings[key] = {defaultToken: "text"}; - var flag = "g"; - - var splitterRurles = []; - for (var i = 0; i < state.length; i++) { - var rule = state[i]; - if (rule.defaultToken) - mapping.defaultToken = rule.defaultToken; - if (rule.caseInsensitive) - flag = "gi"; - if (rule.regex == null) - continue; - - if (rule.regex instanceof RegExp) - rule.regex = rule.regex.toString().slice(1, -1); - var adjustedregex = rule.regex; - var matchcount = new RegExp("(?:(" + adjustedregex + ")|(.))").exec("a").length - 2; - if (Array.isArray(rule.token)) { - if (rule.token.length == 1 || matchcount == 1) { - rule.token = rule.token[0]; - } else if (matchcount - 1 != rule.token.length) { - throw new Error("number of classes and regexp groups in '" + - rule.token + "'\n'" + rule.regex + "' doesn't match\n" - + (matchcount - 1) + "!=" + rule.token.length); - } else { - rule.tokenArray = rule.token; - rule.token = null; - rule.onMatch = this.$arrayTokens; - } - } else if (typeof rule.token == "function" && !rule.onMatch) { - if (matchcount > 1) - rule.onMatch = this.$applyToken; - else - rule.onMatch = rule.token; - } - - if (matchcount > 1) { - if (/\\\d/.test(rule.regex)) { - adjustedregex = rule.regex.replace(/\\([0-9]+)/g, function (match, digit) { - return "\\" + (parseInt(digit, 10) + matchTotal + 1); - }); - } else { - matchcount = 1; - adjustedregex = this.removeCapturingGroups(rule.regex); - } - if (!rule.splitRegex && typeof rule.token != "string") - splitterRurles.push(rule); // flag will be known only at the very end - } - - mapping[matchTotal] = i; - matchTotal += matchcount; - - ruleRegExps.push(adjustedregex); - if (!rule.onMatch) - rule.onMatch = null; - rule.__proto__ = null; - } - - splitterRurles.forEach(function(rule) { - rule.splitRegex = this.createSplitterRegexp(rule.regex, flag); - }, this); - - this.regExps[key] = new RegExp("(" + ruleRegExps.join(")|(") + ")|($)", flag); - } -}; - -(function() { - this.$setMaxTokenCount = function(m) { - MAX_TOKEN_COUNT = m | 0; - }; - - this.$applyToken = function(str) { - var values = this.splitRegex.exec(str).slice(1); - var types = this.token.apply(this, values); - if (typeof types === "string") - return [{type: types, value: str}]; - - var tokens = []; - for (var i = 0, l = types.length; i < l; i++) { - if (values[i]) - tokens[tokens.length] = { - type: types[i], - value: values[i] - }; - } - return tokens; - }, - - this.$arrayTokens = function(str) { - if (!str) - return []; - var values = this.splitRegex.exec(str); - if (!values) - return "text"; - var tokens = []; - var types = this.tokenArray; - for (var i = 0, l = types.length; i < l; i++) { - if (values[i + 1]) - tokens[tokens.length] = { - type: types[i], - value: values[i + 1] - }; - } - return tokens; - }; - - this.removeCapturingGroups = function(src) { - var r = src.replace( - /\[(?:\\.|[^\]])*?\]|\\.|\(\?[:=!]|(\()/g, - function(x, y) {return y ? "(?:" : x;} - ); - return r; - }; - - this.createSplitterRegexp = function(src, flag) { - if (src.indexOf("(?=") != -1) { - var stack = 0; - var inChClass = false; - var lastCapture = {}; - src.replace(/(\\.)|(\((?:\?[=!])?)|(\))|([\[\]])/g, function( - m, esc, parenOpen, parenClose, square, index - ) { - if (inChClass) { - inChClass = square != "]"; - } else if (square) { - inChClass = true; - } else if (parenClose) { - if (stack == lastCapture.stack) { - lastCapture.end = index+1; - lastCapture.stack = -1; - } - stack--; - } else if (parenOpen) { - stack++; - if (parenOpen.length != 1) { - lastCapture.stack = stack - lastCapture.start = index; - } - } - return m; - }); - - if (lastCapture.end != null && /^\)*$/.test(src.substr(lastCapture.end))) - src = src.substring(0, lastCapture.start) + src.substr(lastCapture.end); - } - return new RegExp(src, (flag||"").replace("g", "")); - }; - this.getLineTokens = function(line, startState) { - if (startState && typeof startState != "string") { - var stack = startState.slice(0); - startState = stack[0]; - } else - var stack = []; - - var currentState = startState || "start"; - var state = this.states[currentState]; - var mapping = this.matchMappings[currentState]; - var re = this.regExps[currentState]; - re.lastIndex = 0; - - var match, tokens = []; - var lastIndex = 0; - - var token = {type: null, value: ""}; - - while (match = re.exec(line)) { - var type = mapping.defaultToken; - var rule = null; - var value = match[0]; - var index = re.lastIndex; - - if (index - value.length > lastIndex) { - var skipped = line.substring(lastIndex, index - value.length); - if (token.type == type) { - token.value += skipped; - } else { - if (token.type) - tokens.push(token); - token = {type: type, value: skipped}; - } - } - - for (var i = 0; i < match.length-2; i++) { - if (match[i + 1] === undefined) - continue; - - rule = state[mapping[i]]; - - if (rule.onMatch) - type = rule.onMatch(value, currentState, stack); - else - type = rule.token; - - if (rule.next) { - if (typeof rule.next == "string") - currentState = rule.next; - else - currentState = rule.next(currentState, stack); - - state = this.states[currentState]; - if (!state) { - window.console && console.error && console.error(currentState, "doesn't exist"); - currentState = "start"; - state = this.states[currentState]; - } - mapping = this.matchMappings[currentState]; - lastIndex = index; - re = this.regExps[currentState]; - re.lastIndex = index; - } - break; - } - - if (value) { - if (typeof type == "string") { - if ((!rule || rule.merge !== false) && token.type === type) { - token.value += value; - } else { - if (token.type) - tokens.push(token); - token = {type: type, value: value}; - } - } else if (type) { - if (token.type) - tokens.push(token); - token = {type: null, value: ""}; - for (var i = 0; i < type.length; i++) - tokens.push(type[i]); - } - } - - if (lastIndex == line.length) - break; - - lastIndex = index; - - if (tokens.length > MAX_TOKEN_COUNT) { - while (lastIndex < line.length) { - if (token.type) - tokens.push(token); - token = { - value: line.substring(lastIndex, lastIndex += 2000), - type: "overflow" - } - } - currentState = "start"; - stack = []; - break; - } - } - - if (token.type) - tokens.push(token); - - return { - tokens : tokens, - state : stack.length ? stack : currentState - }; - }; - -}).call(Tokenizer.prototype); - -exports.Tokenizer = Tokenizer; -}); - -define('ace/mode/text_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/lang'], function(require, exports, module) { - - -var lang = require("../lib/lang"); - -var TextHighlightRules = function() { - - this.$rules = { - "start" : [{ - token : "empty_line", - regex : '^$' - }, { - defaultToken : "text" - }] - }; -}; - -(function() { - - this.addRules = function(rules, prefix) { - if (!prefix) { - for (var key in rules) - this.$rules[key] = rules[key]; - return; - } - for (var key in rules) { - var state = rules[key]; - for (var i = 0; i < state.length; i++) { - var rule = state[i]; - if (rule.next) { - if (typeof rule.next != "string") { - if (rule.nextState && rule.nextState.indexOf(prefix) !== 0) - rule.nextState = prefix + rule.nextState; - } else { - if (rule.next.indexOf(prefix) !== 0) - rule.next = prefix + rule.next; - } - - } - } - this.$rules[prefix + key] = state; - } - }; - - this.getRules = function() { - return this.$rules; - }; - - this.embedRules = function (HighlightRules, prefix, escapeRules, states, append) { - var embedRules = new HighlightRules().getRules(); - if (states) { - for (var i = 0; i < states.length; i++) - states[i] = prefix + states[i]; - } else { - states = []; - for (var key in embedRules) - states.push(prefix + key); - } - - this.addRules(embedRules, prefix); - - if (escapeRules) { - var addRules = Array.prototype[append ? "push" : "unshift"]; - for (var i = 0; i < states.length; i++) - addRules.apply(this.$rules[states[i]], lang.deepCopy(escapeRules)); - } - - if (!this.$embeds) - this.$embeds = []; - this.$embeds.push(prefix); - }; - - this.getEmbeds = function() { - return this.$embeds; - }; - - var pushState = function(currentState, stack) { - if (currentState != "start") - stack.unshift(this.nextState, currentState); - return this.nextState; - }; - var popState = function(currentState, stack) { - if (stack[0] !== currentState) - return "start"; - stack.shift(); - return stack.shift(); - }; - - this.normalizeRules = function() { - var id = 0; - var rules = this.$rules; - function processState(key) { - var state = rules[key]; - state.processed = true; - for (var i = 0; i < state.length; i++) { - var rule = state[i]; - if (!rule.regex && rule.start) { - rule.regex = rule.start; - if (!rule.next) - rule.next = []; - rule.next.push({ - defaultToken: rule.token - }, { - token: rule.token + ".end", - regex: rule.end || rule.start, - next: "pop" - }); - rule.token = rule.token + ".start"; - rule.push = true; - } - var next = rule.next || rule.push; - if (next && Array.isArray(next)) { - var stateName = rule.stateName; - if (!stateName) { - stateName = rule.token; - if (typeof stateName != "string") - stateName = stateName[0] || ""; - if (rules[stateName]) - stateName += id++; - } - rules[stateName] = next; - rule.next = stateName; - processState(stateName); - } else if (next == "pop") { - rule.next = popState; - } - - if (rule.push) { - rule.nextState = rule.next || rule.push; - rule.next = pushState; - delete rule.push; - } - - if (rule.rules) { - for (var r in rule.rules) { - if (rules[r]) { - if (rules[r].push) - rules[r].push.apply(rules[r], rule.rules[r]); - } else { - rules[r] = rule.rules[r]; - } - } - } - if (rule.include || typeof rule == "string") { - var includeName = rule.include || rule; - var toInsert = rules[includeName]; - } else if (Array.isArray(rule)) - toInsert = rule; - - if (toInsert) { - var args = [i, 1].concat(toInsert); - if (rule.noEscape) - args = args.filter(function(x) {return !x.next;}); - state.splice.apply(state, args); - i--; - toInsert = null - } - - if (rule.keywordMap) { - rule.token = this.createKeywordMapper( - rule.keywordMap, rule.defaultToken || "text", rule.caseInsensitive - ); - delete rule.defaultToken; - } - } - }; - Object.keys(rules).forEach(processState, this); - }; - - this.createKeywordMapper = function(map, defaultToken, ignoreCase, splitChar) { - var keywords = Object.create(null); - Object.keys(map).forEach(function(className) { - var a = map[className]; - if (ignoreCase) - a = a.toLowerCase(); - var list = a.split(splitChar || "|"); - for (var i = list.length; i--; ) - keywords[list[i]] = className; - }); - if (Object.getPrototypeOf(keywords)) { - keywords.__proto__ = null; - } - this.$keywordList = Object.keys(keywords); - map = null; - return ignoreCase - ? function(value) {return keywords[value.toLowerCase()] || defaultToken } - : function(value) {return keywords[value] || defaultToken }; - } - - this.getKeywords = function() { - return this.$keywords; - }; - -}).call(TextHighlightRules.prototype); - -exports.TextHighlightRules = TextHighlightRules; -}); - -define('ace/mode/behaviour', ['require', 'exports', 'module' ], function(require, exports, module) { - - -var Behaviour = function() { - this.$behaviours = {}; -}; - -(function () { - - this.add = function (name, action, callback) { - switch (undefined) { - case this.$behaviours: - this.$behaviours = {}; - case this.$behaviours[name]: - this.$behaviours[name] = {}; - } - this.$behaviours[name][action] = callback; - } - - this.addBehaviours = function (behaviours) { - for (var key in behaviours) { - for (var action in behaviours[key]) { - this.add(key, action, behaviours[key][action]); - } - } - } - - this.remove = function (name) { - if (this.$behaviours && this.$behaviours[name]) { - delete this.$behaviours[name]; - } - } - - this.inherit = function (mode, filter) { - if (typeof mode === "function") { - var behaviours = new mode().getBehaviours(filter); - } else { - var behaviours = mode.getBehaviours(filter); - } - this.addBehaviours(behaviours); - } - - this.getBehaviours = function (filter) { - if (!filter) { - return this.$behaviours; - } else { - var ret = {} - for (var i = 0; i < filter.length; i++) { - if (this.$behaviours[filter[i]]) { - ret[filter[i]] = this.$behaviours[filter[i]]; - } - } - return ret; - } - } - -}).call(Behaviour.prototype); - -exports.Behaviour = Behaviour; -}); -define('ace/unicode', ['require', 'exports', 'module' ], function(require, exports, module) { -exports.packages = {}; - -addUnicodePackage({ - L: "0041-005A0061-007A00AA00B500BA00C0-00D600D8-00F600F8-02C102C6-02D102E0-02E402EC02EE0370-037403760377037A-037D03860388-038A038C038E-03A103A3-03F503F7-0481048A-05250531-055605590561-058705D0-05EA05F0-05F20621-064A066E066F0671-06D306D506E506E606EE06EF06FA-06FC06FF07100712-072F074D-07A507B107CA-07EA07F407F507FA0800-0815081A082408280904-0939093D09500958-0961097109720979-097F0985-098C098F09900993-09A809AA-09B009B209B6-09B909BD09CE09DC09DD09DF-09E109F009F10A05-0A0A0A0F0A100A13-0A280A2A-0A300A320A330A350A360A380A390A59-0A5C0A5E0A72-0A740A85-0A8D0A8F-0A910A93-0AA80AAA-0AB00AB20AB30AB5-0AB90ABD0AD00AE00AE10B05-0B0C0B0F0B100B13-0B280B2A-0B300B320B330B35-0B390B3D0B5C0B5D0B5F-0B610B710B830B85-0B8A0B8E-0B900B92-0B950B990B9A0B9C0B9E0B9F0BA30BA40BA8-0BAA0BAE-0BB90BD00C05-0C0C0C0E-0C100C12-0C280C2A-0C330C35-0C390C3D0C580C590C600C610C85-0C8C0C8E-0C900C92-0CA80CAA-0CB30CB5-0CB90CBD0CDE0CE00CE10D05-0D0C0D0E-0D100D12-0D280D2A-0D390D3D0D600D610D7A-0D7F0D85-0D960D9A-0DB10DB3-0DBB0DBD0DC0-0DC60E01-0E300E320E330E40-0E460E810E820E840E870E880E8A0E8D0E94-0E970E99-0E9F0EA1-0EA30EA50EA70EAA0EAB0EAD-0EB00EB20EB30EBD0EC0-0EC40EC60EDC0EDD0F000F40-0F470F49-0F6C0F88-0F8B1000-102A103F1050-1055105A-105D106110651066106E-10701075-1081108E10A0-10C510D0-10FA10FC1100-1248124A-124D1250-12561258125A-125D1260-1288128A-128D1290-12B012B2-12B512B8-12BE12C012C2-12C512C8-12D612D8-13101312-13151318-135A1380-138F13A0-13F41401-166C166F-167F1681-169A16A0-16EA1700-170C170E-17111720-17311740-17511760-176C176E-17701780-17B317D717DC1820-18771880-18A818AA18B0-18F51900-191C1950-196D1970-19741980-19AB19C1-19C71A00-1A161A20-1A541AA71B05-1B331B45-1B4B1B83-1BA01BAE1BAF1C00-1C231C4D-1C4F1C5A-1C7D1CE9-1CEC1CEE-1CF11D00-1DBF1E00-1F151F18-1F1D1F20-1F451F48-1F4D1F50-1F571F591F5B1F5D1F5F-1F7D1F80-1FB41FB6-1FBC1FBE1FC2-1FC41FC6-1FCC1FD0-1FD31FD6-1FDB1FE0-1FEC1FF2-1FF41FF6-1FFC2071207F2090-209421022107210A-211321152119-211D212421262128212A-212D212F-2139213C-213F2145-2149214E218321842C00-2C2E2C30-2C5E2C60-2CE42CEB-2CEE2D00-2D252D30-2D652D6F2D80-2D962DA0-2DA62DA8-2DAE2DB0-2DB62DB8-2DBE2DC0-2DC62DC8-2DCE2DD0-2DD62DD8-2DDE2E2F300530063031-3035303B303C3041-3096309D-309F30A1-30FA30FC-30FF3105-312D3131-318E31A0-31B731F0-31FF3400-4DB54E00-9FCBA000-A48CA4D0-A4FDA500-A60CA610-A61FA62AA62BA640-A65FA662-A66EA67F-A697A6A0-A6E5A717-A71FA722-A788A78BA78CA7FB-A801A803-A805A807-A80AA80C-A822A840-A873A882-A8B3A8F2-A8F7A8FBA90A-A925A930-A946A960-A97CA984-A9B2A9CFAA00-AA28AA40-AA42AA44-AA4BAA60-AA76AA7AAA80-AAAFAAB1AAB5AAB6AAB9-AABDAAC0AAC2AADB-AADDABC0-ABE2AC00-D7A3D7B0-D7C6D7CB-D7FBF900-FA2DFA30-FA6DFA70-FAD9FB00-FB06FB13-FB17FB1DFB1F-FB28FB2A-FB36FB38-FB3CFB3EFB40FB41FB43FB44FB46-FBB1FBD3-FD3DFD50-FD8FFD92-FDC7FDF0-FDFBFE70-FE74FE76-FEFCFF21-FF3AFF41-FF5AFF66-FFBEFFC2-FFC7FFCA-FFCFFFD2-FFD7FFDA-FFDC", - Ll: "0061-007A00AA00B500BA00DF-00F600F8-00FF01010103010501070109010B010D010F01110113011501170119011B011D011F01210123012501270129012B012D012F01310133013501370138013A013C013E014001420144014601480149014B014D014F01510153015501570159015B015D015F01610163016501670169016B016D016F0171017301750177017A017C017E-0180018301850188018C018D019201950199-019B019E01A101A301A501A801AA01AB01AD01B001B401B601B901BA01BD-01BF01C601C901CC01CE01D001D201D401D601D801DA01DC01DD01DF01E101E301E501E701E901EB01ED01EF01F001F301F501F901FB01FD01FF02010203020502070209020B020D020F02110213021502170219021B021D021F02210223022502270229022B022D022F02310233-0239023C023F0240024202470249024B024D024F-02930295-02AF037103730377037B-037D039003AC-03CE03D003D103D5-03D703D903DB03DD03DF03E103E303E503E703E903EB03ED03EF-03F303F503F803FB03FC0430-045F04610463046504670469046B046D046F04710473047504770479047B047D047F0481048B048D048F04910493049504970499049B049D049F04A104A304A504A704A904AB04AD04AF04B104B304B504B704B904BB04BD04BF04C204C404C604C804CA04CC04CE04CF04D104D304D504D704D904DB04DD04DF04E104E304E504E704E904EB04ED04EF04F104F304F504F704F904FB04FD04FF05010503050505070509050B050D050F05110513051505170519051B051D051F0521052305250561-05871D00-1D2B1D62-1D771D79-1D9A1E011E031E051E071E091E0B1E0D1E0F1E111E131E151E171E191E1B1E1D1E1F1E211E231E251E271E291E2B1E2D1E2F1E311E331E351E371E391E3B1E3D1E3F1E411E431E451E471E491E4B1E4D1E4F1E511E531E551E571E591E5B1E5D1E5F1E611E631E651E671E691E6B1E6D1E6F1E711E731E751E771E791E7B1E7D1E7F1E811E831E851E871E891E8B1E8D1E8F1E911E931E95-1E9D1E9F1EA11EA31EA51EA71EA91EAB1EAD1EAF1EB11EB31EB51EB71EB91EBB1EBD1EBF1EC11EC31EC51EC71EC91ECB1ECD1ECF1ED11ED31ED51ED71ED91EDB1EDD1EDF1EE11EE31EE51EE71EE91EEB1EED1EEF1EF11EF31EF51EF71EF91EFB1EFD1EFF-1F071F10-1F151F20-1F271F30-1F371F40-1F451F50-1F571F60-1F671F70-1F7D1F80-1F871F90-1F971FA0-1FA71FB0-1FB41FB61FB71FBE1FC2-1FC41FC61FC71FD0-1FD31FD61FD71FE0-1FE71FF2-1FF41FF61FF7210A210E210F2113212F21342139213C213D2146-2149214E21842C30-2C5E2C612C652C662C682C6A2C6C2C712C732C742C76-2C7C2C812C832C852C872C892C8B2C8D2C8F2C912C932C952C972C992C9B2C9D2C9F2CA12CA32CA52CA72CA92CAB2CAD2CAF2CB12CB32CB52CB72CB92CBB2CBD2CBF2CC12CC32CC52CC72CC92CCB2CCD2CCF2CD12CD32CD52CD72CD92CDB2CDD2CDF2CE12CE32CE42CEC2CEE2D00-2D25A641A643A645A647A649A64BA64DA64FA651A653A655A657A659A65BA65DA65FA663A665A667A669A66BA66DA681A683A685A687A689A68BA68DA68FA691A693A695A697A723A725A727A729A72BA72DA72F-A731A733A735A737A739A73BA73DA73FA741A743A745A747A749A74BA74DA74FA751A753A755A757A759A75BA75DA75FA761A763A765A767A769A76BA76DA76FA771-A778A77AA77CA77FA781A783A785A787A78CFB00-FB06FB13-FB17FF41-FF5A", - Lu: "0041-005A00C0-00D600D8-00DE01000102010401060108010A010C010E01100112011401160118011A011C011E01200122012401260128012A012C012E01300132013401360139013B013D013F0141014301450147014A014C014E01500152015401560158015A015C015E01600162016401660168016A016C016E017001720174017601780179017B017D018101820184018601870189-018B018E-0191019301940196-0198019C019D019F01A001A201A401A601A701A901AC01AE01AF01B1-01B301B501B701B801BC01C401C701CA01CD01CF01D101D301D501D701D901DB01DE01E001E201E401E601E801EA01EC01EE01F101F401F6-01F801FA01FC01FE02000202020402060208020A020C020E02100212021402160218021A021C021E02200222022402260228022A022C022E02300232023A023B023D023E02410243-02460248024A024C024E03700372037603860388-038A038C038E038F0391-03A103A3-03AB03CF03D2-03D403D803DA03DC03DE03E003E203E403E603E803EA03EC03EE03F403F703F903FA03FD-042F04600462046404660468046A046C046E04700472047404760478047A047C047E0480048A048C048E04900492049404960498049A049C049E04A004A204A404A604A804AA04AC04AE04B004B204B404B604B804BA04BC04BE04C004C104C304C504C704C904CB04CD04D004D204D404D604D804DA04DC04DE04E004E204E404E604E804EA04EC04EE04F004F204F404F604F804FA04FC04FE05000502050405060508050A050C050E05100512051405160518051A051C051E0520052205240531-055610A0-10C51E001E021E041E061E081E0A1E0C1E0E1E101E121E141E161E181E1A1E1C1E1E1E201E221E241E261E281E2A1E2C1E2E1E301E321E341E361E381E3A1E3C1E3E1E401E421E441E461E481E4A1E4C1E4E1E501E521E541E561E581E5A1E5C1E5E1E601E621E641E661E681E6A1E6C1E6E1E701E721E741E761E781E7A1E7C1E7E1E801E821E841E861E881E8A1E8C1E8E1E901E921E941E9E1EA01EA21EA41EA61EA81EAA1EAC1EAE1EB01EB21EB41EB61EB81EBA1EBC1EBE1EC01EC21EC41EC61EC81ECA1ECC1ECE1ED01ED21ED41ED61ED81EDA1EDC1EDE1EE01EE21EE41EE61EE81EEA1EEC1EEE1EF01EF21EF41EF61EF81EFA1EFC1EFE1F08-1F0F1F18-1F1D1F28-1F2F1F38-1F3F1F48-1F4D1F591F5B1F5D1F5F1F68-1F6F1FB8-1FBB1FC8-1FCB1FD8-1FDB1FE8-1FEC1FF8-1FFB21022107210B-210D2110-211221152119-211D212421262128212A-212D2130-2133213E213F214521832C00-2C2E2C602C62-2C642C672C692C6B2C6D-2C702C722C752C7E-2C802C822C842C862C882C8A2C8C2C8E2C902C922C942C962C982C9A2C9C2C9E2CA02CA22CA42CA62CA82CAA2CAC2CAE2CB02CB22CB42CB62CB82CBA2CBC2CBE2CC02CC22CC42CC62CC82CCA2CCC2CCE2CD02CD22CD42CD62CD82CDA2CDC2CDE2CE02CE22CEB2CEDA640A642A644A646A648A64AA64CA64EA650A652A654A656A658A65AA65CA65EA662A664A666A668A66AA66CA680A682A684A686A688A68AA68CA68EA690A692A694A696A722A724A726A728A72AA72CA72EA732A734A736A738A73AA73CA73EA740A742A744A746A748A74AA74CA74EA750A752A754A756A758A75AA75CA75EA760A762A764A766A768A76AA76CA76EA779A77BA77DA77EA780A782A784A786A78BFF21-FF3A", - Lt: "01C501C801CB01F21F88-1F8F1F98-1F9F1FA8-1FAF1FBC1FCC1FFC", - Lm: "02B0-02C102C6-02D102E0-02E402EC02EE0374037A0559064006E506E607F407F507FA081A0824082809710E460EC610FC17D718431AA71C78-1C7D1D2C-1D611D781D9B-1DBF2071207F2090-20942C7D2D6F2E2F30053031-3035303B309D309E30FC-30FEA015A4F8-A4FDA60CA67FA717-A71FA770A788A9CFAA70AADDFF70FF9EFF9F", - Lo: "01BB01C0-01C3029405D0-05EA05F0-05F20621-063F0641-064A066E066F0671-06D306D506EE06EF06FA-06FC06FF07100712-072F074D-07A507B107CA-07EA0800-08150904-0939093D09500958-096109720979-097F0985-098C098F09900993-09A809AA-09B009B209B6-09B909BD09CE09DC09DD09DF-09E109F009F10A05-0A0A0A0F0A100A13-0A280A2A-0A300A320A330A350A360A380A390A59-0A5C0A5E0A72-0A740A85-0A8D0A8F-0A910A93-0AA80AAA-0AB00AB20AB30AB5-0AB90ABD0AD00AE00AE10B05-0B0C0B0F0B100B13-0B280B2A-0B300B320B330B35-0B390B3D0B5C0B5D0B5F-0B610B710B830B85-0B8A0B8E-0B900B92-0B950B990B9A0B9C0B9E0B9F0BA30BA40BA8-0BAA0BAE-0BB90BD00C05-0C0C0C0E-0C100C12-0C280C2A-0C330C35-0C390C3D0C580C590C600C610C85-0C8C0C8E-0C900C92-0CA80CAA-0CB30CB5-0CB90CBD0CDE0CE00CE10D05-0D0C0D0E-0D100D12-0D280D2A-0D390D3D0D600D610D7A-0D7F0D85-0D960D9A-0DB10DB3-0DBB0DBD0DC0-0DC60E01-0E300E320E330E40-0E450E810E820E840E870E880E8A0E8D0E94-0E970E99-0E9F0EA1-0EA30EA50EA70EAA0EAB0EAD-0EB00EB20EB30EBD0EC0-0EC40EDC0EDD0F000F40-0F470F49-0F6C0F88-0F8B1000-102A103F1050-1055105A-105D106110651066106E-10701075-1081108E10D0-10FA1100-1248124A-124D1250-12561258125A-125D1260-1288128A-128D1290-12B012B2-12B512B8-12BE12C012C2-12C512C8-12D612D8-13101312-13151318-135A1380-138F13A0-13F41401-166C166F-167F1681-169A16A0-16EA1700-170C170E-17111720-17311740-17511760-176C176E-17701780-17B317DC1820-18421844-18771880-18A818AA18B0-18F51900-191C1950-196D1970-19741980-19AB19C1-19C71A00-1A161A20-1A541B05-1B331B45-1B4B1B83-1BA01BAE1BAF1C00-1C231C4D-1C4F1C5A-1C771CE9-1CEC1CEE-1CF12135-21382D30-2D652D80-2D962DA0-2DA62DA8-2DAE2DB0-2DB62DB8-2DBE2DC0-2DC62DC8-2DCE2DD0-2DD62DD8-2DDE3006303C3041-3096309F30A1-30FA30FF3105-312D3131-318E31A0-31B731F0-31FF3400-4DB54E00-9FCBA000-A014A016-A48CA4D0-A4F7A500-A60BA610-A61FA62AA62BA66EA6A0-A6E5A7FB-A801A803-A805A807-A80AA80C-A822A840-A873A882-A8B3A8F2-A8F7A8FBA90A-A925A930-A946A960-A97CA984-A9B2AA00-AA28AA40-AA42AA44-AA4BAA60-AA6FAA71-AA76AA7AAA80-AAAFAAB1AAB5AAB6AAB9-AABDAAC0AAC2AADBAADCABC0-ABE2AC00-D7A3D7B0-D7C6D7CB-D7FBF900-FA2DFA30-FA6DFA70-FAD9FB1DFB1F-FB28FB2A-FB36FB38-FB3CFB3EFB40FB41FB43FB44FB46-FBB1FBD3-FD3DFD50-FD8FFD92-FDC7FDF0-FDFBFE70-FE74FE76-FEFCFF66-FF6FFF71-FF9DFFA0-FFBEFFC2-FFC7FFCA-FFCFFFD2-FFD7FFDA-FFDC", - M: "0300-036F0483-04890591-05BD05BF05C105C205C405C505C70610-061A064B-065E067006D6-06DC06DE-06E406E706E806EA-06ED07110730-074A07A6-07B007EB-07F30816-0819081B-08230825-08270829-082D0900-0903093C093E-094E0951-0955096209630981-098309BC09BE-09C409C709C809CB-09CD09D709E209E30A01-0A030A3C0A3E-0A420A470A480A4B-0A4D0A510A700A710A750A81-0A830ABC0ABE-0AC50AC7-0AC90ACB-0ACD0AE20AE30B01-0B030B3C0B3E-0B440B470B480B4B-0B4D0B560B570B620B630B820BBE-0BC20BC6-0BC80BCA-0BCD0BD70C01-0C030C3E-0C440C46-0C480C4A-0C4D0C550C560C620C630C820C830CBC0CBE-0CC40CC6-0CC80CCA-0CCD0CD50CD60CE20CE30D020D030D3E-0D440D46-0D480D4A-0D4D0D570D620D630D820D830DCA0DCF-0DD40DD60DD8-0DDF0DF20DF30E310E34-0E3A0E47-0E4E0EB10EB4-0EB90EBB0EBC0EC8-0ECD0F180F190F350F370F390F3E0F3F0F71-0F840F860F870F90-0F970F99-0FBC0FC6102B-103E1056-1059105E-10601062-10641067-106D1071-10741082-108D108F109A-109D135F1712-17141732-1734175217531772177317B6-17D317DD180B-180D18A91920-192B1930-193B19B0-19C019C819C91A17-1A1B1A55-1A5E1A60-1A7C1A7F1B00-1B041B34-1B441B6B-1B731B80-1B821BA1-1BAA1C24-1C371CD0-1CD21CD4-1CE81CED1CF21DC0-1DE61DFD-1DFF20D0-20F02CEF-2CF12DE0-2DFF302A-302F3099309AA66F-A672A67CA67DA6F0A6F1A802A806A80BA823-A827A880A881A8B4-A8C4A8E0-A8F1A926-A92DA947-A953A980-A983A9B3-A9C0AA29-AA36AA43AA4CAA4DAA7BAAB0AAB2-AAB4AAB7AAB8AABEAABFAAC1ABE3-ABEAABECABEDFB1EFE00-FE0FFE20-FE26", - Mn: "0300-036F0483-04870591-05BD05BF05C105C205C405C505C70610-061A064B-065E067006D6-06DC06DF-06E406E706E806EA-06ED07110730-074A07A6-07B007EB-07F30816-0819081B-08230825-08270829-082D0900-0902093C0941-0948094D0951-095509620963098109BC09C1-09C409CD09E209E30A010A020A3C0A410A420A470A480A4B-0A4D0A510A700A710A750A810A820ABC0AC1-0AC50AC70AC80ACD0AE20AE30B010B3C0B3F0B41-0B440B4D0B560B620B630B820BC00BCD0C3E-0C400C46-0C480C4A-0C4D0C550C560C620C630CBC0CBF0CC60CCC0CCD0CE20CE30D41-0D440D4D0D620D630DCA0DD2-0DD40DD60E310E34-0E3A0E47-0E4E0EB10EB4-0EB90EBB0EBC0EC8-0ECD0F180F190F350F370F390F71-0F7E0F80-0F840F860F870F90-0F970F99-0FBC0FC6102D-10301032-10371039103A103D103E10581059105E-10601071-1074108210851086108D109D135F1712-17141732-1734175217531772177317B7-17BD17C617C9-17D317DD180B-180D18A91920-19221927192819321939-193B1A171A181A561A58-1A5E1A601A621A65-1A6C1A73-1A7C1A7F1B00-1B031B341B36-1B3A1B3C1B421B6B-1B731B801B811BA2-1BA51BA81BA91C2C-1C331C361C371CD0-1CD21CD4-1CE01CE2-1CE81CED1DC0-1DE61DFD-1DFF20D0-20DC20E120E5-20F02CEF-2CF12DE0-2DFF302A-302F3099309AA66FA67CA67DA6F0A6F1A802A806A80BA825A826A8C4A8E0-A8F1A926-A92DA947-A951A980-A982A9B3A9B6-A9B9A9BCAA29-AA2EAA31AA32AA35AA36AA43AA4CAAB0AAB2-AAB4AAB7AAB8AABEAABFAAC1ABE5ABE8ABEDFB1EFE00-FE0FFE20-FE26", - Mc: "0903093E-09400949-094C094E0982098309BE-09C009C709C809CB09CC09D70A030A3E-0A400A830ABE-0AC00AC90ACB0ACC0B020B030B3E0B400B470B480B4B0B4C0B570BBE0BBF0BC10BC20BC6-0BC80BCA-0BCC0BD70C01-0C030C41-0C440C820C830CBE0CC0-0CC40CC70CC80CCA0CCB0CD50CD60D020D030D3E-0D400D46-0D480D4A-0D4C0D570D820D830DCF-0DD10DD8-0DDF0DF20DF30F3E0F3F0F7F102B102C10311038103B103C105610571062-10641067-106D108310841087-108C108F109A-109C17B617BE-17C517C717C81923-19261929-192B193019311933-193819B0-19C019C819C91A19-1A1B1A551A571A611A631A641A6D-1A721B041B351B3B1B3D-1B411B431B441B821BA11BA61BA71BAA1C24-1C2B1C341C351CE11CF2A823A824A827A880A881A8B4-A8C3A952A953A983A9B4A9B5A9BAA9BBA9BD-A9C0AA2FAA30AA33AA34AA4DAA7BABE3ABE4ABE6ABE7ABE9ABEAABEC", - Me: "0488048906DE20DD-20E020E2-20E4A670-A672", - N: "0030-003900B200B300B900BC-00BE0660-066906F0-06F907C0-07C90966-096F09E6-09EF09F4-09F90A66-0A6F0AE6-0AEF0B66-0B6F0BE6-0BF20C66-0C6F0C78-0C7E0CE6-0CEF0D66-0D750E50-0E590ED0-0ED90F20-0F331040-10491090-10991369-137C16EE-16F017E0-17E917F0-17F91810-18191946-194F19D0-19DA1A80-1A891A90-1A991B50-1B591BB0-1BB91C40-1C491C50-1C5920702074-20792080-20892150-21822185-21892460-249B24EA-24FF2776-27932CFD30073021-30293038-303A3192-31953220-32293251-325F3280-328932B1-32BFA620-A629A6E6-A6EFA830-A835A8D0-A8D9A900-A909A9D0-A9D9AA50-AA59ABF0-ABF9FF10-FF19", - Nd: "0030-00390660-066906F0-06F907C0-07C90966-096F09E6-09EF0A66-0A6F0AE6-0AEF0B66-0B6F0BE6-0BEF0C66-0C6F0CE6-0CEF0D66-0D6F0E50-0E590ED0-0ED90F20-0F291040-10491090-109917E0-17E91810-18191946-194F19D0-19DA1A80-1A891A90-1A991B50-1B591BB0-1BB91C40-1C491C50-1C59A620-A629A8D0-A8D9A900-A909A9D0-A9D9AA50-AA59ABF0-ABF9FF10-FF19", - Nl: "16EE-16F02160-21822185-218830073021-30293038-303AA6E6-A6EF", - No: "00B200B300B900BC-00BE09F4-09F90BF0-0BF20C78-0C7E0D70-0D750F2A-0F331369-137C17F0-17F920702074-20792080-20892150-215F21892460-249B24EA-24FF2776-27932CFD3192-31953220-32293251-325F3280-328932B1-32BFA830-A835", - P: "0021-00230025-002A002C-002F003A003B003F0040005B-005D005F007B007D00A100AB00B700BB00BF037E0387055A-055F0589058A05BE05C005C305C605F305F40609060A060C060D061B061E061F066A-066D06D40700-070D07F7-07F90830-083E0964096509700DF40E4F0E5A0E5B0F04-0F120F3A-0F3D0F850FD0-0FD4104A-104F10FB1361-13681400166D166E169B169C16EB-16ED1735173617D4-17D617D8-17DA1800-180A1944194519DE19DF1A1E1A1F1AA0-1AA61AA8-1AAD1B5A-1B601C3B-1C3F1C7E1C7F1CD32010-20272030-20432045-20512053-205E207D207E208D208E2329232A2768-277527C527C627E6-27EF2983-299829D8-29DB29FC29FD2CF9-2CFC2CFE2CFF2E00-2E2E2E302E313001-30033008-30113014-301F3030303D30A030FBA4FEA4FFA60D-A60FA673A67EA6F2-A6F7A874-A877A8CEA8CFA8F8-A8FAA92EA92FA95FA9C1-A9CDA9DEA9DFAA5C-AA5FAADEAADFABEBFD3EFD3FFE10-FE19FE30-FE52FE54-FE61FE63FE68FE6AFE6BFF01-FF03FF05-FF0AFF0C-FF0FFF1AFF1BFF1FFF20FF3B-FF3DFF3FFF5BFF5DFF5F-FF65", - Pd: "002D058A05BE140018062010-20152E172E1A301C303030A0FE31FE32FE58FE63FF0D", - Ps: "0028005B007B0F3A0F3C169B201A201E2045207D208D23292768276A276C276E27702772277427C527E627E827EA27EC27EE2983298529872989298B298D298F299129932995299729D829DA29FC2E222E242E262E283008300A300C300E3010301430163018301A301DFD3EFE17FE35FE37FE39FE3BFE3DFE3FFE41FE43FE47FE59FE5BFE5DFF08FF3BFF5BFF5FFF62", - Pe: "0029005D007D0F3B0F3D169C2046207E208E232A2769276B276D276F27712773277527C627E727E927EB27ED27EF298429862988298A298C298E2990299229942996299829D929DB29FD2E232E252E272E293009300B300D300F3011301530173019301B301E301FFD3FFE18FE36FE38FE3AFE3CFE3EFE40FE42FE44FE48FE5AFE5CFE5EFF09FF3DFF5DFF60FF63", - Pi: "00AB2018201B201C201F20392E022E042E092E0C2E1C2E20", - Pf: "00BB2019201D203A2E032E052E0A2E0D2E1D2E21", - Pc: "005F203F20402054FE33FE34FE4D-FE4FFF3F", - Po: "0021-00230025-0027002A002C002E002F003A003B003F0040005C00A100B700BF037E0387055A-055F058905C005C305C605F305F40609060A060C060D061B061E061F066A-066D06D40700-070D07F7-07F90830-083E0964096509700DF40E4F0E5A0E5B0F04-0F120F850FD0-0FD4104A-104F10FB1361-1368166D166E16EB-16ED1735173617D4-17D617D8-17DA1800-18051807-180A1944194519DE19DF1A1E1A1F1AA0-1AA61AA8-1AAD1B5A-1B601C3B-1C3F1C7E1C7F1CD3201620172020-20272030-2038203B-203E2041-20432047-205120532055-205E2CF9-2CFC2CFE2CFF2E002E012E06-2E082E0B2E0E-2E162E182E192E1B2E1E2E1F2E2A-2E2E2E302E313001-3003303D30FBA4FEA4FFA60D-A60FA673A67EA6F2-A6F7A874-A877A8CEA8CFA8F8-A8FAA92EA92FA95FA9C1-A9CDA9DEA9DFAA5C-AA5FAADEAADFABEBFE10-FE16FE19FE30FE45FE46FE49-FE4CFE50-FE52FE54-FE57FE5F-FE61FE68FE6AFE6BFF01-FF03FF05-FF07FF0AFF0CFF0EFF0FFF1AFF1BFF1FFF20FF3CFF61FF64FF65", - S: "0024002B003C-003E005E0060007C007E00A2-00A900AC00AE-00B100B400B600B800D700F702C2-02C502D2-02DF02E5-02EB02ED02EF-02FF03750384038503F604820606-0608060B060E060F06E906FD06FE07F609F209F309FA09FB0AF10B700BF3-0BFA0C7F0CF10CF20D790E3F0F01-0F030F13-0F170F1A-0F1F0F340F360F380FBE-0FC50FC7-0FCC0FCE0FCF0FD5-0FD8109E109F13601390-139917DB194019E0-19FF1B61-1B6A1B74-1B7C1FBD1FBF-1FC11FCD-1FCF1FDD-1FDF1FED-1FEF1FFD1FFE20442052207A-207C208A-208C20A0-20B8210021012103-21062108210921142116-2118211E-2123212521272129212E213A213B2140-2144214A-214D214F2190-2328232B-23E82400-24262440-244A249C-24E92500-26CD26CF-26E126E326E8-26FF2701-27042706-2709270C-27272729-274B274D274F-27522756-275E2761-276727942798-27AF27B1-27BE27C0-27C427C7-27CA27CC27D0-27E527F0-29822999-29D729DC-29FB29FE-2B4C2B50-2B592CE5-2CEA2E80-2E992E9B-2EF32F00-2FD52FF0-2FFB300430123013302030363037303E303F309B309C319031913196-319F31C0-31E33200-321E322A-32503260-327F328A-32B032C0-32FE3300-33FF4DC0-4DFFA490-A4C6A700-A716A720A721A789A78AA828-A82BA836-A839AA77-AA79FB29FDFCFDFDFE62FE64-FE66FE69FF04FF0BFF1C-FF1EFF3EFF40FF5CFF5EFFE0-FFE6FFE8-FFEEFFFCFFFD", - Sm: "002B003C-003E007C007E00AC00B100D700F703F60606-060820442052207A-207C208A-208C2140-2144214B2190-2194219A219B21A021A321A621AE21CE21CF21D221D421F4-22FF2308-230B23202321237C239B-23B323DC-23E125B725C125F8-25FF266F27C0-27C427C7-27CA27CC27D0-27E527F0-27FF2900-29822999-29D729DC-29FB29FE-2AFF2B30-2B442B47-2B4CFB29FE62FE64-FE66FF0BFF1C-FF1EFF5CFF5EFFE2FFE9-FFEC", - Sc: "002400A2-00A5060B09F209F309FB0AF10BF90E3F17DB20A0-20B8A838FDFCFE69FF04FFE0FFE1FFE5FFE6", - Sk: "005E006000A800AF00B400B802C2-02C502D2-02DF02E5-02EB02ED02EF-02FF0375038403851FBD1FBF-1FC11FCD-1FCF1FDD-1FDF1FED-1FEF1FFD1FFE309B309CA700-A716A720A721A789A78AFF3EFF40FFE3", - So: "00A600A700A900AE00B000B60482060E060F06E906FD06FE07F609FA0B700BF3-0BF80BFA0C7F0CF10CF20D790F01-0F030F13-0F170F1A-0F1F0F340F360F380FBE-0FC50FC7-0FCC0FCE0FCF0FD5-0FD8109E109F13601390-1399194019E0-19FF1B61-1B6A1B74-1B7C210021012103-21062108210921142116-2118211E-2123212521272129212E213A213B214A214C214D214F2195-2199219C-219F21A121A221A421A521A7-21AD21AF-21CD21D021D121D321D5-21F32300-2307230C-231F2322-2328232B-237B237D-239A23B4-23DB23E2-23E82400-24262440-244A249C-24E92500-25B625B8-25C025C2-25F72600-266E2670-26CD26CF-26E126E326E8-26FF2701-27042706-2709270C-27272729-274B274D274F-27522756-275E2761-276727942798-27AF27B1-27BE2800-28FF2B00-2B2F2B452B462B50-2B592CE5-2CEA2E80-2E992E9B-2EF32F00-2FD52FF0-2FFB300430123013302030363037303E303F319031913196-319F31C0-31E33200-321E322A-32503260-327F328A-32B032C0-32FE3300-33FF4DC0-4DFFA490-A4C6A828-A82BA836A837A839AA77-AA79FDFDFFE4FFE8FFEDFFEEFFFCFFFD", - Z: "002000A01680180E2000-200A20282029202F205F3000", - Zs: "002000A01680180E2000-200A202F205F3000", - Zl: "2028", - Zp: "2029", - C: "0000-001F007F-009F00AD03780379037F-0383038B038D03A20526-05300557055805600588058B-059005C8-05CF05EB-05EF05F5-0605061C061D0620065F06DD070E070F074B074C07B2-07BF07FB-07FF082E082F083F-08FF093A093B094F095609570973-097809800984098D098E0991099209A909B109B3-09B509BA09BB09C509C609C909CA09CF-09D609D8-09DB09DE09E409E509FC-0A000A040A0B-0A0E0A110A120A290A310A340A370A3A0A3B0A3D0A43-0A460A490A4A0A4E-0A500A52-0A580A5D0A5F-0A650A76-0A800A840A8E0A920AA90AB10AB40ABA0ABB0AC60ACA0ACE0ACF0AD1-0ADF0AE40AE50AF00AF2-0B000B040B0D0B0E0B110B120B290B310B340B3A0B3B0B450B460B490B4A0B4E-0B550B58-0B5B0B5E0B640B650B72-0B810B840B8B-0B8D0B910B96-0B980B9B0B9D0BA0-0BA20BA5-0BA70BAB-0BAD0BBA-0BBD0BC3-0BC50BC90BCE0BCF0BD1-0BD60BD8-0BE50BFB-0C000C040C0D0C110C290C340C3A-0C3C0C450C490C4E-0C540C570C5A-0C5F0C640C650C70-0C770C800C810C840C8D0C910CA90CB40CBA0CBB0CC50CC90CCE-0CD40CD7-0CDD0CDF0CE40CE50CF00CF3-0D010D040D0D0D110D290D3A-0D3C0D450D490D4E-0D560D58-0D5F0D640D650D76-0D780D800D810D840D97-0D990DB20DBC0DBE0DBF0DC7-0DC90DCB-0DCE0DD50DD70DE0-0DF10DF5-0E000E3B-0E3E0E5C-0E800E830E850E860E890E8B0E8C0E8E-0E930E980EA00EA40EA60EA80EA90EAC0EBA0EBE0EBF0EC50EC70ECE0ECF0EDA0EDB0EDE-0EFF0F480F6D-0F700F8C-0F8F0F980FBD0FCD0FD9-0FFF10C6-10CF10FD-10FF1249124E124F12571259125E125F1289128E128F12B112B612B712BF12C112C612C712D7131113161317135B-135E137D-137F139A-139F13F5-13FF169D-169F16F1-16FF170D1715-171F1737-173F1754-175F176D17711774-177F17B417B517DE17DF17EA-17EF17FA-17FF180F181A-181F1878-187F18AB-18AF18F6-18FF191D-191F192C-192F193C-193F1941-1943196E196F1975-197F19AC-19AF19CA-19CF19DB-19DD1A1C1A1D1A5F1A7D1A7E1A8A-1A8F1A9A-1A9F1AAE-1AFF1B4C-1B4F1B7D-1B7F1BAB-1BAD1BBA-1BFF1C38-1C3A1C4A-1C4C1C80-1CCF1CF3-1CFF1DE7-1DFC1F161F171F1E1F1F1F461F471F4E1F4F1F581F5A1F5C1F5E1F7E1F7F1FB51FC51FD41FD51FDC1FF01FF11FF51FFF200B-200F202A-202E2060-206F20722073208F2095-209F20B9-20CF20F1-20FF218A-218F23E9-23FF2427-243F244B-245F26CE26E226E4-26E727002705270A270B2728274C274E2753-2755275F27602795-279727B027BF27CB27CD-27CF2B4D-2B4F2B5A-2BFF2C2F2C5F2CF2-2CF82D26-2D2F2D66-2D6E2D70-2D7F2D97-2D9F2DA72DAF2DB72DBF2DC72DCF2DD72DDF2E32-2E7F2E9A2EF4-2EFF2FD6-2FEF2FFC-2FFF3040309730983100-3104312E-3130318F31B8-31BF31E4-31EF321F32FF4DB6-4DBF9FCC-9FFFA48D-A48FA4C7-A4CFA62C-A63FA660A661A674-A67BA698-A69FA6F8-A6FFA78D-A7FAA82C-A82FA83A-A83FA878-A87FA8C5-A8CDA8DA-A8DFA8FC-A8FFA954-A95EA97D-A97FA9CEA9DA-A9DDA9E0-A9FFAA37-AA3FAA4EAA4FAA5AAA5BAA7C-AA7FAAC3-AADAAAE0-ABBFABEEABEFABFA-ABFFD7A4-D7AFD7C7-D7CAD7FC-F8FFFA2EFA2FFA6EFA6FFADA-FAFFFB07-FB12FB18-FB1CFB37FB3DFB3FFB42FB45FBB2-FBD2FD40-FD4FFD90FD91FDC8-FDEFFDFEFDFFFE1A-FE1FFE27-FE2FFE53FE67FE6C-FE6FFE75FEFD-FF00FFBF-FFC1FFC8FFC9FFD0FFD1FFD8FFD9FFDD-FFDFFFE7FFEF-FFFBFFFEFFFF", - Cc: "0000-001F007F-009F", - Cf: "00AD0600-060306DD070F17B417B5200B-200F202A-202E2060-2064206A-206FFEFFFFF9-FFFB", - Co: "E000-F8FF", - Cs: "D800-DFFF", - Cn: "03780379037F-0383038B038D03A20526-05300557055805600588058B-059005C8-05CF05EB-05EF05F5-05FF06040605061C061D0620065F070E074B074C07B2-07BF07FB-07FF082E082F083F-08FF093A093B094F095609570973-097809800984098D098E0991099209A909B109B3-09B509BA09BB09C509C609C909CA09CF-09D609D8-09DB09DE09E409E509FC-0A000A040A0B-0A0E0A110A120A290A310A340A370A3A0A3B0A3D0A43-0A460A490A4A0A4E-0A500A52-0A580A5D0A5F-0A650A76-0A800A840A8E0A920AA90AB10AB40ABA0ABB0AC60ACA0ACE0ACF0AD1-0ADF0AE40AE50AF00AF2-0B000B040B0D0B0E0B110B120B290B310B340B3A0B3B0B450B460B490B4A0B4E-0B550B58-0B5B0B5E0B640B650B72-0B810B840B8B-0B8D0B910B96-0B980B9B0B9D0BA0-0BA20BA5-0BA70BAB-0BAD0BBA-0BBD0BC3-0BC50BC90BCE0BCF0BD1-0BD60BD8-0BE50BFB-0C000C040C0D0C110C290C340C3A-0C3C0C450C490C4E-0C540C570C5A-0C5F0C640C650C70-0C770C800C810C840C8D0C910CA90CB40CBA0CBB0CC50CC90CCE-0CD40CD7-0CDD0CDF0CE40CE50CF00CF3-0D010D040D0D0D110D290D3A-0D3C0D450D490D4E-0D560D58-0D5F0D640D650D76-0D780D800D810D840D97-0D990DB20DBC0DBE0DBF0DC7-0DC90DCB-0DCE0DD50DD70DE0-0DF10DF5-0E000E3B-0E3E0E5C-0E800E830E850E860E890E8B0E8C0E8E-0E930E980EA00EA40EA60EA80EA90EAC0EBA0EBE0EBF0EC50EC70ECE0ECF0EDA0EDB0EDE-0EFF0F480F6D-0F700F8C-0F8F0F980FBD0FCD0FD9-0FFF10C6-10CF10FD-10FF1249124E124F12571259125E125F1289128E128F12B112B612B712BF12C112C612C712D7131113161317135B-135E137D-137F139A-139F13F5-13FF169D-169F16F1-16FF170D1715-171F1737-173F1754-175F176D17711774-177F17DE17DF17EA-17EF17FA-17FF180F181A-181F1878-187F18AB-18AF18F6-18FF191D-191F192C-192F193C-193F1941-1943196E196F1975-197F19AC-19AF19CA-19CF19DB-19DD1A1C1A1D1A5F1A7D1A7E1A8A-1A8F1A9A-1A9F1AAE-1AFF1B4C-1B4F1B7D-1B7F1BAB-1BAD1BBA-1BFF1C38-1C3A1C4A-1C4C1C80-1CCF1CF3-1CFF1DE7-1DFC1F161F171F1E1F1F1F461F471F4E1F4F1F581F5A1F5C1F5E1F7E1F7F1FB51FC51FD41FD51FDC1FF01FF11FF51FFF2065-206920722073208F2095-209F20B9-20CF20F1-20FF218A-218F23E9-23FF2427-243F244B-245F26CE26E226E4-26E727002705270A270B2728274C274E2753-2755275F27602795-279727B027BF27CB27CD-27CF2B4D-2B4F2B5A-2BFF2C2F2C5F2CF2-2CF82D26-2D2F2D66-2D6E2D70-2D7F2D97-2D9F2DA72DAF2DB72DBF2DC72DCF2DD72DDF2E32-2E7F2E9A2EF4-2EFF2FD6-2FEF2FFC-2FFF3040309730983100-3104312E-3130318F31B8-31BF31E4-31EF321F32FF4DB6-4DBF9FCC-9FFFA48D-A48FA4C7-A4CFA62C-A63FA660A661A674-A67BA698-A69FA6F8-A6FFA78D-A7FAA82C-A82FA83A-A83FA878-A87FA8C5-A8CDA8DA-A8DFA8FC-A8FFA954-A95EA97D-A97FA9CEA9DA-A9DDA9E0-A9FFAA37-AA3FAA4EAA4FAA5AAA5BAA7C-AA7FAAC3-AADAAAE0-ABBFABEEABEFABFA-ABFFD7A4-D7AFD7C7-D7CAD7FC-D7FFFA2EFA2FFA6EFA6FFADA-FAFFFB07-FB12FB18-FB1CFB37FB3DFB3FFB42FB45FBB2-FBD2FD40-FD4FFD90FD91FDC8-FDEFFDFEFDFFFE1A-FE1FFE27-FE2FFE53FE67FE6C-FE6FFE75FEFDFEFEFF00FFBF-FFC1FFC8FFC9FFD0FFD1FFD8FFD9FFDD-FFDFFFE7FFEF-FFF8FFFEFFFF" -}); - -function addUnicodePackage (pack) { - var codePoint = /\w{4}/g; - for (var name in pack) - exports.packages[name] = pack[name].replace(codePoint, "\\u$&"); -}; - -}); - -define('ace/token_iterator', ['require', 'exports', 'module' ], function(require, exports, module) { -var TokenIterator = function(session, initialRow, initialColumn) { - this.$session = session; - this.$row = initialRow; - this.$rowTokens = session.getTokens(initialRow); - - var token = session.getTokenAt(initialRow, initialColumn); - this.$tokenIndex = token ? token.index : -1; -}; - -(function() { - this.stepBackward = function() { - this.$tokenIndex -= 1; - - while (this.$tokenIndex < 0) { - this.$row -= 1; - if (this.$row < 0) { - this.$row = 0; - return null; - } - - this.$rowTokens = this.$session.getTokens(this.$row); - this.$tokenIndex = this.$rowTokens.length - 1; - } - - return this.$rowTokens[this.$tokenIndex]; - }; - this.stepForward = function() { - this.$tokenIndex += 1; - var rowCount; - while (this.$tokenIndex >= this.$rowTokens.length) { - this.$row += 1; - if (!rowCount) - rowCount = this.$session.getLength(); - if (this.$row >= rowCount) { - this.$row = rowCount - 1; - return null; - } - - this.$rowTokens = this.$session.getTokens(this.$row); - this.$tokenIndex = 0; - } - - return this.$rowTokens[this.$tokenIndex]; - }; - this.getCurrentToken = function () { - return this.$rowTokens[this.$tokenIndex]; - }; - this.getCurrentTokenRow = function () { - return this.$row; - }; - this.getCurrentTokenColumn = function() { - var rowTokens = this.$rowTokens; - var tokenIndex = this.$tokenIndex; - var column = rowTokens[tokenIndex].start; - if (column !== undefined) - return column; - - column = 0; - while (tokenIndex > 0) { - tokenIndex -= 1; - column += rowTokens[tokenIndex].value.length; - } - - return column; - }; - -}).call(TokenIterator.prototype); - -exports.TokenIterator = TokenIterator; -}); - -define('ace/document', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event_emitter', 'ace/range', 'ace/anchor'], function(require, exports, module) { - - -var oop = require("./lib/oop"); -var EventEmitter = require("./lib/event_emitter").EventEmitter; -var Range = require("./range").Range; -var Anchor = require("./anchor").Anchor; - -var Document = function(text) { - this.$lines = []; - if (text.length == 0) { - this.$lines = [""]; - } else if (Array.isArray(text)) { - this._insertLines(0, text); - } else { - this.insert({row: 0, column:0}, text); - } -}; - -(function() { - - oop.implement(this, EventEmitter); - this.setValue = function(text) { - var len = this.getLength(); - this.remove(new Range(0, 0, len, this.getLine(len-1).length)); - this.insert({row: 0, column:0}, text); - }; - this.getValue = function() { - return this.getAllLines().join(this.getNewLineCharacter()); - }; - this.createAnchor = function(row, column) { - return new Anchor(this, row, column); - }; - if ("aaa".split(/a/).length == 0) - this.$split = function(text) { - return text.replace(/\r\n|\r/g, "\n").split("\n"); - } - else - this.$split = function(text) { - return text.split(/\r\n|\r|\n/); - }; - - - this.$detectNewLine = function(text) { - var match = text.match(/^.*?(\r\n|\r|\n)/m); - this.$autoNewLine = match ? match[1] : "\n"; - }; - this.getNewLineCharacter = function() { - switch (this.$newLineMode) { - case "windows": - return "\r\n"; - case "unix": - return "\n"; - default: - return this.$autoNewLine; - } - }; - - this.$autoNewLine = "\n"; - this.$newLineMode = "auto"; - this.setNewLineMode = function(newLineMode) { - if (this.$newLineMode === newLineMode) - return; - - this.$newLineMode = newLineMode; - }; - this.getNewLineMode = function() { - return this.$newLineMode; - }; - this.isNewLine = function(text) { - return (text == "\r\n" || text == "\r" || text == "\n"); - }; - this.getLine = function(row) { - return this.$lines[row] || ""; - }; - this.getLines = function(firstRow, lastRow) { - return this.$lines.slice(firstRow, lastRow + 1); - }; - this.getAllLines = function() { - return this.getLines(0, this.getLength()); - }; - this.getLength = function() { - return this.$lines.length; - }; - this.getTextRange = function(range) { - if (range.start.row == range.end.row) { - return this.getLine(range.start.row) - .substring(range.start.column, range.end.column); - } - var lines = this.getLines(range.start.row, range.end.row); - lines[0] = (lines[0] || "").substring(range.start.column); - var l = lines.length - 1; - if (range.end.row - range.start.row == l) - lines[l] = lines[l].substring(0, range.end.column); - return lines.join(this.getNewLineCharacter()); - }; - - this.$clipPosition = function(position) { - var length = this.getLength(); - if (position.row >= length) { - position.row = Math.max(0, length - 1); - position.column = this.getLine(length-1).length; - } else if (position.row < 0) - position.row = 0; - return position; - }; - this.insert = function(position, text) { - if (!text || text.length === 0) - return position; - - position = this.$clipPosition(position); - if (this.getLength() <= 1) - this.$detectNewLine(text); - - var lines = this.$split(text); - var firstLine = lines.splice(0, 1)[0]; - var lastLine = lines.length == 0 ? null : lines.splice(lines.length - 1, 1)[0]; - - position = this.insertInLine(position, firstLine); - if (lastLine !== null) { - position = this.insertNewLine(position); // terminate first line - position = this._insertLines(position.row, lines); - position = this.insertInLine(position, lastLine || ""); - } - return position; - }; - this.insertLines = function(row, lines) { - if (row >= this.getLength()) - return this.insert({row: row, column: 0}, "\n" + lines.join("\n")); - return this._insertLines(Math.max(row, 0), lines); - }; - this._insertLines = function(row, lines) { - if (lines.length == 0) - return {row: row, column: 0}; - if (lines.length > 0xFFFF) { - var end = this._insertLines(row, lines.slice(0xFFFF)); - lines = lines.slice(0, 0xFFFF); - } - - var args = [row, 0]; - args.push.apply(args, lines); - this.$lines.splice.apply(this.$lines, args); - - var range = new Range(row, 0, row + lines.length, 0); - var delta = { - action: "insertLines", - range: range, - lines: lines - }; - this._emit("change", { data: delta }); - return end || range.end; - }; - this.insertNewLine = function(position) { - position = this.$clipPosition(position); - var line = this.$lines[position.row] || ""; - - this.$lines[position.row] = line.substring(0, position.column); - this.$lines.splice(position.row + 1, 0, line.substring(position.column, line.length)); - - var end = { - row : position.row + 1, - column : 0 - }; - - var delta = { - action: "insertText", - range: Range.fromPoints(position, end), - text: this.getNewLineCharacter() - }; - this._emit("change", { data: delta }); - - return end; - }; - this.insertInLine = function(position, text) { - if (text.length == 0) - return position; - - var line = this.$lines[position.row] || ""; - - this.$lines[position.row] = line.substring(0, position.column) + text - + line.substring(position.column); - - var end = { - row : position.row, - column : position.column + text.length - }; - - var delta = { - action: "insertText", - range: Range.fromPoints(position, end), - text: text - }; - this._emit("change", { data: delta }); - - return end; - }; - this.remove = function(range) { - if (!range instanceof Range) - range = Range.fromPoints(range.start, range.end); - range.start = this.$clipPosition(range.start); - range.end = this.$clipPosition(range.end); - - if (range.isEmpty()) - return range.start; - - var firstRow = range.start.row; - var lastRow = range.end.row; - - if (range.isMultiLine()) { - var firstFullRow = range.start.column == 0 ? firstRow : firstRow + 1; - var lastFullRow = lastRow - 1; - - if (range.end.column > 0) - this.removeInLine(lastRow, 0, range.end.column); - - if (lastFullRow >= firstFullRow) - this._removeLines(firstFullRow, lastFullRow); - - if (firstFullRow != firstRow) { - this.removeInLine(firstRow, range.start.column, this.getLine(firstRow).length); - this.removeNewLine(range.start.row); - } - } - else { - this.removeInLine(firstRow, range.start.column, range.end.column); - } - return range.start; - }; - this.removeInLine = function(row, startColumn, endColumn) { - if (startColumn == endColumn) - return; - - var range = new Range(row, startColumn, row, endColumn); - var line = this.getLine(row); - var removed = line.substring(startColumn, endColumn); - var newLine = line.substring(0, startColumn) + line.substring(endColumn, line.length); - this.$lines.splice(row, 1, newLine); - - var delta = { - action: "removeText", - range: range, - text: removed - }; - this._emit("change", { data: delta }); - return range.start; - }; - this.removeLines = function(firstRow, lastRow) { - if (firstRow < 0 || lastRow >= this.getLength()) - return this.remove(new Range(firstRow, 0, lastRow + 1, 0)); - return this._removeLines(firstRow, lastRow); - }; - - this._removeLines = function(firstRow, lastRow) { - var range = new Range(firstRow, 0, lastRow + 1, 0); - var removed = this.$lines.splice(firstRow, lastRow - firstRow + 1); - - var delta = { - action: "removeLines", - range: range, - nl: this.getNewLineCharacter(), - lines: removed - }; - this._emit("change", { data: delta }); - return removed; - }; - this.removeNewLine = function(row) { - var firstLine = this.getLine(row); - var secondLine = this.getLine(row+1); - - var range = new Range(row, firstLine.length, row+1, 0); - var line = firstLine + secondLine; - - this.$lines.splice(row, 2, line); - - var delta = { - action: "removeText", - range: range, - text: this.getNewLineCharacter() - }; - this._emit("change", { data: delta }); - }; - this.replace = function(range, text) { - if (!range instanceof Range) - range = Range.fromPoints(range.start, range.end); - if (text.length == 0 && range.isEmpty()) - return range.start; - if (text == this.getTextRange(range)) - return range.end; - - this.remove(range); - if (text) { - var end = this.insert(range.start, text); - } - else { - end = range.start; - } - - return end; - }; - this.applyDeltas = function(deltas) { - for (var i=0; i=0; i--) { - var delta = deltas[i]; - - var range = Range.fromPoints(delta.range.start, delta.range.end); - - if (delta.action == "insertLines") - this._removeLines(range.start.row, range.end.row - 1); - else if (delta.action == "insertText") - this.remove(range); - else if (delta.action == "removeLines") - this._insertLines(range.start.row, delta.lines); - else if (delta.action == "removeText") - this.insert(range.start, delta.text); - } - }; - this.indexToPosition = function(index, startRow) { - var lines = this.$lines || this.getAllLines(); - var newlineLength = this.getNewLineCharacter().length; - for (var i = startRow || 0, l = lines.length; i < l; i++) { - index -= lines[i].length + newlineLength; - if (index < 0) - return {row: i, column: index + lines[i].length + newlineLength}; - } - return {row: l-1, column: lines[l-1].length}; - }; - this.positionToIndex = function(pos, startRow) { - var lines = this.$lines || this.getAllLines(); - var newlineLength = this.getNewLineCharacter().length; - var index = 0; - var row = Math.min(pos.row, lines.length); - for (var i = startRow || 0; i < row; ++i) - index += lines[i].length + newlineLength; - - return index + pos.column; - }; - -}).call(Document.prototype); - -exports.Document = Document; -}); - -define('ace/anchor', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event_emitter'], function(require, exports, module) { - - -var oop = require("./lib/oop"); -var EventEmitter = require("./lib/event_emitter").EventEmitter; - -var Anchor = exports.Anchor = function(doc, row, column) { - this.$onChange = this.onChange.bind(this); - this.attach(doc); - - if (typeof column == "undefined") - this.setPosition(row.row, row.column); - else - this.setPosition(row, column); -}; - -(function() { - - oop.implement(this, EventEmitter); - this.getPosition = function() { - return this.$clipPositionToDocument(this.row, this.column); - }; - this.getDocument = function() { - return this.document; - }; - this.$insertRight = false; - this.onChange = function(e) { - var delta = e.data; - var range = delta.range; - - if (range.start.row == range.end.row && range.start.row != this.row) - return; - - if (range.start.row > this.row) - return; - - if (range.start.row == this.row && range.start.column > this.column) - return; - - var row = this.row; - var column = this.column; - var start = range.start; - var end = range.end; - - if (delta.action === "insertText") { - if (start.row === row && start.column <= column) { - if (start.column === column && this.$insertRight) { - } else if (start.row === end.row) { - column += end.column - start.column; - } else { - column -= start.column; - row += end.row - start.row; - } - } else if (start.row !== end.row && start.row < row) { - row += end.row - start.row; - } - } else if (delta.action === "insertLines") { - if (start.row <= row) { - row += end.row - start.row; - } - } else if (delta.action === "removeText") { - if (start.row === row && start.column < column) { - if (end.column >= column) - column = start.column; - else - column = Math.max(0, column - (end.column - start.column)); - - } else if (start.row !== end.row && start.row < row) { - if (end.row === row) - column = Math.max(0, column - end.column) + start.column; - row -= (end.row - start.row); - } else if (end.row === row) { - row -= end.row - start.row; - column = Math.max(0, column - end.column) + start.column; - } - } else if (delta.action == "removeLines") { - if (start.row <= row) { - if (end.row <= row) - row -= end.row - start.row; - else { - row = start.row; - column = 0; - } - } - } - - this.setPosition(row, column, true); - }; - this.setPosition = function(row, column, noClip) { - var pos; - if (noClip) { - pos = { - row: row, - column: column - }; - } else { - pos = this.$clipPositionToDocument(row, column); - } - - if (this.row == pos.row && this.column == pos.column) - return; - - var old = { - row: this.row, - column: this.column - }; - - this.row = pos.row; - this.column = pos.column; - this._emit("change", { - old: old, - value: pos - }); - }; - this.detach = function() { - this.document.removeEventListener("change", this.$onChange); - }; - this.attach = function(doc) { - this.document = doc || this.document; - this.document.on("change", this.$onChange); - }; - this.$clipPositionToDocument = function(row, column) { - var pos = {}; - - if (row >= this.document.getLength()) { - pos.row = Math.max(0, this.document.getLength() - 1); - pos.column = this.document.getLine(pos.row).length; - } - else if (row < 0) { - pos.row = 0; - pos.column = 0; - } - else { - pos.row = row; - pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column)); - } - - if (column < 0) - pos.column = 0; - - return pos; - }; - -}).call(Anchor.prototype); - -}); - -define('ace/background_tokenizer', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event_emitter'], function(require, exports, module) { - - -var oop = require("./lib/oop"); -var EventEmitter = require("./lib/event_emitter").EventEmitter; - -var BackgroundTokenizer = function(tokenizer, editor) { - this.running = false; - this.lines = []; - this.states = []; - this.currentLine = 0; - this.tokenizer = tokenizer; - - var self = this; - - this.$worker = function() { - if (!self.running) { return; } - - var workerStart = new Date(); - var currentLine = self.currentLine; - var endLine = -1; - var doc = self.doc; - - while (self.lines[currentLine]) - currentLine++; - - var startLine = currentLine; - - var len = doc.getLength(); - var processedLines = 0; - self.running = false; - while (currentLine < len) { - self.$tokenizeRow(currentLine); - endLine = currentLine; - do { - currentLine++; - } while (self.lines[currentLine]); - processedLines ++; - if ((processedLines % 5 == 0) && (new Date() - workerStart) > 20) { - self.running = setTimeout(self.$worker, 20); - self.currentLine = currentLine; - return; - } - } - self.currentLine = currentLine; - - if (startLine <= endLine) - self.fireUpdateEvent(startLine, endLine); - }; -}; - -(function(){ - - oop.implement(this, EventEmitter); - this.setTokenizer = function(tokenizer) { - this.tokenizer = tokenizer; - this.lines = []; - this.states = []; - - this.start(0); - }; - this.setDocument = function(doc) { - this.doc = doc; - this.lines = []; - this.states = []; - - this.stop(); - }; - this.fireUpdateEvent = function(firstRow, lastRow) { - var data = { - first: firstRow, - last: lastRow - }; - this._emit("update", {data: data}); - }; - this.start = function(startRow) { - this.currentLine = Math.min(startRow || 0, this.currentLine, this.doc.getLength()); - this.lines.splice(this.currentLine, this.lines.length); - this.states.splice(this.currentLine, this.states.length); - - this.stop(); - this.running = setTimeout(this.$worker, 700); - }; - - this.scheduleStart = function() { - if (!this.running) - this.running = setTimeout(this.$worker, 700); - } - - this.$updateOnChange = function(delta) { - var range = delta.range; - var startRow = range.start.row; - var len = range.end.row - startRow; - - if (len === 0) { - this.lines[startRow] = null; - } else if (delta.action == "removeText" || delta.action == "removeLines") { - this.lines.splice(startRow, len + 1, null); - this.states.splice(startRow, len + 1, null); - } else { - var args = Array(len + 1); - args.unshift(startRow, 1); - this.lines.splice.apply(this.lines, args); - this.states.splice.apply(this.states, args); - } - - this.currentLine = Math.min(startRow, this.currentLine, this.doc.getLength()); - - this.stop(); - }; - this.stop = function() { - if (this.running) - clearTimeout(this.running); - this.running = false; - }; - this.getTokens = function(row) { - return this.lines[row] || this.$tokenizeRow(row); - }; - this.getState = function(row) { - if (this.currentLine == row) - this.$tokenizeRow(row); - return this.states[row] || "start"; - }; - - this.$tokenizeRow = function(row) { - var line = this.doc.getLine(row); - var state = this.states[row - 1]; - - var data = this.tokenizer.getLineTokens(line, state, row); - - if (this.states[row] + "" !== data.state + "") { - this.states[row] = data.state; - this.lines[row + 1] = null; - if (this.currentLine > row + 1) - this.currentLine = row + 1; - } else if (this.currentLine == row) { - this.currentLine = row + 1; - } - - return this.lines[row] = data.tokens; - }; - -}).call(BackgroundTokenizer.prototype); - -exports.BackgroundTokenizer = BackgroundTokenizer; -}); - -define('ace/search_highlight', ['require', 'exports', 'module' , 'ace/lib/lang', 'ace/lib/oop', 'ace/range'], function(require, exports, module) { - - -var lang = require("./lib/lang"); -var oop = require("./lib/oop"); -var Range = require("./range").Range; - -var SearchHighlight = function(regExp, clazz, type) { - this.setRegexp(regExp); - this.clazz = clazz; - this.type = type || "text"; -}; - -(function() { - this.MAX_RANGES = 500; - - this.setRegexp = function(regExp) { - if (this.regExp+"" == regExp+"") - return; - this.regExp = regExp; - this.cache = []; - }; - - this.update = function(html, markerLayer, session, config) { - if (!this.regExp) - return; - var start = config.firstRow, end = config.lastRow; - - for (var i = start; i <= end; i++) { - var ranges = this.cache[i]; - if (ranges == null) { - ranges = lang.getMatchOffsets(session.getLine(i), this.regExp); - if (ranges.length > this.MAX_RANGES) - ranges = ranges.slice(0, this.MAX_RANGES); - ranges = ranges.map(function(match) { - return new Range(i, match.offset, i, match.offset + match.length); - }); - this.cache[i] = ranges.length ? ranges : ""; - } - - for (var j = ranges.length; j --; ) { - markerLayer.drawSingleLineMarker( - html, ranges[j].toScreenRange(session), this.clazz, config); - } - } - }; - -}).call(SearchHighlight.prototype); - -exports.SearchHighlight = SearchHighlight; -}); - -define('ace/edit_session/folding', ['require', 'exports', 'module' , 'ace/range', 'ace/edit_session/fold_line', 'ace/edit_session/fold', 'ace/token_iterator'], function(require, exports, module) { - - -var Range = require("../range").Range; -var FoldLine = require("./fold_line").FoldLine; -var Fold = require("./fold").Fold; -var TokenIterator = require("../token_iterator").TokenIterator; - -function Folding() { - this.getFoldAt = function(row, column, side) { - var foldLine = this.getFoldLine(row); - if (!foldLine) - return null; - - var folds = foldLine.folds; - for (var i = 0; i < folds.length; i++) { - var fold = folds[i]; - if (fold.range.contains(row, column)) { - if (side == 1 && fold.range.isEnd(row, column)) { - continue; - } else if (side == -1 && fold.range.isStart(row, column)) { - continue; - } - return fold; - } - } - }; - this.getFoldsInRange = function(range) { - var start = range.start; - var end = range.end; - var foldLines = this.$foldData; - var foundFolds = []; - - start.column += 1; - end.column -= 1; - - for (var i = 0; i < foldLines.length; i++) { - var cmp = foldLines[i].range.compareRange(range); - if (cmp == 2) { - continue; - } - else if (cmp == -2) { - break; - } - - var folds = foldLines[i].folds; - for (var j = 0; j < folds.length; j++) { - var fold = folds[j]; - cmp = fold.range.compareRange(range); - if (cmp == -2) { - break; - } else if (cmp == 2) { - continue; - } else - if (cmp == 42) { - break; - } - foundFolds.push(fold); - } - } - start.column -= 1; - end.column += 1; - - return foundFolds; - }; - this.getAllFolds = function() { - var folds = []; - var foldLines = this.$foldData; - - function addFold(fold) { - folds.push(fold); - } - - for (var i = 0; i < foldLines.length; i++) - for (var j = 0; j < foldLines[i].folds.length; j++) - addFold(foldLines[i].folds[j]); - - return folds; - }; - this.getFoldStringAt = function(row, column, trim, foldLine) { - foldLine = foldLine || this.getFoldLine(row); - if (!foldLine) - return null; - - var lastFold = { - end: { column: 0 } - }; - var str, fold; - for (var i = 0; i < foldLine.folds.length; i++) { - fold = foldLine.folds[i]; - var cmp = fold.range.compareEnd(row, column); - if (cmp == -1) { - str = this - .getLine(fold.start.row) - .substring(lastFold.end.column, fold.start.column); - break; - } - else if (cmp === 0) { - return null; - } - lastFold = fold; - } - if (!str) - str = this.getLine(fold.start.row).substring(lastFold.end.column); - - if (trim == -1) - return str.substring(0, column - lastFold.end.column); - else if (trim == 1) - return str.substring(column - lastFold.end.column); - else - return str; - }; - - this.getFoldLine = function(docRow, startFoldLine) { - var foldData = this.$foldData; - var i = 0; - if (startFoldLine) - i = foldData.indexOf(startFoldLine); - if (i == -1) - i = 0; - for (i; i < foldData.length; i++) { - var foldLine = foldData[i]; - if (foldLine.start.row <= docRow && foldLine.end.row >= docRow) { - return foldLine; - } else if (foldLine.end.row > docRow) { - return null; - } - } - return null; - }; - this.getNextFoldLine = function(docRow, startFoldLine) { - var foldData = this.$foldData; - var i = 0; - if (startFoldLine) - i = foldData.indexOf(startFoldLine); - if (i == -1) - i = 0; - for (i; i < foldData.length; i++) { - var foldLine = foldData[i]; - if (foldLine.end.row >= docRow) { - return foldLine; - } - } - return null; - }; - - this.getFoldedRowCount = function(first, last) { - var foldData = this.$foldData, rowCount = last-first+1; - for (var i = 0; i < foldData.length; i++) { - var foldLine = foldData[i], - end = foldLine.end.row, - start = foldLine.start.row; - if (end >= last) { - if(start < last) { - if(start >= first) - rowCount -= last-start; - else - rowCount = 0;//in one fold - } - break; - } else if(end >= first){ - if (start >= first) //fold inside range - rowCount -= end-start; - else - rowCount -= end-first+1; - } - } - return rowCount; - }; - - this.$addFoldLine = function(foldLine) { - this.$foldData.push(foldLine); - this.$foldData.sort(function(a, b) { - return a.start.row - b.start.row; - }); - return foldLine; - }; - this.addFold = function(placeholder, range) { - var foldData = this.$foldData; - var added = false; - var fold; - - if (placeholder instanceof Fold) - fold = placeholder; - else { - fold = new Fold(range, placeholder); - fold.collapseChildren = range.collapseChildren; - } - this.$clipRangeToDocument(fold.range); - - var startRow = fold.start.row; - var startColumn = fold.start.column; - var endRow = fold.end.row; - var endColumn = fold.end.column; - if (!(startRow < endRow || - startRow == endRow && startColumn <= endColumn - 2)) - throw new Error("The range has to be at least 2 characters width"); - - var startFold = this.getFoldAt(startRow, startColumn, 1); - var endFold = this.getFoldAt(endRow, endColumn, -1); - if (startFold && endFold == startFold) - return startFold.addSubFold(fold); - - if ( - (startFold && !startFold.range.isStart(startRow, startColumn)) - || (endFold && !endFold.range.isEnd(endRow, endColumn)) - ) { - throw new Error("A fold can't intersect already existing fold" + fold.range + startFold.range); - } - var folds = this.getFoldsInRange(fold.range); - if (folds.length > 0) { - this.removeFolds(folds); - folds.forEach(function(subFold) { - fold.addSubFold(subFold); - }); - } - - for (var i = 0; i < foldData.length; i++) { - var foldLine = foldData[i]; - if (endRow == foldLine.start.row) { - foldLine.addFold(fold); - added = true; - break; - } else if (startRow == foldLine.end.row) { - foldLine.addFold(fold); - added = true; - if (!fold.sameRow) { - var foldLineNext = foldData[i + 1]; - if (foldLineNext && foldLineNext.start.row == endRow) { - foldLine.merge(foldLineNext); - break; - } - } - break; - } else if (endRow <= foldLine.start.row) { - break; - } - } - - if (!added) - foldLine = this.$addFoldLine(new FoldLine(this.$foldData, fold)); - - if (this.$useWrapMode) - this.$updateWrapData(foldLine.start.row, foldLine.start.row); - else - this.$updateRowLengthCache(foldLine.start.row, foldLine.start.row); - this.$modified = true; - this._emit("changeFold", { data: fold, action: "add" }); - - return fold; - }; - - this.addFolds = function(folds) { - folds.forEach(function(fold) { - this.addFold(fold); - }, this); - }; - - this.removeFold = function(fold) { - var foldLine = fold.foldLine; - var startRow = foldLine.start.row; - var endRow = foldLine.end.row; - - var foldLines = this.$foldData; - var folds = foldLine.folds; - if (folds.length == 1) { - foldLines.splice(foldLines.indexOf(foldLine), 1); - } else - if (foldLine.range.isEnd(fold.end.row, fold.end.column)) { - folds.pop(); - foldLine.end.row = folds[folds.length - 1].end.row; - foldLine.end.column = folds[folds.length - 1].end.column; - } else - if (foldLine.range.isStart(fold.start.row, fold.start.column)) { - folds.shift(); - foldLine.start.row = folds[0].start.row; - foldLine.start.column = folds[0].start.column; - } else - if (fold.sameRow) { - folds.splice(folds.indexOf(fold), 1); - } else - { - var newFoldLine = foldLine.split(fold.start.row, fold.start.column); - folds = newFoldLine.folds; - folds.shift(); - newFoldLine.start.row = folds[0].start.row; - newFoldLine.start.column = folds[0].start.column; - } - - if (!this.$updating) { - if (this.$useWrapMode) - this.$updateWrapData(startRow, endRow); - else - this.$updateRowLengthCache(startRow, endRow); - } - this.$modified = true; - this._emit("changeFold", { data: fold, action: "remove" }); - }; - - this.removeFolds = function(folds) { - var cloneFolds = []; - for (var i = 0; i < folds.length; i++) { - cloneFolds.push(folds[i]); - } - - cloneFolds.forEach(function(fold) { - this.removeFold(fold); - }, this); - this.$modified = true; - }; - - this.expandFold = function(fold) { - this.removeFold(fold); - fold.subFolds.forEach(function(subFold) { - fold.restoreRange(subFold); - this.addFold(subFold); - }, this); - if (fold.collapseChildren > 0) { - this.foldAll(fold.start.row+1, fold.end.row, fold.collapseChildren-1); - } - fold.subFolds = []; - }; - - this.expandFolds = function(folds) { - folds.forEach(function(fold) { - this.expandFold(fold); - }, this); - }; - - this.unfold = function(location, expandInner) { - var range, folds; - if (location == null) { - range = new Range(0, 0, this.getLength(), 0); - expandInner = true; - } else if (typeof location == "number") - range = new Range(location, 0, location, this.getLine(location).length); - else if ("row" in location) - range = Range.fromPoints(location, location); - else - range = location; - - folds = this.getFoldsInRange(range); - if (expandInner) { - this.removeFolds(folds); - } else { - while (folds.length) { - this.expandFolds(folds); - folds = this.getFoldsInRange(range); - } - } - }; - this.isRowFolded = function(docRow, startFoldRow) { - return !!this.getFoldLine(docRow, startFoldRow); - }; - - this.getRowFoldEnd = function(docRow, startFoldRow) { - var foldLine = this.getFoldLine(docRow, startFoldRow); - return foldLine ? foldLine.end.row : docRow; - }; - - this.getRowFoldStart = function(docRow, startFoldRow) { - var foldLine = this.getFoldLine(docRow, startFoldRow); - return foldLine ? foldLine.start.row : docRow; - }; - - this.getFoldDisplayLine = function(foldLine, endRow, endColumn, startRow, startColumn) { - if (startRow == null) { - startRow = foldLine.start.row; - startColumn = 0; - } - - if (endRow == null) { - endRow = foldLine.end.row; - endColumn = this.getLine(endRow).length; - } - var doc = this.doc; - var textLine = ""; - - foldLine.walk(function(placeholder, row, column, lastColumn) { - if (row < startRow) - return; - if (row == startRow) { - if (column < startColumn) - return; - lastColumn = Math.max(startColumn, lastColumn); - } - - if (placeholder != null) { - textLine += placeholder; - } else { - textLine += doc.getLine(row).substring(lastColumn, column); - } - }, endRow, endColumn); - return textLine; - }; - - this.getDisplayLine = function(row, endColumn, startRow, startColumn) { - var foldLine = this.getFoldLine(row); - - if (!foldLine) { - var line; - line = this.doc.getLine(row); - return line.substring(startColumn || 0, endColumn || line.length); - } else { - return this.getFoldDisplayLine( - foldLine, row, endColumn, startRow, startColumn); - } - }; - - this.$cloneFoldData = function() { - var fd = []; - fd = this.$foldData.map(function(foldLine) { - var folds = foldLine.folds.map(function(fold) { - return fold.clone(); - }); - return new FoldLine(fd, folds); - }); - - return fd; - }; - - this.toggleFold = function(tryToUnfold) { - var selection = this.selection; - var range = selection.getRange(); - var fold; - var bracketPos; - - if (range.isEmpty()) { - var cursor = range.start; - fold = this.getFoldAt(cursor.row, cursor.column); - - if (fold) { - this.expandFold(fold); - return; - } else if (bracketPos = this.findMatchingBracket(cursor)) { - if (range.comparePoint(bracketPos) == 1) { - range.end = bracketPos; - } else { - range.start = bracketPos; - range.start.column++; - range.end.column--; - } - } else if (bracketPos = this.findMatchingBracket({row: cursor.row, column: cursor.column + 1})) { - if (range.comparePoint(bracketPos) == 1) - range.end = bracketPos; - else - range.start = bracketPos; - - range.start.column++; - } else { - range = this.getCommentFoldRange(cursor.row, cursor.column) || range; - } - } else { - var folds = this.getFoldsInRange(range); - if (tryToUnfold && folds.length) { - this.expandFolds(folds); - return; - } else if (folds.length == 1 ) { - fold = folds[0]; - } - } - - if (!fold) - fold = this.getFoldAt(range.start.row, range.start.column); - - if (fold && fold.range.toString() == range.toString()) { - this.expandFold(fold); - return; - } - - var placeholder = "..."; - if (!range.isMultiLine()) { - placeholder = this.getTextRange(range); - if(placeholder.length < 4) - return; - placeholder = placeholder.trim().substring(0, 2) + ".."; - } - - this.addFold(placeholder, range); - }; - - this.getCommentFoldRange = function(row, column, dir) { - var iterator = new TokenIterator(this, row, column); - var token = iterator.getCurrentToken(); - if (token && /^comment|string/.test(token.type)) { - var range = new Range(); - var re = new RegExp(token.type.replace(/\..*/, "\\.")); - if (dir != 1) { - do { - token = iterator.stepBackward(); - } while(token && re.test(token.type)); - iterator.stepForward(); - } - - range.start.row = iterator.getCurrentTokenRow(); - range.start.column = iterator.getCurrentTokenColumn() + 2; - - iterator = new TokenIterator(this, row, column); - - if (dir != -1) { - do { - token = iterator.stepForward(); - } while(token && re.test(token.type)); - token = iterator.stepBackward(); - } else - token = iterator.getCurrentToken(); - - range.end.row = iterator.getCurrentTokenRow(); - range.end.column = iterator.getCurrentTokenColumn() + token.value.length - 2; - return range; - } - }; - - this.foldAll = function(startRow, endRow, depth) { - if (depth == undefined) - depth = 100000; // JSON.stringify doesn't hanle Infinity - var foldWidgets = this.foldWidgets; - endRow = endRow || this.getLength(); - startRow = startRow || 0; - for (var row = startRow; row < endRow; row++) { - if (foldWidgets[row] == null) - foldWidgets[row] = this.getFoldWidget(row); - if (foldWidgets[row] != "start") - continue; - - var range = this.getFoldWidgetRange(row); - var rangeEndRow = range.end.row; - if (range && range.isMultiLine() - && rangeEndRow <= endRow - && range.start.row >= startRow - ) try { - var fold = this.addFold("...", range); - fold.collapseChildren = depth; - row = rangeEndRow; - } catch(e) {} - } - }; - this.$foldStyles = { - "manual": 1, - "markbegin": 1, - "markbeginend": 1 - }; - this.$foldStyle = "markbegin"; - this.setFoldStyle = function(style) { - if (!this.$foldStyles[style]) - throw new Error("invalid fold style: " + style + "[" + Object.keys(this.$foldStyles).join(", ") + "]"); - - if (this.$foldStyle == style) - return; - - this.$foldStyle = style; - - if (style == "manual") - this.unfold(); - var mode = this.$foldMode; - this.$setFolding(null); - this.$setFolding(mode); - }; - - this.$setFolding = function(foldMode) { - if (this.$foldMode == foldMode) - return; - - this.$foldMode = foldMode; - - this.removeListener('change', this.$updateFoldWidgets); - this._emit("changeAnnotation"); - - if (!foldMode || this.$foldStyle == "manual") { - this.foldWidgets = null; - return; - } - - this.foldWidgets = []; - this.getFoldWidget = foldMode.getFoldWidget.bind(foldMode, this, this.$foldStyle); - this.getFoldWidgetRange = foldMode.getFoldWidgetRange.bind(foldMode, this, this.$foldStyle); - - this.$updateFoldWidgets = this.updateFoldWidgets.bind(this); - this.on('change', this.$updateFoldWidgets); - - }; - - this.getParentFoldRangeData = function (row, ignoreCurrent) { - var fw = this.foldWidgets; - if (!fw || (ignoreCurrent && fw[row])) - return {}; - - var i = row - 1, firstRange; - while (i >= 0) { - var c = fw[i]; - if (c == null) - c = fw[i] = this.getFoldWidget(i); - - if (c == "start") { - var range = this.getFoldWidgetRange(i); - if (!firstRange) - firstRange = range; - if (range && range.end.row >= row) - break; - } - i--; - } - - return { - range: i !== -1 && range, - firstRange: firstRange - }; - } - - this.onFoldWidgetClick = function(row, e) { - var type = this.getFoldWidget(row); - var line = this.getLine(row); - e = e.domEvent; - var children = e.shiftKey; - var all = e.ctrlKey || e.metaKey; - var siblings = e.altKey; - - var dir = type === "end" ? -1 : 1; - var fold = this.getFoldAt(row, dir === -1 ? 0 : line.length, dir); - - if (fold) { - if (children || all) - this.removeFold(fold); - else - this.expandFold(fold); - return; - } - - var range = this.getFoldWidgetRange(row); - if (range && !range.isMultiLine()) { - fold = this.getFoldAt(range.start.row, range.start.column, 1); - if (fold && range.isEqual(fold.range)) { - this.removeFold(fold); - return; - } - } - - if (siblings) { - var data = this.getParentFoldRangeData(row); - if (data.range) { - var startRow = data.range.start.row + 1; - var endRow = data.range.end.row; - } - this.foldAll(startRow, endRow, all ? 10000 : 0); - } else if (children) { - var endRow = range ? range.end.row : this.getLength(); - this.foldAll(row + 1, range.end.row, all ? 10000 : 0); - } else if (range) { - if (all) - range.collapseChildren = 10000; - this.addFold("...", range); - } - - if (!range) - (e.target || e.srcElement).className += " ace_invalid" - }; - - this.updateFoldWidgets = function(e) { - var delta = e.data; - var range = delta.range; - var firstRow = range.start.row; - var len = range.end.row - firstRow; - - if (len === 0) { - this.foldWidgets[firstRow] = null; - } else if (delta.action == "removeText" || delta.action == "removeLines") { - this.foldWidgets.splice(firstRow, len + 1, null); - } else { - var args = Array(len + 1); - args.unshift(firstRow, 1); - this.foldWidgets.splice.apply(this.foldWidgets, args); - } - }; - -} - -exports.Folding = Folding; - -}); - -define('ace/edit_session/fold_line', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -var Range = require("../range").Range; -function FoldLine(foldData, folds) { - this.foldData = foldData; - if (Array.isArray(folds)) { - this.folds = folds; - } else { - folds = this.folds = [ folds ]; - } - - var last = folds[folds.length - 1] - this.range = new Range(folds[0].start.row, folds[0].start.column, - last.end.row, last.end.column); - this.start = this.range.start; - this.end = this.range.end; - - this.folds.forEach(function(fold) { - fold.setFoldLine(this); - }, this); -} - -(function() { - this.shiftRow = function(shift) { - this.start.row += shift; - this.end.row += shift; - this.folds.forEach(function(fold) { - fold.start.row += shift; - fold.end.row += shift; - }); - } - - this.addFold = function(fold) { - if (fold.sameRow) { - if (fold.start.row < this.startRow || fold.endRow > this.endRow) { - throw new Error("Can't add a fold to this FoldLine as it has no connection"); - } - this.folds.push(fold); - this.folds.sort(function(a, b) { - return -a.range.compareEnd(b.start.row, b.start.column); - }); - if (this.range.compareEnd(fold.start.row, fold.start.column) > 0) { - this.end.row = fold.end.row; - this.end.column = fold.end.column; - } else if (this.range.compareStart(fold.end.row, fold.end.column) < 0) { - this.start.row = fold.start.row; - this.start.column = fold.start.column; - } - } else if (fold.start.row == this.end.row) { - this.folds.push(fold); - this.end.row = fold.end.row; - this.end.column = fold.end.column; - } else if (fold.end.row == this.start.row) { - this.folds.unshift(fold); - this.start.row = fold.start.row; - this.start.column = fold.start.column; - } else { - throw new Error("Trying to add fold to FoldRow that doesn't have a matching row"); - } - fold.foldLine = this; - } - - this.containsRow = function(row) { - return row >= this.start.row && row <= this.end.row; - } - - this.walk = function(callback, endRow, endColumn) { - var lastEnd = 0, - folds = this.folds, - fold, - comp, stop, isNewRow = true; - - if (endRow == null) { - endRow = this.end.row; - endColumn = this.end.column; - } - - for (var i = 0; i < folds.length; i++) { - fold = folds[i]; - - comp = fold.range.compareStart(endRow, endColumn); - if (comp == -1) { - callback(null, endRow, endColumn, lastEnd, isNewRow); - return; - } - - stop = callback(null, fold.start.row, fold.start.column, lastEnd, isNewRow); - stop = !stop && callback(fold.placeholder, fold.start.row, fold.start.column, lastEnd); - if (stop || comp == 0) { - return; - } - isNewRow = !fold.sameRow; - lastEnd = fold.end.column; - } - callback(null, endRow, endColumn, lastEnd, isNewRow); - } - - this.getNextFoldTo = function(row, column) { - var fold, cmp; - for (var i = 0; i < this.folds.length; i++) { - fold = this.folds[i]; - cmp = fold.range.compareEnd(row, column); - if (cmp == -1) { - return { - fold: fold, - kind: "after" - }; - } else if (cmp == 0) { - return { - fold: fold, - kind: "inside" - } - } - } - return null; - } - - this.addRemoveChars = function(row, column, len) { - var ret = this.getNextFoldTo(row, column), - fold, folds; - if (ret) { - fold = ret.fold; - if (ret.kind == "inside" - && fold.start.column != column - && fold.start.row != row) - { - window.console && window.console.log(row, column, fold); - } else if (fold.start.row == row) { - folds = this.folds; - var i = folds.indexOf(fold); - if (i == 0) { - this.start.column += len; - } - for (i; i < folds.length; i++) { - fold = folds[i]; - fold.start.column += len; - if (!fold.sameRow) { - return; - } - fold.end.column += len; - } - this.end.column += len; - } - } - } - - this.split = function(row, column) { - var fold = this.getNextFoldTo(row, column).fold; - var folds = this.folds; - var foldData = this.foldData; - - if (!fold) - return null; - - var i = folds.indexOf(fold); - var foldBefore = folds[i - 1]; - this.end.row = foldBefore.end.row; - this.end.column = foldBefore.end.column; - folds = folds.splice(i, folds.length - i); - - var newFoldLine = new FoldLine(foldData, folds); - foldData.splice(foldData.indexOf(this) + 1, 0, newFoldLine); - return newFoldLine; - } - - this.merge = function(foldLineNext) { - var folds = foldLineNext.folds; - for (var i = 0; i < folds.length; i++) { - this.addFold(folds[i]); - } - var foldData = this.foldData; - foldData.splice(foldData.indexOf(foldLineNext), 1); - } - - this.toString = function() { - var ret = [this.range.toString() + ": [" ]; - - this.folds.forEach(function(fold) { - ret.push(" " + fold.toString()); - }); - ret.push("]") - return ret.join("\n"); - } - - this.idxToPosition = function(idx) { - var lastFoldEndColumn = 0; - var fold; - - for (var i = 0; i < this.folds.length; i++) { - var fold = this.folds[i]; - - idx -= fold.start.column - lastFoldEndColumn; - if (idx < 0) { - return { - row: fold.start.row, - column: fold.start.column + idx - }; - } - - idx -= fold.placeholder.length; - if (idx < 0) { - return fold.start; - } - - lastFoldEndColumn = fold.end.column; - } - - return { - row: this.end.row, - column: this.end.column + idx - }; - } -}).call(FoldLine.prototype); - -exports.FoldLine = FoldLine; -}); - -define('ace/edit_session/fold', ['require', 'exports', 'module' , 'ace/range', 'ace/range_list', 'ace/lib/oop'], function(require, exports, module) { - - -var Range = require("../range").Range; -var RangeList = require("../range_list").RangeList; -var oop = require("../lib/oop") -var Fold = exports.Fold = function(range, placeholder) { - this.foldLine = null; - this.placeholder = placeholder; - this.range = range; - this.start = range.start; - this.end = range.end; - - this.sameRow = range.start.row == range.end.row; - this.subFolds = this.ranges = []; -}; - -oop.inherits(Fold, RangeList); - -(function() { - - this.toString = function() { - return '"' + this.placeholder + '" ' + this.range.toString(); - }; - - this.setFoldLine = function(foldLine) { - this.foldLine = foldLine; - this.subFolds.forEach(function(fold) { - fold.setFoldLine(foldLine); - }); - }; - - this.clone = function() { - var range = this.range.clone(); - var fold = new Fold(range, this.placeholder); - this.subFolds.forEach(function(subFold) { - fold.subFolds.push(subFold.clone()); - }); - fold.collapseChildren = this.collapseChildren; - return fold; - }; - - this.addSubFold = function(fold) { - if (this.range.isEqual(fold)) - return; - - if (!this.range.containsRange(fold)) - throw new Error("A fold can't intersect already existing fold" + fold.range + this.range); - consumeRange(fold, this.start); - - var row = fold.start.row, column = fold.start.column; - for (var i = 0, cmp = -1; i < this.subFolds.length; i++) { - cmp = this.subFolds[i].range.compare(row, column); - if (cmp != 1) - break; - } - var afterStart = this.subFolds[i]; - - if (cmp == 0) - return afterStart.addSubFold(fold); - var row = fold.range.end.row, column = fold.range.end.column; - for (var j = i, cmp = -1; j < this.subFolds.length; j++) { - cmp = this.subFolds[j].range.compare(row, column); - if (cmp != 1) - break; - } - var afterEnd = this.subFolds[j]; - - if (cmp == 0) - throw new Error("A fold can't intersect already existing fold" + fold.range + this.range); - - var consumedFolds = this.subFolds.splice(i, j - i, fold); - fold.setFoldLine(this.foldLine); - - return fold; - }; - - this.restoreRange = function(range) { - return restoreRange(range, this.start); - }; - -}).call(Fold.prototype); - -function consumePoint(point, anchor) { - point.row -= anchor.row; - if (point.row == 0) - point.column -= anchor.column; -} -function consumeRange(range, anchor) { - consumePoint(range.start, anchor); - consumePoint(range.end, anchor); -} -function restorePoint(point, anchor) { - if (point.row == 0) - point.column += anchor.column; - point.row += anchor.row; -} -function restoreRange(range, anchor) { - restorePoint(range.start, anchor); - restorePoint(range.end, anchor); -} - -}); - -define('ace/range_list', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - -var Range = require("./range").Range; -var comparePoints = Range.comparePoints; - -var RangeList = function() { - this.ranges = []; -}; - -(function() { - this.comparePoints = comparePoints; - - this.pointIndex = function(pos, excludeEdges, startIndex) { - var list = this.ranges; - - for (var i = startIndex || 0; i < list.length; i++) { - var range = list[i]; - var cmpEnd = comparePoints(pos, range.end); - if (cmpEnd > 0) - continue; - var cmpStart = comparePoints(pos, range.start); - if (cmpEnd === 0) - return excludeEdges && cmpStart !== 0 ? -i-2 : i; - if (cmpStart > 0 || (cmpStart === 0 && !excludeEdges)) - return i; - - return -i-1; - } - return -i - 1; - }; - - this.add = function(range) { - var excludeEdges = !range.isEmpty(); - var startIndex = this.pointIndex(range.start, excludeEdges); - if (startIndex < 0) - startIndex = -startIndex - 1; - - var endIndex = this.pointIndex(range.end, excludeEdges, startIndex); - - if (endIndex < 0) - endIndex = -endIndex - 1; - else - endIndex++; - return this.ranges.splice(startIndex, endIndex - startIndex, range); - }; - - this.addList = function(list) { - var removed = []; - for (var i = list.length; i--; ) { - removed.push.call(removed, this.add(list[i])); - } - return removed; - }; - - this.substractPoint = function(pos) { - var i = this.pointIndex(pos); - - if (i >= 0) - return this.ranges.splice(i, 1); - }; - this.merge = function() { - var removed = []; - var list = this.ranges; - - list = list.sort(function(a, b) { - return comparePoints(a.start, b.start); - }); - - var next = list[0], range; - for (var i = 1; i < list.length; i++) { - range = next; - next = list[i]; - var cmp = comparePoints(range.end, next.start); - if (cmp < 0) - continue; - - if (cmp == 0 && !range.isEmpty() && !next.isEmpty()) - continue; - - if (comparePoints(range.end, next.end) < 0) { - range.end.row = next.end.row; - range.end.column = next.end.column; - } - - list.splice(i, 1); - removed.push(next); - next = range; - i--; - } - - this.ranges = list; - - return removed; - }; - - this.contains = function(row, column) { - return this.pointIndex({row: row, column: column}) >= 0; - }; - - this.containsPoint = function(pos) { - return this.pointIndex(pos) >= 0; - }; - - this.rangeAtPoint = function(pos) { - var i = this.pointIndex(pos); - if (i >= 0) - return this.ranges[i]; - }; - - - this.clipRows = function(startRow, endRow) { - var list = this.ranges; - if (list[0].start.row > endRow || list[list.length - 1].start.row < startRow) - return []; - - var startIndex = this.pointIndex({row: startRow, column: 0}); - if (startIndex < 0) - startIndex = -startIndex - 1; - var endIndex = this.pointIndex({row: endRow, column: 0}, startIndex); - if (endIndex < 0) - endIndex = -endIndex - 1; - - var clipped = []; - for (var i = startIndex; i < endIndex; i++) { - clipped.push(list[i]); - } - return clipped; - }; - - this.removeAll = function() { - return this.ranges.splice(0, this.ranges.length); - }; - - this.attach = function(session) { - if (this.session) - this.detach(); - - this.session = session; - this.onChange = this.$onChange.bind(this); - - this.session.on('change', this.onChange); - }; - - this.detach = function() { - if (!this.session) - return; - this.session.removeListener('change', this.onChange); - this.session = null; - }; - - this.$onChange = function(e) { - var changeRange = e.data.range; - if (e.data.action[0] == "i"){ - var start = changeRange.start; - var end = changeRange.end; - } else { - var end = changeRange.start; - var start = changeRange.end; - } - var startRow = start.row; - var endRow = end.row; - var lineDif = endRow - startRow; - - var colDiff = -start.column + end.column; - var ranges = this.ranges; - - for (var i = 0, n = ranges.length; i < n; i++) { - var r = ranges[i]; - if (r.end.row < startRow) - continue; - if (r.start.row > startRow) - break; - - if (r.start.row == startRow && r.start.column >= start.column ) { - if (r.start.column == start.column && this.$insertRight) { - } else { - r.start.column += colDiff; - r.start.row += lineDif; - } - } - if (r.end.row == startRow && r.end.column >= start.column) { - if (r.end.column == start.column && this.$insertRight) { - continue; - } - if (r.end.column == start.column && colDiff > 0 && i < n - 1) { - if (r.end.column > r.start.column && r.end.column == ranges[i+1].start.column) - r.end.column -= colDiff; - } - r.end.column += colDiff; - r.end.row += lineDif; - } - } - - if (lineDif != 0 && i < n) { - for (; i < n; i++) { - var r = ranges[i]; - r.start.row += lineDif; - r.end.row += lineDif; - } - } - }; - -}).call(RangeList.prototype); - -exports.RangeList = RangeList; -}); - -define('ace/edit_session/bracket_match', ['require', 'exports', 'module' , 'ace/token_iterator', 'ace/range'], function(require, exports, module) { - - -var TokenIterator = require("../token_iterator").TokenIterator; -var Range = require("../range").Range; - - -function BracketMatch() { - - this.findMatchingBracket = function(position, chr) { - if (position.column == 0) return null; - - var charBeforeCursor = chr || this.getLine(position.row).charAt(position.column-1); - if (charBeforeCursor == "") return null; - - var match = charBeforeCursor.match(/([\(\[\{])|([\)\]\}])/); - if (!match) - return null; - - if (match[1]) - return this.$findClosingBracket(match[1], position); - else - return this.$findOpeningBracket(match[2], position); - }; - - this.getBracketRange = function(pos) { - var line = this.getLine(pos.row); - var before = true, range; - - var chr = line.charAt(pos.column-1); - var match = chr && chr.match(/([\(\[\{])|([\)\]\}])/); - if (!match) { - chr = line.charAt(pos.column); - pos = {row: pos.row, column: pos.column + 1}; - match = chr && chr.match(/([\(\[\{])|([\)\]\}])/); - before = false; - } - if (!match) - return null; - - if (match[1]) { - var bracketPos = this.$findClosingBracket(match[1], pos); - if (!bracketPos) - return null; - range = Range.fromPoints(pos, bracketPos); - if (!before) { - range.end.column++; - range.start.column--; - } - range.cursor = range.end; - } else { - var bracketPos = this.$findOpeningBracket(match[2], pos); - if (!bracketPos) - return null; - range = Range.fromPoints(bracketPos, pos); - if (!before) { - range.start.column++; - range.end.column--; - } - range.cursor = range.start; - } - - return range; - }; - - this.$brackets = { - ")": "(", - "(": ")", - "]": "[", - "[": "]", - "{": "}", - "}": "{" - }; - - this.$findOpeningBracket = function(bracket, position, typeRe) { - var openBracket = this.$brackets[bracket]; - var depth = 1; - - var iterator = new TokenIterator(this, position.row, position.column); - var token = iterator.getCurrentToken(); - if (!token) - token = iterator.stepForward(); - if (!token) - return; - - if (!typeRe){ - typeRe = new RegExp( - "(\\.?" + - token.type.replace(".", "\\.").replace("rparen", ".paren") - + ")+" - ); - } - var valueIndex = position.column - iterator.getCurrentTokenColumn() - 2; - var value = token.value; - - while (true) { - - while (valueIndex >= 0) { - var chr = value.charAt(valueIndex); - if (chr == openBracket) { - depth -= 1; - if (depth == 0) { - return {row: iterator.getCurrentTokenRow(), - column: valueIndex + iterator.getCurrentTokenColumn()}; - } - } - else if (chr == bracket) { - depth += 1; - } - valueIndex -= 1; - } - do { - token = iterator.stepBackward(); - } while (token && !typeRe.test(token.type)); - - if (token == null) - break; - - value = token.value; - valueIndex = value.length - 1; - } - - return null; - }; - - this.$findClosingBracket = function(bracket, position, typeRe) { - var closingBracket = this.$brackets[bracket]; - var depth = 1; - - var iterator = new TokenIterator(this, position.row, position.column); - var token = iterator.getCurrentToken(); - if (!token) - token = iterator.stepForward(); - if (!token) - return; - - if (!typeRe){ - typeRe = new RegExp( - "(\\.?" + - token.type.replace(".", "\\.").replace("lparen", ".paren") - + ")+" - ); - } - var valueIndex = position.column - iterator.getCurrentTokenColumn(); - - while (true) { - - var value = token.value; - var valueLength = value.length; - while (valueIndex < valueLength) { - var chr = value.charAt(valueIndex); - if (chr == closingBracket) { - depth -= 1; - if (depth == 0) { - return {row: iterator.getCurrentTokenRow(), - column: valueIndex + iterator.getCurrentTokenColumn()}; - } - } - else if (chr == bracket) { - depth += 1; - } - valueIndex += 1; - } - do { - token = iterator.stepForward(); - } while (token && !typeRe.test(token.type)); - - if (token == null) - break; - - valueIndex = 0; - } - - return null; - }; -} -exports.BracketMatch = BracketMatch; - -}); - -define('ace/search', ['require', 'exports', 'module' , 'ace/lib/lang', 'ace/lib/oop', 'ace/range'], function(require, exports, module) { - - -var lang = require("./lib/lang"); -var oop = require("./lib/oop"); -var Range = require("./range").Range; - -var Search = function() { - this.$options = {}; -}; - -(function() { - this.set = function(options) { - oop.mixin(this.$options, options); - return this; - }; - this.getOptions = function() { - return lang.copyObject(this.$options); - }; - this.setOptions = function(options) { - this.$options = options; - }; - this.find = function(session) { - var iterator = this.$matchIterator(session, this.$options); - - if (!iterator) - return false; - - var firstRange = null; - iterator.forEach(function(range, row, offset) { - if (!range.start) { - var column = range.offset + (offset || 0); - firstRange = new Range(row, column, row, column+range.length); - } else - firstRange = range; - return true; - }); - - return firstRange; - }; - this.findAll = function(session) { - var options = this.$options; - if (!options.needle) - return []; - this.$assembleRegExp(options); - - var range = options.range; - var lines = range - ? session.getLines(range.start.row, range.end.row) - : session.doc.getAllLines(); - - var ranges = []; - var re = options.re; - if (options.$isMultiLine) { - var len = re.length; - var maxRow = lines.length - len; - for (var row = re.offset || 0; row <= maxRow; row++) { - for (var j = 0; j < len; j++) - if (lines[row + j].search(re[j]) == -1) - break; - - var startLine = lines[row]; - var line = lines[row + len - 1]; - var startIndex = startLine.match(re[0])[0].length; - var endIndex = line.match(re[len - 1])[0].length; - - ranges.push(new Range( - row, startLine.length - startIndex, - row + len - 1, endIndex - )); - } - } else { - for (var i = 0; i < lines.length; i++) { - var matches = lang.getMatchOffsets(lines[i], re); - for (var j = 0; j < matches.length; j++) { - var match = matches[j]; - ranges.push(new Range(i, match.offset, i, match.offset + match.length)); - } - } - } - - if (range) { - var startColumn = range.start.column; - var endColumn = range.start.column; - var i = 0, j = ranges.length - 1; - while (i < j && ranges[i].start.column < startColumn && ranges[i].start.row == range.start.row) - i++; - - while (i < j && ranges[j].end.column > endColumn && ranges[j].end.row == range.end.row) - j--; - - ranges = ranges.slice(i, j + 1); - for (i = 0, j = ranges.length; i < j; i++) { - ranges[i].start.row += range.start.row; - ranges[i].end.row += range.start.row; - } - } - - return ranges; - }; - this.replace = function(input, replacement) { - var options = this.$options; - - var re = this.$assembleRegExp(options); - if (options.$isMultiLine) - return replacement; - - if (!re) - return; - - var match = re.exec(input); - if (!match || match[0].length != input.length) - return null; - - replacement = input.replace(re, replacement); - if (options.preserveCase) { - replacement = replacement.split(""); - for (var i = Math.min(input.length, input.length); i--; ) { - var ch = input[i]; - if (ch && ch.toLowerCase() != ch) - replacement[i] = replacement[i].toUpperCase(); - else - replacement[i] = replacement[i].toLowerCase(); - } - replacement = replacement.join(""); - } - - return replacement; - }; - - this.$matchIterator = function(session, options) { - var re = this.$assembleRegExp(options); - if (!re) - return false; - - var self = this, callback, backwards = options.backwards; - - if (options.$isMultiLine) { - var len = re.length; - var matchIterator = function(line, row, offset) { - var startIndex = line.search(re[0]); - if (startIndex == -1) - return; - for (var i = 1; i < len; i++) { - line = session.getLine(row + i); - if (line.search(re[i]) == -1) - return; - } - - var endIndex = line.match(re[len - 1])[0].length; - - var range = new Range(row, startIndex, row + len - 1, endIndex); - if (re.offset == 1) { - range.start.row--; - range.start.column = Number.MAX_VALUE; - } else if (offset) - range.start.column += offset; - - if (callback(range)) - return true; - }; - } else if (backwards) { - var matchIterator = function(line, row, startIndex) { - var matches = lang.getMatchOffsets(line, re); - for (var i = matches.length-1; i >= 0; i--) - if (callback(matches[i], row, startIndex)) - return true; - }; - } else { - var matchIterator = function(line, row, startIndex) { - var matches = lang.getMatchOffsets(line, re); - for (var i = 0; i < matches.length; i++) - if (callback(matches[i], row, startIndex)) - return true; - }; - } - - return { - forEach: function(_callback) { - callback = _callback; - self.$lineIterator(session, options).forEach(matchIterator); - } - }; - }; - - this.$assembleRegExp = function(options, $disableFakeMultiline) { - if (options.needle instanceof RegExp) - return options.re = options.needle; - - var needle = options.needle; - - if (!options.needle) - return options.re = false; - - if (!options.regExp) - needle = lang.escapeRegExp(needle); - - if (options.wholeWord) - needle = "\\b" + needle + "\\b"; - - var modifier = options.caseSensitive ? "g" : "gi"; - - options.$isMultiLine = !$disableFakeMultiline && /[\n\r]/.test(needle); - if (options.$isMultiLine) - return options.re = this.$assembleMultilineRegExp(needle, modifier); - - try { - var re = new RegExp(needle, modifier); - } catch(e) { - re = false; - } - return options.re = re; - }; - - this.$assembleMultilineRegExp = function(needle, modifier) { - var parts = needle.replace(/\r\n|\r|\n/g, "$\n^").split("\n"); - var re = []; - for (var i = 0; i < parts.length; i++) try { - re.push(new RegExp(parts[i], modifier)); - } catch(e) { - return false; - } - if (parts[0] == "") { - re.shift(); - re.offset = 1; - } else { - re.offset = 0; - } - return re; - }; - - this.$lineIterator = function(session, options) { - var backwards = options.backwards == true; - var skipCurrent = options.skipCurrent != false; - - var range = options.range; - var start = options.start; - if (!start) - start = range ? range[backwards ? "end" : "start"] : session.selection.getRange(); - - if (start.start) - start = start[skipCurrent != backwards ? "end" : "start"]; - - var firstRow = range ? range.start.row : 0; - var lastRow = range ? range.end.row : session.getLength() - 1; - - var forEach = backwards ? function(callback) { - var row = start.row; - - var line = session.getLine(row).substring(0, start.column); - if (callback(line, row)) - return; - - for (row--; row >= firstRow; row--) - if (callback(session.getLine(row), row)) - return; - - if (options.wrap == false) - return; - - for (row = lastRow, firstRow = start.row; row >= firstRow; row--) - if (callback(session.getLine(row), row)) - return; - } : function(callback) { - var row = start.row; - - var line = session.getLine(row).substr(start.column); - if (callback(line, row, start.column)) - return; - - for (row = row+1; row <= lastRow; row++) - if (callback(session.getLine(row), row)) - return; - - if (options.wrap == false) - return; - - for (row = firstRow, lastRow = start.row; row <= lastRow; row++) - if (callback(session.getLine(row), row)) - return; - }; - - return {forEach: forEach}; - }; - -}).call(Search.prototype); - -exports.Search = Search; -}); -define('ace/commands/command_manager', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/keyboard/hash_handler', 'ace/lib/event_emitter'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var HashHandler = require("../keyboard/hash_handler").HashHandler; -var EventEmitter = require("../lib/event_emitter").EventEmitter; - -var CommandManager = function(platform, commands) { - HashHandler.call(this, commands, platform); - this.byName = this.commands; - this.setDefaultHandler("exec", function(e) { - return e.command.exec(e.editor, e.args || {}); - }); -}; - -oop.inherits(CommandManager, HashHandler); - -(function() { - - oop.implement(this, EventEmitter); - - this.exec = function(command, editor, args) { - if (typeof command === 'string') - command = this.commands[command]; - - if (!command) - return false; - - if (editor && editor.$readOnly && !command.readOnly) - return false; - - var e = {editor: editor, command: command, args: args}; - var retvalue = this._emit("exec", e); - this._signal("afterExec", e); - - return retvalue === false ? false : true; - }; - - this.toggleRecording = function(editor) { - if (this.$inReplay) - return; - - editor && editor._emit("changeStatus"); - if (this.recording) { - this.macro.pop(); - this.removeEventListener("exec", this.$addCommandToMacro); - - if (!this.macro.length) - this.macro = this.oldMacro; - - return this.recording = false; - } - if (!this.$addCommandToMacro) { - this.$addCommandToMacro = function(e) { - this.macro.push([e.command, e.args]); - }.bind(this); - } - - this.oldMacro = this.macro; - this.macro = []; - this.on("exec", this.$addCommandToMacro); - return this.recording = true; - }; - - this.replay = function(editor) { - if (this.$inReplay || !this.macro) - return; - - if (this.recording) - return this.toggleRecording(editor); - - try { - this.$inReplay = true; - this.macro.forEach(function(x) { - if (typeof x == "string") - this.exec(x, editor); - else - this.exec(x[0], editor, x[1]); - }, this); - } finally { - this.$inReplay = false; - } - }; - - this.trimMacro = function(m) { - return m.map(function(x){ - if (typeof x[0] != "string") - x[0] = x[0].name; - if (!x[1]) - x = x[0]; - return x; - }); - }; - -}).call(CommandManager.prototype); - -exports.CommandManager = CommandManager; - -}); - -define('ace/keyboard/hash_handler', ['require', 'exports', 'module' , 'ace/lib/keys', 'ace/lib/useragent'], function(require, exports, module) { - - -var keyUtil = require("../lib/keys"); -var useragent = require("../lib/useragent"); - -function HashHandler(config, platform) { - this.platform = platform || (useragent.isMac ? "mac" : "win"); - this.commands = {}; - this.commandKeyBinding = {}; - if (this.__defineGetter__ && this.__defineSetter__ && typeof console != "undefined" && console.error) { - var warned = false; - var warn = function() { - if (!warned) { - warned = true; - console.error("commmandKeyBinding has too many m's. use commandKeyBinding"); - } - }; - this.__defineGetter__("commmandKeyBinding", function() { - warn(); - return this.commandKeyBinding; - }); - this.__defineSetter__("commmandKeyBinding", function(val) { - warn(); - return this.commandKeyBinding = val; - }); - } else { - this.commmandKeyBinding = this.commandKeyBinding; - } - - this.addCommands(config); -}; - -(function() { - - this.addCommand = function(command) { - if (this.commands[command.name]) - this.removeCommand(command); - - this.commands[command.name] = command; - - if (command.bindKey) - this._buildKeyHash(command); - }; - - this.removeCommand = function(command) { - var name = (typeof command === 'string' ? command : command.name); - command = this.commands[name]; - delete this.commands[name]; - var ckb = this.commandKeyBinding; - for (var hashId in ckb) { - for (var key in ckb[hashId]) { - if (ckb[hashId][key] == command) - delete ckb[hashId][key]; - } - } - }; - - this.bindKey = function(key, command) { - if(!key) - return; - if (typeof command == "function") { - this.addCommand({exec: command, bindKey: key, name: command.name || key}); - return; - } - - var ckb = this.commandKeyBinding; - key.split("|").forEach(function(keyPart) { - var binding = this.parseKeys(keyPart, command); - var hashId = binding.hashId; - (ckb[hashId] || (ckb[hashId] = {}))[binding.key] = command; - }, this); - }; - - this.addCommands = function(commands) { - commands && Object.keys(commands).forEach(function(name) { - var command = commands[name]; - if (!command) - return; - - if (typeof command === "string") - return this.bindKey(command, name); - - if (typeof command === "function") - command = { exec: command }; - - if (!command.name) - command.name = name; - - this.addCommand(command); - }, this); - }; - - this.removeCommands = function(commands) { - Object.keys(commands).forEach(function(name) { - this.removeCommand(commands[name]); - }, this); - }; - - this.bindKeys = function(keyList) { - Object.keys(keyList).forEach(function(key) { - this.bindKey(key, keyList[key]); - }, this); - }; - - this._buildKeyHash = function(command) { - var binding = command.bindKey; - if (!binding) - return; - - var key = typeof binding == "string" ? binding: binding[this.platform]; - this.bindKey(key, command); - }; - this.parseKeys = function(keys) { - if (keys.indexOf(" ") != -1) - keys = keys.split(/\s+/).pop(); - - var parts = keys.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(x){return x}); - var key = parts.pop(); - - var keyCode = keyUtil[key]; - if (keyUtil.FUNCTION_KEYS[keyCode]) - key = keyUtil.FUNCTION_KEYS[keyCode].toLowerCase(); - else if (!parts.length) - return {key: key, hashId: -1}; - else if (parts.length == 1 && parts[0] == "shift") - return {key: key.toUpperCase(), hashId: -1}; - - var hashId = 0; - for (var i = parts.length; i--;) { - var modifier = keyUtil.KEY_MODS[parts[i]]; - if (modifier == null) { - if (typeof console != "undefined") - console.error("invalid modifier " + parts[i] + " in " + keys); - return false; - } - hashId |= modifier; - } - return {key: key, hashId: hashId}; - }; - - this.findKeyCommand = function findKeyCommand(hashId, keyString) { - var ckbr = this.commandKeyBinding; - return ckbr[hashId] && ckbr[hashId][keyString]; - }; - - this.handleKeyboard = function(data, hashId, keyString, keyCode) { - return { - command: this.findKeyCommand(hashId, keyString) - }; - }; - -}).call(HashHandler.prototype) - -exports.HashHandler = HashHandler; -}); - -define('ace/commands/default_commands', ['require', 'exports', 'module' , 'ace/lib/lang', 'ace/config'], function(require, exports, module) { - - -var lang = require("../lib/lang"); -var config = require("../config"); - -function bindKey(win, mac) { - return { - win: win, - mac: mac - }; -} - -exports.commands = [{ - name: "showSettingsMenu", - bindKey: bindKey("Ctrl-,", "Command-,"), - exec: function(editor) { - config.loadModule("ace/ext/settings_menu", function(module) { - module.init(editor); - editor.showSettingsMenu(); - }); - }, - readOnly: true -}, { - name: "selectall", - bindKey: bindKey("Ctrl-A", "Command-A"), - exec: function(editor) { editor.selectAll(); }, - readOnly: true -}, { - name: "centerselection", - bindKey: bindKey(null, "Ctrl-L"), - exec: function(editor) { editor.centerSelection(); }, - readOnly: true -}, { - name: "gotoline", - bindKey: bindKey("Ctrl-L", "Command-L"), - exec: function(editor) { - var line = parseInt(prompt("Enter line number:"), 10); - if (!isNaN(line)) { - editor.gotoLine(line); - } - }, - readOnly: true -}, { - name: "fold", - bindKey: bindKey("Alt-L|Ctrl-F1", "Command-Alt-L|Command-F1"), - exec: function(editor) { editor.session.toggleFold(false); }, - readOnly: true -}, { - name: "unfold", - bindKey: bindKey("Alt-Shift-L|Ctrl-Shift-F1", "Command-Alt-Shift-L|Command-Shift-F1"), - exec: function(editor) { editor.session.toggleFold(true); }, - readOnly: true -}, { - name: "foldall", - bindKey: bindKey("Alt-0", "Command-Option-0"), - exec: function(editor) { editor.session.foldAll(); }, - readOnly: true -}, { - name: "unfoldall", - bindKey: bindKey("Alt-Shift-0", "Command-Option-Shift-0"), - exec: function(editor) { editor.session.unfold(); }, - readOnly: true -}, { - name: "findnext", - bindKey: bindKey("Ctrl-K", "Command-G"), - exec: function(editor) { editor.findNext(); }, - readOnly: true -}, { - name: "findprevious", - bindKey: bindKey("Ctrl-Shift-K", "Command-Shift-G"), - exec: function(editor) { editor.findPrevious(); }, - readOnly: true -}, { - name: "find", - bindKey: bindKey("Ctrl-F", "Command-F"), - exec: function(editor) { - config.loadModule("ace/ext/searchbox", function(e) {e.Search(editor)}); - }, - readOnly: true -}, { - name: "overwrite", - bindKey: "Insert", - exec: function(editor) { editor.toggleOverwrite(); }, - readOnly: true -}, { - name: "selecttostart", - bindKey: bindKey("Ctrl-Shift-Home", "Command-Shift-Up"), - exec: function(editor) { editor.getSelection().selectFileStart(); }, - multiSelectAction: "forEach", - readOnly: true, - group: "fileJump" -}, { - name: "gotostart", - bindKey: bindKey("Ctrl-Home", "Command-Home|Command-Up"), - exec: function(editor) { editor.navigateFileStart(); }, - multiSelectAction: "forEach", - readOnly: true, - group: "fileJump" -}, { - name: "selectup", - bindKey: bindKey("Shift-Up", "Shift-Up"), - exec: function(editor) { editor.getSelection().selectUp(); }, - multiSelectAction: "forEach", - readOnly: true -}, { - name: "golineup", - bindKey: bindKey("Up", "Up|Ctrl-P"), - exec: function(editor, args) { editor.navigateUp(args.times); }, - multiSelectAction: "forEach", - readOnly: true -}, { - name: "selecttoend", - bindKey: bindKey("Ctrl-Shift-End", "Command-Shift-Down"), - exec: function(editor) { editor.getSelection().selectFileEnd(); }, - multiSelectAction: "forEach", - readOnly: true, - group: "fileJump" -}, { - name: "gotoend", - bindKey: bindKey("Ctrl-End", "Command-End|Command-Down"), - exec: function(editor) { editor.navigateFileEnd(); }, - multiSelectAction: "forEach", - readOnly: true, - group: "fileJump" -}, { - name: "selectdown", - bindKey: bindKey("Shift-Down", "Shift-Down"), - exec: function(editor) { editor.getSelection().selectDown(); }, - multiSelectAction: "forEach", - readOnly: true -}, { - name: "golinedown", - bindKey: bindKey("Down", "Down|Ctrl-N"), - exec: function(editor, args) { editor.navigateDown(args.times); }, - multiSelectAction: "forEach", - readOnly: true -}, { - name: "selectwordleft", - bindKey: bindKey("Ctrl-Shift-Left", "Option-Shift-Left"), - exec: function(editor) { editor.getSelection().selectWordLeft(); }, - multiSelectAction: "forEach", - readOnly: true -}, { - name: "gotowordleft", - bindKey: bindKey("Ctrl-Left", "Option-Left"), - exec: function(editor) { editor.navigateWordLeft(); }, - multiSelectAction: "forEach", - readOnly: true -}, { - name: "selecttolinestart", - bindKey: bindKey("Alt-Shift-Left", "Command-Shift-Left"), - exec: function(editor) { editor.getSelection().selectLineStart(); }, - multiSelectAction: "forEach", - readOnly: true -}, { - name: "gotolinestart", - bindKey: bindKey("Alt-Left|Home", "Command-Left|Home|Ctrl-A"), - exec: function(editor) { editor.navigateLineStart(); }, - multiSelectAction: "forEach", - readOnly: true -}, { - name: "selectleft", - bindKey: bindKey("Shift-Left", "Shift-Left"), - exec: function(editor) { editor.getSelection().selectLeft(); }, - multiSelectAction: "forEach", - readOnly: true -}, { - name: "gotoleft", - bindKey: bindKey("Left", "Left|Ctrl-B"), - exec: function(editor, args) { editor.navigateLeft(args.times); }, - multiSelectAction: "forEach", - readOnly: true -}, { - name: "selectwordright", - bindKey: bindKey("Ctrl-Shift-Right", "Option-Shift-Right"), - exec: function(editor) { editor.getSelection().selectWordRight(); }, - multiSelectAction: "forEach", - readOnly: true -}, { - name: "gotowordright", - bindKey: bindKey("Ctrl-Right", "Option-Right"), - exec: function(editor) { editor.navigateWordRight(); }, - multiSelectAction: "forEach", - readOnly: true -}, { - name: "selecttolineend", - bindKey: bindKey("Alt-Shift-Right", "Command-Shift-Right"), - exec: function(editor) { editor.getSelection().selectLineEnd(); }, - multiSelectAction: "forEach", - readOnly: true -}, { - name: "gotolineend", - bindKey: bindKey("Alt-Right|End", "Command-Right|End|Ctrl-E"), - exec: function(editor) { editor.navigateLineEnd(); }, - multiSelectAction: "forEach", - readOnly: true -}, { - name: "selectright", - bindKey: bindKey("Shift-Right", "Shift-Right"), - exec: function(editor) { editor.getSelection().selectRight(); }, - multiSelectAction: "forEach", - readOnly: true -}, { - name: "gotoright", - bindKey: bindKey("Right", "Right|Ctrl-F"), - exec: function(editor, args) { editor.navigateRight(args.times); }, - multiSelectAction: "forEach", - readOnly: true -}, { - name: "selectpagedown", - bindKey: "Shift-PageDown", - exec: function(editor) { editor.selectPageDown(); }, - readOnly: true -}, { - name: "pagedown", - bindKey: bindKey(null, "Option-PageDown"), - exec: function(editor) { editor.scrollPageDown(); }, - readOnly: true -}, { - name: "gotopagedown", - bindKey: bindKey("PageDown", "PageDown|Ctrl-V"), - exec: function(editor) { editor.gotoPageDown(); }, - readOnly: true -}, { - name: "selectpageup", - bindKey: "Shift-PageUp", - exec: function(editor) { editor.selectPageUp(); }, - readOnly: true -}, { - name: "pageup", - bindKey: bindKey(null, "Option-PageUp"), - exec: function(editor) { editor.scrollPageUp(); }, - readOnly: true -}, { - name: "gotopageup", - bindKey: "PageUp", - exec: function(editor) { editor.gotoPageUp(); }, - readOnly: true -}, { - name: "scrollup", - bindKey: bindKey("Ctrl-Up", null), - exec: function(e) { e.renderer.scrollBy(0, -2 * e.renderer.layerConfig.lineHeight); }, - readOnly: true -}, { - name: "scrolldown", - bindKey: bindKey("Ctrl-Down", null), - exec: function(e) { e.renderer.scrollBy(0, 2 * e.renderer.layerConfig.lineHeight); }, - readOnly: true -}, { - name: "selectlinestart", - bindKey: "Shift-Home", - exec: function(editor) { editor.getSelection().selectLineStart(); }, - multiSelectAction: "forEach", - readOnly: true -}, { - name: "selectlineend", - bindKey: "Shift-End", - exec: function(editor) { editor.getSelection().selectLineEnd(); }, - multiSelectAction: "forEach", - readOnly: true -}, { - name: "togglerecording", - bindKey: bindKey("Ctrl-Alt-E", "Command-Option-E"), - exec: function(editor) { editor.commands.toggleRecording(editor); }, - readOnly: true -}, { - name: "replaymacro", - bindKey: bindKey("Ctrl-Shift-E", "Command-Shift-E"), - exec: function(editor) { editor.commands.replay(editor); }, - readOnly: true -}, { - name: "jumptomatching", - bindKey: bindKey("Ctrl-P", "Ctrl-Shift-P"), - exec: function(editor) { editor.jumpToMatching(); }, - multiSelectAction: "forEach", - readOnly: true -}, { - name: "selecttomatching", - bindKey: bindKey("Ctrl-Shift-P", null), - exec: function(editor) { editor.jumpToMatching(true); }, - multiSelectAction: "forEach", - readOnly: true -}, -{ - name: "cut", - exec: function(editor) { - var range = editor.getSelectionRange(); - editor._emit("cut", range); - - if (!editor.selection.isEmpty()) { - editor.session.remove(range); - editor.clearSelection(); - } - }, - multiSelectAction: "forEach" -}, { - name: "removeline", - bindKey: bindKey("Ctrl-D", "Command-D"), - exec: function(editor) { editor.removeLines(); }, - multiSelectAction: "forEachLine" -}, { - name: "duplicateSelection", - bindKey: bindKey("Ctrl-Shift-D", "Command-Shift-D"), - exec: function(editor) { editor.duplicateSelection(); }, - multiSelectAction: "forEach" -}, { - name: "sortlines", - bindKey: bindKey("Ctrl-Alt-S", "Command-Alt-S"), - exec: function(editor) { editor.sortLines(); }, - multiSelectAction: "forEachLine" -}, { - name: "togglecomment", - bindKey: bindKey("Ctrl-/", "Command-/"), - exec: function(editor) { editor.toggleCommentLines(); }, - multiSelectAction: "forEachLine" -}, { - name: "toggleBlockComment", - bindKey: bindKey("Ctrl-Shift-/", "Command-Shift-/"), - exec: function(editor) { editor.toggleBlockComment(); }, - multiSelectAction: "forEach" -}, { - name: "modifyNumberUp", - bindKey: bindKey("Ctrl-Shift-Up", "Alt-Shift-Up"), - exec: function(editor) { editor.modifyNumber(1); }, - multiSelectAction: "forEach" -}, { - name: "modifyNumberDown", - bindKey: bindKey("Ctrl-Shift-Down", "Alt-Shift-Down"), - exec: function(editor) { editor.modifyNumber(-1); }, - multiSelectAction: "forEach" -}, { - name: "replace", - bindKey: bindKey("Ctrl-H", "Command-Option-F"), - exec: function(editor) { - config.loadModule("ace/ext/searchbox", function(e) {e.Search(editor, true)}); - } -}, { - name: "undo", - bindKey: bindKey("Ctrl-Z", "Command-Z"), - exec: function(editor) { editor.undo(); } -}, { - name: "redo", - bindKey: bindKey("Ctrl-Shift-Z|Ctrl-Y", "Command-Shift-Z|Command-Y"), - exec: function(editor) { editor.redo(); } -}, { - name: "copylinesup", - bindKey: bindKey("Alt-Shift-Up", "Command-Option-Up"), - exec: function(editor) { editor.copyLinesUp(); } -}, { - name: "movelinesup", - bindKey: bindKey("Alt-Up", "Option-Up"), - exec: function(editor) { editor.moveLinesUp(); } -}, { - name: "copylinesdown", - bindKey: bindKey("Alt-Shift-Down", "Command-Option-Down"), - exec: function(editor) { editor.copyLinesDown(); } -}, { - name: "movelinesdown", - bindKey: bindKey("Alt-Down", "Option-Down"), - exec: function(editor) { editor.moveLinesDown(); } -}, { - name: "del", - bindKey: bindKey("Delete", "Delete|Ctrl-D|Shift-Delete"), - exec: function(editor) { editor.remove("right"); }, - multiSelectAction: "forEach" -}, { - name: "backspace", - bindKey: bindKey( - "Shift-Backspace|Backspace", - "Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H" - ), - exec: function(editor) { editor.remove("left"); }, - multiSelectAction: "forEach" -}, { - name: "cut_or_delete", - bindKey: bindKey("Shift-Delete", null), - exec: function(editor) { - if (editor.selection.isEmpty()) { - editor.remove("left"); - } else { - return false; - } - }, - multiSelectAction: "forEach" -}, { - name: "removetolinestart", - bindKey: bindKey("Alt-Backspace", "Command-Backspace"), - exec: function(editor) { editor.removeToLineStart(); }, - multiSelectAction: "forEach" -}, { - name: "removetolineend", - bindKey: bindKey("Alt-Delete", "Ctrl-K"), - exec: function(editor) { editor.removeToLineEnd(); }, - multiSelectAction: "forEach" -}, { - name: "removewordleft", - bindKey: bindKey("Ctrl-Backspace", "Alt-Backspace|Ctrl-Alt-Backspace"), - exec: function(editor) { editor.removeWordLeft(); }, - multiSelectAction: "forEach" -}, { - name: "removewordright", - bindKey: bindKey("Ctrl-Delete", "Alt-Delete"), - exec: function(editor) { editor.removeWordRight(); }, - multiSelectAction: "forEach" -}, { - name: "outdent", - bindKey: bindKey("Shift-Tab", "Shift-Tab"), - exec: function(editor) { editor.blockOutdent(); }, - multiSelectAction: "forEach" -}, { - name: "indent", - bindKey: bindKey("Tab", "Tab"), - exec: function(editor) { editor.indent(); }, - multiSelectAction: "forEach" -},{ - name: "blockoutdent", - bindKey: bindKey("Ctrl-[", "Ctrl-["), - exec: function(editor) { editor.blockOutdent(); }, - multiSelectAction: "forEachLine" -},{ - name: "blockindent", - bindKey: bindKey("Ctrl-]", "Ctrl-]"), - exec: function(editor) { editor.blockIndent(); }, - multiSelectAction: "forEachLine" -}, { - name: "insertstring", - exec: function(editor, str) { editor.insert(str); }, - multiSelectAction: "forEach" -}, { - name: "inserttext", - exec: function(editor, args) { - editor.insert(lang.stringRepeat(args.text || "", args.times || 1)); - }, - multiSelectAction: "forEach" -}, { - name: "splitline", - bindKey: bindKey(null, "Ctrl-O"), - exec: function(editor) { editor.splitLine(); }, - multiSelectAction: "forEach" -}, { - name: "transposeletters", - bindKey: bindKey("Ctrl-T", "Ctrl-T"), - exec: function(editor) { editor.transposeLetters(); }, - multiSelectAction: function(editor) {editor.transposeSelections(1); } -}, { - name: "touppercase", - bindKey: bindKey("Ctrl-U", "Ctrl-U"), - exec: function(editor) { editor.toUpperCase(); }, - multiSelectAction: "forEach" -}, { - name: "tolowercase", - bindKey: bindKey("Ctrl-Shift-U", "Ctrl-Shift-U"), - exec: function(editor) { editor.toLowerCase(); }, - multiSelectAction: "forEach" -}]; - -}); - -define('ace/undomanager', ['require', 'exports', 'module' ], function(require, exports, module) { -var UndoManager = function() { - this.reset(); -}; - -(function() { - this.execute = function(options) { - var deltas = options.args[0]; - this.$doc = options.args[1]; - if (options.merge && this.hasUndo()){ - deltas = this.$undoStack.pop().concat(deltas); - } - this.$undoStack.push(deltas); - this.$redoStack = []; - - if (this.dirtyCounter < 0) { - this.dirtyCounter = NaN; - } - this.dirtyCounter++; - }; - this.undo = function(dontSelect) { - var deltas = this.$undoStack.pop(); - var undoSelectionRange = null; - if (deltas) { - undoSelectionRange = - this.$doc.undoChanges(deltas, dontSelect); - this.$redoStack.push(deltas); - this.dirtyCounter--; - } - - return undoSelectionRange; - }; - this.redo = function(dontSelect) { - var deltas = this.$redoStack.pop(); - var redoSelectionRange = null; - if (deltas) { - redoSelectionRange = - this.$doc.redoChanges(deltas, dontSelect); - this.$undoStack.push(deltas); - this.dirtyCounter++; - } - - return redoSelectionRange; - }; - this.reset = function() { - this.$undoStack = []; - this.$redoStack = []; - this.dirtyCounter = 0; - }; - this.hasUndo = function() { - return this.$undoStack.length > 0; - }; - this.hasRedo = function() { - return this.$redoStack.length > 0; - }; - this.markClean = function() { - this.dirtyCounter = 0; - }; - this.isClean = function() { - return this.dirtyCounter === 0; - }; - -}).call(UndoManager.prototype); - -exports.UndoManager = UndoManager; -}); - -define('ace/virtual_renderer', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/dom', 'ace/lib/useragent', 'ace/config', 'ace/layer/gutter', 'ace/layer/marker', 'ace/layer/text', 'ace/layer/cursor', 'ace/scrollbar', 'ace/renderloop', 'ace/lib/event_emitter'], function(require, exports, module) { - - -var oop = require("./lib/oop"); -var dom = require("./lib/dom"); -var useragent = require("./lib/useragent"); -var config = require("./config"); -var GutterLayer = require("./layer/gutter").Gutter; -var MarkerLayer = require("./layer/marker").Marker; -var TextLayer = require("./layer/text").Text; -var CursorLayer = require("./layer/cursor").Cursor; -var ScrollBarH = require("./scrollbar").ScrollBarH; -var ScrollBarV = require("./scrollbar").ScrollBarV; -var RenderLoop = require("./renderloop").RenderLoop; -var EventEmitter = require("./lib/event_emitter").EventEmitter; -var editorCss = ".ace_editor {\ -position: relative;\ -overflow: hidden;\ -font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;\ -font-size: 12px;\ -line-height: normal;\ -color: black;\ --ms-user-select: none;\ --moz-user-select: none;\ --webkit-user-select: none;\ -user-select: none;\ -}\ -.ace_scroller {\ -position: absolute;\ -overflow: hidden;\ -top: 0;\ -bottom: 0;\ -background-color: inherit;\ -}\ -.ace_content {\ -position: absolute;\ --moz-box-sizing: border-box;\ --webkit-box-sizing: border-box;\ -box-sizing: border-box;\ -cursor: text;\ -}\ -.ace_dragging, .ace_dragging * {\ -cursor: move !important;\ -}\ -.ace_dragging .ace_scroller:before{\ -position: absolute;\ -top: 0;\ -left: 0;\ -right: 0;\ -bottom: 0;\ -content: '';\ -background: rgba(250, 250, 250, 0.01);\ -z-index: 1000;\ -}\ -.ace_dragging.ace_dark .ace_scroller:before{\ -background: rgba(0, 0, 0, 0.01);\ -}\ -.ace_selecting, .ace_selecting * {\ -cursor: text !important;\ -}\ -.ace_gutter {\ -position: absolute;\ -overflow : hidden;\ -width: auto;\ -top: 0;\ -bottom: 0;\ -left: 0;\ -cursor: default;\ -z-index: 4;\ -}\ -.ace_gutter-active-line {\ -position: absolute;\ -left: 0;\ -right: 0;\ -}\ -.ace_scroller.ace_scroll-left {\ -box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;\ -}\ -.ace_gutter-cell {\ -padding-left: 19px;\ -padding-right: 6px;\ -background-repeat: no-repeat;\ -}\ -.ace_gutter-cell.ace_error {\ -background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QUM2OEZDQTQ4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QUM2OEZDQTU4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBQzY4RkNBMjhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBQzY4RkNBMzhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PkgXxbAAAAJbSURBVHjapFNNaBNBFH4zs5vdZLP5sQmNpT82QY209heh1ioWisaDRcSKF0WKJ0GQnrzrxasHsR6EnlrwD0TagxJabaVEpFYxLWlLSS822tr87m66ccfd2GKyVhA6MMybgfe97/vmPUQphd0sZjto9XIn9OOsvlu2nkqRzVU+6vvlzPf8W6bk8dxQ0NPbxAALgCgg2JkaQuhzQau/El0zbmUA7U0Es8v2CiYmKQJHGO1QICCLoqilMhkmurDAyapKgqItezi/USRdJqEYY4D5jCy03ht2yMkkvL91jTTX10qzyyu2hruPRN7jgbH+EOsXcMLgYiThEgAMhABW85oqy1DXdRIdvP1AHJ2acQXvDIrVHcdQNrEKNYSVMSZGMjEzIIAwDXIo+6G/FxcGnzkC3T2oMhLjre49sBB+RRcHLqdafK6sYdE/GGBwU1VpFNj0aN8pJbe+BkZyevUrvLl6Xmm0W9IuTc0DxrDNAJd5oEvI/KRsNC3bQyNjPO9yQ1YHcfj2QvfQc/5TUhJTBc2iM0U7AWDQtc1nJHvD/cfO2s7jaGkiTEfa/Ep8coLu7zmNmh8+dc5lZDuUeFAGUNA/OY6JVaypQ0vjr7XYjUvJM37vt+j1vuTK5DgVfVUoTjVe+y3/LxMxY2GgU+CSLy4cpfsYorRXuXIOi0Vt40h67uZFTdIo6nLaZcwUJWAzwNS0tBnqqKzQDnjdG/iPyZxo46HaKUpbvYkj8qYRTZsBhge+JHhZyh0x9b95JqjVJkT084kZIPwu/mPWqPgfQ5jXh2+92Ay7HedfAgwA6KDWafb4w3cAAAAASUVORK5CYII=\");\ -background-repeat: no-repeat;\ -background-position: 2px center;\ -}\ -.ace_gutter-cell.ace_warning {\ -background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QUM2OEZDQTg4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QUM2OEZDQTk4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBQzY4RkNBNjhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBQzY4RkNBNzhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pgd7PfIAAAGmSURBVHjaYvr//z8DJZiJgUIANoCRkREb9gLiSVAaQx4OQM7AAkwd7XU2/v++/rOttdYGEB9dASEvOMydGKfH8Gv/p4XTkvRBfLxeQAP+1cUhXopyvzhP7P/IoSj7g7Mw09cNKO6J1QQ0L4gICPIv/veg/8W+JdFvQNLHVsW9/nmn9zk7B+cCkDwhL7gt6knSZnx9/LuCEOcvkIAMP+cvto9nfqyZmmUAksfnBUtbM60gX/3/kgyv3/xSFOL5DZT+L8vP+Yfh5cvfPvp/xUHyQHXGyAYwgpwBjZYFT3Y1OEl/OfCH4ffv3wzc4iwMvNIsDJ+f/mH4+vIPAxsb631WW0Yln6ZpQLXdMK/DXGDflh+sIv37EivD5x//Gb7+YWT4y86sl7BCCkSD+Z++/1dkvsFRl+HnD1Rvje4F8whjMXmGj58YGf5zsDMwcnAwfPvKcml62DsQDeaDxN+/Y0qwlpEHqrdB94IRNIDUgfgfKJChGK4OikEW3gTiXUB950ASLFAF54AC94A0G9QAfOnmF9DCDzABFqS08IHYDIScdijOjQABBgC+/9awBH96jwAAAABJRU5ErkJggg==\");\ -background-position: 2px center;\ -}\ -.ace_gutter-cell.ace_info {\ -background-image: url(\"data:image/gif;base64,R0lGODlhEAAQAMQAAAAAAEFBQVJSUl5eXmRkZGtra39/f4WFhYmJiZGRkaampry8vMPDw8zMzNXV1dzc3OTk5Orq6vDw8P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABQALAAAAAAQABAAAAUuICWOZGmeaBml5XGwFCQSBGyXRSAwtqQIiRuiwIM5BoYVbEFIyGCQoeJGrVptIQA7\");\ -background-position: 2px center;\ -}\ -.ace_dark .ace_gutter-cell.ace_info {\ -background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpGRTk5MTVGREIxNDkxMUUxOTc5Q0FFREQyMTNGMjBFQyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpGRTk5MTVGRUIxNDkxMUUxOTc5Q0FFREQyMTNGMjBFQyI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkZFOTkxNUZCQjE0OTExRTE5NzlDQUVERDIxM0YyMEVDIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkZFOTkxNUZDQjE0OTExRTE5NzlDQUVERDIxM0YyMEVDIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+SIDkjAAAAJ1JREFUeNpi/P//PwMlgImBQkB7A6qrq/+DMC55FkIGKCoq4pVnpFkgTp069f/+/fv/r1u37r+tre1/kg0A+ptn9uzZYLaRkRHpLvjw4cNXWVlZhufPnzOcO3eOdAO0tbVPAjHDmzdvGA4fPsxIsgGSkpJmv379Ynj37h2DjIyMCMkG3LhxQ/T27dsMampqDHZ2dq/pH41DxwCAAAMAFdc68dUsFZgAAAAASUVORK5CYII=\");\ -}\ -.ace_scrollbar {\ -position: absolute;\ -overflow-x: hidden;\ -overflow-y: auto;\ -right: 0;\ -top: 0;\ -bottom: 0;\ -z-index: 6;\ -}\ -.ace_scrollbar-inner {\ -position: absolute;\ -cursor: text;\ -left: 0;\ -top: 0;\ -}\ -.ace_scrollbar-h {\ -position: absolute;\ -overflow-x: auto;\ -overflow-y: hidden;\ -right: 0;\ -left: 0;\ -bottom: 0;\ -z-index: 6;\ -}\ -.ace_print-margin {\ -position: absolute;\ -height: 100%;\ -}\ -.ace_text-input {\ -position: absolute;\ -z-index: 0;\ -width: 0.5em;\ -height: 1em;\ -opacity: 0;\ -background: transparent;\ --moz-appearance: none;\ -appearance: none;\ -border: none;\ -resize: none;\ -outline: none;\ -overflow: hidden;\ -font: inherit;\ -padding: 0 1px;\ -margin: 0 -1px;\ -text-indent: -1em;\ -}\ -.ace_text-input.ace_composition {\ -background: #f8f8f8;\ -color: #111;\ -z-index: 1000;\ -opacity: 1;\ -text-indent: 0;\ -}\ -.ace_layer {\ -z-index: 1;\ -position: absolute;\ -overflow: hidden;\ -white-space: nowrap;\ -height: 100%;\ -width: 100%;\ --moz-box-sizing: border-box;\ --webkit-box-sizing: border-box;\ -box-sizing: border-box;\ -/* setting pointer-events: auto; on node under the mouse, which changes\ -during scroll, will break mouse wheel scrolling in Safari */\ -pointer-events: none;\ -}\ -.ace_gutter-layer {\ -position: relative;\ -width: auto;\ -text-align: right;\ -pointer-events: auto;\ -}\ -.ace_text-layer {\ -font: inherit !important;\ -}\ -.ace_cjk {\ -display: inline-block;\ -text-align: center;\ -}\ -.ace_cursor-layer {\ -z-index: 4;\ -}\ -.ace_cursor {\ -z-index: 4;\ -position: absolute;\ --moz-box-sizing: border-box;\ --webkit-box-sizing: border-box;\ -box-sizing: border-box;\ -border-left: 2px solid\ -}\ -.ace_slim-cursors .ace_cursor {\ -border-left-width: 1px;\ -}\ -.ace_overwrite-cursors .ace_cursor {\ -border-left-width: 0px;\ -border-bottom: 1px solid;\ -}\ -.ace_hidden-cursors .ace_cursor {\ -opacity: 0.2;\ -}\ -.ace_smooth-blinking .ace_cursor {\ --moz-transition: opacity 0.18s;\ --webkit-transition: opacity 0.18s;\ --o-transition: opacity 0.18s;\ --ms-transition: opacity 0.18s;\ -transition: opacity 0.18s;\ -}\ -.ace_cursor[style*=\"opacity: 0\"]{\ --ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\ -}\ -.ace_editor.ace_multiselect .ace_cursor {\ -border-left-width: 1px;\ -}\ -.ace_line {\ -white-space: nowrap;\ -}\ -.ace_marker-layer .ace_step, .ace_marker-layer .ace_stack {\ -position: absolute;\ -z-index: 3;\ -}\ -.ace_marker-layer .ace_selection {\ -position: absolute;\ -z-index: 5;\ -}\ -.ace_marker-layer .ace_bracket {\ -position: absolute;\ -z-index: 6;\ -}\ -.ace_marker-layer .ace_active-line {\ -position: absolute;\ -z-index: 2;\ -}\ -.ace_marker-layer .ace_selected-word {\ -position: absolute;\ -z-index: 4;\ --moz-box-sizing: border-box;\ --webkit-box-sizing: border-box;\ -box-sizing: border-box;\ -}\ -.ace_line .ace_fold {\ --moz-box-sizing: border-box;\ --webkit-box-sizing: border-box;\ -box-sizing: border-box;\ -display: inline-block;\ -height: 11px;\ -margin-top: -2px;\ -vertical-align: middle;\ -background-image:\ -url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%11%00%00%00%09%08%06%00%00%00%D4%E8%C7%0C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%00%B5IDAT(%15%A5%91%3D%0E%02!%10%85ac%E1%05%D6%CE%D6%C6%CE%D2%E8%ED%CD%DE%C0%C6%D6N.%E0V%F8%3D%9Ca%891XH%C2%BE%D9y%3F%90!%E6%9C%C3%BFk%E5%011%C6-%F5%C8N%04%DF%BD%FF%89%DFt%83DN%60%3E%F3%AB%A0%DE%1A%5Dg%BE%10Q%97%1B%40%9C%A8o%10%8F%5E%828%B4%1B%60%87%F6%02%26%85%1Ch%1E%C1%2B%5Bk%FF%86%EE%B7j%09%9A%DA%9B%ACe%A3%F9%EC%DA!9%B4%D5%A6%81%86%86%98%CC%3C%5B%40%FA%81%B3%E9%CB%23%94%C16Azo%05%D4%E1%C1%95a%3B%8A'%A0%E8%CC%17%22%85%1D%BA%00%A2%FA%DC%0A%94%D1%D1%8D%8B%3A%84%17B%C7%60%1A%25Z%FC%8D%00%00%00%00IEND%AEB%60%82\"),\ -url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%007%08%06%00%00%00%C4%DD%80C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%00%3AIDAT8%11c%FC%FF%FF%7F%18%03%1A%60%01%F2%3F%A0%891%80%04%FF%11-%F8%17%9BJ%E2%05%B1ZD%81v%26t%E7%80%F8%A3%82h%A12%1A%20%A3%01%02%0F%01%BA%25%06%00%19%C0%0D%AEF%D5%3ES%00%00%00%00IEND%AEB%60%82\");\ -background-repeat: no-repeat, repeat-x;\ -background-position: center center, top left;\ -color: transparent;\ -border: 1px solid black;\ --moz-border-radius: 2px;\ --webkit-border-radius: 2px;\ -border-radius: 2px;\ -cursor: pointer;\ -pointer-events: auto;\ -}\ -.ace_dark .ace_fold {\ -}\ -.ace_fold:hover{\ -background-image:\ -url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%11%00%00%00%09%08%06%00%00%00%D4%E8%C7%0C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%00%B5IDAT(%15%A5%91%3D%0E%02!%10%85ac%E1%05%D6%CE%D6%C6%CE%D2%E8%ED%CD%DE%C0%C6%D6N.%E0V%F8%3D%9Ca%891XH%C2%BE%D9y%3F%90!%E6%9C%C3%BFk%E5%011%C6-%F5%C8N%04%DF%BD%FF%89%DFt%83DN%60%3E%F3%AB%A0%DE%1A%5Dg%BE%10Q%97%1B%40%9C%A8o%10%8F%5E%828%B4%1B%60%87%F6%02%26%85%1Ch%1E%C1%2B%5Bk%FF%86%EE%B7j%09%9A%DA%9B%ACe%A3%F9%EC%DA!9%B4%D5%A6%81%86%86%98%CC%3C%5B%40%FA%81%B3%E9%CB%23%94%C16Azo%05%D4%E1%C1%95a%3B%8A'%A0%E8%CC%17%22%85%1D%BA%00%A2%FA%DC%0A%94%D1%D1%8D%8B%3A%84%17B%C7%60%1A%25Z%FC%8D%00%00%00%00IEND%AEB%60%82\"),\ -url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%007%08%06%00%00%00%C4%DD%80C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%003IDAT8%11c%FC%FF%FF%7F%3E%03%1A%60%01%F2%3F%A3%891%80%04%FFQ%26%F8w%C0%B43%A1%DB%0C%E2%8F%0A%A2%85%CAh%80%8C%06%08%3C%04%E8%96%18%00%A3S%0D%CD%CF%D8%C1%9D%00%00%00%00IEND%AEB%60%82\");\ -background-repeat: no-repeat, repeat-x;\ -background-position: center center, top left;\ -}\ -.ace_gutter-tooltip {\ -background-color: #FFF;\ -background-image: -webkit-linear-gradient(top, transparent, rgba(0, 0, 0, 0.1));\ -background-image: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.1));\ -border: 1px solid gray;\ -border-radius: 1px;\ -box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);\ -color: black;\ -display: inline-block;\ -max-width: 500px;\ -padding: 4px;\ -position: fixed;\ -z-index: 999999;\ --moz-box-sizing: border-box;\ --webkit-box-sizing: border-box;\ -box-sizing: border-box;\ -cursor: default;\ -white-space: pre-line;\ -word-wrap: break-word;\ -line-height: normal;\ -font-style: normal;\ -font-weight: normal;\ -letter-spacing: normal;\ -}\ -.ace_folding-enabled > .ace_gutter-cell {\ -padding-right: 13px;\ -}\ -.ace_fold-widget {\ --moz-box-sizing: border-box;\ --webkit-box-sizing: border-box;\ -box-sizing: border-box;\ -margin: 0 -12px 0 1px;\ -display: none;\ -width: 11px;\ -vertical-align: top;\ -background-image: url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%00%05%08%06%00%00%00%8Do%26%E5%00%00%004IDATx%DAe%8A%B1%0D%000%0C%C2%F2%2CK%96%BC%D0%8F9%81%88H%E9%D0%0E%96%C0%10%92%3E%02%80%5E%82%E4%A9*-%EEsw%C8%CC%11%EE%96w%D8%DC%E9*Eh%0C%151(%00%00%00%00IEND%AEB%60%82\");\ -background-repeat: no-repeat;\ -background-position: center;\ -border-radius: 3px;\ -border: 1px solid transparent;\ -cursor: pointer;\ -}\ -.ace_folding-enabled .ace_fold-widget {\ -display: inline-block; \ -}\ -.ace_fold-widget.ace_end {\ -background-image: url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%00%05%08%06%00%00%00%8Do%26%E5%00%00%004IDATx%DAm%C7%C1%09%000%08C%D1%8C%ECE%C8E(%8E%EC%02)%1EZJ%F1%C1'%04%07I%E1%E5%EE%CAL%F5%A2%99%99%22%E2%D6%1FU%B5%FE0%D9x%A7%26Wz5%0E%D5%00%00%00%00IEND%AEB%60%82\");\ -}\ -.ace_fold-widget.ace_closed {\ -background-image: url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%03%00%00%00%06%08%06%00%00%00%06%E5%24%0C%00%00%009IDATx%DA5%CA%C1%09%000%08%03%C0%AC*(%3E%04%C1%0D%BA%B1%23%A4Uh%E0%20%81%C0%CC%F8%82%81%AA%A2%AArGfr%88%08%11%11%1C%DD%7D%E0%EE%5B%F6%F6%CB%B8%05Q%2F%E9tai%D9%00%00%00%00IEND%AEB%60%82\");\ -}\ -.ace_fold-widget:hover {\ -border: 1px solid rgba(0, 0, 0, 0.3);\ -background-color: rgba(255, 255, 255, 0.2);\ --moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);\ --webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);\ -box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);\ -}\ -.ace_fold-widget:active {\ -border: 1px solid rgba(0, 0, 0, 0.4);\ -background-color: rgba(0, 0, 0, 0.05);\ --moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);\ --webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);\ -box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);\ -}\ -/**\ -* Dark version for fold widgets\ -*/\ -.ace_dark .ace_fold-widget {\ -background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC\");\ -}\ -.ace_dark .ace_fold-widget.ace_end {\ -background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==\");\ -}\ -.ace_dark .ace_fold-widget.ace_closed {\ -background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==\");\ -}\ -.ace_dark .ace_fold-widget:hover {\ -box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\ -background-color: rgba(255, 255, 255, 0.1);\ -}\ -.ace_dark .ace_fold-widget:active {\ --moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\ --webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\ -box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\ -}\ -.ace_fold-widget.ace_invalid {\ -background-color: #FFB4B4;\ -border-color: #DE5555;\ -}\ -.ace_fade-fold-widgets .ace_fold-widget {\ --moz-transition: opacity 0.4s ease 0.05s;\ --webkit-transition: opacity 0.4s ease 0.05s;\ --o-transition: opacity 0.4s ease 0.05s;\ --ms-transition: opacity 0.4s ease 0.05s;\ -transition: opacity 0.4s ease 0.05s;\ -opacity: 0;\ -}\ -.ace_fade-fold-widgets:hover .ace_fold-widget {\ --moz-transition: opacity 0.05s ease 0.05s;\ --webkit-transition: opacity 0.05s ease 0.05s;\ --o-transition: opacity 0.05s ease 0.05s;\ --ms-transition: opacity 0.05s ease 0.05s;\ -transition: opacity 0.05s ease 0.05s;\ -opacity:1;\ -}\ -.ace_underline {\ -text-decoration: underline;\ -}\ -.ace_bold {\ -font-weight: bold;\ -}\ -.ace_nobold .ace_bold {\ -font-weight: normal;\ -}\ -.ace_italic {\ -font-style: italic;\ -}\ -.ace_error-marker {\ -background-color: rgba(255, 0, 0,0.2);\ -position: absolute;\ -z-index: 9;\ -}\ -.ace_highlight-marker {\ -background-color: rgba(255, 255, 0,0.2);\ -position: absolute;\ -z-index: 8;\ -}\ -"; - -dom.importCssString(editorCss, "ace_editor"); - -var VirtualRenderer = function(container, theme) { - var _self = this; - - this.container = container || dom.createElement("div"); - this.$keepTextAreaAtCursor = true; - - dom.addCssClass(this.container, "ace_editor"); - - this.setTheme(theme); - - this.$gutter = dom.createElement("div"); - this.$gutter.className = "ace_gutter"; - this.container.appendChild(this.$gutter); - - this.scroller = dom.createElement("div"); - this.scroller.className = "ace_scroller"; - this.container.appendChild(this.scroller); - - this.content = dom.createElement("div"); - this.content.className = "ace_content"; - this.scroller.appendChild(this.content); - - this.$gutterLayer = new GutterLayer(this.$gutter); - this.$gutterLayer.on("changeGutterWidth", this.onGutterResize.bind(this)); - - this.$markerBack = new MarkerLayer(this.content); - - var textLayer = this.$textLayer = new TextLayer(this.content); - this.canvas = textLayer.element; - - this.$markerFront = new MarkerLayer(this.content); - - this.$cursorLayer = new CursorLayer(this.content); - this.$horizScroll = false; - this.$vScroll = false; - - this.scrollBar = - this.scrollBarV = new ScrollBarV(this.container, this); - this.scrollBarH = new ScrollBarH(this.container, this); - this.scrollBarV.addEventListener("scroll", function(e) { - if (!_self.$scrollAnimation) - _self.session.setScrollTop(e.data - _self.scrollMargin.top); - }); - this.scrollBarH.addEventListener("scroll", function(e) { - if (!_self.$scrollAnimation) - _self.session.setScrollLeft(e.data - _self.scrollMargin.left); - }); - - this.scrollTop = 0; - this.scrollLeft = 0; - - this.cursorPos = { - row : 0, - column : 0 - }; - - this.$textLayer.addEventListener("changeCharacterSize", function() { - _self.updateCharacterSize(); - _self.onResize(true); - _self._signal("changeCharacterSize"); - }); - - this.$size = { - width: 0, - height: 0, - scrollerHeight: 0, - scrollerWidth: 0 - }; - - this.layerConfig = { - width : 1, - padding : 0, - firstRow : 0, - firstRowScreen: 0, - lastRow : 0, - lineHeight : 0, - characterWidth : 0, - minHeight : 1, - maxHeight : 1, - offset : 0, - height : 1 - }; - - this.scrollMargin = { - left: 0, - right: 0, - top: 0, - bottom: 0, - v: 0, - h: 0 - }; - - this.$loop = new RenderLoop( - this.$renderChanges.bind(this), - this.container.ownerDocument.defaultView - ); - this.$loop.schedule(this.CHANGE_FULL); - - this.updateCharacterSize(); - this.setPadding(4); - config.resetOptions(this); - config._emit("renderer", this); -}; - -(function() { - - this.CHANGE_CURSOR = 1; - this.CHANGE_MARKER = 2; - this.CHANGE_GUTTER = 4; - this.CHANGE_SCROLL = 8; - this.CHANGE_LINES = 16; - this.CHANGE_TEXT = 32; - this.CHANGE_SIZE = 64; - this.CHANGE_MARKER_BACK = 128; - this.CHANGE_MARKER_FRONT = 256; - this.CHANGE_FULL = 512; - this.CHANGE_H_SCROLL = 1024; - - oop.implement(this, EventEmitter); - - this.updateCharacterSize = function() { - if (this.$textLayer.allowBoldFonts != this.$allowBoldFonts) { - this.$allowBoldFonts = this.$textLayer.allowBoldFonts; - this.setStyle("ace_nobold", !this.$allowBoldFonts); - } - - this.layerConfig.characterWidth = - this.characterWidth = this.$textLayer.getCharacterWidth(); - this.layerConfig.lineHeight = - this.lineHeight = this.$textLayer.getLineHeight(); - this.$updatePrintMargin(); - }; - this.setSession = function(session) { - this.session = session; - - this.scroller.className = "ace_scroller"; - - this.$cursorLayer.setSession(session); - this.$markerBack.setSession(session); - this.$markerFront.setSession(session); - this.$gutterLayer.setSession(session); - this.$textLayer.setSession(session); - this.$loop.schedule(this.CHANGE_FULL); - - }; - this.updateLines = function(firstRow, lastRow) { - if (lastRow === undefined) - lastRow = Infinity; - - if (!this.$changedLines) { - this.$changedLines = { - firstRow: firstRow, - lastRow: lastRow - }; - } - else { - if (this.$changedLines.firstRow > firstRow) - this.$changedLines.firstRow = firstRow; - - if (this.$changedLines.lastRow < lastRow) - this.$changedLines.lastRow = lastRow; - } - - if (this.$changedLines.firstRow > this.layerConfig.lastRow || - this.$changedLines.lastRow < this.layerConfig.firstRow) - return; - this.$loop.schedule(this.CHANGE_LINES); - }; - - this.onChangeTabSize = function() { - this.$loop.schedule(this.CHANGE_TEXT | this.CHANGE_MARKER); - this.$textLayer.onChangeTabSize(); - }; - this.updateText = function() { - this.$loop.schedule(this.CHANGE_TEXT); - }; - this.updateFull = function(force) { - if (force) - this.$renderChanges(this.CHANGE_FULL, true); - else - this.$loop.schedule(this.CHANGE_FULL); - }; - this.updateFontSize = function() { - this.$textLayer.checkForSizeChanges(); - }; - - this.$changes = 0; - this.onResize = function(force, gutterWidth, width, height) { - if (this.resizing > 2) - return; - else if (this.resizing > 0) - this.resizing++; - else - this.resizing = force ? 1 : 0; - var el = this.container; - if (!height) - height = el.clientHeight || el.scrollHeight; - if (!width) - width = el.clientWidth || el.scrollWidth; - - var changes = this.$updateCachedSize(force, gutterWidth, width, height); - - if (!this.$size.scrollerHeight || (!width && !height)) - return this.resizing = 0; - - if (force) - this.$gutterLayer.$padding = null; - - if (force) - this.$renderChanges(changes, true); - else - this.$loop.schedule(changes | this.$changes); - - if (this.resizing) - this.resizing = 0; - }; - - this.$updateCachedSize = function(force, gutterWidth, width, height) { - var changes = 0; - var size = this.$size; - var oldSize = { - width: size.width, - height: size.height, - scrollerHeight: size.scrollerHeight, - scrollerWidth: size.scrollerWidth - }; - if (height && (force || size.height != height)) { - size.height = height; - changes = this.CHANGE_SIZE; - - size.scrollerHeight = size.height; - if (this.$horizScroll) - size.scrollerHeight -= this.scrollBarH.getHeight(); - this.scrollBarV.element.style.bottom = this.scrollBarH.getHeight() + "px"; - - if (this.session) { - this.session.setScrollTop(this.getScrollTop()); - changes = changes | this.CHANGE_SCROLL; - } - } - - if (width && (force || size.width != width)) { - changes = this.CHANGE_SIZE; - size.width = width; - - if (gutterWidth == null) - gutterWidth = this.$showGutter ? this.$gutter.offsetWidth : 0; - - this.gutterWidth = gutterWidth; - - this.scrollBarH.element.style.left = - this.scroller.style.left = gutterWidth + "px"; - size.scrollerWidth = Math.max(0, width - gutterWidth - this.scrollBarV.getWidth()); - - this.scrollBarH.element.style.right = - this.scroller.style.right = this.scrollBarV.getWidth() + "px"; - this.scroller.style.bottom = this.scrollBarH.getHeight() + "px"; - - if (this.session && this.session.getUseWrapMode() && this.adjustWrapLimit() || force) - changes = changes | this.CHANGE_FULL; - } - - if (changes) - this._signal("resize", oldSize); - - return changes; - }; - - this.onGutterResize = function() { - var gutterWidth = this.$showGutter ? this.$gutter.offsetWidth : 0; - if (gutterWidth != this.gutterWidth) - this.$changes |= this.$updateCachedSize(true, gutterWidth, this.$size.width, this.$size.height); - - if (this.session.getUseWrapMode() && this.adjustWrapLimit()) - this.$loop.schedule(this.CHANGE_FULL); - else { - this.$computeLayerConfig(); - this.$loop.schedule(this.CHANGE_MARKER); - } - }; - this.adjustWrapLimit = function() { - var availableWidth = this.$size.scrollerWidth - this.$padding * 2; - var limit = Math.floor(availableWidth / this.characterWidth); - return this.session.adjustWrapLimit(limit, this.$showPrintMargin && this.$printMarginColumn); - }; - this.setAnimatedScroll = function(shouldAnimate){ - this.setOption("animatedScroll", shouldAnimate); - }; - this.getAnimatedScroll = function() { - return this.$animatedScroll; - }; - this.setShowInvisibles = function(showInvisibles) { - this.setOption("showInvisibles", showInvisibles); - }; - this.getShowInvisibles = function() { - return this.getOption("showInvisibles"); - }; - this.getDisplayIndentGuides = function() { - return this.getOption("displayIndentGuides"); - }; - - this.setDisplayIndentGuides = function(display) { - this.setOption("displayIndentGuides", display); - }; - this.setShowPrintMargin = function(showPrintMargin) { - this.setOption("showPrintMargin", showPrintMargin); - }; - this.getShowPrintMargin = function() { - return this.getOption("showPrintMargin"); - }; - this.setPrintMarginColumn = function(showPrintMargin) { - this.setOption("printMarginColumn", showPrintMargin); - }; - this.getPrintMarginColumn = function() { - return this.getOption("printMarginColumn"); - }; - this.getShowGutter = function(){ - return this.getOption("showGutter"); - }; - this.setShowGutter = function(show){ - return this.setOption("showGutter", show); - }; - - this.getFadeFoldWidgets = function(){ - return this.getOption("fadeFoldWidgets") - }; - - this.setFadeFoldWidgets = function(show) { - this.setOption("fadeFoldWidgets", show); - }; - - this.setHighlightGutterLine = function(shouldHighlight) { - this.setOption("highlightGutterLine", shouldHighlight); - }; - - this.getHighlightGutterLine = function() { - return this.getOption("highlightGutterLine"); - }; - - this.$updateGutterLineHighlight = function() { - var pos = this.$cursorLayer.$pixelPos; - var height = this.layerConfig.lineHeight; - if (this.session.getUseWrapMode()) { - var cursor = this.session.selection.getCursor(); - cursor.column = 0; - pos = this.$cursorLayer.getPixelPosition(cursor, true); - height *= this.session.getRowLength(cursor.row); - } - this.$gutterLineHighlight.style.top = pos.top - this.layerConfig.offset + "px"; - this.$gutterLineHighlight.style.height = height + "px"; - }; - - this.$updatePrintMargin = function() { - if (!this.$showPrintMargin && !this.$printMarginEl) - return; - - if (!this.$printMarginEl) { - var containerEl = dom.createElement("div"); - containerEl.className = "ace_layer ace_print-margin-layer"; - this.$printMarginEl = dom.createElement("div"); - this.$printMarginEl.className = "ace_print-margin"; - containerEl.appendChild(this.$printMarginEl); - this.content.insertBefore(containerEl, this.content.firstChild); - } - - var style = this.$printMarginEl.style; - style.left = ((this.characterWidth * this.$printMarginColumn) + this.$padding) + "px"; - style.visibility = this.$showPrintMargin ? "visible" : "hidden"; - - if (this.session && this.session.$wrap == -1) - this.adjustWrapLimit(); - }; - this.getContainerElement = function() { - return this.container; - }; - this.getMouseEventTarget = function() { - return this.content; - }; - this.getTextAreaContainer = function() { - return this.container; - }; - this.$moveTextAreaToCursor = function() { - if (!this.$keepTextAreaAtCursor) - return; - var config = this.layerConfig; - var posTop = this.$cursorLayer.$pixelPos.top; - var posLeft = this.$cursorLayer.$pixelPos.left; - posTop -= config.offset; - - var h = this.lineHeight; - if (posTop < 0 || posTop > config.height - h) - return; - - var w = this.characterWidth; - if (this.$composition) { - var val = this.textarea.value.replace(/^\x01+/, ""); - w *= (this.session.$getStringScreenWidth(val)[0]+2); - h += 2; - posTop -= 1; - } - posLeft -= this.scrollLeft; - if (posLeft > this.$size.scrollerWidth - w) - posLeft = this.$size.scrollerWidth - w; - - posLeft -= this.scrollBar.width; - - this.textarea.style.height = h + "px"; - this.textarea.style.width = w + "px"; - this.textarea.style.right = Math.max(0, this.$size.scrollerWidth - posLeft - w) + "px"; - this.textarea.style.bottom = Math.max(0, this.$size.height - posTop - h) + "px"; - }; - this.getFirstVisibleRow = function() { - return this.layerConfig.firstRow; - }; - this.getFirstFullyVisibleRow = function() { - return this.layerConfig.firstRow + (this.layerConfig.offset === 0 ? 0 : 1); - }; - this.getLastFullyVisibleRow = function() { - var flint = Math.floor((this.layerConfig.height + this.layerConfig.offset) / this.layerConfig.lineHeight); - return this.layerConfig.firstRow - 1 + flint; - }; - this.getLastVisibleRow = function() { - return this.layerConfig.lastRow; - }; - - this.$padding = null; - this.setPadding = function(padding) { - this.$padding = padding; - this.$textLayer.setPadding(padding); - this.$cursorLayer.setPadding(padding); - this.$markerFront.setPadding(padding); - this.$markerBack.setPadding(padding); - this.$loop.schedule(this.CHANGE_FULL); - this.$updatePrintMargin(); - }; - - this.setScrollMargin = function(top, bottom, left, right) { - var sm = this.scrollMargin; - sm.top = top|0; - sm.bottom = bottom|0; - sm.right = right|0; - sm.left = left|0; - sm.v = sm.top + sm.bottom; - sm.h = sm.left + sm.right; - this.updateFull(); - }; - this.getHScrollBarAlwaysVisible = function() { - return this.$hScrollBarAlwaysVisible; - }; - this.setHScrollBarAlwaysVisible = function(alwaysVisible) { - this.setOption("hScrollBarAlwaysVisible", alwaysVisible); - }; - this.getVScrollBarAlwaysVisible = function() { - return this.$hScrollBarAlwaysVisible; - }; - this.setVScrollBarAlwaysVisible = function(alwaysVisible) { - this.setOption("vScrollBarAlwaysVisible", alwaysVisible); - }; - - this.$updateScrollBarV = function() { - this.scrollBarV.setInnerHeight(this.layerConfig.maxHeight + this.scrollMargin.v); - this.scrollBarV.setScrollTop(this.scrollTop + this.scrollMargin.top); - }; - this.$updateScrollBarH = function() { - this.scrollBarH.setInnerWidth(this.layerConfig.width + 2 * this.$padding + this.scrollMargin.h); - this.scrollBarH.setScrollLeft(this.scrollLeft + this.scrollMargin.left); - }; - - this.$renderChanges = function(changes, force) { - if (this.$changes) { - changes |= this.$changes; - this.$changes = 0; - } - if ((!this.session || !this.container.offsetWidth) || (!changes && !force)) { - this.$changes |= changes; - return; - } - if (!this.$size.width) { - this.$changes |= changes; - return this.onResize(true); - } - if (!this.lineHeight) { - this.$textLayer.checkForSizeChanges(); - } - - this._signal("beforeRender"); - if (changes & this.CHANGE_FULL || - changes & this.CHANGE_SIZE || - changes & this.CHANGE_TEXT || - changes & this.CHANGE_LINES || - changes & this.CHANGE_SCROLL || - changes & this.CHANGE_H_SCROLL - ) - changes |= this.$computeLayerConfig(); - if (changes & this.CHANGE_H_SCROLL) { - this.$updateScrollBarH(); - this.content.style.marginLeft = -this.scrollLeft + "px"; - this.scroller.className = this.scrollLeft <= 0 ? "ace_scroller" : "ace_scroller ace_scroll-left"; - } - if (changes & this.CHANGE_FULL) { - this.$updateScrollBarV(); - this.$updateScrollBarH(); - this.$textLayer.update(this.layerConfig); - if (this.$showGutter) - this.$gutterLayer.update(this.layerConfig); - this.$markerBack.update(this.layerConfig); - this.$markerFront.update(this.layerConfig); - this.$cursorLayer.update(this.layerConfig); - this.$moveTextAreaToCursor(); - this.$highlightGutterLine && this.$updateGutterLineHighlight(); - this._signal("afterRender"); - return; - } - if (changes & this.CHANGE_SCROLL) { - this.$updateScrollBarV(); - if (changes & this.CHANGE_TEXT || changes & this.CHANGE_LINES) - this.$textLayer.update(this.layerConfig); - else - this.$textLayer.scrollLines(this.layerConfig); - - if (this.$showGutter) - this.$gutterLayer.update(this.layerConfig); - this.$markerBack.update(this.layerConfig); - this.$markerFront.update(this.layerConfig); - this.$cursorLayer.update(this.layerConfig); - this.$highlightGutterLine && this.$updateGutterLineHighlight(); - this.$moveTextAreaToCursor(); - this._signal("afterRender"); - return; - } - - if (changes & this.CHANGE_TEXT) { - this.$textLayer.update(this.layerConfig); - if (this.$showGutter) - this.$gutterLayer.update(this.layerConfig); - } - else if (changes & this.CHANGE_LINES) { - if (this.$updateLines() || (changes & this.CHANGE_GUTTER) && this.$showGutter) - this.$gutterLayer.update(this.layerConfig); - } - else if (changes & this.CHANGE_TEXT || changes & this.CHANGE_GUTTER) { - if (this.$showGutter) - this.$gutterLayer.update(this.layerConfig); - } - - if (changes & this.CHANGE_CURSOR) { - this.$cursorLayer.update(this.layerConfig); - this.$moveTextAreaToCursor(); - this.$highlightGutterLine && this.$updateGutterLineHighlight(); - } - - if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_FRONT)) { - this.$markerFront.update(this.layerConfig); - } - - if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_BACK)) { - this.$markerBack.update(this.layerConfig); - } - - if (changes & this.CHANGE_SIZE || changes & this.CHANGE_LINES) { - this.$updateScrollBarV(); - this.$updateScrollBarH(); - } - - this._signal("afterRender"); - }; - - - this.$autosize = function(height, width) { - var height = this.session.getScreenLength() * this.lineHeight; - var maxHeight = this.$maxLines * this.lineHeight; - var desiredHeight = Math.max( - (this.$minLines||1) * this.lineHeight, - Math.min(maxHeight, height) - ); - var vScroll = height > maxHeight; - - if (desiredHeight != this.desiredHeight || - this.$size.height != this.desiredHeight || vScroll != this.$vScroll) { - if (vScroll != this.$vScroll) { - this.$vScroll = vScroll; - this.scrollBarV.setVisible(vScroll); - } - - var w = this.container.clientWidth; - this.container.style.height = desiredHeight + "px"; - this.$updateCachedSize(true, this.$gutterWidth, w, desiredHeight); - this.desiredHeight = desiredHeight; - } - }; - - this.$computeLayerConfig = function() { - if (this.$maxLines && this.lineHeight > 1) - this.$autosize(); - - var session = this.session; - - var hideScrollbars = this.$size.height <= 2 * this.lineHeight; - var screenLines = this.session.getScreenLength() - var maxHeight = screenLines * this.lineHeight; - - var offset = this.scrollTop % this.lineHeight; - var minHeight = this.$size.scrollerHeight + this.lineHeight; - - var longestLine = this.$getLongestLine(); - - var horizScroll = !hideScrollbars && (this.$hScrollBarAlwaysVisible || - this.$size.scrollerWidth - longestLine - 2 * this.$padding < 0); - - var hScrollChanged = this.$horizScroll !== horizScroll; - if (hScrollChanged) { - this.$horizScroll = horizScroll; - this.scrollBarH.setVisible(horizScroll); - } - - if (!this.$maxLines && this.$scrollPastEnd) { - if (this.scrollTop > maxHeight - this.$size.scrollerHeight) - maxHeight += Math.min( - (this.$size.scrollerHeight - this.lineHeight) * this.$scrollPastEnd, - this.scrollTop - maxHeight + this.$size.scrollerHeight - ); - } - - var vScroll = !hideScrollbars && (this.$vScrollBarAlwaysVisible || - this.$size.scrollerHeight - maxHeight < 0); - var vScrollChanged = this.$vScroll !== vScroll; - if (vScrollChanged) { - this.$vScroll = vScroll; - this.scrollBarV.setVisible(vScroll); - } - - this.session.setScrollTop(Math.max(-this.scrollMargin.top, - Math.min(this.scrollTop, maxHeight - this.$size.scrollerHeight + this.scrollMargin.v))); - - this.session.setScrollLeft(Math.max(-this.scrollMargin.left, Math.min(this.scrollLeft, - longestLine + 2 * this.$padding - this.$size.scrollerWidth + this.scrollMargin.h))); - - var lineCount = Math.ceil(minHeight / this.lineHeight) - 1; - var firstRow = Math.max(0, Math.round((this.scrollTop - offset) / this.lineHeight)); - var lastRow = firstRow + lineCount; - var firstRowScreen, firstRowHeight; - var lineHeight = this.lineHeight; - firstRow = session.screenToDocumentRow(firstRow, 0); - var foldLine = session.getFoldLine(firstRow); - if (foldLine) { - firstRow = foldLine.start.row; - } - - firstRowScreen = session.documentToScreenRow(firstRow, 0); - firstRowHeight = session.getRowLength(firstRow) * lineHeight; - - lastRow = Math.min(session.screenToDocumentRow(lastRow, 0), session.getLength() - 1); - minHeight = this.$size.scrollerHeight + session.getRowLength(lastRow) * lineHeight + - firstRowHeight; - - offset = this.scrollTop - firstRowScreen * lineHeight; - - var changes = 0; - if (hScrollChanged || vScrollChanged) { - changes = this.$updateCachedSize(true, this.gutterWidth, this.$size.width, this.$size.height); - this._signal("scrollbarVisibilityChanged"); - if (vScrollChanged) - longestLine = this.$getLongestLine(); - } - - this.layerConfig = { - width : longestLine, - padding : this.$padding, - firstRow : firstRow, - firstRowScreen: firstRowScreen, - lastRow : lastRow, - lineHeight : lineHeight, - characterWidth : this.characterWidth, - minHeight : minHeight, - maxHeight : maxHeight, - offset : offset, - height : this.$size.scrollerHeight - }; - - this.$gutterLayer.element.style.marginTop = (-offset) + "px"; - this.content.style.marginTop = (-offset) + "px"; - this.content.style.width = longestLine + 2 * this.$padding + "px"; - this.content.style.height = minHeight + "px"; - - return changes; - }; - - this.$updateLines = function() { - var firstRow = this.$changedLines.firstRow; - var lastRow = this.$changedLines.lastRow; - this.$changedLines = null; - - var layerConfig = this.layerConfig; - - if (firstRow > layerConfig.lastRow + 1) { return; } - if (lastRow < layerConfig.firstRow) { return; } - if (lastRow === Infinity) { - if (this.$showGutter) - this.$gutterLayer.update(layerConfig); - this.$textLayer.update(layerConfig); - return; - } - this.$textLayer.updateLines(layerConfig, firstRow, lastRow); - return true; - }; - - this.$getLongestLine = function() { - var charCount = this.session.getScreenWidth(); - if (this.showInvisibles && !this.session.$useWrapMode) - charCount += 1; - - return Math.max(this.$size.scrollerWidth - 2 * this.$padding, Math.round(charCount * this.characterWidth)); - }; - this.updateFrontMarkers = function() { - this.$markerFront.setMarkers(this.session.getMarkers(true)); - this.$loop.schedule(this.CHANGE_MARKER_FRONT); - }; - this.updateBackMarkers = function() { - this.$markerBack.setMarkers(this.session.getMarkers()); - this.$loop.schedule(this.CHANGE_MARKER_BACK); - }; - this.addGutterDecoration = function(row, className){ - this.$gutterLayer.addGutterDecoration(row, className); - }; - this.removeGutterDecoration = function(row, className){ - this.$gutterLayer.removeGutterDecoration(row, className); - }; - this.updateBreakpoints = function(rows) { - this.$loop.schedule(this.CHANGE_GUTTER); - }; - this.setAnnotations = function(annotations) { - this.$gutterLayer.setAnnotations(annotations); - this.$loop.schedule(this.CHANGE_GUTTER); - }; - this.updateCursor = function() { - this.$loop.schedule(this.CHANGE_CURSOR); - }; - this.hideCursor = function() { - this.$cursorLayer.hideCursor(); - }; - this.showCursor = function() { - this.$cursorLayer.showCursor(); - }; - - this.scrollSelectionIntoView = function(anchor, lead, offset) { - this.scrollCursorIntoView(anchor, offset); - this.scrollCursorIntoView(lead, offset); - }; - this.scrollCursorIntoView = function(cursor, offset) { - if (this.$size.scrollerHeight === 0) - return; - - var pos = this.$cursorLayer.getPixelPosition(cursor); - - var left = pos.left; - var top = pos.top; - - var scrollTop = this.$scrollAnimation ? this.session.getScrollTop() : this.scrollTop; - - if (scrollTop > top) { - if (offset) - top -= offset * this.$size.scrollerHeight; - if (top == 0) - top = - this.scrollMargin.top; - else if (top == 0) - top = + this.scrollMargin.bottom; - this.session.setScrollTop(top); - } else if (scrollTop + this.$size.scrollerHeight < top + this.lineHeight) { - if (offset) - top += offset * this.$size.scrollerHeight; - this.session.setScrollTop(top + this.lineHeight - this.$size.scrollerHeight); - } - - var scrollLeft = this.scrollLeft; - - if (scrollLeft > left) { - if (left < this.$padding + 2 * this.layerConfig.characterWidth) - left = -this.scrollMargin.left; - this.session.setScrollLeft(left); - } else if (scrollLeft + this.$size.scrollerWidth < left + this.characterWidth) { - this.session.setScrollLeft(Math.round(left + this.characterWidth - this.$size.scrollerWidth)); - } else if (scrollLeft <= this.$padding && left - scrollLeft < this.characterWidth) { - this.session.setScrollLeft(0); - } - }; - this.getScrollTop = function() { - return this.session.getScrollTop(); - }; - this.getScrollLeft = function() { - return this.session.getScrollLeft(); - }; - this.getScrollTopRow = function() { - return this.scrollTop / this.lineHeight; - }; - this.getScrollBottomRow = function() { - return Math.max(0, Math.floor((this.scrollTop + this.$size.scrollerHeight) / this.lineHeight) - 1); - }; - this.scrollToRow = function(row) { - this.session.setScrollTop(row * this.lineHeight); - }; - - this.alignCursor = function(cursor, alignment) { - if (typeof cursor == "number") - cursor = {row: cursor, column: 0}; - - var pos = this.$cursorLayer.getPixelPosition(cursor); - var h = this.$size.scrollerHeight - this.lineHeight; - var offset = pos.top - h * (alignment || 0); - - this.session.setScrollTop(offset); - return offset; - }; - - this.STEPS = 8; - this.$calcSteps = function(fromValue, toValue){ - var i = 0; - var l = this.STEPS; - var steps = []; - - var func = function(t, x_min, dx) { - return dx * (Math.pow(t - 1, 3) + 1) + x_min; - }; - - for (i = 0; i < l; ++i) - steps.push(func(i / this.STEPS, fromValue, toValue - fromValue)); - - return steps; - }; - this.scrollToLine = function(line, center, animate, callback) { - var pos = this.$cursorLayer.getPixelPosition({row: line, column: 0}); - var offset = pos.top; - if (center) - offset -= this.$size.scrollerHeight / 2; - - var initialScroll = this.scrollTop; - this.session.setScrollTop(offset); - if (animate !== false) - this.animateScrolling(initialScroll, callback); - }; - - this.animateScrolling = function(fromValue, callback) { - var toValue = this.scrollTop; - if (!this.$animatedScroll) - return; - var _self = this; - - if (fromValue == toValue) - return; - - if (this.$scrollAnimation) { - var oldSteps = this.$scrollAnimation.steps; - if (oldSteps.length) { - fromValue = oldSteps[0]; - if (fromValue == toValue) - return; - } - } - - var steps = _self.$calcSteps(fromValue, toValue); - this.$scrollAnimation = {from: fromValue, to: toValue, steps: steps}; - - clearInterval(this.$timer); - - _self.session.setScrollTop(steps.shift()); - this.$timer = setInterval(function() { - if (steps.length) { - _self.session.setScrollTop(steps.shift()); - _self.session.$scrollTop = toValue; - } else if (toValue != null) { - _self.session.$scrollTop = -1; - _self.session.setScrollTop(toValue); - toValue = null; - } else { - _self.$timer = clearInterval(_self.$timer); - _self.$scrollAnimation = null; - callback && callback(); - } - }, 10); - }; - this.scrollToY = function(scrollTop) { - if (this.scrollTop !== scrollTop) { - this.$loop.schedule(this.CHANGE_SCROLL); - this.scrollTop = scrollTop; - } - }; - this.scrollToX = function(scrollLeft) { - if (this.scrollLeft !== scrollLeft) - this.scrollLeft = scrollLeft; - this.$loop.schedule(this.CHANGE_H_SCROLL); - }; - this.scrollTo = function(x, y) { - this.session.setScrollTop(y); - this.session.setScrollLeft(y); - }; - this.scrollBy = function(deltaX, deltaY) { - deltaY && this.session.setScrollTop(this.session.getScrollTop() + deltaY); - deltaX && this.session.setScrollLeft(this.session.getScrollLeft() + deltaX); - }; - this.isScrollableBy = function(deltaX, deltaY) { - if (deltaY < 0 && this.session.getScrollTop() >= 1 - this.scrollMargin.top) - return true; - if (deltaY > 0 && this.session.getScrollTop() + this.$size.scrollerHeight - - this.layerConfig.maxHeight - (this.$size.scrollerHeight - this.lineHeight) * this.$scrollPastEnd - < -1 + this.scrollMargin.bottom) - return true; - if (deltaX < 0 && this.session.getScrollLeft() >= 1 - this.scrollMargin.left) - return true; - if (deltaX > 0 && this.session.getScrollLeft() + this.$size.scrollerWidth - - this.layerConfig.width < -1 + this.scrollMargin.right) - return true; - }; - - this.pixelToScreenCoordinates = function(x, y) { - var canvasPos = this.scroller.getBoundingClientRect(); - - var offset = (x + this.scrollLeft - canvasPos.left - this.$padding) / this.characterWidth; - var row = Math.floor((y + this.scrollTop - canvasPos.top) / this.lineHeight); - var col = Math.round(offset); - - return {row: row, column: col, side: offset - col > 0 ? 1 : -1}; - }; - - this.screenToTextCoordinates = function(x, y) { - var canvasPos = this.scroller.getBoundingClientRect(); - - var col = Math.round( - (x + this.scrollLeft - canvasPos.left - this.$padding) / this.characterWidth - ); - var row = Math.floor( - (y + this.scrollTop - canvasPos.top) / this.lineHeight - ); - - return this.session.screenToDocumentPosition(row, Math.max(col, 0)); - }; - this.textToScreenCoordinates = function(row, column) { - var canvasPos = this.scroller.getBoundingClientRect(); - var pos = this.session.documentToScreenPosition(row, column); - - var x = this.$padding + Math.round(pos.column * this.characterWidth); - var y = pos.row * this.lineHeight; - - return { - pageX: canvasPos.left + x - this.scrollLeft, - pageY: canvasPos.top + y - this.scrollTop - }; - }; - this.visualizeFocus = function() { - dom.addCssClass(this.container, "ace_focus"); - }; - this.visualizeBlur = function() { - dom.removeCssClass(this.container, "ace_focus"); - }; - this.showComposition = function(position) { - if (!this.$composition) - this.$composition = { - keepTextAreaAtCursor: this.$keepTextAreaAtCursor, - cssText: this.textarea.style.cssText - }; - - this.$keepTextAreaAtCursor = true; - dom.addCssClass(this.textarea, "ace_composition"); - this.textarea.style.cssText = ""; - this.$moveTextAreaToCursor(); - }; - this.setCompositionText = function(text) { - this.$moveTextAreaToCursor(); - }; - this.hideComposition = function() { - if (!this.$composition) - return; - - dom.removeCssClass(this.textarea, "ace_composition"); - this.$keepTextAreaAtCursor = this.$composition.keepTextAreaAtCursor; - this.textarea.style.cssText = this.$composition.cssText; - this.$composition = null; - }; - this.setTheme = function(theme, cb) { - var _self = this; - this.$themeValue = theme; - _self._dispatchEvent('themeChange',{theme:theme}); - - if (!theme || typeof theme == "string") { - var moduleName = theme || "ace/theme/textmate"; - config.loadModule(["theme", moduleName], afterLoad); - } else { - afterLoad(theme); - } - - function afterLoad(module) { - if (_self.$themeValue != theme) - return cb && cb(); - if (!module.cssClass) - return; - dom.importCssString( - module.cssText, - module.cssClass, - _self.container.ownerDocument - ); - - if (_self.theme) - dom.removeCssClass(_self.container, _self.theme.cssClass); - _self.$theme = module.cssClass; - - _self.theme = module; - dom.addCssClass(_self.container, module.cssClass); - dom.setCssClass(_self.container, "ace_dark", module.isDark); - - var padding = "padding" in module ? module.padding : 4; - if (_self.$padding && padding != _self.$padding) - _self.setPadding(padding); - if (_self.$size) { - _self.$size.width = 0; - _self.onResize(); - } - - _self._dispatchEvent('themeLoaded', {theme:module}); - cb && cb(); - } - }; - this.getTheme = function() { - return this.$themeValue; - }; - this.setStyle = function(style, include) { - dom.setCssClass(this.container, style, include != false); - }; - this.unsetStyle = function(style) { - dom.removeCssClass(this.container, style); - }; - this.setMouseCursor = function(cursorStyle) { - this.content.style.cursor = cursorStyle; - }; - this.destroy = function() { - this.$textLayer.destroy(); - this.$cursorLayer.destroy(); - }; - -}).call(VirtualRenderer.prototype); - - -config.defineOptions(VirtualRenderer.prototype, "renderer", { - animatedScroll: {initialValue: false}, - showInvisibles: { - set: function(value) { - if (this.$textLayer.setShowInvisibles(value)) - this.$loop.schedule(this.CHANGE_TEXT); - }, - initialValue: false - }, - showPrintMargin: { - set: function() { this.$updatePrintMargin(); }, - initialValue: true - }, - printMarginColumn: { - set: function() { this.$updatePrintMargin(); }, - initialValue: 80 - }, - printMargin: { - set: function(val) { - if (typeof val == "number") - this.$printMarginColumn = val; - this.$showPrintMargin = !!val; - this.$updatePrintMargin(); - }, - get: function() { - return this.$showPrintMargin && this.$printMarginColumn; - } - }, - showGutter: { - set: function(show){ - this.$gutter.style.display = show ? "block" : "none"; - this.onGutterResize(); - }, - initialValue: true - }, - fadeFoldWidgets: { - set: function(show) { - dom.setCssClass(this.$gutter, "ace_fade-fold-widgets", show); - }, - initialValue: false - }, - showFoldWidgets: { - set: function(show) {this.$gutterLayer.setShowFoldWidgets(show)}, - initialValue: true - }, - displayIndentGuides: { - set: function(show) { - if (this.$textLayer.setDisplayIndentGuides(show)) - this.$loop.schedule(this.CHANGE_TEXT); - }, - initialValue: true - }, - highlightGutterLine: { - set: function(shouldHighlight) { - if (!this.$gutterLineHighlight) { - this.$gutterLineHighlight = dom.createElement("div"); - this.$gutterLineHighlight.className = "ace_gutter-active-line"; - this.$gutter.appendChild(this.$gutterLineHighlight); - return; - } - - this.$gutterLineHighlight.style.display = shouldHighlight ? "" : "none"; - if (this.$cursorLayer.$pixelPos) - this.$updateGutterLineHighlight(); - }, - initialValue: false, - value: true - }, - hScrollBarAlwaysVisible: { - set: function(val) { - if (!this.$hScrollBarAlwaysVisible || !this.$horizScroll) - this.$loop.schedule(this.CHANGE_SCROLL); - }, - initialValue: false - }, - vScrollBarAlwaysVisible: { - set: function(val) { - if (!this.$vScrollBarAlwaysVisible || !this.$vScroll) - this.$loop.schedule(this.CHANGE_SCROLL); - }, - initialValue: false - }, - fontSize: { - set: function(size) { - if (typeof size == "number") - size = size + "px"; - this.container.style.fontSize = size; - this.updateFontSize(); - }, - initialValue: 12 - }, - fontFamily: { - set: function(name) { - this.container.style.fontFamily = name; - this.updateFontSize(); - } - }, - maxLines: { - set: function(val) { - this.updateFull(); - } - }, - minLines: { - set: function(val) { - this.updateFull(); - } - }, - scrollPastEnd: { - set: function(val) { - val = +val || 0; - if (this.$scrollPastEnd == val) - return; - this.$scrollPastEnd = val; - this.$loop.schedule(this.CHANGE_SCROLL); - }, - initialValue: 0, - handlesSet: true - }, - fixedWidthGutter: { - set: function(val) { - this.$gutterLayer.$fixedWidth = !!val; - this.$loop.schedule(this.CHANGE_GUTTER); - } - } -}); - -exports.VirtualRenderer = VirtualRenderer; -}); - -define('ace/layer/gutter', ['require', 'exports', 'module' , 'ace/lib/dom', 'ace/lib/oop', 'ace/lib/lang', 'ace/lib/event_emitter'], function(require, exports, module) { - - -var dom = require("../lib/dom"); -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var EventEmitter = require("../lib/event_emitter").EventEmitter; - -var Gutter = function(parentEl) { - this.element = dom.createElement("div"); - this.element.className = "ace_layer ace_gutter-layer"; - parentEl.appendChild(this.element); - this.setShowFoldWidgets(this.$showFoldWidgets); - - this.gutterWidth = 0; - - this.$annotations = []; - this.$updateAnnotations = this.$updateAnnotations.bind(this); - - this.$cells = []; -}; - -(function() { - - oop.implement(this, EventEmitter); - - this.setSession = function(session) { - if (this.session) - this.session.removeEventListener("change", this.$updateAnnotations); - this.session = session; - session.on("change", this.$updateAnnotations); - }; - - this.addGutterDecoration = function(row, className){ - if (window.console) - console.warn && console.warn("deprecated use session.addGutterDecoration"); - this.session.addGutterDecoration(row, className); - }; - - this.removeGutterDecoration = function(row, className){ - if (window.console) - console.warn && console.warn("deprecated use session.removeGutterDecoration"); - this.session.removeGutterDecoration(row, className); - }; - - this.setAnnotations = function(annotations) { - this.$annotations = [] - var rowInfo, row; - for (var i = 0; i < annotations.length; i++) { - var annotation = annotations[i]; - var row = annotation.row; - var rowInfo = this.$annotations[row]; - if (!rowInfo) - rowInfo = this.$annotations[row] = {text: []}; - - var annoText = annotation.text; - annoText = annoText ? lang.escapeHTML(annoText) : annotation.html || ""; - - if (rowInfo.text.indexOf(annoText) === -1) - rowInfo.text.push(annoText); - - var type = annotation.type; - if (type == "error") - rowInfo.className = " ace_error"; - else if (type == "warning" && rowInfo.className != " ace_error") - rowInfo.className = " ace_warning"; - else if (type == "info" && (!rowInfo.className)) - rowInfo.className = " ace_info"; - } - }; - - this.$updateAnnotations = function (e) { - if (!this.$annotations.length) - return; - var delta = e.data; - var range = delta.range; - var firstRow = range.start.row; - var len = range.end.row - firstRow; - if (len === 0) { - } else if (delta.action == "removeText" || delta.action == "removeLines") { - this.$annotations.splice(firstRow, len + 1, null); - } else { - var args = Array(len + 1); - args.unshift(firstRow, 1); - this.$annotations.splice.apply(this.$annotations, args); - } - }; - - this.update = function(config) { - var firstRow = config.firstRow; - var lastRow = config.lastRow; - var fold = this.session.getNextFoldLine(firstRow); - var foldStart = fold ? fold.start.row : Infinity; - var foldWidgets = this.$showFoldWidgets && this.session.foldWidgets; - var breakpoints = this.session.$breakpoints; - var decorations = this.session.$decorations; - var firstLineNumber = this.session.$firstLineNumber; - var lastLineNumber = 0; - - var cell = null; - var index = -1; - var row = firstRow; - while (true) { - if (row > foldStart) { - row = fold.end.row + 1; - fold = this.session.getNextFoldLine(row, fold); - foldStart = fold ? fold.start.row : Infinity; - } - if (row > lastRow) { - while (this.$cells.length > index + 1) { - cell = this.$cells.pop(); - this.element.removeChild(cell.element); - } - break; - } - - cell = this.$cells[++index]; - if (!cell) { - cell = {element: null, textNode: null, foldWidget: null}; - cell.element = dom.createElement("div"); - cell.textNode = document.createTextNode(''); - cell.element.appendChild(cell.textNode); - this.element.appendChild(cell.element); - this.$cells[index] = cell; - } - - var className = "ace_gutter-cell "; - if (breakpoints[row]) - className += breakpoints[row]; - if (decorations[row]) - className += decorations[row]; - if (this.$annotations[row]) - className += this.$annotations[row].className; - if (cell.element.className != className) - cell.element.className = className; - - var height = this.session.getRowLength(row) * config.lineHeight + "px"; - if (height != cell.element.style.height) - cell.element.style.height = height; - - var text = lastLineNumber = row + firstLineNumber; - if (text != cell.textNode.data) - cell.textNode.data = text; - - if (foldWidgets) { - var c = foldWidgets[row]; - if (c == null) - c = foldWidgets[row] = this.session.getFoldWidget(row); - } - - if (c) { - if (!cell.foldWidget) { - cell.foldWidget = dom.createElement("span"); - cell.element.appendChild(cell.foldWidget); - } - var className = "ace_fold-widget ace_" + c; - if (c == "start" && row == foldStart && row < fold.end.row) - className += " ace_closed"; - else - className += " ace_open"; - if (cell.foldWidget.className != className) - cell.foldWidget.className = className; - - var height = config.lineHeight + "px"; - if (cell.foldWidget.style.height != height) - cell.foldWidget.style.height = height; - } else { - if (cell.foldWidget != null) { - cell.element.removeChild(cell.foldWidget); - cell.foldWidget = null; - } - } - - row++; - } - - this.element.style.height = config.minHeight + "px"; - - if (this.$fixedWidth || this.session.$useWrapMode) - lastLineNumber = this.session.getLength(); - - var gutterWidth = lastLineNumber.toString().length * config.characterWidth; - var padding = this.$padding || this.$computePadding(); - gutterWidth += padding.left + padding.right; - if (gutterWidth !== this.gutterWidth && !isNaN(gutterWidth)) { - this.gutterWidth = gutterWidth; - this.element.style.width = Math.ceil(this.gutterWidth) + "px"; - this._emit("changeGutterWidth", gutterWidth); - } - }; - - this.$fixedWidth = false; - - this.$showFoldWidgets = true; - this.setShowFoldWidgets = function(show) { - if (show) - dom.addCssClass(this.element, "ace_folding-enabled"); - else - dom.removeCssClass(this.element, "ace_folding-enabled"); - - this.$showFoldWidgets = show; - this.$padding = null; - }; - - this.getShowFoldWidgets = function() { - return this.$showFoldWidgets; - }; - - this.$computePadding = function() { - if (!this.element.firstChild) - return {left: 0, right: 0}; - var style = dom.computedStyle(this.element.firstChild); - this.$padding = {}; - this.$padding.left = parseInt(style.paddingLeft) + 1 || 0; - this.$padding.right = parseInt(style.paddingRight) || 0; - return this.$padding; - }; - - this.getRegion = function(point) { - var padding = this.$padding || this.$computePadding(); - var rect = this.element.getBoundingClientRect(); - if (point.x < padding.left + rect.left) - return "markers"; - if (this.$showFoldWidgets && point.x > rect.right - padding.right) - return "foldWidgets"; - }; - -}).call(Gutter.prototype); - -exports.Gutter = Gutter; - -}); - -define('ace/layer/marker', ['require', 'exports', 'module' , 'ace/range', 'ace/lib/dom'], function(require, exports, module) { - - -var Range = require("../range").Range; -var dom = require("../lib/dom"); - -var Marker = function(parentEl) { - this.element = dom.createElement("div"); - this.element.className = "ace_layer ace_marker-layer"; - parentEl.appendChild(this.element); -}; - -(function() { - - this.$padding = 0; - - this.setPadding = function(padding) { - this.$padding = padding; - }; - this.setSession = function(session) { - this.session = session; - }; - - this.setMarkers = function(markers) { - this.markers = markers; - }; - - this.update = function(config) { - var config = config || this.config; - if (!config) - return; - - this.config = config; - - - var html = []; - for (var key in this.markers) { - var marker = this.markers[key]; - - if (!marker.range) { - marker.update(html, this, this.session, config); - continue; - } - - var range = marker.range.clipRows(config.firstRow, config.lastRow); - if (range.isEmpty()) continue; - - range = range.toScreenRange(this.session); - if (marker.renderer) { - var top = this.$getTop(range.start.row, config); - var left = this.$padding + range.start.column * config.characterWidth; - marker.renderer(html, range, left, top, config); - } else if (marker.type == "fullLine") { - this.drawFullLineMarker(html, range, marker.clazz, config); - } else if (marker.type == "screenLine") { - this.drawScreenLineMarker(html, range, marker.clazz, config); - } else if (range.isMultiLine()) { - if (marker.type == "text") - this.drawTextMarker(html, range, marker.clazz, config); - else - this.drawMultiLineMarker(html, range, marker.clazz, config); - } else { - this.drawSingleLineMarker(html, range, marker.clazz + " ace_start", config); - } - } - this.element = dom.setInnerHtml(this.element, html.join("")); - }; - - this.$getTop = function(row, layerConfig) { - return (row - layerConfig.firstRowScreen) * layerConfig.lineHeight; - }; - this.drawTextMarker = function(stringBuilder, range, clazz, layerConfig, extraStyle) { - var row = range.start.row; - - var lineRange = new Range( - row, range.start.column, - row, this.session.getScreenLastRowColumn(row) - ); - this.drawSingleLineMarker(stringBuilder, lineRange, clazz + " ace_start", layerConfig, 1, extraStyle); - row = range.end.row; - lineRange = new Range(row, 0, row, range.end.column); - this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 0, extraStyle); - - for (row = range.start.row + 1; row < range.end.row; row++) { - lineRange.start.row = row; - lineRange.end.row = row; - lineRange.end.column = this.session.getScreenLastRowColumn(row); - this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 1, extraStyle); - } - }; - this.drawMultiLineMarker = function(stringBuilder, range, clazz, config, extraStyle) { - var padding = this.$padding; - var height = config.lineHeight; - var top = this.$getTop(range.start.row, config); - var left = padding + range.start.column * config.characterWidth; - extraStyle = extraStyle || ""; - - stringBuilder.push( - "
" - ); - top = this.$getTop(range.end.row, config); - var width = range.end.column * config.characterWidth; - - stringBuilder.push( - "
" - ); - height = (range.end.row - range.start.row - 1) * config.lineHeight; - if (height < 0) - return; - top = this.$getTop(range.start.row + 1, config); - - stringBuilder.push( - "
" - ); - }; - this.drawSingleLineMarker = function(stringBuilder, range, clazz, config, extraLength, extraStyle) { - var height = config.lineHeight; - var width = (range.end.column + (extraLength || 0) - range.start.column) * config.characterWidth; - - var top = this.$getTop(range.start.row, config); - var left = this.$padding + range.start.column * config.characterWidth; - - stringBuilder.push( - "
" - ); - }; - - this.drawFullLineMarker = function(stringBuilder, range, clazz, config, extraStyle) { - var top = this.$getTop(range.start.row, config); - var height = config.lineHeight; - if (range.start.row != range.end.row) - height += this.$getTop(range.end.row, config) - top; - - stringBuilder.push( - "
" - ); - }; - - this.drawScreenLineMarker = function(stringBuilder, range, clazz, config, extraStyle) { - var top = this.$getTop(range.start.row, config); - var height = config.lineHeight; - - stringBuilder.push( - "
" - ); - }; - -}).call(Marker.prototype); - -exports.Marker = Marker; - -}); - -define('ace/layer/text', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/dom', 'ace/lib/lang', 'ace/lib/useragent', 'ace/lib/event_emitter'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var dom = require("../lib/dom"); -var lang = require("../lib/lang"); -var useragent = require("../lib/useragent"); -var EventEmitter = require("../lib/event_emitter").EventEmitter; - -var Text = function(parentEl) { - this.element = dom.createElement("div"); - this.element.className = "ace_layer ace_text-layer"; - parentEl.appendChild(this.element); - - this.$characterSize = {width: 0, height: 0}; - this.checkForSizeChanges(); - this.$pollSizeChanges(); -}; - -(function() { - - oop.implement(this, EventEmitter); - - this.EOF_CHAR = "\xB6"; //"¶"; - this.EOL_CHAR = "\xAC"; //"¬"; - this.TAB_CHAR = "\u2192"; //"→" "\u21E5"; - this.SPACE_CHAR = "\xB7"; //"·"; - this.$padding = 0; - - this.setPadding = function(padding) { - this.$padding = padding; - this.element.style.padding = "0 " + padding + "px"; - }; - - this.getLineHeight = function() { - return this.$characterSize.height || 0; - }; - - this.getCharacterWidth = function() { - return this.$characterSize.width || 0; - }; - - this.checkForSizeChanges = function() { - var size = this.$measureSizes(); - if (size && (this.$characterSize.width !== size.width || this.$characterSize.height !== size.height)) { - this.$measureNode.style.fontWeight = "bold"; - var boldSize = this.$measureSizes(); - this.$measureNode.style.fontWeight = ""; - this.$characterSize = size; - this.allowBoldFonts = boldSize && boldSize.width === size.width && boldSize.height === size.height; - this._emit("changeCharacterSize", {data: size}); - } - }; - - this.$pollSizeChanges = function() { - var self = this; - this.$pollSizeChangesTimer = setInterval(function() { - self.checkForSizeChanges(); - }, 500); - }; - - this.$fontStyles = { - fontFamily : 1, - fontSize : 1, - fontWeight : 1, - fontStyle : 1, - lineHeight : 1 - }; - - this.$measureSizes = useragent.isIE || useragent.isOldGecko ? function() { - var n = 1000; - if (!this.$measureNode) { - var measureNode = this.$measureNode = dom.createElement("div"); - var style = measureNode.style; - - style.width = style.height = "auto"; - style.left = style.top = (-n * 40) + "px"; - - style.visibility = "hidden"; - style.position = "fixed"; - style.overflow = "visible"; - style.whiteSpace = "nowrap"; - measureNode.innerHTML = lang.stringRepeat("Xy", n); - - if (this.element.ownerDocument.body) { - this.element.ownerDocument.body.appendChild(measureNode); - } else { - var container = this.element.parentNode; - while (!dom.hasCssClass(container, "ace_editor")) - container = container.parentNode; - container.appendChild(measureNode); - } - } - if (!this.element.offsetWidth) - return null; - - var style = this.$measureNode.style; - var computedStyle = dom.computedStyle(this.element); - for (var prop in this.$fontStyles) - style[prop] = computedStyle[prop]; - - var size = { - height: this.$measureNode.offsetHeight, - width: this.$measureNode.offsetWidth / (n * 2) - }; - if (size.width == 0 || size.height == 0) - return null; - - return size; - } - : function() { - if (!this.$measureNode) { - var measureNode = this.$measureNode = dom.createElement("div"); - var style = measureNode.style; - - style.width = style.height = "auto"; - style.left = style.top = -100 + "px"; - - style.visibility = "hidden"; - style.position = "fixed"; - style.overflow = "visible"; - style.whiteSpace = "nowrap"; - measureNode.innerHTML = lang.stringRepeat("X", 100); - - var container = this.element.parentNode; - while (container && !dom.hasCssClass(container, "ace_editor")) - container = container.parentNode; - - if (!container) - return this.$measureNode = null; - - container.appendChild(measureNode); - } - - var rect = this.$measureNode.getBoundingClientRect(); - - var size = { - height: rect.height, - width: rect.width / 100 - }; - if (size.width == 0 || size.height == 0) - return null; - - return size; - }; - - this.setSession = function(session) { - this.session = session; - this.$computeTabString(); - }; - - this.showInvisibles = false; - this.setShowInvisibles = function(showInvisibles) { - if (this.showInvisibles == showInvisibles) - return false; - - this.showInvisibles = showInvisibles; - this.$computeTabString(); - return true; - }; - - this.displayIndentGuides = true; - this.setDisplayIndentGuides = function(display) { - if (this.displayIndentGuides == display) - return false; - - this.displayIndentGuides = display; - this.$computeTabString(); - return true; - }; - - this.$tabStrings = []; - this.onChangeTabSize = - this.$computeTabString = function() { - var tabSize = this.session.getTabSize(); - this.tabSize = tabSize; - var tabStr = this.$tabStrings = [0]; - for (var i = 1; i < tabSize + 1; i++) { - if (this.showInvisibles) { - tabStr.push("" - + this.TAB_CHAR - + lang.stringRepeat("\xa0", i - 1) - + ""); - } else { - tabStr.push(lang.stringRepeat("\xa0", i)); - } - } - if (this.displayIndentGuides) { - this.$indentGuideRe = /\s\S| \t|\t |\s$/; - var className = "ace_indent-guide"; - if (this.showInvisibles) { - className += " ace_invisible"; - var spaceContent = lang.stringRepeat(this.SPACE_CHAR, this.tabSize); - var tabContent = this.TAB_CHAR + lang.stringRepeat("\xa0", this.tabSize - 1); - } else{ - var spaceContent = lang.stringRepeat("\xa0", this.tabSize); - var tabContent = spaceContent; - } - - this.$tabStrings[" "] = "" + spaceContent + ""; - this.$tabStrings["\t"] = "" + tabContent + ""; - } - }; - - this.updateLines = function(config, firstRow, lastRow) { - if (this.config.lastRow != config.lastRow || - this.config.firstRow != config.firstRow) { - this.scrollLines(config); - } - this.config = config; - - var first = Math.max(firstRow, config.firstRow); - var last = Math.min(lastRow, config.lastRow); - - var lineElements = this.element.childNodes; - var lineElementsIdx = 0; - - for (var row = config.firstRow; row < first; row++) { - var foldLine = this.session.getFoldLine(row); - if (foldLine) { - if (foldLine.containsRow(first)) { - first = foldLine.start.row; - break; - } else { - row = foldLine.end.row; - } - } - lineElementsIdx ++; - } - - var row = first; - var foldLine = this.session.getNextFoldLine(row); - var foldStart = foldLine ? foldLine.start.row : Infinity; - - while (true) { - if (row > foldStart) { - row = foldLine.end.row+1; - foldLine = this.session.getNextFoldLine(row, foldLine); - foldStart = foldLine ? foldLine.start.row :Infinity; - } - if (row > last) - break; - - var lineElement = lineElements[lineElementsIdx++]; - if (lineElement) { - var html = []; - this.$renderLine( - html, row, !this.$useLineGroups(), row == foldStart ? foldLine : false - ); - dom.setInnerHtml(lineElement, html.join("")); - } - row++; - } - }; - - this.scrollLines = function(config) { - var oldConfig = this.config; - this.config = config; - - if (!oldConfig || oldConfig.lastRow < config.firstRow) - return this.update(config); - - if (config.lastRow < oldConfig.firstRow) - return this.update(config); - - var el = this.element; - if (oldConfig.firstRow < config.firstRow) - for (var row=this.session.getFoldedRowCount(oldConfig.firstRow, config.firstRow - 1); row>0; row--) - el.removeChild(el.firstChild); - - if (oldConfig.lastRow > config.lastRow) - for (var row=this.session.getFoldedRowCount(config.lastRow + 1, oldConfig.lastRow); row>0; row--) - el.removeChild(el.lastChild); - - if (config.firstRow < oldConfig.firstRow) { - var fragment = this.$renderLinesFragment(config, config.firstRow, oldConfig.firstRow - 1); - if (el.firstChild) - el.insertBefore(fragment, el.firstChild); - else - el.appendChild(fragment); - } - - if (config.lastRow > oldConfig.lastRow) { - var fragment = this.$renderLinesFragment(config, oldConfig.lastRow + 1, config.lastRow); - el.appendChild(fragment); - } - }; - - this.$renderLinesFragment = function(config, firstRow, lastRow) { - var fragment = this.element.ownerDocument.createDocumentFragment(); - var row = firstRow; - var foldLine = this.session.getNextFoldLine(row); - var foldStart = foldLine ? foldLine.start.row : Infinity; - - while (true) { - if (row > foldStart) { - row = foldLine.end.row+1; - foldLine = this.session.getNextFoldLine(row, foldLine); - foldStart = foldLine ? foldLine.start.row : Infinity; - } - if (row > lastRow) - break; - - var container = dom.createElement("div"); - - var html = []; - this.$renderLine(html, row, false, row == foldStart ? foldLine : false); - container.innerHTML = html.join(""); - if (this.$useLineGroups()) { - container.className = 'ace_line_group'; - fragment.appendChild(container); - } else { - var lines = container.childNodes - while(lines.length) - fragment.appendChild(lines[0]); - } - - row++; - } - return fragment; - }; - - this.update = function(config) { - this.config = config; - - var html = []; - var firstRow = config.firstRow, lastRow = config.lastRow; - - var row = firstRow; - var foldLine = this.session.getNextFoldLine(row); - var foldStart = foldLine ? foldLine.start.row : Infinity; - - while (true) { - if (row > foldStart) { - row = foldLine.end.row+1; - foldLine = this.session.getNextFoldLine(row, foldLine); - foldStart = foldLine ? foldLine.start.row :Infinity; - } - if (row > lastRow) - break; - - if (this.$useLineGroups()) - html.push("
") - - this.$renderLine(html, row, false, row == foldStart ? foldLine : false); - - if (this.$useLineGroups()) - html.push("
"); // end the line group - - row++; - } - this.element = dom.setInnerHtml(this.element, html.join("")); - }; - - this.$textToken = { - "text": true, - "rparen": true, - "lparen": true - }; - - this.$renderToken = function(stringBuilder, screenColumn, token, value) { - var self = this; - var replaceReg = /\t|&|<|( +)|([\x00-\x1f\x80-\xa0\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\u3000\uFEFF])|[\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3000-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]/g; - var replaceFunc = function(c, a, b, tabIdx, idx4) { - if (a) { - return self.showInvisibles ? - "" + lang.stringRepeat(self.SPACE_CHAR, c.length) + "" : - lang.stringRepeat("\xa0", c.length); - } else if (c == "&") { - return "&"; - } else if (c == "<") { - return "<"; - } else if (c == "\t") { - var tabSize = self.session.getScreenTabSize(screenColumn + tabIdx); - screenColumn += tabSize - 1; - return self.$tabStrings[tabSize]; - } else if (c == "\u3000") { - var classToUse = self.showInvisibles ? "ace_cjk ace_invisible" : "ace_cjk"; - var space = self.showInvisibles ? self.SPACE_CHAR : ""; - screenColumn += 1; - return "" + space + ""; - } else if (b) { - return "" + self.SPACE_CHAR + ""; - } else { - screenColumn += 1; - return "" + c + ""; - } - }; - - var output = value.replace(replaceReg, replaceFunc); - - if (!this.$textToken[token.type]) { - var classes = "ace_" + token.type.replace(/\./g, " ace_"); - var style = ""; - if (token.type == "fold") - style = " style='width:" + (token.value.length * this.config.characterWidth) + "px;' "; - stringBuilder.push("", output, ""); - } - else { - stringBuilder.push(output); - } - return screenColumn + value.length; - }; - - this.renderIndentGuide = function(stringBuilder, value, max) { - var cols = value.search(this.$indentGuideRe); - if (cols <= 0 || cols >= max) - return value; - if (value[0] == " ") { - cols -= cols % this.tabSize; - stringBuilder.push(lang.stringRepeat(this.$tabStrings[" "], cols/this.tabSize)); - return value.substr(cols); - } else if (value[0] == "\t") { - stringBuilder.push(lang.stringRepeat(this.$tabStrings["\t"], cols)); - return value.substr(cols); - } - return value; - }; - - this.$renderWrappedLine = function(stringBuilder, tokens, splits, onlyContents) { - var chars = 0; - var split = 0; - var splitChars = splits[0]; - var screenColumn = 0; - - for (var i = 0; i < tokens.length; i++) { - var token = tokens[i]; - var value = token.value; - if (i == 0 && this.displayIndentGuides) { - chars = value.length; - value = this.renderIndentGuide(stringBuilder, value, splitChars); - if (!value) - continue; - chars -= value.length; - } - - if (chars + value.length < splitChars) { - screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value); - chars += value.length; - } else { - while (chars + value.length >= splitChars) { - screenColumn = this.$renderToken( - stringBuilder, screenColumn, - token, value.substring(0, splitChars - chars) - ); - value = value.substring(splitChars - chars); - chars = splitChars; - - if (!onlyContents) { - stringBuilder.push("", - "
" - ); - } - - split ++; - screenColumn = 0; - splitChars = splits[split] || Number.MAX_VALUE; - } - if (value.length != 0) { - chars += value.length; - screenColumn = this.$renderToken( - stringBuilder, screenColumn, token, value - ); - } - } - } - }; - - this.$renderSimpleLine = function(stringBuilder, tokens) { - var screenColumn = 0; - var token = tokens[0]; - var value = token.value; - if (this.displayIndentGuides) - value = this.renderIndentGuide(stringBuilder, value); - if (value) - screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value); - for (var i = 1; i < tokens.length; i++) { - token = tokens[i]; - value = token.value; - screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value); - } - }; - this.$renderLine = function(stringBuilder, row, onlyContents, foldLine) { - if (!foldLine && foldLine != false) - foldLine = this.session.getFoldLine(row); - - if (foldLine) - var tokens = this.$getFoldLineTokens(row, foldLine); - else - var tokens = this.session.getTokens(row); - - - if (!onlyContents) { - stringBuilder.push( - "
" - ); - } - - if (tokens.length) { - var splits = this.session.getRowSplitData(row); - if (splits && splits.length) - this.$renderWrappedLine(stringBuilder, tokens, splits, onlyContents); - else - this.$renderSimpleLine(stringBuilder, tokens); - } - - if (this.showInvisibles) { - if (foldLine) - row = foldLine.end.row - - stringBuilder.push( - "", - row == this.session.getLength() - 1 ? this.EOF_CHAR : this.EOL_CHAR, - "" - ); - } - if (!onlyContents) - stringBuilder.push("
"); - }; - - this.$getFoldLineTokens = function(row, foldLine) { - var session = this.session; - var renderTokens = []; - - function addTokens(tokens, from, to) { - var idx = 0, col = 0; - while ((col + tokens[idx].value.length) < from) { - col += tokens[idx].value.length; - idx++; - - if (idx == tokens.length) - return; - } - if (col != from) { - var value = tokens[idx].value.substring(from - col); - if (value.length > (to - from)) - value = value.substring(0, to - from); - - renderTokens.push({ - type: tokens[idx].type, - value: value - }); - - col = from + value.length; - idx += 1; - } - - while (col < to && idx < tokens.length) { - var value = tokens[idx].value; - if (value.length + col > to) { - renderTokens.push({ - type: tokens[idx].type, - value: value.substring(0, to - col) - }); - } else - renderTokens.push(tokens[idx]); - col += value.length; - idx += 1; - } - } - - var tokens = session.getTokens(row); - foldLine.walk(function(placeholder, row, column, lastColumn, isNewRow) { - if (placeholder != null) { - renderTokens.push({ - type: "fold", - value: placeholder - }); - } else { - if (isNewRow) - tokens = session.getTokens(row); - - if (tokens.length) - addTokens(tokens, lastColumn, column); - } - }, foldLine.end.row, this.session.getLine(foldLine.end.row).length); - - return renderTokens; - }; - - this.$useLineGroups = function() { - return this.session.getUseWrapMode(); - }; - - this.destroy = function() { - clearInterval(this.$pollSizeChangesTimer); - if (this.$measureNode) - this.$measureNode.parentNode.removeChild(this.$measureNode); - delete this.$measureNode; - }; - -}).call(Text.prototype); - -exports.Text = Text; - -}); - -define('ace/layer/cursor', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) { - - -var dom = require("../lib/dom"); - -var Cursor = function(parentEl) { - this.element = dom.createElement("div"); - this.element.className = "ace_layer ace_cursor-layer"; - parentEl.appendChild(this.element); - - this.isVisible = false; - this.isBlinking = true; - this.blinkInterval = 1000; - this.smoothBlinking = false; - - this.cursors = []; - this.cursor = this.addCursor(); - dom.addCssClass(this.element, "ace_hidden-cursors"); -}; - -(function() { - - this.$padding = 0; - this.setPadding = function(padding) { - this.$padding = padding; - }; - - this.setSession = function(session) { - this.session = session; - }; - - this.setBlinking = function(blinking) { - if (blinking != this.isBlinking){ - this.isBlinking = blinking; - this.restartTimer(); - } - }; - - this.setBlinkInterval = function(blinkInterval) { - if (blinkInterval != this.blinkInterval){ - this.blinkInterval = blinkInterval; - this.restartTimer(); - } - }; - - this.setSmoothBlinking = function(smoothBlinking) { - if (smoothBlinking != this.smoothBlinking) { - this.smoothBlinking = smoothBlinking; - if (smoothBlinking) - dom.addCssClass(this.element, "ace_smooth-blinking"); - else - dom.removeCssClass(this.element, "ace_smooth-blinking"); - this.restartTimer(); - } - }; - - this.addCursor = function() { - var el = dom.createElement("div"); - el.className = "ace_cursor"; - this.element.appendChild(el); - this.cursors.push(el); - return el; - }; - - this.removeCursor = function() { - if (this.cursors.length > 1) { - var el = this.cursors.pop(); - el.parentNode.removeChild(el); - return el; - } - }; - - this.hideCursor = function() { - this.isVisible = false; - dom.addCssClass(this.element, "ace_hidden-cursors"); - this.restartTimer(); - }; - - this.showCursor = function() { - this.isVisible = true; - dom.removeCssClass(this.element, "ace_hidden-cursors"); - this.restartTimer(); - }; - - this.restartTimer = function() { - clearInterval(this.intervalId); - clearTimeout(this.timeoutId); - if (this.smoothBlinking) - dom.removeCssClass(this.element, "ace_smooth-blinking"); - for (var i = this.cursors.length; i--; ) - this.cursors[i].style.opacity = ""; - - if (!this.isBlinking || !this.blinkInterval || !this.isVisible) - return; - - if (this.smoothBlinking) - setTimeout(function(){ - dom.addCssClass(this.element, "ace_smooth-blinking"); - }.bind(this)); - - var blink = function(){ - this.timeoutId = setTimeout(function() { - for (var i = this.cursors.length; i--; ) { - this.cursors[i].style.opacity = 0; - } - }.bind(this), 0.6 * this.blinkInterval); - }.bind(this); - - this.intervalId = setInterval(function() { - for (var i = this.cursors.length; i--; ) { - this.cursors[i].style.opacity = ""; - } - blink(); - }.bind(this), this.blinkInterval); - - blink(); - }; - - this.getPixelPosition = function(position, onScreen) { - if (!this.config || !this.session) - return {left : 0, top : 0}; - - if (!position) - position = this.session.selection.getCursor(); - var pos = this.session.documentToScreenPosition(position); - var cursorLeft = this.$padding + pos.column * this.config.characterWidth; - var cursorTop = (pos.row - (onScreen ? this.config.firstRowScreen : 0)) * - this.config.lineHeight; - - return {left : cursorLeft, top : cursorTop}; - }; - - this.update = function(config) { - this.config = config; - - var selections = this.session.$selectionMarkers; - var i = 0, cursorIndex = 0; - - if (selections === undefined || selections.length === 0){ - selections = [{cursor: null}]; - } - - for (var i = 0, n = selections.length; i < n; i++) { - var pixelPos = this.getPixelPosition(selections[i].cursor, true); - if ((pixelPos.top > config.height + config.offset || - pixelPos.top < -config.offset) && i > 1) { - continue; - } - - var style = (this.cursors[cursorIndex++] || this.addCursor()).style; - - style.left = pixelPos.left + "px"; - style.top = pixelPos.top + "px"; - style.width = config.characterWidth + "px"; - style.height = config.lineHeight + "px"; - } - while (this.cursors.length > cursorIndex) - this.removeCursor(); - - var overwrite = this.session.getOverwrite(); - this.$setOverwrite(overwrite); - this.$pixelPos = pixelPos; - this.restartTimer(); - }; - - this.$setOverwrite = function(overwrite) { - if (overwrite != this.overwrite) { - this.overwrite = overwrite; - if (overwrite) - dom.addCssClass(this.element, "ace_overwrite-cursors"); - else - dom.removeCssClass(this.element, "ace_overwrite-cursors"); - } - }; - - this.destroy = function() { - clearInterval(this.intervalId); - clearTimeout(this.timeoutId); - }; - -}).call(Cursor.prototype); - -exports.Cursor = Cursor; - -}); - -define('ace/scrollbar', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/dom', 'ace/lib/event', 'ace/lib/event_emitter'], function(require, exports, module) { - - -var oop = require("./lib/oop"); -var dom = require("./lib/dom"); -var event = require("./lib/event"); -var EventEmitter = require("./lib/event_emitter").EventEmitter; -var ScrollBarV = function(parent, renderer) { - this.element = dom.createElement("div"); - this.element.className = "ace_scrollbar"; - - this.inner = dom.createElement("div"); - this.inner.className = "ace_scrollbar-inner"; - this.element.appendChild(this.inner); - - parent.appendChild(this.element); - renderer.$scrollbarWidth = - this.width = dom.scrollbarWidth(parent.ownerDocument); - renderer.$scrollbarWidth = - this.width = dom.scrollbarWidth(parent.ownerDocument); - this.fullWidth = this.width; - this.inner.style.width = - this.element.style.width = (this.width || 15) + 5 + "px"; - this.setVisible(false); - this.element.style.overflowY = "scroll"; - - event.addListener(this.element, "scroll", this.onScrollV.bind(this)); - event.addListener(this.element, "mousedown", event.preventDefault); -}; - -var ScrollBarH = function(parent, renderer) { - this.element = dom.createElement("div"); - this.element.className = "ace_scrollbar-h"; - - this.inner = dom.createElement("div"); - this.inner.className = "ace_scrollbar-inner"; - this.element.appendChild(this.inner); - - parent.appendChild(this.element); - this.height = renderer.$scrollbarWidth; - this.fullHeight = this.height; - this.inner.style.height = - this.element.style.height = (this.height || 15) + 5 + "px"; - this.setVisible(false); - this.element.style.overflowX = "scroll"; - - event.addListener(this.element, "scroll", this.onScrollH.bind(this)); - event.addListener(this.element, "mousedown", event.preventDefault); -}; - -(function() { - oop.implement(this, EventEmitter); - - this.setVisible = function(show) { - if (show) { - this.element.style.display = ""; - if (this.fullWidth) - this.width = this.fullWidth; - if (this.fullHeight) - this.height = this.fullHeight; - } else { - this.element.style.display = "none"; - this.height = this.width = 0; - } - }; - this.onScrollV = function() { - if (!this.skipEvent) { - this.scrollTop = this.element.scrollTop; - this._emit("scroll", {data: this.scrollTop}); - } - this.skipEvent = false; - }; - this.onScrollH = function() { - if (!this.skipEvent) { - this.scrollLeft = this.element.scrollLeft; - this._emit("scroll", {data: this.scrollLeft}); - } - this.skipEvent = false; - }; - this.getWidth = function() { - return this.width; - }; - - this.getHeight = function() { - return this.height; - }; - this.setHeight = function(height) { - this.element.style.height = height + "px"; - }; - - this.setWidth = function(width) { - this.element.style.width = width + "px"; - }; - this.setInnerHeight = function(height) { - this.inner.style.height = height + "px"; - }; - - this.setInnerWidth = function(width) { - this.inner.style.width = width + "px"; - }; - this.setScrollTop = function(scrollTop) { - if (this.scrollTop != scrollTop) { - this.skipEvent = true; - this.scrollTop = this.element.scrollTop = scrollTop; - } - }; - this.setScrollLeft = function(scrollLeft) { - if (this.scrollLeft != scrollLeft) { - this.skipEvent = true; - this.scrollLeft = this.element.scrollLeft = scrollLeft; - } - }; - -}).call(ScrollBarV.prototype); -ScrollBarH.prototype = ScrollBarV.prototype; - - - -exports.ScrollBar = ScrollBarV; // backward compatibility -exports.ScrollBarV = ScrollBarV; -exports.ScrollBarH = ScrollBarH; -}); - -define('ace/renderloop', ['require', 'exports', 'module' , 'ace/lib/event'], function(require, exports, module) { - - -var event = require("./lib/event"); - - -var RenderLoop = function(onRender, win) { - this.onRender = onRender; - this.pending = false; - this.changes = 0; - this.window = win || window; -}; - -(function() { - - - this.schedule = function(change) { - this.changes = this.changes | change; - if (!this.pending) { - this.pending = true; - var _self = this; - event.nextFrame(function() { - _self.pending = false; - var changes; - while (changes = _self.changes) { - _self.changes = 0; - _self.onRender(changes); - } - }, this.window); - } - }; - -}).call(RenderLoop.prototype); - -exports.RenderLoop = RenderLoop; -}); - -define('ace/multi_select', ['require', 'exports', 'module' , 'ace/range_list', 'ace/range', 'ace/selection', 'ace/mouse/multi_select_handler', 'ace/lib/event', 'ace/lib/lang', 'ace/commands/multi_select_commands', 'ace/search', 'ace/edit_session', 'ace/editor', 'ace/config'], function(require, exports, module) { - -var RangeList = require("./range_list").RangeList; -var Range = require("./range").Range; -var Selection = require("./selection").Selection; -var onMouseDown = require("./mouse/multi_select_handler").onMouseDown; -var event = require("./lib/event"); -var lang = require("./lib/lang"); -var commands = require("./commands/multi_select_commands"); -exports.commands = commands.defaultCommands.concat(commands.multiSelectCommands); -var Search = require("./search").Search; -var search = new Search(); - -function find(session, needle, dir) { - search.$options.wrap = true; - search.$options.needle = needle; - search.$options.backwards = dir == -1; - return search.find(session); -} -var EditSession = require("./edit_session").EditSession; -(function() { - this.getSelectionMarkers = function() { - return this.$selectionMarkers; - }; -}).call(EditSession.prototype); -(function() { - this.ranges = null; - this.rangeList = null; - this.addRange = function(range, $blockChangeEvents) { - if (!range) - return; - - if (!this.inMultiSelectMode && this.rangeCount == 0) { - var oldRange = this.toOrientedRange(); - this.rangeList.add(oldRange); - this.rangeList.add(range); - if (this.rangeList.ranges.length != 2) { - this.rangeList.removeAll(); - return $blockChangeEvents || this.fromOrientedRange(range); - } - this.rangeList.removeAll(); - this.rangeList.add(oldRange); - this.$onAddRange(oldRange); - } - - if (!range.cursor) - range.cursor = range.end; - - var removed = this.rangeList.add(range); - - this.$onAddRange(range); - - if (removed.length) - this.$onRemoveRange(removed); - - if (this.rangeCount > 1 && !this.inMultiSelectMode) { - this._emit("multiSelect"); - this.inMultiSelectMode = true; - this.session.$undoSelect = false; - this.rangeList.attach(this.session); - } - - return $blockChangeEvents || this.fromOrientedRange(range); - }; - - this.toSingleRange = function(range) { - range = range || this.ranges[0]; - var removed = this.rangeList.removeAll(); - if (removed.length) - this.$onRemoveRange(removed); - - range && this.fromOrientedRange(range); - }; - this.substractPoint = function(pos) { - var removed = this.rangeList.substractPoint(pos); - if (removed) { - this.$onRemoveRange(removed); - return removed[0]; - } - }; - this.mergeOverlappingRanges = function() { - var removed = this.rangeList.merge(); - if (removed.length) - this.$onRemoveRange(removed); - else if(this.ranges[0]) - this.fromOrientedRange(this.ranges[0]); - }; - - this.$onAddRange = function(range) { - this.rangeCount = this.rangeList.ranges.length; - this.ranges.unshift(range); - this._emit("addRange", {range: range}); - }; - - this.$onRemoveRange = function(removed) { - this.rangeCount = this.rangeList.ranges.length; - if (this.rangeCount == 1 && this.inMultiSelectMode) { - var lastRange = this.rangeList.ranges.pop(); - removed.push(lastRange); - this.rangeCount = 0; - } - - for (var i = removed.length; i--; ) { - var index = this.ranges.indexOf(removed[i]); - this.ranges.splice(index, 1); - } - - this._emit("removeRange", {ranges: removed}); - - if (this.rangeCount == 0 && this.inMultiSelectMode) { - this.inMultiSelectMode = false; - this._emit("singleSelect"); - this.session.$undoSelect = true; - this.rangeList.detach(this.session); - } - - lastRange = lastRange || this.ranges[0]; - if (lastRange && !lastRange.isEqual(this.getRange())) - this.fromOrientedRange(lastRange); - }; - this.$initRangeList = function() { - if (this.rangeList) - return; - - this.rangeList = new RangeList(); - this.ranges = []; - this.rangeCount = 0; - }; - this.getAllRanges = function() { - return this.rangeCount ? this.rangeList.ranges.concat() : [this.getRange()]; - }; - - this.splitIntoLines = function () { - if (this.rangeCount > 1) { - var ranges = this.rangeList.ranges; - var lastRange = ranges[ranges.length - 1]; - var range = Range.fromPoints(ranges[0].start, lastRange.end); - - this.toSingleRange(); - this.setSelectionRange(range, lastRange.cursor == lastRange.start); - } else { - var range = this.getRange(); - var isBackwards = this.isBackwards(); - var startRow = range.start.row; - var endRow = range.end.row; - if (startRow == endRow) { - if (isBackwards) - var start = range.end, end = range.start; - else - var start = range.start, end = range.end; - - this.addRange(Range.fromPoints(end, end)); - this.addRange(Range.fromPoints(start, start)); - return; - } - - var rectSel = []; - var r = this.getLineRange(startRow, true); - r.start.column = range.start.column; - rectSel.push(r); - - for (var i = startRow + 1; i < endRow; i++) - rectSel.push(this.getLineRange(i, true)); - - r = this.getLineRange(endRow, true); - r.end.column = range.end.column; - rectSel.push(r); - - rectSel.forEach(this.addRange, this); - } - }; - this.toggleBlockSelection = function () { - if (this.rangeCount > 1) { - var ranges = this.rangeList.ranges; - var lastRange = ranges[ranges.length - 1]; - var range = Range.fromPoints(ranges[0].start, lastRange.end); - - this.toSingleRange(); - this.setSelectionRange(range, lastRange.cursor == lastRange.start); - } else { - var cursor = this.session.documentToScreenPosition(this.selectionLead); - var anchor = this.session.documentToScreenPosition(this.selectionAnchor); - - var rectSel = this.rectangularRangeBlock(cursor, anchor); - rectSel.forEach(this.addRange, this); - } - }; - this.rectangularRangeBlock = function(screenCursor, screenAnchor, includeEmptyLines) { - var rectSel = []; - - var xBackwards = screenCursor.column < screenAnchor.column; - if (xBackwards) { - var startColumn = screenCursor.column; - var endColumn = screenAnchor.column; - } else { - var startColumn = screenAnchor.column; - var endColumn = screenCursor.column; - } - - var yBackwards = screenCursor.row < screenAnchor.row; - if (yBackwards) { - var startRow = screenCursor.row; - var endRow = screenAnchor.row; - } else { - var startRow = screenAnchor.row; - var endRow = screenCursor.row; - } - - if (startColumn < 0) - startColumn = 0; - if (startRow < 0) - startRow = 0; - - if (startRow == endRow) - includeEmptyLines = true; - - for (var row = startRow; row <= endRow; row++) { - var range = Range.fromPoints( - this.session.screenToDocumentPosition(row, startColumn), - this.session.screenToDocumentPosition(row, endColumn) - ); - if (range.isEmpty()) { - if (docEnd && isSamePoint(range.end, docEnd)) - break; - var docEnd = range.end; - } - range.cursor = xBackwards ? range.start : range.end; - rectSel.push(range); - } - - if (yBackwards) - rectSel.reverse(); - - if (!includeEmptyLines) { - var end = rectSel.length - 1; - while (rectSel[end].isEmpty() && end > 0) - end--; - if (end > 0) { - var start = 0; - while (rectSel[start].isEmpty()) - start++; - } - for (var i = end; i >= start; i--) { - if (rectSel[i].isEmpty()) - rectSel.splice(i, 1); - } - } - - return rectSel; - }; -}).call(Selection.prototype); -var Editor = require("./editor").Editor; -(function() { - this.updateSelectionMarkers = function() { - this.renderer.updateCursor(); - this.renderer.updateBackMarkers(); - }; - this.addSelectionMarker = function(orientedRange) { - if (!orientedRange.cursor) - orientedRange.cursor = orientedRange.end; - - var style = this.getSelectionStyle(); - orientedRange.marker = this.session.addMarker(orientedRange, "ace_selection", style); - - this.session.$selectionMarkers.push(orientedRange); - this.session.selectionMarkerCount = this.session.$selectionMarkers.length; - return orientedRange; - }; - this.removeSelectionMarker = function(range) { - if (!range.marker) - return; - this.session.removeMarker(range.marker); - var index = this.session.$selectionMarkers.indexOf(range); - if (index != -1) - this.session.$selectionMarkers.splice(index, 1); - this.session.selectionMarkerCount = this.session.$selectionMarkers.length; - }; - - this.removeSelectionMarkers = function(ranges) { - var markerList = this.session.$selectionMarkers; - for (var i = ranges.length; i--; ) { - var range = ranges[i]; - if (!range.marker) - continue; - this.session.removeMarker(range.marker); - var index = markerList.indexOf(range); - if (index != -1) - markerList.splice(index, 1); - } - this.session.selectionMarkerCount = markerList.length; - }; - - this.$onAddRange = function(e) { - this.addSelectionMarker(e.range); - this.renderer.updateCursor(); - this.renderer.updateBackMarkers(); - }; - - this.$onRemoveRange = function(e) { - this.removeSelectionMarkers(e.ranges); - this.renderer.updateCursor(); - this.renderer.updateBackMarkers(); - }; - - this.$onMultiSelect = function(e) { - if (this.inMultiSelectMode) - return; - this.inMultiSelectMode = true; - - this.setStyle("ace_multiselect"); - this.keyBinding.addKeyboardHandler(commands.keyboardHandler); - this.commands.setDefaultHandler("exec", this.$onMultiSelectExec); - - this.renderer.updateCursor(); - this.renderer.updateBackMarkers(); - }; - - this.$onSingleSelect = function(e) { - if (this.session.multiSelect.inVirtualMode) - return; - this.inMultiSelectMode = false; - - this.unsetStyle("ace_multiselect"); - this.keyBinding.removeKeyboardHandler(commands.keyboardHandler); - - this.commands.removeDefaultHandler("exec", this.$onMultiSelectExec); - this.renderer.updateCursor(); - this.renderer.updateBackMarkers(); - }; - - this.$onMultiSelectExec = function(e) { - var command = e.command; - var editor = e.editor; - if (!editor.multiSelect) - return; - if (!command.multiSelectAction) { - var result = command.exec(editor, e.args || {}); - editor.multiSelect.addRange(editor.multiSelect.toOrientedRange()); - editor.multiSelect.mergeOverlappingRanges(); - } else if (command.multiSelectAction == "forEach") { - result = editor.forEachSelection(command, e.args); - } else if (command.multiSelectAction == "forEachLine") { - result = editor.forEachSelection(command, e.args, true); - } else if (command.multiSelectAction == "single") { - editor.exitMultiSelectMode(); - result = command.exec(editor, e.args || {}); - } else { - result = command.multiSelectAction(editor, e.args || {}); - } - return result; - }; - this.forEachSelection = function(cmd, args, $byLines) { - if (this.inVirtualSelectionMode) - return; - - var session = this.session; - var selection = this.selection; - var rangeList = selection.rangeList; - var result; - - var reg = selection._eventRegistry; - selection._eventRegistry = {}; - - var tmpSel = new Selection(session); - this.inVirtualSelectionMode = true; - for (var i = rangeList.ranges.length; i--;) { - if ($byLines) { - while (i > 0 && rangeList.ranges[i].start.row == rangeList.ranges[i - 1].end.row) - i--; - } - tmpSel.fromOrientedRange(rangeList.ranges[i]); - this.selection = session.selection = tmpSel; - var cmdResult = cmd.exec(this, args || {}); - if (!result == undefined) - result = cmdResult; - tmpSel.toOrientedRange(rangeList.ranges[i]); - } - tmpSel.detach(); - - this.selection = session.selection = selection; - this.inVirtualSelectionMode = false; - selection._eventRegistry = reg; - selection.mergeOverlappingRanges(); - - var anim = this.renderer.$scrollAnimation; - this.onCursorChange(); - this.onSelectionChange(); - if (anim && anim.from == anim.to) - this.renderer.animateScrolling(anim.from); - - return result; - }; - this.exitMultiSelectMode = function() { - if (!this.inMultiSelectMode || this.inVirtualSelectionMode) - return; - this.multiSelect.toSingleRange(); - }; - - this.getSelectedText = function() { - var text = ""; - if (this.inMultiSelectMode && !this.inVirtualSelectionMode) { - var ranges = this.multiSelect.rangeList.ranges; - var buf = []; - for (var i = 0; i < ranges.length; i++) { - buf.push(this.session.getTextRange(ranges[i])); - } - var nl = this.session.getDocument().getNewLineCharacter(); - text = buf.join(nl); - if (text.length == (buf.length - 1) * nl.length) - text = ""; - } else if (!this.selection.isEmpty()) { - text = this.session.getTextRange(this.getSelectionRange()); - } - return text; - }; - this.onPaste = function(text) { - if (this.$readOnly) - return; - - this._signal("paste", text); - if (!this.inMultiSelectMode || this.inVirtualSelectionMode) - return this.insert(text); - - var lines = text.split(/\r\n|\r|\n/); - var ranges = this.selection.rangeList.ranges; - - if (lines.length > ranges.length || lines.length < 2 || !lines[1]) - return this.commands.exec("insertstring", this, text); - - for (var i = ranges.length; i--;) { - var range = ranges[i]; - if (!range.isEmpty()) - this.session.remove(range); - - this.session.insert(range.start, lines[i]); - } - }; - this.findAll = function(needle, options, additive) { - options = options || {}; - options.needle = needle || options.needle; - this.$search.set(options); - - var ranges = this.$search.findAll(this.session); - if (!ranges.length) - return 0; - - this.$blockScrolling += 1; - var selection = this.multiSelect; - - if (!additive) - selection.toSingleRange(ranges[0]); - - for (var i = ranges.length; i--; ) - selection.addRange(ranges[i], true); - - this.$blockScrolling -= 1; - - return ranges.length; - }; - this.selectMoreLines = function(dir, skip) { - var range = this.selection.toOrientedRange(); - var isBackwards = range.cursor == range.end; - - var screenLead = this.session.documentToScreenPosition(range.cursor); - if (this.selection.$desiredColumn) - screenLead.column = this.selection.$desiredColumn; - - var lead = this.session.screenToDocumentPosition(screenLead.row + dir, screenLead.column); - - if (!range.isEmpty()) { - var screenAnchor = this.session.documentToScreenPosition(isBackwards ? range.end : range.start); - var anchor = this.session.screenToDocumentPosition(screenAnchor.row + dir, screenAnchor.column); - } else { - var anchor = lead; - } - - if (isBackwards) { - var newRange = Range.fromPoints(lead, anchor); - newRange.cursor = newRange.start; - } else { - var newRange = Range.fromPoints(anchor, lead); - newRange.cursor = newRange.end; - } - - newRange.desiredColumn = screenLead.column; - if (!this.selection.inMultiSelectMode) { - this.selection.addRange(range); - } else { - if (skip) - var toRemove = range.cursor; - } - - this.selection.addRange(newRange); - if (toRemove) - this.selection.substractPoint(toRemove); - }; - this.transposeSelections = function(dir) { - var session = this.session; - var sel = session.multiSelect; - var all = sel.ranges; - - for (var i = all.length; i--; ) { - var range = all[i]; - if (range.isEmpty()) { - var tmp = session.getWordRange(range.start.row, range.start.column); - range.start.row = tmp.start.row; - range.start.column = tmp.start.column; - range.end.row = tmp.end.row; - range.end.column = tmp.end.column; - } - } - sel.mergeOverlappingRanges(); - - var words = []; - for (var i = all.length; i--; ) { - var range = all[i]; - words.unshift(session.getTextRange(range)); - } - - if (dir < 0) - words.unshift(words.pop()); - else - words.push(words.shift()); - - for (var i = all.length; i--; ) { - var range = all[i]; - var tmp = range.clone(); - session.replace(range, words[i]); - range.start.row = tmp.start.row; - range.start.column = tmp.start.column; - } - }; - this.selectMore = function(dir, skip) { - var session = this.session; - var sel = session.multiSelect; - - var range = sel.toOrientedRange(); - if (range.isEmpty()) { - var range = session.getWordRange(range.start.row, range.start.column); - range.cursor = dir == -1 ? range.start : range.end; - this.multiSelect.addRange(range); - return; - } - var needle = session.getTextRange(range); - - var newRange = find(session, needle, dir); - if (newRange) { - newRange.cursor = dir == -1 ? newRange.start : newRange.end; - this.multiSelect.addRange(newRange); - } - if (skip) - this.multiSelect.substractPoint(range.cursor); - }; - this.alignCursors = function() { - var session = this.session; - var sel = session.multiSelect; - var ranges = sel.ranges; - - if (!ranges.length) { - var range = this.selection.getRange(); - var fr = range.start.row, lr = range.end.row; - var lines = this.session.doc.removeLines(fr, lr); - lines = this.$reAlignText(lines); - this.session.doc.insertLines(fr, lines); - range.start.column = 0; - range.end.column = lines[lines.length - 1].length; - this.selection.setRange(range); - } else { - var row = -1; - var sameRowRanges = ranges.filter(function(r) { - if (r.cursor.row == row) - return true; - row = r.cursor.row; - }); - sel.$onRemoveRange(sameRowRanges); - - var maxCol = 0; - var minSpace = Infinity; - var spaceOffsets = ranges.map(function(r) { - var p = r.cursor; - var line = session.getLine(p.row); - var spaceOffset = line.substr(p.column).search(/\S/g); - if (spaceOffset == -1) - spaceOffset = 0; - - if (p.column > maxCol) - maxCol = p.column; - if (spaceOffset < minSpace) - minSpace = spaceOffset; - return spaceOffset; - }); - ranges.forEach(function(r, i) { - var p = r.cursor; - var l = maxCol - p.column; - var d = spaceOffsets[i] - minSpace; - if (l > d) - session.insert(p, lang.stringRepeat(" ", l - d)); - else - session.remove(new Range(p.row, p.column, p.row, p.column - l + d)); - - r.start.column = r.end.column = maxCol; - r.start.row = r.end.row = p.row; - r.cursor = r.end; - }); - sel.fromOrientedRange(ranges[0]); - this.renderer.updateCursor(); - this.renderer.updateBackMarkers(); - } - }; - - this.$reAlignText = function(lines) { - var isLeftAligned = true, isRightAligned = true; - var startW, textW, endW; - - return lines.map(function(line) { - var m = line.match(/(\s*)(.*?)(\s*)([=:].*)/); - if (!m) - return [line]; - - if (startW == null) { - startW = m[1].length; - textW = m[2].length; - endW = m[3].length; - return m; - } - - if (startW + textW + endW != m[1].length + m[2].length + m[3].length) - isRightAligned = false; - if (startW != m[1].length) - isLeftAligned = false; - - if (startW > m[1].length) - startW = m[1].length; - if (textW < m[2].length) - textW = m[2].length; - if (endW > m[3].length) - endW = m[3].length; - - return m; - }).map(isLeftAligned ? isRightAligned ? alignRight : alignLeft : unAlign); - - function spaces(n) { - return lang.stringRepeat(" ", n); - } - - function alignLeft(m) { - return !m[2] ? m[0] : spaces(startW) + m[2] - + spaces(textW - m[2].length + endW) - + m[4].replace(/^([=:])\s+/, "$1 ") - } - function alignRight(m) { - return !m[2] ? m[0] : spaces(startW + textW - m[2].length) + m[2] - + spaces(endW, " ") - + m[4].replace(/^([=:])\s+/, "$1 ") - } - function unAlign(m) { - return !m[2] ? m[0] : spaces(startW) + m[2] - + spaces(endW) - + m[4].replace(/^([=:])\s+/, "$1 ") - } - } -}).call(Editor.prototype); - - -function isSamePoint(p1, p2) { - return p1.row == p2.row && p1.column == p2.column; -} -exports.onSessionChange = function(e) { - var session = e.session; - if (!session.multiSelect) { - session.$selectionMarkers = []; - session.selection.$initRangeList(); - session.multiSelect = session.selection; - } - this.multiSelect = session.multiSelect; - - var oldSession = e.oldSession; - if (oldSession) { - oldSession.multiSelect.removeEventListener("addRange", this.$onAddRange); - oldSession.multiSelect.removeEventListener("removeRange", this.$onRemoveRange); - oldSession.multiSelect.removeEventListener("multiSelect", this.$onMultiSelect); - oldSession.multiSelect.removeEventListener("singleSelect", this.$onSingleSelect); - } - - session.multiSelect.on("addRange", this.$onAddRange); - session.multiSelect.on("removeRange", this.$onRemoveRange); - session.multiSelect.on("multiSelect", this.$onMultiSelect); - session.multiSelect.on("singleSelect", this.$onSingleSelect); - - if (this.inMultiSelectMode != session.selection.inMultiSelectMode) { - if (session.selection.inMultiSelectMode) - this.$onMultiSelect(); - else - this.$onSingleSelect(); - } -}; -function MultiSelect(editor) { - if (editor.$multiselectOnSessionChange) - return; - editor.$onAddRange = editor.$onAddRange.bind(editor); - editor.$onRemoveRange = editor.$onRemoveRange.bind(editor); - editor.$onMultiSelect = editor.$onMultiSelect.bind(editor); - editor.$onSingleSelect = editor.$onSingleSelect.bind(editor); - editor.$multiselectOnSessionChange = exports.onSessionChange.bind(editor); - - editor.$multiselectOnSessionChange(editor); - editor.on("changeSession", editor.$multiselectOnSessionChange); - - editor.on("mousedown", onMouseDown); - editor.commands.addCommands(commands.defaultCommands); - - addAltCursorListeners(editor); -} - -function addAltCursorListeners(editor){ - var el = editor.textInput.getElement(); - var altCursor = false; - event.addListener(el, "keydown", function(e) { - if (e.keyCode == 18 && !(e.ctrlKey || e.shiftKey || e.metaKey)) { - if (!altCursor) { - editor.renderer.setMouseCursor("crosshair"); - altCursor = true; - } - } else if (altCursor) { - reset(); - } - }); - - event.addListener(el, "keyup", reset); - event.addListener(el, "blur", reset); - function reset(e) { - if (altCursor) { - editor.renderer.setMouseCursor(""); - altCursor = false; - } - } -} - -exports.MultiSelect = MultiSelect; - - -require("./config").defineOptions(Editor.prototype, "editor", { - enableMultiselect: { - set: function(val) { - MultiSelect(this); - if (val) { - this.on("changeSession", this.$multiselectOnSessionChange); - this.on("mousedown", onMouseDown); - } else { - this.off("changeSession", this.$multiselectOnSessionChange); - this.off("mousedown", onMouseDown); - } - }, - value: true - } -}) - - - -}); - -define('ace/mouse/multi_select_handler', ['require', 'exports', 'module' , 'ace/lib/event'], function(require, exports, module) { - -var event = require("../lib/event"); -function isSamePoint(p1, p2) { - return p1.row == p2.row && p1.column == p2.column; -} - -function onMouseDown(e) { - var ev = e.domEvent; - var alt = ev.altKey; - var shift = ev.shiftKey; - var ctrl = e.getAccelKey(); - var button = e.getButton(); - - if (e.editor.inMultiSelectMode && button == 2) { - e.editor.textInput.onContextMenu(e.domEvent); - return; - } - - if (!ctrl && !alt) { - if (button == 0 && e.editor.inMultiSelectMode) - e.editor.exitMultiSelectMode(); - return; - } - - var editor = e.editor; - var selection = editor.selection; - var isMultiSelect = editor.inMultiSelectMode; - var pos = e.getDocumentPosition(); - var cursor = selection.getCursor(); - var inSelection = e.inSelection() || (selection.isEmpty() && isSamePoint(pos, cursor)); - - - var mouseX = e.x, mouseY = e.y; - var onMouseSelection = function(e) { - mouseX = e.clientX; - mouseY = e.clientY; - }; - - var blockSelect = function() { - var newCursor = editor.renderer.pixelToScreenCoordinates(mouseX, mouseY); - var cursor = session.screenToDocumentPosition(newCursor.row, newCursor.column); - - if (isSamePoint(screenCursor, newCursor) - && isSamePoint(cursor, selection.selectionLead)) - return; - screenCursor = newCursor; - - editor.selection.moveCursorToPosition(cursor); - editor.selection.clearSelection(); - editor.renderer.scrollCursorIntoView(); - - editor.removeSelectionMarkers(rectSel); - rectSel = selection.rectangularRangeBlock(screenCursor, screenAnchor); - rectSel.forEach(editor.addSelectionMarker, editor); - editor.updateSelectionMarkers(); - }; - - var session = editor.session; - var screenAnchor = editor.renderer.pixelToScreenCoordinates(mouseX, mouseY); - var screenCursor = screenAnchor; - - - - if (ctrl && !shift && !alt && button == 0) { - if (!isMultiSelect && inSelection) - return; // dragging - - if (!isMultiSelect) { - var range = selection.toOrientedRange(); - editor.addSelectionMarker(range); - } - - var oldRange = selection.rangeList.rangeAtPoint(pos); - - editor.once("mouseup", function() { - var tmpSel = selection.toOrientedRange(); - - if (oldRange && tmpSel.isEmpty() && isSamePoint(oldRange.cursor, tmpSel.cursor)) - selection.substractPoint(tmpSel.cursor); - else { - if (range) { - editor.removeSelectionMarker(range); - selection.addRange(range); - } - selection.addRange(tmpSel); - } - }); - - } else if (alt && button == 0) { - e.stop(); - - if (isMultiSelect && !ctrl) - selection.toSingleRange(); - else if (!isMultiSelect && ctrl) - selection.addRange(); - - var rectSel = []; - if (shift) { - screenAnchor = session.documentToScreenPosition(selection.lead); - blockSelect(); - } else { - selection.moveCursorToPosition(pos); - selection.clearSelection(); - } - - - var onMouseSelectionEnd = function(e) { - clearInterval(timerId); - editor.removeSelectionMarkers(rectSel); - for (var i = 0; i < rectSel.length; i++) - selection.addRange(rectSel[i]); - }; - - var onSelectionInterval = blockSelect; - - event.capture(editor.container, onMouseSelection, onMouseSelectionEnd); - var timerId = setInterval(function() {onSelectionInterval();}, 20); - - return e.preventDefault(); - } -} - - -exports.onMouseDown = onMouseDown; - -}); - -define('ace/commands/multi_select_commands', ['require', 'exports', 'module' , 'ace/keyboard/hash_handler'], function(require, exports, module) { -exports.defaultCommands = [{ - name: "addCursorAbove", - exec: function(editor) { editor.selectMoreLines(-1); }, - bindKey: {win: "Ctrl-Alt-Up", mac: "Ctrl-Alt-Up"}, - readonly: true -}, { - name: "addCursorBelow", - exec: function(editor) { editor.selectMoreLines(1); }, - bindKey: {win: "Ctrl-Alt-Down", mac: "Ctrl-Alt-Down"}, - readonly: true -}, { - name: "addCursorAboveSkipCurrent", - exec: function(editor) { editor.selectMoreLines(-1, true); }, - bindKey: {win: "Ctrl-Alt-Shift-Up", mac: "Ctrl-Alt-Shift-Up"}, - readonly: true -}, { - name: "addCursorBelowSkipCurrent", - exec: function(editor) { editor.selectMoreLines(1, true); }, - bindKey: {win: "Ctrl-Alt-Shift-Down", mac: "Ctrl-Alt-Shift-Down"}, - readonly: true -}, { - name: "selectMoreBefore", - exec: function(editor) { editor.selectMore(-1); }, - bindKey: {win: "Ctrl-Alt-Left", mac: "Ctrl-Alt-Left"}, - readonly: true -}, { - name: "selectMoreAfter", - exec: function(editor) { editor.selectMore(1); }, - bindKey: {win: "Ctrl-Alt-Right", mac: "Ctrl-Alt-Right"}, - readonly: true -}, { - name: "selectNextBefore", - exec: function(editor) { editor.selectMore(-1, true); }, - bindKey: {win: "Ctrl-Alt-Shift-Left", mac: "Ctrl-Alt-Shift-Left"}, - readonly: true -}, { - name: "selectNextAfter", - exec: function(editor) { editor.selectMore(1, true); }, - bindKey: {win: "Ctrl-Alt-Shift-Right", mac: "Ctrl-Alt-Shift-Right"}, - readonly: true -}, { - name: "splitIntoLines", - exec: function(editor) { editor.multiSelect.splitIntoLines(); }, - bindKey: {win: "Ctrl-Alt-L", mac: "Ctrl-Alt-L"}, - readonly: true -}, { - name: "alignCursors", - exec: function(editor) { editor.alignCursors(); }, - bindKey: {win: "Ctrl-Alt-A", mac: "Ctrl-Alt-A"} -}]; -exports.multiSelectCommands = [{ - name: "singleSelection", - bindKey: "esc", - exec: function(editor) { editor.exitMultiSelectMode(); }, - readonly: true, - isAvailable: function(editor) {return editor && editor.inMultiSelectMode} -}]; - -var HashHandler = require("../keyboard/hash_handler").HashHandler; -exports.keyboardHandler = new HashHandler(exports.multiSelectCommands); - -}); - -define('ace/worker/worker_client', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event_emitter', 'ace/config'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var EventEmitter = require("../lib/event_emitter").EventEmitter; -var config = require("../config"); - -var WorkerClient = function(topLevelNamespaces, mod, classname) { - this.$sendDeltaQueue = this.$sendDeltaQueue.bind(this); - this.changeListener = this.changeListener.bind(this); - this.onMessage = this.onMessage.bind(this); - this.onError = this.onError.bind(this); - if (require.nameToUrl && !require.toUrl) - require.toUrl = require.nameToUrl; - - var workerUrl; - if (config.get("packaged") || !require.toUrl) { - workerUrl = config.moduleUrl(mod, "worker"); - } else { - var normalizePath = this.$normalizePath; - workerUrl = normalizePath(require.toUrl("ace/worker/worker.js", null, "_")); - - var tlns = {}; - topLevelNamespaces.forEach(function(ns) { - tlns[ns] = normalizePath(require.toUrl(ns, null, "_").replace(/(\.js)?(\?.*)?$/, "")); - }); - } - - this.$worker = new Worker(workerUrl); - this.$worker.postMessage({ - init : true, - tlns: tlns, - module: mod, - classname: classname - }); - - this.callbackId = 1; - this.callbacks = {}; - - this.$worker.onerror = this.onError; - this.$worker.onmessage = this.onMessage; -}; - -(function(){ - - oop.implement(this, EventEmitter); - - this.onError = function(e) { - window.console && console.log && console.log(e); - throw e; - }; - - this.onMessage = function(e) { - var msg = e.data; - switch(msg.type) { - case "log": - window.console && console.log && console.log.apply(console, msg.data); - break; - - case "event": - this._emit(msg.name, {data: msg.data}); - break; - - case "call": - var callback = this.callbacks[msg.id]; - if (callback) { - callback(msg.data); - delete this.callbacks[msg.id]; - } - break; - } - }; - - this.$normalizePath = function(path) { - if (!location.host) // needed for file:// protocol - return path; - path = path.replace(/^[a-z]+:\/\/[^\/]+/, ""); // Remove domain name and rebuild it - path = location.protocol + "//" + location.host - + (path.charAt(0) == "/" ? "" : location.pathname.replace(/\/[^\/]*$/, "")) - + "/" + path.replace(/^[\/]+/, ""); - return path; - }; - - this.terminate = function() { - this._emit("terminate", {}); - this.deltaQueue = null; - 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 { - 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) { - if (!this.deltaQueue) { - this.deltaQueue = [e.data]; - setTimeout(this.$sendDeltaQueue, 1); - } else - this.deltaQueue.push(e.data); - }; - - this.$sendDeltaQueue = function() { - var q = this.deltaQueue; - if (!q) return; - this.deltaQueue = null; - if (q.length > 20 && q.length > this.$doc.getLength() >> 1) { - this.call("setValue", [this.$doc.getValue()]); - } else - this.emit("change", {data: q}); - } - -}).call(WorkerClient.prototype); - - -var UIWorkerClient = function(topLevelNamespaces, mod, classname) { - this.$sendDeltaQueue = this.$sendDeltaQueue.bind(this); - this.changeListener = this.changeListener.bind(this); - this.callbackId = 1; - this.callbacks = {}; - this.messageBuffer = []; - - var main = null; - var sender = Object.create(EventEmitter); - var _self = this; - - this.$worker = {}; - this.$worker.terminate = function() {}; - this.$worker.postMessage = function(e) { - _self.messageBuffer.push(e); - main && setTimeout(processNext); - }; - - var processNext = function() { - var msg = _self.messageBuffer.shift(); - if (msg.command) - main[msg.command].apply(main, msg.args); - else if (msg.event) - sender._emit(msg.event, msg.data); - }; - - sender.postMessage = function(msg) { - _self.onMessage({data: msg}); - }; - sender.callback = function(data, callbackId) { - this.postMessage({type: "call", id: callbackId, data: data}); - }; - sender.emit = function(name, data) { - this.postMessage({type: "event", name: name, data: data}); - }; - - config.loadModule(["worker", mod], function(Main) { - main = new Main[classname](sender); - while (_self.messageBuffer.length) - processNext(); - }); -}; - -UIWorkerClient.prototype = WorkerClient.prototype; - -exports.UIWorkerClient = UIWorkerClient; -exports.WorkerClient = WorkerClient; - -}); -define('ace/placeholder', ['require', 'exports', 'module' , 'ace/range', 'ace/lib/event_emitter', 'ace/lib/oop'], function(require, exports, module) { - - -var Range = require("./range").Range; -var EventEmitter = require("./lib/event_emitter").EventEmitter; -var oop = require("./lib/oop"); - -var PlaceHolder = function(session, length, pos, others, mainClass, othersClass) { - var _self = this; - this.length = length; - this.session = session; - this.doc = session.getDocument(); - this.mainClass = mainClass; - this.othersClass = othersClass; - this.$onUpdate = this.onUpdate.bind(this); - this.doc.on("change", this.$onUpdate); - this.$others = others; - - this.$onCursorChange = function() { - setTimeout(function() { - _self.onCursorChange(); - }); - }; - - this.$pos = pos; - var undoStack = session.getUndoManager().$undoStack || session.getUndoManager().$undostack || {length: -1}; - this.$undoStackDepth = undoStack.length; - this.setup(); - - session.selection.on("changeCursor", this.$onCursorChange); -}; - -(function() { - - oop.implement(this, EventEmitter); - this.setup = function() { - var _self = this; - var doc = this.doc; - var session = this.session; - var pos = this.$pos; - - this.pos = doc.createAnchor(pos.row, pos.column); - this.markerId = session.addMarker(new Range(pos.row, pos.column, pos.row, pos.column + this.length), this.mainClass, null, false); - this.pos.on("change", function(event) { - session.removeMarker(_self.markerId); - _self.markerId = session.addMarker(new Range(event.value.row, event.value.column, event.value.row, event.value.column+_self.length), _self.mainClass, null, false); - }); - this.others = []; - this.$others.forEach(function(other) { - var anchor = doc.createAnchor(other.row, other.column); - _self.others.push(anchor); - }); - session.setUndoSelect(false); - }; - this.showOtherMarkers = function() { - if(this.othersActive) return; - var session = this.session; - var _self = this; - this.othersActive = true; - this.others.forEach(function(anchor) { - anchor.markerId = session.addMarker(new Range(anchor.row, anchor.column, anchor.row, anchor.column+_self.length), _self.othersClass, null, false); - anchor.on("change", function(event) { - session.removeMarker(anchor.markerId); - anchor.markerId = session.addMarker(new Range(event.value.row, event.value.column, event.value.row, event.value.column+_self.length), _self.othersClass, null, false); - }); - }); - }; - this.hideOtherMarkers = function() { - if(!this.othersActive) return; - this.othersActive = false; - for (var i = 0; i < this.others.length; i++) { - this.session.removeMarker(this.others[i].markerId); - } - }; - this.onUpdate = function(event) { - var delta = event.data; - var range = delta.range; - if(range.start.row !== range.end.row) return; - if(range.start.row !== this.pos.row) return; - if (this.$updating) return; - this.$updating = true; - var lengthDiff = delta.action === "insertText" ? range.end.column - range.start.column : range.start.column - range.end.column; - - if(range.start.column >= this.pos.column && range.start.column <= this.pos.column + this.length + 1) { - var distanceFromStart = range.start.column - this.pos.column; - this.length += lengthDiff; - if(!this.session.$fromUndo) { - if(delta.action === "insertText") { - for (var i = this.others.length - 1; i >= 0; i--) { - var otherPos = this.others[i]; - var newPos = {row: otherPos.row, column: otherPos.column + distanceFromStart}; - if(otherPos.row === range.start.row && range.start.column < otherPos.column) - newPos.column += lengthDiff; - this.doc.insert(newPos, delta.text); - } - } else if(delta.action === "removeText") { - for (var i = this.others.length - 1; i >= 0; i--) { - var otherPos = this.others[i]; - var newPos = {row: otherPos.row, column: otherPos.column + distanceFromStart}; - if(otherPos.row === range.start.row && range.start.column < otherPos.column) - newPos.column += lengthDiff; - this.doc.remove(new Range(newPos.row, newPos.column, newPos.row, newPos.column - lengthDiff)); - } - } - if(range.start.column === this.pos.column && delta.action === "insertText") { - setTimeout(function() { - this.pos.setPosition(this.pos.row, this.pos.column - lengthDiff); - for (var i = 0; i < this.others.length; i++) { - var other = this.others[i]; - var newPos = {row: other.row, column: other.column - lengthDiff}; - if(other.row === range.start.row && range.start.column < other.column) - newPos.column += lengthDiff; - other.setPosition(newPos.row, newPos.column); - } - }.bind(this), 0); - } - else if(range.start.column === this.pos.column && delta.action === "removeText") { - setTimeout(function() { - for (var i = 0; i < this.others.length; i++) { - var other = this.others[i]; - if(other.row === range.start.row && range.start.column < other.column) { - other.setPosition(other.row, other.column - lengthDiff); - } - } - }.bind(this), 0); - } - } - this.pos._emit("change", {value: this.pos}); - for (var i = 0; i < this.others.length; i++) { - this.others[i]._emit("change", {value: this.others[i]}); - } - } - this.$updating = false; - }; - - this.onCursorChange = function(event) { - if (this.$updating) return; - var pos = this.session.selection.getCursor(); - if(pos.row === this.pos.row && pos.column >= this.pos.column && pos.column <= this.pos.column + this.length) { - this.showOtherMarkers(); - this._emit("cursorEnter", event); - } else { - this.hideOtherMarkers(); - this._emit("cursorLeave", event); - } - }; - this.detach = function() { - this.session.removeMarker(this.markerId); - this.hideOtherMarkers(); - this.doc.removeEventListener("change", this.$onUpdate); - this.session.selection.removeEventListener("changeCursor", this.$onCursorChange); - this.pos.detach(); - for (var i = 0; i < this.others.length; i++) { - this.others[i].detach(); - } - this.session.setUndoSelect(true); - }; - this.cancel = function() { - if(this.$undoStackDepth === -1) - throw Error("Canceling placeholders only supported with undo manager attached to session."); - var undoManager = this.session.getUndoManager(); - var undosRequired = (undoManager.$undoStack || undoManager.$undostack).length - this.$undoStackDepth; - for (var i = 0; i < undosRequired; i++) { - undoManager.undo(true); - } - }; -}).call(PlaceHolder.prototype); - - -exports.PlaceHolder = PlaceHolder; -}); - -define('ace/mode/folding/fold_mode', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -var Range = require("../../range").Range; - -var FoldMode = exports.FoldMode = function() {}; - -(function() { - - this.foldingStartMarker = null; - this.foldingStopMarker = null; - 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 line = session.getLine(row); - var startLevel = line.search(re); - if (startLevel == -1) - return; - - var startColumn = column || line.length; - var maxRow = session.getLength(); - var startRow = row; - var endRow = row; - - while (++row < maxRow) { - var level = session.getLine(row).search(re); - - if (level == -1) - 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, typeRe) { - var start = {row: row, column: column + 1}; - var end = session.$findClosingBracket(bracket, start, typeRe); - if (!end) - return; - - var fw = session.foldWidgets[end.row]; - if (fw == null) - fw = this.getFoldWidget(session, end.row); - - if (fw == "start" && end.row > start.row) { - end.row --; - end.column = session.getLine(end.row).length; - } - return Range.fromPoints(start, end); - }; - - this.closingBracketBlock = function(session, bracket, row, column, typeRe) { - var end = {row: row, column: column}; - var start = session.$findOpeningBracket(bracket, end); - - if (!start) - return; - - start.column++; - end.column--; - - return Range.fromPoints(start, end); - }; -}).call(FoldMode.prototype); - -}); - -define('ace/theme/textmate', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) { - - -exports.isDark = false; -exports.cssClass = "ace-tm"; -exports.cssText = ".ace-tm .ace_gutter {\ -background: #f0f0f0;\ -color: #333;\ -}\ -.ace-tm .ace_print-margin {\ -width: 1px;\ -background: #e8e8e8;\ -}\ -.ace-tm .ace_fold {\ -background-color: #6B72E6;\ -}\ -.ace-tm {\ -background-color: #FFFFFF;\ -}\ -.ace-tm .ace_cursor {\ -color: black;\ -}\ -.ace-tm .ace_invisible {\ -color: rgb(191, 191, 191);\ -}\ -.ace-tm .ace_storage,\ -.ace-tm .ace_keyword {\ -color: blue;\ -}\ -.ace-tm .ace_constant {\ -color: rgb(197, 6, 11);\ -}\ -.ace-tm .ace_constant.ace_buildin {\ -color: rgb(88, 72, 246);\ -}\ -.ace-tm .ace_constant.ace_language {\ -color: rgb(88, 92, 246);\ -}\ -.ace-tm .ace_constant.ace_library {\ -color: rgb(6, 150, 14);\ -}\ -.ace-tm .ace_invalid {\ -background-color: rgba(255, 0, 0, 0.1);\ -color: red;\ -}\ -.ace-tm .ace_support.ace_function {\ -color: rgb(60, 76, 114);\ -}\ -.ace-tm .ace_support.ace_constant {\ -color: rgb(6, 150, 14);\ -}\ -.ace-tm .ace_support.ace_type,\ -.ace-tm .ace_support.ace_class {\ -color: rgb(109, 121, 222);\ -}\ -.ace-tm .ace_keyword.ace_operator {\ -color: rgb(104, 118, 135);\ -}\ -.ace-tm .ace_string {\ -color: rgb(3, 106, 7);\ -}\ -.ace-tm .ace_comment {\ -color: rgb(76, 136, 107);\ -}\ -.ace-tm .ace_comment.ace_doc {\ -color: rgb(0, 102, 255);\ -}\ -.ace-tm .ace_comment.ace_doc.ace_tag {\ -color: rgb(128, 159, 191);\ -}\ -.ace-tm .ace_constant.ace_numeric {\ -color: rgb(0, 0, 205);\ -}\ -.ace-tm .ace_variable {\ -color: rgb(49, 132, 149);\ -}\ -.ace-tm .ace_xml-pe {\ -color: rgb(104, 104, 91);\ -}\ -.ace-tm .ace_entity.ace_name.ace_function {\ -color: #0000A2;\ -}\ -.ace-tm .ace_heading {\ -color: rgb(12, 7, 255);\ -}\ -.ace-tm .ace_list {\ -color:rgb(185, 6, 144);\ -}\ -.ace-tm .ace_meta.ace_tag {\ -color:rgb(0, 22, 142);\ -}\ -.ace-tm .ace_string.ace_regex {\ -color: rgb(255, 0, 0)\ -}\ -.ace-tm .ace_marker-layer .ace_selection {\ -background: rgb(181, 213, 255);\ -}\ -.ace-tm.ace_multiselect .ace_selection.ace_start {\ -box-shadow: 0 0 3px 0px white;\ -border-radius: 2px;\ -}\ -.ace-tm .ace_marker-layer .ace_step {\ -background: rgb(252, 255, 0);\ -}\ -.ace-tm .ace_marker-layer .ace_stack {\ -background: rgb(164, 229, 101);\ -}\ -.ace-tm .ace_marker-layer .ace_bracket {\ -margin: -1px 0 0 -1px;\ -border: 1px solid rgb(192, 192, 192);\ -}\ -.ace-tm .ace_marker-layer .ace_active-line {\ -background: rgba(0, 0, 0, 0.07);\ -}\ -.ace-tm .ace_gutter-active-line {\ -background-color : #dcdcdc;\ -}\ -.ace-tm .ace_marker-layer .ace_selected-word {\ -background: rgb(250, 250, 255);\ -border: 1px solid rgb(200, 200, 250);\ -}\ -.ace-tm .ace_indent-guide {\ -background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\") right repeat-y;\ -}\ -"; - -var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); -}); -; - (function() { - window.require(["ace/ace"], function(a) { - a && a.config.init(); - if (!window.ace) - window.ace = {}; - for (var key in a) if (a.hasOwnProperty(key)) - ace[key] = a[key]; - }); - })(); - \ No newline at end of file diff --git a/addons/editor/ace/anchor.js b/addons/editor/ace/anchor.js new file mode 100755 index 00000000..3a62e632 --- /dev/null +++ b/addons/editor/ace/anchor.js @@ -0,0 +1,242 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var oop = require("./lib/oop"); +var EventEmitter = require("./lib/event_emitter").EventEmitter; + +/** + * + * Defines the floating pointer in the document. Whenever text is inserted or deleted before the cursor, the position of the cursor is updated. + * + * @class Anchor + **/ + +/** + * Creates a new `Anchor` and associates it with a document. + * + * @param {Document} doc The document to associate with the anchor + * @param {Number} row The starting row position + * @param {Number} column The starting column position + * + * @constructor + **/ + +var Anchor = exports.Anchor = function(doc, row, column) { + this.$onChange = this.onChange.bind(this); + this.attach(doc); + + if (typeof column == "undefined") + this.setPosition(row.row, row.column); + else + this.setPosition(row, column); +}; + +(function() { + + oop.implement(this, EventEmitter); + + /** + * Returns an object identifying the `row` and `column` position of the current anchor. + * @returns {Object} + **/ + this.getPosition = function() { + return this.$clipPositionToDocument(this.row, this.column); + }; + + /** + * + * Returns the current document. + * @returns {Document} + **/ + this.getDocument = function() { + return this.document; + }; + + /** + * experimental: allows anchor to stick to the next on the left + */ + this.$insertRight = false; + /** + * Fires whenever the anchor position changes. + * + * Both of these objects have a `row` and `column` property corresponding to the position. + * + * Events that can trigger this function include [[Anchor.setPosition `setPosition()`]]. + * + * @event change + * @param {Object} e An object containing information about the anchor position. It has two properties: + * - `old`: An object describing the old Anchor position + * - `value`: An object describing the new Anchor position + * + **/ + this.onChange = function(e) { + var delta = e.data; + var range = delta.range; + + if (range.start.row == range.end.row && range.start.row != this.row) + return; + + if (range.start.row > this.row) + return; + + if (range.start.row == this.row && range.start.column > this.column) + return; + + var row = this.row; + var column = this.column; + var start = range.start; + var end = range.end; + + if (delta.action === "insertText") { + if (start.row === row && start.column <= column) { + if (start.column === column && this.$insertRight) { + // do nothing + } else if (start.row === end.row) { + column += end.column - start.column; + } else { + column -= start.column; + row += end.row - start.row; + } + } else if (start.row !== end.row && start.row < row) { + row += end.row - start.row; + } + } else if (delta.action === "insertLines") { + if (start.row <= row) { + row += end.row - start.row; + } + } else if (delta.action === "removeText") { + if (start.row === row && start.column < column) { + if (end.column >= column) + column = start.column; + else + column = Math.max(0, column - (end.column - start.column)); + + } else if (start.row !== end.row && start.row < row) { + if (end.row === row) + column = Math.max(0, column - end.column) + start.column; + row -= (end.row - start.row); + } else if (end.row === row) { + row -= end.row - start.row; + column = Math.max(0, column - end.column) + start.column; + } + } else if (delta.action == "removeLines") { + if (start.row <= row) { + if (end.row <= row) + row -= end.row - start.row; + else { + row = start.row; + column = 0; + } + } + } + + this.setPosition(row, column, true); + }; + + /** + * Sets the anchor position to the specified row and column. If `noClip` is `true`, the position is not clipped. + * @param {Number} row The row index to move the anchor to + * @param {Number} column The column index to move the anchor to + * @param {Boolean} noClip Identifies if you want the position to be clipped + * + **/ + this.setPosition = function(row, column, noClip) { + var pos; + if (noClip) { + pos = { + row: row, + column: column + }; + } else { + pos = this.$clipPositionToDocument(row, column); + } + + if (this.row == pos.row && this.column == pos.column) + return; + + var old = { + row: this.row, + column: this.column + }; + + this.row = pos.row; + this.column = pos.column; + this._emit("change", { + old: old, + value: pos + }); + }; + + /** + * When called, the `'change'` event listener is removed. + * + **/ + this.detach = function() { + this.document.removeEventListener("change", this.$onChange); + }; + this.attach = function(doc) { + this.document = doc || this.document; + this.document.on("change", this.$onChange); + }; + + /** + * Clips the anchor position to the specified row and column. + * @param {Number} row The row index to clip the anchor to + * @param {Number} column The column index to clip the anchor to + * + **/ + this.$clipPositionToDocument = function(row, column) { + var pos = {}; + + if (row >= this.document.getLength()) { + pos.row = Math.max(0, this.document.getLength() - 1); + pos.column = this.document.getLine(pos.row).length; + } + else if (row < 0) { + pos.row = 0; + pos.column = 0; + } + else { + pos.row = row; + pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column)); + } + + if (column < 0) + pos.column = 0; + + return pos; + }; + +}).call(Anchor.prototype); + +}); diff --git a/addons/editor/ace/anchor_test.js b/addons/editor/ace/anchor_test.js new file mode 100755 index 00000000..2d7fcb63 --- /dev/null +++ b/addons/editor/ace/anchor_test.js @@ -0,0 +1,188 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +if (typeof process !== "undefined") { + require("amd-loader"); +} + +define(function(require, exports, module) { +"use strict"; + +var Document = require("./document").Document; +var Anchor = require("./anchor").Anchor; +var Range = require("./range").Range; +var assert = require("./test/assertions"); + +module.exports = { + + "test create anchor" : function() { + var doc = new Document("juhu"); + var anchor = new Anchor(doc, 0, 0); + + assert.position(anchor.getPosition(), 0, 0); + assert.equal(anchor.getDocument(), doc); + }, + + "test insert text in same row before cursor should move anchor column": function() { + var doc = new Document("juhu\nkinners"); + var anchor = new Anchor(doc, 1, 4); + + doc.insert({row: 1, column: 1}, "123"); + assert.position(anchor.getPosition(), 1, 7); + }, + + "test insert lines before cursor should move anchor row": function() { + var doc = new Document("juhu\nkinners"); + var anchor = new Anchor(doc, 1, 4); + + doc.insertLines(1, ["123", "456"]); + assert.position(anchor.getPosition(), 3, 4); + }, + + "test insert new line before cursor should move anchor column": function() { + var doc = new Document("juhu\nkinners"); + var anchor = new Anchor(doc, 1, 4); + + doc.insertNewLine({row: 0, column: 0}); + assert.position(anchor.getPosition(), 2, 4); + }, + + "test insert new line in anchor line before anchor should move anchor column and row": function() { + var doc = new Document("juhu\nkinners"); + var anchor = new Anchor(doc, 1, 4); + + doc.insertNewLine({row: 1, column: 2}); + assert.position(anchor.getPosition(), 2, 2); + }, + + "test delete text in anchor line before anchor should move anchor column": function() { + var doc = new Document("juhu\nkinners"); + var anchor = new Anchor(doc, 1, 4); + + doc.remove(new Range(1, 1, 1, 3)); + assert.position(anchor.getPosition(), 1, 2); + }, + + "test remove range which contains the anchor should move the anchor to the start of the range": function() { + var doc = new Document("juhu\nkinners"); + var anchor = new Anchor(doc, 0, 3); + + doc.remove(new Range(0, 1, 1, 3)); + assert.position(anchor.getPosition(), 0, 1); + }, + + "test delete character before the anchor should have no effect": function() { + var doc = new Document("juhu\nkinners"); + var anchor = new Anchor(doc, 1, 4); + + doc.remove(new Range(1, 4, 1, 5)); + assert.position(anchor.getPosition(), 1, 4); + }, + + "test delete lines in anchor line before anchor should move anchor row": function() { + var doc = new Document("juhu\n1\n2\nkinners"); + var anchor = new Anchor(doc, 3, 4); + + doc.removeLines(1, 2); + assert.position(anchor.getPosition(), 1, 4); + }, + + "test remove new line before the cursor": function() { + var doc = new Document("juhu\nkinners"); + var anchor = new Anchor(doc, 1, 4); + + doc.removeNewLine(0); + assert.position(anchor.getPosition(), 0, 8); + }, + + "test delete range which contains the anchor should move anchor to the end of the range": function() { + var doc = new Document("juhu\nkinners"); + var anchor = new Anchor(doc, 1, 4); + + doc.remove(new Range(0, 2, 1, 2)); + assert.position(anchor.getPosition(), 0, 4); + }, + + "test delete line which contains the anchor should move anchor to the end of the range": function() { + var doc = new Document("juhu\nkinners\n123"); + var anchor = new Anchor(doc, 1, 5); + + doc.removeLines(1, 1); + assert.position(anchor.getPosition(), 1, 0); + }, + + "test remove after the anchor should have no effect": function() { + var doc = new Document("juhu\nkinners\n123"); + var anchor = new Anchor(doc, 1, 2); + + doc.remove(new Range(1, 4, 2, 2)); + assert.position(anchor.getPosition(), 1, 2); + }, + + "test anchor changes triggered by document changes should emit change event": function(next) { + var doc = new Document("juhu\nkinners\n123"); + var anchor = new Anchor(doc, 1, 5); + + anchor.on("change", function(e) { + assert.position(anchor.getPosition(), 0, 0); + next(); + }); + + doc.remove(new Range(0, 0, 2, 1)); + }, + + "test only fire change event if position changes": function() { + var doc = new Document("juhu\nkinners\n123"); + var anchor = new Anchor(doc, 1, 5); + + anchor.on("change", function(e) { + assert.fail(); + }); + + doc.remove(new Range(2, 0, 2, 1)); + }, + + "test insert/remove lines at the end of the document": function() { + var doc = new Document("juhu\nkinners\n123"); + var anchor = new Anchor(doc, 2, 4); + + doc.removeLines(0, 3); + assert.position(anchor.getPosition(), 0, 0); + doc.insertLines(0, ["a", "b", "c"]); + assert.position(anchor.getPosition(), 3, 0); + assert.equal(doc.getValue(), "a\nb\nc\n"); + } +}; + +}); + +if (typeof module !== "undefined" && module === require.main) { + require("asyncjs").test.testcase(module.exports).exec() +} diff --git a/addons/editor/ace/autocomplete.js b/addons/editor/ace/autocomplete.js new file mode 100755 index 00000000..5b9312f8 --- /dev/null +++ b/addons/editor/ace/autocomplete.js @@ -0,0 +1,350 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2012, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var HashHandler = require("./keyboard/hash_handler").HashHandler; +var AcePopup = require("./autocomplete/popup").AcePopup; +var util = require("./autocomplete/util"); +var event = require("./lib/event"); +var lang = require("./lib/lang"); +var snippetManager = require("./snippets").snippetManager; + +var Autocomplete = function() { + this.keyboardHandler = new HashHandler(); + this.keyboardHandler.bindKeys(this.commands); + + this.blurListener = this.blurListener.bind(this); + this.changeListener = this.changeListener.bind(this); + this.mousedownListener = this.mousedownListener.bind(this); + this.mousewheelListener = this.mousewheelListener.bind(this); + + this.changeTimer = lang.delayedCall(function() { + this.updateCompletions(true); + }.bind(this)) +}; + +(function() { + this.$init = function() { + this.popup = new AcePopup(document.body || document.documentElement); + this.popup.on("click", function(e) { + this.insertMatch(); + e.stop(); + }.bind(this)); + }; + + this.openPopup = function(editor, prefix, keepPopupPosition) { + if (!this.popup) + this.$init(); + + this.popup.setData(this.completions.filtered); + + var renderer = editor.renderer; + if (!keepPopupPosition) { + this.popup.setFontSize(editor.getFontSize()); + + var lineHeight = renderer.layerConfig.lineHeight; + + var pos = renderer.$cursorLayer.getPixelPosition(this.base, true); + pos.left -= this.popup.getTextLeftOffset(); + + var rect = editor.container.getBoundingClientRect(); + pos.top += rect.top - renderer.layerConfig.offset; + pos.left += rect.left; + pos.left += renderer.$gutterLayer.gutterWidth; + + this.popup.show(pos, lineHeight); + } + }; + + this.detach = function() { + this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler); + this.editor.off("changeSelection", this.changeListener); + this.editor.off("blur", this.changeListener); + this.editor.off("mousedown", this.mousedownListener); + this.editor.off("mousewheel", this.mousewheelListener); + this.changeTimer.cancel(); + + if (this.popup) + this.popup.hide(); + + this.activated = false; + this.completions = this.base = null; + }; + + this.changeListener = function(e) { + var cursor = this.editor.selection.lead; + if (cursor.row != this.base.row || cursor.column < this.base.column) { + this.detach(); + } + if (this.activated) + this.changeTimer.schedule(); + else + this.detach(); + }; + + this.blurListener = function() { + if (document.activeElement != this.editor.textInput.getElement()) + this.detach(); + }; + + this.mousedownListener = function(e) { + this.detach(); + }; + + this.mousewheelListener = function(e) { + this.detach(); + }; + + this.goTo = function(where) { + var row = this.popup.getRow(); + var max = this.popup.session.getLength() - 1; + + switch(where) { + case "up": row = row < 0 ? max : row - 1; break; + case "down": row = row >= max ? -1 : row + 1; break; + case "start": row = 0; break; + case "end": row = max; break; + } + + this.popup.setRow(row); + }; + + this.insertMatch = function(data) { + if (!data) + data = this.popup.getData(this.popup.getRow()); + if (!data) + return false; + if (data.completer && data.completer.insertMatch) { + data.completer.insertMatch(this.editor); + } else { + if (this.completions.filterText) { + var ranges = this.editor.selection.getAllRanges(); + for (var i = 0, range; range = ranges[i]; i++) { + range.start.column -= this.completions.filterText.length; + this.editor.session.remove(range); + } + } + if (data.snippet) + snippetManager.insertSnippet(this.editor, data.snippet); + else + this.editor.execCommand("insertstring", data.value || data); + } + this.detach(); + }; + + this.commands = { + "Up": function(editor) { editor.completer.goTo("up"); }, + "Down": function(editor) { editor.completer.goTo("down"); }, + "Ctrl-Up|Ctrl-Home": function(editor) { editor.completer.goTo("start"); }, + "Ctrl-Down|Ctrl-End": function(editor) { editor.completer.goTo("end"); }, + + "Esc": function(editor) { editor.completer.detach(); }, + "Space": function(editor) { editor.completer.detach(); editor.insert(" ");}, + "Return": function(editor) { editor.completer.insertMatch(); }, + "Shift-Return": function(editor) { editor.completer.insertMatch(true); }, + "Tab": function(editor) { editor.completer.insertMatch(); }, + + "PageUp": function(editor) { editor.completer.popup.gotoPageUp(); }, + "PageDown": function(editor) { editor.completer.popup.gotoPageDown(); } + }; + + this.gatherCompletions = function(editor, callback) { + var session = editor.getSession(); + var pos = editor.getCursorPosition(); + + var line = session.getLine(pos.row); + var prefix = util.retrievePrecedingIdentifier(line, pos.column); + + this.base = editor.getCursorPosition(); + this.base.column -= prefix.length; + + var matches = []; + util.parForEach(editor.completers, function(completer, next) { + completer.getCompletions(editor, session, pos, prefix, function(err, results) { + if (!err) + matches = matches.concat(results); + next(); + }); + }, function() { + callback(null, { + prefix: prefix, + matches: matches + }); + }); + return true; + }; + + this.showPopup = function(editor) { + if (this.editor) + this.detach(); + + this.activated = true; + + this.editor = editor; + if (editor.completer != this) { + if (editor.completer) + editor.completer.detach(); + editor.completer = this; + } + + editor.keyBinding.addKeyboardHandler(this.keyboardHandler); + editor.on("changeSelection", this.changeListener); + editor.on("blur", this.blurListener); + editor.on("mousedown", this.mousedownListener); + editor.on("mousewheel", this.mousewheelListener); + + this.updateCompletions(); + }; + + this.updateCompletions = function(keepPopupPosition) { + if (keepPopupPosition && this.base && this.completions) { + var pos = this.editor.getCursorPosition(); + var prefix = this.editor.session.getTextRange({start: this.base, end: pos}); + if (prefix == this.completions.filterText) + return; + this.completions.setFilter(prefix); + if (!this.completions.filtered.length) + return this.detach(); + this.openPopup(this.editor, prefix, keepPopupPosition); + return; + } + this.gatherCompletions(this.editor, function(err, results) { + var matches = results && results.matches; + if (!matches || !matches.length) + return this.detach(); + // TODO reenable this when we have proper change tracking + // if (matches.length == 1) + // return this.insertMatch(matches[0]); + + this.completions = new FilteredList(matches); + this.completions.setFilter(results.prefix); + if (!this.completions.filtered.length) + return this.detach(); + this.openPopup(this.editor, results.prefix, keepPopupPosition); + }.bind(this)); + }; + + this.cancelContextMenu = function() { + var stop = function(e) { + this.editor.off("nativecontextmenu", stop); + if (e && e.domEvent) + event.stopEvent(e.domEvent); + }.bind(this); + setTimeout(stop, 10); + this.editor.on("nativecontextmenu", stop); + }; + +}).call(Autocomplete.prototype); + +Autocomplete.startCommand = { + name: "startAutocomplete", + exec: function(editor) { + if (!editor.completer) + editor.completer = new Autocomplete(); + editor.completer.showPopup(editor); + // needed for firefox on mac + editor.completer.cancelContextMenu(); + }, + bindKey: "Ctrl-Space|Ctrl-Shift-Space|Alt-Space" +}; + +var FilteredList = function(array, filterText, mutateData) { + this.all = array; + this.filtered = array; + this.filterText = filterText || ""; +}; +(function(){ + this.setFilter = function(str) { + if (str.length > this.filterText && str.lastIndexOf(this.filterText, 0) === 0) + var matches = this.filtered; + else + var matches = this.all; + + this.filterText = str; + matches = this.filterCompletions(matches, this.filterText); + matches = matches.sort(function(a, b) { + return b.exactMatch - a.exactMatch || b.score - a.score; + }); + + // make unique + var prev = null; + matches = matches.filter(function(item){ + var caption = item.value || item.caption || item.snippet; + if (caption === prev) return false; + prev = caption; + return true; + }); + + this.filtered = matches; + }; + this.filterCompletions = function(items, needle) { + var results = []; + var upper = needle.toUpperCase(); + var lower = needle.toLowerCase(); + loop: for (var i = 0, item; item = items[i]; i++) { + var caption = item.value || item.caption || item.snippet; + if (!caption) continue; + var lastIndex = -1; + var matchMask = 0; + var penalty = 0; + var index, distance; + // caption char iteration is faster in Chrome but slower in Firefox, so lets use indexOf + for (var j = 0; j < needle.length; j++) { + // TODO add penalty on case mismatch + var i1 = caption.indexOf(lower[j], lastIndex + 1); + var i2 = caption.indexOf(upper[j], lastIndex + 1); + index = (i1 >= 0) ? ((i2 < 0 || i1 < i2) ? i1 : i2) : i2; + if (index < 0) + continue loop; + distance = index - lastIndex - 1; + if (distance > 0) { + // first char mismatch should be more sensitive + if (lastIndex === -1) + penalty += 10; + penalty += distance; + } + matchMask = matchMask | (1 << index); + lastIndex = index; + } + item.matchMask = matchMask; + item.exactMatch = penalty ? 0 : 1; + item.score = (item.score || 0) - penalty; + results.push(item); + } + return results; + }; +}).call(FilteredList.prototype); + +exports.Autocomplete = Autocomplete; +exports.FilteredList = FilteredList; + +}); diff --git a/addons/editor/ace/autocomplete/popup.js b/addons/editor/ace/autocomplete/popup.js new file mode 100755 index 00000000..891cf1e8 --- /dev/null +++ b/addons/editor/ace/autocomplete/popup.js @@ -0,0 +1,316 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2012, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var EditSession = require("../edit_session").EditSession; +var Renderer = require("../virtual_renderer").VirtualRenderer; +var Editor = require("../editor").Editor; +var Range = require("../range").Range; +var event = require("../lib/event"); +var lang = require("../lib/lang"); +var dom = require("../lib/dom"); + +var $singleLineEditor = function(el) { + var renderer = new Renderer(el); + + renderer.$maxLines = 4; + + var editor = new Editor(renderer); + + editor.setHighlightActiveLine(false); + editor.setShowPrintMargin(false); + editor.renderer.setShowGutter(false); + editor.renderer.setHighlightGutterLine(false); + + editor.$mouseHandler.$focusWaitTimout = 0; + + return editor; +}; + +var AcePopup = function(parentNode) { + var el = dom.createElement("div"); + var popup = new $singleLineEditor(el); + + if (parentNode) + parentNode.appendChild(el); + el.style.display = "none"; + popup.renderer.content.style.cursor = "default"; + popup.renderer.setStyle("ace_autocomplete"); + + popup.setOption("displayIndentGuides", false); + + var noop = function(){}; + + popup.focus = noop; + popup.$isFocused = true; + + popup.renderer.$cursorLayer.restartTimer = noop; + popup.renderer.$cursorLayer.element.style.opacity = 0; + + popup.renderer.$maxLines = 8; + popup.renderer.$keepTextAreaAtCursor = false; + + popup.setHighlightActiveLine(false); + // set default highlight color + popup.session.highlight(""); + popup.session.$searchHighlight.clazz = "ace_highlight-marker"; + + popup.on("mousedown", function(e) { + var pos = e.getDocumentPosition(); + popup.moveCursorToPosition(pos); + popup.selection.clearSelection(); + selectionMarker.start.row = selectionMarker.end.row = pos.row; + e.stop(); + }); + + var lastMouseEvent; + var hoverMarker = new Range(-1,0,-1,Infinity); + var selectionMarker = new Range(-1,0,-1,Infinity); + selectionMarker.id = popup.session.addMarker(selectionMarker, "ace_active-line", "fullLine"); + popup.setSelectOnHover = function(val) { + if (!val) { + hoverMarker.id = popup.session.addMarker(hoverMarker, "ace_line-hover", "fullLine"); + } else if (hoverMarker.id) { + popup.session.removeMarker(hoverMarker.id); + hoverMarker.id = null; + } + } + popup.setSelectOnHover(false); + popup.on("mousemove", function(e) { + if (!lastMouseEvent) { + lastMouseEvent = e; + return; + } + if (lastMouseEvent.x == e.x && lastMouseEvent.y == e.y) { + return; + } + lastMouseEvent = e; + lastMouseEvent.scrollTop = popup.renderer.scrollTop; + var row = lastMouseEvent.getDocumentPosition().row; + if (hoverMarker.start.row != row) { + if (!hoverMarker.id) + popup.setRow(row); + setHoverMarker(row); + } + }); + popup.renderer.on("beforeRender", function() { + if (lastMouseEvent && hoverMarker.start.row != -1) { + lastMouseEvent.$pos = null; + var row = lastMouseEvent.getDocumentPosition().row; + if (!hoverMarker.id) + popup.setRow(row); + setHoverMarker(row, true); + } + }); + popup.renderer.on("afterRender", function() { + var row = popup.getRow(); + var t = popup.renderer.$textLayer; + var selected = t.element.childNodes[row - t.config.firstRow]; + if (selected == t.selectedNode) + return; + if (t.selectedNode) + dom.removeCssClass(t.selectedNode, "ace_selected"); + t.selectedNode = selected; + if (selected) + dom.addCssClass(selected, "ace_selected"); + }); + var hideHoverMarker = function() { setHoverMarker(-1) }; + var setHoverMarker = function(row, suppressRedraw) { + if (row !== hoverMarker.start.row) { + hoverMarker.start.row = hoverMarker.end.row = row; + if (!suppressRedraw) + popup.session._emit("changeBackMarker"); + popup._emit("changeHoverMarker"); + } + }; + popup.getHoveredRow = function() { + return hoverMarker.start.row; + }; + + event.addListener(popup.container, "mouseout", hideHoverMarker); + popup.on("hide", hideHoverMarker); + popup.on("changeSelection", hideHoverMarker); + + popup.session.doc.getLength = function() { + return popup.data.length; + }; + popup.session.doc.getLine = function(i) { + var data = popup.data[i]; + if (typeof data == "string") + return data; + return (data && data.value) || ""; + }; + + var bgTokenizer = popup.session.bgTokenizer; + bgTokenizer.$tokenizeRow = function(i) { + var data = popup.data[i]; + var tokens = []; + if (!data) + return tokens; + if (typeof data == "string") + data = {value: data}; + if (!data.caption) + data.caption = data.value; + + var last = -1; + var flag, c; + for (var i = 0; i < data.caption.length; i++) { + c = data.caption[i]; + flag = data.matchMask & (1 << i) ? 1 : 0; + if (last !== flag) { + tokens.push({type: data.className || "" + ( flag ? "completion-highlight" : ""), value: c}); + last = flag; + } else { + tokens[tokens.length - 1].value += c; + } + } + + if (data.meta) { + var maxW = popup.renderer.$size.scrollerWidth / popup.renderer.layerConfig.characterWidth; + if (data.meta.length + data.caption.length < maxW - 2) + tokens.push({type: "rightAlignedText", value: data.meta}); + } + return tokens; + }; + bgTokenizer.$updateOnChange = noop; + bgTokenizer.start = noop; + + popup.session.$computeWidth = function() { + return this.screenWidth = 0; + } + + // public + popup.data = []; + popup.setData = function(list) { + popup.data = list || []; + popup.setValue(lang.stringRepeat("\n", list.length), -1); + popup.setRow(0); + }; + popup.getData = function(row) { + return popup.data[row]; + }; + + popup.getRow = function() { + return selectionMarker.start.row; + }; + popup.setRow = function(line) { + line = Math.max(-1, Math.min(this.data.length, line)); + if (selectionMarker.start.row != line) { + popup.selection.clearSelection(); + selectionMarker.start.row = selectionMarker.end.row = line || 0; + popup.session._emit("changeBackMarker"); + popup.moveCursorTo(line || 0, 0); + if (popup.isOpen) + popup._signal("select"); + } + }; + + popup.hide = function() { + this.container.style.display = "none"; + this._signal("hide"); + popup.isOpen = false; + }; + popup.show = function(pos, lineHeight) { + var el = this.container; + var screenHeight = window.innerHeight; + var renderer = this.renderer; + // var maxLines = Math.min(renderer.$maxLines, this.session.getLength()); + var maxH = renderer.$maxLines * lineHeight * 1.4; + var top = pos.top + this.$borderSize; + if (top + maxH > screenHeight - lineHeight) { + el.style.top = ""; + el.style.bottom = screenHeight - top + "px"; + } else { + top += lineHeight; + el.style.top = top + "px"; + el.style.bottom = ""; + } + + el.style.left = pos.left + "px"; + el.style.display = ""; + this.renderer.$textLayer.checkForSizeChanges(); + + this._signal("show"); + lastMouseEvent = null; + popup.isOpen = true; + }; + + popup.getTextLeftOffset = function() { + return this.$borderSize + this.renderer.$padding + this.$imageSize; + }; + + popup.$imageSize = 0; + popup.$borderSize = 1; + + return popup; +}; + +dom.importCssString("\ +.ace_autocomplete.ace-tm .ace_marker-layer .ace_active-line {\ + background-color: #CAD6FA;\ + z-index: 1;\ +}\ +.ace_autocomplete.ace-tm .ace_line-hover {\ + border: 1px solid #abbffe;\ + margin-top: -1px;\ + background: rgba(233,233,253,0.4);\ +}\ +.ace_autocomplete .ace_line-hover {\ + position: absolute;\ + z-index: 2;\ +}\ +.ace_rightAlignedText {\ + color: gray;\ + display: inline-block;\ + position: absolute;\ + right: 4px;\ + text-align: right;\ + z-index: -1;\ +}\ +.ace_autocomplete .ace_completion-highlight{\ + color: #000;\ + text-shadow: 0 0 0.01em;\ +}\ +.ace_autocomplete {\ + width: 280px;\ + z-index: 200000;\ + background: #fbfbfb;\ + color: #444;\ + border: 1px lightgray solid;\ + position: fixed;\ + box-shadow: 2px 3px 5px rgba(0,0,0,.2);\ + line-height: 1.4;\ +}"); + +exports.AcePopup = AcePopup; + +}); \ No newline at end of file diff --git a/addons/editor/ace/autocomplete/text_completer.js b/addons/editor/ace/autocomplete/text_completer.js new file mode 100755 index 00000000..87a25fb9 --- /dev/null +++ b/addons/editor/ace/autocomplete/text_completer.js @@ -0,0 +1,78 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2012, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { + var Range = require("ace/range").Range; + + var splitRegex = /[^a-zA-Z_0-9\$\-]+/; + + function getWordIndex(doc, pos) { + var textBefore = doc.getTextRange(Range.fromPoints({row: 0, column:0}, pos)); + return textBefore.split(splitRegex).length - 1; + } + + /** + * Does a distance analysis of the word `prefix` at position `pos` in `doc`. + * @return Map + */ + function wordDistance(doc, pos) { + var prefixPos = getWordIndex(doc, pos); + var words = doc.getValue().split(splitRegex); + var wordScores = Object.create(null); + + var currentWord = words[prefixPos]; + + words.forEach(function(word, idx) { + if (!word || word === currentWord) return; + + var distance = Math.abs(prefixPos - idx); + var score = words.length - distance; + if (wordScores[word]) { + wordScores[word] = Math.max(score, wordScores[word]); + } else { + wordScores[word] = score; + } + }); + return wordScores; + } + + exports.getCompletions = function(editor, session, pos, prefix, callback) { + var wordScore = wordDistance(session, pos, prefix); + var wordList = Object.keys(wordScore); + callback(null, wordList.map(function(word) { + return { + name: word, + value: word, + score: wordScore[word], + meta: "local" + }; + })); + }; +}); \ No newline at end of file diff --git a/addons/editor/ace/autocomplete/util.js b/addons/editor/ace/autocomplete/util.js new file mode 100755 index 00000000..8b7c1151 --- /dev/null +++ b/addons/editor/ace/autocomplete/util.js @@ -0,0 +1,74 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2012, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +exports.parForEach = function(array, fn, callback) { + var completed = 0; + var arLength = array.length; + if (arLength === 0) + callback(); + for (var i = 0; i < arLength; i++) { + fn(array[i], function(result, err) { + completed++; + if (completed === arLength) + callback(result, err); + }); + } +} + +var ID_REGEX = /[a-zA-Z_0-9\$-]/; + +exports.retrievePrecedingIdentifier = function(text, pos, regex) { + regex = regex || ID_REGEX; + var buf = []; + for (var i = pos-1; i >= 0; i--) { + if (regex.test(text[i])) + buf.push(text[i]); + else + break; + } + return buf.reverse().join(""); +} + +exports.retrieveFollowingIdentifier = function(text, pos, regex) { + regex = regex || ID_REGEX; + var buf = []; + for (var i = pos; i < text.length; i++) { + if (regex.test(text[i])) + buf.push(text[i]); + else + break; + } + return buf; +} + +}); diff --git a/addons/editor/ace/background_tokenizer.js b/addons/editor/ace/background_tokenizer.js new file mode 100755 index 00000000..217be1b3 --- /dev/null +++ b/addons/editor/ace/background_tokenizer.js @@ -0,0 +1,255 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var oop = require("./lib/oop"); +var EventEmitter = require("./lib/event_emitter").EventEmitter; + + +/** + * + * + * Tokenizes the current [[Document `Document`]] in the background, and caches the tokenized rows for future use. + * + * If a certain row is changed, everything below that row is re-tokenized. + * + * @class BackgroundTokenizer + **/ + +/** + * Creates a new `BackgroundTokenizer` object. + * @param {Tokenizer} tokenizer The tokenizer to use + * @param {Editor} editor The editor to associate with + * + * + * + * @constructor + **/ + +var BackgroundTokenizer = function(tokenizer, editor) { + this.running = false; + this.lines = []; + this.states = []; + this.currentLine = 0; + this.tokenizer = tokenizer; + + var self = this; + + this.$worker = function() { + if (!self.running) { return; } + + var workerStart = new Date(); + var currentLine = self.currentLine; + var endLine = -1; + var doc = self.doc; + + while (self.lines[currentLine]) + currentLine++; + + var startLine = currentLine; + + var len = doc.getLength(); + var processedLines = 0; + self.running = false; + while (currentLine < len) { + self.$tokenizeRow(currentLine); + endLine = currentLine; + do { + currentLine++; + } while (self.lines[currentLine]); + + // only check every 5 lines + processedLines ++; + if ((processedLines % 5 == 0) && (new Date() - workerStart) > 20) { + self.running = setTimeout(self.$worker, 20); + self.currentLine = currentLine; + return; + } + } + self.currentLine = currentLine; + + if (startLine <= endLine) + self.fireUpdateEvent(startLine, endLine); + }; +}; + +(function(){ + + oop.implement(this, EventEmitter); + + /** + * Sets a new tokenizer for this object. + * + * @param {Tokenizer} tokenizer The new tokenizer to use + * + **/ + this.setTokenizer = function(tokenizer) { + this.tokenizer = tokenizer; + this.lines = []; + this.states = []; + + this.start(0); + }; + + /** + * Sets a new document to associate with this object. + * @param {Document} doc The new document to associate with + **/ + this.setDocument = function(doc) { + this.doc = doc; + this.lines = []; + this.states = []; + + this.stop(); + }; + + /** + * Fires whenever the background tokeniziers between a range of rows are going to be updated. + * + * @event update + * @param {Object} e An object containing two properties, `first` and `last`, which indicate the rows of the region being updated. + * + **/ + /** + * Emits the `'update'` event. `firstRow` and `lastRow` are used to define the boundaries of the region to be updated. + * @param {Number} firstRow The starting row region + * @param {Number} lastRow The final row region + * + **/ + this.fireUpdateEvent = function(firstRow, lastRow) { + var data = { + first: firstRow, + last: lastRow + }; + this._emit("update", {data: data}); + }; + + /** + * Starts tokenizing at the row indicated. + * + * @param {Number} startRow The row to start at + * + **/ + this.start = function(startRow) { + this.currentLine = Math.min(startRow || 0, this.currentLine, this.doc.getLength()); + + // remove all cached items below this line + this.lines.splice(this.currentLine, this.lines.length); + this.states.splice(this.currentLine, this.states.length); + + this.stop(); + // pretty long delay to prevent the tokenizer from interfering with the user + this.running = setTimeout(this.$worker, 700); + }; + + this.scheduleStart = function() { + if (!this.running) + this.running = setTimeout(this.$worker, 700); + } + + this.$updateOnChange = function(delta) { + var range = delta.range; + var startRow = range.start.row; + var len = range.end.row - startRow; + + if (len === 0) { + this.lines[startRow] = null; + } else if (delta.action == "removeText" || delta.action == "removeLines") { + this.lines.splice(startRow, len + 1, null); + this.states.splice(startRow, len + 1, null); + } else { + var args = Array(len + 1); + args.unshift(startRow, 1); + this.lines.splice.apply(this.lines, args); + this.states.splice.apply(this.states, args); + } + + this.currentLine = Math.min(startRow, this.currentLine, this.doc.getLength()); + + this.stop(); + }; + + /** + * Stops tokenizing. + * + **/ + this.stop = function() { + if (this.running) + clearTimeout(this.running); + this.running = false; + }; + + /** + * Gives list of tokens of the row. (tokens are cached) + * + * @param {Number} row The row to get tokens at + * + * + * + **/ + this.getTokens = function(row) { + return this.lines[row] || this.$tokenizeRow(row); + }; + + /** + * [Returns the state of tokenization at the end of a row.]{: #BackgroundTokenizer.getState} + * + * @param {Number} row The row to get state at + **/ + this.getState = function(row) { + if (this.currentLine == row) + this.$tokenizeRow(row); + return this.states[row] || "start"; + }; + + this.$tokenizeRow = function(row) { + var line = this.doc.getLine(row); + var state = this.states[row - 1]; + + var data = this.tokenizer.getLineTokens(line, state, row); + + if (this.states[row] + "" !== data.state + "") { + this.states[row] = data.state; + this.lines[row + 1] = null; + if (this.currentLine > row + 1) + this.currentLine = row + 1; + } else if (this.currentLine == row) { + this.currentLine = row + 1; + } + + return this.lines[row] = data.tokens; + }; + +}).call(BackgroundTokenizer.prototype); + +exports.BackgroundTokenizer = BackgroundTokenizer; +}); diff --git a/addons/editor/ace/background_tokenizer_test.js b/addons/editor/ace/background_tokenizer_test.js new file mode 100755 index 00000000..7a4cc78c --- /dev/null +++ b/addons/editor/ace/background_tokenizer_test.js @@ -0,0 +1,85 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +if (typeof process !== "undefined") { + require("amd-loader"); +} + +define(function(require, exports, module) { +"use strict"; + +var EditSession = require("./edit_session").EditSession; +var JavaScriptMode = require("./mode/javascript").Mode; +var Range = require("./range").Range; +var assert = require("./test/assertions"); + +function forceTokenize(session){ + for (var i = 0, l = session.getLength(); i < l; i++) + session.getTokens(i) +} + +function testStates(session, states) { + for (var i = 0, l = session.getLength(); i < l; i++) + assert.equal(session.bgTokenizer.states[i], states[i]) + assert.ok(l == states.length) +} + +module.exports = { + + "test background tokenizer update on session change" : function() { + var doc = new EditSession([ + "/*", + "*/", + "var juhu" + ]); + doc.setMode("./mode/javascript") + + forceTokenize(doc) + testStates(doc, ["comment_regex_allowed", "start", "no_regex"]) + + doc.remove(new Range(0,2,1,2)) + testStates(doc, [null, "no_regex"]) + + forceTokenize(doc) + testStates(doc, ["comment_regex_allowed", "comment_regex_allowed"]) + + doc.insert({row:0, column:2}, "\n*/") + testStates(doc, [undefined, undefined, "comment_regex_allowed"]) + + forceTokenize(doc) + testStates(doc, ["comment_regex_allowed", "start", "no_regex"]) + } +}; + +}); + +if (typeof module !== "undefined" && module === require.main) { + require("asyncjs").test.testcase(module.exports).exec() +} diff --git a/addons/editor/ace/commands/command_manager.js b/addons/editor/ace/commands/command_manager.js new file mode 100755 index 00000000..72a9942d --- /dev/null +++ b/addons/editor/ace/commands/command_manager.js @@ -0,0 +1,112 @@ +define(function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var HashHandler = require("../keyboard/hash_handler").HashHandler; +var EventEmitter = require("../lib/event_emitter").EventEmitter; + +/** + * @class CommandManager + * + * + **/ + +/** + * new CommandManager(platform, commands) + * @param {String} platform Identifier for the platform; must be either `'mac'` or `'win'` + * @param {Array} commands A list of commands + * + **/ + +var CommandManager = function(platform, commands) { + HashHandler.call(this, commands, platform); + this.byName = this.commands; + this.setDefaultHandler("exec", function(e) { + return e.command.exec(e.editor, e.args || {}); + }); +}; + +oop.inherits(CommandManager, HashHandler); + +(function() { + + oop.implement(this, EventEmitter); + + this.exec = function(command, editor, args) { + if (typeof command === 'string') + command = this.commands[command]; + + if (!command) + return false; + + if (editor && editor.$readOnly && !command.readOnly) + return false; + + var e = {editor: editor, command: command, args: args}; + var retvalue = this._emit("exec", e); + this._signal("afterExec", e); + + return retvalue === false ? false : true; + }; + + this.toggleRecording = function(editor) { + if (this.$inReplay) + return; + + editor && editor._emit("changeStatus"); + if (this.recording) { + this.macro.pop(); + this.removeEventListener("exec", this.$addCommandToMacro); + + if (!this.macro.length) + this.macro = this.oldMacro; + + return this.recording = false; + } + if (!this.$addCommandToMacro) { + this.$addCommandToMacro = function(e) { + this.macro.push([e.command, e.args]); + }.bind(this); + } + + this.oldMacro = this.macro; + this.macro = []; + this.on("exec", this.$addCommandToMacro); + return this.recording = true; + }; + + this.replay = function(editor) { + if (this.$inReplay || !this.macro) + return; + + if (this.recording) + return this.toggleRecording(editor); + + try { + this.$inReplay = true; + this.macro.forEach(function(x) { + if (typeof x == "string") + this.exec(x, editor); + else + this.exec(x[0], editor, x[1]); + }, this); + } finally { + this.$inReplay = false; + } + }; + + this.trimMacro = function(m) { + return m.map(function(x){ + if (typeof x[0] != "string") + x[0] = x[0].name; + if (!x[1]) + x = x[0]; + return x; + }); + }; + +}).call(CommandManager.prototype); + +exports.CommandManager = CommandManager; + +}); diff --git a/addons/editor/ace/commands/command_manager_test.js b/addons/editor/ace/commands/command_manager_test.js new file mode 100755 index 00000000..76d973bb --- /dev/null +++ b/addons/editor/ace/commands/command_manager_test.js @@ -0,0 +1,199 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +if (typeof process !== "undefined") { + require("amd-loader"); +} + +define(function(require, exports, module) { +"use strict"; + +var CommandManager = require("./command_manager").CommandManager; +var keys = require("../lib/keys"); +var assert = require("../test/assertions"); + +module.exports = { + + setUp: function() { + this.command = { + name: "gotoline", + bindKey: { + mac: "Command-L", + win: "Ctrl-L" + }, + called: false, + exec: function(editor) { this.called = true; } + }; + + this.cm = new CommandManager("mac", [this.command]); + }, + + "test: register command": function() { + this.cm.exec("gotoline"); + assert.ok(this.command.called); + }, + + "test: mac hotkeys": function() { + var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "l"); + assert.equal(command, this.command); + + var command = this.cm.findKeyCommand(keys.KEY_MODS.ctrl, "l"); + assert.equal(command, undefined); + }, + + "test: win hotkeys": function() { + var cm = new CommandManager("win", [this.command]); + + var command = cm.findKeyCommand(keys.KEY_MODS.command, "l"); + assert.equal(command, undefined); + + var command = cm.findKeyCommand(keys.KEY_MODS.ctrl, "l"); + assert.equal(command, this.command); + }, + + "test: remove command by object": function() { + this.cm.removeCommand(this.command); + + this.cm.exec("gotoline"); + assert.ok(!this.command.called); + + var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "l"); + assert.equal(command, null); + }, + + "test: remove command by name": function() { + this.cm.removeCommand("gotoline"); + + this.cm.exec("gotoline"); + assert.ok(!this.command.called); + + var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "l"); + assert.equal(command, null); + }, + + "test: adding a new command with the same name as an existing one should remove the old one first": function() { + var command = { + name: "gotoline", + bindKey: { + mac: "Command-L", + win: "Ctrl-L" + }, + called: false, + exec: function(editor) { this.called = true; } + }; + this.cm.addCommand(command); + + this.cm.exec("gotoline"); + assert.ok(command.called); + assert.ok(!this.command.called); + + assert.equal(this.cm.findKeyCommand(keys.KEY_MODS.command, "l"), command); + }, + + "test: adding commands and recording a macro": function() { + var called = ""; + this.cm.addCommands({ + togglerecording: function(editor) { + editor.cm.toggleRecording(editor); + }, + replay: function(editor) { + editor.cm.replay(); + }, + cm1: function(editor, arg) { + called += "1" + (arg || ""); + }, + cm2: function(editor) { + called += "2"; + } + }); + + + var statusUpdateEmitted = false; + this._emit = function() {statusUpdateEmitted = true}; + + this.cm.exec("togglerecording", this); + assert.ok(this.cm.recording); + assert.ok(statusUpdateEmitted); + + this.cm.exec("cm1", this, "-"); + this.cm.exec("cm2"); + this.cm.exec("replay", this); + assert.ok(!this.cm.recording); + assert.equal(called, "1-2"); + + called = ""; + this.cm.exec("replay", this); + assert.equal(called, "1-2"); + }, + + "test: bindkeys": function() { + this.cm.bindKeys({ + "Ctrl-L|Command-C": "cm1", + "Ctrl-R": "cm2" + }); + + var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "c"); + assert.equal(command, "cm1"); + + var command = this.cm.findKeyCommand(keys.KEY_MODS.ctrl, "r"); + assert.equal(command, "cm2"); + + this.cm.bindKeys({ + "Ctrl-R": null + }); + + var command = this.cm.findKeyCommand(keys.KEY_MODS.ctrl, "r"); + assert.equal(command, null); + }, + + "test: binding keys without modifiers": function() { + this.cm.bindKeys({ + "R": "cm1", + "Shift-r": "cm2", + "Return": "cm4", + "Enter": "cm3" + }); + + var command = this.cm.findKeyCommand(-1, "r"); + assert.equal(command, "cm1"); + + var command = this.cm.findKeyCommand(-1, "R"); + assert.equal(command, "cm2"); + + var command = this.cm.findKeyCommand(0, "return"); + assert.equal(command, "cm3"); + } +}; + +}); + +if (typeof module !== "undefined" && module === require.main) { + require("asyncjs").test.testcase(module.exports).exec(); +} diff --git a/addons/editor/ace/commands/default_commands.js b/addons/editor/ace/commands/default_commands.js new file mode 100755 index 00000000..9c663d18 --- /dev/null +++ b/addons/editor/ace/commands/default_commands.js @@ -0,0 +1,490 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var lang = require("../lib/lang"); +var config = require("../config"); + +function bindKey(win, mac) { + return { + win: win, + mac: mac + }; +} + +exports.commands = [{ + name: "showSettingsMenu", + bindKey: bindKey("Ctrl-,", "Command-,"), + exec: function(editor) { + config.loadModule("ace/ext/settings_menu", function(module) { + module.init(editor); + editor.showSettingsMenu(); + }); + }, + readOnly: true +}, { + name: "selectall", + bindKey: bindKey("Ctrl-A", "Command-A"), + exec: function(editor) { editor.selectAll(); }, + readOnly: true +}, { + name: "centerselection", + bindKey: bindKey(null, "Ctrl-L"), + exec: function(editor) { editor.centerSelection(); }, + readOnly: true +}, { + name: "gotoline", + bindKey: bindKey("Ctrl-L", "Command-L"), + exec: function(editor) { + var line = parseInt(prompt("Enter line number:"), 10); + if (!isNaN(line)) { + editor.gotoLine(line); + } + }, + readOnly: true +}, { + name: "fold", + bindKey: bindKey("Alt-L|Ctrl-F1", "Command-Alt-L|Command-F1"), + exec: function(editor) { editor.session.toggleFold(false); }, + readOnly: true +}, { + name: "unfold", + bindKey: bindKey("Alt-Shift-L|Ctrl-Shift-F1", "Command-Alt-Shift-L|Command-Shift-F1"), + exec: function(editor) { editor.session.toggleFold(true); }, + readOnly: true +}, { + name: "foldall", + bindKey: bindKey("Alt-0", "Command-Option-0"), + exec: function(editor) { editor.session.foldAll(); }, + readOnly: true +}, { + name: "unfoldall", + bindKey: bindKey("Alt-Shift-0", "Command-Option-Shift-0"), + exec: function(editor) { editor.session.unfold(); }, + readOnly: true +}, { + name: "findnext", + bindKey: bindKey("Ctrl-K", "Command-G"), + exec: function(editor) { editor.findNext(); }, + readOnly: true +}, { + name: "findprevious", + bindKey: bindKey("Ctrl-Shift-K", "Command-Shift-G"), + exec: function(editor) { editor.findPrevious(); }, + readOnly: true +}, { + name: "find", + bindKey: bindKey("Ctrl-F", "Command-F"), + exec: function(editor) { + config.loadModule("ace/ext/searchbox", function(e) {e.Search(editor)}); + }, + readOnly: true +}, { + name: "overwrite", + bindKey: "Insert", + exec: function(editor) { editor.toggleOverwrite(); }, + readOnly: true +}, { + name: "selecttostart", + bindKey: bindKey("Ctrl-Shift-Home", "Command-Shift-Up"), + exec: function(editor) { editor.getSelection().selectFileStart(); }, + multiSelectAction: "forEach", + readOnly: true, + group: "fileJump" +}, { + name: "gotostart", + bindKey: bindKey("Ctrl-Home", "Command-Home|Command-Up"), + exec: function(editor) { editor.navigateFileStart(); }, + multiSelectAction: "forEach", + readOnly: true, + group: "fileJump" +}, { + name: "selectup", + bindKey: bindKey("Shift-Up", "Shift-Up"), + exec: function(editor) { editor.getSelection().selectUp(); }, + multiSelectAction: "forEach", + readOnly: true +}, { + name: "golineup", + bindKey: bindKey("Up", "Up|Ctrl-P"), + exec: function(editor, args) { editor.navigateUp(args.times); }, + multiSelectAction: "forEach", + readOnly: true +}, { + name: "selecttoend", + bindKey: bindKey("Ctrl-Shift-End", "Command-Shift-Down"), + exec: function(editor) { editor.getSelection().selectFileEnd(); }, + multiSelectAction: "forEach", + readOnly: true, + group: "fileJump" +}, { + name: "gotoend", + bindKey: bindKey("Ctrl-End", "Command-End|Command-Down"), + exec: function(editor) { editor.navigateFileEnd(); }, + multiSelectAction: "forEach", + readOnly: true, + group: "fileJump" +}, { + name: "selectdown", + bindKey: bindKey("Shift-Down", "Shift-Down"), + exec: function(editor) { editor.getSelection().selectDown(); }, + multiSelectAction: "forEach", + readOnly: true +}, { + name: "golinedown", + bindKey: bindKey("Down", "Down|Ctrl-N"), + exec: function(editor, args) { editor.navigateDown(args.times); }, + multiSelectAction: "forEach", + readOnly: true +}, { + name: "selectwordleft", + bindKey: bindKey("Ctrl-Shift-Left", "Option-Shift-Left"), + exec: function(editor) { editor.getSelection().selectWordLeft(); }, + multiSelectAction: "forEach", + readOnly: true +}, { + name: "gotowordleft", + bindKey: bindKey("Ctrl-Left", "Option-Left"), + exec: function(editor) { editor.navigateWordLeft(); }, + multiSelectAction: "forEach", + readOnly: true +}, { + name: "selecttolinestart", + bindKey: bindKey("Alt-Shift-Left", "Command-Shift-Left"), + exec: function(editor) { editor.getSelection().selectLineStart(); }, + multiSelectAction: "forEach", + readOnly: true +}, { + name: "gotolinestart", + bindKey: bindKey("Alt-Left|Home", "Command-Left|Home|Ctrl-A"), + exec: function(editor) { editor.navigateLineStart(); }, + multiSelectAction: "forEach", + readOnly: true +}, { + name: "selectleft", + bindKey: bindKey("Shift-Left", "Shift-Left"), + exec: function(editor) { editor.getSelection().selectLeft(); }, + multiSelectAction: "forEach", + readOnly: true +}, { + name: "gotoleft", + bindKey: bindKey("Left", "Left|Ctrl-B"), + exec: function(editor, args) { editor.navigateLeft(args.times); }, + multiSelectAction: "forEach", + readOnly: true +}, { + name: "selectwordright", + bindKey: bindKey("Ctrl-Shift-Right", "Option-Shift-Right"), + exec: function(editor) { editor.getSelection().selectWordRight(); }, + multiSelectAction: "forEach", + readOnly: true +}, { + name: "gotowordright", + bindKey: bindKey("Ctrl-Right", "Option-Right"), + exec: function(editor) { editor.navigateWordRight(); }, + multiSelectAction: "forEach", + readOnly: true +}, { + name: "selecttolineend", + bindKey: bindKey("Alt-Shift-Right", "Command-Shift-Right"), + exec: function(editor) { editor.getSelection().selectLineEnd(); }, + multiSelectAction: "forEach", + readOnly: true +}, { + name: "gotolineend", + bindKey: bindKey("Alt-Right|End", "Command-Right|End|Ctrl-E"), + exec: function(editor) { editor.navigateLineEnd(); }, + multiSelectAction: "forEach", + readOnly: true +}, { + name: "selectright", + bindKey: bindKey("Shift-Right", "Shift-Right"), + exec: function(editor) { editor.getSelection().selectRight(); }, + multiSelectAction: "forEach", + readOnly: true +}, { + name: "gotoright", + bindKey: bindKey("Right", "Right|Ctrl-F"), + exec: function(editor, args) { editor.navigateRight(args.times); }, + multiSelectAction: "forEach", + readOnly: true +}, { + name: "selectpagedown", + bindKey: "Shift-PageDown", + exec: function(editor) { editor.selectPageDown(); }, + readOnly: true +}, { + name: "pagedown", + bindKey: bindKey(null, "Option-PageDown"), + exec: function(editor) { editor.scrollPageDown(); }, + readOnly: true +}, { + name: "gotopagedown", + bindKey: bindKey("PageDown", "PageDown|Ctrl-V"), + exec: function(editor) { editor.gotoPageDown(); }, + readOnly: true +}, { + name: "selectpageup", + bindKey: "Shift-PageUp", + exec: function(editor) { editor.selectPageUp(); }, + readOnly: true +}, { + name: "pageup", + bindKey: bindKey(null, "Option-PageUp"), + exec: function(editor) { editor.scrollPageUp(); }, + readOnly: true +}, { + name: "gotopageup", + bindKey: "PageUp", + exec: function(editor) { editor.gotoPageUp(); }, + readOnly: true +}, { + name: "scrollup", + bindKey: bindKey("Ctrl-Up", null), + exec: function(e) { e.renderer.scrollBy(0, -2 * e.renderer.layerConfig.lineHeight); }, + readOnly: true +}, { + name: "scrolldown", + bindKey: bindKey("Ctrl-Down", null), + exec: function(e) { e.renderer.scrollBy(0, 2 * e.renderer.layerConfig.lineHeight); }, + readOnly: true +}, { + name: "selectlinestart", + bindKey: "Shift-Home", + exec: function(editor) { editor.getSelection().selectLineStart(); }, + multiSelectAction: "forEach", + readOnly: true +}, { + name: "selectlineend", + bindKey: "Shift-End", + exec: function(editor) { editor.getSelection().selectLineEnd(); }, + multiSelectAction: "forEach", + readOnly: true +}, { + name: "togglerecording", + bindKey: bindKey("Ctrl-Alt-E", "Command-Option-E"), + exec: function(editor) { editor.commands.toggleRecording(editor); }, + readOnly: true +}, { + name: "replaymacro", + bindKey: bindKey("Ctrl-Shift-E", "Command-Shift-E"), + exec: function(editor) { editor.commands.replay(editor); }, + readOnly: true +}, { + name: "jumptomatching", + bindKey: bindKey("Ctrl-P", "Ctrl-Shift-P"), + exec: function(editor) { editor.jumpToMatching(); }, + multiSelectAction: "forEach", + readOnly: true +}, { + name: "selecttomatching", + bindKey: bindKey("Ctrl-Shift-P", null), + exec: function(editor) { editor.jumpToMatching(true); }, + multiSelectAction: "forEach", + readOnly: true +}, + +// commands disabled in readOnly mode +{ + name: "cut", + exec: function(editor) { + var range = editor.getSelectionRange(); + editor._emit("cut", range); + + if (!editor.selection.isEmpty()) { + editor.session.remove(range); + editor.clearSelection(); + } + }, + multiSelectAction: "forEach" +}, { + name: "removeline", + bindKey: bindKey("Ctrl-D", "Command-D"), + exec: function(editor) { editor.removeLines(); }, + multiSelectAction: "forEachLine" +}, { + name: "duplicateSelection", + bindKey: bindKey("Ctrl-Shift-D", "Command-Shift-D"), + exec: function(editor) { editor.duplicateSelection(); }, + multiSelectAction: "forEach" +}, { + name: "sortlines", + bindKey: bindKey("Ctrl-Alt-S", "Command-Alt-S"), + exec: function(editor) { editor.sortLines(); }, + multiSelectAction: "forEachLine" +}, { + name: "togglecomment", + bindKey: bindKey("Ctrl-/", "Command-/"), + exec: function(editor) { editor.toggleCommentLines(); }, + multiSelectAction: "forEachLine" +}, { + name: "toggleBlockComment", + bindKey: bindKey("Ctrl-Shift-/", "Command-Shift-/"), + exec: function(editor) { editor.toggleBlockComment(); }, + multiSelectAction: "forEach" +}, { + name: "modifyNumberUp", + bindKey: bindKey("Ctrl-Shift-Up", "Alt-Shift-Up"), + exec: function(editor) { editor.modifyNumber(1); }, + multiSelectAction: "forEach" +}, { + name: "modifyNumberDown", + bindKey: bindKey("Ctrl-Shift-Down", "Alt-Shift-Down"), + exec: function(editor) { editor.modifyNumber(-1); }, + multiSelectAction: "forEach" +}, { + name: "replace", + bindKey: bindKey("Ctrl-H", "Command-Option-F"), + exec: function(editor) { + config.loadModule("ace/ext/searchbox", function(e) {e.Search(editor, true)}); + } +}, { + name: "undo", + bindKey: bindKey("Ctrl-Z", "Command-Z"), + exec: function(editor) { editor.undo(); } +}, { + name: "redo", + bindKey: bindKey("Ctrl-Shift-Z|Ctrl-Y", "Command-Shift-Z|Command-Y"), + exec: function(editor) { editor.redo(); } +}, { + name: "copylinesup", + bindKey: bindKey("Alt-Shift-Up", "Command-Option-Up"), + exec: function(editor) { editor.copyLinesUp(); } +}, { + name: "movelinesup", + bindKey: bindKey("Alt-Up", "Option-Up"), + exec: function(editor) { editor.moveLinesUp(); } +}, { + name: "copylinesdown", + bindKey: bindKey("Alt-Shift-Down", "Command-Option-Down"), + exec: function(editor) { editor.copyLinesDown(); } +}, { + name: "movelinesdown", + bindKey: bindKey("Alt-Down", "Option-Down"), + exec: function(editor) { editor.moveLinesDown(); } +}, { + name: "del", + bindKey: bindKey("Delete", "Delete|Ctrl-D|Shift-Delete"), + exec: function(editor) { editor.remove("right"); }, + multiSelectAction: "forEach" +}, { + name: "backspace", + bindKey: bindKey( + "Shift-Backspace|Backspace", + "Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H" + ), + exec: function(editor) { editor.remove("left"); }, + multiSelectAction: "forEach" +}, { + name: "cut_or_delete", + bindKey: bindKey("Shift-Delete", null), + exec: function(editor) { + if (editor.selection.isEmpty()) { + editor.remove("left"); + } else { + return false; + } + }, + multiSelectAction: "forEach" +}, { + name: "removetolinestart", + bindKey: bindKey("Alt-Backspace", "Command-Backspace"), + exec: function(editor) { editor.removeToLineStart(); }, + multiSelectAction: "forEach" +}, { + name: "removetolineend", + bindKey: bindKey("Alt-Delete", "Ctrl-K"), + exec: function(editor) { editor.removeToLineEnd(); }, + multiSelectAction: "forEach" +}, { + name: "removewordleft", + bindKey: bindKey("Ctrl-Backspace", "Alt-Backspace|Ctrl-Alt-Backspace"), + exec: function(editor) { editor.removeWordLeft(); }, + multiSelectAction: "forEach" +}, { + name: "removewordright", + bindKey: bindKey("Ctrl-Delete", "Alt-Delete"), + exec: function(editor) { editor.removeWordRight(); }, + multiSelectAction: "forEach" +}, { + name: "outdent", + bindKey: bindKey("Shift-Tab", "Shift-Tab"), + exec: function(editor) { editor.blockOutdent(); }, + multiSelectAction: "forEach" +}, { + name: "indent", + bindKey: bindKey("Tab", "Tab"), + exec: function(editor) { editor.indent(); }, + multiSelectAction: "forEach" +},{ + name: "blockoutdent", + bindKey: bindKey("Ctrl-[", "Ctrl-["), + exec: function(editor) { editor.blockOutdent(); }, + multiSelectAction: "forEachLine" +},{ + name: "blockindent", + bindKey: bindKey("Ctrl-]", "Ctrl-]"), + exec: function(editor) { editor.blockIndent(); }, + multiSelectAction: "forEachLine" +}, { + name: "insertstring", + exec: function(editor, str) { editor.insert(str); }, + multiSelectAction: "forEach" +}, { + name: "inserttext", + exec: function(editor, args) { + editor.insert(lang.stringRepeat(args.text || "", args.times || 1)); + }, + multiSelectAction: "forEach" +}, { + name: "splitline", + bindKey: bindKey(null, "Ctrl-O"), + exec: function(editor) { editor.splitLine(); }, + multiSelectAction: "forEach" +}, { + name: "transposeletters", + bindKey: bindKey("Ctrl-T", "Ctrl-T"), + exec: function(editor) { editor.transposeLetters(); }, + multiSelectAction: function(editor) {editor.transposeSelections(1); } +}, { + name: "touppercase", + bindKey: bindKey("Ctrl-U", "Ctrl-U"), + exec: function(editor) { editor.toUpperCase(); }, + multiSelectAction: "forEach" +}, { + name: "tolowercase", + bindKey: bindKey("Ctrl-Shift-U", "Ctrl-Shift-U"), + exec: function(editor) { editor.toLowerCase(); }, + multiSelectAction: "forEach" +}]; + +}); diff --git a/addons/editor/ace/commands/incremental_search_commands.js b/addons/editor/ace/commands/incremental_search_commands.js new file mode 100755 index 00000000..ebe979ca --- /dev/null +++ b/addons/editor/ace/commands/incremental_search_commands.js @@ -0,0 +1,180 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { + +var config = require("../config"); +var oop = require("../lib/oop"); +var HashHandler = require("../keyboard/hash_handler").HashHandler; +var occurStartCommand = require("./occur_commands").occurStartCommand; + +// These commands can be installed in a normal key handler to start iSearch: +exports.iSearchStartCommands = [{ + name: "iSearch", + bindKey: {win: "Ctrl-F", mac: "Command-F"}, + exec: function(editor, options) { + config.loadModule(["core", "ace/incremental_search"], function(e) { + var iSearch = e.iSearch = e.iSearch || new e.IncrementalSearch(); + iSearch.activate(editor, options.backwards); + if (options.jumpToFirstMatch) iSearch.next(options); + }); + }, + readOnly: true +}, { + name: "iSearchBackwards", + exec: function(editor, jumpToNext) { editor.execCommand('iSearch', {backwards: true}); }, + readOnly: true +}, { + name: "iSearchAndGo", + bindKey: {win: "Ctrl-K", mac: "Command-G"}, + exec: function(editor, jumpToNext) { editor.execCommand('iSearch', {jumpToFirstMatch: true, useCurrentOrPrevSearch: true}); }, + readOnly: true +}, { + name: "iSearchBackwardsAndGo", + bindKey: {win: "Ctrl-Shift-K", mac: "Command-Shift-G"}, + exec: function(editor) { editor.execCommand('iSearch', {jumpToFirstMatch: true, backwards: true, useCurrentOrPrevSearch: true}); }, + readOnly: true +}]; + +// These commands are only available when incremental search mode is active: +exports.iSearchCommands = [{ + name: "restartSearch", + bindKey: {win: "Ctrl-F", mac: "Command-F"}, + exec: function(iSearch) { + iSearch.cancelSearch(true); + }, + readOnly: true, + isIncrementalSearchCommand: true +}, { + name: "searchForward", + bindKey: {win: "Ctrl-S|Ctrl-K", mac: "Ctrl-S|Command-G"}, + exec: function(iSearch, options) { + options.useCurrentOrPrevSearch = true; + iSearch.next(options); + }, + readOnly: true, + isIncrementalSearchCommand: true +}, { + name: "searchBackward", + bindKey: {win: "Ctrl-R|Ctrl-Shift-K", mac: "Ctrl-R|Command-Shift-G"}, + exec: function(iSearch, options) { + options.useCurrentOrPrevSearch = true; + options.backwards = true; + iSearch.next(options); + }, + readOnly: true, + isIncrementalSearchCommand: true +}, { + name: "extendSearchTerm", + exec: function(iSearch, string) { + iSearch.addChar(string); + }, + readOnly: true, + isIncrementalSearchCommand: true +}, { + name: "extendSearchTermSpace", + bindKey: "space", + exec: function(iSearch) { iSearch.addChar(' '); }, + readOnly: true, + isIncrementalSearchCommand: true +}, { + name: "shrinkSearchTerm", + bindKey: "backspace", + exec: function(iSearch) { + iSearch.removeChar(); + }, + readOnly: true, + isIncrementalSearchCommand: true +}, { + name: 'confirmSearch', + bindKey: 'return', + exec: function(iSearch) { iSearch.deactivate(); }, + readOnly: true, + isIncrementalSearchCommand: true +}, { + name: 'cancelSearch', + bindKey: 'esc|Ctrl-G', + exec: function(iSearch) { iSearch.deactivate(true); }, + readOnly: true, + isIncrementalSearchCommand: true +}, { + name: 'occurisearch', + bindKey: 'Ctrl-O', + exec: function(iSearch) { + var options = oop.mixin({}, iSearch.$options); + iSearch.deactivate(); + occurStartCommand.exec(iSearch.$editor, options); + }, + readOnly: true, + isIncrementalSearchCommand: true +}]; + +function IncrementalSearchKeyboardHandler(iSearch) { + this.$iSearch = iSearch; +} + +oop.inherits(IncrementalSearchKeyboardHandler, HashHandler); + +;(function() { + + this.attach = function(editor) { + var iSearch = this.$iSearch; + HashHandler.call(this, exports.iSearchCommands, editor.commands.platform); + this.$commandExecHandler = editor.commands.addEventListener('exec', function(e) { + if (!e.command.isIncrementalSearchCommand) return undefined; + e.stopPropagation(); + e.preventDefault(); + return e.command.exec(iSearch, e.args || {}); + }); + } + + this.detach = function(editor) { + if (!this.$commandExecHandler) return; + editor.commands.removeEventListener('exec', this.$commandExecHandler); + delete this.$commandExecHandler; + } + + var handleKeyboard$super = this.handleKeyboard; + this.handleKeyboard = function(data, hashId, key, keyCode) { + var cmd = handleKeyboard$super.call(this, data, hashId, key, keyCode); + if (cmd.command) { return cmd; } + if (hashId == -1) { + var extendCmd = this.commands.extendSearchTerm; + if (extendCmd) { return {command: extendCmd, args: key}; } + } + return {command: "null", passEvent: hashId == 0 || hashId == 4}; + } + +}).call(IncrementalSearchKeyboardHandler.prototype); + + +exports.IncrementalSearchKeyboardHandler = IncrementalSearchKeyboardHandler; + +}); diff --git a/addons/editor/ace/commands/multi_select_commands.js b/addons/editor/ace/commands/multi_select_commands.js new file mode 100755 index 00000000..ff59f045 --- /dev/null +++ b/addons/editor/ace/commands/multi_select_commands.js @@ -0,0 +1,97 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { + +// commands to enter multiselect mode +exports.defaultCommands = [{ + name: "addCursorAbove", + exec: function(editor) { editor.selectMoreLines(-1); }, + bindKey: {win: "Ctrl-Alt-Up", mac: "Ctrl-Alt-Up"}, + readonly: true +}, { + name: "addCursorBelow", + exec: function(editor) { editor.selectMoreLines(1); }, + bindKey: {win: "Ctrl-Alt-Down", mac: "Ctrl-Alt-Down"}, + readonly: true +}, { + name: "addCursorAboveSkipCurrent", + exec: function(editor) { editor.selectMoreLines(-1, true); }, + bindKey: {win: "Ctrl-Alt-Shift-Up", mac: "Ctrl-Alt-Shift-Up"}, + readonly: true +}, { + name: "addCursorBelowSkipCurrent", + exec: function(editor) { editor.selectMoreLines(1, true); }, + bindKey: {win: "Ctrl-Alt-Shift-Down", mac: "Ctrl-Alt-Shift-Down"}, + readonly: true +}, { + name: "selectMoreBefore", + exec: function(editor) { editor.selectMore(-1); }, + bindKey: {win: "Ctrl-Alt-Left", mac: "Ctrl-Alt-Left"}, + readonly: true +}, { + name: "selectMoreAfter", + exec: function(editor) { editor.selectMore(1); }, + bindKey: {win: "Ctrl-Alt-Right", mac: "Ctrl-Alt-Right"}, + readonly: true +}, { + name: "selectNextBefore", + exec: function(editor) { editor.selectMore(-1, true); }, + bindKey: {win: "Ctrl-Alt-Shift-Left", mac: "Ctrl-Alt-Shift-Left"}, + readonly: true +}, { + name: "selectNextAfter", + exec: function(editor) { editor.selectMore(1, true); }, + bindKey: {win: "Ctrl-Alt-Shift-Right", mac: "Ctrl-Alt-Shift-Right"}, + readonly: true +}, { + name: "splitIntoLines", + exec: function(editor) { editor.multiSelect.splitIntoLines(); }, + bindKey: {win: "Ctrl-Alt-L", mac: "Ctrl-Alt-L"}, + readonly: true +}, { + name: "alignCursors", + exec: function(editor) { editor.alignCursors(); }, + bindKey: {win: "Ctrl-Alt-A", mac: "Ctrl-Alt-A"} +}]; + +// commands active only in multiselect mode +exports.multiSelectCommands = [{ + name: "singleSelection", + bindKey: "esc", + exec: function(editor) { editor.exitMultiSelectMode(); }, + readonly: true, + isAvailable: function(editor) {return editor && editor.inMultiSelectMode} +}]; + +var HashHandler = require("../keyboard/hash_handler").HashHandler; +exports.keyboardHandler = new HashHandler(exports.multiSelectCommands); + +}); diff --git a/addons/editor/ace/commands/occur_commands.js b/addons/editor/ace/commands/occur_commands.js new file mode 100755 index 00000000..b45fbf61 --- /dev/null +++ b/addons/editor/ace/commands/occur_commands.js @@ -0,0 +1,110 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { + +var config = require("../config"), + Occur = require("../occur").Occur; + +// These commands can be installed in a normal command handler to start occur: +var occurStartCommand = { + name: "occur", + exec: function(editor, options) { + var alreadyInOccur = !!editor.session.$occur; + var occurSessionActive = new Occur().enter(editor, options); + if (occurSessionActive && !alreadyInOccur) + OccurKeyboardHandler.installIn(editor); + }, + readOnly: true +}; + +var occurCommands = [{ + name: "occurexit", + bindKey: 'esc|Ctrl-G', + exec: function(editor) { + var occur = editor.session.$occur; + if (!occur) return; + occur.exit(editor, {}); + if (!editor.session.$occur) OccurKeyboardHandler.uninstallFrom(editor); + }, + readOnly: true +}, { + name: "occuraccept", + bindKey: 'enter', + exec: function(editor) { + var occur = editor.session.$occur; + if (!occur) return; + occur.exit(editor, {translatePosition: true}); + if (!editor.session.$occur) OccurKeyboardHandler.uninstallFrom(editor); + }, + readOnly: true +}]; + +var HashHandler = require("../keyboard/hash_handler").HashHandler; +var oop = require("../lib/oop"); + + +function OccurKeyboardHandler() {} + +oop.inherits(OccurKeyboardHandler, HashHandler); + +;(function() { + + this.isOccurHandler = true; + + this.attach = function(editor) { + HashHandler.call(this, occurCommands, editor.commands.platform); + this.$editor = editor; + } + + var handleKeyboard$super = this.handleKeyboard; + this.handleKeyboard = function(data, hashId, key, keyCode) { + var cmd = handleKeyboard$super.call(this, data, hashId, key, keyCode); + return (cmd && cmd.command) ? cmd : undefined; + } + +}).call(OccurKeyboardHandler.prototype); + +OccurKeyboardHandler.installIn = function(editor) { + var handler = new this(); + editor.keyBinding.addKeyboardHandler(handler); + editor.commands.addCommands(occurCommands); +} + +OccurKeyboardHandler.uninstallFrom = function(editor) { + editor.commands.removeCommands(occurCommands); + var handler = editor.getKeyboardHandler(); + if (handler.isOccurHandler) + editor.keyBinding.removeKeyboardHandler(handler); +} + +exports.occurStartCommand = occurStartCommand; + +}); diff --git a/addons/editor/ace/config.js b/addons/editor/ace/config.js new file mode 100755 index 00000000..f8614c1a --- /dev/null +++ b/addons/editor/ace/config.js @@ -0,0 +1,295 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"no use strict"; + +var lang = require("./lib/lang"); +var oop = require("./lib/oop"); +var net = require("./lib/net"); +var EventEmitter = require("./lib/event_emitter").EventEmitter; + +var global = (function() { + return this; +})(); + +var options = { + packaged: false, + workerPath: null, + modePath: null, + themePath: null, + basePath: "", + suffix: ".js", + $moduleUrls: {} +}; + +exports.get = function(key) { + if (!options.hasOwnProperty(key)) + throw new Error("Unknown config key: " + key); + + return options[key]; +}; + +exports.set = function(key, value) { + if (!options.hasOwnProperty(key)) + throw new Error("Unknown config key: " + key); + + options[key] = value; +}; + +exports.all = function() { + return lang.copyObject(options); +}; + +// module loading +oop.implement(exports, EventEmitter); + +exports.moduleUrl = function(name, component) { + if (options.$moduleUrls[name]) + return options.$moduleUrls[name]; + + var parts = name.split("/"); + component = component || parts[parts.length - 2] || ""; + + // todo make this configurable or get rid of '-' + var sep = component == "snippets" ? "/" : "-"; + var base = parts[parts.length - 1]; + if (sep == "-") { + var re = new RegExp("^" + component + "[\\-_]|[\\-_]" + component + "$", "g"); + base = base.replace(re, ""); + } + + if ((!base || base == component) && parts.length > 1) + base = parts[parts.length - 2]; + var path = options[component + "Path"]; + if (path == null) { + path = options.basePath; + } else if (sep == "/") { + component = sep = ""; + } + if (path && path.slice(-1) != "/") + path += "/"; + return path + component + sep + base + this.get("suffix"); +}; + +exports.setModuleUrl = function(name, subst) { + return options.$moduleUrls[name] = subst; +}; + +exports.$loading = {}; +exports.loadModule = function(moduleName, onLoad) { + var module, moduleType; + if (Array.isArray(moduleName)) { + moduleType = moduleName[0]; + moduleName = moduleName[1]; + } + + try { + module = require(moduleName); + } catch (e) {} + // require(moduleName) can return empty object if called after require([moduleName], callback) + if (module && !exports.$loading[moduleName]) + return onLoad && onLoad(module); + + if (!exports.$loading[moduleName]) + exports.$loading[moduleName] = []; + + exports.$loading[moduleName].push(onLoad); + + if (exports.$loading[moduleName].length > 1) + return; + + var afterLoad = function() { + require([moduleName], function(module) { + exports._emit("load.module", {name: moduleName, module: module}); + var listeners = exports.$loading[moduleName]; + exports.$loading[moduleName] = null; + listeners.forEach(function(onLoad) { + onLoad && onLoad(module); + }); + }); + }; + + if (!exports.get("packaged")) + return afterLoad(); + net.loadScript(exports.moduleUrl(moduleName, moduleType), afterLoad); +}; + + +// initialization +exports.init = function() { + options.packaged = require.packaged || module.packaged || (global.define && define.packaged); + + if (!global.document) + return ""; + + var scriptOptions = {}; + var scriptUrl = ""; + + var scripts = document.getElementsByTagName("script"); + for (var i=0; i .ace_gutter-cell { + padding-right: 13px; +} + +.ace_fold-widget { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + + margin: 0 -12px 0 1px; + display: none; + width: 11px; + vertical-align: top; + + background-image: url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%00%05%08%06%00%00%00%8Do%26%E5%00%00%004IDATx%DAe%8A%B1%0D%000%0C%C2%F2%2CK%96%BC%D0%8F9%81%88H%E9%D0%0E%96%C0%10%92%3E%02%80%5E%82%E4%A9*-%EEsw%C8%CC%11%EE%96w%D8%DC%E9*Eh%0C%151(%00%00%00%00IEND%AEB%60%82"); + background-repeat: no-repeat; + background-position: center; + + border-radius: 3px; + + border: 1px solid transparent; + cursor: pointer; +} + +.ace_folding-enabled .ace_fold-widget { + display: inline-block; +} + +.ace_fold-widget.ace_end { + background-image: url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%00%05%08%06%00%00%00%8Do%26%E5%00%00%004IDATx%DAm%C7%C1%09%000%08C%D1%8C%ECE%C8E(%8E%EC%02)%1EZJ%F1%C1'%04%07I%E1%E5%EE%CAL%F5%A2%99%99%22%E2%D6%1FU%B5%FE0%D9x%A7%26Wz5%0E%D5%00%00%00%00IEND%AEB%60%82"); +} + +.ace_fold-widget.ace_closed { + background-image: url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%03%00%00%00%06%08%06%00%00%00%06%E5%24%0C%00%00%009IDATx%DA5%CA%C1%09%000%08%03%C0%AC*(%3E%04%C1%0D%BA%B1%23%A4Uh%E0%20%81%C0%CC%F8%82%81%AA%A2%AArGfr%88%08%11%11%1C%DD%7D%E0%EE%5B%F6%F6%CB%B8%05Q%2F%E9tai%D9%00%00%00%00IEND%AEB%60%82"); +} + +.ace_fold-widget:hover { + border: 1px solid rgba(0, 0, 0, 0.3); + background-color: rgba(255, 255, 255, 0.2); + -moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7); + -webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7); + box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7); +} + +.ace_fold-widget:active { + border: 1px solid rgba(0, 0, 0, 0.4); + background-color: rgba(0, 0, 0, 0.05); + -moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8); + -webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8); + box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8); +} +/** + * Dark version for fold widgets + */ +.ace_dark .ace_fold-widget { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC"); +} +.ace_dark .ace_fold-widget.ace_end { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg=="); +} +.ace_dark .ace_fold-widget.ace_closed { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg=="); +} +.ace_dark .ace_fold-widget:hover { + box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2); + background-color: rgba(255, 255, 255, 0.1); +} +.ace_dark .ace_fold-widget:active { + -moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2); + -webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2); + box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2); +} + +.ace_fold-widget.ace_invalid { + background-color: #FFB4B4; + border-color: #DE5555; +} + +.ace_fade-fold-widgets .ace_fold-widget { + -moz-transition: opacity 0.4s ease 0.05s; + -webkit-transition: opacity 0.4s ease 0.05s; + -o-transition: opacity 0.4s ease 0.05s; + -ms-transition: opacity 0.4s ease 0.05s; + transition: opacity 0.4s ease 0.05s; + opacity: 0; +} + +.ace_fade-fold-widgets:hover .ace_fold-widget { + -moz-transition: opacity 0.05s ease 0.05s; + -webkit-transition: opacity 0.05s ease 0.05s; + -o-transition: opacity 0.05s ease 0.05s; + -ms-transition: opacity 0.05s ease 0.05s; + transition: opacity 0.05s ease 0.05s; + opacity:1; +} + +.ace_underline { + text-decoration: underline; +} + +.ace_bold { + font-weight: bold; +} + +.ace_nobold .ace_bold { + font-weight: normal; +} + +.ace_italic { + font-style: italic; +} + + +.ace_error-marker { + background-color: rgba(255, 0, 0,0.2); + position: absolute; + z-index: 9; +} + +.ace_highlight-marker { + background-color: rgba(255, 255, 0,0.2); + position: absolute; + z-index: 8; +} diff --git a/addons/editor/ace/css/expand-marker.png b/addons/editor/ace/css/expand-marker.png new file mode 100755 index 00000000..535e8192 Binary files /dev/null and b/addons/editor/ace/css/expand-marker.png differ diff --git a/addons/editor/ace/document.js b/addons/editor/ace/document.js new file mode 100755 index 00000000..75a7920d --- /dev/null +++ b/addons/editor/ace/document.js @@ -0,0 +1,642 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var oop = require("./lib/oop"); +var EventEmitter = require("./lib/event_emitter").EventEmitter; +var Range = require("./range").Range; +var Anchor = require("./anchor").Anchor; + +/** + * Contains the text of the document. Document can be attached to several [[EditSession `EditSession`]]s. + * + * At its core, `Document`s are just an array of strings, with each row in the document matching up to the array index. + * + * @class Document + **/ + + /** + * + * Creates a new `Document`. If `text` is included, the `Document` contains those strings; otherwise, it's empty. + * @param {String | Array} text The starting text + * @constructor + **/ + +var Document = function(text) { + this.$lines = []; + + // There has to be one line at least in the document. If you pass an empty + // string to the insert function, nothing will happen. Workaround. + if (text.length == 0) { + this.$lines = [""]; + } else if (Array.isArray(text)) { + this._insertLines(0, text); + } else { + this.insert({row: 0, column:0}, text); + } +}; + +(function() { + + oop.implement(this, EventEmitter); + + /** + * Replaces all the lines in the current `Document` with the value of `text`. + * + * @param {String} text The text to use + **/ + this.setValue = function(text) { + var len = this.getLength(); + this.remove(new Range(0, 0, len, this.getLine(len-1).length)); + this.insert({row: 0, column:0}, text); + }; + + /** + * Returns all the lines in the document as a single string, joined by the new line character. + **/ + this.getValue = function() { + return this.getAllLines().join(this.getNewLineCharacter()); + }; + + /** + * Creates a new `Anchor` to define a floating point in the document. + * @param {Number} row The row number to use + * @param {Number} column The column number to use + * + **/ + this.createAnchor = function(row, column) { + return new Anchor(this, row, column); + }; + + /** + * Splits a string of text on any newline (`\n`) or carriage-return ('\r') characters. + * + * @method $split + * @param {String} text The text to work with + * @returns {String} A String array, with each index containing a piece of the original `text` string. + * + **/ + + // check for IE split bug + if ("aaa".split(/a/).length == 0) + this.$split = function(text) { + return text.replace(/\r\n|\r/g, "\n").split("\n"); + } + else + this.$split = function(text) { + return text.split(/\r\n|\r|\n/); + }; + + + this.$detectNewLine = function(text) { + var match = text.match(/^.*?(\r\n|\r|\n)/m); + this.$autoNewLine = match ? match[1] : "\n"; + }; + + /** + * Returns the newline character that's being used, depending on the value of `newLineMode`. + * @returns {String} If `newLineMode == windows`, `\r\n` is returned. + * If `newLineMode == unix`, `\n` is returned. + * If `newLineMode == auto`, the value of `autoNewLine` is returned. + * + **/ + this.getNewLineCharacter = function() { + switch (this.$newLineMode) { + case "windows": + return "\r\n"; + case "unix": + return "\n"; + default: + return this.$autoNewLine; + } + }; + + this.$autoNewLine = "\n"; + this.$newLineMode = "auto"; + /** + * [Sets the new line mode.]{: #Document.setNewLineMode.desc} + * @param {String} newLineMode [The newline mode to use; can be either `windows`, `unix`, or `auto`]{: #Document.setNewLineMode.param} + * + **/ + this.setNewLineMode = function(newLineMode) { + if (this.$newLineMode === newLineMode) + return; + + this.$newLineMode = newLineMode; + }; + + /** + * [Returns the type of newlines being used; either `windows`, `unix`, or `auto`]{: #Document.getNewLineMode} + * @returns {String} + **/ + this.getNewLineMode = function() { + return this.$newLineMode; + }; + + /** + * Returns `true` if `text` is a newline character (either `\r\n`, `\r`, or `\n`). + * @param {String} text The text to check + * + **/ + this.isNewLine = function(text) { + return (text == "\r\n" || text == "\r" || text == "\n"); + }; + + /** + * Returns a verbatim copy of the given line as it is in the document + * @param {Number} row The row index to retrieve + * + **/ + this.getLine = function(row) { + return this.$lines[row] || ""; + }; + + /** + * Returns an array of strings of the rows between `firstRow` and `lastRow`. This function is inclusive of `lastRow`. + * @param {Number} firstRow The first row index to retrieve + * @param {Number} lastRow The final row index to retrieve + * + **/ + this.getLines = function(firstRow, lastRow) { + return this.$lines.slice(firstRow, lastRow + 1); + }; + + /** + * Returns all lines in the document as string array. + **/ + this.getAllLines = function() { + return this.getLines(0, this.getLength()); + }; + + /** + * Returns the number of rows in the document. + **/ + this.getLength = function() { + return this.$lines.length; + }; + + /** + * [Given a range within the document, this function returns all the text within that range as a single string.]{: #Document.getTextRange.desc} + * @param {Range} range The range to work with + * + * @returns {String} + **/ + this.getTextRange = function(range) { + if (range.start.row == range.end.row) { + return this.getLine(range.start.row) + .substring(range.start.column, range.end.column); + } + var lines = this.getLines(range.start.row, range.end.row); + lines[0] = (lines[0] || "").substring(range.start.column); + var l = lines.length - 1; + if (range.end.row - range.start.row == l) + lines[l] = lines[l].substring(0, range.end.column); + return lines.join(this.getNewLineCharacter()); + }; + + this.$clipPosition = function(position) { + var length = this.getLength(); + if (position.row >= length) { + position.row = Math.max(0, length - 1); + position.column = this.getLine(length-1).length; + } else if (position.row < 0) + position.row = 0; + return position; + }; + + /** + * Inserts a block of `text` at the indicated `position`. + * @param {Object} position The position to start inserting at; it's an object that looks like `{ row: row, column: column}` + * @param {String} text A chunk of text to insert + * @returns {Object} The position ({row, column}) of the last line of `text`. If the length of `text` is 0, this function simply returns `position`. + * + **/ + this.insert = function(position, text) { + if (!text || text.length === 0) + return position; + + position = this.$clipPosition(position); + + // only detect new lines if the document has no line break yet + if (this.getLength() <= 1) + this.$detectNewLine(text); + + var lines = this.$split(text); + var firstLine = lines.splice(0, 1)[0]; + var lastLine = lines.length == 0 ? null : lines.splice(lines.length - 1, 1)[0]; + + position = this.insertInLine(position, firstLine); + if (lastLine !== null) { + position = this.insertNewLine(position); // terminate first line + position = this._insertLines(position.row, lines); + position = this.insertInLine(position, lastLine || ""); + } + return position; + }; + + /** + * Fires whenever the document changes. + * + * Several methods trigger different `"change"` events. Below is a list of each action type, followed by each property that's also available: + * + * * `"insertLines"` (emitted by [[Document.insertLines]]) + * * `range`: the [[Range]] of the change within the document + * * `lines`: the lines in the document that are changing + * * `"insertText"` (emitted by [[Document.insertNewLine]]) + * * `range`: the [[Range]] of the change within the document + * * `text`: the text that's being added + * * `"removeLines"` (emitted by [[Document.insertLines]]) + * * `range`: the [[Range]] of the change within the document + * * `lines`: the lines in the document that were removed + * * `nl`: the new line character (as defined by [[Document.getNewLineCharacter]]) + * * `"removeText"` (emitted by [[Document.removeInLine]] and [[Document.removeNewLine]]) + * * `range`: the [[Range]] of the change within the document + * * `text`: the text that's being removed + * + * @event change + * @param {Object} e Contains at least one property called `"action"`. `"action"` indicates the action that triggered the change. Each action also has a set of additional properties. + * + **/ + /** + * Inserts the elements in `lines` into the document, starting at the row index given by `row`. This method also triggers the `'change'` event. + * @param {Number} row The index of the row to insert at + * @param {Array} lines An array of strings + * @returns {Object} Contains the final row and column, like this: + * ``` + * {row: endRow, column: 0} + * ``` + * If `lines` is empty, this function returns an object containing the current row, and column, like this: + * ``` + * {row: row, column: 0} + * ``` + * + **/ + this.insertLines = function(row, lines) { + if (row >= this.getLength()) + return this.insert({row: row, column: 0}, "\n" + lines.join("\n")); + return this._insertLines(Math.max(row, 0), lines); + }; + this._insertLines = function(row, lines) { + if (lines.length == 0) + return {row: row, column: 0}; + + // apply doesn't work for big arrays (smallest threshold is on safari 0xFFFF) + // to circumvent that we have to break huge inserts into smaller chunks here + if (lines.length > 0xFFFF) { + var end = this._insertLines(row, lines.slice(0xFFFF)); + lines = lines.slice(0, 0xFFFF); + } + + var args = [row, 0]; + args.push.apply(args, lines); + this.$lines.splice.apply(this.$lines, args); + + var range = new Range(row, 0, row + lines.length, 0); + var delta = { + action: "insertLines", + range: range, + lines: lines + }; + this._emit("change", { data: delta }); + return end || range.end; + }; + + /** + * Inserts a new line into the document at the current row's `position`. This method also triggers the `'change'` event. + * @param {Object} position The position to insert at + * @returns {Object} Returns an object containing the final row and column, like this:
+ * ``` + * {row: endRow, column: 0} + * ``` + * + **/ + this.insertNewLine = function(position) { + position = this.$clipPosition(position); + var line = this.$lines[position.row] || ""; + + this.$lines[position.row] = line.substring(0, position.column); + this.$lines.splice(position.row + 1, 0, line.substring(position.column, line.length)); + + var end = { + row : position.row + 1, + column : 0 + }; + + var delta = { + action: "insertText", + range: Range.fromPoints(position, end), + text: this.getNewLineCharacter() + }; + this._emit("change", { data: delta }); + + return end; + }; + + /** + * Inserts `text` into the `position` at the current row. This method also triggers the `'change'` event. + * @param {Object} position The position to insert at; it's an object that looks like `{ row: row, column: column}` + * @param {String} text A chunk of text + * @returns {Object} Returns an object containing the final row and column, like this: + * ``` + * {row: endRow, column: 0} + * ``` + * + **/ + this.insertInLine = function(position, text) { + if (text.length == 0) + return position; + + var line = this.$lines[position.row] || ""; + + this.$lines[position.row] = line.substring(0, position.column) + text + + line.substring(position.column); + + var end = { + row : position.row, + column : position.column + text.length + }; + + var delta = { + action: "insertText", + range: Range.fromPoints(position, end), + text: text + }; + this._emit("change", { data: delta }); + + return end; + }; + + /** + * Removes the `range` from the document. + * @param {Range} range A specified Range to remove + * @returns {Object} Returns the new `start` property of the range, which contains `startRow` and `startColumn`. If `range` is empty, this function returns the unmodified value of `range.start`. + * + **/ + this.remove = function(range) { + if (!range instanceof Range) + range = Range.fromPoints(range.start, range.end); + // clip to document + range.start = this.$clipPosition(range.start); + range.end = this.$clipPosition(range.end); + + if (range.isEmpty()) + return range.start; + + var firstRow = range.start.row; + var lastRow = range.end.row; + + if (range.isMultiLine()) { + var firstFullRow = range.start.column == 0 ? firstRow : firstRow + 1; + var lastFullRow = lastRow - 1; + + if (range.end.column > 0) + this.removeInLine(lastRow, 0, range.end.column); + + if (lastFullRow >= firstFullRow) + this._removeLines(firstFullRow, lastFullRow); + + if (firstFullRow != firstRow) { + this.removeInLine(firstRow, range.start.column, this.getLine(firstRow).length); + this.removeNewLine(range.start.row); + } + } + else { + this.removeInLine(firstRow, range.start.column, range.end.column); + } + return range.start; + }; + + /** + * Removes the specified columns from the `row`. This method also triggers the `'change'` event. + * @param {Number} row The row to remove from + * @param {Number} startColumn The column to start removing at + * @param {Number} endColumn The column to stop removing at + * @returns {Object} Returns an object containing `startRow` and `startColumn`, indicating the new row and column values.
If `startColumn` is equal to `endColumn`, this function returns nothing. + * + **/ + this.removeInLine = function(row, startColumn, endColumn) { + if (startColumn == endColumn) + return; + + var range = new Range(row, startColumn, row, endColumn); + var line = this.getLine(row); + var removed = line.substring(startColumn, endColumn); + var newLine = line.substring(0, startColumn) + line.substring(endColumn, line.length); + this.$lines.splice(row, 1, newLine); + + var delta = { + action: "removeText", + range: range, + text: removed + }; + this._emit("change", { data: delta }); + return range.start; + }; + + /** + * Removes a range of full lines. This method also triggers the `'change'` event. + * @param {Number} firstRow The first row to be removed + * @param {Number} lastRow The last row to be removed + * @returns {[String]} Returns all the removed lines. + * + **/ + this.removeLines = function(firstRow, lastRow) { + if (firstRow < 0 || lastRow >= this.getLength()) + return this.remove(new Range(firstRow, 0, lastRow + 1, 0)); + return this._removeLines(firstRow, lastRow); + }; + + this._removeLines = function(firstRow, lastRow) { + var range = new Range(firstRow, 0, lastRow + 1, 0); + var removed = this.$lines.splice(firstRow, lastRow - firstRow + 1); + + var delta = { + action: "removeLines", + range: range, + nl: this.getNewLineCharacter(), + lines: removed + }; + this._emit("change", { data: delta }); + return removed; + }; + + /** + * Removes the new line between `row` and the row immediately following it. This method also triggers the `'change'` event. + * @param {Number} row The row to check + * + **/ + this.removeNewLine = function(row) { + var firstLine = this.getLine(row); + var secondLine = this.getLine(row+1); + + var range = new Range(row, firstLine.length, row+1, 0); + var line = firstLine + secondLine; + + this.$lines.splice(row, 2, line); + + var delta = { + action: "removeText", + range: range, + text: this.getNewLineCharacter() + }; + this._emit("change", { data: delta }); + }; + + /** + * Replaces a range in the document with the new `text`. + * @param {Range} range A specified Range to replace + * @param {String} text The new text to use as a replacement + * @returns {Object} Returns an object containing the final row and column, like this: + * {row: endRow, column: 0} + * If the text and range are empty, this function returns an object containing the current `range.start` value. + * If the text is the exact same as what currently exists, this function returns an object containing the current `range.end` value. + * + **/ + this.replace = function(range, text) { + if (!range instanceof Range) + range = Range.fromPoints(range.start, range.end); + if (text.length == 0 && range.isEmpty()) + return range.start; + + // Shortcut: If the text we want to insert is the same as it is already + // in the document, we don't have to replace anything. + if (text == this.getTextRange(range)) + return range.end; + + this.remove(range); + if (text) { + var end = this.insert(range.start, text); + } + else { + end = range.start; + } + + return end; + }; + + /** + * Applies all the changes previously accumulated. These can be either `'includeText'`, `'insertLines'`, `'removeText'`, and `'removeLines'`. + **/ + this.applyDeltas = function(deltas) { + for (var i=0; i=0; i--) { + var delta = deltas[i]; + + var range = Range.fromPoints(delta.range.start, delta.range.end); + + if (delta.action == "insertLines") + this._removeLines(range.start.row, range.end.row - 1); + else if (delta.action == "insertText") + this.remove(range); + else if (delta.action == "removeLines") + this._insertLines(range.start.row, delta.lines); + else if (delta.action == "removeText") + this.insert(range.start, delta.text); + } + }; + + /** + * Converts an index position in a document to a `{row, column}` object. + * + * Index refers to the "absolute position" of a character in the document. For example: + * + * ```javascript + * var x = 0; // 10 characters, plus one for newline + * var y = -1; + * ``` + * + * Here, `y` is an index 15: 11 characters for the first row, and 5 characters until `y` in the second. + * + * @param {Number} index An index to convert + * @param {Number} startRow=0 The row from which to start the conversion + * @returns {Object} A `{row, column}` object of the `index` position + */ + this.indexToPosition = function(index, startRow) { + var lines = this.$lines || this.getAllLines(); + var newlineLength = this.getNewLineCharacter().length; + for (var i = startRow || 0, l = lines.length; i < l; i++) { + index -= lines[i].length + newlineLength; + if (index < 0) + return {row: i, column: index + lines[i].length + newlineLength}; + } + return {row: l-1, column: lines[l-1].length}; + }; + + /** + * Converts the `{row, column}` position in a document to the character's index. + * + * Index refers to the "absolute position" of a character in the document. For example: + * + * ```javascript + * var x = 0; // 10 characters, plus one for newline + * var y = -1; + * ``` + * + * Here, `y` is an index 15: 11 characters for the first row, and 5 characters until `y` in the second. + * + * @param {Object} pos The `{row, column}` to convert + * @param {Number} startRow=0 The row from which to start the conversion + * @returns {Number} The index position in the document + */ + this.positionToIndex = function(pos, startRow) { + var lines = this.$lines || this.getAllLines(); + var newlineLength = this.getNewLineCharacter().length; + var index = 0; + var row = Math.min(pos.row, lines.length); + for (var i = startRow || 0; i < row; ++i) + index += lines[i].length + newlineLength; + + return index + pos.column; + }; + +}).call(Document.prototype); + +exports.Document = Document; +}); diff --git a/addons/editor/ace/document_test.js b/addons/editor/ace/document_test.js new file mode 100755 index 00000000..5c324db0 --- /dev/null +++ b/addons/editor/ace/document_test.js @@ -0,0 +1,306 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +if (typeof process !== "undefined") { + require("amd-loader"); + require("./test/mockdom"); +} + +define(function(require, exports, module) { +"use strict"; + +var Document = require("./document").Document; +var Range = require("./range").Range; +var assert = require("./test/assertions"); + +module.exports = { + + "test: insert text in line" : function() { + var doc = new Document(["12", "34"]); + + var deltas = []; + doc.on("change", function(e) { deltas.push(e.data); }); + + doc.insert({row: 0, column: 1}, "juhu"); + assert.equal(doc.getValue(), ["1juhu2", "34"].join("\n")); + + var d = deltas.concat(); + doc.revertDeltas(d); + assert.equal(doc.getValue(), ["12", "34"].join("\n")); + + doc.applyDeltas(d); + assert.equal(doc.getValue(), ["1juhu2", "34"].join("\n")); + }, + + "test: insert new line" : function() { + var doc = new Document(["12", "34"]); + + var deltas = []; + doc.on("change", function(e) { deltas.push(e.data); }); + + doc.insertNewLine({row: 0, column: 1}); + assert.equal(doc.getValue(), ["1", "2", "34"].join("\n")); + + var d = deltas.concat(); + doc.revertDeltas(d); + assert.equal(doc.getValue(), ["12", "34"].join("\n")); + + doc.applyDeltas(d); + assert.equal(doc.getValue(), ["1", "2", "34"].join("\n")); + }, + + "test: insert lines at the beginning" : function() { + var doc = new Document(["12", "34"]); + + var deltas = []; + doc.on("change", function(e) { deltas.push(e.data); }); + + doc.insertLines(0, ["aa", "bb"]); + assert.equal(doc.getValue(), ["aa", "bb", "12", "34"].join("\n")); + + var d = deltas.concat(); + doc.revertDeltas(d); + assert.equal(doc.getValue(), ["12", "34"].join("\n")); + + doc.applyDeltas(d); + assert.equal(doc.getValue(), ["aa", "bb", "12", "34"].join("\n")); + }, + + "test: insert lines at the end" : function() { + var doc = new Document(["12", "34"]); + + var deltas = []; + doc.on("change", function(e) { deltas.push(e.data); }); + + doc.insertLines(2, ["aa", "bb"]); + assert.equal(doc.getValue(), ["12", "34", "aa", "bb"].join("\n")); + }, + + "test: insert lines in the middle" : function() { + var doc = new Document(["12", "34"]); + + var deltas = []; + doc.on("change", function(e) { deltas.push(e.data); }); + + doc.insertLines(1, ["aa", "bb"]); + assert.equal(doc.getValue(), ["12", "aa", "bb", "34"].join("\n")); + + var d = deltas.concat(); + doc.revertDeltas(d); + assert.equal(doc.getValue(), ["12", "34"].join("\n")); + + doc.applyDeltas(d); + assert.equal(doc.getValue(), ["12", "aa", "bb", "34"].join("\n")); + }, + + "test: insert multi line string at the start" : function() { + var doc = new Document(["12", "34"]); + + var deltas = []; + doc.on("change", function(e) { deltas.push(e.data); }); + + doc.insert({row: 0, column: 0}, "aa\nbb\ncc"); + assert.equal(doc.getValue(), ["aa", "bb", "cc12", "34"].join("\n")); + + var d = deltas.concat(); + doc.revertDeltas(d); + assert.equal(doc.getValue(), ["12", "34"].join("\n")); + + doc.applyDeltas(d); + assert.equal(doc.getValue(), ["aa", "bb", "cc12", "34"].join("\n")); + }, + + "test: insert multi line string at the end" : function() { + var doc = new Document(["12", "34"]); + + var deltas = []; + doc.on("change", function(e) { deltas.push(e.data); }); + + doc.insert({row: 2, column: 0}, "aa\nbb\ncc"); + assert.equal(doc.getValue(), ["12", "34aa", "bb", "cc"].join("\n")); + + var d = deltas.concat(); + doc.revertDeltas(d); + assert.equal(doc.getValue(), ["12", "34"].join("\n")); + + doc.applyDeltas(d); + assert.equal(doc.getValue(), ["12", "34aa", "bb", "cc"].join("\n")); + }, + + "test: insert multi line string in the middle" : function() { + var doc = new Document(["12", "34"]); + + var deltas = []; + doc.on("change", function(e) { deltas.push(e.data); }); + + doc.insert({row: 0, column: 1}, "aa\nbb\ncc"); + assert.equal(doc.getValue(), ["1aa", "bb", "cc2", "34"].join("\n")); + + var d = deltas.concat(); + doc.revertDeltas(d); + assert.equal(doc.getValue(), ["12", "34"].join("\n")); + + doc.applyDeltas(d); + assert.equal(doc.getValue(), ["1aa", "bb", "cc2", "34"].join("\n")); + }, + + "test: delete in line" : function() { + var doc = new Document(["1234", "5678"]); + + var deltas = []; + doc.on("change", function(e) { deltas.push(e.data); }); + + doc.remove(new Range(0, 1, 0, 3)); + assert.equal(doc.getValue(), ["14", "5678"].join("\n")); + + var d = deltas.concat(); + doc.revertDeltas(d); + assert.equal(doc.getValue(), ["1234", "5678"].join("\n")); + + doc.applyDeltas(d); + assert.equal(doc.getValue(), ["14", "5678"].join("\n")); + }, + + "test: delete new line" : function() { + var doc = new Document(["1234", "5678"]); + + var deltas = []; + doc.on("change", function(e) { deltas.push(e.data); }); + + doc.remove(new Range(0, 4, 1, 0)); + assert.equal(doc.getValue(), ["12345678"].join("\n")); + + var d = deltas.concat(); + doc.revertDeltas(d); + assert.equal(doc.getValue(), ["1234", "5678"].join("\n")); + + doc.applyDeltas(d); + assert.equal(doc.getValue(), ["12345678"].join("\n")); + }, + + "test: delete multi line range line" : function() { + var doc = new Document(["1234", "5678", "abcd"]); + + var deltas = []; + doc.on("change", function(e) { deltas.push(e.data); }); + + doc.remove(new Range(0, 2, 2, 2)); + assert.equal(doc.getValue(), ["12cd"].join("\n")); + + var d = deltas.concat(); + doc.revertDeltas(d); + assert.equal(doc.getValue(), ["1234", "5678", "abcd"].join("\n")); + + doc.applyDeltas(d); + assert.equal(doc.getValue(), ["12cd"].join("\n")); + }, + + "test: delete full lines" : function() { + var doc = new Document(["1234", "5678", "abcd"]); + + var deltas = []; + doc.on("change", function(e) { deltas.push(e.data); }); + + doc.remove(new Range(1, 0, 3, 0)); + assert.equal(doc.getValue(), ["1234", ""].join("\n")); + }, + + "test: remove lines should return the removed lines" : function() { + var doc = new Document(["1234", "5678", "abcd"]); + + var removed = doc.removeLines(1, 2); + assert.equal(removed.join("\n"), ["5678", "abcd"].join("\n")); + }, + + "test: should handle unix style new lines" : function() { + var doc = new Document(["1", "2", "3"]); + assert.equal(doc.getValue(), ["1", "2", "3"].join("\n")); + }, + + "test: should handle windows style new lines" : function() { + var doc = new Document(["1", "2", "3"].join("\r\n")); + + doc.setNewLineMode("unix"); + assert.equal(doc.getValue(), ["1", "2", "3"].join("\n")); + }, + + "test: set new line mode to 'windows' should use '\\r\\n' as new lines": function() { + var doc = new Document(["1", "2", "3"].join("\n")); + doc.setNewLineMode("windows"); + assert.equal(doc.getValue(), ["1", "2", "3"].join("\r\n")); + }, + + "test: set new line mode to 'unix' should use '\\n' as new lines": function() { + var doc = new Document(["1", "2", "3"].join("\r\n")); + + doc.setNewLineMode("unix"); + assert.equal(doc.getValue(), ["1", "2", "3"].join("\n")); + }, + + "test: set new line mode to 'auto' should detect the incoming nl type": function() { + var doc = new Document(["1", "2", "3"].join("\n")); + + doc.setNewLineMode("auto"); + assert.equal(doc.getValue(), ["1", "2", "3"].join("\n")); + + var doc = new Document(["1", "2", "3"].join("\r\n")); + + doc.setNewLineMode("auto"); + assert.equal(doc.getValue(), ["1", "2", "3"].join("\r\n")); + + doc.replace(new Range(0, 0, 2, 1), ["4", "5", "6"].join("\n")); + assert.equal(["4", "5", "6"].join("\n"), doc.getValue()); + }, + + "test: set value": function() { + var doc = new Document("1"); + assert.equal("1", doc.getValue()); + + doc.setValue(doc.getValue()); + assert.equal("1", doc.getValue()); + + var doc = new Document("1\n2"); + assert.equal("1\n2", doc.getValue()); + + doc.setValue(doc.getValue()); + assert.equal("1\n2", doc.getValue()); + }, + + "test: empty document has to contain one line": function() { + var doc = new Document(""); + assert.equal(doc.$lines.length, 1); + } +}; + +}); + +if (typeof module !== "undefined" && module === require.main) { + require("asyncjs").test.testcase(module.exports).exec() +} diff --git a/addons/editor/ace/edit_session.js b/addons/editor/ace/edit_session.js new file mode 100755 index 00000000..98c1e940 --- /dev/null +++ b/addons/editor/ace/edit_session.js @@ -0,0 +1,2505 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var oop = require("./lib/oop"); +var lang = require("./lib/lang"); +var config = require("./config"); +var EventEmitter = require("./lib/event_emitter").EventEmitter; +var Selection = require("./selection").Selection; +var TextMode = require("./mode/text").Mode; +var Range = require("./range").Range; +var Document = require("./document").Document; +var BackgroundTokenizer = require("./background_tokenizer").BackgroundTokenizer; +var SearchHighlight = require("./search_highlight").SearchHighlight; + +/** + * Stores all the data about [[Editor `Editor`]] state providing easy way to change editors state. + * + * `EditSession` can be attached to only one [[Document `Document`]]. Same `Document` can be attached to several `EditSession`s. + * @class EditSession + **/ + +//{ events +/** + * + * Emitted when the document changes. + * @event change + * @param {Object} e An object containing a `delta` of information about the change. + **/ +/** + * Emitted when the tab size changes, via [[EditSession.setTabSize]]. + * + * @event changeTabSize + **/ +/** + * Emitted when the ability to overwrite text changes, via [[EditSession.setOverwrite]]. + * + * @event changeOverwrite + **/ +/** + * Emitted when the gutter changes, either by setting or removing breakpoints, or when the gutter decorations change. + * + * @event changeBreakpoint + **/ +/** + * Emitted when a front marker changes. + * + * @event changeFrontMarker + **/ +/** + * Emitted when a back marker changes. + * + * @event changeBackMarker + **/ +/** + * Emitted when an annotation changes, like through [[EditSession.setAnnotations]]. + * + * @event changeAnnotation + **/ +/** + * Emitted when a background tokenizer asynchronously processes new rows. + * @event tokenizerUpdate + * + * @param {Object} e An object containing one property, `"data"`, that contains information about the changing rows + * + **/ +/** + * Emitted when the current mode changes. + * + * @event changeMode + * + **/ +/** + * Emitted when the wrap mode changes. + * + * @event changeWrapMode + * + **/ +/** + * Emitted when the wrapping limit changes. + * + * @event changeWrapLimit + * + **/ +/** + * Emitted when a code fold is added or removed. + * + * @event changeFold + * + **/ + /** + * Emitted when the scroll top changes. + * @event changeScrollTop + * + * @param {Number} scrollTop The new scroll top value + **/ +/** + * Emitted when the scroll left changes. + * @event changeScrollLeft + * + * @param {Number} scrollLeft The new scroll left value + **/ +//} + +/** + * + * Sets up a new `EditSession` and associates it with the given `Document` and `TextMode`. + * @param {Document | String} text [If `text` is a `Document`, it associates the `EditSession` with it. Otherwise, a new `Document` is created, with the initial text]{: #textParam} + * @param {TextMode} mode [The inital language mode to use for the document]{: #modeParam} + * + * @constructor + **/ + +var EditSession = function(text, mode) { + this.$breakpoints = []; + this.$decorations = []; + this.$frontMarkers = {}; + this.$backMarkers = {}; + this.$markerId = 1; + this.$undoSelect = true; + + this.$foldData = []; + this.$foldData.toString = function() { + return this.join("\n"); + } + this.on("changeFold", this.onChangeFold.bind(this)); + this.$onChange = this.onChange.bind(this); + + if (typeof text != "object" || !text.getLine) + text = new Document(text); + + this.setDocument(text); + this.selection = new Selection(this); + + config.resetOptions(this); + this.setMode(mode); + config._emit("session", this); +}; + + +(function() { + + oop.implement(this, EventEmitter); + + /** + * Sets the `EditSession` to point to a new `Document`. If a `BackgroundTokenizer` exists, it also points to `doc`. + * + * @param {Document} doc The new `Document` to use + * + **/ + this.setDocument = function(doc) { + if (this.doc) + this.doc.removeListener("change", this.$onChange); + + this.doc = doc; + doc.on("change", this.$onChange); + + if (this.bgTokenizer) + this.bgTokenizer.setDocument(this.getDocument()); + + this.resetCaches(); + }; + + /** + * Returns the `Document` associated with this session. + * @return {Document} + **/ + this.getDocument = function() { + return this.doc; + }; + + /** + * @param {Number} row The row to work with + * + **/ + this.$resetRowCache = function(docRow) { + if (!docRow) { + this.$docRowCache = []; + this.$screenRowCache = []; + return; + } + var l = this.$docRowCache.length; + var i = this.$getRowCacheIndex(this.$docRowCache, docRow) + 1; + if (l > i) { + this.$docRowCache.splice(i, l); + this.$screenRowCache.splice(i, l); + } + }; + + this.$getRowCacheIndex = function(cacheArray, val) { + var low = 0; + var hi = cacheArray.length - 1; + + while (low <= hi) { + var mid = (low + hi) >> 1; + var c = cacheArray[mid]; + + if (val > c) + low = mid + 1; + else if (val < c) + hi = mid - 1; + else + return mid; + } + + return low -1; + }; + + this.resetCaches = function() { + this.$modified = true; + this.$wrapData = []; + this.$rowLengthCache = []; + this.$resetRowCache(0); + if (this.bgTokenizer) + this.bgTokenizer.start(0); + }; + + this.onChangeFold = function(e) { + var fold = e.data; + this.$resetRowCache(fold.start.row); + }; + + this.onChange = function(e) { + var delta = e.data; + this.$modified = true; + + this.$resetRowCache(delta.range.start.row); + + var removedFolds = this.$updateInternalDataOnChange(e); + if (!this.$fromUndo && this.$undoManager && !delta.ignore) { + this.$deltasDoc.push(delta); + if (removedFolds && removedFolds.length != 0) { + this.$deltasFold.push({ + action: "removeFolds", + folds: removedFolds + }); + } + + this.$informUndoManager.schedule(); + } + + this.bgTokenizer.$updateOnChange(delta); + this._emit("change", e); + }; + + /** + * Sets the session text. + * @param {String} text The new text to place + * + * + * + **/ + this.setValue = function(text) { + this.doc.setValue(text); + this.selection.moveCursorTo(0, 0); + this.selection.clearSelection(); + + this.$resetRowCache(0); + this.$deltas = []; + this.$deltasDoc = []; + this.$deltasFold = []; + this.getUndoManager().reset(); + }; + + /** + * Returns the current [[Document `Document`]] as a string. + * @method toString + * @returns {String} + * @alias EditSession.getValue + * + **/ + + /** + * Returns the current [[Document `Document`]] as a string. + * @method getValue + * @returns {String} + * @alias EditSession.toString + **/ + this.getValue = + this.toString = function() { + return this.doc.getValue(); + }; + + /** + * Returns the string of the current selection. + **/ + this.getSelection = function() { + return this.selection; + }; + + /** + * {:BackgroundTokenizer.getState} + * @param {Number} row The row to start at + * + * @related BackgroundTokenizer.getState + **/ + this.getState = function(row) { + return this.bgTokenizer.getState(row); + }; + + /** + * Starts tokenizing at the row indicated. Returns a list of objects of the tokenized rows. + * @param {Number} row The row to start at + * + * + * + **/ + this.getTokens = function(row) { + return this.bgTokenizer.getTokens(row); + }; + + /** + * Returns an object indicating the token at the current row. The object has two properties: `index` and `start`. + * @param {Number} row The row number to retrieve from + * @param {Number} column The column number to retrieve from + * + * + **/ + this.getTokenAt = function(row, column) { + var tokens = this.bgTokenizer.getTokens(row); + var token, c = 0; + if (column == null) { + i = tokens.length - 1; + c = this.getLine(row).length; + } else { + for (var i = 0; i < tokens.length; i++) { + c += tokens[i].value.length; + if (c >= column) + break; + } + } + token = tokens[i]; + if (!token) + return null; + token.index = i; + token.start = c - token.value.length; + return token; + }; + + /** + * Sets the undo manager. + * @param {UndoManager} undoManager The new undo manager + * + * + **/ + this.setUndoManager = function(undoManager) { + this.$undoManager = undoManager; + this.$deltas = []; + this.$deltasDoc = []; + this.$deltasFold = []; + + if (this.$informUndoManager) + this.$informUndoManager.cancel(); + + if (undoManager) { + var self = this; + + this.$syncInformUndoManager = function() { + self.$informUndoManager.cancel(); + + if (self.$deltasFold.length) { + self.$deltas.push({ + group: "fold", + deltas: self.$deltasFold + }); + self.$deltasFold = []; + } + + if (self.$deltasDoc.length) { + self.$deltas.push({ + group: "doc", + deltas: self.$deltasDoc + }); + self.$deltasDoc = []; + } + + if (self.$deltas.length > 0) { + undoManager.execute({ + action: "aceupdate", + args: [self.$deltas, self], + merge: self.mergeUndoDeltas + }); + } + self.mergeUndoDeltas = false; + self.$deltas = []; + } + this.$informUndoManager = lang.delayedCall(this.$syncInformUndoManager); + } + }; + + /** + * starts a new group in undo history + **/ + this.markUndoGroup = function() { + if (this.$syncInformUndoManager) + this.$syncInformUndoManager(); + }; + + this.$defaultUndoManager = { + undo: function() {}, + redo: function() {}, + reset: function() {} + }; + + /** + * Returns the current undo manager. + **/ + this.getUndoManager = function() { + return this.$undoManager || this.$defaultUndoManager; + }; + + /** + * Returns the current value for tabs. If the user is using soft tabs, this will be a series of spaces (defined by [[EditSession.getTabSize `getTabSize()`]]); otherwise it's simply `'\t'`. + **/ + this.getTabString = function() { + if (this.getUseSoftTabs()) { + return lang.stringRepeat(" ", this.getTabSize()); + } else { + return "\t"; + } + }; + + /** + /** + * Pass `true` to enable the use of soft tabs. Soft tabs means you're using spaces instead of the tab character (`'\t'`). + * @param {Boolean} useSoftTabs Value indicating whether or not to use soft tabs + **/ + this.setUseSoftTabs = function(val) { + this.setOption("useSoftTabs", val); + }; + /** + * Returns `true` if soft tabs are being used, `false` otherwise. + * @returns {Boolean} + **/ + this.getUseSoftTabs = function() { + // todo might need more general way for changing settings from mode, but this is ok for now + return this.$useSoftTabs && !this.$mode.$indentWithTabs; + }; + /** + * Set the number of spaces that define a soft tab; for example, passing in `4` transforms the soft tabs to be equivalent to four spaces. This function also emits the `changeTabSize` event. + * @param {Number} tabSize The new tab size + **/ + this.setTabSize = function(tabSize) { + this.setOption("tabSize", tabSize) + }; + /** + * Returns the current tab size. + **/ + this.getTabSize = function() { + return this.$tabSize; + }; + + /** + * Returns `true` if the character at the position is a soft tab. + * @param {Object} position The position to check + * + * + **/ + this.isTabStop = function(position) { + return this.$useSoftTabs && (position.column % this.$tabSize == 0); + }; + + this.$overwrite = false; + /** + * Pass in `true` to enable overwrites in your session, or `false` to disable. + * + * If overwrites is enabled, any text you enter will type over any text after it. If the value of `overwrite` changes, this function also emites the `changeOverwrite` event. + * + * @param {Boolean} overwrite Defines wheter or not to set overwrites + * + * + **/ + this.setOverwrite = function(overwrite) { + this.setOption("overwrite", overwrite) + }; + + /** + * Returns `true` if overwrites are enabled; `false` otherwise. + **/ + this.getOverwrite = function() { + return this.$overwrite; + }; + + /** + * Sets the value of overwrite to the opposite of whatever it currently is. + **/ + this.toggleOverwrite = function() { + this.setOverwrite(!this.$overwrite); + }; + + /** + * Adds `className` to the `row`, to be used for CSS stylings and whatnot. + * @param {Number} row The row number + * @param {String} className The class to add + * + * + **/ + this.addGutterDecoration = function(row, className) { + if (!this.$decorations[row]) + this.$decorations[row] = ""; + this.$decorations[row] += " " + className; + this._emit("changeBreakpoint", {}); + }; + + /** + * Removes `className` from the `row`. + * @param {Number} row The row number + * @param {String} className The class to add + * + * + **/ + this.removeGutterDecoration = function(row, className) { + this.$decorations[row] = (this.$decorations[row] || "").replace(" " + className, ""); + this._emit("changeBreakpoint", {}); + }; + + /** + * Returns an array of numbers, indicating which rows have breakpoints. + * @returns {[Number]} + **/ + this.getBreakpoints = function() { + return this.$breakpoints; + }; + + /** + * Sets a breakpoint on every row number given by `rows`. This function also emites the `'changeBreakpoint'` event. + * @param {Array} rows An array of row indices + * + * + * + **/ + this.setBreakpoints = function(rows) { + this.$breakpoints = []; + for (var i=0; i 0) + inToken = !!line.charAt(column - 1).match(this.tokenRe); + + if (!inToken) + inToken = !!line.charAt(column).match(this.tokenRe); + + if (inToken) + var re = this.tokenRe; + else if (/^\s+$/.test(line.slice(column-1, column+1))) + var re = /\s/; + else + var re = this.nonTokenRe; + + var start = column; + if (start > 0) { + do { + start--; + } + while (start >= 0 && line.charAt(start).match(re)); + start++; + } + + var end = column; + while (end < line.length && line.charAt(end).match(re)) { + end++; + } + + return new Range(row, start, row, end); + }; + + /** + * Gets the range of a word, including its right whitespace. + * @param {Number} row The row number to start from + * @param {Number} column The column number to start from + * + * @return {Range} + **/ + this.getAWordRange = function(row, column) { + var wordRange = this.getWordRange(row, column); + var line = this.getLine(wordRange.end.row); + + while (line.charAt(wordRange.end.column).match(/[ \t]/)) { + wordRange.end.column += 1; + } + return wordRange; + }; + + /** + * {:Document.setNewLineMode.desc} + * @param {String} newLineMode {:Document.setNewLineMode.param} + * + * + * @related Document.setNewLineMode + **/ + this.setNewLineMode = function(newLineMode) { + this.doc.setNewLineMode(newLineMode); + }; + + /** + * + * Returns the current new line mode. + * @returns {String} + * @related Document.getNewLineMode + **/ + this.getNewLineMode = function() { + return this.doc.getNewLineMode(); + }; + + /** + * Identifies if you want to use a worker for the `EditSession`. + * @param {Boolean} useWorker Set to `true` to use a worker + * + **/ + this.setUseWorker = function(useWorker) { this.setOption("useWorker", useWorker); }; + + /** + * Returns `true` if workers are being used. + **/ + this.getUseWorker = function() { return this.$useWorker; }; + + /** + * Reloads all the tokens on the current session. This function calls [[BackgroundTokenizer.start `BackgroundTokenizer.start ()`]] to all the rows; it also emits the `'tokenizerUpdate'` event. + **/ + this.onReloadTokenizer = function(e) { + var rows = e.data; + this.bgTokenizer.start(rows.first); + this._emit("tokenizerUpdate", e); + }; + + this.$modes = {}; + + /** + * Sets a new text mode for the `EditSession`. This method also emits the `'changeMode'` event. If a [[BackgroundTokenizer `BackgroundTokenizer`]] is set, the `'tokenizerUpdate'` event is also emitted. + * @param {TextMode} mode Set a new text mode + * @param {cb} optional callback + * + **/ + this.$mode = null; + this.$modeId = null; + this.setMode = function(mode, cb) { + if (mode && typeof mode === "object") { + if (mode.getTokenizer) + return this.$onChangeMode(mode); + var options = mode; + var path = options.path; + } else { + path = mode || "ace/mode/text"; + } + + // this is needed if ace isn't on require path (e.g tests in node) + if (!this.$modes["ace/mode/text"]) + this.$modes["ace/mode/text"] = new TextMode(); + + if (this.$modes[path] && !options) { + this.$onChangeMode(this.$modes[path]); + cb && cb(); + return; + } + // load on demand + this.$modeId = path; + config.loadModule(["mode", path], function(m) { + if (this.$modeId !== path) + return cb && cb(); + if (this.$modes[path] && !options) + return this.$onChangeMode(this.$modes[path]); + if (m && m.Mode) { + m = new m.Mode(options); + if (!options) { + this.$modes[path] = m; + m.$id = path; + } + this.$onChangeMode(m); + cb && cb(); + } + }.bind(this)); + + // set mode to text until loading is finished + if (!this.$mode) + this.$onChangeMode(this.$modes["ace/mode/text"], true); + }; + + this.$onChangeMode = function(mode, $isPlaceholder) { + if (!$isPlaceholder) + this.$modeId = mode.$id; + if (this.$mode === mode) + return; + + this.$mode = mode; + + this.$stopWorker(); + + if (this.$useWorker) + this.$startWorker(); + + var tokenizer = mode.getTokenizer(); + + if(tokenizer.addEventListener !== undefined) { + var onReloadTokenizer = this.onReloadTokenizer.bind(this); + tokenizer.addEventListener("update", onReloadTokenizer); + } + + if (!this.bgTokenizer) { + this.bgTokenizer = new BackgroundTokenizer(tokenizer); + var _self = this; + this.bgTokenizer.addEventListener("update", function(e) { + _self._emit("tokenizerUpdate", e); + }); + } else { + this.bgTokenizer.setTokenizer(tokenizer); + } + + this.bgTokenizer.setDocument(this.getDocument()); + + this.tokenRe = mode.tokenRe; + this.nonTokenRe = mode.nonTokenRe; + + this.$options.wrapMethod.set.call(this, this.$wrapMethod); + + if (!$isPlaceholder) { + this.$setFolding(mode.foldingRules); + this._emit("changeMode"); + this.bgTokenizer.start(0); + } + }; + + + this.$stopWorker = function() { + if (this.$worker) + this.$worker.terminate(); + + this.$worker = null; + }; + + this.$startWorker = function() { + if (typeof Worker !== "undefined" && !require.noWorker) { + try { + this.$worker = this.$mode.createWorker(this); + } catch (e) { + console.log("Could not load worker"); + console.log(e); + this.$worker = null; + } + } + else + this.$worker = null; + }; + + /** + * Returns the current text mode. + * @returns {TextMode} The current text mode + **/ + this.getMode = function() { + return this.$mode; + }; + + this.$scrollTop = 0; + /** + * This function sets the scroll top value. It also emits the `'changeScrollTop'` event. + * @param {Number} scrollTop The new scroll top value + * + **/ + this.setScrollTop = function(scrollTop) { + // TODO: should we force integer lineheight instead? scrollTop = Math.round(scrollTop); + if (this.$scrollTop === scrollTop || isNaN(scrollTop)) + return; + + this.$scrollTop = scrollTop; + this._signal("changeScrollTop", scrollTop); + }; + + /** + * [Returns the value of the distance between the top of the editor and the topmost part of the visible content.]{: #EditSession.getScrollTop} + * @returns {Number} + **/ + this.getScrollTop = function() { + return this.$scrollTop; + }; + + this.$scrollLeft = 0; + /** + * [Sets the value of the distance between the left of the editor and the leftmost part of the visible content.]{: #EditSession.setScrollLeft} + **/ + this.setScrollLeft = function(scrollLeft) { + // scrollLeft = Math.round(scrollLeft); + if (this.$scrollLeft === scrollLeft || isNaN(scrollLeft)) + return; + + this.$scrollLeft = scrollLeft; + this._signal("changeScrollLeft", scrollLeft); + }; + + /** + * [Returns the value of the distance between the left of the editor and the leftmost part of the visible content.]{: #EditSession.getScrollLeft} + * @returns {Number} + **/ + this.getScrollLeft = function() { + return this.$scrollLeft; + }; + + /** + * Returns the width of the screen. + * @returns {Number} + **/ + this.getScreenWidth = function() { + this.$computeWidth(); + return this.screenWidth; + }; + + this.$computeWidth = function(force) { + if (this.$modified || force) { + this.$modified = false; + + if (this.$useWrapMode) + return this.screenWidth = this.$wrapLimit; + + var lines = this.doc.getAllLines(); + var cache = this.$rowLengthCache; + var longestScreenLine = 0; + var foldIndex = 0; + var foldLine = this.$foldData[foldIndex]; + var foldStart = foldLine ? foldLine.start.row : Infinity; + var len = lines.length; + + for (var i = 0; i < len; i++) { + if (i > foldStart) { + i = foldLine.end.row + 1; + if (i >= len) + break; + foldLine = this.$foldData[foldIndex++]; + foldStart = foldLine ? foldLine.start.row : Infinity; + } + + if (cache[i] == null) + cache[i] = this.$getStringScreenWidth(lines[i])[0]; + + if (cache[i] > longestScreenLine) + longestScreenLine = cache[i]; + } + this.screenWidth = longestScreenLine; + } + }; + + /** + * Returns a verbatim copy of the given line as it is in the document + * @param {Number} row The row to retrieve from + * + * + * @returns {String} + * + **/ + this.getLine = function(row) { + return this.doc.getLine(row); + }; + + /** + * Returns an array of strings of the rows between `firstRow` and `lastRow`. This function is inclusive of `lastRow`. + * @param {Number} firstRow The first row index to retrieve + * @param {Number} lastRow The final row index to retrieve + * + * @returns {[String]} + * + **/ + this.getLines = function(firstRow, lastRow) { + return this.doc.getLines(firstRow, lastRow); + }; + + /** + * Returns the number of rows in the document. + * @returns {Number} + **/ + this.getLength = function() { + return this.doc.getLength(); + }; + + /** + * {:Document.getTextRange.desc} + * @param {Range} range The range to work with + * + * @returns {String} + **/ + this.getTextRange = function(range) { + return this.doc.getTextRange(range || this.selection.getRange()); + }; + + /** + * Inserts a block of `text` and the indicated `position`. + * @param {Object} position The position {row, column} to start inserting at + * @param {String} text A chunk of text to insert + * @returns {Object} The position of the last line of `text`. If the length of `text` is 0, this function simply returns `position`. + * + * + **/ + this.insert = function(position, text) { + return this.doc.insert(position, text); + }; + + /** + * Removes the `range` from the document. + * @param {Range} range A specified Range to remove + * @returns {Object} The new `start` property of the range, which contains `startRow` and `startColumn`. If `range` is empty, this function returns the unmodified value of `range.start`. + * + * @related Document.remove + * + **/ + this.remove = function(range) { + return this.doc.remove(range); + }; + + /** + * Reverts previous changes to your document. + * @param {Array} deltas An array of previous changes + * @param {Boolean} dontSelect [If `true`, doesn't select the range of where the change occured]{: #dontSelect} + * + * + * @returns {Range} + **/ + this.undoChanges = function(deltas, dontSelect) { + if (!deltas.length) + return; + + this.$fromUndo = true; + var lastUndoRange = null; + for (var i = deltas.length - 1; i != -1; i--) { + var delta = deltas[i]; + if (delta.group == "doc") { + this.doc.revertDeltas(delta.deltas); + lastUndoRange = + this.$getUndoSelection(delta.deltas, true, lastUndoRange); + } else { + delta.deltas.forEach(function(foldDelta) { + this.addFolds(foldDelta.folds); + }, this); + } + } + this.$fromUndo = false; + lastUndoRange && + this.$undoSelect && + !dontSelect && + this.selection.setSelectionRange(lastUndoRange); + return lastUndoRange; + }; + + /** + * Re-implements a previously undone change to your document. + * @param {Array} deltas An array of previous changes + * @param {Boolean} dontSelect {:dontSelect} + * + * + * @returns {Range} + **/ + this.redoChanges = function(deltas, dontSelect) { + if (!deltas.length) + return; + + this.$fromUndo = true; + var lastUndoRange = null; + for (var i = 0; i < deltas.length; i++) { + var delta = deltas[i]; + if (delta.group == "doc") { + this.doc.applyDeltas(delta.deltas); + lastUndoRange = + this.$getUndoSelection(delta.deltas, false, lastUndoRange); + } + } + this.$fromUndo = false; + lastUndoRange && + this.$undoSelect && + !dontSelect && + this.selection.setSelectionRange(lastUndoRange); + return lastUndoRange; + }; + + /** + * Enables or disables highlighting of the range where an undo occured. + * @param {Boolean} enable If `true`, selects the range of the reinserted change + * + **/ + this.setUndoSelect = function(enable) { + this.$undoSelect = enable; + }; + + this.$getUndoSelection = function(deltas, isUndo, lastUndoRange) { + function isInsert(delta) { + var insert = + delta.action === "insertText" || delta.action === "insertLines"; + return isUndo ? !insert : insert; + } + + var delta = deltas[0]; + var range, point; + var lastDeltaIsInsert = false; + if (isInsert(delta)) { + range = Range.fromPoints(delta.range.start, delta.range.end); + lastDeltaIsInsert = true; + } else { + range = Range.fromPoints(delta.range.start, delta.range.start); + lastDeltaIsInsert = false; + } + + for (var i = 1; i < deltas.length; i++) { + delta = deltas[i]; + if (isInsert(delta)) { + point = delta.range.start; + if (range.compare(point.row, point.column) == -1) { + range.setStart(delta.range.start); + } + point = delta.range.end; + if (range.compare(point.row, point.column) == 1) { + range.setEnd(delta.range.end); + } + lastDeltaIsInsert = true; + } else { + point = delta.range.start; + if (range.compare(point.row, point.column) == -1) { + range = + Range.fromPoints(delta.range.start, delta.range.start); + } + lastDeltaIsInsert = false; + } + } + + // Check if this range and the last undo range has something in common. + // If true, merge the ranges. + if (lastUndoRange != null) { + if (Range.comparePoints(lastUndoRange.start, range.start) == 0) { + lastUndoRange.start.column += range.end.column - range.start.column; + lastUndoRange.end.column += range.end.column - range.start.column; + } + + var cmp = lastUndoRange.compareRange(range); + if (cmp == 1) { + range.setStart(lastUndoRange.start); + } else if (cmp == -1) { + range.setEnd(lastUndoRange.end); + } + } + + return range; + }; + + /** + * Replaces a range in the document with the new `text`. + * + * @param {Range} range A specified Range to replace + * @param {String} text The new text to use as a replacement + * @returns {Object} An object containing the final row and column, like this: + * ``` + * {row: endRow, column: 0} + * ``` + * If the text and range are empty, this function returns an object containing the current `range.start` value. + * If the text is the exact same as what currently exists, this function returns an object containing the current `range.end` value. + * + * + * + * @related Document.replace + * + * + **/ + this.replace = function(range, text) { + return this.doc.replace(range, text); + }; + + /** + * Moves a range of text from the given range to the given position. `toPosition` is an object that looks like this: + * ```json + * { row: newRowLocation, column: newColumnLocation } + * ``` + * @param {Range} fromRange The range of text you want moved within the document + * @param {Object} toPosition The location (row and column) where you want to move the text to + * @returns {Range} The new range where the text was moved to. + * + * + * + **/ + this.moveText = function(fromRange, toPosition, copy) { + var text = this.getTextRange(fromRange); + var folds = this.getFoldsInRange(fromRange); + + var toRange = Range.fromPoints(toPosition, toPosition); + if (!copy) { + this.remove(fromRange); + var rowDiff = fromRange.start.row - fromRange.end.row; + var collDiff = rowDiff ? -fromRange.end.column : fromRange.start.column - fromRange.end.column; + if (collDiff) { + if (toRange.start.row == fromRange.end.row && toRange.start.column > fromRange.end.column) + toRange.start.column += collDiff; + if (toRange.end.row == fromRange.end.row && toRange.end.column > fromRange.end.column) + toRange.end.column += collDiff; + } + if (rowDiff && toRange.start.row >= fromRange.end.row) { + toRange.start.row += rowDiff; + toRange.end.row += rowDiff; + } + } + + toRange.end = this.insert(toRange.start, text); + if (folds.length) { + var oldStart = fromRange.start; + var newStart = toRange.start; + var rowDiff = newStart.row - oldStart.row; + var collDiff = newStart.column - oldStart.column; + this.addFolds(folds.map(function(x) { + x = x.clone(); + if (x.start.row == oldStart.row) + x.start.column += collDiff; + if (x.end.row == oldStart.row) + x.end.column += collDiff; + x.start.row += rowDiff; + x.end.row += rowDiff; + return x; + })); + } + + return toRange; + }; + + /** + * Indents all the rows, from `startRow` to `endRow` (inclusive), by prefixing each row with the token in `indentString`. + * + * If `indentString` contains the `'\t'` character, it's replaced by whatever is defined by [[EditSession.getTabString `getTabString()`]]. + * @param {Number} startRow Starting row + * @param {Number} endRow Ending row + * @param {String} indentString The indent token + * + * + **/ + this.indentRows = function(startRow, endRow, indentString) { + indentString = indentString.replace(/\t/g, this.getTabString()); + for (var row=startRow; row<=endRow; row++) + this.insert({row: row, column:0}, indentString); + }; + + /** + * Outdents all the rows defined by the `start` and `end` properties of `range`. + * @param {Range} range A range of rows + * + * + **/ + this.outdentRows = function (range) { + var rowRange = range.collapseRows(); + var deleteRange = new Range(0, 0, 0, 0); + var size = this.getTabSize(); + + for (var i = rowRange.start.row; i <= rowRange.end.row; ++i) { + var line = this.getLine(i); + + deleteRange.start.row = i; + deleteRange.end.row = i; + for (var j = 0; j < size; ++j) + if (line.charAt(j) != ' ') + break; + if (j < size && line.charAt(j) == '\t') { + deleteRange.start.column = j; + deleteRange.end.column = j + 1; + } else { + deleteRange.start.column = 0; + deleteRange.end.column = j; + } + this.remove(deleteRange); + } + }; + + this.$moveLines = function(firstRow, lastRow, dir) { + firstRow = this.getRowFoldStart(firstRow); + lastRow = this.getRowFoldEnd(lastRow); + if (dir < 0) { + var row = this.getRowFoldStart(firstRow + dir); + if (row < 0) return 0; + var diff = row-firstRow; + } else if (dir > 0) { + var row = this.getRowFoldEnd(lastRow + dir); + if (row > this.doc.getLength()-1) return 0; + var diff = row-lastRow; + } else { + firstRow = this.$clipRowToDocument(firstRow); + lastRow = this.$clipRowToDocument(lastRow); + var diff = lastRow - firstRow + 1; + } + + var range = new Range(firstRow, 0, lastRow, Number.MAX_VALUE); + var folds = this.getFoldsInRange(range).map(function(x){ + x = x.clone(); + x.start.row += diff; + x.end.row += diff; + return x; + }); + + var lines = dir == 0 + ? this.doc.getLines(firstRow, lastRow) + : this.doc.removeLines(firstRow, lastRow); + this.doc.insertLines(firstRow+diff, lines); + folds.length && this.addFolds(folds); + return diff; + }; + /** + * Shifts all the lines in the document up one, starting from `firstRow` and ending at `lastRow`. + * @param {Number} firstRow The starting row to move up + * @param {Number} lastRow The final row to move up + * @returns {Number} If `firstRow` is less-than or equal to 0, this function returns 0. Otherwise, on success, it returns -1. + * + * @related Document.insertLines + * + **/ + this.moveLinesUp = function(firstRow, lastRow) { + return this.$moveLines(firstRow, lastRow, -1); + }; + + /** + * Shifts all the lines in the document down one, starting from `firstRow` and ending at `lastRow`. + * @param {Number} firstRow The starting row to move down + * @param {Number} lastRow The final row to move down + * @returns {Number} If `firstRow` is less-than or equal to 0, this function returns 0. Otherwise, on success, it returns -1. + * + * @related Document.insertLines + **/ + this.moveLinesDown = function(firstRow, lastRow) { + return this.$moveLines(firstRow, lastRow, 1); + }; + + /** + * Duplicates all the text between `firstRow` and `lastRow`. + * @param {Number} firstRow The starting row to duplicate + * @param {Number} lastRow The final row to duplicate + * @returns {Number} Returns the number of new rows added; in other words, `lastRow - firstRow + 1`. + * + * + **/ + this.duplicateLines = function(firstRow, lastRow) { + return this.$moveLines(firstRow, lastRow, 0); + }; + + + this.$clipRowToDocument = function(row) { + return Math.max(0, Math.min(row, this.doc.getLength()-1)); + }; + + this.$clipColumnToRow = function(row, column) { + if (column < 0) + return 0; + return Math.min(this.doc.getLine(row).length, column); + }; + + + this.$clipPositionToDocument = function(row, column) { + column = Math.max(0, column); + + if (row < 0) { + row = 0; + column = 0; + } else { + var len = this.doc.getLength(); + if (row >= len) { + row = len - 1; + column = this.doc.getLine(len-1).length; + } else { + column = Math.min(this.doc.getLine(row).length, column); + } + } + + return { + row: row, + column: column + }; + }; + + this.$clipRangeToDocument = function(range) { + if (range.start.row < 0) { + range.start.row = 0; + range.start.column = 0; + } else { + range.start.column = this.$clipColumnToRow( + range.start.row, + range.start.column + ); + } + + var len = this.doc.getLength() - 1; + if (range.end.row > len) { + range.end.row = len; + range.end.column = this.doc.getLine(len).length; + } else { + range.end.column = this.$clipColumnToRow( + range.end.row, + range.end.column + ); + } + return range; + }; + + // WRAPMODE + this.$wrapLimit = 80; + this.$useWrapMode = false; + this.$wrapLimitRange = { + min : null, + max : null + }; + + /** + * Sets whether or not line wrapping is enabled. If `useWrapMode` is different than the current value, the `'changeWrapMode'` event is emitted. + * @param {Boolean} useWrapMode Enable (or disable) wrap mode + * + * + **/ + this.setUseWrapMode = function(useWrapMode) { + if (useWrapMode != this.$useWrapMode) { + this.$useWrapMode = useWrapMode; + this.$modified = true; + this.$resetRowCache(0); + + // If wrapMode is activaed, the wrapData array has to be initialized. + if (useWrapMode) { + var len = this.getLength(); + this.$wrapData = []; + for (var i = 0; i < len; i++) { + this.$wrapData.push([]); + } + this.$updateWrapData(0, len - 1); + } + + this._emit("changeWrapMode"); + } + }; + + /** + * Returns `true` if wrap mode is being used; `false` otherwise. + * @returns {Boolean} + **/ + this.getUseWrapMode = function() { + return this.$useWrapMode; + }; + + // Allow the wrap limit to move freely between min and max. Either + // parameter can be null to allow the wrap limit to be unconstrained + // in that direction. Or set both parameters to the same number to pin + // the limit to that value. + /** + * Sets the boundaries of wrap. Either value can be `null` to have an unconstrained wrap, or, they can be the same number to pin the limit. If the wrap limits for `min` or `max` are different, this method also emits the `'changeWrapMode'` event. + * @param {Number} min The minimum wrap value (the left side wrap) + * @param {Number} max The maximum wrap value (the right side wrap) + * + * + **/ + this.setWrapLimitRange = function(min, max) { + if (this.$wrapLimitRange.min !== min || this.$wrapLimitRange.max !== max) { + this.$wrapLimitRange = { + min: min, + max: max + }; + this.$modified = true; + // This will force a recalculation of the wrap limit + this._emit("changeWrapMode"); + } + }; + + /** + * This should generally only be called by the renderer when a resize is detected. + * @param {Number} desiredLimit The new wrap limit + * @returns {Boolean} + * + * @private + **/ + this.adjustWrapLimit = function(desiredLimit, $printMargin) { + var limits = this.$wrapLimitRange + if (limits.max < 0) + limits = {min: $printMargin, max: $printMargin}; + var wrapLimit = this.$constrainWrapLimit(desiredLimit, limits.min, limits.max); + if (wrapLimit != this.$wrapLimit && wrapLimit > 1) { + this.$wrapLimit = wrapLimit; + this.$modified = true; + if (this.$useWrapMode) { + this.$updateWrapData(0, this.getLength() - 1); + this.$resetRowCache(0); + this._emit("changeWrapLimit"); + } + return true; + } + return false; + }; + + this.$constrainWrapLimit = function(wrapLimit, min, max) { + if (min) + wrapLimit = Math.max(min, wrapLimit); + + if (max) + wrapLimit = Math.min(max, wrapLimit); + + return wrapLimit; + }; + + /** + * Returns the value of wrap limit. + * @returns {Number} The wrap limit. + **/ + this.getWrapLimit = function() { + return this.$wrapLimit; + }; + + /** + * Sets the line length for soft wrap in the editor. Lines will break + * at a minimum of the given length minus 20 chars and at a maximum + * of the given number of chars. + * @param {number} limit The maximum line length in chars, for soft wrapping lines. + */ + this.setWrapLimit = function (limit) { + this.setWrapLimitRange(limit, limit); + }; + + /** + * Returns an object that defines the minimum and maximum of the wrap limit; it looks something like this: + * + * { min: wrapLimitRange_min, max: wrapLimitRange_max } + * + * @returns {Object} + **/ + this.getWrapLimitRange = function() { + // Avoid unexpected mutation by returning a copy + return { + min : this.$wrapLimitRange.min, + max : this.$wrapLimitRange.max + }; + }; + + this.$updateInternalDataOnChange = function(e) { + var useWrapMode = this.$useWrapMode; + var len; + var action = e.data.action; + var firstRow = e.data.range.start.row; + var lastRow = e.data.range.end.row; + var start = e.data.range.start; + var end = e.data.range.end; + var removedFolds = null; + + if (action.indexOf("Lines") != -1) { + if (action == "insertLines") { + lastRow = firstRow + (e.data.lines.length); + } else { + lastRow = firstRow; + } + len = e.data.lines ? e.data.lines.length : lastRow - firstRow; + } else { + len = lastRow - firstRow; + } + + this.$updating = true; + if (len != 0) { + if (action.indexOf("remove") != -1) { + this[useWrapMode ? "$wrapData" : "$rowLengthCache"].splice(firstRow, len); + + var foldLines = this.$foldData; + removedFolds = this.getFoldsInRange(e.data.range); + this.removeFolds(removedFolds); + + var foldLine = this.getFoldLine(end.row); + var idx = 0; + if (foldLine) { + foldLine.addRemoveChars(end.row, end.column, start.column - end.column); + foldLine.shiftRow(-len); + + var foldLineBefore = this.getFoldLine(firstRow); + if (foldLineBefore && foldLineBefore !== foldLine) { + foldLineBefore.merge(foldLine); + foldLine = foldLineBefore; + } + idx = foldLines.indexOf(foldLine) + 1; + } + + for (idx; idx < foldLines.length; idx++) { + var foldLine = foldLines[idx]; + if (foldLine.start.row >= end.row) { + foldLine.shiftRow(-len); + } + } + + lastRow = firstRow; + } else { + var args; + if (useWrapMode) { + args = [firstRow, 0]; + for (var i = 0; i < len; i++) args.push([]); + this.$wrapData.splice.apply(this.$wrapData, args); + } else { + args = Array(len); + args.unshift(firstRow, 0); + this.$rowLengthCache.splice.apply(this.$rowLengthCache, args); + } + + // If some new line is added inside of a foldLine, then split + // the fold line up. + var foldLines = this.$foldData; + var foldLine = this.getFoldLine(firstRow); + var idx = 0; + if (foldLine) { + var cmp = foldLine.range.compareInside(start.row, start.column) + // Inside of the foldLine range. Need to split stuff up. + if (cmp == 0) { + foldLine = foldLine.split(start.row, start.column); + foldLine.shiftRow(len); + foldLine.addRemoveChars( + lastRow, 0, end.column - start.column); + } else + // Infront of the foldLine but same row. Need to shift column. + if (cmp == -1) { + foldLine.addRemoveChars(firstRow, 0, end.column - start.column); + foldLine.shiftRow(len); + } + // Nothing to do if the insert is after the foldLine. + idx = foldLines.indexOf(foldLine) + 1; + } + + for (idx; idx < foldLines.length; idx++) { + var foldLine = foldLines[idx]; + if (foldLine.start.row >= firstRow) { + foldLine.shiftRow(len); + } + } + } + } else { + // Realign folds. E.g. if you add some new chars before a fold, the + // fold should "move" to the right. + len = Math.abs(e.data.range.start.column - e.data.range.end.column); + if (action.indexOf("remove") != -1) { + // Get all the folds in the change range and remove them. + removedFolds = this.getFoldsInRange(e.data.range); + this.removeFolds(removedFolds); + + len = -len; + } + var foldLine = this.getFoldLine(firstRow); + if (foldLine) { + foldLine.addRemoveChars(firstRow, start.column, len); + } + } + + if (useWrapMode && this.$wrapData.length != this.doc.getLength()) { + console.error("doc.getLength() and $wrapData.length have to be the same!"); + } + this.$updating = false; + + if (useWrapMode) + this.$updateWrapData(firstRow, lastRow); + else + this.$updateRowLengthCache(firstRow, lastRow); + + return removedFolds; + }; + + this.$updateRowLengthCache = function(firstRow, lastRow, b) { + this.$rowLengthCache[firstRow] = null; + this.$rowLengthCache[lastRow] = null; + }; + + this.$updateWrapData = function(firstRow, lastRow) { + var lines = this.doc.getAllLines(); + var tabSize = this.getTabSize(); + var wrapData = this.$wrapData; + var wrapLimit = this.$wrapLimit; + var tokens; + var foldLine; + + var row = firstRow; + lastRow = Math.min(lastRow, lines.length - 1); + while (row <= lastRow) { + foldLine = this.getFoldLine(row, foldLine); + if (!foldLine) { + tokens = this.$getDisplayTokens(lines[row]); + wrapData[row] = this.$computeWrapSplits(tokens, wrapLimit, tabSize); + row ++; + } else { + tokens = []; + foldLine.walk(function(placeholder, row, column, lastColumn) { + var walkTokens; + if (placeholder != null) { + walkTokens = this.$getDisplayTokens( + placeholder, tokens.length); + walkTokens[0] = PLACEHOLDER_START; + for (var i = 1; i < walkTokens.length; i++) { + walkTokens[i] = PLACEHOLDER_BODY; + } + } else { + walkTokens = this.$getDisplayTokens( + lines[row].substring(lastColumn, column), + tokens.length); + } + tokens = tokens.concat(walkTokens); + }.bind(this), + foldLine.end.row, + lines[foldLine.end.row].length + 1 + ); + + wrapData[foldLine.start.row] + = this.$computeWrapSplits(tokens, wrapLimit, tabSize); + row = foldLine.end.row + 1; + } + } + }; + + // "Tokens" + var CHAR = 1, + CHAR_EXT = 2, + PLACEHOLDER_START = 3, + PLACEHOLDER_BODY = 4, + PUNCTUATION = 9, + SPACE = 10, + TAB = 11, + TAB_SPACE = 12; + + + this.$computeWrapSplits = function(tokens, wrapLimit) { + if (tokens.length == 0) { + return []; + } + + var splits = []; + var displayLength = tokens.length; + var lastSplit = 0, lastDocSplit = 0; + + var isCode = this.$wrapAsCode; + + function addSplit(screenPos) { + var displayed = tokens.slice(lastSplit, screenPos); + + // The document size is the current size - the extra width for tabs + // and multipleWidth characters. + var len = displayed.length; + displayed.join(""). + // Get all the TAB_SPACEs. + replace(/12/g, function() { + len -= 1; + }). + // Get all the CHAR_EXT/multipleWidth characters. + replace(/2/g, function() { + len -= 1; + }); + + lastDocSplit += len; + splits.push(lastDocSplit); + lastSplit = screenPos; + } + + while (displayLength - lastSplit > wrapLimit) { + // This is, where the split should be. + var split = lastSplit + wrapLimit; + + // If there is a space or tab at this split position, then making + // a split is simple. + if (tokens[split - 1] >= SPACE && tokens[split] >= SPACE) { + /* disabled see https://github.com/ajaxorg/ace/issues/1186 + // Include all following spaces + tabs in this split as well. + while (tokens[split] >= SPACE) { + split ++; + } */ + addSplit(split); + continue; + } + + // === ELSE === + // Check if split is inside of a placeholder. Placeholder are + // not splitable. Therefore, seek the beginning of the placeholder + // and try to place the split beofre the placeholder's start. + if (tokens[split] == PLACEHOLDER_START || tokens[split] == PLACEHOLDER_BODY) { + // Seek the start of the placeholder and do the split + // before the placeholder. By definition there always + // a PLACEHOLDER_START between split and lastSplit. + for (split; split != lastSplit - 1; split--) { + if (tokens[split] == PLACEHOLDER_START) { + // split++; << No incremental here as we want to + // have the position before the Placeholder. + break; + } + } + + // If the PLACEHOLDER_START is not the index of the + // last split, then we can do the split + if (split > lastSplit) { + addSplit(split); + continue; + } + + // If the PLACEHOLDER_START IS the index of the last + // split, then we have to place the split after the + // placeholder. So, let's seek for the end of the placeholder. + split = lastSplit + wrapLimit; + for (split; split < tokens.length; split++) { + if (tokens[split] != PLACEHOLDER_BODY) { + break; + } + } + + // If spilt == tokens.length, then the placeholder is the last + // thing in the line and adding a new split doesn't make sense. + if (split == tokens.length) { + break; // Breaks the while-loop. + } + + // Finally, add the split... + addSplit(split); + continue; + } + + // === ELSE === + // Search for the first non space/tab/placeholder/punctuation token backwards. + var minSplit = Math.max(split - (isCode ? 10 : wrapLimit-(wrapLimit>>2)), lastSplit - 1); + while (split > minSplit && tokens[split] < PLACEHOLDER_START) { + split --; + } + if (isCode) { + while (split > minSplit && tokens[split] < PLACEHOLDER_START) { + split --; + } + while (split > minSplit && tokens[split] == PUNCTUATION) { + split --; + } + } else { + while (split > minSplit && tokens[split] < SPACE) { + split --; + } + } + // If we found one, then add the split. + if (split > minSplit) { + addSplit(++split); + continue; + } + + // === ELSE === + split = lastSplit + wrapLimit; + // The split is inside of a CHAR or CHAR_EXT token and no space + // around -> force a split. + addSplit(split); + } + return splits; + }; + + /** + * Given a string, returns an array of the display characters, including tabs and spaces. + * @param {String} str The string to check + * @param {Number} offset The value to start at + * + * + **/ + this.$getDisplayTokens = function(str, offset) { + var arr = []; + var tabSize; + offset = offset || 0; + + for (var i = 0; i < str.length; i++) { + var c = str.charCodeAt(i); + // Tab + if (c == 9) { + tabSize = this.getScreenTabSize(arr.length + offset); + arr.push(TAB); + for (var n = 1; n < tabSize; n++) { + arr.push(TAB_SPACE); + } + } + // Space + else if (c == 32) { + arr.push(SPACE); + } else if((c > 39 && c < 48) || (c > 57 && c < 64)) { + arr.push(PUNCTUATION); + } + // full width characters + else if (c >= 0x1100 && isFullWidth(c)) { + arr.push(CHAR, CHAR_EXT); + } else { + arr.push(CHAR); + } + } + return arr; + }; + + /** + * Calculates the width of the string `str` on the screen while assuming that the string starts at the first column on the screen. + * @param {String} str The string to calculate the screen width of + * @param {Number} maxScreenColumn + * @param {Number} screenColumn + * @returns {[Number]} Returns an `int[]` array with two elements:
+ * The first position indicates the number of columns for `str` on screen.
+ * The second value contains the position of the document column that this function read until. + * + * + * + * + **/ + this.$getStringScreenWidth = function(str, maxScreenColumn, screenColumn) { + if (maxScreenColumn == 0) + return [0, 0]; + if (maxScreenColumn == null) + maxScreenColumn = Infinity; + screenColumn = screenColumn || 0; + + var c, column; + for (column = 0; column < str.length; column++) { + c = str.charCodeAt(column); + // tab + if (c == 9) { + screenColumn += this.getScreenTabSize(screenColumn); + } + // full width characters + else if (c >= 0x1100 && isFullWidth(c)) { + screenColumn += 2; + } else { + screenColumn += 1; + } + if (screenColumn > maxScreenColumn) { + break; + } + } + + return [screenColumn, column]; + }; + + /** + * Returns number of screenrows in a wrapped line. + * @param {Number} row The row number to check + * + * @returns {Number} + **/ + this.getRowLength = function(row) { + if (!this.$useWrapMode || !this.$wrapData[row]) { + return 1; + } else { + return this.$wrapData[row].length + 1; + } + }; + + /** + * Returns the position (on screen) for the last character in the provided screen row. + * @param {Number} screenRow The screen row to check + * @returns {Number} + * + * @related EditSession.documentToScreenColumn + **/ + this.getScreenLastRowColumn = function(screenRow) { + var pos = this.screenToDocumentPosition(screenRow, Number.MAX_VALUE); + return this.documentToScreenColumn(pos.row, pos.column); + }; + + /** + * For the given document row and column, this returns the column position of the last screen row. + * @param {Number} docRow + * + * @param {Number} docColumn + **/ + this.getDocumentLastRowColumn = function(docRow, docColumn) { + var screenRow = this.documentToScreenRow(docRow, docColumn); + return this.getScreenLastRowColumn(screenRow); + }; + + /** + * For the given document row and column, this returns the document position of the last row. + * @param {Number} docRow + * @param {Number} docColumn + * + * + **/ + this.getDocumentLastRowColumnPosition = function(docRow, docColumn) { + var screenRow = this.documentToScreenRow(docRow, docColumn); + return this.screenToDocumentPosition(screenRow, Number.MAX_VALUE / 10); + }; + + /** + * For the given row, this returns the split data. + * @returns {String} + **/ + this.getRowSplitData = function(row) { + if (!this.$useWrapMode) { + return undefined; + } else { + return this.$wrapData[row]; + } + }; + + /** + * The distance to the next tab stop at the specified screen column. + * @param {Number} screenColumn The screen column to check + * + * + * @returns {Number} + **/ + this.getScreenTabSize = function(screenColumn) { + return this.$tabSize - screenColumn % this.$tabSize; + }; + + + this.screenToDocumentRow = function(screenRow, screenColumn) { + return this.screenToDocumentPosition(screenRow, screenColumn).row; + }; + + + this.screenToDocumentColumn = function(screenRow, screenColumn) { + return this.screenToDocumentPosition(screenRow, screenColumn).column; + }; + + /** + * Converts characters coordinates on the screen to characters coordinates within the document. [This takes into account code folding, word wrap, tab size, and any other visual modifications.]{: #conversionConsiderations} + * @param {Number} screenRow The screen row to check + * @param {Number} screenColumn The screen column to check + * @returns {Object} The object returned has two properties: `row` and `column`. + * + * + * @related EditSession.documentToScreenPosition + * + **/ + this.screenToDocumentPosition = function(screenRow, screenColumn) { + if (screenRow < 0) + return {row: 0, column: 0}; + + var line; + var docRow = 0; + var docColumn = 0; + var column; + var row = 0; + var rowLength = 0; + + var rowCache = this.$screenRowCache; + var i = this.$getRowCacheIndex(rowCache, screenRow); + var l = rowCache.length; + if (l && i >= 0) { + var row = rowCache[i]; + var docRow = this.$docRowCache[i]; + var doCache = screenRow > rowCache[l - 1]; + } else { + var doCache = !l; + } + + var maxRow = this.getLength() - 1; + var foldLine = this.getNextFoldLine(docRow); + var foldStart = foldLine ? foldLine.start.row : Infinity; + + while (row <= screenRow) { + rowLength = this.getRowLength(docRow); + if (row + rowLength - 1 >= screenRow || docRow >= maxRow) { + break; + } else { + row += rowLength; + docRow++; + if (docRow > foldStart) { + docRow = foldLine.end.row+1; + foldLine = this.getNextFoldLine(docRow, foldLine); + foldStart = foldLine ? foldLine.start.row : Infinity; + } + } + + if (doCache) { + this.$docRowCache.push(docRow); + this.$screenRowCache.push(row); + } + } + + if (foldLine && foldLine.start.row <= docRow) { + line = this.getFoldDisplayLine(foldLine); + docRow = foldLine.start.row; + } else if (row + rowLength <= screenRow || docRow > maxRow) { + // clip at the end of the document + return { + row: maxRow, + column: this.getLine(maxRow).length + } + } else { + line = this.getLine(docRow); + foldLine = null; + } + + if (this.$useWrapMode) { + var splits = this.$wrapData[docRow]; + if (splits) { + column = splits[screenRow - row]; + if(screenRow > row && splits.length) { + docColumn = splits[screenRow - row - 1] || splits[splits.length - 1]; + line = line.substring(docColumn); + } + } + } + + docColumn += this.$getStringScreenWidth(line, screenColumn)[1]; + + // We remove one character at the end so that the docColumn + // position returned is not associated to the next row on the screen. + if (this.$useWrapMode && docColumn >= column) + docColumn = column - 1; + + if (foldLine) + return foldLine.idxToPosition(docColumn); + + return {row: docRow, column: docColumn}; + }; + + /** + * Converts document coordinates to screen coordinates. {:conversionConsiderations} + * @param {Number} docRow The document row to check + * @param {Number} docColumn The document column to check + * @returns {Object} The object returned by this method has two properties: `row` and `column`. + * + * + * @related EditSession.screenToDocumentPosition + * + **/ + this.documentToScreenPosition = function(docRow, docColumn) { + // Normalize the passed in arguments. + if (typeof docColumn === "undefined") + var pos = this.$clipPositionToDocument(docRow.row, docRow.column); + else + pos = this.$clipPositionToDocument(docRow, docColumn); + + docRow = pos.row; + docColumn = pos.column; + + var screenRow = 0; + var foldStartRow = null; + var fold = null; + + // Clamp the docRow position in case it's inside of a folded block. + fold = this.getFoldAt(docRow, docColumn, 1); + if (fold) { + docRow = fold.start.row; + docColumn = fold.start.column; + } + + var rowEnd, row = 0; + + + var rowCache = this.$docRowCache; + var i = this.$getRowCacheIndex(rowCache, docRow); + var l = rowCache.length; + if (l && i >= 0) { + var row = rowCache[i]; + var screenRow = this.$screenRowCache[i]; + var doCache = docRow > rowCache[l - 1]; + } else { + var doCache = !l; + } + + var foldLine = this.getNextFoldLine(row); + var foldStart = foldLine ?foldLine.start.row :Infinity; + + while (row < docRow) { + if (row >= foldStart) { + rowEnd = foldLine.end.row + 1; + if (rowEnd > docRow) + break; + foldLine = this.getNextFoldLine(rowEnd, foldLine); + foldStart = foldLine ?foldLine.start.row :Infinity; + } + else { + rowEnd = row + 1; + } + + screenRow += this.getRowLength(row); + row = rowEnd; + + if (doCache) { + this.$docRowCache.push(row); + this.$screenRowCache.push(screenRow); + } + } + + // Calculate the text line that is displayed in docRow on the screen. + var textLine = ""; + // Check if the final row we want to reach is inside of a fold. + if (foldLine && row >= foldStart) { + textLine = this.getFoldDisplayLine(foldLine, docRow, docColumn); + foldStartRow = foldLine.start.row; + } else { + textLine = this.getLine(docRow).substring(0, docColumn); + foldStartRow = docRow; + } + // Clamp textLine if in wrapMode. + if (this.$useWrapMode) { + var wrapRow = this.$wrapData[foldStartRow]; + var screenRowOffset = 0; + while (textLine.length >= wrapRow[screenRowOffset]) { + screenRow ++; + screenRowOffset++; + } + textLine = textLine.substring( + wrapRow[screenRowOffset - 1] || 0, textLine.length + ); + } + + return { + row: screenRow, + column: this.$getStringScreenWidth(textLine)[0] + }; + }; + + /** + * For the given document row and column, returns the screen column. + * @param {Number} row + * @param {Number} docColumn + * @returns {Number} + * + **/ + this.documentToScreenColumn = function(row, docColumn) { + return this.documentToScreenPosition(row, docColumn).column; + }; + + /** + * For the given document row and column, returns the screen row. + * @param {Number} docRow + * @param {Number} docColumn + * + * + **/ + this.documentToScreenRow = function(docRow, docColumn) { + return this.documentToScreenPosition(docRow, docColumn).row; + }; + + /** + * Returns the length of the screen. + * @returns {Number} + **/ + this.getScreenLength = function() { + var screenRows = 0; + var fold = null; + if (!this.$useWrapMode) { + screenRows = this.getLength(); + + // Remove the folded lines again. + var foldData = this.$foldData; + for (var i = 0; i < foldData.length; i++) { + fold = foldData[i]; + screenRows -= fold.end.row - fold.start.row; + } + } else { + var lastRow = this.$wrapData.length; + var row = 0, i = 0; + var fold = this.$foldData[i++]; + var foldStart = fold ? fold.start.row :Infinity; + + while (row < lastRow) { + screenRows += this.$wrapData[row].length + 1; + row ++; + if (row > foldStart) { + row = fold.end.row+1; + fold = this.$foldData[i++]; + foldStart = fold ?fold.start.row :Infinity; + } + } + } + + return screenRows; + }; + + // For every keystroke this gets called once per char in the whole doc!! + // Wouldn't hurt to make it a bit faster for c >= 0x1100 + + /** + * @private + * + */ + function isFullWidth(c) { + if (c < 0x1100) + return false; + return c >= 0x1100 && c <= 0x115F || + c >= 0x11A3 && c <= 0x11A7 || + c >= 0x11FA && c <= 0x11FF || + c >= 0x2329 && c <= 0x232A || + c >= 0x2E80 && c <= 0x2E99 || + c >= 0x2E9B && c <= 0x2EF3 || + c >= 0x2F00 && c <= 0x2FD5 || + c >= 0x2FF0 && c <= 0x2FFB || + c >= 0x3000 && c <= 0x303E || + c >= 0x3041 && c <= 0x3096 || + c >= 0x3099 && c <= 0x30FF || + c >= 0x3105 && c <= 0x312D || + c >= 0x3131 && c <= 0x318E || + c >= 0x3190 && c <= 0x31BA || + c >= 0x31C0 && c <= 0x31E3 || + c >= 0x31F0 && c <= 0x321E || + c >= 0x3220 && c <= 0x3247 || + c >= 0x3250 && c <= 0x32FE || + c >= 0x3300 && c <= 0x4DBF || + c >= 0x4E00 && c <= 0xA48C || + c >= 0xA490 && c <= 0xA4C6 || + c >= 0xA960 && c <= 0xA97C || + c >= 0xAC00 && c <= 0xD7A3 || + c >= 0xD7B0 && c <= 0xD7C6 || + c >= 0xD7CB && c <= 0xD7FB || + c >= 0xF900 && c <= 0xFAFF || + c >= 0xFE10 && c <= 0xFE19 || + c >= 0xFE30 && c <= 0xFE52 || + c >= 0xFE54 && c <= 0xFE66 || + c >= 0xFE68 && c <= 0xFE6B || + c >= 0xFF01 && c <= 0xFF60 || + c >= 0xFFE0 && c <= 0xFFE6; + }; + +}).call(EditSession.prototype); + +require("./edit_session/folding").Folding.call(EditSession.prototype); +require("./edit_session/bracket_match").BracketMatch.call(EditSession.prototype); + + +config.defineOptions(EditSession.prototype, "session", { + wrap: { + set: function(value) { + if (!value || value == "off") + value = false; + else if (value == "free") + value = true; + else if (value == "printMargin") + value = -1; + else if (typeof value == "string") + value = parseInt(value, 10) || false; + + if (this.$wrap == value) + return; + if (!value) { + this.setUseWrapMode(false); + } else { + var col = typeof value == "number" ? value : null; + this.setWrapLimitRange(col, col); + this.setUseWrapMode(true); + } + this.$wrap = value; + }, + get: function() { + return this.getUseWrapMode() ? this.getWrapLimitRange().min || "free" : "off"; + }, + handlesSet: true + }, + wrapMethod: { + // code|text|auto + set: function(val) { + if (val == "auto") + this.$wrapAsCode = this.$mode.type != "text"; + else + this.$wrapAsCode = val != "text"; + }, + initialValue: "auto" + }, + firstLineNumber: { + set: function() {this._emit("changeBreakpoint");}, + initialValue: 1 + }, + useWorker: { + set: function(useWorker) { + this.$useWorker = useWorker; + + this.$stopWorker(); + if (useWorker) + this.$startWorker(); + }, + initialValue: true + }, + useSoftTabs: {initialValue: true}, + tabSize: { + set: function(tabSize) { + if (isNaN(tabSize) || this.$tabSize === tabSize) return; + + this.$modified = true; + this.$rowLengthCache = []; + this.$tabSize = tabSize; + this._emit("changeTabSize"); + }, + initialValue: 4, + handlesSet: true + }, + overwrite: { + set: function(val) {this._emit("changeOverwrite");}, + initialValue: false + }, + newLineMode: { + set: function(val) {this.doc.setNewLineMode(val)}, + get: function() {return this.doc.getNewLineMode()}, + handlesSet: true + } +}); + +exports.EditSession = EditSession; +}); diff --git a/addons/editor/ace/edit_session/bracket_match.js b/addons/editor/ace/edit_session/bracket_match.js new file mode 100755 index 00000000..825f6924 --- /dev/null +++ b/addons/editor/ace/edit_session/bracket_match.js @@ -0,0 +1,219 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var TokenIterator = require("../token_iterator").TokenIterator; +var Range = require("../range").Range; + + +function BracketMatch() { + + this.findMatchingBracket = function(position, chr) { + if (position.column == 0) return null; + + var charBeforeCursor = chr || this.getLine(position.row).charAt(position.column-1); + if (charBeforeCursor == "") return null; + + var match = charBeforeCursor.match(/([\(\[\{])|([\)\]\}])/); + if (!match) + return null; + + if (match[1]) + return this.$findClosingBracket(match[1], position); + else + return this.$findOpeningBracket(match[2], position); + }; + + this.getBracketRange = function(pos) { + var line = this.getLine(pos.row); + var before = true, range; + + var chr = line.charAt(pos.column-1); + var match = chr && chr.match(/([\(\[\{])|([\)\]\}])/); + if (!match) { + chr = line.charAt(pos.column); + pos = {row: pos.row, column: pos.column + 1}; + match = chr && chr.match(/([\(\[\{])|([\)\]\}])/); + before = false; + } + if (!match) + return null; + + if (match[1]) { + var bracketPos = this.$findClosingBracket(match[1], pos); + if (!bracketPos) + return null; + range = Range.fromPoints(pos, bracketPos); + if (!before) { + range.end.column++; + range.start.column--; + } + range.cursor = range.end; + } else { + var bracketPos = this.$findOpeningBracket(match[2], pos); + if (!bracketPos) + return null; + range = Range.fromPoints(bracketPos, pos); + if (!before) { + range.start.column++; + range.end.column--; + } + range.cursor = range.start; + } + + return range; + }; + + this.$brackets = { + ")": "(", + "(": ")", + "]": "[", + "[": "]", + "{": "}", + "}": "{" + }; + + this.$findOpeningBracket = function(bracket, position, typeRe) { + var openBracket = this.$brackets[bracket]; + var depth = 1; + + var iterator = new TokenIterator(this, position.row, position.column); + var token = iterator.getCurrentToken(); + if (!token) + token = iterator.stepForward(); + if (!token) + return; + + if (!typeRe){ + typeRe = new RegExp( + "(\\.?" + + token.type.replace(".", "\\.").replace("rparen", ".paren") + + ")+" + ); + } + + // Start searching in token, just before the character at position.column + var valueIndex = position.column - iterator.getCurrentTokenColumn() - 2; + var value = token.value; + + while (true) { + + while (valueIndex >= 0) { + var chr = value.charAt(valueIndex); + if (chr == openBracket) { + depth -= 1; + if (depth == 0) { + return {row: iterator.getCurrentTokenRow(), + column: valueIndex + iterator.getCurrentTokenColumn()}; + } + } + else if (chr == bracket) { + depth += 1; + } + valueIndex -= 1; + } + + // Scan backward through the document, looking for the next token + // whose type matches typeRe + do { + token = iterator.stepBackward(); + } while (token && !typeRe.test(token.type)); + + if (token == null) + break; + + value = token.value; + valueIndex = value.length - 1; + } + + return null; + }; + + this.$findClosingBracket = function(bracket, position, typeRe) { + var closingBracket = this.$brackets[bracket]; + var depth = 1; + + var iterator = new TokenIterator(this, position.row, position.column); + var token = iterator.getCurrentToken(); + if (!token) + token = iterator.stepForward(); + if (!token) + return; + + if (!typeRe){ + typeRe = new RegExp( + "(\\.?" + + token.type.replace(".", "\\.").replace("lparen", ".paren") + + ")+" + ); + } + + // Start searching in token, after the character at position.column + var valueIndex = position.column - iterator.getCurrentTokenColumn(); + + while (true) { + + var value = token.value; + var valueLength = value.length; + while (valueIndex < valueLength) { + var chr = value.charAt(valueIndex); + if (chr == closingBracket) { + depth -= 1; + if (depth == 0) { + return {row: iterator.getCurrentTokenRow(), + column: valueIndex + iterator.getCurrentTokenColumn()}; + } + } + else if (chr == bracket) { + depth += 1; + } + valueIndex += 1; + } + + // Scan forward through the document, looking for the next token + // whose type matches typeRe + do { + token = iterator.stepForward(); + } while (token && !typeRe.test(token.type)); + + if (token == null) + break; + + valueIndex = 0; + } + + return null; + }; +} +exports.BracketMatch = BracketMatch; + +}); diff --git a/addons/editor/ace/edit_session/fold.js b/addons/editor/ace/edit_session/fold.js new file mode 100755 index 00000000..232101bd --- /dev/null +++ b/addons/editor/ace/edit_session/fold.js @@ -0,0 +1,140 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var Range = require("../range").Range; +var RangeList = require("../range_list").RangeList; +var oop = require("../lib/oop") +/* + * Simple fold-data struct. + **/ +var Fold = exports.Fold = function(range, placeholder) { + this.foldLine = null; + this.placeholder = placeholder; + this.range = range; + this.start = range.start; + this.end = range.end; + + this.sameRow = range.start.row == range.end.row; + this.subFolds = this.ranges = []; +}; + +oop.inherits(Fold, RangeList); + +(function() { + + this.toString = function() { + return '"' + this.placeholder + '" ' + this.range.toString(); + }; + + this.setFoldLine = function(foldLine) { + this.foldLine = foldLine; + this.subFolds.forEach(function(fold) { + fold.setFoldLine(foldLine); + }); + }; + + this.clone = function() { + var range = this.range.clone(); + var fold = new Fold(range, this.placeholder); + this.subFolds.forEach(function(subFold) { + fold.subFolds.push(subFold.clone()); + }); + fold.collapseChildren = this.collapseChildren; + return fold; + }; + + this.addSubFold = function(fold) { + if (this.range.isEqual(fold)) + return; + + if (!this.range.containsRange(fold)) + throw new Error("A fold can't intersect already existing fold" + fold.range + this.range); + + // transform fold to local coordinates + consumeRange(fold, this.start); + + var row = fold.start.row, column = fold.start.column; + for (var i = 0, cmp = -1; i < this.subFolds.length; i++) { + cmp = this.subFolds[i].range.compare(row, column); + if (cmp != 1) + break; + } + var afterStart = this.subFolds[i]; + + if (cmp == 0) + return afterStart.addSubFold(fold); + + // cmp == -1 + var row = fold.range.end.row, column = fold.range.end.column; + for (var j = i, cmp = -1; j < this.subFolds.length; j++) { + cmp = this.subFolds[j].range.compare(row, column); + if (cmp != 1) + break; + } + var afterEnd = this.subFolds[j]; + + if (cmp == 0) + throw new Error("A fold can't intersect already existing fold" + fold.range + this.range); + + var consumedFolds = this.subFolds.splice(i, j - i, fold); + fold.setFoldLine(this.foldLine); + + return fold; + }; + + this.restoreRange = function(range) { + return restoreRange(range, this.start); + }; + +}).call(Fold.prototype); + +function consumePoint(point, anchor) { + point.row -= anchor.row; + if (point.row == 0) + point.column -= anchor.column; +} +function consumeRange(range, anchor) { + consumePoint(range.start, anchor); + consumePoint(range.end, anchor); +} +function restorePoint(point, anchor) { + if (point.row == 0) + point.column += anchor.column; + point.row += anchor.row; +} +function restoreRange(range, anchor) { + restorePoint(range.start, anchor); + restorePoint(range.end, anchor); +} + +}); diff --git a/addons/editor/ace/edit_session/fold_line.js b/addons/editor/ace/edit_session/fold_line.js new file mode 100755 index 00000000..0218195e --- /dev/null +++ b/addons/editor/ace/edit_session/fold_line.js @@ -0,0 +1,268 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var Range = require("../range").Range; + +/* + * If an array is passed in, the folds are expected to be sorted already. + */ +function FoldLine(foldData, folds) { + this.foldData = foldData; + if (Array.isArray(folds)) { + this.folds = folds; + } else { + folds = this.folds = [ folds ]; + } + + var last = folds[folds.length - 1] + this.range = new Range(folds[0].start.row, folds[0].start.column, + last.end.row, last.end.column); + this.start = this.range.start; + this.end = this.range.end; + + this.folds.forEach(function(fold) { + fold.setFoldLine(this); + }, this); +} + +(function() { + /* + * Note: This doesn't update wrapData! + */ + this.shiftRow = function(shift) { + this.start.row += shift; + this.end.row += shift; + this.folds.forEach(function(fold) { + fold.start.row += shift; + fold.end.row += shift; + }); + } + + this.addFold = function(fold) { + if (fold.sameRow) { + if (fold.start.row < this.startRow || fold.endRow > this.endRow) { + throw new Error("Can't add a fold to this FoldLine as it has no connection"); + } + this.folds.push(fold); + this.folds.sort(function(a, b) { + return -a.range.compareEnd(b.start.row, b.start.column); + }); + if (this.range.compareEnd(fold.start.row, fold.start.column) > 0) { + this.end.row = fold.end.row; + this.end.column = fold.end.column; + } else if (this.range.compareStart(fold.end.row, fold.end.column) < 0) { + this.start.row = fold.start.row; + this.start.column = fold.start.column; + } + } else if (fold.start.row == this.end.row) { + this.folds.push(fold); + this.end.row = fold.end.row; + this.end.column = fold.end.column; + } else if (fold.end.row == this.start.row) { + this.folds.unshift(fold); + this.start.row = fold.start.row; + this.start.column = fold.start.column; + } else { + throw new Error("Trying to add fold to FoldRow that doesn't have a matching row"); + } + fold.foldLine = this; + } + + this.containsRow = function(row) { + return row >= this.start.row && row <= this.end.row; + } + + this.walk = function(callback, endRow, endColumn) { + var lastEnd = 0, + folds = this.folds, + fold, + comp, stop, isNewRow = true; + + if (endRow == null) { + endRow = this.end.row; + endColumn = this.end.column; + } + + for (var i = 0; i < folds.length; i++) { + fold = folds[i]; + + comp = fold.range.compareStart(endRow, endColumn); + // This fold is after the endRow/Column. + if (comp == -1) { + callback(null, endRow, endColumn, lastEnd, isNewRow); + return; + } + + stop = callback(null, fold.start.row, fold.start.column, lastEnd, isNewRow); + stop = !stop && callback(fold.placeholder, fold.start.row, fold.start.column, lastEnd); + + // If the user requested to stop the walk or endRow/endColumn is + // inside of this fold (comp == 0), then end here. + if (stop || comp == 0) { + return; + } + + // Note the new lastEnd might not be on the same line. However, + // it's the callback's job to recognize this. + isNewRow = !fold.sameRow; + lastEnd = fold.end.column; + } + callback(null, endRow, endColumn, lastEnd, isNewRow); + } + + this.getNextFoldTo = function(row, column) { + var fold, cmp; + for (var i = 0; i < this.folds.length; i++) { + fold = this.folds[i]; + cmp = fold.range.compareEnd(row, column); + if (cmp == -1) { + return { + fold: fold, + kind: "after" + }; + } else if (cmp == 0) { + return { + fold: fold, + kind: "inside" + } + } + } + return null; + } + + this.addRemoveChars = function(row, column, len) { + var ret = this.getNextFoldTo(row, column), + fold, folds; + if (ret) { + fold = ret.fold; + if (ret.kind == "inside" + && fold.start.column != column + && fold.start.row != row) + { + //throwing here breaks whole editor + //TODO: properly handle this + window.console && window.console.log(row, column, fold); + } else if (fold.start.row == row) { + folds = this.folds; + var i = folds.indexOf(fold); + if (i == 0) { + this.start.column += len; + } + for (i; i < folds.length; i++) { + fold = folds[i]; + fold.start.column += len; + if (!fold.sameRow) { + return; + } + fold.end.column += len; + } + this.end.column += len; + } + } + } + + this.split = function(row, column) { + var fold = this.getNextFoldTo(row, column).fold; + var folds = this.folds; + var foldData = this.foldData; + + if (!fold) + return null; + + var i = folds.indexOf(fold); + var foldBefore = folds[i - 1]; + this.end.row = foldBefore.end.row; + this.end.column = foldBefore.end.column; + + // Remove the folds after row/column and create a new FoldLine + // containing these removed folds. + folds = folds.splice(i, folds.length - i); + + var newFoldLine = new FoldLine(foldData, folds); + foldData.splice(foldData.indexOf(this) + 1, 0, newFoldLine); + return newFoldLine; + } + + this.merge = function(foldLineNext) { + var folds = foldLineNext.folds; + for (var i = 0; i < folds.length; i++) { + this.addFold(folds[i]); + } + // Remove the foldLineNext - no longer needed, as + // it's merged now with foldLineNext. + var foldData = this.foldData; + foldData.splice(foldData.indexOf(foldLineNext), 1); + } + + this.toString = function() { + var ret = [this.range.toString() + ": [" ]; + + this.folds.forEach(function(fold) { + ret.push(" " + fold.toString()); + }); + ret.push("]") + return ret.join("\n"); + } + + this.idxToPosition = function(idx) { + var lastFoldEndColumn = 0; + var fold; + + for (var i = 0; i < this.folds.length; i++) { + var fold = this.folds[i]; + + idx -= fold.start.column - lastFoldEndColumn; + if (idx < 0) { + return { + row: fold.start.row, + column: fold.start.column + idx + }; + } + + idx -= fold.placeholder.length; + if (idx < 0) { + return fold.start; + } + + lastFoldEndColumn = fold.end.column; + } + + return { + row: this.end.row, + column: this.end.column + idx + }; + } +}).call(FoldLine.prototype); + +exports.FoldLine = FoldLine; +}); diff --git a/addons/editor/ace/edit_session/folding.js b/addons/editor/ace/edit_session/folding.js new file mode 100755 index 00000000..a9b2ddd1 --- /dev/null +++ b/addons/editor/ace/edit_session/folding.js @@ -0,0 +1,799 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var Range = require("../range").Range; +var FoldLine = require("./fold_line").FoldLine; +var Fold = require("./fold").Fold; +var TokenIterator = require("../token_iterator").TokenIterator; + +function Folding() { + /* + * Looks up a fold at a given row/column. Possible values for side: + * -1: ignore a fold if fold.start = row/column + * +1: ignore a fold if fold.end = row/column + */ + this.getFoldAt = function(row, column, side) { + var foldLine = this.getFoldLine(row); + if (!foldLine) + return null; + + var folds = foldLine.folds; + for (var i = 0; i < folds.length; i++) { + var fold = folds[i]; + if (fold.range.contains(row, column)) { + if (side == 1 && fold.range.isEnd(row, column)) { + continue; + } else if (side == -1 && fold.range.isStart(row, column)) { + continue; + } + return fold; + } + } + }; + + /* + * Returns all folds in the given range. Note, that this will return folds + * + */ + this.getFoldsInRange = function(range) { + var start = range.start; + var end = range.end; + var foldLines = this.$foldData; + var foundFolds = []; + + start.column += 1; + end.column -= 1; + + for (var i = 0; i < foldLines.length; i++) { + var cmp = foldLines[i].range.compareRange(range); + if (cmp == 2) { + // Range is before foldLine. No intersection. This means, + // there might be other foldLines that intersect. + continue; + } + else if (cmp == -2) { + // Range is after foldLine. There can't be any other foldLines then, + // so let's give up. + break; + } + + var folds = foldLines[i].folds; + for (var j = 0; j < folds.length; j++) { + var fold = folds[j]; + cmp = fold.range.compareRange(range); + if (cmp == -2) { + break; + } else if (cmp == 2) { + continue; + } else + // WTF-state: Can happen due to -1/+1 to start/end column. + if (cmp == 42) { + break; + } + foundFolds.push(fold); + } + } + start.column -= 1; + end.column += 1; + + return foundFolds; + }; + + /* + * Returns all folds in the document + */ + this.getAllFolds = function() { + var folds = []; + var foldLines = this.$foldData; + + function addFold(fold) { + folds.push(fold); + } + + for (var i = 0; i < foldLines.length; i++) + for (var j = 0; j < foldLines[i].folds.length; j++) + addFold(foldLines[i].folds[j]); + + return folds; + }; + + /* + * Returns the string between folds at the given position. + * E.g. + * foob|arwolrd -> "bar" + * foobarwol|rd -> "world" + * foobarwolrd -> + * + * where | means the position of row/column + * + * The trim option determs if the return string should be trimed according + * to the "side" passed with the trim value: + * + * E.g. + * foob|arwolrd -trim=-1> "b" + * foobarwol|rd -trim=+1> "rld" + * fo|obarwolrd -trim=00> "foo" + */ + this.getFoldStringAt = function(row, column, trim, foldLine) { + foldLine = foldLine || this.getFoldLine(row); + if (!foldLine) + return null; + + var lastFold = { + end: { column: 0 } + }; + // TODO: Refactor to use getNextFoldTo function. + var str, fold; + for (var i = 0; i < foldLine.folds.length; i++) { + fold = foldLine.folds[i]; + var cmp = fold.range.compareEnd(row, column); + if (cmp == -1) { + str = this + .getLine(fold.start.row) + .substring(lastFold.end.column, fold.start.column); + break; + } + else if (cmp === 0) { + return null; + } + lastFold = fold; + } + if (!str) + str = this.getLine(fold.start.row).substring(lastFold.end.column); + + if (trim == -1) + return str.substring(0, column - lastFold.end.column); + else if (trim == 1) + return str.substring(column - lastFold.end.column); + else + return str; + }; + + this.getFoldLine = function(docRow, startFoldLine) { + var foldData = this.$foldData; + var i = 0; + if (startFoldLine) + i = foldData.indexOf(startFoldLine); + if (i == -1) + i = 0; + for (i; i < foldData.length; i++) { + var foldLine = foldData[i]; + if (foldLine.start.row <= docRow && foldLine.end.row >= docRow) { + return foldLine; + } else if (foldLine.end.row > docRow) { + return null; + } + } + return null; + }; + + // returns the fold which starts after or contains docRow + this.getNextFoldLine = function(docRow, startFoldLine) { + var foldData = this.$foldData; + var i = 0; + if (startFoldLine) + i = foldData.indexOf(startFoldLine); + if (i == -1) + i = 0; + for (i; i < foldData.length; i++) { + var foldLine = foldData[i]; + if (foldLine.end.row >= docRow) { + return foldLine; + } + } + return null; + }; + + this.getFoldedRowCount = function(first, last) { + var foldData = this.$foldData, rowCount = last-first+1; + for (var i = 0; i < foldData.length; i++) { + var foldLine = foldData[i], + end = foldLine.end.row, + start = foldLine.start.row; + if (end >= last) { + if(start < last) { + if(start >= first) + rowCount -= last-start; + else + rowCount = 0;//in one fold + } + break; + } else if(end >= first){ + if (start >= first) //fold inside range + rowCount -= end-start; + else + rowCount -= end-first+1; + } + } + return rowCount; + }; + + this.$addFoldLine = function(foldLine) { + this.$foldData.push(foldLine); + this.$foldData.sort(function(a, b) { + return a.start.row - b.start.row; + }); + return foldLine; + }; + + /** + * Adds a new fold. + * + * @returns + * The new created Fold object or an existing fold object in case the + * passed in range fits an existing fold exactly. + */ + this.addFold = function(placeholder, range) { + var foldData = this.$foldData; + var added = false; + var fold; + + if (placeholder instanceof Fold) + fold = placeholder; + else { + fold = new Fold(range, placeholder); + fold.collapseChildren = range.collapseChildren; + } + this.$clipRangeToDocument(fold.range); + + var startRow = fold.start.row; + var startColumn = fold.start.column; + var endRow = fold.end.row; + var endColumn = fold.end.column; + + // --- Some checking --- + if (!(startRow < endRow || + startRow == endRow && startColumn <= endColumn - 2)) + throw new Error("The range has to be at least 2 characters width"); + + var startFold = this.getFoldAt(startRow, startColumn, 1); + var endFold = this.getFoldAt(endRow, endColumn, -1); + if (startFold && endFold == startFold) + return startFold.addSubFold(fold); + + if ( + (startFold && !startFold.range.isStart(startRow, startColumn)) + || (endFold && !endFold.range.isEnd(endRow, endColumn)) + ) { + throw new Error("A fold can't intersect already existing fold" + fold.range + startFold.range); + } + + // Check if there are folds in the range we create the new fold for. + var folds = this.getFoldsInRange(fold.range); + if (folds.length > 0) { + // Remove the folds from fold data. + this.removeFolds(folds); + // Add the removed folds as subfolds on the new fold. + folds.forEach(function(subFold) { + fold.addSubFold(subFold); + }); + } + + for (var i = 0; i < foldData.length; i++) { + var foldLine = foldData[i]; + if (endRow == foldLine.start.row) { + foldLine.addFold(fold); + added = true; + break; + } else if (startRow == foldLine.end.row) { + foldLine.addFold(fold); + added = true; + if (!fold.sameRow) { + // Check if we might have to merge two FoldLines. + var foldLineNext = foldData[i + 1]; + if (foldLineNext && foldLineNext.start.row == endRow) { + // We need to merge! + foldLine.merge(foldLineNext); + break; + } + } + break; + } else if (endRow <= foldLine.start.row) { + break; + } + } + + if (!added) + foldLine = this.$addFoldLine(new FoldLine(this.$foldData, fold)); + + if (this.$useWrapMode) + this.$updateWrapData(foldLine.start.row, foldLine.start.row); + else + this.$updateRowLengthCache(foldLine.start.row, foldLine.start.row); + + // Notify that fold data has changed. + this.$modified = true; + this._emit("changeFold", { data: fold, action: "add" }); + + return fold; + }; + + this.addFolds = function(folds) { + folds.forEach(function(fold) { + this.addFold(fold); + }, this); + }; + + this.removeFold = function(fold) { + var foldLine = fold.foldLine; + var startRow = foldLine.start.row; + var endRow = foldLine.end.row; + + var foldLines = this.$foldData; + var folds = foldLine.folds; + // Simple case where there is only one fold in the FoldLine such that + // the entire fold line can get removed directly. + if (folds.length == 1) { + foldLines.splice(foldLines.indexOf(foldLine), 1); + } else + // If the fold is the last fold of the foldLine, just remove it. + if (foldLine.range.isEnd(fold.end.row, fold.end.column)) { + folds.pop(); + foldLine.end.row = folds[folds.length - 1].end.row; + foldLine.end.column = folds[folds.length - 1].end.column; + } else + // If the fold is the first fold of the foldLine, just remove it. + if (foldLine.range.isStart(fold.start.row, fold.start.column)) { + folds.shift(); + foldLine.start.row = folds[0].start.row; + foldLine.start.column = folds[0].start.column; + } else + // We know there are more then 2 folds and the fold is not at the edge. + // This means, the fold is somewhere in between. + // + // If the fold is in one row, we just can remove it. + if (fold.sameRow) { + folds.splice(folds.indexOf(fold), 1); + } else + // The fold goes over more then one row. This means remvoing this fold + // will cause the fold line to get splitted up. newFoldLine is the second part + { + var newFoldLine = foldLine.split(fold.start.row, fold.start.column); + folds = newFoldLine.folds; + folds.shift(); + newFoldLine.start.row = folds[0].start.row; + newFoldLine.start.column = folds[0].start.column; + } + + if (!this.$updating) { + if (this.$useWrapMode) + this.$updateWrapData(startRow, endRow); + else + this.$updateRowLengthCache(startRow, endRow); + } + + // Notify that fold data has changed. + this.$modified = true; + this._emit("changeFold", { data: fold, action: "remove" }); + }; + + this.removeFolds = function(folds) { + // We need to clone the folds array passed in as it might be the folds + // array of a fold line and as we call this.removeFold(fold), folds + // are removed from folds and changes the current index. + var cloneFolds = []; + for (var i = 0; i < folds.length; i++) { + cloneFolds.push(folds[i]); + } + + cloneFolds.forEach(function(fold) { + this.removeFold(fold); + }, this); + this.$modified = true; + }; + + this.expandFold = function(fold) { + this.removeFold(fold); + fold.subFolds.forEach(function(subFold) { + fold.restoreRange(subFold); + this.addFold(subFold); + }, this); + if (fold.collapseChildren > 0) { + this.foldAll(fold.start.row+1, fold.end.row, fold.collapseChildren-1); + } + fold.subFolds = []; + }; + + this.expandFolds = function(folds) { + folds.forEach(function(fold) { + this.expandFold(fold); + }, this); + }; + + this.unfold = function(location, expandInner) { + var range, folds; + if (location == null) { + range = new Range(0, 0, this.getLength(), 0); + expandInner = true; + } else if (typeof location == "number") + range = new Range(location, 0, location, this.getLine(location).length); + else if ("row" in location) + range = Range.fromPoints(location, location); + else + range = location; + + folds = this.getFoldsInRange(range); + if (expandInner) { + this.removeFolds(folds); + } else { + // TODO: might need to remove and add folds in one go instead of using + // expandFolds several times. + while (folds.length) { + this.expandFolds(folds); + folds = this.getFoldsInRange(range); + } + } + }; + + /* + * Checks if a given documentRow is folded. This is true if there are some + * folded parts such that some parts of the line is still visible. + **/ + this.isRowFolded = function(docRow, startFoldRow) { + return !!this.getFoldLine(docRow, startFoldRow); + }; + + this.getRowFoldEnd = function(docRow, startFoldRow) { + var foldLine = this.getFoldLine(docRow, startFoldRow); + return foldLine ? foldLine.end.row : docRow; + }; + + this.getRowFoldStart = function(docRow, startFoldRow) { + var foldLine = this.getFoldLine(docRow, startFoldRow); + return foldLine ? foldLine.start.row : docRow; + }; + + this.getFoldDisplayLine = function(foldLine, endRow, endColumn, startRow, startColumn) { + if (startRow == null) { + startRow = foldLine.start.row; + startColumn = 0; + } + + if (endRow == null) { + endRow = foldLine.end.row; + endColumn = this.getLine(endRow).length; + } + + // Build the textline using the FoldLine walker. + var doc = this.doc; + var textLine = ""; + + foldLine.walk(function(placeholder, row, column, lastColumn) { + if (row < startRow) + return; + if (row == startRow) { + if (column < startColumn) + return; + lastColumn = Math.max(startColumn, lastColumn); + } + + if (placeholder != null) { + textLine += placeholder; + } else { + textLine += doc.getLine(row).substring(lastColumn, column); + } + }, endRow, endColumn); + return textLine; + }; + + this.getDisplayLine = function(row, endColumn, startRow, startColumn) { + var foldLine = this.getFoldLine(row); + + if (!foldLine) { + var line; + line = this.doc.getLine(row); + return line.substring(startColumn || 0, endColumn || line.length); + } else { + return this.getFoldDisplayLine( + foldLine, row, endColumn, startRow, startColumn); + } + }; + + this.$cloneFoldData = function() { + var fd = []; + fd = this.$foldData.map(function(foldLine) { + var folds = foldLine.folds.map(function(fold) { + return fold.clone(); + }); + return new FoldLine(fd, folds); + }); + + return fd; + }; + + this.toggleFold = function(tryToUnfold) { + var selection = this.selection; + var range = selection.getRange(); + var fold; + var bracketPos; + + if (range.isEmpty()) { + var cursor = range.start; + fold = this.getFoldAt(cursor.row, cursor.column); + + if (fold) { + this.expandFold(fold); + return; + } else if (bracketPos = this.findMatchingBracket(cursor)) { + if (range.comparePoint(bracketPos) == 1) { + range.end = bracketPos; + } else { + range.start = bracketPos; + range.start.column++; + range.end.column--; + } + } else if (bracketPos = this.findMatchingBracket({row: cursor.row, column: cursor.column + 1})) { + if (range.comparePoint(bracketPos) == 1) + range.end = bracketPos; + else + range.start = bracketPos; + + range.start.column++; + } else { + range = this.getCommentFoldRange(cursor.row, cursor.column) || range; + } + } else { + var folds = this.getFoldsInRange(range); + if (tryToUnfold && folds.length) { + this.expandFolds(folds); + return; + } else if (folds.length == 1 ) { + fold = folds[0]; + } + } + + if (!fold) + fold = this.getFoldAt(range.start.row, range.start.column); + + if (fold && fold.range.toString() == range.toString()) { + this.expandFold(fold); + return; + } + + var placeholder = "..."; + if (!range.isMultiLine()) { + placeholder = this.getTextRange(range); + if(placeholder.length < 4) + return; + placeholder = placeholder.trim().substring(0, 2) + ".."; + } + + this.addFold(placeholder, range); + }; + + this.getCommentFoldRange = function(row, column, dir) { + var iterator = new TokenIterator(this, row, column); + var token = iterator.getCurrentToken(); + if (token && /^comment|string/.test(token.type)) { + var range = new Range(); + var re = new RegExp(token.type.replace(/\..*/, "\\.")); + if (dir != 1) { + do { + token = iterator.stepBackward(); + } while(token && re.test(token.type)); + iterator.stepForward(); + } + + range.start.row = iterator.getCurrentTokenRow(); + range.start.column = iterator.getCurrentTokenColumn() + 2; + + iterator = new TokenIterator(this, row, column); + + if (dir != -1) { + do { + token = iterator.stepForward(); + } while(token && re.test(token.type)); + token = iterator.stepBackward(); + } else + token = iterator.getCurrentToken(); + + range.end.row = iterator.getCurrentTokenRow(); + range.end.column = iterator.getCurrentTokenColumn() + token.value.length - 2; + return range; + } + }; + + this.foldAll = function(startRow, endRow, depth) { + if (depth == undefined) + depth = 100000; // JSON.stringify doesn't hanle Infinity + var foldWidgets = this.foldWidgets; + endRow = endRow || this.getLength(); + startRow = startRow || 0; + for (var row = startRow; row < endRow; row++) { + if (foldWidgets[row] == null) + foldWidgets[row] = this.getFoldWidget(row); + if (foldWidgets[row] != "start") + continue; + + var range = this.getFoldWidgetRange(row); + var rangeEndRow = range.end.row; + // sometimes range can be incompatible with existing fold + // TODO change addFold to return null istead of throwing + if (range && range.isMultiLine() + && rangeEndRow <= endRow + && range.start.row >= startRow + ) try { + var fold = this.addFold("...", range); + fold.collapseChildren = depth; + // addFold can change the range + row = rangeEndRow; + } catch(e) {} + } + }; + + // structured folding + this.$foldStyles = { + "manual": 1, + "markbegin": 1, + "markbeginend": 1 + }; + this.$foldStyle = "markbegin"; + this.setFoldStyle = function(style) { + if (!this.$foldStyles[style]) + throw new Error("invalid fold style: " + style + "[" + Object.keys(this.$foldStyles).join(", ") + "]"); + + if (this.$foldStyle == style) + return; + + this.$foldStyle = style; + + if (style == "manual") + this.unfold(); + + // reset folding + var mode = this.$foldMode; + this.$setFolding(null); + this.$setFolding(mode); + }; + + this.$setFolding = function(foldMode) { + if (this.$foldMode == foldMode) + return; + + this.$foldMode = foldMode; + + this.removeListener('change', this.$updateFoldWidgets); + this._emit("changeAnnotation"); + + if (!foldMode || this.$foldStyle == "manual") { + this.foldWidgets = null; + return; + } + + this.foldWidgets = []; + this.getFoldWidget = foldMode.getFoldWidget.bind(foldMode, this, this.$foldStyle); + this.getFoldWidgetRange = foldMode.getFoldWidgetRange.bind(foldMode, this, this.$foldStyle); + + this.$updateFoldWidgets = this.updateFoldWidgets.bind(this); + this.on('change', this.$updateFoldWidgets); + + }; + + this.getParentFoldRangeData = function (row, ignoreCurrent) { + var fw = this.foldWidgets; + if (!fw || (ignoreCurrent && fw[row])) + return {}; + + var i = row - 1, firstRange; + while (i >= 0) { + var c = fw[i]; + if (c == null) + c = fw[i] = this.getFoldWidget(i); + + if (c == "start") { + var range = this.getFoldWidgetRange(i); + if (!firstRange) + firstRange = range; + if (range && range.end.row >= row) + break; + } + i--; + } + + return { + range: i !== -1 && range, + firstRange: firstRange + }; + } + + this.onFoldWidgetClick = function(row, e) { + var type = this.getFoldWidget(row); + var line = this.getLine(row); + e = e.domEvent; + var children = e.shiftKey; + var all = e.ctrlKey || e.metaKey; + var siblings = e.altKey; + + var dir = type === "end" ? -1 : 1; + var fold = this.getFoldAt(row, dir === -1 ? 0 : line.length, dir); + + if (fold) { + if (children || all) + this.removeFold(fold); + else + this.expandFold(fold); + return; + } + + var range = this.getFoldWidgetRange(row); + // sometimes singleline folds can be missed by the code above + if (range && !range.isMultiLine()) { + fold = this.getFoldAt(range.start.row, range.start.column, 1); + if (fold && range.isEqual(fold.range)) { + this.removeFold(fold); + return; + } + } + + if (siblings) { + var data = this.getParentFoldRangeData(row); + if (data.range) { + var startRow = data.range.start.row + 1; + var endRow = data.range.end.row; + } + this.foldAll(startRow, endRow, all ? 10000 : 0); + } else if (children) { + var endRow = range ? range.end.row : this.getLength(); + this.foldAll(row + 1, range.end.row, all ? 10000 : 0); + } else if (range) { + if (all) + range.collapseChildren = 10000; + this.addFold("...", range); + } + + if (!range) + (e.target || e.srcElement).className += " ace_invalid" + }; + + this.updateFoldWidgets = function(e) { + var delta = e.data; + var range = delta.range; + var firstRow = range.start.row; + var len = range.end.row - firstRow; + + if (len === 0) { + this.foldWidgets[firstRow] = null; + } else if (delta.action == "removeText" || delta.action == "removeLines") { + this.foldWidgets.splice(firstRow, len + 1, null); + } else { + var args = Array(len + 1); + args.unshift(firstRow, 1); + this.foldWidgets.splice.apply(this.foldWidgets, args); + } + }; + +} + +exports.Folding = Folding; + +}); diff --git a/addons/editor/ace/edit_session_test.js b/addons/editor/ace/edit_session_test.js new file mode 100755 index 00000000..87cc9567 --- /dev/null +++ b/addons/editor/ace/edit_session_test.js @@ -0,0 +1,1075 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +if (typeof process !== "undefined") { + require("amd-loader"); + require("./test/mockdom"); +} + +define(function(require, exports, module) { +"use strict"; + +var lang = require("./lib/lang"); +var EditSession = require("./edit_session").EditSession; +var Editor = require("./editor").Editor; +var UndoManager = require("./undomanager").UndoManager; +var MockRenderer = require("./test/mockrenderer").MockRenderer; +var Range = require("./range").Range; +var assert = require("./test/assertions"); +var JavaScriptMode = require("./mode/javascript").Mode; + +function createFoldTestSession() { + var lines = [ + "function foo(items) {", + " for (var i=0; i>", [1, 2], 1); + + // Test wrapping for punctuation in + EditSession.prototype.$wrapAsCode = false; + computeAndAssert("ab cde, Juhu kinners", [3, 8, 13, 19], 6); + }, + + "test get longest line" : function() { + var session = new EditSession(["12"]); + session.setTabSize(4); + assert.equal(session.getScreenWidth(), 2); + + session.doc.insertNewLine({row: 0, column: Infinity}); + session.doc.insertLines(1, ["123"]); + assert.equal(session.getScreenWidth(), 3); + + session.doc.insertNewLine({row: 0, column: Infinity}); + session.doc.insertLines(1, ["\t\t"]); + + assert.equal(session.getScreenWidth(), 8); + + session.setTabSize(2); + assert.equal(session.getScreenWidth(), 4); + }, + + "test getDisplayString": function() { + var session = new EditSession(["12"]); + session.setTabSize(4); + + assert.equal(session.$getDisplayTokens("\t").length, 4); + assert.equal(session.$getDisplayTokens("abc").length, 3); + assert.equal(session.$getDisplayTokens("abc\t").length, 4); + }, + + "test issue 83": function() { + var session = new EditSession(""); + var editor = new Editor(new MockRenderer(), session); + var document = session.getDocument(); + + session.setUseWrapMode(true); + + document.insertLines(0, ["a", "b"]); + document.insertLines(2, ["c", "d"]); + document.removeLines(1, 2); + }, + + "test wrapMode init has to create wrapData array": function() { + var session = new EditSession("foo bar\nfoo bar"); + var editor = new Editor(new MockRenderer(), session); + var document = session.getDocument(); + + session.setUseWrapMode(true); + session.setWrapLimitRange(3, 3); + session.adjustWrapLimit(80); + + // Test if wrapData is there and was computed. + assert.equal(session.$wrapData.length, 2); + assert.equal(session.$wrapData[0].length, 1); + assert.equal(session.$wrapData[1].length, 1); + }, + + "test first line blank with wrap": function() { + var session = new EditSession("\nfoo"); + session.setUseWrapMode(true); + assert.equal(session.doc.getValue(), ["", "foo"].join("\n")); + }, + + "test first line blank with wrap 2" : function() { + var session = new EditSession(""); + session.setUseWrapMode(true); + session.setValue("\nfoo"); + + assert.equal(session.doc.getValue(), ["", "foo"].join("\n")); + }, + + "test fold getFoldDisplayLine": function() { + var session = createFoldTestSession(); + function assertDisplayLine(foldLine, str) { + var line = session.getLine(foldLine.end.row); + var displayLine = + session.getFoldDisplayLine(foldLine, foldLine.end.row, line.length); + assert.equal(displayLine, str); + } + + assertDisplayLine(session.$foldData[0], "function foo(args...) {") + assertDisplayLine(session.$foldData[1], " for (vfoo...ert(items[bar...\"juhu\");"); + }, + + "test foldLine idxToPosition": function() { + var session = createFoldTestSession(); + + function assertIdx2Pos(foldLineIdx, idx, row, column) { + var foldLine = session.$foldData[foldLineIdx]; + assert.position(foldLine.idxToPosition(idx), row, column); + } + +// "function foo(items) {", +// " for (var i=0; iThe cursor in this paragraph text will be offset by 1 row.

", + "

Everything after this will be offset as well due to the folds in the row before too.

" + ].join("\n")); + session.addFold('...', new Range(0, 8, 0, 42)); + session.addFold('...', new Range(1, 8, 1, 42)); + session.addFold('...', new Range(3, 7, 3, 51)); + session.setOption("wrap", 40); + session.remove(new Range(0,0, 2, 5)); + // needed because adjustWrapLimit is called async from renderer + session.adjustWrapLimit(80); + + assert.equal(session.$wrapData + "", [[], [], [40, 76]] + ""); + }, + + "test add fold": function() { + var session = createFoldTestSession(); + var fold; + + function tryAddFold(placeholder, range, shouldFail) { + var fail = false; + try { + fold = session.addFold(placeholder, range); + } catch (e) { + fail = true; + } + if (fail != shouldFail) { + throw new Error("Expected to get an exception"); + } + } + + tryAddFold("foo", new Range(0, 13, 0, 17), false); + tryAddFold("foo", new Range(0, 14, 0, 18), true); + tryAddFold("foo", new Range(0, 13, 0, 18), false); + assert.equal(session.$foldData[0].folds.length, 1); + + tryAddFold("f", new Range(0, 13, 0, 18), false); + tryAddFold("foo", new Range(0, 18, 0, 21), false); + assert.equal(session.$foldData[0].folds.length, 2); + session.removeFold(fold); + + tryAddFold("foo", new Range(0, 18, 0, 22), false); + tryAddFold("foo", new Range(0, 18, 0, 19), true); + tryAddFold("foo", new Range(0, 22, 1, 10), false); + }, + + "test add subfolds": function() { + var session = createFoldTestSession(); + var fold, oldFold; + var foldData = session.$foldData; + + oldFold = foldData[0].folds[0]; + + fold = session.addFold("fold0", new Range(0, 10, 0, 21)); + assert.equal(foldData[0].folds.length, 1); + assert.equal(fold.subFolds.length, 1); + assert.equal(fold.subFolds[0], oldFold); + + session.expandFold(fold); + assert.equal(foldData[0].folds.length, 1); + assert.equal(foldData[0].folds[0], oldFold); + assert.equal(fold.subFolds.length, 0); + + fold = session.addFold("fold0", new Range(0, 13, 2, 10)); + assert.equal(foldData.length, 1); + assert.equal(fold.subFolds.length, 2); + assert.equal(fold.subFolds[0], oldFold); + + session.expandFold(fold); + assert.equal(foldData.length, 2); + assert.equal(foldData[0].folds.length, 1); + assert.equal(foldData[0].folds[0], oldFold); + assert.equal(fold.subFolds.length, 0); + + session.unfold(null, true); + fold = session.addFold("fold0", new Range(0, 0, 0, 21)); + session.addFold("fold0", new Range(0, 1, 0, 5)); + session.addFold("fold0", new Range(0, 6, 0, 8)); + assert.equal(fold.subFolds.length, 2); + }, + + "test row cache": function() { + var session = createFoldTestSession(); + + session.screenToDocumentPosition(2,3); + assertArray(session.$docRowCache, [1,3]); + assertArray(session.$screenRowCache, [1,2]); + + session.screenToDocumentPosition(5,3); + assertArray(session.$docRowCache, [1,3,4]); + assertArray(session.$screenRowCache, [1,2,3]); + + session.screenToDocumentPosition(0,3); + assertArray(session.$docRowCache, [1,3,4]); + assertArray(session.$screenRowCache, [1,2,3]); + + var pos = session.screenToDocumentPosition(0,0); + assert.equal(pos.row, 0); + assertArray(session.$docRowCache, [1,3,4]); + assertArray(session.$screenRowCache, [1,2,3]); + + session.screenToDocumentPosition(1,0); + assertArray(session.$docRowCache, [1,3,4]); + assertArray(session.$screenRowCache, [1,2,3]); + + session.$resetRowCache(); + assertArray(session.$docRowCache, []); + assertArray(session.$screenRowCache, []); + + session.screenToDocumentPosition(1,3); + assertArray(session.$docRowCache, [1]); + assertArray(session.$screenRowCache, [1]); + + session.screenToDocumentPosition(5,3); + assertArray(session.$docRowCache, [1,3,4]); + assertArray(session.$screenRowCache, [1,2,3]); + + session = new EditSession(new Array(30).join("\n")); + session.documentToScreenPosition(2,0); + session.documentToScreenPosition(2,0); + assertArray(session.$docRowCache, [1,2]); + assertArray(session.$screenRowCache, [1,2]); + }, + + "test annotations": function() { + var session = new EditSession([]), + annotation = {row: 0, type: 'info', text: "This is a test."}; + + session.clearAnnotations(); + assertArray(session.getAnnotations(), []); + session.setAnnotations([annotation]); + assertArray(session.getAnnotations(), [annotation]); + }, + + "test: mode loading" : function(next) { + if (!require.undef) { + console.log("Skipping test: This test only runs in the browser"); + next(); + return; + } + var session = new EditSession([]); + session.setMode("ace/mode/javascript"); + assert.equal(session.$modeid, "ace/mode/javascript"); + session.on("changeMode", function() { + assert.equal(session.$modeid, "ace/mode/javascript"); + }); + session.setMode("ace/mode/sh", function(mode) { + assert.ok(!mode); + }); + setTimeout(function() { + session.setMode("ace/mode/javascript", function(mode) { + session.setMode("ace/mode/javascript"); + assert.equal(session.$modeid, "ace/mode/javascript"); + next(); + }); + }, 0); + } +}; +}); + +if (typeof module !== "undefined" && module === require.main) { + require("asyncjs").test.testcase(module.exports).exec(); +} diff --git a/addons/editor/ace/editor.js b/addons/editor/ace/editor.js new file mode 100755 index 00000000..4ff568c9 --- /dev/null +++ b/addons/editor/ace/editor.js @@ -0,0 +1,2423 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +require("./lib/fixoldbrowsers"); + +var oop = require("./lib/oop"); +var dom = require("./lib/dom"); +var lang = require("./lib/lang"); +var useragent = require("./lib/useragent"); +var TextInput = require("./keyboard/textinput").TextInput; +var MouseHandler = require("./mouse/mouse_handler").MouseHandler; +var FoldHandler = require("./mouse/fold_handler").FoldHandler; +var KeyBinding = require("./keyboard/keybinding").KeyBinding; +var EditSession = require("./edit_session").EditSession; +var Search = require("./search").Search; +var Range = require("./range").Range; +var EventEmitter = require("./lib/event_emitter").EventEmitter; +var CommandManager = require("./commands/command_manager").CommandManager; +var defaultCommands = require("./commands/default_commands").commands; +var config = require("./config"); + +/** + * The main entry point into the Ace functionality. + * + * The `Editor` manages the [[EditSession]] (which manages [[Document]]s), as well as the [[VirtualRenderer]], which draws everything to the screen. + * + * Event sessions dealing with the mouse and keyboard are bubbled up from `Document` to the `Editor`, which decides what to do with them. + * @class Editor + **/ + +/** + * Creates a new `Editor` object. + * + * @param {VirtualRenderer} renderer Associated `VirtualRenderer` that draws everything + * @param {EditSession} session The `EditSession` to refer to + * + * + * @constructor + **/ +var Editor = function(renderer, session) { + var container = renderer.getContainerElement(); + this.container = container; + this.renderer = renderer; + + this.commands = new CommandManager(useragent.isMac ? "mac" : "win", defaultCommands); + this.textInput = new TextInput(renderer.getTextAreaContainer(), this); + this.renderer.textarea = this.textInput.getElement(); + this.keyBinding = new KeyBinding(this); + + // TODO detect touch event support + this.$mouseHandler = new MouseHandler(this); + new FoldHandler(this); + + this.$blockScrolling = 0; + this.$search = new Search().set({ + wrap: true + }); + + this.$historyTracker = this.$historyTracker.bind(this); + this.commands.on("exec", this.$historyTracker); + + this.$initOperationListeners(); + + this._$emitInputEvent = lang.delayedCall(function() { + this._signal("input", {}); + this.session.bgTokenizer && this.session.bgTokenizer.scheduleStart(); + }.bind(this)); + + this.on("change", function(_, _self) { + _self._$emitInputEvent.schedule(31); + }); + + this.setSession(session || new EditSession("")); + config.resetOptions(this); + config._emit("editor", this); +}; + +(function(){ + + oop.implement(this, EventEmitter); + + this.$initOperationListeners = function() { + function last(a) {return a[a.length - 1]}; + + this.selections = []; + this.commands.on("exec", function(e) { + this.startOperation(e); + + var command = e.command; + if (command.group == "fileJump") { + var prev = this.prevOp; + if (!prev || prev.command.group != "fileJump") { + this.lastFileJumpPos = last(this.selections) + } + } else { + this.lastFileJumpPos = null; + } + }.bind(this), true); + + this.commands.on("afterExec", function(e) { + var command = e.command; + + if (command.group == "fileJump") { + if (this.lastFileJumpPos && !this.curOp.selectionChanged) { + this.selection.fromJSON(this.lastFileJumpPos); + return + } + } + this.endOperation(e); + }.bind(this), true); + + this.$opResetTimer = lang.delayedCall(this.endOperation.bind(this)); + + this.on("change", function() { + this.curOp || this.startOperation(); + this.curOp.docChanged = true; + }.bind(this), true); + + this.on("changeSelection", function() { + this.curOp || this.startOperation(); + this.curOp.selectionChanged = true; + }.bind(this), true); + } + + this.curOp = null; + this.prevOp = {}; + this.startOperation = function(commadEvent) { + if (this.curOp) { + if (!commadEvent || this.curOp.command) + return; + this.prevOp = this.curOp; + } + if (!commadEvent) { + this.previousCommand = null; + commadEvent = {}; + } + + this.$opResetTimer.schedule(); + this.curOp = { + command: commadEvent.command || {}, + args: commadEvent.args + }; + + this.selections.push(this.selection.toJSON()); + }; + + this.endOperation = function() { + if (this.curOp) { + this.prevOp = this.curOp; + this.curOp = null; + } + }; + + this.$historyTracker = function(e) { + if (!this.$mergeUndoDeltas) + return; + + + var prev = this.prevOp; + var mergeableCommands = ["backspace", "del", "insertstring"]; + // previous command was the same + var shouldMerge = prev.command && (e.command.name == prev.command.name); + if (e.command.name == "insertstring") { + var text = e.args; + if (this.mergeNextCommand === undefined) + this.mergeNextCommand = true; + + shouldMerge = shouldMerge + && this.mergeNextCommand // previous command allows to coalesce with + && (!/\s/.test(text) || /\s/.test(prev.args)) // previous insertion was of same type + + this.mergeNextCommand = true; + } else { + shouldMerge = shouldMerge + && mergeableCommands.indexOf(e.command.name) !== -1// the command is mergeable + } + + if ( + this.$mergeUndoDeltas != "always" + && Date.now() - this.sequenceStartTime > 2000 + ) { + shouldMerge = false; // the sequence is too long + } + + if (shouldMerge) + this.session.mergeUndoDeltas = true; + else if (mergeableCommands.indexOf(e.command.name) !== -1) + this.sequenceStartTime = Date.now(); + }; + + /** + * Sets a new key handler, such as "vim" or "windows". + * @param {String} keyboardHandler The new key handler + * + * + **/ + this.setKeyboardHandler = function(keyboardHandler) { + if (!keyboardHandler) { + this.keyBinding.setKeyboardHandler(null); + } else if (typeof keyboardHandler == "string") { + this.$keybindingId = keyboardHandler; + var _self = this; + config.loadModule(["keybinding", keyboardHandler], function(module) { + if (_self.$keybindingId == keyboardHandler) + _self.keyBinding.setKeyboardHandler(module && module.handler); + }); + } else { + this.$keybindingId = null; + this.keyBinding.setKeyboardHandler(keyboardHandler); + } + }; + + /** + * Returns the keyboard handler, such as "vim" or "windows". + * + * @returns {String} + * + **/ + this.getKeyboardHandler = function() { + return this.keyBinding.getKeyboardHandler(); + }; + + + /** + * Emitted whenever the [[EditSession]] changes. + * @event changeSession + * @param {Object} e An object with two properties, `oldSession` and `session`, that represent the old and new [[EditSession]]s. + * + * + **/ + /** + * Sets a new editsession to use. This method also emits the `'changeSession'` event. + * @param {EditSession} session The new session to use + * + * + **/ + this.setSession = function(session) { + if (this.session == session) + return; + + if (this.session) { + var oldSession = this.session; + this.session.removeEventListener("change", this.$onDocumentChange); + this.session.removeEventListener("changeMode", this.$onChangeMode); + this.session.removeEventListener("tokenizerUpdate", this.$onTokenizerUpdate); + this.session.removeEventListener("changeTabSize", this.$onChangeTabSize); + this.session.removeEventListener("changeWrapLimit", this.$onChangeWrapLimit); + this.session.removeEventListener("changeWrapMode", this.$onChangeWrapMode); + this.session.removeEventListener("onChangeFold", this.$onChangeFold); + this.session.removeEventListener("changeFrontMarker", this.$onChangeFrontMarker); + this.session.removeEventListener("changeBackMarker", this.$onChangeBackMarker); + this.session.removeEventListener("changeBreakpoint", this.$onChangeBreakpoint); + this.session.removeEventListener("changeAnnotation", this.$onChangeAnnotation); + this.session.removeEventListener("changeOverwrite", this.$onCursorChange); + this.session.removeEventListener("changeScrollTop", this.$onScrollTopChange); + this.session.removeEventListener("changeScrollLeft", this.$onScrollLeftChange); + + var selection = this.session.getSelection(); + selection.removeEventListener("changeCursor", this.$onCursorChange); + selection.removeEventListener("changeSelection", this.$onSelectionChange); + } + + this.session = session; + + this.$onDocumentChange = this.onDocumentChange.bind(this); + session.addEventListener("change", this.$onDocumentChange); + this.renderer.setSession(session); + + this.$onChangeMode = this.onChangeMode.bind(this); + session.addEventListener("changeMode", this.$onChangeMode); + + this.$onTokenizerUpdate = this.onTokenizerUpdate.bind(this); + session.addEventListener("tokenizerUpdate", this.$onTokenizerUpdate); + + this.$onChangeTabSize = this.renderer.onChangeTabSize.bind(this.renderer); + session.addEventListener("changeTabSize", this.$onChangeTabSize); + + this.$onChangeWrapLimit = this.onChangeWrapLimit.bind(this); + session.addEventListener("changeWrapLimit", this.$onChangeWrapLimit); + + this.$onChangeWrapMode = this.onChangeWrapMode.bind(this); + session.addEventListener("changeWrapMode", this.$onChangeWrapMode); + + this.$onChangeFold = this.onChangeFold.bind(this); + session.addEventListener("changeFold", this.$onChangeFold); + + this.$onChangeFrontMarker = this.onChangeFrontMarker.bind(this); + this.session.addEventListener("changeFrontMarker", this.$onChangeFrontMarker); + + this.$onChangeBackMarker = this.onChangeBackMarker.bind(this); + this.session.addEventListener("changeBackMarker", this.$onChangeBackMarker); + + this.$onChangeBreakpoint = this.onChangeBreakpoint.bind(this); + this.session.addEventListener("changeBreakpoint", this.$onChangeBreakpoint); + + this.$onChangeAnnotation = this.onChangeAnnotation.bind(this); + this.session.addEventListener("changeAnnotation", this.$onChangeAnnotation); + + this.$onCursorChange = this.onCursorChange.bind(this); + this.session.addEventListener("changeOverwrite", this.$onCursorChange); + + this.$onScrollTopChange = this.onScrollTopChange.bind(this); + this.session.addEventListener("changeScrollTop", this.$onScrollTopChange); + + this.$onScrollLeftChange = this.onScrollLeftChange.bind(this); + this.session.addEventListener("changeScrollLeft", this.$onScrollLeftChange); + + this.selection = session.getSelection(); + this.selection.addEventListener("changeCursor", this.$onCursorChange); + + this.$onSelectionChange = this.onSelectionChange.bind(this); + this.selection.addEventListener("changeSelection", this.$onSelectionChange); + + this.onChangeMode(); + + this.$blockScrolling += 1; + this.onCursorChange(); + this.$blockScrolling -= 1; + + this.onScrollTopChange(); + this.onScrollLeftChange(); + this.onSelectionChange(); + this.onChangeFrontMarker(); + this.onChangeBackMarker(); + this.onChangeBreakpoint(); + this.onChangeAnnotation(); + this.session.getUseWrapMode() && this.renderer.adjustWrapLimit(); + this.renderer.updateFull(); + + this._emit("changeSession", { + session: session, + oldSession: oldSession + }); + }; + + /** + * Returns the current session being used. + * @returns {EditSession} + **/ + this.getSession = function() { + return this.session; + }; + + /** + * Sets the current document to `val`. + * @param {String} val The new value to set for the document + * @param {Number} cursorPos Where to set the new value. `undefined` or 0 is selectAll, -1 is at the document start, and 1 is at the end + * + * @returns {String} The current document value + * @related Document.setValue + **/ + this.setValue = function(val, cursorPos) { + this.session.doc.setValue(val); + + if (!cursorPos) + this.selectAll(); + else if (cursorPos == 1) + this.navigateFileEnd(); + else if (cursorPos == -1) + this.navigateFileStart(); + + return val; + }; + + /** + * Returns the current session's content. + * + * @returns {String} + * @related EditSession.getValue + **/ + this.getValue = function() { + return this.session.getValue(); + }; + + /** + * + * Returns the currently highlighted selection. + * @returns {String} The highlighted selection + **/ + this.getSelection = function() { + return this.selection; + }; + + /** + * {:VirtualRenderer.onResize} + * @param {Boolean} force If `true`, recomputes the size, even if the height and width haven't changed + * + * + * @related VirtualRenderer.onResize + **/ + this.resize = function(force) { + this.renderer.onResize(force); + }; + + /** + * {:VirtualRenderer.setTheme} + * @param {String} theme The path to a theme + * + * + **/ + this.setTheme = function(theme) { + this.renderer.setTheme(theme); + }; + + /** + * {:VirtualRenderer.getTheme} + * + * @returns {String} The set theme + * @related VirtualRenderer.getTheme + **/ + this.getTheme = function() { + return this.renderer.getTheme(); + }; + + /** + * {:VirtualRenderer.setStyle} + * @param {String} style A class name + * + * + * @related VirtualRenderer.setStyle + **/ + this.setStyle = function(style) { + this.renderer.setStyle(style); + }; + + /** + * {:VirtualRenderer.unsetStyle} + * @related VirtualRenderer.unsetStyle + **/ + this.unsetStyle = function(style) { + this.renderer.unsetStyle(style); + }; + + /** + * Gets the current font size of the editor text. + */ + this.getFontSize = function () { + return this.getOption("fontSize") || + dom.computedStyle(this.container, "fontSize"); + }; + + /** + * Set a new font size (in pixels) for the editor text. + * @param {String} size A font size ( _e.g._ "12px") + * + * + **/ + this.setFontSize = function(size) { + this.setOption("fontSize", size); + }; + + this.$highlightBrackets = function() { + if (this.session.$bracketHighlight) { + this.session.removeMarker(this.session.$bracketHighlight); + this.session.$bracketHighlight = null; + } + + if (this.$highlightPending) { + return; + } + + // perform highlight async to not block the browser during navigation + var self = this; + this.$highlightPending = true; + setTimeout(function() { + self.$highlightPending = false; + + var pos = self.session.findMatchingBracket(self.getCursorPosition()); + if (pos) { + var range = new Range(pos.row, pos.column, pos.row, pos.column+1); + } else if (self.session.$mode.getMatching) { + var range = self.session.$mode.getMatching(self.session); + } + if (range) + self.session.$bracketHighlight = self.session.addMarker(range, "ace_bracket", "text"); + }, 50); + }; + + /** + * + * Brings the current `textInput` into focus. + **/ + this.focus = function() { + // Safari needs the timeout + // iOS and Firefox need it called immediately + // to be on the save side we do both + var _self = this; + setTimeout(function() { + _self.textInput.focus(); + }); + this.textInput.focus(); + }; + + /** + * Returns `true` if the current `textInput` is in focus. + * @return {Boolean} + **/ + this.isFocused = function() { + return this.textInput.isFocused(); + }; + + /** + * + * Blurs the current `textInput`. + **/ + this.blur = function() { + this.textInput.blur(); + }; + + /** + * Emitted once the editor comes into focus. + * @event focus + * + * + **/ + this.onFocus = function() { + if (this.$isFocused) + return; + this.$isFocused = true; + this.renderer.showCursor(); + this.renderer.visualizeFocus(); + this._emit("focus"); + }; + + /** + * Emitted once the editor has been blurred. + * @event blur + * + * + **/ + this.onBlur = function() { + if (!this.$isFocused) + return; + this.$isFocused = false; + this.renderer.hideCursor(); + this.renderer.visualizeBlur(); + this._emit("blur"); + }; + + this.$cursorChange = function() { + this.renderer.updateCursor(); + }; + + /** + * Emitted whenever the document is changed. + * @event change + * @param {Object} e Contains a single property, `data`, which has the delta of changes + * + * + * + **/ + this.onDocumentChange = function(e) { + var delta = e.data; + var range = delta.range; + var lastRow; + + if (range.start.row == range.end.row && delta.action != "insertLines" && delta.action != "removeLines") + lastRow = range.end.row; + else + lastRow = Infinity; + this.renderer.updateLines(range.start.row, lastRow); + + this._emit("change", e); + + // update cursor because tab characters can influence the cursor position + this.$cursorChange(); + }; + + this.onTokenizerUpdate = function(e) { + var rows = e.data; + this.renderer.updateLines(rows.first, rows.last); + }; + + + this.onScrollTopChange = function() { + this.renderer.scrollToY(this.session.getScrollTop()); + }; + + this.onScrollLeftChange = function() { + this.renderer.scrollToX(this.session.getScrollLeft()); + }; + + /** + * Emitted when the selection changes. + * + **/ + this.onCursorChange = function() { + this.$cursorChange(); + + if (!this.$blockScrolling) { + this.renderer.scrollCursorIntoView(); + } + + this.$highlightBrackets(); + this.$updateHighlightActiveLine(); + this._emit("changeSelection"); + }; + + this.$updateHighlightActiveLine = function() { + var session = this.getSession(); + + var highlight; + if (this.$highlightActiveLine) { + if ((this.$selectionStyle != "line" || !this.selection.isMultiLine())) + highlight = this.getCursorPosition(); + if (this.renderer.$maxLines && this.session.getLength() === 1) + highlight = false; + } + + if (session.$highlightLineMarker && !highlight) { + session.removeMarker(session.$highlightLineMarker.id); + session.$highlightLineMarker = null; + } else if (!session.$highlightLineMarker && highlight) { + var range = new Range(highlight.row, highlight.column, highlight.row, Infinity); + range.id = session.addMarker(range, "ace_active-line", "screenLine"); + session.$highlightLineMarker = range; + } else if (highlight) { + session.$highlightLineMarker.start.row = highlight.row; + session.$highlightLineMarker.end.row = highlight.row; + session.$highlightLineMarker.start.column = highlight.column; + session._emit("changeBackMarker"); + } + }; + + this.onSelectionChange = function(e) { + var session = this.session; + + if (session.$selectionMarker) { + session.removeMarker(session.$selectionMarker); + } + session.$selectionMarker = null; + + if (!this.selection.isEmpty()) { + var range = this.selection.getRange(); + var style = this.getSelectionStyle(); + session.$selectionMarker = session.addMarker(range, "ace_selection", style); + } else { + this.$updateHighlightActiveLine(); + } + + var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp() + this.session.highlight(re); + + this._emit("changeSelection"); + }; + + this.$getSelectionHighLightRegexp = function() { + var session = this.session; + + var selection = this.getSelectionRange(); + if (selection.isEmpty() || selection.isMultiLine()) + return; + + var startOuter = selection.start.column - 1; + var endOuter = selection.end.column + 1; + var line = session.getLine(selection.start.row); + var lineCols = line.length; + var needle = line.substring(Math.max(startOuter, 0), + Math.min(endOuter, lineCols)); + + // Make sure the outer characters are not part of the word. + if ((startOuter >= 0 && /^[\w\d]/.test(needle)) || + (endOuter <= lineCols && /[\w\d]$/.test(needle))) + return; + + needle = line.substring(selection.start.column, selection.end.column); + if (!/^[\w\d]+$/.test(needle)) + return; + + var re = this.$search.$assembleRegExp({ + wholeWord: true, + caseSensitive: true, + needle: needle + }); + + return re; + }; + + + this.onChangeFrontMarker = function() { + this.renderer.updateFrontMarkers(); + }; + + this.onChangeBackMarker = function() { + this.renderer.updateBackMarkers(); + }; + + + this.onChangeBreakpoint = function() { + this.renderer.updateBreakpoints(); + }; + + this.onChangeAnnotation = function() { + this.renderer.setAnnotations(this.session.getAnnotations()); + }; + + + this.onChangeMode = function(e) { + this.renderer.updateText(); + this._emit("changeMode", e); + }; + + + this.onChangeWrapLimit = function() { + this.renderer.updateFull(); + }; + + this.onChangeWrapMode = function() { + this.renderer.onResize(true); + }; + + + this.onChangeFold = function() { + // Update the active line marker as due to folding changes the current + // line range on the screen might have changed. + this.$updateHighlightActiveLine(); + // TODO: This might be too much updating. Okay for now. + this.renderer.updateFull(); + }; + + + /** + * Returns the string of text currently highlighted. + * @returns {String} + **/ + this.getSelectedText = function() { + return this.session.getTextRange(this.getSelectionRange()); + }; + + /** + * Emitted when text is copied. + * @event copy + * @param {String} text The copied text + * + **/ + /** + * Returns the string of text currently highlighted. + * @returns {String} + * @deprecated Use getSelectedText instead. + **/ + this.getCopyText = function() { + var text = this.getSelectedText(); + this._signal("copy", text); + return text; + }; + + /** + * Called whenever a text "copy" happens. + **/ + this.onCopy = function() { + this.commands.exec("copy", this); + }; + + /** + * Called whenever a text "cut" happens. + **/ + this.onCut = function() { + this.commands.exec("cut", this); + }; + + /** + * Emitted when text is pasted. + * @event paste + * @param {String} text The pasted text + * + * + **/ + /** + * Called whenever a text "paste" happens. + * @param {String} text The pasted text + * + * + **/ + this.onPaste = function(text) { + // todo this should change when paste becomes a command + if (this.$readOnly) + return; + this._emit("paste", text); + this.insert(text); + }; + + + this.execCommand = function(command, args) { + this.commands.exec(command, this, args); + }; + + /** + * Inserts `text` into wherever the cursor is pointing. + * @param {String} text The new text to add + * + * + **/ + this.insert = function(text) { + var session = this.session; + var mode = session.getMode(); + var cursor = this.getCursorPosition(); + + if (this.getBehavioursEnabled()) { + // Get a transform if the current mode wants one. + var transform = mode.transformAction(session.getState(cursor.row), 'insertion', this, session, text); + if (transform) { + if (text !== transform.text) { + this.session.mergeUndoDeltas = false; + this.$mergeNextCommand = false; + } + text = transform.text; + + } + } + + if (text == "\t") + text = this.session.getTabString(); + + // remove selected text + if (!this.selection.isEmpty()) { + var range = this.getSelectionRange(); + cursor = this.session.remove(range); + this.clearSelection(); + } + else if (this.session.getOverwrite()) { + var range = new Range.fromPoints(cursor, cursor); + range.end.column += text.length; + this.session.remove(range); + } + + if (text == "\n" || text == "\r\n") { + var line = session.getLine(cursor.row) + if (cursor.column > line.search(/\S|$/)) { + var d = line.substr(cursor.column).search(/\S|$/); + session.doc.removeInLine(cursor.row, cursor.column, cursor.column + d); + } + } + this.clearSelection(); + + var start = cursor.column; + var lineState = session.getState(cursor.row); + var line = session.getLine(cursor.row); + var shouldOutdent = mode.checkOutdent(lineState, line, text); + var end = session.insert(cursor, text); + + if (transform && transform.selection) { + if (transform.selection.length == 2) { // Transform relative to the current column + this.selection.setSelectionRange( + new Range(cursor.row, start + transform.selection[0], + cursor.row, start + transform.selection[1])); + } else { // Transform relative to the current row. + this.selection.setSelectionRange( + new Range(cursor.row + transform.selection[0], + transform.selection[1], + cursor.row + transform.selection[2], + transform.selection[3])); + } + } + + if (session.getDocument().isNewLine(text)) { + var lineIndent = mode.getNextLineIndent(lineState, line.slice(0, cursor.column), session.getTabString()); + + session.insert({row: cursor.row+1, column: 0}, lineIndent); + } + if (shouldOutdent) + mode.autoOutdent(lineState, session, cursor.row); + }; + + this.onTextInput = function(text) { + this.keyBinding.onTextInput(text); + }; + + this.onCommandKey = function(e, hashId, keyCode) { + this.keyBinding.onCommandKey(e, hashId, keyCode); + }; + + /** + * Pass in `true` to enable overwrites in your session, or `false` to disable. If overwrites is enabled, any text you enter will type over any text after it. If the value of `overwrite` changes, this function also emites the `changeOverwrite` event. + * @param {Boolean} overwrite Defines wheter or not to set overwrites + * + * + * @related EditSession.setOverwrite + **/ + this.setOverwrite = function(overwrite) { + this.session.setOverwrite(overwrite); + }; + + /** + * Returns `true` if overwrites are enabled; `false` otherwise. + * @returns {Boolean} + * @related EditSession.getOverwrite + **/ + this.getOverwrite = function() { + return this.session.getOverwrite(); + }; + + /** + * Sets the value of overwrite to the opposite of whatever it currently is. + * @related EditSession.toggleOverwrite + **/ + this.toggleOverwrite = function() { + this.session.toggleOverwrite(); + }; + + /** + * Sets how fast the mouse scrolling should do. + * @param {Number} speed A value indicating the new speed (in milliseconds) + **/ + this.setScrollSpeed = function(speed) { + this.setOption("scrollSpeed", speed); + }; + + /** + * Returns the value indicating how fast the mouse scroll speed is (in milliseconds). + * @returns {Number} + **/ + this.getScrollSpeed = function() { + return this.getOption("scrollSpeed"); + }; + + /** + * Sets the delay (in milliseconds) of the mouse drag. + * @param {Number} dragDelay A value indicating the new delay + **/ + this.setDragDelay = function(dragDelay) { + this.setOption("dragDelay", dragDelay); + }; + + /** + * Returns the current mouse drag delay. + * @returns {Number} + **/ + this.getDragDelay = function() { + return this.getOption("dragDelay"); + }; + + /** + * Emitted when the selection style changes, via [[Editor.setSelectionStyle]]. + * @event changeSelectionStyle + * @param {Object} data Contains one property, `data`, which indicates the new selection style + **/ + /** + * Draw selection markers spanning whole line, or only over selected text. Default value is "line" + * @param {String} style The new selection style "line"|"text" + * + **/ + this.setSelectionStyle = function(val) { + this.setOption("selectionStyle", val); + }; + + /** + * Returns the current selection style. + * @returns {String} + **/ + this.getSelectionStyle = function() { + return this.getOption("selectionStyle"); + }; + + /** + * Determines whether or not the current line should be highlighted. + * @param {Boolean} shouldHighlight Set to `true` to highlight the current line + **/ + this.setHighlightActiveLine = function(shouldHighlight) { + this.setOption("highlightActiveLine", shouldHighlight); + }; + /** + * Returns `true` if current lines are always highlighted. + * @return {Boolean} + **/ + this.getHighlightActiveLine = function() { + return this.getOption("highlightActiveLine"); + }; + this.setHighlightGutterLine = function(shouldHighlight) { + this.setOption("highlightGutterLine", shouldHighlight); + }; + + this.getHighlightGutterLine = function() { + return this.getOption("highlightGutterLine"); + }; + /** + * Determines if the currently selected word should be highlighted. + * @param {Boolean} shouldHighlight Set to `true` to highlight the currently selected word + * + **/ + this.setHighlightSelectedWord = function(shouldHighlight) { + this.setOption("highlightSelectedWord", shouldHighlight); + }; + + /** + * Returns `true` if currently highlighted words are to be highlighted. + * @returns {Boolean} + **/ + this.getHighlightSelectedWord = function() { + return this.$highlightSelectedWord; + }; + + this.setAnimatedScroll = function(shouldAnimate){ + this.renderer.setAnimatedScroll(shouldAnimate); + }; + + this.getAnimatedScroll = function(){ + return this.renderer.getAnimatedScroll(); + }; + + /** + * If `showInvisibles` is set to `true`, invisible characters—like spaces or new lines—are show in the editor. + * @param {Boolean} showInvisibles Specifies whether or not to show invisible characters + * + **/ + this.setShowInvisibles = function(showInvisibles) { + this.renderer.setShowInvisibles(showInvisibles); + }; + + /** + * Returns `true` if invisible characters are being shown. + * @returns {Boolean} + **/ + this.getShowInvisibles = function() { + return this.renderer.getShowInvisibles(); + }; + + this.setDisplayIndentGuides = function(display) { + this.renderer.setDisplayIndentGuides(display); + }; + + this.getDisplayIndentGuides = function() { + return this.renderer.getDisplayIndentGuides(); + }; + + /** + * If `showPrintMargin` is set to `true`, the print margin is shown in the editor. + * @param {Boolean} showPrintMargin Specifies whether or not to show the print margin + * + **/ + this.setShowPrintMargin = function(showPrintMargin) { + this.renderer.setShowPrintMargin(showPrintMargin); + }; + + /** + * Returns `true` if the print margin is being shown. + * @returns {Boolean} + **/ + this.getShowPrintMargin = function() { + return this.renderer.getShowPrintMargin(); + }; + + /** + * Sets the column defining where the print margin should be. + * @param {Number} showPrintMargin Specifies the new print margin + * + **/ + this.setPrintMarginColumn = function(showPrintMargin) { + this.renderer.setPrintMarginColumn(showPrintMargin); + }; + + /** + * Returns the column number of where the print margin is. + * @returns {Number} + **/ + this.getPrintMarginColumn = function() { + return this.renderer.getPrintMarginColumn(); + }; + + /** + * If `readOnly` is true, then the editor is set to read-only mode, and none of the content can change. + * @param {Boolean} readOnly Specifies whether the editor can be modified or not + * + **/ + this.setReadOnly = function(readOnly) { + this.setOption("readOnly", readOnly); + }; + + /** + * Returns `true` if the editor is set to read-only mode. + * @returns {Boolean} + **/ + this.getReadOnly = function() { + return this.getOption("readOnly"); + }; + + /** + * Specifies whether to use behaviors or not. ["Behaviors" in this case is the auto-pairing of special characters, like quotation marks, parenthesis, or brackets.]{: #BehaviorsDef} + * @param {Boolean} enabled Enables or disables behaviors + * + **/ + this.setBehavioursEnabled = function (enabled) { + this.setOption("behavioursEnabled", enabled); + }; + + /** + * Returns `true` if the behaviors are currently enabled. {:BehaviorsDef} + * + * @returns {Boolean} + **/ + this.getBehavioursEnabled = function () { + return this.getOption("behavioursEnabled"); + }; + + /** + * Specifies whether to use wrapping behaviors or not, i.e. automatically wrapping the selection with characters such as brackets + * when such a character is typed in. + * @param {Boolean} enabled Enables or disables wrapping behaviors + * + **/ + this.setWrapBehavioursEnabled = function (enabled) { + this.setOption("wrapBehavioursEnabled", enabled); + }; + + /** + * Returns `true` if the wrapping behaviors are currently enabled. + **/ + this.getWrapBehavioursEnabled = function () { + return this.getOption("wrapBehavioursEnabled"); + }; + + /** + * Indicates whether the fold widgets should be shown or not. + * @param {Boolean} show Specifies whether the fold widgets are shown + **/ + this.setShowFoldWidgets = function(show) { + this.setOption("showFoldWidgets", show); + + }; + /** + * Returns `true` if the fold widgets are shown. + * @return {Boolean} + **/ + this.getShowFoldWidgets = function() { + return this.getOption("showFoldWidgets"); + }; + + this.setFadeFoldWidgets = function(fade) { + this.setOption("fadeFoldWidgets", fade); + }; + + this.getFadeFoldWidgets = function() { + return this.getOption("fadeFoldWidgets"); + }; + + /** + * Removes words of text from the editor. A "word" is defined as a string of characters bookended by whitespace. + * @param {String} dir The direction of the deletion to occur, either "left" or "right" + * + **/ + this.remove = function(dir) { + if (this.selection.isEmpty()){ + if (dir == "left") + this.selection.selectLeft(); + else + this.selection.selectRight(); + } + + var range = this.getSelectionRange(); + if (this.getBehavioursEnabled()) { + var session = this.session; + var state = session.getState(range.start.row); + var new_range = session.getMode().transformAction(state, 'deletion', this, session, range); + + if (range.end.column == 0) { + var text = session.getTextRange(range); + if (text[text.length - 1] == "\n") { + var line = session.getLine(range.end.row) + if (/^\s+$/.test(line)) { + range.end.column = line.length + } + } + } + if (new_range) + range = new_range; + } + + this.session.remove(range); + this.clearSelection(); + }; + + /** + * Removes the word directly to the right of the current selection. + **/ + this.removeWordRight = function() { + if (this.selection.isEmpty()) + this.selection.selectWordRight(); + + this.session.remove(this.getSelectionRange()); + this.clearSelection(); + }; + + /** + * Removes the word directly to the left of the current selection. + **/ + this.removeWordLeft = function() { + if (this.selection.isEmpty()) + this.selection.selectWordLeft(); + + this.session.remove(this.getSelectionRange()); + this.clearSelection(); + }; + + /** + * Removes all the words to the left of the current selection, until the start of the line. + **/ + this.removeToLineStart = function() { + if (this.selection.isEmpty()) + this.selection.selectLineStart(); + + this.session.remove(this.getSelectionRange()); + this.clearSelection(); + }; + + /** + * Removes all the words to the right of the current selection, until the end of the line. + **/ + this.removeToLineEnd = function() { + if (this.selection.isEmpty()) + this.selection.selectLineEnd(); + + var range = this.getSelectionRange(); + if (range.start.column == range.end.column && range.start.row == range.end.row) { + range.end.column = 0; + range.end.row++; + } + + this.session.remove(range); + this.clearSelection(); + }; + + /** + * Splits the line at the current selection (by inserting an `'\n'`). + **/ + this.splitLine = function() { + if (!this.selection.isEmpty()) { + this.session.remove(this.getSelectionRange()); + this.clearSelection(); + } + + var cursor = this.getCursorPosition(); + this.insert("\n"); + this.moveCursorToPosition(cursor); + }; + + /** + * Transposes current line. + **/ + this.transposeLetters = function() { + if (!this.selection.isEmpty()) { + return; + } + + var cursor = this.getCursorPosition(); + var column = cursor.column; + if (column === 0) + return; + + var line = this.session.getLine(cursor.row); + var swap, range; + if (column < line.length) { + swap = line.charAt(column) + line.charAt(column-1); + range = new Range(cursor.row, column-1, cursor.row, column+1); + } + else { + swap = line.charAt(column-1) + line.charAt(column-2); + range = new Range(cursor.row, column-2, cursor.row, column); + } + this.session.replace(range, swap); + }; + + /** + * Converts the current selection entirely into lowercase. + **/ + this.toLowerCase = function() { + var originalRange = this.getSelectionRange(); + if (this.selection.isEmpty()) { + this.selection.selectWord(); + } + + var range = this.getSelectionRange(); + var text = this.session.getTextRange(range); + this.session.replace(range, text.toLowerCase()); + this.selection.setSelectionRange(originalRange); + }; + + /** + * Converts the current selection entirely into uppercase. + **/ + this.toUpperCase = function() { + var originalRange = this.getSelectionRange(); + if (this.selection.isEmpty()) { + this.selection.selectWord(); + } + + var range = this.getSelectionRange(); + var text = this.session.getTextRange(range); + this.session.replace(range, text.toUpperCase()); + this.selection.setSelectionRange(originalRange); + }; + + /** + * Inserts an indentation into the current cursor position or indents the selected lines. + * + * @related EditSession.indentRows + **/ + this.indent = function() { + var session = this.session; + var range = this.getSelectionRange(); + + if (range.start.row < range.end.row) { + var rows = this.$getSelectedRows(); + session.indentRows(rows.first, rows.last, "\t"); + return; + } else if (range.start.column < range.end.column) { + var text = session.getTextRange(range) + if (!/^\s+$/.test(text)) { + var rows = this.$getSelectedRows(); + session.indentRows(rows.first, rows.last, "\t"); + return; + } + } + + var line = session.getLine(range.start.row) + var position = range.start; + var size = session.getTabSize(); + var column = session.documentToScreenColumn(position.row, position.column); + + if (this.session.getUseSoftTabs()) { + var count = (size - column % size); + var indentString = lang.stringRepeat(" ", count); + } else { + var count = column % size; + while (line[range.start.column] == " " && count) { + range.start.column--; + count--; + } + this.selection.setSelectionRange(range); + indentString = "\t"; + } + return this.insert(indentString); + }; + + /** + * Indents the current line. + * @related EditSession.indentRows + **/ + this.blockIndent = function() { + var rows = this.$getSelectedRows(); + this.session.indentRows(rows.first, rows.last, "\t"); + }; + + /** + * Outdents the current line. + * @related EditSession.outdentRows + **/ + this.blockOutdent = function() { + var selection = this.session.getSelection(); + this.session.outdentRows(selection.getRange()); + }; + + // TODO: move out of core when we have good mechanism for managing extensions + this.sortLines = function() { + var rows = this.$getSelectedRows(); + var session = this.session; + + var lines = []; + for (i = rows.first; i <= rows.last; i++) + lines.push(session.getLine(i)); + + lines.sort(function(a, b) { + if (a.toLowerCase() < b.toLowerCase()) return -1; + if (a.toLowerCase() > b.toLowerCase()) return 1; + return 0; + }); + + var deleteRange = new Range(0, 0, 0, 0); + for (var i = rows.first; i <= rows.last; i++) { + var line = session.getLine(i); + deleteRange.start.row = i; + deleteRange.end.row = i; + deleteRange.end.column = line.length; + session.replace(deleteRange, lines[i-rows.first]); + } + }; + + /** + * Given the currently selected range, this function either comments all the lines, or uncomments all of them. + **/ + this.toggleCommentLines = function() { + var state = this.session.getState(this.getCursorPosition().row); + var rows = this.$getSelectedRows(); + this.session.getMode().toggleCommentLines(state, this.session, rows.first, rows.last); + }; + + this.toggleBlockComment = function() { + var cursor = this.getCursorPosition(); + var state = this.session.getState(cursor.row); + var range = this.getSelectionRange(); + this.session.getMode().toggleBlockComment(state, this.session, range, cursor); + }; + + /** + * Works like [[EditSession.getTokenAt]], except it returns a number. + * @returns {Number} + **/ + this.getNumberAt = function( row, column ) { + var _numberRx = /[\-]?[0-9]+(?:\.[0-9]+)?/g + _numberRx.lastIndex = 0 + + var s = this.session.getLine(row) + while (_numberRx.lastIndex < column) { + var m = _numberRx.exec(s) + if(m.index <= column && m.index+m[0].length >= column){ + var number = { + value: m[0], + start: m.index, + end: m.index+m[0].length + } + return number; + } + } + return null; + }; + + /** + * If the character before the cursor is a number, this functions changes its value by `amount`. + * @param {Number} amount The value to change the numeral by (can be negative to decrease value) + * + **/ + this.modifyNumber = function(amount) { + var row = this.selection.getCursor().row; + var column = this.selection.getCursor().column; + + // get the char before the cursor + var charRange = new Range(row, column-1, row, column); + + var c = this.session.getTextRange(charRange); + // if the char is a digit + if (!isNaN(parseFloat(c)) && isFinite(c)) { + // get the whole number the digit is part of + var nr = this.getNumberAt(row, column); + // if number found + if (nr) { + var fp = nr.value.indexOf(".") >= 0 ? nr.start + nr.value.indexOf(".") + 1 : nr.end; + var decimals = nr.start + nr.value.length - fp; + + var t = parseFloat(nr.value); + t *= Math.pow(10, decimals); + + + if(fp !== nr.end && column < fp){ + amount *= Math.pow(10, nr.end - column - 1); + } else { + amount *= Math.pow(10, nr.end - column); + } + + t += amount; + t /= Math.pow(10, decimals); + var nnr = t.toFixed(decimals); + + //update number + var replaceRange = new Range(row, nr.start, row, nr.end); + this.session.replace(replaceRange, nnr); + + //reposition the cursor + this.moveCursorTo(row, Math.max(nr.start +1, column + nnr.length - nr.value.length)); + + } + } + }; + + /** + * Removes all the lines in the current selection + * @related EditSession.remove + **/ + this.removeLines = function() { + var rows = this.$getSelectedRows(); + var range; + if (rows.first === 0 || rows.last+1 < this.session.getLength()) + range = new Range(rows.first, 0, rows.last+1, 0); + else + range = new Range( + rows.first-1, this.session.getLine(rows.first-1).length, + rows.last, this.session.getLine(rows.last).length + ); + this.session.remove(range); + this.clearSelection(); + }; + + this.duplicateSelection = function() { + var sel = this.selection; + var doc = this.session; + var range = sel.getRange(); + var reverse = sel.isBackwards(); + if (range.isEmpty()) { + var row = range.start.row; + doc.duplicateLines(row, row); + } else { + var point = reverse ? range.start : range.end; + var endPoint = doc.insert(point, doc.getTextRange(range), false); + range.start = point; + range.end = endPoint; + + sel.setSelectionRange(range, reverse) + } + }; + + /** + * Shifts all the selected lines down one row. + * + * @returns {Number} On success, it returns -1. + * @related EditSession.moveLinesUp + **/ + this.moveLinesDown = function() { + this.$moveLines(function(firstRow, lastRow) { + return this.session.moveLinesDown(firstRow, lastRow); + }); + }; + + /** + * Shifts all the selected lines up one row. + * @returns {Number} On success, it returns -1. + * @related EditSession.moveLinesDown + **/ + this.moveLinesUp = function() { + this.$moveLines(function(firstRow, lastRow) { + return this.session.moveLinesUp(firstRow, lastRow); + }); + }; + + /** + * Moves a range of text from the given range to the given position. `toPosition` is an object that looks like this: + * ```json + * { row: newRowLocation, column: newColumnLocation } + * ``` + * @param {Range} fromRange The range of text you want moved within the document + * @param {Object} toPosition The location (row and column) where you want to move the text to + * + * @returns {Range} The new range where the text was moved to. + * @related EditSession.moveText + **/ + this.moveText = function(range, toPosition, copy) { + return this.session.moveText(range, toPosition, copy); + }; + + /** + * Copies all the selected lines up one row. + * @returns {Number} On success, returns 0. + * + **/ + this.copyLinesUp = function() { + this.$moveLines(function(firstRow, lastRow) { + this.session.duplicateLines(firstRow, lastRow); + return 0; + }); + }; + + /** + * Copies all the selected lines down one row. + * @returns {Number} On success, returns the number of new rows added; in other words, `lastRow - firstRow + 1`. + * @related EditSession.duplicateLines + * + **/ + this.copyLinesDown = function() { + this.$moveLines(function(firstRow, lastRow) { + return this.session.duplicateLines(firstRow, lastRow); + }); + }; + + /** + * Executes a specific function, which can be anything that manipulates selected lines, such as copying them, duplicating them, or shifting them. + * @param {Function} mover A method to call on each selected row + * + * + **/ + this.$moveLines = function(mover) { + var selection = this.selection; + if (!selection.inMultiSelectMode || this.inVirtualSelectionMode) { + var range = selection.toOrientedRange(); + var rows = this.$getSelectedRows(range); + var linesMoved = mover.call(this, rows.first, rows.last); + range.moveBy(linesMoved, 0); + selection.fromOrientedRange(range); + } else { + var ranges = selection.rangeList.ranges; + selection.rangeList.detach(this.session); + + for (var i = ranges.length; i--; ) { + var rangeIndex = i; + var rows = ranges[i].collapseRows(); + var last = rows.end.row; + var first = rows.start.row; + while (i--) { + var rows = ranges[i].collapseRows(); + if (first - rows.end.row <= 1) + first = rows.end.row; + else + break; + } + i++; + + var linesMoved = mover.call(this, first, last); + while (rangeIndex >= i) { + ranges[rangeIndex].moveBy(linesMoved, 0); + rangeIndex--; + } + } + selection.fromOrientedRange(selection.ranges[0]); + selection.rangeList.attach(this.session); + } + }; + + /** + * Returns an object indicating the currently selected rows. The object looks like this: + * + * ```json + * { first: range.start.row, last: range.end.row } + * ``` + * + * @returns {Object} + **/ + this.$getSelectedRows = function() { + var range = this.getSelectionRange().collapseRows(); + + return { + first: range.start.row, + last: range.end.row + }; + }; + + this.onCompositionStart = function(text) { + this.renderer.showComposition(this.getCursorPosition()); + }; + + this.onCompositionUpdate = function(text) { + this.renderer.setCompositionText(text); + }; + + this.onCompositionEnd = function() { + this.renderer.hideComposition(); + }; + + /** + * {:VirtualRenderer.getFirstVisibleRow} + * + * @returns {Number} + * @related VirtualRenderer.getFirstVisibleRow + **/ + this.getFirstVisibleRow = function() { + return this.renderer.getFirstVisibleRow(); + }; + + /** + * {:VirtualRenderer.getLastVisibleRow} + * + * @returns {Number} + * @related VirtualRenderer.getLastVisibleRow + **/ + this.getLastVisibleRow = function() { + return this.renderer.getLastVisibleRow(); + }; + + /** + * Indicates if the row is currently visible on the screen. + * @param {Number} row The row to check + * + * @returns {Boolean} + **/ + this.isRowVisible = function(row) { + return (row >= this.getFirstVisibleRow() && row <= this.getLastVisibleRow()); + }; + + /** + * Indicates if the entire row is currently visible on the screen. + * @param {Number} row The row to check + * + * + * @returns {Boolean} + **/ + this.isRowFullyVisible = function(row) { + return (row >= this.renderer.getFirstFullyVisibleRow() && row <= this.renderer.getLastFullyVisibleRow()); + }; + + /** + * Returns the number of currently visibile rows. + * @returns {Number} + **/ + this.$getVisibleRowCount = function() { + return this.renderer.getScrollBottomRow() - this.renderer.getScrollTopRow() + 1; + }; + + this.$moveByPage = function(dir, select) { + var renderer = this.renderer; + var config = this.renderer.layerConfig; + var rows = dir * Math.floor(config.height / config.lineHeight); + + this.$blockScrolling++; + if (select == true) { + this.selection.$moveSelection(function(){ + this.moveCursorBy(rows, 0); + }); + } else if (select == false) { + this.selection.moveCursorBy(rows, 0); + this.selection.clearSelection(); + } + this.$blockScrolling--; + + var scrollTop = renderer.scrollTop; + + renderer.scrollBy(0, rows * config.lineHeight); + if (select != null) + renderer.scrollCursorIntoView(null, 0.5); + + renderer.animateScrolling(scrollTop); + }; + + /** + * Selects the text from the current position of the document until where a "page down" finishes. + **/ + this.selectPageDown = function() { + this.$moveByPage(1, true); + }; + + /** + * Selects the text from the current position of the document until where a "page up" finishes. + **/ + this.selectPageUp = function() { + this.$moveByPage(-1, true); + }; + + /** + * Shifts the document to wherever "page down" is, as well as moving the cursor position. + **/ + this.gotoPageDown = function() { + this.$moveByPage(1, false); + }; + + /** + * Shifts the document to wherever "page up" is, as well as moving the cursor position. + **/ + this.gotoPageUp = function() { + this.$moveByPage(-1, false); + }; + + /** + * Scrolls the document to wherever "page down" is, without changing the cursor position. + **/ + this.scrollPageDown = function() { + this.$moveByPage(1); + }; + + /** + * Scrolls the document to wherever "page up" is, without changing the cursor position. + **/ + this.scrollPageUp = function() { + this.$moveByPage(-1); + }; + + /** + * Moves the editor to the specified row. + * @related VirtualRenderer.scrollToRow + **/ + this.scrollToRow = function(row) { + this.renderer.scrollToRow(row); + }; + + /** + * Scrolls to a line. If `center` is `true`, it puts the line in middle of screen (or attempts to). + * @param {Number} line The line to scroll to + * @param {Boolean} center If `true` + * @param {Boolean} animate If `true` animates scrolling + * @param {Function} callback Function to be called when the animation has finished + * + * + * @related VirtualRenderer.scrollToLine + **/ + this.scrollToLine = function(line, center, animate, callback) { + this.renderer.scrollToLine(line, center, animate, callback); + }; + + /** + * Attempts to center the current selection on the screen. + **/ + this.centerSelection = function() { + var range = this.getSelectionRange(); + var pos = { + row: Math.floor(range.start.row + (range.end.row - range.start.row) / 2), + column: Math.floor(range.start.column + (range.end.column - range.start.column) / 2) + } + this.renderer.alignCursor(pos, 0.5); + }; + + /** + * Gets the current position of the cursor. + * @returns {Object} An object that looks something like this: + * + * ```json + * { row: currRow, column: currCol } + * ``` + * + * @related Selection.getCursor + **/ + this.getCursorPosition = function() { + return this.selection.getCursor(); + }; + + /** + * Returns the screen position of the cursor. + * @returns {Number} + * @related EditSession.documentToScreenPosition + **/ + this.getCursorPositionScreen = function() { + return this.session.documentToScreenPosition(this.getCursorPosition()); + }; + + /** + * {:Selection.getRange} + * @returns {Range} + * @related Selection.getRange + **/ + this.getSelectionRange = function() { + return this.selection.getRange(); + }; + + + /** + * Selects all the text in editor. + * @related Selection.selectAll + **/ + this.selectAll = function() { + this.$blockScrolling += 1; + this.selection.selectAll(); + this.$blockScrolling -= 1; + }; + + /** + * {:Selection.clearSelection} + * @related Selection.clearSelection + **/ + this.clearSelection = function() { + this.selection.clearSelection(); + }; + + /** + * Moves the cursor to the specified row and column. Note that this does not de-select the current selection. + * @param {Number} row The new row number + * @param {Number} column The new column number + * + * + * @related Selection.moveCursorTo + **/ + this.moveCursorTo = function(row, column) { + this.selection.moveCursorTo(row, column); + }; + + /** + * Moves the cursor to the position indicated by `pos.row` and `pos.column`. + * @param {Object} pos An object with two properties, row and column + * + * + * @related Selection.moveCursorToPosition + **/ + this.moveCursorToPosition = function(pos) { + this.selection.moveCursorToPosition(pos); + }; + + /** + * Moves the cursor's row and column to the next matching bracket. + * + **/ + this.jumpToMatching = function(select) { + var cursor = this.getCursorPosition(); + + var range = this.session.getBracketRange(cursor); + if (!range) { + range = this.find({ + needle: /[{}()\[\]]/g, + preventScroll:true, + start: {row: cursor.row, column: cursor.column - 1} + }); + if (!range) + return; + var pos = range.start; + if (pos.row == cursor.row && Math.abs(pos.column - cursor.column) < 2) + range = this.session.getBracketRange(pos); + } + + pos = range && range.cursor || pos; + if (pos) { + if (select) { + if (range && range.isEqual(this.getSelectionRange())) + this.clearSelection(); + else + this.selection.selectTo(pos.row, pos.column); + } else { + this.clearSelection(); + this.moveCursorTo(pos.row, pos.column); + } + } + }; + + /** + * Moves the cursor to the specified line number, and also into the indiciated column. + * @param {Number} lineNumber The line number to go to + * @param {Number} column A column number to go to + * @param {Boolean} animate If `true` animates scolling + * + **/ + this.gotoLine = function(lineNumber, column, animate) { + this.selection.clearSelection(); + this.session.unfold({row: lineNumber - 1, column: column || 0}); + + this.$blockScrolling += 1; + // todo: find a way to automatically exit multiselect mode + this.exitMultiSelectMode && this.exitMultiSelectMode(); + this.moveCursorTo(lineNumber - 1, column || 0); + this.$blockScrolling -= 1; + + if (!this.isRowFullyVisible(lineNumber - 1)) + this.scrollToLine(lineNumber - 1, true, animate); + }; + + /** + * Moves the cursor to the specified row and column. Note that this does de-select the current selection. + * @param {Number} row The new row number + * @param {Number} column The new column number + * + * + * @related Editor.moveCursorTo + **/ + this.navigateTo = function(row, column) { + this.clearSelection(); + this.moveCursorTo(row, column); + }; + + /** + * Moves the cursor up in the document the specified number of times. Note that this does de-select the current selection. + * @param {Number} times The number of times to change navigation + * + * + **/ + this.navigateUp = function(times) { + if (this.selection.isMultiLine() && !this.selection.isBackwards()) { + var selectionStart = this.selection.anchor.getPosition(); + return this.moveCursorToPosition(selectionStart); + } + this.selection.clearSelection(); + times = times || 1; + this.selection.moveCursorBy(-times, 0); + }; + + /** + * Moves the cursor down in the document the specified number of times. Note that this does de-select the current selection. + * @param {Number} times The number of times to change navigation + * + * + **/ + this.navigateDown = function(times) { + if (this.selection.isMultiLine() && this.selection.isBackwards()) { + var selectionEnd = this.selection.anchor.getPosition(); + return this.moveCursorToPosition(selectionEnd); + } + this.selection.clearSelection(); + times = times || 1; + this.selection.moveCursorBy(times, 0); + }; + + /** + * Moves the cursor left in the document the specified number of times. Note that this does de-select the current selection. + * @param {Number} times The number of times to change navigation + * + * + **/ + this.navigateLeft = function(times) { + if (!this.selection.isEmpty()) { + var selectionStart = this.getSelectionRange().start; + this.moveCursorToPosition(selectionStart); + } + else { + times = times || 1; + while (times--) { + this.selection.moveCursorLeft(); + } + } + this.clearSelection(); + }; + + /** + * Moves the cursor right in the document the specified number of times. Note that this does de-select the current selection. + * @param {Number} times The number of times to change navigation + * + * + **/ + this.navigateRight = function(times) { + if (!this.selection.isEmpty()) { + var selectionEnd = this.getSelectionRange().end; + this.moveCursorToPosition(selectionEnd); + } + else { + times = times || 1; + while (times--) { + this.selection.moveCursorRight(); + } + } + this.clearSelection(); + }; + + /** + * + * Moves the cursor to the start of the current line. Note that this does de-select the current selection. + **/ + this.navigateLineStart = function() { + this.selection.moveCursorLineStart(); + this.clearSelection(); + }; + + /** + * + * Moves the cursor to the end of the current line. Note that this does de-select the current selection. + **/ + this.navigateLineEnd = function() { + this.selection.moveCursorLineEnd(); + this.clearSelection(); + }; + + /** + * + * Moves the cursor to the end of the current file. Note that this does de-select the current selection. + **/ + this.navigateFileEnd = function() { + var scrollTop = this.renderer.scrollTop; + this.selection.moveCursorFileEnd(); + this.clearSelection(); + this.renderer.animateScrolling(scrollTop); + }; + + /** + * + * Moves the cursor to the start of the current file. Note that this does de-select the current selection. + **/ + this.navigateFileStart = function() { + var scrollTop = this.renderer.scrollTop; + this.selection.moveCursorFileStart(); + this.clearSelection(); + this.renderer.animateScrolling(scrollTop); + }; + + /** + * + * Moves the cursor to the word immediately to the right of the current position. Note that this does de-select the current selection. + **/ + this.navigateWordRight = function() { + this.selection.moveCursorWordRight(); + this.clearSelection(); + }; + + /** + * + * Moves the cursor to the word immediately to the left of the current position. Note that this does de-select the current selection. + **/ + this.navigateWordLeft = function() { + this.selection.moveCursorWordLeft(); + this.clearSelection(); + }; + + /** + * Replaces the first occurance of `options.needle` with the value in `replacement`. + * @param {String} replacement The text to replace with + * @param {Object} options The [[Search `Search`]] options to use + * + * + **/ + this.replace = function(replacement, options) { + if (options) + this.$search.set(options); + + var range = this.$search.find(this.session); + var replaced = 0; + if (!range) + return replaced; + + if (this.$tryReplace(range, replacement)) { + replaced = 1; + } + if (range !== null) { + this.selection.setSelectionRange(range); + this.renderer.scrollSelectionIntoView(range.start, range.end); + } + + return replaced; + }; + + /** + * Replaces all occurances of `options.needle` with the value in `replacement`. + * @param {String} replacement The text to replace with + * @param {Object} options The [[Search `Search`]] options to use + * + * + **/ + this.replaceAll = function(replacement, options) { + if (options) { + this.$search.set(options); + } + + var ranges = this.$search.findAll(this.session); + var replaced = 0; + if (!ranges.length) + return replaced; + + this.$blockScrolling += 1; + + var selection = this.getSelectionRange(); + this.clearSelection(); + this.selection.moveCursorTo(0, 0); + + for (var i = ranges.length - 1; i >= 0; --i) { + if(this.$tryReplace(ranges[i], replacement)) { + replaced++; + } + } + + this.selection.setSelectionRange(selection); + this.$blockScrolling -= 1; + + return replaced; + }; + + this.$tryReplace = function(range, replacement) { + var input = this.session.getTextRange(range); + replacement = this.$search.replace(input, replacement); + if (replacement !== null) { + range.end = this.session.replace(range, replacement); + return range; + } else { + return null; + } + }; + + /** + * {:Search.getOptions} For more information on `options`, see [[Search `Search`]]. + * @related Search.getOptions + * @returns {Object} + **/ + this.getLastSearchOptions = function() { + return this.$search.getOptions(); + }; + + /** + * Attempts to find `needle` within the document. For more information on `options`, see [[Search `Search`]]. + * @param {String} needle The text to search for (optional) + * @param {Object} options An object defining various search properties + * @param {Boolean} animate If `true` animate scrolling + * + * + * @related Search.find + **/ + this.find = function(needle, options, animate) { + if (!options) + options = {}; + + if (typeof needle == "string" || needle instanceof RegExp) + options.needle = needle; + else if (typeof needle == "object") + oop.mixin(options, needle); + + var range = this.selection.getRange(); + if (options.needle == null) { + needle = this.session.getTextRange(range) + || this.$search.$options.needle; + if (!needle) { + range = this.session.getWordRange(range.start.row, range.start.column); + needle = this.session.getTextRange(range); + } + this.$search.set({needle: needle}); + } + + this.$search.set(options); + if (!options.start) + this.$search.set({start: range}); + + var newRange = this.$search.find(this.session); + if (options.preventScroll) + return newRange; + if (newRange) { + this.revealRange(newRange, animate); + return newRange; + } + // clear selection if nothing is found + if (options.backwards) + range.start = range.end; + else + range.end = range.start; + this.selection.setRange(range); + }; + + /** + * Performs another search for `needle` in the document. For more information on `options`, see [[Search `Search`]]. + * @param {Object} options search options + * @param {Boolean} animate If `true` animate scrolling + * + * + * @related Editor.find + **/ + this.findNext = function(options, animate) { + this.find({skipCurrent: true, backwards: false}, options, animate); + }; + + /** + * Performs a search for `needle` backwards. For more information on `options`, see [[Search `Search`]]. + * @param {Object} options search options + * @param {Boolean} animate If `true` animate scrolling + * + * + * @related Editor.find + **/ + this.findPrevious = function(options, animate) { + this.find(options, {skipCurrent: true, backwards: true}, animate); + }; + + this.revealRange = function(range, animate) { + this.$blockScrolling += 1; + this.session.unfold(range); + this.selection.setSelectionRange(range); + this.$blockScrolling -= 1; + + var scrollTop = this.renderer.scrollTop; + this.renderer.scrollSelectionIntoView(range.start, range.end, 0.5); + if (animate != false) + this.renderer.animateScrolling(scrollTop); + }; + + /** + * {:UndoManager.undo} + * @related UndoManager.undo + **/ + this.undo = function() { + this.$blockScrolling++; + this.session.getUndoManager().undo(); + this.$blockScrolling--; + this.renderer.scrollCursorIntoView(null, 0.5); + }; + + /** + * {:UndoManager.redo} + * @related UndoManager.redo + **/ + this.redo = function() { + this.$blockScrolling++; + this.session.getUndoManager().redo(); + this.$blockScrolling--; + this.renderer.scrollCursorIntoView(null, 0.5); + }; + + /** + * + * Cleans up the entire editor. + **/ + this.destroy = function() { + this.renderer.destroy(); + this._emit("destroy", this); + }; + + /** + * Enables automatic scrolling of the cursor into view when editor itself is inside scrollable element + * @param {Boolean} enable default true + **/ + this.setAutoScrollEditorIntoView = function(enable) { + if (enable === false) + return; + var rect; + var self = this; + var shouldScroll = false; + if (!this.$scrollAnchor) + this.$scrollAnchor = document.createElement("div"); + var scrollAnchor = this.$scrollAnchor; + scrollAnchor.style.cssText = "position:absolute"; + this.container.insertBefore(scrollAnchor, this.container.firstChild); + var onChangeSelection = this.on("changeSelection", function() { + shouldScroll = true; + }); + // needed to not trigger sync reflow + var onBeforeRender = this.renderer.on("beforeRender", function() { + if (shouldScroll) + rect = self.renderer.container.getBoundingClientRect(); + }); + var onAfterRender = this.renderer.on("afterRender", function() { + if (shouldScroll && rect && self.isFocused()) { + var renderer = self.renderer; + var pos = renderer.$cursorLayer.$pixelPos; + var config = renderer.layerConfig; + var top = pos.top - config.offset; + if (pos.top >= 0 && top + rect.top < 0) { + shouldScroll = true; + } else if (pos.top < config.height && + pos.top + rect.top + config.lineHeight > window.innerHeight) { + shouldScroll = false; + } else { + shouldScroll = null; + } + if (shouldScroll != null) { + scrollAnchor.style.top = top + "px"; + scrollAnchor.style.left = pos.left + "px"; + scrollAnchor.style.height = config.lineHeight + "px"; + scrollAnchor.scrollIntoView(shouldScroll); + } + shouldScroll = rect = null; + } + }); + this.setAutoScrollEditorIntoView = function(enable) { + if (enable === true) + return; + delete this.setAutoScrollEditorIntoView; + this.removeEventListener("changeSelection", onChangeSelection); + this.renderer.removeEventListener("afterRender", onAfterRender); + this.renderer.removeEventListener("beforeRender", onBeforeRender); + }; + }; + + + this.$resetCursorStyle = function() { + var style = this.$cursorStyle || "ace"; + var cursorLayer = this.renderer.$cursorLayer; + if (!cursorLayer) + return; + cursorLayer.setSmoothBlinking(style == "smooth"); + cursorLayer.isBlinking = !this.$readOnly && style != "wide"; + }; + +}).call(Editor.prototype); + + + +config.defineOptions(Editor.prototype, "editor", { + selectionStyle: { + set: function(style) { + this.onSelectionChange(); + this._emit("changeSelectionStyle", {data: style}); + }, + initialValue: "line" + }, + highlightActiveLine: { + set: function() {this.$updateHighlightActiveLine();}, + initialValue: true + }, + highlightSelectedWord: { + set: function(shouldHighlight) {this.$onSelectionChange();}, + initialValue: true + }, + readOnly: { + set: function(readOnly) { + this.textInput.setReadOnly(readOnly); + this.$resetCursorStyle(); + }, + initialValue: false + }, + cursorStyle: { + set: function(val) { this.$resetCursorStyle(); }, + values: ["ace", "slim", "smooth", "wide"], + initialValue: "ace" + }, + mergeUndoDeltas: { + values: [false, true, "always"], + initialValue: true + }, + behavioursEnabled: {initialValue: true}, + wrapBehavioursEnabled: {initialValue: true}, + + hScrollBarAlwaysVisible: "renderer", + vScrollBarAlwaysVisible: "renderer", + highlightGutterLine: "renderer", + animatedScroll: "renderer", + showInvisibles: "renderer", + showPrintMargin: "renderer", + printMarginColumn: "renderer", + printMargin: "renderer", + fadeFoldWidgets: "renderer", + showFoldWidgets: "renderer", + showGutter: "renderer", + displayIndentGuides: "renderer", + fontSize: "renderer", + fontFamily: "renderer", + maxLines: "renderer", + minLines: "renderer", + scrollPastEnd: "renderer", + fixedWidthGutter: "renderer", + + scrollSpeed: "$mouseHandler", + dragDelay: "$mouseHandler", + dragEnabled: "$mouseHandler", + focusTimout: "$mouseHandler", + + firstLineNumber: "session", + overwrite: "session", + newLineMode: "session", + useWorker: "session", + useSoftTabs: "session", + tabSize: "session", + wrap: "session", + foldStyle: "session" +}); + +exports.Editor = Editor; +}); diff --git a/addons/editor/ace/editor_change_document_test.js b/addons/editor/ace/editor_change_document_test.js new file mode 100755 index 00000000..a1fdaad9 --- /dev/null +++ b/addons/editor/ace/editor_change_document_test.js @@ -0,0 +1,188 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +if (typeof process !== "undefined") { + require("amd-loader"); + require("./test/mockdom"); +} + +define(function(require, exports, module) { +"use strict"; + +var EditSession = require("./edit_session").EditSession; +var Editor = require("./editor").Editor; +var Text = require("./mode/text").Mode; +var JavaScriptMode = require("./mode/javascript").Mode; +var CssMode = require("./mode/css").Mode; +var HtmlMode = require("./mode/html").Mode; +var MockRenderer = require("./test/mockrenderer").MockRenderer; +var assert = require("./test/assertions"); + +module.exports = { + + setUp : function(next) { + this.session1 = new EditSession(["abc", "def"]); + this.session2 = new EditSession(["ghi", "jkl"]); + + + this.editor = new Editor(new MockRenderer()); + next(); + }, + + "test: change document" : function() { + this.editor.setSession(this.session1); + assert.equal(this.editor.getSession(), this.session1); + + this.editor.setSession(this.session2); + assert.equal(this.editor.getSession(), this.session2); + }, + + "test: only changes to the new document should have effect" : function() { + var called = false; + this.editor.onDocumentChange = function() { + called = true; + }; + + this.editor.setSession(this.session1); + this.editor.setSession(this.session2); + + this.session1.duplicateLines(0, 0); + assert.notOk(called); + + this.session2.duplicateLines(0, 0); + assert.ok(called); + }, + + "test: should use cursor of new document" : function() { + this.session1.getSelection().moveCursorTo(0, 1); + this.session2.getSelection().moveCursorTo(1, 0); + + this.editor.setSession(this.session1); + assert.position(this.editor.getCursorPosition(), 0, 1); + + this.editor.setSession(this.session2); + assert.position(this.editor.getCursorPosition(), 1, 0); + }, + + "test: only changing the cursor of the new doc should not have an effect" : function() { + this.editor.onCursorChange = function() { + called = true; + }; + + this.editor.setSession(this.session1); + this.editor.setSession(this.session2); + assert.position(this.editor.getCursorPosition(), 0, 0); + + var called = false; + this.session1.getSelection().moveCursorTo(0, 1); + assert.position(this.editor.getCursorPosition(), 0, 0); + assert.notOk(called); + + this.session2.getSelection().moveCursorTo(1, 1); + assert.position(this.editor.getCursorPosition(), 1, 1); + assert.ok(called); + }, + + "test: should use selection of new document" : function() { + this.session1.getSelection().selectTo(0, 1); + this.session2.getSelection().selectTo(1, 0); + + this.editor.setSession(this.session1); + assert.position(this.editor.getSelection().getSelectionLead(), 0, 1); + + this.editor.setSession(this.session2); + assert.position(this.editor.getSelection().getSelectionLead(), 1, 0); + }, + + "test: only changing the selection of the new doc should not have an effect" : function() { + this.editor.onSelectionChange = function() { + called = true; + }; + + this.editor.setSession(this.session1); + this.editor.setSession(this.session2); + assert.position(this.editor.getSelection().getSelectionLead(), 0, 0); + + var called = false; + this.session1.getSelection().selectTo(0, 1); + assert.position(this.editor.getSelection().getSelectionLead(), 0, 0); + assert.notOk(called); + + this.session2.getSelection().selectTo(1, 1); + assert.position(this.editor.getSelection().getSelectionLead(), 1, 1); + assert.ok(called); + }, + + "test: should use mode of new document" : function() { + this.editor.onChangeMode = function() { + called = true; + }; + this.editor.setSession(this.session1); + this.editor.setSession(this.session2); + + var called = false; + this.session1.setMode(new Text()); + assert.notOk(called); + + this.session2.setMode(new JavaScriptMode()); + assert.ok(called); + }, + + "test: should use stop worker of old document" : function(next) { + var self = this; + + // 1. Open an editor and set the session to CssMode + self.editor.setSession(self.session1); + self.session1.setMode(new CssMode()); + + // 2. Add a line or two of valid CSS. + self.session1.setValue("DIV { color: red; }"); + + // 3. Clear the session value. + self.session1.setValue(""); + + // 4. Set the session to HtmlMode + self.session1.setMode(new HtmlMode()); + + // 5. Try to type valid HTML + self.session1.insert({row: 0, column: 0}, ""); + + setTimeout(function() { + assert.equal(Object.keys(self.session1.getAnnotations()).length, 0); + next(); + }, 600); + } +}; + +}); + +if (typeof module !== "undefined" && module === require.main) { + require("asyncjs").test.testcase(module.exports).exec() +} diff --git a/addons/editor/ace/editor_highlight_selected_word_test.js b/addons/editor/ace/editor_highlight_selected_word_test.js new file mode 100755 index 00000000..13e19c23 --- /dev/null +++ b/addons/editor/ace/editor_highlight_selected_word_test.js @@ -0,0 +1,223 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +if (typeof process !== "undefined") { + require("amd-loader"); + require("./test/mockdom"); +} + +define(function(require, exports, module) { +"use strict"; + +var EditSession = require("./edit_session").EditSession; +var Editor = require("./editor").Editor; +var MockRenderer = require("./test/mockrenderer").MockRenderer; +var assert = require("./test/assertions"); + +var lipsum = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. " + + "Mauris at arcu mi, eu lobortis mauris. Quisque ut libero eget " + + "diam congue vehicula. Quisque ut odio ut mi aliquam tincidunt. " + + "Duis lacinia aliquam lorem eget eleifend. Morbi eget felis mi. " + + "Duis quam ligula, consequat vitae convallis volutpat, blandit " + + "nec neque. Nulla facilisi. Etiam suscipit lorem ac justo " + + "sollicitudin tristique. Phasellus ut posuere nunc. Aliquam " + + "scelerisque mollis felis non gravida. Vestibulum lacus sem, " + + "posuere non bibendum id, luctus non dolor. Aenean id metus " + + "lorem, vel dapibus est. Donec gravida feugiat augue nec " + + "accumsan.Lorem ipsum dolor sit amet, consectetur adipiscing " + + "elit. Nulla vulputate, velit vitae tincidunt congue, nunc " + + "augue accumsan velit, eu consequat turpis lectus ac orci. " + + "Pellentesque ornare dolor feugiat dui auctor eu varius nulla " + + "fermentum. Sed aliquam odio at velit lacinia vel fermentum " + + "felis sodales. In dignissim magna eget nunc lobortis non " + + "fringilla nibh ullamcorper. Donec facilisis malesuada elit " + + "at egestas. Etiam bibendum, diam vitae tempor aliquet, dui " + + "libero vehicula odio, eget bibendum mauris velit eu lorem.\n" + + "consectetur"; + +function callHighlighterUpdate(session, firstRow, lastRow) { + var rangeCount = 0; + var mockMarkerLayer = { drawSingleLineMarker: function() {rangeCount++;} } + session.$searchHighlight.update([], mockMarkerLayer, session, { + firstRow: firstRow, + lastRow: lastRow + }); + return rangeCount; +} + +module.exports = { + setUp: function(next) { + this.session = new EditSession(lipsum); + this.editor = new Editor(new MockRenderer(), this.session); + this.selection = this.session.getSelection(); + this.search = this.editor.$search; + next(); + }, + + "test: highlight selected words by default": function() { + assert.equal(this.editor.getHighlightSelectedWord(), true); + }, + + "test: highlight a word": function() { + this.editor.moveCursorTo(0, 9); + this.selection.selectWord(); + + var highlighter = this.editor.session.$searchHighlight; + assert.ok(highlighter != null); + + var range = this.selection.getRange(); + assert.equal(this.session.getTextRange(range), "ipsum"); + assert.equal(highlighter.cache.length, 0); + assert.equal(callHighlighterUpdate(this.session, 0, 0), 2); + }, + + "test: highlight a word and clear highlight": function() { + this.editor.moveCursorTo(0, 8); + this.selection.selectWord(); + + var range = this.selection.getRange(); + assert.equal(this.session.getTextRange(range), "ipsum"); + assert.equal(callHighlighterUpdate(this.session, 0, 0), 2); + + this.session.highlight(""); + assert.equal(this.session.$searchHighlight.cache.length, 0); + assert.equal(callHighlighterUpdate(this.session, 0, 0), 0); + }, + + "test: highlight another word": function() { + this.selection.moveCursorTo(0, 14); + this.selection.selectWord(); + + var range = this.selection.getRange(); + assert.equal(this.session.getTextRange(range), "dolor"); + assert.equal(callHighlighterUpdate(this.session, 0, 0), 4); + }, + + "test: no selection, no highlight": function() { + this.selection.clearSelection(); + assert.equal(callHighlighterUpdate(this.session, 0, 0), 0); + }, + + "test: select a word, no highlight": function() { + this.selection.moveCursorTo(0, 14); + this.selection.selectWord(); + + this.editor.setHighlightSelectedWord(false); + + var range = this.selection.getRange(); + assert.equal(this.session.getTextRange(range), "dolor"); + assert.equal(callHighlighterUpdate(this.session, 0, 0), 0); + }, + + "test: select a word with no matches": function() { + this.editor.setHighlightSelectedWord(true); + + var currentOptions = this.search.getOptions(); + var newOptions = { + wrap: true, + wholeWord: true, + caseSensitive: true, + needle: "Mauris" + }; + this.search.set(newOptions); + + var match = this.search.find(this.session); + assert.notEqual(match, null, "found a match for 'Mauris'"); + + this.search.set(currentOptions); + + this.selection.setSelectionRange(match); + + assert.equal(this.session.getTextRange(match), "Mauris"); + assert.equal(callHighlighterUpdate(this.session, 0, 0), 1); + }, + + "test: partial word selection 1": function() { + this.selection.moveCursorTo(0, 14); + this.selection.selectWord(); + this.selection.selectLeft(); + + var range = this.selection.getRange(); + assert.equal(this.session.getTextRange(range), "dolo"); + assert.equal(callHighlighterUpdate(this.session, 0, 0), 0); + }, + + "test: partial word selection 2": function() { + this.selection.moveCursorTo(0, 13); + this.selection.selectWord(); + this.selection.selectRight(); + + var range = this.selection.getRange(); + assert.equal(this.session.getTextRange(range), "dolor "); + assert.equal(callHighlighterUpdate(this.session, 0, 0), 0); + }, + + "test: partial word selection 3": function() { + this.selection.moveCursorTo(0, 14); + this.selection.selectWord(); + this.selection.selectLeft(); + this.selection.shiftSelection(1); + + var range = this.selection.getRange(); + assert.equal(this.session.getTextRange(range), "olor"); + assert.equal(callHighlighterUpdate(this.session, 0, 0), 0); + }, + + "test: select last word": function() { + this.selection.moveCursorTo(0, 1); + + var currentOptions = this.search.getOptions(); + var newOptions = { + wrap: true, + wholeWord: true, + caseSensitive: true, + backwards: true, + needle: "consectetur" + }; + this.search.set(newOptions); + + var match = this.search.find(this.session); + assert.notEqual(match, null, "found a match for 'consectetur'"); + assert.position(match.start, 1, 0); + + this.search.set(currentOptions); + + this.selection.setSelectionRange(match); + + assert.equal(this.session.getTextRange(match), "consectetur"); + assert.equal(callHighlighterUpdate(this.session, 0, 1), 3); + } +}; + +}); + +if (typeof module !== "undefined" && module === require.main) { + require("asyncjs").test.testcase(module.exports).exec(); +} diff --git a/addons/editor/ace/editor_navigation_test.js b/addons/editor/ace/editor_navigation_test.js new file mode 100755 index 00000000..ab348241 --- /dev/null +++ b/addons/editor/ace/editor_navigation_test.js @@ -0,0 +1,164 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +if (typeof process !== "undefined") { + require("amd-loader"); + require("./test/mockdom"); +} + +define(function(require, exports, module) { +"use strict"; + +var EditSession = require("./edit_session").EditSession; +var Editor = require("./editor").Editor; +var MockRenderer = require("./test/mockrenderer").MockRenderer; +var assert = require("./test/assertions"); + +module.exports = { + createEditSession : function(rows, cols) { + var line = new Array(cols + 1).join("a"); + var text = new Array(rows).join(line + "\n") + line; + return new EditSession(text); + }, + + "test: navigate to end of file should scroll the last line into view" : function() { + var doc = this.createEditSession(200, 10); + var editor = new Editor(new MockRenderer(), doc); + + editor.navigateFileEnd(); + var cursor = editor.getCursorPosition(); + + assert.ok(editor.getFirstVisibleRow() <= cursor.row); + assert.ok(editor.getLastVisibleRow() >= cursor.row); + }, + + "test: navigate to start of file should scroll the first row into view" : function() { + var doc = this.createEditSession(200, 10); + var editor = new Editor(new MockRenderer(), doc); + + editor.moveCursorTo(editor.getLastVisibleRow() + 20); + editor.navigateFileStart(); + + assert.equal(editor.getFirstVisibleRow(), 0); + }, + + "test: goto hidden line should scroll the line into the middle of the viewport" : function() { + var editor = new Editor(new MockRenderer(), this.createEditSession(200, 5)); + + editor.navigateTo(0, 0); + editor.gotoLine(101); + assert.position(editor.getCursorPosition(), 100, 0); + assert.equal(editor.getFirstVisibleRow(), 89); + + editor.navigateTo(100, 0); + editor.gotoLine(11); + assert.position(editor.getCursorPosition(), 10, 0); + assert.equal(editor.getFirstVisibleRow(), 0); + + editor.navigateTo(100, 0); + editor.gotoLine(6); + assert.position(editor.getCursorPosition(), 5, 0); + assert.equal(0, editor.getFirstVisibleRow(), 0); + + editor.navigateTo(100, 0); + editor.gotoLine(1); + assert.position(editor.getCursorPosition(), 0, 0); + assert.equal(editor.getFirstVisibleRow(), 0); + + editor.navigateTo(0, 0); + editor.gotoLine(191); + assert.position(editor.getCursorPosition(), 190, 0); + assert.equal(editor.getFirstVisibleRow(), 179); + + editor.navigateTo(0, 0); + editor.gotoLine(196); + assert.position(editor.getCursorPosition(), 195, 0); + assert.equal(editor.getFirstVisibleRow(), 180); + }, + + "test: goto visible line should only move the cursor and not scroll": function() { + var editor = new Editor(new MockRenderer(), this.createEditSession(200, 5)); + + editor.navigateTo(0, 0); + editor.gotoLine(12); + assert.position(editor.getCursorPosition(), 11, 0); + assert.equal(editor.getFirstVisibleRow(), 0); + + editor.navigateTo(30, 0); + editor.gotoLine(33); + assert.position(editor.getCursorPosition(), 32, 0); + assert.equal(editor.getFirstVisibleRow(), 30); + }, + + "test: navigate from the end of a long line down to a short line and back should maintain the curser column": function() { + var editor = new Editor(new MockRenderer(), new EditSession(["123456", "1"])); + + editor.navigateTo(0, 6); + assert.position(editor.getCursorPosition(), 0, 6); + + editor.navigateDown(); + assert.position(editor.getCursorPosition(), 1, 1); + + editor.navigateUp(); + assert.position(editor.getCursorPosition(), 0, 6); + }, + + "test: reset desired column on navigate left or right": function() { + var editor = new Editor(new MockRenderer(), new EditSession(["123456", "12"])); + + editor.navigateTo(0, 6); + assert.position(editor.getCursorPosition(), 0, 6); + + editor.navigateDown(); + assert.position(editor.getCursorPosition(), 1, 2); + + editor.navigateLeft(); + assert.position(editor.getCursorPosition(), 1, 1); + + editor.navigateUp(); + assert.position(editor.getCursorPosition(), 0, 1); + }, + + "test: typing text should update the desired column": function() { + var editor = new Editor(new MockRenderer(), new EditSession(["1234", "1234567890"])); + + editor.navigateTo(0, 3); + editor.insert("juhu"); + + editor.navigateDown(); + assert.position(editor.getCursorPosition(), 1, 7); + } +}; + +}); + +if (typeof module !== "undefined" && module === require.main) { + require("asyncjs").test.testcase(module.exports).exec() +} diff --git a/addons/editor/ace/editor_text_edit_test.js b/addons/editor/ace/editor_text_edit_test.js new file mode 100755 index 00000000..77ec34ed --- /dev/null +++ b/addons/editor/ace/editor_text_edit_test.js @@ -0,0 +1,557 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +if (typeof process !== "undefined") { + require("amd-loader"); + require("./test/mockdom"); +} + +define(function(require, exports, module) { +"use strict"; + +var EditSession = require("./edit_session").EditSession; +var Editor = require("./editor").Editor; +var JavaScriptMode = require("./mode/javascript").Mode; +var UndoManager = require("./undomanager").UndoManager; +var MockRenderer = require("./test/mockrenderer").MockRenderer; +var assert = require("./test/assertions"); +var whitespace = require("./ext/whitespace"); + +module.exports = { + "test: delete line from the middle" : function() { + var session = new EditSession(["a", "b", "c", "d"].join("\n")); + var editor = new Editor(new MockRenderer(), session); + + editor.moveCursorTo(1, 1); + editor.removeLines(); + + assert.equal(session.toString(), "a\nc\nd"); + assert.position(editor.getCursorPosition(), 1, 0); + + editor.removeLines(); + + assert.equal(session.toString(), "a\nd"); + assert.position(editor.getCursorPosition(), 1, 0); + + editor.removeLines(); + + assert.equal(session.toString(), "a"); + assert.position(editor.getCursorPosition(), 0, 1); + + editor.removeLines(); + + assert.equal(session.toString(), ""); + assert.position(editor.getCursorPosition(), 0, 0); + }, + + "test: delete multiple selected lines" : function() { + var session = new EditSession(["a", "b", "c", "d"].join("\n")); + var editor = new Editor(new MockRenderer(), session); + + editor.moveCursorTo(1, 1); + editor.getSelection().selectDown(); + + editor.removeLines(); + assert.equal(session.toString(), "a\nd"); + assert.position(editor.getCursorPosition(), 1, 0); + }, + + "test: delete first line" : function() { + var session = new EditSession(["a", "b", "c"].join("\n")); + var editor = new Editor(new MockRenderer(), session); + + editor.removeLines(); + + assert.equal(session.toString(), "b\nc"); + assert.position(editor.getCursorPosition(), 0, 0); + }, + + "test: delete last should also delete the new line of the previous line" : function() { + var session = new EditSession(["a", "b", "c", ""].join("\n")); + var editor = new Editor(new MockRenderer(), session); + + editor.moveCursorTo(3, 0); + + editor.removeLines(); + assert.equal(session.toString(), "a\nb\nc"); + assert.position(editor.getCursorPosition(), 2, 1); + + editor.removeLines(); + assert.equal(session.toString(), "a\nb"); + assert.position(editor.getCursorPosition(), 1, 1); + }, + + "test: indent block" : function() { + var session = new EditSession(["a12345", "b12345", "c12345"].join("\n")); + var editor = new Editor(new MockRenderer(), session); + + editor.moveCursorTo(1, 3); + editor.getSelection().selectDown(); + + editor.indent(); + + assert.equal(["a12345", " b12345", " c12345"].join("\n"), session.toString()); + + assert.position(editor.getCursorPosition(), 2, 7); + + var range = editor.getSelectionRange(); + assert.position(range.start, 1, 7); + assert.position(range.end, 2, 7); + }, + + "test: indent selected lines" : function() { + var session = new EditSession(["a12345", "b12345", "c12345"].join("\n")); + var editor = new Editor(new MockRenderer(), session); + + editor.moveCursorTo(1, 0); + editor.getSelection().selectDown(); + + editor.indent(); + assert.equal(["a12345", " b12345", "c12345"].join("\n"), session.toString()); + }, + + "test: no auto indent if cursor is before the {" : function() { + var session = new EditSession("{", new JavaScriptMode()); + var editor = new Editor(new MockRenderer(), session); + + editor.moveCursorTo(0, 0); + editor.onTextInput("\n"); + assert.equal(["", "{"].join("\n"), session.toString()); + }, + + "test: outdent block" : function() { + var session = new EditSession([" a12345", " b12345", " c12345"].join("\n")); + var editor = new Editor(new MockRenderer(), session); + + editor.moveCursorTo(0, 5); + editor.getSelection().selectDown(); + editor.getSelection().selectDown(); + + editor.blockOutdent(); + assert.equal(session.toString(), [" a12345", "b12345", " c12345"].join("\n")); + + assert.position(editor.getCursorPosition(), 2, 1); + + var range = editor.getSelectionRange(); + assert.position(range.start, 0, 1); + assert.position(range.end, 2, 1); + + editor.blockOutdent(); + assert.equal(session.toString(), ["a12345", "b12345", "c12345"].join("\n")); + + var range = editor.getSelectionRange(); + assert.position(range.start, 0, 0); + assert.position(range.end, 2, 0); + }, + + "test: outent without a selection should update cursor" : function() { + var session = new EditSession(" 12"); + var editor = new Editor(new MockRenderer(), session); + + editor.moveCursorTo(0, 3); + editor.blockOutdent(" "); + + assert.equal(session.toString(), " 12"); + assert.position(editor.getCursorPosition(), 0, 0); + }, + + "test: comment lines should perserve selection" : function() { + var session = new EditSession([" abc", "cde"].join("\n"), new JavaScriptMode()); + var editor = new Editor(new MockRenderer(), session); + whitespace.detectIndentation(session); + + editor.moveCursorTo(0, 2); + editor.getSelection().selectDown(); + editor.toggleCommentLines(); + + assert.equal(["// abc", "// cde"].join("\n"), session.toString()); + + var selection = editor.getSelectionRange(); + assert.position(selection.start, 0, 5); + assert.position(selection.end, 1, 5); + }, + + "test: uncomment lines should perserve selection" : function() { + var session = new EditSession(["// abc", "//cde"].join("\n"), new JavaScriptMode()); + var editor = new Editor(new MockRenderer(), session); + session.setTabSize(2); + + editor.moveCursorTo(0, 1); + editor.getSelection().selectDown(); + editor.getSelection().selectRight(); + editor.getSelection().selectRight(); + + editor.toggleCommentLines(); + + assert.equal([" abc", "cde"].join("\n"), session.toString()); + assert.range(editor.getSelectionRange(), 0, 0, 1, 1); + }, + + "test: toggle comment lines twice should return the original text" : function() { + var session = new EditSession([" abc", "cde", "fg"], new JavaScriptMode()); + var editor = new Editor(new MockRenderer(), session); + + editor.moveCursorTo(0, 0); + editor.getSelection().selectDown(); + editor.getSelection().selectDown(); + + editor.toggleCommentLines(); + editor.toggleCommentLines(); + + assert.equal([" abc", "cde", "fg"].join("\n"), session.toString()); + }, + + + "test: comment lines - if the selection end is at the line start it should stay there": function() { + //select down + var session = new EditSession(["abc", "cde"].join("\n"), new JavaScriptMode()); + var editor = new Editor(new MockRenderer(), session); + + editor.moveCursorTo(0, 0); + editor.getSelection().selectDown(); + + editor.toggleCommentLines(); + assert.range(editor.getSelectionRange(), 0, 3, 1, 0); + + // select up + var session = new EditSession(["abc", "cde"].join("\n"), new JavaScriptMode()); + var editor = new Editor(new MockRenderer(), session); + + editor.moveCursorTo(1, 0); + editor.getSelection().selectUp(); + + editor.toggleCommentLines(); + assert.range(editor.getSelectionRange(), 0, 3, 1, 0); + }, + + "test: move lines down should keep selection on moved lines" : function() { + var session = new EditSession(["11", "22", "33", "44"].join("\n")); + var editor = new Editor(new MockRenderer(), session); + + editor.moveCursorTo(0, 1); + editor.getSelection().selectDown(); + + editor.moveLinesDown(); + assert.equal(["33", "11", "22", "44"].join("\n"), session.toString()); + assert.position(editor.getCursorPosition(), 2, 1); + assert.position(editor.getSelection().getSelectionAnchor(), 1, 1); + assert.position(editor.getSelection().getSelectionLead(), 2, 1); + + editor.moveLinesDown(); + assert.equal(["33", "44", "11", "22"].join("\n"), session.toString()); + assert.position(editor.getCursorPosition(), 3, 1); + assert.position(editor.getSelection().getSelectionAnchor(), 2, 1); + assert.position(editor.getSelection().getSelectionLead(), 3, 1); + + // moving again should have no effect + editor.moveLinesDown(); + assert.equal(["33", "44", "11", "22"].join("\n"), session.toString()); + assert.position(editor.getCursorPosition(), 3, 1); + assert.position(editor.getSelection().getSelectionAnchor(), 2, 1); + assert.position(editor.getSelection().getSelectionLead(), 3, 1); + }, + + "test: move lines up should keep selection on moved lines" : function() { + var session = new EditSession(["11", "22", "33", "44"].join("\n")); + var editor = new Editor(new MockRenderer(), session); + + editor.moveCursorTo(2, 1); + editor.getSelection().selectDown(); + + editor.moveLinesUp(); + assert.equal(session.toString(), ["11", "33", "44", "22"].join("\n")); + assert.position(editor.getCursorPosition(), 2, 1); + assert.position(editor.getSelection().getSelectionAnchor(), 1, 1); + assert.position(editor.getSelection().getSelectionLead(), 2, 1); + + editor.moveLinesUp(); + assert.equal(session.toString(), ["33", "44", "11", "22"].join("\n")); + assert.position(editor.getCursorPosition(), 1, 1); + assert.position(editor.getSelection().getSelectionAnchor(), 0, 1); + assert.position(editor.getSelection().getSelectionLead(), 1, 1); + }, + + "test: move line without active selection should not move cursor relative to the moved line" : function() { + var session = new EditSession(["11", "22", "33", "44"].join("\n")); + var editor = new Editor(new MockRenderer(), session); + + editor.moveCursorTo(1, 1); + editor.clearSelection(); + + editor.moveLinesDown(); + assert.equal(["11", "33", "22", "44"].join("\n"), session.toString()); + assert.position(editor.getCursorPosition(), 2, 1); + + editor.clearSelection(); + + editor.moveLinesUp(); + assert.equal(["11", "22", "33", "44"].join("\n"), session.toString()); + assert.position(editor.getCursorPosition(), 1, 1); + }, + + "test: copy lines down should keep selection" : function() { + var session = new EditSession(["11", "22", "33", "44"].join("\n")); + var editor = new Editor(new MockRenderer(), session); + + editor.moveCursorTo(1, 1); + editor.getSelection().selectDown(); + + editor.copyLinesDown(); + assert.equal(["11", "22", "33", "22", "33", "44"].join("\n"), session.toString()); + + assert.position(editor.getCursorPosition(), 4, 1); + assert.position(editor.getSelection().getSelectionAnchor(), 3, 1); + assert.position(editor.getSelection().getSelectionLead(), 4, 1); + }, + + "test: copy lines up should keep selection" : function() { + var session = new EditSession(["11", "22", "33", "44"].join("\n")); + var editor = new Editor(new MockRenderer(), session); + + editor.moveCursorTo(1, 1); + editor.getSelection().selectDown(); + + editor.copyLinesUp(); + assert.equal(["11", "22", "33", "22", "33", "44"].join("\n"), session.toString()); + + assert.position(editor.getCursorPosition(), 2, 1); + assert.position(editor.getSelection().getSelectionAnchor(), 1, 1); + assert.position(editor.getSelection().getSelectionLead(), 2, 1); + }, + + "test: input a tab with soft tab should convert it to spaces" : function() { + var session = new EditSession(""); + var editor = new Editor(new MockRenderer(), session); + + session.setTabSize(2); + session.setUseSoftTabs(true); + + editor.onTextInput("\t"); + assert.equal(session.toString(), " "); + + session.setTabSize(5); + editor.onTextInput("\t"); + assert.equal(session.toString(), " "); + }, + + "test: input tab without soft tabs should keep the tab character" : function() { + var session = new EditSession(""); + var editor = new Editor(new MockRenderer(), session); + + session.setUseSoftTabs(false); + + editor.onTextInput("\t"); + assert.equal(session.toString(), "\t"); + }, + + "test: undo/redo for delete line" : function() { + var session = new EditSession(["111", "222", "333"]); + var undoManager = new UndoManager(); + session.setUndoManager(undoManager); + + var initialText = session.toString(); + var editor = new Editor(new MockRenderer(), session); + + editor.removeLines(); + var step1 = session.toString(); + assert.equal(step1, "222\n333"); + session.$syncInformUndoManager(); + + editor.removeLines(); + var step2 = session.toString(); + assert.equal(step2, "333"); + session.$syncInformUndoManager(); + + editor.removeLines(); + var step3 = session.toString(); + assert.equal(step3, ""); + session.$syncInformUndoManager(); + + undoManager.undo(); + session.$syncInformUndoManager(); + assert.equal(session.toString(), step2); + + undoManager.undo(); + session.$syncInformUndoManager(); + assert.equal(session.toString(), step1); + + undoManager.undo(); + session.$syncInformUndoManager(); + assert.equal(session.toString(), initialText); + + undoManager.undo(); + session.$syncInformUndoManager(); + assert.equal(session.toString(), initialText); + }, + + "test: remove left should remove character left of the cursor" : function() { + var session = new EditSession(["123", "456"]); + + var editor = new Editor(new MockRenderer(), session); + editor.moveCursorTo(1, 1); + editor.remove("left"); + assert.equal(session.toString(), "123\n56"); + }, + + "test: remove left should remove line break if cursor is at line start" : function() { + var session = new EditSession(["123", "456"]); + + var editor = new Editor(new MockRenderer(), session); + editor.moveCursorTo(1, 0); + editor.remove("left"); + assert.equal(session.toString(), "123456"); + }, + + "test: remove left should remove tabsize spaces if cursor is on a tab stop and preceeded by spaces" : function() { + var session = new EditSession(["123", " 456"]); + session.setUseSoftTabs(true); + session.setTabSize(4); + + var editor = new Editor(new MockRenderer(), session); + editor.moveCursorTo(1, 8); + editor.remove("left"); + assert.equal(session.toString(), "123\n 456"); + }, + + "test: transpose at line start should be a noop": function() { + var session = new EditSession(["123", "4567", "89"]); + + var editor = new Editor(new MockRenderer(), session); + editor.moveCursorTo(1, 0); + editor.transposeLetters(); + + assert.equal(session.getValue(), ["123", "4567", "89"].join("\n")); + }, + + "test: transpose in line should swap the charaters before and after the cursor": function() { + var session = new EditSession(["123", "4567", "89"]); + + var editor = new Editor(new MockRenderer(), session); + editor.moveCursorTo(1, 2); + editor.transposeLetters(); + + assert.equal(session.getValue(), ["123", "4657", "89"].join("\n")); + }, + + "test: transpose at line end should swap the last two characters": function() { + var session = new EditSession(["123", "4567", "89"]); + + var editor = new Editor(new MockRenderer(), session); + editor.moveCursorTo(1, 4); + editor.transposeLetters(); + + assert.equal(session.getValue(), ["123", "4576", "89"].join("\n")); + }, + + "test: transpose with non empty selection should be a noop": function() { + var session = new EditSession(["123", "4567", "89"]); + + var editor = new Editor(new MockRenderer(), session); + editor.moveCursorTo(1, 1); + editor.getSelection().selectRight(); + editor.transposeLetters(); + + assert.equal(session.getValue(), ["123", "4567", "89"].join("\n")); + }, + + "test: transpose should move the cursor behind the last swapped character": function() { + var session = new EditSession(["123", "4567", "89"]); + + var editor = new Editor(new MockRenderer(), session); + editor.moveCursorTo(1, 2); + editor.transposeLetters(); + assert.position(editor.getCursorPosition(), 1, 3); + }, + + "test: remove to line end": function() { + var session = new EditSession(["123", "4567", "89"]); + + var editor = new Editor(new MockRenderer(), session); + editor.moveCursorTo(1, 2); + editor.removeToLineEnd(); + assert.equal(session.getValue(), ["123", "45", "89"].join("\n")); + }, + + "test: remove to line end at line end should remove the new line": function() { + var session = new EditSession(["123", "4567", "89"]); + + var editor = new Editor(new MockRenderer(), session); + editor.moveCursorTo(1, 4); + editor.removeToLineEnd(); + assert.position(editor.getCursorPosition(), 1, 4); + assert.equal(session.getValue(), ["123", "456789"].join("\n")); + }, + + "test: transform selection to uppercase": function() { + var session = new EditSession(["ajax", "dot", "org"]); + + var editor = new Editor(new MockRenderer(), session); + editor.moveCursorTo(1, 0); + editor.getSelection().selectLineEnd(); + editor.toUpperCase() + assert.equal(session.getValue(), ["ajax", "DOT", "org"].join("\n")); + }, + + "test: transform word to uppercase": function() { + var session = new EditSession(["ajax", "dot", "org"]); + + var editor = new Editor(new MockRenderer(), session); + editor.moveCursorTo(1, 0); + editor.toUpperCase() + assert.equal(session.getValue(), ["ajax", "DOT", "org"].join("\n")); + assert.position(editor.getCursorPosition(), 1, 0); + }, + + "test: transform selection to lowercase": function() { + var session = new EditSession(["AJAX", "DOT", "ORG"]); + + var editor = new Editor(new MockRenderer(), session); + editor.moveCursorTo(1, 0); + editor.getSelection().selectLineEnd(); + editor.toLowerCase() + assert.equal(session.getValue(), ["AJAX", "dot", "ORG"].join("\n")); + }, + + "test: transform word to lowercase": function() { + var session = new EditSession(["AJAX", "DOT", "ORG"]); + + var editor = new Editor(new MockRenderer(), session); + editor.moveCursorTo(1, 0); + editor.toLowerCase() + assert.equal(session.getValue(), ["AJAX", "dot", "ORG"].join("\n")); + assert.position(editor.getCursorPosition(), 1, 0); + } +}; + +}); + +if (typeof module !== "undefined" && module === require.main) { + require("asyncjs").test.testcase(module.exports).exec() +} diff --git a/addons/editor/ace/ext-keybinding_menu.js b/addons/editor/ace/ext-keybinding_menu.js deleted file mode 100644 index fac6eaec..00000000 --- a/addons/editor/ace/ext-keybinding_menu.js +++ /dev/null @@ -1,207 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl - * All rights reserved. - * - * Contributed to Ajax.org under the BSD license. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/ext/keybinding_menu', ['require', 'exports', 'module' , 'ace/editor', 'ace/ext/menu_tools/overlay_page', 'ace/ext/menu_tools/get_editor_keyboard_shortcuts'], function(require, exports, module) { - - var Editor = require("ace/editor").Editor; - function showKeyboardShortcuts (editor) { - if(!document.getElementById('kbshortcutmenu')) { - var overlayPage = require('./menu_tools/overlay_page').overlayPage; - var getEditorKeybordShortcuts = require('./menu_tools/get_editor_keyboard_shortcuts').getEditorKeybordShortcuts; - var kb = getEditorKeybordShortcuts(editor); - var el = document.createElement('div'); - var commands = kb.reduce(function(previous, current) { - return previous + '
' - + current.command + ' : ' - + '' + current.key + '
'; - }, ''); - - el.id = 'kbshortcutmenu'; - el.innerHTML = '

Keyboard Shortcuts

' + commands + '
'; - overlayPage(editor, el, '0', '0', '0', null); - } - }; - module.exports.init = function(editor) { - Editor.prototype.showKeyboardShortcuts = function() { - showKeyboardShortcuts(this); - }; - editor.commands.addCommands([{ - name: "showKeyboardShortcuts", - bindKey: {win: "Ctrl-Alt-h", mac: "Command-Alt-h"}, - exec: function(editor, line) { - editor.showKeyboardShortcuts(); - } - }]); - }; - -}); - -define('ace/ext/menu_tools/overlay_page', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) { - -var dom = require("../../lib/dom"); -var cssText = "#ace_settingsmenu, #kbshortcutmenu {\ -background-color: #F7F7F7;\ -color: black;\ -box-shadow: -5px 4px 5px rgba(126, 126, 126, 0.55);\ -padding: 1em 0.5em 2em 1em;\ -overflow: auto;\ -position: absolute;\ -margin: 0;\ -bottom: 0;\ -right: 0;\ -top: 0;\ -z-index: 9991;\ -cursor: default;\ -}\ -.ace_dark #ace_settingsmenu, .ace_dark #kbshortcutmenu {\ -box-shadow: -20px 10px 25px rgba(126, 126, 126, 0.25);\ -background-color: rgba(255, 255, 255, 0.6);\ -color: black;\ -}\ -.ace_optionsMenuEntry:hover {\ -background-color: rgba(100, 100, 100, 0.1);\ --webkit-transition: all 0.5s;\ -transition: all 0.3s\ -}\ -.ace_closeButton {\ -background: rgba(245, 146, 146, 0.5);\ -border: 1px solid #F48A8A;\ -border-radius: 50%;\ -padding: 7px;\ -position: absolute;\ -right: -8px;\ -top: -8px;\ -z-index: 1000;\ -}\ -.ace_closeButton{\ -background: rgba(245, 146, 146, 0.9);\ -}\ -.ace_optionsMenuKey {\ -color: darkslateblue;\ -font-weight: bold;\ -}\ -.ace_optionsMenuCommand {\ -color: darkcyan;\ -font-weight: normal;\ -}"; -dom.importCssString(cssText); -module.exports.overlayPage = function overlayPage(editor, contentElement, top, right, bottom, left) { - top = top ? 'top: ' + top + ';' : ''; - bottom = bottom ? 'bottom: ' + bottom + ';' : ''; - right = right ? 'right: ' + right + ';' : ''; - left = left ? 'left: ' + left + ';' : ''; - - var closer = document.createElement('div'); - var contentContainer = document.createElement('div'); - - function documentEscListener(e) { - if (e.keyCode === 27) { - closer.click(); - } - } - - closer.style.cssText = 'margin: 0; padding: 0; ' + - 'position: fixed; top:0; bottom:0; left:0; right:0;' + - 'z-index: 9990; ' + - 'background-color: rgba(0, 0, 0, 0.3);'; - closer.addEventListener('click', function() { - document.removeEventListener('keydown', documentEscListener); - closer.parentNode.removeChild(closer); - editor.focus(); - closer = null; - }); - document.addEventListener('keydown', documentEscListener); - - contentContainer.style.cssText = top + right + bottom + left; - contentContainer.addEventListener('click', function(e) { - e.stopPropagation(); - }); - - var wrapper = dom.createElement("div"); - wrapper.style.position = "relative"; - - var closeButton = dom.createElement("div"); - closeButton.className = "ace_closeButton"; - closeButton.addEventListener('click', function() { - closer.click(); - }); - - wrapper.appendChild(closeButton); - contentContainer.appendChild(wrapper); - - contentContainer.appendChild(contentElement); - closer.appendChild(contentContainer); - document.body.appendChild(closer); - editor.blur(); -}; - -}); - -define('ace/ext/menu_tools/get_editor_keyboard_shortcuts', ['require', 'exports', 'module' , 'ace/lib/keys'], function(require, exports, module) { - -var keys = require("../../lib/keys"); -module.exports.getEditorKeybordShortcuts = function(editor) { - var KEY_MODS = keys.KEY_MODS; - var keybindings = []; - var commandMap = {}; - editor.keyBinding.$handlers.forEach(function(handler) { - var ckb = handler.commandKeyBinding; - for (var i in ckb) { - var modifier = parseInt(i); - if (modifier == -1) { - modifier = ""; - } else if(isNaN(modifier)) { - modifier = i; - } else { - modifier = "" + - (modifier & KEY_MODS.command ? "Cmd-" : "") + - (modifier & KEY_MODS.ctrl ? "Ctrl-" : "") + - (modifier & KEY_MODS.alt ? "Alt-" : "") + - (modifier & KEY_MODS.shift ? "Shift-" : ""); - } - for (var key in ckb[i]) { - var command = ckb[i][key] - if (typeof command != "string") - command = command.name - if (commandMap[command]) { - commandMap[command].key += "|" + modifier + key; - } else { - commandMap[command] = {key: modifier+key, command: command}; - keybindings.push(commandMap[command]); - } - } - } - }); - return keybindings; -}; - -}); \ No newline at end of file diff --git a/addons/editor/ace/ext-language_tools.js b/addons/editor/ace/ext-language_tools.js deleted file mode 100644 index d6e6ef6f..00000000 --- a/addons/editor/ace/ext-language_tools.js +++ /dev/null @@ -1,1615 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2012, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/ext/language_tools', ['require', 'exports', 'module' , 'ace/snippets', 'ace/autocomplete', 'ace/config', 'ace/autocomplete/text_completer', 'ace/editor'], function(require, exports, module) { - - -var snippetManager = require("../snippets").snippetManager; -var Autocomplete = require("../autocomplete").Autocomplete; -var config = require("../config"); - -var textCompleter = require("../autocomplete/text_completer"); -var keyWordCompleter = { - getCompletions: function(editor, session, pos, prefix, callback) { - var state = editor.session.getState(pos.row); - var completions = session.$mode.getCompletions(state, session, pos, prefix); - callback(null, completions); - } -}; - -var snippetCompleter = { - getCompletions: function(editor, session, pos, prefix, callback) { - var scope = snippetManager.$getScope(editor); - var snippetMap = snippetManager.snippetMap; - var completions = []; - [scope, "_"].forEach(function(scope) { - var snippets = snippetMap[scope] || []; - for (var i = snippets.length; i--;) { - var s = snippets[i]; - var caption = s.name || s.tabTrigger; - if (!caption) - continue; - completions.push({ - caption: caption, - snippet: s.content, - meta: s.tabTrigger && !s.name ? s.tabTrigger + "\u21E5 " : "snippet" - }); - } - }, this); - callback(null, completions); - } -}; - -var completers = [snippetCompleter, textCompleter, keyWordCompleter]; -exports.addCompleter = function(completer) { - completers.push(completer); -}; - -var expandSnippet = { - name: "expandSnippet", - exec: function(editor) { - var success = snippetManager.expandWithTab(editor); - if (!success) - editor.execCommand("indent"); - }, - bindKey: "tab" -} - -var onChangeMode = function(e, editor) { - var mode = editor.session.$mode; - var id = mode.$id - if (!snippetManager.files) snippetManager.files = {}; - if (id && !snippetManager.files[id]) { - var snippetFilePath = id.replace("mode", "snippets"); - config.loadModule(snippetFilePath, function(m) { - if (m) { - snippetManager.files[id] = m; - m.snippets = snippetManager.parseSnippetFile(m.snippetText); - snippetManager.register(m.snippets, m.scope); - } - }); - } -}; - -var Editor = require("../editor").Editor; -require("../config").defineOptions(Editor.prototype, "editor", { - enableBasicAutocompletion: { - set: function(val) { - if (val) { - this.completers = completers - this.commands.addCommand(Autocomplete.startCommand); - } else { - this.commands.removeCommand(Autocomplete.startCommand); - } - }, - value: false - }, - enableSnippets: { - set: function(val) { - if (val) { - this.commands.addCommand(expandSnippet); - this.on("changeMode", onChangeMode); - onChangeMode(null, this) - } else { - this.commands.removeCommand(expandSnippet); - this.off("changeMode", onChangeMode); - } - }, - value: false - } -}); - -}); - -define('ace/snippets', ['require', 'exports', 'module' , 'ace/lib/lang', 'ace/range', 'ace/keyboard/hash_handler', 'ace/tokenizer', 'ace/lib/dom'], function(require, exports, module) { - -var lang = require("./lib/lang") -var Range = require("./range").Range -var HashHandler = require("./keyboard/hash_handler").HashHandler; -var Tokenizer = require("./tokenizer").Tokenizer; -var comparePoints = Range.comparePoints; - -var SnippetManager = function() { - this.snippetMap = {}; - this.snippetNameMap = {}; -}; - -(function() { - this.getTokenizer = function() { - function TabstopToken(str, _, stack) { - str = str.substr(1); - if (/^\d+$/.test(str) && !stack.inFormatString) - return [{tabstopId: parseInt(str, 10)}]; - return [{text: str}] - } - function escape(ch) { - return "(?:[^\\\\" + ch + "]|\\\\.)"; - } - SnippetManager.$tokenizer = new Tokenizer({ - start: [ - {regex: /:/, onMatch: function(val, state, stack) { - if (stack.length && stack[0].expectIf) { - stack[0].expectIf = false; - stack[0].elseBranch = stack[0]; - return [stack[0]]; - } - return ":"; - }}, - {regex: /\\./, onMatch: function(val, state, stack) { - var ch = val[1]; - if (ch == "}" && stack.length) { - val = ch; - }else if ("`$\\".indexOf(ch) != -1) { - val = ch; - } else if (stack.inFormatString) { - if (ch == "n") - val = "\n"; - else if (ch == "t") - val = "\n"; - else if ("ulULE".indexOf(ch) != -1) { - val = {changeCase: ch, local: ch > "a"}; - } - } - - return [val]; - }}, - {regex: /}/, onMatch: function(val, state, stack) { - return [stack.length ? stack.shift() : val]; - }}, - {regex: /\$(?:\d+|\w+)/, onMatch: TabstopToken}, - {regex: /\$\{[\dA-Z_a-z]+/, onMatch: function(str, state, stack) { - var t = TabstopToken(str.substr(1), state, stack); - stack.unshift(t[0]); - return t; - }, next: "snippetVar"}, - {regex: /\n/, token: "newline", merge: false} - ], - snippetVar: [ - {regex: "\\|" + escape("\\|") + "*\\|", onMatch: function(val, state, stack) { - stack[0].choices = val.slice(1, -1).split(","); - }, next: "start"}, - {regex: "/(" + escape("/") + "+)/(?:(" + escape("/") + "*)/)(\\w*):?", - onMatch: function(val, state, stack) { - var ts = stack[0]; - ts.fmtString = val; - - val = this.splitRegex.exec(val); - ts.guard = val[1]; - ts.fmt = val[2]; - ts.flag = val[3]; - return ""; - }, next: "start"}, - {regex: "`" + escape("`") + "*`", onMatch: function(val, state, stack) { - stack[0].code = val.splice(1, -1); - return ""; - }, next: "start"}, - {regex: "\\?", onMatch: function(val, state, stack) { - if (stack[0]) - stack[0].expectIf = true; - }, next: "start"}, - {regex: "([^:}\\\\]|\\\\.)*:?", token: "", next: "start"} - ], - formatString: [ - {regex: "/(" + escape("/") + "+)/", token: "regex"}, - {regex: "", onMatch: function(val, state, stack) { - stack.inFormatString = true; - }, next: "start"} - ] - }); - SnippetManager.prototype.getTokenizer = function() { - return SnippetManager.$tokenizer; - } - return SnippetManager.$tokenizer; - }; - - this.tokenizeTmSnippet = function(str, startState) { - return this.getTokenizer().getLineTokens(str, startState).tokens.map(function(x) { - return x.value || x; - }); - }; - - this.$getDefaultValue = function(editor, name) { - if (/^[A-Z]\d+$/.test(name)) { - var i = name.substr(1); - return (this.variables[name[0] + "__"] || {})[i]; - } - if (/^\d+$/.test(name)) { - return (this.variables.__ || {})[name]; - } - name = name.replace(/^TM_/, ""); - - if (!editor) - return; - var s = editor.session; - switch(name) { - case "CURRENT_WORD": - var r = s.getWordRange(); - case "SELECTION": - case "SELECTED_TEXT": - return s.getTextRange(r); - case "CURRENT_LINE": - return s.getLine(editor.getCursorPosition().row); - case "PREV_LINE": // not possible in textmate - return s.getLine(editor.getCursorPosition().row - 1); - case "LINE_INDEX": - return editor.getCursorPosition().column; - case "LINE_NUMBER": - return editor.getCursorPosition().row + 1; - case "SOFT_TABS": - return s.getUseSoftTabs() ? "YES" : "NO"; - case "TAB_SIZE": - return s.getTabSize(); - case "FILENAME": - case "FILEPATH": - return "ace.ajax.org"; - case "FULLNAME": - return "Ace"; - } - }; - this.variables = {}; - this.getVariableValue = function(editor, varName) { - if (this.variables.hasOwnProperty(varName)) - return this.variables[varName](editor, varName) || ""; - return this.$getDefaultValue(editor, varName) || ""; - }; - this.tmStrFormat = function(str, ch, editor) { - var flag = ch.flag || ""; - var re = ch.guard; - re = new RegExp(re, flag.replace(/[^gi]/, "")); - var fmtTokens = this.tokenizeTmSnippet(ch.fmt, "formatString"); - var _self = this; - var formatted = str.replace(re, function() { - _self.variables.__ = arguments; - var fmtParts = _self.resolveVariables(fmtTokens, editor); - var gChangeCase = "E"; - for (var i = 0; i < fmtParts.length; i++) { - var ch = fmtParts[i]; - if (typeof ch == "object") { - fmtParts[i] = ""; - if (ch.changeCase && ch.local) { - var next = fmtParts[i + 1]; - if (next && typeof next == "string") { - if (ch.changeCase == "u") - fmtParts[i] = next[0].toUpperCase(); - else - fmtParts[i] = next[0].toLowerCase(); - fmtParts[i + 1] = next.substr(1); - } - } else if (ch.changeCase) { - gChangeCase = ch.changeCase; - } - } else if (gChangeCase == "U") { - fmtParts[i] = ch.toUpperCase(); - } else if (gChangeCase == "L") { - fmtParts[i] = ch.toLowerCase(); - } - } - return fmtParts.join(""); - }); - this.variables.__ = null; - return formatted; - }; - - this.resolveVariables = function(snippet, editor) { - var result = []; - for (var i = 0; i < snippet.length; i++) { - var ch = snippet[i]; - if (typeof ch == "string") { - result.push(ch); - } else if (typeof ch != "object") { - continue; - } else if (ch.skip) { - gotoNext(ch); - } else if (ch.processed < i) { - continue; - } else if (ch.text) { - var value = this.getVariableValue(editor, ch.text); - if (value && ch.fmtString) - value = this.tmStrFormat(value, ch); - ch.processed = i; - if (ch.expectIf == null) { - if (value) { - result.push(value); - gotoNext(ch); - } - } else { - if (value) { - ch.skip = ch.elseBranch; - } else - gotoNext(ch); - } - } else if (ch.tabstopId != null) { - result.push(ch); - } else if (ch.changeCase != null) { - result.push(ch); - } - } - function gotoNext(ch) { - var i1 = snippet.indexOf(ch, i + 1); - if (i1 != -1) - i = i1; - } - return result; - }; - - this.insertSnippet = function(editor, snippetText) { - var cursor = editor.getCursorPosition(); - var line = editor.session.getLine(cursor.row); - var indentString = line.match(/^\s*/)[0]; - var tabString = editor.session.getTabString(); - - var tokens = this.tokenizeTmSnippet(snippetText); - tokens = this.resolveVariables(tokens, editor); - tokens = tokens.map(function(x) { - if (x == "\n") - return x + indentString; - if (typeof x == "string") - return x.replace(/\t/g, tabString); - return x; - }); - var tabstops = []; - tokens.forEach(function(p, i) { - if (typeof p != "object") - return; - var id = p.tabstopId; - var ts = tabstops[id]; - if (!ts) { - ts = tabstops[id] = []; - ts.index = id; - ts.value = ""; - } - if (ts.indexOf(p) !== -1) - return; - ts.push(p); - var i1 = tokens.indexOf(p, i + 1); - if (i1 === -1) - return; - - var value = tokens.slice(i + 1, i1); - var isNested = value.some(function(t) {return typeof t === "object"}); - if (isNested && !ts.value) { - ts.value = value; - } else if (value.length && (!ts.value || typeof ts.value !== "string")) { - ts.value = value.join(""); - } - }); - tabstops.forEach(function(ts) {ts.length = 0}); - var expanding = {}; - function copyValue(val) { - var copy = [] - for (var i = 0; i < val.length; i++) { - var p = val[i]; - if (typeof p == "object") { - if (expanding[p.tabstopId]) - continue; - var j = val.lastIndexOf(p, i - 1); - p = copy[j] || {tabstopId: p.tabstopId}; - } - copy[i] = p; - } - return copy; - } - for (var i = 0; i < tokens.length; i++) { - var p = tokens[i]; - if (typeof p != "object") - continue; - var id = p.tabstopId; - var i1 = tokens.indexOf(p, i + 1); - if (expanding[id] == p) { - expanding[id] = null; - continue; - } - - var ts = tabstops[id]; - var arg = typeof ts.value == "string" ? [ts.value] : copyValue(ts.value); - arg.unshift(i + 1, Math.max(0, i1 - i)); - arg.push(p); - expanding[id] = p; - tokens.splice.apply(tokens, arg); - - if (ts.indexOf(p) === -1) - ts.push(p); - }; - var row = 0, column = 0; - var text = ""; - tokens.forEach(function(t) { - if (typeof t === "string") { - if (t[0] === "\n"){ - column = t.length - 1; - row ++; - } else - column += t.length; - text += t; - } else { - if (!t.start) - t.start = {row: row, column: column}; - else - t.end = {row: row, column: column}; - } - }); - var range = editor.getSelectionRange(); - var end = editor.session.replace(range, text); - - var tabstopManager = new TabstopManager(editor); - tabstopManager.addTabstops(tabstops, range.start, end); - tabstopManager.tabNext(); - }; - - this.$getScope = function(editor) { - var scope = editor.session.$mode.$id || ""; - scope = scope.split("/").pop(); - if (scope === "html" || scope === "php") { - if (scope === "php") - scope = "html"; - var c = editor.getCursorPosition() - var state = editor.session.getState(c.row); - if (typeof state === "object") { - state = state[0]; - } - if (state.substring) { - if (state.substring(0, 3) == "js-") - scope = "javascript"; - else if (state.substring(0, 4) == "css-") - scope = "css"; - else if (state.substring(0, 4) == "php-") - scope = "php"; - } - } - - return scope; - }; - - this.expandWithTab = function(editor) { - var cursor = editor.getCursorPosition(); - var line = editor.session.getLine(cursor.row); - var before = line.substring(0, cursor.column); - var after = line.substr(cursor.column); - - var scope = this.$getScope(editor); - var snippetMap = this.snippetMap; - var snippet; - [scope, "_"].some(function(scope) { - var snippets = snippetMap[scope]; - if (snippets) - snippet = this.findMatchingSnippet(snippets, before, after); - return !!snippet; - }, this); - if (!snippet) - return false; - - editor.session.doc.removeInLine(cursor.row, - cursor.column - snippet.replaceBefore.length, - cursor.column + snippet.replaceAfter.length - ); - - this.variables.M__ = snippet.matchBefore; - this.variables.T__ = snippet.matchAfter; - this.insertSnippet(editor, snippet.content); - - this.variables.M__ = this.variables.T__ = null; - return true; - }; - - this.findMatchingSnippet = function(snippetList, before, after) { - for (var i = snippetList.length; i--;) { - var s = snippetList[i]; - if (s.startRe && !s.startRe.test(before)) - continue; - if (s.endRe && !s.endRe.test(after)) - continue; - if (!s.startRe && !s.endRe) - continue; - - s.matchBefore = s.startRe ? s.startRe.exec(before) : [""]; - s.matchAfter = s.endRe ? s.endRe.exec(after) : [""]; - s.replaceBefore = s.triggerRe ? s.triggerRe.exec(before)[0] : ""; - s.replaceAfter = s.endTriggerRe ? s.endTriggerRe.exec(after)[0] : ""; - return s; - } - }; - - this.snippetMap = {}; - this.snippetNameMap = {}; - this.register = function(snippets, scope) { - var snippetMap = this.snippetMap; - var snippetNameMap = this.snippetNameMap; - var self = this; - function wrapRegexp(src) { - if (src && !/^\^?\(.*\)\$?$|^\\b$/.test(src)) - src = "(?:" + src + ")" - - return src || ""; - } - function guardedRegexp(re, guard, opening) { - re = wrapRegexp(re); - guard = wrapRegexp(guard); - if (opening) { - re = guard + re; - if (re && re[re.length - 1] != "$") - re = re + "$"; - } else { - re = re + guard; - if (re && re[0] != "^") - re = "^" + re; - } - return new RegExp(re); - } - - function addSnippet(s) { - if (!s.scope) - s.scope = scope || "_"; - scope = s.scope - if (!snippetMap[scope]) { - snippetMap[scope] = []; - snippetNameMap[scope] = {}; - } - - var map = snippetNameMap[scope]; - if (s.name) { - var old = map[s.name]; - if (old) - self.unregister(old); - map[s.name] = s; - } - snippetMap[scope].push(s); - - if (s.tabTrigger && !s.trigger) { - if (!s.guard && /^\w/.test(s.tabTrigger)) - s.guard = "\\b"; - s.trigger = lang.escapeRegExp(s.tabTrigger); - } - - s.startRe = guardedRegexp(s.trigger, s.guard, true); - s.triggerRe = new RegExp(s.trigger, "", true); - - s.endRe = guardedRegexp(s.endTrigger, s.endGuard, true); - s.endTriggerRe = new RegExp(s.endTrigger, "", true); - }; - - if (snippets.content) - addSnippet(snippets); - else if (Array.isArray(snippets)) - snippets.forEach(addSnippet); - }; - this.unregister = function(snippets, scope) { - var snippetMap = this.snippetMap; - var snippetNameMap = this.snippetNameMap; - - function removeSnippet(s) { - var nameMap = snippetNameMap[s.scope||scope]; - if (nameMap && nameMap[s.name]) { - delete nameMap[s.name]; - var map = snippetMap[s.scope||scope]; - var i = map && map.indexOf(s); - if (i >= 0) - map.splice(i, 1); - } - } - if (snippets.content) - removeSnippet(snippets); - else if (Array.isArray(snippets)) - snippets.forEach(removeSnippet); - }; - this.parseSnippetFile = function(str) { - str = str.replace(/\r/g, ""); - var list = [], snippet = {}; - var re = /^#.*|^({[\s\S]*})\s*$|^(\S+) (.*)$|^((?:\n*\t.*)+)/gm; - var m; - while (m = re.exec(str)) { - if (m[1]) { - try { - snippet = JSON.parse(m[1]) - list.push(snippet); - } catch (e) {} - } if (m[4]) { - snippet.content = m[4].replace(/^\t/gm, ""); - list.push(snippet); - snippet = {}; - } else { - var key = m[2], val = m[3]; - if (key == "regex") { - var guardRe = /\/((?:[^\/\\]|\\.)*)|$/g; - snippet.guard = guardRe.exec(val)[1]; - snippet.trigger = guardRe.exec(val)[1]; - snippet.endTrigger = guardRe.exec(val)[1]; - snippet.endGuard = guardRe.exec(val)[1]; - } else if (key == "snippet") { - snippet.tabTrigger = val.match(/^\S*/)[0]; - if (!snippet.name) - snippet.name = val; - } else { - snippet[key] = val; - } - } - } - return list; - }; - this.getSnippetByName = function(name, editor) { - var scope = editor && this.$getScope(editor); - var snippetMap = this.snippetNameMap; - var snippet; - [scope, "_"].some(function(scope) { - var snippets = snippetMap[scope]; - if (snippets) - snippet = snippets[name]; - return !!snippet; - }, this); - return snippet; - }; - -}).call(SnippetManager.prototype); - - -var TabstopManager = function(editor) { - if (editor.tabstopManager) - return editor.tabstopManager; - editor.tabstopManager = this; - this.$onChange = this.onChange.bind(this); - this.$onChangeSelection = lang.delayedCall(this.onChangeSelection.bind(this)).schedule; - this.$onChangeSession = this.onChangeSession.bind(this); - this.$onAfterExec = this.onAfterExec.bind(this); - this.attach(editor); -}; -(function() { - this.attach = function(editor) { - this.index = -1; - this.ranges = []; - this.tabstops = []; - this.selectedTabstop = null; - - this.editor = editor; - this.editor.on("change", this.$onChange); - this.editor.on("changeSelection", this.$onChangeSelection); - this.editor.on("changeSession", this.$onChangeSession); - this.editor.commands.on("afterExec", this.$onAfterExec); - this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler); - }; - this.detach = function() { - this.tabstops.forEach(this.removeTabstopMarkers, this); - this.ranges = null; - this.tabstops = null; - this.selectedTabstop = null; - this.editor.removeListener("change", this.$onChange); - this.editor.removeListener("changeSelection", this.$onChangeSelection); - this.editor.removeListener("changeSession", this.$onChangeSession); - this.editor.commands.removeListener("afterExec", this.$onAfterExec); - this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler); - this.editor.tabstopManager = null; - this.editor = null; - }; - - this.onChange = function(e) { - var changeRange = e.data.range; - var isRemove = e.data.action[0] == "r"; - var start = changeRange.start; - var end = changeRange.end; - var startRow = start.row; - var endRow = end.row; - var lineDif = endRow - startRow; - var colDiff = end.column - start.column; - - if (isRemove) { - lineDif = -lineDif; - colDiff = -colDiff; - } - if (!this.$inChange && isRemove) { - var ts = this.selectedTabstop; - var changedOutside = !ts.some(function(r) { - return comparePoints(r.start, start) <= 0 && comparePoints(r.end, end) >= 0; - }); - if (changedOutside) - return this.detach(); - } - var ranges = this.ranges; - for (var i = 0; i < ranges.length; i++) { - var r = ranges[i]; - if (r.end.row < start.row) - continue; - - if (comparePoints(start, r.start) < 0 && comparePoints(end, r.end) > 0) { - this.removeRange(r); - i--; - continue; - } - - if (r.start.row == startRow && r.start.column > start.column) - r.start.column += colDiff; - if (r.end.row == startRow && r.end.column >= start.column) - r.end.column += colDiff; - if (r.start.row >= startRow) - r.start.row += lineDif; - if (r.end.row >= startRow) - r.end.row += lineDif; - - if (comparePoints(r.start, r.end) > 0) - this.removeRange(r); - } - if (!ranges.length) - this.detach(); - }; - this.updateLinkedFields = function() { - var ts = this.selectedTabstop; - if (!ts.hasLinkedRanges) - return; - this.$inChange = true; - var session = this.editor.session; - var text = session.getTextRange(ts.firstNonLinked); - for (var i = ts.length; i--;) { - var range = ts[i]; - if (!range.linked) - continue; - var fmt = exports.snippetManager.tmStrFormat(text, range.original) - session.replace(range, fmt); - } - this.$inChange = false; - }; - this.onAfterExec = function(e) { - if (e.command && !e.command.readOnly) - this.updateLinkedFields(); - }; - this.onChangeSelection = function() { - if (!this.editor) - return - var lead = this.editor.selection.lead; - var anchor = this.editor.selection.anchor; - var isEmpty = this.editor.selection.isEmpty(); - for (var i = this.ranges.length; i--;) { - if (this.ranges[i].linked) - continue; - var containsLead = this.ranges[i].contains(lead.row, lead.column); - var containsAnchor = isEmpty || this.ranges[i].contains(anchor.row, anchor.column); - if (containsLead && containsAnchor) - return; - } - this.detach(); - }; - this.onChangeSession = function() { - this.detach(); - }; - this.tabNext = function(dir) { - var max = this.tabstops.length - 1; - var index = this.index + (dir || 1); - index = Math.min(Math.max(index, 0), max); - this.selectTabstop(index); - if (index == max) - this.detach(); - }; - this.selectTabstop = function(index) { - var ts = this.tabstops[this.index]; - if (ts) - this.addTabstopMarkers(ts); - this.index = index; - ts = this.tabstops[this.index]; - if (!ts || !ts.length) - return; - - this.selectedTabstop = ts; - if (!this.editor.inVirtualSelectionMode) { - var sel = this.editor.multiSelect; - sel.toSingleRange(ts.firstNonLinked.clone()); - for (var i = ts.length; i--;) { - if (ts.hasLinkedRanges && ts[i].linked) - continue; - sel.addRange(ts[i].clone(), true); - } - } else { - this.editor.selection.setRange(ts.firstNonLinked); - } - - this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler); - }; - this.addTabstops = function(tabstops, start, end) { - if (!tabstops[0]) { - var p = Range.fromPoints(end, end); - moveRelative(p.start, start); - moveRelative(p.end, start); - tabstops[0] = [p]; - tabstops[0].index = 0; - } - - var i = this.index; - var arg = [i, 0]; - var ranges = this.ranges; - var editor = this.editor; - tabstops.forEach(function(ts) { - for (var i = ts.length; i--;) { - var p = ts[i]; - var range = Range.fromPoints(p.start, p.end || p.start); - movePoint(range.start, start); - movePoint(range.end, start); - range.original = p; - range.tabstop = ts; - ranges.push(range); - ts[i] = range; - if (p.fmtString) { - range.linked = true; - ts.hasLinkedRanges = true; - } else if (!ts.firstNonLinked) - ts.firstNonLinked = range; - } - if (!ts.firstNonLinked) - ts.hasLinkedRanges = false; - arg.push(ts); - this.addTabstopMarkers(ts); - }, this); - arg.push(arg.splice(2, 1)[0]); - this.tabstops.splice.apply(this.tabstops, arg); - }; - - this.addTabstopMarkers = function(ts) { - var session = this.editor.session; - ts.forEach(function(range) { - if (!range.markerId) - range.markerId = session.addMarker(range, "ace_snippet-marker", "text"); - }); - }; - this.removeTabstopMarkers = function(ts) { - var session = this.editor.session; - ts.forEach(function(range) { - session.removeMarker(range.markerId); - range.markerId = null; - }); - }; - this.removeRange = function(range) { - var i = range.tabstop.indexOf(range); - range.tabstop.splice(i, 1); - i = this.ranges.indexOf(range); - this.ranges.splice(i, 1); - this.editor.session.removeMarker(range.markerId); - }; - - this.keyboardHandler = new HashHandler(); - this.keyboardHandler.bindKeys({ - "Tab": function(ed) { - ed.tabstopManager.tabNext(1); - }, - "Shift-Tab": function(ed) { - ed.tabstopManager.tabNext(-1); - }, - "Esc": function(ed) { - ed.tabstopManager.detach(); - }, - "Return": function(ed) { - return false; - } - }); -}).call(TabstopManager.prototype); - - -var movePoint = function(point, diff) { - if (point.row == 0) - point.column += diff.column; - point.row += diff.row; -}; - -var moveRelative = function(point, start) { - if (point.row == start.row) - point.column -= start.column; - point.row -= start.row; -}; - - -require("./lib/dom").importCssString("\ -.ace_snippet-marker {\ - -moz-box-sizing: border-box;\ - box-sizing: border-box;\ - background: rgba(194, 193, 208, 0.09);\ - border: 1px dotted rgba(211, 208, 235, 0.62);\ - position: absolute;\ -}"); - -exports.snippetManager = new SnippetManager(); - - -}); - -define('ace/autocomplete', ['require', 'exports', 'module' , 'ace/keyboard/hash_handler', 'ace/autocomplete/popup', 'ace/autocomplete/util', 'ace/lib/event', 'ace/lib/lang', 'ace/snippets'], function(require, exports, module) { - - -var HashHandler = require("./keyboard/hash_handler").HashHandler; -var AcePopup = require("./autocomplete/popup").AcePopup; -var util = require("./autocomplete/util"); -var event = require("./lib/event"); -var lang = require("./lib/lang"); -var snippetManager = require("./snippets").snippetManager; - -var Autocomplete = function() { - this.keyboardHandler = new HashHandler(); - this.keyboardHandler.bindKeys(this.commands); - - this.blurListener = this.blurListener.bind(this); - this.changeListener = this.changeListener.bind(this); - this.mousedownListener = this.mousedownListener.bind(this); - this.mousewheelListener = this.mousewheelListener.bind(this); - - this.changeTimer = lang.delayedCall(function() { - this.updateCompletions(true); - }.bind(this)) -}; - -(function() { - this.$init = function() { - this.popup = new AcePopup(document.body || document.documentElement); - this.popup.on("click", function(e) { - this.insertMatch(); - e.stop(); - }.bind(this)); - }; - - this.openPopup = function(editor, prefix, keepPopupPosition) { - if (!this.popup) - this.$init(); - - this.popup.setData(this.completions.filtered); - - var renderer = editor.renderer; - if (!keepPopupPosition) { - this.popup.setFontSize(editor.getFontSize()); - - var lineHeight = renderer.layerConfig.lineHeight; - - var pos = renderer.$cursorLayer.getPixelPosition(this.base, true); - pos.left -= this.popup.getTextLeftOffset(); - - var rect = editor.container.getBoundingClientRect(); - pos.top += rect.top - renderer.layerConfig.offset; - pos.left += rect.left; - pos.left += renderer.$gutterLayer.gutterWidth; - - this.popup.show(pos, lineHeight); - } - }; - - this.detach = function() { - this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler); - this.editor.off("changeSelection", this.changeListener); - this.editor.off("blur", this.changeListener); - this.editor.off("mousedown", this.mousedownListener); - this.editor.off("mousewheel", this.mousewheelListener); - this.changeTimer.cancel(); - - if (this.popup) - this.popup.hide(); - - this.activated = false; - this.completions = this.base = null; - }; - - this.changeListener = function(e) { - var cursor = this.editor.selection.lead; - if (cursor.row != this.base.row || cursor.column < this.base.column) { - this.detach(); - } - if (this.activated) - this.changeTimer.schedule(); - else - this.detach(); - }; - - this.blurListener = function() { - if (document.activeElement != this.editor.textInput.getElement()) - this.detach(); - }; - - this.mousedownListener = function(e) { - this.detach(); - }; - - this.mousewheelListener = function(e) { - this.detach(); - }; - - this.goTo = function(where) { - var row = this.popup.getRow(); - var max = this.popup.session.getLength() - 1; - - switch(where) { - case "up": row = row < 0 ? max : row - 1; break; - case "down": row = row >= max ? -1 : row + 1; break; - case "start": row = 0; break; - case "end": row = max; break; - } - - this.popup.setRow(row); - }; - - this.insertMatch = function(data) { - if (!data) - data = this.popup.getData(this.popup.getRow()); - if (!data) - return false; - if (data.completer && data.completer.insertMatch) { - data.completer.insertMatch(this.editor); - } else { - if (this.completions.filterText) { - var ranges = this.editor.selection.getAllRanges(); - for (var i = 0, range; range = ranges[i]; i++) { - range.start.column -= this.completions.filterText.length; - this.editor.session.remove(range); - } - } - if (data.snippet) - snippetManager.insertSnippet(this.editor, data.snippet); - else - this.editor.execCommand("insertstring", data.value || data); - } - this.detach(); - }; - - this.commands = { - "Up": function(editor) { editor.completer.goTo("up"); }, - "Down": function(editor) { editor.completer.goTo("down"); }, - "Ctrl-Up|Ctrl-Home": function(editor) { editor.completer.goTo("start"); }, - "Ctrl-Down|Ctrl-End": function(editor) { editor.completer.goTo("end"); }, - - "Esc": function(editor) { editor.completer.detach(); }, - "Space": function(editor) { editor.completer.detach(); editor.insert(" ");}, - "Return": function(editor) { editor.completer.insertMatch(); }, - "Shift-Return": function(editor) { editor.completer.insertMatch(true); }, - "Tab": function(editor) { editor.completer.insertMatch(); }, - - "PageUp": function(editor) { editor.completer.popup.gotoPageUp(); }, - "PageDown": function(editor) { editor.completer.popup.gotoPageDown(); } - }; - - this.gatherCompletions = function(editor, callback) { - var session = editor.getSession(); - var pos = editor.getCursorPosition(); - - var line = session.getLine(pos.row); - var prefix = util.retrievePrecedingIdentifier(line, pos.column); - - this.base = editor.getCursorPosition(); - this.base.column -= prefix.length; - - var matches = []; - util.parForEach(editor.completers, function(completer, next) { - completer.getCompletions(editor, session, pos, prefix, function(err, results) { - if (!err) - matches = matches.concat(results); - next(); - }); - }, function() { - callback(null, { - prefix: prefix, - matches: matches - }); - }); - return true; - }; - - this.showPopup = function(editor) { - if (this.editor) - this.detach(); - - this.activated = true; - - this.editor = editor; - if (editor.completer != this) { - if (editor.completer) - editor.completer.detach(); - editor.completer = this; - } - - editor.keyBinding.addKeyboardHandler(this.keyboardHandler); - editor.on("changeSelection", this.changeListener); - editor.on("blur", this.blurListener); - editor.on("mousedown", this.mousedownListener); - editor.on("mousewheel", this.mousewheelListener); - - this.updateCompletions(); - }; - - this.updateCompletions = function(keepPopupPosition) { - if (keepPopupPosition && this.base && this.completions) { - var pos = this.editor.getCursorPosition(); - var prefix = this.editor.session.getTextRange({start: this.base, end: pos}); - if (prefix == this.completions.filterText) - return; - this.completions.setFilter(prefix); - if (!this.completions.filtered.length) - return this.detach(); - this.openPopup(this.editor, prefix, keepPopupPosition); - return; - } - this.gatherCompletions(this.editor, function(err, results) { - var matches = results && results.matches; - if (!matches || !matches.length) - return this.detach(); - - this.completions = new FilteredList(matches); - this.completions.setFilter(results.prefix); - if (!this.completions.filtered.length) - return this.detach(); - this.openPopup(this.editor, results.prefix, keepPopupPosition); - }.bind(this)); - }; - - this.cancelContextMenu = function() { - var stop = function(e) { - this.editor.off("nativecontextmenu", stop); - if (e && e.domEvent) - event.stopEvent(e.domEvent); - }.bind(this); - setTimeout(stop, 10); - this.editor.on("nativecontextmenu", stop); - }; - -}).call(Autocomplete.prototype); - -Autocomplete.startCommand = { - name: "startAutocomplete", - exec: function(editor) { - if (!editor.completer) - editor.completer = new Autocomplete(); - editor.completer.showPopup(editor); - editor.completer.cancelContextMenu(); - }, - bindKey: "Ctrl-Space|Ctrl-Shift-Space|Alt-Space" -}; - -var FilteredList = function(array, filterText, mutateData) { - this.all = array; - this.filtered = array; - this.filterText = filterText || ""; -}; -(function(){ - this.setFilter = function(str) { - if (str.length > this.filterText && str.lastIndexOf(this.filterText, 0) === 0) - var matches = this.filtered; - else - var matches = this.all; - - this.filterText = str; - matches = this.filterCompletions(matches, this.filterText); - matches = matches.sort(function(a, b) { - return b.exactMatch - a.exactMatch || b.score - a.score; - }); - var prev = null; - matches = matches.filter(function(item){ - var caption = item.value || item.caption || item.snippet; - if (caption === prev) return false; - prev = caption; - return true; - }); - - this.filtered = matches; - }; - this.filterCompletions = function(items, needle) { - var results = []; - var upper = needle.toUpperCase(); - var lower = needle.toLowerCase(); - loop: for (var i = 0, item; item = items[i]; i++) { - var caption = item.value || item.caption || item.snippet; - if (!caption) continue; - var lastIndex = -1; - var matchMask = 0; - var penalty = 0; - var index, distance; - for (var j = 0; j < needle.length; j++) { - var i1 = caption.indexOf(lower[j], lastIndex + 1); - var i2 = caption.indexOf(upper[j], lastIndex + 1); - index = (i1 >= 0) ? ((i2 < 0 || i1 < i2) ? i1 : i2) : i2; - if (index < 0) - continue loop; - distance = index - lastIndex - 1; - if (distance > 0) { - if (lastIndex === -1) - penalty += 10; - penalty += distance; - } - matchMask = matchMask | (1 << index); - lastIndex = index; - } - item.matchMask = matchMask; - item.exactMatch = penalty ? 0 : 1; - item.score = (item.score || 0) - penalty; - results.push(item); - } - return results; - }; -}).call(FilteredList.prototype); - -exports.Autocomplete = Autocomplete; -exports.FilteredList = FilteredList; - -}); - -define('ace/autocomplete/popup', ['require', 'exports', 'module' , 'ace/edit_session', 'ace/virtual_renderer', 'ace/editor', 'ace/range', 'ace/lib/event', 'ace/lib/lang', 'ace/lib/dom'], function(require, exports, module) { - - -var EditSession = require("../edit_session").EditSession; -var Renderer = require("../virtual_renderer").VirtualRenderer; -var Editor = require("../editor").Editor; -var Range = require("../range").Range; -var event = require("../lib/event"); -var lang = require("../lib/lang"); -var dom = require("../lib/dom"); - -var $singleLineEditor = function(el) { - var renderer = new Renderer(el); - - renderer.$maxLines = 4; - - var editor = new Editor(renderer); - - editor.setHighlightActiveLine(false); - editor.setShowPrintMargin(false); - editor.renderer.setShowGutter(false); - editor.renderer.setHighlightGutterLine(false); - - editor.$mouseHandler.$focusWaitTimout = 0; - - return editor; -}; - -var AcePopup = function(parentNode) { - var el = dom.createElement("div"); - var popup = new $singleLineEditor(el); - - if (parentNode) - parentNode.appendChild(el); - el.style.display = "none"; - popup.renderer.content.style.cursor = "default"; - popup.renderer.setStyle("ace_autocomplete"); - - popup.setOption("displayIndentGuides", false); - - var noop = function(){}; - - popup.focus = noop; - popup.$isFocused = true; - - popup.renderer.$cursorLayer.restartTimer = noop; - popup.renderer.$cursorLayer.element.style.opacity = 0; - - popup.renderer.$maxLines = 8; - popup.renderer.$keepTextAreaAtCursor = false; - - popup.setHighlightActiveLine(false); - popup.session.highlight(""); - popup.session.$searchHighlight.clazz = "ace_highlight-marker"; - - popup.on("mousedown", function(e) { - var pos = e.getDocumentPosition(); - popup.moveCursorToPosition(pos); - popup.selection.clearSelection(); - selectionMarker.start.row = selectionMarker.end.row = pos.row; - e.stop(); - }); - - var lastMouseEvent; - var hoverMarker = new Range(-1,0,-1,Infinity); - var selectionMarker = new Range(-1,0,-1,Infinity); - selectionMarker.id = popup.session.addMarker(selectionMarker, "ace_active-line", "fullLine"); - popup.setSelectOnHover = function(val) { - if (!val) { - hoverMarker.id = popup.session.addMarker(hoverMarker, "ace_line-hover", "fullLine"); - } else if (hoverMarker.id) { - popup.session.removeMarker(hoverMarker.id); - hoverMarker.id = null; - } - } - popup.setSelectOnHover(false); - popup.on("mousemove", function(e) { - if (!lastMouseEvent) { - lastMouseEvent = e; - return; - } - if (lastMouseEvent.x == e.x && lastMouseEvent.y == e.y) { - return; - } - lastMouseEvent = e; - lastMouseEvent.scrollTop = popup.renderer.scrollTop; - var row = lastMouseEvent.getDocumentPosition().row; - if (hoverMarker.start.row != row) { - if (!hoverMarker.id) - popup.setRow(row); - setHoverMarker(row); - } - }); - popup.renderer.on("beforeRender", function() { - if (lastMouseEvent && hoverMarker.start.row != -1) { - lastMouseEvent.$pos = null; - var row = lastMouseEvent.getDocumentPosition().row; - if (!hoverMarker.id) - popup.setRow(row); - setHoverMarker(row, true); - } - }); - popup.renderer.on("afterRender", function() { - var row = popup.getRow(); - var t = popup.renderer.$textLayer; - var selected = t.element.childNodes[row - t.config.firstRow]; - if (selected == t.selectedNode) - return; - if (t.selectedNode) - dom.removeCssClass(t.selectedNode, "ace_selected"); - t.selectedNode = selected; - if (selected) - dom.addCssClass(selected, "ace_selected"); - }); - var hideHoverMarker = function() { setHoverMarker(-1) }; - var setHoverMarker = function(row, suppressRedraw) { - if (row !== hoverMarker.start.row) { - hoverMarker.start.row = hoverMarker.end.row = row; - if (!suppressRedraw) - popup.session._emit("changeBackMarker"); - popup._emit("changeHoverMarker"); - } - }; - popup.getHoveredRow = function() { - return hoverMarker.start.row; - }; - - event.addListener(popup.container, "mouseout", hideHoverMarker); - popup.on("hide", hideHoverMarker); - popup.on("changeSelection", hideHoverMarker); - - popup.session.doc.getLength = function() { - return popup.data.length; - }; - popup.session.doc.getLine = function(i) { - var data = popup.data[i]; - if (typeof data == "string") - return data; - return (data && data.value) || ""; - }; - - var bgTokenizer = popup.session.bgTokenizer; - bgTokenizer.$tokenizeRow = function(i) { - var data = popup.data[i]; - var tokens = []; - if (!data) - return tokens; - if (typeof data == "string") - data = {value: data}; - if (!data.caption) - data.caption = data.value; - - var last = -1; - var flag, c; - for (var i = 0; i < data.caption.length; i++) { - c = data.caption[i]; - flag = data.matchMask & (1 << i) ? 1 : 0; - if (last !== flag) { - tokens.push({type: data.className || "" + ( flag ? "completion-highlight" : ""), value: c}); - last = flag; - } else { - tokens[tokens.length - 1].value += c; - } - } - - if (data.meta) { - var maxW = popup.renderer.$size.scrollerWidth / popup.renderer.layerConfig.characterWidth; - if (data.meta.length + data.caption.length < maxW - 2) - tokens.push({type: "rightAlignedText", value: data.meta}); - } - return tokens; - }; - bgTokenizer.$updateOnChange = noop; - bgTokenizer.start = noop; - - popup.session.$computeWidth = function() { - return this.screenWidth = 0; - } - popup.data = []; - popup.setData = function(list) { - popup.data = list || []; - popup.setValue(lang.stringRepeat("\n", list.length), -1); - popup.setRow(0); - }; - popup.getData = function(row) { - return popup.data[row]; - }; - - popup.getRow = function() { - return selectionMarker.start.row; - }; - popup.setRow = function(line) { - line = Math.max(-1, Math.min(this.data.length, line)); - if (selectionMarker.start.row != line) { - popup.selection.clearSelection(); - selectionMarker.start.row = selectionMarker.end.row = line || 0; - popup.session._emit("changeBackMarker"); - popup.moveCursorTo(line || 0, 0); - if (popup.isOpen) - popup._signal("select"); - } - }; - - popup.hide = function() { - this.container.style.display = "none"; - this._signal("hide"); - popup.isOpen = false; - }; - popup.show = function(pos, lineHeight) { - var el = this.container; - var screenHeight = window.innerHeight; - var renderer = this.renderer; - var maxH = renderer.$maxLines * lineHeight * 1.4; - var top = pos.top + this.$borderSize; - if (top + maxH > screenHeight - lineHeight) { - el.style.top = ""; - el.style.bottom = screenHeight - top + "px"; - } else { - top += lineHeight; - el.style.top = top + "px"; - el.style.bottom = ""; - } - - el.style.left = pos.left + "px"; - el.style.display = ""; - this.renderer.$textLayer.checkForSizeChanges(); - - this._signal("show"); - lastMouseEvent = null; - popup.isOpen = true; - }; - - popup.getTextLeftOffset = function() { - return this.$borderSize + this.renderer.$padding + this.$imageSize; - }; - - popup.$imageSize = 0; - popup.$borderSize = 1; - - return popup; -}; - -dom.importCssString("\ -.ace_autocomplete.ace-tm .ace_marker-layer .ace_active-line {\ - background-color: #CAD6FA;\ - z-index: 1;\ -}\ -.ace_autocomplete.ace-tm .ace_line-hover {\ - border: 1px solid #abbffe;\ - margin-top: -1px;\ - background: rgba(233,233,253,0.4);\ -}\ -.ace_autocomplete .ace_line-hover {\ - position: absolute;\ - z-index: 2;\ -}\ -.ace_rightAlignedText {\ - color: gray;\ - display: inline-block;\ - position: absolute;\ - right: 4px;\ - text-align: right;\ - z-index: -1;\ -}\ -.ace_autocomplete .ace_completion-highlight{\ - color: #000;\ - text-shadow: 0 0 0.01em;\ -}\ -.ace_autocomplete {\ - width: 280px;\ - z-index: 200000;\ - background: #fbfbfb;\ - color: #444;\ - border: 1px lightgray solid;\ - position: fixed;\ - box-shadow: 2px 3px 5px rgba(0,0,0,.2);\ - line-height: 1.4;\ -}"); - -exports.AcePopup = AcePopup; - -}); - -define('ace/autocomplete/util', ['require', 'exports', 'module' ], function(require, exports, module) { - - -exports.parForEach = function(array, fn, callback) { - var completed = 0; - var arLength = array.length; - if (arLength === 0) - callback(); - for (var i = 0; i < arLength; i++) { - fn(array[i], function(result, err) { - completed++; - if (completed === arLength) - callback(result, err); - }); - } -} - -var ID_REGEX = /[a-zA-Z_0-9\$-]/; - -exports.retrievePrecedingIdentifier = function(text, pos, regex) { - regex = regex || ID_REGEX; - var buf = []; - for (var i = pos-1; i >= 0; i--) { - if (regex.test(text[i])) - buf.push(text[i]); - else - break; - } - return buf.reverse().join(""); -} - -exports.retrieveFollowingIdentifier = function(text, pos, regex) { - regex = regex || ID_REGEX; - var buf = []; - for (var i = pos; i < text.length; i++) { - if (regex.test(text[i])) - buf.push(text[i]); - else - break; - } - return buf; -} - -}); - -define('ace/autocomplete/text_completer', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - var Range = require("ace/range").Range; - - var splitRegex = /[^a-zA-Z_0-9\$\-]+/; - - function getWordIndex(doc, pos) { - var textBefore = doc.getTextRange(Range.fromPoints({row: 0, column:0}, pos)); - return textBefore.split(splitRegex).length - 1; - } - function wordDistance(doc, pos) { - var prefixPos = getWordIndex(doc, pos); - var words = doc.getValue().split(splitRegex); - var wordScores = Object.create(null); - - var currentWord = words[prefixPos]; - - words.forEach(function(word, idx) { - if (!word || word === currentWord) return; - - var distance = Math.abs(prefixPos - idx); - var score = words.length - distance; - if (wordScores[word]) { - wordScores[word] = Math.max(score, wordScores[word]); - } else { - wordScores[word] = score; - } - }); - return wordScores; - } - - exports.getCompletions = function(editor, session, pos, prefix, callback) { - var wordScore = wordDistance(session, pos, prefix); - var wordList = Object.keys(wordScore); - callback(null, wordList.map(function(word) { - return { - name: word, - value: word, - score: wordScore[word], - meta: "local" - }; - })); - }; -}); \ No newline at end of file diff --git a/addons/editor/ace/ext-old_ie.js b/addons/editor/ace/ext-old_ie.js deleted file mode 100644 index f926b627..00000000 --- a/addons/editor/ace/ext-old_ie.js +++ /dev/null @@ -1,499 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2010, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/ext/old_ie', ['require', 'exports', 'module' , 'ace/lib/useragent', 'ace/tokenizer', 'ace/ext/searchbox'], function(require, exports, module) { - -var MAX_TOKEN_COUNT = 1000; -var useragent = require("../lib/useragent"); -var TokenizerModule = require("../tokenizer"); - -function patch(obj, name, regexp, replacement) { - eval("obj['" + name + "']=" + obj[name].toString().replace( - regexp, replacement - )); -} - -if (useragent.isIE && useragent.isIE < 10 && window.top.document.compatMode === "BackCompat") - useragent.isOldIE = true; - -if (typeof document != "undefined" && !document.documentElement.querySelector) { - useragent.isOldIE = true; - var qs = function(el, selector) { - if (selector.charAt(0) == ".") { - var classNeme = selector.slice(1); - } else { - var m = selector.match(/(\w+)=(\w+)/); - var attr = m && m[1]; - var attrVal = m && m[2]; - } - for (var i = 0; i < el.all.length; i++) { - var ch = el.all[i]; - if (classNeme) { - if (ch.className.indexOf(classNeme) != -1) - return ch; - } else if (attr) { - if (ch.getAttribute(attr) == attrVal) - return ch; - } - } - }; - var sb = require("./searchbox").SearchBox.prototype; - patch( - sb, "$initElements", - /([^\s=]*).querySelector\((".*?")\)/g, - "qs($1, $2)" - ); -} - -var compliantExecNpcg = /()??/.exec("")[1] === undefined; -if (compliantExecNpcg) - return; -var proto = TokenizerModule.Tokenizer.prototype; -TokenizerModule.Tokenizer_orig = TokenizerModule.Tokenizer; -proto.getLineTokens_orig = proto.getLineTokens; - -patch( - TokenizerModule, "Tokenizer", - "ruleRegExps.push(adjustedregex);\n", - function(m) { - return m + '\ - if (state[i].next && RegExp(adjustedregex).test(""))\n\ - rule._qre = RegExp(adjustedregex, "g");\n\ - '; - } -); -TokenizerModule.Tokenizer.prototype = proto; -patch( - proto, "getLineTokens", - /if \(match\[i \+ 1\] === undefined\)\s*continue;/, - "if (!match[i + 1]) {\n\ - if (value)continue;\n\ - var qre = state[mapping[i]]._qre;\n\ - if (!qre) continue;\n\ - qre.lastIndex = lastIndex;\n\ - if (!qre.exec(line) || qre.lastIndex != lastIndex)\n\ - continue;\n\ - }" -); - -useragent.isOldIE = true; - -}); - -define('ace/ext/searchbox', ['require', 'exports', 'module' , 'ace/lib/dom', 'ace/lib/lang', 'ace/lib/event', 'ace/keyboard/hash_handler', 'ace/lib/keys'], function(require, exports, module) { - - -var dom = require("../lib/dom"); -var lang = require("../lib/lang"); -var event = require("../lib/event"); -var searchboxCss = "\ -/* ------------------------------------------------------------------------------------------\ -* Editor Search Form\ -* --------------------------------------------------------------------------------------- */\ -.ace_search {\ -background-color: #ddd;\ -border: 1px solid #cbcbcb;\ -border-top: 0 none;\ -max-width: 297px;\ -overflow: hidden;\ -margin: 0;\ -padding: 4px;\ -padding-right: 6px;\ -padding-bottom: 0;\ -position: absolute;\ -top: 0px;\ -z-index: 99;\ -}\ -.ace_search.left {\ -border-left: 0 none;\ -border-radius: 0px 0px 5px 0px;\ -left: 0;\ -}\ -.ace_search.right {\ -border-radius: 0px 0px 0px 5px;\ -border-right: 0 none;\ -right: 0;\ -}\ -.ace_search_form, .ace_replace_form {\ -border-radius: 3px;\ -border: 1px solid #cbcbcb;\ -float: left;\ -margin-bottom: 4px;\ -overflow: hidden;\ -}\ -.ace_search_form.ace_nomatch {\ -outline: 1px solid red;\ -}\ -.ace_search_field {\ -background-color: white;\ -border-right: 1px solid #cbcbcb;\ -border: 0 none;\ --webkit-box-sizing: border-box;\ --moz-box-sizing: border-box;\ -box-sizing: border-box;\ -display: block;\ -float: left;\ -height: 22px;\ -outline: 0;\ -padding: 0 7px;\ -width: 214px;\ -margin: 0;\ -}\ -.ace_searchbtn,\ -.ace_replacebtn {\ -background: #fff;\ -border: 0 none;\ -border-left: 1px solid #dcdcdc;\ -cursor: pointer;\ -display: block;\ -float: left;\ -height: 22px;\ -margin: 0;\ -padding: 0;\ -position: relative;\ -}\ -.ace_searchbtn:last-child,\ -.ace_replacebtn:last-child {\ -border-top-right-radius: 3px;\ -border-bottom-right-radius: 3px;\ -}\ -.ace_searchbtn:disabled {\ -background: none;\ -cursor: default;\ -}\ -.ace_searchbtn {\ -background-position: 50% 50%;\ -background-repeat: no-repeat;\ -width: 27px;\ -}\ -.ace_searchbtn.prev {\ -background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADFJREFUeNpiSU1NZUAC/6E0I0yACYskCpsJiySKIiY0SUZk40FyTEgCjGgKwTRAgAEAQJUIPCE+qfkAAAAASUVORK5CYII=); \ -}\ -.ace_searchbtn.next {\ -background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADRJREFUeNpiTE1NZQCC/0DMyIAKwGJMUAYDEo3M/s+EpvM/mkKwCQxYjIeLMaELoLMBAgwAU7UJObTKsvAAAAAASUVORK5CYII=); \ -}\ -.ace_searchbtn_close {\ -background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAcCAYAAABRVo5BAAAAZ0lEQVR42u2SUQrAMAhDvazn8OjZBilCkYVVxiis8H4CT0VrAJb4WHT3C5xU2a2IQZXJjiQIRMdkEoJ5Q2yMqpfDIo+XY4k6h+YXOyKqTIj5REaxloNAd0xiKmAtsTHqW8sR2W5f7gCu5nWFUpVjZwAAAABJRU5ErkJggg==) no-repeat 50% 0;\ -border-radius: 50%;\ -border: 0 none;\ -color: #656565;\ -cursor: pointer;\ -display: block;\ -float: right;\ -font-family: Arial;\ -font-size: 16px;\ -height: 14px;\ -line-height: 16px;\ -margin: 5px 1px 9px 5px;\ -padding: 0;\ -text-align: center;\ -width: 14px;\ -}\ -.ace_searchbtn_close:hover {\ -background-color: #656565;\ -background-position: 50% 100%;\ -color: white;\ -}\ -.ace_replacebtn.prev {\ -width: 54px\ -}\ -.ace_replacebtn.next {\ -width: 27px\ -}\ -.ace_button {\ -margin-left: 2px;\ -cursor: pointer;\ --webkit-user-select: none;\ --moz-user-select: none;\ --o-user-select: none;\ --ms-user-select: none;\ -user-select: none;\ -overflow: hidden;\ -opacity: 0.7;\ -border: 1px solid rgba(100,100,100,0.23);\ -padding: 1px;\ --moz-box-sizing: border-box;\ -box-sizing: border-box;\ -color: black;\ -}\ -.ace_button:hover {\ -background-color: #eee;\ -opacity:1;\ -}\ -.ace_button:active {\ -background-color: #ddd;\ -}\ -.ace_button.checked {\ -border-color: #3399ff;\ -opacity:1;\ -}\ -.ace_search_options{\ -margin-bottom: 3px;\ -text-align: right;\ --webkit-user-select: none;\ --moz-user-select: none;\ --o-user-select: none;\ --ms-user-select: none;\ -user-select: none;\ -}"; -var HashHandler = require("../keyboard/hash_handler").HashHandler; -var keyUtil = require("../lib/keys"); - -dom.importCssString(searchboxCss, "ace_searchbox"); - -var html = ''.replace(/>\s+/g, ">"); - -var SearchBox = function(editor, range, showReplaceForm) { - var div = dom.createElement("div"); - div.innerHTML = html; - this.element = div.firstChild; - - this.$init(); - this.setEditor(editor); -}; - -(function() { - this.setEditor = function(editor) { - editor.searchBox = this; - editor.container.appendChild(this.element); - this.editor = editor; - }; - - this.$initElements = function(sb) { - this.searchBox = sb.querySelector(".ace_search_form"); - this.replaceBox = sb.querySelector(".ace_replace_form"); - this.searchOptions = sb.querySelector(".ace_search_options"); - this.regExpOption = sb.querySelector("[action=toggleRegexpMode]"); - this.caseSensitiveOption = sb.querySelector("[action=toggleCaseSensitive]"); - this.wholeWordOption = sb.querySelector("[action=toggleWholeWords]"); - this.searchInput = this.searchBox.querySelector(".ace_search_field"); - this.replaceInput = this.replaceBox.querySelector(".ace_search_field"); - }; - - this.$init = function() { - var sb = this.element; - - this.$initElements(sb); - - var _this = this; - event.addListener(sb, "mousedown", function(e) { - setTimeout(function(){ - _this.activeInput.focus(); - }, 0); - event.stopPropagation(e); - }); - event.addListener(sb, "click", function(e) { - var t = e.target || e.srcElement; - var action = t.getAttribute("action"); - if (action && _this[action]) - _this[action](); - else if (_this.$searchBarKb.commands[action]) - _this.$searchBarKb.commands[action].exec(_this); - event.stopPropagation(e); - }); - - event.addCommandKeyListener(sb, function(e, hashId, keyCode) { - var keyString = keyUtil.keyCodeToString(keyCode); - var command = _this.$searchBarKb.findKeyCommand(hashId, keyString); - if (command && command.exec) { - command.exec(_this); - event.stopEvent(e); - } - }); - - this.$onChange = lang.delayedCall(function() { - _this.find(false, false); - }); - - event.addListener(this.searchInput, "input", function() { - _this.$onChange.schedule(20); - }); - event.addListener(this.searchInput, "focus", function() { - _this.activeInput = _this.searchInput; - _this.searchInput.value && _this.highlight(); - }); - event.addListener(this.replaceInput, "focus", function() { - _this.activeInput = _this.replaceInput; - _this.searchInput.value && _this.highlight(); - }); - }; - this.$closeSearchBarKb = new HashHandler([{ - bindKey: "Esc", - name: "closeSearchBar", - exec: function(editor) { - editor.searchBox.hide(); - } - }]); - this.$searchBarKb = new HashHandler(); - this.$searchBarKb.bindKeys({ - "Ctrl-f|Command-f|Ctrl-H|Command-Option-F": function(sb) { - var isReplace = sb.isReplace = !sb.isReplace; - sb.replaceBox.style.display = isReplace ? "" : "none"; - sb[isReplace ? "replaceInput" : "searchInput"].focus(); - }, - "Ctrl-G|Command-G": function(sb) { - sb.findNext(); - }, - "Ctrl-Shift-G|Command-Shift-G": function(sb) { - sb.findPrev(); - }, - "esc": function(sb) { - setTimeout(function() { sb.hide();}); - }, - "Return": function(sb) { - if (sb.activeInput == sb.replaceInput) - sb.replace(); - sb.findNext(); - }, - "Shift-Return": function(sb) { - if (sb.activeInput == sb.replaceInput) - sb.replace(); - sb.findPrev(); - }, - "Tab": function(sb) { - (sb.activeInput == sb.replaceInput ? sb.searchInput : sb.replaceInput).focus(); - } - }); - - this.$searchBarKb.addCommands([{ - name: "toggleRegexpMode", - bindKey: {win: "Alt-R|Alt-/", mac: "Ctrl-Alt-R|Ctrl-Alt-/"}, - exec: function(sb) { - sb.regExpOption.checked = !sb.regExpOption.checked; - sb.$syncOptions(); - } - }, { - name: "toggleCaseSensitive", - bindKey: {win: "Alt-C|Alt-I", mac: "Ctrl-Alt-R|Ctrl-Alt-I"}, - exec: function(sb) { - sb.caseSensitiveOption.checked = !sb.caseSensitiveOption.checked; - sb.$syncOptions(); - } - }, { - name: "toggleWholeWords", - bindKey: {win: "Alt-B|Alt-W", mac: "Ctrl-Alt-B|Ctrl-Alt-W"}, - exec: function(sb) { - sb.wholeWordOption.checked = !sb.wholeWordOption.checked; - sb.$syncOptions(); - } - }]); - - this.$syncOptions = function() { - dom.setCssClass(this.regExpOption, "checked", this.regExpOption.checked); - dom.setCssClass(this.wholeWordOption, "checked", this.wholeWordOption.checked); - dom.setCssClass(this.caseSensitiveOption, "checked", this.caseSensitiveOption.checked); - this.find(false, false); - }; - - this.highlight = function(re) { - this.editor.session.highlight(re || this.editor.$search.$options.re); - this.editor.renderer.updateBackMarkers() - }; - this.find = function(skipCurrent, backwards) { - var range = this.editor.find(this.searchInput.value, { - skipCurrent: skipCurrent, - backwards: backwards, - wrap: true, - regExp: this.regExpOption.checked, - caseSensitive: this.caseSensitiveOption.checked, - wholeWord: this.wholeWordOption.checked - }); - var noMatch = !range && this.searchInput.value; - dom.setCssClass(this.searchBox, "ace_nomatch", noMatch); - this.editor._emit("findSearchBox", { match: !noMatch }); - this.highlight(); - }; - this.findNext = function() { - this.find(true, false); - }; - this.findPrev = function() { - this.find(true, true); - }; - this.replace = function() { - if (!this.editor.getReadOnly()) - this.editor.replace(this.replaceInput.value); - }; - this.replaceAndFindNext = function() { - if (!this.editor.getReadOnly()) { - this.editor.replace(this.replaceInput.value); - this.findNext() - } - }; - this.replaceAll = function() { - if (!this.editor.getReadOnly()) - this.editor.replaceAll(this.replaceInput.value); - }; - - this.hide = function() { - this.element.style.display = "none"; - this.editor.keyBinding.removeKeyboardHandler(this.$closeSearchBarKb); - this.editor.focus(); - }; - this.show = function(value, isReplace) { - this.element.style.display = ""; - this.replaceBox.style.display = isReplace ? "" : "none"; - - this.isReplace = isReplace; - - if (value) - this.searchInput.value = value; - this.searchInput.focus(); - this.searchInput.select(); - - this.editor.keyBinding.addKeyboardHandler(this.$closeSearchBarKb); - }; - -}).call(SearchBox.prototype); - -exports.SearchBox = SearchBox; - -exports.Search = function(editor, isReplace) { - var sb = editor.searchBox || new SearchBox(editor); - sb.show(editor.session.getTextRange(), isReplace); -}; - -}); diff --git a/addons/editor/ace/ext-options.js b/addons/editor/ace/ext-options.js deleted file mode 100644 index 9086a163..00000000 --- a/addons/editor/ace/ext-options.js +++ /dev/null @@ -1,252 +0,0 @@ -define('ace/ext/options', ['require', 'exports', 'module' ], function(require, exports, module) { - - -var modesByName = modelist.modesByName; - -var options = [ - ["Document", function(name) { - doclist.loadDoc(name, function(session) { - if (!session) - return; - session = env.split.setSession(session); - updateUIEditorOptions(); - env.editor.focus(); - }); - }, doclist.all], - ["Mode", function(value) { - env.editor.session.setMode(modesByName[value].mode || modesByName.text.mode); - env.editor.session.modeName = value; - }, function(value) { - return env.editor.session.modeName || "text" - }, modelist.modes], - ["Split", function(value) { - var sp = env.split; - if (value == "none") { - if (sp.getSplits() == 2) { - env.secondSession = sp.getEditor(1).session; - } - sp.setSplits(1); - } else { - var newEditor = (sp.getSplits() == 1); - if (value == "below") { - sp.setOrientation(sp.BELOW); - } else { - sp.setOrientation(sp.BESIDE); - } - sp.setSplits(2); - - if (newEditor) { - var session = env.secondSession || sp.getEditor(0).session; - var newSession = sp.setSession(session, 1); - newSession.name = session.name; - } - } - }, ["None", "Beside", "Below"]], - ["Theme", function(value) { - if (!value) - return; - env.editor.setTheme("ace/theme/" + value); - themeEl.selectedValue = value; - }, function() { - return env.editor.getTheme(); - }, { - "Bright": { - chrome: "Chrome", - clouds: "Clouds", - crimson_editor: "Crimson Editor", - dawn: "Dawn", - dreamweaver: "Dreamweaver", - eclipse: "Eclipse", - github: "GitHub", - solarized_light: "Solarized Light", - textmate: "TextMate", - tomorrow: "Tomorrow", - xcode: "XCode" - }, - "Dark": { - ambiance: "Ambiance", - chaos: "Chaos", - clouds_midnight: "Clouds Midnight", - cobalt: "Cobalt", - idle_fingers: "idleFingers", - kr_theme: "krTheme", - merbivore: "Merbivore", - merbivore_soft: "Merbivore Soft", - mono_industrial: "Mono Industrial", - monokai: "Monokai", - pastel_on_dark: "Pastel on dark", - solarized_dark: "Solarized Dark", - twilight: "Twilight", - tomorrow_night: "Tomorrow Night", - tomorrow_night_blue: "Tomorrow Night Blue", - tomorrow_night_bright: "Tomorrow Night Bright", - tomorrow_night_eighties: "Tomorrow Night 80s", - vibrant_ink: "Vibrant Ink", - } - }], - ["Code Folding", function(value) { - env.editor.getSession().setFoldStyle(value); - env.editor.setShowFoldWidgets(value !== "manual"); - }, ["manual", "mark begin", "mark begin and end"]], - ["Soft Wrap", function(value) { - value = value.toLowerCase() - var session = env.editor.getSession(); - var renderer = env.editor.renderer; - session.setUseWrapMode(value == "off"); - var col = parseInt(value) || null; - renderer.setPrintMarginColumn(col || 80); - session.setWrapLimitRange(col, col); - }, ["Off", "40 Chars", "80 Chars", "Free"]], - ["Key Binding", function(value) { - env.editor.setKeyboardHandler(keybindings[value]); - }, ["Ace", "Vim", "Emacs", "Custom"]], - ["Font Size", function(value) { - env.split.setFontSize(value + "px"); - }, [10, 11, 12, 14, 16, 20, 24]], - ["Full Line Selection", function(checked) { - env.editor.setSelectionStyle(checked ? "line" : "text"); - }], - ["Highlight Active Line", function(checked) { - env.editor.setHighlightActiveLine(checked); - }], - ["Show Invisibles", function(checked) { - env.editor.setShowInvisibles(checked); - }], - ["Show Gutter", function(checked) { - env.editor.renderer.setShowGutter(checked); - }], - ["Show Indent Guides", function(checked) { - env.editor.renderer.setDisplayIndentGuides(checked); - }], - ["Show Print Margin", function(checked) { - env.editor.renderer.setShowPrintMargin(checked); - }], - ["Persistent HScroll", function(checked) { - env.editor.renderer.setHScrollBarAlwaysVisible(checked); - }], - ["Animate Scrolling", function(checked) { - env.editor.setAnimatedScroll(checked); - }], - ["Use Soft Tab", function(checked) { - env.editor.getSession().setUseSoftTabs(checked); - }], - ["Highlight Selected Word", function(checked) { - env.editor.setHighlightSelectedWord(checked); - }], - ["Enable Behaviours", function(checked) { - env.editor.setBehavioursEnabled(checked); - }], - ["Fade Fold Widgets", function(checked) { - env.editor.setFadeFoldWidgets(checked); - }], - ["Show Token info", function(checked) { - env.editor.setFadeFoldWidgets(checked); - }] -] - -var createOptionsPanel = function(options) { - var html = [] - var container = document.createElement("div"); - container.style.cssText = "position: absolute; overflow: hidden"; - var inner = document.createElement("div"); - inner.style.cssText = "width: 120%;height:100%;overflow: scroll"; - container.appendChild(inner); - html.push(""); - - options.forEach(function(o) { - - }); - - html.push( - '', - '', - '' - ) - html.push("
', - '', - '', - '', - '
"); - return container; -} - -function bindCheckbox(id, callback) { - var el = document.getElementById(id); - if (localStorage && localStorage.getItem(id)) - el.checked = localStorage.getItem(id) == "1"; - - var onCheck = function() { - callback(!!el.checked); - saveOption(el); - }; - el.onclick = onCheck; - onCheck(); -} - -function bindDropdown(id, callback) { - var el = document.getElementById(id); - if (localStorage && localStorage.getItem(id)) - el.value = localStorage.getItem(id); - - var onChange = function() { - callback(el.value); - saveOption(el); - }; - - el.onchange = onChange; - onChange(); -} - -function fillOptgroup(list, el) { - list.forEach(function(item) { - var option = document.createElement("option"); - option.setAttribute("value", item.name); - option.innerHTML = item.desc; - el.appendChild(option); - }); -} - -function fillDropdown(list, el) { - if (Array.isArray(list)) { - fillOptgroup(list, el); - return; - } - for(var i in list) { - var group = document.createElement("optgroup"); - group.setAttribute("label", i); - fillOptgroup(list[i], group); - el.appendChild(group); - } -} - -function createOptionControl(opt) { - if (opt.values) { - var el = dom.createElement("select"); - el.setAttribute("size", opt.visibleSize || 1); - fillDropdown(opt.values, el) - } else { - var el = dom.createElement("checkbox"); - } - el.setAttribute("name", "opt_" + opt.name) - return el; -} - -function createOptionCell(opt) { - if (opt.values) { - var el = dom.createElement("select"); - el.setAttribute("size", opt.visibleSize || 1); - fillDropdown(opt.values, el) - } else { - var el = dom.createElement("checkbox"); - } - el.setAttribute("name", "opt_" + opt.name) - return el; -} - - -createOptionsPanel(options) - - - -}); - diff --git a/addons/editor/ace/ext-settings_menu.js b/addons/editor/ace/ext-settings_menu.js deleted file mode 100644 index 5d866d1e..00000000 --- a/addons/editor/ace/ext-settings_menu.js +++ /dev/null @@ -1,634 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl - * All rights reserved. - * - * Contributed to Ajax.org under the BSD license. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/ext/settings_menu', ['require', 'exports', 'module' , 'ace/ext/menu_tools/generate_settings_menu', 'ace/ext/menu_tools/overlay_page', 'ace/editor'], function(require, exports, module) { - -var generateSettingsMenu = require('./menu_tools/generate_settings_menu').generateSettingsMenu; -var overlayPage = require('./menu_tools/overlay_page').overlayPage; -function showSettingsMenu(editor) { - var sm = document.getElementById('ace_settingsmenu'); - if (!sm) - overlayPage(editor, generateSettingsMenu(editor), '0', '0', '0'); -} -module.exports.init = function(editor) { - var Editor = require("ace/editor").Editor; - Editor.prototype.showSettingsMenu = function() { - showSettingsMenu(this); - }; -}; -}); - -define('ace/ext/menu_tools/generate_settings_menu', ['require', 'exports', 'module' , 'ace/ext/menu_tools/element_generator', 'ace/ext/menu_tools/add_editor_menu_options', 'ace/ext/menu_tools/get_set_functions'], function(require, exports, module) { - -var egen = require('./element_generator'); -var addEditorMenuOptions = require('./add_editor_menu_options').addEditorMenuOptions; -var getSetFunctions = require('./get_set_functions').getSetFunctions; -module.exports.generateSettingsMenu = function generateSettingsMenu (editor) { - var elements = []; - function cleanupElementsList() { - elements.sort(function(a, b) { - var x = a.getAttribute('contains'); - var y = b.getAttribute('contains'); - return x.localeCompare(y); - }); - } - function wrapElements() { - var topmenu = document.createElement('div'); - topmenu.setAttribute('id', 'ace_settingsmenu'); - elements.forEach(function(element) { - topmenu.appendChild(element); - }); - return topmenu; - } - function createNewEntry(obj, clss, item, val) { - var el; - var div = document.createElement('div'); - div.setAttribute('contains', item); - div.setAttribute('class', 'ace_optionsMenuEntry'); - div.setAttribute('style', 'clear: both;'); - - div.appendChild(egen.createLabel( - item.replace(/^set/, '').replace(/([A-Z])/g, ' $1').trim(), - item - )); - - if (Array.isArray(val)) { - el = egen.createSelection(item, val, clss); - el.addEventListener('change', function(e) { - try{ - editor.menuOptions[e.target.id].forEach(function(x) { - if(x.textContent !== e.target.textContent) { - delete x.selected; - } - }); - obj[e.target.id](e.target.value); - } catch (err) { - throw new Error(err); - } - }); - } else if(typeof val === 'boolean') { - el = egen.createCheckbox(item, val, clss); - el.addEventListener('change', function(e) { - try{ - obj[e.target.id](!!e.target.checked); - } catch (err) { - throw new Error(err); - } - }); - } else { - el = egen.createInput(item, val, clss); - el.addEventListener('change', function(e) { - try{ - if(e.target.value === 'true') { - obj[e.target.id](true); - } else if(e.target.value === 'false') { - obj[e.target.id](false); - } else { - obj[e.target.id](e.target.value); - } - } catch (err) { - throw new Error(err); - } - }); - } - el.style.cssText = 'float:right;'; - div.appendChild(el); - return div; - } - function makeDropdown(item, esr, clss, fn) { - var val = editor.menuOptions[item]; - var currentVal = esr[fn](); - if (typeof currentVal == 'object') - currentVal = currentVal.$id; - val.forEach(function(valuex) { - if (valuex.value === currentVal) - valuex.selected = 'selected'; - }); - return createNewEntry(esr, clss, item, val); - } - function handleSet(setObj) { - var item = setObj.functionName; - var esr = setObj.parentObj; - var clss = setObj.parentName; - var val; - var fn = item.replace(/^set/, 'get'); - if(editor.menuOptions[item] !== undefined) { - elements.push(makeDropdown(item, esr, clss, fn)); - } else if(typeof esr[fn] === 'function') { - try { - val = esr[fn](); - if(typeof val === 'object') { - val = val.$id; - } - elements.push( - createNewEntry(esr, clss, item, val) - ); - } catch (e) { - } - } - } - addEditorMenuOptions(editor); - getSetFunctions(editor).forEach(function(setObj) { - handleSet(setObj); - }); - cleanupElementsList(); - return wrapElements(); -}; - -}); - -define('ace/ext/menu_tools/element_generator', ['require', 'exports', 'module' ], function(require, exports, module) { -module.exports.createOption = function createOption (obj) { - var attribute; - var el = document.createElement('option'); - for(attribute in obj) { - if(obj.hasOwnProperty(attribute)) { - if(attribute === 'selected') { - el.setAttribute(attribute, obj[attribute]); - } else { - el[attribute] = obj[attribute]; - } - } - } - return el; -}; -module.exports.createCheckbox = function createCheckbox (id, checked, clss) { - var el = document.createElement('input'); - el.setAttribute('type', 'checkbox'); - el.setAttribute('id', id); - el.setAttribute('name', id); - el.setAttribute('value', checked); - el.setAttribute('class', clss); - if(checked) { - el.setAttribute('checked', 'checked'); - } - return el; -}; -module.exports.createInput = function createInput (id, value, clss) { - var el = document.createElement('input'); - el.setAttribute('type', 'text'); - el.setAttribute('id', id); - el.setAttribute('name', id); - el.setAttribute('value', value); - el.setAttribute('class', clss); - return el; -}; -module.exports.createLabel = function createLabel (text, labelFor) { - var el = document.createElement('label'); - el.setAttribute('for', labelFor); - el.textContent = text; - return el; -}; -module.exports.createSelection = function createSelection (id, values, clss) { - var el = document.createElement('select'); - el.setAttribute('id', id); - el.setAttribute('name', id); - el.setAttribute('class', clss); - values.forEach(function(item) { - el.appendChild(module.exports.createOption(item)); - }); - return el; -}; - -}); - -define('ace/ext/menu_tools/add_editor_menu_options', ['require', 'exports', 'module' , 'ace/ext/modelist', 'ace/ext/themelist'], function(require, exports, module) { -module.exports.addEditorMenuOptions = function addEditorMenuOptions (editor) { - var modelist = require('../modelist'); - var themelist = require('../themelist'); - editor.menuOptions = { - "setNewLineMode" : [{ - "textContent" : "unix", - "value" : "unix" - }, { - "textContent" : "windows", - "value" : "windows" - }, { - "textContent" : "auto", - "value" : "auto" - }], - "setTheme" : [], - "setMode" : [], - "setKeyboardHandler": [{ - "textContent" : "ace", - "value" : "" - }, { - "textContent" : "vim", - "value" : "ace/keyboard/vim" - }, { - "textContent" : "emacs", - "value" : "ace/keyboard/emacs" - }] - }; - - editor.menuOptions.setTheme = themelist.themes.map(function(theme) { - return { - 'textContent' : theme.desc, - 'value' : theme.theme - }; - }); - - editor.menuOptions.setMode = modelist.modes.map(function(mode) { - return { - 'textContent' : mode.name, - 'value' : mode.mode - }; - }); -}; - - -});define('ace/ext/modelist', ['require', 'exports', 'module' ], function(require, exports, module) { - - -var modes = []; -function getModeForPath(path) { - var mode = modesByName.text; - var fileName = path.split(/[\/\\]/).pop(); - for (var i = 0; i < modes.length; i++) { - if (modes[i].supportsFile(fileName)) { - mode = modes[i]; - break; - } - } - return mode; -} - -var Mode = function(name, caption, extensions) { - this.name = name; - this.caption = caption; - this.mode = "ace/mode/" + name; - this.extensions = extensions; - if (/\^/.test(extensions)) { - var re = extensions.replace(/\|(\^)?/g, function(a, b){ - return "$|" + (b ? "^" : "^.*\\."); - }) + "$"; - } else { - var re = "^.*\\.(" + extensions + ")$"; - } - - this.extRe = new RegExp(re, "gi"); -}; - -Mode.prototype.supportsFile = function(filename) { - return filename.match(this.extRe); -}; -var supportedModes = { - ABAP: ["abap"], - ActionScript:["as"], - ADA: ["ada|adb"], - AsciiDoc: ["asciidoc"], - Assembly_x86:["asm"], - AutoHotKey: ["ahk"], - BatchFile: ["bat|cmd"], - C9Search: ["c9search_results"], - C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp"], - Clojure: ["clj"], - Cobol: ["CBL|COB"], - coffee: ["coffee|cf|cson|^Cakefile"], - ColdFusion: ["cfm"], - CSharp: ["cs"], - CSS: ["css"], - Curly: ["curly"], - D: ["d|di"], - Dart: ["dart"], - Diff: ["diff|patch"], - Dot: ["dot"], - Erlang: ["erl|hrl"], - EJS: ["ejs"], - Forth: ["frt|fs|ldr"], - FTL: ["ftl"], - Glsl: ["glsl|frag|vert"], - golang: ["go"], - Groovy: ["groovy"], - HAML: ["haml"], - Handlebars: ["hbs|handlebars|tpl|mustache"], - Haskell: ["hs"], - haXe: ["hx"], - HTML: ["html|htm|xhtml"], - HTML_Ruby: ["erb|rhtml|html.erb"], - INI: ["ini|conf|cfg|prefs"], - Jack: ["jack"], - Jade: ["jade"], - Java: ["java"], - JavaScript: ["js|jsm"], - JSON: ["json"], - JSONiq: ["jq"], - JSP: ["jsp"], - JSX: ["jsx"], - Julia: ["jl"], - LaTeX: ["tex|latex|ltx|bib"], - LESS: ["less"], - Liquid: ["liquid"], - Lisp: ["lisp"], - LiveScript: ["ls"], - LogiQL: ["logic|lql"], - LSL: ["lsl"], - Lua: ["lua"], - LuaPage: ["lp"], - Lucene: ["lucene"], - Makefile: ["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"], - MATLAB: ["matlab"], - Markdown: ["md|markdown"], - MySQL: ["mysql"], - MUSHCode: ["mc|mush"], - Nix: ["nix"], - ObjectiveC: ["m|mm"], - OCaml: ["ml|mli"], - Pascal: ["pas|p"], - Perl: ["pl|pm"], - pgSQL: ["pgsql"], - PHP: ["php|phtml"], - Powershell: ["ps1"], - Prolog: ["plg|prolog"], - Properties: ["properties"], - Protobuf: ["proto"], - Python: ["py"], - R: ["r"], - RDoc: ["Rd"], - RHTML: ["Rhtml"], - Ruby: ["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"], - Rust: ["rs"], - SASS: ["sass"], - SCAD: ["scad"], - Scala: ["scala"], - Scheme: ["scm|rkt"], - SCSS: ["scss"], - SH: ["sh|bash|^.bashrc"], - SJS: ["sjs"], - Space: ["space"], - snippets: ["snippets"], - Soy_Template:["soy"], - SQL: ["sql"], - Stylus: ["styl|stylus"], - SVG: ["svg"], - Tcl: ["tcl"], - Tex: ["tex"], - Text: ["txt"], - Textile: ["textile"], - Toml: ["toml"], - Twig: ["twig"], - Typescript: ["ts|typescript|str"], - VBScript: ["vbs"], - Velocity: ["vm"], - Verilog: ["v|vh|sv|svh"], - XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl"], - XQuery: ["xq"], - YAML: ["yaml|yml"] -}; - -var nameOverrides = { - ObjectiveC: "Objective-C", - CSharp: "C#", - golang: "Go", - C_Cpp: "C/C++", - coffee: "CoffeeScript", - HTML_Ruby: "HTML (Ruby)", - FTL: "FreeMarker" -}; -var modesByName = {}; -for (var name in supportedModes) { - var data = supportedModes[name]; - var displayName = nameOverrides[name] || name; - var filename = name.toLowerCase(); - var mode = new Mode(filename, displayName, data[0]); - modesByName[filename] = mode; - modes.push(mode); -} - -module.exports = { - getModeForPath: getModeForPath, - modes: modes, - modesByName: modesByName -}; - -}); - -define('ace/ext/themelist', ['require', 'exports', 'module' , 'ace/ext/themelist_utils/themes'], function(require, exports, module) { -module.exports.themes = require('ace/ext/themelist_utils/themes').themes; -module.exports.ThemeDescription = function(name) { - this.name = name; - this.desc = name.split('_' - ).map( - function(namePart) { - return namePart[0].toUpperCase() + namePart.slice(1); - } - ).join(' '); - this.theme = "ace/theme/" + name; -}; - -module.exports.themesByName = {}; - -module.exports.themes = module.exports.themes.map(function(name) { - module.exports.themesByName[name] = new module.exports.ThemeDescription(name); - return module.exports.themesByName[name]; -}); - -}); - -define('ace/ext/themelist_utils/themes', ['require', 'exports', 'module' ], function(require, exports, module) { - -module.exports.themes = [ - "ambiance", - "chaos", - "chrome", - "clouds", - "clouds_midnight", - "cobalt", - "crimson_editor", - "dawn", - "dreamweaver", - "eclipse", - "github", - "idle_fingers", - "kr_theme", - "merbivore", - "merbivore_soft", - "mono_industrial", - "monokai", - "pastel_on_dark", - "solarized_dark", - "solarized_light", - "terminal", - "textmate", - "tomorrow", - "tomorrow_night", - "tomorrow_night_blue", - "tomorrow_night_bright", - "tomorrow_night_eighties", - "twilight", - "vibrant_ink", - "xcode" -]; - -}); - -define('ace/ext/menu_tools/get_set_functions', ['require', 'exports', 'module' ], function(require, exports, module) { -module.exports.getSetFunctions = function getSetFunctions (editor) { - var out = []; - var my = { - 'editor' : editor, - 'session' : editor.session, - 'renderer' : editor.renderer - }; - var opts = []; - var skip = [ - 'setOption', - 'setUndoManager', - 'setDocument', - 'setValue', - 'setBreakpoints', - 'setScrollTop', - 'setScrollLeft', - 'setSelectionStyle', - 'setWrapLimitRange' - ]; - ['renderer', 'session', 'editor'].forEach(function(esra) { - var esr = my[esra]; - var clss = esra; - for(var fn in esr) { - if(skip.indexOf(fn) === -1) { - if(/^set/.test(fn) && opts.indexOf(fn) === -1) { - opts.push(fn); - out.push({ - 'functionName' : fn, - 'parentObj' : esr, - 'parentName' : clss - }); - } - } - } - }); - return out; -}; - -}); - -define('ace/ext/menu_tools/overlay_page', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) { - -var dom = require("../../lib/dom"); -var cssText = "#ace_settingsmenu, #kbshortcutmenu {\ -background-color: #F7F7F7;\ -color: black;\ -box-shadow: -5px 4px 5px rgba(126, 126, 126, 0.55);\ -padding: 1em 0.5em 2em 1em;\ -overflow: auto;\ -position: absolute;\ -margin: 0;\ -bottom: 0;\ -right: 0;\ -top: 0;\ -z-index: 9991;\ -cursor: default;\ -}\ -.ace_dark #ace_settingsmenu, .ace_dark #kbshortcutmenu {\ -box-shadow: -20px 10px 25px rgba(126, 126, 126, 0.25);\ -background-color: rgba(255, 255, 255, 0.6);\ -color: black;\ -}\ -.ace_optionsMenuEntry:hover {\ -background-color: rgba(100, 100, 100, 0.1);\ --webkit-transition: all 0.5s;\ -transition: all 0.3s\ -}\ -.ace_closeButton {\ -background: rgba(245, 146, 146, 0.5);\ -border: 1px solid #F48A8A;\ -border-radius: 50%;\ -padding: 7px;\ -position: absolute;\ -right: -8px;\ -top: -8px;\ -z-index: 1000;\ -}\ -.ace_closeButton{\ -background: rgba(245, 146, 146, 0.9);\ -}\ -.ace_optionsMenuKey {\ -color: darkslateblue;\ -font-weight: bold;\ -}\ -.ace_optionsMenuCommand {\ -color: darkcyan;\ -font-weight: normal;\ -}"; -dom.importCssString(cssText); -module.exports.overlayPage = function overlayPage(editor, contentElement, top, right, bottom, left) { - top = top ? 'top: ' + top + ';' : ''; - bottom = bottom ? 'bottom: ' + bottom + ';' : ''; - right = right ? 'right: ' + right + ';' : ''; - left = left ? 'left: ' + left + ';' : ''; - - var closer = document.createElement('div'); - var contentContainer = document.createElement('div'); - - function documentEscListener(e) { - if (e.keyCode === 27) { - closer.click(); - } - } - - closer.style.cssText = 'margin: 0; padding: 0; ' + - 'position: fixed; top:0; bottom:0; left:0; right:0;' + - 'z-index: 9990; ' + - 'background-color: rgba(0, 0, 0, 0.3);'; - closer.addEventListener('click', function() { - document.removeEventListener('keydown', documentEscListener); - closer.parentNode.removeChild(closer); - editor.focus(); - closer = null; - }); - document.addEventListener('keydown', documentEscListener); - - contentContainer.style.cssText = top + right + bottom + left; - contentContainer.addEventListener('click', function(e) { - e.stopPropagation(); - }); - - var wrapper = dom.createElement("div"); - wrapper.style.position = "relative"; - - var closeButton = dom.createElement("div"); - closeButton.className = "ace_closeButton"; - closeButton.addEventListener('click', function() { - closer.click(); - }); - - wrapper.appendChild(closeButton); - contentContainer.appendChild(wrapper); - - contentContainer.appendChild(contentElement); - closer.appendChild(contentContainer); - document.body.appendChild(closer); - editor.blur(); -}; - -}); \ No newline at end of file diff --git a/addons/editor/ace/ext-chromevox.js b/addons/editor/ace/ext/chromevox.js old mode 100644 new mode 100755 similarity index 56% rename from addons/editor/ace/ext-chromevox.js rename to addons/editor/ace/ext/chromevox.js index 67258f73..9f7a7996 --- a/addons/editor/ace/ext-chromevox.js +++ b/addons/editor/ace/ext/chromevox.js @@ -1,46 +1,125 @@ -define('ace/ext/chromevox', ['require', 'exports', 'module' , 'ace/editor', 'ace/config'], function(require, exports, module) { +define(function(require, exports, module) { + +/* ChromeVox Ace namespace. */ var cvoxAce = {}; + +/* Typedefs for Closure compiler. */ +/** + * @typedef {{ + rate: number, + pitch: number, + volume: number, + relativePitch: number, + punctuationEcho: string + }} + */ +/* TODO(peterxiao): Export this typedef through cvox.Api. */ cvoxAce.SpeechProperty; + +/** + * @typedef {{ + * row: number, + * column: number + * }} + */ cvoxAce.Cursor; + +/** + * @typedef {{ + type: string, + value: string + }} + } + */ cvoxAce.Token; + +/** + * These are errors and information that Ace will display in the gutter. + * @typedef {{ + row: number, + column: number, + value: string + }} + } + */ cvoxAce.Annotation; + +/* Speech Properties. */ +/** + * Speech property for speaking constant tokens. + * @type {cvoxAce.SpeechProperty} + */ var CONSTANT_PROP = { 'rate': 0.8, 'pitch': 0.4, 'volume': 0.9 }; + +/** + * Default speech property for speaking tokens. + * @type {cvoxAce.SpeechProperty} + */ var DEFAULT_PROP = { 'rate': 1, 'pitch': 0.5, 'volume': 0.9 }; + +/** + * Speech property for speaking entity tokens. + * @type {cvoxAce.SpeechProperty} + */ var ENTITY_PROP = { 'rate': 0.8, 'pitch': 0.8, 'volume': 0.9 }; + +/** + * Speech property for speaking keywords. + * @type {cvoxAce.SpeechProperty} + */ var KEYWORD_PROP = { 'rate': 0.8, 'pitch': 0.3, 'volume': 0.9 }; + +/** + * Speech property for speaking storage tokens. + * @type {cvoxAce.SpeechProperty} + */ var STORAGE_PROP = { 'rate': 0.8, 'pitch': 0.7, 'volume': 0.9 }; + +/** + * Speech property for speaking variable tokens. + * @type {cvoxAce.SpeechProperty} + */ var VARIABLE_PROP = { 'rate': 0.8, 'pitch': 0.8, 'volume': 0.9 }; + +/** + * Speech property for speaking deleted text. + * @type {cvoxAce.SpeechProperty} + */ var DELETED_PROP = { 'punctuationEcho': 'none', 'relativePitch': -0.6 }; + +/* Constants for Earcons. */ var ERROR_EARCON = 'ALERT_NONMODAL'; var MODE_SWITCH_EARCON = 'ALERT_MODAL'; var NO_MATCH_EARCON = 'INVALID_KEYPRESS'; + +/* Constants for vim state. */ var INSERT_MODE_STATE = 'insertMode'; var COMMAND_MODE_STATE = 'start'; @@ -54,6 +133,10 @@ var REPLACE_LIST = [ newSubstr: ' colon ' } ]; + +/** + * Context menu commands. + */ var Command = { SPEAK_ANNOT: 'annots', SPEAK_ALL_ANNOTS: 'all_annots', @@ -63,30 +146,104 @@ var Command = { TOGGLE_DISPLACEMENT: 'toggle_displacement', FOCUS_TEXT: 'focus_text' }; + +/** + * Key prefix for each shortcut. + */ var KEY_PREFIX = 'CONTROL + SHIFT '; + +/* Globals. */ cvoxAce.editor = null; +/** + * Last cursor position. + * @type {cvoxAce.Cursor} + */ var lastCursor = null; + +/** + * Table of annotations. + * @typedef {!Object.>} + */ var annotTable = {}; + +/** + * Whether to speak character, word, and then line. This allows blind users + * to know the location of the cursor when they change lines. + * @typedef {boolean} + */ var shouldSpeakRowLocation = false; + +/** + * Whether to speak displacement. + * @typedef {boolean} + */ var shouldSpeakDisplacement = false; + +/** + * Whether text was changed to cause a cursor change event. + * @typedef {boolean} + */ var changed = false; + +/** + * Current state vim is in. + */ var vimState = null; + +/** + * Mapping from key code to shortcut. + */ var keyCodeToShortcutMap = {}; + +/** + * Mapping from command to shortcut. + */ var cmdToShortcutMap = {}; + +/** + * Get shortcut string from keyCode. + * @param {number} keyCode Key code of shortcut. + * @return {string} String representation of shortcut. + */ var getKeyShortcutString = function(keyCode) { return KEY_PREFIX + String.fromCharCode(keyCode); }; + +/** + * Return if in vim mode. + * @return {boolean} True if in Vim mode. + */ var isVimMode = function() { var keyboardHandler = cvoxAce.editor.keyBinding.getKeyboardHandler(); return keyboardHandler.$id === 'ace/keyboard/vim'; }; + +/** + * Gets the current token. + * @param {!cvoxAce.Cursor} cursor Current position of the cursor. + * @return {!cvoxAce.Token} Token at the current position. + */ var getCurrentToken = function(cursor) { return cvoxAce.editor.getSession().getTokenAt(cursor.row, cursor.column + 1); }; + +/** + * Gets the current line the cursor is under. + * @param {!cvoxAce.Cursor} cursor Current cursor position. + */ var getCurrentLine = function(cursor) { return cvoxAce.editor.getSession().getLine(cursor.row); }; + +/** + * Event handler for row changes. When the user changes rows we want to speak + * the line so the user can work on this line. If shouldSpeakRowLocation is on + * then we speak the character, then the row, then the line so the user knows + * where the cursor is. + * @param {!cvoxAce.Cursor} currCursor Current cursor position. + */ var onRowChange = function(currCursor) { + /* Notify that this line has an annotation. */ if (annotTable[currCursor.row]) { cvox.Api.playEarcon(ERROR_EARCON); } @@ -99,16 +256,28 @@ var onRowChange = function(currCursor) { speakLine(currCursor.row, 0); } }; + +/** + * Returns whether the cursor is at the beginning of a word. A word is + * a grouping of alphanumeric characters including underscores. + * @param {!cvoxAce.Cursor} cursor Current cursor position. + * @return {boolean} Whether there is word. + */ var isWord = function(cursor) { var line = getCurrentLine(cursor); var lineSuffix = line.substr(cursor.column - 1); if (cursor.column === 0) { lineSuffix = ' ' + line; } + /* Use regex to tell if the suffix is at the start of a new word. */ var firstWordRegExp = /^\W(\w+)/; var words = firstWordRegExp.exec(lineSuffix); return words !== null; }; + +/** + * A mapping of syntax type to speech properties / expanding rules. + */ var rules = { 'constant': { prop: CONSTANT_PROP @@ -147,9 +316,20 @@ var rules = { ] } }; + +/** + * Default rule to be used. + */ var DEFAULT_RULE = { prop: DEFAULT_RULE }; + +/** + * Expands substrings to how they are read based on the given rules. + * @param {string} value Text to be expanded. + * @param {Array.} replaceRules Rules to determine expansion. + * @return {string} New expanded value. + */ var expand = function(value, replaceRules) { var newValue = value; for (var i = 0; i < replaceRules.length; i++) { @@ -159,7 +339,16 @@ var expand = function(value, replaceRules) { } return newValue; }; + +/** + * Merges tokens from start inclusive to end exclusive. + * @param {Array.} Tokens to be merged. + * @param {number} start Start index inclusive. + * @param {number} end End index exclusive. + * @return {cvoxAce.Token} Merged token. + */ var mergeTokens = function(tokens, start, end) { + /* Different type of token found! Merge all previous like tokens. */ var newToken = {}; newToken.value = ''; newToken.type = tokens[start].type; @@ -168,6 +357,12 @@ var mergeTokens = function(tokens, start, end) { } return newToken; }; + +/** + * Merges tokens that use the same speech properties. + * @param {Array.} tokens Tokens to be merged. + * @return {Array.} Merged tokens. + */ var mergeLikeTokens = function(tokens) { if (tokens.length <= 1) { return tokens; @@ -185,11 +380,23 @@ var mergeLikeTokens = function(tokens) { newTokens.push(mergeTokens(tokens, lastLikeIndex, tokens.length)); return newTokens; }; + +/** + * Returns if given row is a whitespace row. + * @param {number} row Row. + * @return {boolean} True if row is whitespaces. + */ var isRowWhiteSpace = function(row) { var line = cvoxAce.editor.getSession().getLine(row); var whiteSpaceRegexp = /^\s*$/; return whiteSpaceRegexp.exec(line) !== null; }; + +/** + * Speak the line with syntax properties. + * @param {number} row Row to speak. + * @param {number} queue Queue mode to speak. + */ var speakLine = function(row, queue) { var tokens = cvoxAce.editor.getSession().getTokens(row); if (tokens.length === 0 || isRowWhiteSpace(row)) { @@ -198,19 +405,41 @@ var speakLine = function(row, queue) { } tokens = mergeLikeTokens(tokens); var firstToken = tokens[0]; + /* Filter out first token. */ tokens = tokens.filter(function(token) { return token !== firstToken; }); + /* Speak first token separately to flush if queue. */ speakToken_(firstToken, queue); + /* Speak rest of tokens. */ tokens.forEach(speakTokenQueue); }; + +/** + * Speak the token based on the syntax of the token, flushing. + * @param {!cvoxAce.Token} token Token to speak. + * @param {number} queue Queue mode. + */ var speakTokenFlush = function(token) { speakToken_(token, 0); }; + +/** + * Speak the token based on the syntax of the token, queueing. + * @param {!cvoxAce.Token} token Token to speak. + * @param {number} queue Queue mode. + */ var speakTokenQueue = function(token) { speakToken_(token, 1); }; + +/** + * @param {!cvoxAce.Token} token Token to speak. + * Get the token speech property. + */ var getTokenRule = function(token) { + /* Types are period delimited. In this case, we only syntax speak the outer + * most type of token. */ if (!token || !token.type) { return; } @@ -225,6 +454,13 @@ var getTokenRule = function(token) { } return rule; }; + +/** + * Speak the token based on the syntax of the token. + * @private + * @param {!cvoxAce.Token} token Token to speak. + * @param {number} queue Queue mode. + */ var speakToken_ = function(token, queue) { var rule = getTokenRule(token); var value = expand(token.value, REPLACE_LIST); @@ -233,19 +469,45 @@ var speakToken_ = function(token, queue) { } cvox.Api.speak(value, queue, rule.prop); }; + +/** + * Speaks the character under the cursor. This is queued. + * @param {!cvoxAce.Cursor} cursor Current cursor position. + * @return {string} Character. + */ var speakChar = function(cursor) { var line = getCurrentLine(cursor); cvox.Api.speak(line[cursor.column], 1); }; + +/** + * Speaks the jump from lastCursor to currCursor. This function assumes the + * jump takes place on the current line. + * @param {!cvoxAce.Cursor} lastCursor Previous cursor position. + * @param {!cvoxAce.Cursor} currCursor Current cursor position. + */ var speakDisplacement = function(lastCursor, currCursor) { var line = getCurrentLine(currCursor); + + /* Get the text that we jumped past. */ var displace = line.substring(lastCursor.column, currCursor.column); + + /* Speak out loud spaces. */ displace = displace.replace(/ /g, ' space '); cvox.Api.speak(displace); }; + +/** + * Speaks the word if the cursor jumped to a new word or to the beginning + * of the line. Otherwise speak the charactor. + * @param {!cvoxAce.Cursor} lastCursor Previous cursor position. + * @param {!cvoxAce.Cursor} currCursor Current cursor position. + */ var speakCharOrWordOrLine = function(lastCursor, currCursor) { + /* Say word only if jump. */ if (Math.abs(lastCursor.column - currCursor.column) !== 1) { var currLineLength = getCurrentLine(currCursor).length; + /* Speak line if jumping to beginning or end of line. */ if (currCursor.column === 0 || currCursor.column === currLineLength) { speakLine(currCursor.row, 0); return; @@ -258,6 +520,15 @@ var speakCharOrWordOrLine = function(lastCursor, currCursor) { } speakChar(currCursor); }; + +/** + * Event handler for column changes. If shouldSpeakDisplacement is on, then + * we just speak displacements in row changes. Otherwise, we either speak + * the character for single character movements, the word when jumping to the + * next word, or the entire line if jumping to beginning or end of the line. + * @param {!cvoxAce.Cursor} lastCursor Previous cursor position. + * @param {!cvoxAce.Cursor} currCursor Current cursor position. + */ var onColumnChange = function(lastCursor, currCursor) { if (!cvoxAce.editor.selection.isEmpty()) { speakDisplacement(lastCursor, currCursor); @@ -269,7 +540,15 @@ var onColumnChange = function(lastCursor, currCursor) { speakCharOrWordOrLine(lastCursor, currCursor); } }; + +/** + * Event handler for cursor changes. Classify cursor changes as either row or + * column changes, then delegate accordingly. + * @param {!Event} evt The event. + */ var onCursorChange = function(evt) { + /* Do not speak if cursor change was a result of text insertion. We want to + * speak the text that was inserted and not where the cursor lands. */ if (changed) { changed = false; return; @@ -282,29 +561,54 @@ var onCursorChange = function(evt) { } lastCursor = currCursor; }; + +/** + * Event handler for selection changes. + * @param {!Event} evt The event. + */ var onSelectionChange = function(evt) { + /* Assumes that when selection changes to empty, the user has unselected. */ if (cvoxAce.editor.selection.isEmpty()) { cvox.Api.speak('unselected'); } }; + +/** + * Event handler for source changes. We want auditory feedback for inserting + * and deleting text. + * @param {!Event} evt The event. + */ var onChange = function(evt) { var data = evt.data; switch (data.action) { case 'removeText': cvox.Api.speak(data.text, 0, DELETED_PROP); + /* Let the future cursor change event know it's from text change. */ changed = true; break; case 'insertText': cvox.Api.speak(data.text, 0); + /* Let the future cursor change event know it's from text change. */ changed = true; break; } }; + +/** + * Returns whether or not the annotation is new. + * @param {!cvoxAce.Annotation} annot Annotation in question. + * @return {boolean} Whether annot is new. + */ var isNewAnnotation = function(annot) { var row = annot.row; var col = annot.column; return !annotTable[row] || !annotTable[row][col]; }; + +/** + * Populates the annotation table. + * @param {!Array.} annotations Array of annotations. + */ var populateAnnotations = function(annotations) { annotTable = {}; for (var i = 0; i < annotations.length; i++) { @@ -317,6 +621,12 @@ var populateAnnotations = function(annotations) { annotTable[row][col] = annotation; } }; + +/** + * Event handler for annotation changes. We want to notify the user when an + * a new annotation appears. + * @param {!Event} evt Event. + */ var onAnnotationChange = function(evt) { var annotations = cvoxAce.editor.getSession().getAnnotations(); var newAnnotations = annotations.filter(isNewAnnotation); @@ -325,29 +635,58 @@ var onAnnotationChange = function(evt) { } populateAnnotations(annotations); }; + +/** + * Speak annotation. + * @param {!cvoxAce.Annotation} annot Annotation to speak. + */ var speakAnnot = function(annot) { var annotText = annot.type + ' ' + annot.text + ' on ' + rowColToString(annot.row, annot.column); annotText = annotText.replace(';', 'semicolon'); cvox.Api.speak(annotText, 1); }; + +/** + * Speak annotations in a row. + * @param {number} row Row of annotations to speak. + */ var speakAnnotsByRow = function(row) { var annots = annotTable[row]; for (var col in annots) { speakAnnot(annots[col]); } }; + +/** + * Get a string representation of a row and column. + * @param {boolean} row Zero indexed row. + * @param {boolean} col Zero indexed column. + * @return {string} Row and column to be spoken. + */ var rowColToString = function(row, col) { return 'row ' + (row + 1) + ' column ' + (col + 1); }; + +/** + * Speaks the row and column. + */ var speakCurrRowAndCol = function() { cvox.Api.speak(rowColToString(lastCursor.row, lastCursor.column)); }; + +/** + * Speaks all annotations. + */ var speakAllAnnots = function() { for (var row in annotTable) { speakAnnotsByRow(row); } }; + +/** + * Speak the vim mode. If no vim mode, this function does nothing. + */ var speakMode = function() { if (!isVimMode()) { return; @@ -361,22 +700,38 @@ var speakMode = function() { break; } }; + +/** + * Toggle speak location. + */ var toggleSpeakRowLocation = function() { shouldSpeakRowLocation = !shouldSpeakRowLocation; + /* Auditory feedback of the change. */ if (shouldSpeakRowLocation) { cvox.Api.speak('Speak location on row change enabled.'); } else { cvox.Api.speak('Speak location on row change disabled.'); } }; + +/** + * Toggle speak displacement. + */ var toggleSpeakDisplacement = function() { shouldSpeakDisplacement = !shouldSpeakDisplacement; + /* Auditory feedback of the change. */ if (shouldSpeakDisplacement) { cvox.Api.speak('Speak displacement on column changes.'); } else { cvox.Api.speak('Speak current character or word on column changes.'); } }; + +/** + * Event handler for key down events. Gets the right shortcut from the map, + * and calls the associated function. + * @param {!Event} evt Keyboard event. + */ var onKeyDown = function(evt) { if (evt.ctrlKey && evt.shiftKey) { var shortcut = keyCodeToShortcutMap[evt.keyCode]; @@ -385,34 +740,59 @@ var onKeyDown = function(evt) { } } }; + +/** + * Event handler for status change events. Auditory feedback of changing + * between vim states. + * @param {!Event} evt Change status event. + * @param {!Object} editor Editor state. + */ var onChangeStatus = function(evt, editor) { if (!isVimMode()) { return; } var state = editor.keyBinding.$data.state; if (state === vimState) { + /* State hasn't changed, do nothing. */ return; } switch (state) { case INSERT_MODE_STATE: cvox.Api.playEarcon(MODE_SWITCH_EARCON); + /* When in insert mode, we want to speak out keys as feedback. */ cvox.Api.setKeyEcho(true); break; case COMMAND_MODE_STATE: cvox.Api.playEarcon(MODE_SWITCH_EARCON); + /* When in command mode, we want don't speak out keys because those keys + * are not being inserted in the document. */ cvox.Api.setKeyEcho(false); break; } vimState = state; }; + +/** + * Handles context menu events. This is a ChromeVox feature where hitting + * the shortcut ChromeVox + comma will open up a search bar where you can + * type in various commands. All keyboard shortcuts are also commands that + * can be invoked. This handles the event that ChromeVox sends to the page. + * @param {Event} evt Event received. + */ var contextMenuHandler = function(evt) { var cmd = evt.detail['customCommand']; var shortcut = cmdToShortcutMap[cmd]; if (shortcut) { shortcut.func(); + /* ChromeVox will bring focus to an element near the cursor instead of the + * text input. */ cvoxAce.editor.focus(); } }; + +/** + * Initialize the ChromeVox context menu. + */ var initContextMenu = function() { var ACTIONS = SHORTCUTS.map(function(shortcut) { return { @@ -420,22 +800,44 @@ var initContextMenu = function() { cmd: shortcut.cmd }; }); + + /* Attach ContextMenuActions. */ var body = document.querySelector('body'); body.setAttribute('contextMenuActions', JSON.stringify(ACTIONS)); + + /* Listen for ContextMenu events. */ body.addEventListener('ATCustomEvent', contextMenuHandler, true); }; + +/** + * Event handler for find events. When there is a match, we want to speak the + * line we are now at. Otherwise, we want to notify the user there was no + * match + * @param {!Event} evt The event. + */ var onFindSearchbox = function(evt) { if (evt.match) { + /* There is still a match! Speak the line. */ speakLine(lastCursor.row, 0); } else { + /* No match, give auditory feedback! */ cvox.Api.playEarcon(NO_MATCH_EARCON); } }; + +/** + * Focus to text input. + */ var focus = function() { cvoxAce.editor.focus(); }; + +/** + * Shortcut definitions. + */ var SHORTCUTS = [ { + /* 1 key. */ keyCode: 49, func: function() { speakAnnotsByRow(lastCursor.row); @@ -444,44 +846,56 @@ var SHORTCUTS = [ desc: 'Speak annotations on line' }, { + /* 2 key. */ keyCode: 50, func: speakAllAnnots, cmd: Command.SPEAK_ALL_ANNOTS, desc: 'Speak all annotations' }, { + /* 3 key. */ keyCode: 51, func: speakMode, cmd: Command.SPEAK_MODE, desc: 'Speak Vim mode' }, { + /* 4 key. */ keyCode: 52, func: toggleSpeakRowLocation, cmd: Command.TOGGLE_LOCATION, desc: 'Toggle speak row location' }, { + /* 5 key. */ keyCode: 53, func: speakCurrRowAndCol, cmd: Command.SPEAK_ROW_COL, desc: 'Speak row and column' }, { + /* 6 key. */ keyCode: 54, func: toggleSpeakDisplacement, cmd: Command.TOGGLE_DISPLACEMENT, desc: 'Toggle speak displacement' }, { + /* 7 key. */ keyCode: 55, func: focus, cmd: Command.FOCUS_TEXT, desc: 'Focus text' } ]; + +/** + * Event handler for focus events. + */ var onFocus = function() { cvoxAce.editor = editor; + + /* Set up listeners. */ editor.getSession().selection.on('changeCursor', onCursorChange); editor.getSession().selection.on('changeSelection', onSelectionChange); editor.getSession().on('change', onChange); @@ -492,24 +906,53 @@ var onFocus = function() { lastCursor = editor.selection.getCursor(); }; + +/** + * Initialize the theme. + * @param {Object} editor Editor to use. + */ var init = function(editor) { onFocus(); + + /* Construct maps. */ SHORTCUTS.forEach(function(shortcut) { keyCodeToShortcutMap[shortcut.keyCode] = shortcut; cmdToShortcutMap[shortcut.cmd] = shortcut; }); editor.on('focus', onFocus); + + /* Assume we start in command mode if vim. */ if (isVimMode()) { cvox.Api.setKeyEcho(false); } initContextMenu(); }; + +/** + * Returns if cvox exists, and the api exists. + * @return {boolean} Whether not Cvox Api exists. + */ function cvoxApiExists() { return (typeof(cvox) !== 'undefined') && cvox && cvox.Api; } + +/** + * Number of tries for Cvox loading. + * @type {number} + */ var tries = 0; + +/** + * Max number of tries to watch for Cvox loading. + * @type {number} + */ var MAX_TRIES = 15; + +/** + * Check for ChromeVox load. + * @param {Object} editor Editor to use. + */ function watchForCvoxLoad(editor) { if (cvoxApiExists()) { init(editor); diff --git a/addons/editor/ace/ext-elastic_tabstops_lite.js b/addons/editor/ace/ext/elastic_tabstops_lite.js old mode 100644 new mode 100755 similarity index 93% rename from addons/editor/ace/ext-elastic_tabstops_lite.js rename to addons/editor/ace/ext/elastic_tabstops_lite.js index 75abadab..9901c5df --- a/addons/editor/ace/ext-elastic_tabstops_lite.js +++ b/addons/editor/ace/ext/elastic_tabstops_lite.js @@ -28,8 +28,8 @@ * * ***** END LICENSE BLOCK ***** */ -define('ace/ext/elastic_tabstops_lite', ['require', 'exports', 'module' , 'ace/editor', 'ace/config'], function(require, exports, module) { - +define(function(require, exports, module) { +"use strict"; var ElasticTabstopsLite = function(editor) { this.$editor = editor; @@ -82,6 +82,8 @@ var ElasticTabstopsLite = function(editor) { this.$findCellWidthsForBlock = function(row) { var cellWidths = [], widths; + + // starting row and backward var rowIter = row; while (rowIter >= 0) { widths = this.$cellWidthsForRow(rowIter); @@ -92,6 +94,8 @@ var ElasticTabstopsLite = function(editor) { rowIter--; } var firstRow = rowIter + 1; + + // forward (not including starting row) rowIter = row; var numRows = this.$editor.session.getLength(); @@ -110,6 +114,7 @@ var ElasticTabstopsLite = function(editor) { this.$cellWidthsForRow = function(row) { var selectionColumns = this.$selectionColumnsForRow(row); + // todo: support multicursor var tabs = [-1].concat(this.$tabsForRow(row)); var widths = tabs.map(function(el) { return 0; } ).slice(1); @@ -130,6 +135,7 @@ var ElasticTabstopsLite = function(editor) { this.$selectionColumnsForRow = function(row) { var selections = [], cursor = this.$editor.getCursorPosition(); if (this.$editor.session.getSelection().isEmpty()) { + // todo: support multicursor if (row == cursor.row) selections.push(cursor.column); } @@ -147,6 +153,8 @@ var ElasticTabstopsLite = function(editor) { console.error(column); continue; } + // add an extra None to the end so that the end of the column automatically + // finishes a block column.push(NaN); for (var r = 0, s = column.length; r < s; r++) { @@ -157,6 +165,7 @@ var ElasticTabstopsLite = function(editor) { startingNewBlock = false; } if (isNaN(width)) { + // block ended blockEndRow = r; for (var j = blockStartRow; j < blockEndRow; j++) { @@ -207,6 +216,8 @@ var ElasticTabstopsLite = function(editor) { return; var bias = 0, location = -1; + + // this always only contains two elements, so we're safe in the loop below var expandedSet = this.$izip(widths, rowTabs); for (var i = 0, l = expandedSet.length; i < l; i++) { @@ -223,6 +234,8 @@ var ElasticTabstopsLite = function(editor) { var ispaces = partialLine.length - strippedPartialLine.length; if (difference > 0) { + // put the spaces after the tab and then delete the tab, so any insertion + // points behave as expected this.$editor.session.getDocument().insertInLine({row: row, column: it + 1}, Array(difference + 1).join(" ") + "\t"); this.$editor.session.getDocument().removeInLine(row, it, it + 1); @@ -235,6 +248,8 @@ var ElasticTabstopsLite = function(editor) { } } }; + + // the is a (naive) Python port--but works for these purposes this.$izip_longest = function(iterables) { if (!iterables[0]) return []; @@ -264,7 +279,10 @@ var ElasticTabstopsLite = function(editor) { return expandedSet; }; + + // an even more (naive) Python port this.$izip = function(widths, tabs) { + // grab the shorter size var size = widths.length >= tabs.length ? tabs.length : widths.length; var expandedSet = []; diff --git a/addons/editor/ace/ext/emmet.js b/addons/editor/ace/ext/emmet.js new file mode 100755 index 00000000..6647da40 --- /dev/null +++ b/addons/editor/ace/ext/emmet.js @@ -0,0 +1,415 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; +var HashHandler = require("ace/keyboard/hash_handler").HashHandler; +var Editor = require("ace/editor").Editor; +var snippetManager = require("ace/snippets").snippetManager; +var Range = require("ace/range").Range; +var emmet; + +Editor.prototype.indexToPosition = function(index) { + return this.session.doc.indexToPosition(index); +}; + +Editor.prototype.positionToIndex = function(pos) { + return this.session.doc.positionToIndex(pos); +}; + +/** + * Implementation of {@link IEmmetEditor} interface for Ace + */ +function AceEmmetEditor() {} + +AceEmmetEditor.prototype = { + setupContext: function(editor) { + this.ace = editor; + this.indentation = editor.session.getTabString(); + if (!emmet) + emmet = window.emmet; + emmet.require("resources").setVariable("indentation", this.indentation); + this.$syntax = null; + this.$syntax = this.getSyntax(); + }, + /** + * Returns character indexes of selected text: object with start + * and end properties. If there's no selection, should return + * object with start and end properties referring + * to current caret position + * @return {Object} + * @example + * var selection = editor.getSelectionRange(); + * alert(selection.start + ', ' + selection.end); + */ + getSelectionRange: function() { + // TODO should start be caret position instead? + var range = this.ace.getSelectionRange(); + return { + start: this.ace.positionToIndex(range.start), + end: this.ace.positionToIndex(range.end) + }; + }, + + /** + * Creates selection from start to end character + * indexes. If end is ommited, this method should place caret + * and start index + * @param {Number} start + * @param {Number} [end] + * @example + * editor.createSelection(10, 40); + * + * //move caret to 15th character + * editor.createSelection(15); + */ + createSelection: function(start, end) { + this.ace.selection.setRange({ + start: this.ace.indexToPosition(start), + end: this.ace.indexToPosition(end) + }); + }, + + /** + * Returns current line's start and end indexes as object with start + * and end properties + * @return {Object} + * @example + * var range = editor.getCurrentLineRange(); + * alert(range.start + ', ' + range.end); + */ + getCurrentLineRange: function() { + var row = this.ace.getCursorPosition().row; + var lineLength = this.ace.session.getLine(row).length; + var index = this.ace.positionToIndex({row: row, column: 0}); + return { + start: index, + end: index + lineLength + }; + }, + + /** + * Returns current caret position + * @return {Number|null} + */ + getCaretPos: function(){ + var pos = this.ace.getCursorPosition(); + return this.ace.positionToIndex(pos); + }, + + /** + * Set new caret position + * @param {Number} index Caret position + */ + setCaretPos: function(index){ + var pos = this.ace.indexToPosition(index); + this.ace.clearSelection(); + this.ace.selection.moveCursorToPosition(pos); + }, + + /** + * Returns content of current line + * @return {String} + */ + getCurrentLine: function() { + var row = this.ace.getCursorPosition().row; + return this.ace.session.getLine(row); + }, + + /** + * Replace editor's content or it's part (from start to + * end index). If value contains + * caret_placeholder, the editor will put caret into + * this position. If you skip start and end + * arguments, the whole target's content will be replaced with + * value. + * + * If you pass start argument only, + * the value will be placed at start string + * index of current content. + * + * If you pass start and end arguments, + * the corresponding substring of current target's content will be + * replaced with value. + * @param {String} value Content you want to paste + * @param {Number} [start] Start index of editor's content + * @param {Number} [end] End index of editor's content + * @param {Boolean} [noIndent] Do not auto indent value + */ + replaceContent: function(value, start, end, noIndent) { + if (end == null) + end = start == null ? this.getContent().length : start; + if (start == null) + start = 0; + + var editor = this.ace; + var range = Range.fromPoints(editor.indexToPosition(start), editor.indexToPosition(end)); + editor.session.remove(range); + + range.end = range.start; + //editor.selection.setRange(range); + + value = this.$updateTabstops(value); + snippetManager.insertSnippet(editor, value) + }, + + /** + * Returns editor's content + * @return {String} + */ + getContent: function(){ + return this.ace.getValue(); + }, + + /** + * Returns current editor's syntax mode + * @return {String} + */ + getSyntax: function() { + if (this.$syntax) + return this.$syntax; + var syntax = this.ace.session.$modeId.split("/").pop(); + if (syntax == "html" || syntax == "php") { + var cursor = this.ace.getCursorPosition(); + var state = this.ace.session.getState(cursor.row); + if (typeof state != "string") + state = state[0]; + if (state) { + state = state.split("-"); + if (state.length > 1) + syntax = state[0]; + else if (syntax == "php") + syntax = "html"; + } + } + return syntax; + }, + + /** + * Returns current output profile name (@see emmet#setupProfile) + * @return {String} + */ + getProfileName: function() { + switch(this.getSyntax()) { + case "css": return "css"; + case "xml": + case "xsl": + return "xml"; + case "html": + var profile = emmet.require("resources").getVariable("profile"); + // no forced profile, guess from content html or xhtml? + if (!profile) + profile = this.ace.session.getLines(0,2).join("").search(/]+XHTML/i) != -1 ? "xhtml": "html"; + return profile; + } + return "xhtml"; + }, + + /** + * Ask user to enter something + * @param {String} title Dialog title + * @return {String} Entered data + * @since 0.65 + */ + prompt: function(title) { + return prompt(title); + }, + + /** + * Returns current selection + * @return {String} + * @since 0.65 + */ + getSelection: function() { + return this.ace.session.getTextRange(); + }, + + /** + * Returns current editor's file path + * @return {String} + * @since 0.65 + */ + getFilePath: function() { + return ""; + }, + + // update tabstops: make sure all caret placeholders are unique + // by default, abbreviation parser generates all unlinked (un-mirrored) + // tabstops as ${0}, so we have upgrade all caret tabstops with unique + // positions but make sure that all other tabstops are not linked accidentally + // based on https://github.com/sergeche/emmet-sublime/blob/master/editor.js#L119-L171 + $updateTabstops: function(value) { + var base = 1000; + var zeroBase = 0; + var lastZero = null; + var range = emmet.require('range'); + var ts = emmet.require('tabStops'); + var settings = emmet.require('resources').getVocabulary("user"); + var tabstopOptions = { + tabstop: function(data) { + var group = parseInt(data.group, 10); + var isZero = group === 0; + if (isZero) + group = ++zeroBase; + else + group += base; + + var placeholder = data.placeholder; + if (placeholder) { + // recursively update nested tabstops + placeholder = ts.processText(placeholder, tabstopOptions); + } + + var result = '${' + group + (placeholder ? ':' + placeholder : '') + '}'; + + if (isZero) { + lastZero = range.create(data.start, result); + } + + return result + }, + escape: function(ch) { + if (ch == '$') return '\\$'; + if (ch == '\\') return '\\\\'; + return ch; + } + }; + + value = ts.processText(value, tabstopOptions); + + if (settings.variables['insert_final_tabstop'] && !/\$\{0\}$/.test(value)) { + value += '${0}'; + } else if (lastZero) { + value = emmet.require('utils').replaceSubstring(value, '${0}', lastZero); + } + + return value; + } +}; + + +var keymap = { + expand_abbreviation: {"mac": "ctrl+alt+e", "win": "alt+e"}, + match_pair_outward: {"mac": "ctrl+d", "win": "ctrl+,"}, + match_pair_inward: {"mac": "ctrl+j", "win": "ctrl+shift+0"}, + matching_pair: {"mac": "ctrl+alt+j", "win": "alt+j"}, + next_edit_point: "alt+right", + prev_edit_point: "alt+left", + toggle_comment: {"mac": "command+/", "win": "ctrl+/"}, + split_join_tag: {"mac": "shift+command+'", "win": "shift+ctrl+`"}, + remove_tag: {"mac": "command+'", "win": "shift+ctrl+;"}, + evaluate_math_expression: {"mac": "shift+command+y", "win": "shift+ctrl+y"}, + increment_number_by_1: "ctrl+up", + decrement_number_by_1: "ctrl+down", + increment_number_by_01: "alt+up", + decrement_number_by_01: "alt+down", + increment_number_by_10: {"mac": "alt+command+up", "win": "shift+alt+up"}, + decrement_number_by_10: {"mac": "alt+command+down", "win": "shift+alt+down"}, + select_next_item: {"mac": "shift+command+.", "win": "shift+ctrl+."}, + select_previous_item: {"mac": "shift+command+,", "win": "shift+ctrl+,"}, + reflect_css_value: {"mac": "shift+command+r", "win": "shift+ctrl+r"}, + + encode_decode_data_url: {"mac": "shift+ctrl+d", "win": "ctrl+'"}, + // update_image_size: {"mac": "shift+ctrl+i", "win": "ctrl+u"}, + // expand_as_you_type: "ctrl+alt+enter", + // wrap_as_you_type: {"mac": "shift+ctrl+g", "win": "shift+ctrl+g"}, + expand_abbreviation_with_tab: "Tab", + wrap_with_abbreviation: {"mac": "shift+ctrl+a", "win": "shift+ctrl+a"} +}; + +var editorProxy = new AceEmmetEditor(); +exports.commands = new HashHandler(); +exports.runEmmetCommand = function(editor) { + editorProxy.setupContext(editor); + if (editorProxy.getSyntax() == "php") + return false; + var actions = emmet.require("actions"); + + if (this.action == "expand_abbreviation_with_tab") { + if (!editor.selection.isEmpty()) + return false; + } + + if (this.action == "wrap_with_abbreviation") { + // without setTimeout prompt doesn't work on firefox + return setTimeout(function() { + actions.run("wrap_with_abbreviation", editorProxy); + }, 0); + } + + try { + var result = actions.run(this.action, editorProxy); + } catch(e) { + editor._signal("changeStatus", typeof e == "string" ? e : e.message); + console.log(e); + } + return result; +}; + +for (var command in keymap) { + exports.commands.addCommand({ + name: "emmet:" + command, + action: command, + bindKey: keymap[command], + exec: exports.runEmmetCommand, + multiSelectAction: "forEach" + }); +} + +var onChangeMode = function(e, target) { + var editor = target; + if (!editor) + return; + var modeId = editor.session.$modeId; + var enabled = modeId && /css|less|scss|sass|stylus|html|php/.test(modeId); + if (e.enableEmmet === false) + enabled = false; + if (enabled) + editor.keyBinding.addKeyboardHandler(exports.commands); + else + editor.keyBinding.removeKeyboardHandler(exports.commands); +}; + + +exports.AceEmmetEditor = AceEmmetEditor; +require("ace/config").defineOptions(Editor.prototype, "editor", { + enableEmmet: { + set: function(val) { + this[val ? "on" : "removeListener"]("changeMode", onChangeMode); + onChangeMode({enableEmmet: !!val}, this); + }, + value: true + } +}); + + +exports.setCore = function(e) {emmet = e;}; +}); + diff --git a/addons/editor/ace/ext/keybinding_menu.js b/addons/editor/ace/ext/keybinding_menu.js new file mode 100755 index 00000000..bf8189a5 --- /dev/null +++ b/addons/editor/ace/ext/keybinding_menu.js @@ -0,0 +1,86 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl + * All rights reserved. + * + * Contributed to Ajax.org under the BSD license. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +/*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/ +/*global define, require */ + +/** + * Show Keyboard Shortcuts + * @fileOverview Show Keyboard Shortcuts
+ * Generates a menu which displays the keyboard shortcuts. + * @author + * Matthew Christopher Kastor-Inare III
+ * ☭ Hial Atropa!! ☭ + */ + +define(function(require, exports, module) { + "use strict"; + var Editor = require("ace/editor").Editor; + /** + * Generates a menu which displays the keyboard shortcuts. + * @author + * Matthew Christopher Kastor-Inare III
+ * ☭ Hial Atropa!! ☭ + * @param {ace.Editor} editor An instance of the ace editor. + */ + function showKeyboardShortcuts (editor) { + // make sure the menu isn't open already. + if(!document.getElementById('kbshortcutmenu')) { + var overlayPage = require('./menu_tools/overlay_page').overlayPage; + var getEditorKeybordShortcuts = require('./menu_tools/get_editor_keyboard_shortcuts').getEditorKeybordShortcuts; + var kb = getEditorKeybordShortcuts(editor); + var el = document.createElement('div'); + var commands = kb.reduce(function(previous, current) { + return previous + '
' + + current.command + ' : ' + + '' + current.key + '
'; + }, ''); + + el.id = 'kbshortcutmenu'; + el.innerHTML = '

Keyboard Shortcuts

' + commands + ''; + overlayPage(editor, el, '0', '0', '0', null); + } + }; + module.exports.init = function(editor) { + Editor.prototype.showKeyboardShortcuts = function() { + showKeyboardShortcuts(this); + }; + editor.commands.addCommands([{ + name: "showKeyboardShortcuts", + bindKey: {win: "Ctrl-Alt-h", mac: "Command-Alt-h"}, + exec: function(editor, line) { + editor.showKeyboardShortcuts(); + } + }]); + }; + +}); \ No newline at end of file diff --git a/addons/editor/ace/ext/language_tools.js b/addons/editor/ace/ext/language_tools.js new file mode 100755 index 00000000..e5cd8bb4 --- /dev/null +++ b/addons/editor/ace/ext/language_tools.js @@ -0,0 +1,129 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2012, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var snippetManager = require("../snippets").snippetManager; +var Autocomplete = require("../autocomplete").Autocomplete; +var config = require("../config"); + +var textCompleter = require("../autocomplete/text_completer"); +var keyWordCompleter = { + getCompletions: function(editor, session, pos, prefix, callback) { + var state = editor.session.getState(pos.row); + var completions = session.$mode.getCompletions(state, session, pos, prefix); + callback(null, completions); + } +}; + +var snippetCompleter = { + getCompletions: function(editor, session, pos, prefix, callback) { + var scope = snippetManager.$getScope(editor); + var snippetMap = snippetManager.snippetMap; + var completions = []; + [scope, "_"].forEach(function(scope) { + var snippets = snippetMap[scope] || []; + for (var i = snippets.length; i--;) { + var s = snippets[i]; + var caption = s.name || s.tabTrigger; + if (!caption) + continue; + completions.push({ + caption: caption, + snippet: s.content, + meta: s.tabTrigger && !s.name ? s.tabTrigger + "\u21E5 " : "snippet" + }); + } + }, this); + callback(null, completions); + } +}; + +var completers = [snippetCompleter, textCompleter, keyWordCompleter]; +exports.addCompleter = function(completer) { + completers.push(completer); +}; + +var expandSnippet = { + name: "expandSnippet", + exec: function(editor) { + var success = snippetManager.expandWithTab(editor); + if (!success) + editor.execCommand("indent"); + }, + bindKey: "tab" +} + +var onChangeMode = function(e, editor) { + var mode = editor.session.$mode; + var id = mode.$id + if (!snippetManager.files) snippetManager.files = {}; + if (id && !snippetManager.files[id]) { + var snippetFilePath = id.replace("mode", "snippets"); + config.loadModule(snippetFilePath, function(m) { + if (m) { + snippetManager.files[id] = m; + m.snippets = snippetManager.parseSnippetFile(m.snippetText); + snippetManager.register(m.snippets, m.scope); + } + }); + } +}; + +var Editor = require("../editor").Editor; +require("../config").defineOptions(Editor.prototype, "editor", { + enableBasicAutocompletion: { + set: function(val) { + if (val) { + this.completers = completers + this.commands.addCommand(Autocomplete.startCommand); + } else { + this.commands.removeCommand(Autocomplete.startCommand); + } + }, + value: false + }, + enableSnippets: { + set: function(val) { + if (val) { + this.commands.addCommand(expandSnippet); + this.on("changeMode", onChangeMode); + onChangeMode(null, this) + } else { + this.commands.removeCommand(expandSnippet); + this.off("changeMode", onChangeMode); + } + }, + value: false + } +}); + +}); \ No newline at end of file diff --git a/addons/editor/ace/ext/menu_tools/add_editor_menu_options.js b/addons/editor/ace/ext/menu_tools/add_editor_menu_options.js new file mode 100755 index 00000000..fd56859b --- /dev/null +++ b/addons/editor/ace/ext/menu_tools/add_editor_menu_options.js @@ -0,0 +1,103 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl + * All rights reserved. + * + * Contributed to Ajax.org under the BSD license. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +/*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/ +/*global define, require */ + +/** + * Add Editor Menu Options + * @fileOverview Add Editor Menu Options
+ * The menu options property needs to be added to the editor + * so that the settings menu can know about options for + * selection elements and track which option is selected. + * @author + * Matthew Christopher Kastor-Inare III
+ * ☭ Hial Atropa!! ☭ + */ + +define(function(require, exports, module) { +'use strict'; + +/** + * The menu options property needs to be added to the editor + * so that the settings menu can know about options for + * selection elements and track which option is selected. + * @author + * Matthew Christopher Kastor-Inare III
+ * ☭ Hial Atropa!! ☭ + * @param {ace.Editor} editor An instance of the ace editor. + */ +module.exports.addEditorMenuOptions = function addEditorMenuOptions (editor) { + var modelist = require('../modelist'); + var themelist = require('../themelist'); + editor.menuOptions = { + "setNewLineMode" : [{ + "textContent" : "unix", + "value" : "unix" + }, { + "textContent" : "windows", + "value" : "windows" + }, { + "textContent" : "auto", + "value" : "auto" + }], + "setTheme" : [], + "setMode" : [], + "setKeyboardHandler": [{ + "textContent" : "ace", + "value" : "" + }, { + "textContent" : "vim", + "value" : "ace/keyboard/vim" + }, { + "textContent" : "emacs", + "value" : "ace/keyboard/emacs" + }] + }; + + editor.menuOptions.setTheme = themelist.themes.map(function(theme) { + return { + 'textContent' : theme.desc, + 'value' : theme.theme + }; + }); + + editor.menuOptions.setMode = modelist.modes.map(function(mode) { + return { + 'textContent' : mode.name, + 'value' : mode.mode + }; + }); +}; + + +}); \ No newline at end of file diff --git a/addons/editor/ace/ext/menu_tools/element_generator.js b/addons/editor/ace/ext/menu_tools/element_generator.js new file mode 100755 index 00000000..ec6ba93b --- /dev/null +++ b/addons/editor/ace/ext/menu_tools/element_generator.js @@ -0,0 +1,148 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl + * All rights reserved. + * + * Contributed to Ajax.org under the BSD license. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +/*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/ +/*global define, require */ + +/** + * Element Generator + * @fileOverview Element Generator
+ * Contains methods for generating elements. + * @author + * Matthew Christopher Kastor-Inare III
+ * ☭ Hial Atropa!! ☭ + */ + +define(function(require, exports, module) { +'use strict'; +/** + * Creates a DOM option element + * @author + * Matthew Christopher Kastor-Inare III
+ * ☭ Hial Atropa!! ☭ + * @param {object} obj An object containing properties to add to the dom + * element. If one of those properties is named `selected` then it will be + * added as an attribute on the element instead. + */ +module.exports.createOption = function createOption (obj) { + var attribute; + var el = document.createElement('option'); + for(attribute in obj) { + if(obj.hasOwnProperty(attribute)) { + if(attribute === 'selected') { + el.setAttribute(attribute, obj[attribute]); + } else { + el[attribute] = obj[attribute]; + } + } + } + return el; +}; +/** + * Creates a DOM checkbox element. + * @author + * Matthew Christopher Kastor-Inare III
+ * ☭ Hial Atropa!! ☭ + * @param {string} id The id of the element. + * @param {boolean} checked Whether or not the element is checked. + * @param {string} clss The class of the element. + * @returns {DOMElement} Returns a checkbox element reference. + */ +module.exports.createCheckbox = function createCheckbox (id, checked, clss) { + var el = document.createElement('input'); + el.setAttribute('type', 'checkbox'); + el.setAttribute('id', id); + el.setAttribute('name', id); + el.setAttribute('value', checked); + el.setAttribute('class', clss); + if(checked) { + el.setAttribute('checked', 'checked'); + } + return el; +}; +/** + * Creates a DOM text input element. + * @author + * Matthew Christopher Kastor-Inare III
+ * ☭ Hial Atropa!! ☭ + * @param {string} id The id of the element. + * @param {string} value The default value of the input element. + * @param {string} clss The class of the element. + * @returns {DOMElement} Returns an input element reference. + */ +module.exports.createInput = function createInput (id, value, clss) { + var el = document.createElement('input'); + el.setAttribute('type', 'text'); + el.setAttribute('id', id); + el.setAttribute('name', id); + el.setAttribute('value', value); + el.setAttribute('class', clss); + return el; +}; +/** + * Creates a DOM label element. + * @author + * Matthew Christopher Kastor-Inare III
+ * ☭ Hial Atropa!! ☭ + * @param {string} text The label text. + * @param {string} labelFor The id of the element being labeled. + * @returns {DOMElement} Returns a label element reference. + */ +module.exports.createLabel = function createLabel (text, labelFor) { + var el = document.createElement('label'); + el.setAttribute('for', labelFor); + el.textContent = text; + return el; +}; +/** + * Creates a DOM selection element. + * @author + * Matthew Christopher Kastor-Inare III
+ * ☭ Hial Atropa!! ☭ + * @param {string} id The id of the element. + * @param {string} values An array of objects suitable for `createOption` + * @param {string} clss The class of the element. + * @returns {DOMElement} Returns a selection element reference. + * @see ace/ext/element_generator.createOption + */ +module.exports.createSelection = function createSelection (id, values, clss) { + var el = document.createElement('select'); + el.setAttribute('id', id); + el.setAttribute('name', id); + el.setAttribute('class', clss); + values.forEach(function(item) { + el.appendChild(module.exports.createOption(item)); + }); + return el; +}; + +}); \ No newline at end of file diff --git a/addons/editor/ace/ext/menu_tools/generate_settings_menu.js b/addons/editor/ace/ext/menu_tools/generate_settings_menu.js new file mode 100755 index 00000000..16d3a76c --- /dev/null +++ b/addons/editor/ace/ext/menu_tools/generate_settings_menu.js @@ -0,0 +1,258 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl + * All rights reserved. + * + * Contributed to Ajax.org under the BSD license. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +/*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/ +/*global define*/ + +/** + * Generates the settings menu + * @fileOverview Generates the settings menu. + * @author + * Matthew Christopher Kastor-Inare III
+ * ☭ Hial Atropa!! ☭ + */ + +define(function(require, exports, module) { +'use strict'; +var egen = require('./element_generator'); +var addEditorMenuOptions = require('./add_editor_menu_options').addEditorMenuOptions; +var getSetFunctions = require('./get_set_functions').getSetFunctions; + +/** + * Generates an interactive menu with settings useful to end users. + * @author + * Matthew Christopher Kastor-Inare III
+ * ☭ Hial Atropa!! ☭ + * @param {ace.Editor} editor An instance of the ace editor. + */ +module.exports.generateSettingsMenu = function generateSettingsMenu (editor) { + /** + * container for dom elements that will go in the menu. + * @author + * Matthew Christopher Kastor-Inare III
+ * ☭ Hial Atropa!! ☭ + */ + var elements = []; + /** + * Sorts the menu entries (elements var) so they'll appear in alphabetical order + * the sort is performed based on the value of the contains property + * of each element. Since this is an `array.sort` the array is sorted + * in place. + * @author + * Matthew Christopher Kastor-Inare III
+ * ☭ Hial Atropa!! ☭ + */ + function cleanupElementsList() { + elements.sort(function(a, b) { + var x = a.getAttribute('contains'); + var y = b.getAttribute('contains'); + return x.localeCompare(y); + }); + } + /** + * Wraps all dom elements contained in the elements var with a single + * div. + * @author + * Matthew Christopher Kastor-Inare III
+ * ☭ Hial Atropa!! ☭ + */ + function wrapElements() { + var topmenu = document.createElement('div'); + topmenu.setAttribute('id', 'ace_settingsmenu'); + elements.forEach(function(element) { + topmenu.appendChild(element); + }); + return topmenu; + } + /** + * Creates a new menu entry. + * @author + * Matthew Christopher Kastor-Inare III
+ * ☭ Hial Atropa!! ☭ + * @param {object} obj This is a reference to the object containing the + * set function. It is used to set up event listeners for when the + * menu options change. + * @param {string} clss Maps to the class of the dom element. This is + * the name of the object containing the set function e.g. `editor`, + * `session`, `renderer`. + * @param {string} item This is the set function name. It maps to the + * id of the dom element (check, select, input) and to the "contains" + * attribute of the div holding both the element and its label. + * @param {mixed} val This is the value of the setting. It is mapped to + * the dom element's value, checked, or selected option accordingly. + */ + function createNewEntry(obj, clss, item, val) { + var el; + var div = document.createElement('div'); + div.setAttribute('contains', item); + div.setAttribute('class', 'ace_optionsMenuEntry'); + div.setAttribute('style', 'clear: both;'); + + div.appendChild(egen.createLabel( + item.replace(/^set/, '').replace(/([A-Z])/g, ' $1').trim(), + item + )); + + if (Array.isArray(val)) { + el = egen.createSelection(item, val, clss); + el.addEventListener('change', function(e) { + try{ + editor.menuOptions[e.target.id].forEach(function(x) { + if(x.textContent !== e.target.textContent) { + delete x.selected; + } + }); + obj[e.target.id](e.target.value); + } catch (err) { + throw new Error(err); + } + }); + } else if(typeof val === 'boolean') { + el = egen.createCheckbox(item, val, clss); + el.addEventListener('change', function(e) { + try{ + // renderer['setHighlightGutterLine'](true); + obj[e.target.id](!!e.target.checked); + } catch (err) { + throw new Error(err); + } + }); + } else { + // this aids in giving the ability to specify settings through + // post and get requests. + // /ace_editor.html?setMode=ace/mode/html&setOverwrite=true + el = egen.createInput(item, val, clss); + el.addEventListener('change', function(e) { + try{ + if(e.target.value === 'true') { + obj[e.target.id](true); + } else if(e.target.value === 'false') { + obj[e.target.id](false); + } else { + obj[e.target.id](e.target.value); + } + } catch (err) { + throw new Error(err); + } + }); + } + el.style.cssText = 'float:right;'; + div.appendChild(el); + return div; + } + /** + * Generates selection fields for the menu and populates their options + * using information from `editor.menuOptions` + * @author + * Matthew Christopher Kastor-Inare III
+ * ☭ Hial Atropa!! ☭ + * @param {string} item The set function name. + * @param {object} esr A reference to the object having the set function. + * @param {string} clss The name of the object containing the set function. + * @param {string} fn The matching get function's function name. + * @returns {DOMElement} Returns a dom element containing a selection + * element populated with options. The option whose value matches that + * returned from `esr[fn]()` will be selected. + */ + function makeDropdown(item, esr, clss, fn) { + var val = editor.menuOptions[item]; + var currentVal = esr[fn](); + if (typeof currentVal == 'object') + currentVal = currentVal.$id; + val.forEach(function(valuex) { + if (valuex.value === currentVal) + valuex.selected = 'selected'; + }); + return createNewEntry(esr, clss, item, val); + } + /** + * Processes the set functions returned from `getSetFunctions`. First it + * checks for menu options defined in `editor.menuOptions`. If no + * options are specified then it checks whether there is a get function + * (replace set with get) for the setting. When either of those + * conditions are met it will attempt to create a new entry for the + * settings menu and push it into the elements array defined above. + * It can only do so for get functions which return + * strings, numbers, and booleans. A special case is written in for + * `getMode` where it looks at the returned objects `$id` property and + * forwards that through instead. Other special cases could be written + * in but that would get a bit ridiculous. + * @author + * Matthew Christopher Kastor-Inare III
+ * ☭ Hial Atropa!! ☭ + * @param {object} setObj An item from the array returned by + * `getSetFunctions`. + */ + function handleSet(setObj) { + var item = setObj.functionName; + var esr = setObj.parentObj; + var clss = setObj.parentName; + var val; + var fn = item.replace(/^set/, 'get'); + if(editor.menuOptions[item] !== undefined) { + // has options for select element + elements.push(makeDropdown(item, esr, clss, fn)); + } else if(typeof esr[fn] === 'function') { + // has get function + try { + val = esr[fn](); + if(typeof val === 'object') { + // setMode takes a string, getMode returns an object + // the $id property of that object is the string + // which may be given to setMode... + val = val.$id; + } + // the rest of the get functions return strings, + // booleans, or numbers. + elements.push( + createNewEntry(esr, clss, item, val) + ); + } catch (e) { + // if there are errors it is because the element + // does not belong in the settings menu + } + } + } + addEditorMenuOptions(editor); + // gather the set functions + getSetFunctions(editor).forEach(function(setObj) { + // populate the elements array with good stuff. + handleSet(setObj); + }); + // sort the menu entries in the elements list so people can find + // the settings in alphabetical order. + cleanupElementsList(); + // dump the entries from the elements list and wrap them up in a div + return wrapElements(); +}; + +}); \ No newline at end of file diff --git a/addons/editor/ace/ext/menu_tools/get_editor_keyboard_shortcuts.js b/addons/editor/ace/ext/menu_tools/get_editor_keyboard_shortcuts.js new file mode 100755 index 00000000..e412bfba --- /dev/null +++ b/addons/editor/ace/ext/menu_tools/get_editor_keyboard_shortcuts.js @@ -0,0 +1,100 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl + * All rights reserved. + * + * Contributed to Ajax.org under the BSD license. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +/*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/ +/*global define, require */ + +/** + * Get Editor Keyboard Shortcuts + * @fileOverview Get Editor Keyboard Shortcuts
+ * Gets a map of keyboard shortcuts to command names for the current platform. + * @author + * Matthew Christopher Kastor-Inare III
+ * ☭ Hial Atropa!! ☭ + */ + +define(function(require, exports, module) { +"use strict"; +var keys = require("../../lib/keys"); + +/** + * Gets a map of keyboard shortcuts to command names for the current platform. + * @author + * Matthew Christopher Kastor-Inare III
+ * ☭ Hial Atropa!! ☭ + * @param {ace.Editor} editor An editor instance. + * @returns {Array} Returns an array of objects representing the keyboard + * shortcuts for the given editor. + * @example + * var getKbShortcuts = require('./get_keyboard_shortcuts'); + * console.log(getKbShortcuts(editor)); + * // [ + * // {'command' : aCommand, 'key' : 'Control-d'}, + * // {'command' : aCommand, 'key' : 'Control-d'} + * // ] + */ +module.exports.getEditorKeybordShortcuts = function(editor) { + var KEY_MODS = keys.KEY_MODS; + var keybindings = []; + var commandMap = {}; + editor.keyBinding.$handlers.forEach(function(handler) { + var ckb = handler.commandKeyBinding; + for (var i in ckb) { + var modifier = parseInt(i); + if (modifier == -1) { + modifier = ""; + } else if(isNaN(modifier)) { + modifier = i; + } else { + modifier = "" + + (modifier & KEY_MODS.command ? "Cmd-" : "") + + (modifier & KEY_MODS.ctrl ? "Ctrl-" : "") + + (modifier & KEY_MODS.alt ? "Alt-" : "") + + (modifier & KEY_MODS.shift ? "Shift-" : ""); + } + for (var key in ckb[i]) { + var command = ckb[i][key] + if (typeof command != "string") + command = command.name + if (commandMap[command]) { + commandMap[command].key += "|" + modifier + key; + } else { + commandMap[command] = {key: modifier+key, command: command}; + keybindings.push(commandMap[command]); + } + } + } + }); + return keybindings; +}; + +}); \ No newline at end of file diff --git a/addons/editor/ace/ext/menu_tools/get_set_functions.js b/addons/editor/ace/ext/menu_tools/get_set_functions.js new file mode 100755 index 00000000..4cd65508 --- /dev/null +++ b/addons/editor/ace/ext/menu_tools/get_set_functions.js @@ -0,0 +1,141 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl + * All rights reserved. + * + * Contributed to Ajax.org under the BSD license. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +/*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true */ +/*global define*/ + +/** + * Get Set Functions + * @fileOverview Get Set Functions
+ * Gets various functions for setting settings. + * @author + * Matthew Christopher Kastor-Inare III
+ * ☭ Hial Atropa!! ☭ + */ + +define(function(require, exports, module) { +'use strict'; +/** + * Generates a list of set functions for the settings menu. + * @author + * Matthew Christopher Kastor-Inare III
+ * ☭ Hial Atropa!! ☭ + * @param {object} editor The editor instance + * @return {array} Returns an array of objects. Each object contains the + * following properties: functionName, parentObj, and parentName. The + * function name will be the name of a method beginning with the string + * `set` which was found. The parent object will be a reference to the + * object having the method matching the function name. The parent name + * will be a string representing the identifier of the parent object e.g. + * `editor`, `session`, or `renderer`. + */ +module.exports.getSetFunctions = function getSetFunctions (editor) { + /** + * Output array. Will hold the objects described above. + * @author + * Matthew Christopher Kastor-Inare III
+ * ☭ Hial Atropa!! ☭ + */ + var out = []; + /** + * This object provides a map between the objects which will be + * traversed and the parent name which will appear in the output. + * @author + * Matthew Christopher Kastor-Inare III
+ * ☭ Hial Atropa!! ☭ + */ + var my = { + 'editor' : editor, + 'session' : editor.session, + 'renderer' : editor.renderer + }; + /** + * This array will hold the set function names which have already been + * found so that they are not added to the output multiple times. + * @author + * Matthew Christopher Kastor-Inare III
+ * ☭ Hial Atropa!! ☭ + */ + var opts = []; + /** + * This is a list of set functions which will not appear in the settings + * menu. I don't know what to do with setKeyboardHandler. When I tried + * to use it, it didn't appear to be working. Someone who knows better + * could remove it from this list and add it's options to + * add_editor_menu_options.js + * @author + * Matthew Christopher Kastor-Inare III
+ * ☭ Hial Atropa!! ☭ + */ + var skip = [ + 'setOption', + 'setUndoManager', + 'setDocument', + 'setValue', + 'setBreakpoints', + 'setScrollTop', + 'setScrollLeft', + 'setSelectionStyle', + 'setWrapLimitRange' + ]; + + + /** + * This will search the objects mapped to the `my` variable above. When + * it finds a set function in the object that is not listed in the + * `skip` list or the `opts` list it will push a new object to the + * output array. + * @author + * Matthew Christopher Kastor-Inare III
+ * ☭ Hial Atropa!! ☭ + */ + ['renderer', 'session', 'editor'].forEach(function(esra) { + var esr = my[esra]; + var clss = esra; + for(var fn in esr) { + if(skip.indexOf(fn) === -1) { + if(/^set/.test(fn) && opts.indexOf(fn) === -1) { + // found set function + opts.push(fn); + out.push({ + 'functionName' : fn, + 'parentObj' : esr, + 'parentName' : clss + }); + } + } + } + }); + return out; +}; + +}); \ No newline at end of file diff --git a/addons/editor/ace/ext/menu_tools/overlay_page.js b/addons/editor/ace/ext/menu_tools/overlay_page.js new file mode 100755 index 00000000..bf985e29 --- /dev/null +++ b/addons/editor/ace/ext/menu_tools/overlay_page.js @@ -0,0 +1,116 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl + * All rights reserved. + * + * Contributed to Ajax.org under the BSD license. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +/*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/ +/*global define, require */ + +/** + * Overlay Page + * @fileOverview Overlay Page
+ * Generates an overlay for displaying menus. The overlay is an absolutely + * positioned div. + * @author + * Matthew Christopher Kastor-Inare III
+ * ☭ Hial Atropa!! ☭ + */ + +define(function(require, exports, module) { +'use strict'; +var dom = require("../../lib/dom"); +var cssText = require("../../requirejs/text!./settings_menu.css"); +dom.importCssString(cssText); + +/** + * Generates an overlay for displaying menus. The overlay is an absolutely + * positioned div. + * @author + * Matthew Christopher Kastor-Inare III
+ * ☭ Hial Atropa!! ☭ + * @param {DOMElement} contentElement Any element which may be presented inside + * a div. + * @param {string|number} top absolute position value. + * @param {string|number} right absolute position value. + * @param {string|number} bottom absolute position value. + * @param {string|number} left absolute position value. + */ +module.exports.overlayPage = function overlayPage(editor, contentElement, top, right, bottom, left) { + top = top ? 'top: ' + top + ';' : ''; + bottom = bottom ? 'bottom: ' + bottom + ';' : ''; + right = right ? 'right: ' + right + ';' : ''; + left = left ? 'left: ' + left + ';' : ''; + + var closer = document.createElement('div'); + var contentContainer = document.createElement('div'); + + function documentEscListener(e) { + if (e.keyCode === 27) { + closer.click(); + } + } + + closer.style.cssText = 'margin: 0; padding: 0; ' + + 'position: fixed; top:0; bottom:0; left:0; right:0;' + + 'z-index: 9990; ' + + 'background-color: rgba(0, 0, 0, 0.3);'; + closer.addEventListener('click', function() { + document.removeEventListener('keydown', documentEscListener); + closer.parentNode.removeChild(closer); + editor.focus(); + closer = null; + }); + // click closer if esc key is pressed + document.addEventListener('keydown', documentEscListener); + + contentContainer.style.cssText = top + right + bottom + left; + contentContainer.addEventListener('click', function(e) { + e.stopPropagation(); + }); + + var wrapper = dom.createElement("div"); + wrapper.style.position = "relative"; + + var closeButton = dom.createElement("div"); + closeButton.className = "ace_closeButton"; + closeButton.addEventListener('click', function() { + closer.click(); + }); + + wrapper.appendChild(closeButton); + contentContainer.appendChild(wrapper); + + contentContainer.appendChild(contentElement); + closer.appendChild(contentContainer); + document.body.appendChild(closer); + editor.blur(); +}; + +}); \ No newline at end of file diff --git a/addons/editor/ace/ext/menu_tools/settings_menu.css b/addons/editor/ace/ext/menu_tools/settings_menu.css new file mode 100755 index 00000000..f8b761ce --- /dev/null +++ b/addons/editor/ace/ext/menu_tools/settings_menu.css @@ -0,0 +1,48 @@ +#ace_settingsmenu, #kbshortcutmenu { + background-color: #F7F7F7; + color: black; + box-shadow: -5px 4px 5px rgba(126, 126, 126, 0.55); + padding: 1em 0.5em 2em 1em; + overflow: auto; + position: absolute; + margin: 0; + bottom: 0; + right: 0; + top: 0; + z-index: 9991; + cursor: default; +} + +.ace_dark #ace_settingsmenu, .ace_dark #kbshortcutmenu { + box-shadow: -20px 10px 25px rgba(126, 126, 126, 0.25); + background-color: rgba(255, 255, 255, 0.6); + color: black; +} + +.ace_optionsMenuEntry:hover { + background-color: rgba(100, 100, 100, 0.1); + -webkit-transition: all 0.5s; + transition: all 0.3s +} + +.ace_closeButton { + background: rgba(245, 146, 146, 0.5); + border: 1px solid #F48A8A; + border-radius: 50%; + padding: 7px; + position: absolute; + right: -8px; + top: -8px; + z-index: 1000; +} +.ace_closeButton{ + background: rgba(245, 146, 146, 0.9); +} +.ace_optionsMenuKey { + color: darkslateblue; + font-weight: bold; +} +.ace_optionsMenuCommand { + color: darkcyan; + font-weight: normal; +} \ No newline at end of file diff --git a/addons/editor/ace/ext-modelist.js b/addons/editor/ace/ext/modelist.js old mode 100644 new mode 100755 similarity index 93% rename from addons/editor/ace/ext-modelist.js rename to addons/editor/ace/ext/modelist.js index b3f0cc87..88b0218d --- a/addons/editor/ace/ext-modelist.js +++ b/addons/editor/ace/ext/modelist.js @@ -1,7 +1,13 @@ -define('ace/ext/modelist', ['require', 'exports', 'module' ], function(require, exports, module) { - +define(function(require, exports, module) { +"use strict"; var modes = []; +/** + * Suggests a mode based on the file extension present in the given path + * @param {string} path The path to the file + * @returns {object} Returns an object containing information about the + * suggested mode. + */ function getModeForPath(path) { var mode = modesByName.text; var fileName = path.split(/[\/\\]/).pop(); @@ -33,6 +39,8 @@ var Mode = function(name, caption, extensions) { Mode.prototype.supportsFile = function(filename) { return filename.match(this.extRe); }; + +// todo firstlinematch var supportedModes = { ABAP: ["abap"], ActionScript:["as"], diff --git a/addons/editor/ace/ext/old_ie.js b/addons/editor/ace/ext/old_ie.js new file mode 100755 index 00000000..ca67888f --- /dev/null +++ b/addons/editor/ace/ext/old_ie.js @@ -0,0 +1,108 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; +var MAX_TOKEN_COUNT = 1000; +var useragent = require("../lib/useragent"); +var TokenizerModule = require("../tokenizer"); + +function patch(obj, name, regexp, replacement) { + eval("obj['" + name + "']=" + obj[name].toString().replace( + regexp, replacement + )); +} + +if (useragent.isIE && useragent.isIE < 10 && window.top.document.compatMode === "BackCompat") + useragent.isOldIE = true; + +if (typeof document != "undefined" && !document.documentElement.querySelector) { + useragent.isOldIE = true; + var qs = function(el, selector) { + if (selector.charAt(0) == ".") { + var classNeme = selector.slice(1); + } else { + var m = selector.match(/(\w+)=(\w+)/); + var attr = m && m[1]; + var attrVal = m && m[2]; + } + for (var i = 0; i < el.all.length; i++) { + var ch = el.all[i]; + if (classNeme) { + if (ch.className.indexOf(classNeme) != -1) + return ch; + } else if (attr) { + if (ch.getAttribute(attr) == attrVal) + return ch; + } + } + }; + var sb = require("./searchbox").SearchBox.prototype; + patch( + sb, "$initElements", + /([^\s=]*).querySelector\((".*?")\)/g, + "qs($1, $2)" + ); +} + +var compliantExecNpcg = /()??/.exec("")[1] === undefined; +if (compliantExecNpcg) + return; +var proto = TokenizerModule.Tokenizer.prototype; +TokenizerModule.Tokenizer_orig = TokenizerModule.Tokenizer; +proto.getLineTokens_orig = proto.getLineTokens; + +patch( + TokenizerModule, "Tokenizer", + "ruleRegExps.push(adjustedregex);\n", + function(m) { + return m + '\ + if (state[i].next && RegExp(adjustedregex).test(""))\n\ + rule._qre = RegExp(adjustedregex, "g");\n\ + '; + } +); +TokenizerModule.Tokenizer.prototype = proto; +patch( + proto, "getLineTokens", + /if \(match\[i \+ 1\] === undefined\)\s*continue;/, + "if (!match[i + 1]) {\n\ + if (value)continue;\n\ + var qre = state[mapping[i]]._qre;\n\ + if (!qre) continue;\n\ + qre.lastIndex = lastIndex;\n\ + if (!qre.exec(line) || qre.lastIndex != lastIndex)\n\ + continue;\n\ + }" +); + +useragent.isOldIE = true; + +}); diff --git a/addons/editor/ace/ext/old_ie_test.js b/addons/editor/ace/ext/old_ie_test.js new file mode 100755 index 00000000..98652e14 --- /dev/null +++ b/addons/editor/ace/ext/old_ie_test.js @@ -0,0 +1,77 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +if (typeof process !== "undefined") { + require("amd-loader"); +} + +define(function(require, exports, module) { +"use strict"; + +var assert = require("../test/assertions"); + +module.exports = { + "test: getTokenizer() (smoke test)" : function() { + var exec = RegExp.prototype.exec + var brokenExec = function(str) { + var result = exec.call(this, str); + if (result) { + for (var i = result.length; i--;) + if (!result[i]) + result[i] = ""; + } + return result; + } + + try { + // break this to emulate old ie + RegExp.prototype.exec = brokenExec; + require("./old_ie"); + var Tokenizer = require("../tokenizer").Tokenizer; + var JavaScriptHighlightRules = require("../mode/javascript_highlight_rules").JavaScriptHighlightRules; + var tokenizer = new Tokenizer((new JavaScriptHighlightRules).getRules()); + + var tokens = tokenizer.getLineTokens("'juhu'", "start").tokens; + assert.equal("string", tokens[0].type); + } finally { + // restore modified functions + RegExp.prototype.exec = exec; + var module = require("../tokenizer"); + module.Tokenizer = module.Tokenizer_orig; + module.Tokenizer.prototype.getLineTokens = module.Tokenizer.prototype.getLineTokens_orig; + } + } +}; + +}); + +if (typeof module !== "undefined" && module === require.main) { + require("asyncjs").test.testcase(module.exports).exec() +} diff --git a/addons/editor/ace/ext/searchbox.css b/addons/editor/ace/ext/searchbox.css new file mode 100755 index 00000000..c0f5f284 --- /dev/null +++ b/addons/editor/ace/ext/searchbox.css @@ -0,0 +1,157 @@ + + +/* ------------------------------------------------------------------------------------------ + * Editor Search Form + * --------------------------------------------------------------------------------------- */ + .ace_search { + background-color: #ddd; + border: 1px solid #cbcbcb; + border-top: 0 none; + max-width: 297px; + overflow: hidden; + margin: 0; + padding: 4px; + padding-right: 6px; + padding-bottom: 0; + position: absolute; + top: 0px; + z-index: 99; +} +.ace_search.left { + border-left: 0 none; + border-radius: 0px 0px 5px 0px; + left: 0; +} +.ace_search.right { + border-radius: 0px 0px 0px 5px; + border-right: 0 none; + right: 0; +} + +.ace_search_form, .ace_replace_form { + border-radius: 3px; + border: 1px solid #cbcbcb; + float: left; + margin-bottom: 4px; + overflow: hidden; +} +.ace_search_form.ace_nomatch { + outline: 1px solid red; +} + +.ace_search_field { + background-color: white; + border-right: 1px solid #cbcbcb; + border: 0 none; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + display: block; + float: left; + height: 22px; + outline: 0; + padding: 0 7px; + width: 214px; + margin: 0; +} +.ace_searchbtn, +.ace_replacebtn { + background: #fff; + border: 0 none; + border-left: 1px solid #dcdcdc; + cursor: pointer; + display: block; + float: left; + height: 22px; + margin: 0; + padding: 0; + position: relative; +} +.ace_searchbtn:last-child, +.ace_replacebtn:last-child { + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; +} +.ace_searchbtn:disabled { + background: none; + cursor: default; +} +.ace_searchbtn { + background-position: 50% 50%; + background-repeat: no-repeat; + width: 27px; +} +.ace_searchbtn.prev { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADFJREFUeNpiSU1NZUAC/6E0I0yACYskCpsJiySKIiY0SUZk40FyTEgCjGgKwTRAgAEAQJUIPCE+qfkAAAAASUVORK5CYII=); +} +.ace_searchbtn.next { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADRJREFUeNpiTE1NZQCC/0DMyIAKwGJMUAYDEo3M/s+EpvM/mkKwCQxYjIeLMaELoLMBAgwAU7UJObTKsvAAAAAASUVORK5CYII=); +} +.ace_searchbtn_close { + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAcCAYAAABRVo5BAAAAZ0lEQVR42u2SUQrAMAhDvazn8OjZBilCkYVVxiis8H4CT0VrAJb4WHT3C5xU2a2IQZXJjiQIRMdkEoJ5Q2yMqpfDIo+XY4k6h+YXOyKqTIj5REaxloNAd0xiKmAtsTHqW8sR2W5f7gCu5nWFUpVjZwAAAABJRU5ErkJggg==) no-repeat 50% 0; + border-radius: 50%; + border: 0 none; + color: #656565; + cursor: pointer; + display: block; + float: right; + font-family: Arial; + font-size: 16px; + height: 14px; + line-height: 16px; + margin: 5px 1px 9px 5px; + padding: 0; + text-align: center; + width: 14px; +} +.ace_searchbtn_close:hover { + background-color: #656565; + background-position: 50% 100%; + color: white; +} +.ace_replacebtn.prev { + width: 54px +} +.ace_replacebtn.next { + width: 27px +} + +.ace_button { + margin-left: 2px; + cursor: pointer; + -webkit-user-select: none; + -moz-user-select: none; + -o-user-select: none; + -ms-user-select: none; + user-select: none; + overflow: hidden; + opacity: 0.7; + border: 1px solid rgba(100,100,100,0.23); + padding: 1px; + -moz-box-sizing: border-box; + box-sizing: border-box; + color: black; +} + +.ace_button:hover { + background-color: #eee; + opacity:1; +} +.ace_button:active { + background-color: #ddd; +} + +.ace_button.checked { + border-color: #3399ff; + opacity:1; +} + +.ace_search_options{ + margin-bottom: 3px; + text-align: right; + -webkit-user-select: none; + -moz-user-select: none; + -o-user-select: none; + -ms-user-select: none; + user-select: none; +} \ No newline at end of file diff --git a/addons/editor/ace/ext-searchbox.js b/addons/editor/ace/ext/searchbox.js old mode 100644 new mode 100755 similarity index 73% rename from addons/editor/ace/ext-searchbox.js rename to addons/editor/ace/ext/searchbox.js index 2acaf73e..fbbaa8f3 --- a/addons/editor/ace/ext-searchbox.js +++ b/addons/editor/ace/ext/searchbox.js @@ -28,162 +28,13 @@ * * ***** END LICENSE BLOCK ***** */ -define('ace/ext/searchbox', ['require', 'exports', 'module' , 'ace/lib/dom', 'ace/lib/lang', 'ace/lib/event', 'ace/keyboard/hash_handler', 'ace/lib/keys'], function(require, exports, module) { - +define(function(require, exports, module) { +"use strict"; var dom = require("../lib/dom"); var lang = require("../lib/lang"); var event = require("../lib/event"); -var searchboxCss = "\ -/* ------------------------------------------------------------------------------------------\ -* Editor Search Form\ -* --------------------------------------------------------------------------------------- */\ -.ace_search {\ -background-color: #ddd;\ -border: 1px solid #cbcbcb;\ -border-top: 0 none;\ -max-width: 297px;\ -overflow: hidden;\ -margin: 0;\ -padding: 4px;\ -padding-right: 6px;\ -padding-bottom: 0;\ -position: absolute;\ -top: 0px;\ -z-index: 99;\ -}\ -.ace_search.left {\ -border-left: 0 none;\ -border-radius: 0px 0px 5px 0px;\ -left: 0;\ -}\ -.ace_search.right {\ -border-radius: 0px 0px 0px 5px;\ -border-right: 0 none;\ -right: 0;\ -}\ -.ace_search_form, .ace_replace_form {\ -border-radius: 3px;\ -border: 1px solid #cbcbcb;\ -float: left;\ -margin-bottom: 4px;\ -overflow: hidden;\ -}\ -.ace_search_form.ace_nomatch {\ -outline: 1px solid red;\ -}\ -.ace_search_field {\ -background-color: white;\ -border-right: 1px solid #cbcbcb;\ -border: 0 none;\ --webkit-box-sizing: border-box;\ --moz-box-sizing: border-box;\ -box-sizing: border-box;\ -display: block;\ -float: left;\ -height: 22px;\ -outline: 0;\ -padding: 0 7px;\ -width: 214px;\ -margin: 0;\ -}\ -.ace_searchbtn,\ -.ace_replacebtn {\ -background: #fff;\ -border: 0 none;\ -border-left: 1px solid #dcdcdc;\ -cursor: pointer;\ -display: block;\ -float: left;\ -height: 22px;\ -margin: 0;\ -padding: 0;\ -position: relative;\ -}\ -.ace_searchbtn:last-child,\ -.ace_replacebtn:last-child {\ -border-top-right-radius: 3px;\ -border-bottom-right-radius: 3px;\ -}\ -.ace_searchbtn:disabled {\ -background: none;\ -cursor: default;\ -}\ -.ace_searchbtn {\ -background-position: 50% 50%;\ -background-repeat: no-repeat;\ -width: 27px;\ -}\ -.ace_searchbtn.prev {\ -background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADFJREFUeNpiSU1NZUAC/6E0I0yACYskCpsJiySKIiY0SUZk40FyTEgCjGgKwTRAgAEAQJUIPCE+qfkAAAAASUVORK5CYII=); \ -}\ -.ace_searchbtn.next {\ -background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADRJREFUeNpiTE1NZQCC/0DMyIAKwGJMUAYDEo3M/s+EpvM/mkKwCQxYjIeLMaELoLMBAgwAU7UJObTKsvAAAAAASUVORK5CYII=); \ -}\ -.ace_searchbtn_close {\ -background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAcCAYAAABRVo5BAAAAZ0lEQVR42u2SUQrAMAhDvazn8OjZBilCkYVVxiis8H4CT0VrAJb4WHT3C5xU2a2IQZXJjiQIRMdkEoJ5Q2yMqpfDIo+XY4k6h+YXOyKqTIj5REaxloNAd0xiKmAtsTHqW8sR2W5f7gCu5nWFUpVjZwAAAABJRU5ErkJggg==) no-repeat 50% 0;\ -border-radius: 50%;\ -border: 0 none;\ -color: #656565;\ -cursor: pointer;\ -display: block;\ -float: right;\ -font-family: Arial;\ -font-size: 16px;\ -height: 14px;\ -line-height: 16px;\ -margin: 5px 1px 9px 5px;\ -padding: 0;\ -text-align: center;\ -width: 14px;\ -}\ -.ace_searchbtn_close:hover {\ -background-color: #656565;\ -background-position: 50% 100%;\ -color: white;\ -}\ -.ace_replacebtn.prev {\ -width: 54px\ -}\ -.ace_replacebtn.next {\ -width: 27px\ -}\ -.ace_button {\ -margin-left: 2px;\ -cursor: pointer;\ --webkit-user-select: none;\ --moz-user-select: none;\ --o-user-select: none;\ --ms-user-select: none;\ -user-select: none;\ -overflow: hidden;\ -opacity: 0.7;\ -border: 1px solid rgba(100,100,100,0.23);\ -padding: 1px;\ --moz-box-sizing: border-box;\ -box-sizing: border-box;\ -color: black;\ -}\ -.ace_button:hover {\ -background-color: #eee;\ -opacity:1;\ -}\ -.ace_button:active {\ -background-color: #ddd;\ -}\ -.ace_button.checked {\ -border-color: #3399ff;\ -opacity:1;\ -}\ -.ace_search_options{\ -margin-bottom: 3px;\ -text-align: right;\ --webkit-user-select: none;\ --moz-user-select: none;\ --o-user-select: none;\ --ms-user-select: none;\ -user-select: none;\ -}"; +var searchboxCss = require("../requirejs/text!./searchbox.css"); var HashHandler = require("../keyboard/hash_handler").HashHandler; var keyUtil = require("../lib/keys"); @@ -282,6 +133,8 @@ var SearchBox = function(editor, range, showReplaceForm) { _this.searchInput.value && _this.highlight(); }); }; + + //keybinging outsite of the searchbox this.$closeSearchBarKb = new HashHandler([{ bindKey: "Esc", name: "closeSearchBar", @@ -289,6 +142,8 @@ var SearchBox = function(editor, range, showReplaceForm) { editor.searchBox.hide(); } }]); + + //keybinging outsite of the searchbox this.$searchBarKb = new HashHandler(); this.$searchBarKb.bindKeys({ "Ctrl-f|Command-f|Ctrl-H|Command-Option-F": function(sb) { @@ -418,3 +273,14 @@ exports.Search = function(editor, isReplace) { }; }); + + +/* ------------------------------------------------------------------------------------------ + * TODO + * --------------------------------------------------------------------------------------- */ +/* +- move search form to the left if it masks current word +- includ all options that search has. ex: regex +- searchbox.searchbox is not that pretty. we should have just searchbox +- disable prev button if it makes sence +*/ diff --git a/addons/editor/ace/ext/settings_menu.js b/addons/editor/ace/ext/settings_menu.js new file mode 100755 index 00000000..44f6d6ad --- /dev/null +++ b/addons/editor/ace/ext/settings_menu.js @@ -0,0 +1,76 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl + * All rights reserved. + * + * Contributed to Ajax.org under the BSD license. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +/*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/ +/*global define, require */ + +/** + * Show Settings Menu + * @fileOverview Show Settings Menu
+ * Displays an interactive settings menu mostly generated on the fly based on + * the current state of the editor. + * @author + * Matthew Christopher Kastor-Inare III
+ * ☭ Hial Atropa!! ☭ + */ + +define(function(require, exports, module) { +"use strict"; +var generateSettingsMenu = require('./menu_tools/generate_settings_menu').generateSettingsMenu; +var overlayPage = require('./menu_tools/overlay_page').overlayPage; +/** + * This displays the settings menu if it is not already being shown. + * @author + * Matthew Christopher Kastor-Inare III
+ * ☭ Hial Atropa!! ☭ + * @param {ace.Editor} editor An instance of the ace editor. + */ +function showSettingsMenu(editor) { + // make sure the menu isn't open already. + var sm = document.getElementById('ace_settingsmenu'); + if (!sm) + overlayPage(editor, generateSettingsMenu(editor), '0', '0', '0'); +} + +/** + * Initializes the settings menu extension. It adds the showSettingsMenu + * method to the given editor object and adds the showSettingsMenu command + * to the editor with appropriate keyboard shortcuts. + * @param {ace.Editor} editor An instance of the Editor. + */ +module.exports.init = function(editor) { + var Editor = require("ace/editor").Editor; + Editor.prototype.showSettingsMenu = function() { + showSettingsMenu(this); + }; +}; +}); \ No newline at end of file diff --git a/addons/editor/ace/ext-spellcheck.js b/addons/editor/ace/ext/spellcheck.js old mode 100644 new mode 100755 similarity index 93% rename from addons/editor/ace/ext-spellcheck.js rename to addons/editor/ace/ext/spellcheck.js index 7f50e9b1..08bf2189 --- a/addons/editor/ace/ext-spellcheck.js +++ b/addons/editor/ace/ext/spellcheck.js @@ -1,5 +1,5 @@ -define('ace/ext/spellcheck', ['require', 'exports', 'module' , 'ace/lib/event', 'ace/editor', 'ace/config'], function(require, exports, module) { - +define(function(require, exports, module) { +"use strict"; var event = require("../lib/event"); exports.contextMenuHandler = function(e){ @@ -49,6 +49,7 @@ exports.contextMenuHandler = function(e){ return newVal; }); }; +// todo support highlighting with typo.js var Editor = require("../editor").Editor; require("../config").defineOptions(Editor.prototype, "editor", { spellcheck: { diff --git a/addons/editor/ace/ext/split.js b/addons/editor/ace/ext/split.js new file mode 100755 index 00000000..8316562f --- /dev/null +++ b/addons/editor/ace/ext/split.js @@ -0,0 +1,40 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +/** + * this is experimental, and subject to change, use at your own risk! + */ +module.exports = require("../split"); + +}); + diff --git a/addons/editor/ace/ext/static.css b/addons/editor/ace/ext/static.css new file mode 100755 index 00000000..bd479780 --- /dev/null +++ b/addons/editor/ace/ext/static.css @@ -0,0 +1,23 @@ +.ace_static_highlight { + font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', 'Droid Sans Mono', monospace; + font-size: 12px; +} + +.ace_static_highlight .ace_gutter { + width: 25px !important; + display: block; + float: left; + text-align: right; + padding: 0 3px 0 0; + margin-right: 3px; + position: static !important; +} + +.ace_static_highlight .ace_line { clear: both; } + +.ace_static_highlight .ace_gutter-cell { + -moz-user-select: -moz-none; + -khtml-user-select: none; + -webkit-user-select: none; + user-select: none; +} \ No newline at end of file diff --git a/addons/editor/ace/ext-static_highlight.js b/addons/editor/ace/ext/static_highlight.js old mode 100644 new mode 100755 similarity index 74% rename from addons/editor/ace/ext-static_highlight.js rename to addons/editor/ace/ext/static_highlight.js index ac0b7ba3..2119653a --- a/addons/editor/ace/ext-static_highlight.js +++ b/addons/editor/ace/ext/static_highlight.js @@ -28,37 +28,40 @@ * * ***** END LICENSE BLOCK ***** */ -define('ace/ext/static_highlight', ['require', 'exports', 'module' , 'ace/edit_session', 'ace/layer/text', 'ace/config', 'ace/lib/dom'], function(require, exports, module) { - +define(function(require, exports, module) { +"use strict"; var EditSession = require("../edit_session").EditSession; var TextLayer = require("../layer/text").Text; -var baseStyles = ".ace_static_highlight {\ -font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', 'Droid Sans Mono', monospace;\ -font-size: 12px;\ -}\ -.ace_static_highlight .ace_gutter {\ -width: 25px !important;\ -display: block;\ -float: left;\ -text-align: right;\ -padding: 0 3px 0 0;\ -margin-right: 3px;\ -position: static !important;\ -}\ -.ace_static_highlight .ace_line { clear: both; }\ -.ace_static_highlight .ace_gutter-cell {\ --moz-user-select: -moz-none;\ --khtml-user-select: none;\ --webkit-user-select: none;\ -user-select: none;\ -}"; +var baseStyles = require("../requirejs/text!./static.css"); var config = require("../config"); var dom = require("../lib/dom"); +/** + * Transforms a given input code snippet into HTML using the given mode + * + * @param {string} input Code snippet + * @param {string|mode} mode String specifying the mode to load such as + * `ace/mode/javascript` or, a mode loaded from `/ace/mode` + * (use 'ServerSideHiglighter.getMode'). + * @param {string|theme} theme String specifying the theme to load such as + * `ace/theme/twilight` or, a theme loaded from `/ace/theme`. + * @param {number} lineStart A number indicating the first line number. Defaults + * to 1. + * @param {boolean} disableGutter Specifies whether or not to disable the gutter. + * `true` disables the gutter, `false` enables the gutter. Defaults to `false`. + * @param {function} callback When specifying the mode or theme as a string, + * this method has no return value and you must specify a callback function. The + * callback will receive the rendered object containing the properties `html` + * and `css`. + * @returns {object} An object containing the properties `html` and `css`. + */ exports.render = function(input, mode, theme, lineStart, disableGutter, callback) { var waiting = 0; var modeCache = EditSession.prototype.$modes; + + // if either the theme or the mode were specified as objects + // then we need to lazily load them. if (typeof theme == "string") { waiting++; config.loadModule(['theme', theme], function(m) { @@ -75,6 +78,8 @@ exports.render = function(input, mode, theme, lineStart, disableGutter, callback --waiting || done(); }); } + + // loads or passes the specified mode module then calls renderer function done() { var result = exports.renderSync(input, mode, theme, lineStart, disableGutter); return callback ? callback(result) : result; @@ -82,6 +87,14 @@ exports.render = function(input, mode, theme, lineStart, disableGutter, callback return waiting || done(); }; +/* + * Transforms a given input code snippet into HTML using the given mode + * @param {string} input Code snippet + * @param {mode} mode Mode loaded from /ace/mode (use 'ServerSideHiglighter.getMode') + * @param {string} r Code snippet + * @returns {object} An object containing: html, css + */ + exports.renderSync = function(input, mode, theme, lineStart, disableGutter) { lineStart = parseInt(lineStart || 1, 10); @@ -108,6 +121,8 @@ exports.renderSync = function(input, mode, theme, lineStart, disableGutter) { textLayer.$renderLine(stringBuilder, ix, true, false); stringBuilder.push(""); } + + // let's prepare the whole html var html = "
" + "
" + stringBuilder.join("") + @@ -124,7 +139,7 @@ exports.renderSync = function(input, mode, theme, lineStart, disableGutter) { -exports.highlight = function(el, opts) { +exports.highlight = function(el, opts, callback) { var m = el.className.match(/lang-(\w+)/); var mode = opts.mode || m && ("ace/mode/" + m[1]); if (!mode) @@ -159,6 +174,7 @@ exports.highlight = function(el, opts) { var lineEl = container.children[pos.row]; lineEl && lineEl.appendChild(nodes[i+1]); } + callback && callback(); }); }; }); diff --git a/addons/editor/ace/ext/static_highlight_test.js b/addons/editor/ace/ext/static_highlight_test.js new file mode 100755 index 00000000..bdbecbfc --- /dev/null +++ b/addons/editor/ace/ext/static_highlight_test.js @@ -0,0 +1,89 @@ +if (typeof process !== "undefined") { + require("amd-loader"); + require("../test/mockdom"); +} + +define(function(require, exports, module) { +"use strict"; + +var assert = require("assert"); +var highlighter = require("./static_highlight"); +var JavaScriptMode = require("../mode/javascript").Mode; +var TextMode = require("../mode/text").Mode; + +// Execution ORDER: test.setUpSuite, setUp, testFn, tearDown, test.tearDownSuite +module.exports = { + timeout: 10000, + + "test simple snippet": function(next) { + var theme = require("../theme/tomorrow"); + var snippet = [ + "/** this is a function", + "*", + "*/", + "function hello (a, b, c) {", + " console.log(a * b + c + 'sup$');", + "}" + ].join("\n"); + var mode = new JavaScriptMode(); + + var result = highlighter.render(snippet, mode, theme); + assert.equal(result.html, "
1/**\xa0this\xa0is\xa0a\xa0function
2*
3*/
4function\xa0hello\xa0(a,\xa0b,\xa0c)\xa0{
5\xa0\xa0\xa0\xa0console.log(a\xa0*\xa0b\xa0+\xa0c\xa0+\xa0'sup$');
6}
"); + assert.ok(!!result.css); + next(); + }, + + "test css from theme is used": function(next) { + var theme = require("../theme/tomorrow"); + var snippet = [ + "/** this is a function", + "*", + "*/", + "function hello (a, b, c) {", + " console.log(a * b + c + 'sup?');", + "}" + ].join("\n"); + var mode = new JavaScriptMode(); + + var result = highlighter.render(snippet, mode, theme); + + assert.ok(result.css.indexOf(theme.cssText) !== -1); + + next(); + }, + + "test theme classname should be in output html": function(next) { + var theme = require("../theme/tomorrow"); + var snippet = [ + "/** this is a function", + "*", + "*/", + "function hello (a, b, c) {", + " console.log(a * b + c + 'sup?');", + "}" + ].join("\n"); + var mode = new JavaScriptMode(); + + var result = highlighter.render(snippet, mode, theme); + assert.equal(!!result.html.match(/
/), true); + + next(); + }, + + "test js string replace specials": function(next) { + var theme = require("../theme/tomorrow"); + var snippet = "$'$1$2$$$&"; + var mode = new TextMode(); + + var result = highlighter.render(snippet, mode, theme); + assert.ok(result.html.indexOf(snippet) != -1); + + next(); + } +}; + +}); + +if (typeof module !== "undefined" && module === require.main) { + require("asyncjs").test.testcase(module.exports).exec(); +} diff --git a/addons/editor/ace/ext-statusbar.js b/addons/editor/ace/ext/statusbar.js old mode 100644 new mode 100755 similarity index 91% rename from addons/editor/ace/ext-statusbar.js rename to addons/editor/ace/ext/statusbar.js index b751ccae..666febfa --- a/addons/editor/ace/ext-statusbar.js +++ b/addons/editor/ace/ext/statusbar.js @@ -1,4 +1,6 @@ -define('ace/ext/statusbar', ['require', 'exports', 'module' , 'ace/lib/dom', 'ace/lib/lang'], function(require, exports, module) { +define(function(require, exports, module) { +"use strict"; +/** simple statusbar **/ var dom = require("ace/lib/dom"); var lang = require("ace/lib/lang"); diff --git a/addons/editor/ace/ext-textarea.js b/addons/editor/ace/ext/textarea.js old mode 100644 new mode 100755 similarity index 83% rename from addons/editor/ace/ext-textarea.js rename to addons/editor/ace/ext/textarea.js index 8d4cafee..86b299e6 --- a/addons/editor/ace/ext-textarea.js +++ b/addons/editor/ace/ext/textarea.js @@ -28,8 +28,8 @@ * * ***** END LICENSE BLOCK ***** */ -define('ace/ext/textarea', ['require', 'exports', 'module' , 'ace/lib/event', 'ace/lib/useragent', 'ace/lib/net', 'ace/ace', 'ace/theme/textmate', 'ace/mode/text'], function(require, exports, module) { - +define(function(require, exports, module) { +"use strict"; var event = require("../lib/event"); var UA = require("../lib/useragent"); @@ -39,6 +39,16 @@ var ace = require("../ace"); require("../theme/textmate"); module.exports = exports = ace; + +/* + * Returns the CSS property of element. + * 1) If the CSS property is on the style object of the element, use it, OR + * 2) Compute the CSS property + * + * If the property can't get computed, is 'auto' or 'intrinsic', the former + * calculated property is used (this can happen in cases where the textarea + * is hidden and has no dimension styles). + */ var getCSSProperty = function(element, container, property) { var ret = element.style[property]; @@ -68,7 +78,19 @@ function setupContainer(element, getValue) { } var parentNode = element.parentNode; + + // This will hold the editor. var container = document.createElement('div'); + + // To put Ace in the place of the textarea, we have to copy a few of the + // textarea's style attributes to the div container. + // + // The problem is that the properties have to get computed (they might be + // defined by a CSS file on the page - you can't access such rules that + // apply to an element via elm.style). Computed properties are converted to + // pixels although the dimension might be given as percentage. When the + // window resizes, the dimensions defined by percentages changes, so the + // properties have to get recomputed to get the new/true pixels. var resizeEvent = function() { var style = 'position:relative;'; [ @@ -77,20 +99,51 @@ function setupContainer(element, getValue) { style += item + ':' + getCSSProperty(element, container, item) + ';'; }); + + // Calculating the width/height of the textarea is somewhat tricky. To + // do it right, you have to include the paddings to the sides as well + // (eg. width = width + padding-left, -right). This works well, as + // long as the width of the element is not set or given in pixels. In + // this case and after the textarea is hidden, getCSSProperty(element, + // container, 'width') will still return pixel value. If the element + // has realtiv dimensions (e.g. width='95') + // getCSSProperty(...) will return pixel values only as long as the + // textarea is visible. After it is hidden getCSSProperty will return + // the relative dimensions as they are set on the element (in the case + // of width, 95). + // Making the sum of pixel vaules (e.g. padding) and realtive values + // (e.g. ) is not possible. As such the padding styles are + // ignored. + + // The complete width is the width of the textarea + the padding + // to the left and right. var width = getCSSProperty(element, container, 'width') || (element.clientWidth + "px"); var height = getCSSProperty(element, container, 'height') || (element.clientHeight + "px"); style += 'height:' + height + ';width:' + width + ';'; + + // Set the display property to 'inline-block'. style += 'display:inline-block;'; container.setAttribute('style', style); }; event.addListener(window, 'resize', resizeEvent); + + // Call the resizeEvent once, so that the size of the container is + // calculated. resizeEvent(); + + // Insert the div container after the element. parentNode.insertBefore(container, element.nextSibling); + + // Override the forms onsubmit function. Set the innerHTML and value + // of the textarea before submitting. while (parentNode !== document) { if (parentNode.tagName.toUpperCase() === 'FORM') { var oldSumit = parentNode.onsubmit; + // Override the onsubmit function of the form. parentNode.onsubmit = function(evt) { element.value = getValue(); + // If there is a onsubmit function already, then call + // it with the current context and pass the event. if (oldSumit) { oldSumit.call(this, evt); } @@ -107,8 +160,12 @@ exports.transformTextarea = function(element, loader) { var container = setupContainer(element, function() { return session.getValue(); }); + + // Hide the element. element.style.display = 'none'; container.style.background = 'white'; + + // var editorDiv = document.createElement("div"); applyStyles(editorDiv, { top: "0px", @@ -157,6 +214,8 @@ exports.transformTextarea = function(element, loader) { applyStyles(settingDiv, settingDivStyles); container.appendChild(settingDiv); + + // Power up ace on the textarea: var options = {}; var editor = ace.edit(editorDiv); @@ -164,8 +223,14 @@ exports.transformTextarea = function(element, loader) { session.setValue(element.value || element.innerHTML); editor.focus(); + + // Add the settingPanel opener to the editor's div. container.appendChild(settingOpener); + + // Create the API. setupApi(editor, editorDiv, settingDiv, ace, options, loader); + + // Create the setting's panel. setupSettingPanel(settingDiv, settingOpener, editor, options); var state = ""; @@ -237,6 +302,7 @@ function setupApi(editor, editorDiv, settingDiv, ace, options, loader) { switch (key) { case "mode": if (value != "text") { + // Load the required mode file. Files get loaded only once. loader("mode-" + value + ".js", "ace/mode/" + value, function() { var aceMode = require("../mode/" + value).Mode; session.setMode(new aceMode()); @@ -248,6 +314,7 @@ function setupApi(editor, editorDiv, settingDiv, ace, options, loader) { case "theme": if (value != "textmate") { + // Load the required theme file. Files get loaded only once. loader("theme-" + value + ".js", "ace/theme/" + value, function() { editor.setTheme("ace/theme/" + value); }); @@ -463,6 +530,8 @@ function setupSettingPanel(settingDiv, settingOpener, editor, options) { settingDiv.appendChild(button); settingDiv.hideButton = button; } + +// Default startup options. exports.options = { mode: "text", theme: "textmate", diff --git a/addons/editor/ace/ext-themelist.js b/addons/editor/ace/ext/themelist.js old mode 100644 new mode 100755 similarity index 73% rename from addons/editor/ace/ext-themelist.js rename to addons/editor/ace/ext/themelist.js index a267ba90..1032f72c --- a/addons/editor/ace/ext-themelist.js +++ b/addons/editor/ace/ext/themelist.js @@ -30,8 +30,33 @@ * * ***** END LICENSE BLOCK ***** */ -define('ace/ext/themelist', ['require', 'exports', 'module' , 'ace/ext/themelist_utils/themes'], function(require, exports, module) { +/*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/ +/*global define, require */ + +/** + * Generates a list of themes available when ace was built. + * @fileOverview Generates a list of themes available when ace was built. + * @author + * Matthew Christopher Kastor-Inare III
+ * ☭ Hial Atropa!! ☭ + */ + +define(function(require, exports, module) { +"use strict"; + +/** + * An array containing information about available themes. + */ module.exports.themes = require('ace/ext/themelist_utils/themes').themes; + +/** + * Creates a theme description. + * @param {string} name The file name of the theme. + * @returns {ThemeDescription} Returns a theme description object which has + * three properties: the name gives the filename, the desc gives a menu + * friendly name, and the theme gives the string to set the theme with + * `setTheme` + */ module.exports.ThemeDescription = function(name) { this.name = name; this.desc = name.split('_' @@ -52,39 +77,3 @@ module.exports.themes = module.exports.themes.map(function(name) { }); -define('ace/ext/themelist_utils/themes', ['require', 'exports', 'module' ], function(require, exports, module) { - -module.exports.themes = [ - "ambiance", - "chaos", - "chrome", - "clouds", - "clouds_midnight", - "cobalt", - "crimson_editor", - "dawn", - "dreamweaver", - "eclipse", - "github", - "idle_fingers", - "kr_theme", - "merbivore", - "merbivore_soft", - "mono_industrial", - "monokai", - "pastel_on_dark", - "solarized_dark", - "solarized_light", - "terminal", - "textmate", - "tomorrow", - "tomorrow_night", - "tomorrow_night_blue", - "tomorrow_night_bright", - "tomorrow_night_eighties", - "twilight", - "vibrant_ink", - "xcode" -]; - -}); \ No newline at end of file diff --git a/addons/editor/ace/ext/themelist_utils/themes.js b/addons/editor/ace/ext/themelist_utils/themes.js new file mode 100755 index 00000000..2e490c9f --- /dev/null +++ b/addons/editor/ace/ext/themelist_utils/themes.js @@ -0,0 +1,36 @@ +define(function(require, exports, module) { + +module.exports.themes = [ + "ambiance", + "chaos", + "chrome", + "clouds", + "clouds_midnight", + "cobalt", + "crimson_editor", + "dawn", + "dreamweaver", + "eclipse", + "github", + "idle_fingers", + "kr_theme", + "merbivore", + "merbivore_soft", + "mono_industrial", + "monokai", + "pastel_on_dark", + "solarized_dark", + "solarized_light", + "terminal", + "textmate", + "tomorrow", + "tomorrow_night", + "tomorrow_night_blue", + "tomorrow_night_bright", + "tomorrow_night_eighties", + "twilight", + "vibrant_ink", + "xcode" +]; + +}); \ No newline at end of file diff --git a/addons/editor/ace/ext-whitespace.js b/addons/editor/ace/ext/whitespace.js old mode 100644 new mode 100755 similarity index 96% rename from addons/editor/ace/ext-whitespace.js rename to addons/editor/ace/ext/whitespace.js index dbfd3ee1..83486fb0 --- a/addons/editor/ace/ext-whitespace.js +++ b/addons/editor/ace/ext/whitespace.js @@ -28,10 +28,12 @@ * * ***** END LICENSE BLOCK ***** */ -define('ace/ext/whitespace', ['require', 'exports', 'module' , 'ace/lib/lang'], function(require, exports, module) { - +define(function(require, exports, module) { +"use strict"; var lang = require("../lib/lang"); + +// based on http://www.freehackers.org/Indent_Finder exports.$detectIndentation = function(lines, fallback) { var stats = []; var changes = []; @@ -40,6 +42,7 @@ exports.$detectIndentation = function(lines, fallback) { var max = Math.min(lines.length, 1000); for (var i = 0; i < max; i++) { var line = lines[i]; + // ignore empty and comment lines if (!/^\s*[^*+\-\s]/.test(line)) continue; @@ -56,6 +59,8 @@ exports.$detectIndentation = function(lines, fallback) { stats[spaces] = (stats[spaces] || 0) + 1; } prevSpaces = spaces; + + // ignore lines ending with backslash while (line[line.length - 1] == "\\") line = lines[i++]; } @@ -182,6 +187,7 @@ exports.commands = [{ name: "detectIndentation", exec: function(editor) { exports.detectIndentation(editor.session); + // todo show message? } }, { name: "trimTrailingSpace", diff --git a/addons/editor/ace/incremental_search.js b/addons/editor/ace/incremental_search.js new file mode 100755 index 00000000..e6fa8928 --- /dev/null +++ b/addons/editor/ace/incremental_search.js @@ -0,0 +1,259 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var oop = require("./lib/oop"); +var Range = require("./range").Range; +var Search = require("./search").Search; +var SearchHighlight = require("./search_highlight").SearchHighlight; +var iSearchCommandModule = require("./commands/incremental_search_commands"); +var ISearchKbd = iSearchCommandModule.IncrementalSearchKeyboardHandler; + +/** + * @class IncrementalSearch + * + * Implements immediate searching while the user is typing. When incremental + * search is activated, keystrokes into the editor will be used for composing + * a search term. Immediately after every keystroke the search is updated: + * - so-far-matching characters are highlighted + * - the cursor is moved to the next match + * + **/ + + +/** + * + * + * Creates a new `IncrementalSearch` object. + * + * @constructor + **/ +function IncrementalSearch() { + this.$options = {wrap: false, skipCurrent: false}; + this.$keyboardHandler = new ISearchKbd(this); +} + +oop.inherits(IncrementalSearch, Search); + +;(function() { + + this.activate = function(ed, backwards) { + this.$editor = ed; + this.$startPos = this.$currentPos = ed.getCursorPosition(); + this.$options.needle = ''; + this.$options.backwards = backwards; + ed.keyBinding.addKeyboardHandler(this.$keyboardHandler); + this.$mousedownHandler = ed.addEventListener('mousedown', this.onMouseDown.bind(this)); + this.selectionFix(ed); + this.statusMessage(true); + } + + this.deactivate = function(reset) { + this.cancelSearch(reset); + this.$editor.keyBinding.removeKeyboardHandler(this.$keyboardHandler); + if (this.$mousedownHandler) { + this.$editor.removeEventListener('mousedown', this.$mousedownHandler); + delete this.$mousedownHandler; + } + this.message(''); + } + + this.selectionFix = function(editor) { + // Fix selection bug: When clicked inside the editor + // editor.selection.$isEmpty is false even if the mouse click did not + // open a selection. This is interpreted by the move commands to + // extend the selection. To only extend the selection when there is + // one, we clear it here + if (editor.selection.isEmpty() && !editor.session.$emacsMark) { + editor.clearSelection(); + } + } + + this.highlight = function(regexp) { + var sess = this.$editor.session, + hl = sess.$isearchHighlight = sess.$isearchHighlight || sess.addDynamicMarker( + new SearchHighlight(null, "ace_isearch-result", "text")); + hl.setRegexp(regexp); + sess._emit("changeBackMarker"); // force highlight layer redraw + } + + this.cancelSearch = function(reset) { + var e = this.$editor; + this.$prevNeedle = this.$options.needle; + this.$options.needle = ''; + if (reset) { + e.moveCursorToPosition(this.$startPos); + this.$currentPos = this.$startPos; + } else { + e.pushEmacsMark && e.pushEmacsMark(this.$startPos, false); + } + this.highlight(null); + return Range.fromPoints(this.$currentPos, this.$currentPos); + } + + this.highlightAndFindWithNeedle = function(moveToNext, needleUpdateFunc) { + if (!this.$editor) return null; + var options = this.$options; + + // get search term + if (needleUpdateFunc) { + options.needle = needleUpdateFunc.call(this, options.needle || '') || ''; + } + if (options.needle.length === 0) { + this.statusMessage(true); + return this.cancelSearch(true); + }; + + // try to find the next occurence and enable highlighting marker + options.start = this.$currentPos; + var session = this.$editor.session, + found = this.find(session); + if (found) { + if (options.backwards) found = Range.fromPoints(found.end, found.start); + this.$editor.moveCursorToPosition(found.end); + if (moveToNext) this.$currentPos = found.end; + // highlight after cursor move, so selection works properly + this.highlight(options.re) + } + + this.statusMessage(found); + + return found; + } + + this.addChar = function(c) { + return this.highlightAndFindWithNeedle(false, function(needle) { + return needle + c; + }); + } + + this.removeChar = function(c) { + return this.highlightAndFindWithNeedle(false, function(needle) { + return needle.length > 0 ? needle.substring(0, needle.length-1) : needle; + }); + } + + this.next = function(options) { + // try to find the next occurence of whatever we have searched for + // earlier. + // options = {[backwards: BOOL], [useCurrentOrPrevSearch: BOOL]} + options = options || {}; + this.$options.backwards = !!options.backwards; + this.$currentPos = this.$editor.getCursorPosition(); + return this.highlightAndFindWithNeedle(true, function(needle) { + return options.useCurrentOrPrevSearch && needle.length === 0 ? + this.$prevNeedle || '' : needle; + }); + } + + this.onMouseDown = function(evt) { + // when mouse interaction happens then we quit incremental search + this.deactivate(); + return true; + } + + this.statusMessage = function(found) { + var options = this.$options, msg = ''; + msg += options.backwards ? 'reverse-' : ''; + msg += 'isearch: ' + options.needle; + msg += found ? '' : ' (not found)'; + this.message(msg); + } + + this.message = function(msg) { + if (this.$editor.showCommandLine) { + this.$editor.showCommandLine(msg); + this.$editor.focus(); + } else { + console.log(msg); + } + } + +}).call(IncrementalSearch.prototype); + + +exports.IncrementalSearch = IncrementalSearch; + + +/** + * + * Config settings for enabling/disabling [[IncrementalSearch `IncrementalSearch`]]. + * + **/ + +var dom = require('./lib/dom'); +dom.importCssString && dom.importCssString("\ +.ace_marker-layer .ace_isearch-result {\ + position: absolute;\ + z-index: 6;\ + -moz-box-sizing: border-box;\ + -webkit-box-sizing: border-box;\ + box-sizing: border-box;\ +}\ +div.ace_isearch-result {\ + border-radius: 4px;\ + background-color: rgba(255, 200, 0, 0.5);\ + box-shadow: 0 0 4px rgb(255, 200, 0);\ +}\ +.ace_dark div.ace_isearch-result {\ + background-color: rgb(100, 110, 160);\ + box-shadow: 0 0 4px rgb(80, 90, 140);\ +}", "incremental-search-highlighting"); + +// support for default keyboard handler +var commands = require("./commands/command_manager"); +(function() { + this.setupIncrementalSearch = function(editor, val) { + if (this.usesIncrementalSearch == val) return; + this.usesIncrementalSearch = val; + var iSearchCommands = iSearchCommandModule.iSearchStartCommands; + var method = val ? 'addCommands' : 'removeCommands'; + this[method](iSearchCommands); + }; +}).call(commands.CommandManager.prototype); + +// incremental search config option +var Editor = require("./editor").Editor; +require("./config").defineOptions(Editor.prototype, "editor", { + useIncrementalSearch: { + set: function(val) { + this.keyBinding.$handlers.forEach(function(handler) { + if (handler.setupIncrementalSearch) { + handler.setupIncrementalSearch(this, val); + } + }); + this._emit('incrementalSearchSettingChanged', {isEnabled: val}); + } + } +}); + +}); diff --git a/addons/editor/ace/incremental_search_test.js b/addons/editor/ace/incremental_search_test.js new file mode 100755 index 00000000..c351d8e2 --- /dev/null +++ b/addons/editor/ace/incremental_search_test.js @@ -0,0 +1,208 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +if (typeof process !== "undefined") { + require("amd-loader"); +} + +define(function(require, exports, module) { +"use strict"; + +var EditSession = require("./edit_session").EditSession; +var Editor = require("./editor").Editor; +var MockRenderer = require("./test/mockrenderer").MockRenderer; +var Range = require("./range").Range; +var assert = require("./test/assertions"); +var IncrementalSearch = require("./incremental_search").IncrementalSearch; + +var editor, iSearch; +function testRanges(str, ranges) { + ranges = ranges || editor.selection.getAllRanges(); + assert.equal(ranges + "", str + ""); +} + +// force "rerender" +function callHighlighterUpdate() { + var session = editor.session, + ranges = [], + mockMarkerLayer = { + drawSingleLineMarker: function(_, markerRanges) { + ranges = ranges.concat(markerRanges); + } + } + session.$isearchHighlight.update([], mockMarkerLayer, session, { + firstRow: 0, lastRow: session.getRowLength()}); + return ranges; +} + +module.exports = { + + name: "ACE incremental_search.js", + + setUp: function() { + var session = new EditSession(["abc123", "xyz124"]); + editor = new Editor(new MockRenderer(), session); + iSearch = new IncrementalSearch(); + }, + + "test: keyboard handler setup" : function() { + iSearch.activate(editor); + assert.equal(editor.getKeyboardHandler(), iSearch.$keyboardHandler); + iSearch.deactivate(); + assert.notEqual(editor.getKeyboardHandler(), iSearch.$keyboardHandler); + }, + + "test: isearch highlight setup" : function() { + var sess = editor.session; + iSearch.activate(editor); + iSearch.highlight('foo'); + var highl = sess.$isearchHighlight.id; + assert.ok(sess.$isearchHighlight, 'session has no isearch highlighter'); + assert.equal(sess.getMarkers()[highl.id], highl.id, 'isearch highlight not in markers'); + iSearch.deactivate(); + iSearch.activate(editor); + iSearch.highlight('bar'); + var highl2 = sess.$isearchHighlight.id; + assert.equal(highl2, highl, 'multiple isearch highlights'); + }, + + "test: find simple text incrementally" : function() { + iSearch.activate(editor); + var range = iSearch.addChar('1'), // "1" + highlightRanges = callHighlighterUpdate(editor.session); + testRanges("Range: [0/3] -> [0/4]", [range], "range"); + testRanges("Range: [0/3] -> [0/4],Range: [1/3] -> [1/4]", highlightRanges, "highlight"); + + range = iSearch.addChar('2'); // "12" + highlightRanges = callHighlighterUpdate(editor.session); + testRanges("Range: [0/3] -> [0/5]", [range], "range"); + testRanges("Range: [0/3] -> [0/5],Range: [1/3] -> [1/5]", highlightRanges, "highlight"); + + range = iSearch.addChar('3'); // "123" + highlightRanges = callHighlighterUpdate(editor.session); + testRanges("Range: [0/3] -> [0/6]", [range], "range"); + testRanges("Range: [0/3] -> [0/6]", highlightRanges, "highlight"); + + range = iSearch.removeChar(); // "12" + highlightRanges = callHighlighterUpdate(editor.session); + testRanges("Range: [0/3] -> [0/5]", [range], "range"); + testRanges("Range: [0/3] -> [0/5],Range: [1/3] -> [1/5]", highlightRanges, "highlight"); + }, + + "test: forward / backward" : function() { + iSearch.activate(editor); + iSearch.addChar('1'); iSearch.addChar('2'); + var range = iSearch.next(); + testRanges("Range: [1/3] -> [1/5]", [range], "range"); + + range = iSearch.next(); // nothing to find + testRanges("", [range], "range"); + + range = iSearch.next({backwards: true}); // backwards + testRanges("Range: [1/5] -> [1/3]", [range], "range"); + }, + + "test: cancelSearch" : function() { + iSearch.activate(editor); + iSearch.addChar('1'); iSearch.addChar('2'); + var range = iSearch.cancelSearch(true); + testRanges("Range: [0/0] -> [0/0]", [range], "range"); + + iSearch.addChar('1'); range = iSearch.addChar('2'); + testRanges("Range: [0/3] -> [0/5]", [range], "range"); + }, + + "test: failing search keeps pos" : function() { + iSearch.activate(editor); + iSearch.addChar('1'); iSearch.addChar('2'); + var range = iSearch.addChar('x'); + testRanges("", [range], "range"); + assert.position(editor.getCursorPosition(), 0, 5); + }, + + "test: backwards search" : function() { + editor.moveCursorTo(1,0); + iSearch.activate(editor, true); + iSearch.addChar('1'); var range = iSearch.addChar('2');; + testRanges("Range: [0/5] -> [0/3]", [range], "range"); + assert.position(editor.getCursorPosition(), 0, 3); + }, + + "test: forwards then backwards, same result, reoriented range" : function() { + iSearch.activate(editor); + iSearch.addChar('1'); var range = iSearch.addChar('2');; + testRanges("Range: [0/3] -> [0/5]", [range], "range"); + assert.position(editor.getCursorPosition(), 0, 5); + + range = iSearch.next({backwards: true}); + testRanges("Range: [0/5] -> [0/3]", [range], "range"); + assert.position(editor.getCursorPosition(), 0, 3); + }, + + "test: reuse prev search via option" : function() { + iSearch.activate(editor); + iSearch.addChar('1'); iSearch.addChar('2');; + assert.position(editor.getCursorPosition(), 0, 5); + iSearch.deactivate(); + + iSearch.activate(editor); + iSearch.next({backwards: false, useCurrentOrPrevSearch: true}); + assert.position(editor.getCursorPosition(), 1, 5); + }, + + "test: don't extend selection range if selection is empty" : function() { + iSearch.activate(editor); + iSearch.addChar('1'); iSearch.addChar('2');; + testRanges("Range: [0/5] -> [0/5]", [editor.getSelectionRange()], "sel range"); + }, + + "test: extend selection range if selection exists" : function() { + iSearch.activate(editor); + editor.selection.selectTo(0, 1); + iSearch.addChar('1'); iSearch.addChar('2');; + testRanges("Range: [0/0] -> [0/5]", [editor.getSelectionRange()], "sel range"); + }, + + "test: extend selection in emacs mark mode" : function() { + var emacs = require('./keyboard/emacs'); + editor.keyBinding.addKeyboardHandler(emacs.handler); + emacs.handler.commands.setMark.exec(editor); + iSearch.activate(editor); + iSearch.addChar('1'); iSearch.addChar('2');; + testRanges("Range: [0/0] -> [0/5]", [editor.getSelectionRange()], "sel range"); + } + +}; + +}); + +if (typeof module !== "undefined" && module === require.main) { + require("asyncjs").test.testcase(module.exports).exec() +} diff --git a/addons/editor/ace/keybinding-vim.js b/addons/editor/ace/keybinding-vim.js deleted file mode 100644 index 50b81ddb..00000000 --- a/addons/editor/ace/keybinding-vim.js +++ /dev/null @@ -1,1759 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2010, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/keyboard/vim', ['require', 'exports', 'module' , 'ace/keyboard/vim/commands', 'ace/keyboard/vim/maps/util', 'ace/lib/useragent'], function(require, exports, module) { - - -var cmds = require("./vim/commands"); -var coreCommands = cmds.coreCommands; -var util = require("./vim/maps/util"); -var useragent = require("../lib/useragent"); - -var startCommands = { - "i": { - command: coreCommands.start - }, - "I": { - command: coreCommands.startBeginning - }, - "a": { - command: coreCommands.append - }, - "A": { - command: coreCommands.appendEnd - }, - "ctrl-f": { - command: "gotopagedown" - }, - "ctrl-b": { - command: "gotopageup" - } -}; - -exports.handler = { - $id: "ace/keyboard/vim", - handleMacRepeat: function(data, hashId, key) { - if (hashId == -1) { - data.inputChar = key; - data.lastEvent = "input"; - } else if (data.inputChar && data.$lastHash == hashId && data.$lastKey == key) { - if (data.lastEvent == "input") { - data.lastEvent = "input1"; - } else if (data.lastEvent == "input1") { - return true; - } - } else { - data.$lastHash = hashId; - data.$lastKey = key; - data.lastEvent = "keypress"; - } - }, - updateMacCompositionHandlers: function(editor, enable) { - var onCompositionUpdateOverride = function(text) { - if (util.currentMode !== "insert") { - var el = this.textInput.getElement(); - el.blur(); - el.focus(); - el.value = text; - } else { - this.onCompositionUpdateOrig(text); - } - }; - var onCompositionStartOverride = function(text) { - if (util.currentMode === "insert") { - this.onCompositionStartOrig(text); - } - } - if (enable) { - if (!editor.onCompositionUpdateOrig) { - editor.onCompositionUpdateOrig = editor.onCompositionUpdate; - editor.onCompositionUpdate = onCompositionUpdateOverride; - editor.onCompositionStartOrig = editor.onCompositionStart; - editor.onCompositionStart = onCompositionStartOverride; - } - } else { - if (editor.onCompositionUpdateOrig) { - editor.onCompositionUpdate = editor.onCompositionUpdateOrig; - editor.onCompositionUpdateOrig = null; - editor.onCompositionStart = editor.onCompositionStartOrig; - editor.onCompositionStartOrig = null; - } - } - }, - - handleKeyboard: function(data, hashId, key, keyCode, e) { - if (hashId != 0 && (key == "" || key == "\x00")) - return null; - - var editor = data.editor; - - if (hashId == 1) - key = "ctrl-" + key; - if (key == "ctrl-c") { - if (!useragent.isMac && editor.getCopyText()) { - editor.once("copy", function() { - if (data.state == "start") - coreCommands.stop.exec(editor); - else - editor.selection.clearSelection(); - }); - return {command: "null", passEvent: true}; - } - return {command: coreCommands.stop}; - } else if ((key == "esc" && hashId == 0) || key == "ctrl-[") { - return {command: coreCommands.stop}; - } else if (data.state == "start") { - if (useragent.isMac && this.handleMacRepeat(data, hashId, key)) { - hashId = -1; - key = data.inputChar; - } - - if (hashId == -1 || hashId == 1 || hashId == 0 && key.length > 1) { - if (cmds.inputBuffer.idle && startCommands[key]) - return startCommands[key]; - cmds.inputBuffer.push(editor, key); - return {command: "null", passEvent: false}; - } // if no modifier || shift: wait for input. - else if (key.length == 1 && (hashId == 0 || hashId == 4)) { - return {command: "null", passEvent: true}; - } else if (key == "esc" && hashId == 0) { - return {command: coreCommands.stop}; - } - } else { - if (key == "ctrl-w") { - return {command: "removewordleft"}; - } - } - }, - - attach: function(editor) { - editor.on("click", exports.onCursorMove); - if (util.currentMode !== "insert") - cmds.coreCommands.stop.exec(editor); - editor.$vimModeHandler = this; - - this.updateMacCompositionHandlers(editor, true); - }, - - detach: function(editor) { - editor.removeListener("click", exports.onCursorMove); - util.noMode(editor); - util.currentMode = "normal"; - this.updateMacCompositionHandlers(editor, false); - }, - - actions: cmds.actions, - getStatusText: function() { - if (util.currentMode == "insert") - return "INSERT"; - if (util.onVisualMode) - return (util.onVisualLineMode ? "VISUAL LINE " : "VISUAL ") + cmds.inputBuffer.status; - return cmds.inputBuffer.status; - } -}; - - -exports.onCursorMove = function(e) { - cmds.onCursorMove(e.editor, e); - exports.onCursorMove.scheduled = false; -}; - -}); - -define('ace/keyboard/vim/commands', ['require', 'exports', 'module' , 'ace/lib/lang', 'ace/keyboard/vim/maps/util', 'ace/keyboard/vim/maps/motions', 'ace/keyboard/vim/maps/operators', 'ace/keyboard/vim/maps/aliases', 'ace/keyboard/vim/registers'], function(require, exports, module) { - -"never use strict"; - -var lang = require("../../lib/lang"); -var util = require("./maps/util"); -var motions = require("./maps/motions"); -var operators = require("./maps/operators"); -var alias = require("./maps/aliases"); -var registers = require("./registers"); - -var NUMBER = 1; -var OPERATOR = 2; -var MOTION = 3; -var ACTION = 4; -var HMARGIN = 8; // Minimum amount of line separation between margins; - -var repeat = function repeat(fn, count, args) { - while (0 < count--) - fn.apply(this, args); -}; - -var ensureScrollMargin = function(editor) { - var renderer = editor.renderer; - var pos = renderer.$cursorLayer.getPixelPosition(); - - var top = pos.top; - - var margin = HMARGIN * renderer.layerConfig.lineHeight; - if (2 * margin > renderer.$size.scrollerHeight) - margin = renderer.$size.scrollerHeight / 2; - - if (renderer.scrollTop > top - margin) { - renderer.session.setScrollTop(top - margin); - } - - if (renderer.scrollTop + renderer.$size.scrollerHeight < top + margin + renderer.lineHeight) { - renderer.session.setScrollTop(top + margin + renderer.lineHeight - renderer.$size.scrollerHeight); - } -}; - -var actions = exports.actions = { - "z": { - param: true, - fn: function(editor, range, count, param) { - switch (param) { - case "z": - editor.renderer.alignCursor(null, 0.5); - break; - case "t": - editor.renderer.alignCursor(null, 0); - break; - case "b": - editor.renderer.alignCursor(null, 1); - break; - case "c": - editor.session.onFoldWidgetClick(range.start.row, {domEvent:{target :{}}}); - break; - case "o": - editor.session.onFoldWidgetClick(range.start.row, {domEvent:{target :{}}}); - break; - case "C": - editor.session.foldAll(); - break; - case "O": - editor.session.unfold(); - break; - } - } - }, - "r": { - param: true, - fn: function(editor, range, count, param) { - if (param && param.length) { - if (param.length > 1) - param = param == "return" ? "\n" : param == "tab" ? "\t" : param; - repeat(function() { editor.insert(param); }, count || 1); - editor.navigateLeft(); - } - } - }, - "R": { - fn: function(editor, range, count, param) { - util.insertMode(editor); - editor.setOverwrite(true); - } - }, - "~": { - fn: function(editor, range, count) { - repeat(function() { - var range = editor.selection.getRange(); - if (range.isEmpty()) - range.end.column++; - var text = editor.session.getTextRange(range); - var toggled = text.toUpperCase(); - if (toggled == text) - editor.navigateRight(); - else - editor.session.replace(range, toggled); - }, count || 1); - } - }, - "*": { - fn: function(editor, range, count, param) { - editor.selection.selectWord(); - editor.findNext(); - ensureScrollMargin(editor); - var r = editor.selection.getRange(); - editor.selection.setSelectionRange(r, true); - } - }, - "#": { - fn: function(editor, range, count, param) { - editor.selection.selectWord(); - editor.findPrevious(); - ensureScrollMargin(editor); - var r = editor.selection.getRange(); - editor.selection.setSelectionRange(r, true); - } - }, - "m": { - param: true, - fn: function(editor, range, count, param) { - var s = editor.session; - var markers = s.vimMarkers || (s.vimMarkers = {}); - var c = editor.getCursorPosition(); - if (!markers[param]) { - markers[param] = editor.session.doc.createAnchor(c); - } - markers[param].setPosition(c.row, c.column, true); - } - }, - "n": { - fn: function(editor, range, count, param) { - var options = editor.getLastSearchOptions(); - options.backwards = false; - - editor.selection.moveCursorRight(); - editor.selection.clearSelection(); - editor.findNext(options); - - ensureScrollMargin(editor); - var r = editor.selection.getRange(); - r.end.row = r.start.row; - r.end.column = r.start.column; - editor.selection.setSelectionRange(r, true); - } - }, - "N": { - fn: function(editor, range, count, param) { - var options = editor.getLastSearchOptions(); - options.backwards = true; - - editor.findPrevious(options); - ensureScrollMargin(editor); - var r = editor.selection.getRange(); - r.end.row = r.start.row; - r.end.column = r.start.column; - editor.selection.setSelectionRange(r, true); - } - }, - "v": { - fn: function(editor, range, count, param) { - editor.selection.selectRight(); - util.visualMode(editor, false); - }, - acceptsMotion: true - }, - "V": { - fn: function(editor, range, count, param) { - var row = editor.getCursorPosition().row; - editor.selection.clearSelection(); - editor.selection.moveCursorTo(row, 0); - editor.selection.selectLineEnd(); - editor.selection.visualLineStart = row; - - util.visualMode(editor, true); - }, - acceptsMotion: true - }, - "Y": { - fn: function(editor, range, count, param) { - util.copyLine(editor); - } - }, - "p": { - fn: function(editor, range, count, param) { - var defaultReg = registers._default; - - editor.setOverwrite(false); - if (defaultReg.isLine) { - var pos = editor.getCursorPosition(); - pos.column = editor.session.getLine(pos.row).length; - var text = lang.stringRepeat("\n" + defaultReg.text, count || 1); - editor.session.insert(pos, text); - editor.moveCursorTo(pos.row + 1, 0); - } - else { - editor.navigateRight(); - editor.insert(lang.stringRepeat(defaultReg.text, count || 1)); - editor.navigateLeft(); - } - editor.setOverwrite(true); - editor.selection.clearSelection(); - } - }, - "P": { - fn: function(editor, range, count, param) { - var defaultReg = registers._default; - editor.setOverwrite(false); - - if (defaultReg.isLine) { - var pos = editor.getCursorPosition(); - pos.column = 0; - var text = lang.stringRepeat(defaultReg.text + "\n", count || 1); - editor.session.insert(pos, text); - editor.moveCursorToPosition(pos); - } - else { - editor.insert(lang.stringRepeat(defaultReg.text, count || 1)); - } - editor.setOverwrite(true); - editor.selection.clearSelection(); - } - }, - "J": { - fn: function(editor, range, count, param) { - var session = editor.session; - range = editor.getSelectionRange(); - var pos = {row: range.start.row, column: range.start.column}; - count = count || range.end.row - range.start.row; - var maxRow = Math.min(pos.row + (count || 1), session.getLength() - 1); - - range.start.column = session.getLine(pos.row).length; - range.end.column = session.getLine(maxRow).length; - range.end.row = maxRow; - - var text = ""; - for (var i = pos.row; i < maxRow; i++) { - var nextLine = session.getLine(i + 1); - text += " " + /^\s*(.*)$/.exec(nextLine)[1] || ""; - } - - session.replace(range, text); - editor.moveCursorTo(pos.row, pos.column); - } - }, - "u": { - fn: function(editor, range, count, param) { - count = parseInt(count || 1, 10); - for (var i = 0; i < count; i++) { - editor.undo(); - } - editor.selection.clearSelection(); - } - }, - "ctrl-r": { - fn: function(editor, range, count, param) { - count = parseInt(count || 1, 10); - for (var i = 0; i < count; i++) { - editor.redo(); - } - editor.selection.clearSelection(); - } - }, - ":": { - fn: function(editor, range, count, param) { - var val = ":"; - if (count > 1) - val = ".,.+" + count + val; - if (editor.showCommandLine) - editor.showCommandLine(val); - } - }, - "/": { - fn: function(editor, range, count, param) { - if (editor.showCommandLine) - editor.showCommandLine("/"); - } - }, - "?": { - fn: function(editor, range, count, param) { - if (editor.showCommandLine) - editor.showCommandLine("?"); - } - }, - ".": { - fn: function(editor, range, count, param) { - util.onInsertReplaySequence = inputBuffer.lastInsertCommands; - var previous = inputBuffer.previous; - if (previous) // If there is a previous action - inputBuffer.exec(editor, previous.action, previous.param); - } - }, - "ctrl-x": { - fn: function(editor, range, count, param) { - editor.modifyNumber(-(count || 1)); - } - }, - "ctrl-a": { - fn: function(editor, range, count, param) { - editor.modifyNumber(count || 1); - } - } -}; - -var inputBuffer = exports.inputBuffer = { - accepting: [NUMBER, OPERATOR, MOTION, ACTION], - currentCmd: null, - currentCount: "", - status: "", - operator: null, - motion: null, - - lastInsertCommands: [], - - push: function(editor, ch, keyId) { - var status = this.status; - var isKeyHandled = true; - this.idle = false; - var wObj = this.waitingForParam; - if (/^numpad\d+$/i.test(ch)) - ch = ch.substr(6); - - if (wObj) { - this.exec(editor, wObj, ch); - } - else if (!(ch === "0" && !this.currentCount.length) && - (/^\d+$/.test(ch) && this.isAccepting(NUMBER))) { - this.currentCount += ch; - this.currentCmd = NUMBER; - this.accepting = [NUMBER, OPERATOR, MOTION, ACTION]; - } - else if (!this.operator && this.isAccepting(OPERATOR) && operators[ch]) { - this.operator = { - ch: ch, - count: this.getCount() - }; - this.currentCmd = OPERATOR; - this.accepting = [NUMBER, MOTION, ACTION]; - this.exec(editor, { operator: this.operator }); - } - else if (motions[ch] && this.isAccepting(MOTION)) { - this.currentCmd = MOTION; - - var ctx = { - operator: this.operator, - motion: { - ch: ch, - count: this.getCount() - } - }; - - if (motions[ch].param) - this.waitForParam(ctx); - else - this.exec(editor, ctx); - } - else if (alias[ch] && this.isAccepting(MOTION)) { - alias[ch].operator.count = this.getCount(); - this.exec(editor, alias[ch]); - } - else if (actions[ch] && this.isAccepting(ACTION)) { - var actionObj = { - action: { - fn: actions[ch].fn, - count: this.getCount() - } - }; - - if (actions[ch].param) { - this.waitForParam(actionObj); - } - else { - this.exec(editor, actionObj); - } - - if (actions[ch].acceptsMotion) - this.idle = false; - } - else if (this.operator) { - this.operator.count = this.getCount(); - this.exec(editor, { operator: this.operator }, ch); - } - else { - isKeyHandled = ch.length == 1; - this.reset(); - } - - if (this.waitingForParam || this.motion || this.operator) { - this.status += ch; - } else if (this.currentCount) { - this.status = this.currentCount; - } else if (this.status) { - this.status = ""; - } - if (this.status != status) - editor._emit("changeStatus"); - return isKeyHandled; - }, - - waitForParam: function(cmd) { - this.waitingForParam = cmd; - }, - - getCount: function() { - var count = this.currentCount; - this.currentCount = ""; - return count && parseInt(count, 10); - }, - - exec: function(editor, action, param) { - var m = action.motion; - var o = action.operator; - var a = action.action; - - if (!param) - param = action.param; - - if (o) { - this.previous = { - action: action, - param: param - }; - } - - if (o && !editor.selection.isEmpty()) { - if (operators[o.ch].selFn) { - operators[o.ch].selFn(editor, editor.getSelectionRange(), o.count, param); - this.reset(); - } - return; - } - else if (!m && !a && o && param) { - operators[o.ch].fn(editor, null, o.count, param); - this.reset(); - } - else if (m) { - var run = function(fn) { - if (fn && typeof fn === "function") { // There should always be a motion - if (m.count && !motionObj.handlesCount) - repeat(fn, m.count, [editor, null, m.count, param]); - else - fn(editor, null, m.count, param); - } - }; - - var motionObj = motions[m.ch]; - var selectable = motionObj.sel; - - if (!o) { - if ((util.onVisualMode || util.onVisualLineMode) && selectable) - run(motionObj.sel); - else - run(motionObj.nav); - } - else if (selectable) { - repeat(function() { - run(motionObj.sel); - operators[o.ch].fn(editor, editor.getSelectionRange(), o.count, param); - }, o.count || 1); - } - this.reset(); - } - else if (a) { - a.fn(editor, editor.getSelectionRange(), a.count, param); - this.reset(); - } - handleCursorMove(editor); - }, - - isAccepting: function(type) { - return this.accepting.indexOf(type) !== -1; - }, - - reset: function() { - this.operator = null; - this.motion = null; - this.currentCount = ""; - this.status = ""; - this.accepting = [NUMBER, OPERATOR, MOTION, ACTION]; - this.idle = true; - this.waitingForParam = null; - } -}; - -function setPreviousCommand(fn) { - inputBuffer.previous = { action: { action: { fn: fn } } }; -} - -exports.coreCommands = { - start: { - exec: function start(editor) { - util.insertMode(editor); - setPreviousCommand(start); - } - }, - startBeginning: { - exec: function startBeginning(editor) { - editor.navigateLineStart(); - util.insertMode(editor); - setPreviousCommand(startBeginning); - } - }, - stop: { - exec: function stop(editor) { - inputBuffer.reset(); - util.onVisualMode = false; - util.onVisualLineMode = false; - inputBuffer.lastInsertCommands = util.normalMode(editor); - } - }, - append: { - exec: function append(editor) { - var pos = editor.getCursorPosition(); - var lineLen = editor.session.getLine(pos.row).length; - if (lineLen) - editor.navigateRight(); - util.insertMode(editor); - setPreviousCommand(append); - } - }, - appendEnd: { - exec: function appendEnd(editor) { - editor.navigateLineEnd(); - util.insertMode(editor); - setPreviousCommand(appendEnd); - } - } -}; - -var handleCursorMove = exports.onCursorMove = function(editor, e) { - if (util.currentMode === 'insert' || handleCursorMove.running) - return; - else if(!editor.selection.isEmpty()) { - handleCursorMove.running = true; - if (util.onVisualLineMode) { - var originRow = editor.selection.visualLineStart; - var cursorRow = editor.getCursorPosition().row; - if(originRow <= cursorRow) { - var endLine = editor.session.getLine(cursorRow); - editor.selection.clearSelection(); - editor.selection.moveCursorTo(originRow, 0); - editor.selection.selectTo(cursorRow, endLine.length); - } else { - var endLine = editor.session.getLine(originRow); - editor.selection.clearSelection(); - editor.selection.moveCursorTo(originRow, endLine.length); - editor.selection.selectTo(cursorRow, 0); - } - } - handleCursorMove.running = false; - return; - } - else { - if (e && (util.onVisualLineMode || util.onVisualMode)) { - editor.selection.clearSelection(); - util.normalMode(editor); - } - - handleCursorMove.running = true; - var pos = editor.getCursorPosition(); - var lineLen = editor.session.getLine(pos.row).length; - - if (lineLen && pos.column === lineLen) - editor.navigateLeft(); - handleCursorMove.running = false; - } -}; -}); -define('ace/keyboard/vim/maps/util', ['require', 'exports', 'module' , 'ace/keyboard/vim/registers', 'ace/lib/dom'], function(require, exports, module) { -var registers = require("../registers"); - -var dom = require("../../../lib/dom"); -dom.importCssString('.insert-mode .ace_cursor{\ - border-left: 2px solid #333333;\ -}\ -.ace_dark.insert-mode .ace_cursor{\ - border-left: 2px solid #eeeeee;\ -}\ -.normal-mode .ace_cursor{\ - border: 0!important;\ - background-color: red;\ - opacity: 0.5;\ -}', 'vimMode'); - -module.exports = { - onVisualMode: false, - onVisualLineMode: false, - currentMode: 'normal', - noMode: function(editor) { - editor.unsetStyle('insert-mode'); - editor.unsetStyle('normal-mode'); - if (editor.commands.recording) - editor.commands.toggleRecording(editor); - editor.setOverwrite(false); - }, - insertMode: function(editor) { - this.currentMode = 'insert'; - editor.setStyle('insert-mode'); - editor.unsetStyle('normal-mode'); - - editor.setOverwrite(false); - editor.keyBinding.$data.buffer = ""; - editor.keyBinding.$data.state = "insertMode"; - this.onVisualMode = false; - this.onVisualLineMode = false; - if(this.onInsertReplaySequence) { - editor.commands.macro = this.onInsertReplaySequence; - editor.commands.replay(editor); - this.onInsertReplaySequence = null; - this.normalMode(editor); - } else { - editor._emit("changeStatus"); - if(!editor.commands.recording) - editor.commands.toggleRecording(editor); - } - }, - normalMode: function(editor) { - this.currentMode = 'normal'; - - editor.unsetStyle('insert-mode'); - editor.setStyle('normal-mode'); - editor.clearSelection(); - - var pos; - if (!editor.getOverwrite()) { - pos = editor.getCursorPosition(); - if (pos.column > 0) - editor.navigateLeft(); - } - - editor.setOverwrite(true); - editor.keyBinding.$data.buffer = ""; - editor.keyBinding.$data.state = "start"; - this.onVisualMode = false; - this.onVisualLineMode = false; - editor._emit("changeStatus"); - if (editor.commands.recording) { - editor.commands.toggleRecording(editor); - return editor.commands.macro; - } - else { - return []; - } - }, - visualMode: function(editor, lineMode) { - if ( - (this.onVisualLineMode && lineMode) - || (this.onVisualMode && !lineMode) - ) { - this.normalMode(editor); - return; - } - - editor.setStyle('insert-mode'); - editor.unsetStyle('normal-mode'); - - editor._emit("changeStatus"); - if (lineMode) { - this.onVisualLineMode = true; - } else { - this.onVisualMode = true; - this.onVisualLineMode = false; - } - }, - getRightNthChar: function(editor, cursor, ch, n) { - var line = editor.getSession().getLine(cursor.row); - var matches = line.substr(cursor.column + 1).split(ch); - - return n < matches.length ? matches.slice(0, n).join(ch).length : null; - }, - getLeftNthChar: function(editor, cursor, ch, n) { - var line = editor.getSession().getLine(cursor.row); - var matches = line.substr(0, cursor.column).split(ch); - - return n < matches.length ? matches.slice(-1 * n).join(ch).length : null; - }, - toRealChar: function(ch) { - if (ch.length === 1) - return ch; - - if (/^shift-./.test(ch)) - return ch[ch.length - 1].toUpperCase(); - else - return ""; - }, - copyLine: function(editor) { - var pos = editor.getCursorPosition(); - editor.selection.clearSelection(); - editor.moveCursorTo(pos.row, pos.column); - editor.selection.selectLine(); - registers._default.isLine = true; - registers._default.text = editor.getCopyText().replace(/\n$/, ""); - editor.selection.clearSelection(); - editor.moveCursorTo(pos.row, pos.column); - } -}; -}); - -define('ace/keyboard/vim/registers', ['require', 'exports', 'module' ], function(require, exports, module) { - -"never use strict"; - -module.exports = { - _default: { - text: "", - isLine: false - } -}; - -}); - - -define('ace/keyboard/vim/maps/motions', ['require', 'exports', 'module' , 'ace/keyboard/vim/maps/util', 'ace/search', 'ace/range'], function(require, exports, module) { - - -var util = require("./util"); - -var keepScrollPosition = function(editor, fn) { - var scrollTopRow = editor.renderer.getScrollTopRow(); - var initialRow = editor.getCursorPosition().row; - var diff = initialRow - scrollTopRow; - fn && fn.call(editor); - editor.renderer.scrollToRow(editor.getCursorPosition().row - diff); -}; - -function Motion(m) { - if (typeof m == "function") { - var getPos = m; - m = this; - } else { - var getPos = m.getPos; - } - m.nav = function(editor, range, count, param) { - var a = getPos(editor, range, count, param, false); - if (!a) - return; - editor.clearSelection(); - editor.moveCursorTo(a.row, a.column); - }; - m.sel = function(editor, range, count, param) { - var a = getPos(editor, range, count, param, true); - if (!a) - return; - editor.selection.selectTo(a.row, a.column); - }; - return m; -} - -var nonWordRe = /[\s.\/\\()\"'-:,.;<>~!@#$%^&*|+=\[\]{}`~?]/; -var wordSeparatorRe = /[.\/\\()\"'-:,.;<>~!@#$%^&*|+=\[\]{}`~?]/; -var whiteRe = /\s/; -var StringStream = function(editor, cursor) { - var sel = editor.selection; - this.range = sel.getRange(); - cursor = cursor || sel.selectionLead; - this.row = cursor.row; - this.col = cursor.column; - var line = editor.session.getLine(this.row); - var maxRow = editor.session.getLength(); - this.ch = line[this.col] || '\n'; - this.skippedLines = 0; - - this.next = function() { - this.ch = line[++this.col] || this.handleNewLine(1); - return this.ch; - }; - this.prev = function() { - this.ch = line[--this.col] || this.handleNewLine(-1); - return this.ch; - }; - this.peek = function(dir) { - var ch = line[this.col + dir]; - if (ch) - return ch; - if (dir == -1) - return '\n'; - if (this.col == line.length - 1) - return '\n'; - return editor.session.getLine(this.row + 1)[0] || '\n'; - }; - - this.handleNewLine = function(dir) { - if (dir == 1){ - if (this.col == line.length) - return '\n'; - if (this.row == maxRow - 1) - return ''; - this.col = 0; - this.row ++; - line = editor.session.getLine(this.row); - this.skippedLines++; - return line[0] || '\n'; - } - if (dir == -1) { - if (this.row === 0) - return ''; - this.row --; - line = editor.session.getLine(this.row); - this.col = line.length; - this.skippedLines--; - return '\n'; - } - }; - this.debug = function() { - console.log(line.substring(0, this.col)+'|'+this.ch+'\''+this.col+'\''+line.substr(this.col+1)); - }; -}; - -var Search = require("../../../search").Search; -var search = new Search(); - -function find(editor, needle, dir) { - search.$options.needle = needle; - search.$options.backwards = dir == -1; - return search.find(editor.session); -} - -var Range = require("../../../range").Range; - -var LAST_SEARCH_MOTION = {}; - -module.exports = { - "w": new Motion(function(editor) { - var str = new StringStream(editor); - - if (str.ch && wordSeparatorRe.test(str.ch)) { - while (str.ch && wordSeparatorRe.test(str.ch)) - str.next(); - } else { - while (str.ch && !nonWordRe.test(str.ch)) - str.next(); - } - while (str.ch && whiteRe.test(str.ch) && str.skippedLines < 2) - str.next(); - - str.skippedLines == 2 && str.prev(); - return {column: str.col, row: str.row}; - }), - "W": new Motion(function(editor) { - var str = new StringStream(editor); - while(str.ch && !(whiteRe.test(str.ch) && !whiteRe.test(str.peek(1))) && str.skippedLines < 2) - str.next(); - if (str.skippedLines == 2) - str.prev(); - else - str.next(); - - return {column: str.col, row: str.row}; - }), - "b": new Motion(function(editor) { - var str = new StringStream(editor); - - str.prev(); - while (str.ch && whiteRe.test(str.ch) && str.skippedLines > -2) - str.prev(); - - if (str.ch && wordSeparatorRe.test(str.ch)) { - while (str.ch && wordSeparatorRe.test(str.ch)) - str.prev(); - } else { - while (str.ch && !nonWordRe.test(str.ch)) - str.prev(); - } - str.ch && str.next(); - return {column: str.col, row: str.row}; - }), - "B": new Motion(function(editor) { - var str = new StringStream(editor); - str.prev(); - while(str.ch && !(!whiteRe.test(str.ch) && whiteRe.test(str.peek(-1))) && str.skippedLines > -2) - str.prev(); - - if (str.skippedLines == -2) - str.next(); - - return {column: str.col, row: str.row}; - }), - "e": new Motion(function(editor) { - var str = new StringStream(editor); - - str.next(); - while (str.ch && whiteRe.test(str.ch)) - str.next(); - - if (str.ch && wordSeparatorRe.test(str.ch)) { - while (str.ch && wordSeparatorRe.test(str.ch)) - str.next(); - } else { - while (str.ch && !nonWordRe.test(str.ch)) - str.next(); - } - str.ch && str.prev(); - return {column: str.col, row: str.row}; - }), - "E": new Motion(function(editor) { - var str = new StringStream(editor); - str.next(); - while(str.ch && !(!whiteRe.test(str.ch) && whiteRe.test(str.peek(1)))) - str.next(); - - return {column: str.col, row: str.row}; - }), - - "l": { - nav: function(editor) { - var pos = editor.getCursorPosition(); - var col = pos.column; - var lineLen = editor.session.getLine(pos.row).length; - if (lineLen && col !== lineLen) - editor.navigateRight(); - }, - sel: function(editor) { - var pos = editor.getCursorPosition(); - var col = pos.column; - var lineLen = editor.session.getLine(pos.row).length; - if (lineLen && col !== lineLen) //In selection mode you can select the newline - editor.selection.selectRight(); - } - }, - "h": { - nav: function(editor) { - var pos = editor.getCursorPosition(); - if (pos.column > 0) - editor.navigateLeft(); - }, - sel: function(editor) { - var pos = editor.getCursorPosition(); - if (pos.column > 0) - editor.selection.selectLeft(); - } - }, - "H": { - nav: function(editor) { - var row = editor.renderer.getScrollTopRow(); - editor.moveCursorTo(row); - }, - sel: function(editor) { - var row = editor.renderer.getScrollTopRow(); - editor.selection.selectTo(row); - } - }, - "M": { - nav: function(editor) { - var topRow = editor.renderer.getScrollTopRow(); - var bottomRow = editor.renderer.getScrollBottomRow(); - var row = topRow + ((bottomRow - topRow) / 2); - editor.moveCursorTo(row); - }, - sel: function(editor) { - var topRow = editor.renderer.getScrollTopRow(); - var bottomRow = editor.renderer.getScrollBottomRow(); - var row = topRow + ((bottomRow - topRow) / 2); - editor.selection.selectTo(row); - } - }, - "L": { - nav: function(editor) { - var row = editor.renderer.getScrollBottomRow(); - editor.moveCursorTo(row); - }, - sel: function(editor) { - var row = editor.renderer.getScrollBottomRow(); - editor.selection.selectTo(row); - } - }, - "k": { - nav: function(editor) { - editor.navigateUp(); - }, - sel: function(editor) { - editor.selection.selectUp(); - } - }, - "j": { - nav: function(editor) { - editor.navigateDown(); - }, - sel: function(editor) { - editor.selection.selectDown(); - } - }, - - "i": { - param: true, - sel: function(editor, range, count, param) { - switch (param) { - case "w": - editor.selection.selectWord(); - break; - case "W": - editor.selection.selectAWord(); - break; - case "(": - case "{": - case "[": - var cursor = editor.getCursorPosition(); - var end = editor.session.$findClosingBracket(param, cursor, /paren/); - if (!end) - return; - var start = editor.session.$findOpeningBracket(editor.session.$brackets[param], cursor, /paren/); - if (!start) - return; - start.column ++; - editor.selection.setSelectionRange(Range.fromPoints(start, end)); - break; - case "'": - case '"': - case "/": - var end = find(editor, param, 1); - if (!end) - return; - var start = find(editor, param, -1); - if (!start) - return; - editor.selection.setSelectionRange(Range.fromPoints(start.end, end.start)); - break; - } - } - }, - "a": { - param: true, - sel: function(editor, range, count, param) { - switch (param) { - case "w": - editor.selection.selectAWord(); - break; - case "W": - editor.selection.selectAWord(); - break; - case "(": - case "{": - case "[": - var cursor = editor.getCursorPosition(); - var end = editor.session.$findClosingBracket(param, cursor, /paren/); - if (!end) - return; - var start = editor.session.$findOpeningBracket(editor.session.$brackets[param], cursor, /paren/); - if (!start) - return; - end.column ++; - editor.selection.setSelectionRange(Range.fromPoints(start, end)); - break; - case "'": - case "\"": - case "/": - var end = find(editor, param, 1); - if (!end) - return; - var start = find(editor, param, -1); - if (!start) - return; - end.column ++; - editor.selection.setSelectionRange(Range.fromPoints(start.start, end.end)); - break; - } - } - }, - - "f": new Motion({ - param: true, - handlesCount: true, - getPos: function(editor, range, count, param, isSel, isRepeat) { - if (!isRepeat) - LAST_SEARCH_MOTION = {ch: "f", param: param}; - var cursor = editor.getCursorPosition(); - var column = util.getRightNthChar(editor, cursor, param, count || 1); - - if (typeof column === "number") { - cursor.column += column + (isSel ? 2 : 1); - return cursor; - } - } - }), - "F": new Motion({ - param: true, - handlesCount: true, - getPos: function(editor, range, count, param, isSel, isRepeat) { - if (!isRepeat) - LAST_SEARCH_MOTION = {ch: "F", param: param}; - var cursor = editor.getCursorPosition(); - var column = util.getLeftNthChar(editor, cursor, param, count || 1); - - if (typeof column === "number") { - cursor.column -= column + 1; - return cursor; - } - } - }), - "t": new Motion({ - param: true, - handlesCount: true, - getPos: function(editor, range, count, param, isSel, isRepeat) { - if (!isRepeat) - LAST_SEARCH_MOTION = {ch: "t", param: param}; - var cursor = editor.getCursorPosition(); - var column = util.getRightNthChar(editor, cursor, param, count || 1); - - if (isRepeat && column == 0 && !(count > 1)) - var column = util.getRightNthChar(editor, cursor, param, 2); - - if (typeof column === "number") { - cursor.column += column + (isSel ? 1 : 0); - return cursor; - } - } - }), - "T": new Motion({ - param: true, - handlesCount: true, - getPos: function(editor, range, count, param, isSel, isRepeat) { - if (!isRepeat) - LAST_SEARCH_MOTION = {ch: "T", param: param}; - var cursor = editor.getCursorPosition(); - var column = util.getLeftNthChar(editor, cursor, param, count || 1); - - if (isRepeat && column == 0 && !(count > 1)) - var column = util.getLeftNthChar(editor, cursor, param, 2); - - if (typeof column === "number") { - cursor.column -= column; - return cursor; - } - } - }), - ";": new Motion({ - handlesCount: true, - getPos: function(editor, range, count, param, isSel) { - var ch = LAST_SEARCH_MOTION.ch; - if (!ch) - return; - return module.exports[ch].getPos( - editor, range, count, LAST_SEARCH_MOTION.param, isSel, true - ); - } - }), - ",": new Motion({ - handlesCount: true, - getPos: function(editor, range, count, param, isSel) { - var ch = LAST_SEARCH_MOTION.ch; - if (!ch) - return; - var up = ch.toUpperCase(); - ch = ch === up ? ch.toLowerCase() : up; - - return module.exports[ch].getPos( - editor, range, count, LAST_SEARCH_MOTION.param, isSel, true - ); - } - }), - - "^": { - nav: function(editor) { - editor.navigateLineStart(); - }, - sel: function(editor) { - editor.selection.selectLineStart(); - } - }, - "$": { - nav: function(editor) { - editor.navigateLineEnd(); - }, - sel: function(editor) { - editor.selection.selectLineEnd(); - } - }, - "0": new Motion(function(ed) { - return {row: ed.selection.lead.row, column: 0}; - }), - "G": { - nav: function(editor, range, count, param) { - if (!count && count !== 0) { // Stupid JS - count = editor.session.getLength(); - } - editor.gotoLine(count); - }, - sel: function(editor, range, count, param) { - if (!count && count !== 0) { // Stupid JS - count = editor.session.getLength(); - } - editor.selection.selectTo(count, 0); - } - }, - "g": { - param: true, - nav: function(editor, range, count, param) { - switch(param) { - case "m": - console.log("Middle line"); - break; - case "e": - console.log("End of prev word"); - break; - case "g": - editor.gotoLine(count || 0); - case "u": - editor.gotoLine(count || 0); - case "U": - editor.gotoLine(count || 0); - } - }, - sel: function(editor, range, count, param) { - switch(param) { - case "m": - console.log("Middle line"); - break; - case "e": - console.log("End of prev word"); - break; - case "g": - editor.selection.selectTo(count || 0, 0); - } - } - }, - "o": { - nav: function(editor, range, count, param) { - count = count || 1; - var content = ""; - while (0 < count--) - content += "\n"; - - if (content.length) { - editor.navigateLineEnd() - editor.insert(content); - util.insertMode(editor); - } - } - }, - "O": { - nav: function(editor, range, count, param) { - var row = editor.getCursorPosition().row; - count = count || 1; - var content = ""; - while (0 < count--) - content += "\n"; - - if (content.length) { - if(row > 0) { - editor.navigateUp(); - editor.navigateLineEnd() - editor.insert(content); - } else { - editor.session.insert({row: 0, column: 0}, content); - editor.navigateUp(); - } - util.insertMode(editor); - } - } - }, - "%": new Motion(function(editor){ - var brRe = /[\[\]{}()]/g; - var cursor = editor.getCursorPosition(); - var ch = editor.session.getLine(cursor.row)[cursor.column]; - if (!brRe.test(ch)) { - var range = find(editor, brRe); - if (!range) - return; - cursor = range.start; - } - var match = editor.session.findMatchingBracket({ - row: cursor.row, - column: cursor.column + 1 - }); - - return match; - }), - "{": new Motion(function(ed) { - var session = ed.session; - var row = session.selection.lead.row; - while(row > 0 && !/\S/.test(session.getLine(row))) - row--; - while(/\S/.test(session.getLine(row))) - row--; - return {column: 0, row: row}; - }), - "}": new Motion(function(ed) { - var session = ed.session; - var l = session.getLength(); - var row = session.selection.lead.row; - while(row < l && !/\S/.test(session.getLine(row))) - row++; - while(/\S/.test(session.getLine(row))) - row++; - return {column: 0, row: row}; - }), - "ctrl-d": { - nav: function(editor, range, count, param) { - editor.selection.clearSelection(); - keepScrollPosition(editor, editor.gotoPageDown); - }, - sel: function(editor, range, count, param) { - keepScrollPosition(editor, editor.selectPageDown); - } - }, - "ctrl-u": { - nav: function(editor, range, count, param) { - editor.selection.clearSelection(); - keepScrollPosition(editor, editor.gotoPageUp); - }, - sel: function(editor, range, count, param) { - keepScrollPosition(editor, editor.selectPageUp); - } - }, - "`": new Motion({ - param: true, - handlesCount: true, - getPos: function(editor, range, count, param, isSel) { - var s = editor.session; - var marker = s.vimMarkers && s.vimMarkers[param]; - if (marker) { - return marker.getPosition(); - } - } - }), - "'": new Motion({ - param: true, - handlesCount: true, - getPos: function(editor, range, count, param, isSel) { - var s = editor.session; - var marker = s.vimMarkers && s.vimMarkers[param]; - if (marker) { - var pos = marker.getPosition(); - var line = editor.session.getLine(pos.row); - pos.column = line.search(/\S/); - if (pos.column == -1) - pos.column = line.length; - return pos; - } - } - }) -}; - -module.exports.backspace = module.exports.left = module.exports.h; -module.exports.space = module.exports['return'] = module.exports.right = module.exports.l; -module.exports.up = module.exports.k; -module.exports.down = module.exports.j; -module.exports.pagedown = module.exports["ctrl-d"]; -module.exports.pageup = module.exports["ctrl-u"]; - -}); - -define('ace/keyboard/vim/maps/operators', ['require', 'exports', 'module' , 'ace/keyboard/vim/maps/util', 'ace/keyboard/vim/registers'], function(require, exports, module) { - - - -var util = require("./util"); -var registers = require("../registers"); - -module.exports = { - "d": { - selFn: function(editor, range, count, param) { - registers._default.text = editor.getCopyText(); - registers._default.isLine = util.onVisualLineMode; - if(util.onVisualLineMode) - editor.removeLines(); - else - editor.session.remove(range); - util.normalMode(editor); - }, - fn: function(editor, range, count, param) { - count = count || 1; - switch (param) { - case "d": - registers._default.text = ""; - registers._default.isLine = true; - for (var i = 0; i < count; i++) { - editor.selection.selectLine(); - registers._default.text += editor.getCopyText(); - var selRange = editor.getSelectionRange(); - if (!selRange.isMultiLine()) { - var row = selRange.start.row - 1; - var col = editor.session.getLine(row).length - selRange.setStart(row, col); - editor.session.remove(selRange); - editor.selection.clearSelection(); - break; - } - editor.session.remove(selRange); - editor.selection.clearSelection(); - } - registers._default.text = registers._default.text.replace(/\n$/, ""); - break; - default: - if (range) { - editor.selection.setSelectionRange(range); - registers._default.text = editor.getCopyText(); - registers._default.isLine = false; - editor.session.remove(range); - editor.selection.clearSelection(); - } - } - } - }, - "c": { - selFn: function(editor, range, count, param) { - editor.session.remove(range); - util.insertMode(editor); - }, - fn: function(editor, range, count, param) { - count = count || 1; - switch (param) { - case "c": - for (var i = 0; i < count; i++) { - editor.removeLines(); - util.insertMode(editor); - } - - break; - default: - if (range) { - editor.session.remove(range); - util.insertMode(editor); - } - } - } - }, - "y": { - selFn: function(editor, range, count, param) { - registers._default.text = editor.getCopyText(); - registers._default.isLine = util.onVisualLineMode; - editor.selection.clearSelection(); - util.normalMode(editor); - }, - fn: function(editor, range, count, param) { - count = count || 1; - switch (param) { - case "y": - var pos = editor.getCursorPosition(); - editor.selection.selectLine(); - for (var i = 0; i < count - 1; i++) { - editor.selection.moveCursorDown(); - } - registers._default.text = editor.getCopyText().replace(/\n$/, ""); - editor.selection.clearSelection(); - registers._default.isLine = true; - editor.moveCursorToPosition(pos); - break; - default: - if (range) { - var pos = editor.getCursorPosition(); - editor.selection.setSelectionRange(range); - registers._default.text = editor.getCopyText(); - registers._default.isLine = false; - editor.selection.clearSelection(); - editor.moveCursorTo(pos.row, pos.column); - } - } - } - }, - ">": { - selFn: function(editor, range, count, param) { - count = count || 1; - for (var i = 0; i < count; i++) { - editor.indent(); - } - util.normalMode(editor); - }, - fn: function(editor, range, count, param) { - count = parseInt(count || 1, 10); - switch (param) { - case ">": - var pos = editor.getCursorPosition(); - editor.selection.selectLine(); - for (var i = 0; i < count - 1; i++) { - editor.selection.moveCursorDown(); - } - editor.indent(); - editor.selection.clearSelection(); - editor.moveCursorToPosition(pos); - editor.navigateLineEnd(); - editor.navigateLineStart(); - break; - } - } - }, - "<": { - selFn: function(editor, range, count, param) { - count = count || 1; - for (var i = 0; i < count; i++) { - editor.blockOutdent(); - } - util.normalMode(editor); - }, - fn: function(editor, range, count, param) { - count = count || 1; - switch (param) { - case "<": - var pos = editor.getCursorPosition(); - editor.selection.selectLine(); - for (var i = 0; i < count - 1; i++) { - editor.selection.moveCursorDown(); - } - editor.blockOutdent(); - editor.selection.clearSelection(); - editor.moveCursorToPosition(pos); - editor.navigateLineEnd(); - editor.navigateLineStart(); - break; - } - } - } -}; -}); - -"use strict" - -define('ace/keyboard/vim/maps/aliases', ['require', 'exports', 'module' ], function(require, exports, module) { -module.exports = { - "x": { - operator: { - ch: "d", - count: 1 - }, - motion: { - ch: "l", - count: 1 - } - }, - "X": { - operator: { - ch: "d", - count: 1 - }, - motion: { - ch: "h", - count: 1 - } - }, - "D": { - operator: { - ch: "d", - count: 1 - }, - motion: { - ch: "$", - count: 1 - } - }, - "C": { - operator: { - ch: "c", - count: 1 - }, - motion: { - ch: "$", - count: 1 - } - }, - "s": { - operator: { - ch: "c", - count: 1 - }, - motion: { - ch: "l", - count: 1 - } - }, - "S": { - operator: { - ch: "c", - count: 1 - }, - param: "c" - } -}; -}); - diff --git a/addons/editor/ace/keybinding-emacs.js b/addons/editor/ace/keyboard/emacs.js old mode 100644 new mode 100755 similarity index 51% rename from addons/editor/ace/keybinding-emacs.js rename to addons/editor/ace/keyboard/emacs.js index 9ef26ef3..166c6857 --- a/addons/editor/ace/keybinding-emacs.js +++ b/addons/editor/ace/keyboard/emacs.js @@ -28,8 +28,8 @@ * * ***** END LICENSE BLOCK ***** */ -define('ace/keyboard/emacs', ['require', 'exports', 'module' , 'ace/lib/dom', 'ace/incremental_search', 'ace/commands/incremental_search_commands', 'ace/keyboard/hash_handler', 'ace/lib/keys'], function(require, exports, module) { - +define(function(require, exports, module) { +"use strict"; var dom = require("../lib/dom"); require("../incremental_search"); @@ -88,8 +88,10 @@ exports.handler.attach = function(editor) { }', 'emacsMode' ); } + // in emacs, gotowordleft/right should not count a space as a word.. $formerLongWords = editor.session.$selectLongWords; editor.session.$selectLongWords = true; + // CTRL-A should go to actual beginning of line $formerLineStart = editor.session.$useEmacsStyleLineStart; editor.session.$useEmacsStyleLineStart = true; @@ -101,6 +103,7 @@ exports.handler.attach = function(editor) { } editor.setEmacsMark = function(p) { + // to deactivate pass in a falsy value this.session.$emacsMark = p; } @@ -199,6 +202,12 @@ exports.handler.bindKey = function(key, command) { key.split("|").forEach(function(keyPart) { keyPart = keyPart.toLowerCase(); ckb[keyPart] = command; + // register all partial key combos as null commands + // to be able to activate key combos with arbitrary length + // Example: if keyPart is "C-c C-l t" then "C-c C-l t" will + // get command assigned and "C-c" and "C-c C-l" will get + // a null command assigned in this.commandKeyBinding. For + // the lookup logic see handleKeyboard() var keyParts = keyPart.split(" ").slice(0,-1); keyParts.reduce(function(keyMapKeys, keyPart, i) { var prefix = keyMapKeys[i-1] ? keyMapKeys[i-1] + ' ' : ''; @@ -211,6 +220,7 @@ exports.handler.bindKey = function(key, command) { exports.handler.handleKeyboard = function(data, hashId, key, keyCode) { var editor = data.editor; + // insertstring data.count times if (hashId == -1) { editor.pushEmacsMark(); if (data.count) { @@ -223,6 +233,8 @@ exports.handler.handleKeyboard = function(data, hashId, key, keyCode) { if (key == "\x00") return undefined; var modifier = eMods[hashId]; + + // CTRL + number / universalArgument for setting data.count if (modifier == "c-" || data.universalArgument) { var prevCount = String(data.count || 0); var count = parseInt(key[key.length - 1]); @@ -230,21 +242,40 @@ exports.handler.handleKeyboard = function(data, hashId, key, keyCode) { data.count = parseInt(prevCount + count); return {command: "null"}; } else if (data.universalArgument) { + // if no number pressed use emacs defaults for universalArgument + // which is 4 data.count = 4; } } data.universalArgument = false; + + // this.commandKeyBinding maps key specs like "c-p" (for CTRL + P) to + // command objects, for lookup key needs to include the modifier if (modifier) key = modifier + key; + + // Key combos like CTRL+X H build up the data.keyChain if (data.keyChain) key = data.keyChain += " " + key; + + // Key combo prefixes get stored as "null" (String!) in this + // this.commandKeyBinding. When encountered no command is invoked but we + // buld up data.keyChain var command = this.commandKeyBinding[key]; data.keyChain = command == "null" ? key : ""; + + // there really is no command if (!command) return undefined; + + // we pass b/c of key combo or universalArgument if (command === "null") return {command: "null"}; if (command === "universalArgument") { data.universalArgument = true; return {command: "null"}; } + + // lookup command + // TODO extract special handling of markmode + // TODO special case command.command is really unnecessary, remove var args; if (typeof command !== "string") { args = command.args; @@ -291,6 +322,7 @@ exports.handler.handleKeyboard = function(data, hashId, key, keyCode) { }; exports.emacsKeys = { + // movement "Up|C-p" : {command: "goorselect", args: ["golineup","selectup"]}, "Down|C-n" : {command: "goorselect", args: ["golinedown","selectdown"]}, "Left|C-b" : {command: "goorselect", args: ["gotoleft","selectleft"]}, @@ -301,6 +333,8 @@ exports.emacsKeys = { "End|C-e" : {command: "goorselect", args: ["gotolineend","selecttolineend"]}, "C-Home|S-M-,": {command: "goorselect", args: ["gotostart","selecttostart"]}, "C-End|S-M-." : {command: "goorselect", args: ["gotoend","selecttoend"]}, + + // selection "S-Up|S-C-p" : "selectup", "S-Down|S-C-n" : "selectdown", "S-Left|S-C-b" : "selectleft", @@ -316,6 +350,8 @@ exports.emacsKeys = { "M-s" : "centerselection", "M-g": "gotoline", "C-x C-p": "selectall", + + // todo fix these "C-Down": {command: "goorselect", args: ["gotopagedown","selectpagedown"]}, "C-Up": {command: "goorselect", args: ["gotopageup","selectpageup"]}, "PageDown|C-v": {command: "goorselect", args: ["gotopagedown","selectpagedown"]}, @@ -329,6 +365,8 @@ exports.emacsKeys = { "M-C-s": "findnext", "M-C-r": "findprevious", "S-M-5": "replace", + + // basic editing "Backspace": "backspace", "Delete|C-d": "del", "Return|C-m": {command: "insertstring", args: "\n"}, // "newline" @@ -357,8 +395,11 @@ exports.emacsKeys = { "C-/|C-x u|S-C--|C-z": "undo", "S-C-/|S-C-x u|C--|S-C-z": "redo", //infinite undo? + // vertical editing "C-x r": "selectRectangularRegion", "M-x": {command: "focusCommandLine", args: "M-x "} + // todo + // "C-x C-t" "M-t" "M-c" "F11" "C-M- "M-q" }; @@ -384,6 +425,12 @@ exports.handler.addCommands({ }, setMark: { exec: function(editor, args) { + // Sets mark-mode and clears current selection. + // When mark is set, keyboard cursor movement commands become + // selection modification commands. That is, + // "goto" commands become "select" commands. + // Any insertion or mouse click resets mark-mode. + // setMark twice in a row at the same place resets markmode if (args && args.count) { var mark = editor.popEmacsMark(); mark && editor.selection.moveCursorToPosition(mark); @@ -392,6 +439,10 @@ exports.handler.addCommands({ var mark = editor.emacsMark(), transientMarkModeActive = true; + + // if transientMarkModeActive then mark behavior is a little + // different. Deactivate the mark when setMark is run with active + // mark if (transientMarkModeActive && (mark || !editor.selection.isEmpty())) { editor.pushEmacsMark(); editor.clearSelection(); @@ -406,6 +457,7 @@ exports.handler.addCommands({ return; } } + // turn on mark mode mark = editor.getCursorPosition(); editor.setEmacsMark(mark); editor.selection.setSelectionAnchor(mark.row, mark.column); @@ -458,8 +510,13 @@ exports.handler.addCommands({ var pos = editor.getCursorPosition(); if (pos.column == 0 && editor.session.doc.getLine(pos.row).length == 0) { + // If an already empty line is killed, remove + // the line entirely editor.selection.selectLine(); } else { + // otherwise just remove from the current cursor position + // to the end (but don't delete the selection if it's before + // the cursor) editor.clearSelection(); editor.selection.selectLineEnd(); } @@ -540,519 +597,3 @@ exports.killRing = { }; }); - -define('ace/incremental_search', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/search', 'ace/search_highlight', 'ace/commands/incremental_search_commands', 'ace/lib/dom', 'ace/commands/command_manager', 'ace/editor', 'ace/config'], function(require, exports, module) { - - -var oop = require("./lib/oop"); -var Range = require("./range").Range; -var Search = require("./search").Search; -var SearchHighlight = require("./search_highlight").SearchHighlight; -var iSearchCommandModule = require("./commands/incremental_search_commands"); -var ISearchKbd = iSearchCommandModule.IncrementalSearchKeyboardHandler; -function IncrementalSearch() { - this.$options = {wrap: false, skipCurrent: false}; - this.$keyboardHandler = new ISearchKbd(this); -} - -oop.inherits(IncrementalSearch, Search); - -;(function() { - - this.activate = function(ed, backwards) { - this.$editor = ed; - this.$startPos = this.$currentPos = ed.getCursorPosition(); - this.$options.needle = ''; - this.$options.backwards = backwards; - ed.keyBinding.addKeyboardHandler(this.$keyboardHandler); - this.$mousedownHandler = ed.addEventListener('mousedown', this.onMouseDown.bind(this)); - this.selectionFix(ed); - this.statusMessage(true); - } - - this.deactivate = function(reset) { - this.cancelSearch(reset); - this.$editor.keyBinding.removeKeyboardHandler(this.$keyboardHandler); - if (this.$mousedownHandler) { - this.$editor.removeEventListener('mousedown', this.$mousedownHandler); - delete this.$mousedownHandler; - } - this.message(''); - } - - this.selectionFix = function(editor) { - if (editor.selection.isEmpty() && !editor.session.$emacsMark) { - editor.clearSelection(); - } - } - - this.highlight = function(regexp) { - var sess = this.$editor.session, - hl = sess.$isearchHighlight = sess.$isearchHighlight || sess.addDynamicMarker( - new SearchHighlight(null, "ace_isearch-result", "text")); - hl.setRegexp(regexp); - sess._emit("changeBackMarker"); // force highlight layer redraw - } - - this.cancelSearch = function(reset) { - var e = this.$editor; - this.$prevNeedle = this.$options.needle; - this.$options.needle = ''; - if (reset) { - e.moveCursorToPosition(this.$startPos); - this.$currentPos = this.$startPos; - } else { - e.pushEmacsMark && e.pushEmacsMark(this.$startPos, false); - } - this.highlight(null); - return Range.fromPoints(this.$currentPos, this.$currentPos); - } - - this.highlightAndFindWithNeedle = function(moveToNext, needleUpdateFunc) { - if (!this.$editor) return null; - var options = this.$options; - if (needleUpdateFunc) { - options.needle = needleUpdateFunc.call(this, options.needle || '') || ''; - } - if (options.needle.length === 0) { - this.statusMessage(true); - return this.cancelSearch(true); - }; - options.start = this.$currentPos; - var session = this.$editor.session, - found = this.find(session); - if (found) { - if (options.backwards) found = Range.fromPoints(found.end, found.start); - this.$editor.moveCursorToPosition(found.end); - if (moveToNext) this.$currentPos = found.end; - this.highlight(options.re) - } - - this.statusMessage(found); - - return found; - } - - this.addChar = function(c) { - return this.highlightAndFindWithNeedle(false, function(needle) { - return needle + c; - }); - } - - this.removeChar = function(c) { - return this.highlightAndFindWithNeedle(false, function(needle) { - return needle.length > 0 ? needle.substring(0, needle.length-1) : needle; - }); - } - - this.next = function(options) { - options = options || {}; - this.$options.backwards = !!options.backwards; - this.$currentPos = this.$editor.getCursorPosition(); - return this.highlightAndFindWithNeedle(true, function(needle) { - return options.useCurrentOrPrevSearch && needle.length === 0 ? - this.$prevNeedle || '' : needle; - }); - } - - this.onMouseDown = function(evt) { - this.deactivate(); - return true; - } - - this.statusMessage = function(found) { - var options = this.$options, msg = ''; - msg += options.backwards ? 'reverse-' : ''; - msg += 'isearch: ' + options.needle; - msg += found ? '' : ' (not found)'; - this.message(msg); - } - - this.message = function(msg) { - if (this.$editor.showCommandLine) { - this.$editor.showCommandLine(msg); - this.$editor.focus(); - } else { - console.log(msg); - } - } - -}).call(IncrementalSearch.prototype); - - -exports.IncrementalSearch = IncrementalSearch; - -var dom = require('./lib/dom'); -dom.importCssString && dom.importCssString("\ -.ace_marker-layer .ace_isearch-result {\ - position: absolute;\ - z-index: 6;\ - -moz-box-sizing: border-box;\ - -webkit-box-sizing: border-box;\ - box-sizing: border-box;\ -}\ -div.ace_isearch-result {\ - border-radius: 4px;\ - background-color: rgba(255, 200, 0, 0.5);\ - box-shadow: 0 0 4px rgb(255, 200, 0);\ -}\ -.ace_dark div.ace_isearch-result {\ - background-color: rgb(100, 110, 160);\ - box-shadow: 0 0 4px rgb(80, 90, 140);\ -}", "incremental-search-highlighting"); -var commands = require("./commands/command_manager"); -(function() { - this.setupIncrementalSearch = function(editor, val) { - if (this.usesIncrementalSearch == val) return; - this.usesIncrementalSearch = val; - var iSearchCommands = iSearchCommandModule.iSearchStartCommands; - var method = val ? 'addCommands' : 'removeCommands'; - this[method](iSearchCommands); - }; -}).call(commands.CommandManager.prototype); -var Editor = require("./editor").Editor; -require("./config").defineOptions(Editor.prototype, "editor", { - useIncrementalSearch: { - set: function(val) { - this.keyBinding.$handlers.forEach(function(handler) { - if (handler.setupIncrementalSearch) { - handler.setupIncrementalSearch(this, val); - } - }); - this._emit('incrementalSearchSettingChanged', {isEnabled: val}); - } - } -}); - -}); - -define('ace/commands/incremental_search_commands', ['require', 'exports', 'module' , 'ace/config', 'ace/lib/oop', 'ace/keyboard/hash_handler', 'ace/commands/occur_commands'], function(require, exports, module) { - -var config = require("../config"); -var oop = require("../lib/oop"); -var HashHandler = require("../keyboard/hash_handler").HashHandler; -var occurStartCommand = require("./occur_commands").occurStartCommand; -exports.iSearchStartCommands = [{ - name: "iSearch", - bindKey: {win: "Ctrl-F", mac: "Command-F"}, - exec: function(editor, options) { - config.loadModule(["core", "ace/incremental_search"], function(e) { - var iSearch = e.iSearch = e.iSearch || new e.IncrementalSearch(); - iSearch.activate(editor, options.backwards); - if (options.jumpToFirstMatch) iSearch.next(options); - }); - }, - readOnly: true -}, { - name: "iSearchBackwards", - exec: function(editor, jumpToNext) { editor.execCommand('iSearch', {backwards: true}); }, - readOnly: true -}, { - name: "iSearchAndGo", - bindKey: {win: "Ctrl-K", mac: "Command-G"}, - exec: function(editor, jumpToNext) { editor.execCommand('iSearch', {jumpToFirstMatch: true, useCurrentOrPrevSearch: true}); }, - readOnly: true -}, { - name: "iSearchBackwardsAndGo", - bindKey: {win: "Ctrl-Shift-K", mac: "Command-Shift-G"}, - exec: function(editor) { editor.execCommand('iSearch', {jumpToFirstMatch: true, backwards: true, useCurrentOrPrevSearch: true}); }, - readOnly: true -}]; -exports.iSearchCommands = [{ - name: "restartSearch", - bindKey: {win: "Ctrl-F", mac: "Command-F"}, - exec: function(iSearch) { - iSearch.cancelSearch(true); - }, - readOnly: true, - isIncrementalSearchCommand: true -}, { - name: "searchForward", - bindKey: {win: "Ctrl-S|Ctrl-K", mac: "Ctrl-S|Command-G"}, - exec: function(iSearch, options) { - options.useCurrentOrPrevSearch = true; - iSearch.next(options); - }, - readOnly: true, - isIncrementalSearchCommand: true -}, { - name: "searchBackward", - bindKey: {win: "Ctrl-R|Ctrl-Shift-K", mac: "Ctrl-R|Command-Shift-G"}, - exec: function(iSearch, options) { - options.useCurrentOrPrevSearch = true; - options.backwards = true; - iSearch.next(options); - }, - readOnly: true, - isIncrementalSearchCommand: true -}, { - name: "extendSearchTerm", - exec: function(iSearch, string) { - iSearch.addChar(string); - }, - readOnly: true, - isIncrementalSearchCommand: true -}, { - name: "extendSearchTermSpace", - bindKey: "space", - exec: function(iSearch) { iSearch.addChar(' '); }, - readOnly: true, - isIncrementalSearchCommand: true -}, { - name: "shrinkSearchTerm", - bindKey: "backspace", - exec: function(iSearch) { - iSearch.removeChar(); - }, - readOnly: true, - isIncrementalSearchCommand: true -}, { - name: 'confirmSearch', - bindKey: 'return', - exec: function(iSearch) { iSearch.deactivate(); }, - readOnly: true, - isIncrementalSearchCommand: true -}, { - name: 'cancelSearch', - bindKey: 'esc|Ctrl-G', - exec: function(iSearch) { iSearch.deactivate(true); }, - readOnly: true, - isIncrementalSearchCommand: true -}, { - name: 'occurisearch', - bindKey: 'Ctrl-O', - exec: function(iSearch) { - var options = oop.mixin({}, iSearch.$options); - iSearch.deactivate(); - occurStartCommand.exec(iSearch.$editor, options); - }, - readOnly: true, - isIncrementalSearchCommand: true -}]; - -function IncrementalSearchKeyboardHandler(iSearch) { - this.$iSearch = iSearch; -} - -oop.inherits(IncrementalSearchKeyboardHandler, HashHandler); - -;(function() { - - this.attach = function(editor) { - var iSearch = this.$iSearch; - HashHandler.call(this, exports.iSearchCommands, editor.commands.platform); - this.$commandExecHandler = editor.commands.addEventListener('exec', function(e) { - if (!e.command.isIncrementalSearchCommand) return undefined; - e.stopPropagation(); - e.preventDefault(); - return e.command.exec(iSearch, e.args || {}); - }); - } - - this.detach = function(editor) { - if (!this.$commandExecHandler) return; - editor.commands.removeEventListener('exec', this.$commandExecHandler); - delete this.$commandExecHandler; - } - - var handleKeyboard$super = this.handleKeyboard; - this.handleKeyboard = function(data, hashId, key, keyCode) { - var cmd = handleKeyboard$super.call(this, data, hashId, key, keyCode); - if (cmd.command) { return cmd; } - if (hashId == -1) { - var extendCmd = this.commands.extendSearchTerm; - if (extendCmd) { return {command: extendCmd, args: key}; } - } - return {command: "null", passEvent: hashId == 0 || hashId == 4}; - } - -}).call(IncrementalSearchKeyboardHandler.prototype); - - -exports.IncrementalSearchKeyboardHandler = IncrementalSearchKeyboardHandler; - -}); - -define('ace/commands/occur_commands', ['require', 'exports', 'module' , 'ace/config', 'ace/occur', 'ace/keyboard/hash_handler', 'ace/lib/oop'], function(require, exports, module) { - -var config = require("../config"), - Occur = require("../occur").Occur; -var occurStartCommand = { - name: "occur", - exec: function(editor, options) { - var alreadyInOccur = !!editor.session.$occur; - var occurSessionActive = new Occur().enter(editor, options); - if (occurSessionActive && !alreadyInOccur) - OccurKeyboardHandler.installIn(editor); - }, - readOnly: true -}; - -var occurCommands = [{ - name: "occurexit", - bindKey: 'esc|Ctrl-G', - exec: function(editor) { - var occur = editor.session.$occur; - if (!occur) return; - occur.exit(editor, {}); - if (!editor.session.$occur) OccurKeyboardHandler.uninstallFrom(editor); - }, - readOnly: true -}, { - name: "occuraccept", - bindKey: 'enter', - exec: function(editor) { - var occur = editor.session.$occur; - if (!occur) return; - occur.exit(editor, {translatePosition: true}); - if (!editor.session.$occur) OccurKeyboardHandler.uninstallFrom(editor); - }, - readOnly: true -}]; - -var HashHandler = require("../keyboard/hash_handler").HashHandler; -var oop = require("../lib/oop"); - - -function OccurKeyboardHandler() {} - -oop.inherits(OccurKeyboardHandler, HashHandler); - -;(function() { - - this.isOccurHandler = true; - - this.attach = function(editor) { - HashHandler.call(this, occurCommands, editor.commands.platform); - this.$editor = editor; - } - - var handleKeyboard$super = this.handleKeyboard; - this.handleKeyboard = function(data, hashId, key, keyCode) { - var cmd = handleKeyboard$super.call(this, data, hashId, key, keyCode); - return (cmd && cmd.command) ? cmd : undefined; - } - -}).call(OccurKeyboardHandler.prototype); - -OccurKeyboardHandler.installIn = function(editor) { - var handler = new this(); - editor.keyBinding.addKeyboardHandler(handler); - editor.commands.addCommands(occurCommands); -} - -OccurKeyboardHandler.uninstallFrom = function(editor) { - editor.commands.removeCommands(occurCommands); - var handler = editor.getKeyboardHandler(); - if (handler.isOccurHandler) - editor.keyBinding.removeKeyboardHandler(handler); -} - -exports.occurStartCommand = occurStartCommand; - -}); - -define('ace/occur', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/search', 'ace/edit_session', 'ace/search_highlight', 'ace/lib/dom'], function(require, exports, module) { - - -var oop = require("./lib/oop"); -var Range = require("./range").Range; -var Search = require("./search").Search; -var EditSession = require("./edit_session").EditSession; -var SearchHighlight = require("./search_highlight").SearchHighlight; -function Occur() {} - -oop.inherits(Occur, Search); - -(function() { - this.enter = function(editor, options) { - if (!options.needle) return false; - var pos = editor.getCursorPosition(); - this.displayOccurContent(editor, options); - var translatedPos = this.originalToOccurPosition(editor.session, pos); - editor.moveCursorToPosition(translatedPos); - return true; - } - this.exit = function(editor, options) { - var pos = options.translatePosition && editor.getCursorPosition(); - var translatedPos = pos && this.occurToOriginalPosition(editor.session, pos); - this.displayOriginalContent(editor); - if (translatedPos) - editor.moveCursorToPosition(translatedPos); - return true; - } - - this.highlight = function(sess, regexp) { - var hl = sess.$occurHighlight = sess.$occurHighlight || sess.addDynamicMarker( - new SearchHighlight(null, "ace_occur-highlight", "text")); - hl.setRegexp(regexp); - sess._emit("changeBackMarker"); // force highlight layer redraw - } - - this.displayOccurContent = function(editor, options) { - this.$originalSession = editor.session; - var found = this.matchingLines(editor.session, options); - var lines = found.map(function(foundLine) { return foundLine.content; }); - var occurSession = new EditSession(lines.join('\n')); - occurSession.$occur = this; - occurSession.$occurMatchingLines = found; - editor.setSession(occurSession); - this.highlight(occurSession, options.re); - occurSession._emit('changeBackMarker'); - } - - this.displayOriginalContent = function(editor) { - editor.setSession(this.$originalSession); - } - this.originalToOccurPosition = function(session, pos) { - var lines = session.$occurMatchingLines; - var nullPos = {row: 0, column: 0}; - if (!lines) return nullPos; - for (var i = 0; i < lines.length; i++) { - if (lines[i].row === pos.row) - return {row: i, column: pos.column}; - } - return nullPos; - } - this.occurToOriginalPosition = function(session, pos) { - var lines = session.$occurMatchingLines; - if (!lines || !lines[pos.row]) - return pos; - return {row: lines[pos.row].row, column: pos.column}; - } - - this.matchingLines = function(session, options) { - options = oop.mixin({}, options); - if (!session || !options.needle) return []; - var search = new Search(); - search.set(options); - return search.findAll(session).reduce(function(lines, range) { - var row = range.start.row; - var last = lines[lines.length-1]; - return last && last.row === row ? - lines : - lines.concat({row: row, content: session.getLine(row)}); - }, []); - } - -}).call(Occur.prototype); - -var dom = require('./lib/dom'); -dom.importCssString(".ace_occur-highlight {\n\ - border-radius: 4px;\n\ - background-color: rgba(87, 255, 8, 0.25);\n\ - position: absolute;\n\ - z-index: 4;\n\ - -moz-box-sizing: border-box;\n\ - -webkit-box-sizing: border-box;\n\ - box-sizing: border-box;\n\ - box-shadow: 0 0 4px rgb(91, 255, 50);\n\ -}\n\ -.ace_dark .ace_occur-highlight {\n\ - background-color: rgb(80, 140, 85);\n\ - box-shadow: 0 0 4px rgb(60, 120, 70);\n\ -}\n", "incremental-occur-highlighting"); - -exports.Occur = Occur; - -}); diff --git a/addons/editor/ace/keyboard/emacs_test.js b/addons/editor/ace/keyboard/emacs_test.js new file mode 100755 index 00000000..d1aba564 --- /dev/null +++ b/addons/editor/ace/keyboard/emacs_test.js @@ -0,0 +1,73 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +if (typeof process !== "undefined") { + require("amd-loader"); +} + +define(function(require, exports, module) { +"use strict"; + +var EditSession = require("./../edit_session").EditSession, + Editor = require("./../editor").Editor, + MockRenderer = require("./../test/mockrenderer").MockRenderer, + emacs = require('./emacs'), + assert = require("./../test/assertions"), + editor; + +function initEditor(docString) { + var doc = new EditSession(docString.split("\n")); + editor = new Editor(new MockRenderer(), doc); + editor.setKeyboardHandler(emacs.handler); +} + +module.exports = { + + "test: detach removes emacs commands from command manager": function() { + initEditor(''); + assert.ok(!!editor.commands.byName["keyboardQuit"], 'setup error: emacs commands not installed'); + editor.keyBinding.removeKeyboardHandler(editor.getKeyboardHandler()); + assert.ok(!editor.commands.byName["keyboardQuit"], 'emacs commands not removed'); + }, + + "test: keyboardQuit clears selection": function() { + initEditor('foo'); + editor.selectAll(); + editor.execCommand('keyboardQuit'); + assert.ok(editor.selection.isEmpty(), 'selection non-empty'); + } + +}; + +}); + +if (typeof module !== "undefined" && module === require.main) { + require("asyncjs").test.testcase(module.exports).exec() +} diff --git a/addons/editor/ace/keyboard/hash_handler.js b/addons/editor/ace/keyboard/hash_handler.js new file mode 100755 index 00000000..baa88158 --- /dev/null +++ b/addons/editor/ace/keyboard/hash_handler.js @@ -0,0 +1,195 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var keyUtil = require("../lib/keys"); +var useragent = require("../lib/useragent"); + +function HashHandler(config, platform) { + this.platform = platform || (useragent.isMac ? "mac" : "win"); + this.commands = {}; + this.commandKeyBinding = {}; + + // todo remove this after a while + if (this.__defineGetter__ && this.__defineSetter__ && typeof console != "undefined" && console.error) { + var warned = false; + var warn = function() { + if (!warned) { + warned = true; + console.error("commmandKeyBinding has too many m's. use commandKeyBinding"); + } + }; + this.__defineGetter__("commmandKeyBinding", function() { + warn(); + return this.commandKeyBinding; + }); + this.__defineSetter__("commmandKeyBinding", function(val) { + warn(); + return this.commandKeyBinding = val; + }); + } else { + this.commmandKeyBinding = this.commandKeyBinding; + } + + this.addCommands(config); +}; + +(function() { + + this.addCommand = function(command) { + if (this.commands[command.name]) + this.removeCommand(command); + + this.commands[command.name] = command; + + if (command.bindKey) + this._buildKeyHash(command); + }; + + this.removeCommand = function(command) { + var name = (typeof command === 'string' ? command : command.name); + command = this.commands[name]; + delete this.commands[name]; + + // exhaustive search is brute force but since removeCommand is + // not a performance critical operation this should be OK + var ckb = this.commandKeyBinding; + for (var hashId in ckb) { + for (var key in ckb[hashId]) { + if (ckb[hashId][key] == command) + delete ckb[hashId][key]; + } + } + }; + + this.bindKey = function(key, command) { + if(!key) + return; + if (typeof command == "function") { + this.addCommand({exec: command, bindKey: key, name: command.name || key}); + return; + } + + var ckb = this.commandKeyBinding; + key.split("|").forEach(function(keyPart) { + var binding = this.parseKeys(keyPart, command); + var hashId = binding.hashId; + (ckb[hashId] || (ckb[hashId] = {}))[binding.key] = command; + }, this); + }; + + this.addCommands = function(commands) { + commands && Object.keys(commands).forEach(function(name) { + var command = commands[name]; + if (!command) + return; + + if (typeof command === "string") + return this.bindKey(command, name); + + if (typeof command === "function") + command = { exec: command }; + + if (!command.name) + command.name = name; + + this.addCommand(command); + }, this); + }; + + this.removeCommands = function(commands) { + Object.keys(commands).forEach(function(name) { + this.removeCommand(commands[name]); + }, this); + }; + + this.bindKeys = function(keyList) { + Object.keys(keyList).forEach(function(key) { + this.bindKey(key, keyList[key]); + }, this); + }; + + this._buildKeyHash = function(command) { + var binding = command.bindKey; + if (!binding) + return; + + var key = typeof binding == "string" ? binding: binding[this.platform]; + this.bindKey(key, command); + }; + + // accepts keys in the form ctrl+Enter or ctrl-Enter + // keys without modifiers or shift only + this.parseKeys = function(keys) { + // todo support keychains + if (keys.indexOf(" ") != -1) + keys = keys.split(/\s+/).pop(); + + var parts = keys.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(x){return x}); + var key = parts.pop(); + + var keyCode = keyUtil[key]; + if (keyUtil.FUNCTION_KEYS[keyCode]) + key = keyUtil.FUNCTION_KEYS[keyCode].toLowerCase(); + else if (!parts.length) + return {key: key, hashId: -1}; + else if (parts.length == 1 && parts[0] == "shift") + return {key: key.toUpperCase(), hashId: -1}; + + var hashId = 0; + for (var i = parts.length; i--;) { + var modifier = keyUtil.KEY_MODS[parts[i]]; + if (modifier == null) { + if (typeof console != "undefined") + console.error("invalid modifier " + parts[i] + " in " + keys); + return false; + } + hashId |= modifier; + } + return {key: key, hashId: hashId}; + }; + + this.findKeyCommand = function findKeyCommand(hashId, keyString) { + var ckbr = this.commandKeyBinding; + return ckbr[hashId] && ckbr[hashId][keyString]; + }; + + this.handleKeyboard = function(data, hashId, keyString, keyCode) { + return { + command: this.findKeyCommand(hashId, keyString) + }; + }; + +}).call(HashHandler.prototype) + +exports.HashHandler = HashHandler; +}); diff --git a/addons/editor/ace/keyboard/keybinding.js b/addons/editor/ace/keyboard/keybinding.js new file mode 100755 index 00000000..2a1a2230 --- /dev/null +++ b/addons/editor/ace/keyboard/keybinding.js @@ -0,0 +1,136 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var keyUtil = require("../lib/keys"); +var event = require("../lib/event"); + +var KeyBinding = function(editor) { + this.$editor = editor; + this.$data = { }; + this.$handlers = []; + this.setDefaultHandler(editor.commands); +}; + +(function() { + this.setDefaultHandler = function(kb) { + this.removeKeyboardHandler(this.$defaultHandler); + this.$defaultHandler = kb; + this.addKeyboardHandler(kb, 0); + this.$data = {editor: this.$editor}; + }; + + this.setKeyboardHandler = function(kb) { + var h = this.$handlers; + if (h[h.length - 1] == kb) + return; + + while (h[h.length - 1] && h[h.length - 1] != this.$defaultHandler) + this.removeKeyboardHandler(h[h.length - 1]); + + this.addKeyboardHandler(kb, 1); + }; + + this.addKeyboardHandler = function(kb, pos) { + if (!kb) + return; + var i = this.$handlers.indexOf(kb); + if (i != -1) + this.$handlers.splice(i, 1); + + if (pos == undefined) + this.$handlers.push(kb); + else + this.$handlers.splice(pos, 0, kb); + + if (i == -1 && kb.attach) + kb.attach(this.$editor); + }; + + this.removeKeyboardHandler = function(kb) { + var i = this.$handlers.indexOf(kb); + if (i == -1) + return false; + this.$handlers.splice(i, 1); + kb.detach && kb.detach(this.$editor); + return true; + }; + + this.getKeyboardHandler = function() { + return this.$handlers[this.$handlers.length - 1]; + }; + + this.$callKeyboardHandlers = function (hashId, keyString, keyCode, e) { + var toExecute; + var success = false; + var commands = this.$editor.commands; + + for (var i = this.$handlers.length; i--;) { + toExecute = this.$handlers[i].handleKeyboard( + this.$data, hashId, keyString, keyCode, e + ); + if (!toExecute || !toExecute.command) + continue; + + // allow keyboardHandler to consume keys + if (toExecute.command == "null") { + success = true; + } else { + success = commands.exec(toExecute.command, this.$editor, toExecute.args, e); + } + // do not stop input events to not break repeating + if (success && e && hashId != -1 && + toExecute.passEvent != true && toExecute.command.passEvent != true + ) { + event.stopEvent(e); + } + if (success) + break; + } + return success; + }; + + this.onCommandKey = function(e, hashId, keyCode) { + var keyString = keyUtil.keyCodeToString(keyCode); + this.$callKeyboardHandlers(hashId, keyString, keyCode, e); + }; + + this.onTextInput = function(text) { + var success = this.$callKeyboardHandlers(-1, text); + if (!success) + this.$editor.commands.exec("insertstring", this.$editor, text); + }; + +}).call(KeyBinding.prototype); + +exports.KeyBinding = KeyBinding; +}); diff --git a/addons/editor/ace/keyboard/keybinding_test.js b/addons/editor/ace/keyboard/keybinding_test.js new file mode 100755 index 00000000..617d99c4 --- /dev/null +++ b/addons/editor/ace/keyboard/keybinding_test.js @@ -0,0 +1,69 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +if (typeof process !== "undefined") { + require("amd-loader"); +} + +define(function(require, exports, module) { +"use strict"; + +var EditSession = require("./../edit_session").EditSession, + Editor = require("./../editor").Editor, + MockRenderer = require("./../test/mockrenderer").MockRenderer, + assert = require("./../test/assertions"), + HashHandler = require('./hash_handler').HashHandler, + keys = require('../lib/keys'), + editor; + +function initEditor(docString) { + var doc = new EditSession(docString.split("\n")); + editor = new Editor(new MockRenderer(), doc); +} + +module.exports = { + + "test: adding a new keyboard handler does not remove the default handler": function() { + initEditor('abc'); + var handler = new HashHandler({'del': 'f1'}); + editor.keyBinding.setKeyboardHandler(handler); + editor.onCommandKey({}, 0, keys['f1']); + assert.equal('bc', editor.getValue(), "binding of new handler"); + editor.onCommandKey({}, 0, keys['delete']); + assert.equal('c', editor.getValue(), "bindings of the old handler should still work"); + } + +}; + +}); + +if (typeof module !== "undefined" && module === require.main) { + require("asyncjs").test.testcase(module.exports).exec() +} diff --git a/addons/editor/ace/keyboard/state_handler.js b/addons/editor/ace/keyboard/state_handler.js new file mode 100755 index 00000000..8265bbe1 --- /dev/null +++ b/addons/editor/ace/keyboard/state_handler.js @@ -0,0 +1,249 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +// 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 (hashId == -1) + hashId = 0 + // 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; +}); diff --git a/addons/editor/ace/keyboard/textinput.js b/addons/editor/ace/keyboard/textinput.js new file mode 100755 index 00000000..36f89985 --- /dev/null +++ b/addons/editor/ace/keyboard/textinput.js @@ -0,0 +1,505 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var event = require("../lib/event"); +var useragent = require("../lib/useragent"); +var dom = require("../lib/dom"); +var lang = require("../lib/lang"); +var BROKEN_SETDATA = useragent.isChrome < 18; + +var TextInput = function(parentNode, host) { + var text = dom.createElement("textarea"); + text.className = "ace_text-input"; + + if (useragent.isTouchPad) + text.setAttribute("x-palm-disable-auto-cap", true); + + text.wrap = "off"; + text.autocorrect = "off"; + text.autocapitalize = "off"; + text.spellcheck = false; + + text.style.opacity = "0"; + parentNode.insertBefore(text, parentNode.firstChild); + + var PLACEHOLDER = "\x01\x01"; + + var cut = false; + var copied = false; + var pasted = false; + var inComposition = false; + var tempStyle = ''; + var isSelectionEmpty = true; + + // FOCUS + // ie9 throws error if document.activeElement is accessed too soon + try { var isFocused = document.activeElement === text; } catch(e) {} + + event.addListener(text, "blur", function() { + host.onBlur(); + isFocused = false; + }); + event.addListener(text, "focus", function() { + isFocused = true; + host.onFocus(); + resetSelection(); + }); + this.focus = function() { text.focus(); }; + this.blur = function() { text.blur(); }; + this.isFocused = function() { + return isFocused; + }; + + // modifying selection of blured textarea can focus it (chrome mac/linux) + var syncSelection = lang.delayedCall(function() { + isFocused && resetSelection(isSelectionEmpty); + }); + var syncValue = lang.delayedCall(function() { + if (!inComposition) { + text.value = PLACEHOLDER; + isFocused && resetSelection(); + } + }); + + function resetSelection(isEmpty) { + if (inComposition) + return; + if (inputHandler) { + selectionStart = 0; + selectionEnd = isEmpty ? 0 : text.value.length - 1; + } else { + var selectionStart = isEmpty ? 2 : 1; + var selectionEnd = 2; + } + // on firefox this throws if textarea is hidden + try { + text.setSelectionRange(selectionStart, selectionEnd); + } catch(e){} + } + + function resetValue() { + if (inComposition) + return; + text.value = PLACEHOLDER; + //http://code.google.com/p/chromium/issues/detail?id=76516 + if (useragent.isWebKit) + syncValue.schedule(); + } + + useragent.isWebKit || host.addEventListener('changeSelection', function() { + if (host.selection.isEmpty() != isSelectionEmpty) { + isSelectionEmpty = !isSelectionEmpty; + syncSelection.schedule(); + } + }); + + resetValue(); + if (isFocused) + host.onFocus(); + + + var isAllSelected = function(text) { + return text.selectionStart === 0 && text.selectionEnd === text.value.length; + }; + // IE8 does not support setSelectionRange + if (!text.setSelectionRange && text.createTextRange) { + text.setSelectionRange = function(selectionStart, selectionEnd) { + var range = this.createTextRange(); + range.collapse(true); + range.moveStart('character', selectionStart); + range.moveEnd('character', selectionEnd); + range.select(); + }; + isAllSelected = function(text) { + try { + var range = text.ownerDocument.selection.createRange(); + }catch(e) {} + if (!range || range.parentElement() != text) return false; + return range.text == text.value; + } + } + if (useragent.isOldIE) { + var inPropertyChange = false; + var onPropertyChange = function(e){ + if (inPropertyChange) + return; + var data = text.value; + if (inComposition || !data || data == PLACEHOLDER) + return; + // can happen either after delete or during insert operation + if (e && data == PLACEHOLDER[0]) + return syncProperty.schedule(); + + sendText(data); + // ie8 calls propertychange handlers synchronously! + inPropertyChange = true; + resetValue(); + inPropertyChange = false; + }; + var syncProperty = lang.delayedCall(onPropertyChange); + event.addListener(text, "propertychange", onPropertyChange); + + var keytable = { 13:1, 27:1 }; + event.addListener(text, "keyup", function (e) { + if (inComposition && (!text.value || keytable[e.keyCode])) + setTimeout(onCompositionEnd, 0); + if ((text.value.charCodeAt(0)||0) < 129) { + return syncProperty.call(); + } + inComposition ? onCompositionUpdate() : onCompositionStart(); + }); + // when user presses backspace after focusing the editor + // propertychange isn't called for the next character + event.addListener(text, "keydown", function (e) { + syncProperty.schedule(50); + }); + } + + var onSelect = function(e) { + if (cut) { + cut = false; + } else if (copied) { + copied = false; + } else if (isAllSelected(text)) { + host.selectAll(); + resetSelection(); + } else if (inputHandler) { + resetSelection(host.selection.isEmpty()); + } + }; + + var inputHandler = null; + this.setInputHandler = function(cb) {inputHandler = cb}; + this.getInputHandler = function() {return inputHandler}; + var afterContextMenu = false; + + var sendText = function(data) { + if (inputHandler) { + data = inputHandler(data); + inputHandler = null; + } + if (pasted) { + resetSelection(); + if (data) + host.onPaste(data); + pasted = false; + } else if (data == PLACEHOLDER.charAt(0)) { + if (afterContextMenu) + host.execCommand("del", {source: "ace"}); + else // some versions of android do not fire keydown when pressing backspace + host.execCommand("backspace", {source: "ace"}); + } else { + if (data.substring(0, 2) == PLACEHOLDER) + data = data.substr(2); + else if (data.charAt(0) == PLACEHOLDER.charAt(0)) + data = data.substr(1); + else if (data.charAt(data.length - 1) == PLACEHOLDER.charAt(0)) + data = data.slice(0, -1); + // can happen if undo in textarea isn't stopped + if (data.charAt(data.length - 1) == PLACEHOLDER.charAt(0)) + data = data.slice(0, -1); + + if (data) + host.onTextInput(data); + } + if (afterContextMenu) + afterContextMenu = false; + }; + var onInput = function(e) { + // console.log("onInput", inComposition) + if (inComposition) + return; + var data = text.value; + sendText(data); + resetValue(); + }; + + var onCut = function(e) { + var data = host.getCopyText(); + if (!data) { + event.preventDefault(e); + return; + } + + var clipboardData = e.clipboardData || window.clipboardData; + + if (clipboardData && !BROKEN_SETDATA) { + // Safari 5 has clipboardData object, but does not handle setData() + var supported = clipboardData.setData("Text", data); + if (supported) { + host.onCut(); + event.preventDefault(e); + } + } + + if (!supported) { + cut = true; + text.value = data; + text.select(); + setTimeout(function(){ + cut = false; + resetValue(); + resetSelection(); + host.onCut(); + }); + } + }; + + var onCopy = function(e) { + var data = host.getCopyText(); + if (!data) { + event.preventDefault(e); + return; + } + + var clipboardData = e.clipboardData || window.clipboardData; + if (clipboardData && !BROKEN_SETDATA) { + // Safari 5 has clipboardData object, but does not handle setData() + var supported = clipboardData.setData("Text", data); + if (supported) { + host.onCopy(); + event.preventDefault(e); + } + } + if (!supported) { + copied = true; + text.value = data; + text.select(); + setTimeout(function(){ + copied = false; + resetValue(); + resetSelection(); + host.onCopy(); + }); + } + }; + + var onPaste = function(e) { + var clipboardData = e.clipboardData || window.clipboardData; + + if (clipboardData) { + var data = clipboardData.getData("Text"); + if (data) + host.onPaste(data); + if (useragent.isIE) + setTimeout(resetSelection); + event.preventDefault(e); + } + else { + text.value = ""; + pasted = true; + } + }; + + event.addCommandKeyListener(text, host.onCommandKey.bind(host)); + + event.addListener(text, "select", onSelect); + + event.addListener(text, "input", onInput); + + event.addListener(text, "cut", onCut); + event.addListener(text, "copy", onCopy); + event.addListener(text, "paste", onPaste); + + + // Opera has no clipboard events + if (!('oncut' in text) || !('oncopy' in text) || !('onpaste' in text)){ + event.addListener(parentNode, "keydown", function(e) { + if ((useragent.isMac && !e.metaKey) || !e.ctrlKey) + return; + + switch (e.keyCode) { + case 67: + onCopy(e); + break; + case 86: + onPaste(e); + break; + case 88: + onCut(e); + break; + } + }); + } + + + // COMPOSITION + var onCompositionStart = function(e) { + if (inComposition) return; + // console.log("onCompositionStart", inComposition) + inComposition = {}; + host.onCompositionStart(); + setTimeout(onCompositionUpdate, 0); + host.on("mousedown", onCompositionEnd); + if (!host.selection.isEmpty()) { + host.insert(""); + host.session.markUndoGroup(); + host.selection.clearSelection(); + } + host.session.markUndoGroup(); + }; + + var onCompositionUpdate = function() { + // console.log("onCompositionUpdate", inComposition && JSON.stringify(text.value)) + if (!inComposition) return; + var val = text.value.replace(/\x01/g, ""); + if (inComposition.lastValue === val) return; + + host.onCompositionUpdate(val); + if (inComposition.lastValue) + host.undo(); + inComposition.lastValue = val; + if (inComposition.lastValue) { + var r = host.selection.getRange(); + host.insert(inComposition.lastValue); + host.session.markUndoGroup(); + inComposition.range = host.selection.getRange(); + host.selection.setRange(r); + host.selection.clearSelection(); + } + }; + + var onCompositionEnd = function(e) { + // console.log("onCompositionEnd", inComposition &&inComposition.lastValue) + var c = inComposition; + inComposition = false; + var timer = setTimeout(function() { + timer = null; + var str = text.value.replace(/\x01/g, ""); + // console.log(str, c.lastValue) + if (inComposition) + return + else if (str == c.lastValue) + resetValue(); + else if (!c.lastValue && str) { + resetValue(); + sendText(str); + } + }); + inputHandler = function compositionInputHandler(str) { + // console.log("onCompositionEnd", str, c.lastValue) + if (timer) + clearTimeout(timer); + str = str.replace(/\x01/g, ""); + if (str == c.lastValue) + return ""; + if (c.lastValue && timer) + host.undo(); + return str; + }; + host.onCompositionEnd(); + host.removeListener("mousedown", onCompositionEnd); + if (e.type == "compositionend" && c.range) { + host.selection.setRange(c.range); + } + }; + + + + var syncComposition = lang.delayedCall(onCompositionUpdate, 50); + + event.addListener(text, "compositionstart", onCompositionStart); + if (useragent.isGecko) { + event.addListener(text, "text", function(){syncComposition.schedule()}); + } else { + event.addListener(text, "keyup", function(){syncComposition.schedule()}); + event.addListener(text, "keydown", function(){syncComposition.schedule()}); + } + event.addListener(text, "compositionend", onCompositionEnd); + + this.getElement = function() { + return text; + }; + + this.setReadOnly = function(readOnly) { + text.readOnly = readOnly; + }; + + this.onContextMenu = function(e) { + afterContextMenu = true; + if (!tempStyle) + tempStyle = text.style.cssText; + + text.style.cssText = "z-index:100000;" + (useragent.isIE ? "opacity:0.1;" : ""); + + resetSelection(host.selection.isEmpty()); + host._emit("nativecontextmenu", {target: host, domEvent: e}); + var rect = host.container.getBoundingClientRect(); + var style = dom.computedStyle(host.container); + var top = rect.top + (parseInt(style.borderTopWidth) || 0); + var left = rect.left + (parseInt(rect.borderLeftWidth) || 0); + var maxTop = rect.bottom - top - text.clientHeight; + var move = function(e) { + text.style.left = e.clientX - left - 2 + "px"; + text.style.top = Math.min(e.clientY - top - 2, maxTop) + "px"; + }; + move(e); + + if (e.type != "mousedown") + return; + + if (host.renderer.$keepTextAreaAtCursor) + host.renderer.$keepTextAreaAtCursor = null; + + // on windows context menu is opened after mouseup + if (useragent.isWin) + event.capture(host.container, move, onContextMenuClose); + }; + + this.onContextMenuClose = onContextMenuClose; + function onContextMenuClose() { + setTimeout(function () { + if (tempStyle) { + text.style.cssText = tempStyle; + tempStyle = ''; + } + if (host.renderer.$keepTextAreaAtCursor == null) { + host.renderer.$keepTextAreaAtCursor = true; + host.renderer.$moveTextAreaToCursor(); + } + }, 0); + } + + // firefox fires contextmenu event after opening it + if (!useragent.isGecko || useragent.isMac) { + var onContextMenu = function(e) { + host.textInput.onContextMenu(e); + onContextMenuClose(); + }; + event.addListener(host.renderer.scroller, "contextmenu", onContextMenu); + event.addListener(text, "contextmenu", onContextMenu); + } +}; + +exports.TextInput = TextInput; +}); diff --git a/addons/editor/ace/keyboard/vim.js b/addons/editor/ace/keyboard/vim.js new file mode 100755 index 00000000..7af83b05 --- /dev/null +++ b/addons/editor/ace/keyboard/vim.js @@ -0,0 +1,195 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var cmds = require("./vim/commands"); +var coreCommands = cmds.coreCommands; +var util = require("./vim/maps/util"); +var useragent = require("../lib/useragent"); + +var startCommands = { + "i": { + command: coreCommands.start + }, + "I": { + command: coreCommands.startBeginning + }, + "a": { + command: coreCommands.append + }, + "A": { + command: coreCommands.appendEnd + }, + "ctrl-f": { + command: "gotopagedown" + }, + "ctrl-b": { + command: "gotopageup" + } +}; + +exports.handler = { + $id: "ace/keyboard/vim", + // workaround for j not repeating with `defaults write -g ApplePressAndHoldEnabled -bool true` + handleMacRepeat: function(data, hashId, key) { + if (hashId == -1) { + // record key + data.inputChar = key; + data.lastEvent = "input"; + } else if (data.inputChar && data.$lastHash == hashId && data.$lastKey == key) { + // check for repeated keypress + if (data.lastEvent == "input") { + data.lastEvent = "input1"; + } else if (data.lastEvent == "input1") { + // simulate textinput + return true; + } + } else { + // reset + data.$lastHash = hashId; + data.$lastKey = key; + data.lastEvent = "keypress"; + } + }, + // on mac, with some keyboard layouts (e.g swedish) ^ starts composition, we don't need it in normal mode + updateMacCompositionHandlers: function(editor, enable) { + var onCompositionUpdateOverride = function(text) { + if (util.currentMode !== "insert") { + var el = this.textInput.getElement(); + el.blur(); + el.focus(); + el.value = text; + } else { + this.onCompositionUpdateOrig(text); + } + }; + var onCompositionStartOverride = function(text) { + if (util.currentMode === "insert") { + this.onCompositionStartOrig(text); + } + } + if (enable) { + if (!editor.onCompositionUpdateOrig) { + editor.onCompositionUpdateOrig = editor.onCompositionUpdate; + editor.onCompositionUpdate = onCompositionUpdateOverride; + editor.onCompositionStartOrig = editor.onCompositionStart; + editor.onCompositionStart = onCompositionStartOverride; + } + } else { + if (editor.onCompositionUpdateOrig) { + editor.onCompositionUpdate = editor.onCompositionUpdateOrig; + editor.onCompositionUpdateOrig = null; + editor.onCompositionStart = editor.onCompositionStartOrig; + editor.onCompositionStartOrig = null; + } + } + }, + + handleKeyboard: function(data, hashId, key, keyCode, e) { + // ignore command keys (shift, ctrl etc.) + if (hashId != 0 && (key == "" || key == "\x00")) + return null; + + var editor = data.editor; + + if (hashId == 1) + key = "ctrl-" + key; + if (key == "ctrl-c") { + if (!useragent.isMac && editor.getCopyText()) { + editor.once("copy", function() { + if (data.state == "start") + coreCommands.stop.exec(editor); + else + editor.selection.clearSelection(); + }); + return {command: "null", passEvent: true}; + } + return {command: coreCommands.stop}; + } else if ((key == "esc" && hashId == 0) || key == "ctrl-[") { + return {command: coreCommands.stop}; + } else if (data.state == "start") { + if (useragent.isMac && this.handleMacRepeat(data, hashId, key)) { + hashId = -1; + key = data.inputChar; + } + + if (hashId == -1 || hashId == 1 || hashId == 0 && key.length > 1) { + if (cmds.inputBuffer.idle && startCommands[key]) + return startCommands[key]; + cmds.inputBuffer.push(editor, key); + return {command: "null", passEvent: false}; + } // if no modifier || shift: wait for input. + else if (key.length == 1 && (hashId == 0 || hashId == 4)) { + return {command: "null", passEvent: true}; + } else if (key == "esc" && hashId == 0) { + return {command: coreCommands.stop}; + } + } else { + if (key == "ctrl-w") { + return {command: "removewordleft"}; + } + } + }, + + attach: function(editor) { + editor.on("click", exports.onCursorMove); + if (util.currentMode !== "insert") + cmds.coreCommands.stop.exec(editor); + editor.$vimModeHandler = this; + + this.updateMacCompositionHandlers(editor, true); + }, + + detach: function(editor) { + editor.removeListener("click", exports.onCursorMove); + util.noMode(editor); + util.currentMode = "normal"; + this.updateMacCompositionHandlers(editor, false); + }, + + actions: cmds.actions, + getStatusText: function() { + if (util.currentMode == "insert") + return "INSERT"; + if (util.onVisualMode) + return (util.onVisualLineMode ? "VISUAL LINE " : "VISUAL ") + cmds.inputBuffer.status; + return cmds.inputBuffer.status; + } +}; + + +exports.onCursorMove = function(e) { + cmds.onCursorMove(e.editor, e); + exports.onCursorMove.scheduled = false; +}; + +}); diff --git a/addons/editor/ace/keyboard/vim/commands.js b/addons/editor/ace/keyboard/vim/commands.js new file mode 100755 index 00000000..dd3357d6 --- /dev/null +++ b/addons/editor/ace/keyboard/vim/commands.js @@ -0,0 +1,613 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { + +"never use strict"; + +var lang = require("../../lib/lang"); +var util = require("./maps/util"); +var motions = require("./maps/motions"); +var operators = require("./maps/operators"); +var alias = require("./maps/aliases"); +var registers = require("./registers"); + +var NUMBER = 1; +var OPERATOR = 2; +var MOTION = 3; +var ACTION = 4; +var HMARGIN = 8; // Minimum amount of line separation between margins; + +var repeat = function repeat(fn, count, args) { + while (0 < count--) + fn.apply(this, args); +}; + +var ensureScrollMargin = function(editor) { + var renderer = editor.renderer; + var pos = renderer.$cursorLayer.getPixelPosition(); + + var top = pos.top; + + var margin = HMARGIN * renderer.layerConfig.lineHeight; + if (2 * margin > renderer.$size.scrollerHeight) + margin = renderer.$size.scrollerHeight / 2; + + if (renderer.scrollTop > top - margin) { + renderer.session.setScrollTop(top - margin); + } + + if (renderer.scrollTop + renderer.$size.scrollerHeight < top + margin + renderer.lineHeight) { + renderer.session.setScrollTop(top + margin + renderer.lineHeight - renderer.$size.scrollerHeight); + } +}; + +var actions = exports.actions = { + "z": { + param: true, + fn: function(editor, range, count, param) { + switch (param) { + case "z": + editor.renderer.alignCursor(null, 0.5); + break; + case "t": + editor.renderer.alignCursor(null, 0); + break; + case "b": + editor.renderer.alignCursor(null, 1); + break; + case "c": + editor.session.onFoldWidgetClick(range.start.row, {domEvent:{target :{}}}); + break; + case "o": + editor.session.onFoldWidgetClick(range.start.row, {domEvent:{target :{}}}); + break; + case "C": + editor.session.foldAll(); + break; + case "O": + editor.session.unfold(); + break; + } + } + }, + "r": { + param: true, + fn: function(editor, range, count, param) { + if (param && param.length) { + if (param.length > 1) + param = param == "return" ? "\n" : param == "tab" ? "\t" : param; + repeat(function() { editor.insert(param); }, count || 1); + editor.navigateLeft(); + } + } + }, + "R": { + fn: function(editor, range, count, param) { + util.insertMode(editor); + editor.setOverwrite(true); + } + }, + "~": { + fn: function(editor, range, count) { + repeat(function() { + var range = editor.selection.getRange(); + if (range.isEmpty()) + range.end.column++; + var text = editor.session.getTextRange(range); + var toggled = text.toUpperCase(); + if (toggled == text) + editor.navigateRight(); + else + editor.session.replace(range, toggled); + }, count || 1); + } + }, + "*": { + fn: function(editor, range, count, param) { + editor.selection.selectWord(); + editor.findNext(); + ensureScrollMargin(editor); + var r = editor.selection.getRange(); + editor.selection.setSelectionRange(r, true); + } + }, + "#": { + fn: function(editor, range, count, param) { + editor.selection.selectWord(); + editor.findPrevious(); + ensureScrollMargin(editor); + var r = editor.selection.getRange(); + editor.selection.setSelectionRange(r, true); + } + }, + "m": { + param: true, + fn: function(editor, range, count, param) { + var s = editor.session; + var markers = s.vimMarkers || (s.vimMarkers = {}); + var c = editor.getCursorPosition(); + if (!markers[param]) { + markers[param] = editor.session.doc.createAnchor(c); + } + markers[param].setPosition(c.row, c.column, true); + } + }, + "n": { + fn: function(editor, range, count, param) { + var options = editor.getLastSearchOptions(); + options.backwards = false; + + editor.selection.moveCursorRight(); + editor.selection.clearSelection(); + editor.findNext(options); + + ensureScrollMargin(editor); + var r = editor.selection.getRange(); + r.end.row = r.start.row; + r.end.column = r.start.column; + editor.selection.setSelectionRange(r, true); + } + }, + "N": { + fn: function(editor, range, count, param) { + var options = editor.getLastSearchOptions(); + options.backwards = true; + + editor.findPrevious(options); + ensureScrollMargin(editor); + var r = editor.selection.getRange(); + r.end.row = r.start.row; + r.end.column = r.start.column; + editor.selection.setSelectionRange(r, true); + } + }, + "v": { + fn: function(editor, range, count, param) { + editor.selection.selectRight(); + util.visualMode(editor, false); + }, + acceptsMotion: true + }, + "V": { + fn: function(editor, range, count, param) { + //editor.selection.selectLine(); + //editor.selection.selectLeft(); + var row = editor.getCursorPosition().row; + editor.selection.clearSelection(); + editor.selection.moveCursorTo(row, 0); + editor.selection.selectLineEnd(); + editor.selection.visualLineStart = row; + + util.visualMode(editor, true); + }, + acceptsMotion: true + }, + "Y": { + fn: function(editor, range, count, param) { + util.copyLine(editor); + } + }, + "p": { + fn: function(editor, range, count, param) { + var defaultReg = registers._default; + + editor.setOverwrite(false); + if (defaultReg.isLine) { + var pos = editor.getCursorPosition(); + pos.column = editor.session.getLine(pos.row).length; + var text = lang.stringRepeat("\n" + defaultReg.text, count || 1); + editor.session.insert(pos, text); + editor.moveCursorTo(pos.row + 1, 0); + } + else { + editor.navigateRight(); + editor.insert(lang.stringRepeat(defaultReg.text, count || 1)); + editor.navigateLeft(); + } + editor.setOverwrite(true); + editor.selection.clearSelection(); + } + }, + "P": { + fn: function(editor, range, count, param) { + var defaultReg = registers._default; + editor.setOverwrite(false); + + if (defaultReg.isLine) { + var pos = editor.getCursorPosition(); + pos.column = 0; + var text = lang.stringRepeat(defaultReg.text + "\n", count || 1); + editor.session.insert(pos, text); + editor.moveCursorToPosition(pos); + } + else { + editor.insert(lang.stringRepeat(defaultReg.text, count || 1)); + } + editor.setOverwrite(true); + editor.selection.clearSelection(); + } + }, + "J": { + fn: function(editor, range, count, param) { + var session = editor.session; + range = editor.getSelectionRange(); + var pos = {row: range.start.row, column: range.start.column}; + count = count || range.end.row - range.start.row; + var maxRow = Math.min(pos.row + (count || 1), session.getLength() - 1); + + range.start.column = session.getLine(pos.row).length; + range.end.column = session.getLine(maxRow).length; + range.end.row = maxRow; + + var text = ""; + for (var i = pos.row; i < maxRow; i++) { + var nextLine = session.getLine(i + 1); + text += " " + /^\s*(.*)$/.exec(nextLine)[1] || ""; + } + + session.replace(range, text); + editor.moveCursorTo(pos.row, pos.column); + } + }, + "u": { + fn: function(editor, range, count, param) { + count = parseInt(count || 1, 10); + for (var i = 0; i < count; i++) { + editor.undo(); + } + editor.selection.clearSelection(); + } + }, + "ctrl-r": { + fn: function(editor, range, count, param) { + count = parseInt(count || 1, 10); + for (var i = 0; i < count; i++) { + editor.redo(); + } + editor.selection.clearSelection(); + } + }, + ":": { + fn: function(editor, range, count, param) { + var val = ":"; + if (count > 1) + val = ".,.+" + count + val; + if (editor.showCommandLine) + editor.showCommandLine(val); + } + }, + "/": { + fn: function(editor, range, count, param) { + if (editor.showCommandLine) + editor.showCommandLine("/"); + } + }, + "?": { + fn: function(editor, range, count, param) { + if (editor.showCommandLine) + editor.showCommandLine("?"); + } + }, + ".": { + fn: function(editor, range, count, param) { + util.onInsertReplaySequence = inputBuffer.lastInsertCommands; + var previous = inputBuffer.previous; + if (previous) // If there is a previous action + inputBuffer.exec(editor, previous.action, previous.param); + } + }, + "ctrl-x": { + fn: function(editor, range, count, param) { + editor.modifyNumber(-(count || 1)); + } + }, + "ctrl-a": { + fn: function(editor, range, count, param) { + editor.modifyNumber(count || 1); + } + } +}; + +var inputBuffer = exports.inputBuffer = { + accepting: [NUMBER, OPERATOR, MOTION, ACTION], + currentCmd: null, + //currentMode: 0, + currentCount: "", + status: "", + + // Types + operator: null, + motion: null, + + lastInsertCommands: [], + + push: function(editor, ch, keyId) { + var status = this.status; + var isKeyHandled = true; + this.idle = false; + var wObj = this.waitingForParam; + if (/^numpad\d+$/i.test(ch)) + ch = ch.substr(6); + + if (wObj) { + this.exec(editor, wObj, ch); + } + // If input is a number (that doesn't start with 0) + else if (!(ch === "0" && !this.currentCount.length) && + (/^\d+$/.test(ch) && this.isAccepting(NUMBER))) { + // Assuming that ch is always of type String, and not Number + this.currentCount += ch; + this.currentCmd = NUMBER; + this.accepting = [NUMBER, OPERATOR, MOTION, ACTION]; + } + else if (!this.operator && this.isAccepting(OPERATOR) && operators[ch]) { + this.operator = { + ch: ch, + count: this.getCount() + }; + this.currentCmd = OPERATOR; + this.accepting = [NUMBER, MOTION, ACTION]; + this.exec(editor, { operator: this.operator }); + } + else if (motions[ch] && this.isAccepting(MOTION)) { + this.currentCmd = MOTION; + + var ctx = { + operator: this.operator, + motion: { + ch: ch, + count: this.getCount() + } + }; + + if (motions[ch].param) + this.waitForParam(ctx); + else + this.exec(editor, ctx); + } + else if (alias[ch] && this.isAccepting(MOTION)) { + alias[ch].operator.count = this.getCount(); + this.exec(editor, alias[ch]); + } + else if (actions[ch] && this.isAccepting(ACTION)) { + var actionObj = { + action: { + fn: actions[ch].fn, + count: this.getCount() + } + }; + + if (actions[ch].param) { + this.waitForParam(actionObj); + } + else { + this.exec(editor, actionObj); + } + + if (actions[ch].acceptsMotion) + this.idle = false; + } + else if (this.operator) { + this.operator.count = this.getCount(); + this.exec(editor, { operator: this.operator }, ch); + } + else { + isKeyHandled = ch.length == 1; + this.reset(); + } + + if (this.waitingForParam || this.motion || this.operator) { + this.status += ch; + } else if (this.currentCount) { + this.status = this.currentCount; + } else if (this.status) { + this.status = ""; + } + if (this.status != status) + editor._emit("changeStatus"); + return isKeyHandled; + }, + + waitForParam: function(cmd) { + this.waitingForParam = cmd; + }, + + getCount: function() { + var count = this.currentCount; + this.currentCount = ""; + return count && parseInt(count, 10); + }, + + exec: function(editor, action, param) { + var m = action.motion; + var o = action.operator; + var a = action.action; + + if (!param) + param = action.param; + + if (o) { + this.previous = { + action: action, + param: param + }; + } + + if (o && !editor.selection.isEmpty()) { + if (operators[o.ch].selFn) { + operators[o.ch].selFn(editor, editor.getSelectionRange(), o.count, param); + this.reset(); + } + return; + } + + // There is an operator, but no motion or action. We try to pass the + // current ch to the operator to see if it responds to it (an example + // of this is the 'dd' operator). + else if (!m && !a && o && param) { + operators[o.ch].fn(editor, null, o.count, param); + this.reset(); + } + else if (m) { + var run = function(fn) { + if (fn && typeof fn === "function") { // There should always be a motion + if (m.count && !motionObj.handlesCount) + repeat(fn, m.count, [editor, null, m.count, param]); + else + fn(editor, null, m.count, param); + } + }; + + var motionObj = motions[m.ch]; + var selectable = motionObj.sel; + + if (!o) { + if ((util.onVisualMode || util.onVisualLineMode) && selectable) + run(motionObj.sel); + else + run(motionObj.nav); + } + else if (selectable) { + repeat(function() { + run(motionObj.sel); + operators[o.ch].fn(editor, editor.getSelectionRange(), o.count, param); + }, o.count || 1); + } + this.reset(); + } + else if (a) { + a.fn(editor, editor.getSelectionRange(), a.count, param); + this.reset(); + } + handleCursorMove(editor); + }, + + isAccepting: function(type) { + return this.accepting.indexOf(type) !== -1; + }, + + reset: function() { + this.operator = null; + this.motion = null; + this.currentCount = ""; + this.status = ""; + this.accepting = [NUMBER, OPERATOR, MOTION, ACTION]; + this.idle = true; + this.waitingForParam = null; + } +}; + +function setPreviousCommand(fn) { + inputBuffer.previous = { action: { action: { fn: fn } } }; +} + +exports.coreCommands = { + start: { + exec: function start(editor) { + util.insertMode(editor); + setPreviousCommand(start); + } + }, + startBeginning: { + exec: function startBeginning(editor) { + editor.navigateLineStart(); + util.insertMode(editor); + setPreviousCommand(startBeginning); + } + }, + // Stop Insert mode as soon as possible. Works like typing in + // insert mode. + stop: { + exec: function stop(editor) { + inputBuffer.reset(); + util.onVisualMode = false; + util.onVisualLineMode = false; + inputBuffer.lastInsertCommands = util.normalMode(editor); + } + }, + append: { + exec: function append(editor) { + var pos = editor.getCursorPosition(); + var lineLen = editor.session.getLine(pos.row).length; + if (lineLen) + editor.navigateRight(); + util.insertMode(editor); + setPreviousCommand(append); + } + }, + appendEnd: { + exec: function appendEnd(editor) { + editor.navigateLineEnd(); + util.insertMode(editor); + setPreviousCommand(appendEnd); + } + } +}; + +var handleCursorMove = exports.onCursorMove = function(editor, e) { + if (util.currentMode === 'insert' || handleCursorMove.running) + return; + else if(!editor.selection.isEmpty()) { + handleCursorMove.running = true; + if (util.onVisualLineMode) { + var originRow = editor.selection.visualLineStart; + var cursorRow = editor.getCursorPosition().row; + if(originRow <= cursorRow) { + var endLine = editor.session.getLine(cursorRow); + editor.selection.clearSelection(); + editor.selection.moveCursorTo(originRow, 0); + editor.selection.selectTo(cursorRow, endLine.length); + } else { + var endLine = editor.session.getLine(originRow); + editor.selection.clearSelection(); + editor.selection.moveCursorTo(originRow, endLine.length); + editor.selection.selectTo(cursorRow, 0); + } + } + handleCursorMove.running = false; + return; + } + else { + if (e && (util.onVisualLineMode || util.onVisualMode)) { + editor.selection.clearSelection(); + util.normalMode(editor); + } + + handleCursorMove.running = true; + var pos = editor.getCursorPosition(); + var lineLen = editor.session.getLine(pos.row).length; + + if (lineLen && pos.column === lineLen) + editor.navigateLeft(); + handleCursorMove.running = false; + } +}; +}); diff --git a/addons/editor/ace/keyboard/vim/maps/aliases.js b/addons/editor/ace/keyboard/vim/maps/aliases.js new file mode 100755 index 00000000..1a5f32f7 --- /dev/null +++ b/addons/editor/ace/keyboard/vim/maps/aliases.js @@ -0,0 +1,94 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +"use strict" + +define(function(require, exports, module) { +module.exports = { + "x": { + operator: { + ch: "d", + count: 1 + }, + motion: { + ch: "l", + count: 1 + } + }, + "X": { + operator: { + ch: "d", + count: 1 + }, + motion: { + ch: "h", + count: 1 + } + }, + "D": { + operator: { + ch: "d", + count: 1 + }, + motion: { + ch: "$", + count: 1 + } + }, + "C": { + operator: { + ch: "c", + count: 1 + }, + motion: { + ch: "$", + count: 1 + } + }, + "s": { + operator: { + ch: "c", + count: 1 + }, + motion: { + ch: "l", + count: 1 + } + }, + "S": { + operator: { + ch: "c", + count: 1 + }, + param: "c" + } +}; +}); + diff --git a/addons/editor/ace/keyboard/vim/maps/motions.js b/addons/editor/ace/keyboard/vim/maps/motions.js new file mode 100755 index 00000000..91c8b8af --- /dev/null +++ b/addons/editor/ace/keyboard/vim/maps/motions.js @@ -0,0 +1,664 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + + +define(function(require, exports, module) { +"use strict"; + +var util = require("./util"); + +var keepScrollPosition = function(editor, fn) { + var scrollTopRow = editor.renderer.getScrollTopRow(); + var initialRow = editor.getCursorPosition().row; + var diff = initialRow - scrollTopRow; + fn && fn.call(editor); + editor.renderer.scrollToRow(editor.getCursorPosition().row - diff); +}; + +function Motion(m) { + if (typeof m == "function") { + var getPos = m; + m = this; + } else { + var getPos = m.getPos; + } + m.nav = function(editor, range, count, param) { + var a = getPos(editor, range, count, param, false); + if (!a) + return; + editor.clearSelection(); + editor.moveCursorTo(a.row, a.column); + }; + m.sel = function(editor, range, count, param) { + var a = getPos(editor, range, count, param, true); + if (!a) + return; + editor.selection.selectTo(a.row, a.column); + }; + return m; +} + +var nonWordRe = /[\s.\/\\()\"'-:,.;<>~!@#$%^&*|+=\[\]{}`~?]/; +var wordSeparatorRe = /[.\/\\()\"'-:,.;<>~!@#$%^&*|+=\[\]{}`~?]/; +var whiteRe = /\s/; +var StringStream = function(editor, cursor) { + var sel = editor.selection; + this.range = sel.getRange(); + cursor = cursor || sel.selectionLead; + this.row = cursor.row; + this.col = cursor.column; + var line = editor.session.getLine(this.row); + var maxRow = editor.session.getLength(); + this.ch = line[this.col] || '\n'; + this.skippedLines = 0; + + this.next = function() { + this.ch = line[++this.col] || this.handleNewLine(1); + //this.debug() + return this.ch; + }; + this.prev = function() { + this.ch = line[--this.col] || this.handleNewLine(-1); + //this.debug() + return this.ch; + }; + this.peek = function(dir) { + var ch = line[this.col + dir]; + if (ch) + return ch; + if (dir == -1) + return '\n'; + if (this.col == line.length - 1) + return '\n'; + return editor.session.getLine(this.row + 1)[0] || '\n'; + }; + + this.handleNewLine = function(dir) { + if (dir == 1){ + if (this.col == line.length) + return '\n'; + if (this.row == maxRow - 1) + return ''; + this.col = 0; + this.row ++; + line = editor.session.getLine(this.row); + this.skippedLines++; + return line[0] || '\n'; + } + if (dir == -1) { + if (this.row === 0) + return ''; + this.row --; + line = editor.session.getLine(this.row); + this.col = line.length; + this.skippedLines--; + return '\n'; + } + }; + this.debug = function() { + console.log(line.substring(0, this.col)+'|'+this.ch+'\''+this.col+'\''+line.substr(this.col+1)); + }; +}; + +var Search = require("../../../search").Search; +var search = new Search(); + +function find(editor, needle, dir) { + search.$options.needle = needle; + search.$options.backwards = dir == -1; + return search.find(editor.session); +} + +var Range = require("../../../range").Range; + +var LAST_SEARCH_MOTION = {}; + +module.exports = { + "w": new Motion(function(editor) { + var str = new StringStream(editor); + + if (str.ch && wordSeparatorRe.test(str.ch)) { + while (str.ch && wordSeparatorRe.test(str.ch)) + str.next(); + } else { + while (str.ch && !nonWordRe.test(str.ch)) + str.next(); + } + while (str.ch && whiteRe.test(str.ch) && str.skippedLines < 2) + str.next(); + + str.skippedLines == 2 && str.prev(); + return {column: str.col, row: str.row}; + }), + "W": new Motion(function(editor) { + var str = new StringStream(editor); + while(str.ch && !(whiteRe.test(str.ch) && !whiteRe.test(str.peek(1))) && str.skippedLines < 2) + str.next(); + if (str.skippedLines == 2) + str.prev(); + else + str.next(); + + return {column: str.col, row: str.row}; + }), + "b": new Motion(function(editor) { + var str = new StringStream(editor); + + str.prev(); + while (str.ch && whiteRe.test(str.ch) && str.skippedLines > -2) + str.prev(); + + if (str.ch && wordSeparatorRe.test(str.ch)) { + while (str.ch && wordSeparatorRe.test(str.ch)) + str.prev(); + } else { + while (str.ch && !nonWordRe.test(str.ch)) + str.prev(); + } + str.ch && str.next(); + return {column: str.col, row: str.row}; + }), + "B": new Motion(function(editor) { + var str = new StringStream(editor); + str.prev(); + while(str.ch && !(!whiteRe.test(str.ch) && whiteRe.test(str.peek(-1))) && str.skippedLines > -2) + str.prev(); + + if (str.skippedLines == -2) + str.next(); + + return {column: str.col, row: str.row}; + }), + "e": new Motion(function(editor) { + var str = new StringStream(editor); + + str.next(); + while (str.ch && whiteRe.test(str.ch)) + str.next(); + + if (str.ch && wordSeparatorRe.test(str.ch)) { + while (str.ch && wordSeparatorRe.test(str.ch)) + str.next(); + } else { + while (str.ch && !nonWordRe.test(str.ch)) + str.next(); + } + str.ch && str.prev(); + return {column: str.col, row: str.row}; + }), + "E": new Motion(function(editor) { + var str = new StringStream(editor); + str.next(); + while(str.ch && !(!whiteRe.test(str.ch) && whiteRe.test(str.peek(1)))) + str.next(); + + return {column: str.col, row: str.row}; + }), + + "l": { + nav: function(editor) { + var pos = editor.getCursorPosition(); + var col = pos.column; + var lineLen = editor.session.getLine(pos.row).length; + if (lineLen && col !== lineLen) + editor.navigateRight(); + }, + sel: function(editor) { + var pos = editor.getCursorPosition(); + var col = pos.column; + var lineLen = editor.session.getLine(pos.row).length; + + // Solving the behavior at the end of the line due to the + // different 0 index-based colum positions in ACE. + if (lineLen && col !== lineLen) //In selection mode you can select the newline + editor.selection.selectRight(); + } + }, + "h": { + nav: function(editor) { + var pos = editor.getCursorPosition(); + if (pos.column > 0) + editor.navigateLeft(); + }, + sel: function(editor) { + var pos = editor.getCursorPosition(); + if (pos.column > 0) + editor.selection.selectLeft(); + } + }, + "H": { + nav: function(editor) { + var row = editor.renderer.getScrollTopRow(); + editor.moveCursorTo(row); + }, + sel: function(editor) { + var row = editor.renderer.getScrollTopRow(); + editor.selection.selectTo(row); + } + }, + "M": { + nav: function(editor) { + var topRow = editor.renderer.getScrollTopRow(); + var bottomRow = editor.renderer.getScrollBottomRow(); + var row = topRow + ((bottomRow - topRow) / 2); + editor.moveCursorTo(row); + }, + sel: function(editor) { + var topRow = editor.renderer.getScrollTopRow(); + var bottomRow = editor.renderer.getScrollBottomRow(); + var row = topRow + ((bottomRow - topRow) / 2); + editor.selection.selectTo(row); + } + }, + "L": { + nav: function(editor) { + var row = editor.renderer.getScrollBottomRow(); + editor.moveCursorTo(row); + }, + sel: function(editor) { + var row = editor.renderer.getScrollBottomRow(); + editor.selection.selectTo(row); + } + }, + "k": { + nav: function(editor) { + editor.navigateUp(); + }, + sel: function(editor) { + editor.selection.selectUp(); + } + }, + "j": { + nav: function(editor) { + editor.navigateDown(); + }, + sel: function(editor) { + editor.selection.selectDown(); + } + }, + + "i": { + param: true, + sel: function(editor, range, count, param) { + switch (param) { + case "w": + editor.selection.selectWord(); + break; + case "W": + editor.selection.selectAWord(); + break; + case "(": + case "{": + case "[": + var cursor = editor.getCursorPosition(); + var end = editor.session.$findClosingBracket(param, cursor, /paren/); + if (!end) + return; + var start = editor.session.$findOpeningBracket(editor.session.$brackets[param], cursor, /paren/); + if (!start) + return; + start.column ++; + editor.selection.setSelectionRange(Range.fromPoints(start, end)); + break; + case "'": + case '"': + case "/": + var end = find(editor, param, 1); + if (!end) + return; + var start = find(editor, param, -1); + if (!start) + return; + editor.selection.setSelectionRange(Range.fromPoints(start.end, end.start)); + break; + } + } + }, + "a": { + param: true, + sel: function(editor, range, count, param) { + switch (param) { + case "w": + editor.selection.selectAWord(); + break; + case "W": + editor.selection.selectAWord(); + break; + case "(": + case "{": + case "[": + var cursor = editor.getCursorPosition(); + var end = editor.session.$findClosingBracket(param, cursor, /paren/); + if (!end) + return; + var start = editor.session.$findOpeningBracket(editor.session.$brackets[param], cursor, /paren/); + if (!start) + return; + end.column ++; + editor.selection.setSelectionRange(Range.fromPoints(start, end)); + break; + case "'": + case "\"": + case "/": + var end = find(editor, param, 1); + if (!end) + return; + var start = find(editor, param, -1); + if (!start) + return; + end.column ++; + editor.selection.setSelectionRange(Range.fromPoints(start.start, end.end)); + break; + } + } + }, + + "f": new Motion({ + param: true, + handlesCount: true, + getPos: function(editor, range, count, param, isSel, isRepeat) { + if (!isRepeat) + LAST_SEARCH_MOTION = {ch: "f", param: param}; + var cursor = editor.getCursorPosition(); + var column = util.getRightNthChar(editor, cursor, param, count || 1); + + if (typeof column === "number") { + cursor.column += column + (isSel ? 2 : 1); + return cursor; + } + } + }), + "F": new Motion({ + param: true, + handlesCount: true, + getPos: function(editor, range, count, param, isSel, isRepeat) { + if (!isRepeat) + LAST_SEARCH_MOTION = {ch: "F", param: param}; + var cursor = editor.getCursorPosition(); + var column = util.getLeftNthChar(editor, cursor, param, count || 1); + + if (typeof column === "number") { + cursor.column -= column + 1; + return cursor; + } + } + }), + "t": new Motion({ + param: true, + handlesCount: true, + getPos: function(editor, range, count, param, isSel, isRepeat) { + if (!isRepeat) + LAST_SEARCH_MOTION = {ch: "t", param: param}; + var cursor = editor.getCursorPosition(); + var column = util.getRightNthChar(editor, cursor, param, count || 1); + + if (isRepeat && column == 0 && !(count > 1)) + var column = util.getRightNthChar(editor, cursor, param, 2); + + if (typeof column === "number") { + cursor.column += column + (isSel ? 1 : 0); + return cursor; + } + } + }), + "T": new Motion({ + param: true, + handlesCount: true, + getPos: function(editor, range, count, param, isSel, isRepeat) { + if (!isRepeat) + LAST_SEARCH_MOTION = {ch: "T", param: param}; + var cursor = editor.getCursorPosition(); + var column = util.getLeftNthChar(editor, cursor, param, count || 1); + + if (isRepeat && column == 0 && !(count > 1)) + var column = util.getLeftNthChar(editor, cursor, param, 2); + + if (typeof column === "number") { + cursor.column -= column; + return cursor; + } + } + }), + ";": new Motion({ + handlesCount: true, + getPos: function(editor, range, count, param, isSel) { + var ch = LAST_SEARCH_MOTION.ch; + if (!ch) + return; + return module.exports[ch].getPos( + editor, range, count, LAST_SEARCH_MOTION.param, isSel, true + ); + } + }), + ",": new Motion({ + handlesCount: true, + getPos: function(editor, range, count, param, isSel) { + var ch = LAST_SEARCH_MOTION.ch; + if (!ch) + return; + var up = ch.toUpperCase(); + ch = ch === up ? ch.toLowerCase() : up; + + return module.exports[ch].getPos( + editor, range, count, LAST_SEARCH_MOTION.param, isSel, true + ); + } + }), + + "^": { + nav: function(editor) { + editor.navigateLineStart(); + }, + sel: function(editor) { + editor.selection.selectLineStart(); + } + }, + "$": { + nav: function(editor) { + editor.navigateLineEnd(); + }, + sel: function(editor) { + editor.selection.selectLineEnd(); + } + }, + "0": new Motion(function(ed) { + return {row: ed.selection.lead.row, column: 0}; + }), + "G": { + nav: function(editor, range, count, param) { + if (!count && count !== 0) { // Stupid JS + count = editor.session.getLength(); + } + editor.gotoLine(count); + }, + sel: function(editor, range, count, param) { + if (!count && count !== 0) { // Stupid JS + count = editor.session.getLength(); + } + editor.selection.selectTo(count, 0); + } + }, + "g": { + param: true, + nav: function(editor, range, count, param) { + switch(param) { + case "m": + console.log("Middle line"); + break; + case "e": + console.log("End of prev word"); + break; + case "g": + editor.gotoLine(count || 0); + case "u": + editor.gotoLine(count || 0); + case "U": + editor.gotoLine(count || 0); + } + }, + sel: function(editor, range, count, param) { + switch(param) { + case "m": + console.log("Middle line"); + break; + case "e": + console.log("End of prev word"); + break; + case "g": + editor.selection.selectTo(count || 0, 0); + } + } + }, + "o": { + nav: function(editor, range, count, param) { + count = count || 1; + var content = ""; + while (0 < count--) + content += "\n"; + + if (content.length) { + editor.navigateLineEnd() + editor.insert(content); + util.insertMode(editor); + } + } + }, + "O": { + nav: function(editor, range, count, param) { + var row = editor.getCursorPosition().row; + count = count || 1; + var content = ""; + while (0 < count--) + content += "\n"; + + if (content.length) { + if(row > 0) { + editor.navigateUp(); + editor.navigateLineEnd() + editor.insert(content); + } else { + editor.session.insert({row: 0, column: 0}, content); + editor.navigateUp(); + } + util.insertMode(editor); + } + } + }, + "%": new Motion(function(editor){ + var brRe = /[\[\]{}()]/g; + var cursor = editor.getCursorPosition(); + var ch = editor.session.getLine(cursor.row)[cursor.column]; + if (!brRe.test(ch)) { + var range = find(editor, brRe); + if (!range) + return; + cursor = range.start; + } + var match = editor.session.findMatchingBracket({ + row: cursor.row, + column: cursor.column + 1 + }); + + return match; + }), + "{": new Motion(function(ed) { + var session = ed.session; + var row = session.selection.lead.row; + while(row > 0 && !/\S/.test(session.getLine(row))) + row--; + while(/\S/.test(session.getLine(row))) + row--; + return {column: 0, row: row}; + }), + "}": new Motion(function(ed) { + var session = ed.session; + var l = session.getLength(); + var row = session.selection.lead.row; + while(row < l && !/\S/.test(session.getLine(row))) + row++; + while(/\S/.test(session.getLine(row))) + row++; + return {column: 0, row: row}; + }), + "ctrl-d": { + nav: function(editor, range, count, param) { + editor.selection.clearSelection(); + keepScrollPosition(editor, editor.gotoPageDown); + }, + sel: function(editor, range, count, param) { + keepScrollPosition(editor, editor.selectPageDown); + } + }, + "ctrl-u": { + nav: function(editor, range, count, param) { + editor.selection.clearSelection(); + keepScrollPosition(editor, editor.gotoPageUp); + }, + sel: function(editor, range, count, param) { + keepScrollPosition(editor, editor.selectPageUp); + } + }, + "`": new Motion({ + param: true, + handlesCount: true, + getPos: function(editor, range, count, param, isSel) { + var s = editor.session; + var marker = s.vimMarkers && s.vimMarkers[param]; + if (marker) { + return marker.getPosition(); + } + } + }), + "'": new Motion({ + param: true, + handlesCount: true, + getPos: function(editor, range, count, param, isSel) { + var s = editor.session; + var marker = s.vimMarkers && s.vimMarkers[param]; + if (marker) { + var pos = marker.getPosition(); + var line = editor.session.getLine(pos.row); + pos.column = line.search(/\S/); + if (pos.column == -1) + pos.column = line.length; + return pos; + } + } + }) +}; + +module.exports.backspace = module.exports.left = module.exports.h; +module.exports.space = module.exports['return'] = module.exports.right = module.exports.l; +module.exports.up = module.exports.k; +module.exports.down = module.exports.j; +module.exports.pagedown = module.exports["ctrl-d"]; +module.exports.pageup = module.exports["ctrl-u"]; + +}); diff --git a/addons/editor/ace/keyboard/vim/maps/operators.js b/addons/editor/ace/keyboard/vim/maps/operators.js new file mode 100755 index 00000000..067562a0 --- /dev/null +++ b/addons/editor/ace/keyboard/vim/maps/operators.js @@ -0,0 +1,195 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { + +"use strict"; + +var util = require("./util"); +var registers = require("../registers"); + +module.exports = { + "d": { + selFn: function(editor, range, count, param) { + registers._default.text = editor.getCopyText(); + registers._default.isLine = util.onVisualLineMode; + if(util.onVisualLineMode) + editor.removeLines(); + else + editor.session.remove(range); + util.normalMode(editor); + }, + fn: function(editor, range, count, param) { + count = count || 1; + switch (param) { + case "d": + registers._default.text = ""; + registers._default.isLine = true; + for (var i = 0; i < count; i++) { + editor.selection.selectLine(); + registers._default.text += editor.getCopyText(); + var selRange = editor.getSelectionRange(); + // check if end of the document was reached + if (!selRange.isMultiLine()) { + var row = selRange.start.row - 1; + var col = editor.session.getLine(row).length + selRange.setStart(row, col); + editor.session.remove(selRange); + editor.selection.clearSelection(); + break; + } + editor.session.remove(selRange); + editor.selection.clearSelection(); + } + registers._default.text = registers._default.text.replace(/\n$/, ""); + break; + default: + if (range) { + editor.selection.setSelectionRange(range); + registers._default.text = editor.getCopyText(); + registers._default.isLine = false; + editor.session.remove(range); + editor.selection.clearSelection(); + } + } + } + }, + "c": { + selFn: function(editor, range, count, param) { + editor.session.remove(range); + util.insertMode(editor); + }, + fn: function(editor, range, count, param) { + count = count || 1; + switch (param) { + case "c": + for (var i = 0; i < count; i++) { + editor.removeLines(); + util.insertMode(editor); + } + + break; + default: + if (range) { + + // range.end.column ++; + editor.session.remove(range); + util.insertMode(editor); + } + } + } + }, + "y": { + selFn: function(editor, range, count, param) { + registers._default.text = editor.getCopyText(); + registers._default.isLine = util.onVisualLineMode; + editor.selection.clearSelection(); + util.normalMode(editor); + }, + fn: function(editor, range, count, param) { + count = count || 1; + switch (param) { + case "y": + var pos = editor.getCursorPosition(); + editor.selection.selectLine(); + for (var i = 0; i < count - 1; i++) { + editor.selection.moveCursorDown(); + } + registers._default.text = editor.getCopyText().replace(/\n$/, ""); + editor.selection.clearSelection(); + registers._default.isLine = true; + editor.moveCursorToPosition(pos); + break; + default: + if (range) { + var pos = editor.getCursorPosition(); + editor.selection.setSelectionRange(range); + registers._default.text = editor.getCopyText(); + registers._default.isLine = false; + editor.selection.clearSelection(); + editor.moveCursorTo(pos.row, pos.column); + } + } + } + }, + ">": { + selFn: function(editor, range, count, param) { + count = count || 1; + for (var i = 0; i < count; i++) { + editor.indent(); + } + util.normalMode(editor); + }, + fn: function(editor, range, count, param) { + count = parseInt(count || 1, 10); + switch (param) { + case ">": + var pos = editor.getCursorPosition(); + editor.selection.selectLine(); + for (var i = 0; i < count - 1; i++) { + editor.selection.moveCursorDown(); + } + editor.indent(); + editor.selection.clearSelection(); + editor.moveCursorToPosition(pos); + editor.navigateLineEnd(); + editor.navigateLineStart(); + break; + } + } + }, + "<": { + selFn: function(editor, range, count, param) { + count = count || 1; + for (var i = 0; i < count; i++) { + editor.blockOutdent(); + } + util.normalMode(editor); + }, + fn: function(editor, range, count, param) { + count = count || 1; + switch (param) { + case "<": + var pos = editor.getCursorPosition(); + editor.selection.selectLine(); + for (var i = 0; i < count - 1; i++) { + editor.selection.moveCursorDown(); + } + editor.blockOutdent(); + editor.selection.clearSelection(); + editor.moveCursorToPosition(pos); + editor.navigateLineEnd(); + editor.navigateLineStart(); + break; + } + } + } +}; +}); diff --git a/addons/editor/ace/keyboard/vim/maps/util.js b/addons/editor/ace/keyboard/vim/maps/util.js new file mode 100755 index 00000000..af0e07c7 --- /dev/null +++ b/addons/editor/ace/keyboard/vim/maps/util.js @@ -0,0 +1,134 @@ +define(function(require, exports, module) { +var registers = require("../registers"); + +var dom = require("../../../lib/dom"); +dom.importCssString('.insert-mode .ace_cursor{\ + border-left: 2px solid #333333;\ +}\ +.ace_dark.insert-mode .ace_cursor{\ + border-left: 2px solid #eeeeee;\ +}\ +.normal-mode .ace_cursor{\ + border: 0!important;\ + background-color: red;\ + opacity: 0.5;\ +}', 'vimMode'); + +module.exports = { + onVisualMode: false, + onVisualLineMode: false, + currentMode: 'normal', + noMode: function(editor) { + editor.unsetStyle('insert-mode'); + editor.unsetStyle('normal-mode'); + if (editor.commands.recording) + editor.commands.toggleRecording(editor); + editor.setOverwrite(false); + }, + insertMode: function(editor) { + this.currentMode = 'insert'; + // Switch editor to insert mode + editor.setStyle('insert-mode'); + editor.unsetStyle('normal-mode'); + + editor.setOverwrite(false); + editor.keyBinding.$data.buffer = ""; + editor.keyBinding.$data.state = "insertMode"; + this.onVisualMode = false; + this.onVisualLineMode = false; + if(this.onInsertReplaySequence) { + // Ok, we're apparently replaying ("."), so let's do it + editor.commands.macro = this.onInsertReplaySequence; + editor.commands.replay(editor); + this.onInsertReplaySequence = null; + this.normalMode(editor); + } else { + editor._emit("changeStatus"); + // Record any movements, insertions in insert mode + if(!editor.commands.recording) + editor.commands.toggleRecording(editor); + } + }, + normalMode: function(editor) { + // Switch editor to normal mode + this.currentMode = 'normal'; + + editor.unsetStyle('insert-mode'); + editor.setStyle('normal-mode'); + editor.clearSelection(); + + var pos; + if (!editor.getOverwrite()) { + pos = editor.getCursorPosition(); + if (pos.column > 0) + editor.navigateLeft(); + } + + editor.setOverwrite(true); + editor.keyBinding.$data.buffer = ""; + editor.keyBinding.$data.state = "start"; + this.onVisualMode = false; + this.onVisualLineMode = false; + editor._emit("changeStatus"); + // Save recorded keystrokes + if (editor.commands.recording) { + editor.commands.toggleRecording(editor); + return editor.commands.macro; + } + else { + return []; + } + }, + visualMode: function(editor, lineMode) { + if ( + (this.onVisualLineMode && lineMode) + || (this.onVisualMode && !lineMode) + ) { + this.normalMode(editor); + return; + } + + editor.setStyle('insert-mode'); + editor.unsetStyle('normal-mode'); + + editor._emit("changeStatus"); + if (lineMode) { + this.onVisualLineMode = true; + } else { + this.onVisualMode = true; + this.onVisualLineMode = false; + } + }, + getRightNthChar: function(editor, cursor, ch, n) { + var line = editor.getSession().getLine(cursor.row); + var matches = line.substr(cursor.column + 1).split(ch); + + return n < matches.length ? matches.slice(0, n).join(ch).length : null; + }, + getLeftNthChar: function(editor, cursor, ch, n) { + var line = editor.getSession().getLine(cursor.row); + var matches = line.substr(0, cursor.column).split(ch); + + return n < matches.length ? matches.slice(-1 * n).join(ch).length : null; + }, + toRealChar: function(ch) { + if (ch.length === 1) + return ch; + + if (/^shift-./.test(ch)) + return ch[ch.length - 1].toUpperCase(); + else + return ""; + }, + copyLine: function(editor) { + var pos = editor.getCursorPosition(); + editor.selection.clearSelection(); + editor.moveCursorTo(pos.row, pos.column); + editor.selection.selectLine(); + registers._default.isLine = true; + registers._default.text = editor.getCopyText().replace(/\n$/, ""); + editor.selection.clearSelection(); + editor.moveCursorTo(pos.row, pos.column); + } +}; +}); diff --git a/addons/editor/ace/keyboard/vim/registers.js b/addons/editor/ace/keyboard/vim/registers.js new file mode 100755 index 00000000..ef929a35 --- /dev/null +++ b/addons/editor/ace/keyboard/vim/registers.js @@ -0,0 +1,42 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { + +"never use strict"; + +module.exports = { + _default: { + text: "", + isLine: false + } +}; + +}); diff --git a/addons/editor/ace/layer/cursor.js b/addons/editor/ace/layer/cursor.js new file mode 100755 index 00000000..26ade52b --- /dev/null +++ b/addons/editor/ace/layer/cursor.js @@ -0,0 +1,217 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var dom = require("../lib/dom"); + +var Cursor = function(parentEl) { + this.element = dom.createElement("div"); + this.element.className = "ace_layer ace_cursor-layer"; + parentEl.appendChild(this.element); + + this.isVisible = false; + this.isBlinking = true; + this.blinkInterval = 1000; + this.smoothBlinking = false; + + this.cursors = []; + this.cursor = this.addCursor(); + dom.addCssClass(this.element, "ace_hidden-cursors"); +}; + +(function() { + + this.$padding = 0; + this.setPadding = function(padding) { + this.$padding = padding; + }; + + this.setSession = function(session) { + this.session = session; + }; + + this.setBlinking = function(blinking) { + if (blinking != this.isBlinking){ + this.isBlinking = blinking; + this.restartTimer(); + } + }; + + this.setBlinkInterval = function(blinkInterval) { + if (blinkInterval != this.blinkInterval){ + this.blinkInterval = blinkInterval; + this.restartTimer(); + } + }; + + this.setSmoothBlinking = function(smoothBlinking) { + if (smoothBlinking != this.smoothBlinking) { + this.smoothBlinking = smoothBlinking; + if (smoothBlinking) + dom.addCssClass(this.element, "ace_smooth-blinking"); + else + dom.removeCssClass(this.element, "ace_smooth-blinking"); + this.restartTimer(); + } + }; + + this.addCursor = function() { + var el = dom.createElement("div"); + el.className = "ace_cursor"; + this.element.appendChild(el); + this.cursors.push(el); + return el; + }; + + this.removeCursor = function() { + if (this.cursors.length > 1) { + var el = this.cursors.pop(); + el.parentNode.removeChild(el); + return el; + } + }; + + this.hideCursor = function() { + this.isVisible = false; + dom.addCssClass(this.element, "ace_hidden-cursors"); + this.restartTimer(); + }; + + this.showCursor = function() { + this.isVisible = true; + dom.removeCssClass(this.element, "ace_hidden-cursors"); + this.restartTimer(); + }; + + this.restartTimer = function() { + clearInterval(this.intervalId); + clearTimeout(this.timeoutId); + if (this.smoothBlinking) + dom.removeCssClass(this.element, "ace_smooth-blinking"); + for (var i = this.cursors.length; i--; ) + this.cursors[i].style.opacity = ""; + + if (!this.isBlinking || !this.blinkInterval || !this.isVisible) + return; + + if (this.smoothBlinking) + setTimeout(function(){ + dom.addCssClass(this.element, "ace_smooth-blinking"); + }.bind(this)); + + var blink = function(){ + this.timeoutId = setTimeout(function() { + for (var i = this.cursors.length; i--; ) { + this.cursors[i].style.opacity = 0; + } + }.bind(this), 0.6 * this.blinkInterval); + }.bind(this); + + this.intervalId = setInterval(function() { + for (var i = this.cursors.length; i--; ) { + this.cursors[i].style.opacity = ""; + } + blink(); + }.bind(this), this.blinkInterval); + + blink(); + }; + + this.getPixelPosition = function(position, onScreen) { + if (!this.config || !this.session) + return {left : 0, top : 0}; + + if (!position) + position = this.session.selection.getCursor(); + var pos = this.session.documentToScreenPosition(position); + var cursorLeft = this.$padding + pos.column * this.config.characterWidth; + var cursorTop = (pos.row - (onScreen ? this.config.firstRowScreen : 0)) * + this.config.lineHeight; + + return {left : cursorLeft, top : cursorTop}; + }; + + this.update = function(config) { + this.config = config; + + var selections = this.session.$selectionMarkers; + var i = 0, cursorIndex = 0; + + if (selections === undefined || selections.length === 0){ + selections = [{cursor: null}]; + } + + for (var i = 0, n = selections.length; i < n; i++) { + var pixelPos = this.getPixelPosition(selections[i].cursor, true); + if ((pixelPos.top > config.height + config.offset || + pixelPos.top < -config.offset) && i > 1) { + continue; + } + + var style = (this.cursors[cursorIndex++] || this.addCursor()).style; + + style.left = pixelPos.left + "px"; + style.top = pixelPos.top + "px"; + style.width = config.characterWidth + "px"; + style.height = config.lineHeight + "px"; + } + while (this.cursors.length > cursorIndex) + this.removeCursor(); + + var overwrite = this.session.getOverwrite(); + this.$setOverwrite(overwrite); + + // cache for textarea and gutter highlight + this.$pixelPos = pixelPos; + this.restartTimer(); + }; + + this.$setOverwrite = function(overwrite) { + if (overwrite != this.overwrite) { + this.overwrite = overwrite; + if (overwrite) + dom.addCssClass(this.element, "ace_overwrite-cursors"); + else + dom.removeCssClass(this.element, "ace_overwrite-cursors"); + } + }; + + this.destroy = function() { + clearInterval(this.intervalId); + clearTimeout(this.timeoutId); + }; + +}).call(Cursor.prototype); + +exports.Cursor = Cursor; + +}); diff --git a/addons/editor/ace/layer/gutter.js b/addons/editor/ace/layer/gutter.js new file mode 100755 index 00000000..c1130d8f --- /dev/null +++ b/addons/editor/ace/layer/gutter.js @@ -0,0 +1,265 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var dom = require("../lib/dom"); +var oop = require("../lib/oop"); +var lang = require("../lib/lang"); +var EventEmitter = require("../lib/event_emitter").EventEmitter; + +var Gutter = function(parentEl) { + this.element = dom.createElement("div"); + this.element.className = "ace_layer ace_gutter-layer"; + parentEl.appendChild(this.element); + this.setShowFoldWidgets(this.$showFoldWidgets); + + this.gutterWidth = 0; + + this.$annotations = []; + this.$updateAnnotations = this.$updateAnnotations.bind(this); + + this.$cells = []; +}; + +(function() { + + oop.implement(this, EventEmitter); + + this.setSession = function(session) { + if (this.session) + this.session.removeEventListener("change", this.$updateAnnotations); + this.session = session; + session.on("change", this.$updateAnnotations); + }; + + this.addGutterDecoration = function(row, className){ + if (window.console) + console.warn && console.warn("deprecated use session.addGutterDecoration"); + this.session.addGutterDecoration(row, className); + }; + + this.removeGutterDecoration = function(row, className){ + if (window.console) + console.warn && console.warn("deprecated use session.removeGutterDecoration"); + this.session.removeGutterDecoration(row, className); + }; + + this.setAnnotations = function(annotations) { + // iterate over sparse array + this.$annotations = [] + var rowInfo, row; + for (var i = 0; i < annotations.length; i++) { + var annotation = annotations[i]; + var row = annotation.row; + var rowInfo = this.$annotations[row]; + if (!rowInfo) + rowInfo = this.$annotations[row] = {text: []}; + + var annoText = annotation.text; + annoText = annoText ? lang.escapeHTML(annoText) : annotation.html || ""; + + if (rowInfo.text.indexOf(annoText) === -1) + rowInfo.text.push(annoText); + + var type = annotation.type; + if (type == "error") + rowInfo.className = " ace_error"; + else if (type == "warning" && rowInfo.className != " ace_error") + rowInfo.className = " ace_warning"; + else if (type == "info" && (!rowInfo.className)) + rowInfo.className = " ace_info"; + } + }; + + this.$updateAnnotations = function (e) { + if (!this.$annotations.length) + return; + var delta = e.data; + var range = delta.range; + var firstRow = range.start.row; + var len = range.end.row - firstRow; + if (len === 0) { + // do nothing + } else if (delta.action == "removeText" || delta.action == "removeLines") { + this.$annotations.splice(firstRow, len + 1, null); + } else { + var args = Array(len + 1); + args.unshift(firstRow, 1); + this.$annotations.splice.apply(this.$annotations, args); + } + }; + + this.update = function(config) { + var firstRow = config.firstRow; + var lastRow = config.lastRow; + var fold = this.session.getNextFoldLine(firstRow); + var foldStart = fold ? fold.start.row : Infinity; + var foldWidgets = this.$showFoldWidgets && this.session.foldWidgets; + var breakpoints = this.session.$breakpoints; + var decorations = this.session.$decorations; + var firstLineNumber = this.session.$firstLineNumber; + var lastLineNumber = 0; + + var cell = null; + var index = -1; + var row = firstRow; + while (true) { + if (row > foldStart) { + row = fold.end.row + 1; + fold = this.session.getNextFoldLine(row, fold); + foldStart = fold ? fold.start.row : Infinity; + } + if (row > lastRow) { + while (this.$cells.length > index + 1) { + cell = this.$cells.pop(); + this.element.removeChild(cell.element); + } + break; + } + + cell = this.$cells[++index]; + if (!cell) { + cell = {element: null, textNode: null, foldWidget: null}; + cell.element = dom.createElement("div"); + cell.textNode = document.createTextNode(''); + cell.element.appendChild(cell.textNode); + this.element.appendChild(cell.element); + this.$cells[index] = cell; + } + + var className = "ace_gutter-cell "; + if (breakpoints[row]) + className += breakpoints[row]; + if (decorations[row]) + className += decorations[row]; + if (this.$annotations[row]) + className += this.$annotations[row].className; + if (cell.element.className != className) + cell.element.className = className; + + var height = this.session.getRowLength(row) * config.lineHeight + "px"; + if (height != cell.element.style.height) + cell.element.style.height = height; + + var text = lastLineNumber = row + firstLineNumber; + if (text != cell.textNode.data) + cell.textNode.data = text; + + if (foldWidgets) { + var c = foldWidgets[row]; + // check if cached value is invalidated and we need to recompute + if (c == null) + c = foldWidgets[row] = this.session.getFoldWidget(row); + } + + if (c) { + if (!cell.foldWidget) { + cell.foldWidget = dom.createElement("span"); + cell.element.appendChild(cell.foldWidget); + } + var className = "ace_fold-widget ace_" + c; + if (c == "start" && row == foldStart && row < fold.end.row) + className += " ace_closed"; + else + className += " ace_open"; + if (cell.foldWidget.className != className) + cell.foldWidget.className = className; + + var height = config.lineHeight + "px"; + if (cell.foldWidget.style.height != height) + cell.foldWidget.style.height = height; + } else { + if (cell.foldWidget != null) { + cell.element.removeChild(cell.foldWidget); + cell.foldWidget = null; + } + } + + row++; + } + + this.element.style.height = config.minHeight + "px"; + + if (this.$fixedWidth || this.session.$useWrapMode) + lastLineNumber = this.session.getLength(); + + var gutterWidth = lastLineNumber.toString().length * config.characterWidth; + var padding = this.$padding || this.$computePadding(); + gutterWidth += padding.left + padding.right; + if (gutterWidth !== this.gutterWidth && !isNaN(gutterWidth)) { + this.gutterWidth = gutterWidth; + this.element.style.width = Math.ceil(this.gutterWidth) + "px"; + this._emit("changeGutterWidth", gutterWidth); + } + }; + + this.$fixedWidth = false; + + this.$showFoldWidgets = true; + this.setShowFoldWidgets = function(show) { + if (show) + dom.addCssClass(this.element, "ace_folding-enabled"); + else + dom.removeCssClass(this.element, "ace_folding-enabled"); + + this.$showFoldWidgets = show; + this.$padding = null; + }; + + this.getShowFoldWidgets = function() { + return this.$showFoldWidgets; + }; + + this.$computePadding = function() { + if (!this.element.firstChild) + return {left: 0, right: 0}; + var style = dom.computedStyle(this.element.firstChild); + this.$padding = {}; + this.$padding.left = parseInt(style.paddingLeft) + 1 || 0; + this.$padding.right = parseInt(style.paddingRight) || 0; + return this.$padding; + }; + + this.getRegion = function(point) { + var padding = this.$padding || this.$computePadding(); + var rect = this.element.getBoundingClientRect(); + if (point.x < padding.left + rect.left) + return "markers"; + if (this.$showFoldWidgets && point.x > rect.right - padding.right) + return "foldWidgets"; + }; + +}).call(Gutter.prototype); + +exports.Gutter = Gutter; + +}); diff --git a/addons/editor/ace/layer/marker.js b/addons/editor/ace/layer/marker.js new file mode 100755 index 00000000..cd1b992d --- /dev/null +++ b/addons/editor/ace/layer/marker.js @@ -0,0 +1,218 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var Range = require("../range").Range; +var dom = require("../lib/dom"); + +var Marker = function(parentEl) { + this.element = dom.createElement("div"); + this.element.className = "ace_layer ace_marker-layer"; + parentEl.appendChild(this.element); +}; + +(function() { + + this.$padding = 0; + + this.setPadding = function(padding) { + this.$padding = padding; + }; + this.setSession = function(session) { + this.session = session; + }; + + this.setMarkers = function(markers) { + this.markers = markers; + }; + + this.update = function(config) { + var config = config || this.config; + if (!config) + return; + + this.config = config; + + + var html = []; + for (var key in this.markers) { + var marker = this.markers[key]; + + if (!marker.range) { + marker.update(html, this, this.session, config); + continue; + } + + var range = marker.range.clipRows(config.firstRow, config.lastRow); + if (range.isEmpty()) continue; + + range = range.toScreenRange(this.session); + if (marker.renderer) { + var top = this.$getTop(range.start.row, config); + var left = this.$padding + range.start.column * config.characterWidth; + marker.renderer(html, range, left, top, config); + } else if (marker.type == "fullLine") { + this.drawFullLineMarker(html, range, marker.clazz, config); + } else if (marker.type == "screenLine") { + this.drawScreenLineMarker(html, range, marker.clazz, config); + } else if (range.isMultiLine()) { + if (marker.type == "text") + this.drawTextMarker(html, range, marker.clazz, config); + else + this.drawMultiLineMarker(html, range, marker.clazz, config); + } else { + this.drawSingleLineMarker(html, range, marker.clazz + " ace_start", config); + } + } + this.element = dom.setInnerHtml(this.element, html.join("")); + }; + + this.$getTop = function(row, layerConfig) { + return (row - layerConfig.firstRowScreen) * layerConfig.lineHeight; + }; + + // Draws a marker, which spans a range of text on multiple lines + this.drawTextMarker = function(stringBuilder, range, clazz, layerConfig, extraStyle) { + // selection start + var row = range.start.row; + + var lineRange = new Range( + row, range.start.column, + row, this.session.getScreenLastRowColumn(row) + ); + this.drawSingleLineMarker(stringBuilder, lineRange, clazz + " ace_start", layerConfig, 1, extraStyle); + + // selection end + row = range.end.row; + lineRange = new Range(row, 0, row, range.end.column); + this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 0, extraStyle); + + for (row = range.start.row + 1; row < range.end.row; row++) { + lineRange.start.row = row; + lineRange.end.row = row; + lineRange.end.column = this.session.getScreenLastRowColumn(row); + this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 1, extraStyle); + } + }; + + // Draws a multi line marker, where lines span the full width + this.drawMultiLineMarker = function(stringBuilder, range, clazz, config, extraStyle) { + // from selection start to the end of the line + var padding = this.$padding; + var height = config.lineHeight; + var top = this.$getTop(range.start.row, config); + var left = padding + range.start.column * config.characterWidth; + extraStyle = extraStyle || ""; + + stringBuilder.push( + "
" + ); + + // from start of the last line to the selection end + top = this.$getTop(range.end.row, config); + var width = range.end.column * config.characterWidth; + + stringBuilder.push( + "
" + ); + + // all the complete lines + height = (range.end.row - range.start.row - 1) * config.lineHeight; + if (height < 0) + return; + top = this.$getTop(range.start.row + 1, config); + + stringBuilder.push( + "
" + ); + }; + + // Draws a marker which covers part or whole width of a single screen line + this.drawSingleLineMarker = function(stringBuilder, range, clazz, config, extraLength, extraStyle) { + var height = config.lineHeight; + var width = (range.end.column + (extraLength || 0) - range.start.column) * config.characterWidth; + + var top = this.$getTop(range.start.row, config); + var left = this.$padding + range.start.column * config.characterWidth; + + stringBuilder.push( + "
" + ); + }; + + this.drawFullLineMarker = function(stringBuilder, range, clazz, config, extraStyle) { + var top = this.$getTop(range.start.row, config); + var height = config.lineHeight; + if (range.start.row != range.end.row) + height += this.$getTop(range.end.row, config) - top; + + stringBuilder.push( + "
" + ); + }; + + this.drawScreenLineMarker = function(stringBuilder, range, clazz, config, extraStyle) { + var top = this.$getTop(range.start.row, config); + var height = config.lineHeight; + + stringBuilder.push( + "
" + ); + }; + +}).call(Marker.prototype); + +exports.Marker = Marker; + +}); diff --git a/addons/editor/ace/layer/text.js b/addons/editor/ace/layer/text.js new file mode 100755 index 00000000..54f0ef46 --- /dev/null +++ b/addons/editor/ace/layer/text.js @@ -0,0 +1,661 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var dom = require("../lib/dom"); +var lang = require("../lib/lang"); +var useragent = require("../lib/useragent"); +var EventEmitter = require("../lib/event_emitter").EventEmitter; + +var Text = function(parentEl) { + this.element = dom.createElement("div"); + this.element.className = "ace_layer ace_text-layer"; + parentEl.appendChild(this.element); + + this.$characterSize = {width: 0, height: 0}; + this.checkForSizeChanges(); + this.$pollSizeChanges(); +}; + +(function() { + + oop.implement(this, EventEmitter); + + this.EOF_CHAR = "\xB6"; //"¶"; + this.EOL_CHAR = "\xAC"; //"¬"; + this.TAB_CHAR = "\u2192"; //"→" "\u21E5"; + this.SPACE_CHAR = "\xB7"; //"·"; + this.$padding = 0; + + this.setPadding = function(padding) { + this.$padding = padding; + this.element.style.padding = "0 " + padding + "px"; + }; + + this.getLineHeight = function() { + return this.$characterSize.height || 0; + }; + + this.getCharacterWidth = function() { + return this.$characterSize.width || 0; + }; + + this.checkForSizeChanges = function() { + var size = this.$measureSizes(); + if (size && (this.$characterSize.width !== size.width || this.$characterSize.height !== size.height)) { + this.$measureNode.style.fontWeight = "bold"; + var boldSize = this.$measureSizes(); + this.$measureNode.style.fontWeight = ""; + this.$characterSize = size; + this.allowBoldFonts = boldSize && boldSize.width === size.width && boldSize.height === size.height; + this._emit("changeCharacterSize", {data: size}); + } + }; + + this.$pollSizeChanges = function() { + var self = this; + this.$pollSizeChangesTimer = setInterval(function() { + self.checkForSizeChanges(); + }, 500); + }; + + this.$fontStyles = { + fontFamily : 1, + fontSize : 1, + fontWeight : 1, + fontStyle : 1, + lineHeight : 1 + }; + + this.$measureSizes = useragent.isIE || useragent.isOldGecko ? function() { + var n = 1000; + if (!this.$measureNode) { + var measureNode = this.$measureNode = dom.createElement("div"); + var style = measureNode.style; + + style.width = style.height = "auto"; + style.left = style.top = (-n * 40) + "px"; + + style.visibility = "hidden"; + style.position = "fixed"; + style.overflow = "visible"; + style.whiteSpace = "nowrap"; + + // in FF 3.6 monospace fonts can have a fixed sub pixel width. + // that's why we have to measure many characters + // Note: characterWidth can be a float! + measureNode.innerHTML = lang.stringRepeat("Xy", n); + + if (this.element.ownerDocument.body) { + this.element.ownerDocument.body.appendChild(measureNode); + } else { + var container = this.element.parentNode; + while (!dom.hasCssClass(container, "ace_editor")) + container = container.parentNode; + container.appendChild(measureNode); + } + } + + // Size and width can be null if the editor is not visible or + // detached from the document + if (!this.element.offsetWidth) + return null; + + var style = this.$measureNode.style; + var computedStyle = dom.computedStyle(this.element); + for (var prop in this.$fontStyles) + style[prop] = computedStyle[prop]; + + var size = { + height: this.$measureNode.offsetHeight, + width: this.$measureNode.offsetWidth / (n * 2) + }; + + // Size and width can be null if the editor is not visible or + // detached from the document + if (size.width == 0 || size.height == 0) + return null; + + return size; + } + : function() { + if (!this.$measureNode) { + var measureNode = this.$measureNode = dom.createElement("div"); + var style = measureNode.style; + + style.width = style.height = "auto"; + style.left = style.top = -100 + "px"; + + style.visibility = "hidden"; + style.position = "fixed"; + style.overflow = "visible"; + style.whiteSpace = "nowrap"; + + // fixes fractional fixed-width fonts; see http://git.io/CavZNw + measureNode.innerHTML = lang.stringRepeat("X", 100); + + var container = this.element.parentNode; + while (container && !dom.hasCssClass(container, "ace_editor")) + container = container.parentNode; + + if (!container) + return this.$measureNode = null; + + container.appendChild(measureNode); + } + + var rect = this.$measureNode.getBoundingClientRect(); + + var size = { + height: rect.height, + width: rect.width / 100 + }; + + // Size and width can be null if the editor is not visible or + // detached from the document + if (size.width == 0 || size.height == 0) + return null; + + return size; + }; + + this.setSession = function(session) { + this.session = session; + this.$computeTabString(); + }; + + this.showInvisibles = false; + this.setShowInvisibles = function(showInvisibles) { + if (this.showInvisibles == showInvisibles) + return false; + + this.showInvisibles = showInvisibles; + this.$computeTabString(); + return true; + }; + + this.displayIndentGuides = true; + this.setDisplayIndentGuides = function(display) { + if (this.displayIndentGuides == display) + return false; + + this.displayIndentGuides = display; + this.$computeTabString(); + return true; + }; + + this.$tabStrings = []; + this.onChangeTabSize = + this.$computeTabString = function() { + var tabSize = this.session.getTabSize(); + this.tabSize = tabSize; + var tabStr = this.$tabStrings = [0]; + for (var i = 1; i < tabSize + 1; i++) { + if (this.showInvisibles) { + tabStr.push("" + + this.TAB_CHAR + + lang.stringRepeat("\xa0", i - 1) + + ""); + } else { + tabStr.push(lang.stringRepeat("\xa0", i)); + } + } + if (this.displayIndentGuides) { + this.$indentGuideRe = /\s\S| \t|\t |\s$/; + var className = "ace_indent-guide"; + if (this.showInvisibles) { + className += " ace_invisible"; + var spaceContent = lang.stringRepeat(this.SPACE_CHAR, this.tabSize); + var tabContent = this.TAB_CHAR + lang.stringRepeat("\xa0", this.tabSize - 1); + } else{ + var spaceContent = lang.stringRepeat("\xa0", this.tabSize); + var tabContent = spaceContent; + } + + this.$tabStrings[" "] = "" + spaceContent + ""; + this.$tabStrings["\t"] = "" + tabContent + ""; + } + }; + + this.updateLines = function(config, firstRow, lastRow) { + // Due to wrap line changes there can be new lines if e.g. + // the line to updated wrapped in the meantime. + if (this.config.lastRow != config.lastRow || + this.config.firstRow != config.firstRow) { + this.scrollLines(config); + } + this.config = config; + + var first = Math.max(firstRow, config.firstRow); + var last = Math.min(lastRow, config.lastRow); + + var lineElements = this.element.childNodes; + var lineElementsIdx = 0; + + for (var row = config.firstRow; row < first; row++) { + var foldLine = this.session.getFoldLine(row); + if (foldLine) { + if (foldLine.containsRow(first)) { + first = foldLine.start.row; + break; + } else { + row = foldLine.end.row; + } + } + lineElementsIdx ++; + } + + var row = first; + var foldLine = this.session.getNextFoldLine(row); + var foldStart = foldLine ? foldLine.start.row : Infinity; + + while (true) { + if (row > foldStart) { + row = foldLine.end.row+1; + foldLine = this.session.getNextFoldLine(row, foldLine); + foldStart = foldLine ? foldLine.start.row :Infinity; + } + if (row > last) + break; + + var lineElement = lineElements[lineElementsIdx++]; + if (lineElement) { + var html = []; + this.$renderLine( + html, row, !this.$useLineGroups(), row == foldStart ? foldLine : false + ); + dom.setInnerHtml(lineElement, html.join("")); + } + row++; + } + }; + + this.scrollLines = function(config) { + var oldConfig = this.config; + this.config = config; + + if (!oldConfig || oldConfig.lastRow < config.firstRow) + return this.update(config); + + if (config.lastRow < oldConfig.firstRow) + return this.update(config); + + var el = this.element; + if (oldConfig.firstRow < config.firstRow) + for (var row=this.session.getFoldedRowCount(oldConfig.firstRow, config.firstRow - 1); row>0; row--) + el.removeChild(el.firstChild); + + if (oldConfig.lastRow > config.lastRow) + for (var row=this.session.getFoldedRowCount(config.lastRow + 1, oldConfig.lastRow); row>0; row--) + el.removeChild(el.lastChild); + + if (config.firstRow < oldConfig.firstRow) { + var fragment = this.$renderLinesFragment(config, config.firstRow, oldConfig.firstRow - 1); + if (el.firstChild) + el.insertBefore(fragment, el.firstChild); + else + el.appendChild(fragment); + } + + if (config.lastRow > oldConfig.lastRow) { + var fragment = this.$renderLinesFragment(config, oldConfig.lastRow + 1, config.lastRow); + el.appendChild(fragment); + } + }; + + this.$renderLinesFragment = function(config, firstRow, lastRow) { + var fragment = this.element.ownerDocument.createDocumentFragment(); + var row = firstRow; + var foldLine = this.session.getNextFoldLine(row); + var foldStart = foldLine ? foldLine.start.row : Infinity; + + while (true) { + if (row > foldStart) { + row = foldLine.end.row+1; + foldLine = this.session.getNextFoldLine(row, foldLine); + foldStart = foldLine ? foldLine.start.row : Infinity; + } + if (row > lastRow) + break; + + var container = dom.createElement("div"); + + var html = []; + // Get the tokens per line as there might be some lines in between + // beeing folded. + this.$renderLine(html, row, false, row == foldStart ? foldLine : false); + + // don't use setInnerHtml since we are working with an empty DIV + container.innerHTML = html.join(""); + if (this.$useLineGroups()) { + container.className = 'ace_line_group'; + fragment.appendChild(container); + } else { + var lines = container.childNodes + while(lines.length) + fragment.appendChild(lines[0]); + } + + row++; + } + return fragment; + }; + + this.update = function(config) { + this.config = config; + + var html = []; + var firstRow = config.firstRow, lastRow = config.lastRow; + + var row = firstRow; + var foldLine = this.session.getNextFoldLine(row); + var foldStart = foldLine ? foldLine.start.row : Infinity; + + while (true) { + if (row > foldStart) { + row = foldLine.end.row+1; + foldLine = this.session.getNextFoldLine(row, foldLine); + foldStart = foldLine ? foldLine.start.row :Infinity; + } + if (row > lastRow) + break; + + if (this.$useLineGroups()) + html.push("
") + + this.$renderLine(html, row, false, row == foldStart ? foldLine : false); + + if (this.$useLineGroups()) + html.push("
"); // end the line group + + row++; + } + this.element = dom.setInnerHtml(this.element, html.join("")); + }; + + this.$textToken = { + "text": true, + "rparen": true, + "lparen": true + }; + + this.$renderToken = function(stringBuilder, screenColumn, token, value) { + var self = this; + var replaceReg = /\t|&|<|( +)|([\x00-\x1f\x80-\xa0\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\u3000\uFEFF])|[\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3000-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]/g; + var replaceFunc = function(c, a, b, tabIdx, idx4) { + if (a) { + return self.showInvisibles ? + "" + lang.stringRepeat(self.SPACE_CHAR, c.length) + "" : + lang.stringRepeat("\xa0", c.length); + } else if (c == "&") { + return "&"; + } else if (c == "<") { + return "<"; + } else if (c == "\t") { + var tabSize = self.session.getScreenTabSize(screenColumn + tabIdx); + screenColumn += tabSize - 1; + return self.$tabStrings[tabSize]; + } else if (c == "\u3000") { + // U+3000 is both invisible AND full-width, so must be handled uniquely + var classToUse = self.showInvisibles ? "ace_cjk ace_invisible" : "ace_cjk"; + var space = self.showInvisibles ? self.SPACE_CHAR : ""; + screenColumn += 1; + return "" + space + ""; + } else if (b) { + return "" + self.SPACE_CHAR + ""; + } else { + screenColumn += 1; + return "" + c + ""; + } + }; + + var output = value.replace(replaceReg, replaceFunc); + + if (!this.$textToken[token.type]) { + var classes = "ace_" + token.type.replace(/\./g, " ace_"); + var style = ""; + if (token.type == "fold") + style = " style='width:" + (token.value.length * this.config.characterWidth) + "px;' "; + stringBuilder.push("", output, ""); + } + else { + stringBuilder.push(output); + } + return screenColumn + value.length; + }; + + this.renderIndentGuide = function(stringBuilder, value, max) { + var cols = value.search(this.$indentGuideRe); + if (cols <= 0 || cols >= max) + return value; + if (value[0] == " ") { + cols -= cols % this.tabSize; + stringBuilder.push(lang.stringRepeat(this.$tabStrings[" "], cols/this.tabSize)); + return value.substr(cols); + } else if (value[0] == "\t") { + stringBuilder.push(lang.stringRepeat(this.$tabStrings["\t"], cols)); + return value.substr(cols); + } + return value; + }; + + this.$renderWrappedLine = function(stringBuilder, tokens, splits, onlyContents) { + var chars = 0; + var split = 0; + var splitChars = splits[0]; + var screenColumn = 0; + + for (var i = 0; i < tokens.length; i++) { + var token = tokens[i]; + var value = token.value; + if (i == 0 && this.displayIndentGuides) { + chars = value.length; + value = this.renderIndentGuide(stringBuilder, value, splitChars); + if (!value) + continue; + chars -= value.length; + } + + if (chars + value.length < splitChars) { + screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value); + chars += value.length; + } else { + while (chars + value.length >= splitChars) { + screenColumn = this.$renderToken( + stringBuilder, screenColumn, + token, value.substring(0, splitChars - chars) + ); + value = value.substring(splitChars - chars); + chars = splitChars; + + if (!onlyContents) { + stringBuilder.push("
", + "
" + ); + } + + split ++; + screenColumn = 0; + splitChars = splits[split] || Number.MAX_VALUE; + } + if (value.length != 0) { + chars += value.length; + screenColumn = this.$renderToken( + stringBuilder, screenColumn, token, value + ); + } + } + } + }; + + this.$renderSimpleLine = function(stringBuilder, tokens) { + var screenColumn = 0; + var token = tokens[0]; + var value = token.value; + if (this.displayIndentGuides) + value = this.renderIndentGuide(stringBuilder, value); + if (value) + screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value); + for (var i = 1; i < tokens.length; i++) { + token = tokens[i]; + value = token.value; + screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value); + } + }; + + // row is either first row of foldline or not in fold + this.$renderLine = function(stringBuilder, row, onlyContents, foldLine) { + if (!foldLine && foldLine != false) + foldLine = this.session.getFoldLine(row); + + if (foldLine) + var tokens = this.$getFoldLineTokens(row, foldLine); + else + var tokens = this.session.getTokens(row); + + + if (!onlyContents) { + stringBuilder.push( + "
" + ); + } + + if (tokens.length) { + var splits = this.session.getRowSplitData(row); + if (splits && splits.length) + this.$renderWrappedLine(stringBuilder, tokens, splits, onlyContents); + else + this.$renderSimpleLine(stringBuilder, tokens); + } + + if (this.showInvisibles) { + if (foldLine) + row = foldLine.end.row + + stringBuilder.push( + "", + row == this.session.getLength() - 1 ? this.EOF_CHAR : this.EOL_CHAR, + "" + ); + } + if (!onlyContents) + stringBuilder.push("
"); + }; + + this.$getFoldLineTokens = function(row, foldLine) { + var session = this.session; + var renderTokens = []; + + function addTokens(tokens, from, to) { + var idx = 0, col = 0; + while ((col + tokens[idx].value.length) < from) { + col += tokens[idx].value.length; + idx++; + + if (idx == tokens.length) + return; + } + if (col != from) { + var value = tokens[idx].value.substring(from - col); + // Check if the token value is longer then the from...to spacing. + if (value.length > (to - from)) + value = value.substring(0, to - from); + + renderTokens.push({ + type: tokens[idx].type, + value: value + }); + + col = from + value.length; + idx += 1; + } + + while (col < to && idx < tokens.length) { + var value = tokens[idx].value; + if (value.length + col > to) { + renderTokens.push({ + type: tokens[idx].type, + value: value.substring(0, to - col) + }); + } else + renderTokens.push(tokens[idx]); + col += value.length; + idx += 1; + } + } + + var tokens = session.getTokens(row); + foldLine.walk(function(placeholder, row, column, lastColumn, isNewRow) { + if (placeholder != null) { + renderTokens.push({ + type: "fold", + value: placeholder + }); + } else { + if (isNewRow) + tokens = session.getTokens(row); + + if (tokens.length) + addTokens(tokens, lastColumn, column); + } + }, foldLine.end.row, this.session.getLine(foldLine.end.row).length); + + return renderTokens; + }; + + this.$useLineGroups = function() { + // For the updateLines function to work correctly, it's important that the + // child nodes of this.element correspond on a 1-to-1 basis to rows in the + // document (as distinct from lines on the screen). For sessions that are + // wrapped, this means we need to add a layer to the node hierarchy (tagged + // with the class name ace_line_group). + return this.session.getUseWrapMode(); + }; + + this.destroy = function() { + clearInterval(this.$pollSizeChangesTimer); + if (this.$measureNode) + this.$measureNode.parentNode.removeChild(this.$measureNode); + delete this.$measureNode; + }; + +}).call(Text.prototype); + +exports.Text = Text; + +}); diff --git a/addons/editor/ace/layer/text_test.js b/addons/editor/ace/layer/text_test.js new file mode 100755 index 00000000..a14a37e6 --- /dev/null +++ b/addons/editor/ace/layer/text_test.js @@ -0,0 +1,126 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +if (typeof process !== "undefined") { + require("amd-loader"); + require("../test/mockdom"); +} + +define(function(require, exports, module) { +"use strict"; + +var assert = require("../test/assertions"); +var EditSession = require("../edit_session").EditSession; +var TextLayer = require("./text").Text; +var JavaScriptMode = require("../mode/javascript").Mode; + +module.exports = { + + setUp: function(next) { + this.session = new EditSession(""); + this.session.setMode(new JavaScriptMode()); + this.textLayer = new TextLayer(document.createElement("div")); + this.textLayer.setSession(this.session); + this.textLayer.config = { + characterWidth: 10, + lineHeight: 20 + }; + next() + }, + + "test: render line with hard tabs should render the same as lines with soft tabs" : function() { + this.session.setValue("a\ta\ta\t\na a a \n"); + this.textLayer.$computeTabString(); + + // row with hard tabs + var stringBuilder = []; + this.textLayer.$renderLine(stringBuilder, 0); + + // row with soft tabs + var stringBuilder2 = []; + this.textLayer.$renderLine(stringBuilder2, 1); + assert.equal(stringBuilder.join(""), stringBuilder2.join("")); + }, + + "test rendering width of ideographic space (U+3000)" : function() { + this.session.setValue("\u3000"); + + var stringBuilder = []; + this.textLayer.$renderLine(stringBuilder, 0, true); + assert.equal(stringBuilder.join(""), ""); + + this.textLayer.setShowInvisibles(true); + var stringBuilder = []; + this.textLayer.$renderLine(stringBuilder, 0, true); + assert.equal( + stringBuilder.join(""), + "" + this.textLayer.SPACE_CHAR + "" + + "\xB6" + ); + }, + + "test rendering of indent guides" : function() { + var textLayer = this.textLayer + var EOL = "" + textLayer.EOL_CHAR + ""; + var SPACE = function(i) {return Array(i+1).join("\xa0")} + var DOT = function(i) {return Array(i+1).join(textLayer.SPACE_CHAR)} + var TAB = function(i) {return textLayer.TAB_CHAR + SPACE(i-1)} + function testRender(results) { + for (var i = results.length; i--; ) { + var stringBuilder = []; + textLayer.$renderLine(stringBuilder, i, true); + assert.equal(stringBuilder.join(""), results[i]); + } + } + + this.session.setValue(" \n\t\tf\n "); + testRender([ + "" + SPACE(4) + "" + SPACE(2), + "" + SPACE(4) + "" + SPACE(4) + "f", + SPACE(3) + ]); + this.textLayer.setShowInvisibles(true); + testRender([ + "" + DOT(4) + "" + DOT(2) + "" + EOL, + "" + TAB(4) + "" + TAB(4) + "f" + EOL, + ]); + this.textLayer.setDisplayIndentGuides(false); + testRender([ + "" + DOT(6) + "" + EOL, + "" + TAB(4) + "" + TAB(4) + "f" + EOL + ]); + } +}; + +}); + +if (typeof module !== "undefined" && module === require.main) { + require("asyncjs").test.testcase(module.exports).exec() +} diff --git a/addons/editor/ace/lib/dom.js b/addons/editor/ace/lib/dom.js new file mode 100755 index 00000000..b3724009 --- /dev/null +++ b/addons/editor/ace/lib/dom.js @@ -0,0 +1,283 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +if (typeof document == "undefined") + return; + +var XHTML_NS = "http://www.w3.org/1999/xhtml"; + +exports.getDocumentHead = function(doc) { + if (!doc) + doc = document; + return doc.head || doc.getElementsByTagName("head")[0] || doc.documentElement; +} + +exports.createElement = function(tag, ns) { + return document.createElementNS ? + document.createElementNS(ns || XHTML_NS, tag) : + document.createElement(tag); +}; + +exports.hasCssClass = function(el, name) { + var classes = el.className.split(/\s+/g); + return classes.indexOf(name) !== -1; +}; + +/* +* Add a CSS class to the list of classes on the given node +*/ +exports.addCssClass = function(el, name) { + if (!exports.hasCssClass(el, name)) { + el.className += " " + name; + } +}; + +/* +* Remove a CSS class from the list of classes on the given node +*/ +exports.removeCssClass = function(el, name) { + var classes = el.className.split(/\s+/g); + while (true) { + var index = classes.indexOf(name); + if (index == -1) { + break; + } + classes.splice(index, 1); + } + el.className = classes.join(" "); +}; + +exports.toggleCssClass = function(el, name) { + var classes = el.className.split(/\s+/g), add = true; + while (true) { + var index = classes.indexOf(name); + if (index == -1) { + break; + } + add = false; + classes.splice(index, 1); + } + if(add) + classes.push(name); + + el.className = classes.join(" "); + return add; +}; + +/* + * Add or remove a CSS class from the list of classes on the given node + * depending on the value of include + */ +exports.setCssClass = function(node, className, include) { + if (include) { + exports.addCssClass(node, className); + } else { + exports.removeCssClass(node, className); + } +}; + +exports.hasCssString = function(id, doc) { + var index = 0, sheets; + doc = doc || document; + + if (doc.createStyleSheet && (sheets = doc.styleSheets)) { + while (index < sheets.length) + if (sheets[index++].owningElement.id === id) return true; + } else if ((sheets = doc.getElementsByTagName("style"))) { + while (index < sheets.length) + if (sheets[index++].id === id) return true; + } + + return false; +}; + +exports.importCssString = function importCssString(cssText, id, doc) { + doc = doc || document; + // If style is already imported return immediately. + if (id && exports.hasCssString(id, doc)) + return null; + + var style; + + if (doc.createStyleSheet) { + style = doc.createStyleSheet(); + style.cssText = cssText; + if (id) + style.owningElement.id = id; + } else { + style = doc.createElementNS + ? doc.createElementNS(XHTML_NS, "style") + : doc.createElement("style"); + + style.appendChild(doc.createTextNode(cssText)); + if (id) + style.id = id; + + exports.getDocumentHead(doc).appendChild(style); + } +}; + +exports.importCssStylsheet = function(uri, doc) { + if (doc.createStyleSheet) { + doc.createStyleSheet(uri); + } else { + var link = exports.createElement('link'); + link.rel = 'stylesheet'; + link.href = uri; + + exports.getDocumentHead(doc).appendChild(link); + } +}; + +exports.getInnerWidth = function(element) { + return ( + parseInt(exports.computedStyle(element, "paddingLeft"), 10) + + parseInt(exports.computedStyle(element, "paddingRight"), 10) + + element.clientWidth + ); +}; + +exports.getInnerHeight = function(element) { + return ( + parseInt(exports.computedStyle(element, "paddingTop"), 10) + + parseInt(exports.computedStyle(element, "paddingBottom"), 10) + + element.clientHeight + ); +}; + +if (window.pageYOffset !== undefined) { + exports.getPageScrollTop = function() { + return window.pageYOffset; + }; + + exports.getPageScrollLeft = function() { + return window.pageXOffset; + }; +} +else { + exports.getPageScrollTop = function() { + return document.body.scrollTop; + }; + + exports.getPageScrollLeft = function() { + return document.body.scrollLeft; + }; +} + +if (window.getComputedStyle) + exports.computedStyle = function(element, style) { + if (style) + return (window.getComputedStyle(element, "") || {})[style] || ""; + return window.getComputedStyle(element, "") || {}; + }; +else + exports.computedStyle = function(element, style) { + if (style) + return element.currentStyle[style]; + return element.currentStyle; + }; + +exports.scrollbarWidth = function(document) { + var inner = exports.createElement("ace_inner"); + inner.style.width = "100%"; + inner.style.minWidth = "0px"; + inner.style.height = "200px"; + inner.style.display = "block"; + + var outer = exports.createElement("ace_outer"); + var style = outer.style; + + style.position = "absolute"; + style.left = "-10000px"; + style.overflow = "hidden"; + style.width = "200px"; + style.minWidth = "0px"; + style.height = "150px"; + style.display = "block"; + + outer.appendChild(inner); + + var body = document.documentElement; + body.appendChild(outer); + + var noScrollbar = inner.offsetWidth; + + style.overflow = "scroll"; + var withScrollbar = inner.offsetWidth; + + if (noScrollbar == withScrollbar) { + withScrollbar = outer.clientWidth; + } + + body.removeChild(outer); + + return noScrollbar-withScrollbar; +}; + +/* + * Optimized set innerHTML. This is faster than plain innerHTML if the element + * already contains a lot of child elements. + * + * See http://blog.stevenlevithan.com/archives/faster-than-innerhtml for details + */ +exports.setInnerHtml = function(el, innerHtml) { + var element = el.cloneNode(false);//document.createElement("div"); + element.innerHTML = innerHtml; + el.parentNode.replaceChild(element, el); + return element; +}; + +if ("textContent" in document.documentElement) { + exports.setInnerText = function(el, innerText) { + el.textContent = innerText; + }; + + exports.getInnerText = function(el) { + return el.textContent; + }; +} +else { + exports.setInnerText = function(el, innerText) { + el.innerText = innerText; + }; + + exports.getInnerText = function(el) { + return el.innerText; + }; +} + +exports.getParentWindow = function(document) { + return document.defaultView || document.parentWindow; +}; + +}); diff --git a/addons/editor/ace/lib/es5-shim.js b/addons/editor/ace/lib/es5-shim.js new file mode 100755 index 00000000..217bdc61 --- /dev/null +++ b/addons/editor/ace/lib/es5-shim.js @@ -0,0 +1,1062 @@ +// https://github.com/kriskowal/es5-shim +// Copyright 2009-2012 by contributors, MIT License + +define(function(require, exports, module) { + +/* + * Brings an environment as close to ECMAScript 5 compliance + * as is possible with the facilities of erstwhile engines. + * + * Annotated ES5: http://es5.github.com/ (specific links below) + * ES5 Spec: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf + * Required reading: http://javascriptweblog.wordpress.com/2011/12/05/extending-javascript-natives/ + */ + +// +// Function +// ======== +// + +// ES-5 15.3.4.5 +// http://es5.github.com/#x15.3.4.5 + +function Empty() {} + +if (!Function.prototype.bind) { + Function.prototype.bind = function bind(that) { // .length is 1 + // 1. Let Target be the this value. + var target = this; + // 2. If IsCallable(Target) is false, throw a TypeError exception. + if (typeof target != "function") { + throw new TypeError("Function.prototype.bind called on incompatible " + target); + } + // 3. Let A be a new (possibly empty) internal list of all of the + // argument values provided after thisArg (arg1, arg2 etc), in order. + // XXX slicedArgs will stand in for "A" if used + var args = slice.call(arguments, 1); // for normal call + // 4. Let F be a new native ECMAScript object. + // 11. Set the [[Prototype]] internal property of F to the standard + // built-in Function prototype object as specified in 15.3.3.1. + // 12. Set the [[Call]] internal property of F as described in + // 15.3.4.5.1. + // 13. Set the [[Construct]] internal property of F as described in + // 15.3.4.5.2. + // 14. Set the [[HasInstance]] internal property of F as described in + // 15.3.4.5.3. + var bound = function () { + + if (this instanceof bound) { + // 15.3.4.5.2 [[Construct]] + // When the [[Construct]] internal method of a function object, + // F that was created using the bind function is called with a + // list of arguments ExtraArgs, the following steps are taken: + // 1. Let target be the value of F's [[TargetFunction]] + // internal property. + // 2. If target has no [[Construct]] internal method, a + // TypeError exception is thrown. + // 3. Let boundArgs be the value of F's [[BoundArgs]] internal + // property. + // 4. Let args be a new list containing the same values as the + // list boundArgs in the same order followed by the same + // values as the list ExtraArgs in the same order. + // 5. Return the result of calling the [[Construct]] internal + // method of target providing args as the arguments. + + var result = target.apply( + this, + args.concat(slice.call(arguments)) + ); + if (Object(result) === result) { + return result; + } + return this; + + } else { + // 15.3.4.5.1 [[Call]] + // When the [[Call]] internal method of a function object, F, + // which was created using the bind function is called with a + // this value and a list of arguments ExtraArgs, the following + // steps are taken: + // 1. Let boundArgs be the value of F's [[BoundArgs]] internal + // property. + // 2. Let boundThis be the value of F's [[BoundThis]] internal + // property. + // 3. Let target be the value of F's [[TargetFunction]] internal + // property. + // 4. Let args be a new list containing the same values as the + // list boundArgs in the same order followed by the same + // values as the list ExtraArgs in the same order. + // 5. Return the result of calling the [[Call]] internal method + // of target providing boundThis as the this value and + // providing args as the arguments. + + // equiv: target.call(this, ...boundArgs, ...args) + return target.apply( + that, + args.concat(slice.call(arguments)) + ); + + } + + }; + if(target.prototype) { + Empty.prototype = target.prototype; + bound.prototype = new Empty(); + // Clean up dangling references. + Empty.prototype = null; + } + // XXX bound.length is never writable, so don't even try + // + // 15. If the [[Class]] internal property of Target is "Function", then + // a. Let L be the length property of Target minus the length of A. + // b. Set the length own property of F to either 0 or L, whichever is + // larger. + // 16. Else set the length own property of F to 0. + // 17. Set the attributes of the length own property of F to the values + // specified in 15.3.5.1. + + // TODO + // 18. Set the [[Extensible]] internal property of F to true. + + // TODO + // 19. Let thrower be the [[ThrowTypeError]] function Object (13.2.3). + // 20. Call the [[DefineOwnProperty]] internal method of F with + // arguments "caller", PropertyDescriptor {[[Get]]: thrower, [[Set]]: + // thrower, [[Enumerable]]: false, [[Configurable]]: false}, and + // false. + // 21. Call the [[DefineOwnProperty]] internal method of F with + // arguments "arguments", PropertyDescriptor {[[Get]]: thrower, + // [[Set]]: thrower, [[Enumerable]]: false, [[Configurable]]: false}, + // and false. + + // TODO + // NOTE Function objects created using Function.prototype.bind do not + // have a prototype property or the [[Code]], [[FormalParameters]], and + // [[Scope]] internal properties. + // XXX can't delete prototype in pure-js. + + // 22. Return F. + return bound; + }; +} + +// Shortcut to an often accessed properties, in order to avoid multiple +// dereference that costs universally. +// _Please note: Shortcuts are defined after `Function.prototype.bind` as we +// us it in defining shortcuts. +var call = Function.prototype.call; +var prototypeOfArray = Array.prototype; +var prototypeOfObject = Object.prototype; +var slice = prototypeOfArray.slice; +// Having a toString local variable name breaks in Opera so use _toString. +var _toString = call.bind(prototypeOfObject.toString); +var owns = call.bind(prototypeOfObject.hasOwnProperty); + +// If JS engine supports accessors creating shortcuts. +var defineGetter; +var defineSetter; +var lookupGetter; +var lookupSetter; +var supportsAccessors; +if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) { + defineGetter = call.bind(prototypeOfObject.__defineGetter__); + defineSetter = call.bind(prototypeOfObject.__defineSetter__); + lookupGetter = call.bind(prototypeOfObject.__lookupGetter__); + lookupSetter = call.bind(prototypeOfObject.__lookupSetter__); +} + +// +// Array +// ===== +// + +// ES5 15.4.4.12 +// http://es5.github.com/#x15.4.4.12 +// Default value for second param +// [bugfix, ielt9, old browsers] +// IE < 9 bug: [1,2].splice(0).join("") == "" but should be "12" +if ([1,2].splice(0).length != 2) { + if(function() { // test IE < 9 to splice bug - see issue #138 + function makeArray(l) { + var a = new Array(l+2); + a[0] = a[1] = 0; + return a; + } + var array = [], lengthBefore; + + array.splice.apply(array, makeArray(20)); + array.splice.apply(array, makeArray(26)); + + lengthBefore = array.length; //46 + array.splice(5, 0, "XXX"); // add one element + + lengthBefore + 1 == array.length + + if (lengthBefore + 1 == array.length) { + return true;// has right splice implementation without bugs + } + // else { + // IE8 bug + // } + }()) {//IE 6/7 + var array_splice = Array.prototype.splice; + Array.prototype.splice = function(start, deleteCount) { + if (!arguments.length) { + return []; + } else { + return array_splice.apply(this, [ + start === void 0 ? 0 : start, + deleteCount === void 0 ? (this.length - start) : deleteCount + ].concat(slice.call(arguments, 2))) + } + }; + } else {//IE8 + // taken from http://docs.sencha.com/ext-js/4-1/source/Array2.html + Array.prototype.splice = function(pos, removeCount){ + var length = this.length; + if (pos > 0) { + if (pos > length) + pos = length; + } else if (pos == void 0) { + pos = 0; + } else if (pos < 0) { + pos = Math.max(length + pos, 0); + } + + if (!(pos+removeCount < length)) + removeCount = length - pos; + + var removed = this.slice(pos, pos+removeCount); + var insert = slice.call(arguments, 2); + var add = insert.length; + + // we try to use Array.push when we can for efficiency... + if (pos === length) { + if (add) { + this.push.apply(this, insert); + } + } else { + var remove = Math.min(removeCount, length - pos); + var tailOldPos = pos + remove; + var tailNewPos = tailOldPos + add - remove; + var tailCount = length - tailOldPos; + var lengthAfterRemove = length - remove; + + if (tailNewPos < tailOldPos) { // case A + for (var i = 0; i < tailCount; ++i) { + this[tailNewPos+i] = this[tailOldPos+i]; + } + } else if (tailNewPos > tailOldPos) { // case B + for (i = tailCount; i--; ) { + this[tailNewPos+i] = this[tailOldPos+i]; + } + } // else, add == remove (nothing to do) + + if (add && pos === lengthAfterRemove) { + this.length = lengthAfterRemove; // truncate array + this.push.apply(this, insert); + } else { + this.length = lengthAfterRemove + add; // reserves space + for (i = 0; i < add; ++i) { + this[pos+i] = insert[i]; + } + } + } + return removed; + }; + } +} + +// ES5 15.4.3.2 +// http://es5.github.com/#x15.4.3.2 +// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/isArray +if (!Array.isArray) { + Array.isArray = function isArray(obj) { + return _toString(obj) == "[object Array]"; + }; +} + +// The IsCallable() check in the Array functions +// has been replaced with a strict check on the +// internal class of the object to trap cases where +// the provided function was actually a regular +// expression literal, which in V8 and +// JavaScriptCore is a typeof "function". Only in +// V8 are regular expression literals permitted as +// reduce parameters, so it is desirable in the +// general case for the shim to match the more +// strict and common behavior of rejecting regular +// expressions. + +// ES5 15.4.4.18 +// http://es5.github.com/#x15.4.4.18 +// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/forEach + +// Check failure of by-index access of string characters (IE < 9) +// and failure of `0 in boxedString` (Rhino) +var boxedString = Object("a"), + splitString = boxedString[0] != "a" || !(0 in boxedString); + +if (!Array.prototype.forEach) { + Array.prototype.forEach = function forEach(fun /*, thisp*/) { + var object = toObject(this), + self = splitString && _toString(this) == "[object String]" ? + this.split("") : + object, + thisp = arguments[1], + i = -1, + length = self.length >>> 0; + + // If no callback function or if callback is not a callable function + if (_toString(fun) != "[object Function]") { + throw new TypeError(); // TODO message + } + + while (++i < length) { + if (i in self) { + // Invoke the callback function with call, passing arguments: + // context, property value, property key, thisArg object + // context + fun.call(thisp, self[i], i, object); + } + } + }; +} + +// ES5 15.4.4.19 +// http://es5.github.com/#x15.4.4.19 +// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map +if (!Array.prototype.map) { + Array.prototype.map = function map(fun /*, thisp*/) { + var object = toObject(this), + self = splitString && _toString(this) == "[object String]" ? + this.split("") : + object, + length = self.length >>> 0, + result = Array(length), + thisp = arguments[1]; + + // If no callback function or if callback is not a callable function + if (_toString(fun) != "[object Function]") { + throw new TypeError(fun + " is not a function"); + } + + for (var i = 0; i < length; i++) { + if (i in self) + result[i] = fun.call(thisp, self[i], i, object); + } + return result; + }; +} + +// ES5 15.4.4.20 +// http://es5.github.com/#x15.4.4.20 +// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/filter +if (!Array.prototype.filter) { + Array.prototype.filter = function filter(fun /*, thisp */) { + var object = toObject(this), + self = splitString && _toString(this) == "[object String]" ? + this.split("") : + object, + length = self.length >>> 0, + result = [], + value, + thisp = arguments[1]; + + // If no callback function or if callback is not a callable function + if (_toString(fun) != "[object Function]") { + throw new TypeError(fun + " is not a function"); + } + + for (var i = 0; i < length; i++) { + if (i in self) { + value = self[i]; + if (fun.call(thisp, value, i, object)) { + result.push(value); + } + } + } + return result; + }; +} + +// ES5 15.4.4.16 +// http://es5.github.com/#x15.4.4.16 +// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/every +if (!Array.prototype.every) { + Array.prototype.every = function every(fun /*, thisp */) { + var object = toObject(this), + self = splitString && _toString(this) == "[object String]" ? + this.split("") : + object, + length = self.length >>> 0, + thisp = arguments[1]; + + // If no callback function or if callback is not a callable function + if (_toString(fun) != "[object Function]") { + throw new TypeError(fun + " is not a function"); + } + + for (var i = 0; i < length; i++) { + if (i in self && !fun.call(thisp, self[i], i, object)) { + return false; + } + } + return true; + }; +} + +// ES5 15.4.4.17 +// http://es5.github.com/#x15.4.4.17 +// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/some +if (!Array.prototype.some) { + Array.prototype.some = function some(fun /*, thisp */) { + var object = toObject(this), + self = splitString && _toString(this) == "[object String]" ? + this.split("") : + object, + length = self.length >>> 0, + thisp = arguments[1]; + + // If no callback function or if callback is not a callable function + if (_toString(fun) != "[object Function]") { + throw new TypeError(fun + " is not a function"); + } + + for (var i = 0; i < length; i++) { + if (i in self && fun.call(thisp, self[i], i, object)) { + return true; + } + } + return false; + }; +} + +// ES5 15.4.4.21 +// http://es5.github.com/#x15.4.4.21 +// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduce +if (!Array.prototype.reduce) { + Array.prototype.reduce = function reduce(fun /*, initial*/) { + var object = toObject(this), + self = splitString && _toString(this) == "[object String]" ? + this.split("") : + object, + length = self.length >>> 0; + + // If no callback function or if callback is not a callable function + if (_toString(fun) != "[object Function]") { + throw new TypeError(fun + " is not a function"); + } + + // no value to return if no initial value and an empty array + if (!length && arguments.length == 1) { + throw new TypeError("reduce of empty array with no initial value"); + } + + var i = 0; + var result; + if (arguments.length >= 2) { + result = arguments[1]; + } else { + do { + if (i in self) { + result = self[i++]; + break; + } + + // if array contains no values, no initial value to return + if (++i >= length) { + throw new TypeError("reduce of empty array with no initial value"); + } + } while (true); + } + + for (; i < length; i++) { + if (i in self) { + result = fun.call(void 0, result, self[i], i, object); + } + } + + return result; + }; +} + +// ES5 15.4.4.22 +// http://es5.github.com/#x15.4.4.22 +// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduceRight +if (!Array.prototype.reduceRight) { + Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) { + var object = toObject(this), + self = splitString && _toString(this) == "[object String]" ? + this.split("") : + object, + length = self.length >>> 0; + + // If no callback function or if callback is not a callable function + if (_toString(fun) != "[object Function]") { + throw new TypeError(fun + " is not a function"); + } + + // no value to return if no initial value, empty array + if (!length && arguments.length == 1) { + throw new TypeError("reduceRight of empty array with no initial value"); + } + + var result, i = length - 1; + if (arguments.length >= 2) { + result = arguments[1]; + } else { + do { + if (i in self) { + result = self[i--]; + break; + } + + // if array contains no values, no initial value to return + if (--i < 0) { + throw new TypeError("reduceRight of empty array with no initial value"); + } + } while (true); + } + + do { + if (i in this) { + result = fun.call(void 0, result, self[i], i, object); + } + } while (i--); + + return result; + }; +} + +// ES5 15.4.4.14 +// http://es5.github.com/#x15.4.4.14 +// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf +if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) { + Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) { + var self = splitString && _toString(this) == "[object String]" ? + this.split("") : + toObject(this), + length = self.length >>> 0; + + if (!length) { + return -1; + } + + var i = 0; + if (arguments.length > 1) { + i = toInteger(arguments[1]); + } + + // handle negative indices + i = i >= 0 ? i : Math.max(0, length + i); + for (; i < length; i++) { + if (i in self && self[i] === sought) { + return i; + } + } + return -1; + }; +} + +// ES5 15.4.4.15 +// http://es5.github.com/#x15.4.4.15 +// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/lastIndexOf +if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) { + Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) { + var self = splitString && _toString(this) == "[object String]" ? + this.split("") : + toObject(this), + length = self.length >>> 0; + + if (!length) { + return -1; + } + var i = length - 1; + if (arguments.length > 1) { + i = Math.min(i, toInteger(arguments[1])); + } + // handle negative indices + i = i >= 0 ? i : length - Math.abs(i); + for (; i >= 0; i--) { + if (i in self && sought === self[i]) { + return i; + } + } + return -1; + }; +} + +// +// Object +// ====== +// + +// ES5 15.2.3.2 +// http://es5.github.com/#x15.2.3.2 +if (!Object.getPrototypeOf) { + // https://github.com/kriskowal/es5-shim/issues#issue/2 + // http://ejohn.org/blog/objectgetprototypeof/ + // recommended by fschaefer on github + Object.getPrototypeOf = function getPrototypeOf(object) { + return object.__proto__ || ( + object.constructor ? + object.constructor.prototype : + prototypeOfObject + ); + }; +} + +// ES5 15.2.3.3 +// http://es5.github.com/#x15.2.3.3 +if (!Object.getOwnPropertyDescriptor) { + var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " + + "non-object: "; + Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) { + if ((typeof object != "object" && typeof object != "function") || object === null) + throw new TypeError(ERR_NON_OBJECT + object); + // If object does not owns property return undefined immediately. + if (!owns(object, property)) + return; + + var descriptor, getter, setter; + + // If object has a property then it's for sure both `enumerable` and + // `configurable`. + descriptor = { enumerable: true, configurable: true }; + + // If JS engine supports accessor properties then property may be a + // getter or setter. + if (supportsAccessors) { + // Unfortunately `__lookupGetter__` will return a getter even + // if object has own non getter property along with a same named + // inherited getter. To avoid misbehavior we temporary remove + // `__proto__` so that `__lookupGetter__` will return getter only + // if it's owned by an object. + var prototype = object.__proto__; + object.__proto__ = prototypeOfObject; + + var getter = lookupGetter(object, property); + var setter = lookupSetter(object, property); + + // Once we have getter and setter we can put values back. + object.__proto__ = prototype; + + if (getter || setter) { + if (getter) descriptor.get = getter; + if (setter) descriptor.set = setter; + + // If it was accessor property we're done and return here + // in order to avoid adding `value` to the descriptor. + return descriptor; + } + } + + // If we got this far we know that object has an own property that is + // not an accessor so we set it as a value and return descriptor. + descriptor.value = object[property]; + return descriptor; + }; +} + +// ES5 15.2.3.4 +// http://es5.github.com/#x15.2.3.4 +if (!Object.getOwnPropertyNames) { + Object.getOwnPropertyNames = function getOwnPropertyNames(object) { + return Object.keys(object); + }; +} + +// ES5 15.2.3.5 +// http://es5.github.com/#x15.2.3.5 +if (!Object.create) { + var createEmpty; + if (Object.prototype.__proto__ === null) { + createEmpty = function () { + return { "__proto__": null }; + }; + } else { + // In old IE __proto__ can't be used to manually set `null` + createEmpty = function () { + var empty = {}; + for (var i in empty) + empty[i] = null; + empty.constructor = + empty.hasOwnProperty = + empty.propertyIsEnumerable = + empty.isPrototypeOf = + empty.toLocaleString = + empty.toString = + empty.valueOf = + empty.__proto__ = null; + return empty; + } + } + + Object.create = function create(prototype, properties) { + var object; + if (prototype === null) { + object = createEmpty(); + } else { + if (typeof prototype != "object") + throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'"); + var Type = function () {}; + Type.prototype = prototype; + object = new Type(); + // IE has no built-in implementation of `Object.getPrototypeOf` + // neither `__proto__`, but this manually setting `__proto__` will + // guarantee that `Object.getPrototypeOf` will work as expected with + // objects created using `Object.create` + object.__proto__ = prototype; + } + if (properties !== void 0) + Object.defineProperties(object, properties); + return object; + }; +} + +// ES5 15.2.3.6 +// http://es5.github.com/#x15.2.3.6 + +// Patch for WebKit and IE8 standard mode +// Designed by hax +// related issue: https://github.com/kriskowal/es5-shim/issues#issue/5 +// IE8 Reference: +// http://msdn.microsoft.com/en-us/library/dd282900.aspx +// http://msdn.microsoft.com/en-us/library/dd229916.aspx +// WebKit Bugs: +// https://bugs.webkit.org/show_bug.cgi?id=36423 + +function doesDefinePropertyWork(object) { + try { + Object.defineProperty(object, "sentinel", {}); + return "sentinel" in object; + } catch (exception) { + // returns falsy + } +} + +// check whether defineProperty works if it's given. Otherwise, +// shim partially. +if (Object.defineProperty) { + var definePropertyWorksOnObject = doesDefinePropertyWork({}); + var definePropertyWorksOnDom = typeof document == "undefined" || + doesDefinePropertyWork(document.createElement("div")); + if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) { + var definePropertyFallback = Object.defineProperty; + } +} + +if (!Object.defineProperty || definePropertyFallback) { + var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: "; + var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: " + var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " + + "on this javascript engine"; + + Object.defineProperty = function defineProperty(object, property, descriptor) { + if ((typeof object != "object" && typeof object != "function") || object === null) + throw new TypeError(ERR_NON_OBJECT_TARGET + object); + if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null) + throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor); + + // make a valiant attempt to use the real defineProperty + // for I8's DOM elements. + if (definePropertyFallback) { + try { + return definePropertyFallback.call(Object, object, property, descriptor); + } catch (exception) { + // try the shim if the real one doesn't work + } + } + + // If it's a data property. + if (owns(descriptor, "value")) { + // fail silently if "writable", "enumerable", or "configurable" + // are requested but not supported + /* + // alternate approach: + if ( // can't implement these features; allow false but not true + !(owns(descriptor, "writable") ? descriptor.writable : true) || + !(owns(descriptor, "enumerable") ? descriptor.enumerable : true) || + !(owns(descriptor, "configurable") ? descriptor.configurable : true) + ) + throw new RangeError( + "This implementation of Object.defineProperty does not " + + "support configurable, enumerable, or writable." + ); + */ + + if (supportsAccessors && (lookupGetter(object, property) || + lookupSetter(object, property))) + { + // As accessors are supported only on engines implementing + // `__proto__` we can safely override `__proto__` while defining + // a property to make sure that we don't hit an inherited + // accessor. + var prototype = object.__proto__; + object.__proto__ = prototypeOfObject; + // Deleting a property anyway since getter / setter may be + // defined on object itself. + delete object[property]; + object[property] = descriptor.value; + // Setting original `__proto__` back now. + object.__proto__ = prototype; + } else { + object[property] = descriptor.value; + } + } else { + if (!supportsAccessors) + throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED); + // If we got that far then getters and setters can be defined !! + if (owns(descriptor, "get")) + defineGetter(object, property, descriptor.get); + if (owns(descriptor, "set")) + defineSetter(object, property, descriptor.set); + } + + return object; + }; +} + +// ES5 15.2.3.7 +// http://es5.github.com/#x15.2.3.7 +if (!Object.defineProperties) { + Object.defineProperties = function defineProperties(object, properties) { + for (var property in properties) { + if (owns(properties, property)) + Object.defineProperty(object, property, properties[property]); + } + return object; + }; +} + +// ES5 15.2.3.8 +// http://es5.github.com/#x15.2.3.8 +if (!Object.seal) { + Object.seal = function seal(object) { + // this is misleading and breaks feature-detection, but + // allows "securable" code to "gracefully" degrade to working + // but insecure code. + return object; + }; +} + +// ES5 15.2.3.9 +// http://es5.github.com/#x15.2.3.9 +if (!Object.freeze) { + Object.freeze = function freeze(object) { + // this is misleading and breaks feature-detection, but + // allows "securable" code to "gracefully" degrade to working + // but insecure code. + return object; + }; +} + +// detect a Rhino bug and patch it +try { + Object.freeze(function () {}); +} catch (exception) { + Object.freeze = (function freeze(freezeObject) { + return function freeze(object) { + if (typeof object == "function") { + return object; + } else { + return freezeObject(object); + } + }; + })(Object.freeze); +} + +// ES5 15.2.3.10 +// http://es5.github.com/#x15.2.3.10 +if (!Object.preventExtensions) { + Object.preventExtensions = function preventExtensions(object) { + // this is misleading and breaks feature-detection, but + // allows "securable" code to "gracefully" degrade to working + // but insecure code. + return object; + }; +} + +// ES5 15.2.3.11 +// http://es5.github.com/#x15.2.3.11 +if (!Object.isSealed) { + Object.isSealed = function isSealed(object) { + return false; + }; +} + +// ES5 15.2.3.12 +// http://es5.github.com/#x15.2.3.12 +if (!Object.isFrozen) { + Object.isFrozen = function isFrozen(object) { + return false; + }; +} + +// ES5 15.2.3.13 +// http://es5.github.com/#x15.2.3.13 +if (!Object.isExtensible) { + Object.isExtensible = function isExtensible(object) { + // 1. If Type(O) is not Object throw a TypeError exception. + if (Object(object) === object) { + throw new TypeError(); // TODO message + } + // 2. Return the Boolean value of the [[Extensible]] internal property of O. + var name = ''; + while (owns(object, name)) { + name += '?'; + } + object[name] = true; + var returnValue = owns(object, name); + delete object[name]; + return returnValue; + }; +} + +// ES5 15.2.3.14 +// http://es5.github.com/#x15.2.3.14 +if (!Object.keys) { + // http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation + var hasDontEnumBug = true, + dontEnums = [ + "toString", + "toLocaleString", + "valueOf", + "hasOwnProperty", + "isPrototypeOf", + "propertyIsEnumerable", + "constructor" + ], + dontEnumsLength = dontEnums.length; + + for (var key in {"toString": null}) { + hasDontEnumBug = false; + } + + Object.keys = function keys(object) { + + if ( + (typeof object != "object" && typeof object != "function") || + object === null + ) { + throw new TypeError("Object.keys called on a non-object"); + } + + var keys = []; + for (var name in object) { + if (owns(object, name)) { + keys.push(name); + } + } + + if (hasDontEnumBug) { + for (var i = 0, ii = dontEnumsLength; i < ii; i++) { + var dontEnum = dontEnums[i]; + if (owns(object, dontEnum)) { + keys.push(dontEnum); + } + } + } + return keys; + }; + +} + +// +// most of es5-shim Date section is removed since ace doesn't need it, it is too intrusive and it causes problems for users +// ==== +// + +// ES5 15.9.4.4 +// http://es5.github.com/#x15.9.4.4 +if (!Date.now) { + Date.now = function now() { + return new Date().getTime(); + }; +} + + +// +// String +// ====== +// + +// ES5 15.5.4.20 +// http://es5.github.com/#x15.5.4.20 +var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" + + "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" + + "\u2029\uFEFF"; +if (!String.prototype.trim || ws.trim()) { + // http://blog.stevenlevithan.com/archives/faster-trim-javascript + // http://perfectionkills.com/whitespace-deviations/ + ws = "[" + ws + "]"; + var trimBeginRegexp = new RegExp("^" + ws + ws + "*"), + trimEndRegexp = new RegExp(ws + ws + "*$"); + String.prototype.trim = function trim() { + return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, ""); + }; +} + +// +// Util +// ====== +// + +// ES5 9.4 +// http://es5.github.com/#x9.4 +// http://jsperf.com/to-integer + +function toInteger(n) { + n = +n; + if (n !== n) { // isNaN + n = 0; + } else if (n !== 0 && n !== (1/0) && n !== -(1/0)) { + n = (n > 0 || -1) * Math.floor(Math.abs(n)); + } + return n; +} + +function isPrimitive(input) { + var type = typeof input; + return ( + input === null || + type === "undefined" || + type === "boolean" || + type === "number" || + type === "string" + ); +} + +function toPrimitive(input) { + var val, valueOf, toString; + if (isPrimitive(input)) { + return input; + } + valueOf = input.valueOf; + if (typeof valueOf === "function") { + val = valueOf.call(input); + if (isPrimitive(val)) { + return val; + } + } + toString = input.toString; + if (typeof toString === "function") { + val = toString.call(input); + if (isPrimitive(val)) { + return val; + } + } + throw new TypeError(); +} + +// ES5 9.9 +// http://es5.github.com/#x9.9 +var toObject = function (o) { + if (o == null) { // this matches both null and undefined + throw new TypeError("can't convert "+o+" to object"); + } + return Object(o); +}; + +}); diff --git a/addons/editor/ace/lib/event.js b/addons/editor/ace/lib/event.js new file mode 100755 index 00000000..691d0019 --- /dev/null +++ b/addons/editor/ace/lib/event.js @@ -0,0 +1,353 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var keys = require("./keys"); +var useragent = require("./useragent"); +var dom = require("./dom"); + +exports.addListener = function(elem, type, callback) { + if (elem.addEventListener) { + return elem.addEventListener(type, callback, false); + } + if (elem.attachEvent) { + var wrapper = function() { + callback.call(elem, window.event); + }; + callback._wrapper = wrapper; + elem.attachEvent("on" + type, wrapper); + } +}; + +exports.removeListener = function(elem, type, callback) { + if (elem.removeEventListener) { + return elem.removeEventListener(type, callback, false); + } + if (elem.detachEvent) { + elem.detachEvent("on" + type, callback._wrapper || callback); + } +}; + +/* +* Prevents propagation and clobbers the default action of the passed event +*/ +exports.stopEvent = function(e) { + exports.stopPropagation(e); + exports.preventDefault(e); + return false; +}; + +exports.stopPropagation = function(e) { + if (e.stopPropagation) + e.stopPropagation(); + else + e.cancelBubble = true; +}; + +exports.preventDefault = function(e) { + if (e.preventDefault) + e.preventDefault(); + else + e.returnValue = false; +}; + +/* + * @return {Number} 0 for left button, 1 for middle button, 2 for right button + */ +exports.getButton = function(e) { + if (e.type == "dblclick") + return 0; + if (e.type == "contextmenu" || (e.ctrlKey && useragent.isMac)) + return 2; + + // DOM Event + if (e.preventDefault) { + return e.button; + } + // old IE + else { + return {1:0, 2:2, 4:1}[e.button]; + } +}; + +exports.capture = function(el, eventHandler, releaseCaptureHandler) { + function onMouseUp(e) { + eventHandler && eventHandler(e); + releaseCaptureHandler && releaseCaptureHandler(e); + + exports.removeListener(document, "mousemove", eventHandler, true); + exports.removeListener(document, "mouseup", onMouseUp, true); + exports.removeListener(document, "dragstart", onMouseUp, true); + } + + exports.addListener(document, "mousemove", eventHandler, true); + exports.addListener(document, "mouseup", onMouseUp, true); + exports.addListener(document, "dragstart", onMouseUp, true); +}; + +exports.addMouseWheelListener = function(el, callback) { + if ("onmousewheel" in el) { + var factor = 8; + exports.addListener(el, "mousewheel", function(e) { + if (e.wheelDeltaX !== undefined) { + e.wheelX = -e.wheelDeltaX / factor; + e.wheelY = -e.wheelDeltaY / factor; + } else { + e.wheelX = 0; + e.wheelY = -e.wheelDelta / factor; + } + callback(e); + }); + } else if ("onwheel" in el) { + exports.addListener(el, "wheel", function(e) { + e.wheelX = (e.deltaX || 0) * 5; + e.wheelY = (e.deltaY || 0) * 5; + callback(e); + }); + } else { + exports.addListener(el, "DOMMouseScroll", function(e) { + if (e.axis && e.axis == e.HORIZONTAL_AXIS) { + e.wheelX = (e.detail || 0) * 5; + e.wheelY = 0; + } else { + e.wheelX = 0; + e.wheelY = (e.detail || 0) * 5; + } + callback(e); + }); + } +}; + +exports.addMultiMouseDownListener = function(el, timeouts, eventHandler, callbackName) { + var clicks = 0; + var startX, startY, timer; + var eventNames = { + 2: "dblclick", + 3: "tripleclick", + 4: "quadclick" + }; + + exports.addListener(el, "mousedown", function(e) { + if (exports.getButton(e) != 0) { + clicks = 0; + } else if (e.detail > 1) { + clicks++; + if (clicks > 4) + clicks = 1; + } else { + clicks = 1; + } + if (useragent.isIE) { + var isNewClick = Math.abs(e.clientX - startX) > 5 || Math.abs(e.clientY - startY) > 5; + if (isNewClick) { + clicks = 1; + } + if (clicks == 1) { + startX = e.clientX; + startY = e.clientY; + } + } + + eventHandler[callbackName]("mousedown", e); + + if (clicks > 4) + clicks = 0; + else if (clicks > 1) + return eventHandler[callbackName](eventNames[clicks], e); + }); + + if (useragent.isOldIE) { + exports.addListener(el, "dblclick", function(e) { + clicks = 2; + if (timer) + clearTimeout(timer); + timer = setTimeout(function() {timer = null}, timeouts[clicks - 1] || 600); + eventHandler[callbackName]("mousedown", e); + eventHandler[callbackName](eventNames[clicks], e); + }); + } +}; + +function normalizeCommandKeys(callback, e, keyCode) { + var hashId = 0; + if ((useragent.isOpera && !("KeyboardEvent" in window)) && useragent.isMac) { + hashId = 0 | (e.metaKey ? 1 : 0) | (e.altKey ? 2 : 0) + | (e.shiftKey ? 4 : 0) | (e.ctrlKey ? 8 : 0); + } else { + hashId = 0 | (e.ctrlKey ? 1 : 0) | (e.altKey ? 2 : 0) + | (e.shiftKey ? 4 : 0) | (e.metaKey ? 8 : 0); + } + + if (!useragent.isMac && pressedKeys) { + if (pressedKeys[91] || pressedKeys[92]) + hashId |= 8; + if (pressedKeys.altGr) { + if ((3 & hashId) != 3) + pressedKeys.altGr = 0 + else + return; + } + if (keyCode === 18 || keyCode === 17) { + var location = e.location || e.keyLocation; + if (keyCode === 17 && location === 1) { + ts = e.timeStamp; + } else if (keyCode === 18 && hashId === 3 && location === 2) { + var dt = -ts; + ts = e.timeStamp; + dt += ts; + if (dt < 3) + pressedKeys.altGr = true; + } + } + } + + if (keyCode in keys.MODIFIER_KEYS) { + switch (keys.MODIFIER_KEYS[keyCode]) { + case "Alt": + hashId = 2; + break; + case "Shift": + hashId = 4; + break; + case "Ctrl": + hashId = 1; + break; + default: + hashId = 8; + break; + } + keyCode = 0; + } + + if (hashId & 8 && (keyCode === 91 || keyCode === 93)) { + keyCode = 0; + } + + if (!hashId && keyCode === 13) { + if (e.location || e.keyLocation === 3) { + callback(e, hashId, -keyCode) + if (e.defaultPrevented) + return; + } + } + + + // If there is no hashId and the keyCode is not a function key, then + // we don't call the callback as we don't handle a command key here + // (it's a normal key/character input). + if (!hashId && !(keyCode in keys.FUNCTION_KEYS) && !(keyCode in keys.PRINTABLE_KEYS)) { + return false; + } + + + + return callback(e, hashId, keyCode); +} + +var pressedKeys = null; +var ts = 0; +exports.addCommandKeyListener = function(el, callback) { + var addListener = exports.addListener; + if (useragent.isOldGecko || (useragent.isOpera && !("KeyboardEvent" in window))) { + // Old versions of Gecko aka. Firefox < 4.0 didn't repeat the keydown + // event if the user pressed the key for a longer time. Instead, the + // keydown event was fired once and later on only the keypress event. + // To emulate the 'right' keydown behavior, the keyCode of the initial + // keyDown event is stored and in the following keypress events the + // stores keyCode is used to emulate a keyDown event. + var lastKeyDownKeyCode = null; + addListener(el, "keydown", function(e) { + lastKeyDownKeyCode = e.keyCode; + }); + addListener(el, "keypress", function(e) { + return normalizeCommandKeys(callback, e, lastKeyDownKeyCode); + }); + } else { + var lastDefaultPrevented = null; + + addListener(el, "keydown", function(e) { + pressedKeys[e.keyCode] = true; + var result = normalizeCommandKeys(callback, e, e.keyCode); + lastDefaultPrevented = e.defaultPrevented; + return result; + }); + + addListener(el, "keypress", function(e) { + if (lastDefaultPrevented && (e.ctrlKey || e.altKey || e.shiftKey || e.metaKey)) { + exports.stopEvent(e); + lastDefaultPrevented = null; + } + }); + + addListener(el, "keyup", function(e) { + pressedKeys[e.keyCode] = null; + }); + + if (!pressedKeys) { + pressedKeys = Object.create(null); + addListener(window, "focus", function(e) { + pressedKeys = Object.create(null); + }); + } + } +}; + +if (window.postMessage && !useragent.isOldIE) { + var postMessageId = 1; + exports.nextTick = function(callback, win) { + win = win || window; + var messageName = "zero-timeout-message-" + postMessageId; + exports.addListener(win, "message", function listener(e) { + if (e.data == messageName) { + exports.stopPropagation(e); + exports.removeListener(win, "message", listener); + callback(); + } + }); + win.postMessage(messageName, "*"); + }; +} + + +exports.nextFrame = window.requestAnimationFrame || + window.mozRequestAnimationFrame || + window.webkitRequestAnimationFrame || + window.msRequestAnimationFrame || + window.oRequestAnimationFrame; + +if (exports.nextFrame) + exports.nextFrame = exports.nextFrame.bind(window); +else + exports.nextFrame = function(callback) { + setTimeout(callback, 17); + }; +}); diff --git a/addons/editor/ace/lib/event_emitter.js b/addons/editor/ace/lib/event_emitter.js new file mode 100755 index 00000000..b9860145 --- /dev/null +++ b/addons/editor/ace/lib/event_emitter.js @@ -0,0 +1,155 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var EventEmitter = {}; +var stopPropagation = function() { this.propagationStopped = true; }; +var preventDefault = function() { this.defaultPrevented = true; }; + +EventEmitter._emit = +EventEmitter._dispatchEvent = function(eventName, e) { + this._eventRegistry || (this._eventRegistry = {}); + this._defaultHandlers || (this._defaultHandlers = {}); + + var listeners = this._eventRegistry[eventName] || []; + var defaultHandler = this._defaultHandlers[eventName]; + if (!listeners.length && !defaultHandler) + return; + + if (typeof e != "object" || !e) + e = {}; + + if (!e.type) + e.type = eventName; + if (!e.stopPropagation) + e.stopPropagation = stopPropagation; + if (!e.preventDefault) + e.preventDefault = preventDefault; + + listeners = listeners.slice(); + for (var i=0; i 0) { + if (count & 1) + result += string; + + if (count >>= 1) + string += string; + } + return result; +}; + +var trimBeginRegexp = /^\s\s*/; +var trimEndRegexp = /\s\s*$/; + +exports.stringTrimLeft = function (string) { + return string.replace(trimBeginRegexp, ''); +}; + +exports.stringTrimRight = function (string) { + return string.replace(trimEndRegexp, ''); +}; + +exports.copyObject = function(obj) { + var copy = {}; + for (var key in obj) { + copy[key] = obj[key]; + } + return copy; +}; + +exports.copyArray = function(array){ + var copy = []; + for (var i=0, l=array.length; i + * Provides an augmented, extensible, cross-browser implementation of regular expressions, + * including support for additional syntax, flags, and methods + */ + +define(function(require, exports, module) { +"use strict"; + + //--------------------------------- + // Private variables + //--------------------------------- + + var real = { + exec: RegExp.prototype.exec, + test: RegExp.prototype.test, + match: String.prototype.match, + replace: String.prototype.replace, + split: String.prototype.split + }, + compliantExecNpcg = real.exec.call(/()??/, "")[1] === undefined, // check `exec` handling of nonparticipating capturing groups + compliantLastIndexIncrement = function () { + var x = /^/g; + real.test.call(x, ""); + return !x.lastIndex; + }(); + + if (compliantLastIndexIncrement && compliantExecNpcg) + return; + + //--------------------------------- + // Overriden native methods + //--------------------------------- + + // Adds named capture support (with backreferences returned as `result.name`), and fixes two + // cross-browser issues per ES3: + // - Captured values for nonparticipating capturing groups should be returned as `undefined`, + // rather than the empty string. + // - `lastIndex` should not be incremented after zero-length matches. + RegExp.prototype.exec = function (str) { + var match = real.exec.apply(this, arguments), + name, r2; + if ( typeof(str) == 'string' && match) { + // Fix browsers whose `exec` methods don't consistently return `undefined` for + // nonparticipating capturing groups + if (!compliantExecNpcg && match.length > 1 && indexOf(match, "") > -1) { + r2 = RegExp(this.source, real.replace.call(getNativeFlags(this), "g", "")); + // Using `str.slice(match.index)` rather than `match[0]` in case lookahead allowed + // matching due to characters outside the match + real.replace.call(str.slice(match.index), r2, function () { + for (var i = 1; i < arguments.length - 2; i++) { + if (arguments[i] === undefined) + match[i] = undefined; + } + }); + } + // Attach named capture properties + if (this._xregexp && this._xregexp.captureNames) { + for (var i = 1; i < match.length; i++) { + name = this._xregexp.captureNames[i - 1]; + if (name) + match[name] = match[i]; + } + } + // Fix browsers that increment `lastIndex` after zero-length matches + if (!compliantLastIndexIncrement && this.global && !match[0].length && (this.lastIndex > match.index)) + this.lastIndex--; + } + return match; + }; + + // Don't override `test` if it won't change anything + if (!compliantLastIndexIncrement) { + // Fix browser bug in native method + RegExp.prototype.test = function (str) { + // Use the native `exec` to skip some processing overhead, even though the overriden + // `exec` would take care of the `lastIndex` fix + var match = real.exec.call(this, str); + // Fix browsers that increment `lastIndex` after zero-length matches + if (match && this.global && !match[0].length && (this.lastIndex > match.index)) + this.lastIndex--; + return !!match; + }; + } + + //--------------------------------- + // Private helper functions + //--------------------------------- + + function getNativeFlags (regex) { + return (regex.global ? "g" : "") + + (regex.ignoreCase ? "i" : "") + + (regex.multiline ? "m" : "") + + (regex.extended ? "x" : "") + // Proposed for ES4; included in AS3 + (regex.sticky ? "y" : ""); + } + + function indexOf (array, item, from) { + if (Array.prototype.indexOf) // Use the native array method if available + return array.indexOf(item, from); + for (var i = from || 0; i < array.length; i++) { + if (array[i] === item) + return i; + } + return -1; + } + +}); diff --git a/addons/editor/ace/lib/useragent.js b/addons/editor/ace/lib/useragent.js new file mode 100755 index 00000000..b6989a8c --- /dev/null +++ b/addons/editor/ace/lib/useragent.js @@ -0,0 +1,103 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +/* + * I hate doing this, but we need some way to determine if the user is on a Mac + * The reason is that users have different expectations of their key combinations. + * + * Take copy as an example, Mac people expect to use CMD or APPLE + C + * Windows folks expect to use CTRL + C + */ +exports.OS = { + LINUX: "LINUX", + MAC: "MAC", + WINDOWS: "WINDOWS" +}; + +/* + * Return an exports.OS constant + */ +exports.getOS = function() { + if (exports.isMac) { + return exports.OS.MAC; + } else if (exports.isLinux) { + return exports.OS.LINUX; + } else { + return exports.OS.WINDOWS; + } +}; + +// this can be called in non browser environments (e.g. from ace/requirejs/text) +if (typeof navigator != "object") + return; + +var os = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase(); +var ua = navigator.userAgent; + +// Is the user using a browser that identifies itself as Windows +exports.isWin = (os == "win"); + +// Is the user using a browser that identifies itself as Mac OS +exports.isMac = (os == "mac"); + +// Is the user using a browser that identifies itself as Linux +exports.isLinux = (os == "linux"); + +// Windows Store JavaScript apps (aka Metro apps written in HTML5 and JavaScript) do not use the "Microsoft Internet Explorer" string in their user agent, but "MSAppHost" instead. +exports.isIE = + (navigator.appName == "Microsoft Internet Explorer" || navigator.appName.indexOf("MSAppHost") >= 0) + && parseFloat(navigator.userAgent.match(/MSIE ([0-9]+[\.0-9]+)/)[1]); + +exports.isOldIE = exports.isIE && exports.isIE < 9; + +// Is this Firefox or related? +exports.isGecko = exports.isMozilla = window.controllers && window.navigator.product === "Gecko"; + +// oldGecko == rev < 2.0 +exports.isOldGecko = exports.isGecko && parseInt((navigator.userAgent.match(/rv\:(\d+)/)||[])[1], 10) < 4; + +// Is this Opera +exports.isOpera = window.opera && Object.prototype.toString.call(window.opera) == "[object Opera]"; + +// Is the user using a browser that identifies itself as WebKit +exports.isWebKit = parseFloat(ua.split("WebKit/")[1]) || undefined; + +exports.isChrome = parseFloat(ua.split(" Chrome/")[1]) || undefined; + +exports.isAIR = ua.indexOf("AdobeAIR") >= 0; + +exports.isIPad = ua.indexOf("iPad") >= 0; + +exports.isTouchPad = ua.indexOf("TouchPad") >= 0; + +}); diff --git a/addons/editor/ace/mode-c9search.js b/addons/editor/ace/mode-c9search.js deleted file mode 100644 index b56517cb..00000000 --- a/addons/editor/ace/mode-c9search.js +++ /dev/null @@ -1,182 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2010, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/mode/c9search', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/c9search_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/folding/c9search'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var C9SearchHighlightRules = require("./c9search_highlight_rules").C9SearchHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var C9StyleFoldMode = require("./folding/c9search").FoldMode; - -var Mode = function() { - this.HighlightRules = C9SearchHighlightRules; - this.$outdent = new MatchingBraceOutdent(); - this.foldingRules = new C9StyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - 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; - -}); - -define('ace/mode/c9search_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var C9SearchHighlightRules = function() { - this.$rules = { - "start" : [ - { - token : ["c9searchresults.constant.numeric", "c9searchresults.text", "c9searchresults.text"], - regex : "(^\\s+[0-9]+)(:\\s*)(.+)" - }, - { - token : ["string", "text"], // single line - regex : "(.+)(:$)" - } - ] - }; -}; - -oop.inherits(C9SearchHighlightRules, TextHighlightRules); - -exports.C9SearchHighlightRules = C9SearchHighlightRules; - -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - - -define('ace/mode/folding/c9search', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -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.*\:|Searching for.*)$/; - this.foldingStopMarker = /^(\s+|Found.*)$/; - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var lines = session.doc.getAllLines(row); - var line = lines[row]; - var level1 = /^(Found.*|Searching for.*)$/; - var level2 = /^(\S.*\:|\s*)$/; - var re = level1.test(line) ? level1 : level2; - - if (this.foldingStartMarker.test(line)) { - for (var i = row + 1, l = session.getLength(); i < l; i++) { - if (re.test(lines[i])) - break; - } - - return new Range(row, line.length, i, 0); - } - - if (this.foldingStopMarker.test(line)) { - for (var i = row - 1; i >= 0; i--) { - line = lines[i]; - if (re.test(line)) - break; - } - - return new Range(i, line.length, row, 0); - } - }; - -}).call(FoldMode.prototype); - -}); - diff --git a/addons/editor/ace/mode-c_cpp.js b/addons/editor/ace/mode-c_cpp.js deleted file mode 100644 index 99d5c1a2..00000000 --- a/addons/editor/ace/mode-c_cpp.js +++ /dev/null @@ -1,739 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2010, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/mode/c_cpp', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/c_cpp_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var Range = require("../range").Range; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = c_cppHighlightRules; - - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().getLineTokens(line, state); - var tokens = tokenizedLine.tokens; - var endState = tokenizedLine.state; - - if (tokens.length && tokens[tokens.length-1].type == "comment") { - return indent; - } - - if (state == "start") { - var match = line.match(/^.*[\{\(\[]\s*$/); - if (match) { - indent += tab; - } - } else if (state == "doc-start") { - if (endState == "start") { - return ""; - } - var match = line.match(/^\s*(\/?)\*/); - if (match) { - if (match[1]) { - indent += " "; - } - indent += "* "; - } - } - - 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; -}); -define('ace/mode/c_cpp_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var cFunctions = exports.cFunctions = "\\s*\\bhypot(?:f|l)?|s(?:scanf|ystem|nprintf|ca(?:nf|lb(?:n(?:f|l)?|ln(?:f|l)?))|i(?:n(?:h(?:f|l)?|f|l)?|gn(?:al|bit))|tr(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(?:jmp|vbuf|locale|buf)|qrt(?:f|l)?|w(?:scanf|printf)|rand)|n(?:e(?:arbyint(?:f|l)?|xt(?:toward(?:f|l)?|after(?:f|l)?))|an(?:f|l)?)|c(?:s(?:in(?:h(?:f|l)?|f|l)?|qrt(?:f|l)?)|cos(?:h(?:f)?|f|l)?|imag(?:f|l)?|t(?:ime|an(?:h(?:f|l)?|f|l)?)|o(?:s(?:h(?:f|l)?|f|l)?|nj(?:f|l)?|pysign(?:f|l)?)|p(?:ow(?:f|l)?|roj(?:f|l)?)|e(?:il(?:f|l)?|xp(?:f|l)?)|l(?:o(?:ck|g(?:f|l)?)|earerr)|a(?:sin(?:h(?:f|l)?|f|l)?|cos(?:h(?:f|l)?|f|l)?|tan(?:h(?:f|l)?|f|l)?|lloc|rg(?:f|l)?|bs(?:f|l)?)|real(?:f|l)?|brt(?:f|l)?)|t(?:ime|o(?:upper|lower)|an(?:h(?:f|l)?|f|l)?|runc(?:f|l)?|gamma(?:f|l)?|mp(?:nam|file))|i(?:s(?:space|n(?:ormal|an)|cntrl|inf|digit|u(?:nordered|pper)|p(?:unct|rint)|finite|w(?:space|c(?:ntrl|type)|digit|upper|p(?:unct|rint)|lower|al(?:num|pha)|graph|xdigit|blank)|l(?:ower|ess(?:equal|greater)?)|al(?:num|pha)|gr(?:eater(?:equal)?|aph)|xdigit|blank)|logb(?:f|l)?|max(?:div|abs))|di(?:v|fftime)|_Exit|unget(?:c|wc)|p(?:ow(?:f|l)?|ut(?:s|c(?:har)?|wc(?:har)?)|error|rintf)|e(?:rf(?:c(?:f|l)?|f|l)?|x(?:it|p(?:2(?:f|l)?|f|l|m1(?:f|l)?)?))|v(?:s(?:scanf|nprintf|canf|printf|w(?:scanf|printf))|printf|f(?:scanf|printf|w(?:scanf|printf))|w(?:scanf|printf)|a_(?:start|copy|end|arg))|qsort|f(?:s(?:canf|e(?:tpos|ek))|close|tell|open|dim(?:f|l)?|p(?:classify|ut(?:s|c|w(?:s|c))|rintf)|e(?:holdexcept|set(?:e(?:nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(?:aiseexcept|ror)|get(?:e(?:nv|xceptflag)|round))|flush|w(?:scanf|ide|printf|rite)|loor(?:f|l)?|abs(?:f|l)?|get(?:s|c|pos|w(?:s|c))|re(?:open|e|ad|xp(?:f|l)?)|m(?:in(?:f|l)?|od(?:f|l)?|a(?:f|l|x(?:f|l)?)?))|l(?:d(?:iv|exp(?:f|l)?)|o(?:ngjmp|cal(?:time|econv)|g(?:1(?:p(?:f|l)?|0(?:f|l)?)|2(?:f|l)?|f|l|b(?:f|l)?)?)|abs|l(?:div|abs|r(?:int(?:f|l)?|ound(?:f|l)?))|r(?:int(?:f|l)?|ound(?:f|l)?)|gamma(?:f|l)?)|w(?:scanf|c(?:s(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?|mbs)|pbrk|ftime|len|r(?:chr|tombs)|xfrm)|to(?:b|mb)|rtomb)|printf|mem(?:set|c(?:hr|py|mp)|move))|a(?:s(?:sert|ctime|in(?:h(?:f|l)?|f|l)?)|cos(?:h(?:f|l)?|f|l)?|t(?:o(?:i|f|l(?:l)?)|exit|an(?:h(?:f|l)?|2(?:f|l)?|f|l)?)|b(?:s|ort))|g(?:et(?:s|c(?:har)?|env|wc(?:har)?)|mtime)|r(?:int(?:f|l)?|ound(?:f|l)?|e(?:name|alloc|wind|m(?:ove|quo(?:f|l)?|ainder(?:f|l)?))|a(?:nd|ise))|b(?:search|towc)|m(?:odf(?:f|l)?|em(?:set|c(?:hr|py|mp)|move)|ktime|alloc|b(?:s(?:init|towcs|rtowcs)|towc|len|r(?:towc|len)))\\b" - -var c_cppHighlightRules = function() { - - var keywordControls = ( - "break|case|continue|default|do|else|for|goto|if|_Pragma|" + - "return|switch|while|catch|operator|try|throw|using" - ); - - var storageType = ( - "asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" + - "_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|" + - "class|wchar_t|template" - ); - - var storageModifiers = ( - "const|extern|register|restrict|static|volatile|inline|private:|" + - "protected:|public:|friend|explicit|virtual|export|mutable|typename" - ); - - var keywordOperators = ( - "and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq" + - "const_cast|dynamic_cast|reinterpret_cast|static_cast|sizeof|namespace" - ); - - var builtinConstants = ( - "NULL|true|false|TRUE|FALSE" - ); - - var keywordMapper = this.$keywords = this.createKeywordMapper({ - "keyword.control" : keywordControls, - "storage.type" : storageType, - "storage.modifier" : storageModifiers, - "keyword.operator" : keywordOperators, - "variable.language": "this", - "constant.language": builtinConstants - }, "identifier"); - - var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\d\\$_\u00a1-\uffff]*\\b"; - - this.$rules = { - "start" : [ - { - token : "comment", - regex : "\\/\\/.*$" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // multi line string start - regex : '["].*\\\\$', - next : "qqstring" - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - token : "string", // multi line string start - regex : "['].*\\\\$", - next : "qstring" - }, { - token : "constant.numeric", // hex - regex : "0[xX][0-9a-fA-F]+(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b" - }, { - token : "keyword", // pre-compiler directives - regex : "#\\s*(?:include|import|pragma|line|define|undef|if|ifdef|else|elif|ifndef)\\b", - next : "directive" - }, { - token : "keyword", // special case pre-compiler directive - regex : "(?:#\\s*endif)\\b" - }, { - token : "support.function.C99.c", - regex : cFunctions - }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" - }, { - token : "keyword.operator", - regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)" - }, { - token : "punctuation.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 - regex : ".+" - } - ], - "qqstring" : [ - { - token : "string", - regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"', - next : "start" - }, { - token : "string", - regex : '.+' - } - ], - "qstring" : [ - { - token : "string", - regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'", - next : "start" - }, { - token : "string", - regex : '.+' - } - ], - "directive" : [ - { - token : "constant.other.multiline", - regex : /\\/ - }, - { - token : "constant.other.multiline", - regex : /.*\\/ - }, - { - token : "constant.other", - regex : "\\s*<.+?>", - next : "start" - }, - { - token : "constant.other", // single line - regex : '\\s*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]', - next : "start" - }, - { - token : "constant.other", // single line - regex : "\\s*['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']", - next : "start" - }, - { - token : "constant.other", - regex : /[^\\\/]+/, - next : "start" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("start") ]); -}; - -oop.inherits(c_cppHighlightRules, TextHighlightRules); - -exports.c_cppHighlightRules = c_cppHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); diff --git a/addons/editor/ace/mode-coldfusion.js b/addons/editor/ace/mode-coldfusion.js deleted file mode 100644 index b4946d6d..00000000 --- a/addons/editor/ace/mode-coldfusion.js +++ /dev/null @@ -1,1904 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2010, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/mode/coldfusion', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml', 'ace/mode/javascript', 'ace/mode/css', 'ace/tokenizer', 'ace/mode/coldfusion_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var XmlMode = require("./xml").Mode; -var JavaScriptMode = require("./javascript").Mode; -var CssMode = require("./css").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var ColdfusionHighlightRules = require("./coldfusion_highlight_rules").ColdfusionHighlightRules; - -var Mode = function() { - XmlMode.call(this); - - this.HighlightRules = ColdfusionHighlightRules; - - this.createModeDelegates({ - "js-": JavaScriptMode, - "css-": CssMode - }); -}; -oop.inherits(Mode, XmlMode); - -(function() { - - this.getNextLineIndent = function(state, line, tab) { - return this.$getIndent(line); - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/xml_highlight_rules', 'ace/mode/behaviour/xml', 'ace/mode/folding/xml'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; -var XmlBehaviour = require("./behaviour/xml").XmlBehaviour; -var XmlFoldMode = require("./folding/xml").FoldMode; - -var Mode = function() { - this.HighlightRules = XmlHighlightRules; - this.$behaviour = new XmlBehaviour(); - this.foldingRules = new XmlFoldMode(); -}; - -oop.inherits(Mode, TextMode); - -(function() { - - this.blockComment = {start: ""}; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/xml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml_util', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var xmlUtil = require("./xml_util"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var XmlHighlightRules = function(normalize) { - this.$rules = { - start : [ - {token : "punctuation.string.begin", regex : "<\\!\\[CDATA\\[", next : "cdata"}, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)(xml)(?=[\\s])", next : "xml_declaration" - }, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)([-_a-zA-Z0-9]+)", next : "instruction" - }, - {token : "comment", regex : "<\\!--", next : "comment"}, - { - token : ["punctuation.doctype.begin", "meta.tag.doctype"], - regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype" - }, - {include : "tag"}, - {include : "reference"} - ], - - xml_declaration : [ - {include : "attributes"}, - {include : "instruction"} - ], - - instruction : [ - {token : "punctuation.instruction.end", regex : "\\?>", next : "start"} - ], - - doctype : [ - {include : "space"}, - {include : "string"}, - {token : "punctuation.doctype.end", regex : ">", next : "start"}, - {token : "xml-pe", regex : "[-_a-zA-Z0-9:]+"}, - {token : "punctuation.begin", regex : "\\[", push : "declarations"} - ], - - declarations : [{ - token : "text", - regex : "\\s+" - }, { - token: "punctuation.end", - regex: "]", - next: "pop" - }, { - token : ["punctuation.begin", "keyword"], - regex : "(<\\!)([-_a-zA-Z0-9]+)", - push : [{ - token : "text", - regex : "\\s+" - }, - { - token : "punctuation.end", - regex : ">", - next : "pop" - }, - {include : "string"}] - }], - - cdata : [ - {token : "string.end", regex : "\\]\\]>", next : "start"}, - {token : "text", regex : "\\s+"}, - {token : "text", regex : "(?:[^\\]]|\\](?!\\]>))+"} - ], - - comment : [ - {token : "comment", regex : "-->", next : "start"}, - {defaultToken : "comment"} - ], - - tag : [{ - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(<)((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)", - next: [ - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : "start"} - ] - }, { - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(", next : "start"} - ] - }], - - space : [ - {token : "text", regex : "\\s+"} - ], - - reference : [{ - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, { - token : "invalid.illegal", regex : "&" - }], - - string: [{ - token : "string", - regex : "'", - push : "qstring_inner" - }, { - token : "string", - regex : '"', - push : "qqstring_inner" - }], - - qstring_inner: [ - {token : "string", regex: "'", next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - qqstring_inner: [ - {token : "string", regex: '"', next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - attributes: [{ - token : "entity.other.attribute-name", - regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+" - }, { - token : "keyword.operator.separator", - regex : "=" - }, { - include : "space" - }, { - include : "string" - }] - }; - - if (this.constructor === XmlHighlightRules) - this.normalizeRules(); -}; - - -(function() { - - this.embedTagRules = function(HighlightRules, prefix, tag){ - this.$rules.tag.unshift({ - token : ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(<)(" + tag + ")", - next: [ - {include : "space"}, - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : prefix + "start"} - ] - }); - - this.$rules[tag + "-end"] = [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next: "start", - onMatch : function(value, currentState, stack) { - stack.splice(0); - return this.token; - }} - ] - - this.embedRules(HighlightRules, prefix, [{ - token: ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(" - }]); - }; - -}).call(TextHighlightRules.prototype); - -oop.inherits(XmlHighlightRules, TextHighlightRules); - -exports.XmlHighlightRules = XmlHighlightRules; -}); - -define('ace/mode/xml_util', ['require', 'exports', 'module' ], function(require, exports, module) { - - -function string(state) { - return [{ - token : "string", - regex : '"', - next : state + "_qqstring" - }, { - token : "string", - regex : "'", - next : state + "_qstring" - }]; -} - -function multiLineString(quote, state) { - return [ - {token : "string", regex : quote, next : state}, - { - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, - {defaultToken : "string"} - ]; -} - -exports.tag = function(states, name, nextState, tagMap) { - states[name] = [{ - token : "text", - regex : "\\s+" - }, { - - token : !tagMap ? "meta.tag.tag-name" : function(value) { - if (tagMap[value]) - return "meta.tag.tag-name." + tagMap[value]; - else - return "meta.tag.tag-name"; - }, - regex : "[-_a-zA-Z0-9:]+", - next : name + "_embed_attribute_list" - }, { - token: "empty", - regex: "", - next : 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"] = [{ - token : "meta.tag.r", - regex : "/?>", - next : nextState - }, { - token : "keyword.operator", - regex : "=" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "text", - regex : "\\s+" - }].concat(string(name)); -}; - -}); - -define('ace/mode/behaviour/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); - return hasType; -} - -var XmlBehaviour = function () { - - this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour - - this.add("autoclosing", "insertion", function (state, action, editor, session, text) { - if (text == '>') { - var position = editor.getCursorPosition(); - var iterator = new TokenIterator(session, position.row, position.column); - var token = iterator.getCurrentToken(); - - if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column) - return; - var atCursor = false; - if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text'))); - } else { - atCursor = true; - } - if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) { - return; - } - var tag = token.value; - if (atCursor){ - var tag = tag.substring(0, position.column - token.start); - } - - return { - text: '>' + '', - selection: [1, 1] - } - } - }); - - this.add('autoindent', 'insertion', function (state, action, editor, session, text) { - if (text == "\n") { - var cursor = editor.getCursorPosition(); - var line = session.getLine(cursor.row); - var rightChars = line.substring(cursor.column, cursor.column + 2); - if (rightChars == ' -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/range', 'ace/mode/folding/fold_mode', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var lang = require("../../lib/lang"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; -var TokenIterator = require("../../token_iterator").TokenIterator; - -var FoldMode = exports.FoldMode = function(voidElements) { - BaseFoldMode.call(this); - this.voidElements = voidElements || {}; -}; -oop.inherits(FoldMode, BaseFoldMode); - -(function() { - - this.getFoldWidget = function(session, foldStyle, row) { - var tag = this._getFirstTagInLine(session, row); - - if (tag.closing) - return foldStyle == "markbeginend" ? "end" : ""; - - if (!tag.tagName || this.voidElements[tag.tagName.toLowerCase()]) - return ""; - - if (tag.selfClosing) - return ""; - - if (tag.value.indexOf("/" + tag.tagName) !== -1) - return ""; - - return "start"; - }; - - this._getFirstTagInLine = function(session, row) { - var tokens = session.getTokens(row); - var value = ""; - for (var i = 0; i < tokens.length; i++) { - var token = tokens[i]; - if (token.type.lastIndexOf("meta.tag", 0) === 0) - value += token.value; - else - value += lang.stringRepeat(" ", token.value.length); - } - - return this._parseTag(value); - }; - - this.tagRe = /^(\s*)(?)/; - this._parseTag = function(tag) { - - var match = tag.match(this.tagRe); - var column = 0; - - return { - value: tag, - match: match ? match[2] : "", - closing: match ? !!match[3] : false, - selfClosing: match ? !!match[5] || match[2] == "/>" : false, - tagName: match ? match[4] : "", - column: match[1] ? column + match[1].length : column - }; - }; - this._readTagForward = function(iterator) { - var token = iterator.getCurrentToken(); - if (!token) - return null; - - var value = ""; - var start; - - do { - if (token.type.lastIndexOf("meta.tag", 0) === 0) { - if (!start) { - var start = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() - }; - } - value += token.value; - if (value.indexOf(">") !== -1) { - var tag = this._parseTag(value); - tag.start = start; - tag.end = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() + token.value.length - }; - iterator.stepForward(); - return tag; - } - } - } while(token = iterator.stepForward()); - - return null; - }; - - this._readTagBackward = function(iterator) { - var token = iterator.getCurrentToken(); - if (!token) - return null; - - var value = ""; - var end; - - do { - if (token.type.lastIndexOf("meta.tag", 0) === 0) { - if (!end) { - end = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() + token.value.length - }; - } - value = token.value + value; - if (value.indexOf("<") !== -1) { - var tag = this._parseTag(value); - tag.end = end; - tag.start = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() - }; - iterator.stepBackward(); - return tag; - } - } - } while(token = iterator.stepBackward()); - - return null; - }; - - this._pop = function(stack, tag) { - while (stack.length) { - - var top = stack[stack.length-1]; - if (!tag || top.tagName == tag.tagName) { - return stack.pop(); - } - else if (this.voidElements[tag.tagName]) { - return; - } - else if (this.voidElements[top.tagName]) { - stack.pop(); - continue; - } else { - return null; - } - } - }; - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var firstTag = this._getFirstTagInLine(session, row); - - if (!firstTag.match) - return null; - - var isBackward = firstTag.closing || firstTag.selfClosing; - var stack = []; - var tag; - - if (!isBackward) { - var iterator = new TokenIterator(session, row, firstTag.column); - var start = { - row: row, - column: firstTag.column + firstTag.tagName.length + 2 - }; - while (tag = this._readTagForward(iterator)) { - if (tag.selfClosing) { - if (!stack.length) { - tag.start.column += tag.tagName.length + 2; - tag.end.column -= 2; - return Range.fromPoints(tag.start, tag.end); - } else - continue; - } - - if (tag.closing) { - this._pop(stack, tag); - if (stack.length == 0) - return Range.fromPoints(start, tag.start); - } - else { - stack.push(tag) - } - } - } - else { - var iterator = new TokenIterator(session, row, firstTag.column + firstTag.match.length); - var end = { - row: row, - column: firstTag.column - }; - - while (tag = this._readTagBackward(iterator)) { - if (tag.selfClosing) { - if (!stack.length) { - tag.start.column += tag.tagName.length + 2; - tag.end.column -= 2; - return Range.fromPoints(tag.start, tag.end); - } else - continue; - } - - if (!tag.closing) { - this._pop(stack, tag); - if (stack.length == 0) { - tag.start.column += tag.tagName.length + 2; - return Range.fromPoints(tag.start, end); - } - } - else { - stack.push(tag) - } - } - } - - }; - -}).call(FoldMode.prototype); - -}); - -define('ace/mode/javascript', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/javascript_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/worker/worker_client', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var Range = require("../range").Range; -var WorkerClient = require("../worker/worker_client").WorkerClient; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = JavaScriptHighlightRules; - - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().getLineTokens(line, state); - var tokens = tokenizedLine.tokens; - var endState = tokenizedLine.state; - - if (tokens.length && tokens[tokens.length-1].type == "comment") { - return indent; - } - - if (state == "start" || state == "no_regex") { - var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/); - if (match) { - indent += tab; - } - } else if (state == "doc-start") { - if (endState == "start" || endState == "no_regex") { - return ""; - } - var match = line.match(/^\s*(\/?)\*/); - if (match) { - if (match[1]) { - indent += " "; - } - indent += "* "; - } - } - - 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); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker"); - worker.attachToDocument(session.getDocument()); - - worker.on("jslint", function(results) { - session.setAnnotations(results.data); - }); - - worker.on("terminate", function() { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var JavaScriptHighlightRules = function() { - var keywordMapper = this.createKeywordMapper({ - "variable.language": - "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors - "Namespace|QName|XML|XMLList|" + // E4X - "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + - "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + - "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors - "SyntaxError|TypeError|URIError|" + - "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions - "isNaN|parseFloat|parseInt|" + - "JSON|Math|" + // Other - "this|arguments|prototype|window|document" , // Pseudo - "keyword": - "const|yield|import|get|set|" + - "break|case|catch|continue|default|delete|do|else|finally|for|function|" + - "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + - "__parent__|__count__|escape|unescape|with|__proto__|" + - "class|enum|extends|super|export|implements|private|public|interface|package|protected|static", - "storage.type": - "const|let|var|function", - "constant.language": - "null|Infinity|NaN|undefined", - "support.function": - "alert", - "constant.language.boolean": "true|false" - }, "identifier"); - var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; - var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\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 - ".)"; - - this.$rules = { - "no_regex" : [ - { - token : "comment", - regex : "\\/\\/", - next : "line_comment" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : /\/\*/, - next : "comment" - }, { - token : "string", - regex : "'(?=.)", - next : "qstring" - }, { - token : "string", - regex : '"(?=.)', - next : "qqstring" - }, { - token : "constant.numeric", // hex - regex : /0[xX][0-9a-fA-F]+\b/ - }, { - token : "constant.numeric", // float - regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/ - }, { - token : [ - "storage.type", "punctuation.operator", "support.function", - "punctuation.operator", "entity.name.function", "text","keyword.operator" - ], - regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "keyword.operator", "text", "storage.type", - "text", "paren.lparen" - ], - regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "punctuation.operator", - "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "text", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : "keyword", - regex : "(?:" + kwBeforeRe + ")\\b", - next : "start" - }, { - token : ["punctuation.operator", "support.function"], - regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/ - }, { - token : ["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 : keywordMapper, - regex : identifierRe - }, { - token : "keyword.operator", - regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/, - next : "start" - }, { - token : "punctuation.operator", - regex : /\?|\:|\,|\;|\./, - next : "start" - }, { - token : "paren.lparen", - regex : /[\[({]/, - next : "start" - }, { - token : "paren.rparen", - regex : /[\])}]/ - }, { - token : "keyword.operator", - regex : /\/=?/, - next : "start" - }, { - token: "comment", - regex: /^#!.*$/ - } - ], - "start": [ - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment_regex_allowed" - }, { - token : "comment", - regex : "\\/\\/", - next : "line_comment_regex_allowed" - }, { - token: "string.regexp", - regex: "\\/", - next: "regex" - }, { - token : "text", - regex : "\\s+|^$", - next : "start" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "regex": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "string.regexp", - regex: "/\\w*", - next: "no_regex" - }, { - token : "invalid", - regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ - }, { - token : "constant.language.escape", - regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/ - }, { - token : "constant.language.delimiter", - regex: /\|/ - }, { - token: "constant.language.escape", - regex: /\[\^?/, - next: "regex_character_class" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp" - } - ], - "regex_character_class": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "constant.language.escape", - regex: "]", - next: "regex" - }, { - token: "constant.language.escape", - regex: "-" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp.charachterclass" - } - ], - "function_arguments": [ - { - token: "variable.parameter", - regex: identifierRe - }, { - token: "punctuation.operator", - regex: "[, ]+" - }, { - token: "punctuation.operator", - regex: "$" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "comment_regex_allowed" : [ - {token : "comment", regex : "\\*\\/", next : "start"}, - {defaultToken : "comment"} - ], - "comment" : [ - {token : "comment", regex : "\\*\\/", next : "no_regex"}, - {defaultToken : "comment"} - ], - "line_comment_regex_allowed" : [ - {token : "comment", regex : "$|^", next : "start"}, - {defaultToken : "comment"} - ], - "line_comment" : [ - {token : "comment", regex : "$|^", next : "no_regex"}, - {defaultToken : "comment"} - ], - "qqstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qqstring" - }, { - token : "string", - regex : '"|$', - next : "no_regex" - }, { - defaultToken: "string" - } - ], - "qstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qstring" - }, { - token : "string", - regex : "'|$", - next : "no_regex" - }, { - defaultToken: "string" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("no_regex") ]); -}; - -oop.inherits(JavaScriptHighlightRules, TextHighlightRules); - -exports.JavaScriptHighlightRules = JavaScriptHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); - -define('ace/mode/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/css_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/worker/worker_client', 'ace/mode/behaviour/css', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var WorkerClient = require("../worker/worker_client").WorkerClient; -var CssBehaviour = require("./behaviour/css").CssBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = CssHighlightRules; - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CssBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.foldingRules = "cStyle"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - var tokens = this.getTokenizer().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); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker"); - worker.attachToDocument(session.getDocument()); - - worker.on("csslint", function(e) { - session.setAnnotations(e.data); - }); - - worker.on("terminate", function() { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; - -}); - -define('ace/mode/css_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var supportType = exports.supportType = "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"; -var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters"; -var supportConstant = exports.supportConstant = "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|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|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero"; -var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow"; -var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace"; - -var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))"; -var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b"; -var pseudoClasses = exports.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 CssHighlightRules = function() { - - var keywordMapper = this.createKeywordMapper({ - "support.function": supportFunction, - "support.constant": supportConstant, - "support.type": supportType, - "support.constant.color": supportConstantColor, - "support.constant.fonts": supportConstantFonts - }, "text", true); - - this.$rules = { - "start" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "@.*?{", - push: "media" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "media" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "\\}", - next: "pop" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "comment" : [{ - token : "comment", - regex : "\\*\\/", - next : "pop" - }, { - defaultToken : "comment" - }], - - "ruleset" : [ - { - token : "paren.rparen", - regex : "\\}", - next: "pop" - }, { - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - 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 : numRe - }, { - 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 : ["support.function", "string", "support.function"], - regex : "(url\\()(.*)(\\))" - }, { - token : keywordMapper, - regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*" - }, { - caseInsensitive: true - }] - }; - - this.normalizeRules(); -}; - -oop.inherits(CssHighlightRules, TextHighlightRules); - -exports.CssHighlightRules = CssHighlightRules; - -}); - -define('ace/mode/behaviour/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; - -var CssBehaviour = function () { - - this.inherit(CstyleBehaviour); - - this.add("colon", "insertion", function (state, action, editor, session, text) { - if (text === ':') { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - var token = iterator.getCurrentToken(); - if (token && token.value.match(/\s+/)) { - token = iterator.stepBackward(); - } - if (token && token.type === 'support.type') { - var line = session.doc.getLine(cursor.row); - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar === ':') { - return { - text: '', - selection: [1, 1] - } - } - if (!line.substring(cursor.column).match(/^\s*;/)) { - return { - text: ':;', - selection: [1, 1] - } - } - } - } - }); - - this.add("colon", "deletion", function (state, action, editor, session, range) { - var selected = session.doc.getTextRange(range); - if (!range.isMultiLine() && selected === ':') { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - var token = iterator.getCurrentToken(); - if (token && token.value.match(/\s+/)) { - token = iterator.stepBackward(); - } - if (token && token.type === 'support.type') { - 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("semicolon", "insertion", function (state, action, editor, session, text) { - if (text === ';') { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar === ';') { - return { - text: '', - selection: [1, 1] - } - } - } - }); - -} -oop.inherits(CssBehaviour, CstyleBehaviour); - -exports.CssBehaviour = CssBehaviour; -}); - -define('ace/mode/coldfusion_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/javascript_highlight_rules', 'ace/mode/html_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; - -var ColdfusionHighlightRules = function() { - HtmlHighlightRules.call(this); - - this.embedTagRules(JavaScriptHighlightRules, "cfjs-", "cfscript"); - - this.normalizeRules(); -}; - -oop.inherits(ColdfusionHighlightRules, HtmlHighlightRules); - -exports.ColdfusionHighlightRules = ColdfusionHighlightRules; -}); - -define('ace/mode/html_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/css_highlight_rules', 'ace/mode/javascript_highlight_rules', 'ace/mode/xml_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; - -var tagMap = lang.createMap({ - a : 'anchor', - button : 'form', - form : 'form', - img : 'image', - input : 'form', - label : 'form', - option : 'form', - script : 'script', - select : 'form', - textarea : 'form', - style : 'style', - table : 'table', - tbody : 'table', - td : 'table', - tfoot : 'table', - th : 'table', - tr : 'table' -}); - -var HtmlHighlightRules = function() { - XmlHighlightRules.call(this); - - this.addRules({ - attributes: [{ - include : "space" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "keyword.operator.separator", - regex : "=", - push : [{ - include: "space" - }, { - token : "string", - regex : "[^<>='\"`\\s]+", - next : "pop" - }, { - token : "empty", - regex : "", - next : "pop" - }] - }, { - include : "string" - }], - tag: [{ - token : function(start, tag) { - var group = tagMap[tag]; - return ["meta.tag.punctuation.begin", - "meta.tag.name" + (group ? "." + group : "")]; - }, - regex : "(<)([-_a-zA-Z0-9:]+)", - next: "start_tag_stuff" - }, { - token : function(start, tag) { - var group = tagMap[tag]; - return ["meta.tag.punctuation.begin", - "meta.tag.name" + (group ? "." + group : "")]; - }, - regex : "(", next : "start"} - ], - end_tag_stuff: [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next : "start"} - ] - }); - - this.embedTagRules(CssHighlightRules, "css-", "style"); - this.embedTagRules(JavaScriptHighlightRules, "js-", "script"); - - if (this.constructor === HtmlHighlightRules) - this.normalizeRules(); -}; - -oop.inherits(HtmlHighlightRules, XmlHighlightRules); - -exports.HtmlHighlightRules = HtmlHighlightRules; -}); diff --git a/addons/editor/ace/mode-csharp.js b/addons/editor/ace/mode-csharp.js deleted file mode 100644 index fb4d8563..00000000 --- a/addons/editor/ace/mode-csharp.js +++ /dev/null @@ -1,724 +0,0 @@ -define('ace/mode/csharp', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/csharp_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/csharp'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var CSharpHighlightRules = require("./csharp_highlight_rules").CSharpHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/csharp").FoldMode; - -var Mode = function() { - this.HighlightRules = CSharpHighlightRules; - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().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; - }; - - this.checkOutdent = function(state, line, input) { - return this.$outdent.checkOutdent(line, input); - }; - - this.autoOutdent = function(state, doc, row) { - this.$outdent.autoOutdent(doc, row); - }; - - - this.createWorker = function(session) { - return null; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); -define('ace/mode/csharp_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var CSharpHighlightRules = function() { - var keywordMapper = this.createKeywordMapper({ - "variable.language": "this", - "keyword": "abstract|event|new|struct|as|explicit|null|switch|base|extern|object|this|bool|false|operator|throw|break|finally|out|true|byte|fixed|override|try|case|float|params|typeof|catch|for|private|uint|char|foreach|protected|ulong|checked|goto|public|unchecked|class|if|readonly|unsafe|const|implicit|ref|ushort|continue|in|return|using|decimal|int|sbyte|virtual|default|interface|sealed|volatile|delegate|internal|short|void|do|is|sizeof|while|double|lock|stackalloc|else|long|static|enum|namespace|string|var|dynamic", - "constant.language": "null|true|false" - }, "identifier"); - - this.$rules = { - "start" : [ - { - token : "comment", - regex : "\\/\\/.*$" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment" - }, { - token : "string.regexp", - regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" - }, { - token : "string", // character - regex : /'(?:.|\\(:?u[\da-fA-F]+|x[\da-fA-F]+|[tbrf'"n]))'/ - }, { - token : "string", start : '"', end : '"|$', next: [ - {token: "constant.language.escape", regex: /\\(:?u[\da-fA-F]+|x[\da-fA-F]+|[tbrf'"n])/}, - {token: "invalid", regex: /\\./} - ] - }, { - token : "string", start : '@"', end : '"', next:[ - {token: "constant.language.escape", regex: '""'} - ] - }, { - token : "constant.numeric", // hex - regex : "0[xX][0-9a-fA-F]+\\b" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "constant.language.boolean", - regex : "(?:true|false)\\b" - }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" - }, { - token : "keyword.operator", - regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" - }, { - token : "keyword", - regex : "^\\s*#(if|else|elif|endif|define|undef|warning|error|line|region|endregion|pragma)" - }, { - token : "punctuation.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 - regex : ".+" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("start") ]); - this.normalizeRules(); -}; - -oop.inherits(CSharpHighlightRules, TextHighlightRules); - -exports.CSharpHighlightRules = CSharpHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/csharp', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var CFoldMode = require("./cstyle").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -oop.inherits(FoldMode, CFoldMode); - -(function() { - this.usingRe = /^\s*using \S/; - - this.getFoldWidgetRangeBase = this.getFoldWidgetRange; - this.getFoldWidgetBase = this.getFoldWidget; - - this.getFoldWidget = function(session, foldStyle, row) { - var fw = this.getFoldWidgetBase(session, foldStyle, row); - if (!fw) { - var line = session.getLine(row); - if (/^\s*#region\b/.test(line)) - return "start"; - var usingRe = this.usingRe; - if (usingRe.test(line)) { - var prev = session.getLine(row - 1); - var next = session.getLine(row + 1); - if (!usingRe.test(prev) && usingRe.test(next)) - return "start" - } - } - return fw; - }; - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var range = this.getFoldWidgetRangeBase(session, foldStyle, row); - if (range) - return range; - - var line = session.getLine(row); - if (this.usingRe.test(line)) - return this.getUsingStatementBlock(session, line, row); - - if (/^\s*#region\b/.test(line)) - return this.getRegionBlock(session, line, row); - }; - - this.getUsingStatementBlock = function(session, line, row) { - var startColumn = line.match(this.usingRe)[0].length - 1; - var maxRow = session.getLength(); - var startRow = row; - var endRow = row; - - while (++row < maxRow) { - line = session.getLine(row); - if (/^\s*$/.test(line)) - continue; - if (!this.usingRe.test(line)) - break; - - endRow = row; - } - - if (endRow > startRow) { - var endColumn = session.getLine(endRow).length; - return new Range(startRow, startColumn, endRow, endColumn); - } - }; - - this.getRegionBlock = function(session, line, row) { - var startColumn = line.search(/\s*$/); - var maxRow = session.getLength(); - var startRow = row; - - var re = /^\s*#(end)?region\b/ - var depth = 1 - while (++row < maxRow) { - line = session.getLine(row); - var m = re.exec(line); - if (!m) - continue; - if (m[1]) - depth--; - else - depth++; - - if (!depth) - break; - } - - var endRow = row; - if (endRow > startRow) { - var endColumn = line.search(/\S/); - return new Range(startRow, startColumn, endRow, endColumn); - } - }; - -}).call(FoldMode.prototype); - -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); diff --git a/addons/editor/ace/mode-css.js b/addons/editor/ace/mode-css.js deleted file mode 100644 index 71b5249e..00000000 --- a/addons/editor/ace/mode-css.js +++ /dev/null @@ -1,738 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2010, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/mode/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/css_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/worker/worker_client', 'ace/mode/behaviour/css', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var WorkerClient = require("../worker/worker_client").WorkerClient; -var CssBehaviour = require("./behaviour/css").CssBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = CssHighlightRules; - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CssBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.foldingRules = "cStyle"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - var tokens = this.getTokenizer().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); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker"); - worker.attachToDocument(session.getDocument()); - - worker.on("csslint", function(e) { - session.setAnnotations(e.data); - }); - - worker.on("terminate", function() { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; - -}); - -define('ace/mode/css_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var supportType = exports.supportType = "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"; -var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters"; -var supportConstant = exports.supportConstant = "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|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|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero"; -var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow"; -var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace"; - -var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))"; -var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b"; -var pseudoClasses = exports.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 CssHighlightRules = function() { - - var keywordMapper = this.createKeywordMapper({ - "support.function": supportFunction, - "support.constant": supportConstant, - "support.type": supportType, - "support.constant.color": supportConstantColor, - "support.constant.fonts": supportConstantFonts - }, "text", true); - - this.$rules = { - "start" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "@.*?{", - push: "media" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "media" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "\\}", - next: "pop" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "comment" : [{ - token : "comment", - regex : "\\*\\/", - next : "pop" - }, { - defaultToken : "comment" - }], - - "ruleset" : [ - { - token : "paren.rparen", - regex : "\\}", - next: "pop" - }, { - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - 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 : numRe - }, { - 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 : ["support.function", "string", "support.function"], - regex : "(url\\()(.*)(\\))" - }, { - token : keywordMapper, - regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*" - }, { - caseInsensitive: true - }] - }; - - this.normalizeRules(); -}; - -oop.inherits(CssHighlightRules, TextHighlightRules); - -exports.CssHighlightRules = CssHighlightRules; - -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; - -var CssBehaviour = function () { - - this.inherit(CstyleBehaviour); - - this.add("colon", "insertion", function (state, action, editor, session, text) { - if (text === ':') { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - var token = iterator.getCurrentToken(); - if (token && token.value.match(/\s+/)) { - token = iterator.stepBackward(); - } - if (token && token.type === 'support.type') { - var line = session.doc.getLine(cursor.row); - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar === ':') { - return { - text: '', - selection: [1, 1] - } - } - if (!line.substring(cursor.column).match(/^\s*;/)) { - return { - text: ':;', - selection: [1, 1] - } - } - } - } - }); - - this.add("colon", "deletion", function (state, action, editor, session, range) { - var selected = session.doc.getTextRange(range); - if (!range.isMultiLine() && selected === ':') { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - var token = iterator.getCurrentToken(); - if (token && token.value.match(/\s+/)) { - token = iterator.stepBackward(); - } - if (token && token.type === 'support.type') { - 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("semicolon", "insertion", function (state, action, editor, session, text) { - if (text === ';') { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar === ';') { - return { - text: '', - selection: [1, 1] - } - } - } - }); - -} -oop.inherits(CssBehaviour, CstyleBehaviour); - -exports.CssBehaviour = CssBehaviour; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); diff --git a/addons/editor/ace/mode-curly.js b/addons/editor/ace/mode-curly.js deleted file mode 100644 index 0708a82b..00000000 --- a/addons/editor/ace/mode-curly.js +++ /dev/null @@ -1,2373 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2012, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * Contributor(s): - * - * Libo Cannici - * - * - * - * ***** END LICENSE BLOCK ***** */ -define('ace/mode/curly', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/html', 'ace/tokenizer', 'ace/mode/matching_brace_outdent', 'ace/mode/html_highlight_rules', 'ace/mode/folding/html', 'ace/mode/curly_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var HtmlMode = require("./html").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; -var HtmlFoldMode = require("./folding/html").FoldMode; -var CurlyHighlightRules = require("./curly_highlight_rules").CurlyHighlightRules; - -var Mode = function() { - HtmlMode.call(this); - this.HighlightRules = CurlyHighlightRules; - this.$outdent = new MatchingBraceOutdent(); - this.foldingRules = new HtmlFoldMode(); -}; -oop.inherits(Mode, HtmlMode); - -(function() { -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/html', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/javascript', 'ace/mode/css', 'ace/tokenizer', 'ace/mode/html_highlight_rules', 'ace/mode/behaviour/html', 'ace/mode/folding/html', 'ace/mode/html_completions'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var JavaScriptMode = require("./javascript").Mode; -var CssMode = require("./css").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; -var HtmlBehaviour = require("./behaviour/html").HtmlBehaviour; -var HtmlFoldMode = require("./folding/html").FoldMode; -var HtmlCompletions = require("./html_completions").HtmlCompletions; - -var Mode = function() { - this.HighlightRules = HtmlHighlightRules; - this.$behaviour = new HtmlBehaviour(); - this.$completer = new HtmlCompletions(); - - this.createModeDelegates({ - "js-": JavaScriptMode, - "css-": CssMode - }); - - this.foldingRules = new HtmlFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.blockComment = {start: ""}; - - this.getNextLineIndent = function(state, line, tab) { - return this.$getIndent(line); - }; - - this.checkOutdent = function(state, line, input) { - return false; - }; - - this.getCompletions = function(state, session, pos, prefix) { - return this.$completer.getCompletions(state, session, pos, prefix); - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/javascript', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/javascript_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/worker/worker_client', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var Range = require("../range").Range; -var WorkerClient = require("../worker/worker_client").WorkerClient; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = JavaScriptHighlightRules; - - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().getLineTokens(line, state); - var tokens = tokenizedLine.tokens; - var endState = tokenizedLine.state; - - if (tokens.length && tokens[tokens.length-1].type == "comment") { - return indent; - } - - if (state == "start" || state == "no_regex") { - var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/); - if (match) { - indent += tab; - } - } else if (state == "doc-start") { - if (endState == "start" || endState == "no_regex") { - return ""; - } - var match = line.match(/^\s*(\/?)\*/); - if (match) { - if (match[1]) { - indent += " "; - } - indent += "* "; - } - } - - 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); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker"); - worker.attachToDocument(session.getDocument()); - - worker.on("jslint", function(results) { - session.setAnnotations(results.data); - }); - - worker.on("terminate", function() { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var JavaScriptHighlightRules = function() { - var keywordMapper = this.createKeywordMapper({ - "variable.language": - "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors - "Namespace|QName|XML|XMLList|" + // E4X - "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + - "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + - "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors - "SyntaxError|TypeError|URIError|" + - "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions - "isNaN|parseFloat|parseInt|" + - "JSON|Math|" + // Other - "this|arguments|prototype|window|document" , // Pseudo - "keyword": - "const|yield|import|get|set|" + - "break|case|catch|continue|default|delete|do|else|finally|for|function|" + - "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + - "__parent__|__count__|escape|unescape|with|__proto__|" + - "class|enum|extends|super|export|implements|private|public|interface|package|protected|static", - "storage.type": - "const|let|var|function", - "constant.language": - "null|Infinity|NaN|undefined", - "support.function": - "alert", - "constant.language.boolean": "true|false" - }, "identifier"); - var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; - var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\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 - ".)"; - - this.$rules = { - "no_regex" : [ - { - token : "comment", - regex : "\\/\\/", - next : "line_comment" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : /\/\*/, - next : "comment" - }, { - token : "string", - regex : "'(?=.)", - next : "qstring" - }, { - token : "string", - regex : '"(?=.)', - next : "qqstring" - }, { - token : "constant.numeric", // hex - regex : /0[xX][0-9a-fA-F]+\b/ - }, { - token : "constant.numeric", // float - regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/ - }, { - token : [ - "storage.type", "punctuation.operator", "support.function", - "punctuation.operator", "entity.name.function", "text","keyword.operator" - ], - regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "keyword.operator", "text", "storage.type", - "text", "paren.lparen" - ], - regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "punctuation.operator", - "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "text", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : "keyword", - regex : "(?:" + kwBeforeRe + ")\\b", - next : "start" - }, { - token : ["punctuation.operator", "support.function"], - regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/ - }, { - token : ["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 : keywordMapper, - regex : identifierRe - }, { - token : "keyword.operator", - regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/, - next : "start" - }, { - token : "punctuation.operator", - regex : /\?|\:|\,|\;|\./, - next : "start" - }, { - token : "paren.lparen", - regex : /[\[({]/, - next : "start" - }, { - token : "paren.rparen", - regex : /[\])}]/ - }, { - token : "keyword.operator", - regex : /\/=?/, - next : "start" - }, { - token: "comment", - regex: /^#!.*$/ - } - ], - "start": [ - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment_regex_allowed" - }, { - token : "comment", - regex : "\\/\\/", - next : "line_comment_regex_allowed" - }, { - token: "string.regexp", - regex: "\\/", - next: "regex" - }, { - token : "text", - regex : "\\s+|^$", - next : "start" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "regex": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "string.regexp", - regex: "/\\w*", - next: "no_regex" - }, { - token : "invalid", - regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ - }, { - token : "constant.language.escape", - regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/ - }, { - token : "constant.language.delimiter", - regex: /\|/ - }, { - token: "constant.language.escape", - regex: /\[\^?/, - next: "regex_character_class" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp" - } - ], - "regex_character_class": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "constant.language.escape", - regex: "]", - next: "regex" - }, { - token: "constant.language.escape", - regex: "-" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp.charachterclass" - } - ], - "function_arguments": [ - { - token: "variable.parameter", - regex: identifierRe - }, { - token: "punctuation.operator", - regex: "[, ]+" - }, { - token: "punctuation.operator", - regex: "$" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "comment_regex_allowed" : [ - {token : "comment", regex : "\\*\\/", next : "start"}, - {defaultToken : "comment"} - ], - "comment" : [ - {token : "comment", regex : "\\*\\/", next : "no_regex"}, - {defaultToken : "comment"} - ], - "line_comment_regex_allowed" : [ - {token : "comment", regex : "$|^", next : "start"}, - {defaultToken : "comment"} - ], - "line_comment" : [ - {token : "comment", regex : "$|^", next : "no_regex"}, - {defaultToken : "comment"} - ], - "qqstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qqstring" - }, { - token : "string", - regex : '"|$', - next : "no_regex" - }, { - defaultToken: "string" - } - ], - "qstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qstring" - }, { - token : "string", - regex : "'|$", - next : "no_regex" - }, { - defaultToken: "string" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("no_regex") ]); -}; - -oop.inherits(JavaScriptHighlightRules, TextHighlightRules); - -exports.JavaScriptHighlightRules = JavaScriptHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); - -define('ace/mode/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/css_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/worker/worker_client', 'ace/mode/behaviour/css', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var WorkerClient = require("../worker/worker_client").WorkerClient; -var CssBehaviour = require("./behaviour/css").CssBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = CssHighlightRules; - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CssBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.foldingRules = "cStyle"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - var tokens = this.getTokenizer().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); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker"); - worker.attachToDocument(session.getDocument()); - - worker.on("csslint", function(e) { - session.setAnnotations(e.data); - }); - - worker.on("terminate", function() { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; - -}); - -define('ace/mode/css_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var supportType = exports.supportType = "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"; -var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters"; -var supportConstant = exports.supportConstant = "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|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|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero"; -var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow"; -var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace"; - -var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))"; -var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b"; -var pseudoClasses = exports.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 CssHighlightRules = function() { - - var keywordMapper = this.createKeywordMapper({ - "support.function": supportFunction, - "support.constant": supportConstant, - "support.type": supportType, - "support.constant.color": supportConstantColor, - "support.constant.fonts": supportConstantFonts - }, "text", true); - - this.$rules = { - "start" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "@.*?{", - push: "media" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "media" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "\\}", - next: "pop" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "comment" : [{ - token : "comment", - regex : "\\*\\/", - next : "pop" - }, { - defaultToken : "comment" - }], - - "ruleset" : [ - { - token : "paren.rparen", - regex : "\\}", - next: "pop" - }, { - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - 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 : numRe - }, { - 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 : ["support.function", "string", "support.function"], - regex : "(url\\()(.*)(\\))" - }, { - token : keywordMapper, - regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*" - }, { - caseInsensitive: true - }] - }; - - this.normalizeRules(); -}; - -oop.inherits(CssHighlightRules, TextHighlightRules); - -exports.CssHighlightRules = CssHighlightRules; - -}); - -define('ace/mode/behaviour/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; - -var CssBehaviour = function () { - - this.inherit(CstyleBehaviour); - - this.add("colon", "insertion", function (state, action, editor, session, text) { - if (text === ':') { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - var token = iterator.getCurrentToken(); - if (token && token.value.match(/\s+/)) { - token = iterator.stepBackward(); - } - if (token && token.type === 'support.type') { - var line = session.doc.getLine(cursor.row); - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar === ':') { - return { - text: '', - selection: [1, 1] - } - } - if (!line.substring(cursor.column).match(/^\s*;/)) { - return { - text: ':;', - selection: [1, 1] - } - } - } - } - }); - - this.add("colon", "deletion", function (state, action, editor, session, range) { - var selected = session.doc.getTextRange(range); - if (!range.isMultiLine() && selected === ':') { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - var token = iterator.getCurrentToken(); - if (token && token.value.match(/\s+/)) { - token = iterator.stepBackward(); - } - if (token && token.type === 'support.type') { - 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("semicolon", "insertion", function (state, action, editor, session, text) { - if (text === ';') { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar === ';') { - return { - text: '', - selection: [1, 1] - } - } - } - }); - -} -oop.inherits(CssBehaviour, CstyleBehaviour); - -exports.CssBehaviour = CssBehaviour; -}); - -define('ace/mode/html_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/css_highlight_rules', 'ace/mode/javascript_highlight_rules', 'ace/mode/xml_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; - -var tagMap = lang.createMap({ - a : 'anchor', - button : 'form', - form : 'form', - img : 'image', - input : 'form', - label : 'form', - option : 'form', - script : 'script', - select : 'form', - textarea : 'form', - style : 'style', - table : 'table', - tbody : 'table', - td : 'table', - tfoot : 'table', - th : 'table', - tr : 'table' -}); - -var HtmlHighlightRules = function() { - XmlHighlightRules.call(this); - - this.addRules({ - attributes: [{ - include : "space" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "keyword.operator.separator", - regex : "=", - push : [{ - include: "space" - }, { - token : "string", - regex : "[^<>='\"`\\s]+", - next : "pop" - }, { - token : "empty", - regex : "", - next : "pop" - }] - }, { - include : "string" - }], - tag: [{ - token : function(start, tag) { - var group = tagMap[tag]; - return ["meta.tag.punctuation.begin", - "meta.tag.name" + (group ? "." + group : "")]; - }, - regex : "(<)([-_a-zA-Z0-9:]+)", - next: "start_tag_stuff" - }, { - token : function(start, tag) { - var group = tagMap[tag]; - return ["meta.tag.punctuation.begin", - "meta.tag.name" + (group ? "." + group : "")]; - }, - regex : "(", next : "start"} - ], - end_tag_stuff: [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next : "start"} - ] - }); - - this.embedTagRules(CssHighlightRules, "css-", "style"); - this.embedTagRules(JavaScriptHighlightRules, "js-", "script"); - - if (this.constructor === HtmlHighlightRules) - this.normalizeRules(); -}; - -oop.inherits(HtmlHighlightRules, XmlHighlightRules); - -exports.HtmlHighlightRules = HtmlHighlightRules; -}); - -define('ace/mode/xml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml_util', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var xmlUtil = require("./xml_util"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var XmlHighlightRules = function(normalize) { - this.$rules = { - start : [ - {token : "punctuation.string.begin", regex : "<\\!\\[CDATA\\[", next : "cdata"}, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)(xml)(?=[\\s])", next : "xml_declaration" - }, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)([-_a-zA-Z0-9]+)", next : "instruction" - }, - {token : "comment", regex : "<\\!--", next : "comment"}, - { - token : ["punctuation.doctype.begin", "meta.tag.doctype"], - regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype" - }, - {include : "tag"}, - {include : "reference"} - ], - - xml_declaration : [ - {include : "attributes"}, - {include : "instruction"} - ], - - instruction : [ - {token : "punctuation.instruction.end", regex : "\\?>", next : "start"} - ], - - doctype : [ - {include : "space"}, - {include : "string"}, - {token : "punctuation.doctype.end", regex : ">", next : "start"}, - {token : "xml-pe", regex : "[-_a-zA-Z0-9:]+"}, - {token : "punctuation.begin", regex : "\\[", push : "declarations"} - ], - - declarations : [{ - token : "text", - regex : "\\s+" - }, { - token: "punctuation.end", - regex: "]", - next: "pop" - }, { - token : ["punctuation.begin", "keyword"], - regex : "(<\\!)([-_a-zA-Z0-9]+)", - push : [{ - token : "text", - regex : "\\s+" - }, - { - token : "punctuation.end", - regex : ">", - next : "pop" - }, - {include : "string"}] - }], - - cdata : [ - {token : "string.end", regex : "\\]\\]>", next : "start"}, - {token : "text", regex : "\\s+"}, - {token : "text", regex : "(?:[^\\]]|\\](?!\\]>))+"} - ], - - comment : [ - {token : "comment", regex : "-->", next : "start"}, - {defaultToken : "comment"} - ], - - tag : [{ - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(<)((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)", - next: [ - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : "start"} - ] - }, { - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(", next : "start"} - ] - }], - - space : [ - {token : "text", regex : "\\s+"} - ], - - reference : [{ - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, { - token : "invalid.illegal", regex : "&" - }], - - string: [{ - token : "string", - regex : "'", - push : "qstring_inner" - }, { - token : "string", - regex : '"', - push : "qqstring_inner" - }], - - qstring_inner: [ - {token : "string", regex: "'", next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - qqstring_inner: [ - {token : "string", regex: '"', next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - attributes: [{ - token : "entity.other.attribute-name", - regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+" - }, { - token : "keyword.operator.separator", - regex : "=" - }, { - include : "space" - }, { - include : "string" - }] - }; - - if (this.constructor === XmlHighlightRules) - this.normalizeRules(); -}; - - -(function() { - - this.embedTagRules = function(HighlightRules, prefix, tag){ - this.$rules.tag.unshift({ - token : ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(<)(" + tag + ")", - next: [ - {include : "space"}, - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : prefix + "start"} - ] - }); - - this.$rules[tag + "-end"] = [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next: "start", - onMatch : function(value, currentState, stack) { - stack.splice(0); - return this.token; - }} - ] - - this.embedRules(HighlightRules, prefix, [{ - token: ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(" - }]); - }; - -}).call(TextHighlightRules.prototype); - -oop.inherits(XmlHighlightRules, TextHighlightRules); - -exports.XmlHighlightRules = XmlHighlightRules; -}); - -define('ace/mode/xml_util', ['require', 'exports', 'module' ], function(require, exports, module) { - - -function string(state) { - return [{ - token : "string", - regex : '"', - next : state + "_qqstring" - }, { - token : "string", - regex : "'", - next : state + "_qstring" - }]; -} - -function multiLineString(quote, state) { - return [ - {token : "string", regex : quote, next : state}, - { - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, - {defaultToken : "string"} - ]; -} - -exports.tag = function(states, name, nextState, tagMap) { - states[name] = [{ - token : "text", - regex : "\\s+" - }, { - - token : !tagMap ? "meta.tag.tag-name" : function(value) { - if (tagMap[value]) - return "meta.tag.tag-name." + tagMap[value]; - else - return "meta.tag.tag-name"; - }, - regex : "[-_a-zA-Z0-9:]+", - next : name + "_embed_attribute_list" - }, { - token: "empty", - regex: "", - next : 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"] = [{ - token : "meta.tag.r", - regex : "/?>", - next : nextState - }, { - token : "keyword.operator", - regex : "=" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "text", - regex : "\\s+" - }].concat(string(name)); -}; - -}); - -define('ace/mode/behaviour/html', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour/xml', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var XmlBehaviour = require("../behaviour/xml").XmlBehaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var voidElements = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']; - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); - return hasType; -} - -var HtmlBehaviour = function () { - - this.inherit(XmlBehaviour); // Get xml behaviour - - this.add("autoclosing", "insertion", function (state, action, editor, session, text) { - if (text == '>') { - var position = editor.getCursorPosition(); - var iterator = new TokenIterator(session, position.row, position.column); - var token = iterator.getCurrentToken(); - - if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column) - return; - var atCursor = false; - if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text'))); - } else { - atCursor = true; - } - if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) { - return; - } - var element = token.value; - if (atCursor){ - var element = element.substring(0, position.column - token.start); - } - if (voidElements.indexOf(element) !== -1){ - return; - } - return { - text: '>' + '', - selection: [1, 1] - } - } - }); -} -oop.inherits(HtmlBehaviour, XmlBehaviour); - -exports.HtmlBehaviour = HtmlBehaviour; -}); - -define('ace/mode/behaviour/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); - return hasType; -} - -var XmlBehaviour = function () { - - this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour - - this.add("autoclosing", "insertion", function (state, action, editor, session, text) { - if (text == '>') { - var position = editor.getCursorPosition(); - var iterator = new TokenIterator(session, position.row, position.column); - var token = iterator.getCurrentToken(); - - if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column) - return; - var atCursor = false; - if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text'))); - } else { - atCursor = true; - } - if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) { - return; - } - var tag = token.value; - if (atCursor){ - var tag = tag.substring(0, position.column - token.start); - } - - return { - text: '>' + '', - selection: [1, 1] - } - } - }); - - this.add('autoindent', 'insertion', function (state, action, editor, session, text) { - if (text == "\n") { - var cursor = editor.getCursorPosition(); - var line = session.getLine(cursor.row); - var rightChars = line.substring(cursor.column, cursor.column + 2); - if (rightChars == '?)/; - this._parseTag = function(tag) { - - var match = tag.match(this.tagRe); - var column = 0; - - return { - value: tag, - match: match ? match[2] : "", - closing: match ? !!match[3] : false, - selfClosing: match ? !!match[5] || match[2] == "/>" : false, - tagName: match ? match[4] : "", - column: match[1] ? column + match[1].length : column - }; - }; - this._readTagForward = function(iterator) { - var token = iterator.getCurrentToken(); - if (!token) - return null; - - var value = ""; - var start; - - do { - if (token.type.lastIndexOf("meta.tag", 0) === 0) { - if (!start) { - var start = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() - }; - } - value += token.value; - if (value.indexOf(">") !== -1) { - var tag = this._parseTag(value); - tag.start = start; - tag.end = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() + token.value.length - }; - iterator.stepForward(); - return tag; - } - } - } while(token = iterator.stepForward()); - - return null; - }; - - this._readTagBackward = function(iterator) { - var token = iterator.getCurrentToken(); - if (!token) - return null; - - var value = ""; - var end; - - do { - if (token.type.lastIndexOf("meta.tag", 0) === 0) { - if (!end) { - end = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() + token.value.length - }; - } - value = token.value + value; - if (value.indexOf("<") !== -1) { - var tag = this._parseTag(value); - tag.end = end; - tag.start = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() - }; - iterator.stepBackward(); - return tag; - } - } - } while(token = iterator.stepBackward()); - - return null; - }; - - this._pop = function(stack, tag) { - while (stack.length) { - - var top = stack[stack.length-1]; - if (!tag || top.tagName == tag.tagName) { - return stack.pop(); - } - else if (this.voidElements[tag.tagName]) { - return; - } - else if (this.voidElements[top.tagName]) { - stack.pop(); - continue; - } else { - return null; - } - } - }; - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var firstTag = this._getFirstTagInLine(session, row); - - if (!firstTag.match) - return null; - - var isBackward = firstTag.closing || firstTag.selfClosing; - var stack = []; - var tag; - - if (!isBackward) { - var iterator = new TokenIterator(session, row, firstTag.column); - var start = { - row: row, - column: firstTag.column + firstTag.tagName.length + 2 - }; - while (tag = this._readTagForward(iterator)) { - if (tag.selfClosing) { - if (!stack.length) { - tag.start.column += tag.tagName.length + 2; - tag.end.column -= 2; - return Range.fromPoints(tag.start, tag.end); - } else - continue; - } - - if (tag.closing) { - this._pop(stack, tag); - if (stack.length == 0) - return Range.fromPoints(start, tag.start); - } - else { - stack.push(tag) - } - } - } - else { - var iterator = new TokenIterator(session, row, firstTag.column + firstTag.match.length); - var end = { - row: row, - column: firstTag.column - }; - - while (tag = this._readTagBackward(iterator)) { - if (tag.selfClosing) { - if (!stack.length) { - tag.start.column += tag.tagName.length + 2; - tag.end.column -= 2; - return Range.fromPoints(tag.start, tag.end); - } else - continue; - } - - if (!tag.closing) { - this._pop(stack, tag); - if (stack.length == 0) { - tag.start.column += tag.tagName.length + 2; - return Range.fromPoints(tag.start, end); - } - } - else { - stack.push(tag) - } - } - } - - }; - -}).call(FoldMode.prototype); - -}); - -define('ace/mode/html_completions', ['require', 'exports', 'module' , 'ace/token_iterator'], function(require, exports, module) { - - -var TokenIterator = require("../token_iterator").TokenIterator; - -var commonAttributes = [ - "accesskey", - "class", - "contenteditable", - "contextmenu", - "dir", - "draggable", - "dropzone", - "hidden", - "id", - "lang", - "spellcheck", - "style", - "tabindex", - "title", - "translate" -]; - -var eventAttributes = [ - "onabort", - "onblur", - "oncancel", - "oncanplay", - "oncanplaythrough", - "onchange", - "onclick", - "onclose", - "oncontextmenu", - "oncuechange", - "ondblclick", - "ondrag", - "ondragend", - "ondragenter", - "ondragleave", - "ondragover", - "ondragstart", - "ondrop", - "ondurationchange", - "onemptied", - "onended", - "onerror", - "onfocus", - "oninput", - "oninvalid", - "onkeydown", - "onkeypress", - "onkeyup", - "onload", - "onloadeddata", - "onloadedmetadata", - "onloadstart", - "onmousedown", - "onmousemove", - "onmouseout", - "onmouseover", - "onmouseup", - "onmousewheel", - "onpause", - "onplay", - "onplaying", - "onprogress", - "onratechange", - "onreset", - "onscroll", - "onseeked", - "onseeking", - "onselect", - "onshow", - "onstalled", - "onsubmit", - "onsuspend", - "ontimeupdate", - "onvolumechange", - "onwaiting" -]; - -var globalAttributes = commonAttributes.concat(eventAttributes); - -var attributeMap = { - "html": ["manifest"], - "head": [], - "title": [], - "base": ["href", "target"], - "link": ["href", "hreflang", "rel", "media", "type", "sizes"], - "meta": ["http-equiv", "name", "content", "charset"], - "style": ["type", "media", "scoped"], - "script": ["charset", "type", "src", "defer", "async"], - "noscript": ["href"], - "body": ["onafterprint", "onbeforeprint", "onbeforeunload", "onhashchange", "onmessage", "onoffline", "onpopstate", "onredo", "onresize", "onstorage", "onundo", "onunload"], - "section": [], - "nav": [], - "article": ["pubdate"], - "aside": [], - "h1": [], - "h2": [], - "h3": [], - "h4": [], - "h5": [], - "h6": [], - "header": [], - "footer": [], - "address": [], - "main": [], - "p": [], - "hr": [], - "pre": [], - "blockquote": ["cite"], - "ol": ["start", "reversed"], - "ul": [], - "li": ["value"], - "dl": [], - "dt": [], - "dd": [], - "figure": [], - "figcaption": [], - "div": [], - "a": ["href", "target", "ping", "rel", "media", "hreflang", "type"], - "em": [], - "strong": [], - "small": [], - "s": [], - "cite": [], - "q": ["cite"], - "dfn": [], - "abbr": [], - "data": [], - "time": ["datetime"], - "code": [], - "var": [], - "samp": [], - "kbd": [], - "sub": [], - "sup": [], - "i": [], - "b": [], - "u": [], - "mark": [], - "ruby": [], - "rt": [], - "rp": [], - "bdi": [], - "bdo": [], - "span": [], - "br": [], - "wbr": [], - "ins": ["cite", "datetime"], - "del": ["cite", "datetime"], - "img": ["alt", "src", "height", "width", "usemap", "ismap"], - "iframe": ["name", "src", "height", "width", "sandbox", "seamless"], - "embed": ["src", "height", "width", "type"], - "object": ["param", "data", "type", "height" , "width", "usemap", "name", "form", "classid"], - "param": ["name", "value"], - "video": ["src", "autobuffer", "autoplay", "loop", "controls", "width", "height", "poster"], - "audio": ["src", "autobuffer", "autoplay", "loop", "controls"], - "source": ["src", "type", "media"], - "track": ["kind", "src", "srclang", "label", "default"], - "canvas": ["width", "height"], - "map": ["name"], - "area": ["shape", "coords", "href", "hreflang", "alt", "target", "media", "rel", "ping", "type"], - "svg": [], - "math": [], - "table": ["summary"], - "caption": [], - "colgroup": ["span"], - "col": ["span"], - "tbody": [], - "thead": [], - "tfoot": [], - "tr": [], - "td": ["headers", "rowspan", "colspan"], - "th": ["headers", "rowspan", "colspan", "scope"], - "form": ["accept-charset", "action", "autocomplete", "enctype", "method", "name", "novalidate", "target"], - "fieldset": ["disabled", "form", "name"], - "legend": [], - "label": ["form", "for"], - "input": ["type", "accept", "alt", "autocomplete", "checked", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "height", "list", "max", "maxlength", "min", "multiple", "pattern", "placeholder", "readonly", "required", "size", "src", "step", "width", "files", "value"], - "button": ["autofocus", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "name", "value", "type"], - "select": ["autofocus", "disabled", "form", "multiple", "name", "size"], - "datalist": [], - "optgroup": ["disabled", "label"], - "option": ["disabled", "selected", "label", "value"], - "textarea": ["autofocus", "disabled", "form", "maxlength", "name", "placeholder", "readonly", "required", "rows", "cols", "wrap"], - "keygen": ["autofocus", "challenge", "disabled", "form", "keytype", "name"], - "output": ["for", "form", "name"], - "progress": ["value", "max"], - "meter": ["value", "min", "max", "low", "high", "optimum"], - "details": ["open"], - "summary": [], - "command": ["type", "label", "icon", "disabled", "checked", "radiogroup", "command"], - "menu": ["type", "label"], - "dialog": ["open"] -}; - -var allElements = Object.keys(attributeMap); - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); -} - -function findTagName(session, pos) { - var iterator = new TokenIterator(session, pos.row, pos.column); - var token = iterator.getCurrentToken(); - if (!token || !hasType(token, 'tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'operator') || hasType(token, 'attribute-name') || hasType(token, 'text'))); - } - if (token && hasType(token, 'tag-name') && !iterator.stepBackward().value.match('/')) - return token.value; -} - -var HtmlCompletions = function() { - -}; - -(function() { - - this.getCompletions = function(state, session, pos, prefix) { - var token = session.getTokenAt(pos.row, pos.column); - - if (!token) - return []; - if (hasType(token, "tag-name") || (token.value == '<' && hasType(token, "text"))) - return this.getTagCompletions(state, session, pos, prefix); - if (hasType(token, 'text') || hasType(token, 'attribute-name')) - return this.getAttributeCompetions(state, session, pos, prefix); - - return []; - }; - - this.getTagCompletions = function(state, session, pos, prefix) { - var elements = allElements; - if (prefix) { - elements = elements.filter(function(element){ - return element.indexOf(prefix) === 0; - }); - } - return elements.map(function(element){ - return { - value: element, - meta: "tag" - }; - }); - }; - - this.getAttributeCompetions = function(state, session, pos, prefix) { - var tagName = findTagName(session, pos); - if (!tagName) - return []; - var attributes = globalAttributes; - if (tagName in attributeMap) { - attributes = attributes.concat(attributeMap[tagName]); - } - if (prefix) { - attributes = attributes.filter(function(attribute){ - return attribute.indexOf(prefix) === 0; - }); - } - return attributes.map(function(attribute){ - return { - caption: attribute, - snippet: attribute + '="$0"', - meta: "attribute" - }; - }); - }; - -}).call(HtmlCompletions.prototype); - -exports.HtmlCompletions = HtmlCompletions; -}); -define('ace/mode/curly_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/html_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; - - -var CurlyHighlightRules = function() { - HtmlHighlightRules.call(this); - - this.$rules["start"].unshift({ - token: "variable", - regex: "{{", - push: "curly-start" - }); - - this.$rules["curly-start"] = [{ - token: "variable", - regex: "}}", - next: "pop" - }]; - - this.normalizeRules(); -}; - -oop.inherits(CurlyHighlightRules, HtmlHighlightRules); - -exports.CurlyHighlightRules = CurlyHighlightRules; - -}); diff --git a/addons/editor/ace/mode-dart.js b/addons/editor/ace/mode-dart.js deleted file mode 100644 index 00f067d2..00000000 --- a/addons/editor/ace/mode-dart.js +++ /dev/null @@ -1,945 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2012, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * Contributor(s): - * - * - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/mode/dart', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/c_cpp', 'ace/tokenizer', 'ace/mode/dart_highlight_rules', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var CMode = require("./c_cpp").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var DartHighlightRules = require("./dart_highlight_rules").DartHighlightRules; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - CMode.call(this); - this.HighlightRules = DartHighlightRules; - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, CMode); - -(function() { - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/c_cpp', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/c_cpp_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var Range = require("../range").Range; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = c_cppHighlightRules; - - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().getLineTokens(line, state); - var tokens = tokenizedLine.tokens; - var endState = tokenizedLine.state; - - if (tokens.length && tokens[tokens.length-1].type == "comment") { - return indent; - } - - if (state == "start") { - var match = line.match(/^.*[\{\(\[]\s*$/); - if (match) { - indent += tab; - } - } else if (state == "doc-start") { - if (endState == "start") { - return ""; - } - var match = line.match(/^\s*(\/?)\*/); - if (match) { - if (match[1]) { - indent += " "; - } - indent += "* "; - } - } - - 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; -}); -define('ace/mode/c_cpp_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var cFunctions = exports.cFunctions = "\\s*\\bhypot(?:f|l)?|s(?:scanf|ystem|nprintf|ca(?:nf|lb(?:n(?:f|l)?|ln(?:f|l)?))|i(?:n(?:h(?:f|l)?|f|l)?|gn(?:al|bit))|tr(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(?:jmp|vbuf|locale|buf)|qrt(?:f|l)?|w(?:scanf|printf)|rand)|n(?:e(?:arbyint(?:f|l)?|xt(?:toward(?:f|l)?|after(?:f|l)?))|an(?:f|l)?)|c(?:s(?:in(?:h(?:f|l)?|f|l)?|qrt(?:f|l)?)|cos(?:h(?:f)?|f|l)?|imag(?:f|l)?|t(?:ime|an(?:h(?:f|l)?|f|l)?)|o(?:s(?:h(?:f|l)?|f|l)?|nj(?:f|l)?|pysign(?:f|l)?)|p(?:ow(?:f|l)?|roj(?:f|l)?)|e(?:il(?:f|l)?|xp(?:f|l)?)|l(?:o(?:ck|g(?:f|l)?)|earerr)|a(?:sin(?:h(?:f|l)?|f|l)?|cos(?:h(?:f|l)?|f|l)?|tan(?:h(?:f|l)?|f|l)?|lloc|rg(?:f|l)?|bs(?:f|l)?)|real(?:f|l)?|brt(?:f|l)?)|t(?:ime|o(?:upper|lower)|an(?:h(?:f|l)?|f|l)?|runc(?:f|l)?|gamma(?:f|l)?|mp(?:nam|file))|i(?:s(?:space|n(?:ormal|an)|cntrl|inf|digit|u(?:nordered|pper)|p(?:unct|rint)|finite|w(?:space|c(?:ntrl|type)|digit|upper|p(?:unct|rint)|lower|al(?:num|pha)|graph|xdigit|blank)|l(?:ower|ess(?:equal|greater)?)|al(?:num|pha)|gr(?:eater(?:equal)?|aph)|xdigit|blank)|logb(?:f|l)?|max(?:div|abs))|di(?:v|fftime)|_Exit|unget(?:c|wc)|p(?:ow(?:f|l)?|ut(?:s|c(?:har)?|wc(?:har)?)|error|rintf)|e(?:rf(?:c(?:f|l)?|f|l)?|x(?:it|p(?:2(?:f|l)?|f|l|m1(?:f|l)?)?))|v(?:s(?:scanf|nprintf|canf|printf|w(?:scanf|printf))|printf|f(?:scanf|printf|w(?:scanf|printf))|w(?:scanf|printf)|a_(?:start|copy|end|arg))|qsort|f(?:s(?:canf|e(?:tpos|ek))|close|tell|open|dim(?:f|l)?|p(?:classify|ut(?:s|c|w(?:s|c))|rintf)|e(?:holdexcept|set(?:e(?:nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(?:aiseexcept|ror)|get(?:e(?:nv|xceptflag)|round))|flush|w(?:scanf|ide|printf|rite)|loor(?:f|l)?|abs(?:f|l)?|get(?:s|c|pos|w(?:s|c))|re(?:open|e|ad|xp(?:f|l)?)|m(?:in(?:f|l)?|od(?:f|l)?|a(?:f|l|x(?:f|l)?)?))|l(?:d(?:iv|exp(?:f|l)?)|o(?:ngjmp|cal(?:time|econv)|g(?:1(?:p(?:f|l)?|0(?:f|l)?)|2(?:f|l)?|f|l|b(?:f|l)?)?)|abs|l(?:div|abs|r(?:int(?:f|l)?|ound(?:f|l)?))|r(?:int(?:f|l)?|ound(?:f|l)?)|gamma(?:f|l)?)|w(?:scanf|c(?:s(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?|mbs)|pbrk|ftime|len|r(?:chr|tombs)|xfrm)|to(?:b|mb)|rtomb)|printf|mem(?:set|c(?:hr|py|mp)|move))|a(?:s(?:sert|ctime|in(?:h(?:f|l)?|f|l)?)|cos(?:h(?:f|l)?|f|l)?|t(?:o(?:i|f|l(?:l)?)|exit|an(?:h(?:f|l)?|2(?:f|l)?|f|l)?)|b(?:s|ort))|g(?:et(?:s|c(?:har)?|env|wc(?:har)?)|mtime)|r(?:int(?:f|l)?|ound(?:f|l)?|e(?:name|alloc|wind|m(?:ove|quo(?:f|l)?|ainder(?:f|l)?))|a(?:nd|ise))|b(?:search|towc)|m(?:odf(?:f|l)?|em(?:set|c(?:hr|py|mp)|move)|ktime|alloc|b(?:s(?:init|towcs|rtowcs)|towc|len|r(?:towc|len)))\\b" - -var c_cppHighlightRules = function() { - - var keywordControls = ( - "break|case|continue|default|do|else|for|goto|if|_Pragma|" + - "return|switch|while|catch|operator|try|throw|using" - ); - - var storageType = ( - "asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" + - "_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|" + - "class|wchar_t|template" - ); - - var storageModifiers = ( - "const|extern|register|restrict|static|volatile|inline|private:|" + - "protected:|public:|friend|explicit|virtual|export|mutable|typename" - ); - - var keywordOperators = ( - "and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq" + - "const_cast|dynamic_cast|reinterpret_cast|static_cast|sizeof|namespace" - ); - - var builtinConstants = ( - "NULL|true|false|TRUE|FALSE" - ); - - var keywordMapper = this.$keywords = this.createKeywordMapper({ - "keyword.control" : keywordControls, - "storage.type" : storageType, - "storage.modifier" : storageModifiers, - "keyword.operator" : keywordOperators, - "variable.language": "this", - "constant.language": builtinConstants - }, "identifier"); - - var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\d\\$_\u00a1-\uffff]*\\b"; - - this.$rules = { - "start" : [ - { - token : "comment", - regex : "\\/\\/.*$" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // multi line string start - regex : '["].*\\\\$', - next : "qqstring" - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - token : "string", // multi line string start - regex : "['].*\\\\$", - next : "qstring" - }, { - token : "constant.numeric", // hex - regex : "0[xX][0-9a-fA-F]+(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b" - }, { - token : "keyword", // pre-compiler directives - regex : "#\\s*(?:include|import|pragma|line|define|undef|if|ifdef|else|elif|ifndef)\\b", - next : "directive" - }, { - token : "keyword", // special case pre-compiler directive - regex : "(?:#\\s*endif)\\b" - }, { - token : "support.function.C99.c", - regex : cFunctions - }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" - }, { - token : "keyword.operator", - regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)" - }, { - token : "punctuation.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 - regex : ".+" - } - ], - "qqstring" : [ - { - token : "string", - regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"', - next : "start" - }, { - token : "string", - regex : '.+' - } - ], - "qstring" : [ - { - token : "string", - regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'", - next : "start" - }, { - token : "string", - regex : '.+' - } - ], - "directive" : [ - { - token : "constant.other.multiline", - regex : /\\/ - }, - { - token : "constant.other.multiline", - regex : /.*\\/ - }, - { - token : "constant.other", - regex : "\\s*<.+?>", - next : "start" - }, - { - token : "constant.other", // single line - regex : '\\s*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]', - next : "start" - }, - { - token : "constant.other", // single line - regex : "\\s*['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']", - next : "start" - }, - { - token : "constant.other", - regex : /[^\\\/]+/, - next : "start" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("start") ]); -}; - -oop.inherits(c_cppHighlightRules, TextHighlightRules); - -exports.c_cppHighlightRules = c_cppHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); - - -define('ace/mode/dart_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DartHighlightRules = function() { - - var constantLanguage = "true|false|null"; - var variableLanguage = "this|super"; - var keywordControl = "try|catch|finally|throw|break|case|continue|default|do|else|for|if|in|return|switch|while|new"; - var keywordDeclaration = "abstract|class|extends|external|factory|implements|get|native|operator|set|typedef"; - var storageModifier = "static|final|const"; - var storageType = "void|bool|num|int|double|dynamic|var|String"; - - var keywordMapper = this.createKeywordMapper({ - "constant.language.dart": constantLanguage, - "variable.language.dart": variableLanguage, - "keyword.control.dart": keywordControl, - "keyword.declaration.dart": keywordDeclaration, - "storage.modifier.dart": storageModifier, - "storage.type.primitive.dart": storageType - }, "identifier"); - - var stringfill = { - token : "string", - regex : ".+" - }; - - this.$rules = - { - "start": [ - { - token : "comment", - regex : /\/\/.*$/ - }, - { - token : "comment", // multi line comment - regex : /\/\*/, - next : "comment" - }, - { - token: ["meta.preprocessor.script.dart"], - regex: "^(#!.*)$" - }, - { - token: "keyword.other.import.dart", - regex: "(?:\\b)(?:library|import|part|of)(?:\\b)" - }, - { - token : ["keyword.other.import.dart", "text"], - regex : "(?:\\b)(prefix)(\\s*:)" - }, - { - regex: "\\bas\\b", - token: "keyword.cast.dart" - }, - { - regex: "\\?|:", - token: "keyword.control.ternary.dart" - }, - { - regex: "(?:\\b)(is\\!?)(?:\\b)", - token: ["keyword.operator.dart"] - }, - { - regex: "(<<|>>>?|~|\\^|\\||&)", - token: ["keyword.operator.bitwise.dart"] - }, - { - regex: "((?:&|\\^|\\||<<|>>>?)=)", - token: ["keyword.operator.assignment.bitwise.dart"] - }, - { - regex: "(===?|!==?|<=?|>=?)", - token: ["keyword.operator.comparison.dart"] - }, - { - regex: "((?:[+*/%-]|\\~)=)", - token: ["keyword.operator.assignment.arithmetic.dart"] - }, - { - regex: "=", - token: "keyword.operator.assignment.dart" - }, - { - token : "string", - regex : "'''", - next : "qdoc" - }, - { - token : "string", - regex : '"""', - next : "qqdoc" - }, - { - token : "string", - regex : "'", - next : "qstring" - }, - { - token : "string", - regex : '"', - next : "qqstring" - }, - { - regex: "(\\-\\-|\\+\\+)", - token: ["keyword.operator.increment-decrement.dart"] - }, - { - regex: "(\\-|\\+|\\*|\\/|\\~\\/|%)", - token: ["keyword.operator.arithmetic.dart"] - }, - { - regex: "(!|&&|\\|\\|)", - token: ["keyword.operator.logical.dart"] - }, - { - token : "constant.numeric", // hex - regex : "0[xX][0-9a-fA-F]+\\b" - }, - { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, - { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" - } - ], - "comment" : [ - { - token : "comment", // closing comment - regex : ".*?\\*\\/", - next : "start" - }, { - token : "comment", // comment spanning whole line - regex : ".+" - } - ], - "qdoc" : [ - { - token : "string", - regex : ".*?'''", - next : "start" - }, stringfill], - - "qqdoc" : [ - { - token : "string", - regex : '.*?"""', - next : "start" - }, stringfill], - - "qstring" : [ - { - token : "string", - regex : "[^\\\\']*(?:\\\\.[^\\\\']*)*'", - next : "start" - }, stringfill], - - "qqstring" : [ - { - token : "string", - regex : '[^\\\\"]*(?:\\\\.[^\\\\"]*)*"', - next : "start" - }, stringfill] -} - -}; - -oop.inherits(DartHighlightRules, TextHighlightRules); - -exports.DartHighlightRules = DartHighlightRules; -}); diff --git a/addons/editor/ace/mode-django.js b/addons/editor/ace/mode-django.js deleted file mode 100644 index a20b6adb..00000000 --- a/addons/editor/ace/mode-django.js +++ /dev/null @@ -1,2399 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2012, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/mode/django', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/html', 'ace/tokenizer', 'ace/mode/html_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - -var oop = require("../lib/oop"); -var HtmlMode = require("./html").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DjangoHighlightRules = function(){ - this.$rules = { - 'start': [{ - token: "string", - regex: '".*?"' - }, { - token: "string", - regex: "'.*?'" - }, { - token: "constant", - regex: '[0-9]+' - }, { - token: "variable", - regex: "[-_a-zA-Z0-9:]+" - }], - 'comment': [{ - token : "comment.block", - merge: true, - regex : ".+?" - }], - 'tag': [{ - token: "entity.name.function", - regex: "[a-zA-Z][_a-zA-Z0-9]*", - next: "start" - }] - }; -}; - -oop.inherits(DjangoHighlightRules, TextHighlightRules) - -var DjangoHtmlHighlightRules = function() { - this.$rules = new HtmlHighlightRules().getRules(); - - for (var i in this.$rules) { - this.$rules[i].unshift({ - token: "comment.line", - regex: "\\{#.*?#\\}" - }, { - token: "comment.block", - regex: "\\{\\%\\s*comment\\s*\\%\\}", - merge: true, - next: "django-comment" - }, { - token: "constant.language", - regex: "\\{\\{", - next: "django-start" - }, { - token: "constant.language", - regex: "\\{\\%", - next: "django-tag" - }); - this.embedRules(DjangoHighlightRules, "django-", [{ - token: "comment.block", - regex: "\\{\\%\\s*endcomment\\s*\\%\\}", - merge: true, - next: "start" - }, { - token: "constant.language", - regex: "\\%\\}", - next: "start" - }, { - token: "constant.language", - regex: "\\}\\}", - next: "start" - }]); - } -}; - -oop.inherits(DjangoHtmlHighlightRules, HtmlHighlightRules); - -var Mode = function() { - HtmlMode.call(this); - this.HighlightRules = DjangoHtmlHighlightRules; -}; -oop.inherits(Mode, HtmlMode); - -exports.Mode = Mode; -}); - -define('ace/mode/html', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/javascript', 'ace/mode/css', 'ace/tokenizer', 'ace/mode/html_highlight_rules', 'ace/mode/behaviour/html', 'ace/mode/folding/html', 'ace/mode/html_completions'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var JavaScriptMode = require("./javascript").Mode; -var CssMode = require("./css").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; -var HtmlBehaviour = require("./behaviour/html").HtmlBehaviour; -var HtmlFoldMode = require("./folding/html").FoldMode; -var HtmlCompletions = require("./html_completions").HtmlCompletions; - -var Mode = function() { - this.HighlightRules = HtmlHighlightRules; - this.$behaviour = new HtmlBehaviour(); - this.$completer = new HtmlCompletions(); - - this.createModeDelegates({ - "js-": JavaScriptMode, - "css-": CssMode - }); - - this.foldingRules = new HtmlFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.blockComment = {start: ""}; - - this.getNextLineIndent = function(state, line, tab) { - return this.$getIndent(line); - }; - - this.checkOutdent = function(state, line, input) { - return false; - }; - - this.getCompletions = function(state, session, pos, prefix) { - return this.$completer.getCompletions(state, session, pos, prefix); - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/javascript', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/javascript_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/worker/worker_client', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var Range = require("../range").Range; -var WorkerClient = require("../worker/worker_client").WorkerClient; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = JavaScriptHighlightRules; - - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().getLineTokens(line, state); - var tokens = tokenizedLine.tokens; - var endState = tokenizedLine.state; - - if (tokens.length && tokens[tokens.length-1].type == "comment") { - return indent; - } - - if (state == "start" || state == "no_regex") { - var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/); - if (match) { - indent += tab; - } - } else if (state == "doc-start") { - if (endState == "start" || endState == "no_regex") { - return ""; - } - var match = line.match(/^\s*(\/?)\*/); - if (match) { - if (match[1]) { - indent += " "; - } - indent += "* "; - } - } - - 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); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker"); - worker.attachToDocument(session.getDocument()); - - worker.on("jslint", function(results) { - session.setAnnotations(results.data); - }); - - worker.on("terminate", function() { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var JavaScriptHighlightRules = function() { - var keywordMapper = this.createKeywordMapper({ - "variable.language": - "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors - "Namespace|QName|XML|XMLList|" + // E4X - "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + - "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + - "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors - "SyntaxError|TypeError|URIError|" + - "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions - "isNaN|parseFloat|parseInt|" + - "JSON|Math|" + // Other - "this|arguments|prototype|window|document" , // Pseudo - "keyword": - "const|yield|import|get|set|" + - "break|case|catch|continue|default|delete|do|else|finally|for|function|" + - "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + - "__parent__|__count__|escape|unescape|with|__proto__|" + - "class|enum|extends|super|export|implements|private|public|interface|package|protected|static", - "storage.type": - "const|let|var|function", - "constant.language": - "null|Infinity|NaN|undefined", - "support.function": - "alert", - "constant.language.boolean": "true|false" - }, "identifier"); - var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; - var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\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 - ".)"; - - this.$rules = { - "no_regex" : [ - { - token : "comment", - regex : "\\/\\/", - next : "line_comment" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : /\/\*/, - next : "comment" - }, { - token : "string", - regex : "'(?=.)", - next : "qstring" - }, { - token : "string", - regex : '"(?=.)', - next : "qqstring" - }, { - token : "constant.numeric", // hex - regex : /0[xX][0-9a-fA-F]+\b/ - }, { - token : "constant.numeric", // float - regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/ - }, { - token : [ - "storage.type", "punctuation.operator", "support.function", - "punctuation.operator", "entity.name.function", "text","keyword.operator" - ], - regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "keyword.operator", "text", "storage.type", - "text", "paren.lparen" - ], - regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "punctuation.operator", - "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "text", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : "keyword", - regex : "(?:" + kwBeforeRe + ")\\b", - next : "start" - }, { - token : ["punctuation.operator", "support.function"], - regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/ - }, { - token : ["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 : keywordMapper, - regex : identifierRe - }, { - token : "keyword.operator", - regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/, - next : "start" - }, { - token : "punctuation.operator", - regex : /\?|\:|\,|\;|\./, - next : "start" - }, { - token : "paren.lparen", - regex : /[\[({]/, - next : "start" - }, { - token : "paren.rparen", - regex : /[\])}]/ - }, { - token : "keyword.operator", - regex : /\/=?/, - next : "start" - }, { - token: "comment", - regex: /^#!.*$/ - } - ], - "start": [ - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment_regex_allowed" - }, { - token : "comment", - regex : "\\/\\/", - next : "line_comment_regex_allowed" - }, { - token: "string.regexp", - regex: "\\/", - next: "regex" - }, { - token : "text", - regex : "\\s+|^$", - next : "start" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "regex": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "string.regexp", - regex: "/\\w*", - next: "no_regex" - }, { - token : "invalid", - regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ - }, { - token : "constant.language.escape", - regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/ - }, { - token : "constant.language.delimiter", - regex: /\|/ - }, { - token: "constant.language.escape", - regex: /\[\^?/, - next: "regex_character_class" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp" - } - ], - "regex_character_class": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "constant.language.escape", - regex: "]", - next: "regex" - }, { - token: "constant.language.escape", - regex: "-" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp.charachterclass" - } - ], - "function_arguments": [ - { - token: "variable.parameter", - regex: identifierRe - }, { - token: "punctuation.operator", - regex: "[, ]+" - }, { - token: "punctuation.operator", - regex: "$" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "comment_regex_allowed" : [ - {token : "comment", regex : "\\*\\/", next : "start"}, - {defaultToken : "comment"} - ], - "comment" : [ - {token : "comment", regex : "\\*\\/", next : "no_regex"}, - {defaultToken : "comment"} - ], - "line_comment_regex_allowed" : [ - {token : "comment", regex : "$|^", next : "start"}, - {defaultToken : "comment"} - ], - "line_comment" : [ - {token : "comment", regex : "$|^", next : "no_regex"}, - {defaultToken : "comment"} - ], - "qqstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qqstring" - }, { - token : "string", - regex : '"|$', - next : "no_regex" - }, { - defaultToken: "string" - } - ], - "qstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qstring" - }, { - token : "string", - regex : "'|$", - next : "no_regex" - }, { - defaultToken: "string" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("no_regex") ]); -}; - -oop.inherits(JavaScriptHighlightRules, TextHighlightRules); - -exports.JavaScriptHighlightRules = JavaScriptHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); - -define('ace/mode/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/css_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/worker/worker_client', 'ace/mode/behaviour/css', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var WorkerClient = require("../worker/worker_client").WorkerClient; -var CssBehaviour = require("./behaviour/css").CssBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = CssHighlightRules; - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CssBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.foldingRules = "cStyle"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - var tokens = this.getTokenizer().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); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker"); - worker.attachToDocument(session.getDocument()); - - worker.on("csslint", function(e) { - session.setAnnotations(e.data); - }); - - worker.on("terminate", function() { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; - -}); - -define('ace/mode/css_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var supportType = exports.supportType = "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"; -var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters"; -var supportConstant = exports.supportConstant = "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|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|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero"; -var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow"; -var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace"; - -var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))"; -var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b"; -var pseudoClasses = exports.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 CssHighlightRules = function() { - - var keywordMapper = this.createKeywordMapper({ - "support.function": supportFunction, - "support.constant": supportConstant, - "support.type": supportType, - "support.constant.color": supportConstantColor, - "support.constant.fonts": supportConstantFonts - }, "text", true); - - this.$rules = { - "start" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "@.*?{", - push: "media" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "media" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "\\}", - next: "pop" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "comment" : [{ - token : "comment", - regex : "\\*\\/", - next : "pop" - }, { - defaultToken : "comment" - }], - - "ruleset" : [ - { - token : "paren.rparen", - regex : "\\}", - next: "pop" - }, { - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - 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 : numRe - }, { - 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 : ["support.function", "string", "support.function"], - regex : "(url\\()(.*)(\\))" - }, { - token : keywordMapper, - regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*" - }, { - caseInsensitive: true - }] - }; - - this.normalizeRules(); -}; - -oop.inherits(CssHighlightRules, TextHighlightRules); - -exports.CssHighlightRules = CssHighlightRules; - -}); - -define('ace/mode/behaviour/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; - -var CssBehaviour = function () { - - this.inherit(CstyleBehaviour); - - this.add("colon", "insertion", function (state, action, editor, session, text) { - if (text === ':') { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - var token = iterator.getCurrentToken(); - if (token && token.value.match(/\s+/)) { - token = iterator.stepBackward(); - } - if (token && token.type === 'support.type') { - var line = session.doc.getLine(cursor.row); - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar === ':') { - return { - text: '', - selection: [1, 1] - } - } - if (!line.substring(cursor.column).match(/^\s*;/)) { - return { - text: ':;', - selection: [1, 1] - } - } - } - } - }); - - this.add("colon", "deletion", function (state, action, editor, session, range) { - var selected = session.doc.getTextRange(range); - if (!range.isMultiLine() && selected === ':') { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - var token = iterator.getCurrentToken(); - if (token && token.value.match(/\s+/)) { - token = iterator.stepBackward(); - } - if (token && token.type === 'support.type') { - 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("semicolon", "insertion", function (state, action, editor, session, text) { - if (text === ';') { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar === ';') { - return { - text: '', - selection: [1, 1] - } - } - } - }); - -} -oop.inherits(CssBehaviour, CstyleBehaviour); - -exports.CssBehaviour = CssBehaviour; -}); - -define('ace/mode/html_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/css_highlight_rules', 'ace/mode/javascript_highlight_rules', 'ace/mode/xml_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; - -var tagMap = lang.createMap({ - a : 'anchor', - button : 'form', - form : 'form', - img : 'image', - input : 'form', - label : 'form', - option : 'form', - script : 'script', - select : 'form', - textarea : 'form', - style : 'style', - table : 'table', - tbody : 'table', - td : 'table', - tfoot : 'table', - th : 'table', - tr : 'table' -}); - -var HtmlHighlightRules = function() { - XmlHighlightRules.call(this); - - this.addRules({ - attributes: [{ - include : "space" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "keyword.operator.separator", - regex : "=", - push : [{ - include: "space" - }, { - token : "string", - regex : "[^<>='\"`\\s]+", - next : "pop" - }, { - token : "empty", - regex : "", - next : "pop" - }] - }, { - include : "string" - }], - tag: [{ - token : function(start, tag) { - var group = tagMap[tag]; - return ["meta.tag.punctuation.begin", - "meta.tag.name" + (group ? "." + group : "")]; - }, - regex : "(<)([-_a-zA-Z0-9:]+)", - next: "start_tag_stuff" - }, { - token : function(start, tag) { - var group = tagMap[tag]; - return ["meta.tag.punctuation.begin", - "meta.tag.name" + (group ? "." + group : "")]; - }, - regex : "(", next : "start"} - ], - end_tag_stuff: [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next : "start"} - ] - }); - - this.embedTagRules(CssHighlightRules, "css-", "style"); - this.embedTagRules(JavaScriptHighlightRules, "js-", "script"); - - if (this.constructor === HtmlHighlightRules) - this.normalizeRules(); -}; - -oop.inherits(HtmlHighlightRules, XmlHighlightRules); - -exports.HtmlHighlightRules = HtmlHighlightRules; -}); - -define('ace/mode/xml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml_util', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var xmlUtil = require("./xml_util"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var XmlHighlightRules = function(normalize) { - this.$rules = { - start : [ - {token : "punctuation.string.begin", regex : "<\\!\\[CDATA\\[", next : "cdata"}, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)(xml)(?=[\\s])", next : "xml_declaration" - }, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)([-_a-zA-Z0-9]+)", next : "instruction" - }, - {token : "comment", regex : "<\\!--", next : "comment"}, - { - token : ["punctuation.doctype.begin", "meta.tag.doctype"], - regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype" - }, - {include : "tag"}, - {include : "reference"} - ], - - xml_declaration : [ - {include : "attributes"}, - {include : "instruction"} - ], - - instruction : [ - {token : "punctuation.instruction.end", regex : "\\?>", next : "start"} - ], - - doctype : [ - {include : "space"}, - {include : "string"}, - {token : "punctuation.doctype.end", regex : ">", next : "start"}, - {token : "xml-pe", regex : "[-_a-zA-Z0-9:]+"}, - {token : "punctuation.begin", regex : "\\[", push : "declarations"} - ], - - declarations : [{ - token : "text", - regex : "\\s+" - }, { - token: "punctuation.end", - regex: "]", - next: "pop" - }, { - token : ["punctuation.begin", "keyword"], - regex : "(<\\!)([-_a-zA-Z0-9]+)", - push : [{ - token : "text", - regex : "\\s+" - }, - { - token : "punctuation.end", - regex : ">", - next : "pop" - }, - {include : "string"}] - }], - - cdata : [ - {token : "string.end", regex : "\\]\\]>", next : "start"}, - {token : "text", regex : "\\s+"}, - {token : "text", regex : "(?:[^\\]]|\\](?!\\]>))+"} - ], - - comment : [ - {token : "comment", regex : "-->", next : "start"}, - {defaultToken : "comment"} - ], - - tag : [{ - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(<)((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)", - next: [ - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : "start"} - ] - }, { - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(", next : "start"} - ] - }], - - space : [ - {token : "text", regex : "\\s+"} - ], - - reference : [{ - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, { - token : "invalid.illegal", regex : "&" - }], - - string: [{ - token : "string", - regex : "'", - push : "qstring_inner" - }, { - token : "string", - regex : '"', - push : "qqstring_inner" - }], - - qstring_inner: [ - {token : "string", regex: "'", next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - qqstring_inner: [ - {token : "string", regex: '"', next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - attributes: [{ - token : "entity.other.attribute-name", - regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+" - }, { - token : "keyword.operator.separator", - regex : "=" - }, { - include : "space" - }, { - include : "string" - }] - }; - - if (this.constructor === XmlHighlightRules) - this.normalizeRules(); -}; - - -(function() { - - this.embedTagRules = function(HighlightRules, prefix, tag){ - this.$rules.tag.unshift({ - token : ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(<)(" + tag + ")", - next: [ - {include : "space"}, - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : prefix + "start"} - ] - }); - - this.$rules[tag + "-end"] = [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next: "start", - onMatch : function(value, currentState, stack) { - stack.splice(0); - return this.token; - }} - ] - - this.embedRules(HighlightRules, prefix, [{ - token: ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(" - }]); - }; - -}).call(TextHighlightRules.prototype); - -oop.inherits(XmlHighlightRules, TextHighlightRules); - -exports.XmlHighlightRules = XmlHighlightRules; -}); - -define('ace/mode/xml_util', ['require', 'exports', 'module' ], function(require, exports, module) { - - -function string(state) { - return [{ - token : "string", - regex : '"', - next : state + "_qqstring" - }, { - token : "string", - regex : "'", - next : state + "_qstring" - }]; -} - -function multiLineString(quote, state) { - return [ - {token : "string", regex : quote, next : state}, - { - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, - {defaultToken : "string"} - ]; -} - -exports.tag = function(states, name, nextState, tagMap) { - states[name] = [{ - token : "text", - regex : "\\s+" - }, { - - token : !tagMap ? "meta.tag.tag-name" : function(value) { - if (tagMap[value]) - return "meta.tag.tag-name." + tagMap[value]; - else - return "meta.tag.tag-name"; - }, - regex : "[-_a-zA-Z0-9:]+", - next : name + "_embed_attribute_list" - }, { - token: "empty", - regex: "", - next : 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"] = [{ - token : "meta.tag.r", - regex : "/?>", - next : nextState - }, { - token : "keyword.operator", - regex : "=" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "text", - regex : "\\s+" - }].concat(string(name)); -}; - -}); - -define('ace/mode/behaviour/html', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour/xml', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var XmlBehaviour = require("../behaviour/xml").XmlBehaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var voidElements = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']; - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); - return hasType; -} - -var HtmlBehaviour = function () { - - this.inherit(XmlBehaviour); // Get xml behaviour - - this.add("autoclosing", "insertion", function (state, action, editor, session, text) { - if (text == '>') { - var position = editor.getCursorPosition(); - var iterator = new TokenIterator(session, position.row, position.column); - var token = iterator.getCurrentToken(); - - if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column) - return; - var atCursor = false; - if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text'))); - } else { - atCursor = true; - } - if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) { - return; - } - var element = token.value; - if (atCursor){ - var element = element.substring(0, position.column - token.start); - } - if (voidElements.indexOf(element) !== -1){ - return; - } - return { - text: '>' + '', - selection: [1, 1] - } - } - }); -} -oop.inherits(HtmlBehaviour, XmlBehaviour); - -exports.HtmlBehaviour = HtmlBehaviour; -}); - -define('ace/mode/behaviour/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); - return hasType; -} - -var XmlBehaviour = function () { - - this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour - - this.add("autoclosing", "insertion", function (state, action, editor, session, text) { - if (text == '>') { - var position = editor.getCursorPosition(); - var iterator = new TokenIterator(session, position.row, position.column); - var token = iterator.getCurrentToken(); - - if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column) - return; - var atCursor = false; - if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text'))); - } else { - atCursor = true; - } - if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) { - return; - } - var tag = token.value; - if (atCursor){ - var tag = tag.substring(0, position.column - token.start); - } - - return { - text: '>' + '', - selection: [1, 1] - } - } - }); - - this.add('autoindent', 'insertion', function (state, action, editor, session, text) { - if (text == "\n") { - var cursor = editor.getCursorPosition(); - var line = session.getLine(cursor.row); - var rightChars = line.substring(cursor.column, cursor.column + 2); - if (rightChars == '?)/; - this._parseTag = function(tag) { - - var match = tag.match(this.tagRe); - var column = 0; - - return { - value: tag, - match: match ? match[2] : "", - closing: match ? !!match[3] : false, - selfClosing: match ? !!match[5] || match[2] == "/>" : false, - tagName: match ? match[4] : "", - column: match[1] ? column + match[1].length : column - }; - }; - this._readTagForward = function(iterator) { - var token = iterator.getCurrentToken(); - if (!token) - return null; - - var value = ""; - var start; - - do { - if (token.type.lastIndexOf("meta.tag", 0) === 0) { - if (!start) { - var start = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() - }; - } - value += token.value; - if (value.indexOf(">") !== -1) { - var tag = this._parseTag(value); - tag.start = start; - tag.end = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() + token.value.length - }; - iterator.stepForward(); - return tag; - } - } - } while(token = iterator.stepForward()); - - return null; - }; - - this._readTagBackward = function(iterator) { - var token = iterator.getCurrentToken(); - if (!token) - return null; - - var value = ""; - var end; - - do { - if (token.type.lastIndexOf("meta.tag", 0) === 0) { - if (!end) { - end = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() + token.value.length - }; - } - value = token.value + value; - if (value.indexOf("<") !== -1) { - var tag = this._parseTag(value); - tag.end = end; - tag.start = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() - }; - iterator.stepBackward(); - return tag; - } - } - } while(token = iterator.stepBackward()); - - return null; - }; - - this._pop = function(stack, tag) { - while (stack.length) { - - var top = stack[stack.length-1]; - if (!tag || top.tagName == tag.tagName) { - return stack.pop(); - } - else if (this.voidElements[tag.tagName]) { - return; - } - else if (this.voidElements[top.tagName]) { - stack.pop(); - continue; - } else { - return null; - } - } - }; - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var firstTag = this._getFirstTagInLine(session, row); - - if (!firstTag.match) - return null; - - var isBackward = firstTag.closing || firstTag.selfClosing; - var stack = []; - var tag; - - if (!isBackward) { - var iterator = new TokenIterator(session, row, firstTag.column); - var start = { - row: row, - column: firstTag.column + firstTag.tagName.length + 2 - }; - while (tag = this._readTagForward(iterator)) { - if (tag.selfClosing) { - if (!stack.length) { - tag.start.column += tag.tagName.length + 2; - tag.end.column -= 2; - return Range.fromPoints(tag.start, tag.end); - } else - continue; - } - - if (tag.closing) { - this._pop(stack, tag); - if (stack.length == 0) - return Range.fromPoints(start, tag.start); - } - else { - stack.push(tag) - } - } - } - else { - var iterator = new TokenIterator(session, row, firstTag.column + firstTag.match.length); - var end = { - row: row, - column: firstTag.column - }; - - while (tag = this._readTagBackward(iterator)) { - if (tag.selfClosing) { - if (!stack.length) { - tag.start.column += tag.tagName.length + 2; - tag.end.column -= 2; - return Range.fromPoints(tag.start, tag.end); - } else - continue; - } - - if (!tag.closing) { - this._pop(stack, tag); - if (stack.length == 0) { - tag.start.column += tag.tagName.length + 2; - return Range.fromPoints(tag.start, end); - } - } - else { - stack.push(tag) - } - } - } - - }; - -}).call(FoldMode.prototype); - -}); - -define('ace/mode/html_completions', ['require', 'exports', 'module' , 'ace/token_iterator'], function(require, exports, module) { - - -var TokenIterator = require("../token_iterator").TokenIterator; - -var commonAttributes = [ - "accesskey", - "class", - "contenteditable", - "contextmenu", - "dir", - "draggable", - "dropzone", - "hidden", - "id", - "lang", - "spellcheck", - "style", - "tabindex", - "title", - "translate" -]; - -var eventAttributes = [ - "onabort", - "onblur", - "oncancel", - "oncanplay", - "oncanplaythrough", - "onchange", - "onclick", - "onclose", - "oncontextmenu", - "oncuechange", - "ondblclick", - "ondrag", - "ondragend", - "ondragenter", - "ondragleave", - "ondragover", - "ondragstart", - "ondrop", - "ondurationchange", - "onemptied", - "onended", - "onerror", - "onfocus", - "oninput", - "oninvalid", - "onkeydown", - "onkeypress", - "onkeyup", - "onload", - "onloadeddata", - "onloadedmetadata", - "onloadstart", - "onmousedown", - "onmousemove", - "onmouseout", - "onmouseover", - "onmouseup", - "onmousewheel", - "onpause", - "onplay", - "onplaying", - "onprogress", - "onratechange", - "onreset", - "onscroll", - "onseeked", - "onseeking", - "onselect", - "onshow", - "onstalled", - "onsubmit", - "onsuspend", - "ontimeupdate", - "onvolumechange", - "onwaiting" -]; - -var globalAttributes = commonAttributes.concat(eventAttributes); - -var attributeMap = { - "html": ["manifest"], - "head": [], - "title": [], - "base": ["href", "target"], - "link": ["href", "hreflang", "rel", "media", "type", "sizes"], - "meta": ["http-equiv", "name", "content", "charset"], - "style": ["type", "media", "scoped"], - "script": ["charset", "type", "src", "defer", "async"], - "noscript": ["href"], - "body": ["onafterprint", "onbeforeprint", "onbeforeunload", "onhashchange", "onmessage", "onoffline", "onpopstate", "onredo", "onresize", "onstorage", "onundo", "onunload"], - "section": [], - "nav": [], - "article": ["pubdate"], - "aside": [], - "h1": [], - "h2": [], - "h3": [], - "h4": [], - "h5": [], - "h6": [], - "header": [], - "footer": [], - "address": [], - "main": [], - "p": [], - "hr": [], - "pre": [], - "blockquote": ["cite"], - "ol": ["start", "reversed"], - "ul": [], - "li": ["value"], - "dl": [], - "dt": [], - "dd": [], - "figure": [], - "figcaption": [], - "div": [], - "a": ["href", "target", "ping", "rel", "media", "hreflang", "type"], - "em": [], - "strong": [], - "small": [], - "s": [], - "cite": [], - "q": ["cite"], - "dfn": [], - "abbr": [], - "data": [], - "time": ["datetime"], - "code": [], - "var": [], - "samp": [], - "kbd": [], - "sub": [], - "sup": [], - "i": [], - "b": [], - "u": [], - "mark": [], - "ruby": [], - "rt": [], - "rp": [], - "bdi": [], - "bdo": [], - "span": [], - "br": [], - "wbr": [], - "ins": ["cite", "datetime"], - "del": ["cite", "datetime"], - "img": ["alt", "src", "height", "width", "usemap", "ismap"], - "iframe": ["name", "src", "height", "width", "sandbox", "seamless"], - "embed": ["src", "height", "width", "type"], - "object": ["param", "data", "type", "height" , "width", "usemap", "name", "form", "classid"], - "param": ["name", "value"], - "video": ["src", "autobuffer", "autoplay", "loop", "controls", "width", "height", "poster"], - "audio": ["src", "autobuffer", "autoplay", "loop", "controls"], - "source": ["src", "type", "media"], - "track": ["kind", "src", "srclang", "label", "default"], - "canvas": ["width", "height"], - "map": ["name"], - "area": ["shape", "coords", "href", "hreflang", "alt", "target", "media", "rel", "ping", "type"], - "svg": [], - "math": [], - "table": ["summary"], - "caption": [], - "colgroup": ["span"], - "col": ["span"], - "tbody": [], - "thead": [], - "tfoot": [], - "tr": [], - "td": ["headers", "rowspan", "colspan"], - "th": ["headers", "rowspan", "colspan", "scope"], - "form": ["accept-charset", "action", "autocomplete", "enctype", "method", "name", "novalidate", "target"], - "fieldset": ["disabled", "form", "name"], - "legend": [], - "label": ["form", "for"], - "input": ["type", "accept", "alt", "autocomplete", "checked", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "height", "list", "max", "maxlength", "min", "multiple", "pattern", "placeholder", "readonly", "required", "size", "src", "step", "width", "files", "value"], - "button": ["autofocus", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "name", "value", "type"], - "select": ["autofocus", "disabled", "form", "multiple", "name", "size"], - "datalist": [], - "optgroup": ["disabled", "label"], - "option": ["disabled", "selected", "label", "value"], - "textarea": ["autofocus", "disabled", "form", "maxlength", "name", "placeholder", "readonly", "required", "rows", "cols", "wrap"], - "keygen": ["autofocus", "challenge", "disabled", "form", "keytype", "name"], - "output": ["for", "form", "name"], - "progress": ["value", "max"], - "meter": ["value", "min", "max", "low", "high", "optimum"], - "details": ["open"], - "summary": [], - "command": ["type", "label", "icon", "disabled", "checked", "radiogroup", "command"], - "menu": ["type", "label"], - "dialog": ["open"] -}; - -var allElements = Object.keys(attributeMap); - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); -} - -function findTagName(session, pos) { - var iterator = new TokenIterator(session, pos.row, pos.column); - var token = iterator.getCurrentToken(); - if (!token || !hasType(token, 'tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'operator') || hasType(token, 'attribute-name') || hasType(token, 'text'))); - } - if (token && hasType(token, 'tag-name') && !iterator.stepBackward().value.match('/')) - return token.value; -} - -var HtmlCompletions = function() { - -}; - -(function() { - - this.getCompletions = function(state, session, pos, prefix) { - var token = session.getTokenAt(pos.row, pos.column); - - if (!token) - return []; - if (hasType(token, "tag-name") || (token.value == '<' && hasType(token, "text"))) - return this.getTagCompletions(state, session, pos, prefix); - if (hasType(token, 'text') || hasType(token, 'attribute-name')) - return this.getAttributeCompetions(state, session, pos, prefix); - - return []; - }; - - this.getTagCompletions = function(state, session, pos, prefix) { - var elements = allElements; - if (prefix) { - elements = elements.filter(function(element){ - return element.indexOf(prefix) === 0; - }); - } - return elements.map(function(element){ - return { - value: element, - meta: "tag" - }; - }); - }; - - this.getAttributeCompetions = function(state, session, pos, prefix) { - var tagName = findTagName(session, pos); - if (!tagName) - return []; - var attributes = globalAttributes; - if (tagName in attributeMap) { - attributes = attributes.concat(attributeMap[tagName]); - } - if (prefix) { - attributes = attributes.filter(function(attribute){ - return attribute.indexOf(prefix) === 0; - }); - } - return attributes.map(function(attribute){ - return { - caption: attribute, - snippet: attribute + '="$0"', - meta: "attribute" - }; - }); - }; - -}).call(HtmlCompletions.prototype); - -exports.HtmlCompletions = HtmlCompletions; -}); diff --git a/addons/editor/ace/mode-dot.js b/addons/editor/ace/mode-dot.js deleted file mode 100644 index c66d077d..00000000 --- a/addons/editor/ace/mode-dot.js +++ /dev/null @@ -1,319 +0,0 @@ -define('ace/mode/dot', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/matching_brace_outdent', 'ace/mode/dot_highlight_rules', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var DotHighlightRules = require("./dot_highlight_rules").DotHighlightRules; -var DotFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = DotHighlightRules; - this.$outdent = new MatchingBraceOutdent(); - this.foldingRules = new DotFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = ["//", "#"]; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().getLineTokens(line, state); - var tokens = tokenizedLine.tokens; - var endState = tokenizedLine.state; - - if (tokens.length && tokens[tokens.length-1].type == "comment") { - return indent; - } - - if (state == "start") { - var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\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; -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); -define('ace/mode/dot_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules', 'ace/mode/doc_comment_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; - -var DotHighlightRules = function() { - - var keywords = lang.arrayToMap( - ("strict|node|edge|graph|digraph|subgraph").split("|") - ); - - var attributes = lang.arrayToMap( - ("damping|k|url|area|arrowhead|arrowsize|arrowtail|aspect|bb|bgcolor|center|charset|clusterrank|color|colorscheme|comment|compound|concentrate|constraint|decorate|defaultdist|dim|dimen|dir|diredgeconstraints|distortion|dpi|edgeurl|edgehref|edgetarget|edgetooltip|epsilon|esep|fillcolor|fixedsize|fontcolor|fontname|fontnames|fontpath|fontsize|forcelabels|gradientangle|group|headurl|head_lp|headclip|headhref|headlabel|headport|headtarget|headtooltip|height|href|id|image|imagepath|imagescale|label|labelurl|label_scheme|labelangle|labeldistance|labelfloat|labelfontcolor|labelfontname|labelfontsize|labelhref|labeljust|labelloc|labeltarget|labeltooltip|landscape|layer|layerlistsep|layers|layerselect|layersep|layout|len|levels|levelsgap|lhead|lheight|lp|ltail|lwidth|margin|maxiter|mclimit|mindist|minlen|mode|model|mosek|nodesep|nojustify|normalize|nslimit|nslimit1|ordering|orientation|outputorder|overlap|overlap_scaling|pack|packmode|pad|page|pagedir|pencolor|penwidth|peripheries|pin|pos|quadtree|quantum|rank|rankdir|ranksep|ratio|rects|regular|remincross|repulsiveforce|resolution|root|rotate|rotation|samehead|sametail|samplepoints|scale|searchsize|sep|shape|shapefile|showboxes|sides|size|skew|smoothing|sortv|splines|start|style|stylesheet|tailurl|tail_lp|tailclip|tailhref|taillabel|tailport|tailtarget|tailtooltip|target|tooltip|truecolor|vertices|viewport|voro_margin|weight|width|xlabel|xlp|z").split("|") - ); - - this.$rules = { - "start" : [ - { - token : "comment", - regex : /\/\/.*$/ - }, { - token : "comment", - regex : /#.*$/ - }, { - token : "comment", // multi line comment - merge : true, - regex : /\/\*/, - next : "comment" - }, { - token : "string", - regex : "'(?=.)", - next : "qstring" - }, { - token : "string", - regex : '"(?=.)', - next : "qqstring" - }, { - token : "constant.numeric", - regex : /[+\-]?\d+(?:(?:\.\d*)?(?:[eE][+\-]?\d+)?)?\b/ - }, { - token : "keyword.operator", - regex : /\+|=|\->/ - }, { - token : "punctuation.operator", - regex : /,|;/ - }, { - token : "paren.lparen", - regex : /[\[{]/ - }, { - token : "paren.rparen", - regex : /[\]}]/ - }, { - token: "comment", - regex: /^#!.*$/ - }, { - token: function(value) { - if (keywords.hasOwnProperty(value.toLowerCase())) { - return "keyword"; - } - else if (attributes.hasOwnProperty(value.toLowerCase())) { - return "variable"; - } - else { - return "text"; - } - }, - regex: "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*" - } - ], - "comment" : [ - { - token : "comment", // closing comment - regex : ".*?\\*\\/", - merge : true, - next : "start" - }, { - token : "comment", // comment spanning whole line - merge : true, - regex : ".+" - } - ], - "qqstring" : [ - { - token : "string", - regex : '[^"\\\\]+', - merge : true - }, { - token : "string", - regex : "\\\\$", - next : "qqstring", - merge : true - }, { - token : "string", - regex : '"|$', - next : "start", - merge : true - } - ], - "qstring" : [ - { - token : "string", - regex : "[^'\\\\]+", - merge : true - }, { - token : "string", - regex : "\\\\$", - next : "qstring", - merge : true - }, { - token : "string", - regex : "'|$", - next : "start", - merge : true - } - ] - }; -}; - -oop.inherits(DotHighlightRules, TextHighlightRules); - -exports.DotHighlightRules = DotHighlightRules; - -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); diff --git a/addons/editor/ace/mode-ejs.js b/addons/editor/ace/mode-ejs.js deleted file mode 100644 index 5473e80a..00000000 --- a/addons/editor/ace/mode-ejs.js +++ /dev/null @@ -1,2754 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2012, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ - - -define('ace/mode/ejs', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/html_highlight_rules', 'ace/mode/javascript_highlight_rules', 'ace/tokenizer', 'ace/mode/html', 'ace/mode/javascript', 'ace/mode/css', 'ace/mode/ruby'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; - -var EjsHighlightRules = function(start, end) { - HtmlHighlightRules.call(this); - - if (!start) - start = "(?:<%|<\\?|{{)"; - if (!end) - end = "(?:%>|\\?>|}})"; - - for (var i in this.$rules) { - this.$rules[i].unshift({ - token : "markup.list.meta.tag", - regex : start + "(?![>}])[-=]?", - push : "ejs-start" - }); - } - - this.embedRules(JavaScriptHighlightRules, "ejs-"); - - this.$rules["ejs-start"].unshift({ - token : "markup.list.meta.tag", - regex : "-?" + end, - next : "pop" - }, { - token: "comment", - regex: "//.*?" + end, - next: "pop" - }); - - this.$rules["ejs-no_regex"].unshift({ - token : "markup.list.meta.tag", - regex : "-?" + end, - next : "pop" - }, { - token: "comment", - regex: "//.*?" + end, - next: "pop" - }); - - this.normalizeRules(); -}; - - -oop.inherits(EjsHighlightRules, HtmlHighlightRules); - -exports.EjsHighlightRules = EjsHighlightRules; - - -var oop = require("../lib/oop"); -var Tokenizer = require("../tokenizer").Tokenizer; -var HtmlMode = require("./html").Mode; -var JavaScriptMode = require("./javascript").Mode; -var CssMode = require("./css").Mode; -var RubyMode = require("./ruby").Mode; - -var Mode = function() { - HtmlMode.call(this); - this.HighlightRules = EjsHighlightRules; - this.createModeDelegates({ - "js-": JavaScriptMode, - "css-": CssMode, - "ejs-": JavaScriptMode - }); -}; -oop.inherits(Mode, HtmlMode); - -(function() { - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/html_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/css_highlight_rules', 'ace/mode/javascript_highlight_rules', 'ace/mode/xml_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; - -var tagMap = lang.createMap({ - a : 'anchor', - button : 'form', - form : 'form', - img : 'image', - input : 'form', - label : 'form', - option : 'form', - script : 'script', - select : 'form', - textarea : 'form', - style : 'style', - table : 'table', - tbody : 'table', - td : 'table', - tfoot : 'table', - th : 'table', - tr : 'table' -}); - -var HtmlHighlightRules = function() { - XmlHighlightRules.call(this); - - this.addRules({ - attributes: [{ - include : "space" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "keyword.operator.separator", - regex : "=", - push : [{ - include: "space" - }, { - token : "string", - regex : "[^<>='\"`\\s]+", - next : "pop" - }, { - token : "empty", - regex : "", - next : "pop" - }] - }, { - include : "string" - }], - tag: [{ - token : function(start, tag) { - var group = tagMap[tag]; - return ["meta.tag.punctuation.begin", - "meta.tag.name" + (group ? "." + group : "")]; - }, - regex : "(<)([-_a-zA-Z0-9:]+)", - next: "start_tag_stuff" - }, { - token : function(start, tag) { - var group = tagMap[tag]; - return ["meta.tag.punctuation.begin", - "meta.tag.name" + (group ? "." + group : "")]; - }, - regex : "(", next : "start"} - ], - end_tag_stuff: [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next : "start"} - ] - }); - - this.embedTagRules(CssHighlightRules, "css-", "style"); - this.embedTagRules(JavaScriptHighlightRules, "js-", "script"); - - if (this.constructor === HtmlHighlightRules) - this.normalizeRules(); -}; - -oop.inherits(HtmlHighlightRules, XmlHighlightRules); - -exports.HtmlHighlightRules = HtmlHighlightRules; -}); - -define('ace/mode/css_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var supportType = exports.supportType = "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"; -var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters"; -var supportConstant = exports.supportConstant = "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|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|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero"; -var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow"; -var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace"; - -var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))"; -var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b"; -var pseudoClasses = exports.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 CssHighlightRules = function() { - - var keywordMapper = this.createKeywordMapper({ - "support.function": supportFunction, - "support.constant": supportConstant, - "support.type": supportType, - "support.constant.color": supportConstantColor, - "support.constant.fonts": supportConstantFonts - }, "text", true); - - this.$rules = { - "start" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "@.*?{", - push: "media" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "media" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "\\}", - next: "pop" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "comment" : [{ - token : "comment", - regex : "\\*\\/", - next : "pop" - }, { - defaultToken : "comment" - }], - - "ruleset" : [ - { - token : "paren.rparen", - regex : "\\}", - next: "pop" - }, { - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - 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 : numRe - }, { - 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 : ["support.function", "string", "support.function"], - regex : "(url\\()(.*)(\\))" - }, { - token : keywordMapper, - regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*" - }, { - caseInsensitive: true - }] - }; - - this.normalizeRules(); -}; - -oop.inherits(CssHighlightRules, TextHighlightRules); - -exports.CssHighlightRules = CssHighlightRules; - -}); - -define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var JavaScriptHighlightRules = function() { - var keywordMapper = this.createKeywordMapper({ - "variable.language": - "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors - "Namespace|QName|XML|XMLList|" + // E4X - "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + - "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + - "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors - "SyntaxError|TypeError|URIError|" + - "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions - "isNaN|parseFloat|parseInt|" + - "JSON|Math|" + // Other - "this|arguments|prototype|window|document" , // Pseudo - "keyword": - "const|yield|import|get|set|" + - "break|case|catch|continue|default|delete|do|else|finally|for|function|" + - "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + - "__parent__|__count__|escape|unescape|with|__proto__|" + - "class|enum|extends|super|export|implements|private|public|interface|package|protected|static", - "storage.type": - "const|let|var|function", - "constant.language": - "null|Infinity|NaN|undefined", - "support.function": - "alert", - "constant.language.boolean": "true|false" - }, "identifier"); - var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; - var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\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 - ".)"; - - this.$rules = { - "no_regex" : [ - { - token : "comment", - regex : "\\/\\/", - next : "line_comment" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : /\/\*/, - next : "comment" - }, { - token : "string", - regex : "'(?=.)", - next : "qstring" - }, { - token : "string", - regex : '"(?=.)', - next : "qqstring" - }, { - token : "constant.numeric", // hex - regex : /0[xX][0-9a-fA-F]+\b/ - }, { - token : "constant.numeric", // float - regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/ - }, { - token : [ - "storage.type", "punctuation.operator", "support.function", - "punctuation.operator", "entity.name.function", "text","keyword.operator" - ], - regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "keyword.operator", "text", "storage.type", - "text", "paren.lparen" - ], - regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "punctuation.operator", - "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "text", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : "keyword", - regex : "(?:" + kwBeforeRe + ")\\b", - next : "start" - }, { - token : ["punctuation.operator", "support.function"], - regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/ - }, { - token : ["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 : keywordMapper, - regex : identifierRe - }, { - token : "keyword.operator", - regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/, - next : "start" - }, { - token : "punctuation.operator", - regex : /\?|\:|\,|\;|\./, - next : "start" - }, { - token : "paren.lparen", - regex : /[\[({]/, - next : "start" - }, { - token : "paren.rparen", - regex : /[\])}]/ - }, { - token : "keyword.operator", - regex : /\/=?/, - next : "start" - }, { - token: "comment", - regex: /^#!.*$/ - } - ], - "start": [ - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment_regex_allowed" - }, { - token : "comment", - regex : "\\/\\/", - next : "line_comment_regex_allowed" - }, { - token: "string.regexp", - regex: "\\/", - next: "regex" - }, { - token : "text", - regex : "\\s+|^$", - next : "start" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "regex": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "string.regexp", - regex: "/\\w*", - next: "no_regex" - }, { - token : "invalid", - regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ - }, { - token : "constant.language.escape", - regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/ - }, { - token : "constant.language.delimiter", - regex: /\|/ - }, { - token: "constant.language.escape", - regex: /\[\^?/, - next: "regex_character_class" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp" - } - ], - "regex_character_class": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "constant.language.escape", - regex: "]", - next: "regex" - }, { - token: "constant.language.escape", - regex: "-" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp.charachterclass" - } - ], - "function_arguments": [ - { - token: "variable.parameter", - regex: identifierRe - }, { - token: "punctuation.operator", - regex: "[, ]+" - }, { - token: "punctuation.operator", - regex: "$" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "comment_regex_allowed" : [ - {token : "comment", regex : "\\*\\/", next : "start"}, - {defaultToken : "comment"} - ], - "comment" : [ - {token : "comment", regex : "\\*\\/", next : "no_regex"}, - {defaultToken : "comment"} - ], - "line_comment_regex_allowed" : [ - {token : "comment", regex : "$|^", next : "start"}, - {defaultToken : "comment"} - ], - "line_comment" : [ - {token : "comment", regex : "$|^", next : "no_regex"}, - {defaultToken : "comment"} - ], - "qqstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qqstring" - }, { - token : "string", - regex : '"|$', - next : "no_regex" - }, { - defaultToken: "string" - } - ], - "qstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qstring" - }, { - token : "string", - regex : "'|$", - next : "no_regex" - }, { - defaultToken: "string" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("no_regex") ]); -}; - -oop.inherits(JavaScriptHighlightRules, TextHighlightRules); - -exports.JavaScriptHighlightRules = JavaScriptHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/xml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml_util', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var xmlUtil = require("./xml_util"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var XmlHighlightRules = function(normalize) { - this.$rules = { - start : [ - {token : "punctuation.string.begin", regex : "<\\!\\[CDATA\\[", next : "cdata"}, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)(xml)(?=[\\s])", next : "xml_declaration" - }, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)([-_a-zA-Z0-9]+)", next : "instruction" - }, - {token : "comment", regex : "<\\!--", next : "comment"}, - { - token : ["punctuation.doctype.begin", "meta.tag.doctype"], - regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype" - }, - {include : "tag"}, - {include : "reference"} - ], - - xml_declaration : [ - {include : "attributes"}, - {include : "instruction"} - ], - - instruction : [ - {token : "punctuation.instruction.end", regex : "\\?>", next : "start"} - ], - - doctype : [ - {include : "space"}, - {include : "string"}, - {token : "punctuation.doctype.end", regex : ">", next : "start"}, - {token : "xml-pe", regex : "[-_a-zA-Z0-9:]+"}, - {token : "punctuation.begin", regex : "\\[", push : "declarations"} - ], - - declarations : [{ - token : "text", - regex : "\\s+" - }, { - token: "punctuation.end", - regex: "]", - next: "pop" - }, { - token : ["punctuation.begin", "keyword"], - regex : "(<\\!)([-_a-zA-Z0-9]+)", - push : [{ - token : "text", - regex : "\\s+" - }, - { - token : "punctuation.end", - regex : ">", - next : "pop" - }, - {include : "string"}] - }], - - cdata : [ - {token : "string.end", regex : "\\]\\]>", next : "start"}, - {token : "text", regex : "\\s+"}, - {token : "text", regex : "(?:[^\\]]|\\](?!\\]>))+"} - ], - - comment : [ - {token : "comment", regex : "-->", next : "start"}, - {defaultToken : "comment"} - ], - - tag : [{ - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(<)((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)", - next: [ - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : "start"} - ] - }, { - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(", next : "start"} - ] - }], - - space : [ - {token : "text", regex : "\\s+"} - ], - - reference : [{ - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, { - token : "invalid.illegal", regex : "&" - }], - - string: [{ - token : "string", - regex : "'", - push : "qstring_inner" - }, { - token : "string", - regex : '"', - push : "qqstring_inner" - }], - - qstring_inner: [ - {token : "string", regex: "'", next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - qqstring_inner: [ - {token : "string", regex: '"', next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - attributes: [{ - token : "entity.other.attribute-name", - regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+" - }, { - token : "keyword.operator.separator", - regex : "=" - }, { - include : "space" - }, { - include : "string" - }] - }; - - if (this.constructor === XmlHighlightRules) - this.normalizeRules(); -}; - - -(function() { - - this.embedTagRules = function(HighlightRules, prefix, tag){ - this.$rules.tag.unshift({ - token : ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(<)(" + tag + ")", - next: [ - {include : "space"}, - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : prefix + "start"} - ] - }); - - this.$rules[tag + "-end"] = [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next: "start", - onMatch : function(value, currentState, stack) { - stack.splice(0); - return this.token; - }} - ] - - this.embedRules(HighlightRules, prefix, [{ - token: ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(" - }]); - }; - -}).call(TextHighlightRules.prototype); - -oop.inherits(XmlHighlightRules, TextHighlightRules); - -exports.XmlHighlightRules = XmlHighlightRules; -}); - -define('ace/mode/xml_util', ['require', 'exports', 'module' ], function(require, exports, module) { - - -function string(state) { - return [{ - token : "string", - regex : '"', - next : state + "_qqstring" - }, { - token : "string", - regex : "'", - next : state + "_qstring" - }]; -} - -function multiLineString(quote, state) { - return [ - {token : "string", regex : quote, next : state}, - { - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, - {defaultToken : "string"} - ]; -} - -exports.tag = function(states, name, nextState, tagMap) { - states[name] = [{ - token : "text", - regex : "\\s+" - }, { - - token : !tagMap ? "meta.tag.tag-name" : function(value) { - if (tagMap[value]) - return "meta.tag.tag-name." + tagMap[value]; - else - return "meta.tag.tag-name"; - }, - regex : "[-_a-zA-Z0-9:]+", - next : name + "_embed_attribute_list" - }, { - token: "empty", - regex: "", - next : 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"] = [{ - token : "meta.tag.r", - regex : "/?>", - next : nextState - }, { - token : "keyword.operator", - regex : "=" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "text", - regex : "\\s+" - }].concat(string(name)); -}; - -}); - -define('ace/mode/html', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/javascript', 'ace/mode/css', 'ace/tokenizer', 'ace/mode/html_highlight_rules', 'ace/mode/behaviour/html', 'ace/mode/folding/html', 'ace/mode/html_completions'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var JavaScriptMode = require("./javascript").Mode; -var CssMode = require("./css").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; -var HtmlBehaviour = require("./behaviour/html").HtmlBehaviour; -var HtmlFoldMode = require("./folding/html").FoldMode; -var HtmlCompletions = require("./html_completions").HtmlCompletions; - -var Mode = function() { - this.HighlightRules = HtmlHighlightRules; - this.$behaviour = new HtmlBehaviour(); - this.$completer = new HtmlCompletions(); - - this.createModeDelegates({ - "js-": JavaScriptMode, - "css-": CssMode - }); - - this.foldingRules = new HtmlFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.blockComment = {start: ""}; - - this.getNextLineIndent = function(state, line, tab) { - return this.$getIndent(line); - }; - - this.checkOutdent = function(state, line, input) { - return false; - }; - - this.getCompletions = function(state, session, pos, prefix) { - return this.$completer.getCompletions(state, session, pos, prefix); - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/javascript', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/javascript_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/worker/worker_client', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var Range = require("../range").Range; -var WorkerClient = require("../worker/worker_client").WorkerClient; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = JavaScriptHighlightRules; - - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().getLineTokens(line, state); - var tokens = tokenizedLine.tokens; - var endState = tokenizedLine.state; - - if (tokens.length && tokens[tokens.length-1].type == "comment") { - return indent; - } - - if (state == "start" || state == "no_regex") { - var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/); - if (match) { - indent += tab; - } - } else if (state == "doc-start") { - if (endState == "start" || endState == "no_regex") { - return ""; - } - var match = line.match(/^\s*(\/?)\*/); - if (match) { - if (match[1]) { - indent += " "; - } - indent += "* "; - } - } - - 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); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker"); - worker.attachToDocument(session.getDocument()); - - worker.on("jslint", function(results) { - session.setAnnotations(results.data); - }); - - worker.on("terminate", function() { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); - -define('ace/mode/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/css_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/worker/worker_client', 'ace/mode/behaviour/css', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var WorkerClient = require("../worker/worker_client").WorkerClient; -var CssBehaviour = require("./behaviour/css").CssBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = CssHighlightRules; - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CssBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.foldingRules = "cStyle"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - var tokens = this.getTokenizer().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); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker"); - worker.attachToDocument(session.getDocument()); - - worker.on("csslint", function(e) { - session.setAnnotations(e.data); - }); - - worker.on("terminate", function() { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; - -}); - -define('ace/mode/behaviour/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; - -var CssBehaviour = function () { - - this.inherit(CstyleBehaviour); - - this.add("colon", "insertion", function (state, action, editor, session, text) { - if (text === ':') { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - var token = iterator.getCurrentToken(); - if (token && token.value.match(/\s+/)) { - token = iterator.stepBackward(); - } - if (token && token.type === 'support.type') { - var line = session.doc.getLine(cursor.row); - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar === ':') { - return { - text: '', - selection: [1, 1] - } - } - if (!line.substring(cursor.column).match(/^\s*;/)) { - return { - text: ':;', - selection: [1, 1] - } - } - } - } - }); - - this.add("colon", "deletion", function (state, action, editor, session, range) { - var selected = session.doc.getTextRange(range); - if (!range.isMultiLine() && selected === ':') { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - var token = iterator.getCurrentToken(); - if (token && token.value.match(/\s+/)) { - token = iterator.stepBackward(); - } - if (token && token.type === 'support.type') { - 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("semicolon", "insertion", function (state, action, editor, session, text) { - if (text === ';') { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar === ';') { - return { - text: '', - selection: [1, 1] - } - } - } - }); - -} -oop.inherits(CssBehaviour, CstyleBehaviour); - -exports.CssBehaviour = CssBehaviour; -}); - -define('ace/mode/behaviour/html', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour/xml', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var XmlBehaviour = require("../behaviour/xml").XmlBehaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var voidElements = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']; - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); - return hasType; -} - -var HtmlBehaviour = function () { - - this.inherit(XmlBehaviour); // Get xml behaviour - - this.add("autoclosing", "insertion", function (state, action, editor, session, text) { - if (text == '>') { - var position = editor.getCursorPosition(); - var iterator = new TokenIterator(session, position.row, position.column); - var token = iterator.getCurrentToken(); - - if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column) - return; - var atCursor = false; - if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text'))); - } else { - atCursor = true; - } - if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) { - return; - } - var element = token.value; - if (atCursor){ - var element = element.substring(0, position.column - token.start); - } - if (voidElements.indexOf(element) !== -1){ - return; - } - return { - text: '>' + '', - selection: [1, 1] - } - } - }); -} -oop.inherits(HtmlBehaviour, XmlBehaviour); - -exports.HtmlBehaviour = HtmlBehaviour; -}); - -define('ace/mode/behaviour/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); - return hasType; -} - -var XmlBehaviour = function () { - - this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour - - this.add("autoclosing", "insertion", function (state, action, editor, session, text) { - if (text == '>') { - var position = editor.getCursorPosition(); - var iterator = new TokenIterator(session, position.row, position.column); - var token = iterator.getCurrentToken(); - - if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column) - return; - var atCursor = false; - if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text'))); - } else { - atCursor = true; - } - if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) { - return; - } - var tag = token.value; - if (atCursor){ - var tag = tag.substring(0, position.column - token.start); - } - - return { - text: '>' + '', - selection: [1, 1] - } - } - }); - - this.add('autoindent', 'insertion', function (state, action, editor, session, text) { - if (text == "\n") { - var cursor = editor.getCursorPosition(); - var line = session.getLine(cursor.row); - var rightChars = line.substring(cursor.column, cursor.column + 2); - if (rightChars == '?)/; - this._parseTag = function(tag) { - - var match = tag.match(this.tagRe); - var column = 0; - - return { - value: tag, - match: match ? match[2] : "", - closing: match ? !!match[3] : false, - selfClosing: match ? !!match[5] || match[2] == "/>" : false, - tagName: match ? match[4] : "", - column: match[1] ? column + match[1].length : column - }; - }; - this._readTagForward = function(iterator) { - var token = iterator.getCurrentToken(); - if (!token) - return null; - - var value = ""; - var start; - - do { - if (token.type.lastIndexOf("meta.tag", 0) === 0) { - if (!start) { - var start = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() - }; - } - value += token.value; - if (value.indexOf(">") !== -1) { - var tag = this._parseTag(value); - tag.start = start; - tag.end = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() + token.value.length - }; - iterator.stepForward(); - return tag; - } - } - } while(token = iterator.stepForward()); - - return null; - }; - - this._readTagBackward = function(iterator) { - var token = iterator.getCurrentToken(); - if (!token) - return null; - - var value = ""; - var end; - - do { - if (token.type.lastIndexOf("meta.tag", 0) === 0) { - if (!end) { - end = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() + token.value.length - }; - } - value = token.value + value; - if (value.indexOf("<") !== -1) { - var tag = this._parseTag(value); - tag.end = end; - tag.start = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() - }; - iterator.stepBackward(); - return tag; - } - } - } while(token = iterator.stepBackward()); - - return null; - }; - - this._pop = function(stack, tag) { - while (stack.length) { - - var top = stack[stack.length-1]; - if (!tag || top.tagName == tag.tagName) { - return stack.pop(); - } - else if (this.voidElements[tag.tagName]) { - return; - } - else if (this.voidElements[top.tagName]) { - stack.pop(); - continue; - } else { - return null; - } - } - }; - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var firstTag = this._getFirstTagInLine(session, row); - - if (!firstTag.match) - return null; - - var isBackward = firstTag.closing || firstTag.selfClosing; - var stack = []; - var tag; - - if (!isBackward) { - var iterator = new TokenIterator(session, row, firstTag.column); - var start = { - row: row, - column: firstTag.column + firstTag.tagName.length + 2 - }; - while (tag = this._readTagForward(iterator)) { - if (tag.selfClosing) { - if (!stack.length) { - tag.start.column += tag.tagName.length + 2; - tag.end.column -= 2; - return Range.fromPoints(tag.start, tag.end); - } else - continue; - } - - if (tag.closing) { - this._pop(stack, tag); - if (stack.length == 0) - return Range.fromPoints(start, tag.start); - } - else { - stack.push(tag) - } - } - } - else { - var iterator = new TokenIterator(session, row, firstTag.column + firstTag.match.length); - var end = { - row: row, - column: firstTag.column - }; - - while (tag = this._readTagBackward(iterator)) { - if (tag.selfClosing) { - if (!stack.length) { - tag.start.column += tag.tagName.length + 2; - tag.end.column -= 2; - return Range.fromPoints(tag.start, tag.end); - } else - continue; - } - - if (!tag.closing) { - this._pop(stack, tag); - if (stack.length == 0) { - tag.start.column += tag.tagName.length + 2; - return Range.fromPoints(tag.start, end); - } - } - else { - stack.push(tag) - } - } - } - - }; - -}).call(FoldMode.prototype); - -}); - -define('ace/mode/html_completions', ['require', 'exports', 'module' , 'ace/token_iterator'], function(require, exports, module) { - - -var TokenIterator = require("../token_iterator").TokenIterator; - -var commonAttributes = [ - "accesskey", - "class", - "contenteditable", - "contextmenu", - "dir", - "draggable", - "dropzone", - "hidden", - "id", - "lang", - "spellcheck", - "style", - "tabindex", - "title", - "translate" -]; - -var eventAttributes = [ - "onabort", - "onblur", - "oncancel", - "oncanplay", - "oncanplaythrough", - "onchange", - "onclick", - "onclose", - "oncontextmenu", - "oncuechange", - "ondblclick", - "ondrag", - "ondragend", - "ondragenter", - "ondragleave", - "ondragover", - "ondragstart", - "ondrop", - "ondurationchange", - "onemptied", - "onended", - "onerror", - "onfocus", - "oninput", - "oninvalid", - "onkeydown", - "onkeypress", - "onkeyup", - "onload", - "onloadeddata", - "onloadedmetadata", - "onloadstart", - "onmousedown", - "onmousemove", - "onmouseout", - "onmouseover", - "onmouseup", - "onmousewheel", - "onpause", - "onplay", - "onplaying", - "onprogress", - "onratechange", - "onreset", - "onscroll", - "onseeked", - "onseeking", - "onselect", - "onshow", - "onstalled", - "onsubmit", - "onsuspend", - "ontimeupdate", - "onvolumechange", - "onwaiting" -]; - -var globalAttributes = commonAttributes.concat(eventAttributes); - -var attributeMap = { - "html": ["manifest"], - "head": [], - "title": [], - "base": ["href", "target"], - "link": ["href", "hreflang", "rel", "media", "type", "sizes"], - "meta": ["http-equiv", "name", "content", "charset"], - "style": ["type", "media", "scoped"], - "script": ["charset", "type", "src", "defer", "async"], - "noscript": ["href"], - "body": ["onafterprint", "onbeforeprint", "onbeforeunload", "onhashchange", "onmessage", "onoffline", "onpopstate", "onredo", "onresize", "onstorage", "onundo", "onunload"], - "section": [], - "nav": [], - "article": ["pubdate"], - "aside": [], - "h1": [], - "h2": [], - "h3": [], - "h4": [], - "h5": [], - "h6": [], - "header": [], - "footer": [], - "address": [], - "main": [], - "p": [], - "hr": [], - "pre": [], - "blockquote": ["cite"], - "ol": ["start", "reversed"], - "ul": [], - "li": ["value"], - "dl": [], - "dt": [], - "dd": [], - "figure": [], - "figcaption": [], - "div": [], - "a": ["href", "target", "ping", "rel", "media", "hreflang", "type"], - "em": [], - "strong": [], - "small": [], - "s": [], - "cite": [], - "q": ["cite"], - "dfn": [], - "abbr": [], - "data": [], - "time": ["datetime"], - "code": [], - "var": [], - "samp": [], - "kbd": [], - "sub": [], - "sup": [], - "i": [], - "b": [], - "u": [], - "mark": [], - "ruby": [], - "rt": [], - "rp": [], - "bdi": [], - "bdo": [], - "span": [], - "br": [], - "wbr": [], - "ins": ["cite", "datetime"], - "del": ["cite", "datetime"], - "img": ["alt", "src", "height", "width", "usemap", "ismap"], - "iframe": ["name", "src", "height", "width", "sandbox", "seamless"], - "embed": ["src", "height", "width", "type"], - "object": ["param", "data", "type", "height" , "width", "usemap", "name", "form", "classid"], - "param": ["name", "value"], - "video": ["src", "autobuffer", "autoplay", "loop", "controls", "width", "height", "poster"], - "audio": ["src", "autobuffer", "autoplay", "loop", "controls"], - "source": ["src", "type", "media"], - "track": ["kind", "src", "srclang", "label", "default"], - "canvas": ["width", "height"], - "map": ["name"], - "area": ["shape", "coords", "href", "hreflang", "alt", "target", "media", "rel", "ping", "type"], - "svg": [], - "math": [], - "table": ["summary"], - "caption": [], - "colgroup": ["span"], - "col": ["span"], - "tbody": [], - "thead": [], - "tfoot": [], - "tr": [], - "td": ["headers", "rowspan", "colspan"], - "th": ["headers", "rowspan", "colspan", "scope"], - "form": ["accept-charset", "action", "autocomplete", "enctype", "method", "name", "novalidate", "target"], - "fieldset": ["disabled", "form", "name"], - "legend": [], - "label": ["form", "for"], - "input": ["type", "accept", "alt", "autocomplete", "checked", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "height", "list", "max", "maxlength", "min", "multiple", "pattern", "placeholder", "readonly", "required", "size", "src", "step", "width", "files", "value"], - "button": ["autofocus", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "name", "value", "type"], - "select": ["autofocus", "disabled", "form", "multiple", "name", "size"], - "datalist": [], - "optgroup": ["disabled", "label"], - "option": ["disabled", "selected", "label", "value"], - "textarea": ["autofocus", "disabled", "form", "maxlength", "name", "placeholder", "readonly", "required", "rows", "cols", "wrap"], - "keygen": ["autofocus", "challenge", "disabled", "form", "keytype", "name"], - "output": ["for", "form", "name"], - "progress": ["value", "max"], - "meter": ["value", "min", "max", "low", "high", "optimum"], - "details": ["open"], - "summary": [], - "command": ["type", "label", "icon", "disabled", "checked", "radiogroup", "command"], - "menu": ["type", "label"], - "dialog": ["open"] -}; - -var allElements = Object.keys(attributeMap); - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); -} - -function findTagName(session, pos) { - var iterator = new TokenIterator(session, pos.row, pos.column); - var token = iterator.getCurrentToken(); - if (!token || !hasType(token, 'tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'operator') || hasType(token, 'attribute-name') || hasType(token, 'text'))); - } - if (token && hasType(token, 'tag-name') && !iterator.stepBackward().value.match('/')) - return token.value; -} - -var HtmlCompletions = function() { - -}; - -(function() { - - this.getCompletions = function(state, session, pos, prefix) { - var token = session.getTokenAt(pos.row, pos.column); - - if (!token) - return []; - if (hasType(token, "tag-name") || (token.value == '<' && hasType(token, "text"))) - return this.getTagCompletions(state, session, pos, prefix); - if (hasType(token, 'text') || hasType(token, 'attribute-name')) - return this.getAttributeCompetions(state, session, pos, prefix); - - return []; - }; - - this.getTagCompletions = function(state, session, pos, prefix) { - var elements = allElements; - if (prefix) { - elements = elements.filter(function(element){ - return element.indexOf(prefix) === 0; - }); - } - return elements.map(function(element){ - return { - value: element, - meta: "tag" - }; - }); - }; - - this.getAttributeCompetions = function(state, session, pos, prefix) { - var tagName = findTagName(session, pos); - if (!tagName) - return []; - var attributes = globalAttributes; - if (tagName in attributeMap) { - attributes = attributes.concat(attributeMap[tagName]); - } - if (prefix) { - attributes = attributes.filter(function(attribute){ - return attribute.indexOf(prefix) === 0; - }); - } - return attributes.map(function(attribute){ - return { - caption: attribute, - snippet: attribute + '="$0"', - meta: "attribute" - }; - }); - }; - -}).call(HtmlCompletions.prototype); - -exports.HtmlCompletions = HtmlCompletions; -}); - -define('ace/mode/ruby', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/ruby_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/mode/folding/coffee'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var RubyHighlightRules = require("./ruby_highlight_rules").RubyHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var Range = require("../range").Range; -var FoldMode = require("./folding/coffee").FoldMode; - -var Mode = function() { - this.HighlightRules = RubyHighlightRules; - this.$outdent = new MatchingBraceOutdent(); - this.foldingRules = new FoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - - this.lineCommentStart = "#"; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().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*$/); - var startingClassOrMethod = line.match(/^\s*(class|def)\s.*$/); - var startingDoBlock = line.match(/.*do(\s*|\s+\|.*\|\s*)$/); - var startingConditional = line.match(/^\s*(if|else)\s*/) - if (match || startingClassOrMethod || startingDoBlock || startingConditional) { - indent += tab; - } - } - - return indent; - }; - - this.checkOutdent = function(state, line, input) { - return /^\s+end$/.test(line + input) || /^\s+}$/.test(line + input) || /^\s+else$/.test(line + input); - }; - - this.autoOutdent = function(state, doc, row) { - 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; -}); - -define('ace/mode/ruby_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var constantOtherSymbol = exports.constantOtherSymbol = { - token : "constant.other.symbol.ruby", // symbol - regex : "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?" -}; - -var qString = exports.qString = { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" -}; - -var qqString = exports.qqString = { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' -}; - -var tString = exports.tString = { - token : "string", // backtick string - regex : "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]" -}; - -var constantNumericHex = exports.constantNumericHex = { - token : "constant.numeric", // hex - regex : "0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b" -}; - -var constantNumericFloat = exports.constantNumericFloat = { - token : "constant.numeric", // float - regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?\\b" -}; - -var RubyHighlightRules = function() { - - var builtinFunctions = ( - "abort|Array|assert|assert_equal|assert_not_equal|assert_same|assert_not_same|" + - "assert_nil|assert_not_nil|assert_match|assert_no_match|assert_in_delta|assert_throws|" + - "assert_raise|assert_nothing_raised|assert_instance_of|assert_kind_of|assert_respond_to|" + - "assert_operator|assert_send|assert_difference|assert_no_difference|assert_recognizes|" + - "assert_generates|assert_response|assert_redirected_to|assert_template|assert_select|" + - "assert_select_email|assert_select_rjs|assert_select_encoded|css_select|at_exit|" + - "attr|attr_writer|attr_reader|attr_accessor|attr_accessible|autoload|binding|block_given?|callcc|" + - "caller|catch|chomp|chomp!|chop|chop!|defined?|delete_via_redirect|eval|exec|exit|" + - "exit!|fail|Float|flunk|follow_redirect!|fork|form_for|form_tag|format|gets|global_variables|gsub|" + - "gsub!|get_via_redirect|host!|https?|https!|include|Integer|lambda|link_to|" + - "link_to_unless_current|link_to_function|link_to_remote|load|local_variables|loop|open|open_session|" + - "p|print|printf|proc|putc|puts|post_via_redirect|put_via_redirect|raise|rand|" + - "raw|readline|readlines|redirect?|request_via_redirect|require|scan|select|" + - "set_trace_func|sleep|split|sprintf|srand|String|stylesheet_link_tag|syscall|system|sub|sub!|test|" + - "throw|trace_var|trap|untrace_var|atan2|cos|exp|frexp|ldexp|log|log10|sin|sqrt|tan|" + - "render|javascript_include_tag|csrf_meta_tag|label_tag|text_field_tag|submit_tag|check_box_tag|" + - "content_tag|radio_button_tag|text_area_tag|password_field_tag|hidden_field_tag|" + - "fields_for|select_tag|options_for_select|options_from_collection_for_select|collection_select|" + - "time_zone_select|select_date|select_time|select_datetime|date_select|time_select|datetime_select|" + - "select_year|select_month|select_day|select_hour|select_minute|select_second|file_field_tag|" + - "file_field|respond_to|skip_before_filter|around_filter|after_filter|verify|" + - "protect_from_forgery|rescue_from|helper_method|redirect_to|before_filter|" + - "send_data|send_file|validates_presence_of|validates_uniqueness_of|validates_length_of|" + - "validates_format_of|validates_acceptance_of|validates_associated|validates_exclusion_of|" + - "validates_inclusion_of|validates_numericality_of|validates_with|validates_each|" + - "authenticate_or_request_with_http_basic|authenticate_or_request_with_http_digest|" + - "filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" + - "translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|" + - "cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" + - "has_many|has_one|belongs_to|has_and_belongs_to_many" - ); - - var keywords = ( - "alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" + - "__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" + - "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield" - ); - - var buildinConstants = ( - "true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" + - "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING" - ); - - var builtinVariables = ( - "\$DEBUG|\$defout|\$FILENAME|\$LOAD_PATH|\$SAFE|\$stdin|\$stdout|\$stderr|\$VERBOSE|" + - "$!|root_url|flash|session|cookies|params|request|response|logger|self" - ); - - var keywordMapper = this.$keywords = this.createKeywordMapper({ - "keyword": keywords, - "constant.language": buildinConstants, - "variable.language": builtinVariables, - "support.function": builtinFunctions, - "invalid.deprecated": "debugger" // TODO is this a remnant from js mode? - }, "identifier"); - - this.$rules = { - "start" : [ - { - token : "comment", - regex : "#.*$" - }, { - token : "comment", // multi line comment - regex : "^=begin(?:$|\\s.*$)", - next : "comment" - }, { - token : "string.regexp", - regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" - }, - - qString, - qqString, - tString, - - { - token : "text", // namespaces aren't symbols - regex : "::" - }, { - token : "variable.instance", // instance variable - regex : "@{1,2}[a-zA-Z_\\d]+" - }, { - token : "support.class", // class name - regex : "[A-Z][a-zA-Z_\\d]+" - }, - - constantOtherSymbol, - constantNumericHex, - constantNumericFloat, - - { - token : "constant.language.boolean", - regex : "(?:true|false)\\b" - }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" - }, { - token : "punctuation.separator.key-value", - regex : "=>" - }, { - stateName: "heredoc", - onMatch : function(value, currentState, stack) { - var next = value[2] == '-' ? "indentedHeredoc" : "heredoc"; - var tokens = value.split(this.splitRegex); - stack.push(next, tokens[3]); - return [ - {type:"constant", value: tokens[1]}, - {type:"string", value: tokens[2]}, - {type:"support.class", value: tokens[3]}, - {type:"string", value: tokens[4]} - ]; - }, - regex : "(<<-?)(['\"`]?)([\\w]+)(['\"`]?)", - rules: { - heredoc: [{ - onMatch: function(value, currentState, stack) { - if (value == stack[1]) { - stack.shift(); - stack.shift(); - return "support.class"; - } - return "string"; - }, - regex: ".*$", - next: "start" - }], - indentedHeredoc: [{ - token: "string", - regex: "^ +" - }, { - onMatch: function(value, currentState, stack) { - if (value == stack[1]) { - stack.shift(); - stack.shift(); - return "support.class"; - } - return "string"; - }, - regex: ".*$", - next: "start" - }] - } - }, { - token : "keyword.operator", - regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" - }, { - token : "paren.lparen", - regex : "[[({]" - }, { - token : "paren.rparen", - regex : "[\\])}]" - }, { - token : "text", - regex : "\\s+" - } - ], - "comment" : [ - { - token : "comment", // closing comment - regex : "^=end(?:$|\\s.*$)", - next : "start" - }, { - token : "comment", // comment spanning whole line - regex : ".+" - } - ] - }; - - this.normalizeRules(); -}; - -oop.inherits(RubyHighlightRules, TextHighlightRules); - -exports.RubyHighlightRules = RubyHighlightRules; -}); - -define('ace/mode/folding/coffee', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var BaseFoldMode = require("./fold_mode").FoldMode; -var Range = require("../../range").Range; - -var FoldMode = exports.FoldMode = function() {}; -oop.inherits(FoldMode, BaseFoldMode); - -(function() { - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var range = this.indentationBlock(session, row); - if (range) - return range; - - var re = /\S/; - var line = session.getLine(row); - var startLevel = line.search(re); - if (startLevel == -1 || line[startLevel] != "#") - return; - - var startColumn = line.length; - var maxRow = session.getLength(); - var startRow = row; - var endRow = row; - - while (++row < maxRow) { - line = session.getLine(row); - var level = line.search(re); - - if (level == -1) - continue; - - if (line[level] != "#") - break; - - endRow = row; - } - - if (endRow > startRow) { - var endColumn = session.getLine(endRow).length; - return new Range(startRow, startColumn, endRow, endColumn); - } - }; - this.getFoldWidget = function(session, foldStyle, row) { - var line = session.getLine(row); - var indent = line.search(/\S/); - var next = session.getLine(row + 1); - var prev = session.getLine(row - 1); - var prevIndent = prev.search(/\S/); - var nextIndent = next.search(/\S/); - - if (indent == -1) { - session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : ""; - return ""; - } - if (prevIndent == -1) { - if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") { - session.foldWidgets[row - 1] = ""; - session.foldWidgets[row + 1] = ""; - return "start"; - } - } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") { - if (session.getLine(row - 2).search(/\S/) == -1) { - session.foldWidgets[row - 1] = "start"; - session.foldWidgets[row + 1] = ""; - return ""; - } - } - - if (prevIndent!= -1 && prevIndent < indent) - session.foldWidgets[row - 1] = "start"; - else - session.foldWidgets[row - 1] = ""; - - if (indent < nextIndent) - return "start"; - else - return ""; - }; - -}).call(FoldMode.prototype); - -}); diff --git a/addons/editor/ace/mode-ftl.js b/addons/editor/ace/mode-ftl.js deleted file mode 100644 index c106a6d8..00000000 --- a/addons/editor/ace/mode-ftl.js +++ /dev/null @@ -1,1060 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2010, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/mode/ftl', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/ftl_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var FtlHighlightRules = require("./ftl_highlight_rules").FtlHighlightRules; - -var Mode = function() { - this.HighlightRules = FtlHighlightRules; -}; -oop.inherits(Mode, TextMode); - -(function() { - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/ftl_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/html_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var FtlLangHighlightRules = function () { - - var stringBuiltIns = "\\?|substring|cap_first|uncap_first|capitalize|chop_linebreak|date|time|datetime|" - + "ends_with|html|groups|index_of|j_string|js_string|json_string|last_index_of|length|lower_case|" - + "left_pad|right_pad|contains|matches|number|replace|rtf|url|split|starts_with|string|trim|" - + "upper_case|word_list|xhtml|xml"; - var numberBuiltIns = "c|round|floor|ceiling"; - var dateBuiltIns = "iso_[a-z_]+"; - var seqBuiltIns = "first|last|seq_contains|seq_index_of|seq_last_index_of|reverse|size|sort|sort_by|chunk"; - var hashBuiltIns = "keys|values"; - var xmlBuiltIns = "children|parent|root|ancestors|node_name|node_type|node_namespace"; - var expertBuiltIns = "byte|double|float|int|long|short|number_to_date|number_to_time|number_to_datetime|" - + "eval|has_content|interpret|is_[a-z_]+|namespacenew"; - var allBuiltIns = stringBuiltIns + numberBuiltIns + dateBuiltIns + seqBuiltIns + hashBuiltIns - + xmlBuiltIns + expertBuiltIns; - - var deprecatedBuiltIns = "default|exists|if_exists|web_safe"; - - var variables = "data_model|error|globals|lang|locale|locals|main|namespace|node|current_node|" - + "now|output_encoding|template_name|url_escaping_charset|vars|version"; - - var operators = "gt|gte|lt|lte|as|in|using"; - - var reserved = "true|false"; - - var attributes = "encoding|parse|locale|number_format|date_format|time_format|datetime_format|time_zone|" - + "url_escaping_charset|classic_compatible|strip_whitespace|strip_text|strict_syntax|ns_prefixes|" - + "attributes"; - - this.$rules = { - "start" : [{ - token : "constant.character.entity", - regex : /&[^;]+;/ - }, { - token : "support.function", - regex : "\\?("+allBuiltIns+")" - }, { - token : "support.function.deprecated", - regex : "\\?("+deprecatedBuiltIns+")" - }, { - token : "language.variable", - regex : "\\.(?:"+variables+")" - }, { - token : "constant.language", - regex : "\\b("+reserved+")\\b" - }, { - token : "keyword.operator", - regex : "\\b(?:"+operators+")\\b" - }, { - token : "entity.other.attribute-name", - regex : attributes - }, { - token : "string", // - regex : /['"]/, - next : "qstring" - }, { - token : function(value) { - if (value.match("^[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?$")) { - return "constant.numeric"; - } else { - return "variable"; - } - }, - regex : /[\w.+\-]+/ - }, { - token : "keyword.operator", - regex : "!|\\.|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=" - }, { - token : "paren.lparen", - regex : "[[({]" - }, { - token : "paren.rparen", - regex : "[\\])}]" - }, { - token : "text", - regex : "\\s+" - }], - - "qstring" : [{ - token : "constant.character.escape", - regex : '\\\\[nrtvef\\\\"$]' - }, { - token : "string", - regex : /['"]/, - next : "start" - }, { - defaultToken : "string" - }] - }; -}; - -oop.inherits(FtlLangHighlightRules, TextHighlightRules); - -var FtlHighlightRules = function() { - HtmlHighlightRules.call(this); - - var directives = "assign|attempt|break|case|compress|default|elseif|else|escape|fallback|function|flush|" - + "ftl|global|if|import|include|list|local|lt|macro|nested|noescape|noparse|nt|recover|recurse|return|rt|" - + "setting|stop|switch|t|visit"; - - var startRules = [ - { - token : "comment", - regex : "<#--", - next : "ftl-dcomment" - }, { - token : "string.interpolated", - regex : "\\${", - push : "ftl-start" - }, { - token : "keyword.function", - regex : "", - next : "pop" - }, { - token : "string.interpolated", - regex : "}", - next : "pop" - } - ]; - - for (var key in this.$rules) - this.$rules[key].unshift.apply(this.$rules[key], startRules); - - this.embedRules(FtlLangHighlightRules, "ftl-", endRules, ["start"]); - - this.addRules({ - "ftl-dcomment" : [{ - token : "comment", - regex : ".*?-->", - next : "pop" - }, { - token : "comment", - regex : ".+" - }] - }); - - this.normalizeRules(); -}; - -oop.inherits(FtlHighlightRules, HtmlHighlightRules); - -exports.FtlHighlightRules = FtlHighlightRules; -}); - -define('ace/mode/html_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/css_highlight_rules', 'ace/mode/javascript_highlight_rules', 'ace/mode/xml_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; - -var tagMap = lang.createMap({ - a : 'anchor', - button : 'form', - form : 'form', - img : 'image', - input : 'form', - label : 'form', - option : 'form', - script : 'script', - select : 'form', - textarea : 'form', - style : 'style', - table : 'table', - tbody : 'table', - td : 'table', - tfoot : 'table', - th : 'table', - tr : 'table' -}); - -var HtmlHighlightRules = function() { - XmlHighlightRules.call(this); - - this.addRules({ - attributes: [{ - include : "space" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "keyword.operator.separator", - regex : "=", - push : [{ - include: "space" - }, { - token : "string", - regex : "[^<>='\"`\\s]+", - next : "pop" - }, { - token : "empty", - regex : "", - next : "pop" - }] - }, { - include : "string" - }], - tag: [{ - token : function(start, tag) { - var group = tagMap[tag]; - return ["meta.tag.punctuation.begin", - "meta.tag.name" + (group ? "." + group : "")]; - }, - regex : "(<)([-_a-zA-Z0-9:]+)", - next: "start_tag_stuff" - }, { - token : function(start, tag) { - var group = tagMap[tag]; - return ["meta.tag.punctuation.begin", - "meta.tag.name" + (group ? "." + group : "")]; - }, - regex : "(", next : "start"} - ], - end_tag_stuff: [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next : "start"} - ] - }); - - this.embedTagRules(CssHighlightRules, "css-", "style"); - this.embedTagRules(JavaScriptHighlightRules, "js-", "script"); - - if (this.constructor === HtmlHighlightRules) - this.normalizeRules(); -}; - -oop.inherits(HtmlHighlightRules, XmlHighlightRules); - -exports.HtmlHighlightRules = HtmlHighlightRules; -}); - -define('ace/mode/css_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var supportType = exports.supportType = "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"; -var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters"; -var supportConstant = exports.supportConstant = "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|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|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero"; -var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow"; -var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace"; - -var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))"; -var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b"; -var pseudoClasses = exports.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 CssHighlightRules = function() { - - var keywordMapper = this.createKeywordMapper({ - "support.function": supportFunction, - "support.constant": supportConstant, - "support.type": supportType, - "support.constant.color": supportConstantColor, - "support.constant.fonts": supportConstantFonts - }, "text", true); - - this.$rules = { - "start" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "@.*?{", - push: "media" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "media" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "\\}", - next: "pop" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "comment" : [{ - token : "comment", - regex : "\\*\\/", - next : "pop" - }, { - defaultToken : "comment" - }], - - "ruleset" : [ - { - token : "paren.rparen", - regex : "\\}", - next: "pop" - }, { - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - 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 : numRe - }, { - 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 : ["support.function", "string", "support.function"], - regex : "(url\\()(.*)(\\))" - }, { - token : keywordMapper, - regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*" - }, { - caseInsensitive: true - }] - }; - - this.normalizeRules(); -}; - -oop.inherits(CssHighlightRules, TextHighlightRules); - -exports.CssHighlightRules = CssHighlightRules; - -}); - -define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var JavaScriptHighlightRules = function() { - var keywordMapper = this.createKeywordMapper({ - "variable.language": - "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors - "Namespace|QName|XML|XMLList|" + // E4X - "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + - "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + - "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors - "SyntaxError|TypeError|URIError|" + - "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions - "isNaN|parseFloat|parseInt|" + - "JSON|Math|" + // Other - "this|arguments|prototype|window|document" , // Pseudo - "keyword": - "const|yield|import|get|set|" + - "break|case|catch|continue|default|delete|do|else|finally|for|function|" + - "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + - "__parent__|__count__|escape|unescape|with|__proto__|" + - "class|enum|extends|super|export|implements|private|public|interface|package|protected|static", - "storage.type": - "const|let|var|function", - "constant.language": - "null|Infinity|NaN|undefined", - "support.function": - "alert", - "constant.language.boolean": "true|false" - }, "identifier"); - var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; - var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\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 - ".)"; - - this.$rules = { - "no_regex" : [ - { - token : "comment", - regex : "\\/\\/", - next : "line_comment" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : /\/\*/, - next : "comment" - }, { - token : "string", - regex : "'(?=.)", - next : "qstring" - }, { - token : "string", - regex : '"(?=.)', - next : "qqstring" - }, { - token : "constant.numeric", // hex - regex : /0[xX][0-9a-fA-F]+\b/ - }, { - token : "constant.numeric", // float - regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/ - }, { - token : [ - "storage.type", "punctuation.operator", "support.function", - "punctuation.operator", "entity.name.function", "text","keyword.operator" - ], - regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "keyword.operator", "text", "storage.type", - "text", "paren.lparen" - ], - regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "punctuation.operator", - "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "text", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : "keyword", - regex : "(?:" + kwBeforeRe + ")\\b", - next : "start" - }, { - token : ["punctuation.operator", "support.function"], - regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/ - }, { - token : ["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 : keywordMapper, - regex : identifierRe - }, { - token : "keyword.operator", - regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/, - next : "start" - }, { - token : "punctuation.operator", - regex : /\?|\:|\,|\;|\./, - next : "start" - }, { - token : "paren.lparen", - regex : /[\[({]/, - next : "start" - }, { - token : "paren.rparen", - regex : /[\])}]/ - }, { - token : "keyword.operator", - regex : /\/=?/, - next : "start" - }, { - token: "comment", - regex: /^#!.*$/ - } - ], - "start": [ - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment_regex_allowed" - }, { - token : "comment", - regex : "\\/\\/", - next : "line_comment_regex_allowed" - }, { - token: "string.regexp", - regex: "\\/", - next: "regex" - }, { - token : "text", - regex : "\\s+|^$", - next : "start" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "regex": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "string.regexp", - regex: "/\\w*", - next: "no_regex" - }, { - token : "invalid", - regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ - }, { - token : "constant.language.escape", - regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/ - }, { - token : "constant.language.delimiter", - regex: /\|/ - }, { - token: "constant.language.escape", - regex: /\[\^?/, - next: "regex_character_class" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp" - } - ], - "regex_character_class": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "constant.language.escape", - regex: "]", - next: "regex" - }, { - token: "constant.language.escape", - regex: "-" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp.charachterclass" - } - ], - "function_arguments": [ - { - token: "variable.parameter", - regex: identifierRe - }, { - token: "punctuation.operator", - regex: "[, ]+" - }, { - token: "punctuation.operator", - regex: "$" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "comment_regex_allowed" : [ - {token : "comment", regex : "\\*\\/", next : "start"}, - {defaultToken : "comment"} - ], - "comment" : [ - {token : "comment", regex : "\\*\\/", next : "no_regex"}, - {defaultToken : "comment"} - ], - "line_comment_regex_allowed" : [ - {token : "comment", regex : "$|^", next : "start"}, - {defaultToken : "comment"} - ], - "line_comment" : [ - {token : "comment", regex : "$|^", next : "no_regex"}, - {defaultToken : "comment"} - ], - "qqstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qqstring" - }, { - token : "string", - regex : '"|$', - next : "no_regex" - }, { - defaultToken: "string" - } - ], - "qstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qstring" - }, { - token : "string", - regex : "'|$", - next : "no_regex" - }, { - defaultToken: "string" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("no_regex") ]); -}; - -oop.inherits(JavaScriptHighlightRules, TextHighlightRules); - -exports.JavaScriptHighlightRules = JavaScriptHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/xml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml_util', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var xmlUtil = require("./xml_util"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var XmlHighlightRules = function(normalize) { - this.$rules = { - start : [ - {token : "punctuation.string.begin", regex : "<\\!\\[CDATA\\[", next : "cdata"}, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)(xml)(?=[\\s])", next : "xml_declaration" - }, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)([-_a-zA-Z0-9]+)", next : "instruction" - }, - {token : "comment", regex : "<\\!--", next : "comment"}, - { - token : ["punctuation.doctype.begin", "meta.tag.doctype"], - regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype" - }, - {include : "tag"}, - {include : "reference"} - ], - - xml_declaration : [ - {include : "attributes"}, - {include : "instruction"} - ], - - instruction : [ - {token : "punctuation.instruction.end", regex : "\\?>", next : "start"} - ], - - doctype : [ - {include : "space"}, - {include : "string"}, - {token : "punctuation.doctype.end", regex : ">", next : "start"}, - {token : "xml-pe", regex : "[-_a-zA-Z0-9:]+"}, - {token : "punctuation.begin", regex : "\\[", push : "declarations"} - ], - - declarations : [{ - token : "text", - regex : "\\s+" - }, { - token: "punctuation.end", - regex: "]", - next: "pop" - }, { - token : ["punctuation.begin", "keyword"], - regex : "(<\\!)([-_a-zA-Z0-9]+)", - push : [{ - token : "text", - regex : "\\s+" - }, - { - token : "punctuation.end", - regex : ">", - next : "pop" - }, - {include : "string"}] - }], - - cdata : [ - {token : "string.end", regex : "\\]\\]>", next : "start"}, - {token : "text", regex : "\\s+"}, - {token : "text", regex : "(?:[^\\]]|\\](?!\\]>))+"} - ], - - comment : [ - {token : "comment", regex : "-->", next : "start"}, - {defaultToken : "comment"} - ], - - tag : [{ - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(<)((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)", - next: [ - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : "start"} - ] - }, { - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(", next : "start"} - ] - }], - - space : [ - {token : "text", regex : "\\s+"} - ], - - reference : [{ - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, { - token : "invalid.illegal", regex : "&" - }], - - string: [{ - token : "string", - regex : "'", - push : "qstring_inner" - }, { - token : "string", - regex : '"', - push : "qqstring_inner" - }], - - qstring_inner: [ - {token : "string", regex: "'", next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - qqstring_inner: [ - {token : "string", regex: '"', next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - attributes: [{ - token : "entity.other.attribute-name", - regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+" - }, { - token : "keyword.operator.separator", - regex : "=" - }, { - include : "space" - }, { - include : "string" - }] - }; - - if (this.constructor === XmlHighlightRules) - this.normalizeRules(); -}; - - -(function() { - - this.embedTagRules = function(HighlightRules, prefix, tag){ - this.$rules.tag.unshift({ - token : ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(<)(" + tag + ")", - next: [ - {include : "space"}, - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : prefix + "start"} - ] - }); - - this.$rules[tag + "-end"] = [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next: "start", - onMatch : function(value, currentState, stack) { - stack.splice(0); - return this.token; - }} - ] - - this.embedRules(HighlightRules, prefix, [{ - token: ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(" - }]); - }; - -}).call(TextHighlightRules.prototype); - -oop.inherits(XmlHighlightRules, TextHighlightRules); - -exports.XmlHighlightRules = XmlHighlightRules; -}); - -define('ace/mode/xml_util', ['require', 'exports', 'module' ], function(require, exports, module) { - - -function string(state) { - return [{ - token : "string", - regex : '"', - next : state + "_qqstring" - }, { - token : "string", - regex : "'", - next : state + "_qstring" - }]; -} - -function multiLineString(quote, state) { - return [ - {token : "string", regex : quote, next : state}, - { - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, - {defaultToken : "string"} - ]; -} - -exports.tag = function(states, name, nextState, tagMap) { - states[name] = [{ - token : "text", - regex : "\\s+" - }, { - - token : !tagMap ? "meta.tag.tag-name" : function(value) { - if (tagMap[value]) - return "meta.tag.tag-name." + tagMap[value]; - else - return "meta.tag.tag-name"; - }, - regex : "[-_a-zA-Z0-9:]+", - next : name + "_embed_attribute_list" - }, { - token: "empty", - regex: "", - next : 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"] = [{ - token : "meta.tag.r", - regex : "/?>", - next : nextState - }, { - token : "keyword.operator", - regex : "=" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "text", - regex : "\\s+" - }].concat(string(name)); -}; - -}); diff --git a/addons/editor/ace/mode-glsl.js b/addons/editor/ace/mode-glsl.js deleted file mode 100644 index 07f9e64e..00000000 --- a/addons/editor/ace/mode-glsl.js +++ /dev/null @@ -1,813 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2010, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/mode/glsl', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/c_cpp', 'ace/tokenizer', 'ace/mode/glsl_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var CMode = require("./c_cpp").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var glslHighlightRules = require("./glsl_highlight_rules").glslHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var Range = require("../range").Range; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = glslHighlightRules; - - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, CMode); - -exports.Mode = Mode; -}); - -define('ace/mode/c_cpp', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/c_cpp_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var Range = require("../range").Range; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = c_cppHighlightRules; - - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().getLineTokens(line, state); - var tokens = tokenizedLine.tokens; - var endState = tokenizedLine.state; - - if (tokens.length && tokens[tokens.length-1].type == "comment") { - return indent; - } - - if (state == "start") { - var match = line.match(/^.*[\{\(\[]\s*$/); - if (match) { - indent += tab; - } - } else if (state == "doc-start") { - if (endState == "start") { - return ""; - } - var match = line.match(/^\s*(\/?)\*/); - if (match) { - if (match[1]) { - indent += " "; - } - indent += "* "; - } - } - - 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; -}); -define('ace/mode/c_cpp_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var cFunctions = exports.cFunctions = "\\s*\\bhypot(?:f|l)?|s(?:scanf|ystem|nprintf|ca(?:nf|lb(?:n(?:f|l)?|ln(?:f|l)?))|i(?:n(?:h(?:f|l)?|f|l)?|gn(?:al|bit))|tr(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(?:jmp|vbuf|locale|buf)|qrt(?:f|l)?|w(?:scanf|printf)|rand)|n(?:e(?:arbyint(?:f|l)?|xt(?:toward(?:f|l)?|after(?:f|l)?))|an(?:f|l)?)|c(?:s(?:in(?:h(?:f|l)?|f|l)?|qrt(?:f|l)?)|cos(?:h(?:f)?|f|l)?|imag(?:f|l)?|t(?:ime|an(?:h(?:f|l)?|f|l)?)|o(?:s(?:h(?:f|l)?|f|l)?|nj(?:f|l)?|pysign(?:f|l)?)|p(?:ow(?:f|l)?|roj(?:f|l)?)|e(?:il(?:f|l)?|xp(?:f|l)?)|l(?:o(?:ck|g(?:f|l)?)|earerr)|a(?:sin(?:h(?:f|l)?|f|l)?|cos(?:h(?:f|l)?|f|l)?|tan(?:h(?:f|l)?|f|l)?|lloc|rg(?:f|l)?|bs(?:f|l)?)|real(?:f|l)?|brt(?:f|l)?)|t(?:ime|o(?:upper|lower)|an(?:h(?:f|l)?|f|l)?|runc(?:f|l)?|gamma(?:f|l)?|mp(?:nam|file))|i(?:s(?:space|n(?:ormal|an)|cntrl|inf|digit|u(?:nordered|pper)|p(?:unct|rint)|finite|w(?:space|c(?:ntrl|type)|digit|upper|p(?:unct|rint)|lower|al(?:num|pha)|graph|xdigit|blank)|l(?:ower|ess(?:equal|greater)?)|al(?:num|pha)|gr(?:eater(?:equal)?|aph)|xdigit|blank)|logb(?:f|l)?|max(?:div|abs))|di(?:v|fftime)|_Exit|unget(?:c|wc)|p(?:ow(?:f|l)?|ut(?:s|c(?:har)?|wc(?:har)?)|error|rintf)|e(?:rf(?:c(?:f|l)?|f|l)?|x(?:it|p(?:2(?:f|l)?|f|l|m1(?:f|l)?)?))|v(?:s(?:scanf|nprintf|canf|printf|w(?:scanf|printf))|printf|f(?:scanf|printf|w(?:scanf|printf))|w(?:scanf|printf)|a_(?:start|copy|end|arg))|qsort|f(?:s(?:canf|e(?:tpos|ek))|close|tell|open|dim(?:f|l)?|p(?:classify|ut(?:s|c|w(?:s|c))|rintf)|e(?:holdexcept|set(?:e(?:nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(?:aiseexcept|ror)|get(?:e(?:nv|xceptflag)|round))|flush|w(?:scanf|ide|printf|rite)|loor(?:f|l)?|abs(?:f|l)?|get(?:s|c|pos|w(?:s|c))|re(?:open|e|ad|xp(?:f|l)?)|m(?:in(?:f|l)?|od(?:f|l)?|a(?:f|l|x(?:f|l)?)?))|l(?:d(?:iv|exp(?:f|l)?)|o(?:ngjmp|cal(?:time|econv)|g(?:1(?:p(?:f|l)?|0(?:f|l)?)|2(?:f|l)?|f|l|b(?:f|l)?)?)|abs|l(?:div|abs|r(?:int(?:f|l)?|ound(?:f|l)?))|r(?:int(?:f|l)?|ound(?:f|l)?)|gamma(?:f|l)?)|w(?:scanf|c(?:s(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?|mbs)|pbrk|ftime|len|r(?:chr|tombs)|xfrm)|to(?:b|mb)|rtomb)|printf|mem(?:set|c(?:hr|py|mp)|move))|a(?:s(?:sert|ctime|in(?:h(?:f|l)?|f|l)?)|cos(?:h(?:f|l)?|f|l)?|t(?:o(?:i|f|l(?:l)?)|exit|an(?:h(?:f|l)?|2(?:f|l)?|f|l)?)|b(?:s|ort))|g(?:et(?:s|c(?:har)?|env|wc(?:har)?)|mtime)|r(?:int(?:f|l)?|ound(?:f|l)?|e(?:name|alloc|wind|m(?:ove|quo(?:f|l)?|ainder(?:f|l)?))|a(?:nd|ise))|b(?:search|towc)|m(?:odf(?:f|l)?|em(?:set|c(?:hr|py|mp)|move)|ktime|alloc|b(?:s(?:init|towcs|rtowcs)|towc|len|r(?:towc|len)))\\b" - -var c_cppHighlightRules = function() { - - var keywordControls = ( - "break|case|continue|default|do|else|for|goto|if|_Pragma|" + - "return|switch|while|catch|operator|try|throw|using" - ); - - var storageType = ( - "asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" + - "_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|" + - "class|wchar_t|template" - ); - - var storageModifiers = ( - "const|extern|register|restrict|static|volatile|inline|private:|" + - "protected:|public:|friend|explicit|virtual|export|mutable|typename" - ); - - var keywordOperators = ( - "and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq" + - "const_cast|dynamic_cast|reinterpret_cast|static_cast|sizeof|namespace" - ); - - var builtinConstants = ( - "NULL|true|false|TRUE|FALSE" - ); - - var keywordMapper = this.$keywords = this.createKeywordMapper({ - "keyword.control" : keywordControls, - "storage.type" : storageType, - "storage.modifier" : storageModifiers, - "keyword.operator" : keywordOperators, - "variable.language": "this", - "constant.language": builtinConstants - }, "identifier"); - - var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\d\\$_\u00a1-\uffff]*\\b"; - - this.$rules = { - "start" : [ - { - token : "comment", - regex : "\\/\\/.*$" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // multi line string start - regex : '["].*\\\\$', - next : "qqstring" - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - token : "string", // multi line string start - regex : "['].*\\\\$", - next : "qstring" - }, { - token : "constant.numeric", // hex - regex : "0[xX][0-9a-fA-F]+(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b" - }, { - token : "keyword", // pre-compiler directives - regex : "#\\s*(?:include|import|pragma|line|define|undef|if|ifdef|else|elif|ifndef)\\b", - next : "directive" - }, { - token : "keyword", // special case pre-compiler directive - regex : "(?:#\\s*endif)\\b" - }, { - token : "support.function.C99.c", - regex : cFunctions - }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" - }, { - token : "keyword.operator", - regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)" - }, { - token : "punctuation.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 - regex : ".+" - } - ], - "qqstring" : [ - { - token : "string", - regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"', - next : "start" - }, { - token : "string", - regex : '.+' - } - ], - "qstring" : [ - { - token : "string", - regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'", - next : "start" - }, { - token : "string", - regex : '.+' - } - ], - "directive" : [ - { - token : "constant.other.multiline", - regex : /\\/ - }, - { - token : "constant.other.multiline", - regex : /.*\\/ - }, - { - token : "constant.other", - regex : "\\s*<.+?>", - next : "start" - }, - { - token : "constant.other", // single line - regex : '\\s*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]', - next : "start" - }, - { - token : "constant.other", // single line - regex : "\\s*['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']", - next : "start" - }, - { - token : "constant.other", - regex : /[^\\\/]+/, - next : "start" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("start") ]); -}; - -oop.inherits(c_cppHighlightRules, TextHighlightRules); - -exports.c_cppHighlightRules = c_cppHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); - -define('ace/mode/glsl_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/c_cpp_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules; - -var glslHighlightRules = function() { - - var keywords = ( - "attribute|const|uniform|varying|break|continue|do|for|while|" + - "if|else|in|out|inout|float|int|void|bool|true|false|" + - "lowp|mediump|highp|precision|invariant|discard|return|mat2|mat3|" + - "mat4|vec2|vec3|vec4|ivec2|ivec3|ivec4|bvec2|bvec3|bvec4|sampler2D|" + - "samplerCube|struct" - ); - - var buildinConstants = ( - "radians|degrees|sin|cos|tan|asin|acos|atan|pow|" + - "exp|log|exp2|log2|sqrt|inversesqrt|abs|sign|floor|ceil|fract|mod|" + - "min|max|clamp|mix|step|smoothstep|length|distance|dot|cross|" + - "normalize|faceforward|reflect|refract|matrixCompMult|lessThan|" + - "lessThanEqual|greaterThan|greaterThanEqual|equal|notEqual|any|all|" + - "not|dFdx|dFdy|fwidth|texture2D|texture2DProj|texture2DLod|" + - "texture2DProjLod|textureCube|textureCubeLod|" + - "gl_MaxVertexAttribs|gl_MaxVertexUniformVectors|gl_MaxVaryingVectors|" + - "gl_MaxVertexTextureImageUnits|gl_MaxCombinedTextureImageUnits|" + - "gl_MaxTextureImageUnits|gl_MaxFragmentUniformVectors|gl_MaxDrawBuffers|" + - "gl_DepthRangeParameters|gl_DepthRange|" + - "gl_Position|gl_PointSize|" + - "gl_FragCoord|gl_FrontFacing|gl_PointCoord|gl_FragColor|gl_FragData" - ); - - var keywordMapper = this.createKeywordMapper({ - "variable.language": "this", - "keyword": keywords, - "constant.language": buildinConstants - }, "identifier"); - - this.$rules = new c_cppHighlightRules().$rules; - this.$rules.start.forEach(function(rule) { - if (typeof rule.token == "function") - rule.token = keywordMapper; - }) -}; - -oop.inherits(glslHighlightRules, c_cppHighlightRules); - -exports.glslHighlightRules = glslHighlightRules; -}); diff --git a/addons/editor/ace/mode-golang.js b/addons/editor/ace/mode-golang.js deleted file mode 100644 index 8ca0e7b4..00000000 --- a/addons/editor/ace/mode-golang.js +++ /dev/null @@ -1,627 +0,0 @@ -define('ace/mode/golang', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/golang_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) { - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var GolangHighlightRules = require("./golang_highlight_rules").GolangHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = GolangHighlightRules; - this.$outdent = new MatchingBraceOutdent(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().getLineTokens(line, state); - var tokens = tokenizedLine.tokens; - var endState = tokenizedLine.state; - - 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; - };//end getNextLineIndent - - 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; -}); -define('ace/mode/golang_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - var oop = require("../lib/oop"); - var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; - var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - - var GolangHighlightRules = function() { - var keywords = ( - "else|break|case|return|goto|if|const|select|" + - "continue|struct|default|switch|for|range|" + - "func|import|package|chan|defer|fallthrough|go|interface|map|range|" + - "select|type|var" - ); - var builtinTypes = ( - "string|uint8|uint16|uint32|uint64|int8|int16|int32|int64|float32|" + - "float64|complex64|complex128|byte|rune|uint|int|uintptr|bool|error" - ); - var builtinFunctions = ( - "make|close|new|panic|recover" - ); - var builtinConstants = ("nil|true|false|iota"); - - var keywordMapper = this.createKeywordMapper({ - "keyword": keywords, - "constant.language": builtinConstants, - "support.function": builtinFunctions, - "support.type": builtinTypes - }, "identifier"); - - this.$rules = { - "start" : [ - { - token : "comment", - regex : "\\/\\/.*$" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // single line - regex : '[`](?:[^`]*)[`]' - }, { - token : "string", // multi line string start - merge : true, - regex : '[`](?:[^`]*)$', - next : "bqstring" - }, { - token : "constant.numeric", // rune - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))[']" - }, { - token : "constant.numeric", // hex - regex : "0[xX][0-9a-fA-F]+\\b" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" - }, { - token : "keyword.operator", - regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=" - }, { - token : "punctuation.operator", - regex : "\\?|\\:|\\,|\\;|\\." - }, { - token : "paren.lparen", - regex : "[[({]" - }, { - token : "paren.rparen", - regex : "[\\])}]" - }, { - token: "invalid", - regex: "\\s+$" - }, { - token : "text", - regex : "\\s+" - } - ], - "comment" : [ - { - token : "comment", // closing comment - regex : ".*?\\*\\/", - next : "start" - }, { - token : "comment", // comment spanning whole line - regex : ".+" - } - ], - "bqstring" : [ - { - token : "string", - regex : '(?:[^`]*)`', - next : "start" - }, { - token : "string", - regex : '.+' - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("start") ]); - }; - oop.inherits(GolangHighlightRules, TextHighlightRules); - - exports.GolangHighlightRules = GolangHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); diff --git a/addons/editor/ace/mode-groovy.js b/addons/editor/ace/mode-groovy.js deleted file mode 100644 index 725479f1..00000000 --- a/addons/editor/ace/mode-groovy.js +++ /dev/null @@ -1,1047 +0,0 @@ -define('ace/mode/groovy', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/javascript', 'ace/tokenizer', 'ace/mode/groovy_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var JavaScriptMode = require("./javascript").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var GroovyHighlightRules = require("./groovy_highlight_rules").GroovyHighlightRules; - -var Mode = function() { - JavaScriptMode.call(this); - this.HighlightRules = GroovyHighlightRules; -}; -oop.inherits(Mode, JavaScriptMode); - -(function() { - - this.createWorker = function(session) { - return null; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/javascript', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/javascript_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/worker/worker_client', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var Range = require("../range").Range; -var WorkerClient = require("../worker/worker_client").WorkerClient; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = JavaScriptHighlightRules; - - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().getLineTokens(line, state); - var tokens = tokenizedLine.tokens; - var endState = tokenizedLine.state; - - if (tokens.length && tokens[tokens.length-1].type == "comment") { - return indent; - } - - if (state == "start" || state == "no_regex") { - var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/); - if (match) { - indent += tab; - } - } else if (state == "doc-start") { - if (endState == "start" || endState == "no_regex") { - return ""; - } - var match = line.match(/^\s*(\/?)\*/); - if (match) { - if (match[1]) { - indent += " "; - } - indent += "* "; - } - } - - 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); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker"); - worker.attachToDocument(session.getDocument()); - - worker.on("jslint", function(results) { - session.setAnnotations(results.data); - }); - - worker.on("terminate", function() { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var JavaScriptHighlightRules = function() { - var keywordMapper = this.createKeywordMapper({ - "variable.language": - "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors - "Namespace|QName|XML|XMLList|" + // E4X - "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + - "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + - "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors - "SyntaxError|TypeError|URIError|" + - "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions - "isNaN|parseFloat|parseInt|" + - "JSON|Math|" + // Other - "this|arguments|prototype|window|document" , // Pseudo - "keyword": - "const|yield|import|get|set|" + - "break|case|catch|continue|default|delete|do|else|finally|for|function|" + - "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + - "__parent__|__count__|escape|unescape|with|__proto__|" + - "class|enum|extends|super|export|implements|private|public|interface|package|protected|static", - "storage.type": - "const|let|var|function", - "constant.language": - "null|Infinity|NaN|undefined", - "support.function": - "alert", - "constant.language.boolean": "true|false" - }, "identifier"); - var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; - var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\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 - ".)"; - - this.$rules = { - "no_regex" : [ - { - token : "comment", - regex : "\\/\\/", - next : "line_comment" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : /\/\*/, - next : "comment" - }, { - token : "string", - regex : "'(?=.)", - next : "qstring" - }, { - token : "string", - regex : '"(?=.)', - next : "qqstring" - }, { - token : "constant.numeric", // hex - regex : /0[xX][0-9a-fA-F]+\b/ - }, { - token : "constant.numeric", // float - regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/ - }, { - token : [ - "storage.type", "punctuation.operator", "support.function", - "punctuation.operator", "entity.name.function", "text","keyword.operator" - ], - regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "keyword.operator", "text", "storage.type", - "text", "paren.lparen" - ], - regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "punctuation.operator", - "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "text", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : "keyword", - regex : "(?:" + kwBeforeRe + ")\\b", - next : "start" - }, { - token : ["punctuation.operator", "support.function"], - regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/ - }, { - token : ["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 : keywordMapper, - regex : identifierRe - }, { - token : "keyword.operator", - regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/, - next : "start" - }, { - token : "punctuation.operator", - regex : /\?|\:|\,|\;|\./, - next : "start" - }, { - token : "paren.lparen", - regex : /[\[({]/, - next : "start" - }, { - token : "paren.rparen", - regex : /[\])}]/ - }, { - token : "keyword.operator", - regex : /\/=?/, - next : "start" - }, { - token: "comment", - regex: /^#!.*$/ - } - ], - "start": [ - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment_regex_allowed" - }, { - token : "comment", - regex : "\\/\\/", - next : "line_comment_regex_allowed" - }, { - token: "string.regexp", - regex: "\\/", - next: "regex" - }, { - token : "text", - regex : "\\s+|^$", - next : "start" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "regex": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "string.regexp", - regex: "/\\w*", - next: "no_regex" - }, { - token : "invalid", - regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ - }, { - token : "constant.language.escape", - regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/ - }, { - token : "constant.language.delimiter", - regex: /\|/ - }, { - token: "constant.language.escape", - regex: /\[\^?/, - next: "regex_character_class" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp" - } - ], - "regex_character_class": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "constant.language.escape", - regex: "]", - next: "regex" - }, { - token: "constant.language.escape", - regex: "-" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp.charachterclass" - } - ], - "function_arguments": [ - { - token: "variable.parameter", - regex: identifierRe - }, { - token: "punctuation.operator", - regex: "[, ]+" - }, { - token: "punctuation.operator", - regex: "$" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "comment_regex_allowed" : [ - {token : "comment", regex : "\\*\\/", next : "start"}, - {defaultToken : "comment"} - ], - "comment" : [ - {token : "comment", regex : "\\*\\/", next : "no_regex"}, - {defaultToken : "comment"} - ], - "line_comment_regex_allowed" : [ - {token : "comment", regex : "$|^", next : "start"}, - {defaultToken : "comment"} - ], - "line_comment" : [ - {token : "comment", regex : "$|^", next : "no_regex"}, - {defaultToken : "comment"} - ], - "qqstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qqstring" - }, { - token : "string", - regex : '"|$', - next : "no_regex" - }, { - defaultToken: "string" - } - ], - "qstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qstring" - }, { - token : "string", - regex : "'|$", - next : "no_regex" - }, { - defaultToken: "string" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("no_regex") ]); -}; - -oop.inherits(JavaScriptHighlightRules, TextHighlightRules); - -exports.JavaScriptHighlightRules = JavaScriptHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); -define('ace/mode/groovy_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var GroovyHighlightRules = function() { - - var keywords = ( - "assert|with|abstract|continue|for|new|switch|" + - "assert|default|goto|package|synchronized|" + - "boolean|do|if|private|this|" + - "break|double|implements|protected|throw|" + - "byte|else|import|public|throws|" + - "case|enum|instanceof|return|transient|" + - "catch|extends|int|short|try|" + - "char|final|interface|static|void|" + - "class|finally|long|strictfp|volatile|" + - "def|float|native|super|while" - ); - - var buildinConstants = ( - "null|Infinity|NaN|undefined" - ); - - var langClasses = ( - "AbstractMethodError|AssertionError|ClassCircularityError|"+ - "ClassFormatError|Deprecated|EnumConstantNotPresentException|"+ - "ExceptionInInitializerError|IllegalAccessError|"+ - "IllegalThreadStateException|InstantiationError|InternalError|"+ - "NegativeArraySizeException|NoSuchFieldError|Override|Process|"+ - "ProcessBuilder|SecurityManager|StringIndexOutOfBoundsException|"+ - "SuppressWarnings|TypeNotPresentException|UnknownError|"+ - "UnsatisfiedLinkError|UnsupportedClassVersionError|VerifyError|"+ - "InstantiationException|IndexOutOfBoundsException|"+ - "ArrayIndexOutOfBoundsException|CloneNotSupportedException|"+ - "NoSuchFieldException|IllegalArgumentException|NumberFormatException|"+ - "SecurityException|Void|InheritableThreadLocal|IllegalStateException|"+ - "InterruptedException|NoSuchMethodException|IllegalAccessException|"+ - "UnsupportedOperationException|Enum|StrictMath|Package|Compiler|"+ - "Readable|Runtime|StringBuilder|Math|IncompatibleClassChangeError|"+ - "NoSuchMethodError|ThreadLocal|RuntimePermission|ArithmeticException|"+ - "NullPointerException|Long|Integer|Short|Byte|Double|Number|Float|"+ - "Character|Boolean|StackTraceElement|Appendable|StringBuffer|"+ - "Iterable|ThreadGroup|Runnable|Thread|IllegalMonitorStateException|"+ - "StackOverflowError|OutOfMemoryError|VirtualMachineError|"+ - "ArrayStoreException|ClassCastException|LinkageError|"+ - "NoClassDefFoundError|ClassNotFoundException|RuntimeException|"+ - "Exception|ThreadDeath|Error|Throwable|System|ClassLoader|"+ - "Cloneable|Class|CharSequence|Comparable|String|Object" - ); - - var keywordMapper = this.createKeywordMapper({ - "variable.language": "this", - "keyword": keywords, - "support.function": langClasses, - "constant.language": buildinConstants - }, "identifier"); - - this.$rules = { - "start" : [ - { - token : "comment", - regex : "\\/\\/.*$" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment" - }, { - token : "string.regexp", - regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" - }, { - token : "string", - regex : '"""', - next : "qqstring" - }, { - token : "string", - regex : "'''", - next : "qstring" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - token : "constant.numeric", // hex - regex : "0[xX][0-9a-fA-F]+\\b" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "constant.language.boolean", - regex : "(?:true|false)\\b" - }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" - }, { - token : "keyword.operator", - regex : "\\?:|\\?\\.|\\*\\.|<=>|=~|==~|\\.@|\\*\\.@|\\.&|as|in|is|!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" - }, { - token : "lparen", - regex : "[[({]" - }, { - token : "rparen", - regex : "[\\])}]" - }, { - token : "text", - regex : "\\s+" - } - ], - "comment" : [ - { - token : "comment", // closing comment - regex : ".*?\\*\\/", - next : "start" - }, { - token : "comment", // comment spanning whole line - regex : ".+" - } - ], - "qqstring" : [ - { - token : "constant.language.escape", - regex : /\\(?:u[0-9A-Fa-f]{4}|.|$)/ - }, { - token : "constant.language.escape", - regex : /\$[\w\d]+/ - }, { - token : "constant.language.escape", - regex : /\$\{[^"\}]+\}?/ - }, { - token : "string", - regex : '"{3,5}', - next : "start" - }, { - token : "string", - regex : '.+?' - } - ], - "qstring" : [ - { - token : "constant.language.escape", - regex : /\\(?:u[0-9A-Fa-f]{4}|.|$)/ - }, { - token : "string", - regex : "'{3,5}", - next : "start" - }, { - token : "string", - regex : ".+?" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("start") ]); -}; - -oop.inherits(GroovyHighlightRules, TextHighlightRules); - -exports.GroovyHighlightRules = GroovyHighlightRules; -}); diff --git a/addons/editor/ace/mode-haml.js b/addons/editor/ace/mode-haml.js deleted file mode 100644 index b6efc784..00000000 --- a/addons/editor/ace/mode-haml.js +++ /dev/null @@ -1,485 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2012, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * Contributor(s): - * - * Garen J. Torikian < gjtorikian AT gmail DOT com > - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/mode/haml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/haml_highlight_rules', 'ace/mode/folding/coffee'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var HamlHighlightRules = require("./haml_highlight_rules").HamlHighlightRules; -var FoldMode = require("./folding/coffee").FoldMode; - -var Mode = function() { - this.HighlightRules = HamlHighlightRules; - this.foldingRules = new FoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - this.lineCommentStart = ["//", "#"]; - -}).call(Mode.prototype); - -exports.Mode = Mode; -});define('ace/mode/haml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules', 'ace/mode/ruby_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var RubyExports = require("./ruby_highlight_rules"); -var RubyHighlightRules = RubyExports.RubyHighlightRules; - -var HamlHighlightRules = function() { - - this.$rules = - { - "start": [ - { - token : "punctuation.section.comment", - regex : /^\s*\/.*/ - }, - { - token : "punctuation.section.comment", - regex : /^\s*#.*/ - }, - { - token: "string.quoted.double", - regex: "==.+?==" - }, - { - token: "keyword.other.doctype", - regex: "^!!!\\s*(?:[a-zA-Z0-9-_]+)?" - }, - RubyExports.qString, - RubyExports.qqString, - RubyExports.tString, - { - token: ["entity.name.tag.haml"], - regex: /^\s*%[\w:]+/, - next: "tag_single" - }, - { - token: [ "meta.escape.haml" ], - regex: "^\\s*\\\\." - }, - RubyExports.constantNumericHex, - RubyExports.constantNumericFloat, - - RubyExports.constantOtherSymbol, - { - token: "text", - regex: "=|-|~", - next: "embedded_ruby" - } - ], - "tag_single": [ - { - token: "entity.other.attribute-name.class.haml", - regex: "\\.[\\w-]+" - }, - { - token: "entity.other.attribute-name.id.haml", - regex: "#[\\w-]+" - }, - { - token: "punctuation.section", - regex: "\\{", - next: "section" - }, - - RubyExports.constantOtherSymbol, - - { - token: "text", - regex: /\s/, - next: "start" - }, - { - token: "empty", - regex: "$|(?!\\.|#|\\{|\\[|=|-|~|\\/)", - next: "start" - } - ], - "section": [ - RubyExports.constantOtherSymbol, - - RubyExports.qString, - RubyExports.qqString, - RubyExports.tString, - - RubyExports.constantNumericHex, - RubyExports.constantNumericFloat, - { - token: "punctuation.section", - regex: "\\}", - next: "start" - } - ], - "embedded_ruby": [ - RubyExports.constantNumericHex, - RubyExports.constantNumericFloat, - { - token : "support.class", // class name - regex : "[A-Z][a-zA-Z_\\d]+" - }, - { - token : new RubyHighlightRules().getKeywords(), - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" - }, - { - token : ["keyword", "text", "text"], - regex : "(?:do|\\{)(?: \\|[^|]+\\|)?$", - next : "start" - }, - { - token : ["text"], - regex : "^$", - next : "start" - }, - { - token : ["text"], - regex : "^(?!.*\\|\\s*$)", - next : "start" - } - ] -} - -}; - -oop.inherits(HamlHighlightRules, TextHighlightRules); - -exports.HamlHighlightRules = HamlHighlightRules; -}); - -define('ace/mode/ruby_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var constantOtherSymbol = exports.constantOtherSymbol = { - token : "constant.other.symbol.ruby", // symbol - regex : "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?" -}; - -var qString = exports.qString = { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" -}; - -var qqString = exports.qqString = { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' -}; - -var tString = exports.tString = { - token : "string", // backtick string - regex : "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]" -}; - -var constantNumericHex = exports.constantNumericHex = { - token : "constant.numeric", // hex - regex : "0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b" -}; - -var constantNumericFloat = exports.constantNumericFloat = { - token : "constant.numeric", // float - regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?\\b" -}; - -var RubyHighlightRules = function() { - - var builtinFunctions = ( - "abort|Array|assert|assert_equal|assert_not_equal|assert_same|assert_not_same|" + - "assert_nil|assert_not_nil|assert_match|assert_no_match|assert_in_delta|assert_throws|" + - "assert_raise|assert_nothing_raised|assert_instance_of|assert_kind_of|assert_respond_to|" + - "assert_operator|assert_send|assert_difference|assert_no_difference|assert_recognizes|" + - "assert_generates|assert_response|assert_redirected_to|assert_template|assert_select|" + - "assert_select_email|assert_select_rjs|assert_select_encoded|css_select|at_exit|" + - "attr|attr_writer|attr_reader|attr_accessor|attr_accessible|autoload|binding|block_given?|callcc|" + - "caller|catch|chomp|chomp!|chop|chop!|defined?|delete_via_redirect|eval|exec|exit|" + - "exit!|fail|Float|flunk|follow_redirect!|fork|form_for|form_tag|format|gets|global_variables|gsub|" + - "gsub!|get_via_redirect|host!|https?|https!|include|Integer|lambda|link_to|" + - "link_to_unless_current|link_to_function|link_to_remote|load|local_variables|loop|open|open_session|" + - "p|print|printf|proc|putc|puts|post_via_redirect|put_via_redirect|raise|rand|" + - "raw|readline|readlines|redirect?|request_via_redirect|require|scan|select|" + - "set_trace_func|sleep|split|sprintf|srand|String|stylesheet_link_tag|syscall|system|sub|sub!|test|" + - "throw|trace_var|trap|untrace_var|atan2|cos|exp|frexp|ldexp|log|log10|sin|sqrt|tan|" + - "render|javascript_include_tag|csrf_meta_tag|label_tag|text_field_tag|submit_tag|check_box_tag|" + - "content_tag|radio_button_tag|text_area_tag|password_field_tag|hidden_field_tag|" + - "fields_for|select_tag|options_for_select|options_from_collection_for_select|collection_select|" + - "time_zone_select|select_date|select_time|select_datetime|date_select|time_select|datetime_select|" + - "select_year|select_month|select_day|select_hour|select_minute|select_second|file_field_tag|" + - "file_field|respond_to|skip_before_filter|around_filter|after_filter|verify|" + - "protect_from_forgery|rescue_from|helper_method|redirect_to|before_filter|" + - "send_data|send_file|validates_presence_of|validates_uniqueness_of|validates_length_of|" + - "validates_format_of|validates_acceptance_of|validates_associated|validates_exclusion_of|" + - "validates_inclusion_of|validates_numericality_of|validates_with|validates_each|" + - "authenticate_or_request_with_http_basic|authenticate_or_request_with_http_digest|" + - "filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" + - "translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|" + - "cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" + - "has_many|has_one|belongs_to|has_and_belongs_to_many" - ); - - var keywords = ( - "alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" + - "__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" + - "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield" - ); - - var buildinConstants = ( - "true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" + - "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING" - ); - - var builtinVariables = ( - "\$DEBUG|\$defout|\$FILENAME|\$LOAD_PATH|\$SAFE|\$stdin|\$stdout|\$stderr|\$VERBOSE|" + - "$!|root_url|flash|session|cookies|params|request|response|logger|self" - ); - - var keywordMapper = this.$keywords = this.createKeywordMapper({ - "keyword": keywords, - "constant.language": buildinConstants, - "variable.language": builtinVariables, - "support.function": builtinFunctions, - "invalid.deprecated": "debugger" // TODO is this a remnant from js mode? - }, "identifier"); - - this.$rules = { - "start" : [ - { - token : "comment", - regex : "#.*$" - }, { - token : "comment", // multi line comment - regex : "^=begin(?:$|\\s.*$)", - next : "comment" - }, { - token : "string.regexp", - regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" - }, - - qString, - qqString, - tString, - - { - token : "text", // namespaces aren't symbols - regex : "::" - }, { - token : "variable.instance", // instance variable - regex : "@{1,2}[a-zA-Z_\\d]+" - }, { - token : "support.class", // class name - regex : "[A-Z][a-zA-Z_\\d]+" - }, - - constantOtherSymbol, - constantNumericHex, - constantNumericFloat, - - { - token : "constant.language.boolean", - regex : "(?:true|false)\\b" - }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" - }, { - token : "punctuation.separator.key-value", - regex : "=>" - }, { - stateName: "heredoc", - onMatch : function(value, currentState, stack) { - var next = value[2] == '-' ? "indentedHeredoc" : "heredoc"; - var tokens = value.split(this.splitRegex); - stack.push(next, tokens[3]); - return [ - {type:"constant", value: tokens[1]}, - {type:"string", value: tokens[2]}, - {type:"support.class", value: tokens[3]}, - {type:"string", value: tokens[4]} - ]; - }, - regex : "(<<-?)(['\"`]?)([\\w]+)(['\"`]?)", - rules: { - heredoc: [{ - onMatch: function(value, currentState, stack) { - if (value == stack[1]) { - stack.shift(); - stack.shift(); - return "support.class"; - } - return "string"; - }, - regex: ".*$", - next: "start" - }], - indentedHeredoc: [{ - token: "string", - regex: "^ +" - }, { - onMatch: function(value, currentState, stack) { - if (value == stack[1]) { - stack.shift(); - stack.shift(); - return "support.class"; - } - return "string"; - }, - regex: ".*$", - next: "start" - }] - } - }, { - token : "keyword.operator", - regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" - }, { - token : "paren.lparen", - regex : "[[({]" - }, { - token : "paren.rparen", - regex : "[\\])}]" - }, { - token : "text", - regex : "\\s+" - } - ], - "comment" : [ - { - token : "comment", // closing comment - regex : "^=end(?:$|\\s.*$)", - next : "start" - }, { - token : "comment", // comment spanning whole line - regex : ".+" - } - ] - }; - - this.normalizeRules(); -}; - -oop.inherits(RubyHighlightRules, TextHighlightRules); - -exports.RubyHighlightRules = RubyHighlightRules; -}); - -define('ace/mode/folding/coffee', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var BaseFoldMode = require("./fold_mode").FoldMode; -var Range = require("../../range").Range; - -var FoldMode = exports.FoldMode = function() {}; -oop.inherits(FoldMode, BaseFoldMode); - -(function() { - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var range = this.indentationBlock(session, row); - if (range) - return range; - - var re = /\S/; - var line = session.getLine(row); - var startLevel = line.search(re); - if (startLevel == -1 || line[startLevel] != "#") - return; - - var startColumn = line.length; - var maxRow = session.getLength(); - var startRow = row; - var endRow = row; - - while (++row < maxRow) { - line = session.getLine(row); - var level = line.search(re); - - if (level == -1) - continue; - - if (line[level] != "#") - break; - - endRow = row; - } - - if (endRow > startRow) { - var endColumn = session.getLine(endRow).length; - return new Range(startRow, startColumn, endRow, endColumn); - } - }; - this.getFoldWidget = function(session, foldStyle, row) { - var line = session.getLine(row); - var indent = line.search(/\S/); - var next = session.getLine(row + 1); - var prev = session.getLine(row - 1); - var prevIndent = prev.search(/\S/); - var nextIndent = next.search(/\S/); - - if (indent == -1) { - session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : ""; - return ""; - } - if (prevIndent == -1) { - if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") { - session.foldWidgets[row - 1] = ""; - session.foldWidgets[row + 1] = ""; - return "start"; - } - } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") { - if (session.getLine(row - 2).search(/\S/) == -1) { - session.foldWidgets[row - 1] = "start"; - session.foldWidgets[row + 1] = ""; - return ""; - } - } - - if (prevIndent!= -1 && prevIndent < indent) - session.foldWidgets[row - 1] = "start"; - else - session.foldWidgets[row - 1] = ""; - - if (indent < nextIndent) - return "start"; - else - return ""; - }; - -}).call(FoldMode.prototype); - -}); diff --git a/addons/editor/ace/mode-handlebars.js b/addons/editor/ace/mode-handlebars.js deleted file mode 100644 index 7e4dd9b7..00000000 --- a/addons/editor/ace/mode-handlebars.js +++ /dev/null @@ -1,2383 +0,0 @@ -/* global define */ - -define('ace/mode/handlebars', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/html', 'ace/tokenizer', 'ace/mode/handlebars_highlight_rules', 'ace/mode/behaviour/html', 'ace/mode/folding/html'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var HtmlMode = require("./html").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var HandlebarsHighlightRules = require("./handlebars_highlight_rules").HandlebarsHighlightRules; -var HtmlBehaviour = require("./behaviour/html").HtmlBehaviour; -var HtmlFoldMode = require("./folding/html").FoldMode; - -var Mode = function() { - HtmlMode.call(this); - this.HighlightRules = HandlebarsHighlightRules; - this.$behaviour = new HtmlBehaviour(); - - - this.foldingRules = new HtmlFoldMode(); -}; - -oop.inherits(Mode, HtmlMode); - -(function() { - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/html', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/javascript', 'ace/mode/css', 'ace/tokenizer', 'ace/mode/html_highlight_rules', 'ace/mode/behaviour/html', 'ace/mode/folding/html', 'ace/mode/html_completions'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var JavaScriptMode = require("./javascript").Mode; -var CssMode = require("./css").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; -var HtmlBehaviour = require("./behaviour/html").HtmlBehaviour; -var HtmlFoldMode = require("./folding/html").FoldMode; -var HtmlCompletions = require("./html_completions").HtmlCompletions; - -var Mode = function() { - this.HighlightRules = HtmlHighlightRules; - this.$behaviour = new HtmlBehaviour(); - this.$completer = new HtmlCompletions(); - - this.createModeDelegates({ - "js-": JavaScriptMode, - "css-": CssMode - }); - - this.foldingRules = new HtmlFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.blockComment = {start: ""}; - - this.getNextLineIndent = function(state, line, tab) { - return this.$getIndent(line); - }; - - this.checkOutdent = function(state, line, input) { - return false; - }; - - this.getCompletions = function(state, session, pos, prefix) { - return this.$completer.getCompletions(state, session, pos, prefix); - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/javascript', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/javascript_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/worker/worker_client', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var Range = require("../range").Range; -var WorkerClient = require("../worker/worker_client").WorkerClient; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = JavaScriptHighlightRules; - - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().getLineTokens(line, state); - var tokens = tokenizedLine.tokens; - var endState = tokenizedLine.state; - - if (tokens.length && tokens[tokens.length-1].type == "comment") { - return indent; - } - - if (state == "start" || state == "no_regex") { - var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/); - if (match) { - indent += tab; - } - } else if (state == "doc-start") { - if (endState == "start" || endState == "no_regex") { - return ""; - } - var match = line.match(/^\s*(\/?)\*/); - if (match) { - if (match[1]) { - indent += " "; - } - indent += "* "; - } - } - - 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); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker"); - worker.attachToDocument(session.getDocument()); - - worker.on("jslint", function(results) { - session.setAnnotations(results.data); - }); - - worker.on("terminate", function() { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var JavaScriptHighlightRules = function() { - var keywordMapper = this.createKeywordMapper({ - "variable.language": - "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors - "Namespace|QName|XML|XMLList|" + // E4X - "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + - "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + - "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors - "SyntaxError|TypeError|URIError|" + - "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions - "isNaN|parseFloat|parseInt|" + - "JSON|Math|" + // Other - "this|arguments|prototype|window|document" , // Pseudo - "keyword": - "const|yield|import|get|set|" + - "break|case|catch|continue|default|delete|do|else|finally|for|function|" + - "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + - "__parent__|__count__|escape|unescape|with|__proto__|" + - "class|enum|extends|super|export|implements|private|public|interface|package|protected|static", - "storage.type": - "const|let|var|function", - "constant.language": - "null|Infinity|NaN|undefined", - "support.function": - "alert", - "constant.language.boolean": "true|false" - }, "identifier"); - var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; - var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\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 - ".)"; - - this.$rules = { - "no_regex" : [ - { - token : "comment", - regex : "\\/\\/", - next : "line_comment" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : /\/\*/, - next : "comment" - }, { - token : "string", - regex : "'(?=.)", - next : "qstring" - }, { - token : "string", - regex : '"(?=.)', - next : "qqstring" - }, { - token : "constant.numeric", // hex - regex : /0[xX][0-9a-fA-F]+\b/ - }, { - token : "constant.numeric", // float - regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/ - }, { - token : [ - "storage.type", "punctuation.operator", "support.function", - "punctuation.operator", "entity.name.function", "text","keyword.operator" - ], - regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "keyword.operator", "text", "storage.type", - "text", "paren.lparen" - ], - regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "punctuation.operator", - "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "text", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : "keyword", - regex : "(?:" + kwBeforeRe + ")\\b", - next : "start" - }, { - token : ["punctuation.operator", "support.function"], - regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/ - }, { - token : ["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 : keywordMapper, - regex : identifierRe - }, { - token : "keyword.operator", - regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/, - next : "start" - }, { - token : "punctuation.operator", - regex : /\?|\:|\,|\;|\./, - next : "start" - }, { - token : "paren.lparen", - regex : /[\[({]/, - next : "start" - }, { - token : "paren.rparen", - regex : /[\])}]/ - }, { - token : "keyword.operator", - regex : /\/=?/, - next : "start" - }, { - token: "comment", - regex: /^#!.*$/ - } - ], - "start": [ - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment_regex_allowed" - }, { - token : "comment", - regex : "\\/\\/", - next : "line_comment_regex_allowed" - }, { - token: "string.regexp", - regex: "\\/", - next: "regex" - }, { - token : "text", - regex : "\\s+|^$", - next : "start" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "regex": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "string.regexp", - regex: "/\\w*", - next: "no_regex" - }, { - token : "invalid", - regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ - }, { - token : "constant.language.escape", - regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/ - }, { - token : "constant.language.delimiter", - regex: /\|/ - }, { - token: "constant.language.escape", - regex: /\[\^?/, - next: "regex_character_class" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp" - } - ], - "regex_character_class": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "constant.language.escape", - regex: "]", - next: "regex" - }, { - token: "constant.language.escape", - regex: "-" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp.charachterclass" - } - ], - "function_arguments": [ - { - token: "variable.parameter", - regex: identifierRe - }, { - token: "punctuation.operator", - regex: "[, ]+" - }, { - token: "punctuation.operator", - regex: "$" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "comment_regex_allowed" : [ - {token : "comment", regex : "\\*\\/", next : "start"}, - {defaultToken : "comment"} - ], - "comment" : [ - {token : "comment", regex : "\\*\\/", next : "no_regex"}, - {defaultToken : "comment"} - ], - "line_comment_regex_allowed" : [ - {token : "comment", regex : "$|^", next : "start"}, - {defaultToken : "comment"} - ], - "line_comment" : [ - {token : "comment", regex : "$|^", next : "no_regex"}, - {defaultToken : "comment"} - ], - "qqstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qqstring" - }, { - token : "string", - regex : '"|$', - next : "no_regex" - }, { - defaultToken: "string" - } - ], - "qstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qstring" - }, { - token : "string", - regex : "'|$", - next : "no_regex" - }, { - defaultToken: "string" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("no_regex") ]); -}; - -oop.inherits(JavaScriptHighlightRules, TextHighlightRules); - -exports.JavaScriptHighlightRules = JavaScriptHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); - -define('ace/mode/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/css_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/worker/worker_client', 'ace/mode/behaviour/css', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var WorkerClient = require("../worker/worker_client").WorkerClient; -var CssBehaviour = require("./behaviour/css").CssBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = CssHighlightRules; - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CssBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.foldingRules = "cStyle"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - var tokens = this.getTokenizer().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); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker"); - worker.attachToDocument(session.getDocument()); - - worker.on("csslint", function(e) { - session.setAnnotations(e.data); - }); - - worker.on("terminate", function() { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; - -}); - -define('ace/mode/css_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var supportType = exports.supportType = "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"; -var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters"; -var supportConstant = exports.supportConstant = "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|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|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero"; -var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow"; -var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace"; - -var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))"; -var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b"; -var pseudoClasses = exports.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 CssHighlightRules = function() { - - var keywordMapper = this.createKeywordMapper({ - "support.function": supportFunction, - "support.constant": supportConstant, - "support.type": supportType, - "support.constant.color": supportConstantColor, - "support.constant.fonts": supportConstantFonts - }, "text", true); - - this.$rules = { - "start" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "@.*?{", - push: "media" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "media" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "\\}", - next: "pop" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "comment" : [{ - token : "comment", - regex : "\\*\\/", - next : "pop" - }, { - defaultToken : "comment" - }], - - "ruleset" : [ - { - token : "paren.rparen", - regex : "\\}", - next: "pop" - }, { - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - 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 : numRe - }, { - 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 : ["support.function", "string", "support.function"], - regex : "(url\\()(.*)(\\))" - }, { - token : keywordMapper, - regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*" - }, { - caseInsensitive: true - }] - }; - - this.normalizeRules(); -}; - -oop.inherits(CssHighlightRules, TextHighlightRules); - -exports.CssHighlightRules = CssHighlightRules; - -}); - -define('ace/mode/behaviour/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; - -var CssBehaviour = function () { - - this.inherit(CstyleBehaviour); - - this.add("colon", "insertion", function (state, action, editor, session, text) { - if (text === ':') { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - var token = iterator.getCurrentToken(); - if (token && token.value.match(/\s+/)) { - token = iterator.stepBackward(); - } - if (token && token.type === 'support.type') { - var line = session.doc.getLine(cursor.row); - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar === ':') { - return { - text: '', - selection: [1, 1] - } - } - if (!line.substring(cursor.column).match(/^\s*;/)) { - return { - text: ':;', - selection: [1, 1] - } - } - } - } - }); - - this.add("colon", "deletion", function (state, action, editor, session, range) { - var selected = session.doc.getTextRange(range); - if (!range.isMultiLine() && selected === ':') { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - var token = iterator.getCurrentToken(); - if (token && token.value.match(/\s+/)) { - token = iterator.stepBackward(); - } - if (token && token.type === 'support.type') { - 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("semicolon", "insertion", function (state, action, editor, session, text) { - if (text === ';') { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar === ';') { - return { - text: '', - selection: [1, 1] - } - } - } - }); - -} -oop.inherits(CssBehaviour, CstyleBehaviour); - -exports.CssBehaviour = CssBehaviour; -}); - -define('ace/mode/html_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/css_highlight_rules', 'ace/mode/javascript_highlight_rules', 'ace/mode/xml_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; - -var tagMap = lang.createMap({ - a : 'anchor', - button : 'form', - form : 'form', - img : 'image', - input : 'form', - label : 'form', - option : 'form', - script : 'script', - select : 'form', - textarea : 'form', - style : 'style', - table : 'table', - tbody : 'table', - td : 'table', - tfoot : 'table', - th : 'table', - tr : 'table' -}); - -var HtmlHighlightRules = function() { - XmlHighlightRules.call(this); - - this.addRules({ - attributes: [{ - include : "space" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "keyword.operator.separator", - regex : "=", - push : [{ - include: "space" - }, { - token : "string", - regex : "[^<>='\"`\\s]+", - next : "pop" - }, { - token : "empty", - regex : "", - next : "pop" - }] - }, { - include : "string" - }], - tag: [{ - token : function(start, tag) { - var group = tagMap[tag]; - return ["meta.tag.punctuation.begin", - "meta.tag.name" + (group ? "." + group : "")]; - }, - regex : "(<)([-_a-zA-Z0-9:]+)", - next: "start_tag_stuff" - }, { - token : function(start, tag) { - var group = tagMap[tag]; - return ["meta.tag.punctuation.begin", - "meta.tag.name" + (group ? "." + group : "")]; - }, - regex : "(", next : "start"} - ], - end_tag_stuff: [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next : "start"} - ] - }); - - this.embedTagRules(CssHighlightRules, "css-", "style"); - this.embedTagRules(JavaScriptHighlightRules, "js-", "script"); - - if (this.constructor === HtmlHighlightRules) - this.normalizeRules(); -}; - -oop.inherits(HtmlHighlightRules, XmlHighlightRules); - -exports.HtmlHighlightRules = HtmlHighlightRules; -}); - -define('ace/mode/xml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml_util', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var xmlUtil = require("./xml_util"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var XmlHighlightRules = function(normalize) { - this.$rules = { - start : [ - {token : "punctuation.string.begin", regex : "<\\!\\[CDATA\\[", next : "cdata"}, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)(xml)(?=[\\s])", next : "xml_declaration" - }, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)([-_a-zA-Z0-9]+)", next : "instruction" - }, - {token : "comment", regex : "<\\!--", next : "comment"}, - { - token : ["punctuation.doctype.begin", "meta.tag.doctype"], - regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype" - }, - {include : "tag"}, - {include : "reference"} - ], - - xml_declaration : [ - {include : "attributes"}, - {include : "instruction"} - ], - - instruction : [ - {token : "punctuation.instruction.end", regex : "\\?>", next : "start"} - ], - - doctype : [ - {include : "space"}, - {include : "string"}, - {token : "punctuation.doctype.end", regex : ">", next : "start"}, - {token : "xml-pe", regex : "[-_a-zA-Z0-9:]+"}, - {token : "punctuation.begin", regex : "\\[", push : "declarations"} - ], - - declarations : [{ - token : "text", - regex : "\\s+" - }, { - token: "punctuation.end", - regex: "]", - next: "pop" - }, { - token : ["punctuation.begin", "keyword"], - regex : "(<\\!)([-_a-zA-Z0-9]+)", - push : [{ - token : "text", - regex : "\\s+" - }, - { - token : "punctuation.end", - regex : ">", - next : "pop" - }, - {include : "string"}] - }], - - cdata : [ - {token : "string.end", regex : "\\]\\]>", next : "start"}, - {token : "text", regex : "\\s+"}, - {token : "text", regex : "(?:[^\\]]|\\](?!\\]>))+"} - ], - - comment : [ - {token : "comment", regex : "-->", next : "start"}, - {defaultToken : "comment"} - ], - - tag : [{ - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(<)((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)", - next: [ - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : "start"} - ] - }, { - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(", next : "start"} - ] - }], - - space : [ - {token : "text", regex : "\\s+"} - ], - - reference : [{ - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, { - token : "invalid.illegal", regex : "&" - }], - - string: [{ - token : "string", - regex : "'", - push : "qstring_inner" - }, { - token : "string", - regex : '"', - push : "qqstring_inner" - }], - - qstring_inner: [ - {token : "string", regex: "'", next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - qqstring_inner: [ - {token : "string", regex: '"', next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - attributes: [{ - token : "entity.other.attribute-name", - regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+" - }, { - token : "keyword.operator.separator", - regex : "=" - }, { - include : "space" - }, { - include : "string" - }] - }; - - if (this.constructor === XmlHighlightRules) - this.normalizeRules(); -}; - - -(function() { - - this.embedTagRules = function(HighlightRules, prefix, tag){ - this.$rules.tag.unshift({ - token : ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(<)(" + tag + ")", - next: [ - {include : "space"}, - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : prefix + "start"} - ] - }); - - this.$rules[tag + "-end"] = [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next: "start", - onMatch : function(value, currentState, stack) { - stack.splice(0); - return this.token; - }} - ] - - this.embedRules(HighlightRules, prefix, [{ - token: ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(" - }]); - }; - -}).call(TextHighlightRules.prototype); - -oop.inherits(XmlHighlightRules, TextHighlightRules); - -exports.XmlHighlightRules = XmlHighlightRules; -}); - -define('ace/mode/xml_util', ['require', 'exports', 'module' ], function(require, exports, module) { - - -function string(state) { - return [{ - token : "string", - regex : '"', - next : state + "_qqstring" - }, { - token : "string", - regex : "'", - next : state + "_qstring" - }]; -} - -function multiLineString(quote, state) { - return [ - {token : "string", regex : quote, next : state}, - { - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, - {defaultToken : "string"} - ]; -} - -exports.tag = function(states, name, nextState, tagMap) { - states[name] = [{ - token : "text", - regex : "\\s+" - }, { - - token : !tagMap ? "meta.tag.tag-name" : function(value) { - if (tagMap[value]) - return "meta.tag.tag-name." + tagMap[value]; - else - return "meta.tag.tag-name"; - }, - regex : "[-_a-zA-Z0-9:]+", - next : name + "_embed_attribute_list" - }, { - token: "empty", - regex: "", - next : 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"] = [{ - token : "meta.tag.r", - regex : "/?>", - next : nextState - }, { - token : "keyword.operator", - regex : "=" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "text", - regex : "\\s+" - }].concat(string(name)); -}; - -}); - -define('ace/mode/behaviour/html', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour/xml', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var XmlBehaviour = require("../behaviour/xml").XmlBehaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var voidElements = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']; - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); - return hasType; -} - -var HtmlBehaviour = function () { - - this.inherit(XmlBehaviour); // Get xml behaviour - - this.add("autoclosing", "insertion", function (state, action, editor, session, text) { - if (text == '>') { - var position = editor.getCursorPosition(); - var iterator = new TokenIterator(session, position.row, position.column); - var token = iterator.getCurrentToken(); - - if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column) - return; - var atCursor = false; - if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text'))); - } else { - atCursor = true; - } - if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) { - return; - } - var element = token.value; - if (atCursor){ - var element = element.substring(0, position.column - token.start); - } - if (voidElements.indexOf(element) !== -1){ - return; - } - return { - text: '>' + '', - selection: [1, 1] - } - } - }); -} -oop.inherits(HtmlBehaviour, XmlBehaviour); - -exports.HtmlBehaviour = HtmlBehaviour; -}); - -define('ace/mode/behaviour/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); - return hasType; -} - -var XmlBehaviour = function () { - - this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour - - this.add("autoclosing", "insertion", function (state, action, editor, session, text) { - if (text == '>') { - var position = editor.getCursorPosition(); - var iterator = new TokenIterator(session, position.row, position.column); - var token = iterator.getCurrentToken(); - - if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column) - return; - var atCursor = false; - if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text'))); - } else { - atCursor = true; - } - if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) { - return; - } - var tag = token.value; - if (atCursor){ - var tag = tag.substring(0, position.column - token.start); - } - - return { - text: '>' + '', - selection: [1, 1] - } - } - }); - - this.add('autoindent', 'insertion', function (state, action, editor, session, text) { - if (text == "\n") { - var cursor = editor.getCursorPosition(); - var line = session.getLine(cursor.row); - var rightChars = line.substring(cursor.column, cursor.column + 2); - if (rightChars == '?)/; - this._parseTag = function(tag) { - - var match = tag.match(this.tagRe); - var column = 0; - - return { - value: tag, - match: match ? match[2] : "", - closing: match ? !!match[3] : false, - selfClosing: match ? !!match[5] || match[2] == "/>" : false, - tagName: match ? match[4] : "", - column: match[1] ? column + match[1].length : column - }; - }; - this._readTagForward = function(iterator) { - var token = iterator.getCurrentToken(); - if (!token) - return null; - - var value = ""; - var start; - - do { - if (token.type.lastIndexOf("meta.tag", 0) === 0) { - if (!start) { - var start = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() - }; - } - value += token.value; - if (value.indexOf(">") !== -1) { - var tag = this._parseTag(value); - tag.start = start; - tag.end = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() + token.value.length - }; - iterator.stepForward(); - return tag; - } - } - } while(token = iterator.stepForward()); - - return null; - }; - - this._readTagBackward = function(iterator) { - var token = iterator.getCurrentToken(); - if (!token) - return null; - - var value = ""; - var end; - - do { - if (token.type.lastIndexOf("meta.tag", 0) === 0) { - if (!end) { - end = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() + token.value.length - }; - } - value = token.value + value; - if (value.indexOf("<") !== -1) { - var tag = this._parseTag(value); - tag.end = end; - tag.start = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() - }; - iterator.stepBackward(); - return tag; - } - } - } while(token = iterator.stepBackward()); - - return null; - }; - - this._pop = function(stack, tag) { - while (stack.length) { - - var top = stack[stack.length-1]; - if (!tag || top.tagName == tag.tagName) { - return stack.pop(); - } - else if (this.voidElements[tag.tagName]) { - return; - } - else if (this.voidElements[top.tagName]) { - stack.pop(); - continue; - } else { - return null; - } - } - }; - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var firstTag = this._getFirstTagInLine(session, row); - - if (!firstTag.match) - return null; - - var isBackward = firstTag.closing || firstTag.selfClosing; - var stack = []; - var tag; - - if (!isBackward) { - var iterator = new TokenIterator(session, row, firstTag.column); - var start = { - row: row, - column: firstTag.column + firstTag.tagName.length + 2 - }; - while (tag = this._readTagForward(iterator)) { - if (tag.selfClosing) { - if (!stack.length) { - tag.start.column += tag.tagName.length + 2; - tag.end.column -= 2; - return Range.fromPoints(tag.start, tag.end); - } else - continue; - } - - if (tag.closing) { - this._pop(stack, tag); - if (stack.length == 0) - return Range.fromPoints(start, tag.start); - } - else { - stack.push(tag) - } - } - } - else { - var iterator = new TokenIterator(session, row, firstTag.column + firstTag.match.length); - var end = { - row: row, - column: firstTag.column - }; - - while (tag = this._readTagBackward(iterator)) { - if (tag.selfClosing) { - if (!stack.length) { - tag.start.column += tag.tagName.length + 2; - tag.end.column -= 2; - return Range.fromPoints(tag.start, tag.end); - } else - continue; - } - - if (!tag.closing) { - this._pop(stack, tag); - if (stack.length == 0) { - tag.start.column += tag.tagName.length + 2; - return Range.fromPoints(tag.start, end); - } - } - else { - stack.push(tag) - } - } - } - - }; - -}).call(FoldMode.prototype); - -}); - -define('ace/mode/html_completions', ['require', 'exports', 'module' , 'ace/token_iterator'], function(require, exports, module) { - - -var TokenIterator = require("../token_iterator").TokenIterator; - -var commonAttributes = [ - "accesskey", - "class", - "contenteditable", - "contextmenu", - "dir", - "draggable", - "dropzone", - "hidden", - "id", - "lang", - "spellcheck", - "style", - "tabindex", - "title", - "translate" -]; - -var eventAttributes = [ - "onabort", - "onblur", - "oncancel", - "oncanplay", - "oncanplaythrough", - "onchange", - "onclick", - "onclose", - "oncontextmenu", - "oncuechange", - "ondblclick", - "ondrag", - "ondragend", - "ondragenter", - "ondragleave", - "ondragover", - "ondragstart", - "ondrop", - "ondurationchange", - "onemptied", - "onended", - "onerror", - "onfocus", - "oninput", - "oninvalid", - "onkeydown", - "onkeypress", - "onkeyup", - "onload", - "onloadeddata", - "onloadedmetadata", - "onloadstart", - "onmousedown", - "onmousemove", - "onmouseout", - "onmouseover", - "onmouseup", - "onmousewheel", - "onpause", - "onplay", - "onplaying", - "onprogress", - "onratechange", - "onreset", - "onscroll", - "onseeked", - "onseeking", - "onselect", - "onshow", - "onstalled", - "onsubmit", - "onsuspend", - "ontimeupdate", - "onvolumechange", - "onwaiting" -]; - -var globalAttributes = commonAttributes.concat(eventAttributes); - -var attributeMap = { - "html": ["manifest"], - "head": [], - "title": [], - "base": ["href", "target"], - "link": ["href", "hreflang", "rel", "media", "type", "sizes"], - "meta": ["http-equiv", "name", "content", "charset"], - "style": ["type", "media", "scoped"], - "script": ["charset", "type", "src", "defer", "async"], - "noscript": ["href"], - "body": ["onafterprint", "onbeforeprint", "onbeforeunload", "onhashchange", "onmessage", "onoffline", "onpopstate", "onredo", "onresize", "onstorage", "onundo", "onunload"], - "section": [], - "nav": [], - "article": ["pubdate"], - "aside": [], - "h1": [], - "h2": [], - "h3": [], - "h4": [], - "h5": [], - "h6": [], - "header": [], - "footer": [], - "address": [], - "main": [], - "p": [], - "hr": [], - "pre": [], - "blockquote": ["cite"], - "ol": ["start", "reversed"], - "ul": [], - "li": ["value"], - "dl": [], - "dt": [], - "dd": [], - "figure": [], - "figcaption": [], - "div": [], - "a": ["href", "target", "ping", "rel", "media", "hreflang", "type"], - "em": [], - "strong": [], - "small": [], - "s": [], - "cite": [], - "q": ["cite"], - "dfn": [], - "abbr": [], - "data": [], - "time": ["datetime"], - "code": [], - "var": [], - "samp": [], - "kbd": [], - "sub": [], - "sup": [], - "i": [], - "b": [], - "u": [], - "mark": [], - "ruby": [], - "rt": [], - "rp": [], - "bdi": [], - "bdo": [], - "span": [], - "br": [], - "wbr": [], - "ins": ["cite", "datetime"], - "del": ["cite", "datetime"], - "img": ["alt", "src", "height", "width", "usemap", "ismap"], - "iframe": ["name", "src", "height", "width", "sandbox", "seamless"], - "embed": ["src", "height", "width", "type"], - "object": ["param", "data", "type", "height" , "width", "usemap", "name", "form", "classid"], - "param": ["name", "value"], - "video": ["src", "autobuffer", "autoplay", "loop", "controls", "width", "height", "poster"], - "audio": ["src", "autobuffer", "autoplay", "loop", "controls"], - "source": ["src", "type", "media"], - "track": ["kind", "src", "srclang", "label", "default"], - "canvas": ["width", "height"], - "map": ["name"], - "area": ["shape", "coords", "href", "hreflang", "alt", "target", "media", "rel", "ping", "type"], - "svg": [], - "math": [], - "table": ["summary"], - "caption": [], - "colgroup": ["span"], - "col": ["span"], - "tbody": [], - "thead": [], - "tfoot": [], - "tr": [], - "td": ["headers", "rowspan", "colspan"], - "th": ["headers", "rowspan", "colspan", "scope"], - "form": ["accept-charset", "action", "autocomplete", "enctype", "method", "name", "novalidate", "target"], - "fieldset": ["disabled", "form", "name"], - "legend": [], - "label": ["form", "for"], - "input": ["type", "accept", "alt", "autocomplete", "checked", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "height", "list", "max", "maxlength", "min", "multiple", "pattern", "placeholder", "readonly", "required", "size", "src", "step", "width", "files", "value"], - "button": ["autofocus", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "name", "value", "type"], - "select": ["autofocus", "disabled", "form", "multiple", "name", "size"], - "datalist": [], - "optgroup": ["disabled", "label"], - "option": ["disabled", "selected", "label", "value"], - "textarea": ["autofocus", "disabled", "form", "maxlength", "name", "placeholder", "readonly", "required", "rows", "cols", "wrap"], - "keygen": ["autofocus", "challenge", "disabled", "form", "keytype", "name"], - "output": ["for", "form", "name"], - "progress": ["value", "max"], - "meter": ["value", "min", "max", "low", "high", "optimum"], - "details": ["open"], - "summary": [], - "command": ["type", "label", "icon", "disabled", "checked", "radiogroup", "command"], - "menu": ["type", "label"], - "dialog": ["open"] -}; - -var allElements = Object.keys(attributeMap); - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); -} - -function findTagName(session, pos) { - var iterator = new TokenIterator(session, pos.row, pos.column); - var token = iterator.getCurrentToken(); - if (!token || !hasType(token, 'tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'operator') || hasType(token, 'attribute-name') || hasType(token, 'text'))); - } - if (token && hasType(token, 'tag-name') && !iterator.stepBackward().value.match('/')) - return token.value; -} - -var HtmlCompletions = function() { - -}; - -(function() { - - this.getCompletions = function(state, session, pos, prefix) { - var token = session.getTokenAt(pos.row, pos.column); - - if (!token) - return []; - if (hasType(token, "tag-name") || (token.value == '<' && hasType(token, "text"))) - return this.getTagCompletions(state, session, pos, prefix); - if (hasType(token, 'text') || hasType(token, 'attribute-name')) - return this.getAttributeCompetions(state, session, pos, prefix); - - return []; - }; - - this.getTagCompletions = function(state, session, pos, prefix) { - var elements = allElements; - if (prefix) { - elements = elements.filter(function(element){ - return element.indexOf(prefix) === 0; - }); - } - return elements.map(function(element){ - return { - value: element, - meta: "tag" - }; - }); - }; - - this.getAttributeCompetions = function(state, session, pos, prefix) { - var tagName = findTagName(session, pos); - if (!tagName) - return []; - var attributes = globalAttributes; - if (tagName in attributeMap) { - attributes = attributes.concat(attributeMap[tagName]); - } - if (prefix) { - attributes = attributes.filter(function(attribute){ - return attribute.indexOf(prefix) === 0; - }); - } - return attributes.map(function(attribute){ - return { - caption: attribute, - snippet: attribute + '="$0"', - meta: "attribute" - }; - }); - }; - -}).call(HtmlCompletions.prototype); - -exports.HtmlCompletions = HtmlCompletions; -}); - -define('ace/mode/handlebars_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/html_highlight_rules', 'ace/mode/xml_util'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; -var xmlUtil = require("./xml_util"); -function pop2(currentState, stack) { - stack.splice(0, 3); - return stack.shift() || "start"; -} -var HandlebarsHighlightRules = function() { - HtmlHighlightRules.call(this); - var hbs = { - regex : "(?={{)", - push : "handlebars" - } - for (var key in this.$rules) { - this.$rules[key].unshift(hbs); - } - this.$rules.handlebars = [{ - token : "comment.start", - regex : "{{!--", - push : [{ - token : "comment.end", - regex : "--}}", - next : pop2 - }, { - defaultToken : "comment" - }] - }, { - token : "comment.start", - regex : "{{!", - push : [{ - token : "comment.end", - regex : "}}", - next : pop2 - }, { - defaultToken : "comment" - }] - }, { - token : "storage.type.start", // begin section - regex : "{{[#\\^/&]?", - push : [{ - token : "storage.type.end", - regex : "}}", - next : pop2 - }, { - token : "variable.parameter", - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*" - }] - }, { - token : "support.function", // unescaped variable - regex : "{{{", - push : [{ - token : "support.function", - regex : "}}}", - next : pop2 - }, { - token : "variable.parameter", - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*" - }] - }]; - - this.normalizeRules(); -}; - -oop.inherits(HandlebarsHighlightRules, HtmlHighlightRules); - -exports.HandlebarsHighlightRules = HandlebarsHighlightRules; -}); diff --git a/addons/editor/ace/mode-haxe.js b/addons/editor/ace/mode-haxe.js deleted file mode 100644 index 879a1ff3..00000000 --- a/addons/editor/ace/mode-haxe.js +++ /dev/null @@ -1,610 +0,0 @@ -define('ace/mode/haxe', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/haxe_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var HaxeHighlightRules = require("./haxe_highlight_rules").HaxeHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = HaxeHighlightRules; - - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().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; - }; - - 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; -}); -define('ace/mode/haxe_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); - -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var HaxeHighlightRules = function() { - - var keywords = ( - "break|case|cast|catch|class|continue|default|else|enum|extends|for|function|if|implements|import|in|inline|interface|new|override|package|private|public|return|static|super|switch|this|throw|trace|try|typedef|untyped|var|while|Array|Void|Bool|Int|UInt|Float|Dynamic|String|List|Hash|IntHash|Error|Unknown|Type|Std" - ); - - var buildinConstants = ( - "null|true|false" - ); - - var keywordMapper = this.createKeywordMapper({ - "variable.language": "this", - "keyword": keywords, - "constant.language": buildinConstants - }, "identifier"); - - this.$rules = { - "start" : [ - { - token : "comment", - regex : "\\/\\/.*$" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment" - }, { - token : "string.regexp", - regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - token : "constant.numeric", // hex - regex : "0[xX][0-9a-fA-F]+\\b" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "constant.language.boolean", - regex : "(?:true|false)\\b" - }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" - }, { - token : "keyword.operator", - regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" - }, { - token : "punctuation.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 - regex : ".+" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("start") ]); -}; - -oop.inherits(HaxeHighlightRules, TextHighlightRules); - -exports.HaxeHighlightRules = HaxeHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); diff --git a/addons/editor/ace/mode-html.js b/addons/editor/ace/mode-html.js deleted file mode 100644 index 7b1b1bbd..00000000 --- a/addons/editor/ace/mode-html.js +++ /dev/null @@ -1,2312 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2010, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/mode/html', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/javascript', 'ace/mode/css', 'ace/tokenizer', 'ace/mode/html_highlight_rules', 'ace/mode/behaviour/html', 'ace/mode/folding/html', 'ace/mode/html_completions'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var JavaScriptMode = require("./javascript").Mode; -var CssMode = require("./css").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; -var HtmlBehaviour = require("./behaviour/html").HtmlBehaviour; -var HtmlFoldMode = require("./folding/html").FoldMode; -var HtmlCompletions = require("./html_completions").HtmlCompletions; - -var Mode = function() { - this.HighlightRules = HtmlHighlightRules; - this.$behaviour = new HtmlBehaviour(); - this.$completer = new HtmlCompletions(); - - this.createModeDelegates({ - "js-": JavaScriptMode, - "css-": CssMode - }); - - this.foldingRules = new HtmlFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.blockComment = {start: ""}; - - this.getNextLineIndent = function(state, line, tab) { - return this.$getIndent(line); - }; - - this.checkOutdent = function(state, line, input) { - return false; - }; - - this.getCompletions = function(state, session, pos, prefix) { - return this.$completer.getCompletions(state, session, pos, prefix); - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/javascript', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/javascript_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/worker/worker_client', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var Range = require("../range").Range; -var WorkerClient = require("../worker/worker_client").WorkerClient; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = JavaScriptHighlightRules; - - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().getLineTokens(line, state); - var tokens = tokenizedLine.tokens; - var endState = tokenizedLine.state; - - if (tokens.length && tokens[tokens.length-1].type == "comment") { - return indent; - } - - if (state == "start" || state == "no_regex") { - var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/); - if (match) { - indent += tab; - } - } else if (state == "doc-start") { - if (endState == "start" || endState == "no_regex") { - return ""; - } - var match = line.match(/^\s*(\/?)\*/); - if (match) { - if (match[1]) { - indent += " "; - } - indent += "* "; - } - } - - 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); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker"); - worker.attachToDocument(session.getDocument()); - - worker.on("jslint", function(results) { - session.setAnnotations(results.data); - }); - - worker.on("terminate", function() { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var JavaScriptHighlightRules = function() { - var keywordMapper = this.createKeywordMapper({ - "variable.language": - "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors - "Namespace|QName|XML|XMLList|" + // E4X - "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + - "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + - "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors - "SyntaxError|TypeError|URIError|" + - "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions - "isNaN|parseFloat|parseInt|" + - "JSON|Math|" + // Other - "this|arguments|prototype|window|document" , // Pseudo - "keyword": - "const|yield|import|get|set|" + - "break|case|catch|continue|default|delete|do|else|finally|for|function|" + - "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + - "__parent__|__count__|escape|unescape|with|__proto__|" + - "class|enum|extends|super|export|implements|private|public|interface|package|protected|static", - "storage.type": - "const|let|var|function", - "constant.language": - "null|Infinity|NaN|undefined", - "support.function": - "alert", - "constant.language.boolean": "true|false" - }, "identifier"); - var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; - var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\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 - ".)"; - - this.$rules = { - "no_regex" : [ - { - token : "comment", - regex : "\\/\\/", - next : "line_comment" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : /\/\*/, - next : "comment" - }, { - token : "string", - regex : "'(?=.)", - next : "qstring" - }, { - token : "string", - regex : '"(?=.)', - next : "qqstring" - }, { - token : "constant.numeric", // hex - regex : /0[xX][0-9a-fA-F]+\b/ - }, { - token : "constant.numeric", // float - regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/ - }, { - token : [ - "storage.type", "punctuation.operator", "support.function", - "punctuation.operator", "entity.name.function", "text","keyword.operator" - ], - regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "keyword.operator", "text", "storage.type", - "text", "paren.lparen" - ], - regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "punctuation.operator", - "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "text", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : "keyword", - regex : "(?:" + kwBeforeRe + ")\\b", - next : "start" - }, { - token : ["punctuation.operator", "support.function"], - regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/ - }, { - token : ["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 : keywordMapper, - regex : identifierRe - }, { - token : "keyword.operator", - regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/, - next : "start" - }, { - token : "punctuation.operator", - regex : /\?|\:|\,|\;|\./, - next : "start" - }, { - token : "paren.lparen", - regex : /[\[({]/, - next : "start" - }, { - token : "paren.rparen", - regex : /[\])}]/ - }, { - token : "keyword.operator", - regex : /\/=?/, - next : "start" - }, { - token: "comment", - regex: /^#!.*$/ - } - ], - "start": [ - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment_regex_allowed" - }, { - token : "comment", - regex : "\\/\\/", - next : "line_comment_regex_allowed" - }, { - token: "string.regexp", - regex: "\\/", - next: "regex" - }, { - token : "text", - regex : "\\s+|^$", - next : "start" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "regex": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "string.regexp", - regex: "/\\w*", - next: "no_regex" - }, { - token : "invalid", - regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ - }, { - token : "constant.language.escape", - regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/ - }, { - token : "constant.language.delimiter", - regex: /\|/ - }, { - token: "constant.language.escape", - regex: /\[\^?/, - next: "regex_character_class" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp" - } - ], - "regex_character_class": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "constant.language.escape", - regex: "]", - next: "regex" - }, { - token: "constant.language.escape", - regex: "-" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp.charachterclass" - } - ], - "function_arguments": [ - { - token: "variable.parameter", - regex: identifierRe - }, { - token: "punctuation.operator", - regex: "[, ]+" - }, { - token: "punctuation.operator", - regex: "$" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "comment_regex_allowed" : [ - {token : "comment", regex : "\\*\\/", next : "start"}, - {defaultToken : "comment"} - ], - "comment" : [ - {token : "comment", regex : "\\*\\/", next : "no_regex"}, - {defaultToken : "comment"} - ], - "line_comment_regex_allowed" : [ - {token : "comment", regex : "$|^", next : "start"}, - {defaultToken : "comment"} - ], - "line_comment" : [ - {token : "comment", regex : "$|^", next : "no_regex"}, - {defaultToken : "comment"} - ], - "qqstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qqstring" - }, { - token : "string", - regex : '"|$', - next : "no_regex" - }, { - defaultToken: "string" - } - ], - "qstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qstring" - }, { - token : "string", - regex : "'|$", - next : "no_regex" - }, { - defaultToken: "string" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("no_regex") ]); -}; - -oop.inherits(JavaScriptHighlightRules, TextHighlightRules); - -exports.JavaScriptHighlightRules = JavaScriptHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); - -define('ace/mode/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/css_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/worker/worker_client', 'ace/mode/behaviour/css', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var WorkerClient = require("../worker/worker_client").WorkerClient; -var CssBehaviour = require("./behaviour/css").CssBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = CssHighlightRules; - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CssBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.foldingRules = "cStyle"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - var tokens = this.getTokenizer().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); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker"); - worker.attachToDocument(session.getDocument()); - - worker.on("csslint", function(e) { - session.setAnnotations(e.data); - }); - - worker.on("terminate", function() { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; - -}); - -define('ace/mode/css_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var supportType = exports.supportType = "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"; -var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters"; -var supportConstant = exports.supportConstant = "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|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|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero"; -var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow"; -var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace"; - -var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))"; -var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b"; -var pseudoClasses = exports.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 CssHighlightRules = function() { - - var keywordMapper = this.createKeywordMapper({ - "support.function": supportFunction, - "support.constant": supportConstant, - "support.type": supportType, - "support.constant.color": supportConstantColor, - "support.constant.fonts": supportConstantFonts - }, "text", true); - - this.$rules = { - "start" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "@.*?{", - push: "media" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "media" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "\\}", - next: "pop" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "comment" : [{ - token : "comment", - regex : "\\*\\/", - next : "pop" - }, { - defaultToken : "comment" - }], - - "ruleset" : [ - { - token : "paren.rparen", - regex : "\\}", - next: "pop" - }, { - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - 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 : numRe - }, { - 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 : ["support.function", "string", "support.function"], - regex : "(url\\()(.*)(\\))" - }, { - token : keywordMapper, - regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*" - }, { - caseInsensitive: true - }] - }; - - this.normalizeRules(); -}; - -oop.inherits(CssHighlightRules, TextHighlightRules); - -exports.CssHighlightRules = CssHighlightRules; - -}); - -define('ace/mode/behaviour/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; - -var CssBehaviour = function () { - - this.inherit(CstyleBehaviour); - - this.add("colon", "insertion", function (state, action, editor, session, text) { - if (text === ':') { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - var token = iterator.getCurrentToken(); - if (token && token.value.match(/\s+/)) { - token = iterator.stepBackward(); - } - if (token && token.type === 'support.type') { - var line = session.doc.getLine(cursor.row); - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar === ':') { - return { - text: '', - selection: [1, 1] - } - } - if (!line.substring(cursor.column).match(/^\s*;/)) { - return { - text: ':;', - selection: [1, 1] - } - } - } - } - }); - - this.add("colon", "deletion", function (state, action, editor, session, range) { - var selected = session.doc.getTextRange(range); - if (!range.isMultiLine() && selected === ':') { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - var token = iterator.getCurrentToken(); - if (token && token.value.match(/\s+/)) { - token = iterator.stepBackward(); - } - if (token && token.type === 'support.type') { - 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("semicolon", "insertion", function (state, action, editor, session, text) { - if (text === ';') { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar === ';') { - return { - text: '', - selection: [1, 1] - } - } - } - }); - -} -oop.inherits(CssBehaviour, CstyleBehaviour); - -exports.CssBehaviour = CssBehaviour; -}); - -define('ace/mode/html_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/css_highlight_rules', 'ace/mode/javascript_highlight_rules', 'ace/mode/xml_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; - -var tagMap = lang.createMap({ - a : 'anchor', - button : 'form', - form : 'form', - img : 'image', - input : 'form', - label : 'form', - option : 'form', - script : 'script', - select : 'form', - textarea : 'form', - style : 'style', - table : 'table', - tbody : 'table', - td : 'table', - tfoot : 'table', - th : 'table', - tr : 'table' -}); - -var HtmlHighlightRules = function() { - XmlHighlightRules.call(this); - - this.addRules({ - attributes: [{ - include : "space" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "keyword.operator.separator", - regex : "=", - push : [{ - include: "space" - }, { - token : "string", - regex : "[^<>='\"`\\s]+", - next : "pop" - }, { - token : "empty", - regex : "", - next : "pop" - }] - }, { - include : "string" - }], - tag: [{ - token : function(start, tag) { - var group = tagMap[tag]; - return ["meta.tag.punctuation.begin", - "meta.tag.name" + (group ? "." + group : "")]; - }, - regex : "(<)([-_a-zA-Z0-9:]+)", - next: "start_tag_stuff" - }, { - token : function(start, tag) { - var group = tagMap[tag]; - return ["meta.tag.punctuation.begin", - "meta.tag.name" + (group ? "." + group : "")]; - }, - regex : "(", next : "start"} - ], - end_tag_stuff: [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next : "start"} - ] - }); - - this.embedTagRules(CssHighlightRules, "css-", "style"); - this.embedTagRules(JavaScriptHighlightRules, "js-", "script"); - - if (this.constructor === HtmlHighlightRules) - this.normalizeRules(); -}; - -oop.inherits(HtmlHighlightRules, XmlHighlightRules); - -exports.HtmlHighlightRules = HtmlHighlightRules; -}); - -define('ace/mode/xml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml_util', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var xmlUtil = require("./xml_util"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var XmlHighlightRules = function(normalize) { - this.$rules = { - start : [ - {token : "punctuation.string.begin", regex : "<\\!\\[CDATA\\[", next : "cdata"}, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)(xml)(?=[\\s])", next : "xml_declaration" - }, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)([-_a-zA-Z0-9]+)", next : "instruction" - }, - {token : "comment", regex : "<\\!--", next : "comment"}, - { - token : ["punctuation.doctype.begin", "meta.tag.doctype"], - regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype" - }, - {include : "tag"}, - {include : "reference"} - ], - - xml_declaration : [ - {include : "attributes"}, - {include : "instruction"} - ], - - instruction : [ - {token : "punctuation.instruction.end", regex : "\\?>", next : "start"} - ], - - doctype : [ - {include : "space"}, - {include : "string"}, - {token : "punctuation.doctype.end", regex : ">", next : "start"}, - {token : "xml-pe", regex : "[-_a-zA-Z0-9:]+"}, - {token : "punctuation.begin", regex : "\\[", push : "declarations"} - ], - - declarations : [{ - token : "text", - regex : "\\s+" - }, { - token: "punctuation.end", - regex: "]", - next: "pop" - }, { - token : ["punctuation.begin", "keyword"], - regex : "(<\\!)([-_a-zA-Z0-9]+)", - push : [{ - token : "text", - regex : "\\s+" - }, - { - token : "punctuation.end", - regex : ">", - next : "pop" - }, - {include : "string"}] - }], - - cdata : [ - {token : "string.end", regex : "\\]\\]>", next : "start"}, - {token : "text", regex : "\\s+"}, - {token : "text", regex : "(?:[^\\]]|\\](?!\\]>))+"} - ], - - comment : [ - {token : "comment", regex : "-->", next : "start"}, - {defaultToken : "comment"} - ], - - tag : [{ - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(<)((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)", - next: [ - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : "start"} - ] - }, { - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(", next : "start"} - ] - }], - - space : [ - {token : "text", regex : "\\s+"} - ], - - reference : [{ - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, { - token : "invalid.illegal", regex : "&" - }], - - string: [{ - token : "string", - regex : "'", - push : "qstring_inner" - }, { - token : "string", - regex : '"', - push : "qqstring_inner" - }], - - qstring_inner: [ - {token : "string", regex: "'", next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - qqstring_inner: [ - {token : "string", regex: '"', next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - attributes: [{ - token : "entity.other.attribute-name", - regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+" - }, { - token : "keyword.operator.separator", - regex : "=" - }, { - include : "space" - }, { - include : "string" - }] - }; - - if (this.constructor === XmlHighlightRules) - this.normalizeRules(); -}; - - -(function() { - - this.embedTagRules = function(HighlightRules, prefix, tag){ - this.$rules.tag.unshift({ - token : ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(<)(" + tag + ")", - next: [ - {include : "space"}, - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : prefix + "start"} - ] - }); - - this.$rules[tag + "-end"] = [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next: "start", - onMatch : function(value, currentState, stack) { - stack.splice(0); - return this.token; - }} - ] - - this.embedRules(HighlightRules, prefix, [{ - token: ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(" - }]); - }; - -}).call(TextHighlightRules.prototype); - -oop.inherits(XmlHighlightRules, TextHighlightRules); - -exports.XmlHighlightRules = XmlHighlightRules; -}); - -define('ace/mode/xml_util', ['require', 'exports', 'module' ], function(require, exports, module) { - - -function string(state) { - return [{ - token : "string", - regex : '"', - next : state + "_qqstring" - }, { - token : "string", - regex : "'", - next : state + "_qstring" - }]; -} - -function multiLineString(quote, state) { - return [ - {token : "string", regex : quote, next : state}, - { - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, - {defaultToken : "string"} - ]; -} - -exports.tag = function(states, name, nextState, tagMap) { - states[name] = [{ - token : "text", - regex : "\\s+" - }, { - - token : !tagMap ? "meta.tag.tag-name" : function(value) { - if (tagMap[value]) - return "meta.tag.tag-name." + tagMap[value]; - else - return "meta.tag.tag-name"; - }, - regex : "[-_a-zA-Z0-9:]+", - next : name + "_embed_attribute_list" - }, { - token: "empty", - regex: "", - next : 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"] = [{ - token : "meta.tag.r", - regex : "/?>", - next : nextState - }, { - token : "keyword.operator", - regex : "=" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "text", - regex : "\\s+" - }].concat(string(name)); -}; - -}); - -define('ace/mode/behaviour/html', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour/xml', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var XmlBehaviour = require("../behaviour/xml").XmlBehaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var voidElements = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']; - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); - return hasType; -} - -var HtmlBehaviour = function () { - - this.inherit(XmlBehaviour); // Get xml behaviour - - this.add("autoclosing", "insertion", function (state, action, editor, session, text) { - if (text == '>') { - var position = editor.getCursorPosition(); - var iterator = new TokenIterator(session, position.row, position.column); - var token = iterator.getCurrentToken(); - - if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column) - return; - var atCursor = false; - if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text'))); - } else { - atCursor = true; - } - if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) { - return; - } - var element = token.value; - if (atCursor){ - var element = element.substring(0, position.column - token.start); - } - if (voidElements.indexOf(element) !== -1){ - return; - } - return { - text: '>' + '', - selection: [1, 1] - } - } - }); -} -oop.inherits(HtmlBehaviour, XmlBehaviour); - -exports.HtmlBehaviour = HtmlBehaviour; -}); - -define('ace/mode/behaviour/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); - return hasType; -} - -var XmlBehaviour = function () { - - this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour - - this.add("autoclosing", "insertion", function (state, action, editor, session, text) { - if (text == '>') { - var position = editor.getCursorPosition(); - var iterator = new TokenIterator(session, position.row, position.column); - var token = iterator.getCurrentToken(); - - if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column) - return; - var atCursor = false; - if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text'))); - } else { - atCursor = true; - } - if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) { - return; - } - var tag = token.value; - if (atCursor){ - var tag = tag.substring(0, position.column - token.start); - } - - return { - text: '>' + '', - selection: [1, 1] - } - } - }); - - this.add('autoindent', 'insertion', function (state, action, editor, session, text) { - if (text == "\n") { - var cursor = editor.getCursorPosition(); - var line = session.getLine(cursor.row); - var rightChars = line.substring(cursor.column, cursor.column + 2); - if (rightChars == '?)/; - this._parseTag = function(tag) { - - var match = tag.match(this.tagRe); - var column = 0; - - return { - value: tag, - match: match ? match[2] : "", - closing: match ? !!match[3] : false, - selfClosing: match ? !!match[5] || match[2] == "/>" : false, - tagName: match ? match[4] : "", - column: match[1] ? column + match[1].length : column - }; - }; - this._readTagForward = function(iterator) { - var token = iterator.getCurrentToken(); - if (!token) - return null; - - var value = ""; - var start; - - do { - if (token.type.lastIndexOf("meta.tag", 0) === 0) { - if (!start) { - var start = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() - }; - } - value += token.value; - if (value.indexOf(">") !== -1) { - var tag = this._parseTag(value); - tag.start = start; - tag.end = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() + token.value.length - }; - iterator.stepForward(); - return tag; - } - } - } while(token = iterator.stepForward()); - - return null; - }; - - this._readTagBackward = function(iterator) { - var token = iterator.getCurrentToken(); - if (!token) - return null; - - var value = ""; - var end; - - do { - if (token.type.lastIndexOf("meta.tag", 0) === 0) { - if (!end) { - end = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() + token.value.length - }; - } - value = token.value + value; - if (value.indexOf("<") !== -1) { - var tag = this._parseTag(value); - tag.end = end; - tag.start = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() - }; - iterator.stepBackward(); - return tag; - } - } - } while(token = iterator.stepBackward()); - - return null; - }; - - this._pop = function(stack, tag) { - while (stack.length) { - - var top = stack[stack.length-1]; - if (!tag || top.tagName == tag.tagName) { - return stack.pop(); - } - else if (this.voidElements[tag.tagName]) { - return; - } - else if (this.voidElements[top.tagName]) { - stack.pop(); - continue; - } else { - return null; - } - } - }; - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var firstTag = this._getFirstTagInLine(session, row); - - if (!firstTag.match) - return null; - - var isBackward = firstTag.closing || firstTag.selfClosing; - var stack = []; - var tag; - - if (!isBackward) { - var iterator = new TokenIterator(session, row, firstTag.column); - var start = { - row: row, - column: firstTag.column + firstTag.tagName.length + 2 - }; - while (tag = this._readTagForward(iterator)) { - if (tag.selfClosing) { - if (!stack.length) { - tag.start.column += tag.tagName.length + 2; - tag.end.column -= 2; - return Range.fromPoints(tag.start, tag.end); - } else - continue; - } - - if (tag.closing) { - this._pop(stack, tag); - if (stack.length == 0) - return Range.fromPoints(start, tag.start); - } - else { - stack.push(tag) - } - } - } - else { - var iterator = new TokenIterator(session, row, firstTag.column + firstTag.match.length); - var end = { - row: row, - column: firstTag.column - }; - - while (tag = this._readTagBackward(iterator)) { - if (tag.selfClosing) { - if (!stack.length) { - tag.start.column += tag.tagName.length + 2; - tag.end.column -= 2; - return Range.fromPoints(tag.start, tag.end); - } else - continue; - } - - if (!tag.closing) { - this._pop(stack, tag); - if (stack.length == 0) { - tag.start.column += tag.tagName.length + 2; - return Range.fromPoints(tag.start, end); - } - } - else { - stack.push(tag) - } - } - } - - }; - -}).call(FoldMode.prototype); - -}); - -define('ace/mode/html_completions', ['require', 'exports', 'module' , 'ace/token_iterator'], function(require, exports, module) { - - -var TokenIterator = require("../token_iterator").TokenIterator; - -var commonAttributes = [ - "accesskey", - "class", - "contenteditable", - "contextmenu", - "dir", - "draggable", - "dropzone", - "hidden", - "id", - "lang", - "spellcheck", - "style", - "tabindex", - "title", - "translate" -]; - -var eventAttributes = [ - "onabort", - "onblur", - "oncancel", - "oncanplay", - "oncanplaythrough", - "onchange", - "onclick", - "onclose", - "oncontextmenu", - "oncuechange", - "ondblclick", - "ondrag", - "ondragend", - "ondragenter", - "ondragleave", - "ondragover", - "ondragstart", - "ondrop", - "ondurationchange", - "onemptied", - "onended", - "onerror", - "onfocus", - "oninput", - "oninvalid", - "onkeydown", - "onkeypress", - "onkeyup", - "onload", - "onloadeddata", - "onloadedmetadata", - "onloadstart", - "onmousedown", - "onmousemove", - "onmouseout", - "onmouseover", - "onmouseup", - "onmousewheel", - "onpause", - "onplay", - "onplaying", - "onprogress", - "onratechange", - "onreset", - "onscroll", - "onseeked", - "onseeking", - "onselect", - "onshow", - "onstalled", - "onsubmit", - "onsuspend", - "ontimeupdate", - "onvolumechange", - "onwaiting" -]; - -var globalAttributes = commonAttributes.concat(eventAttributes); - -var attributeMap = { - "html": ["manifest"], - "head": [], - "title": [], - "base": ["href", "target"], - "link": ["href", "hreflang", "rel", "media", "type", "sizes"], - "meta": ["http-equiv", "name", "content", "charset"], - "style": ["type", "media", "scoped"], - "script": ["charset", "type", "src", "defer", "async"], - "noscript": ["href"], - "body": ["onafterprint", "onbeforeprint", "onbeforeunload", "onhashchange", "onmessage", "onoffline", "onpopstate", "onredo", "onresize", "onstorage", "onundo", "onunload"], - "section": [], - "nav": [], - "article": ["pubdate"], - "aside": [], - "h1": [], - "h2": [], - "h3": [], - "h4": [], - "h5": [], - "h6": [], - "header": [], - "footer": [], - "address": [], - "main": [], - "p": [], - "hr": [], - "pre": [], - "blockquote": ["cite"], - "ol": ["start", "reversed"], - "ul": [], - "li": ["value"], - "dl": [], - "dt": [], - "dd": [], - "figure": [], - "figcaption": [], - "div": [], - "a": ["href", "target", "ping", "rel", "media", "hreflang", "type"], - "em": [], - "strong": [], - "small": [], - "s": [], - "cite": [], - "q": ["cite"], - "dfn": [], - "abbr": [], - "data": [], - "time": ["datetime"], - "code": [], - "var": [], - "samp": [], - "kbd": [], - "sub": [], - "sup": [], - "i": [], - "b": [], - "u": [], - "mark": [], - "ruby": [], - "rt": [], - "rp": [], - "bdi": [], - "bdo": [], - "span": [], - "br": [], - "wbr": [], - "ins": ["cite", "datetime"], - "del": ["cite", "datetime"], - "img": ["alt", "src", "height", "width", "usemap", "ismap"], - "iframe": ["name", "src", "height", "width", "sandbox", "seamless"], - "embed": ["src", "height", "width", "type"], - "object": ["param", "data", "type", "height" , "width", "usemap", "name", "form", "classid"], - "param": ["name", "value"], - "video": ["src", "autobuffer", "autoplay", "loop", "controls", "width", "height", "poster"], - "audio": ["src", "autobuffer", "autoplay", "loop", "controls"], - "source": ["src", "type", "media"], - "track": ["kind", "src", "srclang", "label", "default"], - "canvas": ["width", "height"], - "map": ["name"], - "area": ["shape", "coords", "href", "hreflang", "alt", "target", "media", "rel", "ping", "type"], - "svg": [], - "math": [], - "table": ["summary"], - "caption": [], - "colgroup": ["span"], - "col": ["span"], - "tbody": [], - "thead": [], - "tfoot": [], - "tr": [], - "td": ["headers", "rowspan", "colspan"], - "th": ["headers", "rowspan", "colspan", "scope"], - "form": ["accept-charset", "action", "autocomplete", "enctype", "method", "name", "novalidate", "target"], - "fieldset": ["disabled", "form", "name"], - "legend": [], - "label": ["form", "for"], - "input": ["type", "accept", "alt", "autocomplete", "checked", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "height", "list", "max", "maxlength", "min", "multiple", "pattern", "placeholder", "readonly", "required", "size", "src", "step", "width", "files", "value"], - "button": ["autofocus", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "name", "value", "type"], - "select": ["autofocus", "disabled", "form", "multiple", "name", "size"], - "datalist": [], - "optgroup": ["disabled", "label"], - "option": ["disabled", "selected", "label", "value"], - "textarea": ["autofocus", "disabled", "form", "maxlength", "name", "placeholder", "readonly", "required", "rows", "cols", "wrap"], - "keygen": ["autofocus", "challenge", "disabled", "form", "keytype", "name"], - "output": ["for", "form", "name"], - "progress": ["value", "max"], - "meter": ["value", "min", "max", "low", "high", "optimum"], - "details": ["open"], - "summary": [], - "command": ["type", "label", "icon", "disabled", "checked", "radiogroup", "command"], - "menu": ["type", "label"], - "dialog": ["open"] -}; - -var allElements = Object.keys(attributeMap); - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); -} - -function findTagName(session, pos) { - var iterator = new TokenIterator(session, pos.row, pos.column); - var token = iterator.getCurrentToken(); - if (!token || !hasType(token, 'tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'operator') || hasType(token, 'attribute-name') || hasType(token, 'text'))); - } - if (token && hasType(token, 'tag-name') && !iterator.stepBackward().value.match('/')) - return token.value; -} - -var HtmlCompletions = function() { - -}; - -(function() { - - this.getCompletions = function(state, session, pos, prefix) { - var token = session.getTokenAt(pos.row, pos.column); - - if (!token) - return []; - if (hasType(token, "tag-name") || (token.value == '<' && hasType(token, "text"))) - return this.getTagCompletions(state, session, pos, prefix); - if (hasType(token, 'text') || hasType(token, 'attribute-name')) - return this.getAttributeCompetions(state, session, pos, prefix); - - return []; - }; - - this.getTagCompletions = function(state, session, pos, prefix) { - var elements = allElements; - if (prefix) { - elements = elements.filter(function(element){ - return element.indexOf(prefix) === 0; - }); - } - return elements.map(function(element){ - return { - value: element, - meta: "tag" - }; - }); - }; - - this.getAttributeCompetions = function(state, session, pos, prefix) { - var tagName = findTagName(session, pos); - if (!tagName) - return []; - var attributes = globalAttributes; - if (tagName in attributeMap) { - attributes = attributes.concat(attributeMap[tagName]); - } - if (prefix) { - attributes = attributes.filter(function(attribute){ - return attribute.indexOf(prefix) === 0; - }); - } - return attributes.map(function(attribute){ - return { - caption: attribute, - snippet: attribute + '="$0"', - meta: "attribute" - }; - }); - }; - -}).call(HtmlCompletions.prototype); - -exports.HtmlCompletions = HtmlCompletions; -}); diff --git a/addons/editor/ace/mode-html_ruby.js b/addons/editor/ace/mode-html_ruby.js deleted file mode 100644 index 5a0540e3..00000000 --- a/addons/editor/ace/mode-html_ruby.js +++ /dev/null @@ -1,2759 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2012, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ - - -define('ace/mode/html_ruby', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/tokenizer', 'ace/mode/html_ruby_highlight_rules', 'ace/mode/html', 'ace/mode/javascript', 'ace/mode/css', 'ace/mode/ruby'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var Tokenizer = require("../tokenizer").Tokenizer; -var HtmlRubyHighlightRules = require("./html_ruby_highlight_rules").HtmlRubyHighlightRules; -var HtmlMode = require("./html").Mode; -var JavaScriptMode = require("./javascript").Mode; -var CssMode = require("./css").Mode; -var RubyMode = require("./ruby").Mode; - -var Mode = function() { - HtmlMode.call(this); - this.HighlightRules = HtmlRubyHighlightRules; - this.createModeDelegates({ - "js-": JavaScriptMode, - "css-": CssMode, - "ruby-": RubyMode - }); -}; -oop.inherits(Mode, HtmlMode); - -(function() { - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/html_ruby_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/html_highlight_rules', 'ace/mode/ruby_highlight_rules'], function(require, exports, module) { - - - var oop = require("../lib/oop"); - var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; - var RubyHighlightRules = require("./ruby_highlight_rules").RubyHighlightRules; - - var HtmlRubyHighlightRules = function() { - HtmlHighlightRules.call(this); - - var startRules = [ - { - regex: "<%%|%%>", - token: "constant.language.escape" - }, { - token : "comment.start.erb", - regex : "<%#", - push : [{ - token : "comment.end.erb", - regex: "%>", - next: "pop", - defaultToken:"comment" - }] - }, { - token : "support.ruby_tag", - regex : "<%+(?!>)[-=]?", - push : "ruby-start" - } - ]; - - var endRules = [ - { - token : "support.ruby_tag", - regex : "%>", - next : "pop" - }, { - token: "comment", - regex: "#(?:[^%]|%[^>])*" - } - ]; - - for (var key in this.$rules) - this.$rules[key].unshift.apply(this.$rules[key], startRules); - - this.embedRules(RubyHighlightRules, "ruby-", endRules, ["start"]); - - this.normalizeRules(); - }; - - - oop.inherits(HtmlRubyHighlightRules, HtmlHighlightRules); - - exports.HtmlRubyHighlightRules = HtmlRubyHighlightRules; -}); - -define('ace/mode/html_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/css_highlight_rules', 'ace/mode/javascript_highlight_rules', 'ace/mode/xml_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; - -var tagMap = lang.createMap({ - a : 'anchor', - button : 'form', - form : 'form', - img : 'image', - input : 'form', - label : 'form', - option : 'form', - script : 'script', - select : 'form', - textarea : 'form', - style : 'style', - table : 'table', - tbody : 'table', - td : 'table', - tfoot : 'table', - th : 'table', - tr : 'table' -}); - -var HtmlHighlightRules = function() { - XmlHighlightRules.call(this); - - this.addRules({ - attributes: [{ - include : "space" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "keyword.operator.separator", - regex : "=", - push : [{ - include: "space" - }, { - token : "string", - regex : "[^<>='\"`\\s]+", - next : "pop" - }, { - token : "empty", - regex : "", - next : "pop" - }] - }, { - include : "string" - }], - tag: [{ - token : function(start, tag) { - var group = tagMap[tag]; - return ["meta.tag.punctuation.begin", - "meta.tag.name" + (group ? "." + group : "")]; - }, - regex : "(<)([-_a-zA-Z0-9:]+)", - next: "start_tag_stuff" - }, { - token : function(start, tag) { - var group = tagMap[tag]; - return ["meta.tag.punctuation.begin", - "meta.tag.name" + (group ? "." + group : "")]; - }, - regex : "(", next : "start"} - ], - end_tag_stuff: [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next : "start"} - ] - }); - - this.embedTagRules(CssHighlightRules, "css-", "style"); - this.embedTagRules(JavaScriptHighlightRules, "js-", "script"); - - if (this.constructor === HtmlHighlightRules) - this.normalizeRules(); -}; - -oop.inherits(HtmlHighlightRules, XmlHighlightRules); - -exports.HtmlHighlightRules = HtmlHighlightRules; -}); - -define('ace/mode/css_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var supportType = exports.supportType = "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"; -var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters"; -var supportConstant = exports.supportConstant = "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|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|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero"; -var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow"; -var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace"; - -var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))"; -var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b"; -var pseudoClasses = exports.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 CssHighlightRules = function() { - - var keywordMapper = this.createKeywordMapper({ - "support.function": supportFunction, - "support.constant": supportConstant, - "support.type": supportType, - "support.constant.color": supportConstantColor, - "support.constant.fonts": supportConstantFonts - }, "text", true); - - this.$rules = { - "start" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "@.*?{", - push: "media" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "media" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "\\}", - next: "pop" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "comment" : [{ - token : "comment", - regex : "\\*\\/", - next : "pop" - }, { - defaultToken : "comment" - }], - - "ruleset" : [ - { - token : "paren.rparen", - regex : "\\}", - next: "pop" - }, { - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - 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 : numRe - }, { - 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 : ["support.function", "string", "support.function"], - regex : "(url\\()(.*)(\\))" - }, { - token : keywordMapper, - regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*" - }, { - caseInsensitive: true - }] - }; - - this.normalizeRules(); -}; - -oop.inherits(CssHighlightRules, TextHighlightRules); - -exports.CssHighlightRules = CssHighlightRules; - -}); - -define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var JavaScriptHighlightRules = function() { - var keywordMapper = this.createKeywordMapper({ - "variable.language": - "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors - "Namespace|QName|XML|XMLList|" + // E4X - "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + - "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + - "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors - "SyntaxError|TypeError|URIError|" + - "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions - "isNaN|parseFloat|parseInt|" + - "JSON|Math|" + // Other - "this|arguments|prototype|window|document" , // Pseudo - "keyword": - "const|yield|import|get|set|" + - "break|case|catch|continue|default|delete|do|else|finally|for|function|" + - "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + - "__parent__|__count__|escape|unescape|with|__proto__|" + - "class|enum|extends|super|export|implements|private|public|interface|package|protected|static", - "storage.type": - "const|let|var|function", - "constant.language": - "null|Infinity|NaN|undefined", - "support.function": - "alert", - "constant.language.boolean": "true|false" - }, "identifier"); - var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; - var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\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 - ".)"; - - this.$rules = { - "no_regex" : [ - { - token : "comment", - regex : "\\/\\/", - next : "line_comment" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : /\/\*/, - next : "comment" - }, { - token : "string", - regex : "'(?=.)", - next : "qstring" - }, { - token : "string", - regex : '"(?=.)', - next : "qqstring" - }, { - token : "constant.numeric", // hex - regex : /0[xX][0-9a-fA-F]+\b/ - }, { - token : "constant.numeric", // float - regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/ - }, { - token : [ - "storage.type", "punctuation.operator", "support.function", - "punctuation.operator", "entity.name.function", "text","keyword.operator" - ], - regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "keyword.operator", "text", "storage.type", - "text", "paren.lparen" - ], - regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "punctuation.operator", - "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "text", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : "keyword", - regex : "(?:" + kwBeforeRe + ")\\b", - next : "start" - }, { - token : ["punctuation.operator", "support.function"], - regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/ - }, { - token : ["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 : keywordMapper, - regex : identifierRe - }, { - token : "keyword.operator", - regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/, - next : "start" - }, { - token : "punctuation.operator", - regex : /\?|\:|\,|\;|\./, - next : "start" - }, { - token : "paren.lparen", - regex : /[\[({]/, - next : "start" - }, { - token : "paren.rparen", - regex : /[\])}]/ - }, { - token : "keyword.operator", - regex : /\/=?/, - next : "start" - }, { - token: "comment", - regex: /^#!.*$/ - } - ], - "start": [ - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment_regex_allowed" - }, { - token : "comment", - regex : "\\/\\/", - next : "line_comment_regex_allowed" - }, { - token: "string.regexp", - regex: "\\/", - next: "regex" - }, { - token : "text", - regex : "\\s+|^$", - next : "start" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "regex": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "string.regexp", - regex: "/\\w*", - next: "no_regex" - }, { - token : "invalid", - regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ - }, { - token : "constant.language.escape", - regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/ - }, { - token : "constant.language.delimiter", - regex: /\|/ - }, { - token: "constant.language.escape", - regex: /\[\^?/, - next: "regex_character_class" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp" - } - ], - "regex_character_class": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "constant.language.escape", - regex: "]", - next: "regex" - }, { - token: "constant.language.escape", - regex: "-" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp.charachterclass" - } - ], - "function_arguments": [ - { - token: "variable.parameter", - regex: identifierRe - }, { - token: "punctuation.operator", - regex: "[, ]+" - }, { - token: "punctuation.operator", - regex: "$" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "comment_regex_allowed" : [ - {token : "comment", regex : "\\*\\/", next : "start"}, - {defaultToken : "comment"} - ], - "comment" : [ - {token : "comment", regex : "\\*\\/", next : "no_regex"}, - {defaultToken : "comment"} - ], - "line_comment_regex_allowed" : [ - {token : "comment", regex : "$|^", next : "start"}, - {defaultToken : "comment"} - ], - "line_comment" : [ - {token : "comment", regex : "$|^", next : "no_regex"}, - {defaultToken : "comment"} - ], - "qqstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qqstring" - }, { - token : "string", - regex : '"|$', - next : "no_regex" - }, { - defaultToken: "string" - } - ], - "qstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qstring" - }, { - token : "string", - regex : "'|$", - next : "no_regex" - }, { - defaultToken: "string" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("no_regex") ]); -}; - -oop.inherits(JavaScriptHighlightRules, TextHighlightRules); - -exports.JavaScriptHighlightRules = JavaScriptHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/xml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml_util', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var xmlUtil = require("./xml_util"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var XmlHighlightRules = function(normalize) { - this.$rules = { - start : [ - {token : "punctuation.string.begin", regex : "<\\!\\[CDATA\\[", next : "cdata"}, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)(xml)(?=[\\s])", next : "xml_declaration" - }, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)([-_a-zA-Z0-9]+)", next : "instruction" - }, - {token : "comment", regex : "<\\!--", next : "comment"}, - { - token : ["punctuation.doctype.begin", "meta.tag.doctype"], - regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype" - }, - {include : "tag"}, - {include : "reference"} - ], - - xml_declaration : [ - {include : "attributes"}, - {include : "instruction"} - ], - - instruction : [ - {token : "punctuation.instruction.end", regex : "\\?>", next : "start"} - ], - - doctype : [ - {include : "space"}, - {include : "string"}, - {token : "punctuation.doctype.end", regex : ">", next : "start"}, - {token : "xml-pe", regex : "[-_a-zA-Z0-9:]+"}, - {token : "punctuation.begin", regex : "\\[", push : "declarations"} - ], - - declarations : [{ - token : "text", - regex : "\\s+" - }, { - token: "punctuation.end", - regex: "]", - next: "pop" - }, { - token : ["punctuation.begin", "keyword"], - regex : "(<\\!)([-_a-zA-Z0-9]+)", - push : [{ - token : "text", - regex : "\\s+" - }, - { - token : "punctuation.end", - regex : ">", - next : "pop" - }, - {include : "string"}] - }], - - cdata : [ - {token : "string.end", regex : "\\]\\]>", next : "start"}, - {token : "text", regex : "\\s+"}, - {token : "text", regex : "(?:[^\\]]|\\](?!\\]>))+"} - ], - - comment : [ - {token : "comment", regex : "-->", next : "start"}, - {defaultToken : "comment"} - ], - - tag : [{ - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(<)((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)", - next: [ - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : "start"} - ] - }, { - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(", next : "start"} - ] - }], - - space : [ - {token : "text", regex : "\\s+"} - ], - - reference : [{ - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, { - token : "invalid.illegal", regex : "&" - }], - - string: [{ - token : "string", - regex : "'", - push : "qstring_inner" - }, { - token : "string", - regex : '"', - push : "qqstring_inner" - }], - - qstring_inner: [ - {token : "string", regex: "'", next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - qqstring_inner: [ - {token : "string", regex: '"', next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - attributes: [{ - token : "entity.other.attribute-name", - regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+" - }, { - token : "keyword.operator.separator", - regex : "=" - }, { - include : "space" - }, { - include : "string" - }] - }; - - if (this.constructor === XmlHighlightRules) - this.normalizeRules(); -}; - - -(function() { - - this.embedTagRules = function(HighlightRules, prefix, tag){ - this.$rules.tag.unshift({ - token : ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(<)(" + tag + ")", - next: [ - {include : "space"}, - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : prefix + "start"} - ] - }); - - this.$rules[tag + "-end"] = [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next: "start", - onMatch : function(value, currentState, stack) { - stack.splice(0); - return this.token; - }} - ] - - this.embedRules(HighlightRules, prefix, [{ - token: ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(" - }]); - }; - -}).call(TextHighlightRules.prototype); - -oop.inherits(XmlHighlightRules, TextHighlightRules); - -exports.XmlHighlightRules = XmlHighlightRules; -}); - -define('ace/mode/xml_util', ['require', 'exports', 'module' ], function(require, exports, module) { - - -function string(state) { - return [{ - token : "string", - regex : '"', - next : state + "_qqstring" - }, { - token : "string", - regex : "'", - next : state + "_qstring" - }]; -} - -function multiLineString(quote, state) { - return [ - {token : "string", regex : quote, next : state}, - { - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, - {defaultToken : "string"} - ]; -} - -exports.tag = function(states, name, nextState, tagMap) { - states[name] = [{ - token : "text", - regex : "\\s+" - }, { - - token : !tagMap ? "meta.tag.tag-name" : function(value) { - if (tagMap[value]) - return "meta.tag.tag-name." + tagMap[value]; - else - return "meta.tag.tag-name"; - }, - regex : "[-_a-zA-Z0-9:]+", - next : name + "_embed_attribute_list" - }, { - token: "empty", - regex: "", - next : 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"] = [{ - token : "meta.tag.r", - regex : "/?>", - next : nextState - }, { - token : "keyword.operator", - regex : "=" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "text", - regex : "\\s+" - }].concat(string(name)); -}; - -}); - -define('ace/mode/ruby_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var constantOtherSymbol = exports.constantOtherSymbol = { - token : "constant.other.symbol.ruby", // symbol - regex : "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?" -}; - -var qString = exports.qString = { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" -}; - -var qqString = exports.qqString = { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' -}; - -var tString = exports.tString = { - token : "string", // backtick string - regex : "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]" -}; - -var constantNumericHex = exports.constantNumericHex = { - token : "constant.numeric", // hex - regex : "0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b" -}; - -var constantNumericFloat = exports.constantNumericFloat = { - token : "constant.numeric", // float - regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?\\b" -}; - -var RubyHighlightRules = function() { - - var builtinFunctions = ( - "abort|Array|assert|assert_equal|assert_not_equal|assert_same|assert_not_same|" + - "assert_nil|assert_not_nil|assert_match|assert_no_match|assert_in_delta|assert_throws|" + - "assert_raise|assert_nothing_raised|assert_instance_of|assert_kind_of|assert_respond_to|" + - "assert_operator|assert_send|assert_difference|assert_no_difference|assert_recognizes|" + - "assert_generates|assert_response|assert_redirected_to|assert_template|assert_select|" + - "assert_select_email|assert_select_rjs|assert_select_encoded|css_select|at_exit|" + - "attr|attr_writer|attr_reader|attr_accessor|attr_accessible|autoload|binding|block_given?|callcc|" + - "caller|catch|chomp|chomp!|chop|chop!|defined?|delete_via_redirect|eval|exec|exit|" + - "exit!|fail|Float|flunk|follow_redirect!|fork|form_for|form_tag|format|gets|global_variables|gsub|" + - "gsub!|get_via_redirect|host!|https?|https!|include|Integer|lambda|link_to|" + - "link_to_unless_current|link_to_function|link_to_remote|load|local_variables|loop|open|open_session|" + - "p|print|printf|proc|putc|puts|post_via_redirect|put_via_redirect|raise|rand|" + - "raw|readline|readlines|redirect?|request_via_redirect|require|scan|select|" + - "set_trace_func|sleep|split|sprintf|srand|String|stylesheet_link_tag|syscall|system|sub|sub!|test|" + - "throw|trace_var|trap|untrace_var|atan2|cos|exp|frexp|ldexp|log|log10|sin|sqrt|tan|" + - "render|javascript_include_tag|csrf_meta_tag|label_tag|text_field_tag|submit_tag|check_box_tag|" + - "content_tag|radio_button_tag|text_area_tag|password_field_tag|hidden_field_tag|" + - "fields_for|select_tag|options_for_select|options_from_collection_for_select|collection_select|" + - "time_zone_select|select_date|select_time|select_datetime|date_select|time_select|datetime_select|" + - "select_year|select_month|select_day|select_hour|select_minute|select_second|file_field_tag|" + - "file_field|respond_to|skip_before_filter|around_filter|after_filter|verify|" + - "protect_from_forgery|rescue_from|helper_method|redirect_to|before_filter|" + - "send_data|send_file|validates_presence_of|validates_uniqueness_of|validates_length_of|" + - "validates_format_of|validates_acceptance_of|validates_associated|validates_exclusion_of|" + - "validates_inclusion_of|validates_numericality_of|validates_with|validates_each|" + - "authenticate_or_request_with_http_basic|authenticate_or_request_with_http_digest|" + - "filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" + - "translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|" + - "cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" + - "has_many|has_one|belongs_to|has_and_belongs_to_many" - ); - - var keywords = ( - "alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" + - "__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" + - "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield" - ); - - var buildinConstants = ( - "true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" + - "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING" - ); - - var builtinVariables = ( - "\$DEBUG|\$defout|\$FILENAME|\$LOAD_PATH|\$SAFE|\$stdin|\$stdout|\$stderr|\$VERBOSE|" + - "$!|root_url|flash|session|cookies|params|request|response|logger|self" - ); - - var keywordMapper = this.$keywords = this.createKeywordMapper({ - "keyword": keywords, - "constant.language": buildinConstants, - "variable.language": builtinVariables, - "support.function": builtinFunctions, - "invalid.deprecated": "debugger" // TODO is this a remnant from js mode? - }, "identifier"); - - this.$rules = { - "start" : [ - { - token : "comment", - regex : "#.*$" - }, { - token : "comment", // multi line comment - regex : "^=begin(?:$|\\s.*$)", - next : "comment" - }, { - token : "string.regexp", - regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" - }, - - qString, - qqString, - tString, - - { - token : "text", // namespaces aren't symbols - regex : "::" - }, { - token : "variable.instance", // instance variable - regex : "@{1,2}[a-zA-Z_\\d]+" - }, { - token : "support.class", // class name - regex : "[A-Z][a-zA-Z_\\d]+" - }, - - constantOtherSymbol, - constantNumericHex, - constantNumericFloat, - - { - token : "constant.language.boolean", - regex : "(?:true|false)\\b" - }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" - }, { - token : "punctuation.separator.key-value", - regex : "=>" - }, { - stateName: "heredoc", - onMatch : function(value, currentState, stack) { - var next = value[2] == '-' ? "indentedHeredoc" : "heredoc"; - var tokens = value.split(this.splitRegex); - stack.push(next, tokens[3]); - return [ - {type:"constant", value: tokens[1]}, - {type:"string", value: tokens[2]}, - {type:"support.class", value: tokens[3]}, - {type:"string", value: tokens[4]} - ]; - }, - regex : "(<<-?)(['\"`]?)([\\w]+)(['\"`]?)", - rules: { - heredoc: [{ - onMatch: function(value, currentState, stack) { - if (value == stack[1]) { - stack.shift(); - stack.shift(); - return "support.class"; - } - return "string"; - }, - regex: ".*$", - next: "start" - }], - indentedHeredoc: [{ - token: "string", - regex: "^ +" - }, { - onMatch: function(value, currentState, stack) { - if (value == stack[1]) { - stack.shift(); - stack.shift(); - return "support.class"; - } - return "string"; - }, - regex: ".*$", - next: "start" - }] - } - }, { - token : "keyword.operator", - regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" - }, { - token : "paren.lparen", - regex : "[[({]" - }, { - token : "paren.rparen", - regex : "[\\])}]" - }, { - token : "text", - regex : "\\s+" - } - ], - "comment" : [ - { - token : "comment", // closing comment - regex : "^=end(?:$|\\s.*$)", - next : "start" - }, { - token : "comment", // comment spanning whole line - regex : ".+" - } - ] - }; - - this.normalizeRules(); -}; - -oop.inherits(RubyHighlightRules, TextHighlightRules); - -exports.RubyHighlightRules = RubyHighlightRules; -}); - -define('ace/mode/html', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/javascript', 'ace/mode/css', 'ace/tokenizer', 'ace/mode/html_highlight_rules', 'ace/mode/behaviour/html', 'ace/mode/folding/html', 'ace/mode/html_completions'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var JavaScriptMode = require("./javascript").Mode; -var CssMode = require("./css").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; -var HtmlBehaviour = require("./behaviour/html").HtmlBehaviour; -var HtmlFoldMode = require("./folding/html").FoldMode; -var HtmlCompletions = require("./html_completions").HtmlCompletions; - -var Mode = function() { - this.HighlightRules = HtmlHighlightRules; - this.$behaviour = new HtmlBehaviour(); - this.$completer = new HtmlCompletions(); - - this.createModeDelegates({ - "js-": JavaScriptMode, - "css-": CssMode - }); - - this.foldingRules = new HtmlFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.blockComment = {start: ""}; - - this.getNextLineIndent = function(state, line, tab) { - return this.$getIndent(line); - }; - - this.checkOutdent = function(state, line, input) { - return false; - }; - - this.getCompletions = function(state, session, pos, prefix) { - return this.$completer.getCompletions(state, session, pos, prefix); - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/javascript', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/javascript_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/worker/worker_client', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var Range = require("../range").Range; -var WorkerClient = require("../worker/worker_client").WorkerClient; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = JavaScriptHighlightRules; - - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().getLineTokens(line, state); - var tokens = tokenizedLine.tokens; - var endState = tokenizedLine.state; - - if (tokens.length && tokens[tokens.length-1].type == "comment") { - return indent; - } - - if (state == "start" || state == "no_regex") { - var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/); - if (match) { - indent += tab; - } - } else if (state == "doc-start") { - if (endState == "start" || endState == "no_regex") { - return ""; - } - var match = line.match(/^\s*(\/?)\*/); - if (match) { - if (match[1]) { - indent += " "; - } - indent += "* "; - } - } - - 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); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker"); - worker.attachToDocument(session.getDocument()); - - worker.on("jslint", function(results) { - session.setAnnotations(results.data); - }); - - worker.on("terminate", function() { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); - -define('ace/mode/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/css_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/worker/worker_client', 'ace/mode/behaviour/css', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var WorkerClient = require("../worker/worker_client").WorkerClient; -var CssBehaviour = require("./behaviour/css").CssBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = CssHighlightRules; - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CssBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.foldingRules = "cStyle"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - var tokens = this.getTokenizer().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); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker"); - worker.attachToDocument(session.getDocument()); - - worker.on("csslint", function(e) { - session.setAnnotations(e.data); - }); - - worker.on("terminate", function() { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; - -}); - -define('ace/mode/behaviour/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; - -var CssBehaviour = function () { - - this.inherit(CstyleBehaviour); - - this.add("colon", "insertion", function (state, action, editor, session, text) { - if (text === ':') { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - var token = iterator.getCurrentToken(); - if (token && token.value.match(/\s+/)) { - token = iterator.stepBackward(); - } - if (token && token.type === 'support.type') { - var line = session.doc.getLine(cursor.row); - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar === ':') { - return { - text: '', - selection: [1, 1] - } - } - if (!line.substring(cursor.column).match(/^\s*;/)) { - return { - text: ':;', - selection: [1, 1] - } - } - } - } - }); - - this.add("colon", "deletion", function (state, action, editor, session, range) { - var selected = session.doc.getTextRange(range); - if (!range.isMultiLine() && selected === ':') { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - var token = iterator.getCurrentToken(); - if (token && token.value.match(/\s+/)) { - token = iterator.stepBackward(); - } - if (token && token.type === 'support.type') { - 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("semicolon", "insertion", function (state, action, editor, session, text) { - if (text === ';') { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar === ';') { - return { - text: '', - selection: [1, 1] - } - } - } - }); - -} -oop.inherits(CssBehaviour, CstyleBehaviour); - -exports.CssBehaviour = CssBehaviour; -}); - -define('ace/mode/behaviour/html', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour/xml', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var XmlBehaviour = require("../behaviour/xml").XmlBehaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var voidElements = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']; - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); - return hasType; -} - -var HtmlBehaviour = function () { - - this.inherit(XmlBehaviour); // Get xml behaviour - - this.add("autoclosing", "insertion", function (state, action, editor, session, text) { - if (text == '>') { - var position = editor.getCursorPosition(); - var iterator = new TokenIterator(session, position.row, position.column); - var token = iterator.getCurrentToken(); - - if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column) - return; - var atCursor = false; - if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text'))); - } else { - atCursor = true; - } - if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) { - return; - } - var element = token.value; - if (atCursor){ - var element = element.substring(0, position.column - token.start); - } - if (voidElements.indexOf(element) !== -1){ - return; - } - return { - text: '>' + '', - selection: [1, 1] - } - } - }); -} -oop.inherits(HtmlBehaviour, XmlBehaviour); - -exports.HtmlBehaviour = HtmlBehaviour; -}); - -define('ace/mode/behaviour/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); - return hasType; -} - -var XmlBehaviour = function () { - - this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour - - this.add("autoclosing", "insertion", function (state, action, editor, session, text) { - if (text == '>') { - var position = editor.getCursorPosition(); - var iterator = new TokenIterator(session, position.row, position.column); - var token = iterator.getCurrentToken(); - - if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column) - return; - var atCursor = false; - if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text'))); - } else { - atCursor = true; - } - if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) { - return; - } - var tag = token.value; - if (atCursor){ - var tag = tag.substring(0, position.column - token.start); - } - - return { - text: '>' + '', - selection: [1, 1] - } - } - }); - - this.add('autoindent', 'insertion', function (state, action, editor, session, text) { - if (text == "\n") { - var cursor = editor.getCursorPosition(); - var line = session.getLine(cursor.row); - var rightChars = line.substring(cursor.column, cursor.column + 2); - if (rightChars == '?)/; - this._parseTag = function(tag) { - - var match = tag.match(this.tagRe); - var column = 0; - - return { - value: tag, - match: match ? match[2] : "", - closing: match ? !!match[3] : false, - selfClosing: match ? !!match[5] || match[2] == "/>" : false, - tagName: match ? match[4] : "", - column: match[1] ? column + match[1].length : column - }; - }; - this._readTagForward = function(iterator) { - var token = iterator.getCurrentToken(); - if (!token) - return null; - - var value = ""; - var start; - - do { - if (token.type.lastIndexOf("meta.tag", 0) === 0) { - if (!start) { - var start = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() - }; - } - value += token.value; - if (value.indexOf(">") !== -1) { - var tag = this._parseTag(value); - tag.start = start; - tag.end = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() + token.value.length - }; - iterator.stepForward(); - return tag; - } - } - } while(token = iterator.stepForward()); - - return null; - }; - - this._readTagBackward = function(iterator) { - var token = iterator.getCurrentToken(); - if (!token) - return null; - - var value = ""; - var end; - - do { - if (token.type.lastIndexOf("meta.tag", 0) === 0) { - if (!end) { - end = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() + token.value.length - }; - } - value = token.value + value; - if (value.indexOf("<") !== -1) { - var tag = this._parseTag(value); - tag.end = end; - tag.start = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() - }; - iterator.stepBackward(); - return tag; - } - } - } while(token = iterator.stepBackward()); - - return null; - }; - - this._pop = function(stack, tag) { - while (stack.length) { - - var top = stack[stack.length-1]; - if (!tag || top.tagName == tag.tagName) { - return stack.pop(); - } - else if (this.voidElements[tag.tagName]) { - return; - } - else if (this.voidElements[top.tagName]) { - stack.pop(); - continue; - } else { - return null; - } - } - }; - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var firstTag = this._getFirstTagInLine(session, row); - - if (!firstTag.match) - return null; - - var isBackward = firstTag.closing || firstTag.selfClosing; - var stack = []; - var tag; - - if (!isBackward) { - var iterator = new TokenIterator(session, row, firstTag.column); - var start = { - row: row, - column: firstTag.column + firstTag.tagName.length + 2 - }; - while (tag = this._readTagForward(iterator)) { - if (tag.selfClosing) { - if (!stack.length) { - tag.start.column += tag.tagName.length + 2; - tag.end.column -= 2; - return Range.fromPoints(tag.start, tag.end); - } else - continue; - } - - if (tag.closing) { - this._pop(stack, tag); - if (stack.length == 0) - return Range.fromPoints(start, tag.start); - } - else { - stack.push(tag) - } - } - } - else { - var iterator = new TokenIterator(session, row, firstTag.column + firstTag.match.length); - var end = { - row: row, - column: firstTag.column - }; - - while (tag = this._readTagBackward(iterator)) { - if (tag.selfClosing) { - if (!stack.length) { - tag.start.column += tag.tagName.length + 2; - tag.end.column -= 2; - return Range.fromPoints(tag.start, tag.end); - } else - continue; - } - - if (!tag.closing) { - this._pop(stack, tag); - if (stack.length == 0) { - tag.start.column += tag.tagName.length + 2; - return Range.fromPoints(tag.start, end); - } - } - else { - stack.push(tag) - } - } - } - - }; - -}).call(FoldMode.prototype); - -}); - -define('ace/mode/html_completions', ['require', 'exports', 'module' , 'ace/token_iterator'], function(require, exports, module) { - - -var TokenIterator = require("../token_iterator").TokenIterator; - -var commonAttributes = [ - "accesskey", - "class", - "contenteditable", - "contextmenu", - "dir", - "draggable", - "dropzone", - "hidden", - "id", - "lang", - "spellcheck", - "style", - "tabindex", - "title", - "translate" -]; - -var eventAttributes = [ - "onabort", - "onblur", - "oncancel", - "oncanplay", - "oncanplaythrough", - "onchange", - "onclick", - "onclose", - "oncontextmenu", - "oncuechange", - "ondblclick", - "ondrag", - "ondragend", - "ondragenter", - "ondragleave", - "ondragover", - "ondragstart", - "ondrop", - "ondurationchange", - "onemptied", - "onended", - "onerror", - "onfocus", - "oninput", - "oninvalid", - "onkeydown", - "onkeypress", - "onkeyup", - "onload", - "onloadeddata", - "onloadedmetadata", - "onloadstart", - "onmousedown", - "onmousemove", - "onmouseout", - "onmouseover", - "onmouseup", - "onmousewheel", - "onpause", - "onplay", - "onplaying", - "onprogress", - "onratechange", - "onreset", - "onscroll", - "onseeked", - "onseeking", - "onselect", - "onshow", - "onstalled", - "onsubmit", - "onsuspend", - "ontimeupdate", - "onvolumechange", - "onwaiting" -]; - -var globalAttributes = commonAttributes.concat(eventAttributes); - -var attributeMap = { - "html": ["manifest"], - "head": [], - "title": [], - "base": ["href", "target"], - "link": ["href", "hreflang", "rel", "media", "type", "sizes"], - "meta": ["http-equiv", "name", "content", "charset"], - "style": ["type", "media", "scoped"], - "script": ["charset", "type", "src", "defer", "async"], - "noscript": ["href"], - "body": ["onafterprint", "onbeforeprint", "onbeforeunload", "onhashchange", "onmessage", "onoffline", "onpopstate", "onredo", "onresize", "onstorage", "onundo", "onunload"], - "section": [], - "nav": [], - "article": ["pubdate"], - "aside": [], - "h1": [], - "h2": [], - "h3": [], - "h4": [], - "h5": [], - "h6": [], - "header": [], - "footer": [], - "address": [], - "main": [], - "p": [], - "hr": [], - "pre": [], - "blockquote": ["cite"], - "ol": ["start", "reversed"], - "ul": [], - "li": ["value"], - "dl": [], - "dt": [], - "dd": [], - "figure": [], - "figcaption": [], - "div": [], - "a": ["href", "target", "ping", "rel", "media", "hreflang", "type"], - "em": [], - "strong": [], - "small": [], - "s": [], - "cite": [], - "q": ["cite"], - "dfn": [], - "abbr": [], - "data": [], - "time": ["datetime"], - "code": [], - "var": [], - "samp": [], - "kbd": [], - "sub": [], - "sup": [], - "i": [], - "b": [], - "u": [], - "mark": [], - "ruby": [], - "rt": [], - "rp": [], - "bdi": [], - "bdo": [], - "span": [], - "br": [], - "wbr": [], - "ins": ["cite", "datetime"], - "del": ["cite", "datetime"], - "img": ["alt", "src", "height", "width", "usemap", "ismap"], - "iframe": ["name", "src", "height", "width", "sandbox", "seamless"], - "embed": ["src", "height", "width", "type"], - "object": ["param", "data", "type", "height" , "width", "usemap", "name", "form", "classid"], - "param": ["name", "value"], - "video": ["src", "autobuffer", "autoplay", "loop", "controls", "width", "height", "poster"], - "audio": ["src", "autobuffer", "autoplay", "loop", "controls"], - "source": ["src", "type", "media"], - "track": ["kind", "src", "srclang", "label", "default"], - "canvas": ["width", "height"], - "map": ["name"], - "area": ["shape", "coords", "href", "hreflang", "alt", "target", "media", "rel", "ping", "type"], - "svg": [], - "math": [], - "table": ["summary"], - "caption": [], - "colgroup": ["span"], - "col": ["span"], - "tbody": [], - "thead": [], - "tfoot": [], - "tr": [], - "td": ["headers", "rowspan", "colspan"], - "th": ["headers", "rowspan", "colspan", "scope"], - "form": ["accept-charset", "action", "autocomplete", "enctype", "method", "name", "novalidate", "target"], - "fieldset": ["disabled", "form", "name"], - "legend": [], - "label": ["form", "for"], - "input": ["type", "accept", "alt", "autocomplete", "checked", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "height", "list", "max", "maxlength", "min", "multiple", "pattern", "placeholder", "readonly", "required", "size", "src", "step", "width", "files", "value"], - "button": ["autofocus", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "name", "value", "type"], - "select": ["autofocus", "disabled", "form", "multiple", "name", "size"], - "datalist": [], - "optgroup": ["disabled", "label"], - "option": ["disabled", "selected", "label", "value"], - "textarea": ["autofocus", "disabled", "form", "maxlength", "name", "placeholder", "readonly", "required", "rows", "cols", "wrap"], - "keygen": ["autofocus", "challenge", "disabled", "form", "keytype", "name"], - "output": ["for", "form", "name"], - "progress": ["value", "max"], - "meter": ["value", "min", "max", "low", "high", "optimum"], - "details": ["open"], - "summary": [], - "command": ["type", "label", "icon", "disabled", "checked", "radiogroup", "command"], - "menu": ["type", "label"], - "dialog": ["open"] -}; - -var allElements = Object.keys(attributeMap); - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); -} - -function findTagName(session, pos) { - var iterator = new TokenIterator(session, pos.row, pos.column); - var token = iterator.getCurrentToken(); - if (!token || !hasType(token, 'tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'operator') || hasType(token, 'attribute-name') || hasType(token, 'text'))); - } - if (token && hasType(token, 'tag-name') && !iterator.stepBackward().value.match('/')) - return token.value; -} - -var HtmlCompletions = function() { - -}; - -(function() { - - this.getCompletions = function(state, session, pos, prefix) { - var token = session.getTokenAt(pos.row, pos.column); - - if (!token) - return []; - if (hasType(token, "tag-name") || (token.value == '<' && hasType(token, "text"))) - return this.getTagCompletions(state, session, pos, prefix); - if (hasType(token, 'text') || hasType(token, 'attribute-name')) - return this.getAttributeCompetions(state, session, pos, prefix); - - return []; - }; - - this.getTagCompletions = function(state, session, pos, prefix) { - var elements = allElements; - if (prefix) { - elements = elements.filter(function(element){ - return element.indexOf(prefix) === 0; - }); - } - return elements.map(function(element){ - return { - value: element, - meta: "tag" - }; - }); - }; - - this.getAttributeCompetions = function(state, session, pos, prefix) { - var tagName = findTagName(session, pos); - if (!tagName) - return []; - var attributes = globalAttributes; - if (tagName in attributeMap) { - attributes = attributes.concat(attributeMap[tagName]); - } - if (prefix) { - attributes = attributes.filter(function(attribute){ - return attribute.indexOf(prefix) === 0; - }); - } - return attributes.map(function(attribute){ - return { - caption: attribute, - snippet: attribute + '="$0"', - meta: "attribute" - }; - }); - }; - -}).call(HtmlCompletions.prototype); - -exports.HtmlCompletions = HtmlCompletions; -}); - -define('ace/mode/ruby', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/ruby_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/mode/folding/coffee'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var RubyHighlightRules = require("./ruby_highlight_rules").RubyHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var Range = require("../range").Range; -var FoldMode = require("./folding/coffee").FoldMode; - -var Mode = function() { - this.HighlightRules = RubyHighlightRules; - this.$outdent = new MatchingBraceOutdent(); - this.foldingRules = new FoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - - this.lineCommentStart = "#"; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().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*$/); - var startingClassOrMethod = line.match(/^\s*(class|def)\s.*$/); - var startingDoBlock = line.match(/.*do(\s*|\s+\|.*\|\s*)$/); - var startingConditional = line.match(/^\s*(if|else)\s*/) - if (match || startingClassOrMethod || startingDoBlock || startingConditional) { - indent += tab; - } - } - - return indent; - }; - - this.checkOutdent = function(state, line, input) { - return /^\s+end$/.test(line + input) || /^\s+}$/.test(line + input) || /^\s+else$/.test(line + input); - }; - - this.autoOutdent = function(state, doc, row) { - 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; -}); - -define('ace/mode/folding/coffee', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var BaseFoldMode = require("./fold_mode").FoldMode; -var Range = require("../../range").Range; - -var FoldMode = exports.FoldMode = function() {}; -oop.inherits(FoldMode, BaseFoldMode); - -(function() { - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var range = this.indentationBlock(session, row); - if (range) - return range; - - var re = /\S/; - var line = session.getLine(row); - var startLevel = line.search(re); - if (startLevel == -1 || line[startLevel] != "#") - return; - - var startColumn = line.length; - var maxRow = session.getLength(); - var startRow = row; - var endRow = row; - - while (++row < maxRow) { - line = session.getLine(row); - var level = line.search(re); - - if (level == -1) - continue; - - if (line[level] != "#") - break; - - endRow = row; - } - - if (endRow > startRow) { - var endColumn = session.getLine(endRow).length; - return new Range(startRow, startColumn, endRow, endColumn); - } - }; - this.getFoldWidget = function(session, foldStyle, row) { - var line = session.getLine(row); - var indent = line.search(/\S/); - var next = session.getLine(row + 1); - var prev = session.getLine(row - 1); - var prevIndent = prev.search(/\S/); - var nextIndent = next.search(/\S/); - - if (indent == -1) { - session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : ""; - return ""; - } - if (prevIndent == -1) { - if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") { - session.foldWidgets[row - 1] = ""; - session.foldWidgets[row + 1] = ""; - return "start"; - } - } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") { - if (session.getLine(row - 2).search(/\S/) == -1) { - session.foldWidgets[row - 1] = "start"; - session.foldWidgets[row + 1] = ""; - return ""; - } - } - - if (prevIndent!= -1 && prevIndent < indent) - session.foldWidgets[row - 1] = "start"; - else - session.foldWidgets[row - 1] = ""; - - if (indent < nextIndent) - return "start"; - else - return ""; - }; - -}).call(FoldMode.prototype); - -}); diff --git a/addons/editor/ace/mode-jack.js b/addons/editor/ace/mode-jack.js deleted file mode 100644 index a89d329f..00000000 --- a/addons/editor/ace/mode-jack.js +++ /dev/null @@ -1,606 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2010, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/mode/jack', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/jack_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var HighlightRules = require("./jack_highlight_rules").JackHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = HighlightRules; - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "--"; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - if (state == "start") { - 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; -}); - -define('ace/mode/jack_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var JackHighlightRules = function() { - this.$rules = { - "start" : [ - { - token : "string", - regex : '"', - next : "string2" - }, { - token : "string", - regex : "'", - next : "string1" - }, { - token : "constant.numeric", // hex - regex: "-?0[xX][0-9a-fA-F]+\\b" - }, { - token : "constant.numeric", // float - regex : "(?:0|[-+]?[1-9][0-9]*)\\b" - }, { - token : "constant.binary", - regex : "<[0-9A-Fa-f][0-9A-Fa-f](\\s+[0-9A-Fa-f][0-9A-Fa-f])*>" - }, { - token : "constant.language.boolean", - regex : "(?:true|false)\\b" - }, { - token : "constant.language.null", - regex : "null\\b" - }, { - token : "storage.type", - regex: "(?:Integer|Boolean|Null|String|Buffer|Tuple|List|Object|Function|Coroutine|Form)\\b" - }, { - token : "keyword", - regex : "(?:return|abort|vars|for|delete|in|is|escape|exec|split|and|if|elif|else|while)\\b" - }, { - token : "language.builtin", - regex : "(?:lines|source|parse|read-stream|interval|substr|parseint|write|print|range|rand|inspect|bind|i-values|i-pairs|i-map|i-filter|i-chunk|i-all\\?|i-any\\?|i-collect|i-zip|i-merge|i-each)\\b" - }, { - token : "comment", - regex : "--.*$" - }, { - token : "paren.lparen", - regex : "[[({]" - }, { - token : "paren.rparen", - regex : "[\\])}]" - }, { - token : "storage.form", - regex : "@[a-z]+" - }, { - token : "constant.other.symbol", - regex : ':+[a-zA-Z_]([-]?[a-zA-Z0-9_])*[?!]?' - }, { - token : "variable", - regex : '[a-zA-Z_]([-]?[a-zA-Z0-9_])*[?!]?' - }, { - token : "keyword.operator", - regex : "\\|\\||\\^\\^|&&|!=|==|<=|<|>=|>|\\+|-|\\*|\\/|\\^|\\%|\\#|\\!" - }, { - token : "text", - regex : "\\s+" - } - ], - "string1" : [ - { - token : "constant.language.escape", - regex : /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|['"\\\/bfnrt])/ - }, { - token : "string", - regex : "[^'\\\\]+" - }, { - token : "string", - regex : "'", - next : "start" - }, { - token : "string", - regex : "", - next : "start" - } - ], - "string2" : [ - { - token : "constant.language.escape", - regex : /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|['"\\\/bfnrt])/ - }, { - token : "string", - regex : '[^"\\\\]+' - }, { - token : "string", - regex : '"', - next : "start" - }, { - token : "string", - regex : "", - next : "start" - } - ] - }; - -}; - -oop.inherits(JackHighlightRules, TextHighlightRules); - -exports.JackHighlightRules = JackHighlightRules; -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); diff --git a/addons/editor/ace/mode-jade.js b/addons/editor/ace/mode-jade.js deleted file mode 100644 index 939ecea4..00000000 --- a/addons/editor/ace/mode-jade.js +++ /dev/null @@ -1,2075 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2012, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * Contributor(s): - * - * Garen J. Torikian - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/mode/jade', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/jade_highlight_rules', 'ace/mode/folding/coffee'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var JadeHighlightRules = require("./jade_highlight_rules").JadeHighlightRules; -var FoldMode = require("./folding/coffee").FoldMode; - -var Mode = function() { - this.HighlightRules = JadeHighlightRules; - - this.foldingRules = new FoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - this.lineCommentStart = "//"; -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/jade_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules', 'ace/mode/markdown_highlight_rules', 'ace/mode/scss_highlight_rules', 'ace/mode/less_highlight_rules', 'ace/mode/coffee_highlight_rules', 'ace/mode/javascript_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var MarkdownHighlightRules = require("./markdown_highlight_rules").MarkdownHighlightRules; -var SassHighlightRules = require("./scss_highlight_rules").ScssHighlightRules; -var LessHighlightRules = require("./less_highlight_rules").LessHighlightRules; -var CoffeeHighlightRules = require("./coffee_highlight_rules").CoffeeHighlightRules; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; - -function mixin_embed(tag, prefix) { - return { - token : "entity.name.function.jade", - regex : "^\\s*\\:" + tag, - next : prefix + "start" - }; -} - -var JadeHighlightRules = function() { - - 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 - ".)"; - - this.$rules = - { - "start": [ - { - token: "keyword.control.import.include.jade", - regex: "\\s*\\binclude\\b" - }, - { - token: "keyword.other.doctype.jade", - regex: "^!!!\\s*(?:[a-zA-Z0-9-_]+)?" - }, - { - token : "punctuation.section.comment", - regex : "^\\s*\/\/(?:\\s*[^-\\s]|\\s+\\S)(?:.*$)" - }, - { - onMatch: function(value, currentState, stack) { - stack.unshift(this.next, value.length - 2, currentState); - return "comment"; - }, - regex: /^\s*\/\//, - next: "comment_block" - }, - mixin_embed("markdown", "markdown-"), - mixin_embed("sass", "sass-"), - mixin_embed("less", "less-"), - mixin_embed("coffee", "coffee-"), - { - token: [ "storage.type.function.jade", - "entity.name.function.jade", - "punctuation.definition.parameters.begin.jade", - "variable.parameter.function.jade", - "punctuation.definition.parameters.end.jade" - ], - regex: "^(\\s*mixin)( [\\w\\-]+)(\\s*\\()(.*?)(\\))" - }, - { - token: [ "storage.type.function.jade", "entity.name.function.jade"], - regex: "^(\\s*mixin)( [\\w\\-]+)" - }, - { - token: "source.js.embedded.jade", - regex: "^\\s*(?:-|=|!=)", - next: "js-start" - }, - { - token: "string.interpolated.jade", - regex: "[#!]\\{[^\\}]+\\}" - }, - { - token: "meta.tag.any.jade", - regex: /^\s*(?!\w+\:)(?:[\w]+|(?=\.|#)])/, - next: "tag_single" - }, - { - token: "suport.type.attribute.id.jade", - regex: "#\\w+" - }, - { - token: "suport.type.attribute.class.jade", - regex: "\\.\\w+" - }, - { - token: "punctuation", - regex: "\\s*(?:\\()", - next: "tag_attributes" - } - ], - "comment_block": [ - {regex: /^\s*/, onMatch: function(value, currentState, stack) { - if (value.length <= stack[1]) { - stack.shift(); - stack.shift(); - this.next = stack.shift(); - return "text"; - } else { - this.next = ""; - return "comment"; - } - }, next: "start"}, - {defaultToken: "comment"} - ], - "tag_single": [ - { - token: "entity.other.attribute-name.class.jade", - regex: "\\.[\\w-]+" - }, - { - token: "entity.other.attribute-name.id.jade", - regex: "#[\\w-]+" - }, - { - token: ["text", "punctuation"], - regex: "($)|((?!\\.|#|=|-))", - next: "start" - } - ], - "tag_attributes": [ - { - token : "string", - regex : "'(?=.)", - next : "qstring" - }, - { - token : "string", - regex : '"(?=.)', - next : "qqstring" - }, - { - token: "entity.other.attribute-name.jade", - regex: "\\b[a-zA-Z\\-:]+" - }, - { - token: ["entity.other.attribute-name.jade", "punctuation"], - regex: "\\b([a-zA-Z:\\.-]+)(=)", - next: "attribute_strings" - }, - { - token: "punctuation", - regex: "\\)", - next: "start" - } - ], - "attribute_strings": [ - { - token : "string", - regex : "'(?=.)", - next : "qstring" - }, - { - token : "string", - regex : '"(?=.)', - next : "qqstring" - } - ], - "qqstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : '[^"\\\\]+' - }, { - token : "string", - regex : "\\\\$", - next : "qqstring" - }, { - token : "string", - regex : '"|$', - next : "tag_attributes" - } - ], - "qstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "[^'\\\\]+" - }, { - token : "string", - regex : "\\\\$", - next : "qstring" - }, { - token : "string", - regex : "'|$", - next : "tag_attributes" - } - ] -}; - - this.embedRules(JavaScriptHighlightRules, "js-", [{ - token: "text", - regex: ".$", - next: "start" - }]); -}; - -oop.inherits(JadeHighlightRules, TextHighlightRules); - -exports.JadeHighlightRules = JadeHighlightRules; -}); - -define('ace/mode/markdown_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules', 'ace/mode/javascript_highlight_rules', 'ace/mode/xml_highlight_rules', 'ace/mode/html_highlight_rules', 'ace/mode/css_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; -var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; - -var escaped = function(ch) { - return "(?:[^" + lang.escapeRegExp(ch) + "\\\\]|\\\\.)*"; -} - -function github_embed(tag, prefix) { - return { // Github style block - token : "support.function", - regex : "^```" + tag + "\\s*$", - push : prefix + "start" - }; -} - -var MarkdownHighlightRules = function() { - HtmlHighlightRules.call(this); - - this.$rules["start"].unshift({ - token : "empty_line", - regex : '^$', - next: "allowBlock" - }, { // h1 - token: "markup.heading.1", - regex: "^=+(?=\\s*$)" - }, { // h2 - token: "markup.heading.2", - regex: "^\\-+(?=\\s*$)" - }, { - token : function(value) { - return "markup.heading." + value.length; - }, - regex : /^#{1,6}(?=\s*[^ #]|\s+#.)/, - next : "header" - }, - github_embed("(?:javascript|js)", "jscode-"), - github_embed("xml", "xmlcode-"), - github_embed("html", "htmlcode-"), - github_embed("css", "csscode-"), - { // Github style block - token : "support.function", - regex : "^```\\s*[a-zA-Z]*(?:{.*?\\})?\\s*$", - next : "githubblock" - }, { // block quote - token : "string", - regex : "^>[ ].+$", - next : "blockquote" - }, { // HR * - _ - token : "constant", - regex : "^ {0,2}(?:(?: ?\\* ?){3,}|(?: ?\\- ?){3,}|(?: ?\\_ ?){3,})\\s*$", - next: "allowBlock" - }, { // list - token : "markup.list", - regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+", - next : "listblock-start" - }, { - include : "basic" - }); - - this.addRules({ - "basic" : [{ - token : "constant.language.escape", - regex : /\\[\\`*_{}\[\]()#+\-.!]/ - }, { // code span ` - token : "support.function", - regex : "(`+)(.*?[^`])(\\1)" - }, { // reference - token : ["text", "constant", "text", "url", "string", "text"], - regex : "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?(\\s*))$" - }, { // link by reference - token : ["text", "string", "text", "constant", "text"], - regex : "(\\[)(" + escaped("]") + ")(\\]\s*\\[)("+ escaped("]") + ")(\\])" - }, { // link by url - token : ["text", "string", "text", "markup.underline", "string", "text"], - regex : "(\\[)(" + // [ - escaped("]") + // link text - ")(\\]\\()"+ // ]( - '((?:[^\\)\\s\\\\]|\\\\.|\\s(?=[^"]))*)' + // href - '(\\s*"' + escaped('"') + '"\\s*)?' + // "title" - "(\\))" // ) - }, { // strong ** __ - token : "string", - regex : "([*]{2}|[_]{2}(?=\\S))(.*?\\S[*_]*)(\\1)" - }, { // emphasis * _ - token : "string", - regex : "([*]|[_](?=\\S))(.*?\\S[*_]*)(\\1)" - }, { // - token : ["text", "url", "text"], - regex : "(<)("+ - "(?:https?|ftp|dict):[^'\">\\s]+"+ - "|"+ - "(?:mailto:)?[-.\\w]+\\@[-a-z0-9]+(?:\\.[-a-z0-9]+)*\\.[a-z]+"+ - ")(>)" - }], - "allowBlock": [ - {token : "support.function", regex : "^ {4}.+", next : "allowBlock"}, - {token : "empty", regex : "", next : "start"} - ], - - "header" : [{ - regex: "$", - next : "start" - }, { - include: "basic" - }, { - defaultToken : "heading" - } ], - - "listblock-start" : [{ - token : "support.variable", - regex : /(?:\[[ x]\])?/, - next : "listblock" - }], - - "listblock" : [ { // Lists only escape on completely blank lines. - token : "empty_line", - regex : "^$", - next : "start" - }, { // list - token : "markup.list", - regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+", - next : "listblock-start" - }, { - include : "basic", noEscape: true - }, { - defaultToken : "list" - } ], - - "blockquote" : [ { // BLockquotes only escape on blank lines. - token : "empty_line", - regex : "^\\s*$", - next : "start" - }, { - token : "string", - regex : ".+" - } ], - - "githubblock" : [ { - token : "support.function", - regex : "^```", - next : "start" - }, { - token : "support.function", - regex : ".+" - } ] - }); - - this.embedRules(JavaScriptHighlightRules, "jscode-", [{ - token : "support.function", - regex : "^```", - next : "pop" - }]); - - this.embedRules(HtmlHighlightRules, "htmlcode-", [{ - token : "support.function", - regex : "^```", - next : "pop" - }]); - - this.embedRules(CssHighlightRules, "csscode-", [{ - token : "support.function", - regex : "^```", - next : "pop" - }]); - - this.embedRules(XmlHighlightRules, "xmlcode-", [{ - token : "support.function", - regex : "^```", - next : "pop" - }]); - - this.normalizeRules(); -}; -oop.inherits(MarkdownHighlightRules, TextHighlightRules); - -exports.MarkdownHighlightRules = MarkdownHighlightRules; -}); - -define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var JavaScriptHighlightRules = function() { - var keywordMapper = this.createKeywordMapper({ - "variable.language": - "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors - "Namespace|QName|XML|XMLList|" + // E4X - "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + - "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + - "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors - "SyntaxError|TypeError|URIError|" + - "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions - "isNaN|parseFloat|parseInt|" + - "JSON|Math|" + // Other - "this|arguments|prototype|window|document" , // Pseudo - "keyword": - "const|yield|import|get|set|" + - "break|case|catch|continue|default|delete|do|else|finally|for|function|" + - "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + - "__parent__|__count__|escape|unescape|with|__proto__|" + - "class|enum|extends|super|export|implements|private|public|interface|package|protected|static", - "storage.type": - "const|let|var|function", - "constant.language": - "null|Infinity|NaN|undefined", - "support.function": - "alert", - "constant.language.boolean": "true|false" - }, "identifier"); - var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; - var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\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 - ".)"; - - this.$rules = { - "no_regex" : [ - { - token : "comment", - regex : "\\/\\/", - next : "line_comment" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : /\/\*/, - next : "comment" - }, { - token : "string", - regex : "'(?=.)", - next : "qstring" - }, { - token : "string", - regex : '"(?=.)', - next : "qqstring" - }, { - token : "constant.numeric", // hex - regex : /0[xX][0-9a-fA-F]+\b/ - }, { - token : "constant.numeric", // float - regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/ - }, { - token : [ - "storage.type", "punctuation.operator", "support.function", - "punctuation.operator", "entity.name.function", "text","keyword.operator" - ], - regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "keyword.operator", "text", "storage.type", - "text", "paren.lparen" - ], - regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "punctuation.operator", - "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "text", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : "keyword", - regex : "(?:" + kwBeforeRe + ")\\b", - next : "start" - }, { - token : ["punctuation.operator", "support.function"], - regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/ - }, { - token : ["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 : keywordMapper, - regex : identifierRe - }, { - token : "keyword.operator", - regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/, - next : "start" - }, { - token : "punctuation.operator", - regex : /\?|\:|\,|\;|\./, - next : "start" - }, { - token : "paren.lparen", - regex : /[\[({]/, - next : "start" - }, { - token : "paren.rparen", - regex : /[\])}]/ - }, { - token : "keyword.operator", - regex : /\/=?/, - next : "start" - }, { - token: "comment", - regex: /^#!.*$/ - } - ], - "start": [ - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment_regex_allowed" - }, { - token : "comment", - regex : "\\/\\/", - next : "line_comment_regex_allowed" - }, { - token: "string.regexp", - regex: "\\/", - next: "regex" - }, { - token : "text", - regex : "\\s+|^$", - next : "start" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "regex": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "string.regexp", - regex: "/\\w*", - next: "no_regex" - }, { - token : "invalid", - regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ - }, { - token : "constant.language.escape", - regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/ - }, { - token : "constant.language.delimiter", - regex: /\|/ - }, { - token: "constant.language.escape", - regex: /\[\^?/, - next: "regex_character_class" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp" - } - ], - "regex_character_class": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "constant.language.escape", - regex: "]", - next: "regex" - }, { - token: "constant.language.escape", - regex: "-" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp.charachterclass" - } - ], - "function_arguments": [ - { - token: "variable.parameter", - regex: identifierRe - }, { - token: "punctuation.operator", - regex: "[, ]+" - }, { - token: "punctuation.operator", - regex: "$" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "comment_regex_allowed" : [ - {token : "comment", regex : "\\*\\/", next : "start"}, - {defaultToken : "comment"} - ], - "comment" : [ - {token : "comment", regex : "\\*\\/", next : "no_regex"}, - {defaultToken : "comment"} - ], - "line_comment_regex_allowed" : [ - {token : "comment", regex : "$|^", next : "start"}, - {defaultToken : "comment"} - ], - "line_comment" : [ - {token : "comment", regex : "$|^", next : "no_regex"}, - {defaultToken : "comment"} - ], - "qqstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qqstring" - }, { - token : "string", - regex : '"|$', - next : "no_regex" - }, { - defaultToken: "string" - } - ], - "qstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qstring" - }, { - token : "string", - regex : "'|$", - next : "no_regex" - }, { - defaultToken: "string" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("no_regex") ]); -}; - -oop.inherits(JavaScriptHighlightRules, TextHighlightRules); - -exports.JavaScriptHighlightRules = JavaScriptHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/xml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml_util', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var xmlUtil = require("./xml_util"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var XmlHighlightRules = function(normalize) { - this.$rules = { - start : [ - {token : "punctuation.string.begin", regex : "<\\!\\[CDATA\\[", next : "cdata"}, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)(xml)(?=[\\s])", next : "xml_declaration" - }, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)([-_a-zA-Z0-9]+)", next : "instruction" - }, - {token : "comment", regex : "<\\!--", next : "comment"}, - { - token : ["punctuation.doctype.begin", "meta.tag.doctype"], - regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype" - }, - {include : "tag"}, - {include : "reference"} - ], - - xml_declaration : [ - {include : "attributes"}, - {include : "instruction"} - ], - - instruction : [ - {token : "punctuation.instruction.end", regex : "\\?>", next : "start"} - ], - - doctype : [ - {include : "space"}, - {include : "string"}, - {token : "punctuation.doctype.end", regex : ">", next : "start"}, - {token : "xml-pe", regex : "[-_a-zA-Z0-9:]+"}, - {token : "punctuation.begin", regex : "\\[", push : "declarations"} - ], - - declarations : [{ - token : "text", - regex : "\\s+" - }, { - token: "punctuation.end", - regex: "]", - next: "pop" - }, { - token : ["punctuation.begin", "keyword"], - regex : "(<\\!)([-_a-zA-Z0-9]+)", - push : [{ - token : "text", - regex : "\\s+" - }, - { - token : "punctuation.end", - regex : ">", - next : "pop" - }, - {include : "string"}] - }], - - cdata : [ - {token : "string.end", regex : "\\]\\]>", next : "start"}, - {token : "text", regex : "\\s+"}, - {token : "text", regex : "(?:[^\\]]|\\](?!\\]>))+"} - ], - - comment : [ - {token : "comment", regex : "-->", next : "start"}, - {defaultToken : "comment"} - ], - - tag : [{ - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(<)((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)", - next: [ - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : "start"} - ] - }, { - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(", next : "start"} - ] - }], - - space : [ - {token : "text", regex : "\\s+"} - ], - - reference : [{ - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, { - token : "invalid.illegal", regex : "&" - }], - - string: [{ - token : "string", - regex : "'", - push : "qstring_inner" - }, { - token : "string", - regex : '"', - push : "qqstring_inner" - }], - - qstring_inner: [ - {token : "string", regex: "'", next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - qqstring_inner: [ - {token : "string", regex: '"', next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - attributes: [{ - token : "entity.other.attribute-name", - regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+" - }, { - token : "keyword.operator.separator", - regex : "=" - }, { - include : "space" - }, { - include : "string" - }] - }; - - if (this.constructor === XmlHighlightRules) - this.normalizeRules(); -}; - - -(function() { - - this.embedTagRules = function(HighlightRules, prefix, tag){ - this.$rules.tag.unshift({ - token : ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(<)(" + tag + ")", - next: [ - {include : "space"}, - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : prefix + "start"} - ] - }); - - this.$rules[tag + "-end"] = [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next: "start", - onMatch : function(value, currentState, stack) { - stack.splice(0); - return this.token; - }} - ] - - this.embedRules(HighlightRules, prefix, [{ - token: ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(" - }]); - }; - -}).call(TextHighlightRules.prototype); - -oop.inherits(XmlHighlightRules, TextHighlightRules); - -exports.XmlHighlightRules = XmlHighlightRules; -}); - -define('ace/mode/xml_util', ['require', 'exports', 'module' ], function(require, exports, module) { - - -function string(state) { - return [{ - token : "string", - regex : '"', - next : state + "_qqstring" - }, { - token : "string", - regex : "'", - next : state + "_qstring" - }]; -} - -function multiLineString(quote, state) { - return [ - {token : "string", regex : quote, next : state}, - { - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, - {defaultToken : "string"} - ]; -} - -exports.tag = function(states, name, nextState, tagMap) { - states[name] = [{ - token : "text", - regex : "\\s+" - }, { - - token : !tagMap ? "meta.tag.tag-name" : function(value) { - if (tagMap[value]) - return "meta.tag.tag-name." + tagMap[value]; - else - return "meta.tag.tag-name"; - }, - regex : "[-_a-zA-Z0-9:]+", - next : name + "_embed_attribute_list" - }, { - token: "empty", - regex: "", - next : 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"] = [{ - token : "meta.tag.r", - regex : "/?>", - next : nextState - }, { - token : "keyword.operator", - regex : "=" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "text", - regex : "\\s+" - }].concat(string(name)); -}; - -}); - -define('ace/mode/html_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/css_highlight_rules', 'ace/mode/javascript_highlight_rules', 'ace/mode/xml_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; - -var tagMap = lang.createMap({ - a : 'anchor', - button : 'form', - form : 'form', - img : 'image', - input : 'form', - label : 'form', - option : 'form', - script : 'script', - select : 'form', - textarea : 'form', - style : 'style', - table : 'table', - tbody : 'table', - td : 'table', - tfoot : 'table', - th : 'table', - tr : 'table' -}); - -var HtmlHighlightRules = function() { - XmlHighlightRules.call(this); - - this.addRules({ - attributes: [{ - include : "space" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "keyword.operator.separator", - regex : "=", - push : [{ - include: "space" - }, { - token : "string", - regex : "[^<>='\"`\\s]+", - next : "pop" - }, { - token : "empty", - regex : "", - next : "pop" - }] - }, { - include : "string" - }], - tag: [{ - token : function(start, tag) { - var group = tagMap[tag]; - return ["meta.tag.punctuation.begin", - "meta.tag.name" + (group ? "." + group : "")]; - }, - regex : "(<)([-_a-zA-Z0-9:]+)", - next: "start_tag_stuff" - }, { - token : function(start, tag) { - var group = tagMap[tag]; - return ["meta.tag.punctuation.begin", - "meta.tag.name" + (group ? "." + group : "")]; - }, - regex : "(", next : "start"} - ], - end_tag_stuff: [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next : "start"} - ] - }); - - this.embedTagRules(CssHighlightRules, "css-", "style"); - this.embedTagRules(JavaScriptHighlightRules, "js-", "script"); - - if (this.constructor === HtmlHighlightRules) - this.normalizeRules(); -}; - -oop.inherits(HtmlHighlightRules, XmlHighlightRules); - -exports.HtmlHighlightRules = HtmlHighlightRules; -}); - -define('ace/mode/css_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var supportType = exports.supportType = "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"; -var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters"; -var supportConstant = exports.supportConstant = "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|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|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero"; -var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow"; -var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace"; - -var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))"; -var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b"; -var pseudoClasses = exports.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 CssHighlightRules = function() { - - var keywordMapper = this.createKeywordMapper({ - "support.function": supportFunction, - "support.constant": supportConstant, - "support.type": supportType, - "support.constant.color": supportConstantColor, - "support.constant.fonts": supportConstantFonts - }, "text", true); - - this.$rules = { - "start" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "@.*?{", - push: "media" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "media" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "\\}", - next: "pop" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "comment" : [{ - token : "comment", - regex : "\\*\\/", - next : "pop" - }, { - defaultToken : "comment" - }], - - "ruleset" : [ - { - token : "paren.rparen", - regex : "\\}", - next: "pop" - }, { - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - 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 : numRe - }, { - 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 : ["support.function", "string", "support.function"], - regex : "(url\\()(.*)(\\))" - }, { - token : keywordMapper, - regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*" - }, { - caseInsensitive: true - }] - }; - - this.normalizeRules(); -}; - -oop.inherits(CssHighlightRules, TextHighlightRules); - -exports.CssHighlightRules = CssHighlightRules; - -}); - -define('ace/mode/scss_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var ScssHighlightRules = 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-shadow|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("|"); - var ret = []; - for (var i=0, ln=browserPrefix.length; i|<=|>=|==|!=|-|%|#|\\+|\\$|\\+|\\*" - }, { - token : "paren.lparen", - regex : "[[({]" - }, { - token : "paren.rparen", - regex : "[\\])}]" - }, { - token : "text", - regex : "\\s+" - }, { - caseInsensitive: true - } - ], - "comment" : [ - { - token : "comment", // closing comment - regex : ".*?\\*\\/", - next : "start" - }, { - token : "comment", // comment spanning whole line - regex : ".+" - } - ], - "qqstring" : [ - { - token : "string", - regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"', - next : "start" - }, { - token : "string", - regex : '.+' - } - ], - "qstring" : [ - { - token : "string", - regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'", - next : "start" - }, { - token : "string", - regex : '.+' - } - ] - }; -}; - -oop.inherits(ScssHighlightRules, TextHighlightRules); - -exports.ScssHighlightRules = ScssHighlightRules; - -}); - -define('ace/mode/less_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -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("|"); - var ret = []; - for (var i=0, ln=browserPrefix.length; i|<=|>=|==|!=|-|%|#|\\+|\\$|\\+|\\*" - }, { - token : "paren.lparen", - regex : "[[({]" - }, { - token : "paren.rparen", - regex : "[\\])}]" - }, { - token : "text", - regex : "\\s+" - }, { - caseInsensitive: true - } - ], - "comment" : [ - { - token : "comment", // closing comment - regex : ".*?\\*\\/", - next : "start" - }, { - token : "comment", // comment spanning whole line - regex : ".+" - } - ] - }; -}; - -oop.inherits(LessHighlightRules, TextHighlightRules); - -exports.LessHighlightRules = LessHighlightRules; - -}); - -define('ace/mode/coffee_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - - var oop = require("../lib/oop"); - var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - - oop.inherits(CoffeeHighlightRules, TextHighlightRules); - - function CoffeeHighlightRules() { - var identifier = "[$A-Za-z_\\x7f-\\uffff][$\\w\\x7f-\\uffff]*"; - - var keywords = ( - "this|throw|then|try|typeof|super|switch|return|break|by|continue|" + - "catch|class|in|instanceof|is|isnt|if|else|extends|for|forown|" + - "finally|function|while|when|new|no|not|delete|debugger|do|loop|of|off|" + - "or|on|unless|until|and|yes" - ); - - var langConstant = ( - "true|false|null|undefined|NaN|Infinity" - ); - - var illegal = ( - "case|const|default|function|var|void|with|enum|export|implements|" + - "interface|let|package|private|protected|public|static|yield|" + - "__hasProp|slice|bind|indexOf" - ); - - var supportClass = ( - "Array|Boolean|Date|Function|Number|Object|RegExp|ReferenceError|String|" + - "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + - "SyntaxError|TypeError|URIError|" + - "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + - "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray" - ); - - var supportFunction = ( - "Math|JSON|isNaN|isFinite|parseInt|parseFloat|encodeURI|" + - "encodeURIComponent|decodeURI|decodeURIComponent|String|" - ); - - var variableLanguage = ( - "window|arguments|prototype|document" - ); - - var keywordMapper = this.createKeywordMapper({ - "keyword": keywords, - "constant.language": langConstant, - "invalid.illegal": illegal, - "language.support.class": supportClass, - "language.support.function": supportFunction, - "variable.language": variableLanguage - }, "identifier"); - - var functionRule = { - token: ["paren.lparen", "variable.parameter", "paren.rparen", "text", "storage.type"], - regex: /(?:(\()((?:"[^")]*?"|'[^')]*?'|\/[^\/)]*?\/|[^()\"'\/])*?)(\))(\s*))?([\-=]>)/.source - }; - - var stringEscape = /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)/; - - this.$rules = { - start : [ - { - token : "constant.numeric", - regex : "(?:0x[\\da-fA-F]+|(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:[eE][+-]?\\d+)?)" - }, { - stateName: "qdoc", - token : "string", regex : "'''", next : [ - {token : "string", regex : "'''", next : "start"}, - {token : "constant.language.escape", regex : stringEscape}, - {defaultToken: "string"} - ] - }, { - stateName: "qqdoc", - token : "string", - regex : '"""', - next : [ - {token : "string", regex : '"""', next : "start"}, - {token : "paren.string", regex : '#{', push : "start"}, - {token : "constant.language.escape", regex : stringEscape}, - {defaultToken: "string"} - ] - }, { - stateName: "qstring", - token : "string", regex : "'", next : [ - {token : "string", regex : "'", next : "start"}, - {token : "constant.language.escape", regex : stringEscape}, - {defaultToken: "string"} - ] - }, { - stateName: "qqstring", - token : "string.start", regex : '"', next : [ - {token : "string.end", regex : '"', next : "start"}, - {token : "paren.string", regex : '#{', push : "start"}, - {token : "constant.language.escape", regex : stringEscape}, - {defaultToken: "string"} - ] - }, { - stateName: "js", - token : "string", regex : "`", next : [ - {token : "string", regex : "`", next : "start"}, - {token : "constant.language.escape", regex : stringEscape}, - {defaultToken: "string"} - ] - }, { - regex: "[{}]", onMatch: function(val, state, stack) { - this.next = ""; - if (val == "{" && stack.length) { - stack.unshift("start", state); - return "paren"; - } - if (val == "}" && stack.length) { - stack.shift(); - this.next = stack.shift(); - if (this.next.indexOf("string") != -1) - return "paren.string"; - } - return "paren"; - } - }, { - token : "string.regex", - regex : "///", - next : "heregex" - }, { - token : "string.regex", - regex : /(?:\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/)(?:[imgy]{0,4})(?!\w)/ - }, { - token : "comment", - regex : "###(?!#)", - next : "comment" - }, { - token : "comment", - regex : "#.*" - }, { - token : ["punctuation.operator", "text", "identifier"], - regex : "(\\.)(\\s*)(" + illegal + ")" - }, { - token : "punctuation.operator", - regex : "\\." - }, { - token : ["keyword", "text", "language.support.class", - "text", "keyword", "text", "language.support.class"], - regex : "(class)(\\s+)(" + identifier + ")(?:(\\s+)(extends)(\\s+)(" + identifier + "))?" - }, { - token : ["entity.name.function", "text", "keyword.operator", "text"].concat(functionRule.token), - regex : "(" + identifier + ")(\\s*)([=:])(\\s*)" + functionRule.regex - }, - functionRule, - { - token : "variable", - regex : "@(?:" + identifier + ")?" - }, { - token: keywordMapper, - regex : identifier - }, { - token : "punctuation.operator", - regex : "\\,|\\." - }, { - token : "storage.type", - regex : "[\\-=]>" - }, { - token : "keyword.operator", - regex : "(?:[-+*/%<>&|^!?=]=|>>>=?|\\-\\-|\\+\\+|::|&&=|\\|\\|=|<<=|>>=|\\?\\.|\\.{2,3}|[!*+-=><])" - }, { - token : "paren.lparen", - regex : "[({[]" - }, { - token : "paren.rparen", - regex : "[\\]})]" - }, { - token : "text", - regex : "\\s+" - }], - - - heregex : [{ - token : "string.regex", - regex : '.*?///[imgy]{0,4}', - next : "start" - }, { - token : "comment.regex", - regex : "\\s+(?:#.*)?" - }, { - token : "string.regex", - regex : "\\S+" - }], - - comment : [{ - token : "comment", - regex : '###', - next : "start" - }, { - defaultToken : "comment" - }] - }; - this.normalizeRules(); - } - - exports.CoffeeHighlightRules = CoffeeHighlightRules; -}); - -define('ace/mode/folding/coffee', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var BaseFoldMode = require("./fold_mode").FoldMode; -var Range = require("../../range").Range; - -var FoldMode = exports.FoldMode = function() {}; -oop.inherits(FoldMode, BaseFoldMode); - -(function() { - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var range = this.indentationBlock(session, row); - if (range) - return range; - - var re = /\S/; - var line = session.getLine(row); - var startLevel = line.search(re); - if (startLevel == -1 || line[startLevel] != "#") - return; - - var startColumn = line.length; - var maxRow = session.getLength(); - var startRow = row; - var endRow = row; - - while (++row < maxRow) { - line = session.getLine(row); - var level = line.search(re); - - if (level == -1) - continue; - - if (line[level] != "#") - break; - - endRow = row; - } - - if (endRow > startRow) { - var endColumn = session.getLine(endRow).length; - return new Range(startRow, startColumn, endRow, endColumn); - } - }; - this.getFoldWidget = function(session, foldStyle, row) { - var line = session.getLine(row); - var indent = line.search(/\S/); - var next = session.getLine(row + 1); - var prev = session.getLine(row - 1); - var prevIndent = prev.search(/\S/); - var nextIndent = next.search(/\S/); - - if (indent == -1) { - session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : ""; - return ""; - } - if (prevIndent == -1) { - if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") { - session.foldWidgets[row - 1] = ""; - session.foldWidgets[row + 1] = ""; - return "start"; - } - } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") { - if (session.getLine(row - 2).search(/\S/) == -1) { - session.foldWidgets[row - 1] = "start"; - session.foldWidgets[row + 1] = ""; - return ""; - } - } - - if (prevIndent!= -1 && prevIndent < indent) - session.foldWidgets[row - 1] = "start"; - else - session.foldWidgets[row - 1] = ""; - - if (indent < nextIndent) - return "start"; - else - return ""; - }; - -}).call(FoldMode.prototype); - -}); diff --git a/addons/editor/ace/mode-java.js b/addons/editor/ace/mode-java.js deleted file mode 100644 index 3628a6fc..00000000 --- a/addons/editor/ace/mode-java.js +++ /dev/null @@ -1,1005 +0,0 @@ -define('ace/mode/java', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/javascript', 'ace/tokenizer', 'ace/mode/java_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var JavaScriptMode = require("./javascript").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var JavaHighlightRules = require("./java_highlight_rules").JavaHighlightRules; - -var Mode = function() { - JavaScriptMode.call(this); - this.HighlightRules = JavaHighlightRules; -}; -oop.inherits(Mode, JavaScriptMode); - -(function() { - - this.createWorker = function(session) { - return null; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/javascript', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/javascript_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/worker/worker_client', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var Range = require("../range").Range; -var WorkerClient = require("../worker/worker_client").WorkerClient; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = JavaScriptHighlightRules; - - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().getLineTokens(line, state); - var tokens = tokenizedLine.tokens; - var endState = tokenizedLine.state; - - if (tokens.length && tokens[tokens.length-1].type == "comment") { - return indent; - } - - if (state == "start" || state == "no_regex") { - var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/); - if (match) { - indent += tab; - } - } else if (state == "doc-start") { - if (endState == "start" || endState == "no_regex") { - return ""; - } - var match = line.match(/^\s*(\/?)\*/); - if (match) { - if (match[1]) { - indent += " "; - } - indent += "* "; - } - } - - 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); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker"); - worker.attachToDocument(session.getDocument()); - - worker.on("jslint", function(results) { - session.setAnnotations(results.data); - }); - - worker.on("terminate", function() { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var JavaScriptHighlightRules = function() { - var keywordMapper = this.createKeywordMapper({ - "variable.language": - "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors - "Namespace|QName|XML|XMLList|" + // E4X - "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + - "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + - "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors - "SyntaxError|TypeError|URIError|" + - "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions - "isNaN|parseFloat|parseInt|" + - "JSON|Math|" + // Other - "this|arguments|prototype|window|document" , // Pseudo - "keyword": - "const|yield|import|get|set|" + - "break|case|catch|continue|default|delete|do|else|finally|for|function|" + - "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + - "__parent__|__count__|escape|unescape|with|__proto__|" + - "class|enum|extends|super|export|implements|private|public|interface|package|protected|static", - "storage.type": - "const|let|var|function", - "constant.language": - "null|Infinity|NaN|undefined", - "support.function": - "alert", - "constant.language.boolean": "true|false" - }, "identifier"); - var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; - var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\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 - ".)"; - - this.$rules = { - "no_regex" : [ - { - token : "comment", - regex : "\\/\\/", - next : "line_comment" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : /\/\*/, - next : "comment" - }, { - token : "string", - regex : "'(?=.)", - next : "qstring" - }, { - token : "string", - regex : '"(?=.)', - next : "qqstring" - }, { - token : "constant.numeric", // hex - regex : /0[xX][0-9a-fA-F]+\b/ - }, { - token : "constant.numeric", // float - regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/ - }, { - token : [ - "storage.type", "punctuation.operator", "support.function", - "punctuation.operator", "entity.name.function", "text","keyword.operator" - ], - regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "keyword.operator", "text", "storage.type", - "text", "paren.lparen" - ], - regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "punctuation.operator", - "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "text", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : "keyword", - regex : "(?:" + kwBeforeRe + ")\\b", - next : "start" - }, { - token : ["punctuation.operator", "support.function"], - regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/ - }, { - token : ["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 : keywordMapper, - regex : identifierRe - }, { - token : "keyword.operator", - regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/, - next : "start" - }, { - token : "punctuation.operator", - regex : /\?|\:|\,|\;|\./, - next : "start" - }, { - token : "paren.lparen", - regex : /[\[({]/, - next : "start" - }, { - token : "paren.rparen", - regex : /[\])}]/ - }, { - token : "keyword.operator", - regex : /\/=?/, - next : "start" - }, { - token: "comment", - regex: /^#!.*$/ - } - ], - "start": [ - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment_regex_allowed" - }, { - token : "comment", - regex : "\\/\\/", - next : "line_comment_regex_allowed" - }, { - token: "string.regexp", - regex: "\\/", - next: "regex" - }, { - token : "text", - regex : "\\s+|^$", - next : "start" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "regex": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "string.regexp", - regex: "/\\w*", - next: "no_regex" - }, { - token : "invalid", - regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ - }, { - token : "constant.language.escape", - regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/ - }, { - token : "constant.language.delimiter", - regex: /\|/ - }, { - token: "constant.language.escape", - regex: /\[\^?/, - next: "regex_character_class" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp" - } - ], - "regex_character_class": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "constant.language.escape", - regex: "]", - next: "regex" - }, { - token: "constant.language.escape", - regex: "-" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp.charachterclass" - } - ], - "function_arguments": [ - { - token: "variable.parameter", - regex: identifierRe - }, { - token: "punctuation.operator", - regex: "[, ]+" - }, { - token: "punctuation.operator", - regex: "$" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "comment_regex_allowed" : [ - {token : "comment", regex : "\\*\\/", next : "start"}, - {defaultToken : "comment"} - ], - "comment" : [ - {token : "comment", regex : "\\*\\/", next : "no_regex"}, - {defaultToken : "comment"} - ], - "line_comment_regex_allowed" : [ - {token : "comment", regex : "$|^", next : "start"}, - {defaultToken : "comment"} - ], - "line_comment" : [ - {token : "comment", regex : "$|^", next : "no_regex"}, - {defaultToken : "comment"} - ], - "qqstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qqstring" - }, { - token : "string", - regex : '"|$', - next : "no_regex" - }, { - defaultToken: "string" - } - ], - "qstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qstring" - }, { - token : "string", - regex : "'|$", - next : "no_regex" - }, { - defaultToken: "string" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("no_regex") ]); -}; - -oop.inherits(JavaScriptHighlightRules, TextHighlightRules); - -exports.JavaScriptHighlightRules = JavaScriptHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); -define('ace/mode/java_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var JavaHighlightRules = function() { - var keywords = ( - "abstract|continue|for|new|switch|" + - "assert|default|goto|package|synchronized|" + - "boolean|do|if|private|this|" + - "break|double|implements|protected|throw|" + - "byte|else|import|public|throws|" + - "case|enum|instanceof|return|transient|" + - "catch|extends|int|short|try|" + - "char|final|interface|static|void|" + - "class|finally|long|strictfp|volatile|" + - "const|float|native|super|while" - ); - - var buildinConstants = ("null|Infinity|NaN|undefined"); - - - var langClasses = ( - "AbstractMethodError|AssertionError|ClassCircularityError|"+ - "ClassFormatError|Deprecated|EnumConstantNotPresentException|"+ - "ExceptionInInitializerError|IllegalAccessError|"+ - "IllegalThreadStateException|InstantiationError|InternalError|"+ - "NegativeArraySizeException|NoSuchFieldError|Override|Process|"+ - "ProcessBuilder|SecurityManager|StringIndexOutOfBoundsException|"+ - "SuppressWarnings|TypeNotPresentException|UnknownError|"+ - "UnsatisfiedLinkError|UnsupportedClassVersionError|VerifyError|"+ - "InstantiationException|IndexOutOfBoundsException|"+ - "ArrayIndexOutOfBoundsException|CloneNotSupportedException|"+ - "NoSuchFieldException|IllegalArgumentException|NumberFormatException|"+ - "SecurityException|Void|InheritableThreadLocal|IllegalStateException|"+ - "InterruptedException|NoSuchMethodException|IllegalAccessException|"+ - "UnsupportedOperationException|Enum|StrictMath|Package|Compiler|"+ - "Readable|Runtime|StringBuilder|Math|IncompatibleClassChangeError|"+ - "NoSuchMethodError|ThreadLocal|RuntimePermission|ArithmeticException|"+ - "NullPointerException|Long|Integer|Short|Byte|Double|Number|Float|"+ - "Character|Boolean|StackTraceElement|Appendable|StringBuffer|"+ - "Iterable|ThreadGroup|Runnable|Thread|IllegalMonitorStateException|"+ - "StackOverflowError|OutOfMemoryError|VirtualMachineError|"+ - "ArrayStoreException|ClassCastException|LinkageError|"+ - "NoClassDefFoundError|ClassNotFoundException|RuntimeException|"+ - "Exception|ThreadDeath|Error|Throwable|System|ClassLoader|"+ - "Cloneable|Class|CharSequence|Comparable|String|Object" - ); - - var keywordMapper = this.createKeywordMapper({ - "variable.language": "this", - "keyword": keywords, - "constant.language": buildinConstants, - "support.function": langClasses - }, "identifier"); - - this.$rules = { - "start" : [ - { - token : "comment", - regex : "\\/\\/.*$" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment" - }, { - token : "string.regexp", - regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - token : "constant.numeric", // hex - regex : "0[xX][0-9a-fA-F]+\\b" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "constant.language.boolean", - regex : "(?:true|false)\\b" - }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" - }, { - token : "keyword.operator", - regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" - }, { - token : "lparen", - regex : "[[({]" - }, { - token : "rparen", - regex : "[\\])}]" - }, { - token : "text", - regex : "\\s+" - } - ], - "comment" : [ - { - token : "comment", // closing comment - regex : ".*?\\*\\/", - next : "start" - }, { - token : "comment", // comment spanning whole line - regex : ".+" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("start") ]); -}; - -oop.inherits(JavaHighlightRules, TextHighlightRules); - -exports.JavaHighlightRules = JavaHighlightRules; -}); diff --git a/addons/editor/ace/mode-javascript.js b/addons/editor/ace/mode-javascript.js deleted file mode 100644 index c9e6f504..00000000 --- a/addons/editor/ace/mode-javascript.js +++ /dev/null @@ -1,886 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2010, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/mode/javascript', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/javascript_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/worker/worker_client', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var Range = require("../range").Range; -var WorkerClient = require("../worker/worker_client").WorkerClient; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = JavaScriptHighlightRules; - - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().getLineTokens(line, state); - var tokens = tokenizedLine.tokens; - var endState = tokenizedLine.state; - - if (tokens.length && tokens[tokens.length-1].type == "comment") { - return indent; - } - - if (state == "start" || state == "no_regex") { - var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/); - if (match) { - indent += tab; - } - } else if (state == "doc-start") { - if (endState == "start" || endState == "no_regex") { - return ""; - } - var match = line.match(/^\s*(\/?)\*/); - if (match) { - if (match[1]) { - indent += " "; - } - indent += "* "; - } - } - - 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); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker"); - worker.attachToDocument(session.getDocument()); - - worker.on("jslint", function(results) { - session.setAnnotations(results.data); - }); - - worker.on("terminate", function() { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var JavaScriptHighlightRules = function() { - var keywordMapper = this.createKeywordMapper({ - "variable.language": - "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors - "Namespace|QName|XML|XMLList|" + // E4X - "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + - "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + - "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors - "SyntaxError|TypeError|URIError|" + - "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions - "isNaN|parseFloat|parseInt|" + - "JSON|Math|" + // Other - "this|arguments|prototype|window|document" , // Pseudo - "keyword": - "const|yield|import|get|set|" + - "break|case|catch|continue|default|delete|do|else|finally|for|function|" + - "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + - "__parent__|__count__|escape|unescape|with|__proto__|" + - "class|enum|extends|super|export|implements|private|public|interface|package|protected|static", - "storage.type": - "const|let|var|function", - "constant.language": - "null|Infinity|NaN|undefined", - "support.function": - "alert", - "constant.language.boolean": "true|false" - }, "identifier"); - var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; - var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\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 - ".)"; - - this.$rules = { - "no_regex" : [ - { - token : "comment", - regex : "\\/\\/", - next : "line_comment" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : /\/\*/, - next : "comment" - }, { - token : "string", - regex : "'(?=.)", - next : "qstring" - }, { - token : "string", - regex : '"(?=.)', - next : "qqstring" - }, { - token : "constant.numeric", // hex - regex : /0[xX][0-9a-fA-F]+\b/ - }, { - token : "constant.numeric", // float - regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/ - }, { - token : [ - "storage.type", "punctuation.operator", "support.function", - "punctuation.operator", "entity.name.function", "text","keyword.operator" - ], - regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "keyword.operator", "text", "storage.type", - "text", "paren.lparen" - ], - regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "punctuation.operator", - "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "text", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : "keyword", - regex : "(?:" + kwBeforeRe + ")\\b", - next : "start" - }, { - token : ["punctuation.operator", "support.function"], - regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/ - }, { - token : ["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 : keywordMapper, - regex : identifierRe - }, { - token : "keyword.operator", - regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/, - next : "start" - }, { - token : "punctuation.operator", - regex : /\?|\:|\,|\;|\./, - next : "start" - }, { - token : "paren.lparen", - regex : /[\[({]/, - next : "start" - }, { - token : "paren.rparen", - regex : /[\])}]/ - }, { - token : "keyword.operator", - regex : /\/=?/, - next : "start" - }, { - token: "comment", - regex: /^#!.*$/ - } - ], - "start": [ - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment_regex_allowed" - }, { - token : "comment", - regex : "\\/\\/", - next : "line_comment_regex_allowed" - }, { - token: "string.regexp", - regex: "\\/", - next: "regex" - }, { - token : "text", - regex : "\\s+|^$", - next : "start" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "regex": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "string.regexp", - regex: "/\\w*", - next: "no_regex" - }, { - token : "invalid", - regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ - }, { - token : "constant.language.escape", - regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/ - }, { - token : "constant.language.delimiter", - regex: /\|/ - }, { - token: "constant.language.escape", - regex: /\[\^?/, - next: "regex_character_class" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp" - } - ], - "regex_character_class": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "constant.language.escape", - regex: "]", - next: "regex" - }, { - token: "constant.language.escape", - regex: "-" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp.charachterclass" - } - ], - "function_arguments": [ - { - token: "variable.parameter", - regex: identifierRe - }, { - token: "punctuation.operator", - regex: "[, ]+" - }, { - token: "punctuation.operator", - regex: "$" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "comment_regex_allowed" : [ - {token : "comment", regex : "\\*\\/", next : "start"}, - {defaultToken : "comment"} - ], - "comment" : [ - {token : "comment", regex : "\\*\\/", next : "no_regex"}, - {defaultToken : "comment"} - ], - "line_comment_regex_allowed" : [ - {token : "comment", regex : "$|^", next : "start"}, - {defaultToken : "comment"} - ], - "line_comment" : [ - {token : "comment", regex : "$|^", next : "no_regex"}, - {defaultToken : "comment"} - ], - "qqstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qqstring" - }, { - token : "string", - regex : '"|$', - next : "no_regex" - }, { - defaultToken: "string" - } - ], - "qstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qstring" - }, { - token : "string", - regex : "'|$", - next : "no_regex" - }, { - defaultToken: "string" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("no_regex") ]); -}; - -oop.inherits(JavaScriptHighlightRules, TextHighlightRules); - -exports.JavaScriptHighlightRules = JavaScriptHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); diff --git a/addons/editor/ace/mode-jsoniq.js b/addons/editor/ace/mode-jsoniq.js deleted file mode 100644 index 82336350..00000000 --- a/addons/editor/ace/mode-jsoniq.js +++ /dev/null @@ -1,2714 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2010, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ -define('ace/mode/jsoniq', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/xquery/JSONiqLexer', 'ace/range', 'ace/mode/behaviour/xquery', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var JSONiqLexer = require("./xquery/JSONiqLexer").JSONiqLexer; -var Range = require("../range").Range; -var XQueryBehaviour = require("./behaviour/xquery").XQueryBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - - -var Mode = function() { - this.$tokenizer = new JSONiqLexer(); - this.$behaviour = new XQueryBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; - -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.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; -}); - -define('ace/mode/xquery/JSONiqLexer', ['require', 'exports', 'module' , 'ace/mode/xquery/JSONiqTokenizer'], function(require, exports, module) { - - var JSONiqTokenizer = require("./JSONiqTokenizer").JSONiqTokenizer; - - var TokenHandler = function(code) { - - var input = code; - - this.tokens = []; - - this.reset = function(code) { - input = input; - this.tokens = []; - }; - - this.startNonterminal = function(name, begin) {}; - - this.endNonterminal = function(name, end) {}; - - this.terminal = function(name, begin, end) { - this.tokens.push({ - name: name, - value: input.substring(begin, end) - }); - }; - - this.whitespace = function(begin, end) { - this.tokens.push({ - name: "WS", - value: input.substring(begin, end) - }); - }; - }; - var keys = "NaN|after|allowing|ancestor|ancestor-or-self|and|append|array|as|ascending|at|attribute|base-uri|before|boundary-space|break|by|case|cast|castable|catch|child|collation|comment|constraint|construction|contains|context|continue|copy|copy-namespaces|count|decimal-format|decimal-separator|declare|default|delete|descendant|descendant-or-self|descending|digit|div|document|document-node|element|else|empty|empty-sequence|encoding|end|eq|every|except|exit|external|false|first|following|following-sibling|for|from|ft-option|function|ge|greatest|group|grouping-separator|gt|idiv|if|import|in|index|infinity|insert|instance|integrity|intersect|into|is|item|json|json-item|jsoniq|last|lax|le|least|let|loop|lt|minus-sign|mod|modify|module|namespace|namespace-node|ne|next|node|nodes|not|null|object|of|only|option|or|order|ordered|ordering|paragraphs|parent|pattern-separator|per-mille|percent|preceding|preceding-sibling|previous|processing-instruction|rename|replace|return|returning|revalidation|satisfies|schema|schema-attribute|schema-element|score|select|self|sentences|sliding|some|stable|start|strict|switch|text|then|times|to|treat|true|try|tumbling|type|typeswitch|union|unordered|updating|validate|value|variable|version|when|where|while|window|with|words|xquery|zero-digit".split("|"); - var keywords = keys.map( - function(val) { return { name: "'" + val + "'", token: "keyword" }; } - ); - - var ncnames = keys.map( - function(val) { return { name: "'" + val + "'", token: "text", next: function(stack){ stack.pop(); } }; } - ); - - var cdata = "constant.language"; - var number = "constant"; - var xmlcomment = "comment"; - var pi = "xml-pe"; - var pragma = "constant.buildin"; - - var Rules = { - start: [ - { name: "'(#'", token: pragma, next: function(stack){ stack.push("Pragma"); } }, - { name: "'(:'", token: "comment", next: function(stack){ stack.push("Comment"); } }, - { name: "'(:~'", token: "comment.doc", next: function(stack){ stack.push("CommentDoc"); } }, - { name: "''", token: xmlcomment, next: function(stack){ stack.pop(); } } - ], - CData: [ - { name: "CDataSectionContents", token: cdata }, - { name: "']]>'", token: cdata, next: function(stack){ stack.pop(); } } - ], - PI: [ - { name: "DirPIContents", token: pi }, - { name: "'?'", token: pi }, - { name: "'?>'", token: pi, next: function(stack){ stack.pop(); } } - ], - AposString: [ - { name: "''''", token: "string", next: function(stack){ stack.pop(); } }, - { name: "PredefinedEntityRef", token: "constant.language.escape" }, - { name: "CharRef", token: "constant.language.escape" }, - { name: "EscapeApos", token: "constant.language.escape" }, - { name: "AposChar", token: "string" } - ], - QuotString: [ - { name: "'\"'", token: "string", next: function(stack){ stack.pop(); } }, - { name: "PredefinedEntityRef", token: "constant.language.escape" }, - { name: "CharRef", token: "constant.language.escape" }, - { name: "EscapeQuot", token: "constant.language.escape" }, - { name: "QuotChar", token: "string" } - ] - }; - -exports.JSONiqLexer = function() { - - this.tokens = []; - - this.getLineTokens = function(line, state, row) { - state = (state === "start" || !state) ? '["start"]' : state; - var stack = JSON.parse(state); - var h = new TokenHandler(line); - var tokenizer = new JSONiqTokenizer(line, h); - var tokens = []; - - while(true) { - var currentState = stack[stack.length - 1]; - try { - - h.tokens = []; - tokenizer["parse_" + currentState](); - var info = null; - - if(h.tokens.length > 1 && h.tokens[0].name === "WS") { - tokens.push({ - type: "text", - value: h.tokens[0].value - }); - h.tokens.splice(0, 1); - } - - var token = h.tokens[0]; - var rules = Rules[currentState]; - for(var k = 0; k < rules.length; k++) { - var rule = Rules[currentState][k]; - if((typeof(rule.name) === "function" && rule.name(token)) || rule.name === token.name) { - info = rule; - break; - } - } - - if(token.name === "EOF") { break; } - if(token.value === "") { throw "Encountered empty string lexical rule."; } - - tokens.push({ - type: info === null ? "text" : (typeof(info.token) === "function" ? info.token(token.value) : info.token), - value: token.value - }); - - if(info && info.next) { - info.next(stack); - } - - } catch(e) { - if(e instanceof tokenizer.ParseException) { - var index = 0; - for(var i=0; i < tokens.length; i++) { - index += tokens[i].value.length; - } - tokens.push({ type: "text", value: line.substring(index) }); - return { - tokens: tokens, - state: JSON.stringify(["start"]) - }; - } else { - throw e; - } - } - } - - - if(this.tokens[row] !== undefined) { - var cachedLine = this.lines[row]; - var begin = sharedStart([line, cachedLine]); - var diff = cachedLine.length - line.length; - var idx = 0; - var col = 0; - for(var i = 0; i < tokens.length; i++) { - var token = tokens[i]; - for(var j = 0; j < this.tokens[row].length; j++) { - var semanticToken = this.tokens[row][j]; - if( - ((col + token.value.length) <= begin.length && semanticToken.sc === col && semanticToken.ec === (col + token.value.length)) || - (semanticToken.sc === (col + diff) && semanticToken.ec === (col + token.value.length + diff)) - ) { - idx = i; - tokens[i].type = semanticToken.type; - } - } - col += token.value.length; - } - } - - return { - tokens: tokens, - state: JSON.stringify(stack) - }; - }; - - function sharedStart(A) { - var tem1, tem2, s, A = A.slice(0).sort(); - tem1 = A[0]; - s = tem1.length; - tem2 = A.pop(); - while(s && tem2.indexOf(tem1) == -1) { - tem1 = tem1.substring(0, --s); - } - return tem1; - } -}; -}); - - define('ace/mode/xquery/JSONiqTokenizer', ['require', 'exports', 'module' ], function(require, exports, module) { - var JSONiqTokenizer = exports.JSONiqTokenizer = function JSONiqTokenizer(string, parsingEventHandler) - { - init(string, parsingEventHandler); - var self = this; - - this.ParseException = function(b, e, s, o, x) - { - var - begin = b, - end = e, - state = s, - offending = o, - expected = x; - - this.getBegin = function() {return begin;}; - this.getEnd = function() {return end;}; - this.getState = function() {return state;}; - this.getExpected = function() {return expected;}; - this.getOffending = function() {return offending;}; - - this.getMessage = function() - { - return offending < 0 ? "lexical analysis failed" : "syntax error"; - }; - }; - - function init(string, parsingEventHandler) - { - eventHandler = parsingEventHandler; - input = string; - size = string.length; - reset(0, 0, 0); - } - - this.getInput = function() - { - return input; - }; - - function reset(l, b, e) - { - b0 = b; e0 = b; - l1 = l; b1 = b; e1 = e; - end = e; - eventHandler.reset(input); - } - - this.getOffendingToken = function(e) - { - var o = e.getOffending(); - return o >= 0 ? JSONiqTokenizer.TOKEN[o] : null; - }; - - this.getExpectedTokenSet = function(e) - { - var expected; - if (e.getExpected() < 0) - { - expected = JSONiqTokenizer.getTokenSet(- e.getState()); - } - else - { - expected = [JSONiqTokenizer.TOKEN[e.getExpected()]]; - } - return expected; - }; - - this.getErrorMessage = function(e) - { - var tokenSet = this.getExpectedTokenSet(e); - var found = this.getOffendingToken(e); - var prefix = input.substring(0, e.getBegin()); - var lines = prefix.split("\n"); - var line = lines.length; - var column = lines[line - 1].length + 1; - var size = e.getEnd() - e.getBegin(); - return e.getMessage() - + (found == null ? "" : ", found " + found) - + "\nwhile expecting " - + (tokenSet.length == 1 ? tokenSet[0] : ("[" + tokenSet.join(", ") + "]")) - + "\n" - + (size == 0 || found != null ? "" : "after successfully scanning " + size + " characters beginning ") - + "at line " + line + ", column " + column + ":\n..." - + input.substring(e.getBegin(), Math.min(input.length, e.getBegin() + 64)) - + "..."; - }; - - this.parse_start = function() - { - eventHandler.startNonterminal("start", e0); - lookahead1W(14); // ModuleDecl | Annotation | OptionDecl | Operator | Variable | Tag | AttrTest | - switch (l1) - { - case 55: // '' | '=' | '>' - switch (l1) - { - case 58: // '>' - shift(58); // '>' - break; - case 50: // '/>' - shift(50); // '/>' - break; - case 27: // QName - shift(27); // QName - break; - case 57: // '=' - shift(57); // '=' - break; - case 35: // '"' - shift(35); // '"' - break; - case 38: // "'" - shift(38); // "'" - break; - default: - shift(33); // EOF - } - eventHandler.endNonterminal("StartTag", e0); - }; - - this.parse_TagContent = function() - { - eventHandler.startNonterminal("TagContent", e0); - lookahead1(11); // Tag | EndTag | PredefinedEntityRef | ElementContentChar | CharRef | EOF | - switch (l1) - { - case 23: // ElementContentChar - shift(23); // ElementContentChar - break; - case 6: // Tag - shift(6); // Tag - break; - case 7: // EndTag - shift(7); // EndTag - break; - case 55: // '' - switch (l1) - { - case 11: // CDataSectionContents - shift(11); // CDataSectionContents - break; - case 64: // ']]>' - shift(64); // ']]>' - break; - default: - shift(33); // EOF - } - eventHandler.endNonterminal("CData", e0); - }; - - this.parse_XMLComment = function() - { - eventHandler.startNonterminal("XMLComment", e0); - lookahead1(0); // DirCommentContents | EOF | '-->' - switch (l1) - { - case 9: // DirCommentContents - shift(9); // DirCommentContents - break; - case 47: // '-->' - shift(47); // '-->' - break; - default: - shift(33); // EOF - } - eventHandler.endNonterminal("XMLComment", e0); - }; - - this.parse_PI = function() - { - eventHandler.startNonterminal("PI", e0); - lookahead1(3); // DirPIContents | EOF | '?' | '?>' - switch (l1) - { - case 10: // DirPIContents - shift(10); // DirPIContents - break; - case 59: // '?' - shift(59); // '?' - break; - case 60: // '?>' - shift(60); // '?>' - break; - default: - shift(33); // EOF - } - eventHandler.endNonterminal("PI", e0); - }; - - this.parse_Pragma = function() - { - eventHandler.startNonterminal("Pragma", e0); - lookahead1(2); // PragmaContents | EOF | '#' | '#)' - switch (l1) - { - case 8: // PragmaContents - shift(8); // PragmaContents - break; - case 36: // '#' - shift(36); // '#' - break; - case 37: // '#)' - shift(37); // '#)' - break; - default: - shift(33); // EOF - } - eventHandler.endNonterminal("Pragma", e0); - }; - - this.parse_Comment = function() - { - eventHandler.startNonterminal("Comment", e0); - lookahead1(4); // CommentContents | EOF | '(:' | ':)' - switch (l1) - { - case 52: // ':)' - shift(52); // ':)' - break; - case 41: // '(:' - shift(41); // '(:' - break; - case 30: // CommentContents - shift(30); // CommentContents - break; - default: - shift(33); // EOF - } - eventHandler.endNonterminal("Comment", e0); - }; - - this.parse_CommentDoc = function() - { - eventHandler.startNonterminal("CommentDoc", e0); - lookahead1(5); // DocTag | DocCommentContents | EOF | '(:' | ':)' - switch (l1) - { - case 31: // DocTag - shift(31); // DocTag - break; - case 32: // DocCommentContents - shift(32); // DocCommentContents - break; - case 52: // ':)' - shift(52); // ':)' - break; - case 41: // '(:' - shift(41); // '(:' - break; - default: - shift(33); // EOF - } - eventHandler.endNonterminal("CommentDoc", e0); - }; - - this.parse_QuotString = function() - { - eventHandler.startNonterminal("QuotString", e0); - lookahead1(6); // PredefinedEntityRef | EscapeQuot | QuotChar | CharRef | EOF | '"' - switch (l1) - { - case 18: // PredefinedEntityRef - shift(18); // PredefinedEntityRef - break; - case 29: // CharRef - shift(29); // CharRef - break; - case 19: // EscapeQuot - shift(19); // EscapeQuot - break; - case 21: // QuotChar - shift(21); // QuotChar - break; - case 35: // '"' - shift(35); // '"' - break; - default: - shift(33); // EOF - } - eventHandler.endNonterminal("QuotString", e0); - }; - - this.parse_AposString = function() - { - eventHandler.startNonterminal("AposString", e0); - lookahead1(7); // PredefinedEntityRef | EscapeApos | AposChar | CharRef | EOF | "'" - switch (l1) - { - case 18: // PredefinedEntityRef - shift(18); // PredefinedEntityRef - break; - case 29: // CharRef - shift(29); // CharRef - break; - case 20: // EscapeApos - shift(20); // EscapeApos - break; - case 22: // AposChar - shift(22); // AposChar - break; - case 38: // "'" - shift(38); // "'" - break; - default: - shift(33); // EOF - } - eventHandler.endNonterminal("AposString", e0); - }; - - this.parse_Prefix = function() - { - eventHandler.startNonterminal("Prefix", e0); - lookahead1W(13); // NCName^Token | S^WS | 'after' | 'allowing' | 'ancestor' | 'ancestor-or-self' | - whitespace(); - parse_NCName(); - eventHandler.endNonterminal("Prefix", e0); - }; - - this.parse__EQName = function() - { - eventHandler.startNonterminal("_EQName", e0); - lookahead1W(12); // EQName^Token | S^WS | 'after' | 'allowing' | 'ancestor' | 'ancestor-or-self' | - whitespace(); - parse_EQName(); - eventHandler.endNonterminal("_EQName", e0); - }; - - function parse_EQName() - { - eventHandler.startNonterminal("EQName", e0); - switch (l1) - { - case 77: // 'attribute' - shift(77); // 'attribute' - break; - case 91: // 'comment' - shift(91); // 'comment' - break; - case 115: // 'document-node' - shift(115); // 'document-node' - break; - case 116: // 'element' - shift(116); // 'element' - break; - case 119: // 'empty-sequence' - shift(119); // 'empty-sequence' - break; - case 140: // 'function' - shift(140); // 'function' - break; - case 147: // 'if' - shift(147); // 'if' - break; - case 160: // 'item' - shift(160); // 'item' - break; - case 180: // 'namespace-node' - shift(180); // 'namespace-node' - break; - case 186: // 'node' - shift(186); // 'node' - break; - case 211: // 'processing-instruction' - shift(211); // 'processing-instruction' - break; - case 221: // 'schema-attribute' - shift(221); // 'schema-attribute' - break; - case 222: // 'schema-element' - shift(222); // 'schema-element' - break; - case 238: // 'switch' - shift(238); // 'switch' - break; - case 239: // 'text' - shift(239); // 'text' - break; - case 248: // 'typeswitch' - shift(248); // 'typeswitch' - break; - default: - parse_FunctionName(); - } - eventHandler.endNonterminal("EQName", e0); - } - - function parse_FunctionName() - { - eventHandler.startNonterminal("FunctionName", e0); - switch (l1) - { - case 14: // EQName^Token - shift(14); // EQName^Token - break; - case 65: // 'after' - shift(65); // 'after' - break; - case 68: // 'ancestor' - shift(68); // 'ancestor' - break; - case 69: // 'ancestor-or-self' - shift(69); // 'ancestor-or-self' - break; - case 70: // 'and' - shift(70); // 'and' - break; - case 74: // 'as' - shift(74); // 'as' - break; - case 75: // 'ascending' - shift(75); // 'ascending' - break; - case 79: // 'before' - shift(79); // 'before' - break; - case 83: // 'case' - shift(83); // 'case' - break; - case 84: // 'cast' - shift(84); // 'cast' - break; - case 85: // 'castable' - shift(85); // 'castable' - break; - case 88: // 'child' - shift(88); // 'child' - break; - case 89: // 'collation' - shift(89); // 'collation' - break; - case 98: // 'copy' - shift(98); // 'copy' - break; - case 100: // 'count' - shift(100); // 'count' - break; - case 103: // 'declare' - shift(103); // 'declare' - break; - case 104: // 'default' - shift(104); // 'default' - break; - case 105: // 'delete' - shift(105); // 'delete' - break; - case 106: // 'descendant' - shift(106); // 'descendant' - break; - case 107: // 'descendant-or-self' - shift(107); // 'descendant-or-self' - break; - case 108: // 'descending' - shift(108); // 'descending' - break; - case 113: // 'div' - shift(113); // 'div' - break; - case 114: // 'document' - shift(114); // 'document' - break; - case 117: // 'else' - shift(117); // 'else' - break; - case 118: // 'empty' - shift(118); // 'empty' - break; - case 121: // 'end' - shift(121); // 'end' - break; - case 123: // 'eq' - shift(123); // 'eq' - break; - case 124: // 'every' - shift(124); // 'every' - break; - case 126: // 'except' - shift(126); // 'except' - break; - case 129: // 'first' - shift(129); // 'first' - break; - case 130: // 'following' - shift(130); // 'following' - break; - case 131: // 'following-sibling' - shift(131); // 'following-sibling' - break; - case 132: // 'for' - shift(132); // 'for' - break; - case 141: // 'ge' - shift(141); // 'ge' - break; - case 143: // 'group' - shift(143); // 'group' - break; - case 145: // 'gt' - shift(145); // 'gt' - break; - case 146: // 'idiv' - shift(146); // 'idiv' - break; - case 148: // 'import' - shift(148); // 'import' - break; - case 154: // 'insert' - shift(154); // 'insert' - break; - case 155: // 'instance' - shift(155); // 'instance' - break; - case 157: // 'intersect' - shift(157); // 'intersect' - break; - case 158: // 'into' - shift(158); // 'into' - break; - case 159: // 'is' - shift(159); // 'is' - break; - case 165: // 'last' - shift(165); // 'last' - break; - case 167: // 'le' - shift(167); // 'le' - break; - case 169: // 'let' - shift(169); // 'let' - break; - case 173: // 'lt' - shift(173); // 'lt' - break; - case 175: // 'mod' - shift(175); // 'mod' - break; - case 176: // 'modify' - shift(176); // 'modify' - break; - case 177: // 'module' - shift(177); // 'module' - break; - case 179: // 'namespace' - shift(179); // 'namespace' - break; - case 181: // 'ne' - shift(181); // 'ne' - break; - case 193: // 'only' - shift(193); // 'only' - break; - case 195: // 'or' - shift(195); // 'or' - break; - case 196: // 'order' - shift(196); // 'order' - break; - case 197: // 'ordered' - shift(197); // 'ordered' - break; - case 201: // 'parent' - shift(201); // 'parent' - break; - case 207: // 'preceding' - shift(207); // 'preceding' - break; - case 208: // 'preceding-sibling' - shift(208); // 'preceding-sibling' - break; - case 213: // 'rename' - shift(213); // 'rename' - break; - case 214: // 'replace' - shift(214); // 'replace' - break; - case 215: // 'return' - shift(215); // 'return' - break; - case 219: // 'satisfies' - shift(219); // 'satisfies' - break; - case 224: // 'self' - shift(224); // 'self' - break; - case 230: // 'some' - shift(230); // 'some' - break; - case 231: // 'stable' - shift(231); // 'stable' - break; - case 232: // 'start' - shift(232); // 'start' - break; - case 243: // 'to' - shift(243); // 'to' - break; - case 244: // 'treat' - shift(244); // 'treat' - break; - case 245: // 'try' - shift(245); // 'try' - break; - case 249: // 'union' - shift(249); // 'union' - break; - case 251: // 'unordered' - shift(251); // 'unordered' - break; - case 255: // 'validate' - shift(255); // 'validate' - break; - case 261: // 'where' - shift(261); // 'where' - break; - case 265: // 'with' - shift(265); // 'with' - break; - case 269: // 'xquery' - shift(269); // 'xquery' - break; - case 67: // 'allowing' - shift(67); // 'allowing' - break; - case 76: // 'at' - shift(76); // 'at' - break; - case 78: // 'base-uri' - shift(78); // 'base-uri' - break; - case 80: // 'boundary-space' - shift(80); // 'boundary-space' - break; - case 81: // 'break' - shift(81); // 'break' - break; - case 86: // 'catch' - shift(86); // 'catch' - break; - case 93: // 'construction' - shift(93); // 'construction' - break; - case 96: // 'context' - shift(96); // 'context' - break; - case 97: // 'continue' - shift(97); // 'continue' - break; - case 99: // 'copy-namespaces' - shift(99); // 'copy-namespaces' - break; - case 101: // 'decimal-format' - shift(101); // 'decimal-format' - break; - case 120: // 'encoding' - shift(120); // 'encoding' - break; - case 127: // 'exit' - shift(127); // 'exit' - break; - case 128: // 'external' - shift(128); // 'external' - break; - case 136: // 'ft-option' - shift(136); // 'ft-option' - break; - case 149: // 'in' - shift(149); // 'in' - break; - case 150: // 'index' - shift(150); // 'index' - break; - case 156: // 'integrity' - shift(156); // 'integrity' - break; - case 166: // 'lax' - shift(166); // 'lax' - break; - case 187: // 'nodes' - shift(187); // 'nodes' - break; - case 194: // 'option' - shift(194); // 'option' - break; - case 198: // 'ordering' - shift(198); // 'ordering' - break; - case 217: // 'revalidation' - shift(217); // 'revalidation' - break; - case 220: // 'schema' - shift(220); // 'schema' - break; - case 223: // 'score' - shift(223); // 'score' - break; - case 229: // 'sliding' - shift(229); // 'sliding' - break; - case 235: // 'strict' - shift(235); // 'strict' - break; - case 246: // 'tumbling' - shift(246); // 'tumbling' - break; - case 247: // 'type' - shift(247); // 'type' - break; - case 252: // 'updating' - shift(252); // 'updating' - break; - case 256: // 'value' - shift(256); // 'value' - break; - case 257: // 'variable' - shift(257); // 'variable' - break; - case 258: // 'version' - shift(258); // 'version' - break; - case 262: // 'while' - shift(262); // 'while' - break; - case 92: // 'constraint' - shift(92); // 'constraint' - break; - case 171: // 'loop' - shift(171); // 'loop' - break; - default: - shift(216); // 'returning' - } - eventHandler.endNonterminal("FunctionName", e0); - } - - function parse_NCName() - { - eventHandler.startNonterminal("NCName", e0); - switch (l1) - { - case 26: // NCName^Token - shift(26); // NCName^Token - break; - case 65: // 'after' - shift(65); // 'after' - break; - case 70: // 'and' - shift(70); // 'and' - break; - case 74: // 'as' - shift(74); // 'as' - break; - case 75: // 'ascending' - shift(75); // 'ascending' - break; - case 79: // 'before' - shift(79); // 'before' - break; - case 83: // 'case' - shift(83); // 'case' - break; - case 84: // 'cast' - shift(84); // 'cast' - break; - case 85: // 'castable' - shift(85); // 'castable' - break; - case 89: // 'collation' - shift(89); // 'collation' - break; - case 100: // 'count' - shift(100); // 'count' - break; - case 104: // 'default' - shift(104); // 'default' - break; - case 108: // 'descending' - shift(108); // 'descending' - break; - case 113: // 'div' - shift(113); // 'div' - break; - case 117: // 'else' - shift(117); // 'else' - break; - case 118: // 'empty' - shift(118); // 'empty' - break; - case 121: // 'end' - shift(121); // 'end' - break; - case 123: // 'eq' - shift(123); // 'eq' - break; - case 126: // 'except' - shift(126); // 'except' - break; - case 132: // 'for' - shift(132); // 'for' - break; - case 141: // 'ge' - shift(141); // 'ge' - break; - case 143: // 'group' - shift(143); // 'group' - break; - case 145: // 'gt' - shift(145); // 'gt' - break; - case 146: // 'idiv' - shift(146); // 'idiv' - break; - case 155: // 'instance' - shift(155); // 'instance' - break; - case 157: // 'intersect' - shift(157); // 'intersect' - break; - case 158: // 'into' - shift(158); // 'into' - break; - case 159: // 'is' - shift(159); // 'is' - break; - case 167: // 'le' - shift(167); // 'le' - break; - case 169: // 'let' - shift(169); // 'let' - break; - case 173: // 'lt' - shift(173); // 'lt' - break; - case 175: // 'mod' - shift(175); // 'mod' - break; - case 176: // 'modify' - shift(176); // 'modify' - break; - case 181: // 'ne' - shift(181); // 'ne' - break; - case 193: // 'only' - shift(193); // 'only' - break; - case 195: // 'or' - shift(195); // 'or' - break; - case 196: // 'order' - shift(196); // 'order' - break; - case 215: // 'return' - shift(215); // 'return' - break; - case 219: // 'satisfies' - shift(219); // 'satisfies' - break; - case 231: // 'stable' - shift(231); // 'stable' - break; - case 232: // 'start' - shift(232); // 'start' - break; - case 243: // 'to' - shift(243); // 'to' - break; - case 244: // 'treat' - shift(244); // 'treat' - break; - case 249: // 'union' - shift(249); // 'union' - break; - case 261: // 'where' - shift(261); // 'where' - break; - case 265: // 'with' - shift(265); // 'with' - break; - case 68: // 'ancestor' - shift(68); // 'ancestor' - break; - case 69: // 'ancestor-or-self' - shift(69); // 'ancestor-or-self' - break; - case 77: // 'attribute' - shift(77); // 'attribute' - break; - case 88: // 'child' - shift(88); // 'child' - break; - case 91: // 'comment' - shift(91); // 'comment' - break; - case 98: // 'copy' - shift(98); // 'copy' - break; - case 103: // 'declare' - shift(103); // 'declare' - break; - case 105: // 'delete' - shift(105); // 'delete' - break; - case 106: // 'descendant' - shift(106); // 'descendant' - break; - case 107: // 'descendant-or-self' - shift(107); // 'descendant-or-self' - break; - case 114: // 'document' - shift(114); // 'document' - break; - case 115: // 'document-node' - shift(115); // 'document-node' - break; - case 116: // 'element' - shift(116); // 'element' - break; - case 119: // 'empty-sequence' - shift(119); // 'empty-sequence' - break; - case 124: // 'every' - shift(124); // 'every' - break; - case 129: // 'first' - shift(129); // 'first' - break; - case 130: // 'following' - shift(130); // 'following' - break; - case 131: // 'following-sibling' - shift(131); // 'following-sibling' - break; - case 140: // 'function' - shift(140); // 'function' - break; - case 147: // 'if' - shift(147); // 'if' - break; - case 148: // 'import' - shift(148); // 'import' - break; - case 154: // 'insert' - shift(154); // 'insert' - break; - case 160: // 'item' - shift(160); // 'item' - break; - case 165: // 'last' - shift(165); // 'last' - break; - case 177: // 'module' - shift(177); // 'module' - break; - case 179: // 'namespace' - shift(179); // 'namespace' - break; - case 180: // 'namespace-node' - shift(180); // 'namespace-node' - break; - case 186: // 'node' - shift(186); // 'node' - break; - case 197: // 'ordered' - shift(197); // 'ordered' - break; - case 201: // 'parent' - shift(201); // 'parent' - break; - case 207: // 'preceding' - shift(207); // 'preceding' - break; - case 208: // 'preceding-sibling' - shift(208); // 'preceding-sibling' - break; - case 211: // 'processing-instruction' - shift(211); // 'processing-instruction' - break; - case 213: // 'rename' - shift(213); // 'rename' - break; - case 214: // 'replace' - shift(214); // 'replace' - break; - case 221: // 'schema-attribute' - shift(221); // 'schema-attribute' - break; - case 222: // 'schema-element' - shift(222); // 'schema-element' - break; - case 224: // 'self' - shift(224); // 'self' - break; - case 230: // 'some' - shift(230); // 'some' - break; - case 238: // 'switch' - shift(238); // 'switch' - break; - case 239: // 'text' - shift(239); // 'text' - break; - case 245: // 'try' - shift(245); // 'try' - break; - case 248: // 'typeswitch' - shift(248); // 'typeswitch' - break; - case 251: // 'unordered' - shift(251); // 'unordered' - break; - case 255: // 'validate' - shift(255); // 'validate' - break; - case 257: // 'variable' - shift(257); // 'variable' - break; - case 269: // 'xquery' - shift(269); // 'xquery' - break; - case 67: // 'allowing' - shift(67); // 'allowing' - break; - case 76: // 'at' - shift(76); // 'at' - break; - case 78: // 'base-uri' - shift(78); // 'base-uri' - break; - case 80: // 'boundary-space' - shift(80); // 'boundary-space' - break; - case 81: // 'break' - shift(81); // 'break' - break; - case 86: // 'catch' - shift(86); // 'catch' - break; - case 93: // 'construction' - shift(93); // 'construction' - break; - case 96: // 'context' - shift(96); // 'context' - break; - case 97: // 'continue' - shift(97); // 'continue' - break; - case 99: // 'copy-namespaces' - shift(99); // 'copy-namespaces' - break; - case 101: // 'decimal-format' - shift(101); // 'decimal-format' - break; - case 120: // 'encoding' - shift(120); // 'encoding' - break; - case 127: // 'exit' - shift(127); // 'exit' - break; - case 128: // 'external' - shift(128); // 'external' - break; - case 136: // 'ft-option' - shift(136); // 'ft-option' - break; - case 149: // 'in' - shift(149); // 'in' - break; - case 150: // 'index' - shift(150); // 'index' - break; - case 156: // 'integrity' - shift(156); // 'integrity' - break; - case 166: // 'lax' - shift(166); // 'lax' - break; - case 187: // 'nodes' - shift(187); // 'nodes' - break; - case 194: // 'option' - shift(194); // 'option' - break; - case 198: // 'ordering' - shift(198); // 'ordering' - break; - case 217: // 'revalidation' - shift(217); // 'revalidation' - break; - case 220: // 'schema' - shift(220); // 'schema' - break; - case 223: // 'score' - shift(223); // 'score' - break; - case 229: // 'sliding' - shift(229); // 'sliding' - break; - case 235: // 'strict' - shift(235); // 'strict' - break; - case 246: // 'tumbling' - shift(246); // 'tumbling' - break; - case 247: // 'type' - shift(247); // 'type' - break; - case 252: // 'updating' - shift(252); // 'updating' - break; - case 256: // 'value' - shift(256); // 'value' - break; - case 258: // 'version' - shift(258); // 'version' - break; - case 262: // 'while' - shift(262); // 'while' - break; - case 92: // 'constraint' - shift(92); // 'constraint' - break; - case 171: // 'loop' - shift(171); // 'loop' - break; - default: - shift(216); // 'returning' - } - eventHandler.endNonterminal("NCName", e0); - } - - function shift(t) - { - if (l1 == t) - { - whitespace(); - eventHandler.terminal(JSONiqTokenizer.TOKEN[l1], b1, e1 > size ? size : e1); - b0 = b1; e0 = e1; l1 = 0; - } - else - { - error(b1, e1, 0, l1, t); - } - } - - function whitespace() - { - if (e0 != b1) - { - b0 = e0; - e0 = b1; - eventHandler.whitespace(b0, e0); - } - } - - function matchW(set) - { - var code; - for (;;) - { - code = match(set); - if (code != 28) // S^WS - { - break; - } - } - return code; - } - - function lookahead1W(set) - { - if (l1 == 0) - { - l1 = matchW(set); - b1 = begin; - e1 = end; - } - } - - function lookahead1(set) - { - if (l1 == 0) - { - l1 = match(set); - b1 = begin; - e1 = end; - } - } - - function error(b, e, s, l, t) - { - throw new self.ParseException(b, e, s, l, t); - } - - var lk, b0, e0; - var l1, b1, e1; - var eventHandler; - - var input; - var size; - var begin; - var end; - - function match(tokenSetId) - { - var nonbmp = false; - begin = end; - var current = end; - var result = JSONiqTokenizer.INITIAL[tokenSetId]; - var state = 0; - - for (var code = result & 4095; code != 0; ) - { - var charclass; - var c0 = current < size ? input.charCodeAt(current) : 0; - ++current; - if (c0 < 0x80) - { - charclass = JSONiqTokenizer.MAP0[c0]; - } - else if (c0 < 0xd800) - { - var c1 = c0 >> 4; - charclass = JSONiqTokenizer.MAP1[(c0 & 15) + JSONiqTokenizer.MAP1[(c1 & 31) + JSONiqTokenizer.MAP1[c1 >> 5]]]; - } - else - { - if (c0 < 0xdc00) - { - var c1 = current < size ? input.charCodeAt(current) : 0; - if (c1 >= 0xdc00 && c1 < 0xe000) - { - ++current; - c0 = ((c0 & 0x3ff) << 10) + (c1 & 0x3ff) + 0x10000; - nonbmp = true; - } - } - var lo = 0, hi = 5; - for (var m = 3; ; m = (hi + lo) >> 1) - { - if (JSONiqTokenizer.MAP2[m] > c0) hi = m - 1; - else if (JSONiqTokenizer.MAP2[6 + m] < c0) lo = m + 1; - else {charclass = JSONiqTokenizer.MAP2[12 + m]; break;} - if (lo > hi) {charclass = 0; break;} - } - } - - state = code; - var i0 = (charclass << 12) + code - 1; - code = JSONiqTokenizer.TRANSITION[(i0 & 15) + JSONiqTokenizer.TRANSITION[i0 >> 4]]; - - if (code > 4095) - { - result = code; - code &= 4095; - end = current; - } - } - - result >>= 12; - if (result == 0) - { - end = current - 1; - var c1 = end < size ? input.charCodeAt(end) : 0; - if (c1 >= 0xdc00 && c1 < 0xe000) --end; - return error(begin, end, state, -1, -1); - } - - if (nonbmp) - { - for (var i = result >> 9; i > 0; --i) - { - --end; - var c1 = end < size ? input.charCodeAt(end) : 0; - if (c1 >= 0xdc00 && c1 < 0xe000) --end; - } - } - else - { - end -= result >> 9; - } - - return (result & 511) - 1; - } -} - -JSONiqTokenizer.getTokenSet = function(tokenSetId) -{ - var set = []; - var s = tokenSetId < 0 ? - tokenSetId : INITIAL[tokenSetId] & 4095; - for (var i = 0; i < 276; i += 32) - { - var j = i; - var i0 = (i >> 5) * 2062 + s - 1; - var i1 = i0 >> 2; - var i2 = i1 >> 2; - var f = JSONiqTokenizer.EXPECTED[(i0 & 3) + JSONiqTokenizer.EXPECTED[(i1 & 3) + JSONiqTokenizer.EXPECTED[(i2 & 3) + JSONiqTokenizer.EXPECTED[i2 >> 2]]]]; - for ( ; f != 0; f >>>= 1, ++j) - { - if ((f & 1) != 0) - { - set.push(JSONiqTokenizer.TOKEN[j]); - } - } - } - return set; -}; - -JSONiqTokenizer.MAP0 = -[ 66, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 27, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 32, 31, 31, 33, 31, 31, 31, 31, 31, 31, 34, 35, 36, 35, 31, 35, 37, 38, 39, 40, 41, 42, 43, 44, 45, 31, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 31, 61, 62, 63, 64, 35 -]; - -JSONiqTokenizer.MAP1 = -[ 108, 124, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 156, 181, 181, 181, 181, 181, 214, 215, 213, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 247, 261, 277, 293, 309, 347, 363, 379, 416, 416, 416, 408, 331, 323, 331, 323, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 433, 433, 433, 433, 433, 433, 433, 316, 331, 331, 331, 331, 331, 331, 331, 331, 394, 416, 416, 417, 415, 416, 416, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 330, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 416, 66, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 27, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 35, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 32, 31, 31, 33, 31, 31, 31, 31, 31, 31, 34, 35, 36, 35, 31, 35, 37, 38, 39, 40, 41, 42, 43, 44, 45, 31, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 31, 61, 62, 63, 64, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 31, 31, 35, 35, 35, 35, 35, 35, 35, 65, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65 -]; - -JSONiqTokenizer.MAP2 = -[ 57344, 63744, 64976, 65008, 65536, 983040, 63743, 64975, 65007, 65533, 983039, 1114111, 35, 31, 35, 31, 31, 35 -]; - -JSONiqTokenizer.INITIAL = -[ 1, 2, 36867, 45060, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 -]; - -JSONiqTokenizer.TRANSITION = -[ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22874, 18847, 17152, 19027, 19252, 17687, 19027, 17173, 30771, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 17991, 17308, 17327, 17346, 18937, 17365, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 21848, 17311, 18669, 19018, 19027, 17447, 17470, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417, 18199, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 17890, 17922, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18065, 36544, 18632, 18081, 18098, 18114, 18159, 18185, 18215, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17756, 18816, 18429, 18445, 18143, 17393, 18500, 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 18590, 21686, 17152, 19027, 19252, 17687, 19027, 28677, 30771, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 17991, 17308, 17327, 17346, 18937, 17365, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 21848, 17311, 18669, 19018, 19027, 17447, 17470, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417, 18199, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 17890, 17922, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18065, 36544, 18632, 18081, 18098, 18114, 18159, 18185, 18215, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17756, 18816, 18429, 18445, 18143, 17393, 18500, 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 20083, 18847, 18648, 19027, 19252, 21242, 19027, 17173, 30771, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 17991, 17308, 17327, 17346, 18937, 18460, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 21848, 17311, 18669, 19018, 19027, 17447, 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 19175, 17906, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 18632, 18081, 18098, 18114, 18159, 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758, 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 18774, 18789, 18805, 19027, 19252, 17687, 19027, 17173, 30771, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 17991, 17308, 17327, 17346, 18937, 18460, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 21848, 17311, 18669, 19018, 19027, 17447, 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 19175, 17906, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 18632, 18081, 18098, 18114, 18159, 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758, 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 18832, 22889, 18925, 19027, 19252, 17569, 19027, 17173, 30771, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 17991, 17308, 17327, 17346, 18937, 18956, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 19073, 17311, 18669, 19018, 19027, 17447, 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 18972, 21862, 17504, 17527, 17258, 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 19175, 17906, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 18632, 18081, 18098, 18114, 18159, 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758, 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21818, 18847, 19006, 19027, 19252, 17687, 19027, 17173, 30771, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 17991, 17308, 17327, 17346, 18937, 18460, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 21848, 17311, 18669, 19018, 19027, 17447, 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 19175, 17906, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 18632, 18081, 18098, 18114, 18159, 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758, 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21671, 18847, 19006, 19027, 19252, 17687, 19027, 17173, 30771, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 17991, 17308, 17327, 17346, 18937, 18460, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 21848, 17311, 18669, 19018, 19027, 17447, 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 19175, 17906, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 18632, 18081, 18098, 18114, 18159, 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758, 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22395, 20098, 18731, 19027, 19252, 17687, 19027, 17173, 23525, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 18129, 17308, 17327, 17346, 18937, 18460, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 20746, 19130, 17311, 18669, 19018, 19027, 17447, 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 19175, 17906, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 18632, 18081, 18098, 18114, 18159, 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758, 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 19043, 18847, 18620, 19027, 19252, 17687, 19027, 17173, 30771, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 17991, 17308, 17327, 17346, 18937, 18460, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 21848, 17311, 18669, 19018, 19027, 17447, 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 19175, 17906, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 18632, 18081, 18098, 18114, 18159, 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758, 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 19100, 22410, 19006, 19027, 19252, 17687, 19027, 19084, 30771, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 17991, 17308, 17327, 17346, 18937, 18460, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 21848, 17311, 18669, 19018, 19027, 17447, 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 19175, 17906, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 18632, 18081, 18098, 18114, 18159, 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758, 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21967, 21982, 19006, 19027, 19252, 17687, 19027, 18701, 30771, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 17991, 17308, 17327, 17346, 18937, 18460, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 21848, 17311, 18669, 19018, 19027, 17447, 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 19175, 17906, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 18632, 18081, 18098, 18114, 18159, 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758, 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22380, 18847, 19006, 19027, 19252, 30659, 19027, 17173, 30771, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 19157, 17308, 17327, 17346, 18937, 18460, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 19299, 17311, 18669, 19018, 19027, 17447, 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 19191, 21862, 17504, 17527, 17258, 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 19175, 17906, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 18632, 18081, 18098, 18114, 18159, 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758, 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21758, 18847, 19006, 19027, 19252, 17687, 19027, 17173, 30771, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 19237, 17308, 17327, 17346, 18937, 18460, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 21848, 17311, 18669, 19018, 19027, 17447, 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 19175, 17906, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 18632, 18081, 18098, 18114, 18159, 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758, 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21626, 18847, 19006, 19027, 19252, 17687, 19027, 17173, 30771, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 17991, 17308, 17327, 17346, 18937, 18460, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 21848, 17311, 18669, 19018, 19027, 17447, 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 19175, 17906, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 18632, 18081, 18098, 18114, 18159, 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758, 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 19268, 19284, 19326, 18482, 27869, 30509, 24384, 31417, 23323, 18482, 19370, 18482, 18484, 27202, 19389, 27202, 27202, 19411, 24384, 34295, 24384, 24384, 25485, 18482, 18482, 18482, 18482, 18482, 25794, 27202, 27202, 27202, 27202, 28530, 19459, 24384, 24384, 24384, 24384, 24017, 18036, 24041, 18482, 18482, 18482, 18484, 19487, 27202, 27202, 27202, 27202, 19503, 35523, 19539, 24384, 24384, 24384, 19647, 18482, 35623, 18482, 18482, 23052, 27202, 19557, 27202, 27202, 30764, 23993, 24384, 19579, 24384, 24384, 26758, 18482, 18482, 19346, 27867, 27202, 27202, 19599, 17590, 23998, 24384, 24384, 19619, 25683, 18482, 18482, 28511, 27202, 27203, 23997, 19639, 19887, 28419, 18902, 18483, 19663, 27202, 24325, 35844, 19887, 30991, 19713, 19395, 19736, 22259, 19754, 22073, 19770, 35154, 19795, 19816, 19836, 19859, 25794, 34248, 24116, 19720, 19875, 30988, 23482, 30981, 28304, 19438, 27956, 19678, 27944, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21743, 18847, 19006, 19027, 19252, 17431, 19027, 17173, 30771, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 17991, 17308, 17327, 17346, 18937, 18460, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 21848, 17311, 18669, 19018, 19027, 17447, 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 19175, 17906, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 18632, 18081, 18098, 18114, 18159, 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758, 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22365, 18847, 19907, 19027, 19252, 17687, 19027, 17173, 30771, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 17991, 17308, 17327, 17346, 18937, 18460, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 21848, 17311, 18669, 19018, 19027, 17447, 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 19175, 17906, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 18632, 18081, 18098, 18114, 18159, 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758, 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21641, 18847, 19326, 18482, 27869, 30544, 24384, 29176, 21442, 18482, 18482, 18482, 18484, 27202, 27202, 27202, 27202, 19935, 24384, 24384, 24384, 24384, 32316, 18482, 18482, 18482, 18482, 18482, 25794, 27202, 27202, 27202, 27202, 28530, 19965, 24384, 24384, 24384, 24384, 31473, 18475, 18482, 18482, 18482, 18482, 18484, 27202, 27202, 27202, 27202, 27202, 19988, 24384, 24384, 24384, 24384, 24384, 33654, 18482, 18482, 18482, 18482, 23052, 27202, 27202, 27202, 27202, 29523, 29939, 24384, 24384, 24384, 24384, 26114, 18482, 18482, 18482, 27867, 27202, 27202, 27202, 20017, 22934, 24384, 24384, 24384, 18481, 18482, 18482, 27202, 27202, 35771, 20047, 24385, 19887, 25677, 18482, 18483, 27202, 27202, 19738, 23870, 19887, 30991, 18484, 27202, 31802, 19425, 19466, 23052, 23296, 19847, 30990, 27868, 34251, 19859, 25794, 34248, 19856, 25793, 19779, 30988, 23482, 30981, 22080, 19438, 27956, 19678, 27944, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 20068, 19058, 20158, 20367, 20884, 17944, 20276, 20853, 25651, 20604, 20460, 20185, 20209, 17189, 17208, 17281, 17675, 20232, 20273, 20295, 20338, 22456, 20777, 20600, 21329, 20635, 20365, 20937, 21207, 17292, 17421, 21157, 17192, 21217, 22425, 20279, 25549, 22436, 20276, 20383, 18983, 20421, 20446, 21317, 21051, 20476, 20322, 20663, 20490, 17543, 17559, 17585, 22463, 20540, 19523, 20246, 20556, 20257, 20430, 20585, 20620, 20193, 20651, 17661, 18368, 17703, 17730, 17772, 19513, 20679, 20692, 22446, 21027, 21097, 18990, 21111, 20708, 20736, 17744, 17795, 17874, 17590, 25536, 20349, 20762, 20812, 20169, 20828, 21376, 17714, 17976, 18021, 18560, 20844, 20569, 25560, 20869, 20900, 18114, 18159, 20916, 20953, 21013, 21043, 21067, 18281, 21083, 18574, 21127, 21143, 21181, 20515, 20930, 20883, 20504, 21197, 21233, 21258, 20524, 20216, 17405, 21270, 21286, 21302, 20720, 20310, 21345, 21361, 21392, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21952, 18847, 19006, 19027, 19252, 17687, 19027, 17173, 30771, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 17991, 17308, 17327, 17346, 18937, 21427, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 21848, 17311, 18669, 19018, 19027, 21479, 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417, 36500, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 28667, 21921, 17617, 36472, 18265, 17237, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 21550, 21509, 17481, 19175, 17906, 18742, 17960, 36550, 17714, 17976, 21535, 30636, 18692, 18413, 18632, 18081, 18098, 18114, 18159, 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758, 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21773, 18847, 21587, 19027, 19252, 17687, 19027, 17173, 30771, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 17991, 17308, 17327, 17346, 18937, 18460, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 21848, 17311, 18669, 19018, 19027, 17447, 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 19175, 17906, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 18632, 18081, 18098, 18114, 18159, 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758, 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21611, 18847, 19006, 19027, 19252, 18169, 19027, 17173, 30771, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 17991, 17308, 17327, 17346, 18937, 18460, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 21848, 17311, 18669, 19018, 19027, 17447, 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 19175, 17906, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 18632, 18081, 18098, 18114, 18159, 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758, 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21728, 19115, 21878, 19027, 19252, 17687, 19027, 19310, 30771, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 17991, 17308, 17327, 17346, 18937, 17379, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 21848, 17311, 18669, 19018, 19027, 17447, 21906, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417, 18322, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 19175, 17906, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 18632, 18081, 18098, 18114, 18159, 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758, 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21937, 18605, 19006, 19027, 19252, 22018, 19027, 17173, 30771, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 17991, 17308, 17327, 17346, 18937, 18460, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 21848, 17311, 18669, 19018, 19027, 17447, 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 19175, 17906, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 18632, 18081, 18098, 18114, 18159, 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758, 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21656, 21833, 19006, 19027, 19252, 17687, 19027, 21519, 30771, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 17991, 17308, 17327, 17346, 18937, 18460, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 21848, 17311, 18669, 19018, 19027, 17447, 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 19175, 17906, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 18632, 18081, 18098, 18114, 18159, 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758, 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22305, 18847, 22034, 18482, 27869, 25325, 24384, 29176, 22062, 18482, 18482, 18482, 18484, 27202, 27202, 27202, 27202, 22096, 24384, 24384, 24384, 24384, 30621, 18482, 18482, 18482, 18482, 18482, 25794, 27202, 27202, 27202, 27202, 35010, 22148, 24384, 24384, 24384, 24384, 31473, 31659, 18482, 18482, 18482, 18482, 18484, 27202, 27202, 27202, 27202, 27202, 19503, 24384, 24384, 24384, 24384, 24384, 32253, 18482, 18482, 18482, 18482, 23052, 27202, 27202, 27202, 27202, 30764, 21406, 24384, 24384, 24384, 24384, 26114, 18482, 18482, 18482, 27867, 27202, 27202, 27202, 22171, 22934, 24384, 24384, 24384, 22228, 18482, 18482, 27202, 27202, 35771, 20047, 24385, 19887, 25677, 18482, 18483, 27202, 27202, 19738, 23870, 19887, 30991, 18484, 27202, 31802, 19425, 19466, 23052, 23296, 19847, 30990, 27868, 34251, 19859, 25794, 34248, 19856, 25793, 19779, 30988, 23482, 30981, 22080, 19438, 27956, 19678, 27944, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22305, 18847, 22034, 18482, 27869, 25325, 24384, 29176, 22062, 18482, 18482, 18482, 18484, 27202, 27202, 27202, 27202, 22096, 24384, 24384, 24384, 24384, 30621, 18482, 18482, 18482, 18482, 18482, 25794, 27202, 27202, 27202, 27202, 35010, 22148, 24384, 24384, 24384, 24384, 31473, 31659, 18482, 18482, 18482, 18482, 18484, 27202, 27202, 27202, 27202, 27202, 19503, 24384, 24384, 24384, 24384, 24384, 31154, 18482, 18482, 18482, 18482, 23052, 27202, 27202, 27202, 27202, 30764, 21406, 24384, 24384, 24384, 24384, 26114, 18482, 18482, 18482, 27867, 27202, 27202, 27202, 22171, 22934, 24384, 24384, 24384, 18481, 18482, 18482, 27202, 27202, 35771, 20047, 24385, 19887, 25677, 18482, 18483, 27202, 27202, 19738, 23870, 19887, 30991, 18484, 27202, 31802, 19425, 19466, 23052, 23296, 19847, 30990, 27868, 34251, 19859, 25794, 34248, 19856, 25793, 19779, 30988, 23482, 30981, 22080, 19438, 27956, 19678, 27944, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22305, 18847, 22034, 18482, 27869, 25325, 24384, 29176, 22062, 18482, 18482, 18482, 18484, 27202, 27202, 27202, 27202, 22096, 24384, 24384, 24384, 24384, 31644, 18482, 18482, 18482, 18482, 18482, 25794, 27202, 27202, 27202, 27202, 35010, 22148, 24384, 24384, 24384, 24384, 31473, 31659, 18482, 18482, 18482, 18482, 18484, 27202, 27202, 27202, 27202, 27202, 19503, 24384, 24384, 24384, 24384, 24384, 31154, 18482, 18482, 18482, 18482, 23052, 27202, 27202, 27202, 27202, 30764, 21406, 24384, 24384, 24384, 24384, 26114, 18482, 18482, 18482, 27867, 27202, 27202, 27202, 22171, 22934, 24384, 24384, 24384, 18481, 18482, 18482, 27202, 27202, 35771, 20047, 24385, 19887, 25677, 18482, 18483, 27202, 27202, 19738, 23870, 19887, 30991, 18484, 27202, 31802, 19425, 19466, 23052, 23296, 19847, 30990, 27868, 34251, 19859, 25794, 34248, 19856, 25793, 19779, 30988, 23482, 30981, 22080, 19438, 27956, 19678, 27944, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22305, 18847, 22034, 18482, 27869, 25325, 24384, 29176, 22062, 18482, 18482, 18482, 18484, 27202, 27202, 27202, 27202, 22096, 24384, 24384, 24384, 24384, 30621, 18482, 18482, 18482, 18482, 18482, 25794, 27202, 27202, 27202, 27202, 35010, 22148, 24384, 24384, 24384, 24384, 33557, 31659, 18482, 18482, 18482, 18482, 18484, 27202, 27202, 27202, 27202, 27202, 19503, 24384, 24384, 24384, 24384, 24384, 31154, 18482, 18482, 18482, 18482, 23052, 27202, 27202, 27202, 27202, 30764, 21406, 24384, 24384, 24384, 24384, 26114, 18482, 18482, 18482, 27867, 27202, 27202, 27202, 22171, 22934, 24384, 24384, 24384, 18481, 18482, 18482, 27202, 27202, 35771, 20047, 24385, 19887, 25677, 18482, 18483, 27202, 27202, 19738, 23870, 19887, 30991, 18484, 27202, 31802, 19425, 19466, 23052, 23296, 19847, 30990, 27868, 34251, 19859, 25794, 34248, 19856, 25793, 19779, 30988, 23482, 30981, 22080, 19438, 27956, 19678, 27944, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22305, 18847, 22034, 18482, 27869, 34068, 24384, 29176, 22062, 18482, 18482, 18482, 18484, 27202, 27202, 27202, 27202, 22245, 24384, 24384, 24384, 24384, 30621, 18482, 18482, 18482, 18482, 18482, 25794, 27202, 27202, 27202, 27202, 35010, 22148, 24384, 24384, 24384, 24384, 31473, 31659, 18482, 18482, 18482, 18482, 18484, 27202, 27202, 27202, 27202, 27202, 19503, 24384, 24384, 24384, 24384, 24384, 31154, 18482, 18482, 18482, 18482, 23052, 27202, 27202, 27202, 27202, 30764, 21406, 24384, 24384, 24384, 24384, 26114, 18482, 18482, 18482, 27867, 27202, 27202, 27202, 22171, 22934, 24384, 24384, 24384, 18481, 18482, 18482, 27202, 27202, 35771, 20047, 24385, 19887, 25677, 18482, 18483, 27202, 27202, 19738, 23870, 19887, 30991, 18484, 27202, 31802, 19425, 19466, 23052, 23296, 19847, 30990, 27868, 34251, 19859, 25794, 34248, 19856, 25793, 19779, 30988, 23482, 30981, 22080, 19438, 27956, 19678, 27944, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22305, 18847, 22034, 18482, 27869, 25325, 24384, 29176, 22062, 18482, 18482, 18482, 18484, 27202, 27202, 27202, 27202, 22096, 24384, 24384, 24384, 24384, 18877, 18482, 18482, 18482, 18482, 18482, 25794, 27202, 27202, 27202, 27202, 35010, 22148, 24384, 24384, 24384, 24384, 24017, 31659, 18482, 18482, 18482, 18482, 18484, 27202, 27202, 27202, 27202, 27202, 19503, 24384, 24384, 24384, 24384, 24384, 19647, 18482, 18482, 18482, 18482, 23052, 27202, 27202, 27202, 27202, 30764, 23993, 24384, 24384, 24384, 24384, 26758, 18482, 18482, 18482, 27867, 27202, 27202, 27202, 17590, 23998, 24384, 24384, 24384, 18481, 18482, 18482, 27202, 27202, 27203, 23997, 24385, 19887, 25677, 18482, 18483, 27202, 27202, 19738, 23870, 19887, 30991, 18484, 27202, 31802, 19425, 19466, 23052, 23296, 19847, 30990, 27868, 34251, 19859, 25794, 34248, 19856, 25793, 19779, 30988, 23482, 30981, 22080, 19438, 27956, 19678, 27944, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22290, 18847, 22034, 18482, 27869, 34957, 24384, 29176, 22062, 18482, 18482, 18482, 18484, 27202, 27202, 27202, 27202, 22096, 24384, 24384, 24384, 24384, 18877, 18482, 18482, 18482, 18482, 18482, 25794, 27202, 27202, 27202, 27202, 35010, 22148, 24384, 24384, 24384, 24384, 24017, 31659, 18482, 18482, 18482, 18482, 18484, 27202, 27202, 27202, 27202, 27202, 19503, 24384, 24384, 24384, 24384, 24384, 19647, 18482, 18482, 18482, 18482, 23052, 27202, 27202, 27202, 27202, 30764, 23993, 24384, 24384, 24384, 24384, 26758, 18482, 18482, 18482, 27867, 27202, 27202, 27202, 17590, 23998, 24384, 24384, 24384, 18481, 18482, 18482, 27202, 27202, 27203, 23997, 24385, 19887, 25677, 18482, 18483, 27202, 27202, 19738, 23870, 19887, 30991, 18484, 27202, 31802, 19425, 19466, 23052, 23296, 19847, 30990, 27868, 34251, 19859, 25794, 34248, 19856, 25793, 19779, 30988, 23482, 30981, 22080, 19438, 27956, 19678, 27944, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22305, 18847, 22034, 18482, 27869, 25325, 24384, 29176, 22062, 18482, 18482, 18482, 18484, 27202, 27202, 27202, 27202, 22096, 24384, 24384, 24384, 24384, 18877, 18482, 18482, 18482, 18482, 18482, 25794, 27202, 27202, 27202, 27202, 35010, 22148, 24384, 24384, 24384, 24384, 24017, 31659, 18482, 18482, 18482, 18482, 18484, 27202, 27202, 27202, 27202, 27202, 19503, 24384, 24384, 24384, 24384, 24384, 19647, 18482, 18482, 18482, 18482, 23052, 27202, 27202, 27202, 27202, 30764, 23993, 24384, 24384, 24384, 24384, 34436, 18482, 18482, 18482, 27867, 27202, 27202, 27202, 17590, 23998, 24384, 24384, 24384, 18481, 18482, 18482, 27202, 27202, 27203, 23997, 24385, 19887, 25677, 18482, 18483, 27202, 27202, 19738, 23870, 19887, 30991, 18484, 27202, 31802, 19425, 19466, 23052, 23296, 19847, 30990, 27868, 34251, 19859, 25794, 34248, 19856, 25793, 19779, 30988, 23482, 30981, 22080, 19438, 27956, 19678, 27944, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22320, 18847, 19006, 19027, 19252, 17687, 19027, 17173, 27077, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 17991, 17308, 17327, 17346, 18937, 18460, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 21848, 17311, 18669, 19018, 19027, 17447, 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 19175, 17906, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 19919, 18081, 18098, 18114, 18159, 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758, 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21803, 18847, 19006, 19027, 19252, 17687, 19027, 17173, 30771, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 17991, 17308, 17327, 17346, 18937, 18460, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 21848, 17311, 18669, 19018, 19027, 17447, 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 19175, 17906, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 18632, 18081, 18098, 18114, 18159, 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758, 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22275, 22479, 19006, 19027, 19252, 17687, 19027, 19141, 30771, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 17991, 17308, 17327, 17346, 18937, 22510, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 21848, 17311, 18669, 19018, 19027, 17447, 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 19175, 17906, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 18632, 18081, 18098, 18114, 18159, 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758, 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22574, 18847, 22954, 22970, 27597, 22986, 23002, 23033, 22062, 18482, 18482, 18482, 23049, 27202, 27202, 27202, 23068, 22096, 24384, 24384, 24384, 23088, 31359, 31082, 19693, 18482, 28112, 28225, 19443, 35045, 27202, 27202, 23108, 23139, 23155, 23178, 24384, 24384, 23212, 35330, 31659, 23228, 18482, 23256, 23274, 27795, 26712, 23293, 35214, 34879, 33340, 23312, 18235, 23359, 32708, 23949, 24384, 23380, 35255, 23429, 18482, 33884, 23408, 23448, 27202, 27202, 23498, 23518, 21406, 23541, 24384, 24384, 23570, 26114, 23601, 23623, 18482, 33444, 23651, 32875, 27202, 22171, 18862, 23702, 36589, 24384, 18481, 23731, 32601, 27202, 23750, 23768, 20047, 32969, 24367, 25677, 18482, 18483, 27202, 27202, 19738, 23870, 23784, 30991, 18484, 27202, 31802, 19425, 19466, 23052, 23296, 19847, 28217, 31795, 23804, 26925, 34916, 23831, 26501, 25793, 23859, 23895, 23482, 30981, 22080, 19438, 27956, 19678, 29812, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22589, 18847, 22034, 18482, 27869, 25325, 24384, 29176, 22062, 18482, 18482, 18482, 18484, 27202, 27202, 27202, 27202, 22096, 24384, 24384, 24384, 24384, 30621, 18482, 18482, 18482, 18482, 28902, 25794, 27202, 27202, 27202, 34019, 23914, 22148, 24384, 24384, 24384, 28393, 23930, 31659, 18482, 18482, 18482, 18482, 18484, 27202, 27202, 27202, 27202, 27202, 19503, 24384, 24384, 24384, 24384, 24384, 31154, 26591, 18482, 18482, 18482, 31585, 23965, 27202, 27202, 27202, 23986, 22185, 24014, 24384, 24384, 24384, 24033, 18482, 18482, 18482, 27867, 27202, 27202, 27202, 22171, 22934, 24384, 24384, 24384, 18481, 18482, 18482, 27202, 27202, 35771, 20047, 24385, 19887, 25677, 18482, 18483, 27202, 27202, 19738, 23870, 19887, 30991, 18484, 27202, 31802, 19425, 19466, 23052, 23296, 19847, 30990, 27868, 34251, 26504, 24057, 24107, 24132, 25793, 19779, 30988, 23482, 30981, 22080, 19438, 27956, 19678, 27944, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22604, 18847, 22034, 19697, 27869, 24166, 24384, 24182, 24198, 26600, 18482, 18482, 18484, 24233, 24249, 27202, 27202, 22096, 24268, 24284, 24384, 24384, 30621, 19800, 35427, 35999, 32609, 18482, 25794, 24303, 28959, 23752, 27202, 35010, 22148, 24341, 32040, 26837, 24383, 31473, 31659, 18482, 18482, 18482, 24784, 18484, 27202, 27202, 27202, 27202, 24401, 19503, 24384, 24384, 24384, 24384, 20134, 31154, 18482, 18482, 18482, 27845, 23052, 27202, 27202, 33502, 27202, 30764, 21406, 24384, 24384, 22938, 24384, 26114, 18482, 36246, 18482, 27867, 27202, 24423, 27202, 22171, 22934, 24384, 24442, 24384, 36762, 28438, 18482, 34466, 34508, 35771, 24461, 24385, 24477, 25677, 18482, 36220, 27202, 27202, 24498, 30954, 23715, 30991, 18484, 27202, 31802, 19425, 19466, 23052, 23296, 24521, 30990, 27868, 34251, 30090, 23343, 24546, 19856, 25793, 19779, 30988, 23482, 26152, 22080, 19438, 29824, 24562, 27944, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22619, 18847, 22034, 25767, 22132, 25325, 23162, 29176, 24597, 24091, 23607, 24656, 26122, 24680, 24426, 24696, 28551, 22096, 24731, 24445, 24747, 23364, 30621, 18482, 18482, 18482, 18482, 24781, 25794, 27202, 27202, 27202, 34210, 35010, 22148, 24384, 24384, 24384, 33259, 31473, 22525, 24087, 24213, 18482, 18482, 34908, 24800, 30419, 27202, 27202, 32418, 19503, 29781, 35065, 24384, 24384, 19891, 31154, 24835, 18482, 18482, 24854, 29214, 27202, 27202, 32006, 27202, 30764, 35344, 24384, 24384, 31544, 24384, 26114, 33098, 27814, 27002, 27867, 34668, 25625, 24871, 22171, 22934, 19214, 34531, 24889, 18481, 18482, 18482, 27202, 27202, 35771, 20047, 24385, 19887, 25677, 18482, 33615, 27202, 27202, 24907, 24930, 23554, 30991, 18484, 27202, 31802, 22199, 19466, 23052, 23296, 19847, 30877, 31015, 24955, 19859, 24983, 34248, 30871, 25793, 19779, 30988, 23482, 30981, 22080, 19438, 24999, 19678, 27944, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22634, 18847, 25024, 25040, 31293, 25056, 25072, 25088, 22062, 34734, 24217, 36253, 34808, 32637, 25104, 23072, 32848, 22245, 36623, 25120, 30679, 27356, 30621, 25136, 26455, 25174, 25208, 22540, 23240, 25224, 25240, 25256, 25306, 25341, 25357, 25418, 25446, 25470, 26739, 25522, 31659, 23635, 25576, 27398, 25593, 28592, 25945, 25617, 27202, 32546, 27295, 25641, 25850, 25667, 24384, 34758, 25699, 25716, 22552, 27787, 30221, 25756, 25789, 25810, 25828, 28333, 28988, 30764, 21493, 33405, 25848, 25866, 25904, 26114, 31227, 26677, 30167, 27867, 25941, 25961, 27202, 22171, 22934, 25977, 25997, 24384, 23394, 27775, 25740, 25270, 26013, 26048, 26064, 26104, 26138, 26178, 26211, 26230, 26247, 30500, 26380, 26282, 28388, 30991, 33711, 27202, 33645, 26324, 36716, 26353, 26374, 35300, 30990, 26396, 26415, 30927, 26358, 33832, 26442, 26471, 26487, 26520, 23482, 33146, 26539, 26555, 27956, 31266, 27944, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22649, 18847, 26576, 26189, 26616, 25325, 26643, 29176, 22062, 26669, 18482, 18482, 18484, 26693, 27202, 27202, 27202, 22096, 26728, 24384, 24384, 24384, 30621, 18482, 18482, 18482, 18482, 26782, 25794, 27202, 27202, 27202, 26258, 35010, 22148, 24384, 24384, 24384, 21571, 31473, 31659, 18482, 18482, 33949, 18482, 18484, 27202, 27202, 25812, 27202, 27202, 19503, 24384, 24384, 24384, 26800, 24384, 31154, 18482, 18482, 18482, 35570, 23052, 27202, 27202, 27202, 26817, 30764, 21406, 24384, 24384, 24384, 26836, 26114, 18482, 18482, 18482, 27867, 27202, 27202, 27202, 22171, 22934, 24384, 24384, 24384, 18481, 18482, 18482, 27202, 27202, 35771, 20047, 24385, 19887, 25677, 31882, 18483, 35699, 27202, 19738, 26853, 19887, 30991, 18484, 27202, 31802, 19425, 19466, 23052, 23296, 26913, 30990, 27868, 34251, 19859, 25794, 34248, 19856, 25793, 19779, 30988, 23482, 24967, 31061, 19438, 26953, 27663, 27944, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22664, 18847, 26990, 18482, 27869, 25325, 24384, 29176, 22062, 18482, 18482, 18482, 18484, 27202, 27202, 27202, 27202, 22096, 24384, 24384, 24384, 24384, 23017, 18482, 18482, 18482, 18482, 18482, 25794, 27202, 27202, 27202, 27202, 35010, 27024, 24384, 24384, 24384, 24384, 24017, 31659, 18482, 18482, 27047, 18482, 18484, 27202, 27202, 27331, 27202, 27202, 27066, 24384, 24384, 29025, 24384, 24384, 19647, 18482, 18482, 18482, 18482, 23052, 27202, 27202, 27202, 27202, 30764, 23993, 24384, 24384, 24384, 24384, 26758, 18482, 18482, 33957, 27867, 27202, 27202, 27093, 17590, 23998, 24384, 24384, 27114, 27135, 36322, 27153, 27201, 27219, 28359, 18229, 34780, 34405, 27235, 35972, 27268, 27293, 27311, 36040, 33984, 20980, 31851, 21453, 30535, 27347, 32520, 27372, 23052, 23296, 19847, 30990, 27868, 34251, 19859, 25794, 34248, 19856, 25793, 19779, 30988, 23482, 30981, 22080, 26337, 30118, 19678, 27944, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22305, 18847, 22034, 27397, 27414, 27436, 27452, 27473, 22062, 18482, 18482, 30171, 18484, 27202, 27202, 27982, 27202, 22096, 24384, 24384, 25700, 24384, 18877, 18482, 18482, 18482, 18482, 18482, 34013, 27202, 27202, 27202, 27202, 29731, 22148, 24384, 24384, 24384, 24384, 27119, 31659, 27489, 18482, 18482, 18482, 18484, 27185, 27202, 27202, 27202, 27202, 19503, 27457, 24384, 24384, 24384, 24384, 19647, 18482, 18482, 18482, 27050, 23052, 27202, 27202, 27202, 32469, 30764, 23993, 24384, 24384, 24384, 34982, 26758, 18482, 18482, 18482, 27867, 27202, 27202, 27202, 17590, 23998, 24384, 24384, 24384, 18481, 18482, 18482, 27202, 27202, 27203, 23997, 24385, 19887, 25677, 18482, 18483, 27202, 27202, 19738, 23870, 19887, 30991, 20796, 27202, 29362, 22110, 33940, 23052, 23296, 19847, 30990, 27868, 34251, 19859, 25794, 34248, 19856, 25793, 19779, 30988, 23482, 30981, 22080, 19438, 27956, 19678, 27944, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22679, 18847, 22034, 27508, 27528, 27553, 35182, 27569, 22062, 29693, 26300, 23258, 27585, 24715, 27613, 27202, 27648, 22096, 36597, 27698, 24384, 27733, 18877, 18482, 27811, 18482, 27830, 22046, 27865, 32194, 27202, 25158, 27885, 27913, 22148, 29458, 24384, 29977, 34392, 26750, 27763, 26889, 18482, 18482, 27252, 29886, 27929, 27202, 27202, 27202, 27981, 27998, 28024, 28045, 24384, 24384, 28062, 28081, 28128, 25506, 28145, 26088, 28160, 27202, 28173, 24640, 28189, 30764, 31496, 24384, 28205, 34154, 36166, 24939, 28241, 28259, 28283, 21463, 33034, 28320, 28349, 17590, 20967, 23092, 28375, 28409, 28095, 28435, 28454, 28474, 28509, 28527, 20001, 33682, 25879, 25677, 18482, 18483, 27202, 27202, 19738, 23870, 19887, 30272, 28267, 28546, 28567, 19425, 28583, 23052, 23296, 19847, 19471, 28608, 28653, 31075, 25794, 34248, 19856, 25793, 19779, 29644, 35950, 30318, 22080, 19438, 27956, 23123, 28693, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22305, 18847, 22034, 18482, 27869, 25325, 24384, 29176, 22062, 18482, 18482, 18482, 18484, 27202, 27202, 27202, 27202, 22096, 24384, 24384, 24384, 24384, 18877, 18482, 18482, 18482, 18482, 18482, 25794, 27202, 27202, 27202, 27202, 35010, 22148, 24384, 24384, 24384, 24384, 24017, 22494, 18482, 18482, 18482, 18482, 18484, 25283, 27202, 27202, 27202, 27202, 19503, 29397, 24384, 24384, 24384, 24384, 19647, 18482, 18482, 18482, 18482, 23052, 27202, 27202, 27202, 27202, 30764, 23993, 24384, 24384, 24384, 24384, 26758, 18482, 18482, 18482, 27867, 27202, 27202, 27202, 17590, 23998, 24384, 24384, 24384, 18481, 18482, 18482, 27202, 27202, 27203, 23997, 24385, 19887, 25677, 18482, 18483, 27202, 27202, 19738, 23870, 19887, 30991, 18484, 27202, 31802, 19425, 19466, 23052, 23296, 19847, 30990, 27868, 34251, 19859, 25794, 34248, 19856, 25793, 19779, 30988, 23482, 30981, 22080, 19438, 27956, 19678, 27944, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22694, 18847, 28740, 28775, 28810, 28834, 28850, 28873, 28889, 24142, 28936, 31945, 36329, 25290, 28954, 27632, 28975, 29004, 24505, 29020, 25454, 29041, 23017, 27512, 29083, 29103, 30721, 18482, 23478, 29123, 24819, 27202, 29148, 28920, 27024, 29166, 23196, 24384, 29192, 35529, 31659, 18482, 18482, 25601, 32589, 29211, 27202, 27202, 31434, 30700, 29230, 27066, 24384, 24384, 24384, 29255, 29306, 19647, 18482, 33383, 18482, 18482, 23052, 27202, 29333, 27202, 27202, 30764, 23993, 35925, 24384, 24384, 24384, 27717, 36123, 18482, 18482, 29350, 29413, 27202, 35642, 17590, 21411, 29432, 24384, 25981, 18481, 33866, 18482, 27202, 26967, 27203, 23997, 32729, 19887, 25677, 18482, 26897, 27202, 27202, 29451, 23870, 24354, 30991, 18484, 27202, 31802, 19425, 19466, 23052, 23296, 19847, 30990, 27868, 31737, 19859, 25794, 34248, 19856, 29474, 29539, 29283, 29581, 29637, 22080, 32533, 29501, 19678, 27944, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22709, 18847, 22034, 29660, 29512, 25325, 33242, 29176, 29682, 27245, 18482, 29709, 33286, 26974, 27202, 29725, 29747, 22096, 19221, 24384, 32702, 29772, 18877, 26784, 33892, 28458, 18482, 18482, 25794, 29797, 27202, 29840, 27202, 35010, 22148, 35817, 24384, 29859, 24384, 24017, 36756, 25192, 18482, 18482, 29879, 18484, 27202, 29902, 27202, 26032, 27202, 29925, 24384, 29960, 24384, 33594, 24384, 19647, 18482, 18482, 18482, 18482, 23052, 27202, 27202, 27202, 27202, 29239, 29993, 24384, 24384, 24384, 24384, 26758, 18482, 18482, 18482, 27867, 27202, 27202, 27202, 17590, 23998, 24384, 24384, 24384, 31665, 18482, 18482, 19603, 27202, 27203, 23997, 30013, 19887, 25677, 18482, 18483, 27202, 27202, 19738, 23870, 19887, 30991, 18484, 27202, 31802, 19949, 19466, 36661, 19563, 19847, 30029, 30128, 30062, 19859, 25794, 30078, 19856, 25793, 19779, 30988, 23482, 30981, 22080, 19438, 27956, 19678, 30106, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22724, 18847, 30152, 30187, 30237, 30288, 30304, 30344, 22062, 35616, 32797, 25773, 18484, 29909, 34096, 26820, 27202, 22096, 24914, 23189, 29195, 24384, 18877, 34444, 30360, 18482, 18482, 18482, 23413, 24707, 27202, 27202, 27202, 35010, 30378, 34990, 24384, 24384, 24384, 24017, 29554, 18482, 18482, 27137, 18482, 31281, 30394, 27202, 27202, 30413, 30566, 19503, 30435, 24384, 24384, 29969, 35678, 19647, 28759, 30455, 35459, 35606, 23052, 28724, 30490, 30525, 30560, 30764, 23993, 20123, 30582, 30606, 30675, 26291, 33426, 28938, 27682, 30695, 23675, 33466, 28493, 17590, 23944, 20405, 34338, 20997, 32331, 26308, 30716, 30737, 24315, 30756, 21563, 36372, 30787, 26653, 24611, 33177, 32448, 30814, 31804, 25430, 25917, 26523, 18484, 28818, 31802, 29269, 19466, 28297, 34240, 23815, 26076, 30842, 30858, 32115, 30893, 30915, 32757, 25793, 30943, 30988, 23482, 30981, 30970, 31007, 27956, 19678, 29489, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22739, 18847, 31031, 31047, 32397, 31098, 31114, 31170, 22062, 18482, 29565, 35577, 36725, 27202, 33216, 31186, 24407, 22096, 24384, 20142, 31202, 34301, 27748, 31218, 33388, 27166, 18482, 29087, 27277, 27202, 31251, 31309, 27202, 31328, 31344, 24384, 31375, 31391, 24384, 31410, 31659, 18482, 36130, 32801, 18482, 18484, 27202, 27202, 31433, 31450, 27202, 19503, 24384, 24384, 31470, 33588, 24384, 32977, 18482, 18482, 18482, 18482, 30038, 27202, 27202, 27202, 27202, 31489, 32244, 24384, 24384, 24384, 24384, 31512, 18482, 28755, 18482, 24634, 35732, 27202, 27202, 28637, 31538, 35788, 24384, 24384, 19337, 31986, 18482, 33208, 25316, 27203, 29997, 29863, 19887, 25677, 18482, 18483, 27202, 27202, 19738, 31560, 19887, 31601, 32369, 33316, 30136, 31629, 19972, 31681, 31726, 31753, 31781, 30046, 31820, 31847, 25794, 34282, 19856, 25793, 19779, 30988, 23482, 30981, 22080, 19438, 27956, 31867, 30252, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22754, 18847, 22034, 18909, 30474, 31902, 24287, 31918, 31934, 32767, 35262, 27008, 29621, 34103, 19820, 29416, 33323, 22096, 27031, 30439, 29435, 28857, 29596, 18482, 18482, 18482, 31961, 18482, 25794, 27202, 27202, 35038, 27202, 35010, 22148, 24384, 24384, 29389, 24384, 24017, 31979, 18482, 26937, 18482, 18482, 18484, 27202, 31454, 32002, 27202, 27202, 32022, 24384, 33015, 32056, 24384, 24384, 33690, 18482, 18482, 33119, 18482, 23052, 27202, 27202, 27624, 27202, 29756, 32078, 24384, 24384, 34332, 24384, 26758, 18482, 18482, 18482, 27867, 27202, 27202, 27202, 36691, 23998, 24384, 24384, 24384, 18481, 18482, 18482, 27202, 27202, 27203, 23997, 24385, 19887, 25677, 18482, 18483, 27202, 27202, 19738, 23870, 19887, 30991, 18484, 27202, 31802, 31710, 22155, 33181, 24252, 32103, 30990, 27868, 34251, 19859, 25794, 34248, 30265, 25793, 19779, 30988, 23482, 30981, 22080, 19438, 27956, 19678, 27944, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22305, 18847, 32138, 32166, 32186, 30826, 33252, 29067, 22062, 18482, 18482, 18482, 18484, 27202, 27202, 27202, 27202, 22096, 24384, 24384, 24384, 24384, 23585, 18482, 18482, 18482, 18482, 18482, 25794, 27202, 27202, 27202, 27202, 35010, 32210, 24384, 24384, 24384, 24384, 24017, 31659, 18482, 18482, 18482, 18482, 18484, 27202, 27202, 27202, 27202, 27202, 32233, 24384, 24384, 24384, 24384, 24384, 19647, 18482, 18482, 18482, 18482, 23052, 27202, 27202, 27202, 27202, 30764, 23993, 24384, 24384, 24384, 24384, 26758, 18482, 18482, 18482, 27867, 27202, 27202, 27202, 17590, 23998, 24384, 24384, 24384, 18481, 18482, 18482, 27202, 27202, 27203, 23997, 24385, 19887, 25677, 33857, 18483, 36057, 27202, 19738, 35289, 19887, 30991, 18484, 27202, 31802, 19425, 19466, 23052, 23296, 19847, 30990, 27868, 34251, 19859, 25794, 34248, 19856, 25793, 19779, 30988, 23482, 30981, 22080, 19438, 27956, 19678, 27944, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22769, 18847, 32269, 31613, 34604, 32285, 32301, 32351, 22062, 18482, 32367, 19354, 32385, 27202, 32413, 27098, 32434, 22096, 24384, 32485, 20052, 32506, 18877, 25396, 23734, 18482, 18482, 32562, 32625, 27202, 32653, 27202, 23664, 32673, 32689, 24384, 32724, 24384, 25888, 32745, 34706, 18482, 27381, 32783, 24577, 24838, 32817, 24873, 32838, 32864, 27202, 32899, 32934, 24384, 32957, 29317, 24384, 30798, 26214, 27678, 33875, 18482, 23052, 36352, 27202, 32993, 27202, 30764, 23993, 32087, 24384, 33013, 24384, 35853, 18482, 18482, 30362, 27965, 27202, 27202, 33754, 17590, 20112, 24384, 24384, 34576, 20792, 18482, 18482, 33031, 27202, 27203, 36159, 24385, 19887, 25677, 18482, 18483, 27202, 27202, 19738, 23870, 19887, 30991, 18484, 27202, 31802, 19425, 34554, 24150, 33050, 33080, 33114, 27868, 34251, 23843, 26560, 31696, 19856, 25793, 19779, 30988, 23482, 30981, 33135, 22123, 27956, 23463, 27944, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22784, 18847, 33162, 28106, 33197, 25325, 33232, 29176, 22062, 33275, 35433, 18482, 18484, 33302, 26399, 33339, 27202, 22096, 33356, 28065, 33404, 24384, 18877, 22229, 18482, 33421, 18482, 18482, 33442, 33460, 24811, 27202, 27202, 26627, 22148, 24758, 35190, 24384, 24384, 25925, 29611, 18482, 18482, 29290, 25186, 33482, 33501, 27202, 27202, 33518, 36276, 19503, 33554, 24384, 24384, 33573, 32490, 19647, 18482, 18482, 31235, 33610, 23052, 27202, 27202, 33631, 27202, 30764, 23993, 24384, 24384, 33670, 24384, 26862, 27492, 18482, 33706, 27867, 32883, 34639, 27202, 17590, 32036, 24765, 23788, 24384, 18481, 18482, 18482, 27202, 27202, 27203, 33727, 36097, 19887, 25677, 18482, 23334, 27202, 29150, 19738, 23870, 35357, 30328, 18484, 33748, 34675, 33770, 19466, 34050, 33824, 31831, 30990, 27868, 34251, 33848, 28913, 33908, 19856, 30469, 33973, 25385, 36033, 34000, 22080, 19438, 27956, 19678, 27944, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22799, 18847, 34035, 32576, 34084, 34119, 34135, 34170, 34186, 32150, 36005, 31522, 31886, 34202, 34226, 34267, 29334, 34317, 34354, 34378, 34421, 26801, 18877, 26195, 29666, 25402, 18482, 35091, 25794, 34460, 34482, 34504, 25832, 35010, 22148, 34524, 34547, 34570, 19623, 24017, 36654, 35111, 24664, 18482, 32335, 34592, 31312, 34620, 34636, 27202, 34655, 34691, 28046, 34750, 34774, 24384, 33785, 19647, 34796, 32170, 34844, 24581, 33485, 26704, 34828, 34860, 35493, 29132, 36704, 33800, 35368, 32941, 34146, 26758, 34895, 18482, 18482, 34932, 34948, 27202, 32997, 17590, 29944, 34973, 24384, 36296, 25500, 30202, 35875, 35006, 35026, 26266, 20396, 31146, 35061, 35081, 35127, 24623, 28484, 27897, 19738, 35143, 35170, 26162, 28794, 35206, 35230, 33064, 35245, 23052, 23296, 29054, 30990, 27868, 34251, 19859, 25794, 34248, 24530, 25147, 35278, 31765, 35316, 33370, 22080, 19438, 27956, 24072, 28623, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22814, 18847, 22034, 34720, 34059, 35384, 20989, 35400, 35416, 35449, 18482, 18482, 23432, 35475, 27202, 27202, 27202, 35509, 31127, 24384, 24384, 24384, 35545, 18482, 26871, 35101, 35593, 24855, 25794, 30397, 23502, 26024, 35639, 35658, 22148, 19541, 19583, 30590, 35674, 27709, 35560, 29107, 18482, 18482, 18482, 18484, 27202, 35694, 27202, 27202, 27202, 35715, 24384, 36580, 24384, 24384, 24384, 19647, 30215, 18482, 18482, 18482, 23052, 35731, 27202, 27202, 27202, 27537, 22904, 24384, 24384, 24384, 24384, 23879, 35748, 18482, 18482, 25008, 35770, 27202, 27202, 17590, 20031, 35787, 24384, 24384, 18481, 18482, 18482, 27202, 27202, 27203, 23997, 24385, 19887, 25677, 18482, 18483, 27202, 27202, 19738, 23870, 19887, 23898, 18484, 34488, 31802, 25371, 19466, 23052, 23296, 26426, 30990, 27868, 34251, 19859, 25794, 35804, 19856, 27178, 35833, 33092, 23482, 30981, 22080, 22212, 28705, 19678, 27944, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22829, 18847, 22034, 35869, 28716, 25325, 31137, 29176, 22062, 26766, 18482, 22558, 18484, 23970, 27202, 29843, 27202, 22096, 33732, 24384, 31394, 24384, 18877, 18482, 18482, 26880, 18482, 18482, 25794, 27202, 30740, 27202, 27202, 35010, 22148, 24384, 24891, 24384, 24384, 24017, 31659, 18482, 18482, 18482, 18482, 18484, 27202, 27202, 27202, 27202, 27202, 19503, 24384, 24384, 24384, 24384, 24384, 19647, 18482, 18482, 18482, 18482, 23052, 27202, 27202, 27202, 27202, 30764, 23993, 24384, 24384, 24384, 24384, 26758, 18482, 18482, 18482, 27867, 27202, 27202, 27202, 17590, 23998, 24384, 24384, 24384, 18481, 18482, 18482, 27202, 27202, 27203, 23997, 24385, 19887, 25677, 18482, 18483, 27202, 27202, 19738, 23870, 19887, 30991, 18484, 27202, 31802, 19425, 19466, 23052, 23296, 19847, 30990, 27868, 34251, 19859, 25794, 34248, 19856, 25793, 19779, 30988, 23482, 30981, 22080, 19438, 27956, 19678, 27944, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22844, 18847, 22034, 27849, 27869, 35891, 24384, 35907, 22062, 18482, 18482, 18482, 18484, 27202, 27202, 27202, 27202, 22096, 24384, 24384, 24384, 24384, 18877, 18482, 18482, 18482, 18482, 18482, 25794, 27202, 27202, 27202, 27202, 35010, 22148, 24384, 24384, 24384, 24384, 24017, 31575, 18482, 18482, 18482, 18482, 26231, 27202, 27202, 27202, 27202, 27202, 19503, 35923, 24384, 24384, 24384, 24384, 19647, 18482, 28129, 18482, 18482, 35941, 27202, 32822, 27202, 32657, 30764, 23993, 24384, 32217, 24384, 32062, 26758, 18482, 18482, 18482, 27867, 27202, 27202, 27202, 17590, 23998, 24384, 24384, 24384, 18481, 18482, 18482, 27202, 27202, 27203, 23997, 24385, 19887, 25677, 18482, 18483, 27202, 27202, 19738, 23870, 19887, 30991, 18484, 27202, 31802, 19425, 19466, 23052, 23296, 19847, 30990, 27868, 34251, 19859, 25794, 34248, 19856, 25793, 19779, 30988, 23482, 30981, 22080, 19438, 27956, 19678, 27944, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22859, 18847, 22034, 35966, 34820, 25325, 33931, 29176, 35988, 18482, 23277, 18482, 36021, 27202, 27202, 36056, 36073, 22096, 24384, 24384, 36096, 33921, 18877, 18482, 18482, 18482, 18482, 18482, 25794, 27202, 27202, 27202, 27202, 35010, 22148, 24384, 24384, 24384, 24384, 24017, 36113, 18482, 25577, 18482, 18482, 18484, 27202, 27202, 27324, 27202, 27202, 36146, 24384, 24384, 34362, 24384, 24384, 19647, 28243, 18482, 18482, 18482, 23052, 30899, 27202, 27202, 27202, 23686, 23993, 33808, 24384, 24384, 24384, 26758, 18482, 18482, 18482, 27867, 27202, 27202, 27202, 17590, 23998, 24384, 24384, 24384, 18481, 18482, 18482, 27202, 27202, 27203, 23997, 24385, 19887, 25677, 18482, 18483, 27202, 27202, 19738, 23870, 19887, 30991, 18484, 27202, 31802, 19425, 19466, 23052, 23296, 19847, 30990, 27868, 34251, 19859, 25794, 34248, 19856, 25793, 19779, 30988, 23482, 30981, 22080, 19438, 27956, 19678, 27944, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22305, 18847, 22034, 19373, 27869, 36182, 24384, 36198, 22062, 18482, 18482, 18482, 18049, 27202, 27202, 27202, 35485, 22096, 24384, 24384, 24384, 29371, 18877, 18482, 36214, 18482, 28788, 18482, 25794, 34872, 27202, 27420, 27202, 35010, 22148, 29380, 24384, 24482, 24384, 24017, 31659, 18482, 36236, 18482, 18482, 18484, 27202, 36080, 27202, 27202, 27202, 19503, 24384, 28029, 24384, 24384, 24384, 19647, 18482, 18482, 32122, 18482, 35754, 27202, 27202, 36269, 27202, 33531, 23993, 24384, 24384, 36292, 24384, 36312, 18482, 18482, 18482, 27867, 27202, 27202, 27202, 17590, 23998, 24384, 24384, 24384, 25730, 18482, 18482, 36345, 27202, 27203, 19203, 24385, 19887, 25677, 31963, 18483, 27202, 32462, 19738, 23870, 36368, 30991, 18484, 27202, 31802, 19425, 19466, 23052, 23296, 19847, 30990, 27868, 34251, 19859, 25794, 34248, 19856, 25793, 19779, 30988, 23482, 30981, 22080, 19438, 27956, 19678, 27944, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22350, 18847, 36388, 19027, 19252, 17687, 36433, 17173, 17595, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 36452, 17308, 17327, 17346, 18937, 18460, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 17682, 21701, 17311, 18669, 19018, 19027, 17447, 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 19175, 17906, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 18632, 18081, 18098, 18114, 18159, 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758, 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22335, 18847, 19006, 19027, 19252, 17687, 19027, 21712, 30771, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 17991, 17308, 17327, 17346, 18937, 18460, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 21848, 17311, 18669, 19018, 19027, 17447, 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 19175, 17906, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 18632, 18081, 18098, 18114, 18159, 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758, 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21788, 18847, 36488, 19027, 19252, 17687, 19027, 17173, 17779, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 17810, 17308, 17327, 17346, 18937, 18460, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21165, 21997, 17311, 18669, 19018, 19027, 17447, 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 19175, 17906, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 18632, 18081, 18098, 18114, 18159, 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758, 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21803, 18847, 19006, 19027, 19252, 17687, 19027, 17173, 30771, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 36516, 17308, 17327, 17346, 18937, 18460, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 21848, 17311, 18669, 19018, 19027, 17447, 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 19175, 17906, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 18632, 18081, 18098, 18114, 18159, 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758, 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21803, 18847, 19326, 18482, 27869, 30764, 24384, 29176, 28008, 18482, 18482, 18482, 18484, 27202, 27202, 27202, 27202, 36566, 24384, 24384, 24384, 24384, 22919, 18482, 18482, 18482, 18482, 18482, 25794, 27202, 27202, 27202, 27202, 28530, 36613, 24384, 24384, 24384, 24384, 24017, 18892, 18482, 18482, 18482, 18482, 18484, 27202, 27202, 27202, 27202, 27202, 19503, 24384, 24384, 24384, 24384, 24384, 19647, 18482, 18482, 18482, 18482, 23052, 27202, 27202, 27202, 27202, 30764, 23993, 24384, 24384, 24384, 24384, 26758, 18482, 18482, 18482, 27867, 27202, 27202, 27202, 17590, 23998, 24384, 24384, 24384, 18481, 18482, 18482, 27202, 27202, 27203, 23997, 24385, 19887, 25677, 18482, 18483, 27202, 27202, 19738, 23870, 19887, 30991, 18484, 27202, 31802, 19425, 19466, 23052, 23296, 19847, 30990, 27868, 34251, 19859, 25794, 34248, 19856, 25793, 19779, 30988, 23482, 30981, 22080, 19438, 27956, 19678, 27944, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 36639, 36677, 18731, 19027, 19252, 17687, 19027, 17454, 17595, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 17223, 17308, 17327, 17346, 18937, 36741, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 17682, 21701, 17311, 18669, 19018, 19027, 17447, 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 19175, 17906, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 18632, 18081, 18098, 18114, 18159, 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758, 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 0, 94242, 0, 118820, 0, 2211840, 102439, 0, 0, 106538, 98347, 0, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2482176, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 2207744, 2404352, 2412544, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 3104768, 2605056, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2678784, 2207744, 2695168, 2207744, 2703360, 2207744, 2711552, 2752512, 2207744, 0, 0, 0, 0, 0, 0, 2166784, 0, 0, 0, 0, 0, 0, 2158592, 2158592, 3170304, 3174400, 2158592, 0, 139, 0, 2158592, 2158592, 2158592, 2158592, 2158592, 2424832, 2158592, 2158592, 2158592, 2748416, 2756608, 2777088, 2801664, 2158592, 2158592, 2158592, 2863104, 2891776, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 3104768, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2207744, 2785280, 2207744, 2809856, 2207744, 2207744, 2842624, 2207744, 2207744, 2207744, 2899968, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2564096, 2207744, 2207744, 2207744, 2158592, 2404352, 2412544, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2564096, 2158592, 2158592, 2605056, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2678784, 2158592, 2695168, 2158592, 2703360, 2158592, 2711552, 2752512, 2158592, 2158592, 2785280, 2158592, 2158592, 2785280, 2158592, 2809856, 2158592, 2158592, 2842624, 2158592, 2158592, 2158592, 2899968, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 18, 0, 0, 0, 0, 0, 0, 0, 2211840, 0, 0, 641, 0, 2158592, 0, 0, 0, 0, 0, 0, 0, 0, 2211840, 0, 0, 32768, 0, 2158592, 0, 2158592, 2158592, 2158592, 2383872, 2158592, 2158592, 2158592, 2158592, 3006464, 2383872, 2207744, 2207744, 2207744, 2207744, 2158877, 2158877, 2158877, 2158877, 0, 0, 0, 2158877, 2572573, 2158877, 2158877, 0, 2207744, 2207744, 2596864, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2641920, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 0, 0, 0, 0, 0, 0, 2162968, 0, 0, 3104768, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 0, 0, 0, 2146304, 2146304, 2224128, 2224128, 2232320, 2232320, 2232320, 641, 0, 0, 0, 0, 0, 0, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2531328, 2158592, 2158592, 2158592, 2158592, 2158592, 2617344, 2158592, 2158592, 2158592, 2158592, 2441216, 2445312, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2502656, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2580480, 2158592, 2158592, 2158592, 2158592, 2621440, 2158592, 2580480, 2158592, 2158592, 2158592, 2158592, 2621440, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2699264, 2158592, 2158592, 2158592, 2158592, 2158592, 2748416, 2756608, 2777088, 2801664, 2207744, 2863104, 2891776, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 3018752, 2207744, 3043328, 2207744, 2207744, 2207744, 2207744, 3080192, 2207744, 2207744, 3112960, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 0, 0, 0, 167936, 0, 0, 2162688, 0, 0, 2207744, 2207744, 2207744, 3186688, 2207744, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2158592, 2158592, 2158592, 2404352, 2412544, 2158592, 2510848, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2584576, 2158592, 2609152, 2158592, 2158592, 2629632, 2158592, 2158592, 2158592, 2686976, 2158592, 2715648, 2158592, 2158592, 3121152, 2158592, 2158592, 2158592, 3149824, 2158592, 2158592, 3170304, 3174400, 2158592, 2367488, 2207744, 2207744, 2207744, 2207744, 2158592, 2158592, 2158592, 2158592, 0, 0, 0, 2158592, 2572288, 2158592, 2158592, 0, 2207744, 2207744, 2207744, 2433024, 2207744, 2453504, 2461696, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2510848, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 3096576, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 0, 0, 0, 0, 0, 0, 2162688, 0, 0, 2715648, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2867200, 2207744, 2904064, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2473984, 2207744, 2207744, 2494464, 2207744, 2207744, 2207744, 2523136, 2207744, 2207744, 2207744, 2207744, 3014656, 2207744, 2207744, 3051520, 2207744, 2207744, 3100672, 2207744, 2207744, 3121152, 2207744, 2207744, 2207744, 2207744, 2207744, 2531328, 2207744, 2207744, 2207744, 2207744, 2207744, 2617344, 2207744, 2207744, 2207744, 2207744, 2158592, 2158592, 2158592, 2158592, 0, 0, 0, 2158592, 2572288, 2158592, 2158592, 1508, 2207744, 3149824, 2207744, 2207744, 3170304, 3174400, 2207744, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 138, 2158592, 2158592, 2158592, 2404352, 2412544, 2707456, 2732032, 2207744, 2207744, 2207744, 2822144, 2826240, 2207744, 2895872, 2207744, 2207744, 2924544, 2207744, 2207744, 2973696, 2207744, 0, 0, 0, 0, 0, 0, 2166784, 0, 0, 0, 0, 0, 285, 2158592, 2158592, 3112960, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 3186688, 2158592, 2207744, 2207744, 2158592, 2158592, 2158592, 2158592, 2158592, 0, 0, 0, 2158592, 2158592, 2158592, 2158592, 0, 0, 2535424, 2543616, 2158592, 2158592, 2158592, 0, 0, 0, 2158592, 2158592, 2158592, 2990080, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2572288, 2981888, 2207744, 2207744, 3002368, 2207744, 3047424, 3063808, 3076096, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 3203072, 2708960, 2732032, 2158592, 2158592, 2158592, 2822144, 2827748, 2158592, 2895872, 2158592, 2158592, 2924544, 2158592, 2158592, 2973696, 2158592, 2981888, 2158592, 2158592, 3002368, 2158592, 3047424, 3063808, 3076096, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 3203072, 2981888, 2158592, 2158592, 3003876, 2158592, 3047424, 3063808, 3076096, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 3203072, 2207744, 2207744, 2207744, 2207744, 2207744, 2424832, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 0, 0, 0, 172310, 279, 0, 2162688, 0, 0, 2523136, 2527232, 2158592, 2158592, 2576384, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2908160, 2527232, 2207744, 2207744, 2576384, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2908160, 2207744, 0, 0, 0, 0, 0, 0, 2166784, 0, 0, 0, 0, 0, 286, 2158592, 2158592, 0, 0, 2158592, 2158592, 2158592, 2158592, 2633728, 2658304, 0, 0, 2740224, 2744320, 0, 2834432, 2207744, 2207744, 2977792, 2207744, 2207744, 2207744, 2207744, 3039232, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 3158016, 0, 0, 29315, 0, 0, 0, 0, 45, 45, 45, 45, 45, 933, 45, 45, 45, 45, 442, 45, 45, 45, 45, 45, 45, 45, 45, 45, 67, 67, 2494464, 2158592, 2158592, 2158592, 2524757, 2527232, 2158592, 2158592, 2576384, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 1504, 2158592, 2498560, 2158592, 2158592, 2158592, 2158592, 2568192, 2158592, 2592768, 2625536, 2158592, 2158592, 2674688, 2736128, 2158592, 2158592, 0, 2158592, 2912256, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 3108864, 2158592, 2158592, 3133440, 3145728, 3153920, 2375680, 2379776, 2207744, 2207744, 2420736, 2207744, 2449408, 2207744, 2207744, 2207744, 2498560, 2207744, 2207744, 2207744, 2207744, 2568192, 2207744, 0, 0, 0, 0, 0, 0, 2166784, 0, 0, 0, 0, 0, 551, 2158592, 2158592, 2158592, 2158592, 2207744, 2506752, 2207744, 2207744, 2207744, 2207744, 2207744, 2158592, 2506752, 0, 2020, 2158592, 2592768, 2625536, 2207744, 2207744, 2674688, 2736128, 2207744, 2207744, 2207744, 2912256, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 20480, 0, 0, 0, 0, 0, 2162688, 20480, 0, 2207744, 3108864, 2207744, 2207744, 3133440, 3145728, 3153920, 2375680, 2379776, 2158592, 2158592, 2420736, 2158592, 2449408, 2158592, 2158592, 2158592, 2158592, 2158592, 3186688, 2158592, 0, 641, 0, 0, 0, 0, 0, 0, 2367488, 2158592, 2498560, 2158592, 2158592, 1621, 2158592, 2158592, 2568192, 2158592, 2592768, 2625536, 2158592, 2158592, 2674688, 0, 0, 0, 0, 0, 1608, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1107, 97, 97, 1110, 97, 97, 3133440, 3145728, 3153920, 2158592, 2408448, 2416640, 2158592, 2465792, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 3014656, 2158592, 2158592, 3051520, 2158592, 2158592, 3100672, 2158592, 2158592, 3121152, 2158592, 2158592, 2158592, 3149824, 2416640, 2207744, 2465792, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2633728, 2658304, 2740224, 2744320, 2834432, 2949120, 2158592, 2985984, 2158592, 2998272, 2158592, 2158592, 2158592, 3129344, 2207744, 2408448, 2949120, 2207744, 2985984, 2207744, 2998272, 2207744, 2207744, 2207744, 3129344, 2158592, 2408448, 2416640, 2158592, 2465792, 2158592, 2158592, 2158592, 2158592, 2158592, 3186688, 2158592, 0, 32768, 0, 0, 0, 0, 0, 0, 2367488, 2949120, 2158592, 2985984, 2158592, 2998272, 2158592, 2158592, 2158592, 3129344, 2158592, 2158592, 2478080, 2158592, 2158592, 2158592, 2535424, 2543616, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 3117056, 2207744, 2207744, 2478080, 2207744, 2207744, 2207744, 2207744, 2207744, 2584576, 2207744, 2609152, 2207744, 2207744, 2629632, 2207744, 2207744, 2207744, 2686976, 2207744, 2207744, 2535424, 2543616, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 3117056, 2158592, 2158592, 2478080, 2207744, 2207744, 2990080, 2207744, 2207744, 2158592, 2158592, 2482176, 2158592, 2158592, 0, 0, 0, 2158592, 2158592, 2158592, 0, 2158592, 2908160, 2158592, 2158592, 2158592, 2977792, 2158592, 2158592, 2158592, 2158592, 3039232, 2158592, 2158592, 3010560, 2207744, 2428928, 2207744, 2514944, 2207744, 2588672, 2207744, 2838528, 2207744, 2207744, 2207744, 3010560, 2158592, 2428928, 2158592, 2514944, 0, 0, 2158592, 2588672, 2158592, 0, 2838528, 2158592, 2158592, 2158592, 3010560, 2158592, 2506752, 2158592, 18, 0, 0, 0, 0, 0, 0, 0, 2211840, 0, 0, 0, 0, 2158592, 0, 0, 29315, 922, 0, 0, 0, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 67, 67, 3006464, 2383872, 0, 2020, 2158592, 2158592, 2158592, 2158592, 3006464, 2158592, 2637824, 2953216, 2158592, 2207744, 2637824, 2953216, 2207744, 0, 0, 2158592, 2637824, 2953216, 2158592, 2539520, 2158592, 2539520, 2207744, 0, 0, 2539520, 2158592, 2158592, 2158592, 2158592, 2207744, 2506752, 2207744, 2207744, 2207744, 2207744, 2207744, 2158592, 2506752, 0, 0, 2158592, 2207744, 0, 2158592, 2158592, 2207744, 0, 2158592, 2158592, 2207744, 0, 2158592, 2965504, 2965504, 2965504, 0, 0, 0, 0, 0, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2474269, 2158877, 2158877, 0, 0, 2158877, 2158877, 2158877, 2158877, 2634013, 2658589, 0, 0, 2740509, 2744605, 0, 2834717, 40976, 18, 36884, 45078, 24, 28, 90143, 94242, 118820, 102439, 106538, 98347, 118820, 118820, 118820, 40976, 18, 18, 36884, 0, 0, 0, 24, 24, 24, 27, 27, 27, 27, 90143, 0, 0, 86016, 0, 0, 2211840, 102439, 0, 0, 0, 98347, 0, 2158592, 2158592, 2158592, 2158592, 2158592, 3158016, 0, 2375680, 2379776, 2158592, 2158592, 2420736, 2158592, 2449408, 2158592, 2158592, 0, 94242, 0, 0, 0, 2211840, 102439, 0, 0, 106538, 98347, 135, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2564096, 2158592, 2158592, 2158592, 2158592, 2158592, 2596864, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2641920, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2781184, 2793472, 2494464, 2158592, 2158592, 2158592, 2523136, 2527232, 2158592, 2158592, 2576384, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 0, 40976, 0, 18, 18, 24, 0, 27, 27, 0, 2158592, 2498560, 2158592, 2158592, 0, 2158592, 2158592, 2568192, 2158592, 2592768, 2625536, 2158592, 2158592, 2674688, 0, 0, 0, 0, 0, 2211840, 0, 0, 0, 0, 0, 0, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2473984, 2158592, 2158592, 2494464, 2158592, 2158592, 2158592, 3006464, 2383872, 0, 0, 2158592, 2158592, 2158592, 2158592, 3006464, 2158592, 2637824, 2953216, 2158592, 2207744, 2637824, 2953216, 40976, 18, 36884, 45078, 24, 27, 147488, 94242, 147456, 147488, 106538, 98347, 0, 0, 147456, 40976, 18, 18, 36884, 0, 45078, 0, 24, 24, 24, 27, 27, 27, 27, 0, 81920, 0, 94242, 0, 0, 0, 2211840, 0, 0, 0, 106538, 98347, 0, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2428928, 2158592, 2514944, 2158592, 2588672, 2158592, 2838528, 2158592, 2158592, 40976, 18, 151573, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 0, 40976, 18, 18, 36884, 0, 45078, 0, 24, 24, 24, 27, 27, 27, 27, 90143, 0, 0, 1315, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1487, 97, 18, 131427, 0, 0, 0, 0, 0, 0, 362, 0, 0, 365, 29315, 367, 0, 0, 29315, 0, 0, 0, 0, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1663, 45, 45, 45, 45, 45, 45, 45, 45, 45, 183, 45, 45, 45, 45, 201, 45, 130, 94242, 0, 0, 0, 2211840, 102439, 0, 0, 106538, 98347, 0, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 3096576, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2207744, 2207744, 2158592, 18, 0, 0, 0, 0, 0, 0, 0, 2211840, 0, 0, 0, 0, 2158592, 644, 2207744, 2207744, 2207744, 3186688, 2207744, 0, 1080, 0, 1084, 0, 1088, 0, 0, 0, 0, 0, 0, 0, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2531466, 2158730, 2158730, 2158730, 2158730, 2158730, 2617482, 0, 94242, 0, 0, 0, 2211840, 102439, 0, 0, 106538, 98347, 0, 2158592, 2158592, 2158592, 2158592, 2158592, 2781184, 2793472, 2158592, 2818048, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 40976, 18, 36884, 45078, 24, 27, 90143, 159779, 159744, 102439, 159779, 98347, 0, 0, 159744, 40976, 18, 18, 36884, 0, 45078, 0, 2224253, 172032, 2224253, 2232448, 2232448, 172032, 2232448, 90143, 0, 0, 2170880, 0, 0, 550, 829, 2158592, 2158592, 2158592, 2387968, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 0, 40976, 0, 18, 18, 124, 124, 127, 127, 127, 40976, 18, 36884, 45078, 25, 29, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 163931, 40976, 18, 18, 36884, 0, 45078, 249856, 24, 24, 24, 27, 27, 27, 27, 90143, 0, 0, 2170880, 0, 0, 827, 0, 2158592, 2158592, 2158592, 2387968, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 0, 40976, 0, 4243810, 4243810, 24, 24, 27, 27, 27, 2207744, 0, 0, 0, 0, 0, 0, 2166784, 0, 0, 0, 0, 57344, 286, 2158592, 2158592, 2158592, 2158592, 2707456, 2732032, 2158592, 2158592, 2158592, 2822144, 2826240, 2158592, 2895872, 2158592, 2158592, 2924544, 2158592, 2158592, 2973696, 2158592, 2207744, 2207744, 2207744, 3186688, 2207744, 0, 0, 0, 0, 0, 0, 53248, 0, 0, 0, 0, 0, 97, 97, 97, 97, 97, 1613, 97, 97, 97, 97, 97, 97, 1495, 97, 97, 97, 97, 97, 97, 97, 97, 97, 566, 97, 97, 97, 97, 97, 97, 2207744, 0, 0, 0, 0, 0, 0, 2166784, 546, 0, 0, 0, 0, 286, 2158592, 2158592, 2158592, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 17, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 20480, 120, 121, 18, 18, 36884, 0, 45078, 0, 24, 24, 24, 27, 27, 27, 27, 90143, 0, 0, 2170880, 0, 53248, 550, 0, 2158592, 2158592, 2158592, 2387968, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 0, 40976, 196608, 18, 266240, 24, 24, 27, 27, 27, 0, 94242, 0, 0, 0, 38, 102439, 0, 0, 106538, 98347, 0, 45, 45, 45, 45, 45, 45, 45, 1535, 45, 45, 45, 45, 45, 45, 45, 1416, 45, 45, 45, 45, 45, 45, 45, 45, 424, 45, 45, 45, 45, 45, 45, 45, 45, 45, 405, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 199, 45, 45, 67, 67, 67, 67, 67, 491, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1766, 67, 67, 67, 1767, 67, 24850, 24850, 12564, 12564, 0, 0, 2166784, 546, 0, 53531, 53531, 0, 286, 97, 97, 0, 0, 97, 97, 97, 97, 97, 97, 0, 0, 97, 97, 0, 97, 97, 97, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 67, 67, 67, 67, 743, 57889, 0, 2170880, 0, 0, 550, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 45, 45, 45, 45, 45, 45, 45, 45, 1856, 45, 1858, 1859, 67, 67, 67, 1009, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1021, 67, 67, 67, 67, 67, 25398, 0, 13112, 0, 54074, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2367773, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2699549, 2158877, 2158877, 2158877, 2158877, 2158877, 2748701, 2756893, 2777373, 2801949, 97, 1115, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 857, 97, 67, 67, 67, 67, 67, 1258, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1826, 67, 97, 97, 97, 97, 97, 97, 1338, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 870, 97, 97, 67, 67, 67, 1463, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1579, 67, 67, 97, 97, 97, 1518, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 904, 905, 97, 97, 97, 97, 1620, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 0, 921, 0, 0, 0, 0, 0, 0, 45, 1679, 67, 67, 67, 1682, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1690, 67, 0, 0, 97, 97, 97, 97, 45, 45, 67, 67, 0, 0, 97, 97, 45, 45, 45, 669, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 189, 45, 45, 45, 1748, 45, 45, 45, 1749, 1750, 45, 45, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 1959, 67, 67, 67, 67, 1768, 67, 67, 67, 67, 67, 67, 67, 67, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1791, 97, 97, 97, 97, 97, 97, 97, 97, 45, 45, 45, 45, 45, 45, 1802, 67, 1817, 67, 67, 67, 67, 67, 67, 1823, 67, 67, 67, 67, 97, 97, 97, 97, 0, 0, 0, 97, 97, 97, 97, 0, 97, 97, 97, 97, 1848, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 659, 45, 45, 45, 45, 45, 45, 45, 1863, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 495, 67, 67, 67, 67, 67, 1878, 97, 97, 97, 97, 0, 0, 0, 97, 97, 97, 97, 0, 0, 97, 97, 97, 97, 97, 0, 0, 0, 97, 97, 97, 97, 97, 97, 45, 45, 45, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 97, 97, 97, 97, 0, 0, 0, 1973, 97, 97, 97, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1165, 97, 1167, 0, 94242, 0, 0, 0, 2211840, 102439, 0, 0, 106538, 98347, 136, 2158592, 2158592, 2158592, 2158592, 2158592, 3158016, 229376, 2375680, 2379776, 2158592, 2158592, 2420736, 2158592, 2449408, 2158592, 2158592, 67, 24850, 24850, 12564, 12564, 0, 0, 280, 547, 0, 53531, 53531, 0, 286, 97, 97, 0, 0, 97, 97, 97, 97, 97, 97, 0, 0, 97, 97, 1789, 97, 57889, 547, 547, 0, 0, 550, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 45, 45, 45, 1799, 45, 45, 45, 67, 67, 67, 67, 67, 25398, 0, 13112, 0, 54074, 0, 0, 1092, 0, 0, 0, 0, 0, 97, 97, 97, 97, 1612, 97, 97, 97, 97, 1616, 97, 1297, 1472, 0, 0, 0, 0, 1303, 1474, 0, 0, 0, 0, 1309, 1476, 0, 0, 0, 0, 97, 97, 97, 1481, 97, 97, 97, 97, 97, 97, 1488, 97, 0, 1474, 0, 1476, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 607, 97, 97, 97, 97, 40976, 18, 36884, 45078, 26, 30, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 213080, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 143448, 40976, 18, 18, 36884, 0, 45078, 0, 24, 24, 24, 27, 27, 27, 27, 0, 0, 0, 0, 97, 97, 97, 97, 1482, 97, 1483, 97, 97, 97, 97, 97, 97, 1326, 97, 97, 1329, 1330, 97, 97, 97, 97, 97, 97, 1159, 1160, 97, 97, 97, 97, 97, 97, 97, 97, 590, 97, 97, 97, 97, 97, 97, 97, 0, 94242, 0, 0, 0, 2211974, 102439, 0, 0, 106538, 98347, 0, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2474122, 2158730, 2158730, 2494602, 2158730, 2158730, 2158730, 2809994, 2158730, 2158730, 2842762, 2158730, 2158730, 2158730, 2900106, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 3014794, 2158730, 2158730, 3051658, 2158730, 2158730, 3100810, 2158730, 2158730, 2158730, 2158730, 3096714, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2207744, 2207744, 2207744, 2207744, 2207744, 2572288, 2207744, 2207744, 2207744, 2207744, 541, 541, 543, 543, 0, 0, 2166784, 0, 548, 549, 549, 0, 286, 2158877, 2158877, 2158877, 2863389, 2892061, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 3186973, 2158877, 0, 0, 0, 0, 0, 0, 0, 0, 2367626, 2158877, 2404637, 2412829, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2564381, 2158877, 2158877, 2605341, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2679069, 2158877, 2695453, 2158877, 2703645, 2158877, 2711837, 2752797, 2158877, 0, 2158877, 2158877, 2158877, 2384010, 2158730, 2158730, 2158730, 2158730, 3006602, 2383872, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2441216, 2445312, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2502656, 2158877, 2785565, 2158877, 2810141, 2158877, 2158877, 2842909, 2158877, 2158877, 2158877, 2900253, 2158877, 2158877, 2158877, 2158877, 2158877, 2531613, 2158877, 2158877, 2158877, 2158877, 2158877, 2617629, 2158877, 2158877, 2158877, 2158877, 2158730, 2818186, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 3105053, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 0, 0, 0, 0, 0, 97, 97, 97, 1611, 97, 97, 97, 97, 97, 97, 97, 1496, 97, 97, 1499, 97, 97, 97, 97, 97, 2441354, 2445450, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2502794, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2433162, 2158730, 2453642, 2461834, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2580618, 2158730, 2158730, 2158730, 2158730, 2621578, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2699402, 2158730, 2158730, 2158730, 2158730, 2678922, 2158730, 2695306, 2158730, 2703498, 2158730, 2711690, 2752650, 2158730, 2158730, 2785418, 2158730, 2158730, 2158730, 3113098, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 3186826, 2158730, 2207744, 2207744, 2207744, 2207744, 2699264, 2207744, 2207744, 2207744, 2207744, 2207744, 2748416, 2756608, 2777088, 2801664, 2207744, 2207744, 2158877, 2158877, 2158877, 2158877, 2158877, 0, 0, 0, 2158877, 2158877, 2158877, 2158877, 0, 0, 2535709, 2543901, 2158877, 2158877, 2158877, 0, 0, 0, 2158877, 2158877, 2158877, 2990365, 2158877, 2158877, 2158730, 2158730, 2158730, 2158730, 2158730, 2572426, 2158877, 2502941, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2580765, 2158877, 2158877, 2158877, 2158877, 2621725, 2158877, 3019037, 2158877, 3043613, 2158877, 2158877, 2158877, 2158877, 3080477, 2158877, 2158877, 3113245, 2158877, 2158877, 2158877, 2158877, 0, 2158877, 2908445, 2158877, 2158877, 2158877, 2978077, 2158877, 2158877, 2158877, 2158877, 3039517, 2158877, 2158730, 2510986, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2584714, 2158730, 2609290, 2158730, 2158730, 2629770, 2158730, 2158730, 2158730, 2388106, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2605194, 2158730, 2158730, 2158730, 2158730, 2687114, 2158730, 2715786, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2867338, 2158730, 2904202, 2158730, 2158730, 2158730, 2642058, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2781322, 2793610, 2158730, 3121290, 2158730, 2158730, 2158730, 3149962, 2158730, 2158730, 3170442, 3174538, 2158730, 2367488, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2580480, 2207744, 2207744, 2207744, 2207744, 2621440, 2207744, 2207744, 2158877, 2433309, 2158877, 2453789, 2461981, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2511133, 2158877, 2158877, 2158877, 2158877, 2584861, 2158877, 2609437, 2158877, 2158877, 2629917, 2158877, 2158877, 2158877, 2687261, 2158877, 2715933, 2158877, 2158730, 2158730, 2973834, 2158730, 2982026, 2158730, 2158730, 3002506, 2158730, 3047562, 3063946, 3076234, 2158730, 2158730, 2158730, 2158730, 2207744, 2506752, 2207744, 2207744, 2207744, 2207744, 2207744, 2158877, 2507037, 0, 0, 2158877, 2158730, 2158730, 2158730, 3203210, 2207744, 2207744, 2207744, 2207744, 2207744, 2424832, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 0, 823, 0, 825, 2707741, 2732317, 2158877, 2158877, 2158877, 2822429, 2826525, 2158877, 2896157, 2158877, 2158877, 2924829, 2158877, 2158877, 2973981, 2158877, 18, 0, 0, 0, 0, 0, 0, 0, 2211840, 0, 0, 642, 0, 2158592, 0, 45, 1529, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1755, 45, 67, 67, 2982173, 2158877, 2158877, 3002653, 2158877, 3047709, 3064093, 3076381, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 3203357, 2523274, 2527370, 2158730, 2158730, 2576522, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2908298, 2494749, 2158877, 2158877, 2158877, 2523421, 2527517, 2158877, 2158877, 2576669, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 0, 40976, 0, 18, 18, 4321280, 2224253, 2232448, 4329472, 2232448, 2158730, 2498698, 2158730, 2158730, 2158730, 2158730, 2568330, 2158730, 2592906, 2625674, 2158730, 2158730, 2674826, 2736266, 2158730, 2158730, 2158730, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2158730, 2912394, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 3109002, 2158730, 2158730, 3133578, 3145866, 3154058, 2375680, 2207744, 3108864, 2207744, 2207744, 3133440, 3145728, 3153920, 2375965, 2380061, 2158877, 2158877, 2421021, 2158877, 2449693, 2158877, 2158877, 2158877, 3117341, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 3104906, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158877, 2498845, 2158877, 2158877, 0, 2158877, 2158877, 2568477, 2158877, 2593053, 2625821, 2158877, 2158877, 2674973, 0, 0, 0, 0, 97, 97, 1480, 97, 97, 97, 97, 97, 1485, 97, 97, 97, 0, 97, 97, 1729, 97, 1731, 97, 97, 97, 97, 97, 97, 97, 311, 97, 97, 97, 97, 97, 97, 97, 97, 1520, 97, 97, 1523, 97, 97, 1526, 97, 2736413, 2158877, 2158877, 0, 2158877, 2912541, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 3109149, 2158877, 2158877, 3014941, 2158877, 2158877, 3051805, 2158877, 2158877, 3100957, 2158877, 2158877, 3121437, 2158877, 2158877, 2158877, 3150109, 3133725, 3146013, 3154205, 2158730, 2408586, 2416778, 2158730, 2465930, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 3018890, 2158730, 3043466, 2158730, 2158730, 2158730, 2158730, 3080330, 2633866, 2658442, 2740362, 2744458, 2834570, 2949258, 2158730, 2986122, 2158730, 2998410, 2158730, 2158730, 2158730, 3129482, 2207744, 2408448, 2949120, 2207744, 2985984, 2207744, 2998272, 2207744, 2207744, 2207744, 3129344, 2158877, 2408733, 2416925, 2158877, 2466077, 2158877, 2158877, 3170589, 3174685, 2158877, 0, 0, 0, 2158730, 2158730, 2158730, 2158730, 2158730, 2424970, 2158730, 2158730, 2158730, 2158730, 2707594, 2732170, 2158730, 2158730, 2158730, 2822282, 2826378, 2158730, 2896010, 2158730, 2158730, 2924682, 2949405, 2158877, 2986269, 2158877, 2998557, 2158877, 2158877, 2158877, 3129629, 2158730, 2158730, 2478218, 2158730, 2158730, 2158730, 2535562, 2543754, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 3117194, 2207744, 2207744, 2478080, 2207744, 2207744, 2207744, 2207744, 2781184, 2793472, 2207744, 2818048, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 0, 541, 0, 543, 2207744, 2535424, 2543616, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 3117056, 2158877, 2158877, 2478365, 0, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158730, 2158730, 2482314, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2207744, 2207744, 2207744, 2387968, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 0, 542, 0, 544, 2158730, 2158730, 2158730, 2990218, 2158730, 2158730, 2207744, 2207744, 2482176, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 0, 0, 0, 0, 0, 0, 2162688, 135, 0, 2207744, 2207744, 2990080, 2207744, 2207744, 2158877, 2158877, 2482461, 2158877, 2158877, 0, 0, 0, 2158877, 2158877, 2158877, 2158877, 2158877, 2158730, 2429066, 2158730, 2515082, 2158730, 2588810, 2158730, 2838666, 2158730, 2158730, 2158730, 3010698, 2207744, 2428928, 2207744, 2514944, 2207744, 2588672, 2207744, 2838528, 2207744, 2207744, 2207744, 3010560, 2158877, 2429213, 2158877, 2515229, 0, 0, 2158877, 2588957, 2158877, 0, 2838813, 2158877, 2158877, 2158877, 3010845, 2158730, 2506890, 2158730, 2158730, 2158730, 2748554, 2756746, 2777226, 2801802, 2158730, 2158730, 2158730, 2863242, 2891914, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2564234, 2158730, 2158730, 2158730, 2158730, 2158730, 2597002, 2158730, 2158730, 2158730, 3006464, 2384157, 0, 0, 2158877, 2158877, 2158877, 2158877, 3006749, 2158730, 2637962, 2953354, 2158730, 2207744, 2637824, 2953216, 2207744, 0, 0, 2158877, 2638109, 2953501, 2158877, 2539658, 2158730, 2539520, 2207744, 0, 0, 2539805, 2158877, 2158730, 2158730, 2158730, 2977930, 2158730, 2158730, 2158730, 2158730, 3039370, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 3158154, 2207744, 0, 2158877, 2158730, 2207744, 0, 2158877, 2158730, 2207744, 0, 2158877, 2965642, 2965504, 2965789, 0, 0, 0, 0, 1315, 0, 0, 0, 0, 97, 97, 97, 97, 97, 97, 97, 1484, 97, 97, 97, 97, 2158592, 18, 0, 122880, 0, 0, 0, 77824, 0, 2211840, 0, 0, 0, 0, 2158592, 0, 356, 0, 0, 0, 0, 0, 0, 28809, 0, 139, 45, 45, 45, 45, 45, 45, 1751, 45, 45, 45, 45, 45, 45, 45, 67, 67, 1427, 67, 67, 67, 67, 67, 1432, 67, 67, 67, 3104768, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 122880, 0, 0, 0, 0, 1315, 0, 0, 0, 0, 97, 97, 97, 97, 97, 97, 1322, 550, 0, 286, 0, 2158592, 2158592, 2158592, 2158592, 2158592, 2424832, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 0, 40976, 0, 18, 18, 24, 24, 4329472, 27, 27, 2207744, 2207744, 2977792, 2207744, 2207744, 2207744, 2207744, 3039232, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 3158016, 542, 0, 0, 0, 542, 0, 544, 0, 0, 0, 544, 0, 550, 0, 0, 0, 0, 0, 97, 97, 1610, 97, 97, 97, 97, 97, 97, 97, 97, 898, 97, 97, 97, 97, 97, 97, 97, 0, 94242, 0, 0, 0, 2211840, 0, 0, 0, 0, 0, 0, 2158592, 2158592, 2158592, 2158592, 2158592, 2424832, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 237568, 102439, 106538, 98347, 0, 0, 20480, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 192512, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 94, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 96, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 12378, 40976, 18, 18, 36884, 0, 45078, 0, 24, 24, 24, 126, 126, 126, 126, 90143, 0, 0, 2170880, 0, 0, 0, 0, 2158592, 2158592, 2158592, 2387968, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 20480, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 241664, 102439, 106538, 98347, 0, 0, 20568, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 200797, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 20480, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 0, 0, 44, 0, 0, 20575, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 41, 41, 41, 0, 0, 1126400, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 0, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 89, 40976, 18, 18, 36884, 0, 45078, 0, 24, 24, 24, 27, 131201, 27, 27, 90143, 0, 0, 2170880, 0, 0, 550, 0, 2158592, 2158592, 2158592, 2387968, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2441216, 2445312, 2158592, 2158592, 2158592, 2158592, 2158592, 0, 94242, 0, 0, 208896, 2211840, 102439, 0, 0, 106538, 98347, 0, 2158592, 2158592, 2158592, 2158592, 2158592, 3186688, 2158592, 0, 0, 0, 0, 0, 0, 0, 0, 2367488, 32768, 0, 0, 0, 0, 0, 0, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2433024, 2158592, 2453504, 2461696, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2510848, 2158592, 2158592, 2158592, 2158592, 40976, 18, 36884, 245783, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 20480, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 221184, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 180224, 40976, 18, 18, 36884, 155648, 45078, 0, 24, 24, 217088, 27, 27, 27, 217088, 90143, 0, 0, 2170880, 0, 0, 828, 0, 2158592, 2158592, 2158592, 2387968, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2207744, 2207744, 2207744, 2387968, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 0, 0, 0, 0, 0, 0, 2162688, 233472, 0, 0, 94242, 0, 0, 0, 38, 102439, 0, 0, 106538, 98347, 28809, 45, 45, 45, 45, 45, 718, 45, 45, 45, 45, 45, 45, 45, 45, 45, 727, 131427, 0, 0, 0, 0, 362, 0, 365, 28809, 367, 139, 45, 45, 45, 45, 45, 45, 1808, 45, 45, 45, 45, 67, 67, 67, 67, 67, 67, 67, 97, 97, 0, 0, 97, 67, 24850, 24850, 12564, 12564, 0, 57889, 0, 0, 0, 53531, 53531, 367, 286, 97, 97, 0, 0, 97, 97, 97, 97, 97, 97, 0, 1788, 97, 97, 0, 97, 2024, 97, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 67, 67, 67, 235, 67, 67, 67, 67, 67, 57889, 0, 0, 54074, 54074, 550, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 45, 1798, 45, 45, 1800, 45, 45, 0, 1472, 0, 0, 0, 0, 0, 1474, 0, 0, 0, 0, 0, 1476, 0, 0, 0, 0, 1315, 0, 0, 0, 0, 97, 97, 97, 97, 1320, 97, 97, 0, 0, 97, 97, 97, 97, 97, 97, 1787, 0, 97, 97, 0, 97, 97, 97, 45, 45, 45, 45, 2029, 45, 67, 67, 67, 67, 2033, 1527, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 663, 67, 24850, 24850, 12564, 12564, 0, 57889, 281, 0, 0, 53531, 53531, 367, 286, 97, 97, 0, 0, 97, 97, 97, 97, 1786, 97, 0, 0, 97, 97, 0, 1790, 40976, 19, 36884, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 262144, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 46, 67, 98, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 45, 67, 97, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 258048, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 1122423, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 1114152, 1114152, 1114152, 0, 0, 1114112, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 37, 102439, 106538, 98347, 0, 0, 204800, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 57436, 40976, 18, 36884, 45078, 24, 27, 33, 33, 0, 33, 33, 33, 0, 0, 0, 40976, 18, 18, 36884, 0, 45078, 0, 124, 124, 124, 127, 127, 127, 127, 90143, 0, 0, 2170880, 0, 0, 550, 0, 2158877, 2158877, 2158877, 2388253, 2158877, 2158877, 2158877, 2158877, 2158877, 2781469, 2793757, 2158877, 2818333, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2867485, 2158877, 2904349, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 3096861, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2441501, 2445597, 2158877, 2158877, 2158877, 2158877, 2158877, 40976, 122, 123, 36884, 0, 45078, 0, 24, 24, 24, 27, 27, 27, 27, 90143, 0, 921, 29315, 0, 0, 0, 0, 45, 45, 45, 45, 45, 45, 45, 45, 936, 2158592, 4243810, 0, 0, 0, 0, 0, 0, 0, 2211840, 0, 0, 0, 0, 2158592, 0, 921, 29315, 0, 0, 0, 0, 45, 45, 45, 45, 45, 45, 45, 935, 45, 45, 45, 715, 45, 45, 45, 45, 45, 45, 45, 723, 45, 45, 45, 45, 45, 1182, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 430, 45, 45, 45, 45, 45, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 47, 68, 99, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 48, 69, 100, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 49, 70, 101, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 50, 71, 102, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 51, 72, 103, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 52, 73, 104, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 53, 74, 105, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 54, 75, 106, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 55, 76, 107, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 56, 77, 108, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 57, 78, 109, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 58, 79, 110, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 59, 80, 111, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 60, 81, 112, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 61, 82, 113, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 62, 83, 114, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 63, 84, 115, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 64, 85, 116, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 65, 86, 117, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 66, 87, 118, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 118820, 102439, 106538, 98347, 118820, 118820, 118820, 40976, 18, 18, 0, 0, 45078, 0, 24, 24, 24, 27, 27, 27, 27, 90143, 0, 0, 1314, 0, 0, 0, 0, 0, 0, 97, 97, 97, 97, 97, 1321, 97, 18, 131427, 0, 0, 0, 0, 0, 0, 362, 0, 0, 365, 0, 367, 0, 0, 1315, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1360, 97, 97, 131, 94242, 0, 0, 0, 38, 102439, 0, 0, 106538, 98347, 28809, 45, 45, 45, 145, 149, 45, 45, 45, 45, 45, 174, 45, 179, 45, 185, 45, 188, 45, 45, 202, 67, 255, 67, 67, 269, 67, 67, 0, 24850, 12564, 0, 0, 0, 0, 28809, 53531, 97, 97, 97, 292, 296, 97, 97, 97, 97, 97, 321, 97, 326, 97, 332, 97, 18, 131427, 0, 0, 0, 0, 0, 0, 362, 0, 0, 365, 29315, 367, 646, 335, 97, 97, 349, 97, 97, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 437, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 67, 67, 67, 523, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 511, 67, 67, 67, 97, 97, 97, 620, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1501, 1502, 97, 793, 67, 67, 796, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 808, 67, 0, 0, 97, 97, 97, 97, 45, 45, 67, 67, 0, 0, 97, 97, 2052, 67, 67, 67, 67, 813, 67, 67, 67, 67, 67, 67, 67, 25398, 542, 13112, 544, 57889, 0, 0, 54074, 54074, 550, 830, 97, 97, 97, 97, 97, 97, 97, 97, 97, 315, 97, 97, 97, 97, 97, 97, 841, 97, 97, 97, 97, 97, 97, 97, 97, 97, 854, 97, 97, 97, 97, 97, 97, 589, 97, 97, 97, 97, 97, 97, 97, 97, 97, 867, 97, 97, 97, 97, 97, 97, 97, 891, 97, 97, 894, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 906, 45, 937, 45, 45, 940, 45, 45, 45, 45, 45, 45, 948, 45, 45, 45, 45, 45, 734, 735, 67, 737, 67, 738, 67, 740, 67, 67, 67, 45, 967, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 435, 45, 45, 45, 980, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 415, 45, 45, 67, 67, 1024, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 97, 97, 97, 67, 67, 67, 67, 67, 25398, 1081, 13112, 1085, 54074, 1089, 0, 0, 0, 0, 0, 0, 363, 0, 28809, 0, 139, 45, 45, 45, 45, 45, 45, 1674, 45, 45, 45, 45, 45, 45, 45, 45, 67, 1913, 67, 1914, 67, 67, 67, 1918, 67, 67, 97, 97, 97, 97, 1118, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 630, 97, 97, 97, 97, 97, 1169, 97, 97, 97, 97, 97, 0, 921, 0, 1175, 0, 0, 0, 0, 45, 45, 45, 45, 45, 45, 1534, 45, 45, 45, 45, 45, 1538, 45, 45, 45, 45, 1233, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 67, 67, 67, 742, 67, 45, 45, 1191, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 454, 67, 67, 67, 67, 1243, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1251, 67, 0, 0, 97, 97, 97, 97, 45, 45, 67, 67, 2050, 0, 97, 97, 45, 45, 45, 732, 45, 45, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 97, 97, 67, 67, 67, 1284, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 772, 67, 67, 67, 1293, 67, 67, 67, 67, 67, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 368, 2158592, 2158592, 2158592, 2404352, 2412544, 1323, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1331, 97, 97, 97, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1737, 97, 1364, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1373, 97, 18, 131427, 0, 0, 0, 0, 0, 0, 362, 0, 0, 365, 29315, 367, 647, 45, 45, 1387, 45, 45, 1391, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 410, 45, 45, 45, 45, 45, 1400, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1407, 45, 45, 45, 45, 45, 941, 45, 943, 45, 45, 45, 45, 45, 45, 951, 45, 67, 1438, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1447, 67, 67, 67, 67, 67, 67, 799, 67, 67, 67, 804, 67, 67, 67, 67, 67, 67, 67, 1443, 67, 67, 1446, 67, 67, 67, 67, 67, 67, 67, 1298, 0, 0, 0, 1304, 0, 0, 0, 1310, 97, 1491, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1500, 97, 97, 97, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1736, 97, 45, 45, 1541, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 677, 45, 45, 67, 1581, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 791, 792, 67, 67, 67, 67, 1598, 67, 1600, 67, 67, 67, 67, 67, 67, 67, 67, 1472, 97, 97, 97, 1727, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1513, 97, 97, 67, 67, 97, 1879, 97, 1881, 97, 0, 1884, 0, 97, 97, 97, 97, 0, 0, 97, 97, 97, 97, 97, 0, 0, 0, 1842, 97, 97, 67, 67, 67, 67, 67, 97, 97, 97, 97, 1928, 0, 0, 0, 97, 97, 97, 97, 97, 97, 45, 45, 45, 45, 45, 1903, 45, 45, 45, 67, 67, 67, 67, 97, 97, 97, 97, 1971, 0, 0, 97, 97, 97, 97, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 0, 0, 0, 45, 45, 45, 1381, 45, 45, 45, 45, 1976, 97, 97, 97, 97, 97, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1747, 809, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 25398, 542, 13112, 544, 97, 907, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 638, 0, 0, 0, 0, 1478, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1150, 97, 97, 97, 97, 67, 67, 67, 67, 1244, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 477, 67, 67, 67, 67, 67, 67, 1294, 67, 67, 67, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1324, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 0, 0, 0, 1374, 97, 97, 97, 97, 0, 1175, 0, 45, 45, 45, 45, 45, 45, 45, 45, 945, 45, 45, 45, 45, 45, 45, 45, 45, 1908, 45, 45, 1910, 45, 67, 67, 67, 67, 67, 67, 67, 67, 1919, 67, 0, 0, 97, 97, 97, 97, 45, 2048, 67, 2049, 0, 0, 97, 2051, 45, 45, 45, 939, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 397, 45, 45, 45, 1921, 67, 67, 1923, 67, 97, 97, 97, 97, 97, 0, 0, 0, 97, 97, 97, 97, 97, 97, 45, 45, 45, 45, 1947, 45, 1935, 0, 0, 0, 97, 1939, 97, 97, 1941, 97, 45, 45, 45, 45, 45, 45, 382, 389, 45, 45, 45, 45, 45, 45, 45, 45, 1810, 45, 45, 1812, 67, 67, 67, 67, 67, 256, 67, 67, 67, 67, 67, 0, 24850, 12564, 0, 0, 0, 0, 28809, 53531, 336, 97, 97, 97, 97, 97, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 131427, 0, 0, 0, 0, 362, 0, 365, 28809, 367, 139, 45, 45, 371, 373, 45, 45, 45, 955, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 413, 45, 45, 45, 457, 459, 67, 67, 67, 67, 67, 67, 67, 67, 473, 67, 478, 67, 67, 482, 67, 67, 485, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 97, 1828, 97, 554, 556, 97, 97, 97, 97, 97, 97, 97, 97, 570, 97, 575, 97, 97, 579, 97, 97, 582, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 330, 97, 97, 67, 746, 67, 67, 67, 67, 67, 67, 67, 67, 67, 758, 67, 67, 67, 67, 67, 67, 67, 1587, 67, 1589, 67, 67, 67, 67, 67, 67, 67, 97, 1706, 97, 97, 97, 1709, 97, 97, 97, 97, 97, 844, 97, 97, 97, 97, 97, 97, 97, 97, 97, 856, 97, 97, 97, 0, 97, 97, 97, 97, 97, 97, 97, 97, 1735, 97, 97, 97, 0, 97, 97, 97, 97, 97, 97, 97, 1642, 97, 1644, 97, 97, 890, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 0, 67, 67, 67, 67, 1065, 1066, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 532, 67, 67, 67, 67, 67, 67, 67, 1451, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 496, 67, 67, 97, 97, 1505, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 593, 97, 97, 0, 1474, 0, 1476, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1617, 97, 97, 1635, 0, 1637, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 885, 97, 97, 97, 97, 67, 67, 1704, 67, 67, 67, 67, 97, 97, 97, 97, 97, 97, 97, 97, 97, 565, 572, 97, 97, 97, 97, 97, 97, 97, 97, 1832, 0, 97, 97, 97, 97, 97, 0, 0, 0, 97, 97, 97, 97, 97, 97, 45, 45, 45, 1946, 45, 45, 67, 67, 67, 67, 67, 97, 1926, 97, 1927, 97, 0, 0, 0, 97, 97, 1934, 2043, 0, 0, 97, 97, 97, 2047, 45, 45, 67, 67, 0, 1832, 97, 97, 45, 45, 45, 981, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1227, 45, 45, 45, 131427, 0, 0, 0, 0, 362, 0, 365, 28809, 367, 139, 45, 45, 372, 45, 45, 45, 45, 1661, 1662, 45, 45, 45, 45, 45, 1666, 45, 45, 45, 45, 45, 1673, 45, 1675, 45, 45, 45, 45, 45, 45, 45, 67, 1426, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1275, 67, 67, 67, 67, 67, 45, 418, 45, 45, 420, 45, 45, 423, 45, 45, 45, 45, 45, 45, 45, 45, 959, 45, 45, 962, 45, 45, 45, 45, 458, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 483, 67, 67, 67, 67, 504, 67, 67, 506, 67, 67, 509, 67, 67, 67, 67, 67, 67, 67, 753, 67, 67, 67, 67, 67, 67, 67, 67, 467, 67, 67, 67, 67, 67, 67, 67, 555, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 580, 97, 97, 97, 97, 601, 97, 97, 603, 97, 97, 606, 97, 97, 97, 97, 97, 97, 848, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1498, 97, 97, 97, 97, 97, 97, 45, 45, 714, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 989, 990, 45, 67, 67, 67, 67, 67, 1011, 67, 67, 67, 67, 1015, 67, 67, 67, 67, 67, 67, 67, 768, 67, 67, 67, 67, 67, 67, 67, 67, 769, 67, 67, 67, 67, 67, 67, 67, 45, 45, 1179, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1003, 1004, 67, 1217, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 728, 67, 1461, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1034, 67, 97, 1516, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 871, 97, 67, 67, 67, 1705, 67, 67, 67, 97, 97, 97, 97, 97, 97, 97, 97, 97, 567, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1715, 97, 97, 97, 97, 97, 97, 97, 97, 97, 0, 0, 0, 45, 45, 1380, 45, 45, 45, 45, 45, 67, 67, 97, 97, 97, 97, 97, 0, 0, 0, 97, 1887, 97, 97, 0, 0, 97, 97, 97, 0, 97, 97, 97, 97, 97, 2006, 45, 45, 1907, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1920, 67, 97, 0, 2035, 97, 97, 97, 97, 97, 45, 45, 45, 45, 67, 67, 67, 1428, 67, 67, 67, 67, 67, 67, 1435, 67, 0, 94242, 0, 0, 0, 38, 102439, 0, 0, 106538, 98347, 28809, 45, 45, 45, 146, 45, 152, 45, 45, 165, 45, 175, 45, 180, 45, 45, 187, 190, 195, 45, 203, 254, 257, 262, 67, 270, 67, 67, 0, 24850, 12564, 0, 0, 0, 281, 28809, 53531, 97, 97, 97, 293, 97, 299, 97, 97, 312, 97, 322, 97, 327, 97, 97, 334, 337, 342, 97, 350, 97, 97, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 67, 484, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 499, 97, 581, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 596, 648, 45, 650, 45, 651, 45, 653, 45, 45, 45, 657, 45, 45, 45, 45, 45, 45, 1954, 67, 67, 67, 1958, 67, 67, 67, 67, 67, 67, 67, 783, 67, 67, 67, 788, 67, 67, 67, 67, 680, 45, 45, 45, 45, 45, 45, 45, 45, 688, 689, 691, 45, 45, 45, 45, 45, 983, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 947, 45, 45, 45, 45, 952, 45, 45, 698, 699, 45, 45, 702, 703, 45, 45, 45, 45, 45, 45, 45, 711, 744, 67, 67, 67, 67, 67, 67, 67, 67, 67, 757, 67, 67, 67, 67, 761, 67, 67, 67, 67, 765, 67, 767, 67, 67, 67, 67, 67, 67, 67, 67, 775, 776, 778, 67, 67, 67, 67, 67, 67, 785, 786, 67, 67, 789, 790, 67, 67, 67, 67, 67, 67, 1574, 67, 67, 67, 67, 67, 1578, 67, 67, 67, 67, 67, 67, 1012, 67, 67, 67, 67, 67, 67, 67, 67, 67, 468, 475, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 798, 67, 67, 67, 802, 67, 67, 67, 67, 67, 67, 67, 67, 1588, 67, 67, 67, 67, 67, 67, 67, 0, 24850, 12564, 0, 0, 0, 0, 28809, 53531, 67, 810, 67, 67, 67, 67, 67, 67, 67, 67, 67, 821, 25398, 542, 13112, 544, 57889, 0, 0, 54074, 54074, 550, 0, 833, 97, 835, 97, 836, 97, 838, 97, 97, 0, 0, 97, 97, 97, 1785, 97, 97, 0, 0, 97, 97, 0, 97, 97, 1979, 97, 97, 45, 45, 1983, 45, 1984, 45, 45, 45, 45, 45, 652, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 690, 45, 45, 694, 45, 45, 97, 842, 97, 97, 97, 97, 97, 97, 97, 97, 97, 855, 97, 97, 97, 97, 0, 1717, 1718, 97, 97, 97, 97, 97, 1722, 97, 0, 0, 859, 97, 97, 97, 97, 863, 97, 865, 97, 97, 97, 97, 97, 97, 97, 97, 604, 97, 97, 97, 97, 97, 97, 97, 873, 874, 876, 97, 97, 97, 97, 97, 97, 883, 884, 97, 97, 887, 888, 97, 18, 131427, 0, 0, 0, 0, 0, 0, 362, 225280, 0, 365, 0, 367, 0, 45, 45, 45, 1531, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1199, 45, 45, 45, 45, 45, 97, 97, 908, 97, 97, 97, 97, 97, 97, 97, 97, 97, 919, 638, 0, 0, 0, 0, 2158877, 2158877, 2158877, 2158877, 2158877, 2425117, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2597149, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2642205, 2158877, 2158877, 2158877, 2158877, 2158877, 3158301, 0, 2375818, 2379914, 2158730, 2158730, 2420874, 2158730, 2449546, 2158730, 2158730, 953, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 965, 978, 45, 45, 45, 45, 45, 45, 985, 45, 45, 45, 45, 45, 45, 45, 45, 971, 45, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 1027, 67, 1029, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1455, 67, 67, 67, 67, 67, 67, 67, 1077, 1078, 67, 67, 25398, 0, 13112, 0, 54074, 0, 0, 0, 0, 0, 0, 0, 0, 366, 0, 139, 2158730, 2158730, 2158730, 2404490, 2412682, 1113, 97, 97, 97, 97, 97, 97, 1121, 97, 1123, 97, 97, 97, 97, 97, 97, 0, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1540, 1155, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 615, 1168, 97, 97, 1171, 1172, 97, 97, 0, 921, 0, 1175, 0, 0, 0, 0, 45, 45, 45, 45, 45, 1533, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1559, 1561, 45, 45, 45, 1564, 45, 1566, 1567, 45, 45, 45, 1219, 45, 45, 45, 45, 45, 45, 45, 1226, 45, 45, 45, 45, 45, 168, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 427, 45, 45, 45, 45, 45, 45, 45, 1231, 45, 45, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1242, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1046, 67, 67, 1254, 67, 1256, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 806, 807, 67, 67, 97, 1336, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1111, 97, 97, 97, 97, 97, 1351, 97, 97, 97, 1354, 97, 97, 97, 1359, 97, 97, 97, 0, 97, 97, 97, 97, 1640, 97, 97, 97, 97, 97, 97, 97, 897, 97, 97, 97, 902, 97, 97, 97, 97, 97, 97, 97, 97, 1366, 97, 97, 97, 97, 97, 97, 97, 1371, 97, 97, 97, 0, 97, 97, 97, 1730, 97, 97, 97, 97, 97, 97, 97, 97, 915, 97, 97, 97, 97, 0, 360, 0, 67, 67, 67, 1440, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1017, 67, 1019, 67, 67, 67, 67, 67, 1453, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1459, 97, 97, 97, 1493, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1525, 97, 97, 97, 97, 97, 97, 1507, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1514, 67, 67, 67, 67, 1584, 67, 67, 67, 67, 67, 1590, 67, 67, 67, 67, 67, 67, 67, 784, 67, 67, 67, 67, 67, 67, 67, 67, 1055, 67, 67, 67, 67, 1060, 67, 67, 67, 67, 67, 67, 67, 1599, 1601, 67, 67, 67, 1604, 67, 1606, 1607, 67, 1472, 0, 1474, 0, 1476, 0, 97, 97, 97, 97, 97, 97, 1614, 97, 97, 97, 97, 45, 45, 1850, 45, 45, 45, 45, 1855, 45, 45, 45, 45, 45, 1222, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1229, 97, 1618, 97, 97, 97, 97, 97, 97, 97, 1625, 97, 97, 97, 97, 97, 0, 1175, 0, 45, 45, 45, 45, 45, 45, 45, 45, 447, 45, 45, 45, 45, 45, 67, 67, 1633, 97, 97, 0, 97, 97, 97, 97, 97, 97, 97, 97, 1643, 1645, 97, 97, 0, 0, 97, 97, 97, 2002, 97, 97, 97, 97, 97, 45, 45, 45, 45, 45, 1740, 45, 45, 45, 1744, 45, 45, 45, 97, 1648, 97, 1650, 1651, 97, 0, 45, 45, 45, 1654, 45, 45, 45, 45, 45, 169, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 658, 45, 45, 45, 45, 664, 45, 45, 1659, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1187, 45, 45, 1669, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 67, 1005, 67, 67, 1681, 67, 67, 67, 67, 67, 67, 67, 1686, 67, 67, 67, 67, 67, 67, 67, 800, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1603, 67, 67, 67, 67, 67, 0, 97, 97, 1713, 97, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 0, 0, 0, 1378, 45, 45, 45, 45, 45, 45, 45, 408, 45, 45, 45, 45, 45, 45, 45, 45, 1547, 45, 1549, 45, 45, 45, 45, 45, 97, 97, 1780, 0, 97, 97, 97, 97, 97, 97, 0, 0, 97, 97, 0, 97, 97, 97, 45, 45, 2027, 2028, 45, 45, 67, 67, 2031, 2032, 67, 45, 45, 1804, 45, 45, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 67, 1917, 67, 67, 67, 67, 67, 67, 67, 1819, 67, 67, 67, 67, 67, 67, 67, 67, 97, 97, 97, 1708, 97, 97, 97, 97, 97, 45, 45, 1862, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 497, 67, 67, 67, 1877, 97, 97, 97, 97, 97, 0, 0, 0, 97, 97, 97, 97, 0, 0, 97, 97, 97, 97, 97, 1839, 0, 0, 97, 97, 97, 97, 1936, 0, 0, 97, 97, 97, 97, 97, 97, 1943, 1944, 1945, 45, 45, 45, 45, 670, 45, 45, 45, 45, 674, 45, 45, 45, 45, 678, 45, 1948, 45, 1950, 45, 45, 45, 45, 1955, 1956, 1957, 67, 67, 67, 1960, 67, 1962, 67, 67, 67, 67, 1967, 1968, 1969, 97, 0, 0, 0, 97, 97, 1974, 97, 0, 1936, 0, 97, 97, 97, 97, 97, 97, 45, 45, 45, 45, 45, 45, 45, 45, 1906, 0, 1977, 97, 97, 97, 97, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1746, 45, 45, 45, 45, 2011, 67, 67, 2013, 67, 67, 67, 2017, 97, 97, 0, 0, 2021, 97, 8192, 97, 97, 2025, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 1916, 67, 67, 67, 67, 0, 94242, 0, 0, 0, 38, 102439, 0, 0, 106538, 98347, 28809, 45, 45, 140, 45, 45, 45, 1180, 45, 45, 45, 45, 1184, 45, 45, 45, 45, 45, 45, 45, 387, 45, 392, 45, 45, 396, 45, 45, 399, 45, 45, 67, 207, 67, 67, 67, 67, 67, 67, 236, 67, 67, 67, 67, 67, 67, 67, 817, 67, 67, 67, 67, 25398, 542, 13112, 544, 97, 97, 287, 97, 97, 97, 97, 97, 97, 316, 97, 97, 97, 97, 97, 97, 0, 45, 45, 45, 45, 45, 45, 45, 1656, 1657, 45, 376, 45, 45, 45, 45, 45, 388, 45, 45, 45, 45, 45, 45, 45, 45, 1406, 45, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 462, 67, 67, 67, 67, 67, 474, 67, 67, 67, 67, 67, 67, 67, 1245, 67, 67, 67, 67, 67, 67, 67, 67, 1013, 67, 67, 1016, 67, 67, 67, 67, 97, 97, 97, 97, 559, 97, 97, 97, 97, 97, 571, 97, 97, 97, 97, 97, 97, 896, 97, 97, 97, 900, 97, 97, 97, 97, 97, 97, 912, 914, 97, 97, 97, 97, 97, 0, 0, 0, 45, 45, 45, 45, 45, 45, 45, 45, 391, 45, 45, 45, 45, 45, 45, 45, 45, 713, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 662, 45, 1140, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 636, 67, 67, 1283, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 513, 67, 67, 1363, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 889, 97, 97, 97, 1714, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 0, 0, 926, 45, 45, 45, 45, 45, 45, 45, 45, 672, 45, 45, 45, 45, 45, 45, 45, 45, 686, 45, 45, 45, 45, 45, 45, 45, 45, 944, 45, 45, 45, 45, 45, 45, 45, 45, 1676, 45, 45, 45, 45, 45, 45, 67, 97, 97, 97, 1833, 0, 97, 97, 97, 97, 97, 0, 0, 0, 97, 97, 97, 97, 97, 97, 45, 45, 45, 45, 1902, 45, 45, 45, 45, 45, 957, 45, 45, 45, 45, 961, 45, 963, 45, 45, 45, 67, 97, 2034, 0, 97, 97, 97, 97, 97, 2040, 45, 45, 45, 2042, 67, 67, 67, 67, 67, 67, 1586, 67, 67, 67, 67, 67, 67, 67, 67, 67, 469, 67, 67, 67, 67, 67, 67, 132, 94242, 0, 0, 0, 38, 102439, 0, 0, 106538, 98347, 28809, 45, 45, 45, 45, 45, 1414, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 428, 45, 45, 45, 45, 45, 57889, 0, 0, 54074, 54074, 550, 831, 97, 97, 97, 97, 97, 97, 97, 97, 97, 568, 97, 97, 97, 97, 578, 97, 45, 45, 968, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1228, 45, 45, 67, 67, 67, 67, 67, 25398, 1082, 13112, 1086, 54074, 1090, 0, 0, 0, 0, 0, 0, 364, 0, 0, 0, 139, 2158592, 2158592, 2158592, 2404352, 2412544, 67, 67, 67, 67, 1464, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 510, 67, 67, 67, 67, 97, 97, 97, 97, 1519, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 918, 97, 0, 0, 0, 0, 1528, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 976, 45, 1554, 45, 45, 45, 45, 45, 45, 45, 45, 1562, 45, 45, 1565, 45, 45, 45, 45, 683, 45, 45, 45, 687, 45, 45, 692, 45, 45, 45, 45, 45, 1953, 45, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1014, 67, 67, 67, 67, 67, 67, 1568, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 0, 67, 67, 67, 67, 67, 1585, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1594, 97, 97, 1649, 97, 97, 97, 0, 45, 45, 1653, 45, 45, 45, 45, 45, 45, 383, 45, 45, 45, 45, 45, 45, 45, 45, 45, 986, 45, 45, 45, 45, 45, 45, 45, 45, 1670, 45, 1672, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 67, 736, 67, 67, 67, 67, 67, 741, 67, 67, 67, 1680, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1074, 67, 67, 67, 1692, 67, 67, 67, 67, 67, 67, 67, 1697, 67, 1699, 67, 67, 67, 67, 67, 67, 1041, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1044, 67, 67, 67, 67, 67, 67, 67, 1769, 67, 67, 67, 67, 67, 67, 67, 97, 97, 97, 97, 97, 97, 97, 624, 97, 97, 97, 97, 97, 97, 634, 97, 97, 1792, 97, 97, 97, 97, 97, 97, 97, 45, 45, 45, 45, 45, 45, 45, 958, 45, 45, 45, 45, 45, 45, 964, 45, 150, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 977, 204, 45, 67, 67, 67, 217, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 787, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 271, 67, 0, 24850, 12564, 0, 0, 0, 0, 28809, 53531, 97, 97, 97, 97, 297, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1108, 97, 97, 97, 97, 97, 97, 97, 97, 351, 97, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 45, 45, 938, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1398, 45, 45, 45, 153, 45, 161, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 660, 661, 45, 45, 205, 45, 67, 67, 67, 67, 220, 67, 228, 67, 67, 67, 67, 67, 67, 67, 0, 0, 0, 1302, 0, 0, 0, 1308, 0, 67, 67, 67, 67, 67, 272, 67, 0, 24850, 12564, 0, 0, 0, 0, 28809, 53531, 97, 97, 97, 97, 352, 97, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 45, 439, 45, 45, 45, 45, 45, 445, 45, 45, 45, 452, 45, 45, 67, 67, 212, 216, 67, 67, 67, 67, 67, 241, 67, 246, 67, 252, 67, 67, 486, 67, 67, 67, 67, 67, 67, 67, 494, 67, 67, 67, 67, 67, 67, 67, 1272, 67, 67, 67, 67, 67, 67, 67, 67, 507, 67, 67, 67, 67, 67, 67, 67, 67, 521, 67, 67, 525, 67, 67, 67, 67, 67, 531, 67, 67, 67, 538, 67, 0, 0, 2046, 97, 97, 97, 45, 45, 67, 67, 0, 0, 97, 97, 45, 45, 45, 1192, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1418, 45, 45, 1421, 97, 97, 583, 97, 97, 97, 97, 97, 97, 97, 591, 97, 97, 97, 97, 97, 97, 913, 97, 97, 97, 97, 97, 97, 0, 0, 0, 45, 45, 45, 45, 45, 45, 45, 1384, 97, 618, 97, 97, 622, 97, 97, 97, 97, 97, 628, 97, 97, 97, 635, 97, 18, 131427, 0, 0, 0, 639, 0, 132, 362, 0, 0, 365, 29315, 367, 0, 921, 29315, 0, 0, 0, 0, 45, 45, 45, 45, 932, 45, 45, 45, 45, 45, 1544, 45, 45, 45, 45, 45, 1550, 45, 45, 45, 45, 45, 1194, 45, 1196, 45, 45, 45, 45, 45, 45, 45, 45, 999, 45, 45, 45, 45, 45, 67, 67, 45, 45, 667, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1408, 45, 45, 45, 696, 45, 45, 45, 701, 45, 45, 45, 45, 45, 45, 45, 45, 710, 45, 45, 45, 1220, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 194, 45, 45, 45, 729, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 797, 67, 67, 67, 67, 67, 67, 805, 67, 67, 67, 67, 67, 67, 67, 1695, 67, 67, 67, 67, 67, 1700, 67, 1702, 67, 67, 67, 67, 67, 814, 816, 67, 67, 67, 67, 67, 25398, 542, 13112, 544, 67, 67, 1008, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1020, 67, 0, 97, 45, 67, 0, 97, 45, 67, 0, 97, 45, 67, 97, 0, 0, 97, 97, 97, 97, 97, 45, 45, 45, 45, 67, 67, 67, 67, 1429, 67, 1430, 67, 67, 67, 67, 67, 1062, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 518, 1076, 67, 67, 67, 67, 25398, 0, 13112, 0, 54074, 0, 0, 0, 0, 0, 0, 0, 0, 28809, 0, 139, 45, 45, 45, 45, 45, 97, 97, 97, 97, 1102, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1124, 97, 1126, 97, 97, 1114, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1112, 97, 97, 1156, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 594, 97, 97, 97, 97, 1170, 97, 97, 97, 97, 0, 921, 0, 0, 0, 0, 0, 0, 45, 45, 45, 45, 1532, 45, 45, 45, 45, 1536, 45, 45, 45, 45, 45, 172, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 706, 45, 45, 709, 45, 45, 1177, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1202, 45, 1204, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1215, 45, 45, 45, 1232, 45, 45, 45, 45, 45, 45, 45, 67, 1237, 67, 67, 67, 67, 67, 67, 1259, 67, 67, 67, 67, 67, 67, 1264, 67, 67, 67, 1282, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1289, 67, 67, 67, 1292, 97, 97, 97, 97, 1339, 97, 97, 97, 97, 97, 97, 1344, 97, 97, 97, 97, 45, 1849, 45, 1851, 45, 45, 45, 45, 45, 45, 45, 45, 721, 45, 45, 45, 45, 45, 726, 45, 1385, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1188, 45, 45, 1401, 1402, 45, 45, 45, 45, 1405, 45, 45, 45, 45, 45, 45, 45, 45, 1752, 45, 45, 45, 45, 45, 67, 67, 1410, 45, 45, 45, 1413, 45, 1415, 45, 45, 45, 45, 45, 45, 1419, 45, 45, 45, 45, 1806, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 67, 67, 97, 97, 2019, 0, 97, 67, 67, 67, 1452, 67, 67, 67, 67, 67, 67, 67, 67, 1457, 67, 67, 67, 67, 67, 67, 1271, 67, 67, 67, 1274, 67, 67, 67, 1279, 67, 1460, 67, 1462, 67, 67, 67, 67, 67, 67, 1466, 67, 67, 67, 67, 67, 67, 67, 67, 1602, 67, 67, 1605, 67, 67, 67, 0, 97, 97, 97, 1506, 97, 97, 97, 97, 97, 97, 97, 97, 1512, 97, 97, 97, 0, 1728, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 901, 97, 97, 97, 97, 1515, 97, 1517, 97, 97, 97, 97, 97, 97, 1521, 97, 97, 97, 97, 97, 97, 0, 45, 1652, 45, 45, 45, 1655, 45, 45, 45, 45, 45, 1542, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1552, 1553, 45, 45, 45, 1556, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 693, 45, 45, 45, 67, 67, 67, 67, 1572, 67, 67, 67, 67, 1576, 67, 67, 67, 67, 67, 67, 67, 67, 1685, 67, 67, 67, 67, 67, 67, 67, 67, 1465, 67, 67, 1468, 67, 67, 1471, 67, 67, 1582, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1580, 67, 67, 1596, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 0, 542, 0, 544, 67, 67, 67, 67, 1759, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 533, 67, 67, 67, 67, 67, 67, 67, 1770, 67, 67, 67, 67, 67, 97, 97, 97, 97, 97, 97, 1777, 97, 97, 97, 1793, 97, 97, 97, 97, 97, 45, 45, 45, 45, 45, 45, 45, 998, 45, 45, 1001, 1002, 45, 45, 67, 67, 45, 1861, 45, 67, 67, 67, 67, 67, 67, 67, 67, 1871, 67, 1873, 1874, 67, 0, 97, 45, 67, 0, 97, 45, 67, 16384, 97, 45, 67, 97, 0, 0, 0, 1473, 0, 1082, 0, 0, 0, 1475, 0, 1086, 0, 0, 0, 1477, 1876, 67, 97, 97, 97, 97, 97, 1883, 0, 1885, 97, 97, 97, 1889, 0, 0, 0, 286, 0, 0, 0, 286, 0, 2367488, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 0, 40976, 0, 18, 18, 24, 24, 126, 126, 126, 2053, 0, 2055, 45, 67, 0, 97, 45, 67, 0, 97, 45, 67, 97, 0, 0, 97, 97, 97, 2039, 97, 45, 45, 45, 45, 67, 67, 67, 67, 67, 226, 67, 67, 67, 67, 67, 67, 67, 67, 1246, 67, 67, 1249, 1250, 67, 67, 67, 132, 94242, 0, 0, 0, 38, 102439, 0, 0, 106538, 98347, 28809, 45, 45, 141, 45, 45, 45, 1403, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1186, 45, 45, 1189, 45, 45, 155, 45, 45, 45, 45, 45, 45, 45, 45, 45, 191, 45, 45, 45, 45, 700, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1753, 45, 45, 45, 67, 67, 45, 45, 67, 208, 67, 67, 67, 222, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1764, 67, 67, 67, 67, 67, 67, 67, 258, 67, 67, 67, 67, 67, 0, 24850, 12564, 0, 0, 0, 0, 28809, 53531, 97, 97, 288, 97, 97, 97, 302, 97, 97, 97, 97, 97, 97, 97, 97, 97, 627, 97, 97, 97, 97, 97, 97, 338, 97, 97, 97, 97, 97, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 131427, 0, 0, 0, 0, 362, 0, 365, 28809, 367, 139, 45, 370, 45, 45, 45, 45, 716, 45, 45, 45, 45, 45, 722, 45, 45, 45, 45, 45, 45, 1912, 67, 67, 67, 67, 67, 67, 67, 67, 67, 819, 67, 67, 25398, 542, 13112, 544, 45, 403, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1409, 45, 67, 67, 67, 67, 489, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 771, 67, 67, 67, 67, 520, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 534, 67, 67, 67, 67, 67, 67, 1286, 67, 67, 67, 67, 67, 67, 67, 1291, 67, 67, 24850, 24850, 12564, 12564, 0, 57889, 0, 0, 0, 53531, 53531, 367, 286, 97, 553, 97, 97, 97, 97, 586, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1138, 97, 97, 97, 97, 617, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 631, 97, 97, 97, 0, 1834, 97, 97, 97, 97, 97, 0, 0, 0, 97, 97, 97, 97, 97, 353, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 45, 45, 668, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 724, 45, 45, 45, 45, 45, 682, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 949, 45, 45, 45, 67, 67, 747, 748, 67, 67, 67, 67, 755, 67, 67, 67, 67, 67, 67, 67, 0, 0, 1301, 0, 0, 0, 1307, 0, 0, 67, 794, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1701, 67, 97, 97, 97, 845, 846, 97, 97, 97, 97, 853, 97, 97, 97, 97, 97, 97, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 97, 97, 892, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 610, 97, 97, 45, 992, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 67, 67, 67, 1239, 67, 67, 67, 1063, 67, 67, 67, 67, 67, 1068, 67, 67, 67, 67, 67, 67, 67, 0, 1299, 0, 0, 0, 1305, 0, 0, 0, 97, 1141, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1152, 97, 97, 0, 0, 97, 97, 1784, 97, 97, 97, 0, 0, 97, 97, 0, 97, 1978, 97, 97, 97, 1982, 45, 45, 45, 45, 45, 45, 45, 45, 45, 972, 973, 45, 45, 45, 45, 45, 97, 97, 97, 97, 1157, 97, 97, 97, 97, 97, 1162, 97, 97, 97, 97, 97, 97, 1145, 97, 97, 97, 97, 97, 1151, 97, 97, 97, 1253, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 539, 45, 1423, 45, 45, 67, 67, 67, 67, 67, 67, 67, 1431, 67, 67, 67, 67, 67, 67, 67, 1773, 67, 97, 97, 97, 97, 97, 97, 97, 625, 97, 97, 97, 97, 97, 97, 97, 97, 850, 97, 97, 97, 97, 97, 97, 97, 97, 880, 97, 97, 97, 97, 97, 97, 97, 97, 1106, 97, 97, 97, 97, 97, 97, 97, 67, 67, 1439, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 514, 67, 67, 97, 97, 1492, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 611, 97, 97, 1703, 67, 67, 67, 67, 67, 67, 97, 97, 97, 97, 97, 97, 97, 97, 97, 852, 97, 97, 97, 97, 97, 97, 45, 1949, 45, 1951, 45, 45, 45, 67, 67, 67, 67, 67, 67, 67, 1961, 67, 0, 97, 45, 67, 0, 97, 2060, 2061, 0, 2062, 45, 67, 97, 0, 0, 2036, 97, 97, 97, 97, 45, 45, 45, 45, 67, 67, 67, 67, 67, 223, 67, 67, 237, 67, 67, 67, 67, 67, 67, 67, 1297, 0, 0, 0, 1303, 0, 0, 0, 1309, 1963, 67, 67, 67, 97, 97, 97, 97, 0, 1972, 0, 97, 97, 97, 1975, 0, 921, 29315, 0, 0, 0, 0, 45, 45, 45, 931, 45, 45, 45, 45, 45, 407, 45, 45, 45, 45, 45, 45, 45, 45, 45, 417, 45, 45, 1989, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1996, 97, 18, 131427, 0, 0, 360, 0, 0, 0, 362, 0, 0, 365, 29315, 367, 0, 921, 29315, 0, 0, 0, 0, 45, 45, 930, 45, 45, 45, 45, 45, 45, 444, 45, 45, 45, 45, 45, 45, 45, 67, 67, 97, 97, 1998, 0, 97, 97, 97, 0, 97, 97, 97, 97, 97, 45, 45, 45, 45, 45, 45, 1985, 45, 1986, 45, 45, 45, 156, 45, 45, 170, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 675, 45, 45, 45, 45, 679, 131427, 0, 358, 0, 0, 362, 0, 365, 28809, 367, 139, 45, 45, 45, 45, 45, 381, 45, 45, 45, 45, 45, 45, 45, 45, 45, 400, 45, 45, 419, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 436, 67, 67, 67, 67, 67, 505, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 820, 67, 25398, 542, 13112, 544, 67, 67, 522, 67, 67, 67, 67, 67, 529, 67, 67, 67, 67, 67, 67, 67, 0, 1300, 0, 0, 0, 1306, 0, 0, 0, 97, 97, 619, 97, 97, 97, 97, 97, 626, 97, 97, 97, 97, 97, 97, 97, 1105, 97, 97, 97, 97, 1109, 97, 97, 97, 67, 67, 67, 67, 749, 67, 67, 67, 67, 67, 67, 67, 67, 67, 760, 67, 0, 97, 45, 67, 2058, 97, 45, 67, 0, 97, 45, 67, 97, 0, 0, 97, 97, 97, 97, 97, 45, 45, 45, 2041, 67, 67, 67, 67, 67, 780, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 516, 67, 67, 97, 97, 97, 878, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1629, 97, 0, 45, 979, 45, 45, 45, 45, 984, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1000, 45, 45, 45, 45, 67, 67, 67, 1023, 67, 67, 67, 67, 1028, 67, 67, 67, 67, 67, 67, 67, 67, 67, 470, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 25398, 0, 13112, 0, 54074, 0, 0, 0, 1094, 0, 0, 0, 1092, 1315, 0, 0, 0, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1486, 97, 1489, 97, 97, 97, 1117, 97, 97, 97, 97, 1122, 97, 97, 97, 97, 97, 97, 97, 1146, 97, 97, 97, 97, 97, 97, 97, 97, 881, 97, 97, 97, 886, 97, 97, 97, 1311, 0, 0, 0, 0, 0, 0, 0, 0, 97, 97, 97, 97, 97, 97, 97, 1615, 97, 97, 97, 97, 97, 1619, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1631, 97, 97, 1847, 97, 45, 45, 45, 45, 1852, 45, 45, 45, 45, 45, 45, 45, 1235, 45, 45, 45, 67, 67, 67, 67, 67, 1868, 67, 67, 67, 1872, 67, 67, 67, 67, 67, 97, 97, 97, 97, 1882, 0, 0, 0, 97, 97, 97, 97, 0, 1891, 67, 67, 67, 67, 67, 97, 97, 97, 97, 97, 1929, 0, 0, 97, 97, 97, 97, 97, 97, 45, 1900, 45, 1901, 45, 45, 45, 1905, 45, 67, 2054, 97, 45, 67, 0, 97, 45, 67, 0, 97, 45, 67, 97, 0, 0, 97, 2037, 2038, 97, 97, 45, 45, 45, 45, 67, 67, 67, 67, 1867, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1774, 97, 97, 97, 97, 97, 97, 0, 94242, 0, 0, 0, 38, 102439, 0, 0, 106538, 98347, 28809, 45, 45, 142, 45, 45, 45, 1412, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 432, 45, 45, 45, 45, 45, 157, 45, 45, 171, 45, 45, 45, 182, 45, 45, 45, 45, 200, 45, 45, 45, 1543, 45, 45, 45, 45, 45, 45, 45, 45, 1551, 45, 45, 45, 45, 1181, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1211, 45, 45, 45, 1214, 45, 45, 45, 67, 209, 67, 67, 67, 224, 67, 67, 238, 67, 67, 67, 249, 67, 0, 97, 2056, 2057, 0, 2059, 45, 67, 0, 97, 45, 67, 97, 0, 0, 1937, 97, 97, 97, 97, 97, 97, 45, 45, 45, 45, 45, 45, 1741, 45, 45, 45, 45, 45, 45, 67, 67, 67, 267, 67, 67, 67, 0, 24850, 12564, 0, 0, 0, 0, 28809, 53531, 97, 97, 289, 97, 97, 97, 304, 97, 97, 318, 97, 97, 97, 329, 97, 97, 0, 0, 97, 97, 2001, 0, 97, 2003, 97, 97, 97, 45, 45, 45, 1739, 45, 45, 45, 1742, 45, 45, 45, 45, 45, 97, 97, 347, 97, 97, 97, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 45, 666, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1420, 45, 57889, 0, 0, 54074, 54074, 550, 0, 97, 97, 97, 97, 97, 97, 97, 97, 840, 67, 1007, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 759, 67, 67, 67, 67, 67, 67, 67, 1052, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1031, 67, 67, 67, 67, 67, 97, 97, 97, 1101, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 592, 97, 97, 97, 1190, 45, 45, 45, 45, 45, 1195, 45, 1197, 45, 45, 45, 45, 1201, 45, 45, 45, 45, 1952, 45, 45, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 250, 67, 67, 67, 1255, 67, 1257, 67, 67, 67, 67, 1261, 67, 67, 67, 67, 67, 67, 67, 67, 1696, 67, 67, 67, 67, 67, 67, 67, 0, 0, 0, 0, 0, 0, 2162688, 0, 0, 67, 67, 1267, 67, 67, 67, 67, 67, 67, 1273, 67, 67, 67, 67, 67, 67, 67, 67, 1763, 67, 67, 67, 67, 67, 67, 67, 0, 0, 0, 0, 0, 280, 94, 0, 0, 1281, 67, 67, 67, 67, 1285, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1070, 67, 67, 67, 67, 67, 1335, 97, 1337, 97, 97, 97, 97, 1341, 97, 97, 97, 97, 97, 97, 97, 97, 882, 97, 97, 97, 97, 97, 97, 97, 1347, 97, 97, 97, 97, 97, 97, 1353, 97, 97, 97, 97, 97, 97, 1361, 97, 18, 131427, 0, 638, 0, 0, 0, 0, 362, 0, 0, 365, 29315, 367, 0, 544, 0, 550, 0, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2473984, 2158592, 2158592, 2158592, 2990080, 2158592, 2158592, 2207744, 2207744, 2482176, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 0, 0, 0, 0, 0, 0, 2162688, 0, 53530, 97, 97, 97, 1365, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 608, 97, 97, 97, 45, 45, 1424, 45, 1425, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1058, 67, 67, 67, 67, 45, 1555, 45, 45, 1557, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 707, 45, 45, 45, 45, 67, 67, 1570, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 773, 67, 67, 1595, 67, 67, 1597, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 139, 2158592, 2158592, 2158592, 2404352, 2412544, 97, 97, 97, 1636, 97, 97, 97, 1639, 97, 97, 1641, 97, 97, 97, 97, 97, 97, 1173, 0, 921, 0, 0, 0, 0, 0, 0, 45, 67, 67, 67, 1693, 67, 67, 67, 67, 67, 67, 67, 1698, 67, 67, 67, 67, 67, 67, 273, 0, 24850, 12564, 0, 0, 0, 0, 28809, 53531, 1860, 45, 45, 67, 67, 1865, 67, 67, 67, 67, 1870, 67, 67, 67, 67, 1875, 67, 67, 97, 97, 1880, 97, 97, 0, 0, 0, 97, 97, 1888, 97, 0, 0, 0, 1938, 97, 97, 97, 97, 97, 45, 45, 45, 45, 45, 45, 1854, 45, 45, 45, 45, 45, 45, 45, 1909, 45, 45, 1911, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1248, 67, 67, 67, 67, 67, 67, 1922, 67, 67, 1924, 97, 97, 97, 97, 97, 0, 0, 0, 97, 97, 97, 97, 97, 1898, 45, 45, 45, 45, 45, 45, 1904, 45, 45, 67, 67, 67, 67, 97, 97, 97, 97, 0, 0, 16384, 97, 97, 97, 97, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 0, 1724, 2008, 2009, 45, 45, 67, 67, 67, 2014, 2015, 67, 67, 97, 97, 0, 0, 97, 97, 97, 0, 97, 97, 97, 97, 97, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 2022, 0, 2023, 97, 97, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 67, 1869, 67, 67, 67, 67, 67, 67, 0, 94242, 0, 0, 0, 38, 102439, 0, 0, 106538, 98347, 28809, 45, 45, 45, 147, 151, 154, 45, 162, 45, 45, 176, 178, 181, 45, 45, 45, 192, 196, 45, 45, 45, 45, 2012, 67, 67, 67, 67, 67, 67, 2018, 97, 0, 0, 97, 1894, 1895, 97, 1897, 97, 45, 45, 45, 45, 45, 45, 45, 45, 45, 656, 45, 45, 45, 45, 45, 45, 67, 259, 263, 67, 67, 67, 67, 0, 24850, 12564, 0, 0, 0, 0, 28809, 53531, 97, 97, 97, 294, 298, 301, 97, 309, 97, 97, 323, 325, 328, 97, 97, 97, 97, 97, 560, 97, 97, 97, 569, 97, 97, 97, 97, 97, 97, 306, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1624, 97, 97, 97, 97, 97, 97, 97, 0, 921, 0, 1175, 0, 0, 0, 0, 45, 339, 343, 97, 97, 97, 97, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 67, 67, 503, 67, 67, 67, 67, 67, 67, 67, 67, 67, 512, 67, 67, 519, 97, 97, 600, 97, 97, 97, 97, 97, 97, 97, 97, 97, 609, 97, 97, 616, 45, 649, 45, 45, 45, 45, 45, 654, 45, 45, 45, 45, 45, 45, 45, 45, 1393, 45, 45, 45, 45, 45, 45, 45, 45, 1209, 45, 45, 45, 45, 45, 45, 45, 67, 763, 67, 67, 67, 67, 67, 67, 67, 67, 770, 67, 67, 67, 774, 67, 0, 2045, 97, 97, 97, 97, 45, 45, 67, 67, 0, 0, 97, 97, 45, 45, 45, 994, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 67, 67, 213, 67, 219, 67, 67, 232, 67, 242, 67, 247, 67, 67, 67, 779, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1018, 67, 67, 67, 67, 811, 67, 67, 67, 67, 67, 67, 67, 67, 67, 25398, 542, 13112, 544, 57889, 0, 0, 54074, 54074, 550, 0, 97, 834, 97, 97, 97, 97, 97, 839, 97, 18, 131427, 0, 638, 0, 0, 0, 0, 362, 0, 0, 365, 29315, 367, 645, 97, 97, 861, 97, 97, 97, 97, 97, 97, 97, 97, 868, 97, 97, 97, 872, 97, 97, 877, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 613, 97, 97, 97, 97, 97, 909, 97, 97, 97, 97, 97, 97, 97, 97, 97, 0, 0, 0, 18, 18, 24, 24, 27, 27, 27, 1036, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1047, 67, 67, 67, 1050, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1033, 67, 67, 67, 97, 97, 1130, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 638, 0, 0, 67, 67, 67, 1295, 67, 67, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 97, 1317, 97, 97, 97, 97, 97, 97, 1375, 97, 97, 97, 0, 0, 0, 45, 1379, 45, 45, 45, 45, 45, 45, 422, 45, 45, 45, 429, 431, 45, 45, 45, 45, 0, 1090, 0, 0, 97, 1479, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1357, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1716, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1723, 0, 921, 29315, 0, 0, 0, 0, 45, 929, 45, 45, 45, 45, 45, 45, 45, 1234, 45, 45, 45, 45, 67, 67, 67, 67, 1240, 97, 97, 97, 1738, 45, 45, 45, 45, 45, 45, 45, 1743, 45, 45, 45, 45, 166, 45, 45, 45, 45, 184, 186, 45, 45, 197, 45, 45, 97, 1779, 0, 0, 97, 97, 97, 97, 97, 97, 0, 0, 97, 97, 0, 97, 18, 131427, 0, 638, 0, 0, 0, 0, 362, 0, 640, 365, 29315, 367, 0, 921, 29315, 0, 0, 0, 0, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1539, 45, 45, 1803, 45, 45, 45, 45, 45, 1809, 45, 45, 45, 67, 67, 67, 1814, 67, 67, 67, 67, 67, 97, 97, 97, 97, 97, 0, 0, 0, 1932, 97, 97, 0, 1781, 97, 97, 97, 97, 97, 97, 0, 0, 97, 97, 0, 97, 67, 67, 67, 1818, 67, 67, 67, 67, 67, 1824, 67, 67, 67, 97, 97, 97, 97, 97, 0, 0, 0, 97, 97, 97, 97, 1890, 0, 1829, 97, 97, 0, 0, 97, 97, 1836, 97, 97, 0, 0, 0, 97, 97, 97, 97, 1981, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1987, 1845, 97, 97, 97, 45, 45, 45, 45, 45, 1853, 45, 45, 45, 1857, 45, 45, 45, 67, 1864, 67, 1866, 67, 67, 67, 67, 67, 67, 67, 67, 67, 97, 97, 97, 97, 97, 97, 97, 1710, 1711, 67, 67, 97, 97, 97, 97, 97, 0, 0, 0, 1886, 97, 97, 97, 0, 0, 97, 97, 97, 97, 1838, 0, 0, 0, 97, 1843, 97, 0, 1893, 97, 97, 97, 97, 97, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1745, 45, 45, 67, 2044, 0, 97, 97, 97, 97, 45, 45, 67, 67, 0, 0, 97, 97, 45, 45, 45, 1660, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 453, 45, 455, 67, 67, 67, 67, 268, 67, 67, 67, 0, 24850, 12564, 0, 0, 0, 0, 28809, 53531, 97, 97, 348, 97, 97, 97, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 131427, 0, 359, 0, 0, 362, 0, 365, 28809, 367, 139, 45, 45, 45, 45, 45, 421, 45, 45, 45, 45, 45, 45, 45, 434, 45, 45, 695, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1667, 45, 0, 921, 29315, 0, 925, 0, 0, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1548, 45, 45, 45, 45, 45, 45, 67, 1037, 67, 1039, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1277, 67, 67, 67, 67, 67, 67, 67, 67, 25398, 0, 13112, 0, 54074, 0, 0, 0, 1095, 0, 0, 0, 1096, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 869, 97, 97, 97, 97, 97, 97, 1131, 97, 1133, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1370, 97, 97, 97, 97, 97, 1312, 0, 0, 0, 0, 1096, 0, 0, 0, 97, 97, 97, 97, 97, 97, 97, 1327, 97, 97, 97, 97, 97, 1332, 97, 97, 97, 1830, 97, 0, 0, 97, 97, 97, 97, 97, 0, 0, 0, 97, 97, 97, 1896, 97, 97, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1210, 45, 45, 45, 45, 45, 45, 133, 94242, 0, 0, 0, 38, 102439, 0, 0, 106538, 98347, 28809, 45, 45, 45, 45, 380, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 401, 45, 45, 158, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1200, 45, 45, 45, 45, 206, 67, 67, 67, 67, 67, 225, 67, 67, 67, 67, 67, 67, 67, 67, 754, 67, 67, 67, 67, 67, 67, 67, 57889, 0, 0, 54074, 54074, 550, 832, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1342, 97, 97, 97, 97, 97, 97, 67, 67, 67, 67, 67, 25398, 1083, 13112, 1087, 54074, 1091, 0, 0, 0, 0, 0, 0, 1316, 0, 831, 97, 97, 97, 97, 97, 97, 97, 1174, 921, 0, 1175, 0, 0, 0, 0, 45, 0, 94242, 0, 0, 0, 38, 102439, 0, 0, 106538, 98347, 28809, 45, 45, 45, 148, 67, 67, 264, 67, 67, 67, 67, 0, 24850, 12564, 0, 0, 0, 0, 28809, 53531, 97, 97, 97, 295, 97, 97, 97, 97, 313, 97, 97, 97, 97, 331, 333, 97, 18, 131427, 356, 638, 0, 0, 0, 0, 362, 0, 0, 365, 0, 367, 0, 45, 45, 1530, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 988, 45, 45, 45, 97, 344, 97, 97, 97, 97, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 402, 404, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1756, 67, 438, 45, 45, 45, 45, 45, 45, 45, 45, 449, 450, 45, 45, 45, 67, 67, 214, 218, 221, 67, 229, 67, 67, 243, 245, 248, 67, 67, 67, 67, 67, 488, 490, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1071, 67, 1073, 67, 67, 67, 67, 67, 524, 67, 67, 67, 67, 67, 67, 67, 67, 535, 536, 67, 67, 67, 67, 67, 67, 1683, 1684, 67, 67, 67, 67, 1688, 1689, 67, 67, 67, 67, 67, 67, 1694, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1288, 67, 67, 67, 67, 67, 67, 97, 97, 97, 585, 587, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1163, 97, 97, 97, 97, 97, 97, 97, 621, 97, 97, 97, 97, 97, 97, 97, 97, 632, 633, 97, 97, 0, 0, 97, 1783, 97, 97, 97, 97, 0, 0, 97, 97, 0, 97, 97, 97, 45, 2026, 45, 45, 45, 45, 67, 2030, 67, 67, 67, 67, 67, 67, 1053, 1054, 67, 67, 67, 67, 67, 67, 1061, 67, 712, 45, 45, 45, 717, 45, 45, 45, 45, 45, 45, 45, 45, 725, 45, 45, 45, 163, 167, 173, 177, 45, 45, 45, 45, 45, 193, 45, 45, 45, 45, 982, 45, 45, 45, 45, 45, 45, 987, 45, 45, 45, 45, 45, 1558, 45, 1560, 45, 45, 45, 45, 45, 45, 45, 45, 704, 705, 45, 45, 45, 45, 45, 45, 45, 45, 731, 45, 45, 45, 67, 67, 67, 67, 67, 739, 67, 67, 67, 67, 67, 67, 464, 67, 67, 67, 67, 67, 67, 479, 67, 67, 67, 67, 67, 764, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1290, 67, 67, 67, 67, 67, 67, 812, 67, 67, 67, 67, 818, 67, 67, 67, 25398, 542, 13112, 544, 57889, 0, 0, 54074, 54074, 550, 0, 97, 97, 97, 97, 97, 837, 97, 97, 97, 97, 97, 602, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1137, 97, 97, 97, 97, 97, 97, 97, 97, 97, 862, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1627, 97, 97, 97, 0, 97, 97, 97, 97, 910, 97, 97, 97, 97, 916, 97, 97, 97, 0, 0, 0, 97, 97, 1940, 97, 97, 1942, 45, 45, 45, 45, 45, 45, 385, 45, 45, 45, 45, 395, 45, 45, 45, 45, 966, 45, 969, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 975, 45, 45, 45, 406, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 974, 45, 45, 45, 67, 67, 67, 67, 1010, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1262, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1040, 67, 1042, 67, 1045, 67, 67, 67, 67, 67, 67, 67, 527, 67, 67, 67, 67, 67, 67, 537, 67, 67, 67, 67, 67, 1051, 67, 67, 67, 67, 67, 1057, 67, 67, 67, 67, 67, 67, 67, 1454, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1445, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1079, 25398, 0, 13112, 0, 54074, 0, 0, 0, 0, 0, 0, 0, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2207744, 2207744, 2207744, 2207744, 2207744, 2572288, 2207744, 2207744, 2207744, 1098, 97, 97, 97, 97, 97, 1104, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1356, 97, 97, 97, 97, 97, 97, 1128, 97, 97, 97, 97, 97, 97, 1134, 97, 1136, 97, 1139, 97, 97, 97, 97, 97, 97, 1622, 97, 97, 97, 97, 97, 97, 97, 97, 0, 921, 0, 0, 0, 1176, 0, 646, 45, 67, 67, 67, 1268, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1469, 67, 67, 67, 97, 1348, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1127, 97, 67, 1569, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1448, 1449, 67, 1816, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1825, 67, 67, 1827, 97, 97, 0, 0, 1782, 97, 97, 97, 97, 97, 0, 0, 97, 97, 0, 97, 97, 97, 1831, 0, 0, 97, 97, 97, 97, 97, 0, 0, 0, 97, 97, 97, 1980, 97, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1395, 45, 45, 45, 45, 45, 97, 1846, 97, 97, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1212, 45, 45, 45, 45, 45, 45, 2010, 45, 67, 67, 67, 67, 67, 2016, 67, 97, 97, 0, 0, 97, 97, 97, 0, 97, 97, 97, 97, 97, 45, 45, 2007, 0, 94242, 0, 0, 0, 38, 102439, 0, 0, 106538, 98347, 28809, 45, 45, 143, 45, 45, 45, 1671, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 67, 1813, 67, 67, 1815, 45, 45, 67, 210, 67, 67, 67, 67, 67, 67, 239, 67, 67, 67, 67, 67, 67, 67, 1575, 67, 67, 67, 67, 67, 67, 67, 67, 493, 67, 67, 67, 67, 67, 67, 67, 97, 97, 290, 97, 97, 97, 97, 97, 97, 319, 97, 97, 97, 97, 97, 97, 303, 97, 97, 317, 97, 97, 97, 97, 97, 97, 305, 97, 97, 97, 97, 97, 97, 97, 97, 97, 899, 97, 97, 97, 97, 97, 97, 375, 45, 45, 45, 379, 45, 45, 390, 45, 45, 394, 45, 45, 45, 45, 45, 443, 45, 45, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 461, 67, 67, 67, 465, 67, 67, 476, 67, 67, 480, 67, 67, 67, 67, 67, 67, 1761, 67, 67, 67, 67, 67, 67, 67, 67, 67, 530, 67, 67, 67, 67, 67, 67, 500, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1075, 97, 97, 97, 558, 97, 97, 97, 562, 97, 97, 573, 97, 97, 577, 97, 97, 0, 1999, 97, 97, 97, 0, 97, 97, 2004, 2005, 97, 45, 45, 45, 45, 1193, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 676, 45, 45, 45, 45, 597, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1334, 45, 681, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1396, 45, 45, 1399, 45, 45, 730, 45, 45, 45, 45, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1434, 67, 67, 67, 67, 67, 67, 750, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1456, 67, 67, 67, 67, 67, 45, 45, 993, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 67, 67, 1238, 67, 67, 1006, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1280, 1048, 1049, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1059, 67, 67, 67, 67, 67, 67, 1296, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2367488, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 97, 97, 1100, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 638, 0, 920, 97, 97, 1142, 1143, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1153, 97, 97, 97, 97, 97, 1144, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1149, 97, 97, 97, 97, 1154, 45, 1218, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1678, 45, 45, 45, 67, 67, 67, 67, 67, 1269, 67, 67, 67, 67, 67, 67, 67, 67, 1278, 67, 67, 67, 67, 67, 67, 1772, 67, 67, 97, 97, 97, 97, 97, 97, 97, 0, 921, 922, 1175, 0, 0, 0, 0, 45, 97, 97, 1349, 97, 97, 97, 97, 97, 97, 97, 97, 1358, 97, 97, 97, 97, 97, 97, 1623, 97, 97, 97, 97, 97, 97, 97, 97, 0, 921, 0, 0, 926, 0, 0, 0, 45, 45, 1411, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1754, 45, 45, 67, 67, 1301, 0, 1307, 0, 1313, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 21054, 97, 97, 97, 97, 67, 1757, 67, 67, 67, 1760, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1467, 67, 67, 67, 67, 67, 1778, 97, 0, 0, 97, 97, 97, 97, 97, 97, 0, 0, 97, 97, 0, 97, 97, 97, 97, 97, 1158, 97, 97, 97, 1161, 97, 97, 97, 97, 1166, 97, 97, 97, 97, 97, 1325, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1328, 97, 97, 97, 97, 97, 97, 97, 67, 67, 67, 67, 67, 1820, 67, 1822, 67, 67, 67, 67, 67, 97, 97, 97, 97, 97, 0, 0, 0, 97, 1933, 97, 1892, 97, 97, 97, 97, 97, 97, 1899, 45, 45, 45, 45, 45, 45, 45, 45, 1664, 45, 45, 45, 45, 45, 45, 45, 45, 1546, 45, 45, 45, 45, 45, 45, 45, 45, 1208, 45, 45, 45, 45, 45, 45, 45, 45, 1224, 45, 45, 45, 45, 45, 45, 45, 45, 673, 45, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 1925, 97, 97, 97, 97, 0, 0, 0, 97, 97, 97, 97, 97, 623, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 307, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1796, 97, 45, 45, 45, 45, 45, 45, 45, 970, 45, 45, 45, 45, 45, 45, 45, 45, 1417, 45, 45, 45, 45, 45, 45, 45, 67, 1964, 67, 67, 97, 97, 97, 97, 0, 0, 0, 97, 97, 97, 97, 0, 97, 97, 97, 97, 97, 97, 1721, 97, 97, 0, 0, 1997, 97, 0, 0, 2000, 97, 97, 0, 97, 97, 97, 97, 97, 45, 45, 45, 45, 733, 45, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 803, 67, 67, 67, 67, 67, 0, 94242, 0, 0, 0, 38, 102439, 0, 0, 106538, 98347, 28809, 45, 45, 144, 45, 45, 45, 1805, 45, 1807, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 67, 231, 67, 67, 67, 67, 67, 67, 67, 0, 24850, 12564, 0, 0, 0, 281, 28809, 53531, 45, 45, 67, 211, 67, 67, 67, 67, 230, 234, 240, 244, 67, 67, 67, 67, 67, 67, 492, 67, 67, 67, 67, 67, 67, 67, 67, 67, 471, 67, 67, 67, 67, 481, 67, 67, 260, 67, 67, 67, 67, 67, 0, 24850, 12564, 0, 0, 0, 0, 28809, 53531, 97, 97, 291, 97, 97, 97, 97, 310, 314, 320, 324, 97, 97, 97, 97, 97, 97, 1367, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1355, 97, 97, 97, 97, 97, 97, 1362, 340, 97, 97, 97, 97, 97, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 131427, 0, 0, 360, 0, 362, 0, 365, 28809, 367, 139, 369, 45, 45, 45, 374, 67, 67, 460, 67, 67, 67, 67, 466, 67, 67, 67, 67, 67, 67, 67, 67, 801, 67, 67, 67, 67, 67, 67, 67, 67, 67, 487, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 498, 67, 67, 67, 67, 67, 67, 1821, 67, 67, 67, 67, 67, 67, 97, 97, 97, 97, 97, 0, 0, 0, 97, 97, 97, 97, 0, 0, 67, 502, 67, 67, 67, 67, 67, 67, 67, 508, 67, 67, 67, 515, 517, 67, 67, 67, 67, 67, 97, 97, 97, 97, 97, 0, 0, 1931, 97, 97, 97, 97, 97, 588, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 629, 97, 97, 97, 97, 97, 67, 24850, 24850, 12564, 12564, 0, 57889, 0, 0, 0, 53531, 53531, 367, 286, 552, 97, 97, 97, 97, 97, 1352, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1511, 97, 97, 97, 97, 97, 97, 97, 557, 97, 97, 97, 97, 563, 97, 97, 97, 97, 97, 97, 97, 97, 1135, 97, 97, 97, 97, 97, 97, 97, 97, 97, 584, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 595, 97, 97, 97, 97, 97, 895, 97, 97, 97, 97, 97, 97, 903, 97, 97, 97, 0, 97, 97, 1638, 97, 97, 97, 97, 97, 97, 97, 97, 1646, 97, 599, 97, 97, 97, 97, 97, 97, 97, 605, 97, 97, 97, 612, 614, 97, 97, 97, 97, 97, 1377, 0, 0, 45, 45, 45, 45, 45, 45, 45, 45, 655, 45, 45, 45, 45, 45, 45, 45, 745, 67, 67, 67, 67, 751, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1577, 67, 67, 67, 67, 67, 762, 67, 67, 67, 67, 766, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1765, 67, 67, 67, 67, 67, 777, 67, 67, 781, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1592, 1593, 67, 67, 97, 843, 97, 97, 97, 97, 849, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1510, 97, 97, 97, 97, 97, 97, 97, 860, 97, 97, 97, 97, 864, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1797, 45, 45, 45, 45, 1801, 45, 97, 875, 97, 97, 879, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1522, 97, 97, 97, 97, 97, 991, 45, 45, 45, 45, 996, 45, 45, 45, 45, 45, 45, 45, 45, 67, 67, 215, 67, 67, 67, 67, 233, 67, 67, 67, 67, 251, 253, 1022, 67, 67, 67, 1026, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1035, 67, 67, 1038, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1458, 67, 67, 67, 67, 67, 1064, 67, 67, 67, 1067, 67, 67, 67, 67, 1072, 67, 67, 67, 67, 67, 67, 1442, 67, 67, 67, 67, 67, 67, 67, 67, 67, 97, 97, 97, 1775, 97, 97, 97, 67, 67, 67, 67, 67, 25398, 0, 13112, 0, 54074, 0, 0, 0, 0, 1096, 0, 921, 29315, 0, 0, 0, 0, 928, 45, 45, 45, 45, 45, 934, 45, 45, 45, 164, 45, 45, 45, 45, 45, 45, 45, 45, 45, 198, 45, 45, 45, 378, 45, 45, 45, 45, 45, 45, 393, 45, 45, 45, 398, 45, 97, 97, 1116, 97, 97, 97, 1120, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1147, 1148, 97, 97, 97, 97, 97, 97, 97, 1129, 97, 97, 1132, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1626, 97, 97, 97, 97, 0, 45, 1178, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1185, 45, 45, 45, 45, 441, 45, 45, 45, 45, 45, 45, 451, 45, 45, 67, 67, 67, 67, 67, 227, 67, 67, 67, 67, 67, 67, 67, 67, 1260, 67, 67, 67, 1263, 67, 67, 1265, 1203, 45, 45, 1205, 45, 1206, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1216, 67, 1266, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1276, 67, 67, 67, 67, 67, 67, 752, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1056, 67, 67, 67, 67, 67, 67, 45, 1386, 45, 1389, 45, 45, 45, 45, 1394, 45, 45, 45, 1397, 45, 45, 45, 45, 995, 45, 997, 45, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 1915, 67, 67, 67, 67, 67, 1422, 45, 45, 45, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1433, 67, 1436, 67, 67, 67, 67, 1441, 67, 67, 67, 1444, 67, 67, 67, 67, 67, 67, 67, 0, 24851, 12565, 0, 0, 0, 0, 28809, 53532, 97, 97, 97, 97, 1494, 97, 97, 97, 1497, 97, 97, 97, 97, 97, 97, 97, 1368, 97, 97, 97, 97, 97, 97, 97, 97, 851, 97, 97, 97, 97, 97, 97, 97, 67, 67, 67, 1571, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 25398, 542, 13112, 544, 67, 67, 1583, 67, 67, 67, 67, 67, 67, 67, 67, 1591, 67, 67, 67, 67, 67, 67, 782, 67, 67, 67, 67, 67, 67, 67, 67, 67, 756, 67, 67, 67, 67, 67, 67, 97, 1634, 97, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1125, 97, 97, 97, 1647, 97, 97, 97, 97, 97, 0, 45, 45, 45, 45, 45, 45, 45, 45, 45, 719, 720, 45, 45, 45, 45, 45, 45, 45, 45, 685, 45, 45, 45, 45, 45, 45, 45, 45, 45, 942, 45, 45, 946, 45, 45, 45, 950, 45, 45, 1658, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1668, 1712, 97, 97, 97, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 0, 0, 1835, 97, 97, 97, 97, 0, 0, 0, 97, 97, 1844, 97, 97, 1726, 0, 97, 97, 97, 97, 97, 1732, 97, 1734, 97, 97, 97, 97, 97, 300, 97, 308, 97, 97, 97, 97, 97, 97, 97, 97, 866, 97, 97, 97, 97, 97, 97, 97, 67, 67, 67, 1758, 67, 67, 67, 1762, 67, 67, 67, 67, 67, 67, 67, 67, 1043, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1771, 67, 67, 67, 97, 97, 97, 97, 97, 1776, 97, 97, 97, 97, 97, 1794, 97, 97, 97, 45, 45, 45, 45, 45, 45, 45, 1183, 45, 45, 45, 45, 45, 45, 45, 45, 45, 409, 45, 45, 45, 45, 45, 45, 67, 67, 67, 1966, 97, 97, 97, 1970, 0, 0, 0, 97, 97, 97, 97, 0, 97, 97, 97, 1720, 97, 97, 97, 97, 97, 0, 0, 97, 97, 97, 1837, 97, 0, 1840, 1841, 97, 97, 97, 1988, 45, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1994, 1995, 67, 97, 97, 97, 97, 97, 911, 97, 97, 97, 97, 97, 97, 97, 638, 0, 0, 0, 0, 1315, 0, 0, 0, 0, 97, 97, 97, 1319, 97, 97, 97, 0, 97, 97, 97, 97, 97, 97, 1733, 97, 97, 97, 97, 97, 97, 1340, 97, 97, 97, 1343, 97, 97, 1345, 97, 1346, 67, 67, 265, 67, 67, 67, 67, 0, 24850, 12564, 0, 0, 0, 0, 28809, 53531, 97, 345, 97, 97, 97, 97, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 131427, 0, 0, 0, 361, 362, 0, 365, 28809, 367, 139, 45, 45, 45, 45, 45, 671, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 411, 45, 45, 414, 45, 45, 45, 45, 377, 45, 45, 45, 386, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1207, 45, 45, 45, 45, 45, 45, 1213, 45, 45, 67, 67, 67, 67, 67, 463, 67, 67, 67, 472, 67, 67, 67, 67, 67, 67, 67, 528, 67, 67, 67, 67, 67, 67, 67, 67, 1287, 67, 67, 67, 67, 67, 67, 67, 540, 24850, 24850, 12564, 12564, 0, 57889, 0, 0, 0, 53531, 53531, 367, 286, 97, 97, 97, 97, 97, 1103, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 917, 97, 97, 0, 0, 0, 637, 18, 131427, 0, 0, 0, 0, 0, 0, 362, 0, 0, 365, 29315, 367, 0, 921, 29315, 0, 0, 0, 927, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1223, 45, 45, 45, 45, 45, 45, 45, 45, 45, 426, 45, 45, 433, 45, 45, 45, 45, 697, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 708, 45, 45, 45, 45, 1221, 45, 45, 45, 45, 1225, 45, 45, 45, 45, 45, 45, 384, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1198, 45, 45, 45, 45, 45, 45, 67, 67, 795, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1470, 67, 67, 67, 67, 67, 67, 67, 815, 67, 67, 67, 67, 67, 67, 25398, 542, 13112, 544, 97, 97, 97, 893, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1164, 97, 97, 97, 67, 67, 67, 1025, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1687, 67, 67, 67, 67, 67, 67, 67, 67, 67, 25398, 0, 13112, 0, 54074, 0, 0, 0, 0, 0, 1097, 1241, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1450, 45, 45, 1388, 45, 1390, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1236, 67, 67, 67, 67, 67, 1437, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1472, 1490, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1503, 67, 67, 67, 67, 67, 97, 97, 97, 97, 97, 0, 1930, 0, 97, 97, 97, 97, 97, 847, 97, 97, 97, 97, 97, 97, 97, 97, 97, 858, 67, 67, 1965, 67, 97, 97, 97, 97, 0, 0, 0, 97, 97, 97, 97, 0, 97, 97, 1719, 97, 97, 97, 97, 97, 97, 0, 0, 0, 45, 45, 45, 45, 1382, 45, 1383, 45, 45, 45, 159, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1563, 45, 45, 45, 45, 45, 67, 261, 67, 67, 67, 67, 67, 0, 24850, 12564, 0, 0, 0, 0, 28809, 53531, 341, 97, 97, 97, 97, 97, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 97, 1099, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1333, 97, 1230, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 67, 1992, 67, 1993, 67, 67, 67, 97, 97, 45, 45, 160, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1665, 45, 45, 45, 45, 45, 131427, 357, 0, 0, 0, 362, 0, 365, 28809, 367, 139, 45, 45, 45, 45, 45, 684, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 412, 45, 45, 45, 416, 45, 45, 45, 440, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 67, 67, 1990, 67, 1991, 67, 67, 67, 67, 67, 67, 67, 97, 97, 1707, 97, 97, 97, 97, 97, 97, 501, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1691, 67, 67, 67, 67, 67, 526, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1030, 67, 1032, 67, 67, 67, 67, 598, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1632, 0, 921, 29315, 923, 0, 0, 0, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1392, 45, 45, 45, 45, 45, 45, 45, 45, 45, 960, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 25398, 0, 13112, 0, 54074, 0, 0, 1093, 0, 0, 0, 0, 0, 97, 1609, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1369, 97, 97, 97, 1372, 97, 97, 67, 67, 266, 67, 67, 67, 67, 0, 24850, 12564, 0, 0, 0, 0, 28809, 53531, 97, 346, 97, 97, 97, 97, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 665, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1677, 45, 45, 45, 45, 67, 45, 45, 954, 45, 956, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1404, 45, 45, 45, 45, 45, 45, 45, 45, 45, 425, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 1270, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1069, 67, 67, 67, 67, 67, 67, 97, 97, 97, 1350, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1524, 97, 97, 97, 97, 97, 97, 97, 1376, 0, 0, 0, 45, 45, 45, 45, 45, 45, 45, 45, 1545, 45, 45, 45, 45, 45, 45, 45, 45, 45, 448, 45, 45, 45, 45, 67, 456, 67, 67, 67, 67, 67, 1573, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1247, 67, 67, 67, 67, 67, 1252, 97, 1725, 97, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1628, 97, 1630, 0, 0, 94242, 0, 0, 0, 2211840, 0, 1118208, 0, 0, 0, 0, 2158592, 2158731, 2158592, 2158592, 2158592, 3117056, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 3018752, 2158592, 3043328, 2158592, 2158592, 2158592, 2158592, 3080192, 2158592, 2158592, 3112960, 2158592, 2158592, 2158592, 2158592, 2158592, 2158878, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2605056, 2158592, 2158592, 2207744, 0, 542, 0, 544, 0, 0, 2166784, 0, 0, 0, 550, 0, 0, 2158592, 2158592, 2686976, 2158592, 2715648, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2867200, 2158592, 2904064, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 0, 94242, 0, 0, 0, 2211840, 0, 0, 1130496, 0, 0, 0, 2158592, 2158592, 2158592, 2158592, 2158592, 3186688, 2158592, 0, 0, 139, 0, 0, 0, 139, 0, 2367488, 2207744, 0, 0, 0, 0, 176128, 0, 2166784, 0, 0, 0, 0, 0, 286, 2158592, 2158592, 3170304, 3174400, 2158592, 0, 0, 0, 2158592, 2158592, 2158592, 2158592, 2158592, 2424832, 2158592, 2158592, 2158592, 1508, 2158592, 2908160, 2158592, 2158592, 2158592, 2977792, 2158592, 2158592, 2158592, 2158592, 3039232, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 3158016, 67, 24850, 24850, 12564, 12564, 0, 0, 0, 0, 0, 53531, 53531, 0, 286, 97, 97, 97, 97, 97, 1119, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1509, 97, 97, 97, 97, 97, 97, 97, 97, 564, 97, 97, 97, 97, 97, 97, 97, 57889, 0, 0, 0, 0, 550, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 561, 97, 97, 97, 97, 97, 97, 576, 97, 97, 139264, 139264, 139264, 139264, 139264, 139264, 139264, 139264, 139264, 139264, 139264, 139264, 0, 0, 139264, 0, 921, 29315, 0, 0, 926, 0, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1811, 45, 67, 67, 67, 67, 67, 0, 2146304, 2146304, 0, 0, 0, 0, 2224128, 2224128, 2224128, 2232320, 2232320, 2232320, 2232320, 0, 0, 1301, 0, 0, 0, 0, 0, 1307, 0, 0, 0, 0, 0, 1313, 0, 0, 0, 0, 0, 0, 0, 97, 97, 1318, 97, 97, 97, 97, 97, 97, 1795, 97, 97, 45, 45, 45, 45, 45, 45, 45, 446, 45, 45, 45, 45, 45, 45, 67, 67, 2158592, 2146304, 0, 0, 0, 0, 0, 0, 0, 2211840, 0, 0, 0, 0, 2158592, 0, 921, 29315, 0, 924, 0, 0, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1537, 45, 45, 45, 45 -]; - -JSONiqTokenizer.EXPECTED = -[ 290, 300, 304, 353, 296, 309, 305, 319, 315, 324, 328, 352, 354, 334, 338, 330, 320, 345, 349, 293, 358, 362, 341, 366, 312, 370, 374, 378, 382, 386, 390, 394, 398, 737, 402, 634, 439, 604, 634, 634, 634, 634, 408, 634, 634, 634, 404, 634, 634, 634, 457, 634, 634, 963, 634, 634, 413, 634, 634, 634, 634, 634, 634, 634, 663, 418, 422, 903, 902, 426, 431, 548, 634, 437, 521, 919, 443, 615, 409, 449, 455, 624, 731, 751, 634, 461, 465, 672, 470, 469, 474, 481, 485, 477, 489, 493, 629, 542, 497, 505, 603, 602, 991, 648, 510, 804, 634, 515, 958, 526, 525, 530, 768, 634, 546, 552, 711, 710, 593, 558, 562, 618, 566, 570, 574, 578, 582, 586, 590, 608, 612, 660, 822, 821, 634, 622, 596, 444, 628, 533, 724, 633, 640, 653, 647, 652, 536, 1008, 451, 450, 445, 657, 670, 676, 685, 689, 693, 697, 701, 704, 707, 715, 719, 798, 815, 634, 723, 762, 996, 634, 728, 969, 730, 735, 908, 634, 741, 679, 889, 511, 747, 634, 750, 755, 499, 666, 499, 501, 759, 772, 776, 780, 634, 787, 784, 797, 802, 809, 808, 427, 814, 1006, 517, 634, 519, 853, 634, 813, 850, 793, 634, 819, 826, 833, 832, 837, 843, 847, 857, 861, 863, 867, 871, 875, 879, 883, 643, 887, 539, 980, 979, 634, 893, 944, 634, 900, 896, 634, 907, 933, 506, 912, 917, 828, 433, 636, 635, 554, 961, 923, 930, 927, 937, 941, 634, 634, 634, 974, 948, 952, 985, 913, 968, 967, 743, 634, 973, 839, 634, 978, 599, 634, 984, 989, 765, 444, 995, 1000, 634, 1003, 790, 955, 1012, 681, 634, 634, 634, 634, 634, 414, 1016, 1020, 1024, 1085, 1027, 1090, 1090, 1046, 1080, 1137, 1108, 1215, 1049, 1032, 1039, 1085, 1085, 1085, 1085, 1058, 1062, 1068, 1085, 1086, 1090, 1090, 1091, 1072, 1064, 1107, 1090, 1090, 1090, 1118, 1123, 1138, 1078, 1074, 1084, 1085, 1085, 1085, 1087, 1090, 1062, 1052, 1060, 1114, 1062, 1104, 1085, 1085, 1090, 1090, 1028, 1122, 1063, 1128, 1139, 1127, 1158, 1085, 1085, 1151, 1090, 1090, 1090, 1095, 1090, 1132, 1073, 1136, 1143, 1061, 1150, 1085, 1155, 1098, 1101, 1146, 1162, 1169, 1101, 1185, 1151, 1090, 1110, 1173, 1054, 1087, 1109, 1177, 1165, 1089, 1204, 1184, 1107, 1189, 1193, 1088, 1197, 1180, 1201, 1208, 1042, 1212, 1219, 1223, 1227, 1231, 1235, 1245, 1777, 1527, 1686, 1686, 1238, 1686, 1254, 1686, 1686, 1686, 1294, 1669, 1686, 1686, 1686, 1322, 1625, 1534, 1268, 1624, 1275, 1281, 1443, 1292, 1300, 1686, 1686, 1686, 1350, 1826, 1306, 1686, 1686, 1240, 2032, 1317, 1321, 1686, 1686, 1253, 1686, 1326, 1686, 1686, 1686, 1418, 1709, 1446, 1686, 1686, 1686, 1492, 1686, 1295, 1447, 1686, 1686, 1258, 1686, 1736, 1686, 1686, 1520, 1355, 1686, 1288, 1348, 1361, 1686, 1359, 1686, 1364, 1498, 1368, 1302, 1362, 1381, 1389, 1395, 1486, 1686, 1371, 1377, 1370, 1686, 1375, 1382, 1384, 1402, 1408, 1385, 1383, 1619, 1413, 1423, 1428, 1433, 1686, 1686, 1270, 1686, 1338, 1686, 1440, 1686, 1686, 1686, 1499, 1465, 1686, 1686, 1686, 1639, 1473, 1884, 1686, 1686, 1293, 1864, 1686, 1686, 1296, 1321, 1483, 1686, 1686, 1686, 1646, 1686, 1748, 1496, 1686, 1418, 1675, 1686, 1418, 1702, 1686, 1418, 1981, 1686, 1429, 1409, 1427, 1504, 1692, 1686, 1686, 1313, 1448, 1651, 1508, 1686, 1686, 1340, 1686, 1903, 1686, 1686, 1435, 1513, 1686, 1283, 1287, 1519, 1686, 1524, 1363, 1568, 1938, 1539, 1566, 1579, 1479, 1533, 1538, 1553, 1544, 1552, 1557, 1563, 1574, 1557, 1583, 1589, 1590, 1759, 1594, 1603, 1607, 1611, 1686, 1436, 1514, 1686, 1434, 1656, 1686, 1434, 1680, 1686, 1453, 1686, 1686, 1686, 1559, 1617, 1686, 1770, 1418, 1623, 1769, 1629, 1686, 1515, 1335, 1686, 1285, 1686, 1671, 1921, 1650, 1686, 1686, 1344, 1308, 1666, 1686, 1686, 1686, 1659, 1685, 1686, 1686, 1686, 1686, 1241, 1686, 1686, 1844, 1691, 1686, 1630, 1977, 1970, 1362, 1686, 1686, 1686, 1693, 1698, 1686, 1686, 1686, 1697, 1686, 1764, 1715, 1686, 1634, 1638, 1686, 1599, 1585, 1686, 1271, 1686, 1269, 1686, 1721, 1686, 1686, 1354, 1686, 1801, 1686, 1799, 1686, 1640, 1686, 1686, 1461, 1686, 1686, 1732, 1686, 1944, 1686, 1740, 1686, 1746, 1415, 1396, 1686, 1598, 1547, 1417, 1597, 1416, 1577, 1546, 1397, 1577, 1547, 1548, 1570, 1398, 1753, 1686, 1652, 1509, 1686, 1686, 1686, 1757, 1686, 1419, 1686, 1763, 1418, 1768, 1781, 1686, 1686, 1686, 1705, 1686, 2048, 1792, 1686, 1686, 1686, 1735, 1686, 1797, 1686, 1686, 1404, 1686, 1639, 1815, 1686, 1686, 1418, 2017, 1820, 1686, 1686, 1803, 1686, 1686, 1686, 1736, 1489, 1686, 1686, 1825, 1338, 1260, 1263, 1686, 1686, 1785, 1686, 1686, 1728, 1686, 1686, 1749, 1497, 1830, 1830, 1262, 1248, 1261, 1329, 1260, 1264, 1329, 1248, 1249, 1259, 1540, 1849, 1842, 1686, 1686, 1835, 1686, 1686, 1816, 1686, 1686, 1831, 1882, 1848, 1686, 1686, 1686, 1774, 2071, 1854, 1686, 1686, 1469, 1884, 1686, 1821, 1859, 1686, 1686, 1350, 1883, 1686, 1686, 1686, 1781, 1391, 1875, 1686, 1686, 1613, 1644, 1686, 1686, 1889, 1686, 1686, 1662, 1884, 1686, 1885, 1890, 1686, 1686, 1686, 1894, 1686, 1686, 1678, 1686, 1907, 1686, 1686, 1529, 1914, 1686, 1838, 1686, 1686, 1881, 1686, 1686, 1872, 1876, 1836, 1919, 1686, 1837, 1692, 1910, 1686, 1925, 1928, 1742, 1686, 1811, 1811, 1930, 1810, 1929, 1935, 1928, 1900, 1942, 1867, 1868, 1931, 1035, 1788, 1948, 1952, 1956, 1960, 1964, 1686, 1976, 1686, 1686, 1686, 2065, 1686, 1992, 2037, 1686, 1686, 1998, 2009, 1972, 2002, 1686, 1686, 1686, 2077, 1300, 2023, 1686, 1686, 1686, 1807, 2031, 1686, 1686, 1686, 1860, 1500, 2032, 1686, 1686, 1686, 2083, 1686, 2036, 1686, 1277, 1276, 2042, 1877, 1686, 1686, 2041, 1686, 1686, 2027, 2037, 2012, 1686, 2012, 1855, 1850, 1686, 2046, 1686, 1686, 2054, 1996, 1686, 1897, 1309, 2059, 2052, 1686, 2058, 1686, 1686, 2081, 1686, 1717, 1477, 1686, 1331, 1686, 1686, 1687, 1686, 1860, 1681, 1686, 1686, 1686, 1966, 1724, 1686, 1686, 1686, 1984, 2015, 1686, 1686, 1686, 1988, 1686, 2063, 1686, 1686, 1686, 2005, 1686, 1727, 1686, 1686, 1711, 1457, 2069, 1686, 1686, 1686, 2019, 2075, 1686, 1686, 1915, 1686, 1686, 1793, 1874, 1686, 1686, 1491, 1362, 1449, 1686, 1686, 1460, 2098, 2087, 2091, 2095, 2184, 2102, 2113, 2780, 2117, 2134, 2142, 2281, 2146, 2146, 2146, 2304, 2296, 2181, 2639, 2591, 2872, 2592, 2873, 2313, 2195, 2200, 2281, 2146, 2273, 2226, 2204, 2152, 2219, 2276, 2167, 2177, 2276, 2235, 2276, 2276, 2230, 2281, 2276, 2296, 2276, 2293, 2276, 2276, 2276, 2276, 2234, 2276, 2311, 2314, 2210, 2199, 2217, 2222, 2276, 2276, 2276, 2240, 2276, 2294, 2276, 2276, 2173, 2276, 2198, 2281, 2281, 2281, 2281, 2282, 2146, 2146, 2146, 2146, 2205, 2146, 2204, 2248, 2276, 2235, 2276, 2297, 2276, 2276, 2276, 2277, 2256, 2281, 2283, 2146, 2146, 2146, 2275, 2276, 2295, 2276, 2276, 2293, 2146, 2304, 2264, 2269, 2221, 2276, 2276, 2276, 2293, 2295, 2276, 2276, 2276, 2295, 2263, 2205, 2268, 2220, 2172, 2276, 2276, 2276, 2296, 2276, 2276, 2296, 2294, 2276, 2276, 2278, 2281, 2281, 2280, 2281, 2281, 2281, 2283, 2206, 2223, 2276, 2276, 2279, 2281, 2281, 2146, 2273, 2276, 2276, 2281, 2281, 2281, 2276, 2292, 2276, 2298, 2225, 2276, 2298, 2169, 2224, 2292, 2298, 2171, 2229, 2281, 2281, 2171, 2236, 2281, 2281, 2281, 2146, 2275, 2225, 2292, 2299, 2276, 2229, 2281, 2146, 2276, 2290, 2297, 2283, 2146, 2146, 2274, 2224, 2227, 2298, 2225, 2297, 2276, 2230, 2170, 2230, 2282, 2146, 2147, 2151, 2156, 2288, 2276, 2230, 2303, 2308, 2236, 2284, 2228, 2318, 2318, 2318, 2326, 2335, 2339, 2343, 2349, 2416, 2693, 2357, 2592, 2109, 2592, 2592, 2162, 2943, 2823, 2646, 2592, 2361, 2592, 2122, 2592, 2592, 2122, 2470, 2592, 2592, 2592, 2109, 2107, 2592, 2592, 2592, 2123, 2592, 2592, 2592, 2125, 2592, 2413, 2592, 2592, 2592, 2127, 2592, 2592, 2414, 2592, 2592, 2592, 2130, 2952, 2592, 2594, 2592, 2592, 2212, 2609, 2252, 2592, 2592, 2592, 2446, 2434, 2592, 2592, 2592, 2212, 2446, 2450, 2456, 2431, 2435, 2592, 2592, 2243, 2478, 2448, 2439, 2946, 2592, 2592, 2592, 2368, 2809, 2813, 2450, 2441, 2212, 2812, 2449, 2440, 2947, 2592, 2592, 2592, 2345, 2451, 2457, 2948, 2592, 2124, 2592, 2592, 2650, 2823, 2449, 2455, 2946, 2592, 2128, 2592, 2592, 2649, 2952, 2592, 2810, 2448, 2461, 2991, 2467, 2592, 2592, 2329, 2817, 2474, 2990, 2466, 2592, 2592, 2373, 2447, 2992, 2469, 2592, 2592, 2592, 2373, 2447, 2477, 2468, 2592, 2592, 2353, 2469, 2592, 2495, 2592, 2592, 2415, 2483, 2592, 2415, 2496, 2592, 2592, 2352, 2592, 2592, 2352, 2352, 2469, 2592, 2592, 2363, 2331, 2494, 2592, 2592, 2592, 2375, 2592, 2375, 2415, 2504, 2592, 2592, 2367, 2372, 2503, 2592, 2592, 2592, 2389, 2418, 2415, 2592, 2592, 2373, 2592, 2592, 2592, 2593, 2732, 2417, 2415, 2592, 2417, 2520, 2592, 2592, 2592, 2390, 2521, 2521, 2592, 2592, 2592, 2401, 2599, 2585, 2526, 2531, 2120, 2592, 2212, 2426, 2450, 2463, 2948, 2592, 2592, 2592, 2213, 2389, 2527, 2532, 2121, 2542, 2551, 2105, 2592, 2213, 2592, 2592, 2592, 2558, 2538, 2544, 2553, 2557, 2537, 2543, 2552, 2421, 2572, 2576, 2546, 2543, 2547, 2592, 2592, 2373, 2615, 2575, 2545, 2105, 2592, 2244, 2479, 2592, 2129, 2592, 2592, 2628, 2690, 2469, 2562, 2566, 2592, 2592, 2592, 2415, 2928, 2934, 2401, 2570, 2574, 2564, 2572, 2585, 2590, 2592, 2592, 2585, 2965, 2592, 2592, 2592, 2445, 2251, 2592, 2592, 2592, 2474, 2592, 2609, 2892, 2592, 2362, 2592, 2592, 2138, 2851, 2159, 2592, 2592, 2592, 2509, 2888, 2892, 2592, 2592, 2592, 2490, 2418, 2891, 2592, 2592, 2376, 2592, 2592, 2374, 2592, 2889, 2388, 2592, 2373, 2373, 2890, 2592, 2592, 2387, 2592, 2887, 2505, 2892, 2592, 2373, 2610, 2388, 2592, 2592, 2376, 2373, 2592, 2887, 2891, 2592, 2374, 2592, 2592, 2608, 2159, 2614, 2620, 2592, 2592, 2394, 2594, 2887, 2399, 2592, 2887, 2397, 2508, 2374, 2507, 2592, 2375, 2592, 2592, 2592, 2595, 2508, 2506, 2592, 2506, 2505, 2505, 2592, 2507, 2637, 2505, 2592, 2592, 2401, 2661, 2592, 2643, 2592, 2592, 2417, 2592, 2655, 2592, 2592, 2592, 2510, 2414, 2656, 2592, 2592, 2592, 2516, 2592, 2593, 2660, 2665, 2880, 2592, 2592, 2592, 2522, 2767, 2666, 2881, 2592, 2592, 2420, 2571, 2696, 2592, 2592, 2592, 2580, 2572, 2686, 2632, 2698, 2592, 2383, 2514, 2592, 2163, 2932, 2465, 2685, 2631, 2697, 2592, 2388, 2592, 2592, 2212, 2604, 2671, 2632, 2678, 2592, 2401, 2405, 2409, 2592, 2592, 2592, 2679, 2592, 2592, 2592, 2592, 2108, 2677, 2591, 2592, 2592, 2592, 2419, 2592, 2683, 2187, 2191, 2469, 2671, 2189, 2467, 2592, 2401, 2629, 2633, 2702, 2468, 2592, 2592, 2421, 2536, 2703, 2469, 2592, 2592, 2422, 2573, 2593, 2672, 2467, 2592, 2402, 2406, 2592, 2402, 2979, 2592, 2592, 2626, 2673, 2467, 2592, 2446, 2259, 2947, 2592, 2377, 2709, 2592, 2592, 2522, 2862, 2713, 2468, 2592, 2592, 2581, 2572, 2562, 2374, 2374, 2592, 2376, 2721, 2724, 2592, 2592, 2624, 2373, 2731, 2592, 2592, 2592, 2626, 2732, 2592, 2592, 2592, 2755, 2656, 2726, 2736, 2741, 2592, 2486, 2593, 2381, 2592, 2727, 2737, 2742, 2715, 2747, 2753, 2592, 2498, 2469, 2873, 2743, 2592, 2592, 2592, 2791, 2759, 2763, 2592, 2592, 2627, 2704, 2592, 2592, 2522, 2789, 2593, 2761, 2753, 2592, 2498, 2863, 2592, 2592, 2767, 2592, 2592, 2592, 2792, 2789, 2592, 2592, 2592, 2803, 2126, 2592, 2592, 2592, 2811, 2122, 2592, 2592, 2592, 2834, 2777, 2592, 2592, 2592, 2848, 2936, 2591, 2489, 2797, 2592, 2592, 2670, 2631, 2490, 2798, 2592, 2592, 2592, 2963, 2807, 2592, 2592, 2592, 2965, 2838, 2592, 2592, 2592, 2975, 2330, 2818, 2829, 2592, 2498, 2939, 2592, 2498, 2592, 2791, 2331, 2819, 2830, 2592, 2592, 2592, 2982, 2834, 2817, 2828, 2106, 2592, 2592, 2592, 2405, 2405, 2817, 2828, 2592, 2592, 2415, 2849, 2842, 2592, 2522, 2773, 2592, 2522, 2868, 2592, 2580, 2600, 2586, 2137, 2850, 2843, 2592, 2592, 2855, 2937, 2844, 2592, 2592, 2592, 2987, 2936, 2591, 2592, 2592, 2684, 2630, 2592, 2856, 2938, 2592, 2592, 2860, 2939, 2592, 2592, 2872, 2592, 2861, 2591, 2592, 2592, 2887, 2616, 2592, 2867, 2592, 2592, 2708, 2592, 2498, 2469, 2498, 2497, 2785, 2773, 2499, 2783, 2770, 2877, 2877, 2877, 2772, 2592, 2592, 2345, 2885, 2592, 2592, 2592, 2715, 2762, 2515, 2896, 2592, 2592, 2715, 2917, 2516, 2897, 2592, 2592, 2592, 2901, 2906, 2911, 2592, 2592, 2956, 2960, 2715, 2902, 2907, 2912, 2593, 2916, 2920, 2820, 2922, 2822, 2592, 2592, 2715, 2927, 2921, 2821, 2106, 2592, 2592, 2974, 2408, 2321, 2821, 2106, 2592, 2592, 2983, 2592, 2593, 2404, 2408, 2592, 2592, 2717, 2749, 2716, 2928, 2322, 2822, 2593, 2926, 2919, 2820, 2934, 2823, 2592, 2592, 2592, 2651, 2824, 2592, 2592, 2592, 2130, 2952, 2592, 2592, 2592, 2592, 2964, 2592, 2592, 2716, 2748, 2592, 2969, 2592, 2592, 2716, 2918, 2368, 2970, 2592, 2592, 2592, 2403, 2407, 2592, 2592, 2787, 2211, 2404, 2409, 2592, 2592, 2802, 2837, 2987, 2592, 2592, 2592, 2809, 2427, 2592, 2793, 2592, 2592, 2809, 2447, 1073741824, 0x80000000, 539754496, 542375936, 402653184, 554434560, 571736064, 545521856, 268451840, 335544320, 268693630, 512, 2048, 256, 1024, 0, 1024, 0, 1073741824, 0x80000000, 0, 0, 0, 8388608, 0, 0, 1073741824, 1073741824, 0, 0x80000000, 537133056, 4194304, 1048576, 268435456, -1073741824, 0, 0, 0, 1048576, 0, 0, 0, 1572864, 0, 0, 0, 4194304, 0, 134217728, 16777216, 0, 0, 32, 64, 98304, 0, 33554432, 8388608, 192, 67108864, 67108864, 67108864, 67108864, 16, 32, 4, 0, 8192, 196608, 196608, 229376, 80, 4096, 524288, 8388608, 0, 0, 32, 128, 256, 24576, 24600, 24576, 24576, 2, 24576, 24576, 24576, 24584, 24592, 24576, 24578, 24576, 24578, 24576, 24576, 16, 512, 2048, 2048, 256, 4096, 32768, 1048576, 4194304, 67108864, 134217728, 268435456, 262144, 134217728, 0, 128, 128, 64, 16384, 16384, 16384, 67108864, 32, 32, 4, 4, 4096, 262144, 134217728, 0, 0, 0, 2, 0, 8192, 131072, 131072, 4096, 4096, 4096, 4096, 24576, 24576, 24576, 8, 8, 24576, 24576, 16384, 16384, 16384, 24576, 24584, 24576, 24576, 24576, 16384, 24576, 536870912, 262144, 0, 0, 32, 2048, 8192, 4, 4096, 4096, 4096, 786432, 8388608, 16777216, 0, 128, 16384, 16384, 16384, 32768, 65536, 2097152, 32, 32, 32, 32, 4, 4, 4, 4, 4, 4096, 67108864, 67108864, 67108864, 24576, 24576, 24576, 24576, 0, 16384, 16384, 16384, 16384, 67108864, 67108864, 8, 67108864, 24576, 8, 8, 8, 24576, 24576, 24576, 24578, 24576, 24576, 24576, 2, 2, 2, 16384, 67108864, 67108864, 67108864, 32, 67108864, 8, 8, 24576, 2048, 0x80000000, 536870912, 262144, 262144, 262144, 67108864, 8, 24576, 16384, 32768, 1048576, 4194304, 25165824, 67108864, 24576, 32770, 2, 4, 112, 512, 98304, 524288, 50, 402653186, 1049090, 1049091, 10, 66, 100925514, 10, 66, 12582914, 0, 0, -1678194207, -1678194207, -1041543218, 0, 32768, 0, 0, 32, 65536, 268435456, 1, 1, 513, 1048577, 0, 12582912, 0, 0, 0, 4, 1792, 0, 0, 0, 7, 29360128, 0, 0, 0, 8, 0, 0, 0, 12, 1, 1, 0, 0, -604102721, -604102721, 4194304, 8388608, 0, 0, 0, 31, 925600, 997981306, 997981306, 997981306, 0, 0, 2048, 8388608, 0, 0, 1, 2, 4, 32, 64, 512, 8192, 0, 0, 0, 245760, 997720064, 0, 0, 0, 32, 0, 0, 0, 3, 12, 16, 32, 8, 112, 3072, 12288, 16384, 32768, 65536, 131072, 7864320, 16777216, 973078528, 0, 0, 65536, 131072, 3670016, 4194304, 16777216, 33554432, 2, 8, 48, 2048, 8192, 16384, 32768, 65536, 131072, 524288, 131072, 524288, 3145728, 4194304, 16777216, 33554432, 65536, 131072, 2097152, 4194304, 16777216, 33554432, 134217728, 268435456, 536870912, 0, 0, 0, 1024, 0, 8, 48, 2048, 8192, 65536, 33554432, 268435456, 536870912, 65536, 268435456, 536870912, 0, 0, 32768, 0, 0, 126, 623104, 65011712, 0, 32, 65536, 536870912, 0, 0, 65536, 524288, 0, 32, 65536, 0, 0, 0, 2048, 0, 0, 0, 15482, 245760, -604102721, 0, 0, 0, 18913, 33062912, 925600, -605028352, 0, 0, 0, 65536, 31, 8096, 131072, 786432, 3145728, 3145728, 12582912, 50331648, 134217728, 268435456, 160, 256, 512, 7168, 131072, 786432, 131072, 786432, 1048576, 2097152, 12582912, 16777216, 268435456, 1073741824, 0x80000000, 12582912, 16777216, 33554432, 268435456, 1073741824, 0x80000000, 3, 12, 16, 160, 256, 7168, 786432, 1048576, 12582912, 16777216, 268435456, 1073741824, 0, 8, 16, 32, 128, 256, 512, 7168, 786432, 1048576, 2097152, 0, 1, 2, 8, 16, 7168, 786432, 1048576, 8388608, 16777216, 16777216, 1073741824, 0, 0, 0, 0, 1, 0, 0, 8, 32, 128, 256, 7168, 8, 32, 0, 3072, 0, 8, 32, 3072, 4096, 524288, 8, 32, 0, 0, 3072, 4096, 0, 2048, 524288, 8388608, 8, 2048, 0, 0, 1, 12, 256, 4096, 32768, 262144, 1048576, 4194304, 67108864, 0, 2048, 0, 2048, 2048, 1073741824, -58805985, -58805985, -58805985, 0, 0, 262144, 0, 0, 32, 4194304, 16777216, 134217728, 4382, 172032, -58982400, 0, 0, 2, 28, 256, 4096, 8192, 8192, 32768, 131072, 262144, 524288, 1, 2, 12, 256, 4096, 0, 0, 4194304, 67108864, 134217728, 805306368, 1073741824, 0, 0, 1, 2, 12, 16, 256, 4096, 1048576, 67108864, 134217728, 268435456, 0, 512, 1048576, 4194304, 201326592, 1879048192, 0, 0, 12, 256, 4096, 134217728, 268435456, 536870912, 12, 256, 268435456, 536870912, 0, 12, 256, 0, 0, 1, 32, 64, 512, 0, 0, 205236961, 205236961, 0, 0, 0, 1, 96, 640, 1, 10976, 229376, 204996608, 0, 640, 2048, 8192, 229376, 1572864, 1572864, 2097152, 201326592, 0, 0, 0, 64, 512, 2048, 229376, 1572864, 201326592, 1572864, 201326592, 0, 0, 1, 4382, 0, 1, 32, 2048, 65536, 131072, 1572864, 201326592, 131072, 1572864, 134217728, 0, 0, 524288, 524288, 0, 0, 0, -68582786, -68582786, -68582786, 0, 0, 2097152, 524288, 0, 524288, 0, 0, 65536, 131072, 1572864, 0, 0, 2, 4, 0, 0, 65011712, -134217728, 0, 0, 0, 0, 2, 4, 120, 512, -268435456, 0, 0, 0, 2, 8, 48, 64, 2048, 8192, 98304, 524288, 2097152, 4194304, 25165824, 33554432, 134217728, 268435456, 0x80000000, 0, 0, 25165824, 33554432, 134217728, 1879048192, 0x80000000, 0, 0, 4, 112, 512, 622592, 65011712, 134217728, -268435456, 16777216, 33554432, 134217728, 1610612736, 0, 0, 0, 64, 98304, 524288, 4194304, 16777216, 33554432, 0, 98304, 524288, 16777216, 33554432, 0, 65536, 524288, 33554432, 536870912, 1073741824, 0, 65536, 524288, 536870912, 1073741824, 0, 0, 65536, 524288, 536870912, 0, 524288, 0, 524288, 524288, 1048576, 2086666240, 0x80000000, 0, -1678194207, 0, 0, 0, 8, 32, 2048, 524288, 8388608, 0, 0, 33062912, 436207616, 0x80000000, 0, 0, 32, 64, 2432, 16384, 32768, 32768, 524288, 3145728, 4194304, 25165824, 25165824, 167772160, 268435456, 0x80000000, 0, 32, 64, 384, 2048, 16384, 32768, 1048576, 2097152, 4194304, 25165824, 32, 64, 128, 256, 2048, 16384, 2048, 16384, 1048576, 4194304, 16777216, 33554432, 134217728, 536870912, 1073741824, 0, 0, 2048, 16384, 4194304, 16777216, 33554432, 134217728, 805306368, 0, 0, 16777216, 134217728, 268435456, 0x80000000, 0, 622592, 622592, 622592, 8807, 8807, 434791, 0, 0, 16777216, 0, 0, 0, 7, 608, 8192, 0, 0, 0, 3, 4, 96, 512, 32, 64, 8192, 0, 0, 16777216, 134217728, 0, 0, 2, 4, 8192, 16384, 65536, 2097152, 33554432, 268435456 -]; - -JSONiqTokenizer.TOKEN = -[ - "(0)", - "ModuleDecl", - "Annotation", - "OptionDecl", - "Operator", - "Variable", - "Tag", - "EndTag", - "PragmaContents", - "DirCommentContents", - "DirPIContents", - "CDataSectionContents", - "AttrTest", - "Wildcard", - "EQName", - "IntegerLiteral", - "DecimalLiteral", - "DoubleLiteral", - "PredefinedEntityRef", - "'\"\"'", - "EscapeApos", - "QuotChar", - "AposChar", - "ElementContentChar", - "QuotAttrContentChar", - "AposAttrContentChar", - "NCName", - "QName", - "S", - "CharRef", - "CommentContents", - "DocTag", - "DocCommentContents", - "EOF", - "'!'", - "'\"'", - "'#'", - "'#)'", - "''''", - "'('", - "'(#'", - "'(:'", - "'(:~'", - "')'", - "'*'", - "'*'", - "','", - "'-->'", - "'.'", - "'/'", - "'/>'", - "':'", - "':)'", - "';'", - "'", next : "start"}, - {defaultToken : "comment"} - ], - - tag : [{ - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(<)((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)", - next: [ - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : "start"} - ] - }, { - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(", next : "start"} - ] - }], - - space : [ - {token : "text", regex : "\\s+"} - ], - - reference : [{ - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, { - token : "invalid.illegal", regex : "&" - }], - - string: [{ - token : "string", - regex : "'", - push : "qstring_inner" - }, { - token : "string", - regex : '"', - push : "qqstring_inner" - }], - - qstring_inner: [ - {token : "string", regex: "'", next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - qqstring_inner: [ - {token : "string", regex: '"', next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - attributes: [{ - token : "entity.other.attribute-name", - regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+" - }, { - token : "keyword.operator.separator", - regex : "=" - }, { - include : "space" - }, { - include : "string" - }] - }; - - if (this.constructor === XmlHighlightRules) - this.normalizeRules(); -}; - - -(function() { - - this.embedTagRules = function(HighlightRules, prefix, tag){ - this.$rules.tag.unshift({ - token : ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(<)(" + tag + ")", - next: [ - {include : "space"}, - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : prefix + "start"} - ] - }); - - this.$rules[tag + "-end"] = [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next: "start", - onMatch : function(value, currentState, stack) { - stack.splice(0); - return this.token; - }} - ] - - this.embedRules(HighlightRules, prefix, [{ - token: ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(" - }]); - }; - -}).call(TextHighlightRules.prototype); - -oop.inherits(XmlHighlightRules, TextHighlightRules); - -exports.XmlHighlightRules = XmlHighlightRules; -}); - -define('ace/mode/xml_util', ['require', 'exports', 'module' ], function(require, exports, module) { - - -function string(state) { - return [{ - token : "string", - regex : '"', - next : state + "_qqstring" - }, { - token : "string", - regex : "'", - next : state + "_qstring" - }]; -} - -function multiLineString(quote, state) { - return [ - {token : "string", regex : quote, next : state}, - { - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, - {defaultToken : "string"} - ]; -} - -exports.tag = function(states, name, nextState, tagMap) { - states[name] = [{ - token : "text", - regex : "\\s+" - }, { - - token : !tagMap ? "meta.tag.tag-name" : function(value) { - if (tagMap[value]) - return "meta.tag.tag-name." + tagMap[value]; - else - return "meta.tag.tag-name"; - }, - regex : "[-_a-zA-Z0-9:]+", - next : name + "_embed_attribute_list" - }, { - token: "empty", - regex: "", - next : 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"] = [{ - token : "meta.tag.r", - regex : "/?>", - next : nextState - }, { - token : "keyword.operator", - regex : "=" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "text", - regex : "\\s+" - }].concat(string(name)); -}; - -}); -define('ace/mode/java_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var JavaHighlightRules = function() { - var keywords = ( - "abstract|continue|for|new|switch|" + - "assert|default|goto|package|synchronized|" + - "boolean|do|if|private|this|" + - "break|double|implements|protected|throw|" + - "byte|else|import|public|throws|" + - "case|enum|instanceof|return|transient|" + - "catch|extends|int|short|try|" + - "char|final|interface|static|void|" + - "class|finally|long|strictfp|volatile|" + - "const|float|native|super|while" - ); - - var buildinConstants = ("null|Infinity|NaN|undefined"); - - - var langClasses = ( - "AbstractMethodError|AssertionError|ClassCircularityError|"+ - "ClassFormatError|Deprecated|EnumConstantNotPresentException|"+ - "ExceptionInInitializerError|IllegalAccessError|"+ - "IllegalThreadStateException|InstantiationError|InternalError|"+ - "NegativeArraySizeException|NoSuchFieldError|Override|Process|"+ - "ProcessBuilder|SecurityManager|StringIndexOutOfBoundsException|"+ - "SuppressWarnings|TypeNotPresentException|UnknownError|"+ - "UnsatisfiedLinkError|UnsupportedClassVersionError|VerifyError|"+ - "InstantiationException|IndexOutOfBoundsException|"+ - "ArrayIndexOutOfBoundsException|CloneNotSupportedException|"+ - "NoSuchFieldException|IllegalArgumentException|NumberFormatException|"+ - "SecurityException|Void|InheritableThreadLocal|IllegalStateException|"+ - "InterruptedException|NoSuchMethodException|IllegalAccessException|"+ - "UnsupportedOperationException|Enum|StrictMath|Package|Compiler|"+ - "Readable|Runtime|StringBuilder|Math|IncompatibleClassChangeError|"+ - "NoSuchMethodError|ThreadLocal|RuntimePermission|ArithmeticException|"+ - "NullPointerException|Long|Integer|Short|Byte|Double|Number|Float|"+ - "Character|Boolean|StackTraceElement|Appendable|StringBuffer|"+ - "Iterable|ThreadGroup|Runnable|Thread|IllegalMonitorStateException|"+ - "StackOverflowError|OutOfMemoryError|VirtualMachineError|"+ - "ArrayStoreException|ClassCastException|LinkageError|"+ - "NoClassDefFoundError|ClassNotFoundException|RuntimeException|"+ - "Exception|ThreadDeath|Error|Throwable|System|ClassLoader|"+ - "Cloneable|Class|CharSequence|Comparable|String|Object" - ); - - var keywordMapper = this.createKeywordMapper({ - "variable.language": "this", - "keyword": keywords, - "constant.language": buildinConstants, - "support.function": langClasses - }, "identifier"); - - this.$rules = { - "start" : [ - { - token : "comment", - regex : "\\/\\/.*$" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment" - }, { - token : "string.regexp", - regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - token : "constant.numeric", // hex - regex : "0[xX][0-9a-fA-F]+\\b" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "constant.language.boolean", - regex : "(?:true|false)\\b" - }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" - }, { - token : "keyword.operator", - regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" - }, { - token : "lparen", - regex : "[[({]" - }, { - token : "rparen", - regex : "[\\])}]" - }, { - token : "text", - regex : "\\s+" - } - ], - "comment" : [ - { - token : "comment", // closing comment - regex : ".*?\\*\\/", - next : "start" - }, { - token : "comment", // comment spanning whole line - regex : ".+" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("start") ]); -}; - -oop.inherits(JavaHighlightRules, TextHighlightRules); - -exports.JavaHighlightRules = JavaHighlightRules; -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); diff --git a/addons/editor/ace/mode-jsx.js b/addons/editor/ace/mode-jsx.js deleted file mode 100644 index c9fd0493..00000000 --- a/addons/editor/ace/mode-jsx.js +++ /dev/null @@ -1,635 +0,0 @@ -define('ace/mode/jsx', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/jsx_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var JsxHighlightRules = require("./jsx_highlight_rules").JsxHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -function Mode() { - this.HighlightRules = JsxHighlightRules; - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - this.foldingRules = new CStyleFoldMode(); -} -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().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; - }; - - 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; -}); -define('ace/mode/jsx_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var JsxHighlightRules = function() { - var keywords = lang.arrayToMap( - ("break|do|instanceof|typeof|case|else|new|var|catch|finally|return|void|continue|for|switch|default|while|function|this|" + - "if|throw|" + - "delete|in|try|" + - "class|extends|super|import|from|into|implements|interface|static|mixin|override|abstract|final|" + - "number|int|string|boolean|variant|" + - "log|assert").split("|") - ); - - var buildinConstants = lang.arrayToMap( - ("null|true|false|NaN|Infinity|__FILE__|__LINE__|undefined").split("|") - ); - - var reserved = lang.arrayToMap( - ("debugger|with|" + - "const|export|" + - "let|private|public|yield|protected|" + - "extern|native|as|operator|__fake__|__readonly__").split("|") - ); - - var identifierRe = "[a-zA-Z_][a-zA-Z0-9_]*\\b"; - - this.$rules = { - "start" : [ - { - token : "comment", - regex : "\\/\\/.*$" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment" - }, { - token : "string.regexp", - regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - token : "constant.numeric", // hex - regex : "0[xX][0-9a-fA-F]+\\b" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "constant.language.boolean", - regex : "(?:true|false)\\b" - }, { - token : [ - "storage.type", - "text", - "entity.name.function" - ], - regex : "(function)(\\s+)(" + identifierRe + ")" - }, { - token : function(value) { - if (value == "this") - return "variable.language"; - else if (value == "function") - return "storage.type"; - else if (keywords.hasOwnProperty(value) || reserved.hasOwnProperty(value)) - return "keyword"; - else if (buildinConstants.hasOwnProperty(value)) - return "constant.language"; - else if (/^_?[A-Z][a-zA-Z0-9_]*$/.test(value)) - return "language.support.class"; - else - return "identifier"; - }, - regex : identifierRe - }, { - token : "keyword.operator", - regex : "!|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" - }, { - token : "punctuation.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 - regex : ".+" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("start") ]); -}; - -oop.inherits(JsxHighlightRules, TextHighlightRules); - -exports.JsxHighlightRules = JsxHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); diff --git a/addons/editor/ace/mode-less.js b/addons/editor/ace/mode-less.js deleted file mode 100644 index a825922e..00000000 --- a/addons/editor/ace/mode-less.js +++ /dev/null @@ -1,807 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2010, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ - -define('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/behaviour/css', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -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 CssBehaviour = require("./behaviour/css").CssBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = LessHighlightRules; - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CssBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - var tokens = this.getTokenizer().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; - -}); - -define('ace/mode/less_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -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("|"); - var ret = []; - for (var i=0, ln=browserPrefix.length; i|<=|>=|==|!=|-|%|#|\\+|\\$|\\+|\\*" - }, { - token : "paren.lparen", - regex : "[[({]" - }, { - token : "paren.rparen", - regex : "[\\])}]" - }, { - token : "text", - regex : "\\s+" - }, { - caseInsensitive: true - } - ], - "comment" : [ - { - token : "comment", // closing comment - regex : ".*?\\*\\/", - next : "start" - }, { - token : "comment", // comment spanning whole line - regex : ".+" - } - ] - }; -}; - -oop.inherits(LessHighlightRules, TextHighlightRules); - -exports.LessHighlightRules = LessHighlightRules; - -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; - -var CssBehaviour = function () { - - this.inherit(CstyleBehaviour); - - this.add("colon", "insertion", function (state, action, editor, session, text) { - if (text === ':') { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - var token = iterator.getCurrentToken(); - if (token && token.value.match(/\s+/)) { - token = iterator.stepBackward(); - } - if (token && token.type === 'support.type') { - var line = session.doc.getLine(cursor.row); - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar === ':') { - return { - text: '', - selection: [1, 1] - } - } - if (!line.substring(cursor.column).match(/^\s*;/)) { - return { - text: ':;', - selection: [1, 1] - } - } - } - } - }); - - this.add("colon", "deletion", function (state, action, editor, session, range) { - var selected = session.doc.getTextRange(range); - if (!range.isMultiLine() && selected === ':') { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - var token = iterator.getCurrentToken(); - if (token && token.value.match(/\s+/)) { - token = iterator.stepBackward(); - } - if (token && token.type === 'support.type') { - 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("semicolon", "insertion", function (state, action, editor, session, text) { - if (text === ';') { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar === ';') { - return { - text: '', - selection: [1, 1] - } - } - } - }); - -} -oop.inherits(CssBehaviour, CstyleBehaviour); - -exports.CssBehaviour = CssBehaviour; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); diff --git a/addons/editor/ace/mode-liquid.js b/addons/editor/ace/mode-liquid.js deleted file mode 100644 index c320ed53..00000000 --- a/addons/editor/ace/mode-liquid.js +++ /dev/null @@ -1,1062 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2010, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/mode/liquid', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/liquid_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range'], function(require, exports, module) { - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var LiquidHighlightRules = require("./liquid_highlight_rules").LiquidHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var Range = require("../range").Range; - -var Mode = function() { - this.HighlightRules = LiquidHighlightRules; - this.$outdent = new MatchingBraceOutdent(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.blockComment = {start: ""}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().getLineTokens(line, state); - var tokens = tokenizedLine.tokens; - var endState = tokenizedLine.state; - - 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; - }; - - 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; -}); - -define('ace/mode/liquid_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules', 'ace/mode/html_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; - -var LiquidHighlightRules = function() { - HtmlHighlightRules.call(this); - var functions = ( - "date|capitalize|downcase|upcase|first|last|join|sort|map|size|escape|" + - "escape_once|strip_html|strip_newlines|newline_to_br|replace|replace_first|" + - "truncate|truncatewords|prepend|append|minus|plus|times|divided_by|split" - ); - - var keywords = ( - "capture|endcapture|case|endcase|when|comment|endcomment|" + - "cycle|for|endfor|in|reversed|if|endif|else|elsif|include|endinclude|unless|endunless|" + - "style|text|image|widget|plugin|marker|endmarker|tablerow|endtablerow" - ); - - var builtinVariables = 'forloop|tablerowloop'; - - var definitions = ("assign"); - - var keywordMapper = this.createKeywordMapper({ - "variable.language": builtinVariables, - "keyword": keywords, - "support.function": functions, - "keyword.definition": definitions - }, "identifier"); - for (var rule in this.$rules) { - this.$rules[rule].unshift({ - token : "variable", - regex : "{%", - push : "liquid-start" - }, { - token : "variable", - regex : "{{", - push : "liquid-start" - }); - } - - this.addRules({ - "liquid-start" : [{ - token: "variable", - regex: "}}", - next: "pop" - }, { - token: "variable", - regex: "%}", - next: "pop" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - token : "constant.numeric", // hex - regex : "0[xX][0-9a-fA-F]+\\b" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "constant.language.boolean", - regex : "(?:true|false)\\b" - }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" - }, { - token : "keyword.operator", - regex : "\/|\\*|\\-|\\+|=|!=|\\?\\:" - }, { - token : "paren.lparen", - regex : /[\[\({]/ - }, { - token : "paren.rparen", - regex : /[\])}]/ - }, { - token : "text", - regex : "\\s+" - }] - }); - - this.normalizeRules(); -}; -oop.inherits(LiquidHighlightRules, TextHighlightRules); - -exports.LiquidHighlightRules = LiquidHighlightRules; -}); - -define('ace/mode/html_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/css_highlight_rules', 'ace/mode/javascript_highlight_rules', 'ace/mode/xml_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; - -var tagMap = lang.createMap({ - a : 'anchor', - button : 'form', - form : 'form', - img : 'image', - input : 'form', - label : 'form', - option : 'form', - script : 'script', - select : 'form', - textarea : 'form', - style : 'style', - table : 'table', - tbody : 'table', - td : 'table', - tfoot : 'table', - th : 'table', - tr : 'table' -}); - -var HtmlHighlightRules = function() { - XmlHighlightRules.call(this); - - this.addRules({ - attributes: [{ - include : "space" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "keyword.operator.separator", - regex : "=", - push : [{ - include: "space" - }, { - token : "string", - regex : "[^<>='\"`\\s]+", - next : "pop" - }, { - token : "empty", - regex : "", - next : "pop" - }] - }, { - include : "string" - }], - tag: [{ - token : function(start, tag) { - var group = tagMap[tag]; - return ["meta.tag.punctuation.begin", - "meta.tag.name" + (group ? "." + group : "")]; - }, - regex : "(<)([-_a-zA-Z0-9:]+)", - next: "start_tag_stuff" - }, { - token : function(start, tag) { - var group = tagMap[tag]; - return ["meta.tag.punctuation.begin", - "meta.tag.name" + (group ? "." + group : "")]; - }, - regex : "(", next : "start"} - ], - end_tag_stuff: [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next : "start"} - ] - }); - - this.embedTagRules(CssHighlightRules, "css-", "style"); - this.embedTagRules(JavaScriptHighlightRules, "js-", "script"); - - if (this.constructor === HtmlHighlightRules) - this.normalizeRules(); -}; - -oop.inherits(HtmlHighlightRules, XmlHighlightRules); - -exports.HtmlHighlightRules = HtmlHighlightRules; -}); - -define('ace/mode/css_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var supportType = exports.supportType = "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"; -var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters"; -var supportConstant = exports.supportConstant = "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|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|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero"; -var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow"; -var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace"; - -var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))"; -var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b"; -var pseudoClasses = exports.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 CssHighlightRules = function() { - - var keywordMapper = this.createKeywordMapper({ - "support.function": supportFunction, - "support.constant": supportConstant, - "support.type": supportType, - "support.constant.color": supportConstantColor, - "support.constant.fonts": supportConstantFonts - }, "text", true); - - this.$rules = { - "start" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "@.*?{", - push: "media" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "media" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "\\}", - next: "pop" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "comment" : [{ - token : "comment", - regex : "\\*\\/", - next : "pop" - }, { - defaultToken : "comment" - }], - - "ruleset" : [ - { - token : "paren.rparen", - regex : "\\}", - next: "pop" - }, { - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - 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 : numRe - }, { - 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 : ["support.function", "string", "support.function"], - regex : "(url\\()(.*)(\\))" - }, { - token : keywordMapper, - regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*" - }, { - caseInsensitive: true - }] - }; - - this.normalizeRules(); -}; - -oop.inherits(CssHighlightRules, TextHighlightRules); - -exports.CssHighlightRules = CssHighlightRules; - -}); - -define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var JavaScriptHighlightRules = function() { - var keywordMapper = this.createKeywordMapper({ - "variable.language": - "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors - "Namespace|QName|XML|XMLList|" + // E4X - "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + - "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + - "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors - "SyntaxError|TypeError|URIError|" + - "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions - "isNaN|parseFloat|parseInt|" + - "JSON|Math|" + // Other - "this|arguments|prototype|window|document" , // Pseudo - "keyword": - "const|yield|import|get|set|" + - "break|case|catch|continue|default|delete|do|else|finally|for|function|" + - "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + - "__parent__|__count__|escape|unescape|with|__proto__|" + - "class|enum|extends|super|export|implements|private|public|interface|package|protected|static", - "storage.type": - "const|let|var|function", - "constant.language": - "null|Infinity|NaN|undefined", - "support.function": - "alert", - "constant.language.boolean": "true|false" - }, "identifier"); - var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; - var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\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 - ".)"; - - this.$rules = { - "no_regex" : [ - { - token : "comment", - regex : "\\/\\/", - next : "line_comment" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : /\/\*/, - next : "comment" - }, { - token : "string", - regex : "'(?=.)", - next : "qstring" - }, { - token : "string", - regex : '"(?=.)', - next : "qqstring" - }, { - token : "constant.numeric", // hex - regex : /0[xX][0-9a-fA-F]+\b/ - }, { - token : "constant.numeric", // float - regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/ - }, { - token : [ - "storage.type", "punctuation.operator", "support.function", - "punctuation.operator", "entity.name.function", "text","keyword.operator" - ], - regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "keyword.operator", "text", "storage.type", - "text", "paren.lparen" - ], - regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "punctuation.operator", - "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "text", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : "keyword", - regex : "(?:" + kwBeforeRe + ")\\b", - next : "start" - }, { - token : ["punctuation.operator", "support.function"], - regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/ - }, { - token : ["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 : keywordMapper, - regex : identifierRe - }, { - token : "keyword.operator", - regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/, - next : "start" - }, { - token : "punctuation.operator", - regex : /\?|\:|\,|\;|\./, - next : "start" - }, { - token : "paren.lparen", - regex : /[\[({]/, - next : "start" - }, { - token : "paren.rparen", - regex : /[\])}]/ - }, { - token : "keyword.operator", - regex : /\/=?/, - next : "start" - }, { - token: "comment", - regex: /^#!.*$/ - } - ], - "start": [ - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment_regex_allowed" - }, { - token : "comment", - regex : "\\/\\/", - next : "line_comment_regex_allowed" - }, { - token: "string.regexp", - regex: "\\/", - next: "regex" - }, { - token : "text", - regex : "\\s+|^$", - next : "start" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "regex": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "string.regexp", - regex: "/\\w*", - next: "no_regex" - }, { - token : "invalid", - regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ - }, { - token : "constant.language.escape", - regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/ - }, { - token : "constant.language.delimiter", - regex: /\|/ - }, { - token: "constant.language.escape", - regex: /\[\^?/, - next: "regex_character_class" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp" - } - ], - "regex_character_class": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "constant.language.escape", - regex: "]", - next: "regex" - }, { - token: "constant.language.escape", - regex: "-" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp.charachterclass" - } - ], - "function_arguments": [ - { - token: "variable.parameter", - regex: identifierRe - }, { - token: "punctuation.operator", - regex: "[, ]+" - }, { - token: "punctuation.operator", - regex: "$" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "comment_regex_allowed" : [ - {token : "comment", regex : "\\*\\/", next : "start"}, - {defaultToken : "comment"} - ], - "comment" : [ - {token : "comment", regex : "\\*\\/", next : "no_regex"}, - {defaultToken : "comment"} - ], - "line_comment_regex_allowed" : [ - {token : "comment", regex : "$|^", next : "start"}, - {defaultToken : "comment"} - ], - "line_comment" : [ - {token : "comment", regex : "$|^", next : "no_regex"}, - {defaultToken : "comment"} - ], - "qqstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qqstring" - }, { - token : "string", - regex : '"|$', - next : "no_regex" - }, { - defaultToken: "string" - } - ], - "qstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qstring" - }, { - token : "string", - regex : "'|$", - next : "no_regex" - }, { - defaultToken: "string" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("no_regex") ]); -}; - -oop.inherits(JavaScriptHighlightRules, TextHighlightRules); - -exports.JavaScriptHighlightRules = JavaScriptHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/xml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml_util', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var xmlUtil = require("./xml_util"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var XmlHighlightRules = function(normalize) { - this.$rules = { - start : [ - {token : "punctuation.string.begin", regex : "<\\!\\[CDATA\\[", next : "cdata"}, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)(xml)(?=[\\s])", next : "xml_declaration" - }, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)([-_a-zA-Z0-9]+)", next : "instruction" - }, - {token : "comment", regex : "<\\!--", next : "comment"}, - { - token : ["punctuation.doctype.begin", "meta.tag.doctype"], - regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype" - }, - {include : "tag"}, - {include : "reference"} - ], - - xml_declaration : [ - {include : "attributes"}, - {include : "instruction"} - ], - - instruction : [ - {token : "punctuation.instruction.end", regex : "\\?>", next : "start"} - ], - - doctype : [ - {include : "space"}, - {include : "string"}, - {token : "punctuation.doctype.end", regex : ">", next : "start"}, - {token : "xml-pe", regex : "[-_a-zA-Z0-9:]+"}, - {token : "punctuation.begin", regex : "\\[", push : "declarations"} - ], - - declarations : [{ - token : "text", - regex : "\\s+" - }, { - token: "punctuation.end", - regex: "]", - next: "pop" - }, { - token : ["punctuation.begin", "keyword"], - regex : "(<\\!)([-_a-zA-Z0-9]+)", - push : [{ - token : "text", - regex : "\\s+" - }, - { - token : "punctuation.end", - regex : ">", - next : "pop" - }, - {include : "string"}] - }], - - cdata : [ - {token : "string.end", regex : "\\]\\]>", next : "start"}, - {token : "text", regex : "\\s+"}, - {token : "text", regex : "(?:[^\\]]|\\](?!\\]>))+"} - ], - - comment : [ - {token : "comment", regex : "-->", next : "start"}, - {defaultToken : "comment"} - ], - - tag : [{ - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(<)((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)", - next: [ - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : "start"} - ] - }, { - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(", next : "start"} - ] - }], - - space : [ - {token : "text", regex : "\\s+"} - ], - - reference : [{ - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, { - token : "invalid.illegal", regex : "&" - }], - - string: [{ - token : "string", - regex : "'", - push : "qstring_inner" - }, { - token : "string", - regex : '"', - push : "qqstring_inner" - }], - - qstring_inner: [ - {token : "string", regex: "'", next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - qqstring_inner: [ - {token : "string", regex: '"', next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - attributes: [{ - token : "entity.other.attribute-name", - regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+" - }, { - token : "keyword.operator.separator", - regex : "=" - }, { - include : "space" - }, { - include : "string" - }] - }; - - if (this.constructor === XmlHighlightRules) - this.normalizeRules(); -}; - - -(function() { - - this.embedTagRules = function(HighlightRules, prefix, tag){ - this.$rules.tag.unshift({ - token : ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(<)(" + tag + ")", - next: [ - {include : "space"}, - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : prefix + "start"} - ] - }); - - this.$rules[tag + "-end"] = [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next: "start", - onMatch : function(value, currentState, stack) { - stack.splice(0); - return this.token; - }} - ] - - this.embedRules(HighlightRules, prefix, [{ - token: ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(" - }]); - }; - -}).call(TextHighlightRules.prototype); - -oop.inherits(XmlHighlightRules, TextHighlightRules); - -exports.XmlHighlightRules = XmlHighlightRules; -}); - -define('ace/mode/xml_util', ['require', 'exports', 'module' ], function(require, exports, module) { - - -function string(state) { - return [{ - token : "string", - regex : '"', - next : state + "_qqstring" - }, { - token : "string", - regex : "'", - next : state + "_qstring" - }]; -} - -function multiLineString(quote, state) { - return [ - {token : "string", regex : quote, next : state}, - { - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, - {defaultToken : "string"} - ]; -} - -exports.tag = function(states, name, nextState, tagMap) { - states[name] = [{ - token : "text", - regex : "\\s+" - }, { - - token : !tagMap ? "meta.tag.tag-name" : function(value) { - if (tagMap[value]) - return "meta.tag.tag-name." + tagMap[value]; - else - return "meta.tag.tag-name"; - }, - regex : "[-_a-zA-Z0-9:]+", - next : name + "_embed_attribute_list" - }, { - token: "empty", - regex: "", - next : 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"] = [{ - token : "meta.tag.r", - regex : "/?>", - next : nextState - }, { - token : "keyword.operator", - regex : "=" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "text", - regex : "\\s+" - }].concat(string(name)); -}; - -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); diff --git a/addons/editor/ace/mode-logiql.js b/addons/editor/ace/mode-logiql.js deleted file mode 100644 index e2622784..00000000 --- a/addons/editor/ace/mode-logiql.js +++ /dev/null @@ -1,663 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2012, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/mode/logiql', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/logiql_highlight_rules', 'ace/mode/folding/coffee', 'ace/token_iterator', 'ace/range', 'ace/mode/behaviour/cstyle', 'ace/mode/matching_brace_outdent'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var LogiQLHighlightRules = require("./logiql_highlight_rules").LogiQLHighlightRules; -var FoldMode = require("./folding/coffee").FoldMode; -var TokenIterator = require("../token_iterator").TokenIterator; -var Range = require("../range").Range; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; - -var Mode = function() { - this.HighlightRules = LogiQLHighlightRules; - this.foldingRules = new FoldMode(); - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); -}; -oop.inherits(Mode, TextMode); - -(function() { - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().getLineTokens(line, state); - var tokens = tokenizedLine.tokens; - var endState = tokenizedLine.state; - if (/comment|string/.test(endState)) - return indent; - if (tokens.length && tokens[tokens.length - 1].type == "comment.single") - return indent; - - var match = line.match(); - if (/(-->|<--|<-|->|{)\s*$/.test(line)) - indent += tab; - return indent; - }; - - this.checkOutdent = function(state, line, input) { - if (this.$outdent.checkOutdent(line, input)) - return true; - - if (input !== "\n" && input !== "\r\n") - return false; - - if (!/^\s+/.test(line)) - return false; - - return true; - }; - - this.autoOutdent = function(state, doc, row) { - if (this.$outdent.autoOutdent(doc, row)) - return; - var prevLine = doc.getLine(row); - var match = prevLine.match(/^\s+/); - var column = prevLine.lastIndexOf(".") + 1; - if (!match || !row || !column) return 0; - - var line = doc.getLine(row + 1); - var startRange = this.getMatching(doc, {row: row, column: column}); - if (!startRange || startRange.start.row == row) return 0; - - column = match[0].length; - var indent = this.$getIndent(doc.getLine(startRange.start.row)); - doc.replace(new Range(row + 1, 0, row + 1, column), indent); - }; - - this.getMatching = function(session, row, column) { - if (row == undefined) - row = session.selection.lead - if (typeof row == "object") { - column = row.column; - row = row.row; - } - - var startToken = session.getTokenAt(row, column); - var KW_START = "keyword.start", KW_END = "keyword.end"; - var tok; - if (!startToken) - return; - if (startToken.type == KW_START) { - var it = new TokenIterator(session, row, column); - it.step = it.stepForward; - } else if (startToken.type == KW_END) { - var it = new TokenIterator(session, row, column); - it.step = it.stepBackward; - } else - return; - - while (tok = it.step()) { - if (tok.type == KW_START || tok.type == KW_END) - break; - } - if (!tok || tok.type == startToken.type) - return; - - var col = it.getCurrentTokenColumn(); - var row = it.getCurrentTokenRow(); - return new Range(row, col, row, col + tok.value.length); - }; -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/logiql_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var LogiQLHighlightRules = function() { - - this.$rules = { start: - [ { token: 'comment.block', - regex: '/\\*', - push: - [ { token: 'comment.block', regex: '\\*/', next: 'pop' }, - { defaultToken: 'comment.block' } ], - }, - { token: 'comment.single', - regex: '//.*', - }, - { token: 'constant.numeric', - regex: '\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?[fd]?', - }, - { token: 'string', - regex: '"', - push: - [ { token: 'string', regex: '"', next: 'pop' }, - { defaultToken: 'string' } ], - }, - { token: 'constant.language', - regex: '\\b(true|false)\\b', - }, - { token: 'entity.name.type.logicblox', - regex: '`[a-zA-Z_:]+(\\d|\\a)*\\b', - }, - { token: 'keyword.start', regex: '->', comment: 'Constraint' }, - { token: 'keyword.start', regex: '-->', comment: 'Level 1 Constraint'}, - { token: 'keyword.start', regex: '<-', comment: 'Rule' }, - { token: 'keyword.start', regex: '<--', comment: 'Level 1 Rule' }, - { token: 'keyword.end', regex: '\\.', comment: 'Terminator' }, - { token: 'keyword.other', regex: '!', comment: 'Negation' }, - { token: 'keyword.other', regex: ',', comment: 'Conjunction' }, - { token: 'keyword.other', regex: ';', comment: 'Disjunction' }, - { token: 'keyword.operator', regex: '<=|>=|!=|<|>', comment: 'Equality'}, - { token: 'keyword.other', regex: '@', comment: 'Equality' }, - { token: 'keyword.operator', regex: '\\+|-|\\*|/', comment: 'Arithmetic operations'}, - { token: 'keyword', regex: '::', comment: 'Colon colon' }, - { token: 'support.function', - regex: '\\b(agg\\s*<<)', - push: - [ { include: '$self' }, - { token: 'support.function', - regex: '>>', - next: 'pop' } ], - }, - { token: 'storage.modifier', - regex: '\\b(lang:[\\w:]*)', - }, - { token: [ 'storage.type', 'text' ], - regex: '(export|sealed|clauses|block|alias)(\\s*\\()(?=`)', - }, - { token: 'entity.name', - regex: '[a-zA-Z_][a-zA-Z_0-9:]*(@prev|@init|@final)?(?=(\\(|\\[))', - }, - { token: 'variable.parameter', - regex: '([a-zA-Z][a-zA-Z_0-9]*|_)\\s*(?=(,|\\.|<-|->|\\)|\\]|=))', - } ] } - - this.normalizeRules(); -}; - -oop.inherits(LogiQLHighlightRules, TextHighlightRules); - -exports.LogiQLHighlightRules = LogiQLHighlightRules; -}); - -define('ace/mode/folding/coffee', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var BaseFoldMode = require("./fold_mode").FoldMode; -var Range = require("../../range").Range; - -var FoldMode = exports.FoldMode = function() {}; -oop.inherits(FoldMode, BaseFoldMode); - -(function() { - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var range = this.indentationBlock(session, row); - if (range) - return range; - - var re = /\S/; - var line = session.getLine(row); - var startLevel = line.search(re); - if (startLevel == -1 || line[startLevel] != "#") - return; - - var startColumn = line.length; - var maxRow = session.getLength(); - var startRow = row; - var endRow = row; - - while (++row < maxRow) { - line = session.getLine(row); - var level = line.search(re); - - if (level == -1) - continue; - - if (line[level] != "#") - break; - - endRow = row; - } - - if (endRow > startRow) { - var endColumn = session.getLine(endRow).length; - return new Range(startRow, startColumn, endRow, endColumn); - } - }; - this.getFoldWidget = function(session, foldStyle, row) { - var line = session.getLine(row); - var indent = line.search(/\S/); - var next = session.getLine(row + 1); - var prev = session.getLine(row - 1); - var prevIndent = prev.search(/\S/); - var nextIndent = next.search(/\S/); - - if (indent == -1) { - session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : ""; - return ""; - } - if (prevIndent == -1) { - if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") { - session.foldWidgets[row - 1] = ""; - session.foldWidgets[row + 1] = ""; - return "start"; - } - } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") { - if (session.getLine(row - 2).search(/\S/) == -1) { - session.foldWidgets[row - 1] = "start"; - session.foldWidgets[row + 1] = ""; - return ""; - } - } - - if (prevIndent!= -1 && prevIndent < indent) - session.foldWidgets[row - 1] = "start"; - else - session.foldWidgets[row - 1] = ""; - - if (indent < nextIndent) - return "start"; - else - return ""; - }; - -}).call(FoldMode.prototype); - -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); diff --git a/addons/editor/ace/mode-lua.js b/addons/editor/ace/mode-lua.js deleted file mode 100644 index 80fe5515..00000000 --- a/addons/editor/ace/mode-lua.js +++ /dev/null @@ -1,456 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2010, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/mode/lua', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/lua_highlight_rules', 'ace/mode/folding/lua', 'ace/range', 'ace/worker/worker_client'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var LuaHighlightRules = require("./lua_highlight_rules").LuaHighlightRules; -var LuaFoldMode = require("./folding/lua").FoldMode; -var Range = require("../range").Range; -var WorkerClient = require("../worker/worker_client").WorkerClient; - -var Mode = function() { - this.HighlightRules = LuaHighlightRules; - - this.foldingRules = new LuaFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "--"; - this.blockComment = {start: "--[", end: "]--"}; - - var indentKeywords = { - "function": 1, - "then": 1, - "do": 1, - "else": 1, - "elseif": 1, - "repeat": 1, - "end": -1, - "until": -1 - }; - var outdentKeywords = [ - "else", - "elseif", - "end", - "until" - ]; - - function getNetIndentLevel(tokens) { - var level = 0; - for (var i = 0; i < tokens.length; i++) { - var token = tokens[i]; - if (token.type == "keyword") { - if (token.value in indentKeywords) { - level += indentKeywords[token.value]; - } - } else if (token.type == "paren.lparen") { - level ++; - } else if (token.type == "paren.rparen") { - level --; - } - } - if (level < 0) { - return -1; - } else if (level > 0) { - return 1; - } else { - return 0; - } - } - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - var level = 0; - - var tokenizedLine = this.getTokenizer().getLineTokens(line, state); - var tokens = tokenizedLine.tokens; - - if (state == "start") { - level = getNetIndentLevel(tokens); - } - if (level > 0) { - return indent + tab; - } else if (level < 0 && indent.substr(indent.length - tab.length) == tab) { - if (!this.checkOutdent(state, line, "\n")) { - return indent.substr(0, indent.length - tab.length); - } - } - return indent; - }; - - this.checkOutdent = function(state, line, input) { - if (input != "\n" && input != "\r" && input != "\r\n") - return false; - - if (line.match(/^\s*[\)\}\]]$/)) - return true; - - var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens; - - if (!tokens || !tokens.length) - return false; - - return (tokens[0].type == "keyword" && outdentKeywords.indexOf(tokens[0].value) != -1); - }; - - this.autoOutdent = function(state, session, row) { - var prevLine = session.getLine(row - 1); - var prevIndent = this.$getIndent(prevLine).length; - var prevTokens = this.getTokenizer().getLineTokens(prevLine, "start").tokens; - var tabLength = session.getTabString().length; - var expectedIndent = prevIndent + tabLength * getNetIndentLevel(prevTokens); - var curIndent = this.$getIndent(session.getLine(row)).length; - if (curIndent < expectedIndent) { - return; - } - session.outdentRows(new Range(row, 0, row + 2, 0)); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/lua_worker", "Worker"); - worker.attachToDocument(session.getDocument()); - - worker.on("error", function(e) { - session.setAnnotations([e.data]); - }); - - worker.on("ok", function(e) { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/lua_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var LuaHighlightRules = function() { - - var keywords = ( - "break|do|else|elseif|end|for|function|if|in|local|repeat|"+ - "return|then|until|while|or|and|not" - ); - - var builtinConstants = ("true|false|nil|_G|_VERSION"); - - var functions = ( - "string|xpcall|package|tostring|print|os|unpack|require|"+ - "getfenv|setmetatable|next|assert|tonumber|io|rawequal|"+ - "collectgarbage|getmetatable|module|rawset|math|debug|"+ - "pcall|table|newproxy|type|coroutine|_G|select|gcinfo|"+ - "pairs|rawget|loadstring|ipairs|_VERSION|dofile|setfenv|"+ - "load|error|loadfile|"+ - - "sub|upper|len|gfind|rep|find|match|char|dump|gmatch|"+ - "reverse|byte|format|gsub|lower|preload|loadlib|loaded|"+ - "loaders|cpath|config|path|seeall|exit|setlocale|date|"+ - "getenv|difftime|remove|time|clock|tmpname|rename|execute|"+ - "lines|write|close|flush|open|output|type|read|stderr|"+ - "stdin|input|stdout|popen|tmpfile|log|max|acos|huge|"+ - "ldexp|pi|cos|tanh|pow|deg|tan|cosh|sinh|random|randomseed|"+ - "frexp|ceil|floor|rad|abs|sqrt|modf|asin|min|mod|fmod|log10|"+ - "atan2|exp|sin|atan|getupvalue|debug|sethook|getmetatable|"+ - "gethook|setmetatable|setlocal|traceback|setfenv|getinfo|"+ - "setupvalue|getlocal|getregistry|getfenv|setn|insert|getn|"+ - "foreachi|maxn|foreach|concat|sort|remove|resume|yield|"+ - "status|wrap|create|running|"+ - "__add|__sub|__mod|__unm|__concat|__lt|__index|__call|__gc|__metatable|"+ - "__mul|__div|__pow|__len|__eq|__le|__newindex|__tostring|__mode|__tonumber" - ); - - var stdLibaries = ("string|package|os|io|math|debug|table|coroutine"); - - var futureReserved = ""; - - var deprecatedIn5152 = ("setn|foreach|foreachi|gcinfo|log10|maxn"); - - var keywordMapper = this.createKeywordMapper({ - "keyword": keywords, - "support.function": functions, - "invalid.deprecated": deprecatedIn5152, - "constant.library": stdLibaries, - "constant.language": builtinConstants, - "invalid.illegal": futureReserved, - "variable.language": "this" - }, "identifier"); - - var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))"; - var hexInteger = "(?:0[xX][\\dA-Fa-f]+)"; - var integer = "(?:" + decimalInteger + "|" + hexInteger + ")"; - - var fraction = "(?:\\.\\d+)"; - var intPart = "(?:\\d+)"; - var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))"; - var floatNumber = "(?:" + pointFloat + ")"; - - this.$rules = { - "start" : [{ - stateName: "bracketedComment", - onMatch : function(value, currentState, stack){ - stack.unshift(this.next, value.length - 2, currentState); - return "comment"; - }, - regex : /\-\-\[=*\[/, - next : [ - { - onMatch : function(value, currentState, stack) { - if (value.length == stack[1]) { - stack.shift(); - stack.shift(); - this.next = stack.shift(); - } else { - this.next = ""; - } - return "comment"; - }, - regex : /\]=*\]/, - next : "start" - }, { - defaultToken : "comment" - } - ] - }, - - { - token : "comment", - regex : "\\-\\-.*$" - }, - { - stateName: "bracketedString", - onMatch : function(value, currentState, stack){ - stack.unshift(this.next, value.length, currentState); - return "comment"; - }, - regex : /\[=*\[/, - next : [ - { - onMatch : function(value, currentState, stack) { - if (value.length == stack[1]) { - stack.shift(); - stack.shift(); - this.next = stack.shift(); - } else { - this.next = ""; - } - return "comment"; - }, - - regex : /\]=*\]/, - next : "start" - }, { - defaultToken : "comment" - } - ] - }, - { - token : "string", // " string - regex : '"(?:[^\\\\]|\\\\.)*?"' - }, { - token : "string", // ' string - regex : "'(?:[^\\\\]|\\\\.)*?'" - }, { - token : "constant.numeric", // float - regex : floatNumber - }, { - token : "constant.numeric", // integer - regex : integer + "\\b" - }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" - }, { - token : "keyword.operator", - regex : "\\+|\\-|\\*|\\/|%|\\#|\\^|~|<|>|<=|=>|==|~=|=|\\:|\\.\\.\\.|\\.\\." - }, { - token : "paren.lparen", - regex : "[\\[\\(\\{]" - }, { - token : "paren.rparen", - regex : "[\\]\\)\\}]" - }, { - token : "text", - regex : "\\s+|\\w+" - } ] - }; - - this.normalizeRules(); -} - -oop.inherits(LuaHighlightRules, TextHighlightRules); - -exports.LuaHighlightRules = LuaHighlightRules; -}); - -define('ace/mode/folding/lua', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var BaseFoldMode = require("./fold_mode").FoldMode; -var Range = require("../../range").Range; -var TokenIterator = require("../../token_iterator").TokenIterator; - - -var FoldMode = exports.FoldMode = function() {}; - -oop.inherits(FoldMode, BaseFoldMode); - -(function() { - - this.foldingStartMarker = /\b(function|then|do|repeat)\b|{\s*$|(\[=*\[)/; - this.foldingStopMarker = /\bend\b|^\s*}|\]=*\]/; - - this.getFoldWidget = function(session, foldStyle, row) { - var line = session.getLine(row); - var isStart = this.foldingStartMarker.test(line); - var isEnd = this.foldingStopMarker.test(line); - - if (isStart && !isEnd) { - var match = line.match(this.foldingStartMarker); - if (match[1] == "then" && /\belseif\b/.test(line)) - return; - if (match[1]) { - if (session.getTokenAt(row, match.index + 1).type === "keyword") - return "start"; - } else if (match[2]) { - var type = session.bgTokenizer.getState(row) || ""; - if (type[0] == "bracketedComment" || type[0] == "bracketedString") - return "start"; - } else { - return "start"; - } - } - if (foldStyle != "markbeginend" || !isEnd || isStart && isEnd) - return ""; - - var match = line.match(this.foldingStopMarker); - if (match[0] === "end") { - if (session.getTokenAt(row, match.index + 1).type === "keyword") - return "end"; - } else if (match[0][0] === "]") { - var type = session.bgTokenizer.getState(row - 1) || ""; - if (type[0] == "bracketedComment" || type[0] == "bracketedString") - return "end"; - } else - return "end"; - }; - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var line = session.doc.getLine(row); - var match = this.foldingStartMarker.exec(line); - if (match) { - if (match[1]) - return this.luaBlock(session, row, match.index + 1); - - if (match[2]) - return session.getCommentFoldRange(row, match.index + 1); - - return this.openingBracketBlock(session, "{", row, match.index); - } - - var match = this.foldingStopMarker.exec(line); - if (match) { - if (match[0] === "end") { - if (session.getTokenAt(row, match.index + 1).type === "keyword") - return this.luaBlock(session, row, match.index + 1); - } - - if (match[0][0] === "]") - return session.getCommentFoldRange(row, match.index + 1); - - return this.closingBracketBlock(session, "}", row, match.index + match[0].length); - } - }; - - this.luaBlock = function(session, row, column) { - var stream = new TokenIterator(session, row, column); - var indentKeywords = { - "function": 1, - "do": 1, - "then": 1, - "elseif": -1, - "end": -1, - "repeat": 1, - "until": -1 - }; - - var token = stream.getCurrentToken(); - if (!token || token.type != "keyword") - return; - - var val = token.value; - var stack = [val]; - var dir = indentKeywords[val]; - - if (!dir) - return; - - var startColumn = dir === -1 ? stream.getCurrentTokenColumn() : session.getLine(row).length; - var startRow = row; - - stream.step = dir === -1 ? stream.stepBackward : stream.stepForward; - while(token = stream.step()) { - if (token.type !== "keyword") - continue; - var level = dir * indentKeywords[token.value]; - - if (level > 0) { - stack.unshift(token.value); - } else if (level <= 0) { - stack.shift(); - if (!stack.length && token.value != "elseif") - break; - if (level === 0) - stack.unshift(token.value); - } - } - - var row = stream.getCurrentTokenRow(); - if (dir === -1) - return new Range(row, session.getLine(row).length, startRow, startColumn); - else - return new Range(startRow, startColumn, row, stream.getCurrentTokenColumn()); - }; - -}).call(FoldMode.prototype); - -}); diff --git a/addons/editor/ace/mode-luapage.js b/addons/editor/ace/mode-luapage.js deleted file mode 100644 index 976cb711..00000000 --- a/addons/editor/ace/mode-luapage.js +++ /dev/null @@ -1,2778 +0,0 @@ -define('ace/mode/luapage', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/html', 'ace/mode/lua', 'ace/tokenizer', 'ace/mode/luapage_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var HtmlMode = require("./html").Mode; -var LuaMode = require("./lua").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var LuaPageHighlightRules = require("./luapage_highlight_rules").LuaPageHighlightRules; - -var Mode = function() { - this.HighlightRules = LuaPageHighlightRules; - - this.HighlightRules = LuaPageHighlightRules; - this.createModeDelegates({ - "lua-": LuaMode - }); -}; -oop.inherits(Mode, HtmlMode); - -exports.Mode = Mode; -}); - -define('ace/mode/html', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/javascript', 'ace/mode/css', 'ace/tokenizer', 'ace/mode/html_highlight_rules', 'ace/mode/behaviour/html', 'ace/mode/folding/html', 'ace/mode/html_completions'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var JavaScriptMode = require("./javascript").Mode; -var CssMode = require("./css").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; -var HtmlBehaviour = require("./behaviour/html").HtmlBehaviour; -var HtmlFoldMode = require("./folding/html").FoldMode; -var HtmlCompletions = require("./html_completions").HtmlCompletions; - -var Mode = function() { - this.HighlightRules = HtmlHighlightRules; - this.$behaviour = new HtmlBehaviour(); - this.$completer = new HtmlCompletions(); - - this.createModeDelegates({ - "js-": JavaScriptMode, - "css-": CssMode - }); - - this.foldingRules = new HtmlFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.blockComment = {start: ""}; - - this.getNextLineIndent = function(state, line, tab) { - return this.$getIndent(line); - }; - - this.checkOutdent = function(state, line, input) { - return false; - }; - - this.getCompletions = function(state, session, pos, prefix) { - return this.$completer.getCompletions(state, session, pos, prefix); - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/javascript', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/javascript_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/worker/worker_client', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var Range = require("../range").Range; -var WorkerClient = require("../worker/worker_client").WorkerClient; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = JavaScriptHighlightRules; - - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().getLineTokens(line, state); - var tokens = tokenizedLine.tokens; - var endState = tokenizedLine.state; - - if (tokens.length && tokens[tokens.length-1].type == "comment") { - return indent; - } - - if (state == "start" || state == "no_regex") { - var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/); - if (match) { - indent += tab; - } - } else if (state == "doc-start") { - if (endState == "start" || endState == "no_regex") { - return ""; - } - var match = line.match(/^\s*(\/?)\*/); - if (match) { - if (match[1]) { - indent += " "; - } - indent += "* "; - } - } - - 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); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker"); - worker.attachToDocument(session.getDocument()); - - worker.on("jslint", function(results) { - session.setAnnotations(results.data); - }); - - worker.on("terminate", function() { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var JavaScriptHighlightRules = function() { - var keywordMapper = this.createKeywordMapper({ - "variable.language": - "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors - "Namespace|QName|XML|XMLList|" + // E4X - "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + - "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + - "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors - "SyntaxError|TypeError|URIError|" + - "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions - "isNaN|parseFloat|parseInt|" + - "JSON|Math|" + // Other - "this|arguments|prototype|window|document" , // Pseudo - "keyword": - "const|yield|import|get|set|" + - "break|case|catch|continue|default|delete|do|else|finally|for|function|" + - "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + - "__parent__|__count__|escape|unescape|with|__proto__|" + - "class|enum|extends|super|export|implements|private|public|interface|package|protected|static", - "storage.type": - "const|let|var|function", - "constant.language": - "null|Infinity|NaN|undefined", - "support.function": - "alert", - "constant.language.boolean": "true|false" - }, "identifier"); - var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; - var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\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 - ".)"; - - this.$rules = { - "no_regex" : [ - { - token : "comment", - regex : "\\/\\/", - next : "line_comment" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : /\/\*/, - next : "comment" - }, { - token : "string", - regex : "'(?=.)", - next : "qstring" - }, { - token : "string", - regex : '"(?=.)', - next : "qqstring" - }, { - token : "constant.numeric", // hex - regex : /0[xX][0-9a-fA-F]+\b/ - }, { - token : "constant.numeric", // float - regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/ - }, { - token : [ - "storage.type", "punctuation.operator", "support.function", - "punctuation.operator", "entity.name.function", "text","keyword.operator" - ], - regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "keyword.operator", "text", "storage.type", - "text", "paren.lparen" - ], - regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "punctuation.operator", - "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "text", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : "keyword", - regex : "(?:" + kwBeforeRe + ")\\b", - next : "start" - }, { - token : ["punctuation.operator", "support.function"], - regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/ - }, { - token : ["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 : keywordMapper, - regex : identifierRe - }, { - token : "keyword.operator", - regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/, - next : "start" - }, { - token : "punctuation.operator", - regex : /\?|\:|\,|\;|\./, - next : "start" - }, { - token : "paren.lparen", - regex : /[\[({]/, - next : "start" - }, { - token : "paren.rparen", - regex : /[\])}]/ - }, { - token : "keyword.operator", - regex : /\/=?/, - next : "start" - }, { - token: "comment", - regex: /^#!.*$/ - } - ], - "start": [ - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment_regex_allowed" - }, { - token : "comment", - regex : "\\/\\/", - next : "line_comment_regex_allowed" - }, { - token: "string.regexp", - regex: "\\/", - next: "regex" - }, { - token : "text", - regex : "\\s+|^$", - next : "start" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "regex": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "string.regexp", - regex: "/\\w*", - next: "no_regex" - }, { - token : "invalid", - regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ - }, { - token : "constant.language.escape", - regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/ - }, { - token : "constant.language.delimiter", - regex: /\|/ - }, { - token: "constant.language.escape", - regex: /\[\^?/, - next: "regex_character_class" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp" - } - ], - "regex_character_class": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "constant.language.escape", - regex: "]", - next: "regex" - }, { - token: "constant.language.escape", - regex: "-" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp.charachterclass" - } - ], - "function_arguments": [ - { - token: "variable.parameter", - regex: identifierRe - }, { - token: "punctuation.operator", - regex: "[, ]+" - }, { - token: "punctuation.operator", - regex: "$" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "comment_regex_allowed" : [ - {token : "comment", regex : "\\*\\/", next : "start"}, - {defaultToken : "comment"} - ], - "comment" : [ - {token : "comment", regex : "\\*\\/", next : "no_regex"}, - {defaultToken : "comment"} - ], - "line_comment_regex_allowed" : [ - {token : "comment", regex : "$|^", next : "start"}, - {defaultToken : "comment"} - ], - "line_comment" : [ - {token : "comment", regex : "$|^", next : "no_regex"}, - {defaultToken : "comment"} - ], - "qqstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qqstring" - }, { - token : "string", - regex : '"|$', - next : "no_regex" - }, { - defaultToken: "string" - } - ], - "qstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qstring" - }, { - token : "string", - regex : "'|$", - next : "no_regex" - }, { - defaultToken: "string" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("no_regex") ]); -}; - -oop.inherits(JavaScriptHighlightRules, TextHighlightRules); - -exports.JavaScriptHighlightRules = JavaScriptHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); - -define('ace/mode/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/css_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/worker/worker_client', 'ace/mode/behaviour/css', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var WorkerClient = require("../worker/worker_client").WorkerClient; -var CssBehaviour = require("./behaviour/css").CssBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = CssHighlightRules; - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CssBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.foldingRules = "cStyle"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - var tokens = this.getTokenizer().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); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker"); - worker.attachToDocument(session.getDocument()); - - worker.on("csslint", function(e) { - session.setAnnotations(e.data); - }); - - worker.on("terminate", function() { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; - -}); - -define('ace/mode/css_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var supportType = exports.supportType = "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"; -var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters"; -var supportConstant = exports.supportConstant = "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|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|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero"; -var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow"; -var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace"; - -var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))"; -var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b"; -var pseudoClasses = exports.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 CssHighlightRules = function() { - - var keywordMapper = this.createKeywordMapper({ - "support.function": supportFunction, - "support.constant": supportConstant, - "support.type": supportType, - "support.constant.color": supportConstantColor, - "support.constant.fonts": supportConstantFonts - }, "text", true); - - this.$rules = { - "start" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "@.*?{", - push: "media" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "media" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "\\}", - next: "pop" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "comment" : [{ - token : "comment", - regex : "\\*\\/", - next : "pop" - }, { - defaultToken : "comment" - }], - - "ruleset" : [ - { - token : "paren.rparen", - regex : "\\}", - next: "pop" - }, { - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - 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 : numRe - }, { - 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 : ["support.function", "string", "support.function"], - regex : "(url\\()(.*)(\\))" - }, { - token : keywordMapper, - regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*" - }, { - caseInsensitive: true - }] - }; - - this.normalizeRules(); -}; - -oop.inherits(CssHighlightRules, TextHighlightRules); - -exports.CssHighlightRules = CssHighlightRules; - -}); - -define('ace/mode/behaviour/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; - -var CssBehaviour = function () { - - this.inherit(CstyleBehaviour); - - this.add("colon", "insertion", function (state, action, editor, session, text) { - if (text === ':') { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - var token = iterator.getCurrentToken(); - if (token && token.value.match(/\s+/)) { - token = iterator.stepBackward(); - } - if (token && token.type === 'support.type') { - var line = session.doc.getLine(cursor.row); - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar === ':') { - return { - text: '', - selection: [1, 1] - } - } - if (!line.substring(cursor.column).match(/^\s*;/)) { - return { - text: ':;', - selection: [1, 1] - } - } - } - } - }); - - this.add("colon", "deletion", function (state, action, editor, session, range) { - var selected = session.doc.getTextRange(range); - if (!range.isMultiLine() && selected === ':') { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - var token = iterator.getCurrentToken(); - if (token && token.value.match(/\s+/)) { - token = iterator.stepBackward(); - } - if (token && token.type === 'support.type') { - 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("semicolon", "insertion", function (state, action, editor, session, text) { - if (text === ';') { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar === ';') { - return { - text: '', - selection: [1, 1] - } - } - } - }); - -} -oop.inherits(CssBehaviour, CstyleBehaviour); - -exports.CssBehaviour = CssBehaviour; -}); - -define('ace/mode/html_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/css_highlight_rules', 'ace/mode/javascript_highlight_rules', 'ace/mode/xml_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; - -var tagMap = lang.createMap({ - a : 'anchor', - button : 'form', - form : 'form', - img : 'image', - input : 'form', - label : 'form', - option : 'form', - script : 'script', - select : 'form', - textarea : 'form', - style : 'style', - table : 'table', - tbody : 'table', - td : 'table', - tfoot : 'table', - th : 'table', - tr : 'table' -}); - -var HtmlHighlightRules = function() { - XmlHighlightRules.call(this); - - this.addRules({ - attributes: [{ - include : "space" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "keyword.operator.separator", - regex : "=", - push : [{ - include: "space" - }, { - token : "string", - regex : "[^<>='\"`\\s]+", - next : "pop" - }, { - token : "empty", - regex : "", - next : "pop" - }] - }, { - include : "string" - }], - tag: [{ - token : function(start, tag) { - var group = tagMap[tag]; - return ["meta.tag.punctuation.begin", - "meta.tag.name" + (group ? "." + group : "")]; - }, - regex : "(<)([-_a-zA-Z0-9:]+)", - next: "start_tag_stuff" - }, { - token : function(start, tag) { - var group = tagMap[tag]; - return ["meta.tag.punctuation.begin", - "meta.tag.name" + (group ? "." + group : "")]; - }, - regex : "(", next : "start"} - ], - end_tag_stuff: [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next : "start"} - ] - }); - - this.embedTagRules(CssHighlightRules, "css-", "style"); - this.embedTagRules(JavaScriptHighlightRules, "js-", "script"); - - if (this.constructor === HtmlHighlightRules) - this.normalizeRules(); -}; - -oop.inherits(HtmlHighlightRules, XmlHighlightRules); - -exports.HtmlHighlightRules = HtmlHighlightRules; -}); - -define('ace/mode/xml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml_util', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var xmlUtil = require("./xml_util"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var XmlHighlightRules = function(normalize) { - this.$rules = { - start : [ - {token : "punctuation.string.begin", regex : "<\\!\\[CDATA\\[", next : "cdata"}, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)(xml)(?=[\\s])", next : "xml_declaration" - }, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)([-_a-zA-Z0-9]+)", next : "instruction" - }, - {token : "comment", regex : "<\\!--", next : "comment"}, - { - token : ["punctuation.doctype.begin", "meta.tag.doctype"], - regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype" - }, - {include : "tag"}, - {include : "reference"} - ], - - xml_declaration : [ - {include : "attributes"}, - {include : "instruction"} - ], - - instruction : [ - {token : "punctuation.instruction.end", regex : "\\?>", next : "start"} - ], - - doctype : [ - {include : "space"}, - {include : "string"}, - {token : "punctuation.doctype.end", regex : ">", next : "start"}, - {token : "xml-pe", regex : "[-_a-zA-Z0-9:]+"}, - {token : "punctuation.begin", regex : "\\[", push : "declarations"} - ], - - declarations : [{ - token : "text", - regex : "\\s+" - }, { - token: "punctuation.end", - regex: "]", - next: "pop" - }, { - token : ["punctuation.begin", "keyword"], - regex : "(<\\!)([-_a-zA-Z0-9]+)", - push : [{ - token : "text", - regex : "\\s+" - }, - { - token : "punctuation.end", - regex : ">", - next : "pop" - }, - {include : "string"}] - }], - - cdata : [ - {token : "string.end", regex : "\\]\\]>", next : "start"}, - {token : "text", regex : "\\s+"}, - {token : "text", regex : "(?:[^\\]]|\\](?!\\]>))+"} - ], - - comment : [ - {token : "comment", regex : "-->", next : "start"}, - {defaultToken : "comment"} - ], - - tag : [{ - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(<)((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)", - next: [ - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : "start"} - ] - }, { - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(", next : "start"} - ] - }], - - space : [ - {token : "text", regex : "\\s+"} - ], - - reference : [{ - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, { - token : "invalid.illegal", regex : "&" - }], - - string: [{ - token : "string", - regex : "'", - push : "qstring_inner" - }, { - token : "string", - regex : '"', - push : "qqstring_inner" - }], - - qstring_inner: [ - {token : "string", regex: "'", next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - qqstring_inner: [ - {token : "string", regex: '"', next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - attributes: [{ - token : "entity.other.attribute-name", - regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+" - }, { - token : "keyword.operator.separator", - regex : "=" - }, { - include : "space" - }, { - include : "string" - }] - }; - - if (this.constructor === XmlHighlightRules) - this.normalizeRules(); -}; - - -(function() { - - this.embedTagRules = function(HighlightRules, prefix, tag){ - this.$rules.tag.unshift({ - token : ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(<)(" + tag + ")", - next: [ - {include : "space"}, - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : prefix + "start"} - ] - }); - - this.$rules[tag + "-end"] = [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next: "start", - onMatch : function(value, currentState, stack) { - stack.splice(0); - return this.token; - }} - ] - - this.embedRules(HighlightRules, prefix, [{ - token: ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(" - }]); - }; - -}).call(TextHighlightRules.prototype); - -oop.inherits(XmlHighlightRules, TextHighlightRules); - -exports.XmlHighlightRules = XmlHighlightRules; -}); - -define('ace/mode/xml_util', ['require', 'exports', 'module' ], function(require, exports, module) { - - -function string(state) { - return [{ - token : "string", - regex : '"', - next : state + "_qqstring" - }, { - token : "string", - regex : "'", - next : state + "_qstring" - }]; -} - -function multiLineString(quote, state) { - return [ - {token : "string", regex : quote, next : state}, - { - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, - {defaultToken : "string"} - ]; -} - -exports.tag = function(states, name, nextState, tagMap) { - states[name] = [{ - token : "text", - regex : "\\s+" - }, { - - token : !tagMap ? "meta.tag.tag-name" : function(value) { - if (tagMap[value]) - return "meta.tag.tag-name." + tagMap[value]; - else - return "meta.tag.tag-name"; - }, - regex : "[-_a-zA-Z0-9:]+", - next : name + "_embed_attribute_list" - }, { - token: "empty", - regex: "", - next : 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"] = [{ - token : "meta.tag.r", - regex : "/?>", - next : nextState - }, { - token : "keyword.operator", - regex : "=" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "text", - regex : "\\s+" - }].concat(string(name)); -}; - -}); - -define('ace/mode/behaviour/html', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour/xml', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var XmlBehaviour = require("../behaviour/xml").XmlBehaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var voidElements = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']; - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); - return hasType; -} - -var HtmlBehaviour = function () { - - this.inherit(XmlBehaviour); // Get xml behaviour - - this.add("autoclosing", "insertion", function (state, action, editor, session, text) { - if (text == '>') { - var position = editor.getCursorPosition(); - var iterator = new TokenIterator(session, position.row, position.column); - var token = iterator.getCurrentToken(); - - if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column) - return; - var atCursor = false; - if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text'))); - } else { - atCursor = true; - } - if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) { - return; - } - var element = token.value; - if (atCursor){ - var element = element.substring(0, position.column - token.start); - } - if (voidElements.indexOf(element) !== -1){ - return; - } - return { - text: '>' + '', - selection: [1, 1] - } - } - }); -} -oop.inherits(HtmlBehaviour, XmlBehaviour); - -exports.HtmlBehaviour = HtmlBehaviour; -}); - -define('ace/mode/behaviour/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); - return hasType; -} - -var XmlBehaviour = function () { - - this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour - - this.add("autoclosing", "insertion", function (state, action, editor, session, text) { - if (text == '>') { - var position = editor.getCursorPosition(); - var iterator = new TokenIterator(session, position.row, position.column); - var token = iterator.getCurrentToken(); - - if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column) - return; - var atCursor = false; - if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text'))); - } else { - atCursor = true; - } - if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) { - return; - } - var tag = token.value; - if (atCursor){ - var tag = tag.substring(0, position.column - token.start); - } - - return { - text: '>' + '', - selection: [1, 1] - } - } - }); - - this.add('autoindent', 'insertion', function (state, action, editor, session, text) { - if (text == "\n") { - var cursor = editor.getCursorPosition(); - var line = session.getLine(cursor.row); - var rightChars = line.substring(cursor.column, cursor.column + 2); - if (rightChars == '?)/; - this._parseTag = function(tag) { - - var match = tag.match(this.tagRe); - var column = 0; - - return { - value: tag, - match: match ? match[2] : "", - closing: match ? !!match[3] : false, - selfClosing: match ? !!match[5] || match[2] == "/>" : false, - tagName: match ? match[4] : "", - column: match[1] ? column + match[1].length : column - }; - }; - this._readTagForward = function(iterator) { - var token = iterator.getCurrentToken(); - if (!token) - return null; - - var value = ""; - var start; - - do { - if (token.type.lastIndexOf("meta.tag", 0) === 0) { - if (!start) { - var start = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() - }; - } - value += token.value; - if (value.indexOf(">") !== -1) { - var tag = this._parseTag(value); - tag.start = start; - tag.end = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() + token.value.length - }; - iterator.stepForward(); - return tag; - } - } - } while(token = iterator.stepForward()); - - return null; - }; - - this._readTagBackward = function(iterator) { - var token = iterator.getCurrentToken(); - if (!token) - return null; - - var value = ""; - var end; - - do { - if (token.type.lastIndexOf("meta.tag", 0) === 0) { - if (!end) { - end = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() + token.value.length - }; - } - value = token.value + value; - if (value.indexOf("<") !== -1) { - var tag = this._parseTag(value); - tag.end = end; - tag.start = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() - }; - iterator.stepBackward(); - return tag; - } - } - } while(token = iterator.stepBackward()); - - return null; - }; - - this._pop = function(stack, tag) { - while (stack.length) { - - var top = stack[stack.length-1]; - if (!tag || top.tagName == tag.tagName) { - return stack.pop(); - } - else if (this.voidElements[tag.tagName]) { - return; - } - else if (this.voidElements[top.tagName]) { - stack.pop(); - continue; - } else { - return null; - } - } - }; - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var firstTag = this._getFirstTagInLine(session, row); - - if (!firstTag.match) - return null; - - var isBackward = firstTag.closing || firstTag.selfClosing; - var stack = []; - var tag; - - if (!isBackward) { - var iterator = new TokenIterator(session, row, firstTag.column); - var start = { - row: row, - column: firstTag.column + firstTag.tagName.length + 2 - }; - while (tag = this._readTagForward(iterator)) { - if (tag.selfClosing) { - if (!stack.length) { - tag.start.column += tag.tagName.length + 2; - tag.end.column -= 2; - return Range.fromPoints(tag.start, tag.end); - } else - continue; - } - - if (tag.closing) { - this._pop(stack, tag); - if (stack.length == 0) - return Range.fromPoints(start, tag.start); - } - else { - stack.push(tag) - } - } - } - else { - var iterator = new TokenIterator(session, row, firstTag.column + firstTag.match.length); - var end = { - row: row, - column: firstTag.column - }; - - while (tag = this._readTagBackward(iterator)) { - if (tag.selfClosing) { - if (!stack.length) { - tag.start.column += tag.tagName.length + 2; - tag.end.column -= 2; - return Range.fromPoints(tag.start, tag.end); - } else - continue; - } - - if (!tag.closing) { - this._pop(stack, tag); - if (stack.length == 0) { - tag.start.column += tag.tagName.length + 2; - return Range.fromPoints(tag.start, end); - } - } - else { - stack.push(tag) - } - } - } - - }; - -}).call(FoldMode.prototype); - -}); - -define('ace/mode/html_completions', ['require', 'exports', 'module' , 'ace/token_iterator'], function(require, exports, module) { - - -var TokenIterator = require("../token_iterator").TokenIterator; - -var commonAttributes = [ - "accesskey", - "class", - "contenteditable", - "contextmenu", - "dir", - "draggable", - "dropzone", - "hidden", - "id", - "lang", - "spellcheck", - "style", - "tabindex", - "title", - "translate" -]; - -var eventAttributes = [ - "onabort", - "onblur", - "oncancel", - "oncanplay", - "oncanplaythrough", - "onchange", - "onclick", - "onclose", - "oncontextmenu", - "oncuechange", - "ondblclick", - "ondrag", - "ondragend", - "ondragenter", - "ondragleave", - "ondragover", - "ondragstart", - "ondrop", - "ondurationchange", - "onemptied", - "onended", - "onerror", - "onfocus", - "oninput", - "oninvalid", - "onkeydown", - "onkeypress", - "onkeyup", - "onload", - "onloadeddata", - "onloadedmetadata", - "onloadstart", - "onmousedown", - "onmousemove", - "onmouseout", - "onmouseover", - "onmouseup", - "onmousewheel", - "onpause", - "onplay", - "onplaying", - "onprogress", - "onratechange", - "onreset", - "onscroll", - "onseeked", - "onseeking", - "onselect", - "onshow", - "onstalled", - "onsubmit", - "onsuspend", - "ontimeupdate", - "onvolumechange", - "onwaiting" -]; - -var globalAttributes = commonAttributes.concat(eventAttributes); - -var attributeMap = { - "html": ["manifest"], - "head": [], - "title": [], - "base": ["href", "target"], - "link": ["href", "hreflang", "rel", "media", "type", "sizes"], - "meta": ["http-equiv", "name", "content", "charset"], - "style": ["type", "media", "scoped"], - "script": ["charset", "type", "src", "defer", "async"], - "noscript": ["href"], - "body": ["onafterprint", "onbeforeprint", "onbeforeunload", "onhashchange", "onmessage", "onoffline", "onpopstate", "onredo", "onresize", "onstorage", "onundo", "onunload"], - "section": [], - "nav": [], - "article": ["pubdate"], - "aside": [], - "h1": [], - "h2": [], - "h3": [], - "h4": [], - "h5": [], - "h6": [], - "header": [], - "footer": [], - "address": [], - "main": [], - "p": [], - "hr": [], - "pre": [], - "blockquote": ["cite"], - "ol": ["start", "reversed"], - "ul": [], - "li": ["value"], - "dl": [], - "dt": [], - "dd": [], - "figure": [], - "figcaption": [], - "div": [], - "a": ["href", "target", "ping", "rel", "media", "hreflang", "type"], - "em": [], - "strong": [], - "small": [], - "s": [], - "cite": [], - "q": ["cite"], - "dfn": [], - "abbr": [], - "data": [], - "time": ["datetime"], - "code": [], - "var": [], - "samp": [], - "kbd": [], - "sub": [], - "sup": [], - "i": [], - "b": [], - "u": [], - "mark": [], - "ruby": [], - "rt": [], - "rp": [], - "bdi": [], - "bdo": [], - "span": [], - "br": [], - "wbr": [], - "ins": ["cite", "datetime"], - "del": ["cite", "datetime"], - "img": ["alt", "src", "height", "width", "usemap", "ismap"], - "iframe": ["name", "src", "height", "width", "sandbox", "seamless"], - "embed": ["src", "height", "width", "type"], - "object": ["param", "data", "type", "height" , "width", "usemap", "name", "form", "classid"], - "param": ["name", "value"], - "video": ["src", "autobuffer", "autoplay", "loop", "controls", "width", "height", "poster"], - "audio": ["src", "autobuffer", "autoplay", "loop", "controls"], - "source": ["src", "type", "media"], - "track": ["kind", "src", "srclang", "label", "default"], - "canvas": ["width", "height"], - "map": ["name"], - "area": ["shape", "coords", "href", "hreflang", "alt", "target", "media", "rel", "ping", "type"], - "svg": [], - "math": [], - "table": ["summary"], - "caption": [], - "colgroup": ["span"], - "col": ["span"], - "tbody": [], - "thead": [], - "tfoot": [], - "tr": [], - "td": ["headers", "rowspan", "colspan"], - "th": ["headers", "rowspan", "colspan", "scope"], - "form": ["accept-charset", "action", "autocomplete", "enctype", "method", "name", "novalidate", "target"], - "fieldset": ["disabled", "form", "name"], - "legend": [], - "label": ["form", "for"], - "input": ["type", "accept", "alt", "autocomplete", "checked", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "height", "list", "max", "maxlength", "min", "multiple", "pattern", "placeholder", "readonly", "required", "size", "src", "step", "width", "files", "value"], - "button": ["autofocus", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "name", "value", "type"], - "select": ["autofocus", "disabled", "form", "multiple", "name", "size"], - "datalist": [], - "optgroup": ["disabled", "label"], - "option": ["disabled", "selected", "label", "value"], - "textarea": ["autofocus", "disabled", "form", "maxlength", "name", "placeholder", "readonly", "required", "rows", "cols", "wrap"], - "keygen": ["autofocus", "challenge", "disabled", "form", "keytype", "name"], - "output": ["for", "form", "name"], - "progress": ["value", "max"], - "meter": ["value", "min", "max", "low", "high", "optimum"], - "details": ["open"], - "summary": [], - "command": ["type", "label", "icon", "disabled", "checked", "radiogroup", "command"], - "menu": ["type", "label"], - "dialog": ["open"] -}; - -var allElements = Object.keys(attributeMap); - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); -} - -function findTagName(session, pos) { - var iterator = new TokenIterator(session, pos.row, pos.column); - var token = iterator.getCurrentToken(); - if (!token || !hasType(token, 'tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'operator') || hasType(token, 'attribute-name') || hasType(token, 'text'))); - } - if (token && hasType(token, 'tag-name') && !iterator.stepBackward().value.match('/')) - return token.value; -} - -var HtmlCompletions = function() { - -}; - -(function() { - - this.getCompletions = function(state, session, pos, prefix) { - var token = session.getTokenAt(pos.row, pos.column); - - if (!token) - return []; - if (hasType(token, "tag-name") || (token.value == '<' && hasType(token, "text"))) - return this.getTagCompletions(state, session, pos, prefix); - if (hasType(token, 'text') || hasType(token, 'attribute-name')) - return this.getAttributeCompetions(state, session, pos, prefix); - - return []; - }; - - this.getTagCompletions = function(state, session, pos, prefix) { - var elements = allElements; - if (prefix) { - elements = elements.filter(function(element){ - return element.indexOf(prefix) === 0; - }); - } - return elements.map(function(element){ - return { - value: element, - meta: "tag" - }; - }); - }; - - this.getAttributeCompetions = function(state, session, pos, prefix) { - var tagName = findTagName(session, pos); - if (!tagName) - return []; - var attributes = globalAttributes; - if (tagName in attributeMap) { - attributes = attributes.concat(attributeMap[tagName]); - } - if (prefix) { - attributes = attributes.filter(function(attribute){ - return attribute.indexOf(prefix) === 0; - }); - } - return attributes.map(function(attribute){ - return { - caption: attribute, - snippet: attribute + '="$0"', - meta: "attribute" - }; - }); - }; - -}).call(HtmlCompletions.prototype); - -exports.HtmlCompletions = HtmlCompletions; -}); - -define('ace/mode/lua', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/lua_highlight_rules', 'ace/mode/folding/lua', 'ace/range', 'ace/worker/worker_client'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var LuaHighlightRules = require("./lua_highlight_rules").LuaHighlightRules; -var LuaFoldMode = require("./folding/lua").FoldMode; -var Range = require("../range").Range; -var WorkerClient = require("../worker/worker_client").WorkerClient; - -var Mode = function() { - this.HighlightRules = LuaHighlightRules; - - this.foldingRules = new LuaFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "--"; - this.blockComment = {start: "--[", end: "]--"}; - - var indentKeywords = { - "function": 1, - "then": 1, - "do": 1, - "else": 1, - "elseif": 1, - "repeat": 1, - "end": -1, - "until": -1 - }; - var outdentKeywords = [ - "else", - "elseif", - "end", - "until" - ]; - - function getNetIndentLevel(tokens) { - var level = 0; - for (var i = 0; i < tokens.length; i++) { - var token = tokens[i]; - if (token.type == "keyword") { - if (token.value in indentKeywords) { - level += indentKeywords[token.value]; - } - } else if (token.type == "paren.lparen") { - level ++; - } else if (token.type == "paren.rparen") { - level --; - } - } - if (level < 0) { - return -1; - } else if (level > 0) { - return 1; - } else { - return 0; - } - } - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - var level = 0; - - var tokenizedLine = this.getTokenizer().getLineTokens(line, state); - var tokens = tokenizedLine.tokens; - - if (state == "start") { - level = getNetIndentLevel(tokens); - } - if (level > 0) { - return indent + tab; - } else if (level < 0 && indent.substr(indent.length - tab.length) == tab) { - if (!this.checkOutdent(state, line, "\n")) { - return indent.substr(0, indent.length - tab.length); - } - } - return indent; - }; - - this.checkOutdent = function(state, line, input) { - if (input != "\n" && input != "\r" && input != "\r\n") - return false; - - if (line.match(/^\s*[\)\}\]]$/)) - return true; - - var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens; - - if (!tokens || !tokens.length) - return false; - - return (tokens[0].type == "keyword" && outdentKeywords.indexOf(tokens[0].value) != -1); - }; - - this.autoOutdent = function(state, session, row) { - var prevLine = session.getLine(row - 1); - var prevIndent = this.$getIndent(prevLine).length; - var prevTokens = this.getTokenizer().getLineTokens(prevLine, "start").tokens; - var tabLength = session.getTabString().length; - var expectedIndent = prevIndent + tabLength * getNetIndentLevel(prevTokens); - var curIndent = this.$getIndent(session.getLine(row)).length; - if (curIndent < expectedIndent) { - return; - } - session.outdentRows(new Range(row, 0, row + 2, 0)); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/lua_worker", "Worker"); - worker.attachToDocument(session.getDocument()); - - worker.on("error", function(e) { - session.setAnnotations([e.data]); - }); - - worker.on("ok", function(e) { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/lua_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var LuaHighlightRules = function() { - - var keywords = ( - "break|do|else|elseif|end|for|function|if|in|local|repeat|"+ - "return|then|until|while|or|and|not" - ); - - var builtinConstants = ("true|false|nil|_G|_VERSION"); - - var functions = ( - "string|xpcall|package|tostring|print|os|unpack|require|"+ - "getfenv|setmetatable|next|assert|tonumber|io|rawequal|"+ - "collectgarbage|getmetatable|module|rawset|math|debug|"+ - "pcall|table|newproxy|type|coroutine|_G|select|gcinfo|"+ - "pairs|rawget|loadstring|ipairs|_VERSION|dofile|setfenv|"+ - "load|error|loadfile|"+ - - "sub|upper|len|gfind|rep|find|match|char|dump|gmatch|"+ - "reverse|byte|format|gsub|lower|preload|loadlib|loaded|"+ - "loaders|cpath|config|path|seeall|exit|setlocale|date|"+ - "getenv|difftime|remove|time|clock|tmpname|rename|execute|"+ - "lines|write|close|flush|open|output|type|read|stderr|"+ - "stdin|input|stdout|popen|tmpfile|log|max|acos|huge|"+ - "ldexp|pi|cos|tanh|pow|deg|tan|cosh|sinh|random|randomseed|"+ - "frexp|ceil|floor|rad|abs|sqrt|modf|asin|min|mod|fmod|log10|"+ - "atan2|exp|sin|atan|getupvalue|debug|sethook|getmetatable|"+ - "gethook|setmetatable|setlocal|traceback|setfenv|getinfo|"+ - "setupvalue|getlocal|getregistry|getfenv|setn|insert|getn|"+ - "foreachi|maxn|foreach|concat|sort|remove|resume|yield|"+ - "status|wrap|create|running|"+ - "__add|__sub|__mod|__unm|__concat|__lt|__index|__call|__gc|__metatable|"+ - "__mul|__div|__pow|__len|__eq|__le|__newindex|__tostring|__mode|__tonumber" - ); - - var stdLibaries = ("string|package|os|io|math|debug|table|coroutine"); - - var futureReserved = ""; - - var deprecatedIn5152 = ("setn|foreach|foreachi|gcinfo|log10|maxn"); - - var keywordMapper = this.createKeywordMapper({ - "keyword": keywords, - "support.function": functions, - "invalid.deprecated": deprecatedIn5152, - "constant.library": stdLibaries, - "constant.language": builtinConstants, - "invalid.illegal": futureReserved, - "variable.language": "this" - }, "identifier"); - - var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))"; - var hexInteger = "(?:0[xX][\\dA-Fa-f]+)"; - var integer = "(?:" + decimalInteger + "|" + hexInteger + ")"; - - var fraction = "(?:\\.\\d+)"; - var intPart = "(?:\\d+)"; - var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))"; - var floatNumber = "(?:" + pointFloat + ")"; - - this.$rules = { - "start" : [{ - stateName: "bracketedComment", - onMatch : function(value, currentState, stack){ - stack.unshift(this.next, value.length - 2, currentState); - return "comment"; - }, - regex : /\-\-\[=*\[/, - next : [ - { - onMatch : function(value, currentState, stack) { - if (value.length == stack[1]) { - stack.shift(); - stack.shift(); - this.next = stack.shift(); - } else { - this.next = ""; - } - return "comment"; - }, - regex : /\]=*\]/, - next : "start" - }, { - defaultToken : "comment" - } - ] - }, - - { - token : "comment", - regex : "\\-\\-.*$" - }, - { - stateName: "bracketedString", - onMatch : function(value, currentState, stack){ - stack.unshift(this.next, value.length, currentState); - return "comment"; - }, - regex : /\[=*\[/, - next : [ - { - onMatch : function(value, currentState, stack) { - if (value.length == stack[1]) { - stack.shift(); - stack.shift(); - this.next = stack.shift(); - } else { - this.next = ""; - } - return "comment"; - }, - - regex : /\]=*\]/, - next : "start" - }, { - defaultToken : "comment" - } - ] - }, - { - token : "string", // " string - regex : '"(?:[^\\\\]|\\\\.)*?"' - }, { - token : "string", // ' string - regex : "'(?:[^\\\\]|\\\\.)*?'" - }, { - token : "constant.numeric", // float - regex : floatNumber - }, { - token : "constant.numeric", // integer - regex : integer + "\\b" - }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" - }, { - token : "keyword.operator", - regex : "\\+|\\-|\\*|\\/|%|\\#|\\^|~|<|>|<=|=>|==|~=|=|\\:|\\.\\.\\.|\\.\\." - }, { - token : "paren.lparen", - regex : "[\\[\\(\\{]" - }, { - token : "paren.rparen", - regex : "[\\]\\)\\}]" - }, { - token : "text", - regex : "\\s+|\\w+" - } ] - }; - - this.normalizeRules(); -} - -oop.inherits(LuaHighlightRules, TextHighlightRules); - -exports.LuaHighlightRules = LuaHighlightRules; -}); - -define('ace/mode/folding/lua', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var BaseFoldMode = require("./fold_mode").FoldMode; -var Range = require("../../range").Range; -var TokenIterator = require("../../token_iterator").TokenIterator; - - -var FoldMode = exports.FoldMode = function() {}; - -oop.inherits(FoldMode, BaseFoldMode); - -(function() { - - this.foldingStartMarker = /\b(function|then|do|repeat)\b|{\s*$|(\[=*\[)/; - this.foldingStopMarker = /\bend\b|^\s*}|\]=*\]/; - - this.getFoldWidget = function(session, foldStyle, row) { - var line = session.getLine(row); - var isStart = this.foldingStartMarker.test(line); - var isEnd = this.foldingStopMarker.test(line); - - if (isStart && !isEnd) { - var match = line.match(this.foldingStartMarker); - if (match[1] == "then" && /\belseif\b/.test(line)) - return; - if (match[1]) { - if (session.getTokenAt(row, match.index + 1).type === "keyword") - return "start"; - } else if (match[2]) { - var type = session.bgTokenizer.getState(row) || ""; - if (type[0] == "bracketedComment" || type[0] == "bracketedString") - return "start"; - } else { - return "start"; - } - } - if (foldStyle != "markbeginend" || !isEnd || isStart && isEnd) - return ""; - - var match = line.match(this.foldingStopMarker); - if (match[0] === "end") { - if (session.getTokenAt(row, match.index + 1).type === "keyword") - return "end"; - } else if (match[0][0] === "]") { - var type = session.bgTokenizer.getState(row - 1) || ""; - if (type[0] == "bracketedComment" || type[0] == "bracketedString") - return "end"; - } else - return "end"; - }; - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var line = session.doc.getLine(row); - var match = this.foldingStartMarker.exec(line); - if (match) { - if (match[1]) - return this.luaBlock(session, row, match.index + 1); - - if (match[2]) - return session.getCommentFoldRange(row, match.index + 1); - - return this.openingBracketBlock(session, "{", row, match.index); - } - - var match = this.foldingStopMarker.exec(line); - if (match) { - if (match[0] === "end") { - if (session.getTokenAt(row, match.index + 1).type === "keyword") - return this.luaBlock(session, row, match.index + 1); - } - - if (match[0][0] === "]") - return session.getCommentFoldRange(row, match.index + 1); - - return this.closingBracketBlock(session, "}", row, match.index + match[0].length); - } - }; - - this.luaBlock = function(session, row, column) { - var stream = new TokenIterator(session, row, column); - var indentKeywords = { - "function": 1, - "do": 1, - "then": 1, - "elseif": -1, - "end": -1, - "repeat": 1, - "until": -1 - }; - - var token = stream.getCurrentToken(); - if (!token || token.type != "keyword") - return; - - var val = token.value; - var stack = [val]; - var dir = indentKeywords[val]; - - if (!dir) - return; - - var startColumn = dir === -1 ? stream.getCurrentTokenColumn() : session.getLine(row).length; - var startRow = row; - - stream.step = dir === -1 ? stream.stepBackward : stream.stepForward; - while(token = stream.step()) { - if (token.type !== "keyword") - continue; - var level = dir * indentKeywords[token.value]; - - if (level > 0) { - stack.unshift(token.value); - } else if (level <= 0) { - stack.shift(); - if (!stack.length && token.value != "elseif") - break; - if (level === 0) - stack.unshift(token.value); - } - } - - var row = stream.getCurrentTokenRow(); - if (dir === -1) - return new Range(row, session.getLine(row).length, startRow, startColumn); - else - return new Range(startRow, startColumn, row, stream.getCurrentTokenColumn()); - }; - -}).call(FoldMode.prototype); - -}); -define('ace/mode/luapage_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/html_highlight_rules', 'ace/mode/lua_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; -var LuaHighlightRules = require("./lua_highlight_rules").LuaHighlightRules; - -var LuaPageHighlightRules = function() { - HtmlHighlightRules.call(this); - - var startRules = [ - { - token: "keyword", - regex: "<\\%\\=?", - push: "lua-start" - }, { - token: "keyword", - regex: "<\\?lua\\=?", - push: "lua-start" - } - ]; - - var endRules = [ - { - token: "keyword", - regex: "\\%>", - next: "pop" - }, { - token: "keyword", - regex: "\\?>", - next: "pop" - } - ]; - - this.embedRules(LuaHighlightRules, "lua-", endRules, ["start"]); - - for (var key in this.$rules) - this.$rules[key].unshift.apply(this.$rules[key], startRules); - - this.normalizeRules(); -}; - -oop.inherits(LuaPageHighlightRules, HtmlHighlightRules); - -exports.LuaPageHighlightRules = LuaPageHighlightRules; - -}); \ No newline at end of file diff --git a/addons/editor/ace/mode-makefile.js b/addons/editor/ace/mode-makefile.js deleted file mode 100644 index 2bc26fe8..00000000 --- a/addons/editor/ace/mode-makefile.js +++ /dev/null @@ -1,331 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2012, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * Contributor(s): - * - * - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/mode/makefile', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/makefile_highlight_rules', 'ace/mode/folding/coffee'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var MakefileHighlightRules = require("./makefile_highlight_rules").MakefileHighlightRules; -var FoldMode = require("./folding/coffee").FoldMode; - -var Mode = function() { - this.HighlightRules = MakefileHighlightRules; - this.foldingRules = new FoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "#"; - this.$indentWithTabs = true; - -}).call(Mode.prototype); - -exports.Mode = Mode; -});define('ace/mode/makefile_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules', 'ace/mode/sh_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var ShHighlightFile = require("./sh_highlight_rules"); - -var MakefileHighlightRules = function() { - - var keywordMapper = this.createKeywordMapper({ - "keyword": ShHighlightFile.reservedKeywords, - "support.function.builtin": ShHighlightFile.languageConstructs, - "invalid.deprecated": "debugger" - }, "string"); - - this.$rules = - { - "start": [ - { - token: "string.interpolated.backtick.makefile", - regex: "`", - next: "shell-start" - }, - { - token: "punctuation.definition.comment.makefile", - regex: /#(?=.)/, - next: "comment" - }, - { - token: [ "keyword.control.makefile"], - regex: "^(?:\\s*\\b)(\\-??include|ifeq|ifneq|ifdef|ifndef|else|endif|vpath|export|unexport|define|endef|override)(?:\\b)" - }, - {// ^([^\t ]+(\s[^\t ]+)*:(?!\=))\s*.* - token: ["entity.name.function.makefile", "text"], - regex: "^([^\\t ]+(?:\\s[^\\t ]+)*:)(\\s*.*)" - } - ], - "comment": [ - { - token : "punctuation.definition.comment.makefile", - regex : /.+\\/ - }, - { - token : "punctuation.definition.comment.makefile", - regex : ".+", - next : "start" - } - ], - "shell-start": [ - { - token: keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" - }, - { - token: "string", - regex : "\\w+" - }, - { - token : "string.interpolated.backtick.makefile", - regex : "`", - next : "start" - } - ] -} - -}; - -oop.inherits(MakefileHighlightRules, TextHighlightRules); - -exports.MakefileHighlightRules = MakefileHighlightRules; -}); - -define('ace/mode/sh_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var reservedKeywords = exports.reservedKeywords = ( - '!|{|}|case|do|done|elif|else|'+ - 'esac|fi|for|if|in|then|until|while|'+ - '&|;|export|local|read|typeset|unset|'+ - 'elif|select|set' - ); - -var languageConstructs = exports.languageConstructs = ( - '[|]|alias|bg|bind|break|builtin|'+ - 'cd|command|compgen|complete|continue|'+ - 'dirs|disown|echo|enable|eval|exec|'+ - 'exit|fc|fg|getopts|hash|help|history|'+ - 'jobs|kill|let|logout|popd|printf|pushd|'+ - 'pwd|return|set|shift|shopt|source|'+ - 'suspend|test|times|trap|type|ulimit|'+ - 'umask|unalias|wait' -); - -var ShHighlightRules = function() { - var keywordMapper = this.createKeywordMapper({ - "keyword": reservedKeywords, - "support.function.builtin": languageConstructs, - "invalid.deprecated": "debugger" - }, "identifier"); - - var integer = "(?:(?:[1-9]\\d*)|(?:0))"; - - 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 : "constant", - regex : /\\./ - }, { - token : ["text", "comment"], - regex : /(^|\s)(#.*)$/ - }, { - token : "string", - regex : '"', - push : [{ - token : "constant.language.escape", - regex : /\\(?:[$abeEfnrtv\\'"]|x[a-fA-F\d]{1,2}|u[a-fA-F\d]{4}([a-fA-F\d]{4})?|c.|\d{1,3})/ - }, { - token : "constant", - regex : /\$\w+/ - }, { - token : "string", - regex : '"', - next: "pop" - }, { - defaultToken: "string" - }] - }, { - token : "variable.language", - regex : builtinVariable - }, { - token : "variable", - regex : variable - }, { - token : "support.function", - regex : func - }, { - token : "support.function", - regex : fileDescriptor - }, { - token : "string", // ' string - start : "'", end : "'" - }, { - token : "constant.numeric", // float - regex : floatNumber - }, { - token : "constant.numeric", // integer - regex : integer + "\\b" - }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" - }, { - token : "keyword.operator", - regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|~|<|>|<=|=>|=|!=" - }, { - token : "paren.lparen", - regex : "[\\[\\(\\{]" - }, { - token : "paren.rparen", - regex : "[\\]\\)\\}]" - } ] - }; - - this.normalizeRules(); -}; - -oop.inherits(ShHighlightRules, TextHighlightRules); - -exports.ShHighlightRules = ShHighlightRules; -}); - -define('ace/mode/folding/coffee', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var BaseFoldMode = require("./fold_mode").FoldMode; -var Range = require("../../range").Range; - -var FoldMode = exports.FoldMode = function() {}; -oop.inherits(FoldMode, BaseFoldMode); - -(function() { - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var range = this.indentationBlock(session, row); - if (range) - return range; - - var re = /\S/; - var line = session.getLine(row); - var startLevel = line.search(re); - if (startLevel == -1 || line[startLevel] != "#") - return; - - var startColumn = line.length; - var maxRow = session.getLength(); - var startRow = row; - var endRow = row; - - while (++row < maxRow) { - line = session.getLine(row); - var level = line.search(re); - - if (level == -1) - continue; - - if (line[level] != "#") - break; - - endRow = row; - } - - if (endRow > startRow) { - var endColumn = session.getLine(endRow).length; - return new Range(startRow, startColumn, endRow, endColumn); - } - }; - this.getFoldWidget = function(session, foldStyle, row) { - var line = session.getLine(row); - var indent = line.search(/\S/); - var next = session.getLine(row + 1); - var prev = session.getLine(row - 1); - var prevIndent = prev.search(/\S/); - var nextIndent = next.search(/\S/); - - if (indent == -1) { - session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : ""; - return ""; - } - if (prevIndent == -1) { - if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") { - session.foldWidgets[row - 1] = ""; - session.foldWidgets[row + 1] = ""; - return "start"; - } - } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") { - if (session.getLine(row - 2).search(/\S/) == -1) { - session.foldWidgets[row - 1] = "start"; - session.foldWidgets[row + 1] = ""; - return ""; - } - } - - if (prevIndent!= -1 && prevIndent < indent) - session.foldWidgets[row - 1] = "start"; - else - session.foldWidgets[row - 1] = ""; - - if (indent < nextIndent) - return "start"; - else - return ""; - }; - -}).call(FoldMode.prototype); - -}); diff --git a/addons/editor/ace/mode-markdown.js b/addons/editor/ace/mode-markdown.js deleted file mode 100644 index e86614f9..00000000 --- a/addons/editor/ace/mode-markdown.js +++ /dev/null @@ -1,2668 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2010, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/mode/markdown', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/javascript', 'ace/mode/xml', 'ace/mode/html', 'ace/tokenizer', 'ace/mode/markdown_highlight_rules', 'ace/mode/folding/markdown'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var JavaScriptMode = require("./javascript").Mode; -var XmlMode = require("./xml").Mode; -var HtmlMode = require("./html").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var MarkdownHighlightRules = require("./markdown_highlight_rules").MarkdownHighlightRules; -var MarkdownFoldMode = require("./folding/markdown").FoldMode; - -var Mode = function() { - this.HighlightRules = MarkdownHighlightRules; - - this.createModeDelegates({ - "js-": JavaScriptMode, - "xml-": XmlMode, - "html-": HtmlMode - }); - - this.foldingRules = new MarkdownFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - this.type = "text"; - this.lineCommentStart = ">"; - - this.getNextLineIndent = function(state, line, tab) { - if (state == "listblock") { - var match = /^(\s*)(?:([-+*])|(\d+)\.)(\s+)/.exec(line); - if (!match) - return ""; - var marker = match[2]; - if (!marker) - marker = parseInt(match[3], 10) + 1 + "."; - return match[1] + marker + match[4]; - } else { - return this.$getIndent(line); - } - }; -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/javascript', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/javascript_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/worker/worker_client', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var Range = require("../range").Range; -var WorkerClient = require("../worker/worker_client").WorkerClient; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = JavaScriptHighlightRules; - - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().getLineTokens(line, state); - var tokens = tokenizedLine.tokens; - var endState = tokenizedLine.state; - - if (tokens.length && tokens[tokens.length-1].type == "comment") { - return indent; - } - - if (state == "start" || state == "no_regex") { - var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/); - if (match) { - indent += tab; - } - } else if (state == "doc-start") { - if (endState == "start" || endState == "no_regex") { - return ""; - } - var match = line.match(/^\s*(\/?)\*/); - if (match) { - if (match[1]) { - indent += " "; - } - indent += "* "; - } - } - - 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); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker"); - worker.attachToDocument(session.getDocument()); - - worker.on("jslint", function(results) { - session.setAnnotations(results.data); - }); - - worker.on("terminate", function() { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var JavaScriptHighlightRules = function() { - var keywordMapper = this.createKeywordMapper({ - "variable.language": - "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors - "Namespace|QName|XML|XMLList|" + // E4X - "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + - "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + - "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors - "SyntaxError|TypeError|URIError|" + - "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions - "isNaN|parseFloat|parseInt|" + - "JSON|Math|" + // Other - "this|arguments|prototype|window|document" , // Pseudo - "keyword": - "const|yield|import|get|set|" + - "break|case|catch|continue|default|delete|do|else|finally|for|function|" + - "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + - "__parent__|__count__|escape|unescape|with|__proto__|" + - "class|enum|extends|super|export|implements|private|public|interface|package|protected|static", - "storage.type": - "const|let|var|function", - "constant.language": - "null|Infinity|NaN|undefined", - "support.function": - "alert", - "constant.language.boolean": "true|false" - }, "identifier"); - var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; - var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\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 - ".)"; - - this.$rules = { - "no_regex" : [ - { - token : "comment", - regex : "\\/\\/", - next : "line_comment" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : /\/\*/, - next : "comment" - }, { - token : "string", - regex : "'(?=.)", - next : "qstring" - }, { - token : "string", - regex : '"(?=.)', - next : "qqstring" - }, { - token : "constant.numeric", // hex - regex : /0[xX][0-9a-fA-F]+\b/ - }, { - token : "constant.numeric", // float - regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/ - }, { - token : [ - "storage.type", "punctuation.operator", "support.function", - "punctuation.operator", "entity.name.function", "text","keyword.operator" - ], - regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "keyword.operator", "text", "storage.type", - "text", "paren.lparen" - ], - regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "punctuation.operator", - "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "text", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : "keyword", - regex : "(?:" + kwBeforeRe + ")\\b", - next : "start" - }, { - token : ["punctuation.operator", "support.function"], - regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/ - }, { - token : ["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 : keywordMapper, - regex : identifierRe - }, { - token : "keyword.operator", - regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/, - next : "start" - }, { - token : "punctuation.operator", - regex : /\?|\:|\,|\;|\./, - next : "start" - }, { - token : "paren.lparen", - regex : /[\[({]/, - next : "start" - }, { - token : "paren.rparen", - regex : /[\])}]/ - }, { - token : "keyword.operator", - regex : /\/=?/, - next : "start" - }, { - token: "comment", - regex: /^#!.*$/ - } - ], - "start": [ - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment_regex_allowed" - }, { - token : "comment", - regex : "\\/\\/", - next : "line_comment_regex_allowed" - }, { - token: "string.regexp", - regex: "\\/", - next: "regex" - }, { - token : "text", - regex : "\\s+|^$", - next : "start" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "regex": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "string.regexp", - regex: "/\\w*", - next: "no_regex" - }, { - token : "invalid", - regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ - }, { - token : "constant.language.escape", - regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/ - }, { - token : "constant.language.delimiter", - regex: /\|/ - }, { - token: "constant.language.escape", - regex: /\[\^?/, - next: "regex_character_class" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp" - } - ], - "regex_character_class": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "constant.language.escape", - regex: "]", - next: "regex" - }, { - token: "constant.language.escape", - regex: "-" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp.charachterclass" - } - ], - "function_arguments": [ - { - token: "variable.parameter", - regex: identifierRe - }, { - token: "punctuation.operator", - regex: "[, ]+" - }, { - token: "punctuation.operator", - regex: "$" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "comment_regex_allowed" : [ - {token : "comment", regex : "\\*\\/", next : "start"}, - {defaultToken : "comment"} - ], - "comment" : [ - {token : "comment", regex : "\\*\\/", next : "no_regex"}, - {defaultToken : "comment"} - ], - "line_comment_regex_allowed" : [ - {token : "comment", regex : "$|^", next : "start"}, - {defaultToken : "comment"} - ], - "line_comment" : [ - {token : "comment", regex : "$|^", next : "no_regex"}, - {defaultToken : "comment"} - ], - "qqstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qqstring" - }, { - token : "string", - regex : '"|$', - next : "no_regex" - }, { - defaultToken: "string" - } - ], - "qstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qstring" - }, { - token : "string", - regex : "'|$", - next : "no_regex" - }, { - defaultToken: "string" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("no_regex") ]); -}; - -oop.inherits(JavaScriptHighlightRules, TextHighlightRules); - -exports.JavaScriptHighlightRules = JavaScriptHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); - -define('ace/mode/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/xml_highlight_rules', 'ace/mode/behaviour/xml', 'ace/mode/folding/xml'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; -var XmlBehaviour = require("./behaviour/xml").XmlBehaviour; -var XmlFoldMode = require("./folding/xml").FoldMode; - -var Mode = function() { - this.HighlightRules = XmlHighlightRules; - this.$behaviour = new XmlBehaviour(); - this.foldingRules = new XmlFoldMode(); -}; - -oop.inherits(Mode, TextMode); - -(function() { - - this.blockComment = {start: ""}; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/xml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml_util', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var xmlUtil = require("./xml_util"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var XmlHighlightRules = function(normalize) { - this.$rules = { - start : [ - {token : "punctuation.string.begin", regex : "<\\!\\[CDATA\\[", next : "cdata"}, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)(xml)(?=[\\s])", next : "xml_declaration" - }, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)([-_a-zA-Z0-9]+)", next : "instruction" - }, - {token : "comment", regex : "<\\!--", next : "comment"}, - { - token : ["punctuation.doctype.begin", "meta.tag.doctype"], - regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype" - }, - {include : "tag"}, - {include : "reference"} - ], - - xml_declaration : [ - {include : "attributes"}, - {include : "instruction"} - ], - - instruction : [ - {token : "punctuation.instruction.end", regex : "\\?>", next : "start"} - ], - - doctype : [ - {include : "space"}, - {include : "string"}, - {token : "punctuation.doctype.end", regex : ">", next : "start"}, - {token : "xml-pe", regex : "[-_a-zA-Z0-9:]+"}, - {token : "punctuation.begin", regex : "\\[", push : "declarations"} - ], - - declarations : [{ - token : "text", - regex : "\\s+" - }, { - token: "punctuation.end", - regex: "]", - next: "pop" - }, { - token : ["punctuation.begin", "keyword"], - regex : "(<\\!)([-_a-zA-Z0-9]+)", - push : [{ - token : "text", - regex : "\\s+" - }, - { - token : "punctuation.end", - regex : ">", - next : "pop" - }, - {include : "string"}] - }], - - cdata : [ - {token : "string.end", regex : "\\]\\]>", next : "start"}, - {token : "text", regex : "\\s+"}, - {token : "text", regex : "(?:[^\\]]|\\](?!\\]>))+"} - ], - - comment : [ - {token : "comment", regex : "-->", next : "start"}, - {defaultToken : "comment"} - ], - - tag : [{ - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(<)((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)", - next: [ - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : "start"} - ] - }, { - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(", next : "start"} - ] - }], - - space : [ - {token : "text", regex : "\\s+"} - ], - - reference : [{ - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, { - token : "invalid.illegal", regex : "&" - }], - - string: [{ - token : "string", - regex : "'", - push : "qstring_inner" - }, { - token : "string", - regex : '"', - push : "qqstring_inner" - }], - - qstring_inner: [ - {token : "string", regex: "'", next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - qqstring_inner: [ - {token : "string", regex: '"', next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - attributes: [{ - token : "entity.other.attribute-name", - regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+" - }, { - token : "keyword.operator.separator", - regex : "=" - }, { - include : "space" - }, { - include : "string" - }] - }; - - if (this.constructor === XmlHighlightRules) - this.normalizeRules(); -}; - - -(function() { - - this.embedTagRules = function(HighlightRules, prefix, tag){ - this.$rules.tag.unshift({ - token : ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(<)(" + tag + ")", - next: [ - {include : "space"}, - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : prefix + "start"} - ] - }); - - this.$rules[tag + "-end"] = [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next: "start", - onMatch : function(value, currentState, stack) { - stack.splice(0); - return this.token; - }} - ] - - this.embedRules(HighlightRules, prefix, [{ - token: ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(" - }]); - }; - -}).call(TextHighlightRules.prototype); - -oop.inherits(XmlHighlightRules, TextHighlightRules); - -exports.XmlHighlightRules = XmlHighlightRules; -}); - -define('ace/mode/xml_util', ['require', 'exports', 'module' ], function(require, exports, module) { - - -function string(state) { - return [{ - token : "string", - regex : '"', - next : state + "_qqstring" - }, { - token : "string", - regex : "'", - next : state + "_qstring" - }]; -} - -function multiLineString(quote, state) { - return [ - {token : "string", regex : quote, next : state}, - { - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, - {defaultToken : "string"} - ]; -} - -exports.tag = function(states, name, nextState, tagMap) { - states[name] = [{ - token : "text", - regex : "\\s+" - }, { - - token : !tagMap ? "meta.tag.tag-name" : function(value) { - if (tagMap[value]) - return "meta.tag.tag-name." + tagMap[value]; - else - return "meta.tag.tag-name"; - }, - regex : "[-_a-zA-Z0-9:]+", - next : name + "_embed_attribute_list" - }, { - token: "empty", - regex: "", - next : 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"] = [{ - token : "meta.tag.r", - regex : "/?>", - next : nextState - }, { - token : "keyword.operator", - regex : "=" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "text", - regex : "\\s+" - }].concat(string(name)); -}; - -}); - -define('ace/mode/behaviour/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); - return hasType; -} - -var XmlBehaviour = function () { - - this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour - - this.add("autoclosing", "insertion", function (state, action, editor, session, text) { - if (text == '>') { - var position = editor.getCursorPosition(); - var iterator = new TokenIterator(session, position.row, position.column); - var token = iterator.getCurrentToken(); - - if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column) - return; - var atCursor = false; - if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text'))); - } else { - atCursor = true; - } - if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) { - return; - } - var tag = token.value; - if (atCursor){ - var tag = tag.substring(0, position.column - token.start); - } - - return { - text: '>' + '', - selection: [1, 1] - } - } - }); - - this.add('autoindent', 'insertion', function (state, action, editor, session, text) { - if (text == "\n") { - var cursor = editor.getCursorPosition(); - var line = session.getLine(cursor.row); - var rightChars = line.substring(cursor.column, cursor.column + 2); - if (rightChars == '?)/; - this._parseTag = function(tag) { - - var match = tag.match(this.tagRe); - var column = 0; - - return { - value: tag, - match: match ? match[2] : "", - closing: match ? !!match[3] : false, - selfClosing: match ? !!match[5] || match[2] == "/>" : false, - tagName: match ? match[4] : "", - column: match[1] ? column + match[1].length : column - }; - }; - this._readTagForward = function(iterator) { - var token = iterator.getCurrentToken(); - if (!token) - return null; - - var value = ""; - var start; - - do { - if (token.type.lastIndexOf("meta.tag", 0) === 0) { - if (!start) { - var start = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() - }; - } - value += token.value; - if (value.indexOf(">") !== -1) { - var tag = this._parseTag(value); - tag.start = start; - tag.end = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() + token.value.length - }; - iterator.stepForward(); - return tag; - } - } - } while(token = iterator.stepForward()); - - return null; - }; - - this._readTagBackward = function(iterator) { - var token = iterator.getCurrentToken(); - if (!token) - return null; - - var value = ""; - var end; - - do { - if (token.type.lastIndexOf("meta.tag", 0) === 0) { - if (!end) { - end = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() + token.value.length - }; - } - value = token.value + value; - if (value.indexOf("<") !== -1) { - var tag = this._parseTag(value); - tag.end = end; - tag.start = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() - }; - iterator.stepBackward(); - return tag; - } - } - } while(token = iterator.stepBackward()); - - return null; - }; - - this._pop = function(stack, tag) { - while (stack.length) { - - var top = stack[stack.length-1]; - if (!tag || top.tagName == tag.tagName) { - return stack.pop(); - } - else if (this.voidElements[tag.tagName]) { - return; - } - else if (this.voidElements[top.tagName]) { - stack.pop(); - continue; - } else { - return null; - } - } - }; - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var firstTag = this._getFirstTagInLine(session, row); - - if (!firstTag.match) - return null; - - var isBackward = firstTag.closing || firstTag.selfClosing; - var stack = []; - var tag; - - if (!isBackward) { - var iterator = new TokenIterator(session, row, firstTag.column); - var start = { - row: row, - column: firstTag.column + firstTag.tagName.length + 2 - }; - while (tag = this._readTagForward(iterator)) { - if (tag.selfClosing) { - if (!stack.length) { - tag.start.column += tag.tagName.length + 2; - tag.end.column -= 2; - return Range.fromPoints(tag.start, tag.end); - } else - continue; - } - - if (tag.closing) { - this._pop(stack, tag); - if (stack.length == 0) - return Range.fromPoints(start, tag.start); - } - else { - stack.push(tag) - } - } - } - else { - var iterator = new TokenIterator(session, row, firstTag.column + firstTag.match.length); - var end = { - row: row, - column: firstTag.column - }; - - while (tag = this._readTagBackward(iterator)) { - if (tag.selfClosing) { - if (!stack.length) { - tag.start.column += tag.tagName.length + 2; - tag.end.column -= 2; - return Range.fromPoints(tag.start, tag.end); - } else - continue; - } - - if (!tag.closing) { - this._pop(stack, tag); - if (stack.length == 0) { - tag.start.column += tag.tagName.length + 2; - return Range.fromPoints(tag.start, end); - } - } - else { - stack.push(tag) - } - } - } - - }; - -}).call(FoldMode.prototype); - -}); - -define('ace/mode/html', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/javascript', 'ace/mode/css', 'ace/tokenizer', 'ace/mode/html_highlight_rules', 'ace/mode/behaviour/html', 'ace/mode/folding/html', 'ace/mode/html_completions'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var JavaScriptMode = require("./javascript").Mode; -var CssMode = require("./css").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; -var HtmlBehaviour = require("./behaviour/html").HtmlBehaviour; -var HtmlFoldMode = require("./folding/html").FoldMode; -var HtmlCompletions = require("./html_completions").HtmlCompletions; - -var Mode = function() { - this.HighlightRules = HtmlHighlightRules; - this.$behaviour = new HtmlBehaviour(); - this.$completer = new HtmlCompletions(); - - this.createModeDelegates({ - "js-": JavaScriptMode, - "css-": CssMode - }); - - this.foldingRules = new HtmlFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.blockComment = {start: ""}; - - this.getNextLineIndent = function(state, line, tab) { - return this.$getIndent(line); - }; - - this.checkOutdent = function(state, line, input) { - return false; - }; - - this.getCompletions = function(state, session, pos, prefix) { - return this.$completer.getCompletions(state, session, pos, prefix); - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/css_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/worker/worker_client', 'ace/mode/behaviour/css', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var WorkerClient = require("../worker/worker_client").WorkerClient; -var CssBehaviour = require("./behaviour/css").CssBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = CssHighlightRules; - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CssBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.foldingRules = "cStyle"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - var tokens = this.getTokenizer().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); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker"); - worker.attachToDocument(session.getDocument()); - - worker.on("csslint", function(e) { - session.setAnnotations(e.data); - }); - - worker.on("terminate", function() { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; - -}); - -define('ace/mode/css_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var supportType = exports.supportType = "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"; -var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters"; -var supportConstant = exports.supportConstant = "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|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|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero"; -var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow"; -var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace"; - -var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))"; -var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b"; -var pseudoClasses = exports.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 CssHighlightRules = function() { - - var keywordMapper = this.createKeywordMapper({ - "support.function": supportFunction, - "support.constant": supportConstant, - "support.type": supportType, - "support.constant.color": supportConstantColor, - "support.constant.fonts": supportConstantFonts - }, "text", true); - - this.$rules = { - "start" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "@.*?{", - push: "media" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "media" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "\\}", - next: "pop" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "comment" : [{ - token : "comment", - regex : "\\*\\/", - next : "pop" - }, { - defaultToken : "comment" - }], - - "ruleset" : [ - { - token : "paren.rparen", - regex : "\\}", - next: "pop" - }, { - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - 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 : numRe - }, { - 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 : ["support.function", "string", "support.function"], - regex : "(url\\()(.*)(\\))" - }, { - token : keywordMapper, - regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*" - }, { - caseInsensitive: true - }] - }; - - this.normalizeRules(); -}; - -oop.inherits(CssHighlightRules, TextHighlightRules); - -exports.CssHighlightRules = CssHighlightRules; - -}); - -define('ace/mode/behaviour/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; - -var CssBehaviour = function () { - - this.inherit(CstyleBehaviour); - - this.add("colon", "insertion", function (state, action, editor, session, text) { - if (text === ':') { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - var token = iterator.getCurrentToken(); - if (token && token.value.match(/\s+/)) { - token = iterator.stepBackward(); - } - if (token && token.type === 'support.type') { - var line = session.doc.getLine(cursor.row); - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar === ':') { - return { - text: '', - selection: [1, 1] - } - } - if (!line.substring(cursor.column).match(/^\s*;/)) { - return { - text: ':;', - selection: [1, 1] - } - } - } - } - }); - - this.add("colon", "deletion", function (state, action, editor, session, range) { - var selected = session.doc.getTextRange(range); - if (!range.isMultiLine() && selected === ':') { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - var token = iterator.getCurrentToken(); - if (token && token.value.match(/\s+/)) { - token = iterator.stepBackward(); - } - if (token && token.type === 'support.type') { - 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("semicolon", "insertion", function (state, action, editor, session, text) { - if (text === ';') { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar === ';') { - return { - text: '', - selection: [1, 1] - } - } - } - }); - -} -oop.inherits(CssBehaviour, CstyleBehaviour); - -exports.CssBehaviour = CssBehaviour; -}); - -define('ace/mode/html_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/css_highlight_rules', 'ace/mode/javascript_highlight_rules', 'ace/mode/xml_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; - -var tagMap = lang.createMap({ - a : 'anchor', - button : 'form', - form : 'form', - img : 'image', - input : 'form', - label : 'form', - option : 'form', - script : 'script', - select : 'form', - textarea : 'form', - style : 'style', - table : 'table', - tbody : 'table', - td : 'table', - tfoot : 'table', - th : 'table', - tr : 'table' -}); - -var HtmlHighlightRules = function() { - XmlHighlightRules.call(this); - - this.addRules({ - attributes: [{ - include : "space" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "keyword.operator.separator", - regex : "=", - push : [{ - include: "space" - }, { - token : "string", - regex : "[^<>='\"`\\s]+", - next : "pop" - }, { - token : "empty", - regex : "", - next : "pop" - }] - }, { - include : "string" - }], - tag: [{ - token : function(start, tag) { - var group = tagMap[tag]; - return ["meta.tag.punctuation.begin", - "meta.tag.name" + (group ? "." + group : "")]; - }, - regex : "(<)([-_a-zA-Z0-9:]+)", - next: "start_tag_stuff" - }, { - token : function(start, tag) { - var group = tagMap[tag]; - return ["meta.tag.punctuation.begin", - "meta.tag.name" + (group ? "." + group : "")]; - }, - regex : "(", next : "start"} - ], - end_tag_stuff: [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next : "start"} - ] - }); - - this.embedTagRules(CssHighlightRules, "css-", "style"); - this.embedTagRules(JavaScriptHighlightRules, "js-", "script"); - - if (this.constructor === HtmlHighlightRules) - this.normalizeRules(); -}; - -oop.inherits(HtmlHighlightRules, XmlHighlightRules); - -exports.HtmlHighlightRules = HtmlHighlightRules; -}); - -define('ace/mode/behaviour/html', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour/xml', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var XmlBehaviour = require("../behaviour/xml").XmlBehaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var voidElements = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']; - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); - return hasType; -} - -var HtmlBehaviour = function () { - - this.inherit(XmlBehaviour); // Get xml behaviour - - this.add("autoclosing", "insertion", function (state, action, editor, session, text) { - if (text == '>') { - var position = editor.getCursorPosition(); - var iterator = new TokenIterator(session, position.row, position.column); - var token = iterator.getCurrentToken(); - - if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column) - return; - var atCursor = false; - if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text'))); - } else { - atCursor = true; - } - if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) { - return; - } - var element = token.value; - if (atCursor){ - var element = element.substring(0, position.column - token.start); - } - if (voidElements.indexOf(element) !== -1){ - return; - } - return { - text: '>' + '', - selection: [1, 1] - } - } - }); -} -oop.inherits(HtmlBehaviour, XmlBehaviour); - -exports.HtmlBehaviour = HtmlBehaviour; -}); - -define('ace/mode/folding/html', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/mixed', 'ace/mode/folding/xml', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var MixedFoldMode = require("./mixed").FoldMode; -var XmlFoldMode = require("./xml").FoldMode; -var CStyleFoldMode = require("./cstyle").FoldMode; - -var FoldMode = exports.FoldMode = function() { - MixedFoldMode.call(this, new XmlFoldMode({ - "area": 1, - "base": 1, - "br": 1, - "col": 1, - "command": 1, - "embed": 1, - "hr": 1, - "img": 1, - "input": 1, - "keygen": 1, - "link": 1, - "meta": 1, - "param": 1, - "source": 1, - "track": 1, - "wbr": 1, - "li": 1, - "dt": 1, - "dd": 1, - "p": 1, - "rt": 1, - "rp": 1, - "optgroup": 1, - "option": 1, - "colgroup": 1, - "td": 1, - "th": 1 - }), { - "js-": new CStyleFoldMode(), - "css-": new CStyleFoldMode() - }); -}; - -oop.inherits(FoldMode, MixedFoldMode); - -}); - -define('ace/mode/folding/mixed', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(defaultMode, subModes) { - this.defaultMode = defaultMode; - this.subModes = subModes; -}; -oop.inherits(FoldMode, BaseFoldMode); - -(function() { - - - this.$getMode = function(state) { - if (typeof state != "string") - state = state[0]; - for (var key in this.subModes) { - if (state.indexOf(key) === 0) - return this.subModes[key]; - } - return null; - }; - - this.$tryMode = function(state, session, foldStyle, row) { - var mode = this.$getMode(state); - return (mode ? mode.getFoldWidget(session, foldStyle, row) : ""); - }; - - this.getFoldWidget = function(session, foldStyle, row) { - return ( - this.$tryMode(session.getState(row-1), session, foldStyle, row) || - this.$tryMode(session.getState(row), session, foldStyle, row) || - this.defaultMode.getFoldWidget(session, foldStyle, row) - ); - }; - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var mode = this.$getMode(session.getState(row-1)); - - if (!mode || !mode.getFoldWidget(session, foldStyle, row)) - mode = this.$getMode(session.getState(row)); - - if (!mode || !mode.getFoldWidget(session, foldStyle, row)) - mode = this.defaultMode; - - return mode.getFoldWidgetRange(session, foldStyle, row); - }; - -}).call(FoldMode.prototype); - -}); - -define('ace/mode/html_completions', ['require', 'exports', 'module' , 'ace/token_iterator'], function(require, exports, module) { - - -var TokenIterator = require("../token_iterator").TokenIterator; - -var commonAttributes = [ - "accesskey", - "class", - "contenteditable", - "contextmenu", - "dir", - "draggable", - "dropzone", - "hidden", - "id", - "lang", - "spellcheck", - "style", - "tabindex", - "title", - "translate" -]; - -var eventAttributes = [ - "onabort", - "onblur", - "oncancel", - "oncanplay", - "oncanplaythrough", - "onchange", - "onclick", - "onclose", - "oncontextmenu", - "oncuechange", - "ondblclick", - "ondrag", - "ondragend", - "ondragenter", - "ondragleave", - "ondragover", - "ondragstart", - "ondrop", - "ondurationchange", - "onemptied", - "onended", - "onerror", - "onfocus", - "oninput", - "oninvalid", - "onkeydown", - "onkeypress", - "onkeyup", - "onload", - "onloadeddata", - "onloadedmetadata", - "onloadstart", - "onmousedown", - "onmousemove", - "onmouseout", - "onmouseover", - "onmouseup", - "onmousewheel", - "onpause", - "onplay", - "onplaying", - "onprogress", - "onratechange", - "onreset", - "onscroll", - "onseeked", - "onseeking", - "onselect", - "onshow", - "onstalled", - "onsubmit", - "onsuspend", - "ontimeupdate", - "onvolumechange", - "onwaiting" -]; - -var globalAttributes = commonAttributes.concat(eventAttributes); - -var attributeMap = { - "html": ["manifest"], - "head": [], - "title": [], - "base": ["href", "target"], - "link": ["href", "hreflang", "rel", "media", "type", "sizes"], - "meta": ["http-equiv", "name", "content", "charset"], - "style": ["type", "media", "scoped"], - "script": ["charset", "type", "src", "defer", "async"], - "noscript": ["href"], - "body": ["onafterprint", "onbeforeprint", "onbeforeunload", "onhashchange", "onmessage", "onoffline", "onpopstate", "onredo", "onresize", "onstorage", "onundo", "onunload"], - "section": [], - "nav": [], - "article": ["pubdate"], - "aside": [], - "h1": [], - "h2": [], - "h3": [], - "h4": [], - "h5": [], - "h6": [], - "header": [], - "footer": [], - "address": [], - "main": [], - "p": [], - "hr": [], - "pre": [], - "blockquote": ["cite"], - "ol": ["start", "reversed"], - "ul": [], - "li": ["value"], - "dl": [], - "dt": [], - "dd": [], - "figure": [], - "figcaption": [], - "div": [], - "a": ["href", "target", "ping", "rel", "media", "hreflang", "type"], - "em": [], - "strong": [], - "small": [], - "s": [], - "cite": [], - "q": ["cite"], - "dfn": [], - "abbr": [], - "data": [], - "time": ["datetime"], - "code": [], - "var": [], - "samp": [], - "kbd": [], - "sub": [], - "sup": [], - "i": [], - "b": [], - "u": [], - "mark": [], - "ruby": [], - "rt": [], - "rp": [], - "bdi": [], - "bdo": [], - "span": [], - "br": [], - "wbr": [], - "ins": ["cite", "datetime"], - "del": ["cite", "datetime"], - "img": ["alt", "src", "height", "width", "usemap", "ismap"], - "iframe": ["name", "src", "height", "width", "sandbox", "seamless"], - "embed": ["src", "height", "width", "type"], - "object": ["param", "data", "type", "height" , "width", "usemap", "name", "form", "classid"], - "param": ["name", "value"], - "video": ["src", "autobuffer", "autoplay", "loop", "controls", "width", "height", "poster"], - "audio": ["src", "autobuffer", "autoplay", "loop", "controls"], - "source": ["src", "type", "media"], - "track": ["kind", "src", "srclang", "label", "default"], - "canvas": ["width", "height"], - "map": ["name"], - "area": ["shape", "coords", "href", "hreflang", "alt", "target", "media", "rel", "ping", "type"], - "svg": [], - "math": [], - "table": ["summary"], - "caption": [], - "colgroup": ["span"], - "col": ["span"], - "tbody": [], - "thead": [], - "tfoot": [], - "tr": [], - "td": ["headers", "rowspan", "colspan"], - "th": ["headers", "rowspan", "colspan", "scope"], - "form": ["accept-charset", "action", "autocomplete", "enctype", "method", "name", "novalidate", "target"], - "fieldset": ["disabled", "form", "name"], - "legend": [], - "label": ["form", "for"], - "input": ["type", "accept", "alt", "autocomplete", "checked", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "height", "list", "max", "maxlength", "min", "multiple", "pattern", "placeholder", "readonly", "required", "size", "src", "step", "width", "files", "value"], - "button": ["autofocus", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "name", "value", "type"], - "select": ["autofocus", "disabled", "form", "multiple", "name", "size"], - "datalist": [], - "optgroup": ["disabled", "label"], - "option": ["disabled", "selected", "label", "value"], - "textarea": ["autofocus", "disabled", "form", "maxlength", "name", "placeholder", "readonly", "required", "rows", "cols", "wrap"], - "keygen": ["autofocus", "challenge", "disabled", "form", "keytype", "name"], - "output": ["for", "form", "name"], - "progress": ["value", "max"], - "meter": ["value", "min", "max", "low", "high", "optimum"], - "details": ["open"], - "summary": [], - "command": ["type", "label", "icon", "disabled", "checked", "radiogroup", "command"], - "menu": ["type", "label"], - "dialog": ["open"] -}; - -var allElements = Object.keys(attributeMap); - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); -} - -function findTagName(session, pos) { - var iterator = new TokenIterator(session, pos.row, pos.column); - var token = iterator.getCurrentToken(); - if (!token || !hasType(token, 'tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'operator') || hasType(token, 'attribute-name') || hasType(token, 'text'))); - } - if (token && hasType(token, 'tag-name') && !iterator.stepBackward().value.match('/')) - return token.value; -} - -var HtmlCompletions = function() { - -}; - -(function() { - - this.getCompletions = function(state, session, pos, prefix) { - var token = session.getTokenAt(pos.row, pos.column); - - if (!token) - return []; - if (hasType(token, "tag-name") || (token.value == '<' && hasType(token, "text"))) - return this.getTagCompletions(state, session, pos, prefix); - if (hasType(token, 'text') || hasType(token, 'attribute-name')) - return this.getAttributeCompetions(state, session, pos, prefix); - - return []; - }; - - this.getTagCompletions = function(state, session, pos, prefix) { - var elements = allElements; - if (prefix) { - elements = elements.filter(function(element){ - return element.indexOf(prefix) === 0; - }); - } - return elements.map(function(element){ - return { - value: element, - meta: "tag" - }; - }); - }; - - this.getAttributeCompetions = function(state, session, pos, prefix) { - var tagName = findTagName(session, pos); - if (!tagName) - return []; - var attributes = globalAttributes; - if (tagName in attributeMap) { - attributes = attributes.concat(attributeMap[tagName]); - } - if (prefix) { - attributes = attributes.filter(function(attribute){ - return attribute.indexOf(prefix) === 0; - }); - } - return attributes.map(function(attribute){ - return { - caption: attribute, - snippet: attribute + '="$0"', - meta: "attribute" - }; - }); - }; - -}).call(HtmlCompletions.prototype); - -exports.HtmlCompletions = HtmlCompletions; -}); - -define('ace/mode/markdown_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules', 'ace/mode/javascript_highlight_rules', 'ace/mode/xml_highlight_rules', 'ace/mode/html_highlight_rules', 'ace/mode/css_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; -var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; - -var escaped = function(ch) { - return "(?:[^" + lang.escapeRegExp(ch) + "\\\\]|\\\\.)*"; -} - -function github_embed(tag, prefix) { - return { // Github style block - token : "support.function", - regex : "^```" + tag + "\\s*$", - push : prefix + "start" - }; -} - -var MarkdownHighlightRules = function() { - HtmlHighlightRules.call(this); - - this.$rules["start"].unshift({ - token : "empty_line", - regex : '^$', - next: "allowBlock" - }, { // h1 - token: "markup.heading.1", - regex: "^=+(?=\\s*$)" - }, { // h2 - token: "markup.heading.2", - regex: "^\\-+(?=\\s*$)" - }, { - token : function(value) { - return "markup.heading." + value.length; - }, - regex : /^#{1,6}(?=\s*[^ #]|\s+#.)/, - next : "header" - }, - github_embed("(?:javascript|js)", "jscode-"), - github_embed("xml", "xmlcode-"), - github_embed("html", "htmlcode-"), - github_embed("css", "csscode-"), - { // Github style block - token : "support.function", - regex : "^```\\s*[a-zA-Z]*(?:{.*?\\})?\\s*$", - next : "githubblock" - }, { // block quote - token : "string", - regex : "^>[ ].+$", - next : "blockquote" - }, { // HR * - _ - token : "constant", - regex : "^ {0,2}(?:(?: ?\\* ?){3,}|(?: ?\\- ?){3,}|(?: ?\\_ ?){3,})\\s*$", - next: "allowBlock" - }, { // list - token : "markup.list", - regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+", - next : "listblock-start" - }, { - include : "basic" - }); - - this.addRules({ - "basic" : [{ - token : "constant.language.escape", - regex : /\\[\\`*_{}\[\]()#+\-.!]/ - }, { // code span ` - token : "support.function", - regex : "(`+)(.*?[^`])(\\1)" - }, { // reference - token : ["text", "constant", "text", "url", "string", "text"], - regex : "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?(\\s*))$" - }, { // link by reference - token : ["text", "string", "text", "constant", "text"], - regex : "(\\[)(" + escaped("]") + ")(\\]\s*\\[)("+ escaped("]") + ")(\\])" - }, { // link by url - token : ["text", "string", "text", "markup.underline", "string", "text"], - regex : "(\\[)(" + // [ - escaped("]") + // link text - ")(\\]\\()"+ // ]( - '((?:[^\\)\\s\\\\]|\\\\.|\\s(?=[^"]))*)' + // href - '(\\s*"' + escaped('"') + '"\\s*)?' + // "title" - "(\\))" // ) - }, { // strong ** __ - token : "string", - regex : "([*]{2}|[_]{2}(?=\\S))(.*?\\S[*_]*)(\\1)" - }, { // emphasis * _ - token : "string", - regex : "([*]|[_](?=\\S))(.*?\\S[*_]*)(\\1)" - }, { // - token : ["text", "url", "text"], - regex : "(<)("+ - "(?:https?|ftp|dict):[^'\">\\s]+"+ - "|"+ - "(?:mailto:)?[-.\\w]+\\@[-a-z0-9]+(?:\\.[-a-z0-9]+)*\\.[a-z]+"+ - ")(>)" - }], - "allowBlock": [ - {token : "support.function", regex : "^ {4}.+", next : "allowBlock"}, - {token : "empty", regex : "", next : "start"} - ], - - "header" : [{ - regex: "$", - next : "start" - }, { - include: "basic" - }, { - defaultToken : "heading" - } ], - - "listblock-start" : [{ - token : "support.variable", - regex : /(?:\[[ x]\])?/, - next : "listblock" - }], - - "listblock" : [ { // Lists only escape on completely blank lines. - token : "empty_line", - regex : "^$", - next : "start" - }, { // list - token : "markup.list", - regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+", - next : "listblock-start" - }, { - include : "basic", noEscape: true - }, { - defaultToken : "list" - } ], - - "blockquote" : [ { // BLockquotes only escape on blank lines. - token : "empty_line", - regex : "^\\s*$", - next : "start" - }, { - token : "string", - regex : ".+" - } ], - - "githubblock" : [ { - token : "support.function", - regex : "^```", - next : "start" - }, { - token : "support.function", - regex : ".+" - } ] - }); - - this.embedRules(JavaScriptHighlightRules, "jscode-", [{ - token : "support.function", - regex : "^```", - next : "pop" - }]); - - this.embedRules(HtmlHighlightRules, "htmlcode-", [{ - token : "support.function", - regex : "^```", - next : "pop" - }]); - - this.embedRules(CssHighlightRules, "csscode-", [{ - token : "support.function", - regex : "^```", - next : "pop" - }]); - - this.embedRules(XmlHighlightRules, "xmlcode-", [{ - token : "support.function", - regex : "^```", - next : "pop" - }]); - - this.normalizeRules(); -}; -oop.inherits(MarkdownHighlightRules, TextHighlightRules); - -exports.MarkdownHighlightRules = MarkdownHighlightRules; -}); - -define('ace/mode/folding/markdown', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var BaseFoldMode = require("./fold_mode").FoldMode; -var Range = require("../../range").Range; - -var FoldMode = exports.FoldMode = function() {}; -oop.inherits(FoldMode, BaseFoldMode); - -(function() { - this.foldingStartMarker = /^(?:[=-]+\s*$|#{1,6} |`{3})/; - - this.getFoldWidget = function(session, foldStyle, row) { - var line = session.getLine(row); - if (!this.foldingStartMarker.test(line)) - return ""; - - if (line[0] == "`") { - if (session.bgTokenizer.getState(row) == "start") - return "end"; - return "start"; - } - - return "start"; - }; - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var line = session.getLine(row); - var startColumn = line.length; - var maxRow = session.getLength(); - var startRow = row; - var endRow = row; - if (!line.match(this.foldingStartMarker)) - return; - - if (line[0] == "`") { - if (session.bgTokenizer.getState(row) !== "start") { - while (++row < maxRow) { - line = session.getLine(row); - if (line[0] == "`" & line.substring(0, 3) == "```") - break; - } - return new Range(startRow, startColumn, row, 0); - } else { - while (row -- > 0) { - line = session.getLine(row); - if (line[0] == "`" & line.substring(0, 3) == "```") - break; - } - return new Range(row, line.length, startRow, 0); - } - } - - var token; - function isHeading(row) { - token = session.getTokens(row)[0]; - return token && token.type.lastIndexOf(heading, 0) === 0; - } - - var heading = "markup.heading"; - function getLevel() { - var ch = token.value[0]; - if (ch == "=") return 6; - if (ch == "-") return 5; - return 7 - token.value.search(/[^#]/); - } - - if (isHeading(row)) { - var startHeadingLevel = getLevel(); - while (++row < maxRow) { - if (!isHeading(row)) - continue; - var level = getLevel(); - if (level >= startHeadingLevel) - break; - } - - endRow = row - (!token || ["=", "-"].indexOf(token.value[0]) == -1 ? 1 : 2); - - if (endRow > startRow) { - while (endRow > startRow && /^\s*$/.test(session.getLine(endRow))) - endRow--; - } - - if (endRow > startRow) { - var endColumn = session.getLine(endRow).length; - return new Range(startRow, startColumn, endRow, endColumn); - } - } - }; - -}).call(FoldMode.prototype); - -}); diff --git a/addons/editor/ace/mode-mushcode.js b/addons/editor/ace/mode-mushcode.js deleted file mode 100644 index 8b3b71e1..00000000 --- a/addons/editor/ace/mode-mushcode.js +++ /dev/null @@ -1,704 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2010, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/mode/mushcode', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/mushcode_high_rules', 'ace/mode/folding/pythonic', 'ace/range'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var MushCodeRules = require("./mushcode_high_rules").MushCodeRules; -var PythonFoldMode = require("./folding/pythonic").FoldMode; -var Range = require("../range").Range; - -var Mode = function() { - this.HighlightRules = MushCodeRules; - this.foldingRules = new PythonFoldMode("\\:"); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "#"; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().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.getTokenizer().getLineTokens(line.trim(), state).tokens; - - if (!tokens) - return false; - 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) { - - 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; -}); - -define('ace/mode/mushcode_high_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var MushCodeRules = function() { - - - var keywords = ( - "@if|"+ - "@ifelse|"+ - "@switch|"+ - "@halt|"+ - "@dolist|"+ - "@create|"+ - "@scent|"+ - "@sound|"+ - "@touch|"+ - "@ataste|"+ - "@osound|"+ - "@ahear|"+ - "@aahear|"+ - "@amhear|"+ - "@otouch|"+ - "@otaste|"+ - "@drop|"+ - "@odrop|"+ - "@adrop|"+ - "@dropfail|"+ - "@odropfail|"+ - "@smell|"+ - "@oemit|"+ - "@emit|"+ - "@pemit|"+ - "@parent|"+ - "@clone|"+ - "@taste|"+ - "whisper|"+ - "page|"+ - "say|"+ - "pose|"+ - "semipose|"+ - "teach|"+ - "touch|"+ - "taste|"+ - "smell|"+ - "listen|"+ - "look|"+ - "move|"+ - "go|"+ - "home|"+ - "follow|"+ - "unfollow|"+ - "desert|"+ - "dismiss|"+ - "@tel" - ); - - var builtinConstants = ( - "=#0" - ); - - var builtinFunctions = ( - "default|"+ - "edefault|"+ - "eval|"+ - "get_eval|"+ - "get|"+ - "grep|"+ - "grepi|"+ - "hasattr|"+ - "hasattrp|"+ - "hasattrval|"+ - "hasattrpval|"+ - "lattr|"+ - "nattr|"+ - "poss|"+ - "udefault|"+ - "ufun|"+ - "u|"+ - "v|"+ - "uldefault|"+ - "xget|"+ - "zfun|"+ - "band|"+ - "bnand|"+ - "bnot|"+ - "bor|"+ - "bxor|"+ - "shl|"+ - "shr|"+ - "and|"+ - "cand|"+ - "cor|"+ - "eq|"+ - "gt|"+ - "gte|"+ - "lt|"+ - "lte|"+ - "nand|"+ - "neq|"+ - "nor|"+ - "not|"+ - "or|"+ - "t|"+ - "xor|"+ - "con|"+ - "entrances|"+ - "exit|"+ - "followers|"+ - "home|"+ - "lcon|"+ - "lexits|"+ - "loc|"+ - "locate|"+ - "lparent|"+ - "lsearch|"+ - "next|"+ - "num|"+ - "owner|"+ - "parent|"+ - "pmatch|"+ - "rloc|"+ - "rnum|"+ - "room|"+ - "where|"+ - "zone|"+ - "worn|"+ - "held|"+ - "carried|"+ - "acos|"+ - "asin|"+ - "atan|"+ - "ceil|"+ - "cos|"+ - "e|"+ - "exp|"+ - "fdiv|"+ - "fmod|"+ - "floor|"+ - "log|"+ - "ln|"+ - "pi|"+ - "power|"+ - "round|"+ - "sin|"+ - "sqrt|"+ - "tan|"+ - "aposs|"+ - "andflags|"+ - "conn|"+ - "commandssent|"+ - "controls|"+ - "doing|"+ - "elock|"+ - "findable|"+ - "flags|"+ - "fullname|"+ - "hasflag|"+ - "haspower|"+ - "hastype|"+ - "hidden|"+ - "idle|"+ - "isbaker|"+ - "lock|"+ - "lstats|"+ - "money|"+ - "who|"+ - "name|"+ - "nearby|"+ - "obj|"+ - "objflags|"+ - "photo|"+ - "poll|"+ - "powers|"+ - "pendingtext|"+ - "receivedtext|"+ - "restarts|"+ - "restarttime|"+ - "subj|"+ - "shortestpath|"+ - "tmoney|"+ - "type|"+ - "visible|"+ - "cat|"+ - "element|"+ - "elements|"+ - "extract|"+ - "filter|"+ - "filterbool|"+ - "first|"+ - "foreach|"+ - "fold|"+ - "grab|"+ - "graball|"+ - "index|"+ - "insert|"+ - "itemize|"+ - "items|"+ - "iter|"+ - "last|"+ - "ldelete|"+ - "map|"+ - "match|"+ - "matchall|"+ - "member|"+ - "mix|"+ - "munge|"+ - "pick|"+ - "remove|"+ - "replace|"+ - "rest|"+ - "revwords|"+ - "setdiff|"+ - "setinter|"+ - "setunion|"+ - "shuffle|"+ - "sort|"+ - "sortby|"+ - "splice|"+ - "step|"+ - "wordpos|"+ - "words|"+ - "add|"+ - "lmath|"+ - "max|"+ - "mean|"+ - "median|"+ - "min|"+ - "mul|"+ - "percent|"+ - "sign|"+ - "stddev|"+ - "sub|"+ - "val|"+ - "bound|"+ - "abs|"+ - "inc|"+ - "dec|"+ - "dist2d|"+ - "dist3d|"+ - "div|"+ - "floordiv|"+ - "mod|"+ - "modulo|"+ - "remainder|"+ - "vadd|"+ - "vdim|"+ - "vdot|"+ - "vmag|"+ - "vmax|"+ - "vmin|"+ - "vmul|"+ - "vsub|"+ - "vunit|"+ - "regedit|"+ - "regeditall|"+ - "regeditalli|"+ - "regediti|"+ - "regmatch|"+ - "regmatchi|"+ - "regrab|"+ - "regraball|"+ - "regraballi|"+ - "regrabi|"+ - "regrep|"+ - "regrepi|"+ - "after|"+ - "alphamin|"+ - "alphamax|"+ - "art|"+ - "before|"+ - "brackets|"+ - "capstr|"+ - "case|"+ - "caseall|"+ - "center|"+ - "containsfansi|"+ - "comp|"+ - "decompose|"+ - "decrypt|"+ - "delete|"+ - "edit|"+ - "encrypt|"+ - "escape|"+ - "if|"+ - "ifelse|"+ - "lcstr|"+ - "left|"+ - "lit|"+ - "ljust|"+ - "merge|"+ - "mid|"+ - "ostrlen|"+ - "pos|"+ - "repeat|"+ - "reverse|"+ - "right|"+ - "rjust|"+ - "scramble|"+ - "secure|"+ - "space|"+ - "spellnum|"+ - "squish|"+ - "strcat|"+ - "strmatch|"+ - "strinsert|"+ - "stripansi|"+ - "stripfansi|"+ - "strlen|"+ - "switch|"+ - "switchall|"+ - "table|"+ - "tr|"+ - "trim|"+ - "ucstr|"+ - "unsafe|"+ - "wrap|"+ - "ctitle|"+ - "cwho|"+ - "channels|"+ - "clock|"+ - "cflags|"+ - "ilev|"+ - "itext|"+ - "inum|"+ - "convsecs|"+ - "convutcsecs|"+ - "convtime|"+ - "ctime|"+ - "etimefmt|"+ - "isdaylight|"+ - "mtime|"+ - "secs|"+ - "msecs|"+ - "starttime|"+ - "time|"+ - "timefmt|"+ - "timestring|"+ - "utctime|"+ - "atrlock|"+ - "clone|"+ - "create|"+ - "cook|"+ - "dig|"+ - "emit|"+ - "lemit|"+ - "link|"+ - "oemit|"+ - "open|"+ - "pemit|"+ - "remit|"+ - "set|"+ - "tel|"+ - "wipe|"+ - "zemit|"+ - "fbcreate|"+ - "fbdestroy|"+ - "fbwrite|"+ - "fbclear|"+ - "fbcopy|"+ - "fbcopyto|"+ - "fbclip|"+ - "fbdump|"+ - "fbflush|"+ - "fbhset|"+ - "fblist|"+ - "fbstats|"+ - "qentries|"+ - "qentry|"+ - "play|"+ - "ansi|"+ - "break|"+ - "c|"+ - "asc|"+ - "die|"+ - "isdbref|"+ - "isint|"+ - "isnum|"+ - "isletters|"+ - "linecoords|"+ - "localize|"+ - "lnum|"+ - "nameshort|"+ - "null|"+ - "objeval|"+ - "r|"+ - "rand|"+ - "s|"+ - "setq|"+ - "setr|"+ - "soundex|"+ - "soundslike|"+ - "valid|"+ - "vchart|"+ - "vchart2|"+ - "vlabel|"+ - "@@|"+ - "bakerdays|"+ - "bodybuild|"+ - "box|"+ - "capall|"+ - "catalog|"+ - "children|"+ - "ctrailer|"+ - "darttime|"+ - "debt|"+ - "detailbar|"+ - "exploredroom|"+ - "fansitoansi|"+ - "fansitoxansi|"+ - "fullbar|"+ - "halfbar|"+ - "isdarted|"+ - "isnewbie|"+ - "isword|"+ - "lambda|"+ - "lobjects|"+ - "lplayers|"+ - "lthings|"+ - "lvexits|"+ - "lvobjects|"+ - "lvplayers|"+ - "lvthings|"+ - "newswrap|"+ - "numsuffix|"+ - "playerson|"+ - "playersthisweek|"+ - "randomad|"+ - "randword|"+ - "realrandword|"+ - "replacechr|"+ - "second|"+ - "splitamount|"+ - "strlenall|"+ - "text|"+ - "third|"+ - "tofansi|"+ - "totalac|"+ - "unique|"+ - "getaddressroom|"+ - "listpropertycomm|"+ - "listpropertyres|"+ - "lotowner|"+ - "lotrating|"+ - "lotratingcount|"+ - "lotvalue|"+ - "boughtproduct|"+ - "companyabb|"+ - "companyicon|"+ - "companylist|"+ - "companyname|"+ - "companyowners|"+ - "companyvalue|"+ - "employees|"+ - "invested|"+ - "productlist|"+ - "productname|"+ - "productowners|"+ - "productrating|"+ - "productratingcount|"+ - "productsoldat|"+ - "producttype|"+ - "ratedproduct|"+ - "soldproduct|"+ - "topproducts|"+ - "totalspentonproduct|"+ - "totalstock|"+ - "transfermoney|"+ - "uniquebuyercount|"+ - "uniqueproductsbought|"+ - "validcompany|"+ - "deletepicture|"+ - "fbsave|"+ - "getpicturesecurity|"+ - "haspicture|"+ - "listpictures|"+ - "picturesize|"+ - "replacecolor|"+ - "rgbtocolor|"+ - "savepicture|"+ - "setpicturesecurity|"+ - "showpicture|"+ - "piechart|"+ - "piechartlabel|"+ - "createmaze|"+ - "drawmaze|"+ - "drawwireframe" - ); - var keywordMapper = this.createKeywordMapper({ - "invalid.deprecated": "debugger", - "support.function": builtinFunctions, - "constant.language": builtinConstants, - "keyword": keywords - }, "identifier"); - - var strPre = "(?:r|u|ur|R|U|UR|Ur|uR)?"; - - var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))"; - var octInteger = "(?:0[oO]?[0-7]+)"; - var hexInteger = "(?:0[xX][\\dA-Fa-f]+)"; - var binInteger = "(?:0[bB][01]+)"; - var integer = "(?:" + decimalInteger + "|" + octInteger + "|" + hexInteger + "|" + binInteger + ")"; - - var exponent = "(?:[eE][+-]?\\d+)"; - var fraction = "(?:\\.\\d+)"; - var intPart = "(?:\\d+)"; - var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))"; - var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + exponent + ")"; - var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")"; - - this.$rules = { - "start" : [ - { - token : "variable", // mush substitution register - regex : "%[0-9]{1}" - }, - { - token : "variable", // mush substitution register - regex : "%q[0-9A-Za-z]{1}" - }, - { - token : "variable", // mush special character register - regex : "%[a-zA-Z]{1}" - }, - { - token: "variable.language", - regex: "%[a-z0-9-_]+" - }, - { - token : "constant.numeric", // imaginary - regex : "(?:" + floatNumber + "|\\d+)[jJ]\\b" - }, { - token : "constant.numeric", // float - regex : floatNumber - }, { - token : "constant.numeric", // long integer - regex : integer + "[lL]\\b" - }, { - token : "constant.numeric", // integer - regex : integer + "\\b" - }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" - }, { - token : "keyword.operator", - regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|#|%|<<|>>|\\||\\^|~|<|>|<=|=>|==|!=|<>|=" - }, { - token : "paren.lparen", - regex : "[\\[\\(\\{]" - }, { - token : "paren.rparen", - regex : "[\\]\\)\\}]" - }, { - token : "text", - regex : "\\s+" - } ] - }; -}; - -oop.inherits(MushCodeRules, TextHighlightRules); - -exports.MushCodeRules = MushCodeRules; -}); - -define('ace/mode/folding/pythonic', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(markers) { - this.foldingStartMarker = new RegExp("([\\[{])(?:\\s*)$|(" + markers + ")(?:\\s*)(?:#.*)?$"); -}; -oop.inherits(FoldMode, BaseFoldMode); - -(function() { - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var line = session.getLine(row); - var match = line.match(this.foldingStartMarker); - if (match) { - if (match[1]) - return this.openingBracketBlock(session, match[1], row, match.index); - if (match[2]) - return this.indentationBlock(session, row, match.index + match[2].length); - return this.indentationBlock(session, row); - } - } - -}).call(FoldMode.prototype); - -}); diff --git a/addons/editor/ace/mode-mysql.js b/addons/editor/ace/mode-mysql.js deleted file mode 100644 index 52905985..00000000 --- a/addons/editor/ace/mode-mysql.js +++ /dev/null @@ -1,184 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2010, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/mode/mysql', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/mysql_highlight_rules', 'ace/range'], function(require, exports, module) { - -var oop = require("../lib/oop"); -var TextMode = require("../mode/text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var MysqlHighlightRules = require("./mysql_highlight_rules").MysqlHighlightRules; -var Range = require("../range").Range; - -var Mode = function() { - this.HighlightRules = MysqlHighlightRules; -}; -oop.inherits(Mode, TextMode); - -(function() { - this.lineCommentStart = ["--", "#"]; // todo space - this.blockComment = {start: "/*", end: "*/"}; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/mysql_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var MysqlHighlightRules = function() { - - var mySqlKeywords = /*sql*/ "alter|and|as|asc|between|count|create|delete|desc|distinct|drop|from|having|in|insert|into|is|join|like|not|on|or|order|select|set|table|union|update|values|where" + "|accessible|action|add|after|algorithm|all|analyze|asensitive|at|authors|auto_increment|autocommit|avg|avg_row_length|before|binary|binlog|both|btree|cache|call|cascade|cascaded|case|catalog_name|chain|change|changed|character|check|checkpoint|checksum|class_origin|client_statistics|close|coalesce|code|collate|collation|collations|column|columns|comment|commit|committed|completion|concurrent|condition|connection|consistent|constraint|contains|continue|contributors|convert|cross|current_date|current_time|current_timestamp|current_user|cursor|data|database|databases|day_hour|day_microsecond|day_minute|day_second|deallocate|dec|declare|default|delay_key_write|delayed|delimiter|des_key_file|describe|deterministic|dev_pop|dev_samp|deviance|directory|disable|discard|distinctrow|div|dual|dumpfile|each|elseif|enable|enclosed|end|ends|engine|engines|enum|errors|escape|escaped|even|event|events|every|execute|exists|exit|explain|extended|fast|fetch|field|fields|first|flush|for|force|foreign|found_rows|full|fulltext|function|general|global|grant|grants|group|groupby_concat|handler|hash|help|high_priority|hosts|hour_microsecond|hour_minute|hour_second|if|ignore|ignore_server_ids|import|index|index_statistics|infile|inner|innodb|inout|insensitive|insert_method|install|interval|invoker|isolation|iterate|key|keys|kill|language|last|leading|leave|left|level|limit|linear|lines|list|load|local|localtime|localtimestamp|lock|logs|low_priority|master|master_heartbeat_period|master_ssl_verify_server_cert|masters|match|max|max_rows|maxvalue|message_text|middleint|migrate|min|min_rows|minute_microsecond|minute_second|mod|mode|modifies|modify|mutex|mysql_errno|natural|next|no|no_write_to_binlog|offline|offset|one|online|open|optimize|option|optionally|out|outer|outfile|pack_keys|parser|partition|partitions|password|phase|plugin|plugins|prepare|preserve|prev|primary|privileges|procedure|processlist|profile|profiles|purge|query|quick|range|read|read_write|reads|real|rebuild|recover|references|regexp|relaylog|release|remove|rename|reorganize|repair|repeatable|replace|require|resignal|restrict|resume|return|returns|revoke|right|rlike|rollback|rollup|row|row_format|rtree|savepoint|schedule|schema|schema_name|schemas|second_microsecond|security|sensitive|separator|serializable|server|session|share|show|signal|slave|slow|smallint|snapshot|soname|spatial|specific|sql|sql_big_result|sql_buffer_result|sql_cache|sql_calc_found_rows|sql_no_cache|sql_small_result|sqlexception|sqlstate|sqlwarning|ssl|start|starting|starts|status|std|stddev|stddev_pop|stddev_samp|storage|straight_join|subclass_origin|sum|suspend|table_name|table_statistics|tables|tablespace|temporary|terminated|to|trailing|transaction|trigger|triggers|truncate|uncommitted|undo|uninstall|unique|unlock|upgrade|usage|use|use_frm|user|user_resources|user_statistics|using|utc_date|utc_time|utc_timestamp|value|variables|varying|view|views|warnings|when|while|with|work|write|xa|xor|year_month|zerofill|begin|do|then|else|loop|repeat"; - var builtins = "by|bool|boolean|bit|blob|decimal|double|enum|float|long|longblob|longtext|medium|mediumblob|mediumint|mediumtext|time|timestamp|tinyblob|tinyint|tinytext|text|bigint|int|int1|int2|int3|int4|int8|integer|float|float4|float8|double|char|varbinary|varchar|varcharacter|precision|date|datetime|year|unsigned|signed|numeric" - var variable = "charset|clear|connect|edit|ego|exit|go|help|nopager|notee|nowarning|pager|print|prompt|quit|rehash|source|status|system|tee" - - var keywordMapper = this.createKeywordMapper({ - "support.function": builtins, - "keyword": mySqlKeywords, - "constant": "false|true|null|unknown|date|time|timestamp|ODBCdotTable|zerolessFloat", - "variable.language": variable - }, "identifier", true); - - - function string(rule) { - var start = rule.start; - var escapeSeq = rule.escape; - return { - token: "string.start", - regex: start, - next: [ - {token: "constant.language.escape", regex: escapeSeq}, - {token: "string.end", next: "start", regex: start}, - {defaultToken: "string"} - ] - }; - } - - this.$rules = { - "start" : [ { - token : "comment", regex : "(?:-- |#).*$" - }, - string({start: '"', escape: /\\[0'"bnrtZ\\%_]?/}), - string({start: "'", escape: /\\[0'"bnrtZ\\%_]?/}), - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : /\/\*/, - next : "comment" - }, { - token : "constant.numeric", // hex - regex : /0[xX][0-9a-fA-F]+|[xX]'[0-9a-fA-F]+'|0[bB][01]+|[bB]'[01]+'/ - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" - }, { - token : "constant.class", - regex : "@@?[a-zA-Z_$][a-zA-Z0-9_$]*\\b" - }, { - token : "constant.buildin", - regex : "`[^`]*`" - }, { - token : "keyword.operator", - regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|=" - }, { - token : "paren.lparen", - regex : "[\\(]" - }, { - token : "paren.rparen", - regex : "[\\)]" - }, { - token : "text", - regex : "\\s+" - } ], - "comment" : [ - {token : "comment", regex : "\\*\\/", next : "start"}, - {defaultToken : "comment"} - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]); - this.normalizeRules(); -}; - -oop.inherits(MysqlHighlightRules, TextHighlightRules); - -exports.MysqlHighlightRules = MysqlHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); diff --git a/addons/editor/ace/mode-nix.js b/addons/editor/ace/mode-nix.js deleted file mode 100644 index 9c6a3d12..00000000 --- a/addons/editor/ace/mode-nix.js +++ /dev/null @@ -1,887 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2012, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * Contributor(s): - * - * Zef Hemel - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/mode/nix', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/c_cpp', 'ace/tokenizer', 'ace/mode/nix_highlight_rules', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var CMode = require("./c_cpp").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var NixHighlightRules = require("./nix_highlight_rules").NixHighlightRules; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - CMode.call(this); - this.HighlightRules = NixHighlightRules; - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, CMode); - -(function() { - this.lineCommentStart = "#"; - this.blockComment = {start: "/*", end: "*/"}; -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/c_cpp', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/c_cpp_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var Range = require("../range").Range; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = c_cppHighlightRules; - - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().getLineTokens(line, state); - var tokens = tokenizedLine.tokens; - var endState = tokenizedLine.state; - - if (tokens.length && tokens[tokens.length-1].type == "comment") { - return indent; - } - - if (state == "start") { - var match = line.match(/^.*[\{\(\[]\s*$/); - if (match) { - indent += tab; - } - } else if (state == "doc-start") { - if (endState == "start") { - return ""; - } - var match = line.match(/^\s*(\/?)\*/); - if (match) { - if (match[1]) { - indent += " "; - } - indent += "* "; - } - } - - 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; -}); -define('ace/mode/c_cpp_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var cFunctions = exports.cFunctions = "\\s*\\bhypot(?:f|l)?|s(?:scanf|ystem|nprintf|ca(?:nf|lb(?:n(?:f|l)?|ln(?:f|l)?))|i(?:n(?:h(?:f|l)?|f|l)?|gn(?:al|bit))|tr(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(?:jmp|vbuf|locale|buf)|qrt(?:f|l)?|w(?:scanf|printf)|rand)|n(?:e(?:arbyint(?:f|l)?|xt(?:toward(?:f|l)?|after(?:f|l)?))|an(?:f|l)?)|c(?:s(?:in(?:h(?:f|l)?|f|l)?|qrt(?:f|l)?)|cos(?:h(?:f)?|f|l)?|imag(?:f|l)?|t(?:ime|an(?:h(?:f|l)?|f|l)?)|o(?:s(?:h(?:f|l)?|f|l)?|nj(?:f|l)?|pysign(?:f|l)?)|p(?:ow(?:f|l)?|roj(?:f|l)?)|e(?:il(?:f|l)?|xp(?:f|l)?)|l(?:o(?:ck|g(?:f|l)?)|earerr)|a(?:sin(?:h(?:f|l)?|f|l)?|cos(?:h(?:f|l)?|f|l)?|tan(?:h(?:f|l)?|f|l)?|lloc|rg(?:f|l)?|bs(?:f|l)?)|real(?:f|l)?|brt(?:f|l)?)|t(?:ime|o(?:upper|lower)|an(?:h(?:f|l)?|f|l)?|runc(?:f|l)?|gamma(?:f|l)?|mp(?:nam|file))|i(?:s(?:space|n(?:ormal|an)|cntrl|inf|digit|u(?:nordered|pper)|p(?:unct|rint)|finite|w(?:space|c(?:ntrl|type)|digit|upper|p(?:unct|rint)|lower|al(?:num|pha)|graph|xdigit|blank)|l(?:ower|ess(?:equal|greater)?)|al(?:num|pha)|gr(?:eater(?:equal)?|aph)|xdigit|blank)|logb(?:f|l)?|max(?:div|abs))|di(?:v|fftime)|_Exit|unget(?:c|wc)|p(?:ow(?:f|l)?|ut(?:s|c(?:har)?|wc(?:har)?)|error|rintf)|e(?:rf(?:c(?:f|l)?|f|l)?|x(?:it|p(?:2(?:f|l)?|f|l|m1(?:f|l)?)?))|v(?:s(?:scanf|nprintf|canf|printf|w(?:scanf|printf))|printf|f(?:scanf|printf|w(?:scanf|printf))|w(?:scanf|printf)|a_(?:start|copy|end|arg))|qsort|f(?:s(?:canf|e(?:tpos|ek))|close|tell|open|dim(?:f|l)?|p(?:classify|ut(?:s|c|w(?:s|c))|rintf)|e(?:holdexcept|set(?:e(?:nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(?:aiseexcept|ror)|get(?:e(?:nv|xceptflag)|round))|flush|w(?:scanf|ide|printf|rite)|loor(?:f|l)?|abs(?:f|l)?|get(?:s|c|pos|w(?:s|c))|re(?:open|e|ad|xp(?:f|l)?)|m(?:in(?:f|l)?|od(?:f|l)?|a(?:f|l|x(?:f|l)?)?))|l(?:d(?:iv|exp(?:f|l)?)|o(?:ngjmp|cal(?:time|econv)|g(?:1(?:p(?:f|l)?|0(?:f|l)?)|2(?:f|l)?|f|l|b(?:f|l)?)?)|abs|l(?:div|abs|r(?:int(?:f|l)?|ound(?:f|l)?))|r(?:int(?:f|l)?|ound(?:f|l)?)|gamma(?:f|l)?)|w(?:scanf|c(?:s(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?|mbs)|pbrk|ftime|len|r(?:chr|tombs)|xfrm)|to(?:b|mb)|rtomb)|printf|mem(?:set|c(?:hr|py|mp)|move))|a(?:s(?:sert|ctime|in(?:h(?:f|l)?|f|l)?)|cos(?:h(?:f|l)?|f|l)?|t(?:o(?:i|f|l(?:l)?)|exit|an(?:h(?:f|l)?|2(?:f|l)?|f|l)?)|b(?:s|ort))|g(?:et(?:s|c(?:har)?|env|wc(?:har)?)|mtime)|r(?:int(?:f|l)?|ound(?:f|l)?|e(?:name|alloc|wind|m(?:ove|quo(?:f|l)?|ainder(?:f|l)?))|a(?:nd|ise))|b(?:search|towc)|m(?:odf(?:f|l)?|em(?:set|c(?:hr|py|mp)|move)|ktime|alloc|b(?:s(?:init|towcs|rtowcs)|towc|len|r(?:towc|len)))\\b" - -var c_cppHighlightRules = function() { - - var keywordControls = ( - "break|case|continue|default|do|else|for|goto|if|_Pragma|" + - "return|switch|while|catch|operator|try|throw|using" - ); - - var storageType = ( - "asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" + - "_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|" + - "class|wchar_t|template" - ); - - var storageModifiers = ( - "const|extern|register|restrict|static|volatile|inline|private:|" + - "protected:|public:|friend|explicit|virtual|export|mutable|typename" - ); - - var keywordOperators = ( - "and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq" + - "const_cast|dynamic_cast|reinterpret_cast|static_cast|sizeof|namespace" - ); - - var builtinConstants = ( - "NULL|true|false|TRUE|FALSE" - ); - - var keywordMapper = this.$keywords = this.createKeywordMapper({ - "keyword.control" : keywordControls, - "storage.type" : storageType, - "storage.modifier" : storageModifiers, - "keyword.operator" : keywordOperators, - "variable.language": "this", - "constant.language": builtinConstants - }, "identifier"); - - var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\d\\$_\u00a1-\uffff]*\\b"; - - this.$rules = { - "start" : [ - { - token : "comment", - regex : "\\/\\/.*$" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // multi line string start - regex : '["].*\\\\$', - next : "qqstring" - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - token : "string", // multi line string start - regex : "['].*\\\\$", - next : "qstring" - }, { - token : "constant.numeric", // hex - regex : "0[xX][0-9a-fA-F]+(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b" - }, { - token : "keyword", // pre-compiler directives - regex : "#\\s*(?:include|import|pragma|line|define|undef|if|ifdef|else|elif|ifndef)\\b", - next : "directive" - }, { - token : "keyword", // special case pre-compiler directive - regex : "(?:#\\s*endif)\\b" - }, { - token : "support.function.C99.c", - regex : cFunctions - }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" - }, { - token : "keyword.operator", - regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)" - }, { - token : "punctuation.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 - regex : ".+" - } - ], - "qqstring" : [ - { - token : "string", - regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"', - next : "start" - }, { - token : "string", - regex : '.+' - } - ], - "qstring" : [ - { - token : "string", - regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'", - next : "start" - }, { - token : "string", - regex : '.+' - } - ], - "directive" : [ - { - token : "constant.other.multiline", - regex : /\\/ - }, - { - token : "constant.other.multiline", - regex : /.*\\/ - }, - { - token : "constant.other", - regex : "\\s*<.+?>", - next : "start" - }, - { - token : "constant.other", // single line - regex : '\\s*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]', - next : "start" - }, - { - token : "constant.other", // single line - regex : "\\s*['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']", - next : "start" - }, - { - token : "constant.other", - regex : /[^\\\/]+/, - next : "start" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("start") ]); -}; - -oop.inherits(c_cppHighlightRules, TextHighlightRules); - -exports.c_cppHighlightRules = c_cppHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); -define('ace/mode/nix_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - - var oop = require("../lib/oop"); - var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - - var NixHighlightRules = function() { - - var constantLanguage = "true|false"; - var keywordControl = "with|import|if|else|then|inherit"; - var keywordDeclaration = "let|in|rec"; - - var keywordMapper = this.createKeywordMapper({ - "constant.language.nix": constantLanguage, - "keyword.control.nix": keywordControl, - "keyword.declaration.nix": keywordDeclaration - }, "identifier"); - - this.$rules = { - "start": [{ - token: "comment", - regex: /#.*$/ - }, { - token: "comment", - regex: /\/\*/, - next: "comment" - }, { - token: "constant", - regex: "<[^>]+>" - }, { - regex: "(==|!=|<=?|>=?)", - token: ["keyword.operator.comparison.nix"] - }, { - regex: "((?:[+*/%-]|\\~)=)", - token: ["keyword.operator.assignment.arithmetic.nix"] - }, { - regex: "=", - token: "keyword.operator.assignment.nix" - }, { - token: "string", - regex: "''", - next: "qqdoc" - }, { - token: "string", - regex: "'", - next: "qstring" - }, { - token: "string", - regex: '"', - push: "qqstring" - }, { - token: "constant.numeric", // hex - regex: "0[xX][0-9a-fA-F]+\\b" - }, { - token: "constant.numeric", // float - regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token: keywordMapper, - regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" - }, { - regex: "}", - token: function(val, start, stack) { - return stack[1] && stack[1].charAt(0) == "q" ? "constant.language.escape" : "text"; - }, - next: "pop" - }], - "comment": [{ - token: "comment", // closing comment - regex: ".*?\\*\\/", - next: "start" - }, { - token: "comment", // comment spanning whole line - regex: ".+" - }], - "qqdoc": [ - { - token: "constant.language.escape", - regex: /\$\{/, - push: "start" - }, { - token: "string", - regex: "''", - next: "pop" - }, { - defaultToken: "string" - }], - "qqstring": [ - { - token: "constant.language.escape", - regex: /\$\{/, - push: "start" - }, { - token: "string", - regex: '"', - next: "pop" - }, { - defaultToken: "string" - }], - "qstring": [ - { - token: "constant.language.escape", - regex: /\$\{/, - push: "start" - }, { - token: "string", - regex: "'", - next: "pop" - }, { - defaultToken: "string" - }] - }; - - this.normalizeRules(); - }; - - oop.inherits(NixHighlightRules, TextHighlightRules); - - exports.NixHighlightRules = NixHighlightRules; -}); \ No newline at end of file diff --git a/addons/editor/ace/mode-powershell.js b/addons/editor/ace/mode-powershell.js deleted file mode 100644 index f91a7668..00000000 --- a/addons/editor/ace/mode-powershell.js +++ /dev/null @@ -1,618 +0,0 @@ -define('ace/mode/powershell', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/powershell_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var PowershellHighlightRules = require("./powershell_highlight_rules").PowershellHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = PowershellHighlightRules; - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - this.foldingRules = new CStyleFoldMode({start: "^\\s*(<#)", end: "^[#\\s]>\\s*$"}); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "#"; - this.blockComment = {start: "<#", end: "#>"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().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; - }; - - this.checkOutdent = function(state, line, input) { - return this.$outdent.checkOutdent(line, input); - }; - - this.autoOutdent = function(state, doc, row) { - this.$outdent.autoOutdent(doc, row); - }; - - - this.createWorker = function(session) { - return null; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); -define('ace/mode/powershell_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var PowershellHighlightRules = function() { - - var keywords = ( - "function|if|else|elseif|switch|while|default|for|do|until|break|continue|" + - "foreach|return|filter|in|trap|throw|param|begin|process|end" - ); - - var builtinFunctions = ( - "Get-Alias|Import-Alias|New-Alias|Set-Alias|Get-AuthenticodeSignature|Set-AuthenticodeSignature|" + - "Set-Location|Get-ChildItem|Clear-Item|Get-Command|Measure-Command|Trace-Command|" + - "Add-Computer|Checkpoint-Computer|Remove-Computer|Restart-Computer|Restore-Computer|Stop-Computer|" + - "Reset-ComputerMachinePassword|Test-ComputerSecureChannel|Add-Content|Get-Content|Set-Content|Clear-Content|" + - "Get-Command|Invoke-Command|Enable-ComputerRestore|Disable-ComputerRestore|Get-ComputerRestorePoint|Test-Connection|" + - "ConvertFrom-CSV|ConvertTo-CSV|ConvertTo-Html|ConvertTo-Xml|ConvertFrom-SecureString|ConvertTo-SecureString|" + - "Copy-Item|Export-Counter|Get-Counter|Import-Counter|Get-Credential|Get-Culture|" + - "Get-ChildItem|Get-Date|Set-Date|Remove-Item|Compare-Object|Get-Event|" + - "Get-WinEvent|New-Event|Remove-Event|Unregister-Event|Wait-Event|Clear-EventLog|" + - "Get-Eventlog|Limit-EventLog|New-Eventlog|Remove-EventLog|Show-EventLog|Write-EventLog|" + - "Get-EventSubscriber|Register-EngineEvent|Register-ObjectEvent|Register-WmiEvent|Get-ExecutionPolicy|Set-ExecutionPolicy|" + - "Export-Alias|Export-Clixml|Export-Console|Export-Csv|ForEach-Object|Format-Custom|" + - "Format-List|Format-Table|Format-Wide|Export-FormatData|Get-FormatData|Get-Item|" + - "Get-ChildItem|Get-Help|Add-History|Clear-History|Get-History|Invoke-History|" + - "Get-Host|Read-Host|Write-Host|Get-HotFix|Import-Clixml|Import-Csv|" + - "Invoke-Command|Invoke-Expression|Get-Item|Invoke-Item|New-Item|Remove-Item|" + - "Set-Item|Clear-ItemProperty|Copy-ItemProperty|Get-ItemProperty|Move-ItemProperty|New-ItemProperty|" + - "Remove-ItemProperty|Rename-ItemProperty|Set-ItemProperty|Get-Job|Receive-Job|Remove-Job|" + - "Start-Job|Stop-Job|Wait-Job|Stop-Process|Update-List|Get-Location|" + - "Pop-Location|Push-Location|Set-Location|Send-MailMessage|Add-Member|Get-Member|" + - "Move-Item|Compare-Object|Group-Object|Measure-Object|New-Object|Select-Object|" + - "Sort-Object|Where-Object|Out-Default|Out-File|Out-GridView|Out-Host|" + - "Out-Null|Out-Printer|Out-String|Convert-Path|Join-Path|Resolve-Path|" + - "Split-Path|Test-Path|Get-Pfxcertificate|Pop-Location|Push-Location|Get-Process|" + - "Start-Process|Stop-Process|Wait-Process|Enable-PSBreakpoint|Disable-PSBreakpoint|Get-PSBreakpoint|" + - "Set-PSBreakpoint|Remove-PSBreakpoint|Get-PSDrive|New-PSDrive|Remove-PSDrive|Get-PSProvider|" + - "Set-PSdebug|Enter-PSSession|Exit-PSSession|Export-PSSession|Get-PSSession|Import-PSSession|" + - "New-PSSession|Remove-PSSession|Disable-PSSessionConfiguration|Enable-PSSessionConfiguration|Get-PSSessionConfiguration|Register-PSSessionConfiguration|" + - "Set-PSSessionConfiguration|Unregister-PSSessionConfiguration|New-PSSessionOption|Add-PsSnapIn|Get-PsSnapin|Remove-PSSnapin|" + - "Get-Random|Read-Host|Remove-Item|Rename-Item|Rename-ItemProperty|Select-Object|" + - "Select-XML|Send-MailMessage|Get-Service|New-Service|Restart-Service|Resume-Service|" + - "Set-Service|Start-Service|Stop-Service|Suspend-Service|Sort-Object|Start-Sleep|" + - "ConvertFrom-StringData|Select-String|Tee-Object|New-Timespan|Trace-Command|Get-Tracesource|" + - "Set-Tracesource|Start-Transaction|Complete-Transaction|Get-Transaction|Use-Transaction|Undo-Transaction|" + - "Start-Transcript|Stop-Transcript|Add-Type|Update-TypeData|Get-Uiculture|Get-Unique|" + - "Update-Formatdata|Update-Typedata|Clear-Variable|Get-Variable|New-Variable|Remove-Variable|" + - "Set-Variable|New-WebServiceProxy|Where-Object|Write-Debug|Write-Error|Write-Host|" + - "Write-Output|Write-Progress|Write-Verbose|Write-Warning|Set-WmiInstance|Invoke-WmiMethod|" + - "Get-WmiObject|Remove-WmiObject|Connect-WSMan|Disconnect-WSMan|Test-WSMan|Invoke-WSManAction|" + - "Disable-WSManCredSSP|Enable-WSManCredSSP|Get-WSManCredSSP|New-WSManInstance|Get-WSManInstance|Set-WSManInstance|" + - "Remove-WSManInstance|Set-WSManQuickConfig|New-WSManSessionOption" - ); - - var keywordMapper = this.createKeywordMapper({ - "support.function": builtinFunctions, - "keyword": keywords - }, "identifier"); - - var binaryOperatorsRe = "eq|ne|ge|gt|lt|le|like|notlike|match|notmatch|replace|contains|notcontains|" + - "ieq|ine|ige|igt|ile|ilt|ilike|inotlike|imatch|inotmatch|ireplace|icontains|inotcontains|" + - "is|isnot|as|" + - "and|or|band|bor|not"; - - this.$rules = { - "start" : [ - { - token : "comment", - regex : "#.*$" - }, { - token : "comment.start", - regex : "<#", - next : "comment" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - token : "constant.numeric", // hex - regex : "0[xX][0-9a-fA-F]+\\b" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "constant.language.boolean", - regex : "[$](?:[Tt]rue|[Ff]alse)\\b" - }, { - token : "constant.language", - regex : "[$][Nn]ull\\b" - }, { - token : "variable.instance", - regex : "[$][a-zA-Z][a-zA-Z0-9_]*\\b" - }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$\\-]*\\b" - }, { - token : "keyword.operator", - regex : "\\-(?:" + binaryOperatorsRe + ")" - }, { - token : "keyword.operator", - regex : "&|\\*|\\+|\\-|\\=|\\+=|\\-=" - }, { - token : "lparen", - regex : "[[({]" - }, { - token : "rparen", - regex : "[\\])}]" - }, { - token : "text", - regex : "\\s+" - } - ], - "comment" : [ - { - token : "comment.end", - regex : "#>", - next : "start" - }, { - token : "doc.comment.tag", - regex : "^\\.\\w+" - }, { - token : "comment", - regex : "\\w+" - }, { - token : "comment", - regex : "." - } - ] - }; -}; - -oop.inherits(PowershellHighlightRules, TextHighlightRules); - -exports.PowershellHighlightRules = PowershellHighlightRules; -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); diff --git a/addons/editor/ace/mode-protobuf.js b/addons/editor/ace/mode-protobuf.js deleted file mode 100644 index 0dc31c47..00000000 --- a/addons/editor/ace/mode-protobuf.js +++ /dev/null @@ -1,837 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2012, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * Contributor(s): - * - * Zef Hemel - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/mode/protobuf', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/c_cpp', 'ace/tokenizer', 'ace/mode/protobuf_highlight_rules', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var CMode = require("./c_cpp").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var ProtobufHighlightRules = require("./protobuf_highlight_rules").ProtobufHighlightRules; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - CMode.call(this); - var highlighter = new ProtobufHighlightRules(); - this.foldingRules = new CStyleFoldMode(); - - this.$tokenizer = new Tokenizer(highlighter.getRules()); - this.$keywordList = highlighter.$keywordList; -}; -oop.inherits(Mode, CMode); - -(function() { - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/c_cpp', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/c_cpp_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var Range = require("../range").Range; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = c_cppHighlightRules; - - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().getLineTokens(line, state); - var tokens = tokenizedLine.tokens; - var endState = tokenizedLine.state; - - if (tokens.length && tokens[tokens.length-1].type == "comment") { - return indent; - } - - if (state == "start") { - var match = line.match(/^.*[\{\(\[]\s*$/); - if (match) { - indent += tab; - } - } else if (state == "doc-start") { - if (endState == "start") { - return ""; - } - var match = line.match(/^\s*(\/?)\*/); - if (match) { - if (match[1]) { - indent += " "; - } - indent += "* "; - } - } - - 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; -}); -define('ace/mode/c_cpp_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var cFunctions = exports.cFunctions = "\\s*\\bhypot(?:f|l)?|s(?:scanf|ystem|nprintf|ca(?:nf|lb(?:n(?:f|l)?|ln(?:f|l)?))|i(?:n(?:h(?:f|l)?|f|l)?|gn(?:al|bit))|tr(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(?:jmp|vbuf|locale|buf)|qrt(?:f|l)?|w(?:scanf|printf)|rand)|n(?:e(?:arbyint(?:f|l)?|xt(?:toward(?:f|l)?|after(?:f|l)?))|an(?:f|l)?)|c(?:s(?:in(?:h(?:f|l)?|f|l)?|qrt(?:f|l)?)|cos(?:h(?:f)?|f|l)?|imag(?:f|l)?|t(?:ime|an(?:h(?:f|l)?|f|l)?)|o(?:s(?:h(?:f|l)?|f|l)?|nj(?:f|l)?|pysign(?:f|l)?)|p(?:ow(?:f|l)?|roj(?:f|l)?)|e(?:il(?:f|l)?|xp(?:f|l)?)|l(?:o(?:ck|g(?:f|l)?)|earerr)|a(?:sin(?:h(?:f|l)?|f|l)?|cos(?:h(?:f|l)?|f|l)?|tan(?:h(?:f|l)?|f|l)?|lloc|rg(?:f|l)?|bs(?:f|l)?)|real(?:f|l)?|brt(?:f|l)?)|t(?:ime|o(?:upper|lower)|an(?:h(?:f|l)?|f|l)?|runc(?:f|l)?|gamma(?:f|l)?|mp(?:nam|file))|i(?:s(?:space|n(?:ormal|an)|cntrl|inf|digit|u(?:nordered|pper)|p(?:unct|rint)|finite|w(?:space|c(?:ntrl|type)|digit|upper|p(?:unct|rint)|lower|al(?:num|pha)|graph|xdigit|blank)|l(?:ower|ess(?:equal|greater)?)|al(?:num|pha)|gr(?:eater(?:equal)?|aph)|xdigit|blank)|logb(?:f|l)?|max(?:div|abs))|di(?:v|fftime)|_Exit|unget(?:c|wc)|p(?:ow(?:f|l)?|ut(?:s|c(?:har)?|wc(?:har)?)|error|rintf)|e(?:rf(?:c(?:f|l)?|f|l)?|x(?:it|p(?:2(?:f|l)?|f|l|m1(?:f|l)?)?))|v(?:s(?:scanf|nprintf|canf|printf|w(?:scanf|printf))|printf|f(?:scanf|printf|w(?:scanf|printf))|w(?:scanf|printf)|a_(?:start|copy|end|arg))|qsort|f(?:s(?:canf|e(?:tpos|ek))|close|tell|open|dim(?:f|l)?|p(?:classify|ut(?:s|c|w(?:s|c))|rintf)|e(?:holdexcept|set(?:e(?:nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(?:aiseexcept|ror)|get(?:e(?:nv|xceptflag)|round))|flush|w(?:scanf|ide|printf|rite)|loor(?:f|l)?|abs(?:f|l)?|get(?:s|c|pos|w(?:s|c))|re(?:open|e|ad|xp(?:f|l)?)|m(?:in(?:f|l)?|od(?:f|l)?|a(?:f|l|x(?:f|l)?)?))|l(?:d(?:iv|exp(?:f|l)?)|o(?:ngjmp|cal(?:time|econv)|g(?:1(?:p(?:f|l)?|0(?:f|l)?)|2(?:f|l)?|f|l|b(?:f|l)?)?)|abs|l(?:div|abs|r(?:int(?:f|l)?|ound(?:f|l)?))|r(?:int(?:f|l)?|ound(?:f|l)?)|gamma(?:f|l)?)|w(?:scanf|c(?:s(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?|mbs)|pbrk|ftime|len|r(?:chr|tombs)|xfrm)|to(?:b|mb)|rtomb)|printf|mem(?:set|c(?:hr|py|mp)|move))|a(?:s(?:sert|ctime|in(?:h(?:f|l)?|f|l)?)|cos(?:h(?:f|l)?|f|l)?|t(?:o(?:i|f|l(?:l)?)|exit|an(?:h(?:f|l)?|2(?:f|l)?|f|l)?)|b(?:s|ort))|g(?:et(?:s|c(?:har)?|env|wc(?:har)?)|mtime)|r(?:int(?:f|l)?|ound(?:f|l)?|e(?:name|alloc|wind|m(?:ove|quo(?:f|l)?|ainder(?:f|l)?))|a(?:nd|ise))|b(?:search|towc)|m(?:odf(?:f|l)?|em(?:set|c(?:hr|py|mp)|move)|ktime|alloc|b(?:s(?:init|towcs|rtowcs)|towc|len|r(?:towc|len)))\\b" - -var c_cppHighlightRules = function() { - - var keywordControls = ( - "break|case|continue|default|do|else|for|goto|if|_Pragma|" + - "return|switch|while|catch|operator|try|throw|using" - ); - - var storageType = ( - "asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" + - "_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|" + - "class|wchar_t|template" - ); - - var storageModifiers = ( - "const|extern|register|restrict|static|volatile|inline|private:|" + - "protected:|public:|friend|explicit|virtual|export|mutable|typename" - ); - - var keywordOperators = ( - "and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq" + - "const_cast|dynamic_cast|reinterpret_cast|static_cast|sizeof|namespace" - ); - - var builtinConstants = ( - "NULL|true|false|TRUE|FALSE" - ); - - var keywordMapper = this.$keywords = this.createKeywordMapper({ - "keyword.control" : keywordControls, - "storage.type" : storageType, - "storage.modifier" : storageModifiers, - "keyword.operator" : keywordOperators, - "variable.language": "this", - "constant.language": builtinConstants - }, "identifier"); - - var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\d\\$_\u00a1-\uffff]*\\b"; - - this.$rules = { - "start" : [ - { - token : "comment", - regex : "\\/\\/.*$" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // multi line string start - regex : '["].*\\\\$', - next : "qqstring" - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - token : "string", // multi line string start - regex : "['].*\\\\$", - next : "qstring" - }, { - token : "constant.numeric", // hex - regex : "0[xX][0-9a-fA-F]+(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b" - }, { - token : "keyword", // pre-compiler directives - regex : "#\\s*(?:include|import|pragma|line|define|undef|if|ifdef|else|elif|ifndef)\\b", - next : "directive" - }, { - token : "keyword", // special case pre-compiler directive - regex : "(?:#\\s*endif)\\b" - }, { - token : "support.function.C99.c", - regex : cFunctions - }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" - }, { - token : "keyword.operator", - regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)" - }, { - token : "punctuation.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 - regex : ".+" - } - ], - "qqstring" : [ - { - token : "string", - regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"', - next : "start" - }, { - token : "string", - regex : '.+' - } - ], - "qstring" : [ - { - token : "string", - regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'", - next : "start" - }, { - token : "string", - regex : '.+' - } - ], - "directive" : [ - { - token : "constant.other.multiline", - regex : /\\/ - }, - { - token : "constant.other.multiline", - regex : /.*\\/ - }, - { - token : "constant.other", - regex : "\\s*<.+?>", - next : "start" - }, - { - token : "constant.other", // single line - regex : '\\s*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]', - next : "start" - }, - { - token : "constant.other", // single line - regex : "\\s*['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']", - next : "start" - }, - { - token : "constant.other", - regex : /[^\\\/]+/, - next : "start" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("start") ]); -}; - -oop.inherits(c_cppHighlightRules, TextHighlightRules); - -exports.c_cppHighlightRules = c_cppHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); -define('ace/mode/protobuf_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - - var oop = require("../lib/oop"); - var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - - var ProtobufHighlightRules = function() { - - var builtinTypes = "double|float|int32|int64|uint32|uint64|sint32|" + - "sint64|fixed32|fixed64|sfixed32|sfixed64|bool|" + - "string|bytes"; - var keywordDeclaration = "message|required|optional|repeated|package|" + - "import|option|enum"; - - var keywordMapper = this.createKeywordMapper({ - "keyword.declaration.protobuf": keywordDeclaration, - "support.type": builtinTypes - }, "identifier"); - - this.$rules = { - "start": [{ - token: "comment", - regex: /\/\/.*$/ - }, { - token: "comment", - regex: /\/\*/, - next: "comment" - }, { - token: "constant", - regex: "<[^>]+>" - }, { - regex: "=", - token: "keyword.operator.assignment.protobuf" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // single line - regex : '[\'](?:(?:\\\\.)|(?:[^\'\\\\]))*?[\']' - }, { - token: "constant.numeric", // hex - regex: "0[xX][0-9a-fA-F]+\\b" - }, { - token: "constant.numeric", // float - regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token: keywordMapper, - regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" - }], - "comment": [{ - token: "comment", // closing comment - regex: ".*?\\*\\/", - next: "start" - }, { - token: "comment", // comment spanning whole line - regex: ".+" - }] - }; - - this.normalizeRules(); - }; - - oop.inherits(ProtobufHighlightRules, TextHighlightRules); - - exports.ProtobufHighlightRules = ProtobufHighlightRules; -}); \ No newline at end of file diff --git a/addons/editor/ace/mode-r.js b/addons/editor/ace/mode-r.js deleted file mode 100644 index 6f4107e4..00000000 --- a/addons/editor/ace/mode-r.js +++ /dev/null @@ -1,336 +0,0 @@ -/* - * r.js - * - * Copyright (C) 2009-11 by RStudio, Inc. - * - * 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. - * - * Distributed under the BSD license: - * - * Copyright (c) 2010, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * - */ -define('ace/mode/r', ['require', 'exports', 'module' , 'ace/range', 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/text_highlight_rules', 'ace/mode/r_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/unicode'], function(require, exports, module) { - - - var Range = require("../range").Range; - var oop = require("../lib/oop"); - var TextMode = require("./text").Mode; - var Tokenizer = require("../tokenizer").Tokenizer; - var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - var RHighlightRules = require("./r_highlight_rules").RHighlightRules; - var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; - var unicode = require("../unicode"); - - var Mode = function() - { - this.HighlightRules = RHighlightRules; - this.$outdent = new MatchingBraceOutdent(); - }; - oop.inherits(Mode, TextMode); - - (function() - { - this.lineCommentStart = "#"; - }).call(Mode.prototype); - exports.Mode = Mode; -}); -define('ace/mode/r_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules', 'ace/mode/tex_highlight_rules'], function(require, exports, module) { - - var oop = require("../lib/oop"); - var lang = require("../lib/lang"); - var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - var TexHighlightRules = require("./tex_highlight_rules").TexHighlightRules; - - var RHighlightRules = function() - { - - var keywords = lang.arrayToMap( - ("function|if|in|break|next|repeat|else|for|return|switch|while|try|tryCatch|stop|warning|require|library|attach|detach|source|setMethod|setGeneric|setGroupGeneric|setClass") - .split("|") - ); - - var buildinConstants = lang.arrayToMap( - ("NULL|NA|TRUE|FALSE|T|F|Inf|NaN|NA_integer_|NA_real_|NA_character_|" + - "NA_complex_").split("|") - ); - - this.$rules = { - "start" : [ - { - token : "comment.sectionhead", - regex : "#+(?!').*(?:----|====|####)\\s*$" - }, - { - token : "comment", - regex : "#+'", - next : "rd-start" - }, - { - token : "comment", - regex : "#.*$" - }, - { - token : "string", // multi line string start - regex : '["]', - next : "qqstring" - }, - { - token : "string", // multi line string start - regex : "[']", - next : "qstring" - }, - { - token : "constant.numeric", // hex - regex : "0[xX][0-9a-fA-F]+[Li]?\\b" - }, - { - token : "constant.numeric", // explicit integer - regex : "\\d+L\\b" - }, - { - token : "constant.numeric", // number - regex : "\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d*)?i?\\b" - }, - { - token : "constant.numeric", // number with leading decimal - regex : "\\.\\d+(?:[eE][+\\-]?\\d*)?i?\\b" - }, - { - token : "constant.language.boolean", - regex : "(?:TRUE|FALSE|T|F)\\b" - }, - { - token : "identifier", - regex : "`.*?`" - }, - { - onMatch : function(value) { - if (keywords[value]) - return "keyword"; - else if (buildinConstants[value]) - return "constant.language"; - else if (value == '...' || value.match(/^\.\.\d+$/)) - return "variable.language"; - else - return "identifier"; - }, - regex : "[a-zA-Z.][a-zA-Z0-9._]*\\b" - }, - { - token : "keyword.operator", - regex : "%%|>=|<=|==|!=|\\->|<\\-|\\|\\||&&|=|\\+|\\-|\\*|/|\\^|>|<|!|&|\\||~|\\$|:" - }, - { - token : "keyword.operator", // infix operators - regex : "%.*?%" - }, - { - token : "paren.keyword.operator", - regex : "[[({]" - }, - { - token : "paren.keyword.operator", - regex : "[\\])}]" - }, - { - token : "text", - regex : "\\s+" - } - ], - "qqstring" : [ - { - token : "string", - regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"', - next : "start" - }, - { - token : "string", - regex : '.+' - } - ], - "qstring" : [ - { - token : "string", - regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'", - next : "start" - }, - { - token : "string", - regex : '.+' - } - ] - }; - - var rdRules = new TexHighlightRules("comment").getRules(); - for (var i = 0; i < rdRules["start"].length; i++) { - rdRules["start"][i].token += ".virtual-comment"; - } - - this.addRules(rdRules, "rd-"); - this.$rules["rd-start"].unshift({ - token: "text", - regex: "^", - next: "start" - }); - this.$rules["rd-start"].unshift({ - token : "keyword", - regex : "@(?!@)[^ ]*" - }); - this.$rules["rd-start"].unshift({ - token : "comment", - regex : "@@" - }); - this.$rules["rd-start"].push({ - token : "comment", - regex : "[^%\\\\[({\\])}]+" - }); - }; - - oop.inherits(RHighlightRules, TextHighlightRules); - - exports.RHighlightRules = RHighlightRules; -}); -define('ace/mode/tex_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var TexHighlightRules = function(textClass) { - - if (!textClass) - textClass = "text"; - - this.$rules = { - "start" : [ - { - token : "comment", - regex : "%.*$" - }, { - token : textClass, // non-command - regex : "\\\\[$&%#\\{\\}]" - }, { - token : "keyword", // command - regex : "\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\b", - next : "nospell" - }, { - token : "keyword", // command - regex : "\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])" - }, { - token : "paren.keyword.operator", - regex : "[[({]" - }, { - token : "paren.keyword.operator", - regex : "[\\])}]" - }, { - token : textClass, - regex : "\\s+" - } - ], - "nospell" : [ - { - token : "comment", - regex : "%.*$", - next : "start" - }, { - token : "nospell." + textClass, // non-command - regex : "\\\\[$&%#\\{\\}]" - }, { - token : "keyword", // command - regex : "\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\b" - }, { - token : "keyword", // command - regex : "\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])", - next : "start" - }, { - token : "paren.keyword.operator", - regex : "[[({]" - }, { - token : "paren.keyword.operator", - regex : "[\\])]" - }, { - token : "paren.keyword.operator", - regex : "}", - next : "start" - }, { - token : "nospell." + textClass, - regex : "\\s+" - }, { - token : "nospell." + textClass, - regex : "\\w+" - } - ] - }; -}; - -oop.inherits(TexHighlightRules, TextHighlightRules); - -exports.TexHighlightRules = TexHighlightRules; -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); diff --git a/addons/editor/ace/mode-rdoc.js b/addons/editor/ace/mode-rdoc.js deleted file mode 100644 index d405543a..00000000 --- a/addons/editor/ace/mode-rdoc.js +++ /dev/null @@ -1,209 +0,0 @@ -/* - * rdoc.js - * - * Copyright (C) 2009-11 by RStudio, Inc. - * - * 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. - * - * Distributed under the BSD license: - * - * Copyright (c) 2010, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * - */ -define('ace/mode/rdoc', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/text_highlight_rules', 'ace/mode/rdoc_highlight_rules', 'ace/mode/matching_brace_outdent'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var RDocHighlightRules = require("./rdoc_highlight_rules").RDocHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; - -var Mode = function(suppressHighlighting) { - this.HighlightRules = RDocHighlightRules; - this.$outdent = new MatchingBraceOutdent(); -}; -oop.inherits(Mode, TextMode); - -(function() { - this.getNextLineIndent = function(state, line, tab) { - return this.$getIndent(line); - }; -}).call(Mode.prototype); - -exports.Mode = Mode; -}); -define('ace/mode/rdoc_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules', 'ace/mode/latex_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var LaTeXHighlightRules = require("./latex_highlight_rules"); - -var RDocHighlightRules = function() { - - this.$rules = { - "start" : [ - { - token : "comment", - regex : "%.*$" - }, { - token : "text", // non-command - regex : "\\\\[$&%#\\{\\}]" - }, { - token : "keyword", // command - regex : "\\\\(?:name|alias|method|S3method|S4method|item|code|preformatted|kbd|pkg|var|env|option|command|author|email|url|source|cite|acronym|href|code|preformatted|link|eqn|deqn|keyword|usage|examples|dontrun|dontshow|figure|if|ifelse|Sexpr|RdOpts|inputencoding|usepackage)\\b", - next : "nospell" - }, { - token : "keyword", // command - regex : "\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])" - }, { - token : "paren.keyword.operator", - regex : "[[({]" - }, { - token : "paren.keyword.operator", - regex : "[\\])}]" - }, { - token : "text", - regex : "\\s+" - } - ], - "nospell" : [ - { - token : "comment", - regex : "%.*$", - next : "start" - }, { - token : "nospell.text", // non-command - regex : "\\\\[$&%#\\{\\}]" - }, { - token : "keyword", // command - regex : "\\\\(?:name|alias|method|S3method|S4method|item|code|preformatted|kbd|pkg|var|env|option|command|author|email|url|source|cite|acronym|href|code|preformatted|link|eqn|deqn|keyword|usage|examples|dontrun|dontshow|figure|if|ifelse|Sexpr|RdOpts|inputencoding|usepackage)\\b" - }, { - token : "keyword", // command - regex : "\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])", - next : "start" - }, { - token : "paren.keyword.operator", - regex : "[[({]" - }, { - token : "paren.keyword.operator", - regex : "[\\])]" - }, { - token : "paren.keyword.operator", - regex : "}", - next : "start" - }, { - token : "nospell.text", - regex : "\\s+" - }, { - token : "nospell.text", - regex : "\\w+" - } - ] - }; -}; - -oop.inherits(RDocHighlightRules, TextHighlightRules); - -exports.RDocHighlightRules = RDocHighlightRules; -}); -define('ace/mode/latex_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var LatexHighlightRules = 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 : "%.*$" - }] - }; -}; - -oop.inherits(LatexHighlightRules, TextHighlightRules); - -exports.LatexHighlightRules = LatexHighlightRules; - -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); diff --git a/addons/editor/ace/mode-rhtml.js b/addons/editor/ace/mode-rhtml.js deleted file mode 100644 index 5b7624d2..00000000 --- a/addons/editor/ace/mode-rhtml.js +++ /dev/null @@ -1,2613 +0,0 @@ -/* - * rhtml.js - * - * Copyright (C) 2009-11 by RStudio, Inc. - * - * 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. - * - * Distributed under the BSD license: - * - * Copyright (c) 2010, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - */ - -define('ace/mode/rhtml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/html', 'ace/tokenizer', 'ace/mode/rhtml_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var HtmlMode = require("./html").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; - -var RHtmlHighlightRules = require("./rhtml_highlight_rules").RHtmlHighlightRules; - -var Mode = function(doc, session) { - this.$session = session; - this.HighlightRules = RHtmlHighlightRules; -}; -oop.inherits(Mode, HtmlMode); - -(function() { - this.insertChunkInfo = { - value: "\n", - position: {row: 0, column: 15} - }; - - this.getLanguageMode = function(position) - { - return this.$session.getState(position.row).match(/^r-/) ? 'R' : 'HTML'; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/html', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/javascript', 'ace/mode/css', 'ace/tokenizer', 'ace/mode/html_highlight_rules', 'ace/mode/behaviour/html', 'ace/mode/folding/html', 'ace/mode/html_completions'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var JavaScriptMode = require("./javascript").Mode; -var CssMode = require("./css").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; -var HtmlBehaviour = require("./behaviour/html").HtmlBehaviour; -var HtmlFoldMode = require("./folding/html").FoldMode; -var HtmlCompletions = require("./html_completions").HtmlCompletions; - -var Mode = function() { - this.HighlightRules = HtmlHighlightRules; - this.$behaviour = new HtmlBehaviour(); - this.$completer = new HtmlCompletions(); - - this.createModeDelegates({ - "js-": JavaScriptMode, - "css-": CssMode - }); - - this.foldingRules = new HtmlFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.blockComment = {start: ""}; - - this.getNextLineIndent = function(state, line, tab) { - return this.$getIndent(line); - }; - - this.checkOutdent = function(state, line, input) { - return false; - }; - - this.getCompletions = function(state, session, pos, prefix) { - return this.$completer.getCompletions(state, session, pos, prefix); - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/javascript', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/javascript_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/worker/worker_client', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var Range = require("../range").Range; -var WorkerClient = require("../worker/worker_client").WorkerClient; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = JavaScriptHighlightRules; - - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().getLineTokens(line, state); - var tokens = tokenizedLine.tokens; - var endState = tokenizedLine.state; - - if (tokens.length && tokens[tokens.length-1].type == "comment") { - return indent; - } - - if (state == "start" || state == "no_regex") { - var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/); - if (match) { - indent += tab; - } - } else if (state == "doc-start") { - if (endState == "start" || endState == "no_regex") { - return ""; - } - var match = line.match(/^\s*(\/?)\*/); - if (match) { - if (match[1]) { - indent += " "; - } - indent += "* "; - } - } - - 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); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker"); - worker.attachToDocument(session.getDocument()); - - worker.on("jslint", function(results) { - session.setAnnotations(results.data); - }); - - worker.on("terminate", function() { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var JavaScriptHighlightRules = function() { - var keywordMapper = this.createKeywordMapper({ - "variable.language": - "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors - "Namespace|QName|XML|XMLList|" + // E4X - "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + - "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + - "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors - "SyntaxError|TypeError|URIError|" + - "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions - "isNaN|parseFloat|parseInt|" + - "JSON|Math|" + // Other - "this|arguments|prototype|window|document" , // Pseudo - "keyword": - "const|yield|import|get|set|" + - "break|case|catch|continue|default|delete|do|else|finally|for|function|" + - "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + - "__parent__|__count__|escape|unescape|with|__proto__|" + - "class|enum|extends|super|export|implements|private|public|interface|package|protected|static", - "storage.type": - "const|let|var|function", - "constant.language": - "null|Infinity|NaN|undefined", - "support.function": - "alert", - "constant.language.boolean": "true|false" - }, "identifier"); - var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; - var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\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 - ".)"; - - this.$rules = { - "no_regex" : [ - { - token : "comment", - regex : "\\/\\/", - next : "line_comment" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : /\/\*/, - next : "comment" - }, { - token : "string", - regex : "'(?=.)", - next : "qstring" - }, { - token : "string", - regex : '"(?=.)', - next : "qqstring" - }, { - token : "constant.numeric", // hex - regex : /0[xX][0-9a-fA-F]+\b/ - }, { - token : "constant.numeric", // float - regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/ - }, { - token : [ - "storage.type", "punctuation.operator", "support.function", - "punctuation.operator", "entity.name.function", "text","keyword.operator" - ], - regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "keyword.operator", "text", "storage.type", - "text", "paren.lparen" - ], - regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "punctuation.operator", - "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "text", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : "keyword", - regex : "(?:" + kwBeforeRe + ")\\b", - next : "start" - }, { - token : ["punctuation.operator", "support.function"], - regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/ - }, { - token : ["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 : keywordMapper, - regex : identifierRe - }, { - token : "keyword.operator", - regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/, - next : "start" - }, { - token : "punctuation.operator", - regex : /\?|\:|\,|\;|\./, - next : "start" - }, { - token : "paren.lparen", - regex : /[\[({]/, - next : "start" - }, { - token : "paren.rparen", - regex : /[\])}]/ - }, { - token : "keyword.operator", - regex : /\/=?/, - next : "start" - }, { - token: "comment", - regex: /^#!.*$/ - } - ], - "start": [ - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment_regex_allowed" - }, { - token : "comment", - regex : "\\/\\/", - next : "line_comment_regex_allowed" - }, { - token: "string.regexp", - regex: "\\/", - next: "regex" - }, { - token : "text", - regex : "\\s+|^$", - next : "start" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "regex": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "string.regexp", - regex: "/\\w*", - next: "no_regex" - }, { - token : "invalid", - regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ - }, { - token : "constant.language.escape", - regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/ - }, { - token : "constant.language.delimiter", - regex: /\|/ - }, { - token: "constant.language.escape", - regex: /\[\^?/, - next: "regex_character_class" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp" - } - ], - "regex_character_class": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "constant.language.escape", - regex: "]", - next: "regex" - }, { - token: "constant.language.escape", - regex: "-" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp.charachterclass" - } - ], - "function_arguments": [ - { - token: "variable.parameter", - regex: identifierRe - }, { - token: "punctuation.operator", - regex: "[, ]+" - }, { - token: "punctuation.operator", - regex: "$" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "comment_regex_allowed" : [ - {token : "comment", regex : "\\*\\/", next : "start"}, - {defaultToken : "comment"} - ], - "comment" : [ - {token : "comment", regex : "\\*\\/", next : "no_regex"}, - {defaultToken : "comment"} - ], - "line_comment_regex_allowed" : [ - {token : "comment", regex : "$|^", next : "start"}, - {defaultToken : "comment"} - ], - "line_comment" : [ - {token : "comment", regex : "$|^", next : "no_regex"}, - {defaultToken : "comment"} - ], - "qqstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qqstring" - }, { - token : "string", - regex : '"|$', - next : "no_regex" - }, { - defaultToken: "string" - } - ], - "qstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qstring" - }, { - token : "string", - regex : "'|$", - next : "no_regex" - }, { - defaultToken: "string" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("no_regex") ]); -}; - -oop.inherits(JavaScriptHighlightRules, TextHighlightRules); - -exports.JavaScriptHighlightRules = JavaScriptHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); - -define('ace/mode/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/css_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/worker/worker_client', 'ace/mode/behaviour/css', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var WorkerClient = require("../worker/worker_client").WorkerClient; -var CssBehaviour = require("./behaviour/css").CssBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = CssHighlightRules; - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CssBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.foldingRules = "cStyle"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - var tokens = this.getTokenizer().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); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker"); - worker.attachToDocument(session.getDocument()); - - worker.on("csslint", function(e) { - session.setAnnotations(e.data); - }); - - worker.on("terminate", function() { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; - -}); - -define('ace/mode/css_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var supportType = exports.supportType = "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"; -var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters"; -var supportConstant = exports.supportConstant = "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|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|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero"; -var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow"; -var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace"; - -var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))"; -var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b"; -var pseudoClasses = exports.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 CssHighlightRules = function() { - - var keywordMapper = this.createKeywordMapper({ - "support.function": supportFunction, - "support.constant": supportConstant, - "support.type": supportType, - "support.constant.color": supportConstantColor, - "support.constant.fonts": supportConstantFonts - }, "text", true); - - this.$rules = { - "start" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "@.*?{", - push: "media" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "media" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "\\}", - next: "pop" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "comment" : [{ - token : "comment", - regex : "\\*\\/", - next : "pop" - }, { - defaultToken : "comment" - }], - - "ruleset" : [ - { - token : "paren.rparen", - regex : "\\}", - next: "pop" - }, { - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - 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 : numRe - }, { - 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 : ["support.function", "string", "support.function"], - regex : "(url\\()(.*)(\\))" - }, { - token : keywordMapper, - regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*" - }, { - caseInsensitive: true - }] - }; - - this.normalizeRules(); -}; - -oop.inherits(CssHighlightRules, TextHighlightRules); - -exports.CssHighlightRules = CssHighlightRules; - -}); - -define('ace/mode/behaviour/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; - -var CssBehaviour = function () { - - this.inherit(CstyleBehaviour); - - this.add("colon", "insertion", function (state, action, editor, session, text) { - if (text === ':') { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - var token = iterator.getCurrentToken(); - if (token && token.value.match(/\s+/)) { - token = iterator.stepBackward(); - } - if (token && token.type === 'support.type') { - var line = session.doc.getLine(cursor.row); - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar === ':') { - return { - text: '', - selection: [1, 1] - } - } - if (!line.substring(cursor.column).match(/^\s*;/)) { - return { - text: ':;', - selection: [1, 1] - } - } - } - } - }); - - this.add("colon", "deletion", function (state, action, editor, session, range) { - var selected = session.doc.getTextRange(range); - if (!range.isMultiLine() && selected === ':') { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - var token = iterator.getCurrentToken(); - if (token && token.value.match(/\s+/)) { - token = iterator.stepBackward(); - } - if (token && token.type === 'support.type') { - 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("semicolon", "insertion", function (state, action, editor, session, text) { - if (text === ';') { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar === ';') { - return { - text: '', - selection: [1, 1] - } - } - } - }); - -} -oop.inherits(CssBehaviour, CstyleBehaviour); - -exports.CssBehaviour = CssBehaviour; -}); - -define('ace/mode/html_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/css_highlight_rules', 'ace/mode/javascript_highlight_rules', 'ace/mode/xml_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; - -var tagMap = lang.createMap({ - a : 'anchor', - button : 'form', - form : 'form', - img : 'image', - input : 'form', - label : 'form', - option : 'form', - script : 'script', - select : 'form', - textarea : 'form', - style : 'style', - table : 'table', - tbody : 'table', - td : 'table', - tfoot : 'table', - th : 'table', - tr : 'table' -}); - -var HtmlHighlightRules = function() { - XmlHighlightRules.call(this); - - this.addRules({ - attributes: [{ - include : "space" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "keyword.operator.separator", - regex : "=", - push : [{ - include: "space" - }, { - token : "string", - regex : "[^<>='\"`\\s]+", - next : "pop" - }, { - token : "empty", - regex : "", - next : "pop" - }] - }, { - include : "string" - }], - tag: [{ - token : function(start, tag) { - var group = tagMap[tag]; - return ["meta.tag.punctuation.begin", - "meta.tag.name" + (group ? "." + group : "")]; - }, - regex : "(<)([-_a-zA-Z0-9:]+)", - next: "start_tag_stuff" - }, { - token : function(start, tag) { - var group = tagMap[tag]; - return ["meta.tag.punctuation.begin", - "meta.tag.name" + (group ? "." + group : "")]; - }, - regex : "(", next : "start"} - ], - end_tag_stuff: [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next : "start"} - ] - }); - - this.embedTagRules(CssHighlightRules, "css-", "style"); - this.embedTagRules(JavaScriptHighlightRules, "js-", "script"); - - if (this.constructor === HtmlHighlightRules) - this.normalizeRules(); -}; - -oop.inherits(HtmlHighlightRules, XmlHighlightRules); - -exports.HtmlHighlightRules = HtmlHighlightRules; -}); - -define('ace/mode/xml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml_util', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var xmlUtil = require("./xml_util"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var XmlHighlightRules = function(normalize) { - this.$rules = { - start : [ - {token : "punctuation.string.begin", regex : "<\\!\\[CDATA\\[", next : "cdata"}, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)(xml)(?=[\\s])", next : "xml_declaration" - }, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)([-_a-zA-Z0-9]+)", next : "instruction" - }, - {token : "comment", regex : "<\\!--", next : "comment"}, - { - token : ["punctuation.doctype.begin", "meta.tag.doctype"], - regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype" - }, - {include : "tag"}, - {include : "reference"} - ], - - xml_declaration : [ - {include : "attributes"}, - {include : "instruction"} - ], - - instruction : [ - {token : "punctuation.instruction.end", regex : "\\?>", next : "start"} - ], - - doctype : [ - {include : "space"}, - {include : "string"}, - {token : "punctuation.doctype.end", regex : ">", next : "start"}, - {token : "xml-pe", regex : "[-_a-zA-Z0-9:]+"}, - {token : "punctuation.begin", regex : "\\[", push : "declarations"} - ], - - declarations : [{ - token : "text", - regex : "\\s+" - }, { - token: "punctuation.end", - regex: "]", - next: "pop" - }, { - token : ["punctuation.begin", "keyword"], - regex : "(<\\!)([-_a-zA-Z0-9]+)", - push : [{ - token : "text", - regex : "\\s+" - }, - { - token : "punctuation.end", - regex : ">", - next : "pop" - }, - {include : "string"}] - }], - - cdata : [ - {token : "string.end", regex : "\\]\\]>", next : "start"}, - {token : "text", regex : "\\s+"}, - {token : "text", regex : "(?:[^\\]]|\\](?!\\]>))+"} - ], - - comment : [ - {token : "comment", regex : "-->", next : "start"}, - {defaultToken : "comment"} - ], - - tag : [{ - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(<)((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)", - next: [ - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : "start"} - ] - }, { - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(", next : "start"} - ] - }], - - space : [ - {token : "text", regex : "\\s+"} - ], - - reference : [{ - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, { - token : "invalid.illegal", regex : "&" - }], - - string: [{ - token : "string", - regex : "'", - push : "qstring_inner" - }, { - token : "string", - regex : '"', - push : "qqstring_inner" - }], - - qstring_inner: [ - {token : "string", regex: "'", next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - qqstring_inner: [ - {token : "string", regex: '"', next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - attributes: [{ - token : "entity.other.attribute-name", - regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+" - }, { - token : "keyword.operator.separator", - regex : "=" - }, { - include : "space" - }, { - include : "string" - }] - }; - - if (this.constructor === XmlHighlightRules) - this.normalizeRules(); -}; - - -(function() { - - this.embedTagRules = function(HighlightRules, prefix, tag){ - this.$rules.tag.unshift({ - token : ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(<)(" + tag + ")", - next: [ - {include : "space"}, - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : prefix + "start"} - ] - }); - - this.$rules[tag + "-end"] = [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next: "start", - onMatch : function(value, currentState, stack) { - stack.splice(0); - return this.token; - }} - ] - - this.embedRules(HighlightRules, prefix, [{ - token: ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(" - }]); - }; - -}).call(TextHighlightRules.prototype); - -oop.inherits(XmlHighlightRules, TextHighlightRules); - -exports.XmlHighlightRules = XmlHighlightRules; -}); - -define('ace/mode/xml_util', ['require', 'exports', 'module' ], function(require, exports, module) { - - -function string(state) { - return [{ - token : "string", - regex : '"', - next : state + "_qqstring" - }, { - token : "string", - regex : "'", - next : state + "_qstring" - }]; -} - -function multiLineString(quote, state) { - return [ - {token : "string", regex : quote, next : state}, - { - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, - {defaultToken : "string"} - ]; -} - -exports.tag = function(states, name, nextState, tagMap) { - states[name] = [{ - token : "text", - regex : "\\s+" - }, { - - token : !tagMap ? "meta.tag.tag-name" : function(value) { - if (tagMap[value]) - return "meta.tag.tag-name." + tagMap[value]; - else - return "meta.tag.tag-name"; - }, - regex : "[-_a-zA-Z0-9:]+", - next : name + "_embed_attribute_list" - }, { - token: "empty", - regex: "", - next : 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"] = [{ - token : "meta.tag.r", - regex : "/?>", - next : nextState - }, { - token : "keyword.operator", - regex : "=" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "text", - regex : "\\s+" - }].concat(string(name)); -}; - -}); - -define('ace/mode/behaviour/html', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour/xml', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var XmlBehaviour = require("../behaviour/xml").XmlBehaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var voidElements = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']; - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); - return hasType; -} - -var HtmlBehaviour = function () { - - this.inherit(XmlBehaviour); // Get xml behaviour - - this.add("autoclosing", "insertion", function (state, action, editor, session, text) { - if (text == '>') { - var position = editor.getCursorPosition(); - var iterator = new TokenIterator(session, position.row, position.column); - var token = iterator.getCurrentToken(); - - if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column) - return; - var atCursor = false; - if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text'))); - } else { - atCursor = true; - } - if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) { - return; - } - var element = token.value; - if (atCursor){ - var element = element.substring(0, position.column - token.start); - } - if (voidElements.indexOf(element) !== -1){ - return; - } - return { - text: '>' + '', - selection: [1, 1] - } - } - }); -} -oop.inherits(HtmlBehaviour, XmlBehaviour); - -exports.HtmlBehaviour = HtmlBehaviour; -}); - -define('ace/mode/behaviour/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); - return hasType; -} - -var XmlBehaviour = function () { - - this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour - - this.add("autoclosing", "insertion", function (state, action, editor, session, text) { - if (text == '>') { - var position = editor.getCursorPosition(); - var iterator = new TokenIterator(session, position.row, position.column); - var token = iterator.getCurrentToken(); - - if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column) - return; - var atCursor = false; - if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text'))); - } else { - atCursor = true; - } - if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) { - return; - } - var tag = token.value; - if (atCursor){ - var tag = tag.substring(0, position.column - token.start); - } - - return { - text: '>' + '', - selection: [1, 1] - } - } - }); - - this.add('autoindent', 'insertion', function (state, action, editor, session, text) { - if (text == "\n") { - var cursor = editor.getCursorPosition(); - var line = session.getLine(cursor.row); - var rightChars = line.substring(cursor.column, cursor.column + 2); - if (rightChars == '?)/; - this._parseTag = function(tag) { - - var match = tag.match(this.tagRe); - var column = 0; - - return { - value: tag, - match: match ? match[2] : "", - closing: match ? !!match[3] : false, - selfClosing: match ? !!match[5] || match[2] == "/>" : false, - tagName: match ? match[4] : "", - column: match[1] ? column + match[1].length : column - }; - }; - this._readTagForward = function(iterator) { - var token = iterator.getCurrentToken(); - if (!token) - return null; - - var value = ""; - var start; - - do { - if (token.type.lastIndexOf("meta.tag", 0) === 0) { - if (!start) { - var start = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() - }; - } - value += token.value; - if (value.indexOf(">") !== -1) { - var tag = this._parseTag(value); - tag.start = start; - tag.end = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() + token.value.length - }; - iterator.stepForward(); - return tag; - } - } - } while(token = iterator.stepForward()); - - return null; - }; - - this._readTagBackward = function(iterator) { - var token = iterator.getCurrentToken(); - if (!token) - return null; - - var value = ""; - var end; - - do { - if (token.type.lastIndexOf("meta.tag", 0) === 0) { - if (!end) { - end = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() + token.value.length - }; - } - value = token.value + value; - if (value.indexOf("<") !== -1) { - var tag = this._parseTag(value); - tag.end = end; - tag.start = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() - }; - iterator.stepBackward(); - return tag; - } - } - } while(token = iterator.stepBackward()); - - return null; - }; - - this._pop = function(stack, tag) { - while (stack.length) { - - var top = stack[stack.length-1]; - if (!tag || top.tagName == tag.tagName) { - return stack.pop(); - } - else if (this.voidElements[tag.tagName]) { - return; - } - else if (this.voidElements[top.tagName]) { - stack.pop(); - continue; - } else { - return null; - } - } - }; - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var firstTag = this._getFirstTagInLine(session, row); - - if (!firstTag.match) - return null; - - var isBackward = firstTag.closing || firstTag.selfClosing; - var stack = []; - var tag; - - if (!isBackward) { - var iterator = new TokenIterator(session, row, firstTag.column); - var start = { - row: row, - column: firstTag.column + firstTag.tagName.length + 2 - }; - while (tag = this._readTagForward(iterator)) { - if (tag.selfClosing) { - if (!stack.length) { - tag.start.column += tag.tagName.length + 2; - tag.end.column -= 2; - return Range.fromPoints(tag.start, tag.end); - } else - continue; - } - - if (tag.closing) { - this._pop(stack, tag); - if (stack.length == 0) - return Range.fromPoints(start, tag.start); - } - else { - stack.push(tag) - } - } - } - else { - var iterator = new TokenIterator(session, row, firstTag.column + firstTag.match.length); - var end = { - row: row, - column: firstTag.column - }; - - while (tag = this._readTagBackward(iterator)) { - if (tag.selfClosing) { - if (!stack.length) { - tag.start.column += tag.tagName.length + 2; - tag.end.column -= 2; - return Range.fromPoints(tag.start, tag.end); - } else - continue; - } - - if (!tag.closing) { - this._pop(stack, tag); - if (stack.length == 0) { - tag.start.column += tag.tagName.length + 2; - return Range.fromPoints(tag.start, end); - } - } - else { - stack.push(tag) - } - } - } - - }; - -}).call(FoldMode.prototype); - -}); - -define('ace/mode/html_completions', ['require', 'exports', 'module' , 'ace/token_iterator'], function(require, exports, module) { - - -var TokenIterator = require("../token_iterator").TokenIterator; - -var commonAttributes = [ - "accesskey", - "class", - "contenteditable", - "contextmenu", - "dir", - "draggable", - "dropzone", - "hidden", - "id", - "lang", - "spellcheck", - "style", - "tabindex", - "title", - "translate" -]; - -var eventAttributes = [ - "onabort", - "onblur", - "oncancel", - "oncanplay", - "oncanplaythrough", - "onchange", - "onclick", - "onclose", - "oncontextmenu", - "oncuechange", - "ondblclick", - "ondrag", - "ondragend", - "ondragenter", - "ondragleave", - "ondragover", - "ondragstart", - "ondrop", - "ondurationchange", - "onemptied", - "onended", - "onerror", - "onfocus", - "oninput", - "oninvalid", - "onkeydown", - "onkeypress", - "onkeyup", - "onload", - "onloadeddata", - "onloadedmetadata", - "onloadstart", - "onmousedown", - "onmousemove", - "onmouseout", - "onmouseover", - "onmouseup", - "onmousewheel", - "onpause", - "onplay", - "onplaying", - "onprogress", - "onratechange", - "onreset", - "onscroll", - "onseeked", - "onseeking", - "onselect", - "onshow", - "onstalled", - "onsubmit", - "onsuspend", - "ontimeupdate", - "onvolumechange", - "onwaiting" -]; - -var globalAttributes = commonAttributes.concat(eventAttributes); - -var attributeMap = { - "html": ["manifest"], - "head": [], - "title": [], - "base": ["href", "target"], - "link": ["href", "hreflang", "rel", "media", "type", "sizes"], - "meta": ["http-equiv", "name", "content", "charset"], - "style": ["type", "media", "scoped"], - "script": ["charset", "type", "src", "defer", "async"], - "noscript": ["href"], - "body": ["onafterprint", "onbeforeprint", "onbeforeunload", "onhashchange", "onmessage", "onoffline", "onpopstate", "onredo", "onresize", "onstorage", "onundo", "onunload"], - "section": [], - "nav": [], - "article": ["pubdate"], - "aside": [], - "h1": [], - "h2": [], - "h3": [], - "h4": [], - "h5": [], - "h6": [], - "header": [], - "footer": [], - "address": [], - "main": [], - "p": [], - "hr": [], - "pre": [], - "blockquote": ["cite"], - "ol": ["start", "reversed"], - "ul": [], - "li": ["value"], - "dl": [], - "dt": [], - "dd": [], - "figure": [], - "figcaption": [], - "div": [], - "a": ["href", "target", "ping", "rel", "media", "hreflang", "type"], - "em": [], - "strong": [], - "small": [], - "s": [], - "cite": [], - "q": ["cite"], - "dfn": [], - "abbr": [], - "data": [], - "time": ["datetime"], - "code": [], - "var": [], - "samp": [], - "kbd": [], - "sub": [], - "sup": [], - "i": [], - "b": [], - "u": [], - "mark": [], - "ruby": [], - "rt": [], - "rp": [], - "bdi": [], - "bdo": [], - "span": [], - "br": [], - "wbr": [], - "ins": ["cite", "datetime"], - "del": ["cite", "datetime"], - "img": ["alt", "src", "height", "width", "usemap", "ismap"], - "iframe": ["name", "src", "height", "width", "sandbox", "seamless"], - "embed": ["src", "height", "width", "type"], - "object": ["param", "data", "type", "height" , "width", "usemap", "name", "form", "classid"], - "param": ["name", "value"], - "video": ["src", "autobuffer", "autoplay", "loop", "controls", "width", "height", "poster"], - "audio": ["src", "autobuffer", "autoplay", "loop", "controls"], - "source": ["src", "type", "media"], - "track": ["kind", "src", "srclang", "label", "default"], - "canvas": ["width", "height"], - "map": ["name"], - "area": ["shape", "coords", "href", "hreflang", "alt", "target", "media", "rel", "ping", "type"], - "svg": [], - "math": [], - "table": ["summary"], - "caption": [], - "colgroup": ["span"], - "col": ["span"], - "tbody": [], - "thead": [], - "tfoot": [], - "tr": [], - "td": ["headers", "rowspan", "colspan"], - "th": ["headers", "rowspan", "colspan", "scope"], - "form": ["accept-charset", "action", "autocomplete", "enctype", "method", "name", "novalidate", "target"], - "fieldset": ["disabled", "form", "name"], - "legend": [], - "label": ["form", "for"], - "input": ["type", "accept", "alt", "autocomplete", "checked", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "height", "list", "max", "maxlength", "min", "multiple", "pattern", "placeholder", "readonly", "required", "size", "src", "step", "width", "files", "value"], - "button": ["autofocus", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "name", "value", "type"], - "select": ["autofocus", "disabled", "form", "multiple", "name", "size"], - "datalist": [], - "optgroup": ["disabled", "label"], - "option": ["disabled", "selected", "label", "value"], - "textarea": ["autofocus", "disabled", "form", "maxlength", "name", "placeholder", "readonly", "required", "rows", "cols", "wrap"], - "keygen": ["autofocus", "challenge", "disabled", "form", "keytype", "name"], - "output": ["for", "form", "name"], - "progress": ["value", "max"], - "meter": ["value", "min", "max", "low", "high", "optimum"], - "details": ["open"], - "summary": [], - "command": ["type", "label", "icon", "disabled", "checked", "radiogroup", "command"], - "menu": ["type", "label"], - "dialog": ["open"] -}; - -var allElements = Object.keys(attributeMap); - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); -} - -function findTagName(session, pos) { - var iterator = new TokenIterator(session, pos.row, pos.column); - var token = iterator.getCurrentToken(); - if (!token || !hasType(token, 'tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'operator') || hasType(token, 'attribute-name') || hasType(token, 'text'))); - } - if (token && hasType(token, 'tag-name') && !iterator.stepBackward().value.match('/')) - return token.value; -} - -var HtmlCompletions = function() { - -}; - -(function() { - - this.getCompletions = function(state, session, pos, prefix) { - var token = session.getTokenAt(pos.row, pos.column); - - if (!token) - return []; - if (hasType(token, "tag-name") || (token.value == '<' && hasType(token, "text"))) - return this.getTagCompletions(state, session, pos, prefix); - if (hasType(token, 'text') || hasType(token, 'attribute-name')) - return this.getAttributeCompetions(state, session, pos, prefix); - - return []; - }; - - this.getTagCompletions = function(state, session, pos, prefix) { - var elements = allElements; - if (prefix) { - elements = elements.filter(function(element){ - return element.indexOf(prefix) === 0; - }); - } - return elements.map(function(element){ - return { - value: element, - meta: "tag" - }; - }); - }; - - this.getAttributeCompetions = function(state, session, pos, prefix) { - var tagName = findTagName(session, pos); - if (!tagName) - return []; - var attributes = globalAttributes; - if (tagName in attributeMap) { - attributes = attributes.concat(attributeMap[tagName]); - } - if (prefix) { - attributes = attributes.filter(function(attribute){ - return attribute.indexOf(prefix) === 0; - }); - } - return attributes.map(function(attribute){ - return { - caption: attribute, - snippet: attribute + '="$0"', - meta: "attribute" - }; - }); - }; - -}).call(HtmlCompletions.prototype); - -exports.HtmlCompletions = HtmlCompletions; -}); -define('ace/mode/rhtml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/r_highlight_rules', 'ace/mode/html_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var RHighlightRules = require("./r_highlight_rules").RHighlightRules; -var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var RHtmlHighlightRules = function() { - HtmlHighlightRules.call(this); - - this.$rules["start"].unshift({ - token: "support.function.codebegin", - regex: "^<" + "!--\\s*begin.rcode\\s*(?:.*)", - next: "r-start" - }); - - this.embedRules(RHighlightRules, "r-", [{ - token: "support.function.codeend", - regex: "^\\s*end.rcode\\s*-->", - next: "start" - }], ["start"]); - - this.normalizeRules(); -}; -oop.inherits(RHtmlHighlightRules, TextHighlightRules); - -exports.RHtmlHighlightRules = RHtmlHighlightRules; -}); -define('ace/mode/r_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules', 'ace/mode/tex_highlight_rules'], function(require, exports, module) { - - var oop = require("../lib/oop"); - var lang = require("../lib/lang"); - var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - var TexHighlightRules = require("./tex_highlight_rules").TexHighlightRules; - - var RHighlightRules = function() - { - - var keywords = lang.arrayToMap( - ("function|if|in|break|next|repeat|else|for|return|switch|while|try|tryCatch|stop|warning|require|library|attach|detach|source|setMethod|setGeneric|setGroupGeneric|setClass") - .split("|") - ); - - var buildinConstants = lang.arrayToMap( - ("NULL|NA|TRUE|FALSE|T|F|Inf|NaN|NA_integer_|NA_real_|NA_character_|" + - "NA_complex_").split("|") - ); - - this.$rules = { - "start" : [ - { - token : "comment.sectionhead", - regex : "#+(?!').*(?:----|====|####)\\s*$" - }, - { - token : "comment", - regex : "#+'", - next : "rd-start" - }, - { - token : "comment", - regex : "#.*$" - }, - { - token : "string", // multi line string start - regex : '["]', - next : "qqstring" - }, - { - token : "string", // multi line string start - regex : "[']", - next : "qstring" - }, - { - token : "constant.numeric", // hex - regex : "0[xX][0-9a-fA-F]+[Li]?\\b" - }, - { - token : "constant.numeric", // explicit integer - regex : "\\d+L\\b" - }, - { - token : "constant.numeric", // number - regex : "\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d*)?i?\\b" - }, - { - token : "constant.numeric", // number with leading decimal - regex : "\\.\\d+(?:[eE][+\\-]?\\d*)?i?\\b" - }, - { - token : "constant.language.boolean", - regex : "(?:TRUE|FALSE|T|F)\\b" - }, - { - token : "identifier", - regex : "`.*?`" - }, - { - onMatch : function(value) { - if (keywords[value]) - return "keyword"; - else if (buildinConstants[value]) - return "constant.language"; - else if (value == '...' || value.match(/^\.\.\d+$/)) - return "variable.language"; - else - return "identifier"; - }, - regex : "[a-zA-Z.][a-zA-Z0-9._]*\\b" - }, - { - token : "keyword.operator", - regex : "%%|>=|<=|==|!=|\\->|<\\-|\\|\\||&&|=|\\+|\\-|\\*|/|\\^|>|<|!|&|\\||~|\\$|:" - }, - { - token : "keyword.operator", // infix operators - regex : "%.*?%" - }, - { - token : "paren.keyword.operator", - regex : "[[({]" - }, - { - token : "paren.keyword.operator", - regex : "[\\])}]" - }, - { - token : "text", - regex : "\\s+" - } - ], - "qqstring" : [ - { - token : "string", - regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"', - next : "start" - }, - { - token : "string", - regex : '.+' - } - ], - "qstring" : [ - { - token : "string", - regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'", - next : "start" - }, - { - token : "string", - regex : '.+' - } - ] - }; - - var rdRules = new TexHighlightRules("comment").getRules(); - for (var i = 0; i < rdRules["start"].length; i++) { - rdRules["start"][i].token += ".virtual-comment"; - } - - this.addRules(rdRules, "rd-"); - this.$rules["rd-start"].unshift({ - token: "text", - regex: "^", - next: "start" - }); - this.$rules["rd-start"].unshift({ - token : "keyword", - regex : "@(?!@)[^ ]*" - }); - this.$rules["rd-start"].unshift({ - token : "comment", - regex : "@@" - }); - this.$rules["rd-start"].push({ - token : "comment", - regex : "[^%\\\\[({\\])}]+" - }); - }; - - oop.inherits(RHighlightRules, TextHighlightRules); - - exports.RHighlightRules = RHighlightRules; -}); -define('ace/mode/tex_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var TexHighlightRules = function(textClass) { - - if (!textClass) - textClass = "text"; - - this.$rules = { - "start" : [ - { - token : "comment", - regex : "%.*$" - }, { - token : textClass, // non-command - regex : "\\\\[$&%#\\{\\}]" - }, { - token : "keyword", // command - regex : "\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\b", - next : "nospell" - }, { - token : "keyword", // command - regex : "\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])" - }, { - token : "paren.keyword.operator", - regex : "[[({]" - }, { - token : "paren.keyword.operator", - regex : "[\\])}]" - }, { - token : textClass, - regex : "\\s+" - } - ], - "nospell" : [ - { - token : "comment", - regex : "%.*$", - next : "start" - }, { - token : "nospell." + textClass, // non-command - regex : "\\\\[$&%#\\{\\}]" - }, { - token : "keyword", // command - regex : "\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\b" - }, { - token : "keyword", // command - regex : "\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])", - next : "start" - }, { - token : "paren.keyword.operator", - regex : "[[({]" - }, { - token : "paren.keyword.operator", - regex : "[\\])]" - }, { - token : "paren.keyword.operator", - regex : "}", - next : "start" - }, { - token : "nospell." + textClass, - regex : "\\s+" - }, { - token : "nospell." + textClass, - regex : "\\w+" - } - ] - }; -}; - -oop.inherits(TexHighlightRules, TextHighlightRules); - -exports.TexHighlightRules = TexHighlightRules; -}); diff --git a/addons/editor/ace/mode-scad.js b/addons/editor/ace/mode-scad.js deleted file mode 100644 index a8b73f53..00000000 --- a/addons/editor/ace/mode-scad.js +++ /dev/null @@ -1,670 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2010, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/mode/scad', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/scad_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var scadHighlightRules = require("./scad_highlight_rules").scadHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var Range = require("../range").Range; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = scadHighlightRules; - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().getLineTokens(line, state); - var tokens = tokenizedLine.tokens; - var endState = tokenizedLine.state; - - if (tokens.length && tokens[tokens.length-1].type == "comment") { - return indent; - } - - if (state == "start") { - var match = line.match(/^.*[\{\(\[]\s*$/); - if (match) { - indent += tab; - } - } else if (state == "doc-start") { - if (endState == "start") { - return ""; - } - var match = line.match(/^\s*(\/?)\*/); - if (match) { - if (match[1]) { - indent += " "; - } - indent += "* "; - } - } - - 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; -}); - -define('ace/mode/scad_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var scadHighlightRules = function() { - var keywordMapper = this.createKeywordMapper({ - "variable.language": "this", - "keyword": "module|if|else|for", - "constant.language": "NULL" - }, "identifier"); - - this.$rules = { - "start" : [ - { - token : "comment", - regex : "\\/\\/.*$" - }, - DocCommentHighlightRules.getStartRule("start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // multi line string start - regex : '["].*\\\\$', - next : "qqstring" - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - token : "string", // multi line string start - regex : "['].*\\\\$", - next : "qstring" - }, { - token : "constant.numeric", // hex - regex : "0[xX][0-9a-fA-F]+\\b" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "constant", // - regex : "<[a-zA-Z0-9.]+>" - }, { - token : "keyword", // pre-compiler directivs - regex : "(?:use|include)" - }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" - }, { - token : "keyword.operator", - regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)" - }, { - 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 - regex : ".+" - } - ], - "qqstring" : [ - { - token : "string", - regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"', - next : "start" - }, { - token : "string", - regex : '.+' - } - ], - "qstring" : [ - { - token : "string", - regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'", - next : "start" - }, { - token : "string", - regex : '.+' - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("start") ]); -}; - -oop.inherits(scadHighlightRules, TextHighlightRules); - -exports.scadHighlightRules = scadHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); diff --git a/addons/editor/ace/mode-scala.js b/addons/editor/ace/mode-scala.js deleted file mode 100644 index 048918ed..00000000 --- a/addons/editor/ace/mode-scala.js +++ /dev/null @@ -1,1035 +0,0 @@ -define('ace/mode/scala', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/javascript', 'ace/tokenizer', 'ace/mode/scala_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var JavaScriptMode = require("./javascript").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var ScalaHighlightRules = require("./scala_highlight_rules").ScalaHighlightRules; - -var Mode = function() { - JavaScriptMode.call(this); - - this.HighlightRules = ScalaHighlightRules; -}; -oop.inherits(Mode, JavaScriptMode); - -(function() { - - this.createWorker = function(session) { - return null; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/javascript', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/javascript_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/worker/worker_client', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var Range = require("../range").Range; -var WorkerClient = require("../worker/worker_client").WorkerClient; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = JavaScriptHighlightRules; - - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().getLineTokens(line, state); - var tokens = tokenizedLine.tokens; - var endState = tokenizedLine.state; - - if (tokens.length && tokens[tokens.length-1].type == "comment") { - return indent; - } - - if (state == "start" || state == "no_regex") { - var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/); - if (match) { - indent += tab; - } - } else if (state == "doc-start") { - if (endState == "start" || endState == "no_regex") { - return ""; - } - var match = line.match(/^\s*(\/?)\*/); - if (match) { - if (match[1]) { - indent += " "; - } - indent += "* "; - } - } - - 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); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker"); - worker.attachToDocument(session.getDocument()); - - worker.on("jslint", function(results) { - session.setAnnotations(results.data); - }); - - worker.on("terminate", function() { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var JavaScriptHighlightRules = function() { - var keywordMapper = this.createKeywordMapper({ - "variable.language": - "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors - "Namespace|QName|XML|XMLList|" + // E4X - "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + - "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + - "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors - "SyntaxError|TypeError|URIError|" + - "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions - "isNaN|parseFloat|parseInt|" + - "JSON|Math|" + // Other - "this|arguments|prototype|window|document" , // Pseudo - "keyword": - "const|yield|import|get|set|" + - "break|case|catch|continue|default|delete|do|else|finally|for|function|" + - "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + - "__parent__|__count__|escape|unescape|with|__proto__|" + - "class|enum|extends|super|export|implements|private|public|interface|package|protected|static", - "storage.type": - "const|let|var|function", - "constant.language": - "null|Infinity|NaN|undefined", - "support.function": - "alert", - "constant.language.boolean": "true|false" - }, "identifier"); - var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; - var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\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 - ".)"; - - this.$rules = { - "no_regex" : [ - { - token : "comment", - regex : "\\/\\/", - next : "line_comment" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : /\/\*/, - next : "comment" - }, { - token : "string", - regex : "'(?=.)", - next : "qstring" - }, { - token : "string", - regex : '"(?=.)', - next : "qqstring" - }, { - token : "constant.numeric", // hex - regex : /0[xX][0-9a-fA-F]+\b/ - }, { - token : "constant.numeric", // float - regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/ - }, { - token : [ - "storage.type", "punctuation.operator", "support.function", - "punctuation.operator", "entity.name.function", "text","keyword.operator" - ], - regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "keyword.operator", "text", "storage.type", - "text", "paren.lparen" - ], - regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "punctuation.operator", - "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "text", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : "keyword", - regex : "(?:" + kwBeforeRe + ")\\b", - next : "start" - }, { - token : ["punctuation.operator", "support.function"], - regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/ - }, { - token : ["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 : keywordMapper, - regex : identifierRe - }, { - token : "keyword.operator", - regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/, - next : "start" - }, { - token : "punctuation.operator", - regex : /\?|\:|\,|\;|\./, - next : "start" - }, { - token : "paren.lparen", - regex : /[\[({]/, - next : "start" - }, { - token : "paren.rparen", - regex : /[\])}]/ - }, { - token : "keyword.operator", - regex : /\/=?/, - next : "start" - }, { - token: "comment", - regex: /^#!.*$/ - } - ], - "start": [ - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment_regex_allowed" - }, { - token : "comment", - regex : "\\/\\/", - next : "line_comment_regex_allowed" - }, { - token: "string.regexp", - regex: "\\/", - next: "regex" - }, { - token : "text", - regex : "\\s+|^$", - next : "start" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "regex": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "string.regexp", - regex: "/\\w*", - next: "no_regex" - }, { - token : "invalid", - regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ - }, { - token : "constant.language.escape", - regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/ - }, { - token : "constant.language.delimiter", - regex: /\|/ - }, { - token: "constant.language.escape", - regex: /\[\^?/, - next: "regex_character_class" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp" - } - ], - "regex_character_class": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "constant.language.escape", - regex: "]", - next: "regex" - }, { - token: "constant.language.escape", - regex: "-" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp.charachterclass" - } - ], - "function_arguments": [ - { - token: "variable.parameter", - regex: identifierRe - }, { - token: "punctuation.operator", - regex: "[, ]+" - }, { - token: "punctuation.operator", - regex: "$" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "comment_regex_allowed" : [ - {token : "comment", regex : "\\*\\/", next : "start"}, - {defaultToken : "comment"} - ], - "comment" : [ - {token : "comment", regex : "\\*\\/", next : "no_regex"}, - {defaultToken : "comment"} - ], - "line_comment_regex_allowed" : [ - {token : "comment", regex : "$|^", next : "start"}, - {defaultToken : "comment"} - ], - "line_comment" : [ - {token : "comment", regex : "$|^", next : "no_regex"}, - {defaultToken : "comment"} - ], - "qqstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qqstring" - }, { - token : "string", - regex : '"|$', - next : "no_regex" - }, { - defaultToken: "string" - } - ], - "qstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qstring" - }, { - token : "string", - regex : "'|$", - next : "no_regex" - }, { - defaultToken: "string" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("no_regex") ]); -}; - -oop.inherits(JavaScriptHighlightRules, TextHighlightRules); - -exports.JavaScriptHighlightRules = JavaScriptHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); -define('ace/mode/scala_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var ScalaHighlightRules = function() { - var keywords = ( - "case|default|do|else|for|if|match|while|throw|return|try|catch|finally|yield|" + - "abstract|class|def|extends|final|forSome|implicit|implicits|import|lazy|new|object|" + - "override|package|private|protected|sealed|super|this|trait|type|val|var|with" - ); - - var buildinConstants = ("true|false"); - - var langClasses = ( - "AbstractMethodError|AssertionError|ClassCircularityError|"+ - "ClassFormatError|Deprecated|EnumConstantNotPresentException|"+ - "ExceptionInInitializerError|IllegalAccessError|"+ - "IllegalThreadStateException|InstantiationError|InternalError|"+ - - "NegativeArraySizeException|NoSuchFieldError|Override|Process|"+ - "ProcessBuilder|SecurityManager|StringIndexOutOfBoundsException|"+ - "SuppressWarnings|TypeNotPresentException|UnknownError|"+ - "UnsatisfiedLinkError|UnsupportedClassVersionError|VerifyError|"+ - "InstantiationException|IndexOutOfBoundsException|"+ - "ArrayIndexOutOfBoundsException|CloneNotSupportedException|"+ - "NoSuchFieldException|IllegalArgumentException|NumberFormatException|"+ - "SecurityException|Void|InheritableThreadLocal|IllegalStateException|"+ - "InterruptedException|NoSuchMethodException|IllegalAccessException|"+ - "UnsupportedOperationException|Enum|StrictMath|Package|Compiler|"+ - "Readable|Runtime|StringBuilder|Math|IncompatibleClassChangeError|"+ - "NoSuchMethodError|ThreadLocal|RuntimePermission|ArithmeticException|"+ - "NullPointerException|Long|Integer|Short|Byte|Double|Number|Float|"+ - "Character|Boolean|StackTraceElement|Appendable|StringBuffer|"+ - "Iterable|ThreadGroup|Runnable|Thread|IllegalMonitorStateException|"+ - "StackOverflowError|OutOfMemoryError|VirtualMachineError|"+ - "ArrayStoreException|ClassCastException|LinkageError|"+ - "NoClassDefFoundError|ClassNotFoundException|RuntimeException|"+ - "Exception|ThreadDeath|Error|Throwable|System|ClassLoader|"+ - "Cloneable|Class|CharSequence|Comparable|String|Object|" + - "Unit|Any|AnyVal|AnyRef|Null|ScalaObject|Singleton|Seq|Iterable|List|" + - "Option|Array|Char|Byte|Short|Int|Long|Nothing" - - - ); - - var keywordMapper = this.createKeywordMapper({ - "variable.language": "this", - "keyword": keywords, - "support.function": langClasses, - "constant.language": buildinConstants - }, "identifier"); - - this.$rules = { - "start" : [ - { - token : "comment", - regex : "\\/\\/.*$" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment" - }, { - token : "string.regexp", - regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" - }, { - token : "string", - regex : '"""', - next : "tstring" - }, { - token : "string", - regex : '"(?=.)', // " strings can't span multiple lines - next : "string" - }, { - token : "symbol.constant", // single line - regex : "'[\\w\\d_]+" - }, { - token : "constant.numeric", // hex - regex : "0[xX][0-9a-fA-F]+\\b" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "constant.language.boolean", - regex : "(?:true|false)\\b" - }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" - }, { - token : "keyword.operator", - regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" - }, { - 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 - regex : ".+" - } - ], - "string" : [ - { - token : "escape", - regex : '\\\\"' - }, { - token : "string", - regex : '"', - next : "start" - }, { - token : "string.invalid", - regex : '[^"\\\\]*$', - next : "start" - }, { - token : "string", - regex : '[^"\\\\]+' - } - ], - "tstring" : [ - { - token : "string", // closing comment - regex : '"{3,5}', - next : "start" - }, { - token : "string", // comment spanning whole line - regex : ".+?" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("start") ]); -}; - -oop.inherits(ScalaHighlightRules, TextHighlightRules); - -exports.ScalaHighlightRules = ScalaHighlightRules; -}); diff --git a/addons/editor/ace/mode-scss.js b/addons/editor/ace/mode-scss.js deleted file mode 100644 index 1ce02270..00000000 --- a/addons/editor/ace/mode-scss.js +++ /dev/null @@ -1,832 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2010, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/mode/scss', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/scss_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/behaviour/css', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var ScssHighlightRules = require("./scss_highlight_rules").ScssHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var CssBehaviour = require("./behaviour/css").CssBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = ScssHighlightRules; - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CssBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - var tokens = this.getTokenizer().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; - -}); - -define('ace/mode/scss_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var ScssHighlightRules = 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-shadow|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("|"); - var ret = []; - for (var i=0, ln=browserPrefix.length; i|<=|>=|==|!=|-|%|#|\\+|\\$|\\+|\\*" - }, { - token : "paren.lparen", - regex : "[[({]" - }, { - token : "paren.rparen", - regex : "[\\])}]" - }, { - token : "text", - regex : "\\s+" - }, { - caseInsensitive: true - } - ], - "comment" : [ - { - token : "comment", // closing comment - regex : ".*?\\*\\/", - next : "start" - }, { - token : "comment", // comment spanning whole line - regex : ".+" - } - ], - "qqstring" : [ - { - token : "string", - regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"', - next : "start" - }, { - token : "string", - regex : '.+' - } - ], - "qstring" : [ - { - token : "string", - regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'", - next : "start" - }, { - token : "string", - regex : '.+' - } - ] - }; -}; - -oop.inherits(ScssHighlightRules, TextHighlightRules); - -exports.ScssHighlightRules = ScssHighlightRules; - -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; - -var CssBehaviour = function () { - - this.inherit(CstyleBehaviour); - - this.add("colon", "insertion", function (state, action, editor, session, text) { - if (text === ':') { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - var token = iterator.getCurrentToken(); - if (token && token.value.match(/\s+/)) { - token = iterator.stepBackward(); - } - if (token && token.type === 'support.type') { - var line = session.doc.getLine(cursor.row); - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar === ':') { - return { - text: '', - selection: [1, 1] - } - } - if (!line.substring(cursor.column).match(/^\s*;/)) { - return { - text: ':;', - selection: [1, 1] - } - } - } - } - }); - - this.add("colon", "deletion", function (state, action, editor, session, range) { - var selected = session.doc.getTextRange(range); - if (!range.isMultiLine() && selected === ':') { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - var token = iterator.getCurrentToken(); - if (token && token.value.match(/\s+/)) { - token = iterator.stepBackward(); - } - if (token && token.type === 'support.type') { - 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("semicolon", "insertion", function (state, action, editor, session, text) { - if (text === ';') { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar === ';') { - return { - text: '', - selection: [1, 1] - } - } - } - }); - -} -oop.inherits(CssBehaviour, CstyleBehaviour); - -exports.CssBehaviour = CssBehaviour; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); diff --git a/addons/editor/ace/mode-sjs.js b/addons/editor/ace/mode-sjs.js deleted file mode 100644 index fbd3ecc4..00000000 --- a/addons/editor/ace/mode-sjs.js +++ /dev/null @@ -1,1106 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2010, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/mode/sjs', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/javascript', 'ace/tokenizer', 'ace/mode/sjs_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) { - -var oop = require("../lib/oop"); -var JSMode = require("./javascript").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var SJSHighlightRules = require("./sjs_highlight_rules").SJSHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - var highlighter = new SJSHighlightRules(); - - this.$tokenizer = new Tokenizer(highlighter.getRules()); - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - this.$keywordList = highlighter.$keywordList; - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, JSMode); -(function() { - this.createWorker = function(session) { - return null; - } -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/javascript', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/javascript_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/worker/worker_client', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var Range = require("../range").Range; -var WorkerClient = require("../worker/worker_client").WorkerClient; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = JavaScriptHighlightRules; - - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().getLineTokens(line, state); - var tokens = tokenizedLine.tokens; - var endState = tokenizedLine.state; - - if (tokens.length && tokens[tokens.length-1].type == "comment") { - return indent; - } - - if (state == "start" || state == "no_regex") { - var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/); - if (match) { - indent += tab; - } - } else if (state == "doc-start") { - if (endState == "start" || endState == "no_regex") { - return ""; - } - var match = line.match(/^\s*(\/?)\*/); - if (match) { - if (match[1]) { - indent += " "; - } - indent += "* "; - } - } - - 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); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker"); - worker.attachToDocument(session.getDocument()); - - worker.on("jslint", function(results) { - session.setAnnotations(results.data); - }); - - worker.on("terminate", function() { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var JavaScriptHighlightRules = function() { - var keywordMapper = this.createKeywordMapper({ - "variable.language": - "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors - "Namespace|QName|XML|XMLList|" + // E4X - "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + - "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + - "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors - "SyntaxError|TypeError|URIError|" + - "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions - "isNaN|parseFloat|parseInt|" + - "JSON|Math|" + // Other - "this|arguments|prototype|window|document" , // Pseudo - "keyword": - "const|yield|import|get|set|" + - "break|case|catch|continue|default|delete|do|else|finally|for|function|" + - "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + - "__parent__|__count__|escape|unescape|with|__proto__|" + - "class|enum|extends|super|export|implements|private|public|interface|package|protected|static", - "storage.type": - "const|let|var|function", - "constant.language": - "null|Infinity|NaN|undefined", - "support.function": - "alert", - "constant.language.boolean": "true|false" - }, "identifier"); - var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; - var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\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 - ".)"; - - this.$rules = { - "no_regex" : [ - { - token : "comment", - regex : "\\/\\/", - next : "line_comment" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : /\/\*/, - next : "comment" - }, { - token : "string", - regex : "'(?=.)", - next : "qstring" - }, { - token : "string", - regex : '"(?=.)', - next : "qqstring" - }, { - token : "constant.numeric", // hex - regex : /0[xX][0-9a-fA-F]+\b/ - }, { - token : "constant.numeric", // float - regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/ - }, { - token : [ - "storage.type", "punctuation.operator", "support.function", - "punctuation.operator", "entity.name.function", "text","keyword.operator" - ], - regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "keyword.operator", "text", "storage.type", - "text", "paren.lparen" - ], - regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "punctuation.operator", - "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "text", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : "keyword", - regex : "(?:" + kwBeforeRe + ")\\b", - next : "start" - }, { - token : ["punctuation.operator", "support.function"], - regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/ - }, { - token : ["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 : keywordMapper, - regex : identifierRe - }, { - token : "keyword.operator", - regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/, - next : "start" - }, { - token : "punctuation.operator", - regex : /\?|\:|\,|\;|\./, - next : "start" - }, { - token : "paren.lparen", - regex : /[\[({]/, - next : "start" - }, { - token : "paren.rparen", - regex : /[\])}]/ - }, { - token : "keyword.operator", - regex : /\/=?/, - next : "start" - }, { - token: "comment", - regex: /^#!.*$/ - } - ], - "start": [ - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment_regex_allowed" - }, { - token : "comment", - regex : "\\/\\/", - next : "line_comment_regex_allowed" - }, { - token: "string.regexp", - regex: "\\/", - next: "regex" - }, { - token : "text", - regex : "\\s+|^$", - next : "start" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "regex": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "string.regexp", - regex: "/\\w*", - next: "no_regex" - }, { - token : "invalid", - regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ - }, { - token : "constant.language.escape", - regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/ - }, { - token : "constant.language.delimiter", - regex: /\|/ - }, { - token: "constant.language.escape", - regex: /\[\^?/, - next: "regex_character_class" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp" - } - ], - "regex_character_class": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "constant.language.escape", - regex: "]", - next: "regex" - }, { - token: "constant.language.escape", - regex: "-" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp.charachterclass" - } - ], - "function_arguments": [ - { - token: "variable.parameter", - regex: identifierRe - }, { - token: "punctuation.operator", - regex: "[, ]+" - }, { - token: "punctuation.operator", - regex: "$" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "comment_regex_allowed" : [ - {token : "comment", regex : "\\*\\/", next : "start"}, - {defaultToken : "comment"} - ], - "comment" : [ - {token : "comment", regex : "\\*\\/", next : "no_regex"}, - {defaultToken : "comment"} - ], - "line_comment_regex_allowed" : [ - {token : "comment", regex : "$|^", next : "start"}, - {defaultToken : "comment"} - ], - "line_comment" : [ - {token : "comment", regex : "$|^", next : "no_regex"}, - {defaultToken : "comment"} - ], - "qqstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qqstring" - }, { - token : "string", - regex : '"|$', - next : "no_regex" - }, { - defaultToken: "string" - } - ], - "qstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qstring" - }, { - token : "string", - regex : "'|$", - next : "no_regex" - }, { - defaultToken: "string" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("no_regex") ]); -}; - -oop.inherits(JavaScriptHighlightRules, TextHighlightRules); - -exports.JavaScriptHighlightRules = JavaScriptHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); - -define('ace/mode/sjs_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/javascript_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var SJSHighlightRules = function() { - var parent = new JavaScriptHighlightRules(); - 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 - ".)"; - - var contextAware = function(f) { - f.isContextAware = true; - return f; - }; - - var ctxBegin = function(opts) { - return { - token: opts.token, - regex: opts.regex, - next: contextAware(function(currentState, stack) { - if (stack.length === 0) - stack.unshift(currentState); - stack.unshift(opts.next); - return opts.next; - }), - }; - }; - - var ctxEnd = function(opts) { - return { - token: opts.token, - regex: opts.regex, - next: contextAware(function(currentState, stack) { - stack.shift(); - return stack[0] || "start"; - }), - }; - }; - - this.$rules = parent.$rules; - this.$rules.no_regex = [ - { - token: "keyword", - regex: "(waitfor|or|and|collapse|spawn|retract)\\b" - }, - { - token: "keyword.operator", - regex: "(->|=>|\\.\\.)" - }, - { - token: "variable.language", - regex: "(hold|default)\\b" - }, - ctxBegin({ - token: "string", - regex: "`", - next: "bstring" - }), - ctxBegin({ - token: "string", - regex: '"', - next: "qqstring" - }), - ctxBegin({ - token: "string", - regex: '"', - next: "qqstring" - }), - { - token: ["paren.lparen", "text", "paren.rparen"], - regex: "(\\{)(\\s*)(\\|)", - next: "block_arguments", - } - - ].concat(this.$rules.no_regex); - - this.$rules.block_arguments = [ - { - token: "paren.rparen", - regex: "\\|", - next: "no_regex", - } - ].concat(this.$rules.function_arguments); - - this.$rules.bstring = [ - { - token : "constant.language.escape", - regex : escapedRe - }, - { - token : "string", - regex : "\\\\$", - next: "bstring" - }, - ctxBegin({ - token : "paren.lparen", - regex : "\\$\\{", - next: "string_interp" - }), - ctxBegin({ - token : "paren.lparen", - regex : "\\$", - next: "bstring_interp_single" - }), - ctxEnd({ - token : "string", - regex : "`", - }), - { - defaultToken: "string" - } - ]; - - this.$rules.qqstring = [ - { - token : "constant.language.escape", - regex : escapedRe - }, - { - token : "string", - regex : "\\\\$", - next: "qqstring", - }, - ctxBegin({ - token : "paren.lparen", - regex : "#\\{", - next: "string_interp" - }), - ctxEnd({ - token : "string", - regex : '"', - }), - { - defaultToken: "string" - } - ]; - var embeddableRules = []; - for (var i=0; i"}; - - this.getNextLineIndent = function(state, line, tab) { - return this.$getIndent(line); - }; - - this.checkOutdent = function(state, line, input) { - return false; - }; - - this.getCompletions = function(state, session, pos, prefix) { - return this.$completer.getCompletions(state, session, pos, prefix); - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/javascript', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/javascript_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/worker/worker_client', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var Range = require("../range").Range; -var WorkerClient = require("../worker/worker_client").WorkerClient; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = JavaScriptHighlightRules; - - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().getLineTokens(line, state); - var tokens = tokenizedLine.tokens; - var endState = tokenizedLine.state; - - if (tokens.length && tokens[tokens.length-1].type == "comment") { - return indent; - } - - if (state == "start" || state == "no_regex") { - var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/); - if (match) { - indent += tab; - } - } else if (state == "doc-start") { - if (endState == "start" || endState == "no_regex") { - return ""; - } - var match = line.match(/^\s*(\/?)\*/); - if (match) { - if (match[1]) { - indent += " "; - } - indent += "* "; - } - } - - 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); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker"); - worker.attachToDocument(session.getDocument()); - - worker.on("jslint", function(results) { - session.setAnnotations(results.data); - }); - - worker.on("terminate", function() { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var JavaScriptHighlightRules = function() { - var keywordMapper = this.createKeywordMapper({ - "variable.language": - "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors - "Namespace|QName|XML|XMLList|" + // E4X - "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + - "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + - "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors - "SyntaxError|TypeError|URIError|" + - "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions - "isNaN|parseFloat|parseInt|" + - "JSON|Math|" + // Other - "this|arguments|prototype|window|document" , // Pseudo - "keyword": - "const|yield|import|get|set|" + - "break|case|catch|continue|default|delete|do|else|finally|for|function|" + - "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + - "__parent__|__count__|escape|unescape|with|__proto__|" + - "class|enum|extends|super|export|implements|private|public|interface|package|protected|static", - "storage.type": - "const|let|var|function", - "constant.language": - "null|Infinity|NaN|undefined", - "support.function": - "alert", - "constant.language.boolean": "true|false" - }, "identifier"); - var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; - var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\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 - ".)"; - - this.$rules = { - "no_regex" : [ - { - token : "comment", - regex : "\\/\\/", - next : "line_comment" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : /\/\*/, - next : "comment" - }, { - token : "string", - regex : "'(?=.)", - next : "qstring" - }, { - token : "string", - regex : '"(?=.)', - next : "qqstring" - }, { - token : "constant.numeric", // hex - regex : /0[xX][0-9a-fA-F]+\b/ - }, { - token : "constant.numeric", // float - regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/ - }, { - token : [ - "storage.type", "punctuation.operator", "support.function", - "punctuation.operator", "entity.name.function", "text","keyword.operator" - ], - regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "keyword.operator", "text", "storage.type", - "text", "paren.lparen" - ], - regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "punctuation.operator", - "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "text", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : "keyword", - regex : "(?:" + kwBeforeRe + ")\\b", - next : "start" - }, { - token : ["punctuation.operator", "support.function"], - regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/ - }, { - token : ["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 : keywordMapper, - regex : identifierRe - }, { - token : "keyword.operator", - regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/, - next : "start" - }, { - token : "punctuation.operator", - regex : /\?|\:|\,|\;|\./, - next : "start" - }, { - token : "paren.lparen", - regex : /[\[({]/, - next : "start" - }, { - token : "paren.rparen", - regex : /[\])}]/ - }, { - token : "keyword.operator", - regex : /\/=?/, - next : "start" - }, { - token: "comment", - regex: /^#!.*$/ - } - ], - "start": [ - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment_regex_allowed" - }, { - token : "comment", - regex : "\\/\\/", - next : "line_comment_regex_allowed" - }, { - token: "string.regexp", - regex: "\\/", - next: "regex" - }, { - token : "text", - regex : "\\s+|^$", - next : "start" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "regex": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "string.regexp", - regex: "/\\w*", - next: "no_regex" - }, { - token : "invalid", - regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ - }, { - token : "constant.language.escape", - regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/ - }, { - token : "constant.language.delimiter", - regex: /\|/ - }, { - token: "constant.language.escape", - regex: /\[\^?/, - next: "regex_character_class" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp" - } - ], - "regex_character_class": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "constant.language.escape", - regex: "]", - next: "regex" - }, { - token: "constant.language.escape", - regex: "-" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp.charachterclass" - } - ], - "function_arguments": [ - { - token: "variable.parameter", - regex: identifierRe - }, { - token: "punctuation.operator", - regex: "[, ]+" - }, { - token: "punctuation.operator", - regex: "$" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "comment_regex_allowed" : [ - {token : "comment", regex : "\\*\\/", next : "start"}, - {defaultToken : "comment"} - ], - "comment" : [ - {token : "comment", regex : "\\*\\/", next : "no_regex"}, - {defaultToken : "comment"} - ], - "line_comment_regex_allowed" : [ - {token : "comment", regex : "$|^", next : "start"}, - {defaultToken : "comment"} - ], - "line_comment" : [ - {token : "comment", regex : "$|^", next : "no_regex"}, - {defaultToken : "comment"} - ], - "qqstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qqstring" - }, { - token : "string", - regex : '"|$', - next : "no_regex" - }, { - defaultToken: "string" - } - ], - "qstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qstring" - }, { - token : "string", - regex : "'|$", - next : "no_regex" - }, { - defaultToken: "string" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("no_regex") ]); -}; - -oop.inherits(JavaScriptHighlightRules, TextHighlightRules); - -exports.JavaScriptHighlightRules = JavaScriptHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); - -define('ace/mode/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/css_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/worker/worker_client', 'ace/mode/behaviour/css', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var WorkerClient = require("../worker/worker_client").WorkerClient; -var CssBehaviour = require("./behaviour/css").CssBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = CssHighlightRules; - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CssBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.foldingRules = "cStyle"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - var tokens = this.getTokenizer().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); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker"); - worker.attachToDocument(session.getDocument()); - - worker.on("csslint", function(e) { - session.setAnnotations(e.data); - }); - - worker.on("terminate", function() { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; - -}); - -define('ace/mode/css_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var supportType = exports.supportType = "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"; -var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters"; -var supportConstant = exports.supportConstant = "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|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|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero"; -var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow"; -var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace"; - -var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))"; -var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b"; -var pseudoClasses = exports.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 CssHighlightRules = function() { - - var keywordMapper = this.createKeywordMapper({ - "support.function": supportFunction, - "support.constant": supportConstant, - "support.type": supportType, - "support.constant.color": supportConstantColor, - "support.constant.fonts": supportConstantFonts - }, "text", true); - - this.$rules = { - "start" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "@.*?{", - push: "media" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "media" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "\\}", - next: "pop" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "comment" : [{ - token : "comment", - regex : "\\*\\/", - next : "pop" - }, { - defaultToken : "comment" - }], - - "ruleset" : [ - { - token : "paren.rparen", - regex : "\\}", - next: "pop" - }, { - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - 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 : numRe - }, { - 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 : ["support.function", "string", "support.function"], - regex : "(url\\()(.*)(\\))" - }, { - token : keywordMapper, - regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*" - }, { - caseInsensitive: true - }] - }; - - this.normalizeRules(); -}; - -oop.inherits(CssHighlightRules, TextHighlightRules); - -exports.CssHighlightRules = CssHighlightRules; - -}); - -define('ace/mode/behaviour/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; - -var CssBehaviour = function () { - - this.inherit(CstyleBehaviour); - - this.add("colon", "insertion", function (state, action, editor, session, text) { - if (text === ':') { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - var token = iterator.getCurrentToken(); - if (token && token.value.match(/\s+/)) { - token = iterator.stepBackward(); - } - if (token && token.type === 'support.type') { - var line = session.doc.getLine(cursor.row); - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar === ':') { - return { - text: '', - selection: [1, 1] - } - } - if (!line.substring(cursor.column).match(/^\s*;/)) { - return { - text: ':;', - selection: [1, 1] - } - } - } - } - }); - - this.add("colon", "deletion", function (state, action, editor, session, range) { - var selected = session.doc.getTextRange(range); - if (!range.isMultiLine() && selected === ':') { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - var token = iterator.getCurrentToken(); - if (token && token.value.match(/\s+/)) { - token = iterator.stepBackward(); - } - if (token && token.type === 'support.type') { - 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("semicolon", "insertion", function (state, action, editor, session, text) { - if (text === ';') { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar === ';') { - return { - text: '', - selection: [1, 1] - } - } - } - }); - -} -oop.inherits(CssBehaviour, CstyleBehaviour); - -exports.CssBehaviour = CssBehaviour; -}); - -define('ace/mode/html_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/css_highlight_rules', 'ace/mode/javascript_highlight_rules', 'ace/mode/xml_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; - -var tagMap = lang.createMap({ - a : 'anchor', - button : 'form', - form : 'form', - img : 'image', - input : 'form', - label : 'form', - option : 'form', - script : 'script', - select : 'form', - textarea : 'form', - style : 'style', - table : 'table', - tbody : 'table', - td : 'table', - tfoot : 'table', - th : 'table', - tr : 'table' -}); - -var HtmlHighlightRules = function() { - XmlHighlightRules.call(this); - - this.addRules({ - attributes: [{ - include : "space" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "keyword.operator.separator", - regex : "=", - push : [{ - include: "space" - }, { - token : "string", - regex : "[^<>='\"`\\s]+", - next : "pop" - }, { - token : "empty", - regex : "", - next : "pop" - }] - }, { - include : "string" - }], - tag: [{ - token : function(start, tag) { - var group = tagMap[tag]; - return ["meta.tag.punctuation.begin", - "meta.tag.name" + (group ? "." + group : "")]; - }, - regex : "(<)([-_a-zA-Z0-9:]+)", - next: "start_tag_stuff" - }, { - token : function(start, tag) { - var group = tagMap[tag]; - return ["meta.tag.punctuation.begin", - "meta.tag.name" + (group ? "." + group : "")]; - }, - regex : "(", next : "start"} - ], - end_tag_stuff: [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next : "start"} - ] - }); - - this.embedTagRules(CssHighlightRules, "css-", "style"); - this.embedTagRules(JavaScriptHighlightRules, "js-", "script"); - - if (this.constructor === HtmlHighlightRules) - this.normalizeRules(); -}; - -oop.inherits(HtmlHighlightRules, XmlHighlightRules); - -exports.HtmlHighlightRules = HtmlHighlightRules; -}); - -define('ace/mode/xml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml_util', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var xmlUtil = require("./xml_util"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var XmlHighlightRules = function(normalize) { - this.$rules = { - start : [ - {token : "punctuation.string.begin", regex : "<\\!\\[CDATA\\[", next : "cdata"}, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)(xml)(?=[\\s])", next : "xml_declaration" - }, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)([-_a-zA-Z0-9]+)", next : "instruction" - }, - {token : "comment", regex : "<\\!--", next : "comment"}, - { - token : ["punctuation.doctype.begin", "meta.tag.doctype"], - regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype" - }, - {include : "tag"}, - {include : "reference"} - ], - - xml_declaration : [ - {include : "attributes"}, - {include : "instruction"} - ], - - instruction : [ - {token : "punctuation.instruction.end", regex : "\\?>", next : "start"} - ], - - doctype : [ - {include : "space"}, - {include : "string"}, - {token : "punctuation.doctype.end", regex : ">", next : "start"}, - {token : "xml-pe", regex : "[-_a-zA-Z0-9:]+"}, - {token : "punctuation.begin", regex : "\\[", push : "declarations"} - ], - - declarations : [{ - token : "text", - regex : "\\s+" - }, { - token: "punctuation.end", - regex: "]", - next: "pop" - }, { - token : ["punctuation.begin", "keyword"], - regex : "(<\\!)([-_a-zA-Z0-9]+)", - push : [{ - token : "text", - regex : "\\s+" - }, - { - token : "punctuation.end", - regex : ">", - next : "pop" - }, - {include : "string"}] - }], - - cdata : [ - {token : "string.end", regex : "\\]\\]>", next : "start"}, - {token : "text", regex : "\\s+"}, - {token : "text", regex : "(?:[^\\]]|\\](?!\\]>))+"} - ], - - comment : [ - {token : "comment", regex : "-->", next : "start"}, - {defaultToken : "comment"} - ], - - tag : [{ - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(<)((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)", - next: [ - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : "start"} - ] - }, { - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(", next : "start"} - ] - }], - - space : [ - {token : "text", regex : "\\s+"} - ], - - reference : [{ - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, { - token : "invalid.illegal", regex : "&" - }], - - string: [{ - token : "string", - regex : "'", - push : "qstring_inner" - }, { - token : "string", - regex : '"', - push : "qqstring_inner" - }], - - qstring_inner: [ - {token : "string", regex: "'", next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - qqstring_inner: [ - {token : "string", regex: '"', next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - attributes: [{ - token : "entity.other.attribute-name", - regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+" - }, { - token : "keyword.operator.separator", - regex : "=" - }, { - include : "space" - }, { - include : "string" - }] - }; - - if (this.constructor === XmlHighlightRules) - this.normalizeRules(); -}; - - -(function() { - - this.embedTagRules = function(HighlightRules, prefix, tag){ - this.$rules.tag.unshift({ - token : ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(<)(" + tag + ")", - next: [ - {include : "space"}, - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : prefix + "start"} - ] - }); - - this.$rules[tag + "-end"] = [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next: "start", - onMatch : function(value, currentState, stack) { - stack.splice(0); - return this.token; - }} - ] - - this.embedRules(HighlightRules, prefix, [{ - token: ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(" - }]); - }; - -}).call(TextHighlightRules.prototype); - -oop.inherits(XmlHighlightRules, TextHighlightRules); - -exports.XmlHighlightRules = XmlHighlightRules; -}); - -define('ace/mode/xml_util', ['require', 'exports', 'module' ], function(require, exports, module) { - - -function string(state) { - return [{ - token : "string", - regex : '"', - next : state + "_qqstring" - }, { - token : "string", - regex : "'", - next : state + "_qstring" - }]; -} - -function multiLineString(quote, state) { - return [ - {token : "string", regex : quote, next : state}, - { - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, - {defaultToken : "string"} - ]; -} - -exports.tag = function(states, name, nextState, tagMap) { - states[name] = [{ - token : "text", - regex : "\\s+" - }, { - - token : !tagMap ? "meta.tag.tag-name" : function(value) { - if (tagMap[value]) - return "meta.tag.tag-name." + tagMap[value]; - else - return "meta.tag.tag-name"; - }, - regex : "[-_a-zA-Z0-9:]+", - next : name + "_embed_attribute_list" - }, { - token: "empty", - regex: "", - next : 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"] = [{ - token : "meta.tag.r", - regex : "/?>", - next : nextState - }, { - token : "keyword.operator", - regex : "=" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "text", - regex : "\\s+" - }].concat(string(name)); -}; - -}); - -define('ace/mode/behaviour/html', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour/xml', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var XmlBehaviour = require("../behaviour/xml").XmlBehaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var voidElements = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']; - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); - return hasType; -} - -var HtmlBehaviour = function () { - - this.inherit(XmlBehaviour); // Get xml behaviour - - this.add("autoclosing", "insertion", function (state, action, editor, session, text) { - if (text == '>') { - var position = editor.getCursorPosition(); - var iterator = new TokenIterator(session, position.row, position.column); - var token = iterator.getCurrentToken(); - - if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column) - return; - var atCursor = false; - if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text'))); - } else { - atCursor = true; - } - if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) { - return; - } - var element = token.value; - if (atCursor){ - var element = element.substring(0, position.column - token.start); - } - if (voidElements.indexOf(element) !== -1){ - return; - } - return { - text: '>' + '', - selection: [1, 1] - } - } - }); -} -oop.inherits(HtmlBehaviour, XmlBehaviour); - -exports.HtmlBehaviour = HtmlBehaviour; -}); - -define('ace/mode/behaviour/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); - return hasType; -} - -var XmlBehaviour = function () { - - this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour - - this.add("autoclosing", "insertion", function (state, action, editor, session, text) { - if (text == '>') { - var position = editor.getCursorPosition(); - var iterator = new TokenIterator(session, position.row, position.column); - var token = iterator.getCurrentToken(); - - if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column) - return; - var atCursor = false; - if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text'))); - } else { - atCursor = true; - } - if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) { - return; - } - var tag = token.value; - if (atCursor){ - var tag = tag.substring(0, position.column - token.start); - } - - return { - text: '>' + '', - selection: [1, 1] - } - } - }); - - this.add('autoindent', 'insertion', function (state, action, editor, session, text) { - if (text == "\n") { - var cursor = editor.getCursorPosition(); - var line = session.getLine(cursor.row); - var rightChars = line.substring(cursor.column, cursor.column + 2); - if (rightChars == '?)/; - this._parseTag = function(tag) { - - var match = tag.match(this.tagRe); - var column = 0; - - return { - value: tag, - match: match ? match[2] : "", - closing: match ? !!match[3] : false, - selfClosing: match ? !!match[5] || match[2] == "/>" : false, - tagName: match ? match[4] : "", - column: match[1] ? column + match[1].length : column - }; - }; - this._readTagForward = function(iterator) { - var token = iterator.getCurrentToken(); - if (!token) - return null; - - var value = ""; - var start; - - do { - if (token.type.lastIndexOf("meta.tag", 0) === 0) { - if (!start) { - var start = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() - }; - } - value += token.value; - if (value.indexOf(">") !== -1) { - var tag = this._parseTag(value); - tag.start = start; - tag.end = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() + token.value.length - }; - iterator.stepForward(); - return tag; - } - } - } while(token = iterator.stepForward()); - - return null; - }; - - this._readTagBackward = function(iterator) { - var token = iterator.getCurrentToken(); - if (!token) - return null; - - var value = ""; - var end; - - do { - if (token.type.lastIndexOf("meta.tag", 0) === 0) { - if (!end) { - end = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() + token.value.length - }; - } - value = token.value + value; - if (value.indexOf("<") !== -1) { - var tag = this._parseTag(value); - tag.end = end; - tag.start = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() - }; - iterator.stepBackward(); - return tag; - } - } - } while(token = iterator.stepBackward()); - - return null; - }; - - this._pop = function(stack, tag) { - while (stack.length) { - - var top = stack[stack.length-1]; - if (!tag || top.tagName == tag.tagName) { - return stack.pop(); - } - else if (this.voidElements[tag.tagName]) { - return; - } - else if (this.voidElements[top.tagName]) { - stack.pop(); - continue; - } else { - return null; - } - } - }; - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var firstTag = this._getFirstTagInLine(session, row); - - if (!firstTag.match) - return null; - - var isBackward = firstTag.closing || firstTag.selfClosing; - var stack = []; - var tag; - - if (!isBackward) { - var iterator = new TokenIterator(session, row, firstTag.column); - var start = { - row: row, - column: firstTag.column + firstTag.tagName.length + 2 - }; - while (tag = this._readTagForward(iterator)) { - if (tag.selfClosing) { - if (!stack.length) { - tag.start.column += tag.tagName.length + 2; - tag.end.column -= 2; - return Range.fromPoints(tag.start, tag.end); - } else - continue; - } - - if (tag.closing) { - this._pop(stack, tag); - if (stack.length == 0) - return Range.fromPoints(start, tag.start); - } - else { - stack.push(tag) - } - } - } - else { - var iterator = new TokenIterator(session, row, firstTag.column + firstTag.match.length); - var end = { - row: row, - column: firstTag.column - }; - - while (tag = this._readTagBackward(iterator)) { - if (tag.selfClosing) { - if (!stack.length) { - tag.start.column += tag.tagName.length + 2; - tag.end.column -= 2; - return Range.fromPoints(tag.start, tag.end); - } else - continue; - } - - if (!tag.closing) { - this._pop(stack, tag); - if (stack.length == 0) { - tag.start.column += tag.tagName.length + 2; - return Range.fromPoints(tag.start, end); - } - } - else { - stack.push(tag) - } - } - } - - }; - -}).call(FoldMode.prototype); - -}); - -define('ace/mode/html_completions', ['require', 'exports', 'module' , 'ace/token_iterator'], function(require, exports, module) { - - -var TokenIterator = require("../token_iterator").TokenIterator; - -var commonAttributes = [ - "accesskey", - "class", - "contenteditable", - "contextmenu", - "dir", - "draggable", - "dropzone", - "hidden", - "id", - "lang", - "spellcheck", - "style", - "tabindex", - "title", - "translate" -]; - -var eventAttributes = [ - "onabort", - "onblur", - "oncancel", - "oncanplay", - "oncanplaythrough", - "onchange", - "onclick", - "onclose", - "oncontextmenu", - "oncuechange", - "ondblclick", - "ondrag", - "ondragend", - "ondragenter", - "ondragleave", - "ondragover", - "ondragstart", - "ondrop", - "ondurationchange", - "onemptied", - "onended", - "onerror", - "onfocus", - "oninput", - "oninvalid", - "onkeydown", - "onkeypress", - "onkeyup", - "onload", - "onloadeddata", - "onloadedmetadata", - "onloadstart", - "onmousedown", - "onmousemove", - "onmouseout", - "onmouseover", - "onmouseup", - "onmousewheel", - "onpause", - "onplay", - "onplaying", - "onprogress", - "onratechange", - "onreset", - "onscroll", - "onseeked", - "onseeking", - "onselect", - "onshow", - "onstalled", - "onsubmit", - "onsuspend", - "ontimeupdate", - "onvolumechange", - "onwaiting" -]; - -var globalAttributes = commonAttributes.concat(eventAttributes); - -var attributeMap = { - "html": ["manifest"], - "head": [], - "title": [], - "base": ["href", "target"], - "link": ["href", "hreflang", "rel", "media", "type", "sizes"], - "meta": ["http-equiv", "name", "content", "charset"], - "style": ["type", "media", "scoped"], - "script": ["charset", "type", "src", "defer", "async"], - "noscript": ["href"], - "body": ["onafterprint", "onbeforeprint", "onbeforeunload", "onhashchange", "onmessage", "onoffline", "onpopstate", "onredo", "onresize", "onstorage", "onundo", "onunload"], - "section": [], - "nav": [], - "article": ["pubdate"], - "aside": [], - "h1": [], - "h2": [], - "h3": [], - "h4": [], - "h5": [], - "h6": [], - "header": [], - "footer": [], - "address": [], - "main": [], - "p": [], - "hr": [], - "pre": [], - "blockquote": ["cite"], - "ol": ["start", "reversed"], - "ul": [], - "li": ["value"], - "dl": [], - "dt": [], - "dd": [], - "figure": [], - "figcaption": [], - "div": [], - "a": ["href", "target", "ping", "rel", "media", "hreflang", "type"], - "em": [], - "strong": [], - "small": [], - "s": [], - "cite": [], - "q": ["cite"], - "dfn": [], - "abbr": [], - "data": [], - "time": ["datetime"], - "code": [], - "var": [], - "samp": [], - "kbd": [], - "sub": [], - "sup": [], - "i": [], - "b": [], - "u": [], - "mark": [], - "ruby": [], - "rt": [], - "rp": [], - "bdi": [], - "bdo": [], - "span": [], - "br": [], - "wbr": [], - "ins": ["cite", "datetime"], - "del": ["cite", "datetime"], - "img": ["alt", "src", "height", "width", "usemap", "ismap"], - "iframe": ["name", "src", "height", "width", "sandbox", "seamless"], - "embed": ["src", "height", "width", "type"], - "object": ["param", "data", "type", "height" , "width", "usemap", "name", "form", "classid"], - "param": ["name", "value"], - "video": ["src", "autobuffer", "autoplay", "loop", "controls", "width", "height", "poster"], - "audio": ["src", "autobuffer", "autoplay", "loop", "controls"], - "source": ["src", "type", "media"], - "track": ["kind", "src", "srclang", "label", "default"], - "canvas": ["width", "height"], - "map": ["name"], - "area": ["shape", "coords", "href", "hreflang", "alt", "target", "media", "rel", "ping", "type"], - "svg": [], - "math": [], - "table": ["summary"], - "caption": [], - "colgroup": ["span"], - "col": ["span"], - "tbody": [], - "thead": [], - "tfoot": [], - "tr": [], - "td": ["headers", "rowspan", "colspan"], - "th": ["headers", "rowspan", "colspan", "scope"], - "form": ["accept-charset", "action", "autocomplete", "enctype", "method", "name", "novalidate", "target"], - "fieldset": ["disabled", "form", "name"], - "legend": [], - "label": ["form", "for"], - "input": ["type", "accept", "alt", "autocomplete", "checked", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "height", "list", "max", "maxlength", "min", "multiple", "pattern", "placeholder", "readonly", "required", "size", "src", "step", "width", "files", "value"], - "button": ["autofocus", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "name", "value", "type"], - "select": ["autofocus", "disabled", "form", "multiple", "name", "size"], - "datalist": [], - "optgroup": ["disabled", "label"], - "option": ["disabled", "selected", "label", "value"], - "textarea": ["autofocus", "disabled", "form", "maxlength", "name", "placeholder", "readonly", "required", "rows", "cols", "wrap"], - "keygen": ["autofocus", "challenge", "disabled", "form", "keytype", "name"], - "output": ["for", "form", "name"], - "progress": ["value", "max"], - "meter": ["value", "min", "max", "low", "high", "optimum"], - "details": ["open"], - "summary": [], - "command": ["type", "label", "icon", "disabled", "checked", "radiogroup", "command"], - "menu": ["type", "label"], - "dialog": ["open"] -}; - -var allElements = Object.keys(attributeMap); - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); -} - -function findTagName(session, pos) { - var iterator = new TokenIterator(session, pos.row, pos.column); - var token = iterator.getCurrentToken(); - if (!token || !hasType(token, 'tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'operator') || hasType(token, 'attribute-name') || hasType(token, 'text'))); - } - if (token && hasType(token, 'tag-name') && !iterator.stepBackward().value.match('/')) - return token.value; -} - -var HtmlCompletions = function() { - -}; - -(function() { - - this.getCompletions = function(state, session, pos, prefix) { - var token = session.getTokenAt(pos.row, pos.column); - - if (!token) - return []; - if (hasType(token, "tag-name") || (token.value == '<' && hasType(token, "text"))) - return this.getTagCompletions(state, session, pos, prefix); - if (hasType(token, 'text') || hasType(token, 'attribute-name')) - return this.getAttributeCompetions(state, session, pos, prefix); - - return []; - }; - - this.getTagCompletions = function(state, session, pos, prefix) { - var elements = allElements; - if (prefix) { - elements = elements.filter(function(element){ - return element.indexOf(prefix) === 0; - }); - } - return elements.map(function(element){ - return { - value: element, - meta: "tag" - }; - }); - }; - - this.getAttributeCompetions = function(state, session, pos, prefix) { - var tagName = findTagName(session, pos); - if (!tagName) - return []; - var attributes = globalAttributes; - if (tagName in attributeMap) { - attributes = attributes.concat(attributeMap[tagName]); - } - if (prefix) { - attributes = attributes.filter(function(attribute){ - return attribute.indexOf(prefix) === 0; - }); - } - return attributes.map(function(attribute){ - return { - caption: attribute, - snippet: attribute + '="$0"', - meta: "attribute" - }; - }); - }; - -}).call(HtmlCompletions.prototype); - -exports.HtmlCompletions = HtmlCompletions; -}); - -define('ace/mode/soy_template_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/html_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; - -var SoyTemplateHighlightRules = function() { - HtmlHighlightRules.call(this); - - var soyRules = { start: - [ { include: '#template' }, - { include: '#if' }, - { include: '#comment-line' }, - { include: '#comment-block' }, - { include: '#comment-doc' }, - { include: '#call' }, - { include: '#css' }, - { include: '#param' }, - { include: '#print' }, - { include: '#msg' }, - { include: '#for' }, - { include: '#foreach' }, - { include: '#switch' }, - { include: '#tag' }, - { include: 'text.html.basic' } ], - '#call': - [ { token: - [ 'punctuation.definition.tag.begin.soy', - 'meta.tag.call.soy' ], - regex: '(\\{/?)(\\s*)(?=call|delcall)', - push: - [ { token: 'punctuation.definition.tag.end.soy', - regex: '\\}', - next: 'pop' }, - { include: '#string-quoted-single' }, - { include: '#string-quoted-double' }, - { token: ['entity.name.tag.soy', 'variable.parameter.soy'], - regex: '(call|delcall)(\\s+[\\.\\w]+)'}, - { token: - [ 'entity.other.attribute-name.soy', - 'text', - 'keyword.operator.soy' ], - regex: '\\b(data)(\\s*)(=)' }, - { defaultToken: 'meta.tag.call.soy' } ] } ], - '#comment-line': - [ { token: - [ 'comment.line.double-slash.soy', - 'punctuation.definition.comment.soy', - 'comment.line.double-slash.soy' ], - regex: '(\\s+)(//)(.*$)' } ], - '#comment-block': - [ { token: 'punctuation.definition.comment.begin.soy', - regex: '/\\*(?!\\*)', - push: - [ { token: 'punctuation.definition.comment.end.soy', - regex: '\\*/', - next: 'pop' }, - { defaultToken: 'comment.block.soy' } ] } ], - '#comment-doc': - [ { token: 'punctuation.definition.comment.begin.soy', - regex: '/\\*\\*(?!/)', - push: - [ { token: 'punctuation.definition.comment.end.soy', - regex: '\\*/', - next: 'pop' }, - { token: [ 'support.type.soy', 'text', 'variable.parameter.soy' ], - regex: '(@param|@param\\?)(\\s+)(\\w+)' }, - { defaultToken: 'comment.block.documentation.soy' } ] } ], - '#css': - [ { token: - [ 'punctuation.definition.tag.begin.soy', - 'meta.tag.css.soy', - 'entity.name.tag.soy' ], - regex: '(\\{/?)(\\s*)(css)\\b', - push: - [ { token: 'punctuation.definition.tag.end.soy', - regex: '\\}', - next: 'pop' }, - { token: 'support.constant.soy', - regex: '\\b(?:LITERAL|REFERENCE|BACKEND_SPECIFIC|GOOG)\\b' }, - { defaultToken: 'meta.tag.css.soy' } ] } ], - '#for': - [ { token: - [ 'punctuation.definition.tag.begin.soy', - 'meta.tag.for.soy', - 'entity.name.tag.soy' ], - regex: '(\\{/?)(\\s*)(for)\\b', - push: - [ { token: 'punctuation.definition.tag.end.soy', - regex: '\\}', - next: 'pop' }, - { token: 'keyword.operator.soy', regex: '\\bin\\b' }, - { token: 'support.function.soy', regex: '\\brange\\b' }, - { include: '#variable' }, - { include: '#number' }, - { include: '#primitive' }, - { defaultToken: 'meta.tag.for.soy' } ] } ], - '#foreach': - [ { token: - [ 'punctuation.definition.tag.begin.soy', - 'meta.tag.foreach.soy', - 'entity.name.tag.soy' ], - regex: '(\\{/?)(\\s*)(foreach)\\b', - push: - [ { token: 'punctuation.definition.tag.end.soy', - regex: '\\}', - next: 'pop' }, - { token: 'keyword.operator.soy', regex: '\\bin\\b' }, - { include: '#variable' }, - { defaultToken: 'meta.tag.foreach.soy' } ] } ], - '#function': - [ { token: 'support.function.soy', - regex: '\\b(?:isFirst|isLast|index|hasData|length|keys|round|floor|ceiling|min|max|randomInt)\\b' } ], - '#if': - [ { token: - [ 'punctuation.definition.tag.begin.soy', - 'meta.tag.if.soy', - 'entity.name.tag.soy' ], - regex: '(\\{/?)(\\s*)(if|elseif)\\b', - push: - [ { token: 'punctuation.definition.tag.end.soy', - regex: '\\}', - next: 'pop' }, - { include: '#variable' }, - { include: '#operator' }, - { include: '#function' }, - { include: '#string-quoted-single' }, - { include: '#string-quoted-double' }, - { defaultToken: 'meta.tag.if.soy' } ] } ], - '#namespace': - [ { token: [ 'entity.name.tag.soy', 'text', 'variable.parameter.soy' ], - regex: '(namespace|delpackage)(\\s+)([\\w\\.]+)' } ], - '#number': [ { token: 'constant.numeric', regex: '[\\d]+' } ], - '#operator': - [ { token: 'keyword.operator.soy', - regex: '==|!=|\\band\\b|\\bor\\b|\\bnot\\b|-|\\+|/|\\?:' } ], - '#param': - [ { token: - [ 'punctuation.definition.tag.begin.soy', - 'meta.tag.param.soy', - 'entity.name.tag.soy' ], - regex: '(\\{/?)(\\s*)(param)', - push: - [ { token: 'punctuation.definition.tag.end.soy', - regex: '\\}', - next: 'pop' }, - { include: '#variable' }, - { token: - [ 'entity.other.attribute-name.soy', - 'text', - 'keyword.operator.soy' ], - regex: '\\b([\\w]*)(\\s*)((?::)?)' }, - { defaultToken: 'meta.tag.param.soy' } ] } ], - '#primitive': - [ { token: 'constant.language.soy', - regex: '\\b(?:null|false|true)\\b' } ], - '#msg': - [ { token: - [ 'punctuation.definition.tag.begin.soy', - 'meta.tag.msg.soy', - 'entity.name.tag.soy' ], - regex: '(\\{/?)(\\s*)(msg)\\b', - push: - [ { token: 'punctuation.definition.tag.end.soy', - regex: '\\}', - next: 'pop' }, - { include: '#string-quoted-single' }, - { include: '#string-quoted-double' }, - { token: - [ 'entity.other.attribute-name.soy', - 'text', - 'keyword.operator.soy' ], - regex: '\\b(meaning|desc)(\\s*)(=)' }, - { defaultToken: 'meta.tag.msg.soy' } ] } ], - '#print': - [ { token: - [ 'punctuation.definition.tag.begin.soy', - 'meta.tag.print.soy', - 'entity.name.tag.soy' ], - regex: '(\\{/?)(\\s*)(print)\\b', - push: - [ { token: 'punctuation.definition.tag.end.soy', - regex: '\\}', - next: 'pop' }, - { include: '#variable' }, - { include: '#print-parameter' }, - { include: '#number' }, - { include: '#primitive' }, - { include: '#attribute-lookup' }, - { defaultToken: 'meta.tag.print.soy' } ] } ], - '#print-parameter': - [ { token: 'keyword.operator.soy', regex: '\\|' }, - { token: 'variable.parameter.soy', - regex: 'noAutoescape|id|escapeHtml|escapeJs|insertWorkBreaks|truncate' } ], - '#special-character': - [ { token: 'support.constant.soy', - regex: '\\bsp\\b|\\bnil\\b|\\\\r|\\\\n|\\\\t|\\blb\\b|\\brb\\b' } ], - '#string-quoted-double': [ { token: 'string.quoted.double', regex: '"[^"]*"' } ], - '#string-quoted-single': [ { token: 'string.quoted.single', regex: '\'[^\']*\'' } ], - '#switch': - [ { token: - [ 'punctuation.definition.tag.begin.soy', - 'meta.tag.switch.soy', - 'entity.name.tag.soy' ], - regex: '(\\{/?)(\\s*)(switch|case)\\b', - push: - [ { token: 'punctuation.definition.tag.end.soy', - regex: '\\}', - next: 'pop' }, - { include: '#variable' }, - { include: '#function' }, - { include: '#number' }, - { include: '#string-quoted-single' }, - { include: '#string-quoted-double' }, - { defaultToken: 'meta.tag.switch.soy' } ] } ], - '#attribute-lookup': - [ { token: 'punctuation.definition.attribute-lookup.begin.soy', - regex: '\\[', - push: - [ { token: 'punctuation.definition.attribute-lookup.end.soy', - regex: '\\]', - next: 'pop' }, - { include: '#variable' }, - { include: '#function' }, - { include: '#operator' }, - { include: '#number' }, - { include: '#primitive' }, - { include: '#string-quoted-single' }, - { include: '#string-quoted-double' } ] } ], - '#tag': - [ { token: 'punctuation.definition.tag.begin.soy', - regex: '\\{', - push: - [ { token: 'punctuation.definition.tag.end.soy', - regex: '\\}', - next: 'pop' }, - { include: '#namespace' }, - { include: '#variable' }, - { include: '#special-character' }, - { include: '#tag-simple' }, - { include: '#function' }, - { include: '#operator' }, - { include: '#attribute-lookup' }, - { include: '#number' }, - { include: '#primitive' }, - { include: '#print-parameter' } ] } ], - '#tag-simple': - [ { token: 'entity.name.tag.soy', - regex: '{{\\s*(?:literal|else|ifempty|default)\\s*(?=\\})'} ], - '#template': - [ { token: - [ 'punctuation.definition.tag.begin.soy', - 'meta.tag.template.soy' ], - regex: '(\\{/?)(\\s*)(?=template|deltemplate)', - push: - [ { token: 'punctuation.definition.tag.end.soy', - regex: '\\}', - next: 'pop' }, - { token: ['entity.name.tag.soy', 'text', 'entity.name.function.soy' ], - regex: '(template|deltemplate)(\\s+)([\\.\\w]+)', - originalRegex: '(?<=template|deltemplate)\\s+([\\.\\w]+)' }, - { token: - [ 'entity.other.attribute-name.soy', - 'text', - 'keyword.operator.soy', - 'text', - 'string.quoted.double.soy' ], - regex: '\\b(private)(\\s*)(=)(\\s*)("true"|"false")' }, - { token: - [ 'entity.other.attribute-name.soy', - 'text', - 'keyword.operator.soy', - 'text', - 'string.quoted.single.soy' ], - regex: '\\b(private)(\\s*)(=)(\\s*)(\'true\'|\'false\')' }, - { token: - [ 'entity.other.attribute-name.soy', - 'text', - 'keyword.operator.soy', - 'text', - 'string.quoted.double.soy' ], - regex: '\\b(autoescape)(\\s*)(=)(\\s*)("true"|"false"|"contextual")' }, - { token: - [ 'entity.other.attribute-name.soy', - 'text', - 'keyword.operator.soy', - 'text', - 'string.quoted.single.soy' ], - regex: '\\b(autoescape)(\\s*)(=)(\\s*)(\'true\'|\'false\'|\'contextual\')' }, - { defaultToken: 'meta.tag.template.soy' } ] } ], - '#variable': [ { token: 'variable.other.soy', regex: '\\$[\\w\\.]+' } ] } - - - for (var i in soyRules) { - if (this.$rules[i]) { - this.$rules[i].unshift.call(this.$rules[i], soyRules[i]); - } else { - this.$rules[i] = soyRules[i]; - } - } - - this.normalizeRules(); -}; - -SoyTemplateHighlightRules.metaData = { comment: 'SoyTemplate', - fileTypes: [ 'soy' ], - firstLineMatch: '\\{\\s*namespace\\b', - foldingStartMarker: '\\{\\s*template\\s+[^\\}]*\\}', - foldingStopMarker: '\\{\\s*/\\s*template\\s*\\}', - name: 'SoyTemplate', - scopeName: 'source.soy' } - - -oop.inherits(SoyTemplateHighlightRules, HtmlHighlightRules); - -exports.SoyTemplateHighlightRules = SoyTemplateHighlightRules; -}); \ No newline at end of file diff --git a/addons/editor/ace/mode-svg.js b/addons/editor/ace/mode-svg.js deleted file mode 100644 index 13b122f3..00000000 --- a/addons/editor/ace/mode-svg.js +++ /dev/null @@ -1,1579 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2010, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/mode/svg', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml', 'ace/mode/javascript', 'ace/tokenizer', 'ace/mode/svg_highlight_rules', 'ace/mode/folding/mixed', 'ace/mode/folding/xml', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var XmlMode = require("./xml").Mode; -var JavaScriptMode = require("./javascript").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var SvgHighlightRules = require("./svg_highlight_rules").SvgHighlightRules; -var MixedFoldMode = require("./folding/mixed").FoldMode; -var XmlFoldMode = require("./folding/xml").FoldMode; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - XmlMode.call(this); - - this.HighlightRules = SvgHighlightRules; - - this.createModeDelegates({ - "js-": JavaScriptMode - }); - - this.foldingRules = new MixedFoldMode(new XmlFoldMode({}), { - "js-": new CStyleFoldMode() - }); -}; - -oop.inherits(Mode, XmlMode); - -(function() { - - this.getNextLineIndent = function(state, line, tab) { - return this.$getIndent(line); - }; - - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/xml_highlight_rules', 'ace/mode/behaviour/xml', 'ace/mode/folding/xml'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; -var XmlBehaviour = require("./behaviour/xml").XmlBehaviour; -var XmlFoldMode = require("./folding/xml").FoldMode; - -var Mode = function() { - this.HighlightRules = XmlHighlightRules; - this.$behaviour = new XmlBehaviour(); - this.foldingRules = new XmlFoldMode(); -}; - -oop.inherits(Mode, TextMode); - -(function() { - - this.blockComment = {start: ""}; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/xml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml_util', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var xmlUtil = require("./xml_util"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var XmlHighlightRules = function(normalize) { - this.$rules = { - start : [ - {token : "punctuation.string.begin", regex : "<\\!\\[CDATA\\[", next : "cdata"}, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)(xml)(?=[\\s])", next : "xml_declaration" - }, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)([-_a-zA-Z0-9]+)", next : "instruction" - }, - {token : "comment", regex : "<\\!--", next : "comment"}, - { - token : ["punctuation.doctype.begin", "meta.tag.doctype"], - regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype" - }, - {include : "tag"}, - {include : "reference"} - ], - - xml_declaration : [ - {include : "attributes"}, - {include : "instruction"} - ], - - instruction : [ - {token : "punctuation.instruction.end", regex : "\\?>", next : "start"} - ], - - doctype : [ - {include : "space"}, - {include : "string"}, - {token : "punctuation.doctype.end", regex : ">", next : "start"}, - {token : "xml-pe", regex : "[-_a-zA-Z0-9:]+"}, - {token : "punctuation.begin", regex : "\\[", push : "declarations"} - ], - - declarations : [{ - token : "text", - regex : "\\s+" - }, { - token: "punctuation.end", - regex: "]", - next: "pop" - }, { - token : ["punctuation.begin", "keyword"], - regex : "(<\\!)([-_a-zA-Z0-9]+)", - push : [{ - token : "text", - regex : "\\s+" - }, - { - token : "punctuation.end", - regex : ">", - next : "pop" - }, - {include : "string"}] - }], - - cdata : [ - {token : "string.end", regex : "\\]\\]>", next : "start"}, - {token : "text", regex : "\\s+"}, - {token : "text", regex : "(?:[^\\]]|\\](?!\\]>))+"} - ], - - comment : [ - {token : "comment", regex : "-->", next : "start"}, - {defaultToken : "comment"} - ], - - tag : [{ - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(<)((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)", - next: [ - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : "start"} - ] - }, { - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(", next : "start"} - ] - }], - - space : [ - {token : "text", regex : "\\s+"} - ], - - reference : [{ - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, { - token : "invalid.illegal", regex : "&" - }], - - string: [{ - token : "string", - regex : "'", - push : "qstring_inner" - }, { - token : "string", - regex : '"', - push : "qqstring_inner" - }], - - qstring_inner: [ - {token : "string", regex: "'", next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - qqstring_inner: [ - {token : "string", regex: '"', next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - attributes: [{ - token : "entity.other.attribute-name", - regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+" - }, { - token : "keyword.operator.separator", - regex : "=" - }, { - include : "space" - }, { - include : "string" - }] - }; - - if (this.constructor === XmlHighlightRules) - this.normalizeRules(); -}; - - -(function() { - - this.embedTagRules = function(HighlightRules, prefix, tag){ - this.$rules.tag.unshift({ - token : ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(<)(" + tag + ")", - next: [ - {include : "space"}, - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : prefix + "start"} - ] - }); - - this.$rules[tag + "-end"] = [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next: "start", - onMatch : function(value, currentState, stack) { - stack.splice(0); - return this.token; - }} - ] - - this.embedRules(HighlightRules, prefix, [{ - token: ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(" - }]); - }; - -}).call(TextHighlightRules.prototype); - -oop.inherits(XmlHighlightRules, TextHighlightRules); - -exports.XmlHighlightRules = XmlHighlightRules; -}); - -define('ace/mode/xml_util', ['require', 'exports', 'module' ], function(require, exports, module) { - - -function string(state) { - return [{ - token : "string", - regex : '"', - next : state + "_qqstring" - }, { - token : "string", - regex : "'", - next : state + "_qstring" - }]; -} - -function multiLineString(quote, state) { - return [ - {token : "string", regex : quote, next : state}, - { - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, - {defaultToken : "string"} - ]; -} - -exports.tag = function(states, name, nextState, tagMap) { - states[name] = [{ - token : "text", - regex : "\\s+" - }, { - - token : !tagMap ? "meta.tag.tag-name" : function(value) { - if (tagMap[value]) - return "meta.tag.tag-name." + tagMap[value]; - else - return "meta.tag.tag-name"; - }, - regex : "[-_a-zA-Z0-9:]+", - next : name + "_embed_attribute_list" - }, { - token: "empty", - regex: "", - next : 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"] = [{ - token : "meta.tag.r", - regex : "/?>", - next : nextState - }, { - token : "keyword.operator", - regex : "=" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "text", - regex : "\\s+" - }].concat(string(name)); -}; - -}); - -define('ace/mode/behaviour/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); - return hasType; -} - -var XmlBehaviour = function () { - - this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour - - this.add("autoclosing", "insertion", function (state, action, editor, session, text) { - if (text == '>') { - var position = editor.getCursorPosition(); - var iterator = new TokenIterator(session, position.row, position.column); - var token = iterator.getCurrentToken(); - - if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column) - return; - var atCursor = false; - if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text'))); - } else { - atCursor = true; - } - if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) { - return; - } - var tag = token.value; - if (atCursor){ - var tag = tag.substring(0, position.column - token.start); - } - - return { - text: '>' + '', - selection: [1, 1] - } - } - }); - - this.add('autoindent', 'insertion', function (state, action, editor, session, text) { - if (text == "\n") { - var cursor = editor.getCursorPosition(); - var line = session.getLine(cursor.row); - var rightChars = line.substring(cursor.column, cursor.column + 2); - if (rightChars == ' -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/range', 'ace/mode/folding/fold_mode', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var lang = require("../../lib/lang"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; -var TokenIterator = require("../../token_iterator").TokenIterator; - -var FoldMode = exports.FoldMode = function(voidElements) { - BaseFoldMode.call(this); - this.voidElements = voidElements || {}; -}; -oop.inherits(FoldMode, BaseFoldMode); - -(function() { - - this.getFoldWidget = function(session, foldStyle, row) { - var tag = this._getFirstTagInLine(session, row); - - if (tag.closing) - return foldStyle == "markbeginend" ? "end" : ""; - - if (!tag.tagName || this.voidElements[tag.tagName.toLowerCase()]) - return ""; - - if (tag.selfClosing) - return ""; - - if (tag.value.indexOf("/" + tag.tagName) !== -1) - return ""; - - return "start"; - }; - - this._getFirstTagInLine = function(session, row) { - var tokens = session.getTokens(row); - var value = ""; - for (var i = 0; i < tokens.length; i++) { - var token = tokens[i]; - if (token.type.lastIndexOf("meta.tag", 0) === 0) - value += token.value; - else - value += lang.stringRepeat(" ", token.value.length); - } - - return this._parseTag(value); - }; - - this.tagRe = /^(\s*)(?)/; - this._parseTag = function(tag) { - - var match = tag.match(this.tagRe); - var column = 0; - - return { - value: tag, - match: match ? match[2] : "", - closing: match ? !!match[3] : false, - selfClosing: match ? !!match[5] || match[2] == "/>" : false, - tagName: match ? match[4] : "", - column: match[1] ? column + match[1].length : column - }; - }; - this._readTagForward = function(iterator) { - var token = iterator.getCurrentToken(); - if (!token) - return null; - - var value = ""; - var start; - - do { - if (token.type.lastIndexOf("meta.tag", 0) === 0) { - if (!start) { - var start = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() - }; - } - value += token.value; - if (value.indexOf(">") !== -1) { - var tag = this._parseTag(value); - tag.start = start; - tag.end = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() + token.value.length - }; - iterator.stepForward(); - return tag; - } - } - } while(token = iterator.stepForward()); - - return null; - }; - - this._readTagBackward = function(iterator) { - var token = iterator.getCurrentToken(); - if (!token) - return null; - - var value = ""; - var end; - - do { - if (token.type.lastIndexOf("meta.tag", 0) === 0) { - if (!end) { - end = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() + token.value.length - }; - } - value = token.value + value; - if (value.indexOf("<") !== -1) { - var tag = this._parseTag(value); - tag.end = end; - tag.start = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() - }; - iterator.stepBackward(); - return tag; - } - } - } while(token = iterator.stepBackward()); - - return null; - }; - - this._pop = function(stack, tag) { - while (stack.length) { - - var top = stack[stack.length-1]; - if (!tag || top.tagName == tag.tagName) { - return stack.pop(); - } - else if (this.voidElements[tag.tagName]) { - return; - } - else if (this.voidElements[top.tagName]) { - stack.pop(); - continue; - } else { - return null; - } - } - }; - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var firstTag = this._getFirstTagInLine(session, row); - - if (!firstTag.match) - return null; - - var isBackward = firstTag.closing || firstTag.selfClosing; - var stack = []; - var tag; - - if (!isBackward) { - var iterator = new TokenIterator(session, row, firstTag.column); - var start = { - row: row, - column: firstTag.column + firstTag.tagName.length + 2 - }; - while (tag = this._readTagForward(iterator)) { - if (tag.selfClosing) { - if (!stack.length) { - tag.start.column += tag.tagName.length + 2; - tag.end.column -= 2; - return Range.fromPoints(tag.start, tag.end); - } else - continue; - } - - if (tag.closing) { - this._pop(stack, tag); - if (stack.length == 0) - return Range.fromPoints(start, tag.start); - } - else { - stack.push(tag) - } - } - } - else { - var iterator = new TokenIterator(session, row, firstTag.column + firstTag.match.length); - var end = { - row: row, - column: firstTag.column - }; - - while (tag = this._readTagBackward(iterator)) { - if (tag.selfClosing) { - if (!stack.length) { - tag.start.column += tag.tagName.length + 2; - tag.end.column -= 2; - return Range.fromPoints(tag.start, tag.end); - } else - continue; - } - - if (!tag.closing) { - this._pop(stack, tag); - if (stack.length == 0) { - tag.start.column += tag.tagName.length + 2; - return Range.fromPoints(tag.start, end); - } - } - else { - stack.push(tag) - } - } - } - - }; - -}).call(FoldMode.prototype); - -}); - -define('ace/mode/javascript', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/javascript_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/worker/worker_client', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var Range = require("../range").Range; -var WorkerClient = require("../worker/worker_client").WorkerClient; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = JavaScriptHighlightRules; - - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().getLineTokens(line, state); - var tokens = tokenizedLine.tokens; - var endState = tokenizedLine.state; - - if (tokens.length && tokens[tokens.length-1].type == "comment") { - return indent; - } - - if (state == "start" || state == "no_regex") { - var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/); - if (match) { - indent += tab; - } - } else if (state == "doc-start") { - if (endState == "start" || endState == "no_regex") { - return ""; - } - var match = line.match(/^\s*(\/?)\*/); - if (match) { - if (match[1]) { - indent += " "; - } - indent += "* "; - } - } - - 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); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker"); - worker.attachToDocument(session.getDocument()); - - worker.on("jslint", function(results) { - session.setAnnotations(results.data); - }); - - worker.on("terminate", function() { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var JavaScriptHighlightRules = function() { - var keywordMapper = this.createKeywordMapper({ - "variable.language": - "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors - "Namespace|QName|XML|XMLList|" + // E4X - "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + - "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + - "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors - "SyntaxError|TypeError|URIError|" + - "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions - "isNaN|parseFloat|parseInt|" + - "JSON|Math|" + // Other - "this|arguments|prototype|window|document" , // Pseudo - "keyword": - "const|yield|import|get|set|" + - "break|case|catch|continue|default|delete|do|else|finally|for|function|" + - "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + - "__parent__|__count__|escape|unescape|with|__proto__|" + - "class|enum|extends|super|export|implements|private|public|interface|package|protected|static", - "storage.type": - "const|let|var|function", - "constant.language": - "null|Infinity|NaN|undefined", - "support.function": - "alert", - "constant.language.boolean": "true|false" - }, "identifier"); - var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; - var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\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 - ".)"; - - this.$rules = { - "no_regex" : [ - { - token : "comment", - regex : "\\/\\/", - next : "line_comment" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : /\/\*/, - next : "comment" - }, { - token : "string", - regex : "'(?=.)", - next : "qstring" - }, { - token : "string", - regex : '"(?=.)', - next : "qqstring" - }, { - token : "constant.numeric", // hex - regex : /0[xX][0-9a-fA-F]+\b/ - }, { - token : "constant.numeric", // float - regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/ - }, { - token : [ - "storage.type", "punctuation.operator", "support.function", - "punctuation.operator", "entity.name.function", "text","keyword.operator" - ], - regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "keyword.operator", "text", "storage.type", - "text", "paren.lparen" - ], - regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "punctuation.operator", - "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "text", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : "keyword", - regex : "(?:" + kwBeforeRe + ")\\b", - next : "start" - }, { - token : ["punctuation.operator", "support.function"], - regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/ - }, { - token : ["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 : keywordMapper, - regex : identifierRe - }, { - token : "keyword.operator", - regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/, - next : "start" - }, { - token : "punctuation.operator", - regex : /\?|\:|\,|\;|\./, - next : "start" - }, { - token : "paren.lparen", - regex : /[\[({]/, - next : "start" - }, { - token : "paren.rparen", - regex : /[\])}]/ - }, { - token : "keyword.operator", - regex : /\/=?/, - next : "start" - }, { - token: "comment", - regex: /^#!.*$/ - } - ], - "start": [ - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment_regex_allowed" - }, { - token : "comment", - regex : "\\/\\/", - next : "line_comment_regex_allowed" - }, { - token: "string.regexp", - regex: "\\/", - next: "regex" - }, { - token : "text", - regex : "\\s+|^$", - next : "start" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "regex": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "string.regexp", - regex: "/\\w*", - next: "no_regex" - }, { - token : "invalid", - regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ - }, { - token : "constant.language.escape", - regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/ - }, { - token : "constant.language.delimiter", - regex: /\|/ - }, { - token: "constant.language.escape", - regex: /\[\^?/, - next: "regex_character_class" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp" - } - ], - "regex_character_class": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "constant.language.escape", - regex: "]", - next: "regex" - }, { - token: "constant.language.escape", - regex: "-" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp.charachterclass" - } - ], - "function_arguments": [ - { - token: "variable.parameter", - regex: identifierRe - }, { - token: "punctuation.operator", - regex: "[, ]+" - }, { - token: "punctuation.operator", - regex: "$" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "comment_regex_allowed" : [ - {token : "comment", regex : "\\*\\/", next : "start"}, - {defaultToken : "comment"} - ], - "comment" : [ - {token : "comment", regex : "\\*\\/", next : "no_regex"}, - {defaultToken : "comment"} - ], - "line_comment_regex_allowed" : [ - {token : "comment", regex : "$|^", next : "start"}, - {defaultToken : "comment"} - ], - "line_comment" : [ - {token : "comment", regex : "$|^", next : "no_regex"}, - {defaultToken : "comment"} - ], - "qqstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qqstring" - }, { - token : "string", - regex : '"|$', - next : "no_regex" - }, { - defaultToken: "string" - } - ], - "qstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qstring" - }, { - token : "string", - regex : "'|$", - next : "no_regex" - }, { - defaultToken: "string" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("no_regex") ]); -}; - -oop.inherits(JavaScriptHighlightRules, TextHighlightRules); - -exports.JavaScriptHighlightRules = JavaScriptHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); - -define('ace/mode/svg_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/javascript_highlight_rules', 'ace/mode/xml_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; - -var SvgHighlightRules = function() { - XmlHighlightRules.call(this); - - this.embedTagRules(JavaScriptHighlightRules, "js-", "script"); - - this.normalizeRules(); -}; - -oop.inherits(SvgHighlightRules, XmlHighlightRules); - -exports.SvgHighlightRules = SvgHighlightRules; -}); - -define('ace/mode/folding/mixed', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(defaultMode, subModes) { - this.defaultMode = defaultMode; - this.subModes = subModes; -}; -oop.inherits(FoldMode, BaseFoldMode); - -(function() { - - - this.$getMode = function(state) { - if (typeof state != "string") - state = state[0]; - for (var key in this.subModes) { - if (state.indexOf(key) === 0) - return this.subModes[key]; - } - return null; - }; - - this.$tryMode = function(state, session, foldStyle, row) { - var mode = this.$getMode(state); - return (mode ? mode.getFoldWidget(session, foldStyle, row) : ""); - }; - - this.getFoldWidget = function(session, foldStyle, row) { - return ( - this.$tryMode(session.getState(row-1), session, foldStyle, row) || - this.$tryMode(session.getState(row), session, foldStyle, row) || - this.defaultMode.getFoldWidget(session, foldStyle, row) - ); - }; - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var mode = this.$getMode(session.getState(row-1)); - - if (!mode || !mode.getFoldWidget(session, foldStyle, row)) - mode = this.$getMode(session.getState(row)); - - if (!mode || !mode.getFoldWidget(session, foldStyle, row)) - mode = this.defaultMode; - - return mode.getFoldWidgetRange(session, foldStyle, row); - }; - -}).call(FoldMode.prototype); - -}); diff --git a/addons/editor/ace/mode-tex.js b/addons/editor/ace/mode-tex.js deleted file mode 100644 index 8d76f729..00000000 --- a/addons/editor/ace/mode-tex.js +++ /dev/null @@ -1,186 +0,0 @@ -/* - * tex.js - * - * Copyright (C) 2009-11 by RStudio, Inc. - * - * 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. - * - * Distributed under the BSD license: - * - * Copyright (c) 2010, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * - */ -define('ace/mode/tex', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/text_highlight_rules', 'ace/mode/tex_highlight_rules', 'ace/mode/matching_brace_outdent'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var TexHighlightRules = require("./tex_highlight_rules").TexHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; - -var Mode = function(suppressHighlighting) { - if (suppressHighlighting) - this.HighlightRules = TextHighlightRules; - else - this.HighlightRules = TexHighlightRules; - this.$outdent = new MatchingBraceOutdent(); -}; -oop.inherits(Mode, TextMode); - -(function() { - this.getNextLineIndent = function(state, line, tab) { - return this.$getIndent(line); - }; - - this.allowAutoInsert = function() { - return false; - }; -}).call(Mode.prototype); - -exports.Mode = Mode; -}); -define('ace/mode/tex_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var TexHighlightRules = function(textClass) { - - if (!textClass) - textClass = "text"; - - this.$rules = { - "start" : [ - { - token : "comment", - regex : "%.*$" - }, { - token : textClass, // non-command - regex : "\\\\[$&%#\\{\\}]" - }, { - token : "keyword", // command - regex : "\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\b", - next : "nospell" - }, { - token : "keyword", // command - regex : "\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])" - }, { - token : "paren.keyword.operator", - regex : "[[({]" - }, { - token : "paren.keyword.operator", - regex : "[\\])}]" - }, { - token : textClass, - regex : "\\s+" - } - ], - "nospell" : [ - { - token : "comment", - regex : "%.*$", - next : "start" - }, { - token : "nospell." + textClass, // non-command - regex : "\\\\[$&%#\\{\\}]" - }, { - token : "keyword", // command - regex : "\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\b" - }, { - token : "keyword", // command - regex : "\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])", - next : "start" - }, { - token : "paren.keyword.operator", - regex : "[[({]" - }, { - token : "paren.keyword.operator", - regex : "[\\])]" - }, { - token : "paren.keyword.operator", - regex : "}", - next : "start" - }, { - token : "nospell." + textClass, - regex : "\\s+" - }, { - token : "nospell." + textClass, - regex : "\\w+" - } - ] - }; -}; - -oop.inherits(TexHighlightRules, TextHighlightRules); - -exports.TexHighlightRules = TexHighlightRules; -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); diff --git a/addons/editor/ace/mode-tmsnippet.js b/addons/editor/ace/mode-tmsnippet.js deleted file mode 100644 index af3b0445..00000000 --- a/addons/editor/ace/mode-tmsnippet.js +++ /dev/null @@ -1,200 +0,0 @@ -define('ace/mode/tmsnippet', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/text_highlight_rules', 'ace/mode/folding/coffee'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var SnippetHighlightRules = function() { - - var builtins = "SELECTION|CURRENT_WORD|SELECTED_TEXT|CURRENT_LINE|LINE_INDEX|" + - "LINE_NUMBER|SOFT_TABS|TAB_SIZE|FILENAME|FILEPATH|FULLNAME"; - - this.$rules = { - "start" : [ - {token:"constant.language.escape", regex: /\\[\$}`\\]/}, - {token:"keyword", regex: "\\$(?:TM_)?(?:" + builtins + ")\\b"}, - {token:"variable", regex: "\\$\\w+"}, - {onMatch: function(value, state, stack) { - if (stack[1]) - stack[1]++; - else - stack.unshift(state, 1); - return this.tokenName; - }, tokenName: "markup.list", regex: "\\${", next: "varDecl"}, - {onMatch: function(value, state, stack) { - if (!stack[1]) - return "text"; - stack[1]--; - if (!stack[1]) - stack.splice(0,2); - return this.tokenName; - }, tokenName: "markup.list", regex: "}"}, - {token: "doc.comment", regex:/^\${2}-{5,}$/} - ], - "varDecl" : [ - {regex: /\d+\b/, token: "constant.numeric"}, - {token:"keyword", regex: "(?:TM_)?(?:" + builtins + ")\\b"}, - {token:"variable", regex: "\\w+"}, - {regex: /:/, token: "punctuation.operator", next: "start"}, - {regex: /\//, token: "string.regex", next: "regexp"}, - {regex: "", next: "start"} - ], - "regexp" : [ - {regex: /\\./, token: "escape"}, - {regex: /\[/, token: "regex.start", next: "charClass"}, - {regex: "/", token: "string.regex", next: "format"}, - {"token": "string.regex", regex:"."} - ], - charClass : [ - {regex: "\\.", token: "escape"}, - {regex: "\\]", token: "regex.end", next: "regexp"}, - {"token": "string.regex", regex:"."} - ], - "format" : [ - {regex: /\\[ulULE]/, token: "keyword"}, - {regex: /\$\d+/, token: "variable"}, - {regex: "/[gim]*:?", token: "string.regex", next: "start"}, - {"token": "string", regex:"."} - ] - }; -}; -oop.inherits(SnippetHighlightRules, TextHighlightRules); - -exports.SnippetHighlightRules = SnippetHighlightRules; - -var SnippetGroupHighlightRules = function() { - this.$rules = { - "start" : [ - {token: "text", regex: "^\\t", next: "sn-start"}, - {token:"invalid", regex: /^ \s*/}, - {token:"comment", regex: /^#.*/}, - {token:"constant.language.escape", regex: "^regex ", next: "regex"}, - {token:"constant.language.escape", regex: "^(trigger|endTrigger|name|snippet|guard|endGuard|tabTrigger|key)\\b"} - ], - "regex" : [ - {token:"text", regex: "\\."}, - {token:"keyword", regex: "/"}, - {token:"empty", regex: "$", next: "start"} - ] - }; - this.embedRules(SnippetHighlightRules, "sn-", [ - {token: "text", regex: "^\\t", next: "sn-start"}, - {onMatch: function(value, state, stack) { - stack.splice(stack.length); - return this.tokenName; - }, tokenName: "text", regex: "^(?!\t)", next: "start"}, - ]) - -}; - -oop.inherits(SnippetGroupHighlightRules, TextHighlightRules); - -exports.SnippetGroupHighlightRules = SnippetGroupHighlightRules; - -var FoldMode = require("./folding/coffee").FoldMode; - -var Mode = function() { - var highlighter = new SnippetGroupHighlightRules(); - this.foldingRules = new FoldMode(); - this.$tokenizer = new Tokenizer(highlighter.getRules()); -}; -oop.inherits(Mode, TextMode); - -(function() { - this.getNextLineIndent = function(state, line, tab) { - return this.$getIndent(line); - }; -}).call(Mode.prototype); -exports.Mode = Mode; - - -}); - -define('ace/mode/folding/coffee', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var BaseFoldMode = require("./fold_mode").FoldMode; -var Range = require("../../range").Range; - -var FoldMode = exports.FoldMode = function() {}; -oop.inherits(FoldMode, BaseFoldMode); - -(function() { - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var range = this.indentationBlock(session, row); - if (range) - return range; - - var re = /\S/; - var line = session.getLine(row); - var startLevel = line.search(re); - if (startLevel == -1 || line[startLevel] != "#") - return; - - var startColumn = line.length; - var maxRow = session.getLength(); - var startRow = row; - var endRow = row; - - while (++row < maxRow) { - line = session.getLine(row); - var level = line.search(re); - - if (level == -1) - continue; - - if (line[level] != "#") - break; - - endRow = row; - } - - if (endRow > startRow) { - var endColumn = session.getLine(endRow).length; - return new Range(startRow, startColumn, endRow, endColumn); - } - }; - this.getFoldWidget = function(session, foldStyle, row) { - var line = session.getLine(row); - var indent = line.search(/\S/); - var next = session.getLine(row + 1); - var prev = session.getLine(row - 1); - var prevIndent = prev.search(/\S/); - var nextIndent = next.search(/\S/); - - if (indent == -1) { - session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : ""; - return ""; - } - if (prevIndent == -1) { - if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") { - session.foldWidgets[row - 1] = ""; - session.foldWidgets[row + 1] = ""; - return "start"; - } - } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") { - if (session.getLine(row - 2).search(/\S/) == -1) { - session.foldWidgets[row - 1] = "start"; - session.foldWidgets[row + 1] = ""; - return ""; - } - } - - if (prevIndent!= -1 && prevIndent < indent) - session.foldWidgets[row - 1] = "start"; - else - session.foldWidgets[row - 1] = ""; - - if (indent < nextIndent) - return "start"; - else - return ""; - }; - -}).call(FoldMode.prototype); - -}); diff --git a/addons/editor/ace/mode-twig.js b/addons/editor/ace/mode-twig.js deleted file mode 100644 index c1810489..00000000 --- a/addons/editor/ace/mode-twig.js +++ /dev/null @@ -1,2179 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2013, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/mode/twig', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/javascript', 'ace/mode/css', 'ace/tokenizer', 'ace/mode/twig_highlight_rules', 'ace/mode/behaviour/html', 'ace/mode/folding/html', 'ace/mode/matching_brace_outdent'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var JavaScriptMode = require("./javascript").Mode; -var CssMode = require("./css").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var TwigHighlightRules = require("./twig_highlight_rules").TwigHighlightRules; -var HtmlBehaviour = require("./behaviour/html").HtmlBehaviour; -var HtmlFoldMode = require("./folding/html").FoldMode; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; - -var Mode = function() { - this.HighlightRules = TwigHighlightRules; - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new HtmlBehaviour(); - - this.createModeDelegates({ - "js-": JavaScriptMode, - "css-": CssMode - }); - - this.foldingRules = new HtmlFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - this.blockComment = {start: "{#", end: "#}"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().getLineTokens(line, state); - var tokens = tokenizedLine.tokens; - var endState = tokenizedLine.state; - - 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; - }; - - 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; -}); - -define('ace/mode/javascript', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/javascript_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/worker/worker_client', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var Range = require("../range").Range; -var WorkerClient = require("../worker/worker_client").WorkerClient; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = JavaScriptHighlightRules; - - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().getLineTokens(line, state); - var tokens = tokenizedLine.tokens; - var endState = tokenizedLine.state; - - if (tokens.length && tokens[tokens.length-1].type == "comment") { - return indent; - } - - if (state == "start" || state == "no_regex") { - var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/); - if (match) { - indent += tab; - } - } else if (state == "doc-start") { - if (endState == "start" || endState == "no_regex") { - return ""; - } - var match = line.match(/^\s*(\/?)\*/); - if (match) { - if (match[1]) { - indent += " "; - } - indent += "* "; - } - } - - 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); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker"); - worker.attachToDocument(session.getDocument()); - - worker.on("jslint", function(results) { - session.setAnnotations(results.data); - }); - - worker.on("terminate", function() { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var JavaScriptHighlightRules = function() { - var keywordMapper = this.createKeywordMapper({ - "variable.language": - "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors - "Namespace|QName|XML|XMLList|" + // E4X - "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + - "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + - "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors - "SyntaxError|TypeError|URIError|" + - "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions - "isNaN|parseFloat|parseInt|" + - "JSON|Math|" + // Other - "this|arguments|prototype|window|document" , // Pseudo - "keyword": - "const|yield|import|get|set|" + - "break|case|catch|continue|default|delete|do|else|finally|for|function|" + - "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + - "__parent__|__count__|escape|unescape|with|__proto__|" + - "class|enum|extends|super|export|implements|private|public|interface|package|protected|static", - "storage.type": - "const|let|var|function", - "constant.language": - "null|Infinity|NaN|undefined", - "support.function": - "alert", - "constant.language.boolean": "true|false" - }, "identifier"); - var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; - var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\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 - ".)"; - - this.$rules = { - "no_regex" : [ - { - token : "comment", - regex : "\\/\\/", - next : "line_comment" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : /\/\*/, - next : "comment" - }, { - token : "string", - regex : "'(?=.)", - next : "qstring" - }, { - token : "string", - regex : '"(?=.)', - next : "qqstring" - }, { - token : "constant.numeric", // hex - regex : /0[xX][0-9a-fA-F]+\b/ - }, { - token : "constant.numeric", // float - regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/ - }, { - token : [ - "storage.type", "punctuation.operator", "support.function", - "punctuation.operator", "entity.name.function", "text","keyword.operator" - ], - regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "keyword.operator", "text", "storage.type", - "text", "paren.lparen" - ], - regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "punctuation.operator", - "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "text", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : "keyword", - regex : "(?:" + kwBeforeRe + ")\\b", - next : "start" - }, { - token : ["punctuation.operator", "support.function"], - regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/ - }, { - token : ["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 : keywordMapper, - regex : identifierRe - }, { - token : "keyword.operator", - regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/, - next : "start" - }, { - token : "punctuation.operator", - regex : /\?|\:|\,|\;|\./, - next : "start" - }, { - token : "paren.lparen", - regex : /[\[({]/, - next : "start" - }, { - token : "paren.rparen", - regex : /[\])}]/ - }, { - token : "keyword.operator", - regex : /\/=?/, - next : "start" - }, { - token: "comment", - regex: /^#!.*$/ - } - ], - "start": [ - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment_regex_allowed" - }, { - token : "comment", - regex : "\\/\\/", - next : "line_comment_regex_allowed" - }, { - token: "string.regexp", - regex: "\\/", - next: "regex" - }, { - token : "text", - regex : "\\s+|^$", - next : "start" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "regex": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "string.regexp", - regex: "/\\w*", - next: "no_regex" - }, { - token : "invalid", - regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ - }, { - token : "constant.language.escape", - regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/ - }, { - token : "constant.language.delimiter", - regex: /\|/ - }, { - token: "constant.language.escape", - regex: /\[\^?/, - next: "regex_character_class" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp" - } - ], - "regex_character_class": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "constant.language.escape", - regex: "]", - next: "regex" - }, { - token: "constant.language.escape", - regex: "-" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp.charachterclass" - } - ], - "function_arguments": [ - { - token: "variable.parameter", - regex: identifierRe - }, { - token: "punctuation.operator", - regex: "[, ]+" - }, { - token: "punctuation.operator", - regex: "$" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "comment_regex_allowed" : [ - {token : "comment", regex : "\\*\\/", next : "start"}, - {defaultToken : "comment"} - ], - "comment" : [ - {token : "comment", regex : "\\*\\/", next : "no_regex"}, - {defaultToken : "comment"} - ], - "line_comment_regex_allowed" : [ - {token : "comment", regex : "$|^", next : "start"}, - {defaultToken : "comment"} - ], - "line_comment" : [ - {token : "comment", regex : "$|^", next : "no_regex"}, - {defaultToken : "comment"} - ], - "qqstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qqstring" - }, { - token : "string", - regex : '"|$', - next : "no_regex" - }, { - defaultToken: "string" - } - ], - "qstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qstring" - }, { - token : "string", - regex : "'|$", - next : "no_regex" - }, { - defaultToken: "string" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("no_regex") ]); -}; - -oop.inherits(JavaScriptHighlightRules, TextHighlightRules); - -exports.JavaScriptHighlightRules = JavaScriptHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); - -define('ace/mode/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/css_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/worker/worker_client', 'ace/mode/behaviour/css', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var WorkerClient = require("../worker/worker_client").WorkerClient; -var CssBehaviour = require("./behaviour/css").CssBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = CssHighlightRules; - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CssBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.foldingRules = "cStyle"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - var tokens = this.getTokenizer().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); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker"); - worker.attachToDocument(session.getDocument()); - - worker.on("csslint", function(e) { - session.setAnnotations(e.data); - }); - - worker.on("terminate", function() { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; - -}); - -define('ace/mode/css_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var supportType = exports.supportType = "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"; -var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters"; -var supportConstant = exports.supportConstant = "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|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|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero"; -var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow"; -var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace"; - -var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))"; -var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b"; -var pseudoClasses = exports.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 CssHighlightRules = function() { - - var keywordMapper = this.createKeywordMapper({ - "support.function": supportFunction, - "support.constant": supportConstant, - "support.type": supportType, - "support.constant.color": supportConstantColor, - "support.constant.fonts": supportConstantFonts - }, "text", true); - - this.$rules = { - "start" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "@.*?{", - push: "media" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "media" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "\\}", - next: "pop" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "comment" : [{ - token : "comment", - regex : "\\*\\/", - next : "pop" - }, { - defaultToken : "comment" - }], - - "ruleset" : [ - { - token : "paren.rparen", - regex : "\\}", - next: "pop" - }, { - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - 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 : numRe - }, { - 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 : ["support.function", "string", "support.function"], - regex : "(url\\()(.*)(\\))" - }, { - token : keywordMapper, - regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*" - }, { - caseInsensitive: true - }] - }; - - this.normalizeRules(); -}; - -oop.inherits(CssHighlightRules, TextHighlightRules); - -exports.CssHighlightRules = CssHighlightRules; - -}); - -define('ace/mode/behaviour/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; - -var CssBehaviour = function () { - - this.inherit(CstyleBehaviour); - - this.add("colon", "insertion", function (state, action, editor, session, text) { - if (text === ':') { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - var token = iterator.getCurrentToken(); - if (token && token.value.match(/\s+/)) { - token = iterator.stepBackward(); - } - if (token && token.type === 'support.type') { - var line = session.doc.getLine(cursor.row); - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar === ':') { - return { - text: '', - selection: [1, 1] - } - } - if (!line.substring(cursor.column).match(/^\s*;/)) { - return { - text: ':;', - selection: [1, 1] - } - } - } - } - }); - - this.add("colon", "deletion", function (state, action, editor, session, range) { - var selected = session.doc.getTextRange(range); - if (!range.isMultiLine() && selected === ':') { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - var token = iterator.getCurrentToken(); - if (token && token.value.match(/\s+/)) { - token = iterator.stepBackward(); - } - if (token && token.type === 'support.type') { - 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("semicolon", "insertion", function (state, action, editor, session, text) { - if (text === ';') { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar === ';') { - return { - text: '', - selection: [1, 1] - } - } - } - }); - -} -oop.inherits(CssBehaviour, CstyleBehaviour); - -exports.CssBehaviour = CssBehaviour; -}); - -define('ace/mode/twig_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/html_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var TwigHighlightRules = function() { - HtmlHighlightRules.call(this); - - var tags = "autoescape|block|do|embed|extends|filter|flush|for|from|if|import|include|macro|sandbox|set|spaceless|use|verbatim"; - tags = tags + "|end" + tags.replace(/\|/g, "|end"); - var filters = "abs|batch|capitalize|convert_encoding|date|date_modify|default|e|escape|first|format|join|json_encode|keys|last|length|lower|merge|nl2br|number_format|raw|replace|reverse|slice|sort|split|striptags|title|trim|upper|url_encode"; - var functions = "attribute|constant|cycle|date|dump|parent|random|range|template_from_string"; - var tests = "constant|divisibleby|sameas|defined|empty|even|iterable|odd"; - var constants = "null|none|true|false"; - var operators = "b-and|b-xor|b-or|in|is|and|or|not" - - var keywordMapper = this.createKeywordMapper({ - "keyword.control.twig": tags, - "support.function.twig": [filters, functions, tests].join("|"), - "keyword.operator.twig": operators, - "constant.language.twig": constants - }, "identifier"); - for (var rule in this.$rules) { - this.$rules[rule].unshift({ - token : "variable.other.readwrite.local.twig", - regex : "\\{\\{-?", - push : "twig-start" - }, { - token : "meta.tag.twig", - regex : "\\{%-?", - push : "twig-start" - }, { - token : "comment.block.twig", - regex : "\\{#-?", - push : "twig-comment" - }); - } - this.$rules["twig-comment"] = [{ - token : "comment.block.twig", - regex : ".*-?#\\}", - next : "pop" - }]; - - this.$rules["twig-start"] = [{ - token : "variable.other.readwrite.local.twig", - regex : "-?\\}\\}", - next : "pop" - }, { - token : "meta.tag.twig", - regex : "-?%\\}", - next : "pop" - }, { - token : "string", - regex : "'", - next : "twig-qstring" - }, { - token : "string", - regex : '"', - next : "twig-qqstring" - }, { - token : "constant.numeric", // hex - regex : "0[xX][0-9a-fA-F]+\\b" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "constant.language.boolean", - regex : "(?:true|false)\\b" - }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" - }, { - token : "keyword.operator.assignment", - regex : "=|~" - }, { - token : "keyword.operator.comparison", - regex : "==|!=|<|>|>=|<=|===" - }, { - token : "keyword.operator.arithmetic", - regex : "\\+|-|/|%|//|\\*|\\*\\*" - }, { - token : "keyword.operator.other", - regex : "\\.\\.|\\|" - }, { - token : "punctuation.operator", - regex : /\?|\:|\,|\;|\./ - }, { - token : "paren.lparen", - regex : /[\[\({]/ - }, { - token : "paren.rparen", - regex : /[\])}]/ - }, { - token : "text", - regex : "\\s+" - } ]; - - this.$rules["twig-qqstring"] = [{ - token : "constant.language.escape", - regex : /\\[\\"$#ntr]|#{[^"}]*}/ - }, { - token : "string", - regex : '"', - next : "twig-start" - }, { - defaultToken : "string" - } - ]; - - this.$rules["twig-qstring"] = [{ - token : "constant.language.escape", - regex : /\\[\\'ntr]}/ - }, { - token : "string", - regex : "'", - next : "twig-start" - }, { - defaultToken : "string" - } - ]; - - this.normalizeRules(); -}; - -oop.inherits(TwigHighlightRules, TextHighlightRules); - -exports.TwigHighlightRules = TwigHighlightRules; -}); - -define('ace/mode/html_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/css_highlight_rules', 'ace/mode/javascript_highlight_rules', 'ace/mode/xml_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; - -var tagMap = lang.createMap({ - a : 'anchor', - button : 'form', - form : 'form', - img : 'image', - input : 'form', - label : 'form', - option : 'form', - script : 'script', - select : 'form', - textarea : 'form', - style : 'style', - table : 'table', - tbody : 'table', - td : 'table', - tfoot : 'table', - th : 'table', - tr : 'table' -}); - -var HtmlHighlightRules = function() { - XmlHighlightRules.call(this); - - this.addRules({ - attributes: [{ - include : "space" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "keyword.operator.separator", - regex : "=", - push : [{ - include: "space" - }, { - token : "string", - regex : "[^<>='\"`\\s]+", - next : "pop" - }, { - token : "empty", - regex : "", - next : "pop" - }] - }, { - include : "string" - }], - tag: [{ - token : function(start, tag) { - var group = tagMap[tag]; - return ["meta.tag.punctuation.begin", - "meta.tag.name" + (group ? "." + group : "")]; - }, - regex : "(<)([-_a-zA-Z0-9:]+)", - next: "start_tag_stuff" - }, { - token : function(start, tag) { - var group = tagMap[tag]; - return ["meta.tag.punctuation.begin", - "meta.tag.name" + (group ? "." + group : "")]; - }, - regex : "(", next : "start"} - ], - end_tag_stuff: [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next : "start"} - ] - }); - - this.embedTagRules(CssHighlightRules, "css-", "style"); - this.embedTagRules(JavaScriptHighlightRules, "js-", "script"); - - if (this.constructor === HtmlHighlightRules) - this.normalizeRules(); -}; - -oop.inherits(HtmlHighlightRules, XmlHighlightRules); - -exports.HtmlHighlightRules = HtmlHighlightRules; -}); - -define('ace/mode/xml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml_util', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var xmlUtil = require("./xml_util"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var XmlHighlightRules = function(normalize) { - this.$rules = { - start : [ - {token : "punctuation.string.begin", regex : "<\\!\\[CDATA\\[", next : "cdata"}, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)(xml)(?=[\\s])", next : "xml_declaration" - }, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)([-_a-zA-Z0-9]+)", next : "instruction" - }, - {token : "comment", regex : "<\\!--", next : "comment"}, - { - token : ["punctuation.doctype.begin", "meta.tag.doctype"], - regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype" - }, - {include : "tag"}, - {include : "reference"} - ], - - xml_declaration : [ - {include : "attributes"}, - {include : "instruction"} - ], - - instruction : [ - {token : "punctuation.instruction.end", regex : "\\?>", next : "start"} - ], - - doctype : [ - {include : "space"}, - {include : "string"}, - {token : "punctuation.doctype.end", regex : ">", next : "start"}, - {token : "xml-pe", regex : "[-_a-zA-Z0-9:]+"}, - {token : "punctuation.begin", regex : "\\[", push : "declarations"} - ], - - declarations : [{ - token : "text", - regex : "\\s+" - }, { - token: "punctuation.end", - regex: "]", - next: "pop" - }, { - token : ["punctuation.begin", "keyword"], - regex : "(<\\!)([-_a-zA-Z0-9]+)", - push : [{ - token : "text", - regex : "\\s+" - }, - { - token : "punctuation.end", - regex : ">", - next : "pop" - }, - {include : "string"}] - }], - - cdata : [ - {token : "string.end", regex : "\\]\\]>", next : "start"}, - {token : "text", regex : "\\s+"}, - {token : "text", regex : "(?:[^\\]]|\\](?!\\]>))+"} - ], - - comment : [ - {token : "comment", regex : "-->", next : "start"}, - {defaultToken : "comment"} - ], - - tag : [{ - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(<)((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)", - next: [ - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : "start"} - ] - }, { - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(", next : "start"} - ] - }], - - space : [ - {token : "text", regex : "\\s+"} - ], - - reference : [{ - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, { - token : "invalid.illegal", regex : "&" - }], - - string: [{ - token : "string", - regex : "'", - push : "qstring_inner" - }, { - token : "string", - regex : '"', - push : "qqstring_inner" - }], - - qstring_inner: [ - {token : "string", regex: "'", next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - qqstring_inner: [ - {token : "string", regex: '"', next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - attributes: [{ - token : "entity.other.attribute-name", - regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+" - }, { - token : "keyword.operator.separator", - regex : "=" - }, { - include : "space" - }, { - include : "string" - }] - }; - - if (this.constructor === XmlHighlightRules) - this.normalizeRules(); -}; - - -(function() { - - this.embedTagRules = function(HighlightRules, prefix, tag){ - this.$rules.tag.unshift({ - token : ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(<)(" + tag + ")", - next: [ - {include : "space"}, - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : prefix + "start"} - ] - }); - - this.$rules[tag + "-end"] = [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next: "start", - onMatch : function(value, currentState, stack) { - stack.splice(0); - return this.token; - }} - ] - - this.embedRules(HighlightRules, prefix, [{ - token: ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(" - }]); - }; - -}).call(TextHighlightRules.prototype); - -oop.inherits(XmlHighlightRules, TextHighlightRules); - -exports.XmlHighlightRules = XmlHighlightRules; -}); - -define('ace/mode/xml_util', ['require', 'exports', 'module' ], function(require, exports, module) { - - -function string(state) { - return [{ - token : "string", - regex : '"', - next : state + "_qqstring" - }, { - token : "string", - regex : "'", - next : state + "_qstring" - }]; -} - -function multiLineString(quote, state) { - return [ - {token : "string", regex : quote, next : state}, - { - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, - {defaultToken : "string"} - ]; -} - -exports.tag = function(states, name, nextState, tagMap) { - states[name] = [{ - token : "text", - regex : "\\s+" - }, { - - token : !tagMap ? "meta.tag.tag-name" : function(value) { - if (tagMap[value]) - return "meta.tag.tag-name." + tagMap[value]; - else - return "meta.tag.tag-name"; - }, - regex : "[-_a-zA-Z0-9:]+", - next : name + "_embed_attribute_list" - }, { - token: "empty", - regex: "", - next : 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"] = [{ - token : "meta.tag.r", - regex : "/?>", - next : nextState - }, { - token : "keyword.operator", - regex : "=" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "text", - regex : "\\s+" - }].concat(string(name)); -}; - -}); - -define('ace/mode/behaviour/html', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour/xml', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var XmlBehaviour = require("../behaviour/xml").XmlBehaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var voidElements = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']; - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); - return hasType; -} - -var HtmlBehaviour = function () { - - this.inherit(XmlBehaviour); // Get xml behaviour - - this.add("autoclosing", "insertion", function (state, action, editor, session, text) { - if (text == '>') { - var position = editor.getCursorPosition(); - var iterator = new TokenIterator(session, position.row, position.column); - var token = iterator.getCurrentToken(); - - if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column) - return; - var atCursor = false; - if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text'))); - } else { - atCursor = true; - } - if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) { - return; - } - var element = token.value; - if (atCursor){ - var element = element.substring(0, position.column - token.start); - } - if (voidElements.indexOf(element) !== -1){ - return; - } - return { - text: '>' + '', - selection: [1, 1] - } - } - }); -} -oop.inherits(HtmlBehaviour, XmlBehaviour); - -exports.HtmlBehaviour = HtmlBehaviour; -}); - -define('ace/mode/behaviour/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); - return hasType; -} - -var XmlBehaviour = function () { - - this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour - - this.add("autoclosing", "insertion", function (state, action, editor, session, text) { - if (text == '>') { - var position = editor.getCursorPosition(); - var iterator = new TokenIterator(session, position.row, position.column); - var token = iterator.getCurrentToken(); - - if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column) - return; - var atCursor = false; - if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text'))); - } else { - atCursor = true; - } - if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) { - return; - } - var tag = token.value; - if (atCursor){ - var tag = tag.substring(0, position.column - token.start); - } - - return { - text: '>' + '', - selection: [1, 1] - } - } - }); - - this.add('autoindent', 'insertion', function (state, action, editor, session, text) { - if (text == "\n") { - var cursor = editor.getCursorPosition(); - var line = session.getLine(cursor.row); - var rightChars = line.substring(cursor.column, cursor.column + 2); - if (rightChars == '?)/; - this._parseTag = function(tag) { - - var match = tag.match(this.tagRe); - var column = 0; - - return { - value: tag, - match: match ? match[2] : "", - closing: match ? !!match[3] : false, - selfClosing: match ? !!match[5] || match[2] == "/>" : false, - tagName: match ? match[4] : "", - column: match[1] ? column + match[1].length : column - }; - }; - this._readTagForward = function(iterator) { - var token = iterator.getCurrentToken(); - if (!token) - return null; - - var value = ""; - var start; - - do { - if (token.type.lastIndexOf("meta.tag", 0) === 0) { - if (!start) { - var start = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() - }; - } - value += token.value; - if (value.indexOf(">") !== -1) { - var tag = this._parseTag(value); - tag.start = start; - tag.end = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() + token.value.length - }; - iterator.stepForward(); - return tag; - } - } - } while(token = iterator.stepForward()); - - return null; - }; - - this._readTagBackward = function(iterator) { - var token = iterator.getCurrentToken(); - if (!token) - return null; - - var value = ""; - var end; - - do { - if (token.type.lastIndexOf("meta.tag", 0) === 0) { - if (!end) { - end = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() + token.value.length - }; - } - value = token.value + value; - if (value.indexOf("<") !== -1) { - var tag = this._parseTag(value); - tag.end = end; - tag.start = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() - }; - iterator.stepBackward(); - return tag; - } - } - } while(token = iterator.stepBackward()); - - return null; - }; - - this._pop = function(stack, tag) { - while (stack.length) { - - var top = stack[stack.length-1]; - if (!tag || top.tagName == tag.tagName) { - return stack.pop(); - } - else if (this.voidElements[tag.tagName]) { - return; - } - else if (this.voidElements[top.tagName]) { - stack.pop(); - continue; - } else { - return null; - } - } - }; - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var firstTag = this._getFirstTagInLine(session, row); - - if (!firstTag.match) - return null; - - var isBackward = firstTag.closing || firstTag.selfClosing; - var stack = []; - var tag; - - if (!isBackward) { - var iterator = new TokenIterator(session, row, firstTag.column); - var start = { - row: row, - column: firstTag.column + firstTag.tagName.length + 2 - }; - while (tag = this._readTagForward(iterator)) { - if (tag.selfClosing) { - if (!stack.length) { - tag.start.column += tag.tagName.length + 2; - tag.end.column -= 2; - return Range.fromPoints(tag.start, tag.end); - } else - continue; - } - - if (tag.closing) { - this._pop(stack, tag); - if (stack.length == 0) - return Range.fromPoints(start, tag.start); - } - else { - stack.push(tag) - } - } - } - else { - var iterator = new TokenIterator(session, row, firstTag.column + firstTag.match.length); - var end = { - row: row, - column: firstTag.column - }; - - while (tag = this._readTagBackward(iterator)) { - if (tag.selfClosing) { - if (!stack.length) { - tag.start.column += tag.tagName.length + 2; - tag.end.column -= 2; - return Range.fromPoints(tag.start, tag.end); - } else - continue; - } - - if (!tag.closing) { - this._pop(stack, tag); - if (stack.length == 0) { - tag.start.column += tag.tagName.length + 2; - return Range.fromPoints(tag.start, end); - } - } - else { - stack.push(tag) - } - } - } - - }; - -}).call(FoldMode.prototype); - -}); diff --git a/addons/editor/ace/mode-typescript.js b/addons/editor/ace/mode-typescript.js deleted file mode 100644 index 4738a5fa..00000000 --- a/addons/editor/ace/mode-typescript.js +++ /dev/null @@ -1,970 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2012, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/mode/typescript', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/javascript', 'ace/tokenizer', 'ace/mode/typescript_highlight_rules', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle', 'ace/mode/matching_brace_outdent'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var jsMode = require("./javascript").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var TypeScriptHighlightRules = require("./typescript_highlight_rules").TypeScriptHighlightRules; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; - -var Mode = function() { - this.HighlightRules = TypeScriptHighlightRules; - - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, jsMode); - -(function() { - this.createWorker = function(session) { - return null; - }; -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/javascript', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/javascript_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/worker/worker_client', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var Range = require("../range").Range; -var WorkerClient = require("../worker/worker_client").WorkerClient; -var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = JavaScriptHighlightRules; - - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().getLineTokens(line, state); - var tokens = tokenizedLine.tokens; - var endState = tokenizedLine.state; - - if (tokens.length && tokens[tokens.length-1].type == "comment") { - return indent; - } - - if (state == "start" || state == "no_regex") { - var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/); - if (match) { - indent += tab; - } - } else if (state == "doc-start") { - if (endState == "start" || endState == "no_regex") { - return ""; - } - var match = line.match(/^\s*(\/?)\*/); - if (match) { - if (match[1]) { - indent += " "; - } - indent += "* "; - } - } - - 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); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker"); - worker.attachToDocument(session.getDocument()); - - worker.on("jslint", function(results) { - session.setAnnotations(results.data); - }); - - worker.on("terminate", function() { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var JavaScriptHighlightRules = function() { - var keywordMapper = this.createKeywordMapper({ - "variable.language": - "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors - "Namespace|QName|XML|XMLList|" + // E4X - "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + - "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + - "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors - "SyntaxError|TypeError|URIError|" + - "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions - "isNaN|parseFloat|parseInt|" + - "JSON|Math|" + // Other - "this|arguments|prototype|window|document" , // Pseudo - "keyword": - "const|yield|import|get|set|" + - "break|case|catch|continue|default|delete|do|else|finally|for|function|" + - "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + - "__parent__|__count__|escape|unescape|with|__proto__|" + - "class|enum|extends|super|export|implements|private|public|interface|package|protected|static", - "storage.type": - "const|let|var|function", - "constant.language": - "null|Infinity|NaN|undefined", - "support.function": - "alert", - "constant.language.boolean": "true|false" - }, "identifier"); - var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; - var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\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 - ".)"; - - this.$rules = { - "no_regex" : [ - { - token : "comment", - regex : "\\/\\/", - next : "line_comment" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : /\/\*/, - next : "comment" - }, { - token : "string", - regex : "'(?=.)", - next : "qstring" - }, { - token : "string", - regex : '"(?=.)', - next : "qqstring" - }, { - token : "constant.numeric", // hex - regex : /0[xX][0-9a-fA-F]+\b/ - }, { - token : "constant.numeric", // float - regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/ - }, { - token : [ - "storage.type", "punctuation.operator", "support.function", - "punctuation.operator", "entity.name.function", "text","keyword.operator" - ], - regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "keyword.operator", "text", "storage.type", - "text", "paren.lparen" - ], - regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "punctuation.operator", - "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "text", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : "keyword", - regex : "(?:" + kwBeforeRe + ")\\b", - next : "start" - }, { - token : ["punctuation.operator", "support.function"], - regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/ - }, { - token : ["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 : keywordMapper, - regex : identifierRe - }, { - token : "keyword.operator", - regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/, - next : "start" - }, { - token : "punctuation.operator", - regex : /\?|\:|\,|\;|\./, - next : "start" - }, { - token : "paren.lparen", - regex : /[\[({]/, - next : "start" - }, { - token : "paren.rparen", - regex : /[\])}]/ - }, { - token : "keyword.operator", - regex : /\/=?/, - next : "start" - }, { - token: "comment", - regex: /^#!.*$/ - } - ], - "start": [ - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment_regex_allowed" - }, { - token : "comment", - regex : "\\/\\/", - next : "line_comment_regex_allowed" - }, { - token: "string.regexp", - regex: "\\/", - next: "regex" - }, { - token : "text", - regex : "\\s+|^$", - next : "start" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "regex": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "string.regexp", - regex: "/\\w*", - next: "no_regex" - }, { - token : "invalid", - regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ - }, { - token : "constant.language.escape", - regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/ - }, { - token : "constant.language.delimiter", - regex: /\|/ - }, { - token: "constant.language.escape", - regex: /\[\^?/, - next: "regex_character_class" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp" - } - ], - "regex_character_class": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "constant.language.escape", - regex: "]", - next: "regex" - }, { - token: "constant.language.escape", - regex: "-" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp.charachterclass" - } - ], - "function_arguments": [ - { - token: "variable.parameter", - regex: identifierRe - }, { - token: "punctuation.operator", - regex: "[, ]+" - }, { - token: "punctuation.operator", - regex: "$" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "comment_regex_allowed" : [ - {token : "comment", regex : "\\*\\/", next : "start"}, - {defaultToken : "comment"} - ], - "comment" : [ - {token : "comment", regex : "\\*\\/", next : "no_regex"}, - {defaultToken : "comment"} - ], - "line_comment_regex_allowed" : [ - {token : "comment", regex : "$|^", next : "start"}, - {defaultToken : "comment"} - ], - "line_comment" : [ - {token : "comment", regex : "$|^", next : "no_regex"}, - {defaultToken : "comment"} - ], - "qqstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qqstring" - }, { - token : "string", - regex : '"|$', - next : "no_regex" - }, { - defaultToken: "string" - } - ], - "qstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qstring" - }, { - token : "string", - regex : "'|$", - next : "no_regex" - }, { - defaultToken: "string" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("no_regex") ]); -}; - -oop.inherits(JavaScriptHighlightRules, TextHighlightRules); - -exports.JavaScriptHighlightRules = JavaScriptHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var lang = require("../../lib/lang"); - -var SAFE_INSERT_IN_TOKENS = - ["text", "paren.rparen", "punctuation.operator"]; -var SAFE_INSERT_BEFORE_TOKENS = - ["text", "paren.rparen", "punctuation.operator", "comment"]; - - -var autoInsertedBrackets = 0; -var autoInsertedRow = -1; -var autoInsertedLineEnd = ""; -var maybeInsertedBrackets = 0; -var maybeInsertedRow = -1; -var maybeInsertedLineStart = ""; -var maybeInsertedLineEnd = ""; - -var CstyleBehaviour = function () { - - CstyleBehaviour.isSaneInsertion = function(editor, session) { - var cursor = editor.getCursorPosition(); - var iterator = new TokenIterator(session, cursor.row, cursor.column); - if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { - var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); - if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) - return false; - } - iterator.stepForward(); - return iterator.getCurrentTokenRow() !== cursor.row || - this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); - }; - - CstyleBehaviour.$matchTokenType = function(token, types) { - return types.indexOf(token.type || token) > -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); - - -define('ace/mode/typescript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/javascript_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; - -var TypeScriptHighlightRules = function() { - - var tsRules = [ - { - token: ["keyword.operator.ts", "text", "variable.parameter.function.ts", "text"], - regex: "\\b(module)(\\s*)([a-zA-Z0-9_?.$][\\w?.$]*)(\\s*\\{)" - }, - { - token: ["storage.type.variable.ts", "text", "keyword.other.ts", "text"], - regex: "(super)(\\s*\\()([a-zA-Z0-9,_?.$\\s]+\\s*)(\\))" - }, - { - token: ["entity.name.function.ts","paren.lparen", "paren.rparen"], - regex: "([a-zA-Z_?.$][\\w?.$]*)(\\()(\\))" - }, - { - token: ["variable.parameter.function.ts", "text", "variable.parameter.function.ts"], - regex: "([a-zA-Z0-9_?.$][\\w?.$]*)(\\s*:\\s*)([a-zA-Z0-9_?.$][\\w?.$]*)" - }, - { - token: ["keyword.operator.ts"], - regex: "(?:\\b(constructor|declare|interface|as|AS|public|private|class|extends|export|super)\\b)" - }, - { - token: ["storage.type.variable.ts"], - regex: "(?:\\b(this\\.|string\\b|bool\\b|number)\\b)" - }, - { - token: ["keyword.operator.ts", "storage.type.variable.ts", "keyword.operator.ts", "storage.type.variable.ts"], - regex: "(class)(\\s+[a-zA-Z0-9_?.$][\\w?.$]*\\s+)(extends)(\\s+[a-zA-Z0-9_?.$][\\w?.$]*\\s+)?" - }, - { - token: "keyword", - regex: "(?:super|export|class|extends|import)\\b" - } - ]; - - var JSRules = new JavaScriptHighlightRules().getRules(); - - JSRules.start = tsRules.concat(JSRules.start); - this.$rules = JSRules; -}; - -oop.inherits(TypeScriptHighlightRules, JavaScriptHighlightRules); - -exports.TypeScriptHighlightRules = TypeScriptHighlightRules; -}); \ No newline at end of file diff --git a/addons/editor/ace/mode-velocity.js b/addons/editor/ace/mode-velocity.js deleted file mode 100644 index ef535ab7..00000000 --- a/addons/editor/ace/mode-velocity.js +++ /dev/null @@ -1,1615 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2012, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/mode/velocity', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/velocity_highlight_rules', 'ace/mode/folding/velocity', 'ace/mode/behaviour/html'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var VelocityHighlightRules = require("./velocity_highlight_rules").VelocityHighlightRules; -var FoldMode = require("./folding/velocity").FoldMode; -var HtmlBehaviour = require("./behaviour/html").HtmlBehaviour; - -var Mode = function() { - this.HighlightRules = VelocityHighlightRules; - this.foldingRules = new FoldMode(); - this.$behaviour = new HtmlBehaviour(); -}; -oop.inherits(Mode, TextMode); - -(function() { - this.lineCommentStart = "##"; - this.blockComment = {start: "#*", end: "*#"}; -}).call(Mode.prototype); - -exports.Mode = Mode; -});define('ace/mode/velocity_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules', 'ace/mode/html_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; - -var VelocityHighlightRules = function() { - HtmlHighlightRules.call(this); - - var builtinConstants = lang.arrayToMap( - ('true|false|null').split('|') - ); - - var builtinFunctions = lang.arrayToMap( - ("_DateTool|_DisplayTool|_EscapeTool|_FieldTool|_MathTool|_NumberTool|_SerializerTool|_SortTool|_StringTool|_XPathTool").split('|') - ); - - var builtinVariables = lang.arrayToMap( - ('$contentRoot|$foreach').split('|') - ); - - var keywords = lang.arrayToMap( - ("#set|#macro|#include|#parse|" + - "#if|#elseif|#else|#foreach|" + - "#break|#end|#stop" - ).split('|') - ); - - this.$rules.start.push( - { - token : "comment", - regex : "##.*$" - },{ - token : "comment.block", // multi line comment - regex : "#\\*", - next : "vm_comment" - }, { - token : "string.regexp", - regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - token : "constant.numeric", // hex - regex : "0[xX][0-9a-fA-F]+\\b" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "constant.language.boolean", - regex : "(?:true|false)\\b" - }, { - token : function(value) { - if (keywords.hasOwnProperty(value)) - return "keyword"; - else if (builtinConstants.hasOwnProperty(value)) - return "constant.language"; - else if (builtinVariables.hasOwnProperty(value)) - return "variable.language"; - else if (builtinFunctions.hasOwnProperty(value) || builtinFunctions.hasOwnProperty(value.substring(1))) - return "support.function"; - else if (value == "debugger") - return "invalid.deprecated"; - else - if(value.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*)$/)) - return "variable"; - return "identifier"; - }, - regex : "[a-zA-Z$#][a-zA-Z0-9_]*\\b" - }, { - token : "keyword.operator", - regex : "!|&|\\*|\\-|\\+|=|!=|<=|>=|<|>|&&|\\|\\|" - }, { - token : "lparen", - regex : "[[({]" - }, { - token : "rparen", - regex : "[\\])}]" - }, { - token : "text", - regex : "\\s+" - } - ); - - this.$rules["vm_comment"] = [ - { - token : "comment", // closing comment - regex : "\\*#|-->", - next : "start" - }, { - defaultToken: "comment" - } - ]; - - this.$rules["vm_start"] = [ - { - token: "variable", - regex: "}", - next: "pop" - }, { - token : "string.regexp", - regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - token : "constant.numeric", // hex - regex : "0[xX][0-9a-fA-F]+\\b" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "constant.language.boolean", - regex : "(?:true|false)\\b" - }, { - token : function(value) { - if (keywords.hasOwnProperty(value)) - return "keyword"; - else if (builtinConstants.hasOwnProperty(value)) - return "constant.language"; - else if (builtinVariables.hasOwnProperty(value)) - return "variable.language"; - else if (builtinFunctions.hasOwnProperty(value) || builtinFunctions.hasOwnProperty(value.substring(1))) - return "support.function"; - else if (value == "debugger") - return "invalid.deprecated"; - else - if(value.match(/^(\$[a-zA-Z_$][a-zA-Z0-9_]*)$/)) - return "variable"; - return "identifier"; - }, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" - }, { - token : "keyword.operator", - regex : "!|&|\\*|\\-|\\+|=|!=|<=|>=|<|>|&&|\\|\\|" - }, { - token : "lparen", - regex : "[[({]" - }, { - token : "rparen", - regex : "[\\])}]" - }, { - token : "text", - regex : "\\s+" - } - ]; - - for (var i in this.$rules) { - this.$rules[i].unshift({ - token: "variable", - regex: "\\${", - push: "vm_start" - }); - } - - this.normalizeRules(); -}; - -oop.inherits(VelocityHighlightRules, TextHighlightRules); - -exports.VelocityHighlightRules = VelocityHighlightRules; -}); - -define('ace/mode/html_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/css_highlight_rules', 'ace/mode/javascript_highlight_rules', 'ace/mode/xml_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; -var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; - -var tagMap = lang.createMap({ - a : 'anchor', - button : 'form', - form : 'form', - img : 'image', - input : 'form', - label : 'form', - option : 'form', - script : 'script', - select : 'form', - textarea : 'form', - style : 'style', - table : 'table', - tbody : 'table', - td : 'table', - tfoot : 'table', - th : 'table', - tr : 'table' -}); - -var HtmlHighlightRules = function() { - XmlHighlightRules.call(this); - - this.addRules({ - attributes: [{ - include : "space" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "keyword.operator.separator", - regex : "=", - push : [{ - include: "space" - }, { - token : "string", - regex : "[^<>='\"`\\s]+", - next : "pop" - }, { - token : "empty", - regex : "", - next : "pop" - }] - }, { - include : "string" - }], - tag: [{ - token : function(start, tag) { - var group = tagMap[tag]; - return ["meta.tag.punctuation.begin", - "meta.tag.name" + (group ? "." + group : "")]; - }, - regex : "(<)([-_a-zA-Z0-9:]+)", - next: "start_tag_stuff" - }, { - token : function(start, tag) { - var group = tagMap[tag]; - return ["meta.tag.punctuation.begin", - "meta.tag.name" + (group ? "." + group : "")]; - }, - regex : "(", next : "start"} - ], - end_tag_stuff: [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next : "start"} - ] - }); - - this.embedTagRules(CssHighlightRules, "css-", "style"); - this.embedTagRules(JavaScriptHighlightRules, "js-", "script"); - - if (this.constructor === HtmlHighlightRules) - this.normalizeRules(); -}; - -oop.inherits(HtmlHighlightRules, XmlHighlightRules); - -exports.HtmlHighlightRules = HtmlHighlightRules; -}); - -define('ace/mode/css_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var supportType = exports.supportType = "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"; -var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters"; -var supportConstant = exports.supportConstant = "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|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|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero"; -var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow"; -var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace"; - -var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))"; -var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b"; -var pseudoClasses = exports.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 CssHighlightRules = function() { - - var keywordMapper = this.createKeywordMapper({ - "support.function": supportFunction, - "support.constant": supportConstant, - "support.type": supportType, - "support.constant.color": supportConstantColor, - "support.constant.fonts": supportConstantFonts - }, "text", true); - - this.$rules = { - "start" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "@.*?{", - push: "media" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "media" : [{ - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token: "paren.lparen", - regex: "\\{", - push: "ruleset" - }, { - token: "string", - regex: "\\}", - next: "pop" - }, { - token: "keyword", - regex: "#[a-z0-9-_]+" - }, { - token: "variable", - regex: "\\.[a-z0-9-_]+" - }, { - token: "string", - regex: ":[a-z0-9-_]+" - }, { - token: "constant", - regex: "[a-z0-9-_]+" - }, { - caseInsensitive: true - }], - - "comment" : [{ - token : "comment", - regex : "\\*\\/", - next : "pop" - }, { - defaultToken : "comment" - }], - - "ruleset" : [ - { - token : "paren.rparen", - regex : "\\}", - next: "pop" - }, { - token : "comment", // multi line comment - regex : "\\/\\*", - push : "comment" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - 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 : numRe - }, { - 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 : ["support.function", "string", "support.function"], - regex : "(url\\()(.*)(\\))" - }, { - token : keywordMapper, - regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*" - }, { - caseInsensitive: true - }] - }; - - this.normalizeRules(); -}; - -oop.inherits(CssHighlightRules, TextHighlightRules); - -exports.CssHighlightRules = CssHighlightRules; - -}); - -define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var JavaScriptHighlightRules = function() { - var keywordMapper = this.createKeywordMapper({ - "variable.language": - "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors - "Namespace|QName|XML|XMLList|" + // E4X - "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + - "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + - "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors - "SyntaxError|TypeError|URIError|" + - "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions - "isNaN|parseFloat|parseInt|" + - "JSON|Math|" + // Other - "this|arguments|prototype|window|document" , // Pseudo - "keyword": - "const|yield|import|get|set|" + - "break|case|catch|continue|default|delete|do|else|finally|for|function|" + - "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + - "__parent__|__count__|escape|unescape|with|__proto__|" + - "class|enum|extends|super|export|implements|private|public|interface|package|protected|static", - "storage.type": - "const|let|var|function", - "constant.language": - "null|Infinity|NaN|undefined", - "support.function": - "alert", - "constant.language.boolean": "true|false" - }, "identifier"); - var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; - var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\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 - ".)"; - - this.$rules = { - "no_regex" : [ - { - token : "comment", - regex : "\\/\\/", - next : "line_comment" - }, - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : /\/\*/, - next : "comment" - }, { - token : "string", - regex : "'(?=.)", - next : "qstring" - }, { - token : "string", - regex : '"(?=.)', - next : "qqstring" - }, { - token : "constant.numeric", // hex - regex : /0[xX][0-9a-fA-F]+\b/ - }, { - token : "constant.numeric", // float - regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/ - }, { - token : [ - "storage.type", "punctuation.operator", "support.function", - "punctuation.operator", "entity.name.function", "text","keyword.operator" - ], - regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "keyword.operator", "text", "storage.type", - "text", "paren.lparen" - ], - regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "storage.type", "text", "entity.name.function", "text", "paren.lparen" - ], - regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "entity.name.function", "text", "punctuation.operator", - "text", "storage.type", "text", "paren.lparen" - ], - regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : [ - "text", "text", "storage.type", "text", "paren.lparen" - ], - regex : "(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments" - }, { - token : "keyword", - regex : "(?:" + kwBeforeRe + ")\\b", - next : "start" - }, { - token : ["punctuation.operator", "support.function"], - regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/ - }, { - token : ["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 : keywordMapper, - regex : identifierRe - }, { - token : "keyword.operator", - regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/, - next : "start" - }, { - token : "punctuation.operator", - regex : /\?|\:|\,|\;|\./, - next : "start" - }, { - token : "paren.lparen", - regex : /[\[({]/, - next : "start" - }, { - token : "paren.rparen", - regex : /[\])}]/ - }, { - token : "keyword.operator", - regex : /\/=?/, - next : "start" - }, { - token: "comment", - regex: /^#!.*$/ - } - ], - "start": [ - DocCommentHighlightRules.getStartRule("doc-start"), - { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment_regex_allowed" - }, { - token : "comment", - regex : "\\/\\/", - next : "line_comment_regex_allowed" - }, { - token: "string.regexp", - regex: "\\/", - next: "regex" - }, { - token : "text", - regex : "\\s+|^$", - next : "start" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "regex": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "string.regexp", - regex: "/\\w*", - next: "no_regex" - }, { - token : "invalid", - regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ - }, { - token : "constant.language.escape", - regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/ - }, { - token : "constant.language.delimiter", - regex: /\|/ - }, { - token: "constant.language.escape", - regex: /\[\^?/, - next: "regex_character_class" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp" - } - ], - "regex_character_class": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" - }, { - token: "constant.language.escape", - regex: "]", - next: "regex" - }, { - token: "constant.language.escape", - regex: "-" - }, { - token: "empty", - regex: "$", - next: "no_regex" - }, { - defaultToken: "string.regexp.charachterclass" - } - ], - "function_arguments": [ - { - token: "variable.parameter", - regex: identifierRe - }, { - token: "punctuation.operator", - regex: "[, ]+" - }, { - token: "punctuation.operator", - regex: "$" - }, { - token: "empty", - regex: "", - next: "no_regex" - } - ], - "comment_regex_allowed" : [ - {token : "comment", regex : "\\*\\/", next : "start"}, - {defaultToken : "comment"} - ], - "comment" : [ - {token : "comment", regex : "\\*\\/", next : "no_regex"}, - {defaultToken : "comment"} - ], - "line_comment_regex_allowed" : [ - {token : "comment", regex : "$|^", next : "start"}, - {defaultToken : "comment"} - ], - "line_comment" : [ - {token : "comment", regex : "$|^", next : "no_regex"}, - {defaultToken : "comment"} - ], - "qqstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qqstring" - }, { - token : "string", - regex : '"|$', - next : "no_regex" - }, { - defaultToken: "string" - } - ], - "qstring" : [ - { - token : "constant.language.escape", - regex : escapedRe - }, { - token : "string", - regex : "\\\\$", - next : "qstring" - }, { - token : "string", - regex : "'|$", - next : "no_regex" - }, { - defaultToken: "string" - } - ] - }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("no_regex") ]); -}; - -oop.inherits(JavaScriptHighlightRules, TextHighlightRules); - -exports.JavaScriptHighlightRules = JavaScriptHighlightRules; -}); - -define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc.tag", - regex : "\\bTODO\\b" - }, { - defaultToken : "comment.doc" - }] - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start - }; -}; - - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -define('ace/mode/xml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml_util', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var xmlUtil = require("./xml_util"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var XmlHighlightRules = function(normalize) { - this.$rules = { - start : [ - {token : "punctuation.string.begin", regex : "<\\!\\[CDATA\\[", next : "cdata"}, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)(xml)(?=[\\s])", next : "xml_declaration" - }, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)([-_a-zA-Z0-9]+)", next : "instruction" - }, - {token : "comment", regex : "<\\!--", next : "comment"}, - { - token : ["punctuation.doctype.begin", "meta.tag.doctype"], - regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype" - }, - {include : "tag"}, - {include : "reference"} - ], - - xml_declaration : [ - {include : "attributes"}, - {include : "instruction"} - ], - - instruction : [ - {token : "punctuation.instruction.end", regex : "\\?>", next : "start"} - ], - - doctype : [ - {include : "space"}, - {include : "string"}, - {token : "punctuation.doctype.end", regex : ">", next : "start"}, - {token : "xml-pe", regex : "[-_a-zA-Z0-9:]+"}, - {token : "punctuation.begin", regex : "\\[", push : "declarations"} - ], - - declarations : [{ - token : "text", - regex : "\\s+" - }, { - token: "punctuation.end", - regex: "]", - next: "pop" - }, { - token : ["punctuation.begin", "keyword"], - regex : "(<\\!)([-_a-zA-Z0-9]+)", - push : [{ - token : "text", - regex : "\\s+" - }, - { - token : "punctuation.end", - regex : ">", - next : "pop" - }, - {include : "string"}] - }], - - cdata : [ - {token : "string.end", regex : "\\]\\]>", next : "start"}, - {token : "text", regex : "\\s+"}, - {token : "text", regex : "(?:[^\\]]|\\](?!\\]>))+"} - ], - - comment : [ - {token : "comment", regex : "-->", next : "start"}, - {defaultToken : "comment"} - ], - - tag : [{ - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(<)((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)", - next: [ - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : "start"} - ] - }, { - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(", next : "start"} - ] - }], - - space : [ - {token : "text", regex : "\\s+"} - ], - - reference : [{ - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, { - token : "invalid.illegal", regex : "&" - }], - - string: [{ - token : "string", - regex : "'", - push : "qstring_inner" - }, { - token : "string", - regex : '"', - push : "qqstring_inner" - }], - - qstring_inner: [ - {token : "string", regex: "'", next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - qqstring_inner: [ - {token : "string", regex: '"', next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - attributes: [{ - token : "entity.other.attribute-name", - regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+" - }, { - token : "keyword.operator.separator", - regex : "=" - }, { - include : "space" - }, { - include : "string" - }] - }; - - if (this.constructor === XmlHighlightRules) - this.normalizeRules(); -}; - - -(function() { - - this.embedTagRules = function(HighlightRules, prefix, tag){ - this.$rules.tag.unshift({ - token : ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(<)(" + tag + ")", - next: [ - {include : "space"}, - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : prefix + "start"} - ] - }); - - this.$rules[tag + "-end"] = [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next: "start", - onMatch : function(value, currentState, stack) { - stack.splice(0); - return this.token; - }} - ] - - this.embedRules(HighlightRules, prefix, [{ - token: ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(" - }]); - }; - -}).call(TextHighlightRules.prototype); - -oop.inherits(XmlHighlightRules, TextHighlightRules); - -exports.XmlHighlightRules = XmlHighlightRules; -}); - -define('ace/mode/xml_util', ['require', 'exports', 'module' ], function(require, exports, module) { - - -function string(state) { - return [{ - token : "string", - regex : '"', - next : state + "_qqstring" - }, { - token : "string", - regex : "'", - next : state + "_qstring" - }]; -} - -function multiLineString(quote, state) { - return [ - {token : "string", regex : quote, next : state}, - { - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, - {defaultToken : "string"} - ]; -} - -exports.tag = function(states, name, nextState, tagMap) { - states[name] = [{ - token : "text", - regex : "\\s+" - }, { - - token : !tagMap ? "meta.tag.tag-name" : function(value) { - if (tagMap[value]) - return "meta.tag.tag-name." + tagMap[value]; - else - return "meta.tag.tag-name"; - }, - regex : "[-_a-zA-Z0-9:]+", - next : name + "_embed_attribute_list" - }, { - token: "empty", - regex: "", - next : 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"] = [{ - token : "meta.tag.r", - regex : "/?>", - next : nextState - }, { - token : "keyword.operator", - regex : "=" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "text", - regex : "\\s+" - }].concat(string(name)); -}; - -}); - -define('ace/mode/folding/velocity', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var BaseFoldMode = require("./fold_mode").FoldMode; -var Range = require("../../range").Range; - -var FoldMode = exports.FoldMode = function() {}; -oop.inherits(FoldMode, BaseFoldMode); - -(function() { - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var range = this.indentationBlock(session, row); - if (range) - return range; - - var re = /\S/; - var line = session.getLine(row); - var startLevel = line.search(re); - if (startLevel == -1 || line[startLevel] != "##") - return; - - var startColumn = line.length; - var maxRow = session.getLength(); - var startRow = row; - var endRow = row; - - while (++row < maxRow) { - line = session.getLine(row); - var level = line.search(re); - - if (level == -1) - continue; - - if (line[level] != "##") - break; - - endRow = row; - } - - if (endRow > startRow) { - var endColumn = session.getLine(endRow).length; - return new Range(startRow, startColumn, endRow, endColumn); - } - }; - this.getFoldWidget = function(session, foldStyle, row) { - var line = session.getLine(row); - var indent = line.search(/\S/); - var next = session.getLine(row + 1); - var prev = session.getLine(row - 1); - var prevIndent = prev.search(/\S/); - var nextIndent = next.search(/\S/); - - if (indent == -1) { - session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : ""; - return ""; - } - if (prevIndent == -1) { - if (indent == nextIndent && line[indent] == "##" && next[indent] == "##") { - session.foldWidgets[row - 1] = ""; - session.foldWidgets[row + 1] = ""; - return "start"; - } - } else if (prevIndent == indent && line[indent] == "##" && prev[indent] == "##") { - if (session.getLine(row - 2).search(/\S/) == -1) { - session.foldWidgets[row - 1] = "start"; - session.foldWidgets[row + 1] = ""; - return ""; - } - } - - if (prevIndent!= -1 && prevIndent < indent) - session.foldWidgets[row - 1] = "start"; - else - session.foldWidgets[row - 1] = ""; - - if (indent < nextIndent) - return "start"; - else - return ""; - }; - -}).call(FoldMode.prototype); - -}); - -define('ace/mode/behaviour/html', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour/xml', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var XmlBehaviour = require("../behaviour/xml").XmlBehaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; -var voidElements = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']; - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); - return hasType; -} - -var HtmlBehaviour = function () { - - this.inherit(XmlBehaviour); // Get xml behaviour - - this.add("autoclosing", "insertion", function (state, action, editor, session, text) { - if (text == '>') { - var position = editor.getCursorPosition(); - var iterator = new TokenIterator(session, position.row, position.column); - var token = iterator.getCurrentToken(); - - if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column) - return; - var atCursor = false; - if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text'))); - } else { - atCursor = true; - } - if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) { - return; - } - var element = token.value; - if (atCursor){ - var element = element.substring(0, position.column - token.start); - } - if (voidElements.indexOf(element) !== -1){ - return; - } - return { - text: '>' + '', - selection: [1, 1] - } - } - }); -} -oop.inherits(HtmlBehaviour, XmlBehaviour); - -exports.HtmlBehaviour = HtmlBehaviour; -}); - -define('ace/mode/behaviour/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); - return hasType; -} - -var XmlBehaviour = function () { - - this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour - - this.add("autoclosing", "insertion", function (state, action, editor, session, text) { - if (text == '>') { - var position = editor.getCursorPosition(); - var iterator = new TokenIterator(session, position.row, position.column); - var token = iterator.getCurrentToken(); - - if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column) - return; - var atCursor = false; - if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text'))); - } else { - atCursor = true; - } - if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) { - return; - } - var tag = token.value; - if (atCursor){ - var tag = tag.substring(0, position.column - token.start); - } - - return { - text: '>' + '', - selection: [1, 1] - } - } - }); - - this.add('autoindent', 'insertion', function (state, action, editor, session, text) { - if (text == "\n") { - var cursor = editor.getCursorPosition(); - var line = session.getLine(cursor.row); - var rightChars = line.substring(cursor.column, cursor.column + 2); - if (rightChars == ' -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); diff --git a/addons/editor/ace/mode-xml.js b/addons/editor/ace/mode-xml.js deleted file mode 100644 index d38801bf..00000000 --- a/addons/editor/ace/mode-xml.js +++ /dev/null @@ -1,931 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2010, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/mode/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/xml_highlight_rules', 'ace/mode/behaviour/xml', 'ace/mode/folding/xml'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; -var XmlBehaviour = require("./behaviour/xml").XmlBehaviour; -var XmlFoldMode = require("./folding/xml").FoldMode; - -var Mode = function() { - this.HighlightRules = XmlHighlightRules; - this.$behaviour = new XmlBehaviour(); - this.foldingRules = new XmlFoldMode(); -}; - -oop.inherits(Mode, TextMode); - -(function() { - - this.blockComment = {start: ""}; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/xml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml_util', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var xmlUtil = require("./xml_util"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var XmlHighlightRules = function(normalize) { - this.$rules = { - start : [ - {token : "punctuation.string.begin", regex : "<\\!\\[CDATA\\[", next : "cdata"}, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)(xml)(?=[\\s])", next : "xml_declaration" - }, - { - token : ["punctuation.instruction.begin", "keyword.instruction"], - regex : "(<\\?)([-_a-zA-Z0-9]+)", next : "instruction" - }, - {token : "comment", regex : "<\\!--", next : "comment"}, - { - token : ["punctuation.doctype.begin", "meta.tag.doctype"], - regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype" - }, - {include : "tag"}, - {include : "reference"} - ], - - xml_declaration : [ - {include : "attributes"}, - {include : "instruction"} - ], - - instruction : [ - {token : "punctuation.instruction.end", regex : "\\?>", next : "start"} - ], - - doctype : [ - {include : "space"}, - {include : "string"}, - {token : "punctuation.doctype.end", regex : ">", next : "start"}, - {token : "xml-pe", regex : "[-_a-zA-Z0-9:]+"}, - {token : "punctuation.begin", regex : "\\[", push : "declarations"} - ], - - declarations : [{ - token : "text", - regex : "\\s+" - }, { - token: "punctuation.end", - regex: "]", - next: "pop" - }, { - token : ["punctuation.begin", "keyword"], - regex : "(<\\!)([-_a-zA-Z0-9]+)", - push : [{ - token : "text", - regex : "\\s+" - }, - { - token : "punctuation.end", - regex : ">", - next : "pop" - }, - {include : "string"}] - }], - - cdata : [ - {token : "string.end", regex : "\\]\\]>", next : "start"}, - {token : "text", regex : "\\s+"}, - {token : "text", regex : "(?:[^\\]]|\\](?!\\]>))+"} - ], - - comment : [ - {token : "comment", regex : "-->", next : "start"}, - {defaultToken : "comment"} - ], - - tag : [{ - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(<)((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)", - next: [ - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : "start"} - ] - }, { - token : ["meta.tag.punctuation.begin", "meta.tag.name"], - regex : "(", next : "start"} - ] - }], - - space : [ - {token : "text", regex : "\\s+"} - ], - - reference : [{ - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, { - token : "invalid.illegal", regex : "&" - }], - - string: [{ - token : "string", - regex : "'", - push : "qstring_inner" - }, { - token : "string", - regex : '"', - push : "qqstring_inner" - }], - - qstring_inner: [ - {token : "string", regex: "'", next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - qqstring_inner: [ - {token : "string", regex: '"', next: "pop"}, - {include : "reference"}, - {defaultToken : "string"} - ], - - attributes: [{ - token : "entity.other.attribute-name", - regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+" - }, { - token : "keyword.operator.separator", - regex : "=" - }, { - include : "space" - }, { - include : "string" - }] - }; - - if (this.constructor === XmlHighlightRules) - this.normalizeRules(); -}; - - -(function() { - - this.embedTagRules = function(HighlightRules, prefix, tag){ - this.$rules.tag.unshift({ - token : ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(<)(" + tag + ")", - next: [ - {include : "space"}, - {include : "attributes"}, - {token : "meta.tag.punctuation.end", regex : "/?>", next : prefix + "start"} - ] - }); - - this.$rules[tag + "-end"] = [ - {include : "space"}, - {token : "meta.tag.punctuation.end", regex : ">", next: "start", - onMatch : function(value, currentState, stack) { - stack.splice(0); - return this.token; - }} - ] - - this.embedRules(HighlightRules, prefix, [{ - token: ["meta.tag.punctuation.begin", "meta.tag.name." + tag], - regex : "(" - }]); - }; - -}).call(TextHighlightRules.prototype); - -oop.inherits(XmlHighlightRules, TextHighlightRules); - -exports.XmlHighlightRules = XmlHighlightRules; -}); - -define('ace/mode/xml_util', ['require', 'exports', 'module' ], function(require, exports, module) { - - -function string(state) { - return [{ - token : "string", - regex : '"', - next : state + "_qqstring" - }, { - token : "string", - regex : "'", - next : state + "_qstring" - }]; -} - -function multiLineString(quote, state) { - return [ - {token : "string", regex : quote, next : state}, - { - token : "constant.language.escape", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" - }, - {defaultToken : "string"} - ]; -} - -exports.tag = function(states, name, nextState, tagMap) { - states[name] = [{ - token : "text", - regex : "\\s+" - }, { - - token : !tagMap ? "meta.tag.tag-name" : function(value) { - if (tagMap[value]) - return "meta.tag.tag-name." + tagMap[value]; - else - return "meta.tag.tag-name"; - }, - regex : "[-_a-zA-Z0-9:]+", - next : name + "_embed_attribute_list" - }, { - token: "empty", - regex: "", - next : 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"] = [{ - token : "meta.tag.r", - regex : "/?>", - next : nextState - }, { - token : "keyword.operator", - regex : "=" - }, { - token : "entity.other.attribute-name", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "text", - regex : "\\s+" - }].concat(string(name)); -}; - -}); - -define('ace/mode/behaviour/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Behaviour = require("../behaviour").Behaviour; -var CstyleBehaviour = require("./cstyle").CstyleBehaviour; -var TokenIterator = require("../../token_iterator").TokenIterator; - -function hasType(token, type) { - var tokenTypes = token.type.split('.'); - return type.split('.').every(function(type){ - return (tokenTypes.indexOf(type) !== -1); - }); - return hasType; -} - -var XmlBehaviour = function () { - - this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour - - this.add("autoclosing", "insertion", function (state, action, editor, session, text) { - if (text == '>') { - var position = editor.getCursorPosition(); - var iterator = new TokenIterator(session, position.row, position.column); - var token = iterator.getCurrentToken(); - - if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column) - return; - var atCursor = false; - if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ - do { - token = iterator.stepBackward(); - } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text'))); - } else { - atCursor = true; - } - if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) { - return; - } - var tag = token.value; - if (atCursor){ - var tag = tag.substring(0, position.column - token.start); - } - - return { - text: '>' + '', - selection: [1, 1] - } - } - }); - - this.add('autoindent', 'insertion', function (state, action, editor, session, text) { - if (text == "\n") { - var cursor = editor.getCursorPosition(); - var line = session.getLine(cursor.row); - var rightChars = line.substring(cursor.column, cursor.column + 2); - if (rightChars == ' -1; - }; - - CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) - autoInsertedBrackets = 0; - autoInsertedRow = cursor.row; - autoInsertedLineEnd = bracket + line.substr(cursor.column); - autoInsertedBrackets++; - }; - - CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (!this.isMaybeInsertedClosing(cursor, line)) - maybeInsertedBrackets = 0; - maybeInsertedRow = cursor.row; - maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; - maybeInsertedLineEnd = line.substr(cursor.column); - maybeInsertedBrackets++; - }; - - CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { - return autoInsertedBrackets > 0 && - cursor.row === autoInsertedRow && - bracket === autoInsertedLineEnd[0] && - line.substr(cursor.column) === autoInsertedLineEnd; - }; - - CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { - return maybeInsertedBrackets > 0 && - cursor.row === maybeInsertedRow && - line.substr(cursor.column) === maybeInsertedLineEnd && - line.substr(0, cursor.column) == maybeInsertedLineStart; - }; - - CstyleBehaviour.popAutoInsertedClosing = function() { - autoInsertedLineEnd = autoInsertedLineEnd.substr(1); - autoInsertedBrackets--; - }; - - CstyleBehaviour.clearMaybeInsertedClosing = function() { - maybeInsertedBrackets = 0; - maybeInsertedRow = -1; - }; - - this.add("braces", "insertion", function (state, action, editor, session, text) { - var cursor = editor.getCursorPosition(); - var line = session.doc.getLine(cursor.row); - if (text == '{') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { - return { - text: '{' + selected + '}', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - if (/[\]\}\)]/.test(line[cursor.column])) { - CstyleBehaviour.recordAutoInsert(editor, session, "}"); - return { - text: '{}', - selection: [1, 1] - }; - } else { - CstyleBehaviour.recordMaybeInsert(editor, session, "{"); - return { - text: '{', - selection: [1, 1] - }; - } - } - } else if (text == '}') { - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } else if (text == "\n" || text == "\r\n") { - var closing = ""; - if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { - closing = lang.stringRepeat("}", maybeInsertedBrackets); - CstyleBehaviour.clearMaybeInsertedClosing(); - } - var rightChar = line.substring(cursor.column, cursor.column + 1); - if (rightChar == '}' || closing !== "") { - var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); - if (!openBracePos) - return null; - - var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); - var next_indent = this.$getIndent(line); - - return { - text: '\n' + indent + '\n' + next_indent + closing, - 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; - } else { - maybeInsertedBrackets--; - } - } - }); - - this.add("parens", "insertion", function (state, action, editor, session, text) { - if (text == '(') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '(' + selected + ')', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, ")"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - 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("brackets", "insertion", function (state, action, editor, session, text) { - if (text == '[') { - var selection = editor.getSelectionRange(); - var selected = session.doc.getTextRange(selection); - if (selected !== "" && editor.getWrapBehavioursEnabled()) { - return { - text: '[' + selected + ']', - selection: false - }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { - CstyleBehaviour.recordAutoInsert(editor, session, "]"); - 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 && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { - CstyleBehaviour.popAutoInsertedClosing(); - return { - text: '', - selection: [1, 1] - }; - } - } - } - }); - - this.add("brackets", "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 !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { - 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); - if (leftChar == '\\') { - return null; - } - var tokens = session.getTokens(selection.start.row); - 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; - } - 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)))) { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; - return { - text: quote + quote, - selection: [1,1] - }; - } else if (token && token.type === "string") { - 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 == selected) { - range.end.column++; - return range; - } - } - }); - -}; - -oop.inherits(CstyleBehaviour, Behaviour); - -exports.CstyleBehaviour = CstyleBehaviour; -}); - -define('ace/mode/folding/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/range', 'ace/mode/folding/fold_mode', 'ace/token_iterator'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var lang = require("../../lib/lang"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; -var TokenIterator = require("../../token_iterator").TokenIterator; - -var FoldMode = exports.FoldMode = function(voidElements) { - BaseFoldMode.call(this); - this.voidElements = voidElements || {}; -}; -oop.inherits(FoldMode, BaseFoldMode); - -(function() { - - this.getFoldWidget = function(session, foldStyle, row) { - var tag = this._getFirstTagInLine(session, row); - - if (tag.closing) - return foldStyle == "markbeginend" ? "end" : ""; - - if (!tag.tagName || this.voidElements[tag.tagName.toLowerCase()]) - return ""; - - if (tag.selfClosing) - return ""; - - if (tag.value.indexOf("/" + tag.tagName) !== -1) - return ""; - - return "start"; - }; - - this._getFirstTagInLine = function(session, row) { - var tokens = session.getTokens(row); - var value = ""; - for (var i = 0; i < tokens.length; i++) { - var token = tokens[i]; - if (token.type.lastIndexOf("meta.tag", 0) === 0) - value += token.value; - else - value += lang.stringRepeat(" ", token.value.length); - } - - return this._parseTag(value); - }; - - this.tagRe = /^(\s*)(?)/; - this._parseTag = function(tag) { - - var match = tag.match(this.tagRe); - var column = 0; - - return { - value: tag, - match: match ? match[2] : "", - closing: match ? !!match[3] : false, - selfClosing: match ? !!match[5] || match[2] == "/>" : false, - tagName: match ? match[4] : "", - column: match[1] ? column + match[1].length : column - }; - }; - this._readTagForward = function(iterator) { - var token = iterator.getCurrentToken(); - if (!token) - return null; - - var value = ""; - var start; - - do { - if (token.type.lastIndexOf("meta.tag", 0) === 0) { - if (!start) { - var start = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() - }; - } - value += token.value; - if (value.indexOf(">") !== -1) { - var tag = this._parseTag(value); - tag.start = start; - tag.end = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() + token.value.length - }; - iterator.stepForward(); - return tag; - } - } - } while(token = iterator.stepForward()); - - return null; - }; - - this._readTagBackward = function(iterator) { - var token = iterator.getCurrentToken(); - if (!token) - return null; - - var value = ""; - var end; - - do { - if (token.type.lastIndexOf("meta.tag", 0) === 0) { - if (!end) { - end = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() + token.value.length - }; - } - value = token.value + value; - if (value.indexOf("<") !== -1) { - var tag = this._parseTag(value); - tag.end = end; - tag.start = { - row: iterator.getCurrentTokenRow(), - column: iterator.getCurrentTokenColumn() - }; - iterator.stepBackward(); - return tag; - } - } - } while(token = iterator.stepBackward()); - - return null; - }; - - this._pop = function(stack, tag) { - while (stack.length) { - - var top = stack[stack.length-1]; - if (!tag || top.tagName == tag.tagName) { - return stack.pop(); - } - else if (this.voidElements[tag.tagName]) { - return; - } - else if (this.voidElements[top.tagName]) { - stack.pop(); - continue; - } else { - return null; - } - } - }; - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var firstTag = this._getFirstTagInLine(session, row); - - if (!firstTag.match) - return null; - - var isBackward = firstTag.closing || firstTag.selfClosing; - var stack = []; - var tag; - - if (!isBackward) { - var iterator = new TokenIterator(session, row, firstTag.column); - var start = { - row: row, - column: firstTag.column + firstTag.tagName.length + 2 - }; - while (tag = this._readTagForward(iterator)) { - if (tag.selfClosing) { - if (!stack.length) { - tag.start.column += tag.tagName.length + 2; - tag.end.column -= 2; - return Range.fromPoints(tag.start, tag.end); - } else - continue; - } - - if (tag.closing) { - this._pop(stack, tag); - if (stack.length == 0) - return Range.fromPoints(start, tag.start); - } - else { - stack.push(tag) - } - } - } - else { - var iterator = new TokenIterator(session, row, firstTag.column + firstTag.match.length); - var end = { - row: row, - column: firstTag.column - }; - - while (tag = this._readTagBackward(iterator)) { - if (tag.selfClosing) { - if (!stack.length) { - tag.start.column += tag.tagName.length + 2; - tag.end.column -= 2; - return Range.fromPoints(tag.start, tag.end); - } else - continue; - } - - if (!tag.closing) { - this._pop(stack, tag); - if (stack.length == 0) { - tag.start.column += tag.tagName.length + 2; - return Range.fromPoints(tag.start, end); - } - } - else { - stack.push(tag) - } - } - } - - }; - -}).call(FoldMode.prototype); - -}); diff --git a/addons/editor/ace/mode-xquery.js b/addons/editor/ace/mode-xquery.js deleted file mode 100644 index 16c52f58..00000000 --- a/addons/editor/ace/mode-xquery.js +++ /dev/null @@ -1,2748 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Distributed under the BSD license: - * - * Copyright (c) 2010, Ajax.org B.V. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Ajax.org B.V. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ -define('ace/mode/xquery', ['require', 'exports', 'module' , 'ace/worker/worker_client', 'ace/lib/oop', 'ace/mode/text', 'ace/mode/xquery/XQueryLexer', 'ace/range', 'ace/mode/behaviour/xquery', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var WorkerClient = require("../worker/worker_client").WorkerClient; -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var XQueryLexer = require("./xquery/XQueryLexer").XQueryLexer; -var Range = require("../range").Range; -var XQueryBehaviour = require("./behaviour/xquery").XQueryBehaviour; -var CStyleFoldMode = require("./folding/cstyle").FoldMode; - - -var Mode = function() { - this.$tokenizer = new XQueryLexer(); - this.$behaviour = new XQueryBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; - -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.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 + ":)"); - } - }; - - this.createWorker = function(session) { - - var worker = new WorkerClient(["ace"], "ace/mode/xquery_worker", "XQueryWorker"); - var that = this; - - worker.attachToDocument(session.getDocument()); - - worker.on("error", function(e) { - session.setAnnotations([e.data]); - }); - - worker.on("ok", function(e) { - session.clearAnnotations(); - }); - - worker.on("highlight", function(tokens) { - that.$tokenizer.tokens = tokens.data.tokens; - that.$tokenizer.lines = session.getDocument().getAllLines(); - - var rows = Object.keys(that.$tokenizer.tokens); - for(var i=0; i < rows.length; i++) { - var row = parseInt(rows[i]); - delete session.bgTokenizer.lines[row]; - delete session.bgTokenizer.states[row]; - session.bgTokenizer.fireUpdateEvent(row, row); - } - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/xquery/XQueryLexer', ['require', 'exports', 'module' , 'ace/mode/xquery/XQueryTokenizer'], function(require, exports, module) { - - var XQueryTokenizer = require("./XQueryTokenizer").XQueryTokenizer; - - var TokenHandler = function(code) { - - var input = code; - - this.tokens = []; - - this.reset = function(code) { - input = input; - this.tokens = []; - }; - - this.startNonterminal = function(name, begin) {}; - - this.endNonterminal = function(name, end) {}; - - this.terminal = function(name, begin, end) { - this.tokens.push({ - name: name, - value: input.substring(begin, end) - }); - }; - - this.whitespace = function(begin, end) { - this.tokens.push({ - name: "WS", - value: input.substring(begin, end) - }); - }; - }; - - var keys = "after|ancestor|ancestor-or-self|and|as|ascending|attribute|before|case|cast|castable|child|collation|comment|copy|count|declare|default|delete|descendant|descendant-or-self|descending|div|document|document-node|element|else|empty|empty-sequence|end|eq|every|except|first|following|following-sibling|for|function|ge|group|gt|idiv|if|import|insert|instance|intersect|into|is|item|last|le|let|lt|mod|modify|module|namespace|namespace-node|ne|node|only|or|order|ordered|parent|preceding|preceding-sibling|processing-instruction|rename|replace|return|satisfies|schema-attribute|schema-element|self|some|stable|start|switch|text|to|treat|try|typeswitch|union|unordered|validate|where|with|xquery|contains|paragraphs|sentences|times|words|by|collectionreturn|variable|version|option|when|encoding|toswitch|catch|tumbling|sliding|window|at|using|stemming|collection|schema|while|on|nodes|index|external|then|in|updating|value|of|containsbreak|loop|continue|exit|returning|append|json|position|strict".split("|"); - var keywords = keys.map( - function(val) { return { name: "'" + val + "'", token: "keyword" }; } - ); - - var ncnames = keys.map( - function(val) { return { name: "'" + val + "'", token: "text", next: function(stack){ stack.pop(); } }; } - ); - - var cdata = "constant.language"; - var number = "constant"; - var xmlcomment = "comment"; - var pi = "xml-pe"; - var pragma = "constant.buildin"; - - var Rules = { - start: [ - { name: "'(#'", token: pragma, next: function(stack){ stack.push("Pragma"); } }, - { name: "'(:'", token: "comment", next: function(stack){ stack.push("Comment"); } }, - { name: "'(:~'", token: "comment.doc", next: function(stack){ stack.push("CommentDoc"); } }, - { name: "''", token: xmlcomment, next: function(stack){ stack.pop(); } } - ], - CData: [ - { name: "CDataSectionContents", token: cdata }, - { name: "']]>'", token: cdata, next: function(stack){ stack.pop(); } } - ], - PI: [ - { name: "DirPIContents", token: pi }, - { name: "'?'", token: pi }, - { name: "'?>'", token: pi, next: function(stack){ stack.pop(); } } - ], - AposString: [ - { name: "''''", token: "string", next: function(stack){ stack.pop(); } }, - { name: "PredefinedEntityRef", token: "constant.language.escape" }, - { name: "CharRef", token: "constant.language.escape" }, - { name: "EscapeApos", token: "constant.language.escape" }, - { name: "AposChar", token: "string" } - ], - QuotString: [ - { name: "'\"'", token: "string", next: function(stack){ stack.pop(); } }, - { name: "PredefinedEntityRef", token: "constant.language.escape" }, - { name: "CharRef", token: "constant.language.escape" }, - { name: "EscapeQuot", token: "constant.language.escape" }, - { name: "QuotChar", token: "string" } - ] - }; - -exports.XQueryLexer = function() { - - this.tokens = []; - - this.getLineTokens = function(line, state, row) { - state = (state === "start" || !state) ? '["start"]' : state; - var stack = JSON.parse(state); - var h = new TokenHandler(line); - var tokenizer = new XQueryTokenizer(line, h); - var tokens = []; - - while(true) { - var currentState = stack[stack.length - 1]; - try { - - h.tokens = []; - tokenizer["parse_" + currentState](); - var info = null; - - if(h.tokens.length > 1 && h.tokens[0].name === "WS") { - tokens.push({ - type: "text", - value: h.tokens[0].value - }); - h.tokens.splice(0, 1); - } - - var token = h.tokens[0]; - var rules = Rules[currentState]; - for(var k = 0; k < rules.length; k++) { - var rule = Rules[currentState][k]; - if((typeof(rule.name) === "function" && rule.name(token)) || rule.name === token.name) { - info = rule; - break; - } - } - - if(token.name === "EOF") { break; } - if(token.value === "") { throw "Encountered empty string lexical rule."; } - - tokens.push({ - type: info === null ? "text" : (typeof(info.token) === "function" ? info.token(token.value) : info.token), - value: token.value - }); - - if(info && info.next) { - info.next(stack); - } - - } catch(e) { - if(e instanceof tokenizer.ParseException) { - var index = 0; - for(var i=0; i < tokens.length; i++) { - index += tokens[i].value.length; - } - tokens.push({ type: "text", value: line.substring(index) }); - return { - tokens: tokens, - state: JSON.stringify(["start"]) - }; - } else { - throw e; - } - } - } - - - if(this.tokens[row] !== undefined) { - var cachedLine = this.lines[row]; - var begin = sharedStart([line, cachedLine]); - var diff = cachedLine.length - line.length; - var idx = 0; - var col = 0; - for(var i = 0; i < tokens.length; i++) { - var token = tokens[i]; - for(var j = 0; j < this.tokens[row].length; j++) { - var semanticToken = this.tokens[row][j]; - if( - ((col + token.value.length) <= begin.length && semanticToken.sc === col && semanticToken.ec === (col + token.value.length)) || - (semanticToken.sc === (col + diff) && semanticToken.ec === (col + token.value.length + diff)) - ) { - idx = i; - tokens[i].type = semanticToken.type; - } - } - col += token.value.length; - } - } - - return { - tokens: tokens, - state: JSON.stringify(stack) - }; - }; - - function sharedStart(A) { - var tem1, tem2, s, A = A.slice(0).sort(); - tem1 = A[0]; - s = tem1.length; - tem2 = A.pop(); - while(s && tem2.indexOf(tem1) == -1) { - tem1 = tem1.substring(0, --s); - } - return tem1; - } -}; -}); - - define('ace/mode/xquery/XQueryTokenizer', ['require', 'exports', 'module' ], function(require, exports, module) { - var XQueryTokenizer = exports.XQueryTokenizer = function XQueryTokenizer(string, parsingEventHandler) - { - init(string, parsingEventHandler); - var self = this; - - this.ParseException = function(b, e, s, o, x) - { - var - begin = b, - end = e, - state = s, - offending = o, - expected = x; - - this.getBegin = function() {return begin;}; - this.getEnd = function() {return end;}; - this.getState = function() {return state;}; - this.getExpected = function() {return expected;}; - this.getOffending = function() {return offending;}; - - this.getMessage = function() - { - return offending < 0 ? "lexical analysis failed" : "syntax error"; - }; - }; - - function init(string, parsingEventHandler) - { - eventHandler = parsingEventHandler; - input = string; - size = string.length; - reset(0, 0, 0); - } - - this.getInput = function() - { - return input; - }; - - function reset(l, b, e) - { - b0 = b; e0 = b; - l1 = l; b1 = b; e1 = e; - end = e; - eventHandler.reset(input); - } - - this.getOffendingToken = function(e) - { - var o = e.getOffending(); - return o >= 0 ? XQueryTokenizer.TOKEN[o] : null; - }; - - this.getExpectedTokenSet = function(e) - { - var expected; - if (e.getExpected() < 0) - { - expected = XQueryTokenizer.getTokenSet(- e.getState()); - } - else - { - expected = [XQueryTokenizer.TOKEN[e.getExpected()]]; - } - return expected; - }; - - this.getErrorMessage = function(e) - { - var tokenSet = this.getExpectedTokenSet(e); - var found = this.getOffendingToken(e); - var prefix = input.substring(0, e.getBegin()); - var lines = prefix.split("\n"); - var line = lines.length; - var column = lines[line - 1].length + 1; - var size = e.getEnd() - e.getBegin(); - return e.getMessage() - + (found == null ? "" : ", found " + found) - + "\nwhile expecting " - + (tokenSet.length == 1 ? tokenSet[0] : ("[" + tokenSet.join(", ") + "]")) - + "\n" - + (size == 0 || found != null ? "" : "after successfully scanning " + size + " characters beginning ") - + "at line " + line + ", column " + column + ":\n..." - + input.substring(e.getBegin(), Math.min(input.length, e.getBegin() + 64)) - + "..."; - }; - - this.parse_start = function() - { - eventHandler.startNonterminal("start", e0); - lookahead1W(14); // ModuleDecl | Annotation | OptionDecl | Operator | Variable | Tag | AttrTest | - switch (l1) - { - case 55: // '' | '=' | '>' - switch (l1) - { - case 58: // '>' - shift(58); // '>' - break; - case 50: // '/>' - shift(50); // '/>' - break; - case 27: // QName - shift(27); // QName - break; - case 57: // '=' - shift(57); // '=' - break; - case 35: // '"' - shift(35); // '"' - break; - case 38: // "'" - shift(38); // "'" - break; - default: - shift(33); // EOF - } - eventHandler.endNonterminal("StartTag", e0); - }; - - this.parse_TagContent = function() - { - eventHandler.startNonterminal("TagContent", e0); - lookahead1(11); // Tag | EndTag | PredefinedEntityRef | ElementContentChar | CharRef | EOF | - switch (l1) - { - case 23: // ElementContentChar - shift(23); // ElementContentChar - break; - case 6: // Tag - shift(6); // Tag - break; - case 7: // EndTag - shift(7); // EndTag - break; - case 55: // '' - switch (l1) - { - case 11: // CDataSectionContents - shift(11); // CDataSectionContents - break; - case 64: // ']]>' - shift(64); // ']]>' - break; - default: - shift(33); // EOF - } - eventHandler.endNonterminal("CData", e0); - }; - - this.parse_XMLComment = function() - { - eventHandler.startNonterminal("XMLComment", e0); - lookahead1(0); // DirCommentContents | EOF | '-->' - switch (l1) - { - case 9: // DirCommentContents - shift(9); // DirCommentContents - break; - case 47: // '-->' - shift(47); // '-->' - break; - default: - shift(33); // EOF - } - eventHandler.endNonterminal("XMLComment", e0); - }; - - this.parse_PI = function() - { - eventHandler.startNonterminal("PI", e0); - lookahead1(3); // DirPIContents | EOF | '?' | '?>' - switch (l1) - { - case 10: // DirPIContents - shift(10); // DirPIContents - break; - case 59: // '?' - shift(59); // '?' - break; - case 60: // '?>' - shift(60); // '?>' - break; - default: - shift(33); // EOF - } - eventHandler.endNonterminal("PI", e0); - }; - - this.parse_Pragma = function() - { - eventHandler.startNonterminal("Pragma", e0); - lookahead1(2); // PragmaContents | EOF | '#' | '#)' - switch (l1) - { - case 8: // PragmaContents - shift(8); // PragmaContents - break; - case 36: // '#' - shift(36); // '#' - break; - case 37: // '#)' - shift(37); // '#)' - break; - default: - shift(33); // EOF - } - eventHandler.endNonterminal("Pragma", e0); - }; - - this.parse_Comment = function() - { - eventHandler.startNonterminal("Comment", e0); - lookahead1(4); // CommentContents | EOF | '(:' | ':)' - switch (l1) - { - case 52: // ':)' - shift(52); // ':)' - break; - case 41: // '(:' - shift(41); // '(:' - break; - case 30: // CommentContents - shift(30); // CommentContents - break; - default: - shift(33); // EOF - } - eventHandler.endNonterminal("Comment", e0); - }; - - this.parse_CommentDoc = function() - { - eventHandler.startNonterminal("CommentDoc", e0); - lookahead1(5); // DocTag | DocCommentContents | EOF | '(:' | ':)' - switch (l1) - { - case 31: // DocTag - shift(31); // DocTag - break; - case 32: // DocCommentContents - shift(32); // DocCommentContents - break; - case 52: // ':)' - shift(52); // ':)' - break; - case 41: // '(:' - shift(41); // '(:' - break; - default: - shift(33); // EOF - } - eventHandler.endNonterminal("CommentDoc", e0); - }; - - this.parse_QuotString = function() - { - eventHandler.startNonterminal("QuotString", e0); - lookahead1(6); // PredefinedEntityRef | EscapeQuot | QuotChar | CharRef | EOF | '"' - switch (l1) - { - case 18: // PredefinedEntityRef - shift(18); // PredefinedEntityRef - break; - case 29: // CharRef - shift(29); // CharRef - break; - case 19: // EscapeQuot - shift(19); // EscapeQuot - break; - case 21: // QuotChar - shift(21); // QuotChar - break; - case 35: // '"' - shift(35); // '"' - break; - default: - shift(33); // EOF - } - eventHandler.endNonterminal("QuotString", e0); - }; - - this.parse_AposString = function() - { - eventHandler.startNonterminal("AposString", e0); - lookahead1(7); // PredefinedEntityRef | EscapeApos | AposChar | CharRef | EOF | "'" - switch (l1) - { - case 18: // PredefinedEntityRef - shift(18); // PredefinedEntityRef - break; - case 29: // CharRef - shift(29); // CharRef - break; - case 20: // EscapeApos - shift(20); // EscapeApos - break; - case 22: // AposChar - shift(22); // AposChar - break; - case 38: // "'" - shift(38); // "'" - break; - default: - shift(33); // EOF - } - eventHandler.endNonterminal("AposString", e0); - }; - - this.parse_Prefix = function() - { - eventHandler.startNonterminal("Prefix", e0); - lookahead1W(13); // NCName^Token | S^WS | 'after' | 'allowing' | 'ancestor' | 'ancestor-or-self' | - whitespace(); - parse_NCName(); - eventHandler.endNonterminal("Prefix", e0); - }; - - this.parse__EQName = function() - { - eventHandler.startNonterminal("_EQName", e0); - lookahead1W(12); // EQName^Token | S^WS | 'after' | 'allowing' | 'ancestor' | 'ancestor-or-self' | - whitespace(); - parse_EQName(); - eventHandler.endNonterminal("_EQName", e0); - }; - - function parse_EQName() - { - eventHandler.startNonterminal("EQName", e0); - switch (l1) - { - case 77: // 'attribute' - shift(77); // 'attribute' - break; - case 91: // 'comment' - shift(91); // 'comment' - break; - case 115: // 'document-node' - shift(115); // 'document-node' - break; - case 116: // 'element' - shift(116); // 'element' - break; - case 119: // 'empty-sequence' - shift(119); // 'empty-sequence' - break; - case 140: // 'function' - shift(140); // 'function' - break; - case 147: // 'if' - shift(147); // 'if' - break; - case 160: // 'item' - shift(160); // 'item' - break; - case 180: // 'namespace-node' - shift(180); // 'namespace-node' - break; - case 186: // 'node' - shift(186); // 'node' - break; - case 211: // 'processing-instruction' - shift(211); // 'processing-instruction' - break; - case 221: // 'schema-attribute' - shift(221); // 'schema-attribute' - break; - case 222: // 'schema-element' - shift(222); // 'schema-element' - break; - case 238: // 'switch' - shift(238); // 'switch' - break; - case 239: // 'text' - shift(239); // 'text' - break; - case 248: // 'typeswitch' - shift(248); // 'typeswitch' - break; - default: - parse_FunctionName(); - } - eventHandler.endNonterminal("EQName", e0); - } - - function parse_FunctionName() - { - eventHandler.startNonterminal("FunctionName", e0); - switch (l1) - { - case 14: // EQName^Token - shift(14); // EQName^Token - break; - case 65: // 'after' - shift(65); // 'after' - break; - case 68: // 'ancestor' - shift(68); // 'ancestor' - break; - case 69: // 'ancestor-or-self' - shift(69); // 'ancestor-or-self' - break; - case 70: // 'and' - shift(70); // 'and' - break; - case 74: // 'as' - shift(74); // 'as' - break; - case 75: // 'ascending' - shift(75); // 'ascending' - break; - case 79: // 'before' - shift(79); // 'before' - break; - case 83: // 'case' - shift(83); // 'case' - break; - case 84: // 'cast' - shift(84); // 'cast' - break; - case 85: // 'castable' - shift(85); // 'castable' - break; - case 88: // 'child' - shift(88); // 'child' - break; - case 89: // 'collation' - shift(89); // 'collation' - break; - case 98: // 'copy' - shift(98); // 'copy' - break; - case 100: // 'count' - shift(100); // 'count' - break; - case 103: // 'declare' - shift(103); // 'declare' - break; - case 104: // 'default' - shift(104); // 'default' - break; - case 105: // 'delete' - shift(105); // 'delete' - break; - case 106: // 'descendant' - shift(106); // 'descendant' - break; - case 107: // 'descendant-or-self' - shift(107); // 'descendant-or-self' - break; - case 108: // 'descending' - shift(108); // 'descending' - break; - case 113: // 'div' - shift(113); // 'div' - break; - case 114: // 'document' - shift(114); // 'document' - break; - case 117: // 'else' - shift(117); // 'else' - break; - case 118: // 'empty' - shift(118); // 'empty' - break; - case 121: // 'end' - shift(121); // 'end' - break; - case 123: // 'eq' - shift(123); // 'eq' - break; - case 124: // 'every' - shift(124); // 'every' - break; - case 126: // 'except' - shift(126); // 'except' - break; - case 129: // 'first' - shift(129); // 'first' - break; - case 130: // 'following' - shift(130); // 'following' - break; - case 131: // 'following-sibling' - shift(131); // 'following-sibling' - break; - case 132: // 'for' - shift(132); // 'for' - break; - case 141: // 'ge' - shift(141); // 'ge' - break; - case 143: // 'group' - shift(143); // 'group' - break; - case 145: // 'gt' - shift(145); // 'gt' - break; - case 146: // 'idiv' - shift(146); // 'idiv' - break; - case 148: // 'import' - shift(148); // 'import' - break; - case 154: // 'insert' - shift(154); // 'insert' - break; - case 155: // 'instance' - shift(155); // 'instance' - break; - case 157: // 'intersect' - shift(157); // 'intersect' - break; - case 158: // 'into' - shift(158); // 'into' - break; - case 159: // 'is' - shift(159); // 'is' - break; - case 165: // 'last' - shift(165); // 'last' - break; - case 167: // 'le' - shift(167); // 'le' - break; - case 169: // 'let' - shift(169); // 'let' - break; - case 173: // 'lt' - shift(173); // 'lt' - break; - case 175: // 'mod' - shift(175); // 'mod' - break; - case 176: // 'modify' - shift(176); // 'modify' - break; - case 177: // 'module' - shift(177); // 'module' - break; - case 179: // 'namespace' - shift(179); // 'namespace' - break; - case 181: // 'ne' - shift(181); // 'ne' - break; - case 193: // 'only' - shift(193); // 'only' - break; - case 195: // 'or' - shift(195); // 'or' - break; - case 196: // 'order' - shift(196); // 'order' - break; - case 197: // 'ordered' - shift(197); // 'ordered' - break; - case 201: // 'parent' - shift(201); // 'parent' - break; - case 207: // 'preceding' - shift(207); // 'preceding' - break; - case 208: // 'preceding-sibling' - shift(208); // 'preceding-sibling' - break; - case 213: // 'rename' - shift(213); // 'rename' - break; - case 214: // 'replace' - shift(214); // 'replace' - break; - case 215: // 'return' - shift(215); // 'return' - break; - case 219: // 'satisfies' - shift(219); // 'satisfies' - break; - case 224: // 'self' - shift(224); // 'self' - break; - case 230: // 'some' - shift(230); // 'some' - break; - case 231: // 'stable' - shift(231); // 'stable' - break; - case 232: // 'start' - shift(232); // 'start' - break; - case 243: // 'to' - shift(243); // 'to' - break; - case 244: // 'treat' - shift(244); // 'treat' - break; - case 245: // 'try' - shift(245); // 'try' - break; - case 249: // 'union' - shift(249); // 'union' - break; - case 251: // 'unordered' - shift(251); // 'unordered' - break; - case 255: // 'validate' - shift(255); // 'validate' - break; - case 261: // 'where' - shift(261); // 'where' - break; - case 265: // 'with' - shift(265); // 'with' - break; - case 269: // 'xquery' - shift(269); // 'xquery' - break; - case 67: // 'allowing' - shift(67); // 'allowing' - break; - case 76: // 'at' - shift(76); // 'at' - break; - case 78: // 'base-uri' - shift(78); // 'base-uri' - break; - case 80: // 'boundary-space' - shift(80); // 'boundary-space' - break; - case 81: // 'break' - shift(81); // 'break' - break; - case 86: // 'catch' - shift(86); // 'catch' - break; - case 93: // 'construction' - shift(93); // 'construction' - break; - case 96: // 'context' - shift(96); // 'context' - break; - case 97: // 'continue' - shift(97); // 'continue' - break; - case 99: // 'copy-namespaces' - shift(99); // 'copy-namespaces' - break; - case 101: // 'decimal-format' - shift(101); // 'decimal-format' - break; - case 120: // 'encoding' - shift(120); // 'encoding' - break; - case 127: // 'exit' - shift(127); // 'exit' - break; - case 128: // 'external' - shift(128); // 'external' - break; - case 136: // 'ft-option' - shift(136); // 'ft-option' - break; - case 149: // 'in' - shift(149); // 'in' - break; - case 150: // 'index' - shift(150); // 'index' - break; - case 156: // 'integrity' - shift(156); // 'integrity' - break; - case 166: // 'lax' - shift(166); // 'lax' - break; - case 187: // 'nodes' - shift(187); // 'nodes' - break; - case 194: // 'option' - shift(194); // 'option' - break; - case 198: // 'ordering' - shift(198); // 'ordering' - break; - case 217: // 'revalidation' - shift(217); // 'revalidation' - break; - case 220: // 'schema' - shift(220); // 'schema' - break; - case 223: // 'score' - shift(223); // 'score' - break; - case 229: // 'sliding' - shift(229); // 'sliding' - break; - case 235: // 'strict' - shift(235); // 'strict' - break; - case 246: // 'tumbling' - shift(246); // 'tumbling' - break; - case 247: // 'type' - shift(247); // 'type' - break; - case 252: // 'updating' - shift(252); // 'updating' - break; - case 256: // 'value' - shift(256); // 'value' - break; - case 257: // 'variable' - shift(257); // 'variable' - break; - case 258: // 'version' - shift(258); // 'version' - break; - case 262: // 'while' - shift(262); // 'while' - break; - case 92: // 'constraint' - shift(92); // 'constraint' - break; - case 171: // 'loop' - shift(171); // 'loop' - break; - default: - shift(216); // 'returning' - } - eventHandler.endNonterminal("FunctionName", e0); - } - - function parse_NCName() - { - eventHandler.startNonterminal("NCName", e0); - switch (l1) - { - case 26: // NCName^Token - shift(26); // NCName^Token - break; - case 65: // 'after' - shift(65); // 'after' - break; - case 70: // 'and' - shift(70); // 'and' - break; - case 74: // 'as' - shift(74); // 'as' - break; - case 75: // 'ascending' - shift(75); // 'ascending' - break; - case 79: // 'before' - shift(79); // 'before' - break; - case 83: // 'case' - shift(83); // 'case' - break; - case 84: // 'cast' - shift(84); // 'cast' - break; - case 85: // 'castable' - shift(85); // 'castable' - break; - case 89: // 'collation' - shift(89); // 'collation' - break; - case 100: // 'count' - shift(100); // 'count' - break; - case 104: // 'default' - shift(104); // 'default' - break; - case 108: // 'descending' - shift(108); // 'descending' - break; - case 113: // 'div' - shift(113); // 'div' - break; - case 117: // 'else' - shift(117); // 'else' - break; - case 118: // 'empty' - shift(118); // 'empty' - break; - case 121: // 'end' - shift(121); // 'end' - break; - case 123: // 'eq' - shift(123); // 'eq' - break; - case 126: // 'except' - shift(126); // 'except' - break; - case 132: // 'for' - shift(132); // 'for' - break; - case 141: // 'ge' - shift(141); // 'ge' - break; - case 143: // 'group' - shift(143); // 'group' - break; - case 145: // 'gt' - shift(145); // 'gt' - break; - case 146: // 'idiv' - shift(146); // 'idiv' - break; - case 155: // 'instance' - shift(155); // 'instance' - break; - case 157: // 'intersect' - shift(157); // 'intersect' - break; - case 158: // 'into' - shift(158); // 'into' - break; - case 159: // 'is' - shift(159); // 'is' - break; - case 167: // 'le' - shift(167); // 'le' - break; - case 169: // 'let' - shift(169); // 'let' - break; - case 173: // 'lt' - shift(173); // 'lt' - break; - case 175: // 'mod' - shift(175); // 'mod' - break; - case 176: // 'modify' - shift(176); // 'modify' - break; - case 181: // 'ne' - shift(181); // 'ne' - break; - case 193: // 'only' - shift(193); // 'only' - break; - case 195: // 'or' - shift(195); // 'or' - break; - case 196: // 'order' - shift(196); // 'order' - break; - case 215: // 'return' - shift(215); // 'return' - break; - case 219: // 'satisfies' - shift(219); // 'satisfies' - break; - case 231: // 'stable' - shift(231); // 'stable' - break; - case 232: // 'start' - shift(232); // 'start' - break; - case 243: // 'to' - shift(243); // 'to' - break; - case 244: // 'treat' - shift(244); // 'treat' - break; - case 249: // 'union' - shift(249); // 'union' - break; - case 261: // 'where' - shift(261); // 'where' - break; - case 265: // 'with' - shift(265); // 'with' - break; - case 68: // 'ancestor' - shift(68); // 'ancestor' - break; - case 69: // 'ancestor-or-self' - shift(69); // 'ancestor-or-self' - break; - case 77: // 'attribute' - shift(77); // 'attribute' - break; - case 88: // 'child' - shift(88); // 'child' - break; - case 91: // 'comment' - shift(91); // 'comment' - break; - case 98: // 'copy' - shift(98); // 'copy' - break; - case 103: // 'declare' - shift(103); // 'declare' - break; - case 105: // 'delete' - shift(105); // 'delete' - break; - case 106: // 'descendant' - shift(106); // 'descendant' - break; - case 107: // 'descendant-or-self' - shift(107); // 'descendant-or-self' - break; - case 114: // 'document' - shift(114); // 'document' - break; - case 115: // 'document-node' - shift(115); // 'document-node' - break; - case 116: // 'element' - shift(116); // 'element' - break; - case 119: // 'empty-sequence' - shift(119); // 'empty-sequence' - break; - case 124: // 'every' - shift(124); // 'every' - break; - case 129: // 'first' - shift(129); // 'first' - break; - case 130: // 'following' - shift(130); // 'following' - break; - case 131: // 'following-sibling' - shift(131); // 'following-sibling' - break; - case 140: // 'function' - shift(140); // 'function' - break; - case 147: // 'if' - shift(147); // 'if' - break; - case 148: // 'import' - shift(148); // 'import' - break; - case 154: // 'insert' - shift(154); // 'insert' - break; - case 160: // 'item' - shift(160); // 'item' - break; - case 165: // 'last' - shift(165); // 'last' - break; - case 177: // 'module' - shift(177); // 'module' - break; - case 179: // 'namespace' - shift(179); // 'namespace' - break; - case 180: // 'namespace-node' - shift(180); // 'namespace-node' - break; - case 186: // 'node' - shift(186); // 'node' - break; - case 197: // 'ordered' - shift(197); // 'ordered' - break; - case 201: // 'parent' - shift(201); // 'parent' - break; - case 207: // 'preceding' - shift(207); // 'preceding' - break; - case 208: // 'preceding-sibling' - shift(208); // 'preceding-sibling' - break; - case 211: // 'processing-instruction' - shift(211); // 'processing-instruction' - break; - case 213: // 'rename' - shift(213); // 'rename' - break; - case 214: // 'replace' - shift(214); // 'replace' - break; - case 221: // 'schema-attribute' - shift(221); // 'schema-attribute' - break; - case 222: // 'schema-element' - shift(222); // 'schema-element' - break; - case 224: // 'self' - shift(224); // 'self' - break; - case 230: // 'some' - shift(230); // 'some' - break; - case 238: // 'switch' - shift(238); // 'switch' - break; - case 239: // 'text' - shift(239); // 'text' - break; - case 245: // 'try' - shift(245); // 'try' - break; - case 248: // 'typeswitch' - shift(248); // 'typeswitch' - break; - case 251: // 'unordered' - shift(251); // 'unordered' - break; - case 255: // 'validate' - shift(255); // 'validate' - break; - case 257: // 'variable' - shift(257); // 'variable' - break; - case 269: // 'xquery' - shift(269); // 'xquery' - break; - case 67: // 'allowing' - shift(67); // 'allowing' - break; - case 76: // 'at' - shift(76); // 'at' - break; - case 78: // 'base-uri' - shift(78); // 'base-uri' - break; - case 80: // 'boundary-space' - shift(80); // 'boundary-space' - break; - case 81: // 'break' - shift(81); // 'break' - break; - case 86: // 'catch' - shift(86); // 'catch' - break; - case 93: // 'construction' - shift(93); // 'construction' - break; - case 96: // 'context' - shift(96); // 'context' - break; - case 97: // 'continue' - shift(97); // 'continue' - break; - case 99: // 'copy-namespaces' - shift(99); // 'copy-namespaces' - break; - case 101: // 'decimal-format' - shift(101); // 'decimal-format' - break; - case 120: // 'encoding' - shift(120); // 'encoding' - break; - case 127: // 'exit' - shift(127); // 'exit' - break; - case 128: // 'external' - shift(128); // 'external' - break; - case 136: // 'ft-option' - shift(136); // 'ft-option' - break; - case 149: // 'in' - shift(149); // 'in' - break; - case 150: // 'index' - shift(150); // 'index' - break; - case 156: // 'integrity' - shift(156); // 'integrity' - break; - case 166: // 'lax' - shift(166); // 'lax' - break; - case 187: // 'nodes' - shift(187); // 'nodes' - break; - case 194: // 'option' - shift(194); // 'option' - break; - case 198: // 'ordering' - shift(198); // 'ordering' - break; - case 217: // 'revalidation' - shift(217); // 'revalidation' - break; - case 220: // 'schema' - shift(220); // 'schema' - break; - case 223: // 'score' - shift(223); // 'score' - break; - case 229: // 'sliding' - shift(229); // 'sliding' - break; - case 235: // 'strict' - shift(235); // 'strict' - break; - case 246: // 'tumbling' - shift(246); // 'tumbling' - break; - case 247: // 'type' - shift(247); // 'type' - break; - case 252: // 'updating' - shift(252); // 'updating' - break; - case 256: // 'value' - shift(256); // 'value' - break; - case 258: // 'version' - shift(258); // 'version' - break; - case 262: // 'while' - shift(262); // 'while' - break; - case 92: // 'constraint' - shift(92); // 'constraint' - break; - case 171: // 'loop' - shift(171); // 'loop' - break; - default: - shift(216); // 'returning' - } - eventHandler.endNonterminal("NCName", e0); - } - - function shift(t) - { - if (l1 == t) - { - whitespace(); - eventHandler.terminal(XQueryTokenizer.TOKEN[l1], b1, e1 > size ? size : e1); - b0 = b1; e0 = e1; l1 = 0; - } - else - { - error(b1, e1, 0, l1, t); - } - } - - function whitespace() - { - if (e0 != b1) - { - b0 = e0; - e0 = b1; - eventHandler.whitespace(b0, e0); - } - } - - function matchW(set) - { - var code; - for (;;) - { - code = match(set); - if (code != 28) // S^WS - { - break; - } - } - return code; - } - - function lookahead1W(set) - { - if (l1 == 0) - { - l1 = matchW(set); - b1 = begin; - e1 = end; - } - } - - function lookahead1(set) - { - if (l1 == 0) - { - l1 = match(set); - b1 = begin; - e1 = end; - } - } - - function error(b, e, s, l, t) - { - throw new self.ParseException(b, e, s, l, t); - } - - var lk, b0, e0; - var l1, b1, e1; - var eventHandler; - - var input; - var size; - var begin; - var end; - - function match(tokenSetId) - { - var nonbmp = false; - begin = end; - var current = end; - var result = XQueryTokenizer.INITIAL[tokenSetId]; - var state = 0; - - for (var code = result & 4095; code != 0; ) - { - var charclass; - var c0 = current < size ? input.charCodeAt(current) : 0; - ++current; - if (c0 < 0x80) - { - charclass = XQueryTokenizer.MAP0[c0]; - } - else if (c0 < 0xd800) - { - var c1 = c0 >> 4; - charclass = XQueryTokenizer.MAP1[(c0 & 15) + XQueryTokenizer.MAP1[(c1 & 31) + XQueryTokenizer.MAP1[c1 >> 5]]]; - } - else - { - if (c0 < 0xdc00) - { - var c1 = current < size ? input.charCodeAt(current) : 0; - if (c1 >= 0xdc00 && c1 < 0xe000) - { - ++current; - c0 = ((c0 & 0x3ff) << 10) + (c1 & 0x3ff) + 0x10000; - nonbmp = true; - } - } - var lo = 0, hi = 5; - for (var m = 3; ; m = (hi + lo) >> 1) - { - if (XQueryTokenizer.MAP2[m] > c0) hi = m - 1; - else if (XQueryTokenizer.MAP2[6 + m] < c0) lo = m + 1; - else {charclass = XQueryTokenizer.MAP2[12 + m]; break;} - if (lo > hi) {charclass = 0; break;} - } - } - - state = code; - var i0 = (charclass << 12) + code - 1; - code = XQueryTokenizer.TRANSITION[(i0 & 15) + XQueryTokenizer.TRANSITION[i0 >> 4]]; - - if (code > 4095) - { - result = code; - code &= 4095; - end = current; - } - } - - result >>= 12; - if (result == 0) - { - end = current - 1; - var c1 = end < size ? input.charCodeAt(end) : 0; - if (c1 >= 0xdc00 && c1 < 0xe000) --end; - return error(begin, end, state, -1, -1); - } - - if (nonbmp) - { - for (var i = result >> 9; i > 0; --i) - { - --end; - var c1 = end < size ? input.charCodeAt(end) : 0; - if (c1 >= 0xdc00 && c1 < 0xe000) --end; - } - } - else - { - end -= result >> 9; - } - - return (result & 511) - 1; - } -} - -XQueryTokenizer.getTokenSet = function(tokenSetId) -{ - var set = []; - var s = tokenSetId < 0 ? - tokenSetId : INITIAL[tokenSetId] & 4095; - for (var i = 0; i < 276; i += 32) - { - var j = i; - var i0 = (i >> 5) * 2062 + s - 1; - var i1 = i0 >> 2; - var i2 = i1 >> 2; - var f = XQueryTokenizer.EXPECTED[(i0 & 3) + XQueryTokenizer.EXPECTED[(i1 & 3) + XQueryTokenizer.EXPECTED[(i2 & 3) + XQueryTokenizer.EXPECTED[i2 >> 2]]]]; - for ( ; f != 0; f >>>= 1, ++j) - { - if ((f & 1) != 0) - { - set.push(XQueryTokenizer.TOKEN[j]); - } - } - } - return set; -}; - -XQueryTokenizer.MAP0 = -[ 66, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 27, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 32, 31, 31, 33, 31, 31, 31, 31, 31, 31, 34, 35, 36, 35, 31, 35, 37, 38, 39, 40, 41, 42, 43, 44, 45, 31, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 31, 61, 62, 63, 64, 35 -]; - -XQueryTokenizer.MAP1 = -[ 108, 124, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 156, 181, 181, 181, 181, 181, 214, 215, 213, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 247, 261, 277, 293, 309, 347, 363, 379, 416, 416, 416, 408, 331, 323, 331, 323, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 433, 433, 433, 433, 433, 433, 433, 316, 331, 331, 331, 331, 331, 331, 331, 331, 394, 416, 416, 417, 415, 416, 416, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 330, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 416, 66, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 27, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 35, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 32, 31, 31, 33, 31, 31, 31, 31, 31, 31, 34, 35, 36, 35, 31, 35, 37, 38, 39, 40, 41, 42, 43, 44, 45, 31, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 31, 61, 62, 63, 64, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 31, 31, 35, 35, 35, 35, 35, 35, 35, 65, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65 -]; - -XQueryTokenizer.MAP2 = -[ 57344, 63744, 64976, 65008, 65536, 983040, 63743, 64975, 65007, 65533, 983039, 1114111, 35, 31, 35, 31, 31, 35 -]; - -XQueryTokenizer.INITIAL = -[ 1, 2, 36867, 45060, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 -]; - -XQueryTokenizer.TRANSITION = -[ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22908, 18836, 17152, 19008, 19233, 20367, 19008, 17173, 30763, 36437, 17330, 17349, 18921, 17189, 17208, 17281, 20355, 17949, 17308, 17327, 17346, 18918, 17365, 21880, 18649, 18665, 19006, 17265, 22033, 20765, 17421, 20535, 17192, 18127, 21873, 17311, 18658, 18999, 19008, 17447, 17470, 17497, 17520, 17251, 36411, 17782, 20682, 17714, 18326, 17543, 17559, 17585, 21887, 17504, 17527, 17258, 36418, 18157, 21940, 17611, 36467, 18217, 17633, 17661, 21190, 17703, 21176, 17730, 34737, 21946, 17617, 36473, 18223, 36531, 17477, 19152, 17860, 17892, 17675, 17753, 17832, 17590, 21620, 17481, 17848, 17880, 18731, 17918, 36551, 17292, 17934, 17979, 18727, 18023, 36545, 18621, 18039, 18056, 18072, 18117, 18143, 18173, 18052, 18209, 18250, 18239, 18266, 17963, 18296, 18312, 18376, 17807, 36403, 19232, 17796, 17163, 30642, 18392, 17816, 32961, 17687, 18805, 18421, 18437, 18101, 17393, 18489, 18505, 18535, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 18579, 21711, 17152, 19008, 19233, 20367, 19008, 28684, 30763, 36437, 17330, 17349, 18921, 17189, 17208, 17281, 20355, 17949, 17308, 17327, 17346, 18918, 17365, 21880, 18649, 18665, 19006, 17265, 22033, 20765, 17421, 20535, 17192, 18127, 21873, 17311, 18658, 18999, 19008, 17447, 17470, 17497, 17520, 17251, 36411, 17782, 20682, 17714, 18326, 17543, 17559, 17585, 21887, 17504, 17527, 17258, 36418, 18157, 21940, 17611, 36467, 18217, 17633, 17661, 21190, 17703, 21176, 17730, 34737, 21946, 17617, 36473, 18223, 36531, 17477, 19152, 17860, 17892, 17675, 17753, 17832, 17590, 21620, 17481, 17848, 17880, 18731, 17918, 36551, 17292, 17934, 17979, 18727, 18023, 36545, 18621, 18039, 18056, 18072, 18117, 18143, 18173, 18052, 18209, 18250, 18239, 18266, 17963, 18296, 18312, 18376, 17807, 36403, 19232, 17796, 17163, 30642, 18392, 17816, 32961, 17687, 18805, 18421, 18437, 18101, 17393, 18489, 18505, 18535, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 20116, 18836, 18637, 19008, 19233, 21267, 19008, 17173, 30763, 36437, 17330, 17349, 18921, 17189, 17208, 17281, 20355, 17949, 17308, 17327, 17346, 18918, 18452, 21880, 18649, 18665, 19006, 17265, 22033, 20765, 17421, 20535, 17192, 18127, 21873, 17311, 18658, 18999, 19008, 17447, 32952, 17497, 17520, 17251, 36411, 17782, 20682, 17714, 18326, 17543, 17559, 17585, 21887, 17504, 17527, 17258, 36418, 21915, 21940, 17611, 36467, 18217, 17633, 17661, 21190, 17703, 21176, 17730, 34737, 21946, 17617, 36473, 18223, 36531, 17477, 19152, 17860, 17892, 17675, 17753, 17832, 17590, 21620, 17481, 19156, 17864, 18731, 17918, 36551, 17292, 17934, 17979, 18727, 18681, 18405, 18621, 18039, 18056, 18072, 18117, 18143, 18706, 18052, 18209, 18250, 18239, 18266, 17963, 18296, 18312, 18376, 17807, 36403, 19232, 17796, 17163, 30642, 18392, 17816, 32961, 17645, 18805, 18421, 18437, 18519, 17393, 18747, 18505, 18535, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 18763, 18778, 18794, 19008, 19233, 20367, 19008, 17173, 30763, 36437, 17330, 17349, 18921, 17189, 17208, 17281, 20355, 17949, 17308, 17327, 17346, 18918, 18452, 21880, 18649, 18665, 19006, 17265, 22033, 20765, 17421, 20535, 17192, 18127, 21873, 17311, 18658, 18999, 19008, 17447, 32952, 17497, 17520, 17251, 36411, 17782, 20682, 17714, 18326, 17543, 17559, 17585, 21887, 17504, 17527, 17258, 36418, 21915, 21940, 17611, 36467, 18217, 17633, 17661, 21190, 17703, 21176, 17730, 34737, 21946, 17617, 36473, 18223, 36531, 17477, 19152, 17860, 17892, 17675, 17753, 17832, 17590, 21620, 17481, 19156, 17864, 18731, 17918, 36551, 17292, 17934, 17979, 18727, 18681, 18405, 18621, 18039, 18056, 18072, 18117, 18143, 18706, 18052, 18209, 18250, 18239, 18266, 17963, 18296, 18312, 18376, 17807, 36403, 19232, 17796, 17163, 30642, 18392, 17816, 32961, 17645, 18805, 18421, 18437, 18519, 17393, 18747, 18505, 18535, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 18821, 22923, 18906, 19008, 19233, 17431, 19008, 17173, 30763, 36437, 17330, 17349, 18921, 17189, 17208, 17281, 20355, 17949, 17308, 17327, 17346, 18918, 18937, 21880, 18649, 18665, 19006, 17265, 22033, 20765, 17421, 20535, 17192, 18127, 19054, 17311, 18658, 18999, 19008, 17447, 32952, 17497, 17520, 17251, 36411, 17782, 20682, 17714, 18326, 17543, 17559, 18953, 21887, 17504, 17527, 17258, 36418, 21915, 21940, 17611, 36467, 18217, 17633, 17661, 21190, 17703, 21176, 17730, 34737, 21946, 17617, 36473, 18223, 36531, 17477, 19152, 17860, 17892, 17675, 17753, 17832, 17590, 21620, 17481, 19156, 17864, 18731, 17918, 36551, 17292, 17934, 17979, 18727, 18681, 18405, 18621, 18039, 18056, 18072, 18117, 18143, 18706, 18052, 18209, 18250, 18239, 18266, 17963, 18296, 18312, 18376, 17807, 36403, 19232, 17796, 17163, 30642, 18392, 17816, 32961, 17645, 18805, 18421, 18437, 18519, 17393, 18747, 18505, 18535, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21843, 18836, 18987, 19008, 19233, 20367, 19008, 17173, 30763, 36437, 17330, 17349, 18921, 17189, 17208, 17281, 20355, 17949, 17308, 17327, 17346, 18918, 18452, 21880, 18649, 18665, 19006, 17265, 22033, 20765, 17421, 20535, 17192, 18127, 21873, 17311, 18658, 18999, 19008, 17447, 32952, 17497, 17520, 17251, 36411, 17782, 20682, 17714, 18326, 17543, 17559, 17585, 21887, 17504, 17527, 17258, 36418, 21915, 21940, 17611, 36467, 18217, 17633, 17661, 21190, 17703, 21176, 17730, 34737, 21946, 17617, 36473, 18223, 36531, 17477, 19152, 17860, 17892, 17675, 17753, 17832, 17590, 21620, 17481, 19156, 17864, 18731, 17918, 36551, 17292, 17934, 17979, 18727, 18681, 18405, 18621, 18039, 18056, 18072, 18117, 18143, 18706, 18052, 18209, 18250, 18239, 18266, 17963, 18296, 18312, 18376, 17807, 36403, 19232, 17796, 17163, 30642, 18392, 17816, 32961, 17645, 18805, 18421, 18437, 18519, 17393, 18747, 18505, 18535, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21696, 18836, 18987, 19008, 19233, 20367, 19008, 17173, 30763, 36437, 17330, 17349, 18921, 17189, 17208, 17281, 20355, 17949, 17308, 17327, 17346, 18918, 18452, 21880, 18649, 18665, 19006, 17265, 22033, 20765, 17421, 20535, 17192, 18127, 21873, 17311, 18658, 18999, 19008, 17447, 32952, 17497, 17520, 17251, 36411, 17782, 20682, 17714, 18326, 17543, 17559, 17585, 21887, 17504, 17527, 17258, 36418, 21915, 21940, 17611, 36467, 18217, 17633, 17661, 21190, 17703, 21176, 17730, 34737, 21946, 17617, 36473, 18223, 36531, 17477, 19152, 17860, 17892, 17675, 17753, 17832, 17590, 21620, 17481, 19156, 17864, 18731, 17918, 36551, 17292, 17934, 17979, 18727, 18681, 18405, 18621, 18039, 18056, 18072, 18117, 18143, 18706, 18052, 18209, 18250, 18239, 18266, 17963, 18296, 18312, 18376, 17807, 36403, 19232, 17796, 17163, 30642, 18392, 17816, 32961, 17645, 18805, 18421, 18437, 18519, 17393, 18747, 18505, 18535, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22429, 20131, 18720, 19008, 19233, 20367, 19008, 17173, 23559, 36437, 17330, 17349, 18921, 17189, 17208, 17281, 20355, 18087, 17308, 17327, 17346, 18918, 18452, 21880, 18649, 18665, 19006, 17265, 22033, 20765, 17421, 20535, 17192, 21242, 19111, 17311, 18658, 18999, 19008, 17447, 32952, 17497, 17520, 17251, 36411, 17782, 20682, 17714, 18326, 17543, 17559, 17585, 21887, 17504, 17527, 17258, 36418, 21915, 21940, 17611, 36467, 18217, 17633, 17661, 21190, 17703, 21176, 17730, 34737, 21946, 17617, 36473, 18223, 36531, 17477, 19152, 17860, 17892, 17675, 17753, 17832, 17590, 21620, 17481, 19156, 17864, 18731, 17918, 36551, 17292, 17934, 17979, 18727, 18681, 18405, 18621, 18039, 18056, 18072, 18117, 18143, 18706, 18052, 18209, 18250, 18239, 18266, 17963, 18296, 18312, 18376, 17807, 36403, 19232, 17796, 17163, 30642, 18392, 17816, 32961, 17645, 18805, 18421, 18437, 18519, 17393, 18747, 18505, 18535, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 19024, 18836, 18609, 19008, 19233, 20367, 19008, 17173, 30763, 36437, 17330, 17349, 18921, 17189, 17208, 17281, 20355, 17949, 17308, 17327, 17346, 18918, 18452, 21880, 18649, 18665, 19006, 17265, 22033, 20765, 17421, 20535, 17192, 18127, 21873, 17311, 18658, 18999, 19008, 17447, 32952, 17497, 17520, 17251, 36411, 17782, 20682, 17714, 18326, 17543, 17559, 17585, 21887, 17504, 17527, 17258, 36418, 21915, 21940, 17611, 36467, 18217, 17633, 17661, 21190, 17703, 21176, 17730, 34737, 21946, 17617, 36473, 18223, 36531, 17477, 19152, 17860, 17892, 17675, 17753, 17832, 17590, 21620, 17481, 19156, 17864, 18731, 17918, 36551, 17292, 17934, 17979, 18727, 18681, 18405, 18621, 18039, 18056, 18072, 18117, 18143, 18706, 18052, 18209, 18250, 18239, 18266, 17963, 18296, 18312, 18376, 17807, 36403, 19232, 17796, 17163, 30642, 18392, 17816, 32961, 17645, 18805, 18421, 18437, 18519, 17393, 18747, 18505, 18535, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 19081, 22444, 18987, 19008, 19233, 20367, 19008, 19065, 30763, 36437, 17330, 17349, 18921, 17189, 17208, 17281, 20355, 17949, 17308, 17327, 17346, 18918, 18452, 21880, 18649, 18665, 19006, 17265, 22033, 20765, 17421, 20535, 17192, 18127, 21873, 17311, 18658, 18999, 19008, 17447, 32952, 17497, 17520, 17251, 36411, 17782, 20682, 17714, 18326, 17543, 17559, 17585, 21887, 17504, 17527, 17258, 36418, 21915, 21940, 17611, 36467, 18217, 17633, 17661, 21190, 17703, 21176, 17730, 34737, 21946, 17617, 36473, 18223, 36531, 17477, 19152, 17860, 17892, 17675, 17753, 17832, 17590, 21620, 17481, 19156, 17864, 18731, 17918, 36551, 17292, 17934, 17979, 18727, 18681, 18405, 18621, 18039, 18056, 18072, 18117, 18143, 18706, 18052, 18209, 18250, 18239, 18266, 17963, 18296, 18312, 18376, 17807, 36403, 19232, 17796, 17163, 30642, 18392, 17816, 32961, 17645, 18805, 18421, 18437, 18519, 17393, 18747, 18505, 18535, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21992, 22007, 18987, 19008, 19233, 20367, 19008, 18690, 30763, 36437, 17330, 17349, 18921, 17189, 17208, 17281, 20355, 17949, 17308, 17327, 17346, 18918, 18452, 21880, 18649, 18665, 19006, 17265, 22033, 20765, 17421, 20535, 17192, 18127, 21873, 17311, 18658, 18999, 19008, 17447, 32952, 17497, 17520, 17251, 36411, 17782, 20682, 17714, 18326, 17543, 17559, 17585, 21887, 17504, 17527, 17258, 36418, 21915, 21940, 17611, 36467, 18217, 17633, 17661, 21190, 17703, 21176, 17730, 34737, 21946, 17617, 36473, 18223, 36531, 17477, 19152, 17860, 17892, 17675, 17753, 17832, 17590, 21620, 17481, 19156, 17864, 18731, 17918, 36551, 17292, 17934, 17979, 18727, 18681, 18405, 18621, 18039, 18056, 18072, 18117, 18143, 18706, 18052, 18209, 18250, 18239, 18266, 17963, 18296, 18312, 18376, 17807, 36403, 19232, 17796, 17163, 30642, 18392, 17816, 32961, 17645, 18805, 18421, 18437, 18519, 17393, 18747, 18505, 18535, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22414, 18836, 18987, 19008, 19233, 30651, 19008, 17173, 30763, 36437, 17330, 17349, 18921, 17189, 17208, 17281, 20355, 19138, 17308, 17327, 17346, 18918, 18452, 21880, 18649, 18665, 19006, 17265, 22033, 20765, 17421, 20535, 17192, 18127, 19280, 17311, 18658, 18999, 19008, 17447, 32952, 17497, 17520, 17251, 36411, 17782, 20682, 17714, 18326, 17543, 17559, 19172, 21887, 17504, 17527, 17258, 36418, 21915, 21940, 17611, 36467, 18217, 17633, 17661, 21190, 17703, 21176, 17730, 34737, 21946, 17617, 36473, 18223, 36531, 17477, 19152, 17860, 17892, 17675, 17753, 17832, 17590, 21620, 17481, 19156, 17864, 18731, 17918, 36551, 17292, 17934, 17979, 18727, 18681, 18405, 18621, 18039, 18056, 18072, 18117, 18143, 18706, 18052, 18209, 18250, 18239, 18266, 17963, 18296, 18312, 18376, 17807, 36403, 19232, 17796, 17163, 30642, 18392, 17816, 32961, 17645, 18805, 18421, 18437, 18519, 17393, 18747, 18505, 18535, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21783, 18836, 18987, 19008, 19233, 20367, 19008, 17173, 30763, 36437, 17330, 17349, 18921, 17189, 17208, 17281, 20355, 19218, 17308, 17327, 17346, 18918, 18452, 21880, 18649, 18665, 19006, 17265, 22033, 20765, 17421, 20535, 17192, 18127, 21873, 17311, 18658, 18999, 19008, 17447, 32952, 17497, 17520, 17251, 36411, 17782, 20682, 17714, 18326, 17543, 17559, 17585, 21887, 17504, 17527, 17258, 36418, 21915, 21940, 17611, 36467, 18217, 17633, 17661, 21190, 17703, 21176, 17730, 34737, 21946, 17617, 36473, 18223, 36531, 17477, 19152, 17860, 17892, 17675, 17753, 17832, 17590, 21620, 17481, 19156, 17864, 18731, 17918, 36551, 17292, 17934, 17979, 18727, 18681, 18405, 18621, 18039, 18056, 18072, 18117, 18143, 18706, 18052, 18209, 18250, 18239, 18266, 17963, 18296, 18312, 18376, 17807, 36403, 19232, 17796, 17163, 30642, 18392, 17816, 32961, 17645, 18805, 18421, 18437, 18519, 17393, 18747, 18505, 18535, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21651, 18836, 18987, 19008, 19233, 20367, 19008, 17173, 30763, 36437, 17330, 17349, 18921, 17189, 17208, 17281, 20355, 17949, 17308, 17327, 17346, 18918, 18452, 21880, 18649, 18665, 19006, 17265, 22033, 20765, 17421, 20535, 17192, 18127, 21873, 17311, 18658, 18999, 19008, 17447, 32952, 17497, 17520, 17251, 36411, 17782, 20682, 17714, 18326, 17543, 17559, 17585, 21887, 17504, 17527, 17258, 36418, 21915, 21940, 17611, 36467, 18217, 17633, 17661, 21190, 17703, 21176, 17730, 34737, 21946, 17617, 36473, 18223, 36531, 17477, 19152, 17860, 17892, 17675, 17753, 17832, 17590, 21620, 17481, 19156, 17864, 18731, 17918, 36551, 17292, 17934, 17979, 18727, 18681, 18405, 18621, 18039, 18056, 18072, 18117, 18143, 18706, 18052, 18209, 18250, 18239, 18266, 17963, 18296, 18312, 18376, 17807, 36403, 19232, 17796, 17163, 30642, 18392, 17816, 32961, 17645, 18805, 18421, 18437, 18519, 17393, 18747, 18505, 18535, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 19249, 19265, 19307, 18888, 27857, 30536, 24401, 31444, 23357, 18888, 19351, 18888, 18890, 27211, 19370, 27211, 27211, 19392, 24401, 31911, 24401, 24401, 25467, 18888, 18888, 18888, 18888, 18888, 25783, 27211, 27211, 27211, 27211, 28537, 19440, 24401, 24401, 24401, 24401, 24036, 17994, 24060, 18888, 18888, 18888, 18890, 19468, 27211, 27211, 27211, 27211, 19484, 35367, 19520, 24401, 24401, 24401, 19628, 18888, 29855, 18888, 18888, 23086, 27211, 19538, 27211, 27211, 30756, 24012, 24401, 19560, 24401, 24401, 26750, 18888, 18888, 19327, 27855, 27211, 27211, 19580, 17590, 24017, 24401, 24401, 19600, 25665, 18888, 18888, 28518, 27211, 27212, 24016, 19620, 19868, 28435, 25722, 18889, 19644, 27211, 32888, 35852, 19868, 31018, 19694, 19376, 19717, 22215, 19735, 22098, 19751, 35203, 19776, 19797, 19817, 19840, 25783, 31738, 24135, 19701, 19856, 31015, 23516, 31008, 28311, 19419, 27963, 19659, 27951, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21768, 18836, 19307, 18888, 27857, 27904, 24401, 29183, 28015, 18888, 18888, 18888, 18890, 27211, 27211, 27211, 27211, 19888, 24401, 24401, 24401, 24401, 22953, 18888, 18888, 18888, 18888, 18888, 25783, 27211, 27211, 27211, 27211, 28537, 19440, 24401, 24401, 24401, 24401, 24036, 18881, 18888, 18888, 18888, 18888, 18890, 27211, 27211, 27211, 27211, 27211, 19484, 24401, 24401, 24401, 24401, 24401, 19628, 18888, 18888, 18888, 18888, 23086, 27211, 27211, 27211, 27211, 30756, 24012, 24401, 24401, 24401, 24401, 26750, 18888, 18888, 18888, 27855, 27211, 27211, 27211, 17590, 24017, 24401, 24401, 24401, 18887, 18888, 18888, 27211, 27211, 27212, 24016, 24402, 19868, 25659, 18888, 18889, 27211, 27211, 19719, 23889, 19868, 31018, 18890, 27211, 31833, 19406, 19447, 23086, 23330, 19828, 31017, 27856, 31741, 19840, 25783, 31738, 19837, 25782, 19760, 31015, 23516, 31008, 22105, 19419, 27963, 19659, 27951, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22399, 18836, 19918, 19008, 19233, 20367, 19008, 17173, 30763, 36437, 17330, 17349, 18921, 17189, 17208, 17281, 20355, 17949, 17308, 17327, 17346, 18918, 18452, 21880, 18649, 18665, 19006, 17265, 22033, 20765, 17421, 20535, 17192, 18127, 21873, 17311, 18658, 18999, 19008, 17447, 32952, 17497, 17520, 17251, 36411, 17782, 20682, 17714, 18326, 17543, 17559, 17585, 21887, 17504, 17527, 17258, 36418, 21915, 21940, 17611, 36467, 18217, 17633, 17661, 21190, 17703, 21176, 17730, 34737, 21946, 17617, 36473, 18223, 36531, 17477, 19152, 17860, 17892, 17675, 17753, 17832, 17590, 21620, 17481, 19156, 17864, 18731, 17918, 36551, 17292, 17934, 17979, 18727, 18681, 18405, 18621, 18039, 18056, 18072, 18117, 18143, 18706, 18052, 18209, 18250, 18239, 18266, 17963, 18296, 18312, 18376, 17807, 36403, 19232, 17796, 17163, 30642, 18392, 17816, 32961, 17645, 18805, 18421, 18437, 18519, 17393, 18747, 18505, 18535, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21666, 18836, 19307, 18888, 27857, 27525, 24401, 29183, 21467, 18888, 18888, 18888, 18890, 27211, 27211, 27211, 27211, 19946, 24401, 24401, 24401, 24401, 32382, 18888, 18888, 18888, 18888, 18888, 25783, 27211, 27211, 27211, 27211, 28537, 19998, 24401, 24401, 24401, 24401, 31500, 18467, 18888, 18888, 18888, 18888, 18890, 27211, 27211, 27211, 27211, 27211, 20021, 24401, 24401, 24401, 24401, 24401, 34271, 18888, 18888, 18888, 18888, 23086, 27211, 27211, 27211, 27211, 32926, 29908, 24401, 24401, 24401, 24401, 26095, 18888, 18888, 18888, 27855, 27211, 27211, 27211, 20050, 22968, 24401, 24401, 24401, 18887, 18888, 18888, 27211, 27211, 35779, 20080, 24402, 19868, 25659, 18888, 18889, 27211, 27211, 19719, 23889, 19868, 31018, 18890, 27211, 31833, 19406, 19447, 23086, 23330, 19828, 31017, 27856, 31741, 19840, 25783, 31738, 19837, 25782, 19760, 31015, 23516, 31008, 22105, 19419, 27963, 19659, 27951, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 20101, 19039, 20191, 20412, 20903, 17569, 20309, 20872, 25633, 20623, 20505, 20218, 20242, 17189, 17208, 17281, 20355, 20265, 20306, 20328, 20383, 22490, 20796, 20619, 21354, 20654, 20410, 20956, 21232, 20765, 17421, 20535, 17192, 18127, 22459, 20312, 25531, 22470, 20309, 20428, 18964, 20466, 20491, 21342, 21070, 20521, 20682, 17714, 18326, 17543, 17559, 17585, 22497, 20559, 19504, 20279, 20575, 20290, 20475, 20604, 20639, 20226, 20670, 17661, 21190, 17703, 21176, 17730, 19494, 20698, 20711, 22480, 21046, 21116, 18971, 21130, 20727, 20755, 17675, 17753, 17832, 17590, 25518, 20394, 20781, 20831, 20202, 20847, 21401, 17292, 17934, 17979, 18549, 20863, 20588, 25542, 20888, 20919, 18072, 18117, 20935, 20972, 21032, 21062, 21086, 18239, 21102, 18563, 21146, 21162, 21206, 18351, 20949, 20902, 18340, 21222, 21258, 21283, 18360, 20249, 17405, 21295, 21311, 21327, 20739, 20343, 21370, 21386, 21417, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21977, 18836, 18987, 19008, 19233, 20367, 19008, 17173, 30763, 36437, 17330, 17349, 18921, 17189, 17208, 17281, 20355, 17949, 17308, 17327, 17346, 18918, 21452, 21880, 18649, 18665, 19006, 17265, 22033, 20765, 17421, 20535, 17192, 18127, 21873, 17311, 18658, 18999, 19008, 21504, 32952, 17497, 17520, 17251, 36411, 17782, 20682, 17714, 18326, 17543, 17559, 17585, 21887, 17504, 17527, 17258, 36418, 36501, 21940, 17611, 36467, 18217, 17633, 17661, 21190, 17703, 21176, 17730, 28674, 21946, 17617, 36473, 18223, 17237, 17477, 19152, 17860, 17892, 17675, 17753, 17832, 21575, 21534, 17481, 19156, 17864, 18731, 17918, 36551, 17292, 17934, 21560, 30628, 18681, 18405, 18621, 18039, 18056, 18072, 18117, 18143, 18706, 18052, 18209, 18250, 18239, 18266, 17963, 18296, 18312, 18376, 17807, 36403, 19232, 17796, 17163, 30642, 18392, 17816, 32961, 17645, 18805, 18421, 18437, 18519, 17393, 18747, 18505, 18535, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21798, 18836, 21612, 19008, 19233, 20367, 19008, 17173, 30763, 36437, 17330, 17349, 18921, 17189, 17208, 17281, 20355, 17949, 17308, 17327, 17346, 18918, 18452, 21880, 18649, 18665, 19006, 17265, 22033, 20765, 17421, 20535, 17192, 18127, 21873, 17311, 18658, 18999, 19008, 17447, 32952, 17497, 17520, 17251, 36411, 17782, 20682, 17714, 18326, 17543, 17559, 17585, 21887, 17504, 17527, 17258, 36418, 21915, 21940, 17611, 36467, 18217, 17633, 17661, 21190, 17703, 21176, 17730, 34737, 21946, 17617, 36473, 18223, 36531, 17477, 19152, 17860, 17892, 17675, 17753, 17832, 17590, 21620, 17481, 19156, 17864, 18731, 17918, 36551, 17292, 17934, 17979, 18727, 18681, 18405, 18621, 18039, 18056, 18072, 18117, 18143, 18706, 18052, 18209, 18250, 18239, 18266, 17963, 18296, 18312, 18376, 17807, 36403, 19232, 17796, 17163, 30642, 18392, 17816, 32961, 17645, 18805, 18421, 18437, 18519, 17393, 18747, 18505, 18535, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21636, 18836, 18987, 19008, 19233, 17902, 19008, 17173, 30763, 36437, 17330, 17349, 18921, 17189, 17208, 17281, 20355, 17949, 17308, 17327, 17346, 18918, 18452, 21880, 18649, 18665, 19006, 17265, 22033, 20765, 17421, 20535, 17192, 18127, 21873, 17311, 18658, 18999, 19008, 17447, 32952, 17497, 17520, 17251, 36411, 17782, 20682, 17714, 18326, 17543, 17559, 17585, 21887, 17504, 17527, 17258, 36418, 21915, 21940, 17611, 36467, 18217, 17633, 17661, 21190, 17703, 21176, 17730, 34737, 21946, 17617, 36473, 18223, 36531, 17477, 19152, 17860, 17892, 17675, 17753, 17832, 17590, 21620, 17481, 19156, 17864, 18731, 17918, 36551, 17292, 17934, 17979, 18727, 18681, 18405, 18621, 18039, 18056, 18072, 18117, 18143, 18706, 18052, 18209, 18250, 18239, 18266, 17963, 18296, 18312, 18376, 17807, 36403, 19232, 17796, 17163, 30642, 18392, 17816, 32961, 17645, 18805, 18421, 18437, 18519, 17393, 18747, 18505, 18535, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21753, 19096, 21903, 19008, 19233, 20367, 19008, 19291, 30763, 36437, 17330, 17349, 18921, 17189, 17208, 17281, 20355, 17949, 17308, 17327, 17346, 18918, 17379, 21880, 18649, 18665, 19006, 17265, 22033, 20765, 17421, 20535, 17192, 18127, 21873, 17311, 18658, 18999, 19008, 17447, 21931, 17497, 17520, 17251, 36411, 17782, 20682, 17714, 18326, 17543, 17559, 17585, 21887, 17504, 17527, 17258, 36418, 18280, 21940, 17611, 36467, 18217, 17633, 17661, 21190, 17703, 21176, 17730, 34737, 21946, 17617, 36473, 18223, 36531, 17477, 19152, 17860, 17892, 17675, 17753, 17832, 17590, 21620, 17481, 19156, 17864, 18731, 17918, 36551, 17292, 17934, 17979, 18727, 18681, 18405, 18621, 18039, 18056, 18072, 18117, 18143, 18706, 18052, 18209, 18250, 18239, 18266, 17963, 18296, 18312, 18376, 17807, 36403, 19232, 17796, 17163, 30642, 18392, 17816, 32961, 17645, 18805, 18421, 18437, 18519, 17393, 18747, 18505, 18535, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21962, 18594, 18987, 19008, 19233, 22043, 19008, 17173, 30763, 36437, 17330, 17349, 18921, 17189, 17208, 17281, 20355, 17949, 17308, 17327, 17346, 18918, 18452, 21880, 18649, 18665, 19006, 17265, 22033, 20765, 17421, 20535, 17192, 18127, 21873, 17311, 18658, 18999, 19008, 17447, 32952, 17497, 17520, 17251, 36411, 17782, 20682, 17714, 18326, 17543, 17559, 17585, 21887, 17504, 17527, 17258, 36418, 21915, 21940, 17611, 36467, 18217, 17633, 17661, 21190, 17703, 21176, 17730, 34737, 21946, 17617, 36473, 18223, 36531, 17477, 19152, 17860, 17892, 17675, 17753, 17832, 17590, 21620, 17481, 19156, 17864, 18731, 17918, 36551, 17292, 17934, 17979, 18727, 18681, 18405, 18621, 18039, 18056, 18072, 18117, 18143, 18706, 18052, 18209, 18250, 18239, 18266, 17963, 18296, 18312, 18376, 17807, 36403, 19232, 17796, 17163, 30642, 18392, 17816, 32961, 17645, 18805, 18421, 18437, 18519, 17393, 18747, 18505, 18535, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21681, 21858, 18987, 19008, 19233, 20367, 19008, 21544, 30763, 36437, 17330, 17349, 18921, 17189, 17208, 17281, 20355, 17949, 17308, 17327, 17346, 18918, 18452, 21880, 18649, 18665, 19006, 17265, 22033, 20765, 17421, 20535, 17192, 18127, 21873, 17311, 18658, 18999, 19008, 17447, 32952, 17497, 17520, 17251, 36411, 17782, 20682, 17714, 18326, 17543, 17559, 17585, 21887, 17504, 17527, 17258, 36418, 21915, 21940, 17611, 36467, 18217, 17633, 17661, 21190, 17703, 21176, 17730, 34737, 21946, 17617, 36473, 18223, 36531, 17477, 19152, 17860, 17892, 17675, 17753, 17832, 17590, 21620, 17481, 19156, 17864, 18731, 17918, 36551, 17292, 17934, 17979, 18727, 18681, 18405, 18621, 18039, 18056, 18072, 18117, 18143, 18706, 18052, 18209, 18250, 18239, 18266, 17963, 18296, 18312, 18376, 17807, 36403, 19232, 17796, 17163, 30642, 18392, 17816, 32961, 17645, 18805, 18421, 18437, 18519, 17393, 18747, 18505, 18535, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22339, 18836, 22059, 18888, 27857, 34097, 24401, 29183, 22087, 18888, 18888, 18888, 18890, 27211, 27211, 27211, 27211, 22121, 24401, 24401, 24401, 24401, 30613, 18888, 18888, 18888, 18888, 18888, 25783, 27211, 27211, 27211, 27211, 35072, 22164, 24401, 24401, 24401, 24401, 31500, 31693, 18888, 18888, 18888, 18888, 18890, 27211, 27211, 27211, 27211, 27211, 19484, 24401, 24401, 24401, 24401, 24401, 32319, 18888, 18888, 18888, 18888, 23086, 27211, 27211, 27211, 27211, 30756, 21431, 24401, 24401, 24401, 24401, 26095, 18888, 18888, 18888, 27855, 27211, 27211, 27211, 22187, 22968, 24401, 24401, 24401, 22231, 18888, 18888, 27211, 27211, 35779, 20080, 24402, 19868, 25659, 18888, 18889, 27211, 27211, 19719, 23889, 19868, 31018, 18890, 27211, 31833, 19406, 19447, 23086, 23330, 19828, 31017, 27856, 31741, 19840, 25783, 31738, 19837, 25782, 19760, 31015, 23516, 31008, 22105, 19419, 27963, 19659, 27951, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22339, 18836, 22059, 18888, 27857, 34097, 24401, 29183, 22087, 18888, 18888, 18888, 18890, 27211, 27211, 27211, 27211, 22121, 24401, 24401, 24401, 24401, 30613, 18888, 18888, 18888, 18888, 18888, 25783, 27211, 27211, 27211, 27211, 35072, 22164, 24401, 24401, 24401, 24401, 31500, 31693, 18888, 18888, 18888, 18888, 18890, 27211, 27211, 27211, 27211, 27211, 19484, 24401, 24401, 24401, 24401, 24401, 31181, 18888, 18888, 18888, 18888, 23086, 27211, 27211, 27211, 27211, 30756, 21431, 24401, 24401, 24401, 24401, 26095, 18888, 18888, 18888, 27855, 27211, 27211, 27211, 22187, 22968, 24401, 24401, 24401, 18887, 18888, 18888, 27211, 27211, 35779, 20080, 24402, 19868, 25659, 18888, 18889, 27211, 27211, 19719, 23889, 19868, 31018, 18890, 27211, 31833, 19406, 19447, 23086, 23330, 19828, 31017, 27856, 31741, 19840, 25783, 31738, 19837, 25782, 19760, 31015, 23516, 31008, 22105, 19419, 27963, 19659, 27951, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22339, 18836, 22059, 18888, 27857, 34097, 24401, 29183, 22087, 18888, 18888, 18888, 18890, 27211, 27211, 27211, 27211, 22121, 24401, 24401, 24401, 24401, 31678, 18888, 18888, 18888, 18888, 18888, 25783, 27211, 27211, 27211, 27211, 35072, 22164, 24401, 24401, 24401, 24401, 31500, 31693, 18888, 18888, 18888, 18888, 18890, 27211, 27211, 27211, 27211, 27211, 19484, 24401, 24401, 24401, 24401, 24401, 31181, 18888, 18888, 18888, 18888, 23086, 27211, 27211, 27211, 27211, 30756, 21431, 24401, 24401, 24401, 24401, 26095, 18888, 18888, 18888, 27855, 27211, 27211, 27211, 22187, 22968, 24401, 24401, 24401, 18887, 18888, 18888, 27211, 27211, 35779, 20080, 24402, 19868, 25659, 18888, 18889, 27211, 27211, 19719, 23889, 19868, 31018, 18890, 27211, 31833, 19406, 19447, 23086, 23330, 19828, 31017, 27856, 31741, 19840, 25783, 31738, 19837, 25782, 19760, 31015, 23516, 31008, 22105, 19419, 27963, 19659, 27951, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22339, 18836, 22059, 18888, 27857, 34097, 24401, 29183, 22087, 18888, 18888, 18888, 18890, 27211, 27211, 27211, 27211, 22121, 24401, 24401, 24401, 24401, 30613, 18888, 18888, 18888, 18888, 18888, 25783, 27211, 27211, 27211, 27211, 35072, 22164, 24401, 24401, 24401, 24401, 33588, 31693, 18888, 18888, 18888, 18888, 18890, 27211, 27211, 27211, 27211, 27211, 19484, 24401, 24401, 24401, 24401, 24401, 31181, 18888, 18888, 18888, 18888, 23086, 27211, 27211, 27211, 27211, 30756, 21431, 24401, 24401, 24401, 24401, 26095, 18888, 18888, 18888, 27855, 27211, 27211, 27211, 22187, 22968, 24401, 24401, 24401, 18887, 18888, 18888, 27211, 27211, 35779, 20080, 24402, 19868, 25659, 18888, 18889, 27211, 27211, 19719, 23889, 19868, 31018, 18890, 27211, 31833, 19406, 19447, 23086, 23330, 19828, 31017, 27856, 31741, 19840, 25783, 31738, 19837, 25782, 19760, 31015, 23516, 31008, 22105, 19419, 27963, 19659, 27951, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22339, 18836, 22059, 18888, 27857, 35019, 24401, 29183, 22087, 18888, 18888, 18888, 18890, 27211, 27211, 27211, 27211, 22248, 24401, 24401, 24401, 24401, 30613, 18888, 18888, 18888, 18888, 18888, 25783, 27211, 27211, 27211, 27211, 35072, 22164, 24401, 24401, 24401, 24401, 31500, 31693, 18888, 18888, 18888, 18888, 18890, 27211, 27211, 27211, 27211, 27211, 19484, 24401, 24401, 24401, 24401, 24401, 31181, 18888, 18888, 18888, 18888, 23086, 27211, 27211, 27211, 27211, 30756, 21431, 24401, 24401, 24401, 24401, 26095, 18888, 18888, 18888, 27855, 27211, 27211, 27211, 22187, 22968, 24401, 24401, 24401, 18887, 18888, 18888, 27211, 27211, 35779, 20080, 24402, 19868, 25659, 18888, 18889, 27211, 27211, 19719, 23889, 19868, 31018, 18890, 27211, 31833, 19406, 19447, 23086, 23330, 19828, 31017, 27856, 31741, 19840, 25783, 31738, 19837, 25782, 19760, 31015, 23516, 31008, 22105, 19419, 27963, 19659, 27951, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22339, 18836, 22059, 18888, 27857, 34097, 24401, 29183, 22087, 18888, 18888, 18888, 18890, 27211, 27211, 27211, 27211, 22121, 24401, 24401, 24401, 24401, 18866, 18888, 18888, 18888, 18888, 18888, 25783, 27211, 27211, 27211, 27211, 35072, 22164, 24401, 24401, 24401, 24401, 24036, 31693, 18888, 18888, 18888, 18888, 18890, 27211, 27211, 27211, 27211, 27211, 19484, 24401, 24401, 24401, 24401, 24401, 19628, 18888, 18888, 18888, 18888, 23086, 27211, 27211, 27211, 27211, 30756, 24012, 24401, 24401, 24401, 24401, 26750, 18888, 18888, 18888, 27855, 27211, 27211, 27211, 17590, 24017, 24401, 24401, 24401, 18887, 18888, 18888, 27211, 27211, 27212, 24016, 24402, 19868, 25659, 18888, 18889, 27211, 27211, 19719, 23889, 19868, 31018, 18890, 27211, 31833, 19406, 19447, 23086, 23330, 19828, 31017, 27856, 31741, 19840, 25783, 31738, 19837, 25782, 19760, 31015, 23516, 31008, 22105, 19419, 27963, 19659, 27951, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22324, 18836, 22059, 18888, 27857, 30501, 24401, 29183, 22087, 18888, 18888, 18888, 18890, 27211, 27211, 27211, 27211, 22121, 24401, 24401, 24401, 24401, 18866, 18888, 18888, 18888, 18888, 18888, 25783, 27211, 27211, 27211, 27211, 35072, 22164, 24401, 24401, 24401, 24401, 24036, 31693, 18888, 18888, 18888, 18888, 18890, 27211, 27211, 27211, 27211, 27211, 19484, 24401, 24401, 24401, 24401, 24401, 19628, 18888, 18888, 18888, 18888, 23086, 27211, 27211, 27211, 27211, 30756, 24012, 24401, 24401, 24401, 24401, 26750, 18888, 18888, 18888, 27855, 27211, 27211, 27211, 17590, 24017, 24401, 24401, 24401, 18887, 18888, 18888, 27211, 27211, 27212, 24016, 24402, 19868, 25659, 18888, 18889, 27211, 27211, 19719, 23889, 19868, 31018, 18890, 27211, 31833, 19406, 19447, 23086, 23330, 19828, 31017, 27856, 31741, 19840, 25783, 31738, 19837, 25782, 19760, 31015, 23516, 31008, 22105, 19419, 27963, 19659, 27951, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22339, 18836, 22059, 18888, 27857, 34097, 24401, 29183, 22087, 18888, 18888, 18888, 18890, 27211, 27211, 27211, 27211, 22121, 24401, 24401, 24401, 24401, 18866, 18888, 18888, 18888, 18888, 18888, 25783, 27211, 27211, 27211, 27211, 35072, 22164, 24401, 24401, 24401, 24401, 24036, 31693, 18888, 18888, 18888, 18888, 18890, 27211, 27211, 27211, 27211, 27211, 19484, 24401, 24401, 24401, 24401, 24401, 19628, 18888, 18888, 18888, 18888, 23086, 27211, 27211, 27211, 27211, 30756, 24012, 24401, 24401, 24401, 24401, 34365, 18888, 18888, 18888, 27855, 27211, 27211, 27211, 17590, 24017, 24401, 24401, 24401, 18887, 18888, 18888, 27211, 27211, 27212, 24016, 24402, 19868, 25659, 18888, 18889, 27211, 27211, 19719, 23889, 19868, 31018, 18890, 27211, 31833, 19406, 19447, 23086, 23330, 19828, 31017, 27856, 31741, 19840, 25783, 31738, 19837, 25782, 19760, 31015, 23516, 31008, 22105, 19419, 27963, 19659, 27951, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22354, 18836, 18987, 19008, 19233, 20367, 19008, 17173, 27086, 36437, 17330, 17349, 18921, 17189, 17208, 17281, 20355, 17949, 17308, 17327, 17346, 18918, 18452, 21880, 18649, 18665, 19006, 17265, 22033, 20765, 17421, 20535, 17192, 18127, 21873, 17311, 18658, 18999, 19008, 17447, 32952, 17497, 17520, 17251, 36411, 17782, 20682, 17714, 18326, 17543, 17559, 17585, 21887, 17504, 17527, 17258, 36418, 21915, 21940, 17611, 36467, 18217, 17633, 17661, 21190, 17703, 21176, 17730, 34737, 21946, 17617, 36473, 18223, 36531, 17477, 19152, 17860, 17892, 17675, 17753, 17832, 17590, 21620, 17481, 19156, 17864, 18731, 17918, 36551, 17292, 17934, 17979, 18727, 18681, 18405, 19930, 18039, 18056, 18072, 18117, 18143, 18706, 18052, 18209, 18250, 18239, 18266, 17963, 18296, 18312, 18376, 17807, 36403, 19232, 17796, 17163, 30642, 18392, 17816, 32961, 17645, 18805, 18421, 18437, 18519, 17393, 18747, 18505, 18535, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21828, 18836, 18987, 19008, 19233, 20367, 19008, 17173, 30763, 36437, 17330, 17349, 18921, 17189, 17208, 17281, 20355, 17949, 17308, 17327, 17346, 18918, 18452, 21880, 18649, 18665, 19006, 17265, 22033, 20765, 17421, 20535, 17192, 18127, 21873, 17311, 18658, 18999, 19008, 17447, 32952, 17497, 17520, 17251, 36411, 17782, 20682, 17714, 18326, 17543, 17559, 17585, 21887, 17504, 17527, 17258, 36418, 21915, 21940, 17611, 36467, 18217, 17633, 17661, 21190, 17703, 21176, 17730, 34737, 21946, 17617, 36473, 18223, 36531, 17477, 19152, 17860, 17892, 17675, 17753, 17832, 17590, 21620, 17481, 19156, 17864, 18731, 17918, 36551, 17292, 17934, 17979, 18727, 18681, 18405, 18621, 18039, 18056, 18072, 18117, 18143, 18706, 18052, 18209, 18250, 18239, 18266, 17963, 18296, 18312, 18376, 17807, 36403, 19232, 17796, 17163, 30642, 18392, 17816, 32961, 17645, 18805, 18421, 18437, 18519, 17393, 18747, 18505, 18535, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22309, 22513, 18987, 19008, 19233, 20367, 19008, 19122, 30763, 36437, 17330, 17349, 18921, 17189, 17208, 17281, 20355, 17949, 17308, 17327, 17346, 18918, 22544, 21880, 18649, 18665, 19006, 17265, 22033, 20765, 17421, 20535, 17192, 18127, 21873, 17311, 18658, 18999, 19008, 17447, 32952, 17497, 17520, 17251, 36411, 17782, 20682, 17714, 18326, 17543, 17559, 17585, 21887, 17504, 17527, 17258, 36418, 21915, 21940, 17611, 36467, 18217, 17633, 17661, 21190, 17703, 21176, 17730, 34737, 21946, 17617, 36473, 18223, 36531, 17477, 19152, 17860, 17892, 17675, 17753, 17832, 17590, 21620, 17481, 19156, 17864, 18731, 17918, 36551, 17292, 17934, 17979, 18727, 18681, 18405, 18621, 18039, 18056, 18072, 18117, 18143, 18706, 18052, 18209, 18250, 18239, 18266, 17963, 18296, 18312, 18376, 17807, 36403, 19232, 17796, 17163, 30642, 18392, 17816, 32961, 17645, 18805, 18421, 18437, 18519, 17393, 18747, 18505, 18535, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22608, 18836, 22988, 23004, 27585, 23020, 23036, 23067, 22087, 18888, 18888, 18888, 23083, 27211, 27211, 27211, 23102, 22121, 24401, 24401, 24401, 23122, 31386, 26154, 19674, 18888, 28119, 28232, 19424, 23705, 27211, 27211, 23142, 23173, 23189, 23212, 24401, 24401, 23246, 34427, 31693, 23262, 18888, 23290, 23308, 27783, 27620, 23327, 35263, 35107, 33383, 23346, 18193, 23393, 32748, 23968, 24401, 23414, 35153, 23463, 18888, 33913, 23442, 23482, 27211, 27211, 23532, 23552, 21431, 23575, 24401, 24401, 23604, 26095, 23635, 23657, 18888, 33482, 23685, 33251, 27211, 22187, 18851, 23721, 35536, 24401, 18887, 23750, 32641, 27211, 23769, 23787, 20080, 33012, 24384, 25659, 18888, 18889, 27211, 27211, 19719, 23889, 23803, 31018, 18890, 27211, 31833, 19406, 19447, 23086, 23330, 19828, 28224, 31826, 23823, 26917, 34978, 23850, 26493, 25782, 23878, 23914, 23516, 31008, 22105, 19419, 27963, 19659, 29781, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22623, 18836, 22059, 18888, 27857, 34097, 24401, 29183, 22087, 18888, 18888, 18888, 18890, 27211, 27211, 27211, 27211, 22121, 24401, 24401, 24401, 24401, 30613, 18888, 18888, 18888, 18888, 28909, 25783, 27211, 27211, 27211, 34048, 23933, 22164, 24401, 24401, 24401, 28409, 23949, 31693, 18888, 18888, 18888, 18888, 18890, 27211, 27211, 27211, 27211, 27211, 19484, 24401, 24401, 24401, 24401, 24401, 31181, 26583, 18888, 18888, 18888, 35585, 23984, 27211, 27211, 27211, 24005, 22201, 24033, 24401, 24401, 24401, 24052, 18888, 18888, 18888, 27855, 27211, 27211, 27211, 22187, 22968, 24401, 24401, 24401, 18887, 18888, 18888, 27211, 27211, 35779, 20080, 24402, 19868, 25659, 18888, 18889, 27211, 27211, 19719, 23889, 19868, 31018, 18890, 27211, 31833, 19406, 19447, 23086, 23330, 19828, 31017, 27856, 31741, 26496, 24076, 24126, 24151, 25782, 19760, 31015, 23516, 31008, 22105, 19419, 27963, 19659, 27951, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22638, 18836, 22059, 19678, 27857, 24185, 24401, 24201, 24217, 26592, 18888, 18888, 18890, 24252, 24268, 27211, 27211, 22121, 24287, 24303, 24401, 24401, 30613, 19781, 35432, 36007, 32649, 18888, 25783, 24322, 28966, 23771, 27211, 35072, 22164, 24358, 32106, 26829, 24400, 31500, 31693, 18888, 18888, 18888, 24801, 18890, 27211, 27211, 27211, 27211, 24418, 19484, 24401, 24401, 24401, 24401, 20167, 31181, 18888, 18888, 18888, 27833, 23086, 27211, 27211, 33540, 27211, 30756, 21431, 24401, 24401, 22972, 24401, 26095, 18888, 36131, 18888, 27855, 27211, 24440, 27211, 22187, 22968, 24401, 24459, 24401, 31699, 28454, 18888, 34528, 34570, 35779, 24478, 24402, 24494, 25659, 18888, 36228, 27211, 27211, 24515, 30981, 23734, 31018, 18890, 27211, 31833, 19406, 19447, 23086, 23330, 24538, 31017, 27856, 31741, 30059, 23377, 24563, 19837, 25782, 19760, 31015, 23516, 25374, 22105, 19419, 29793, 24579, 27951, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22653, 18836, 22059, 25756, 19982, 34097, 23196, 29183, 24614, 24110, 23641, 24673, 26103, 24697, 24443, 24713, 28558, 22121, 24748, 24462, 24764, 23398, 30613, 18888, 18888, 18888, 18888, 24798, 25783, 27211, 27211, 27211, 34232, 35072, 22164, 24401, 24401, 24401, 33302, 31500, 22559, 24106, 24232, 18888, 18888, 34970, 24817, 30411, 27211, 27211, 32484, 19484, 29750, 35127, 24401, 24401, 19872, 31181, 24852, 18888, 18888, 24871, 29221, 27211, 27211, 32072, 27211, 30756, 34441, 24401, 24401, 31571, 24401, 26095, 33141, 27802, 27011, 27855, 25295, 25607, 24888, 22187, 22968, 19195, 34593, 24906, 18887, 18888, 18888, 27211, 27211, 35779, 20080, 24402, 19868, 25659, 18888, 33663, 27211, 27211, 24924, 24947, 23588, 31018, 18890, 27211, 31833, 22135, 19447, 23086, 23330, 19828, 30904, 31042, 24972, 19840, 25000, 31738, 30898, 25782, 19760, 31015, 23516, 31008, 22105, 19419, 25016, 19659, 27951, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22668, 18836, 25041, 25057, 31320, 25073, 25089, 25105, 22087, 34796, 24236, 36138, 34870, 34125, 25121, 23106, 35497, 22248, 36613, 25137, 30671, 27365, 30613, 25153, 26447, 25199, 25233, 22574, 23274, 25249, 25265, 25281, 25318, 25344, 25360, 25400, 25428, 25452, 26731, 25504, 31693, 23669, 25558, 27407, 25575, 28599, 25934, 25599, 27211, 28180, 27304, 25623, 25839, 25649, 24401, 34820, 25681, 25698, 22586, 27775, 30190, 25745, 25778, 25799, 25817, 28995, 33569, 30756, 21518, 33443, 25837, 25855, 25893, 26095, 31254, 26677, 30136, 27855, 25930, 25950, 27211, 22187, 22968, 25966, 25986, 24401, 23428, 27763, 36330, 26959, 26002, 26029, 26045, 26085, 26119, 26170, 26203, 26222, 26239, 30527, 26372, 26274, 28404, 31018, 33757, 27211, 34262, 26316, 36729, 26345, 26366, 35337, 31017, 26388, 26407, 30954, 26350, 33861, 26434, 26463, 26479, 26512, 23516, 33189, 26531, 26547, 27963, 31293, 27951, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22683, 18836, 26568, 26181, 26608, 34097, 26643, 29183, 22087, 26669, 18888, 18888, 18890, 26693, 27211, 27211, 27211, 22121, 26720, 24401, 24401, 24401, 30613, 18888, 18888, 18888, 18888, 26774, 25783, 27211, 27211, 27211, 26619, 35072, 22164, 24401, 24401, 24401, 21596, 31500, 31693, 18888, 18888, 33978, 18888, 18890, 27211, 27211, 25801, 27211, 27211, 19484, 24401, 24401, 24401, 26792, 24401, 31181, 18888, 18888, 18888, 35464, 23086, 27211, 27211, 27211, 26809, 30756, 21431, 24401, 24401, 24401, 26828, 26095, 18888, 18888, 18888, 27855, 27211, 27211, 27211, 22187, 22968, 24401, 24401, 24401, 18887, 18888, 18888, 27211, 27211, 35779, 20080, 24402, 19868, 25659, 31948, 18889, 35707, 27211, 19719, 26845, 19868, 31018, 18890, 27211, 31833, 19406, 19447, 23086, 23330, 26905, 31017, 27856, 31741, 19840, 25783, 31738, 19837, 25782, 19760, 31015, 23516, 24984, 31088, 19419, 26945, 27651, 27951, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22698, 18836, 26999, 18888, 27857, 34097, 24401, 29183, 22087, 18888, 18888, 18888, 18890, 27211, 27211, 27211, 27211, 22121, 24401, 24401, 24401, 24401, 23051, 18888, 18888, 18888, 18888, 18888, 25783, 27211, 27211, 27211, 27211, 35072, 27033, 24401, 24401, 24401, 24401, 24036, 31693, 18888, 18888, 27056, 18888, 18890, 27211, 27211, 30320, 27211, 27211, 27075, 24401, 24401, 29032, 24401, 24401, 19628, 18888, 18888, 18888, 18888, 23086, 27211, 27211, 27211, 27211, 30756, 24012, 24401, 24401, 24401, 24401, 26750, 18888, 18888, 33986, 27855, 27211, 27211, 27102, 17590, 24017, 24401, 24401, 27123, 27144, 36254, 27162, 27210, 27228, 28500, 18187, 34842, 33426, 27244, 35980, 27277, 27302, 27320, 36048, 34013, 20999, 31882, 21478, 27895, 27356, 30287, 27381, 23086, 23330, 19828, 31017, 27856, 31741, 19840, 25783, 31738, 19837, 25782, 19760, 31015, 23516, 31008, 22105, 26329, 30087, 19659, 27951, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22339, 18836, 22059, 27406, 27423, 27445, 35294, 27461, 22087, 18888, 18888, 30140, 18890, 27211, 27211, 27989, 27211, 22121, 24401, 24401, 25682, 24401, 18866, 18888, 18888, 18888, 18888, 18888, 34042, 27211, 27211, 27211, 27211, 29700, 22164, 24401, 24401, 24401, 24401, 27128, 31693, 27477, 18888, 18888, 18888, 18890, 27194, 27211, 27211, 27211, 27211, 19484, 35299, 24401, 24401, 24401, 24401, 19628, 18888, 18888, 18888, 27059, 23086, 27211, 27211, 27211, 33366, 30756, 24012, 24401, 24401, 24401, 35044, 26750, 18888, 18888, 18888, 27855, 27211, 27211, 27211, 17590, 24017, 24401, 24401, 24401, 18887, 18888, 18888, 27211, 27211, 27212, 24016, 24402, 19868, 25659, 18888, 18889, 27211, 27211, 19719, 23889, 19868, 31018, 20815, 27211, 30818, 19960, 33969, 23086, 23330, 19828, 31017, 27856, 31741, 19840, 25783, 31738, 19837, 25782, 19760, 31015, 23516, 31008, 22105, 19419, 27963, 19659, 27951, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22713, 18836, 22059, 27496, 27516, 27541, 35231, 27557, 22087, 29662, 26292, 23292, 27573, 24836, 27601, 27211, 27636, 22121, 35544, 27686, 24401, 27721, 18866, 18888, 27799, 18888, 27818, 22071, 27853, 32260, 27211, 26013, 27873, 27920, 22164, 29419, 24401, 29946, 33413, 26742, 27751, 26881, 18888, 18888, 27261, 36776, 27936, 27211, 27211, 27211, 27988, 28005, 28031, 28052, 24401, 24401, 28069, 28088, 28135, 25488, 28152, 26069, 28167, 27211, 28340, 24657, 28196, 30756, 31523, 24401, 28212, 34176, 36174, 24956, 28248, 28266, 28290, 21488, 33077, 28327, 28356, 17590, 20986, 23126, 28391, 28425, 28102, 28451, 28470, 28490, 28516, 28534, 20034, 33728, 25868, 25659, 18888, 18889, 27211, 27211, 19719, 23889, 19868, 30241, 28274, 28553, 28574, 19406, 28590, 23086, 23330, 19828, 19452, 28615, 28660, 26147, 25783, 31738, 19837, 25782, 19760, 29613, 35958, 29276, 22105, 19419, 27963, 23157, 28700, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22339, 18836, 22059, 18888, 27857, 34097, 24401, 29183, 22087, 18888, 18888, 18888, 18890, 27211, 27211, 27211, 27211, 22121, 24401, 24401, 24401, 24401, 18866, 18888, 18888, 18888, 18888, 18888, 25783, 27211, 27211, 27211, 27211, 35072, 22164, 24401, 24401, 24401, 24401, 24036, 22528, 18888, 18888, 18888, 18888, 18890, 27333, 27211, 27211, 27211, 27211, 19484, 30853, 24401, 24401, 24401, 24401, 19628, 18888, 18888, 18888, 18888, 23086, 27211, 27211, 27211, 27211, 30756, 24012, 24401, 24401, 24401, 24401, 26750, 18888, 18888, 18888, 27855, 27211, 27211, 27211, 17590, 24017, 24401, 24401, 24401, 18887, 18888, 18888, 27211, 27211, 27212, 24016, 24402, 19868, 25659, 18888, 18889, 27211, 27211, 19719, 23889, 19868, 31018, 18890, 27211, 31833, 19406, 19447, 23086, 23330, 19828, 31017, 27856, 31741, 19840, 25783, 31738, 19837, 25782, 19760, 31015, 23516, 31008, 22105, 19419, 27963, 19659, 27951, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22728, 18836, 28747, 28782, 28817, 28841, 28857, 28880, 28896, 24161, 28943, 32011, 36261, 27340, 28961, 29492, 28982, 29011, 24522, 29027, 25436, 29048, 23051, 27500, 29090, 29110, 30713, 18888, 23512, 29130, 25183, 27211, 29155, 28927, 27033, 29173, 23230, 24401, 29199, 35373, 31693, 18888, 18888, 25583, 32629, 29218, 27211, 27211, 31461, 30692, 29237, 27075, 24401, 24401, 24401, 29262, 29302, 19628, 18888, 34329, 18888, 18888, 23086, 27211, 29329, 27211, 27211, 30756, 24012, 35933, 24401, 24401, 24401, 27705, 31612, 18888, 18888, 29346, 29374, 27211, 35650, 17590, 21436, 29393, 24401, 25970, 18887, 33895, 18888, 27211, 32528, 27212, 24016, 32769, 19868, 25659, 18888, 26889, 27211, 27211, 29412, 23889, 24371, 31018, 18890, 27211, 31833, 19406, 19447, 23086, 23330, 19828, 31017, 27856, 31768, 19840, 25783, 31738, 19837, 29435, 29508, 31102, 29550, 29606, 22105, 30300, 29462, 19659, 27951, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22743, 18836, 22059, 29629, 29473, 34097, 33285, 29183, 29651, 27254, 18888, 29678, 33329, 32535, 27211, 29694, 29716, 22121, 19202, 24401, 32742, 29741, 18866, 26776, 33921, 28474, 18888, 18888, 25783, 29766, 27211, 29809, 27211, 35072, 22164, 35825, 24401, 29828, 24401, 24036, 36769, 25217, 18888, 18888, 29848, 18890, 27211, 29871, 27211, 26258, 27211, 29894, 24401, 29929, 24401, 36587, 24401, 19628, 18888, 18888, 18888, 18888, 23086, 27211, 27211, 27211, 27211, 29725, 29962, 24401, 24401, 24401, 24401, 26750, 18888, 18888, 18888, 27855, 27211, 27211, 27211, 17590, 24017, 24401, 24401, 24401, 18473, 18888, 18888, 19584, 27211, 27212, 24016, 29982, 19868, 25659, 18888, 18889, 27211, 27211, 19719, 23889, 19868, 31018, 18890, 27211, 31833, 19902, 19447, 32052, 19544, 19828, 29998, 30097, 30031, 19840, 25783, 30047, 19837, 25782, 19760, 31015, 23516, 31008, 22105, 19419, 27963, 19659, 30075, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22758, 18836, 30121, 30156, 30206, 30257, 30273, 30336, 22087, 35624, 32837, 25762, 18890, 29878, 34934, 26812, 27211, 22121, 24931, 23223, 29202, 24401, 18866, 34373, 30352, 18888, 18888, 18888, 23447, 24828, 27211, 27211, 27211, 35072, 30370, 35052, 24401, 24401, 24401, 24036, 29523, 18888, 18888, 27146, 18888, 31308, 30386, 27211, 27211, 30405, 30558, 19484, 30427, 24401, 24401, 29938, 35686, 19628, 28766, 30447, 34506, 35614, 23086, 28731, 30482, 30517, 30552, 30756, 24012, 20156, 30574, 30598, 30667, 26283, 33464, 28945, 27670, 30687, 32915, 33504, 25328, 17590, 23963, 20450, 33837, 21016, 32397, 26300, 30708, 30729, 27885, 30748, 21588, 36373, 30779, 26653, 24628, 33220, 32514, 30806, 31835, 25412, 25906, 26515, 18890, 28825, 31833, 26133, 19447, 28304, 31730, 23834, 26057, 30869, 30885, 32181, 30920, 30942, 32797, 25782, 30970, 31015, 23516, 31008, 30997, 31034, 27963, 19659, 29450, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22773, 18836, 31058, 31074, 32463, 31125, 31141, 31197, 22087, 18888, 29534, 35471, 36738, 27211, 24342, 31213, 24424, 22121, 24401, 20175, 31229, 31917, 27736, 31245, 34334, 27175, 18888, 29094, 27286, 27211, 31278, 31336, 27211, 31355, 31371, 24401, 31402, 31418, 24401, 31437, 31693, 18888, 31619, 32841, 18888, 18890, 27211, 27211, 31460, 31477, 27211, 19484, 24401, 24401, 31497, 36581, 24401, 33020, 18888, 18888, 18888, 18888, 30007, 27211, 27211, 27211, 27211, 31516, 32310, 24401, 24401, 24401, 24401, 31539, 18888, 28762, 18888, 24651, 35740, 27211, 27211, 28644, 31565, 35796, 24401, 24401, 19318, 32188, 18888, 24334, 28366, 27212, 29966, 29832, 19868, 25659, 18888, 18889, 27211, 27211, 19719, 31587, 19868, 31635, 32435, 33693, 30105, 31663, 20005, 31715, 31757, 31784, 31812, 30015, 31851, 31878, 25783, 31898, 19837, 25782, 19760, 31015, 23516, 31008, 22105, 19419, 27963, 31933, 30221, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22788, 18836, 22059, 25729, 30466, 31968, 24306, 31984, 32000, 32807, 35160, 27017, 29590, 34941, 19801, 29377, 33700, 22121, 27040, 30431, 29396, 28864, 29565, 18888, 18888, 18888, 32027, 18888, 25783, 27211, 27211, 23698, 27211, 35072, 22164, 24401, 24401, 30845, 24401, 24036, 32045, 18888, 26929, 18888, 18888, 18890, 27211, 31481, 32068, 27211, 27211, 32088, 24401, 33058, 32122, 24401, 24401, 33736, 18888, 18888, 33162, 18888, 23086, 27211, 27211, 29484, 27211, 28375, 32144, 24401, 24401, 33831, 24401, 26750, 18888, 18888, 18888, 27855, 27211, 27211, 27211, 36704, 24017, 24401, 24401, 24401, 18887, 18888, 18888, 27211, 27211, 27212, 24016, 24402, 19868, 25659, 18888, 18889, 27211, 27211, 19719, 23889, 19868, 31018, 18890, 27211, 31833, 33107, 22171, 33224, 24271, 32169, 31017, 27856, 31741, 19840, 25783, 31738, 30234, 25782, 19760, 31015, 23516, 31008, 22105, 19419, 27963, 19659, 27951, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22339, 18836, 32204, 32232, 32252, 32677, 33295, 29074, 22087, 18888, 18888, 18888, 18890, 27211, 27211, 27211, 27211, 22121, 24401, 24401, 24401, 24401, 23619, 18888, 18888, 18888, 18888, 18888, 25783, 27211, 27211, 27211, 27211, 35072, 32276, 24401, 24401, 24401, 24401, 24036, 31693, 18888, 18888, 18888, 18888, 18890, 27211, 27211, 27211, 27211, 27211, 32299, 24401, 24401, 24401, 24401, 24401, 19628, 18888, 18888, 18888, 18888, 23086, 27211, 27211, 27211, 27211, 30756, 24012, 24401, 24401, 24401, 24401, 26750, 18888, 18888, 18888, 27855, 27211, 27211, 27211, 17590, 24017, 24401, 24401, 24401, 18887, 18888, 18888, 27211, 27211, 27212, 24016, 24402, 19868, 25659, 33886, 18889, 36065, 27211, 19719, 35326, 19868, 31018, 18890, 27211, 31833, 19406, 19447, 23086, 23330, 19828, 31017, 27856, 31741, 19840, 25783, 31738, 19837, 25782, 19760, 31015, 23516, 31008, 22105, 19419, 27963, 19659, 27951, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22803, 18836, 32335, 31647, 34666, 32351, 32367, 32417, 22087, 18888, 32433, 19335, 32451, 27211, 32479, 27107, 32500, 22121, 24401, 32551, 20085, 32572, 18866, 22287, 23753, 18888, 18888, 32602, 32665, 27211, 32693, 27211, 26972, 32713, 32729, 24401, 32764, 24401, 25877, 32785, 34768, 18888, 27390, 32823, 24594, 24855, 32857, 24890, 32878, 32904, 27211, 32942, 32977, 24401, 33000, 29313, 24401, 30790, 26206, 27666, 33904, 18888, 23086, 36353, 27211, 33036, 27211, 30756, 24012, 32153, 24401, 33056, 24401, 35861, 18888, 18888, 30354, 27972, 27211, 27211, 33800, 17590, 20145, 24401, 24401, 34638, 20811, 18888, 18888, 33074, 27211, 27212, 36167, 24402, 19868, 25659, 18888, 18889, 27211, 27211, 19719, 23889, 19868, 31018, 18890, 27211, 31833, 19406, 34616, 24169, 33093, 33123, 33157, 27856, 31741, 23862, 26552, 34302, 19837, 25782, 19760, 31015, 23516, 31008, 33178, 19973, 27963, 23497, 27951, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22818, 18836, 33205, 28113, 33240, 34097, 33275, 29183, 22087, 33318, 35438, 18888, 18890, 33345, 26391, 33382, 27211, 22121, 33399, 28072, 33442, 24401, 18866, 22232, 18888, 33459, 18888, 18888, 33480, 33498, 25175, 27211, 27211, 26704, 22164, 24775, 35239, 24401, 24401, 25914, 29580, 18888, 18888, 31109, 25211, 33520, 33539, 27211, 27211, 33556, 36284, 19484, 33585, 24401, 24401, 33604, 32556, 19628, 18888, 18888, 31262, 33658, 23086, 27211, 27211, 33679, 27211, 30756, 24012, 24401, 24401, 33716, 24401, 26854, 27480, 18888, 33752, 27855, 33259, 34701, 27211, 17590, 32102, 24782, 23807, 24401, 18887, 18888, 18888, 27211, 27211, 27212, 33773, 36105, 19868, 25659, 18888, 23368, 27211, 29157, 19719, 23889, 34454, 29286, 18890, 33794, 25302, 33816, 19447, 34079, 33853, 31862, 31017, 27856, 31741, 33877, 28920, 33937, 19837, 30461, 34002, 22276, 36041, 34029, 22105, 19419, 27963, 19659, 27951, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22833, 18836, 34064, 32616, 34113, 34141, 34157, 34192, 34208, 32216, 36013, 31549, 31952, 34224, 34248, 34287, 29330, 34350, 34389, 34413, 34481, 26793, 18866, 26187, 29635, 22293, 18888, 36654, 25783, 34522, 34544, 34566, 25821, 35072, 22164, 34586, 34609, 34632, 19604, 24036, 36644, 36674, 24681, 18888, 32401, 34654, 31339, 34682, 34698, 27211, 34717, 34753, 28053, 34812, 34836, 24401, 33619, 19628, 34858, 32236, 34906, 24598, 33523, 27612, 34890, 34922, 24732, 29246, 36717, 33634, 34465, 32984, 34168, 26750, 34957, 18888, 18888, 34994, 35010, 27211, 33040, 17590, 29913, 35035, 24401, 36304, 25482, 30171, 35883, 35068, 35088, 26627, 20441, 31173, 35123, 35143, 35176, 24640, 30492, 29358, 19719, 35192, 35219, 25384, 28801, 35255, 35279, 32586, 34496, 23086, 23330, 29061, 31017, 27856, 31741, 19840, 25783, 31738, 24547, 25164, 35315, 31796, 35353, 34316, 22105, 19419, 27963, 24091, 28630, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22848, 18836, 22059, 34782, 34088, 35389, 21008, 35405, 35421, 35454, 18888, 18888, 23466, 35487, 27211, 27211, 27211, 35513, 31154, 24401, 24401, 24401, 35560, 18888, 26863, 36664, 35601, 24872, 25783, 30389, 23536, 26250, 35647, 35666, 22164, 19522, 19564, 30582, 35682, 27697, 35575, 29114, 18888, 18888, 18888, 18890, 27211, 35702, 27211, 27211, 27211, 35723, 24401, 35527, 24401, 24401, 24401, 19628, 30184, 18888, 18888, 18888, 23086, 35739, 27211, 27211, 27211, 29139, 22938, 24401, 24401, 24401, 24401, 23898, 35756, 18888, 18888, 25025, 35778, 27211, 27211, 17590, 20064, 35795, 24401, 24401, 18887, 18888, 18888, 27211, 27211, 27212, 24016, 24402, 19868, 25659, 18888, 18889, 27211, 27211, 19719, 23889, 19868, 23917, 18890, 34550, 31833, 22262, 19447, 23086, 23330, 26418, 31017, 27856, 31741, 19840, 25783, 35812, 19837, 27187, 35841, 33135, 23516, 31008, 22105, 22148, 28712, 19659, 27951, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22863, 18836, 22059, 35877, 28723, 34097, 31164, 29183, 22087, 26758, 18888, 22592, 18890, 23989, 27211, 29812, 27211, 22121, 33778, 24401, 31421, 24401, 18866, 18888, 18888, 26872, 18888, 18888, 25783, 27211, 30732, 27211, 27211, 35072, 22164, 24401, 24908, 24401, 24401, 24036, 31693, 18888, 18888, 18888, 18888, 18890, 27211, 27211, 27211, 27211, 27211, 19484, 24401, 24401, 24401, 24401, 24401, 19628, 18888, 18888, 18888, 18888, 23086, 27211, 27211, 27211, 27211, 30756, 24012, 24401, 24401, 24401, 24401, 26750, 18888, 18888, 18888, 27855, 27211, 27211, 27211, 17590, 24017, 24401, 24401, 24401, 18887, 18888, 18888, 27211, 27211, 27212, 24016, 24402, 19868, 25659, 18888, 18889, 27211, 27211, 19719, 23889, 19868, 31018, 18890, 27211, 31833, 19406, 19447, 23086, 23330, 19828, 31017, 27856, 31741, 19840, 25783, 31738, 19837, 25782, 19760, 31015, 23516, 31008, 22105, 19419, 27963, 19659, 27951, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22878, 18836, 22059, 27837, 27857, 35899, 24401, 35915, 22087, 18888, 18888, 18888, 18890, 27211, 27211, 27211, 27211, 22121, 24401, 24401, 24401, 24401, 18866, 18888, 18888, 18888, 18888, 18888, 25783, 27211, 27211, 27211, 27211, 35072, 22164, 24401, 24401, 24401, 24401, 24036, 31602, 18888, 18888, 18888, 18888, 26223, 27211, 27211, 27211, 27211, 27211, 19484, 35931, 24401, 24401, 24401, 24401, 19628, 18888, 28136, 18888, 18888, 35949, 27211, 32862, 27211, 32697, 30756, 24012, 24401, 32283, 24401, 32128, 26750, 18888, 18888, 18888, 27855, 27211, 27211, 27211, 17590, 24017, 24401, 24401, 24401, 18887, 18888, 18888, 27211, 27211, 27212, 24016, 24402, 19868, 25659, 18888, 18889, 27211, 27211, 19719, 23889, 19868, 31018, 18890, 27211, 31833, 19406, 19447, 23086, 23330, 19828, 31017, 27856, 31741, 19840, 25783, 31738, 19837, 25782, 19760, 31015, 23516, 31008, 22105, 19419, 27963, 19659, 27951, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22893, 18836, 22059, 35974, 34882, 34097, 33960, 29183, 35996, 18888, 23311, 18888, 36029, 27211, 27211, 36064, 36081, 22121, 24401, 24401, 36104, 33950, 18866, 18888, 18888, 18888, 18888, 18888, 25783, 27211, 27211, 27211, 27211, 35072, 22164, 24401, 24401, 24401, 24401, 24036, 36121, 18888, 25559, 18888, 18888, 18890, 27211, 27211, 30313, 27211, 27211, 36154, 24401, 24401, 34397, 24401, 24401, 19628, 28250, 18888, 18888, 18888, 23086, 30926, 27211, 27211, 27211, 26983, 24012, 33642, 24401, 24401, 24401, 26750, 18888, 18888, 18888, 27855, 27211, 27211, 27211, 17590, 24017, 24401, 24401, 24401, 18887, 18888, 18888, 27211, 27211, 27212, 24016, 24402, 19868, 25659, 18888, 18889, 27211, 27211, 19719, 23889, 19868, 31018, 18890, 27211, 31833, 19406, 19447, 23086, 23330, 19828, 31017, 27856, 31741, 19840, 25783, 31738, 19837, 25782, 19760, 31015, 23516, 31008, 22105, 19419, 27963, 19659, 27951, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22339, 18836, 22059, 19354, 27857, 36190, 24401, 36206, 22087, 18888, 18888, 18888, 18007, 27211, 27211, 27211, 24724, 22121, 24401, 24401, 24401, 30827, 18866, 18888, 36222, 18888, 28795, 18888, 25783, 35100, 27211, 27429, 27211, 35072, 22164, 30836, 24401, 24499, 24401, 24036, 31693, 18888, 36244, 18888, 18888, 18890, 27211, 36088, 27211, 27211, 27211, 19484, 24401, 28036, 24401, 24401, 24401, 19628, 18888, 18888, 35631, 18888, 35762, 27211, 27211, 36277, 27211, 34730, 24012, 24401, 24401, 36300, 24401, 36320, 18888, 18888, 18888, 27855, 27211, 27211, 27211, 17590, 24017, 24401, 24401, 24401, 25712, 18888, 18888, 36346, 27211, 27212, 19184, 24402, 19868, 25659, 32029, 18889, 27211, 33359, 19719, 23889, 36369, 31018, 18890, 27211, 31833, 19406, 19447, 23086, 23330, 19828, 31017, 27856, 31741, 19840, 25783, 31738, 19837, 25782, 19760, 31015, 23516, 31008, 22105, 19419, 27963, 19659, 27951, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22384, 18836, 36389, 19008, 19233, 20367, 36434, 17173, 17595, 36437, 17330, 17349, 18921, 17189, 17208, 17281, 20355, 36453, 17308, 17327, 17346, 18918, 18452, 21880, 18649, 18665, 19006, 17265, 22033, 20765, 17421, 20535, 17192, 20362, 21726, 17311, 18658, 18999, 19008, 17447, 32952, 17497, 17520, 17251, 36411, 17782, 20682, 17714, 18326, 17543, 17559, 17585, 21887, 17504, 17527, 17258, 36418, 21915, 21940, 17611, 36467, 18217, 17633, 17661, 21190, 17703, 21176, 17730, 34737, 21946, 17617, 36473, 18223, 36531, 17477, 19152, 17860, 17892, 17675, 17753, 17832, 17590, 21620, 17481, 19156, 17864, 18731, 17918, 36551, 17292, 17934, 17979, 18727, 18681, 18405, 18621, 18039, 18056, 18072, 18117, 18143, 18706, 18052, 18209, 18250, 18239, 18266, 17963, 18296, 18312, 18376, 17807, 36403, 19232, 17796, 17163, 30642, 18392, 17816, 32961, 17645, 18805, 18421, 18437, 18519, 17393, 18747, 18505, 18535, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22369, 18836, 18987, 19008, 19233, 20367, 19008, 21737, 30763, 36437, 17330, 17349, 18921, 17189, 17208, 17281, 20355, 17949, 17308, 17327, 17346, 18918, 18452, 21880, 18649, 18665, 19006, 17265, 22033, 20765, 17421, 20535, 17192, 18127, 21873, 17311, 18658, 18999, 19008, 17447, 32952, 17497, 17520, 17251, 36411, 17782, 20682, 17714, 18326, 17543, 17559, 17585, 21887, 17504, 17527, 17258, 36418, 21915, 21940, 17611, 36467, 18217, 17633, 17661, 21190, 17703, 21176, 17730, 34737, 21946, 17617, 36473, 18223, 36531, 17477, 19152, 17860, 17892, 17675, 17753, 17832, 17590, 21620, 17481, 19156, 17864, 18731, 17918, 36551, 17292, 17934, 17979, 18727, 18681, 18405, 18621, 18039, 18056, 18072, 18117, 18143, 18706, 18052, 18209, 18250, 18239, 18266, 17963, 18296, 18312, 18376, 17807, 36403, 19232, 17796, 17163, 30642, 18392, 17816, 32961, 17645, 18805, 18421, 18437, 18519, 17393, 18747, 18505, 18535, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21813, 18836, 36489, 19008, 19233, 20367, 19008, 17173, 17737, 36437, 17330, 17349, 18921, 17189, 17208, 17281, 20355, 17768, 17308, 17327, 17346, 18918, 18452, 21880, 18649, 18665, 19006, 17265, 22033, 20765, 17421, 20535, 17192, 20543, 22022, 17311, 18658, 18999, 19008, 17447, 32952, 17497, 17520, 17251, 36411, 17782, 20682, 17714, 18326, 17543, 17559, 17585, 21887, 17504, 17527, 17258, 36418, 21915, 21940, 17611, 36467, 18217, 17633, 17661, 21190, 17703, 21176, 17730, 34737, 21946, 17617, 36473, 18223, 36531, 17477, 19152, 17860, 17892, 17675, 17753, 17832, 17590, 21620, 17481, 19156, 17864, 18731, 17918, 36551, 17292, 17934, 17979, 18727, 18681, 18405, 18621, 18039, 18056, 18072, 18117, 18143, 18706, 18052, 18209, 18250, 18239, 18266, 17963, 18296, 18312, 18376, 17807, 36403, 19232, 17796, 17163, 30642, 18392, 17816, 32961, 17645, 18805, 18421, 18437, 18519, 17393, 18747, 18505, 18535, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21828, 18836, 18987, 19008, 19233, 20367, 19008, 17173, 30763, 36437, 17330, 17349, 18921, 17189, 17208, 17281, 20355, 36517, 17308, 17327, 17346, 18918, 18452, 21880, 18649, 18665, 19006, 17265, 22033, 20765, 17421, 20535, 17192, 18127, 21873, 17311, 18658, 18999, 19008, 17447, 32952, 17497, 17520, 17251, 36411, 17782, 20682, 17714, 18326, 17543, 17559, 17585, 21887, 17504, 17527, 17258, 36418, 21915, 21940, 17611, 36467, 18217, 17633, 17661, 21190, 17703, 21176, 17730, 34737, 21946, 17617, 36473, 18223, 36531, 17477, 19152, 17860, 17892, 17675, 17753, 17832, 17590, 21620, 17481, 19156, 17864, 18731, 17918, 36551, 17292, 17934, 17979, 18727, 18681, 18405, 18621, 18039, 18056, 18072, 18117, 18143, 18706, 18052, 18209, 18250, 18239, 18266, 17963, 18296, 18312, 18376, 17807, 36403, 19232, 17796, 17163, 30642, 18392, 17816, 32961, 17645, 18805, 18421, 18437, 18519, 17393, 18747, 18505, 18535, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21828, 18836, 19307, 18888, 27857, 30756, 24401, 29183, 28015, 18888, 18888, 18888, 18890, 27211, 27211, 27211, 27211, 36567, 24401, 24401, 24401, 24401, 22953, 18888, 18888, 18888, 18888, 18888, 25783, 27211, 27211, 27211, 27211, 28537, 36603, 24401, 24401, 24401, 24401, 24036, 18881, 18888, 18888, 18888, 18888, 18890, 27211, 27211, 27211, 27211, 27211, 19484, 24401, 24401, 24401, 24401, 24401, 19628, 18888, 18888, 18888, 18888, 23086, 27211, 27211, 27211, 27211, 30756, 24012, 24401, 24401, 24401, 24401, 26750, 18888, 18888, 18888, 27855, 27211, 27211, 27211, 17590, 24017, 24401, 24401, 24401, 18887, 18888, 18888, 27211, 27211, 27212, 24016, 24402, 19868, 25659, 18888, 18889, 27211, 27211, 19719, 23889, 19868, 31018, 18890, 27211, 31833, 19406, 19447, 23086, 23330, 19828, 31017, 27856, 31741, 19840, 25783, 31738, 19837, 25782, 19760, 31015, 23516, 31008, 22105, 19419, 27963, 19659, 27951, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 36629, 36690, 18720, 19008, 19233, 20367, 19008, 17454, 17595, 36437, 17330, 17349, 18921, 17189, 17208, 17281, 20355, 17223, 17308, 17327, 17346, 18918, 36754, 21880, 18649, 18665, 19006, 17265, 22033, 20765, 17421, 20535, 17192, 20362, 21726, 17311, 18658, 18999, 19008, 17447, 32952, 17497, 17520, 17251, 36411, 17782, 20682, 17714, 18326, 17543, 17559, 17585, 21887, 17504, 17527, 17258, 36418, 21915, 21940, 17611, 36467, 18217, 17633, 17661, 21190, 17703, 21176, 17730, 34737, 21946, 17617, 36473, 18223, 36531, 17477, 19152, 17860, 17892, 17675, 17753, 17832, 17590, 21620, 17481, 19156, 17864, 18731, 17918, 36551, 17292, 17934, 17979, 18727, 18681, 18405, 18621, 18039, 18056, 18072, 18117, 18143, 18706, 18052, 18209, 18250, 18239, 18266, 17963, 18296, 18312, 18376, 17807, 36403, 19232, 17796, 17163, 30642, 18392, 17816, 32961, 17645, 18805, 18421, 18437, 18519, 17393, 18747, 18505, 18535, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 0, 94242, 0, 118820, 0, 2211840, 102439, 0, 0, 106538, 98347, 0, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2482176, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 2207744, 2404352, 2412544, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 3104768, 2605056, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2678784, 2207744, 2695168, 2207744, 2703360, 2207744, 2711552, 2752512, 2207744, 0, 0, 0, 0, 0, 0, 2166784, 0, 0, 0, 0, 0, 0, 2158592, 2158592, 3170304, 3174400, 2158592, 0, 139, 0, 2158592, 2158592, 2158592, 2158592, 2158592, 2424832, 2158592, 2158592, 2158592, 2748416, 2756608, 2777088, 2801664, 2158592, 2158592, 2158592, 2863104, 2891776, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 3104768, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2207744, 2785280, 2207744, 2809856, 2207744, 2207744, 2842624, 2207744, 2207744, 2207744, 2899968, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2473984, 2207744, 2207744, 2494464, 2207744, 2207744, 2207744, 2523136, 2158592, 2404352, 2412544, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2564096, 2158592, 2158592, 2605056, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2678784, 2158592, 2695168, 2158592, 2703360, 2158592, 2711552, 2752512, 2158592, 2158592, 2785280, 2158592, 2158592, 2785280, 2158592, 2809856, 2158592, 2158592, 2842624, 2158592, 2158592, 2158592, 2899968, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 18, 0, 0, 0, 0, 0, 0, 0, 2211840, 0, 0, 641, 0, 2158592, 0, 0, 0, 0, 0, 0, 0, 0, 2211840, 0, 0, 32768, 0, 2158592, 0, 2158592, 2158592, 2158592, 2383872, 2158592, 2158592, 2158592, 2158592, 3006464, 2383872, 2207744, 2207744, 2207744, 2207744, 2158877, 2158877, 2158877, 2158877, 0, 0, 0, 2158877, 2572573, 2158877, 2158877, 0, 2207744, 2207744, 2596864, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2641920, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 0, 0, 0, 167936, 0, 0, 2162688, 0, 0, 3104768, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 0, 0, 0, 2146304, 2146304, 2224128, 2224128, 2232320, 2232320, 2232320, 641, 0, 0, 0, 0, 0, 0, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2531328, 2158592, 2158592, 2158592, 2158592, 2158592, 2617344, 2158592, 2158592, 2158592, 2158592, 2441216, 2445312, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2502656, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2580480, 2158592, 2158592, 2158592, 2158592, 2621440, 2158592, 2580480, 2158592, 2158592, 2158592, 2158592, 2621440, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2699264, 2158592, 2158592, 2158592, 2158592, 2158592, 2748416, 2756608, 2777088, 2801664, 2207744, 2863104, 2891776, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 3018752, 2207744, 3043328, 2207744, 2207744, 2207744, 2207744, 3080192, 2207744, 2207744, 3112960, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 0, 0, 0, 172310, 279, 0, 2162688, 0, 0, 2207744, 2207744, 2207744, 3186688, 2207744, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2158592, 2158592, 2158592, 2404352, 2412544, 2158592, 2510848, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2584576, 2158592, 2609152, 2158592, 2158592, 2629632, 2158592, 2158592, 2158592, 2686976, 2158592, 2715648, 2158592, 2158592, 3121152, 2158592, 2158592, 2158592, 3149824, 2158592, 2158592, 3170304, 3174400, 2158592, 2367488, 2207744, 2207744, 2207744, 2207744, 2158592, 2158592, 2158592, 2158592, 0, 0, 0, 2158592, 2572288, 2158592, 2158592, 0, 2207744, 2207744, 2207744, 2433024, 2207744, 2453504, 2461696, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2510848, 2207744, 2207744, 2207744, 2207744, 2207744, 2531328, 2207744, 2207744, 2207744, 2207744, 2207744, 2617344, 2207744, 2207744, 2207744, 2207744, 2158592, 2158592, 2158592, 2158592, 0, 0, 0, 2158592, 2572288, 2158592, 2158592, 1508, 2715648, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2867200, 2207744, 2904064, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2580480, 2207744, 2207744, 2207744, 2207744, 2621440, 2207744, 2207744, 2207744, 3149824, 2207744, 2207744, 3170304, 3174400, 2207744, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 138, 2158592, 2158592, 2158592, 2404352, 2412544, 2707456, 2732032, 2207744, 2207744, 2207744, 2822144, 2826240, 2207744, 2895872, 2207744, 2207744, 2924544, 2207744, 2207744, 2973696, 2207744, 0, 0, 0, 0, 0, 0, 2166784, 0, 0, 0, 0, 0, 285, 2158592, 2158592, 3112960, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 3186688, 2158592, 2207744, 2207744, 2158592, 2158592, 2158592, 2158592, 2158592, 0, 0, 0, 2158592, 2158592, 2158592, 2158592, 0, 0, 2535424, 2543616, 2158592, 2158592, 2158592, 0, 0, 0, 2158592, 2158592, 2158592, 2990080, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2572288, 2981888, 2207744, 2207744, 3002368, 2207744, 3047424, 3063808, 3076096, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 3203072, 2708960, 2732032, 2158592, 2158592, 2158592, 2822144, 2827748, 2158592, 2895872, 2158592, 2158592, 2924544, 2158592, 2158592, 2973696, 2158592, 2981888, 2158592, 2158592, 3002368, 2158592, 3047424, 3063808, 3076096, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 3203072, 2981888, 2158592, 2158592, 3003876, 2158592, 3047424, 3063808, 3076096, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 3203072, 2207744, 2207744, 2207744, 2207744, 2207744, 2424832, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 20480, 0, 0, 0, 0, 0, 2162688, 20480, 0, 2523136, 2527232, 2158592, 2158592, 2576384, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2908160, 2527232, 2207744, 2207744, 2576384, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2908160, 2207744, 0, 0, 0, 0, 0, 0, 2166784, 0, 0, 0, 0, 0, 286, 2158592, 2158592, 0, 0, 2158592, 2158592, 2158592, 2158592, 2633728, 2658304, 0, 0, 2740224, 2744320, 0, 2834432, 2207744, 2207744, 2977792, 2207744, 2207744, 2207744, 2207744, 3039232, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 3158016, 0, 0, 29315, 0, 0, 0, 0, 45, 45, 45, 45, 45, 933, 45, 45, 45, 45, 442, 45, 45, 45, 45, 45, 45, 45, 45, 45, 67, 67, 2494464, 2158592, 2158592, 2158592, 2524757, 2527232, 2158592, 2158592, 2576384, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 1504, 2158592, 2498560, 2158592, 2158592, 2158592, 2158592, 2568192, 2158592, 2592768, 2625536, 2158592, 2158592, 2674688, 2736128, 2158592, 2158592, 0, 2158592, 2912256, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 3108864, 2158592, 2158592, 3133440, 3145728, 3153920, 2375680, 2379776, 2207744, 2207744, 2420736, 2207744, 2449408, 2207744, 2207744, 2207744, 2498560, 2207744, 2207744, 2207744, 2207744, 2568192, 2207744, 0, 0, 0, 0, 0, 0, 2166784, 0, 0, 0, 0, 0, 551, 2158592, 2158592, 2158592, 2158592, 2207744, 2506752, 2207744, 2207744, 2207744, 2207744, 2207744, 2158592, 2506752, 0, 2020, 2158592, 2592768, 2625536, 2207744, 2207744, 2674688, 2736128, 2207744, 2207744, 2207744, 2912256, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 0, 542, 0, 544, 2207744, 3108864, 2207744, 2207744, 3133440, 3145728, 3153920, 2375680, 2379776, 2158592, 2158592, 2420736, 2158592, 2449408, 2158592, 2158592, 2158592, 2158592, 2158592, 3186688, 2158592, 0, 641, 0, 0, 0, 0, 0, 0, 2367488, 2158592, 2498560, 2158592, 2158592, 1621, 2158592, 2158592, 2568192, 2158592, 2592768, 2625536, 2158592, 2158592, 2674688, 0, 0, 0, 0, 0, 1608, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1107, 97, 97, 1110, 97, 97, 3133440, 3145728, 3153920, 2158592, 2408448, 2416640, 2158592, 2465792, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 3014656, 2158592, 2158592, 3051520, 2158592, 2158592, 3100672, 2158592, 2158592, 3121152, 2158592, 2158592, 2158592, 3149824, 2416640, 2207744, 2465792, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2633728, 2658304, 2740224, 2744320, 2834432, 2949120, 2158592, 2985984, 2158592, 2998272, 2158592, 2158592, 2158592, 3129344, 2207744, 2408448, 2949120, 2207744, 2985984, 2207744, 2998272, 2207744, 2207744, 2207744, 3129344, 2158592, 2408448, 2416640, 2158592, 2465792, 2158592, 2158592, 2158592, 2158592, 2158592, 3186688, 2158592, 0, 32768, 0, 0, 0, 0, 0, 0, 2367488, 2949120, 2158592, 2985984, 2158592, 2998272, 2158592, 2158592, 2158592, 3129344, 2158592, 2158592, 2478080, 2158592, 2158592, 2158592, 2535424, 2543616, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 3117056, 2207744, 2207744, 2478080, 2207744, 2207744, 2207744, 2207744, 2699264, 2207744, 2207744, 2207744, 2207744, 2207744, 2748416, 2756608, 2777088, 2801664, 2207744, 2207744, 2158877, 2158877, 2158877, 2158877, 2158877, 0, 0, 0, 2158877, 2158877, 2158877, 2158877, 0, 0, 2535709, 2543901, 2158877, 2158877, 2158877, 0, 0, 0, 2158877, 2158877, 2158877, 2990365, 2158877, 2158877, 2158730, 2158730, 2158730, 2158730, 2158730, 2572426, 2207744, 2535424, 2543616, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 3117056, 2158592, 2158592, 2478080, 2207744, 2207744, 2990080, 2207744, 2207744, 2158592, 2158592, 2482176, 2158592, 2158592, 0, 0, 0, 2158592, 2158592, 2158592, 0, 2158592, 2908160, 2158592, 2158592, 2158592, 2977792, 2158592, 2158592, 2158592, 2158592, 3039232, 2158592, 2158592, 3010560, 2207744, 2428928, 2207744, 2514944, 2207744, 2588672, 2207744, 2838528, 2207744, 2207744, 2207744, 3010560, 2158592, 2428928, 2158592, 2514944, 0, 0, 2158592, 2588672, 2158592, 0, 2838528, 2158592, 2158592, 2158592, 3010560, 2158592, 2506752, 2158592, 18, 0, 0, 0, 0, 0, 0, 0, 2211840, 0, 0, 0, 0, 2158592, 0, 0, 29315, 922, 0, 0, 0, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1539, 45, 3006464, 2383872, 0, 2020, 2158592, 2158592, 2158592, 2158592, 3006464, 2158592, 2637824, 2953216, 2158592, 2207744, 2637824, 2953216, 2207744, 0, 0, 2158592, 2637824, 2953216, 2158592, 2539520, 2158592, 2539520, 2207744, 0, 0, 2539520, 2158592, 2158592, 2158592, 2158592, 2207744, 2506752, 2207744, 2207744, 2207744, 2207744, 2207744, 2158592, 2506752, 0, 0, 2158592, 2207744, 0, 2158592, 2158592, 2207744, 0, 2158592, 2158592, 2207744, 0, 2158592, 2965504, 2965504, 2965504, 0, 0, 0, 0, 0, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2474269, 2158877, 2158877, 0, 0, 2158877, 2158877, 2158877, 2158877, 2634013, 2658589, 0, 0, 2740509, 2744605, 0, 2834717, 40976, 18, 36884, 45078, 24, 28, 90143, 94242, 118820, 102439, 106538, 98347, 118820, 118820, 118820, 40976, 18, 18, 36884, 0, 0, 0, 24, 24, 24, 27, 27, 27, 27, 90143, 0, 0, 86016, 0, 0, 2211840, 102439, 0, 0, 0, 98347, 0, 2158592, 2158592, 2158592, 2158592, 2158592, 3158016, 0, 2375680, 2379776, 2158592, 2158592, 2420736, 2158592, 2449408, 2158592, 2158592, 0, 94242, 0, 0, 0, 2211840, 102439, 0, 0, 106538, 98347, 135, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2564096, 2158592, 2158592, 2158592, 2158592, 2158592, 2596864, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2641920, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2781184, 2793472, 2494464, 2158592, 2158592, 2158592, 2523136, 2527232, 2158592, 2158592, 2576384, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 0, 40976, 0, 18, 18, 24, 0, 27, 27, 0, 2158592, 2498560, 2158592, 2158592, 0, 2158592, 2158592, 2568192, 2158592, 2592768, 2625536, 2158592, 2158592, 2674688, 0, 0, 0, 0, 0, 2211840, 0, 0, 0, 0, 0, 0, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2473984, 2158592, 2158592, 2494464, 2158592, 2158592, 2158592, 3006464, 2383872, 0, 0, 2158592, 2158592, 2158592, 2158592, 3006464, 2158592, 2637824, 2953216, 2158592, 2207744, 2637824, 2953216, 40976, 18, 36884, 45078, 24, 27, 147488, 94242, 147456, 147488, 106538, 98347, 0, 0, 147456, 40976, 18, 18, 36884, 0, 45078, 0, 24, 24, 24, 27, 27, 27, 27, 0, 81920, 0, 94242, 0, 0, 0, 2211840, 0, 0, 0, 106538, 98347, 0, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2428928, 2158592, 2514944, 2158592, 2588672, 2158592, 2838528, 2158592, 2158592, 40976, 18, 151573, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 0, 40976, 18, 18, 36884, 0, 45078, 0, 24, 24, 24, 27, 27, 27, 27, 90143, 0, 0, 1315, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1487, 97, 18, 131427, 0, 0, 0, 0, 0, 0, 362, 0, 0, 365, 29315, 367, 0, 0, 29315, 0, 0, 0, 0, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 67, 67, 130, 94242, 0, 0, 0, 2211840, 102439, 0, 0, 106538, 98347, 0, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 3096576, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2207744, 2207744, 2158592, 18, 0, 0, 0, 0, 0, 0, 0, 2211840, 0, 0, 0, 0, 2158592, 644, 2207744, 2207744, 2207744, 3186688, 2207744, 0, 1080, 0, 1084, 0, 1088, 0, 0, 0, 0, 0, 0, 0, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2531466, 2158730, 2158730, 2158730, 2158730, 2158730, 2617482, 0, 94242, 0, 0, 0, 2211840, 102439, 0, 0, 106538, 98347, 0, 2158592, 2158592, 2158592, 2158592, 2158592, 2781184, 2793472, 2158592, 2818048, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 40976, 18, 36884, 45078, 24, 27, 90143, 159779, 159744, 102439, 159779, 98347, 0, 0, 159744, 40976, 18, 18, 36884, 0, 45078, 0, 2224253, 172032, 2224253, 2232448, 2232448, 172032, 2232448, 90143, 0, 0, 2170880, 0, 0, 550, 829, 2158592, 2158592, 2158592, 2387968, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 0, 40976, 0, 18, 18, 124, 124, 127, 127, 127, 40976, 18, 36884, 45078, 25, 29, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 163931, 40976, 18, 18, 36884, 0, 45078, 249856, 24, 24, 24, 27, 27, 27, 27, 90143, 0, 0, 2170880, 0, 0, 827, 0, 2158592, 2158592, 2158592, 2387968, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 0, 40976, 0, 4243810, 4243810, 24, 24, 27, 27, 27, 2207744, 0, 0, 0, 0, 0, 0, 2166784, 0, 0, 0, 0, 57344, 286, 2158592, 2158592, 2158592, 2158592, 2707456, 2732032, 2158592, 2158592, 2158592, 2822144, 2826240, 2158592, 2895872, 2158592, 2158592, 2924544, 2158592, 2158592, 2973696, 2158592, 2207744, 2207744, 2207744, 3186688, 2207744, 0, 0, 0, 0, 0, 0, 53248, 0, 0, 0, 0, 0, 97, 97, 97, 97, 97, 1613, 97, 97, 97, 97, 97, 97, 1495, 97, 97, 97, 97, 97, 97, 97, 97, 97, 566, 97, 97, 97, 97, 97, 97, 2207744, 0, 0, 0, 0, 0, 0, 2166784, 546, 0, 0, 0, 0, 286, 2158592, 2158592, 2158592, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 17, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 20480, 120, 121, 18, 18, 36884, 0, 45078, 0, 24, 24, 24, 27, 27, 27, 27, 90143, 0, 0, 2170880, 0, 53248, 550, 0, 2158592, 2158592, 2158592, 2387968, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 0, 40976, 196608, 18, 266240, 24, 24, 27, 27, 27, 0, 94242, 0, 0, 0, 38, 102439, 0, 0, 106538, 98347, 0, 45, 45, 45, 45, 45, 45, 45, 1535, 45, 45, 45, 45, 45, 45, 45, 1416, 45, 45, 45, 45, 45, 45, 45, 45, 424, 45, 45, 45, 45, 45, 45, 45, 45, 45, 405, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 199, 45, 45, 67, 67, 67, 67, 67, 491, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1766, 67, 67, 67, 1767, 67, 24850, 24850, 12564, 12564, 0, 0, 2166784, 546, 0, 53531, 53531, 0, 286, 97, 97, 0, 0, 97, 97, 97, 97, 97, 97, 0, 0, 97, 97, 0, 97, 97, 97, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 67, 67, 67, 67, 743, 57889, 0, 2170880, 0, 0, 550, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 45, 45, 45, 45, 45, 45, 45, 45, 1856, 45, 1858, 1859, 67, 67, 67, 1009, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1021, 67, 67, 67, 67, 67, 25398, 0, 13112, 0, 54074, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2367773, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2699549, 2158877, 2158877, 2158877, 2158877, 2158877, 2748701, 2756893, 2777373, 2801949, 97, 1115, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 857, 97, 67, 67, 67, 67, 67, 1258, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1826, 67, 97, 97, 97, 97, 97, 97, 1338, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 870, 97, 97, 67, 67, 67, 1463, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1579, 67, 67, 97, 97, 97, 1518, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 904, 905, 97, 97, 97, 97, 1620, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 0, 921, 0, 0, 0, 0, 0, 0, 45, 1679, 67, 67, 67, 1682, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1690, 67, 0, 0, 97, 97, 97, 97, 45, 45, 67, 67, 0, 0, 97, 97, 45, 45, 45, 669, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 189, 45, 45, 45, 1748, 45, 45, 45, 1749, 1750, 45, 45, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 1959, 67, 67, 67, 67, 1768, 67, 67, 67, 67, 67, 67, 67, 67, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1791, 97, 97, 97, 97, 97, 97, 97, 97, 45, 45, 45, 45, 45, 45, 1802, 67, 1817, 67, 67, 67, 67, 67, 67, 1823, 67, 67, 67, 67, 97, 97, 97, 97, 0, 0, 0, 97, 97, 97, 97, 0, 97, 97, 97, 97, 1848, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 659, 45, 45, 45, 45, 45, 45, 45, 1863, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 495, 67, 67, 67, 67, 67, 1878, 97, 97, 97, 97, 0, 0, 0, 97, 97, 97, 97, 0, 0, 97, 97, 97, 97, 97, 0, 0, 0, 97, 97, 97, 97, 97, 97, 45, 45, 45, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 97, 97, 97, 97, 0, 0, 0, 1973, 97, 97, 97, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1165, 97, 1167, 67, 24850, 24850, 12564, 12564, 0, 0, 2166784, 0, 0, 53531, 53531, 0, 286, 97, 97, 0, 0, 97, 97, 97, 97, 97, 97, 0, 0, 97, 97, 1789, 97, 0, 94242, 0, 0, 0, 2211840, 102439, 0, 0, 106538, 98347, 136, 2158592, 2158592, 2158592, 2158592, 2158592, 3158016, 229376, 2375680, 2379776, 2158592, 2158592, 2420736, 2158592, 2449408, 2158592, 2158592, 67, 24850, 24850, 12564, 12564, 0, 0, 280, 547, 0, 53531, 53531, 0, 286, 97, 97, 0, 0, 97, 97, 97, 97, 97, 97, 0, 1788, 97, 97, 0, 97, 2024, 97, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 67, 67, 67, 235, 67, 67, 67, 67, 67, 57889, 547, 547, 0, 0, 550, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 45, 45, 45, 1799, 45, 45, 45, 67, 67, 67, 67, 67, 25398, 0, 13112, 0, 54074, 0, 0, 1092, 0, 0, 0, 0, 0, 97, 97, 97, 97, 1612, 97, 97, 97, 97, 1616, 97, 1297, 1472, 0, 0, 0, 0, 1303, 1474, 0, 0, 0, 0, 1309, 1476, 0, 0, 0, 0, 97, 97, 97, 1481, 97, 97, 97, 97, 97, 97, 1488, 97, 0, 1474, 0, 1476, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 607, 97, 97, 97, 97, 40976, 18, 36884, 45078, 26, 30, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 213080, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 143448, 40976, 18, 18, 36884, 0, 45078, 0, 24, 24, 24, 27, 27, 27, 27, 0, 0, 0, 0, 97, 97, 97, 97, 1482, 97, 1483, 97, 97, 97, 97, 97, 97, 1326, 97, 97, 1329, 1330, 97, 97, 97, 97, 97, 97, 1159, 1160, 97, 97, 97, 97, 97, 97, 97, 97, 590, 97, 97, 97, 97, 97, 97, 97, 0, 94242, 0, 0, 0, 2211974, 102439, 0, 0, 106538, 98347, 0, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2474122, 2158730, 2158730, 2494602, 2158730, 2158730, 2158730, 2809994, 2158730, 2158730, 2842762, 2158730, 2158730, 2158730, 2900106, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 3014794, 2158730, 2158730, 3051658, 2158730, 2158730, 3100810, 2158730, 2158730, 2158730, 2158730, 3096714, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2207744, 2207744, 2207744, 2207744, 2207744, 2572288, 2207744, 2207744, 2207744, 2207744, 541, 541, 543, 543, 0, 0, 2166784, 0, 548, 549, 549, 0, 286, 2158877, 2158877, 2158877, 2863389, 2892061, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 3186973, 2158877, 0, 0, 0, 0, 0, 0, 0, 0, 2367626, 2158877, 2404637, 2412829, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2564381, 2158877, 2158877, 2605341, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2679069, 2158877, 2695453, 2158877, 2703645, 2158877, 2711837, 2752797, 2158877, 0, 2158877, 2158877, 2158877, 2384010, 2158730, 2158730, 2158730, 2158730, 3006602, 2383872, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 3096576, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 0, 0, 0, 0, 0, 0, 2162688, 0, 0, 2158877, 2785565, 2158877, 2810141, 2158877, 2158877, 2842909, 2158877, 2158877, 2158877, 2900253, 2158877, 2158877, 2158877, 2158877, 2158877, 2531613, 2158877, 2158877, 2158877, 2158877, 2158877, 2617629, 2158877, 2158877, 2158877, 2158877, 2158730, 2818186, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 3105053, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 0, 0, 0, 0, 0, 97, 97, 97, 1611, 97, 97, 97, 97, 97, 97, 97, 1496, 97, 97, 1499, 97, 97, 97, 97, 97, 2441354, 2445450, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2502794, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2433162, 2158730, 2453642, 2461834, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2580618, 2158730, 2158730, 2158730, 2158730, 2621578, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2699402, 2158730, 2158730, 2158730, 2158730, 2678922, 2158730, 2695306, 2158730, 2703498, 2158730, 2711690, 2752650, 2158730, 2158730, 2785418, 2158730, 2158730, 2158730, 3113098, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 3186826, 2158730, 2207744, 2207744, 2207744, 2207744, 2781184, 2793472, 2207744, 2818048, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 0, 541, 0, 543, 2158877, 2502941, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2580765, 2158877, 2158877, 2158877, 2158877, 2621725, 2158877, 3019037, 2158877, 3043613, 2158877, 2158877, 2158877, 2158877, 3080477, 2158877, 2158877, 3113245, 2158877, 2158877, 2158877, 2158877, 0, 2158877, 2908445, 2158877, 2158877, 2158877, 2978077, 2158877, 2158877, 2158877, 2158877, 3039517, 2158877, 2158730, 2510986, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2584714, 2158730, 2609290, 2158730, 2158730, 2629770, 2158730, 2158730, 2158730, 2388106, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2605194, 2158730, 2158730, 2158730, 2158730, 2687114, 2158730, 2715786, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2867338, 2158730, 2904202, 2158730, 2158730, 2158730, 2642058, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2781322, 2793610, 2158730, 3121290, 2158730, 2158730, 2158730, 3149962, 2158730, 2158730, 3170442, 3174538, 2158730, 2367488, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2441216, 2445312, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2502656, 2158877, 2433309, 2158877, 2453789, 2461981, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2511133, 2158877, 2158877, 2158877, 2158877, 2584861, 2158877, 2609437, 2158877, 2158877, 2629917, 2158877, 2158877, 2158877, 2687261, 2158877, 2715933, 2158877, 2158730, 2158730, 2973834, 2158730, 2982026, 2158730, 2158730, 3002506, 2158730, 3047562, 3063946, 3076234, 2158730, 2158730, 2158730, 2158730, 2207744, 2506752, 2207744, 2207744, 2207744, 2207744, 2207744, 2158877, 2507037, 0, 0, 2158877, 2158730, 2158730, 2158730, 3203210, 2207744, 2207744, 2207744, 2207744, 2207744, 2424832, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2564096, 2207744, 2207744, 2207744, 2707741, 2732317, 2158877, 2158877, 2158877, 2822429, 2826525, 2158877, 2896157, 2158877, 2158877, 2924829, 2158877, 2158877, 2973981, 2158877, 18, 0, 0, 0, 0, 0, 0, 0, 2211840, 0, 0, 642, 0, 2158592, 0, 45, 1529, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1755, 45, 67, 67, 2982173, 2158877, 2158877, 3002653, 2158877, 3047709, 3064093, 3076381, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 3203357, 2523274, 2527370, 2158730, 2158730, 2576522, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2908298, 2494749, 2158877, 2158877, 2158877, 2523421, 2527517, 2158877, 2158877, 2576669, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 0, 40976, 0, 18, 18, 4321280, 2224253, 2232448, 4329472, 2232448, 2158730, 2498698, 2158730, 2158730, 2158730, 2158730, 2568330, 2158730, 2592906, 2625674, 2158730, 2158730, 2674826, 2736266, 2158730, 2158730, 2158730, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2158730, 2912394, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 3109002, 2158730, 2158730, 3133578, 3145866, 3154058, 2375680, 2207744, 3108864, 2207744, 2207744, 3133440, 3145728, 3153920, 2375965, 2380061, 2158877, 2158877, 2421021, 2158877, 2449693, 2158877, 2158877, 2158877, 3117341, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 3104906, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158877, 2498845, 2158877, 2158877, 0, 2158877, 2158877, 2568477, 2158877, 2593053, 2625821, 2158877, 2158877, 2674973, 0, 0, 0, 0, 97, 97, 1480, 97, 97, 97, 97, 97, 1485, 97, 97, 97, 0, 97, 97, 1729, 97, 1731, 97, 97, 97, 97, 97, 97, 97, 311, 97, 97, 97, 97, 97, 97, 97, 97, 1520, 97, 97, 1523, 97, 97, 1526, 97, 2736413, 2158877, 2158877, 0, 2158877, 2912541, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 3109149, 2158877, 2158877, 3014941, 2158877, 2158877, 3051805, 2158877, 2158877, 3100957, 2158877, 2158877, 3121437, 2158877, 2158877, 2158877, 3150109, 3133725, 3146013, 3154205, 2158730, 2408586, 2416778, 2158730, 2465930, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 3018890, 2158730, 3043466, 2158730, 2158730, 2158730, 2158730, 3080330, 2633866, 2658442, 2740362, 2744458, 2834570, 2949258, 2158730, 2986122, 2158730, 2998410, 2158730, 2158730, 2158730, 3129482, 2207744, 2408448, 2949120, 2207744, 2985984, 2207744, 2998272, 2207744, 2207744, 2207744, 3129344, 2158877, 2408733, 2416925, 2158877, 2466077, 2158877, 2158877, 3170589, 3174685, 2158877, 0, 0, 0, 2158730, 2158730, 2158730, 2158730, 2158730, 2424970, 2158730, 2158730, 2158730, 2158730, 2707594, 2732170, 2158730, 2158730, 2158730, 2822282, 2826378, 2158730, 2896010, 2158730, 2158730, 2924682, 2949405, 2158877, 2986269, 2158877, 2998557, 2158877, 2158877, 2158877, 3129629, 2158730, 2158730, 2478218, 2158730, 2158730, 2158730, 2535562, 2543754, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 3117194, 2207744, 2207744, 2478080, 2207744, 2207744, 2207744, 2207744, 3014656, 2207744, 2207744, 3051520, 2207744, 2207744, 3100672, 2207744, 2207744, 3121152, 2207744, 2207744, 2207744, 2207744, 2207744, 2584576, 2207744, 2609152, 2207744, 2207744, 2629632, 2207744, 2207744, 2207744, 2686976, 2207744, 2207744, 2535424, 2543616, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 3117056, 2158877, 2158877, 2478365, 0, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158730, 2158730, 2482314, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2207744, 2207744, 2207744, 2387968, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 0, 823, 0, 825, 2158730, 2158730, 2158730, 2990218, 2158730, 2158730, 2207744, 2207744, 2482176, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 0, 0, 0, 0, 0, 0, 2162688, 135, 0, 2207744, 2207744, 2990080, 2207744, 2207744, 2158877, 2158877, 2482461, 2158877, 2158877, 0, 0, 0, 2158877, 2158877, 2158877, 2158877, 2158877, 2158730, 2429066, 2158730, 2515082, 2158730, 2588810, 2158730, 2838666, 2158730, 2158730, 2158730, 3010698, 2207744, 2428928, 2207744, 2514944, 2207744, 2588672, 2207744, 2838528, 2207744, 2207744, 2207744, 3010560, 2158877, 2429213, 2158877, 2515229, 0, 0, 2158877, 2588957, 2158877, 0, 2838813, 2158877, 2158877, 2158877, 3010845, 2158730, 2506890, 2158730, 2158730, 2158730, 2748554, 2756746, 2777226, 2801802, 2158730, 2158730, 2158730, 2863242, 2891914, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 2564234, 2158730, 2158730, 2158730, 2158730, 2158730, 2597002, 2158730, 2158730, 2158730, 3006464, 2384157, 0, 0, 2158877, 2158877, 2158877, 2158877, 3006749, 2158730, 2637962, 2953354, 2158730, 2207744, 2637824, 2953216, 2207744, 0, 0, 2158877, 2638109, 2953501, 2158877, 2539658, 2158730, 2539520, 2207744, 0, 0, 2539805, 2158877, 2158730, 2158730, 2158730, 2977930, 2158730, 2158730, 2158730, 2158730, 3039370, 2158730, 2158730, 2158730, 2158730, 2158730, 2158730, 3158154, 2207744, 0, 2158877, 2158730, 2207744, 0, 2158877, 2158730, 2207744, 0, 2158877, 2965642, 2965504, 2965789, 0, 0, 0, 0, 1315, 0, 0, 0, 0, 97, 97, 97, 97, 97, 97, 97, 1484, 97, 97, 97, 97, 2158592, 18, 0, 122880, 0, 0, 0, 77824, 0, 2211840, 0, 0, 0, 0, 2158592, 0, 356, 0, 0, 0, 0, 0, 0, 28809, 0, 139, 45, 45, 45, 45, 45, 45, 1751, 45, 45, 45, 45, 45, 45, 45, 67, 67, 1427, 67, 67, 67, 67, 67, 1432, 67, 67, 67, 3104768, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 122880, 0, 0, 0, 0, 1315, 0, 0, 0, 0, 97, 97, 97, 97, 97, 97, 1322, 550, 0, 286, 0, 2158592, 2158592, 2158592, 2158592, 2158592, 2424832, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 0, 40976, 0, 18, 18, 24, 24, 4329472, 27, 27, 2207744, 2207744, 2977792, 2207744, 2207744, 2207744, 2207744, 3039232, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 3158016, 542, 0, 0, 0, 542, 0, 544, 0, 0, 0, 544, 0, 550, 0, 0, 0, 0, 0, 97, 97, 1610, 97, 97, 97, 97, 97, 97, 97, 97, 898, 97, 97, 97, 97, 97, 97, 97, 0, 94242, 0, 0, 0, 2211840, 0, 0, 0, 0, 0, 0, 2158592, 2158592, 2158592, 2158592, 2158592, 2424832, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 237568, 102439, 106538, 98347, 0, 0, 20480, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 192512, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 94, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 96, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 12378, 40976, 18, 18, 36884, 0, 45078, 0, 24, 24, 24, 126, 126, 126, 126, 90143, 0, 0, 2170880, 0, 0, 0, 0, 2158592, 2158592, 2158592, 2387968, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 20480, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 241664, 102439, 106538, 98347, 0, 0, 20568, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 200797, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 20480, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 0, 0, 44, 0, 0, 20575, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 41, 41, 41, 0, 0, 1126400, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 0, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 89, 40976, 18, 18, 36884, 0, 45078, 0, 24, 24, 24, 27, 131201, 27, 27, 90143, 0, 0, 2170880, 0, 0, 550, 0, 2158592, 2158592, 2158592, 2387968, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2441216, 2445312, 2158592, 2158592, 2158592, 2158592, 2158592, 0, 94242, 0, 0, 208896, 2211840, 102439, 0, 0, 106538, 98347, 0, 2158592, 2158592, 2158592, 2158592, 2158592, 3186688, 2158592, 0, 0, 0, 0, 0, 0, 0, 0, 2367488, 32768, 0, 0, 0, 0, 0, 0, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2433024, 2158592, 2453504, 2461696, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2510848, 2158592, 2158592, 2158592, 2158592, 40976, 18, 36884, 245783, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 20480, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 221184, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 180224, 40976, 18, 18, 36884, 155648, 45078, 0, 24, 24, 217088, 27, 27, 27, 217088, 90143, 0, 0, 2170880, 0, 0, 828, 0, 2158592, 2158592, 2158592, 2387968, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2207744, 2207744, 2207744, 2387968, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 0, 0, 0, 0, 0, 0, 2162688, 233472, 0, 0, 94242, 0, 0, 0, 38, 102439, 0, 0, 106538, 98347, 28809, 45, 45, 45, 45, 45, 718, 45, 45, 45, 45, 45, 45, 45, 45, 45, 727, 131427, 0, 0, 0, 0, 362, 0, 365, 28809, 367, 139, 45, 45, 45, 45, 45, 45, 1808, 45, 45, 45, 45, 67, 67, 67, 67, 67, 67, 67, 97, 97, 0, 0, 97, 67, 24850, 24850, 12564, 12564, 0, 57889, 0, 0, 0, 53531, 53531, 367, 286, 97, 97, 0, 0, 97, 97, 97, 97, 97, 97, 1787, 0, 97, 97, 0, 97, 97, 97, 45, 45, 45, 45, 2029, 45, 67, 67, 67, 67, 2033, 57889, 0, 0, 54074, 54074, 550, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 45, 1798, 45, 45, 1800, 45, 45, 0, 1472, 0, 0, 0, 0, 0, 1474, 0, 0, 0, 0, 0, 1476, 0, 0, 0, 0, 1315, 0, 0, 0, 0, 97, 97, 97, 97, 1320, 97, 97, 0, 0, 97, 97, 97, 97, 1786, 97, 0, 0, 97, 97, 0, 1790, 1527, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 663, 67, 24850, 24850, 12564, 12564, 0, 57889, 281, 0, 0, 53531, 53531, 367, 286, 97, 97, 0, 0, 97, 97, 97, 1785, 97, 97, 0, 0, 97, 97, 0, 97, 97, 1979, 97, 97, 45, 45, 1983, 45, 1984, 45, 45, 45, 45, 45, 652, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 690, 45, 45, 694, 45, 45, 40976, 19, 36884, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 262144, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 46, 67, 98, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 45, 67, 97, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 258048, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 1122423, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 1114152, 1114152, 1114152, 0, 0, 1114112, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 37, 102439, 106538, 98347, 0, 0, 204800, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 0, 102439, 106538, 98347, 0, 0, 57436, 40976, 18, 36884, 45078, 24, 27, 33, 33, 0, 33, 33, 33, 0, 0, 0, 40976, 18, 18, 36884, 0, 45078, 0, 124, 124, 124, 127, 127, 127, 127, 90143, 0, 0, 2170880, 0, 0, 550, 0, 2158877, 2158877, 2158877, 2388253, 2158877, 2158877, 2158877, 2158877, 2158877, 2781469, 2793757, 2158877, 2818333, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2867485, 2158877, 2904349, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 3096861, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2441501, 2445597, 2158877, 2158877, 2158877, 2158877, 2158877, 40976, 122, 123, 36884, 0, 45078, 0, 24, 24, 24, 27, 27, 27, 27, 90143, 0, 921, 29315, 0, 0, 0, 0, 45, 45, 45, 45, 45, 45, 45, 45, 936, 2158592, 4243810, 0, 0, 0, 0, 0, 0, 0, 2211840, 0, 0, 0, 0, 2158592, 0, 921, 29315, 0, 0, 0, 0, 45, 45, 45, 45, 45, 45, 45, 935, 45, 45, 45, 715, 45, 45, 45, 45, 45, 45, 45, 723, 45, 45, 45, 45, 45, 1182, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 430, 45, 45, 45, 45, 45, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 47, 68, 99, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 48, 69, 100, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 49, 70, 101, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 50, 71, 102, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 51, 72, 103, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 52, 73, 104, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 53, 74, 105, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 54, 75, 106, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 55, 76, 107, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 56, 77, 108, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 57, 78, 109, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 58, 79, 110, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 59, 80, 111, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 60, 81, 112, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 61, 82, 113, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 62, 83, 114, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 63, 84, 115, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 64, 85, 116, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 65, 86, 117, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 38, 102439, 106538, 98347, 66, 87, 118, 40976, 18, 36884, 45078, 24, 27, 90143, 94242, 118820, 102439, 106538, 98347, 118820, 118820, 118820, 40976, 18, 18, 0, 0, 45078, 0, 24, 24, 24, 27, 27, 27, 27, 90143, 0, 0, 1314, 0, 0, 0, 0, 0, 0, 97, 97, 97, 97, 97, 1321, 97, 18, 131427, 0, 0, 0, 0, 0, 0, 362, 0, 0, 365, 0, 367, 0, 0, 1315, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1360, 97, 97, 131, 94242, 0, 0, 0, 38, 102439, 0, 0, 106538, 98347, 28809, 45, 45, 45, 145, 149, 45, 45, 45, 45, 45, 174, 45, 179, 45, 185, 45, 188, 45, 45, 202, 67, 255, 67, 67, 269, 67, 67, 0, 24850, 12564, 0, 0, 0, 0, 28809, 53531, 97, 97, 97, 292, 296, 97, 97, 97, 97, 97, 321, 97, 326, 97, 332, 97, 18, 131427, 0, 0, 0, 0, 0, 0, 362, 0, 0, 365, 29315, 367, 646, 335, 97, 97, 349, 97, 97, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 437, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 67, 67, 67, 523, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 511, 67, 67, 67, 97, 97, 97, 620, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1501, 1502, 97, 793, 67, 67, 796, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 808, 67, 0, 0, 97, 97, 97, 97, 45, 45, 67, 67, 0, 0, 97, 97, 2052, 67, 67, 67, 67, 813, 67, 67, 67, 67, 67, 67, 67, 25398, 542, 13112, 544, 57889, 0, 0, 54074, 54074, 550, 830, 97, 97, 97, 97, 97, 97, 97, 97, 97, 315, 97, 97, 97, 97, 97, 97, 841, 97, 97, 97, 97, 97, 97, 97, 97, 97, 854, 97, 97, 97, 97, 97, 97, 589, 97, 97, 97, 97, 97, 97, 97, 97, 97, 867, 97, 97, 97, 97, 97, 97, 97, 891, 97, 97, 894, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 906, 45, 937, 45, 45, 940, 45, 45, 45, 45, 45, 45, 948, 45, 45, 45, 45, 45, 734, 735, 67, 737, 67, 738, 67, 740, 67, 67, 67, 45, 967, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 435, 45, 45, 45, 980, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 415, 45, 45, 67, 67, 1024, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 97, 97, 97, 67, 67, 67, 67, 67, 25398, 1081, 13112, 1085, 54074, 1089, 0, 0, 0, 0, 0, 0, 363, 0, 28809, 0, 139, 45, 45, 45, 45, 45, 45, 1674, 45, 45, 45, 45, 45, 45, 45, 45, 67, 1913, 67, 1914, 67, 67, 67, 1918, 67, 67, 97, 97, 97, 97, 1118, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 630, 97, 97, 97, 97, 97, 1169, 97, 97, 97, 97, 97, 0, 921, 0, 1175, 0, 0, 0, 0, 45, 45, 45, 45, 45, 45, 1534, 45, 45, 45, 45, 45, 1538, 45, 45, 45, 45, 1233, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 67, 67, 67, 742, 67, 45, 45, 1191, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 454, 67, 67, 67, 67, 1243, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1251, 67, 0, 0, 97, 97, 97, 97, 45, 45, 67, 67, 2050, 0, 97, 97, 45, 45, 45, 732, 45, 45, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 97, 97, 67, 67, 67, 1284, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 772, 67, 67, 67, 1293, 67, 67, 67, 67, 67, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 368, 2158592, 2158592, 2158592, 2404352, 2412544, 1323, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1331, 97, 97, 97, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1737, 97, 1364, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1373, 97, 18, 131427, 0, 0, 0, 0, 0, 0, 362, 0, 0, 365, 29315, 367, 647, 45, 45, 1387, 45, 45, 1391, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 410, 45, 45, 45, 45, 45, 1400, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1407, 45, 45, 45, 45, 45, 941, 45, 943, 45, 45, 45, 45, 45, 45, 951, 45, 67, 1438, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1447, 67, 67, 67, 67, 67, 67, 782, 67, 67, 67, 67, 67, 67, 67, 67, 67, 756, 67, 67, 67, 67, 67, 67, 97, 1491, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1500, 97, 97, 97, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1736, 97, 45, 45, 1541, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 677, 45, 45, 67, 1581, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 791, 792, 67, 67, 67, 67, 1598, 67, 1600, 67, 67, 67, 67, 67, 67, 67, 67, 1472, 97, 97, 97, 1727, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1513, 97, 97, 67, 67, 97, 1879, 97, 1881, 97, 0, 1884, 0, 97, 97, 97, 97, 0, 0, 97, 97, 97, 97, 97, 0, 0, 0, 1842, 97, 97, 67, 67, 67, 67, 67, 97, 97, 97, 97, 1928, 0, 0, 0, 97, 97, 97, 97, 97, 97, 45, 45, 45, 45, 45, 1903, 45, 45, 45, 67, 67, 67, 67, 97, 97, 97, 97, 1971, 0, 0, 97, 97, 97, 97, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 0, 0, 0, 45, 45, 45, 1381, 45, 45, 45, 45, 1976, 97, 97, 97, 97, 97, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1747, 809, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 25398, 542, 13112, 544, 97, 907, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 638, 0, 0, 0, 0, 1478, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1150, 97, 97, 97, 97, 67, 67, 67, 67, 1244, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 477, 67, 67, 67, 67, 67, 67, 1294, 67, 67, 67, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1324, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 0, 0, 0, 1374, 97, 97, 97, 97, 0, 1175, 0, 45, 45, 45, 45, 45, 45, 45, 45, 945, 45, 45, 45, 45, 45, 45, 45, 45, 1908, 45, 45, 1910, 45, 67, 67, 67, 67, 67, 67, 67, 67, 1919, 67, 0, 0, 97, 97, 97, 97, 45, 2048, 67, 2049, 0, 0, 97, 2051, 45, 45, 45, 939, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 397, 45, 45, 45, 1921, 67, 67, 1923, 67, 97, 97, 97, 97, 97, 0, 0, 0, 97, 97, 97, 97, 97, 97, 45, 45, 45, 45, 1947, 45, 1935, 0, 0, 0, 97, 1939, 97, 97, 1941, 97, 45, 45, 45, 45, 45, 45, 382, 389, 45, 45, 45, 45, 45, 45, 45, 45, 1810, 45, 45, 1812, 67, 67, 67, 67, 67, 256, 67, 67, 67, 67, 67, 0, 24850, 12564, 0, 0, 0, 0, 28809, 53531, 336, 97, 97, 97, 97, 97, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 131427, 0, 0, 0, 0, 362, 0, 365, 28809, 367, 139, 45, 45, 371, 373, 45, 45, 45, 955, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 413, 45, 45, 45, 457, 459, 67, 67, 67, 67, 67, 67, 67, 67, 473, 67, 478, 67, 67, 482, 67, 67, 485, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 97, 1828, 97, 554, 556, 97, 97, 97, 97, 97, 97, 97, 97, 570, 97, 575, 97, 97, 579, 97, 97, 582, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 330, 97, 97, 67, 746, 67, 67, 67, 67, 67, 67, 67, 67, 67, 758, 67, 67, 67, 67, 67, 67, 67, 1575, 67, 67, 67, 67, 67, 67, 67, 67, 493, 67, 67, 67, 67, 67, 67, 67, 97, 97, 844, 97, 97, 97, 97, 97, 97, 97, 97, 97, 856, 97, 97, 97, 0, 97, 97, 97, 97, 97, 97, 97, 97, 1735, 97, 97, 97, 0, 97, 97, 97, 97, 97, 97, 97, 1642, 97, 1644, 97, 97, 890, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 0, 67, 67, 67, 67, 1065, 1066, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 532, 67, 67, 67, 67, 67, 67, 67, 1451, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 496, 67, 67, 97, 97, 1505, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 593, 97, 97, 0, 1474, 0, 1476, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1617, 97, 97, 1635, 0, 1637, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 885, 97, 97, 97, 97, 67, 67, 1704, 67, 67, 67, 67, 97, 97, 97, 97, 97, 97, 97, 97, 97, 565, 572, 97, 97, 97, 97, 97, 97, 97, 97, 1832, 0, 97, 97, 97, 97, 97, 0, 0, 0, 97, 97, 97, 97, 97, 97, 45, 45, 45, 1946, 45, 45, 67, 67, 67, 67, 67, 97, 1926, 97, 1927, 97, 0, 0, 0, 97, 97, 1934, 2043, 0, 0, 97, 97, 97, 2047, 45, 45, 67, 67, 0, 1832, 97, 97, 45, 45, 45, 981, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1227, 45, 45, 45, 131427, 0, 0, 0, 0, 362, 0, 365, 28809, 367, 139, 45, 45, 372, 45, 45, 45, 45, 1661, 1662, 45, 45, 45, 45, 45, 1666, 45, 45, 45, 45, 45, 1673, 45, 1675, 45, 45, 45, 45, 45, 45, 45, 67, 1426, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1275, 67, 67, 67, 67, 67, 45, 418, 45, 45, 420, 45, 45, 423, 45, 45, 45, 45, 45, 45, 45, 45, 959, 45, 45, 962, 45, 45, 45, 45, 458, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 483, 67, 67, 67, 67, 504, 67, 67, 506, 67, 67, 509, 67, 67, 67, 67, 67, 67, 67, 528, 67, 67, 67, 67, 67, 67, 67, 67, 1287, 67, 67, 67, 67, 67, 67, 67, 555, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 580, 97, 97, 97, 97, 601, 97, 97, 603, 97, 97, 606, 97, 97, 97, 97, 97, 97, 848, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1498, 97, 97, 97, 97, 97, 97, 45, 45, 714, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 989, 990, 45, 67, 67, 67, 67, 67, 1011, 67, 67, 67, 67, 1015, 67, 67, 67, 67, 67, 67, 67, 753, 67, 67, 67, 67, 67, 67, 67, 67, 467, 67, 67, 67, 67, 67, 67, 67, 45, 45, 1179, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1003, 1004, 67, 1217, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 728, 67, 1461, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1034, 67, 97, 1516, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 871, 97, 67, 67, 67, 1705, 67, 67, 67, 97, 97, 97, 97, 97, 97, 97, 97, 97, 567, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1715, 97, 97, 97, 97, 97, 97, 97, 97, 97, 0, 0, 0, 45, 45, 1380, 45, 45, 45, 45, 45, 67, 67, 97, 97, 97, 97, 97, 0, 0, 0, 97, 1887, 97, 97, 0, 0, 97, 97, 97, 0, 97, 97, 97, 97, 97, 2006, 45, 45, 1907, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1920, 67, 97, 0, 2035, 97, 97, 97, 97, 97, 45, 45, 45, 45, 67, 67, 67, 1428, 67, 67, 67, 67, 67, 67, 1435, 67, 0, 94242, 0, 0, 0, 38, 102439, 0, 0, 106538, 98347, 28809, 45, 45, 45, 146, 45, 152, 45, 45, 165, 45, 175, 45, 180, 45, 45, 187, 190, 195, 45, 203, 254, 257, 262, 67, 270, 67, 67, 0, 24850, 12564, 0, 0, 0, 281, 28809, 53531, 97, 97, 97, 293, 97, 299, 97, 97, 312, 97, 322, 97, 327, 97, 97, 334, 337, 342, 97, 350, 97, 97, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 67, 484, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 499, 97, 581, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 596, 648, 45, 650, 45, 651, 45, 653, 45, 45, 45, 657, 45, 45, 45, 45, 45, 45, 1954, 67, 67, 67, 1958, 67, 67, 67, 67, 67, 67, 67, 768, 67, 67, 67, 67, 67, 67, 67, 67, 769, 67, 67, 67, 67, 67, 67, 67, 680, 45, 45, 45, 45, 45, 45, 45, 45, 688, 689, 691, 45, 45, 45, 45, 45, 983, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 947, 45, 45, 45, 45, 952, 45, 45, 698, 699, 45, 45, 702, 703, 45, 45, 45, 45, 45, 45, 45, 711, 744, 67, 67, 67, 67, 67, 67, 67, 67, 67, 757, 67, 67, 67, 67, 761, 67, 67, 67, 67, 765, 67, 767, 67, 67, 67, 67, 67, 67, 67, 67, 775, 776, 778, 67, 67, 67, 67, 67, 67, 785, 786, 67, 67, 789, 790, 67, 67, 67, 67, 67, 67, 1442, 67, 67, 67, 67, 67, 67, 67, 67, 67, 97, 97, 97, 1775, 97, 97, 97, 67, 67, 67, 67, 67, 798, 67, 67, 67, 802, 67, 67, 67, 67, 67, 67, 67, 67, 1465, 67, 67, 1468, 67, 67, 1471, 67, 67, 810, 67, 67, 67, 67, 67, 67, 67, 67, 67, 821, 25398, 542, 13112, 544, 57889, 0, 0, 54074, 54074, 550, 0, 833, 97, 835, 97, 836, 97, 838, 97, 97, 0, 0, 97, 97, 97, 2002, 97, 97, 97, 97, 97, 45, 45, 45, 45, 45, 1740, 45, 45, 45, 1744, 45, 45, 45, 97, 842, 97, 97, 97, 97, 97, 97, 97, 97, 97, 855, 97, 97, 97, 97, 0, 1717, 1718, 97, 97, 97, 97, 97, 1722, 97, 0, 0, 859, 97, 97, 97, 97, 863, 97, 865, 97, 97, 97, 97, 97, 97, 97, 97, 604, 97, 97, 97, 97, 97, 97, 97, 873, 874, 876, 97, 97, 97, 97, 97, 97, 883, 884, 97, 97, 887, 888, 97, 18, 131427, 0, 0, 0, 0, 0, 0, 362, 225280, 0, 365, 0, 367, 0, 45, 45, 45, 1531, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1199, 45, 45, 45, 45, 45, 97, 97, 908, 97, 97, 97, 97, 97, 97, 97, 97, 97, 919, 638, 0, 0, 0, 0, 2158877, 2158877, 2158877, 2158877, 2158877, 2425117, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2597149, 2158877, 2158877, 2158877, 2158877, 2158877, 2158877, 2642205, 2158877, 2158877, 2158877, 2158877, 2158877, 3158301, 0, 2375818, 2379914, 2158730, 2158730, 2420874, 2158730, 2449546, 2158730, 2158730, 953, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 965, 978, 45, 45, 45, 45, 45, 45, 985, 45, 45, 45, 45, 45, 45, 45, 45, 971, 45, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 1027, 67, 1029, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1455, 67, 67, 67, 67, 67, 67, 67, 1077, 1078, 67, 67, 25398, 0, 13112, 0, 54074, 0, 0, 0, 0, 0, 0, 0, 0, 366, 0, 139, 2158730, 2158730, 2158730, 2404490, 2412682, 1113, 97, 97, 97, 97, 97, 97, 1121, 97, 1123, 97, 97, 97, 97, 97, 97, 0, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1540, 1155, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 615, 1168, 97, 97, 1171, 1172, 97, 97, 0, 921, 0, 1175, 0, 0, 0, 0, 45, 45, 45, 45, 45, 1533, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1663, 45, 45, 45, 45, 45, 45, 45, 45, 45, 183, 45, 45, 45, 45, 201, 45, 45, 45, 1219, 45, 45, 45, 45, 45, 45, 45, 1226, 45, 45, 45, 45, 45, 168, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 427, 45, 45, 45, 45, 45, 45, 45, 1231, 45, 45, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1242, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1046, 67, 67, 1254, 67, 1256, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 806, 807, 67, 67, 97, 1336, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1111, 97, 97, 97, 97, 97, 1351, 97, 97, 97, 1354, 97, 97, 97, 1359, 97, 97, 97, 0, 97, 97, 97, 97, 1640, 97, 97, 97, 97, 97, 97, 97, 897, 97, 97, 97, 902, 97, 97, 97, 97, 97, 97, 97, 97, 1366, 97, 97, 97, 97, 97, 97, 97, 1371, 97, 97, 97, 0, 97, 97, 97, 1730, 97, 97, 97, 97, 97, 97, 97, 97, 915, 97, 97, 97, 97, 0, 360, 0, 67, 67, 67, 1440, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1017, 67, 1019, 67, 67, 67, 67, 67, 1453, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1459, 97, 97, 97, 1493, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1525, 97, 97, 97, 97, 97, 97, 1507, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1514, 67, 67, 67, 67, 1584, 67, 67, 67, 67, 67, 1590, 67, 67, 67, 67, 67, 67, 67, 783, 67, 67, 67, 788, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1599, 1601, 67, 67, 67, 1604, 67, 1606, 1607, 67, 1472, 0, 1474, 0, 1476, 0, 97, 97, 97, 97, 97, 97, 1614, 97, 97, 97, 97, 45, 45, 1850, 45, 45, 45, 45, 1855, 45, 45, 45, 45, 45, 1222, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1229, 97, 1618, 97, 97, 97, 97, 97, 97, 97, 1625, 97, 97, 97, 97, 97, 0, 1175, 0, 45, 45, 45, 45, 45, 45, 45, 45, 447, 45, 45, 45, 45, 45, 67, 67, 1633, 97, 97, 0, 97, 97, 97, 97, 97, 97, 97, 97, 1643, 1645, 97, 97, 0, 0, 97, 97, 1784, 97, 97, 97, 0, 0, 97, 97, 0, 97, 1894, 1895, 97, 1897, 97, 45, 45, 45, 45, 45, 45, 45, 45, 45, 656, 45, 45, 45, 45, 45, 45, 97, 1648, 97, 1650, 1651, 97, 0, 45, 45, 45, 1654, 45, 45, 45, 45, 45, 169, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 658, 45, 45, 45, 45, 664, 45, 45, 1659, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1187, 45, 45, 1669, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 67, 1005, 67, 67, 1681, 67, 67, 67, 67, 67, 67, 67, 1686, 67, 67, 67, 67, 67, 67, 67, 784, 67, 67, 67, 67, 67, 67, 67, 67, 1055, 67, 67, 67, 67, 1060, 67, 67, 97, 97, 1713, 97, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 0, 0, 0, 1378, 45, 45, 45, 45, 45, 45, 45, 408, 45, 45, 45, 45, 45, 45, 45, 45, 1547, 45, 1549, 45, 45, 45, 45, 45, 97, 97, 1780, 0, 97, 97, 97, 97, 97, 97, 0, 0, 97, 97, 0, 97, 97, 97, 45, 45, 2027, 2028, 45, 45, 67, 67, 2031, 2032, 67, 45, 45, 1804, 45, 45, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 67, 1917, 67, 67, 67, 67, 67, 67, 67, 1819, 67, 67, 67, 67, 67, 67, 67, 67, 97, 97, 97, 1708, 97, 97, 97, 97, 97, 45, 45, 1862, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 497, 67, 67, 67, 1877, 97, 97, 97, 97, 97, 0, 0, 0, 97, 97, 97, 97, 0, 0, 97, 97, 97, 97, 97, 1839, 0, 0, 97, 97, 97, 97, 1936, 0, 0, 97, 97, 97, 97, 97, 97, 1943, 1944, 1945, 45, 45, 45, 45, 670, 45, 45, 45, 45, 674, 45, 45, 45, 45, 678, 45, 1948, 45, 1950, 45, 45, 45, 45, 1955, 1956, 1957, 67, 67, 67, 1960, 67, 1962, 67, 67, 67, 67, 1967, 1968, 1969, 97, 0, 0, 0, 97, 97, 1974, 97, 0, 1936, 0, 97, 97, 97, 97, 97, 97, 45, 45, 45, 45, 45, 45, 45, 45, 1906, 0, 1977, 97, 97, 97, 97, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1746, 45, 45, 45, 45, 2011, 67, 67, 2013, 67, 67, 67, 2017, 97, 97, 0, 0, 2021, 97, 8192, 97, 97, 2025, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 1916, 67, 67, 67, 67, 0, 94242, 0, 0, 0, 38, 102439, 0, 0, 106538, 98347, 28809, 45, 45, 140, 45, 45, 45, 1180, 45, 45, 45, 45, 1184, 45, 45, 45, 45, 45, 45, 45, 387, 45, 392, 45, 45, 396, 45, 45, 399, 45, 45, 67, 207, 67, 67, 67, 67, 67, 67, 236, 67, 67, 67, 67, 67, 67, 67, 800, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1603, 67, 67, 67, 67, 67, 0, 97, 97, 287, 97, 97, 97, 97, 97, 97, 316, 97, 97, 97, 97, 97, 97, 0, 45, 45, 45, 45, 45, 45, 45, 1656, 1657, 45, 376, 45, 45, 45, 45, 45, 388, 45, 45, 45, 45, 45, 45, 45, 45, 1406, 45, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 462, 67, 67, 67, 67, 67, 474, 67, 67, 67, 67, 67, 67, 67, 817, 67, 67, 67, 67, 25398, 542, 13112, 544, 97, 97, 97, 97, 559, 97, 97, 97, 97, 97, 571, 97, 97, 97, 97, 97, 97, 896, 97, 97, 97, 900, 97, 97, 97, 97, 97, 97, 912, 914, 97, 97, 97, 97, 97, 0, 0, 0, 45, 45, 45, 45, 45, 45, 45, 45, 391, 45, 45, 45, 45, 45, 45, 45, 45, 713, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 662, 45, 1140, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 636, 67, 67, 1283, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 513, 67, 67, 1363, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 889, 97, 97, 97, 1714, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 0, 0, 926, 45, 45, 45, 45, 45, 45, 45, 45, 672, 45, 45, 45, 45, 45, 45, 45, 45, 686, 45, 45, 45, 45, 45, 45, 45, 45, 944, 45, 45, 45, 45, 45, 45, 45, 45, 1676, 45, 45, 45, 45, 45, 45, 67, 97, 97, 97, 1833, 0, 97, 97, 97, 97, 97, 0, 0, 0, 97, 97, 97, 97, 97, 97, 45, 45, 45, 45, 1902, 45, 45, 45, 45, 45, 957, 45, 45, 45, 45, 961, 45, 963, 45, 45, 45, 67, 97, 2034, 0, 97, 97, 97, 97, 97, 2040, 45, 45, 45, 2042, 67, 67, 67, 67, 67, 67, 1574, 67, 67, 67, 67, 67, 1578, 67, 67, 67, 67, 67, 67, 799, 67, 67, 67, 804, 67, 67, 67, 67, 67, 67, 67, 1298, 0, 0, 0, 1304, 0, 0, 0, 1310, 132, 94242, 0, 0, 0, 38, 102439, 0, 0, 106538, 98347, 28809, 45, 45, 45, 45, 45, 1414, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 428, 45, 45, 45, 45, 45, 57889, 0, 0, 54074, 54074, 550, 831, 97, 97, 97, 97, 97, 97, 97, 97, 97, 568, 97, 97, 97, 97, 578, 97, 45, 45, 968, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1228, 45, 45, 67, 67, 67, 67, 67, 25398, 1082, 13112, 1086, 54074, 1090, 0, 0, 0, 0, 0, 0, 364, 0, 0, 0, 139, 2158592, 2158592, 2158592, 2404352, 2412544, 67, 67, 67, 67, 1464, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 510, 67, 67, 67, 67, 97, 97, 97, 97, 1519, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 918, 97, 0, 0, 0, 0, 1528, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 976, 45, 1554, 45, 45, 45, 45, 45, 45, 45, 45, 1562, 45, 45, 1565, 45, 45, 45, 45, 683, 45, 45, 45, 687, 45, 45, 692, 45, 45, 45, 45, 45, 1953, 45, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1014, 67, 67, 67, 67, 67, 67, 1568, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 0, 67, 67, 67, 67, 67, 1585, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1594, 97, 97, 1649, 97, 97, 97, 0, 45, 45, 1653, 45, 45, 45, 45, 45, 45, 383, 45, 45, 45, 45, 45, 45, 45, 45, 45, 986, 45, 45, 45, 45, 45, 45, 45, 45, 1670, 45, 1672, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 67, 736, 67, 67, 67, 67, 67, 741, 67, 67, 67, 1680, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1074, 67, 67, 67, 1692, 67, 67, 67, 67, 67, 67, 67, 1697, 67, 1699, 67, 67, 67, 67, 67, 67, 1012, 67, 67, 67, 67, 67, 67, 67, 67, 67, 468, 475, 67, 67, 67, 67, 67, 67, 1769, 67, 67, 67, 67, 67, 67, 67, 97, 97, 97, 97, 97, 97, 97, 624, 97, 97, 97, 97, 97, 97, 634, 97, 97, 1792, 97, 97, 97, 97, 97, 97, 97, 45, 45, 45, 45, 45, 45, 45, 958, 45, 45, 45, 45, 45, 45, 964, 45, 150, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 977, 204, 45, 67, 67, 67, 217, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 787, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 271, 67, 0, 24850, 12564, 0, 0, 0, 0, 28809, 53531, 97, 97, 97, 97, 351, 97, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 45, 45, 938, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1398, 45, 45, 45, 153, 45, 161, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 660, 661, 45, 45, 205, 45, 67, 67, 67, 67, 220, 67, 228, 67, 67, 67, 67, 67, 67, 67, 0, 0, 0, 0, 0, 280, 94, 0, 0, 67, 67, 67, 67, 67, 272, 67, 0, 24850, 12564, 0, 0, 0, 0, 28809, 53531, 97, 97, 97, 97, 352, 97, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 45, 439, 45, 45, 45, 45, 45, 445, 45, 45, 45, 452, 45, 45, 67, 67, 212, 216, 67, 67, 67, 67, 67, 241, 67, 246, 67, 252, 67, 67, 486, 67, 67, 67, 67, 67, 67, 67, 494, 67, 67, 67, 67, 67, 67, 67, 1245, 67, 67, 67, 67, 67, 67, 67, 67, 1013, 67, 67, 1016, 67, 67, 67, 67, 67, 521, 67, 67, 525, 67, 67, 67, 67, 67, 531, 67, 67, 67, 538, 67, 0, 0, 2046, 97, 97, 97, 45, 45, 67, 67, 0, 0, 97, 97, 45, 45, 45, 1192, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1418, 45, 45, 1421, 97, 97, 583, 97, 97, 97, 97, 97, 97, 97, 591, 97, 97, 97, 97, 97, 97, 913, 97, 97, 97, 97, 97, 97, 0, 0, 0, 45, 45, 45, 45, 45, 45, 45, 1384, 97, 618, 97, 97, 622, 97, 97, 97, 97, 97, 628, 97, 97, 97, 635, 97, 18, 131427, 0, 0, 0, 639, 0, 132, 362, 0, 0, 365, 29315, 367, 0, 921, 29315, 0, 0, 0, 0, 45, 45, 45, 45, 932, 45, 45, 45, 45, 45, 1544, 45, 45, 45, 45, 45, 1550, 45, 45, 45, 45, 45, 1194, 45, 1196, 45, 45, 45, 45, 45, 45, 45, 45, 999, 45, 45, 45, 45, 45, 67, 67, 45, 45, 667, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1408, 45, 45, 45, 696, 45, 45, 45, 701, 45, 45, 45, 45, 45, 45, 45, 45, 710, 45, 45, 45, 1220, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 194, 45, 45, 45, 729, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 797, 67, 67, 67, 67, 67, 67, 805, 67, 67, 67, 67, 67, 67, 67, 1587, 67, 1589, 67, 67, 67, 67, 67, 67, 67, 67, 1763, 67, 67, 67, 67, 67, 67, 67, 0, 0, 0, 0, 0, 0, 2162968, 0, 0, 67, 67, 67, 67, 67, 814, 816, 67, 67, 67, 67, 67, 25398, 542, 13112, 544, 67, 67, 1008, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1020, 67, 0, 97, 45, 67, 0, 97, 45, 67, 0, 97, 45, 67, 97, 0, 0, 97, 97, 97, 97, 97, 45, 45, 45, 45, 67, 67, 67, 67, 1429, 67, 1430, 67, 67, 67, 67, 67, 1062, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 518, 1076, 67, 67, 67, 67, 25398, 0, 13112, 0, 54074, 0, 0, 0, 0, 0, 0, 0, 0, 28809, 0, 139, 45, 45, 45, 45, 45, 97, 97, 97, 97, 1102, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1124, 97, 1126, 97, 97, 1114, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1112, 97, 97, 1156, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 594, 97, 97, 97, 97, 1170, 97, 97, 97, 97, 0, 921, 0, 0, 0, 0, 0, 0, 45, 45, 45, 45, 1532, 45, 45, 45, 45, 1536, 45, 45, 45, 45, 45, 172, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 706, 45, 45, 709, 45, 45, 1177, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1202, 45, 1204, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1215, 45, 45, 45, 1232, 45, 45, 45, 45, 45, 45, 45, 67, 1237, 67, 67, 67, 67, 67, 67, 1053, 1054, 67, 67, 67, 67, 67, 67, 1061, 67, 67, 1282, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1289, 67, 67, 67, 1292, 97, 97, 97, 97, 1339, 97, 97, 97, 97, 97, 97, 1344, 97, 97, 97, 97, 45, 1849, 45, 1851, 45, 45, 45, 45, 45, 45, 45, 45, 721, 45, 45, 45, 45, 45, 726, 45, 1385, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1188, 45, 45, 1401, 1402, 45, 45, 45, 45, 1405, 45, 45, 45, 45, 45, 45, 45, 45, 1752, 45, 45, 45, 45, 45, 67, 67, 1410, 45, 45, 45, 1413, 45, 1415, 45, 45, 45, 45, 45, 45, 1419, 45, 45, 45, 45, 1806, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 67, 67, 97, 97, 2019, 0, 97, 67, 67, 67, 1452, 67, 67, 67, 67, 67, 67, 67, 67, 1457, 67, 67, 67, 67, 67, 67, 1259, 67, 67, 67, 67, 67, 67, 1264, 67, 67, 1460, 67, 1462, 67, 67, 67, 67, 67, 67, 1466, 67, 67, 67, 67, 67, 67, 67, 67, 1588, 67, 67, 67, 67, 67, 67, 67, 0, 1300, 0, 0, 0, 1306, 0, 0, 0, 97, 97, 97, 1506, 97, 97, 97, 97, 97, 97, 97, 97, 1512, 97, 97, 97, 0, 1728, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 901, 97, 97, 97, 97, 1515, 97, 1517, 97, 97, 97, 97, 97, 97, 1521, 97, 97, 97, 97, 97, 97, 0, 45, 1652, 45, 45, 45, 1655, 45, 45, 45, 45, 45, 1542, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1552, 1553, 45, 45, 45, 1556, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 693, 45, 45, 45, 67, 67, 67, 67, 1572, 67, 67, 67, 67, 1576, 67, 67, 67, 67, 67, 67, 67, 67, 1602, 67, 67, 1605, 67, 67, 67, 0, 67, 1582, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1580, 67, 67, 1596, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 0, 542, 0, 544, 67, 67, 67, 67, 1759, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 533, 67, 67, 67, 67, 67, 67, 67, 1770, 67, 67, 67, 67, 67, 97, 97, 97, 97, 97, 97, 1777, 97, 97, 97, 1793, 97, 97, 97, 97, 97, 45, 45, 45, 45, 45, 45, 45, 998, 45, 45, 1001, 1002, 45, 45, 67, 67, 45, 1861, 45, 67, 67, 67, 67, 67, 67, 67, 67, 1871, 67, 1873, 1874, 67, 0, 97, 45, 67, 0, 97, 45, 67, 16384, 97, 45, 67, 97, 0, 0, 0, 1473, 0, 1082, 0, 0, 0, 1475, 0, 1086, 0, 0, 0, 1477, 1876, 67, 97, 97, 97, 97, 97, 1883, 0, 1885, 97, 97, 97, 1889, 0, 0, 0, 286, 0, 0, 0, 286, 0, 2367488, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 0, 40976, 0, 18, 18, 24, 24, 126, 126, 126, 2053, 0, 2055, 45, 67, 0, 97, 45, 67, 0, 97, 45, 67, 97, 0, 0, 97, 97, 97, 2039, 97, 45, 45, 45, 45, 67, 67, 67, 67, 67, 226, 67, 67, 67, 67, 67, 67, 67, 67, 1246, 67, 67, 1249, 1250, 67, 67, 67, 132, 94242, 0, 0, 0, 38, 102439, 0, 0, 106538, 98347, 28809, 45, 45, 141, 45, 45, 45, 1403, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1186, 45, 45, 1189, 45, 45, 155, 45, 45, 45, 45, 45, 45, 45, 45, 45, 191, 45, 45, 45, 45, 700, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1753, 45, 45, 45, 67, 67, 45, 45, 67, 208, 67, 67, 67, 222, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1764, 67, 67, 67, 67, 67, 67, 67, 258, 67, 67, 67, 67, 67, 0, 24850, 12564, 0, 0, 0, 0, 28809, 53531, 97, 97, 288, 97, 97, 97, 302, 97, 97, 97, 97, 97, 97, 97, 97, 97, 627, 97, 97, 97, 97, 97, 97, 338, 97, 97, 97, 97, 97, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 131427, 0, 0, 0, 0, 362, 0, 365, 28809, 367, 139, 45, 370, 45, 45, 45, 45, 716, 45, 45, 45, 45, 45, 722, 45, 45, 45, 45, 45, 45, 1912, 67, 67, 67, 67, 67, 67, 67, 67, 67, 819, 67, 67, 25398, 542, 13112, 544, 45, 403, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1409, 45, 67, 67, 67, 67, 489, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 771, 67, 67, 67, 67, 520, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 534, 67, 67, 67, 67, 67, 67, 1271, 67, 67, 67, 1274, 67, 67, 67, 1279, 67, 67, 24850, 24850, 12564, 12564, 0, 57889, 0, 0, 0, 53531, 53531, 367, 286, 97, 553, 97, 97, 97, 97, 586, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1138, 97, 97, 97, 97, 617, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 631, 97, 97, 97, 0, 1834, 97, 97, 97, 97, 97, 0, 0, 0, 97, 97, 97, 97, 97, 353, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 45, 45, 668, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 724, 45, 45, 45, 45, 45, 682, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 949, 45, 45, 45, 67, 67, 747, 748, 67, 67, 67, 67, 755, 67, 67, 67, 67, 67, 67, 67, 0, 0, 0, 1302, 0, 0, 0, 1308, 0, 67, 794, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1701, 67, 97, 97, 97, 845, 846, 97, 97, 97, 97, 853, 97, 97, 97, 97, 97, 97, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 97, 97, 892, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 610, 97, 97, 45, 992, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 67, 67, 67, 1239, 67, 67, 67, 1063, 67, 67, 67, 67, 67, 1068, 67, 67, 67, 67, 67, 67, 67, 0, 0, 1301, 0, 0, 0, 1307, 0, 0, 97, 1141, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1152, 97, 97, 0, 0, 97, 97, 2001, 0, 97, 2003, 97, 97, 97, 45, 45, 45, 1739, 45, 45, 45, 1742, 45, 45, 45, 45, 45, 97, 97, 97, 97, 1157, 97, 97, 97, 97, 97, 1162, 97, 97, 97, 97, 97, 97, 1145, 97, 97, 97, 97, 97, 1151, 97, 97, 97, 1253, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 539, 45, 1423, 45, 45, 67, 67, 67, 67, 67, 67, 67, 1431, 67, 67, 67, 67, 67, 67, 67, 1695, 67, 67, 67, 67, 67, 1700, 67, 1702, 67, 67, 1439, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 514, 67, 67, 97, 97, 1492, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 611, 97, 97, 1703, 67, 67, 67, 67, 67, 67, 97, 97, 97, 97, 97, 97, 97, 97, 97, 852, 97, 97, 97, 97, 97, 97, 45, 1949, 45, 1951, 45, 45, 45, 67, 67, 67, 67, 67, 67, 67, 1961, 67, 0, 97, 45, 67, 0, 97, 2060, 2061, 0, 2062, 45, 67, 97, 0, 0, 2036, 97, 97, 97, 97, 45, 45, 45, 45, 67, 67, 67, 67, 67, 223, 67, 67, 237, 67, 67, 67, 67, 67, 67, 67, 1272, 67, 67, 67, 67, 67, 67, 67, 67, 507, 67, 67, 67, 67, 67, 67, 67, 1963, 67, 67, 67, 97, 97, 97, 97, 0, 1972, 0, 97, 97, 97, 1975, 0, 921, 29315, 0, 0, 0, 0, 45, 45, 45, 931, 45, 45, 45, 45, 45, 407, 45, 45, 45, 45, 45, 45, 45, 45, 45, 417, 45, 45, 1989, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1996, 97, 18, 131427, 0, 0, 360, 0, 0, 0, 362, 0, 0, 365, 29315, 367, 0, 921, 29315, 0, 0, 0, 0, 45, 45, 930, 45, 45, 45, 45, 45, 45, 444, 45, 45, 45, 45, 45, 45, 45, 67, 67, 97, 97, 1998, 0, 97, 97, 97, 0, 97, 97, 97, 97, 97, 45, 45, 45, 45, 45, 45, 1985, 45, 1986, 45, 45, 45, 156, 45, 45, 170, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 675, 45, 45, 45, 45, 679, 131427, 0, 358, 0, 0, 362, 0, 365, 28809, 367, 139, 45, 45, 45, 45, 45, 381, 45, 45, 45, 45, 45, 45, 45, 45, 45, 400, 45, 45, 419, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 436, 67, 67, 67, 67, 67, 505, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 820, 67, 25398, 542, 13112, 544, 67, 67, 522, 67, 67, 67, 67, 67, 529, 67, 67, 67, 67, 67, 67, 67, 0, 1299, 0, 0, 0, 1305, 0, 0, 0, 97, 97, 619, 97, 97, 97, 97, 97, 626, 97, 97, 97, 97, 97, 97, 97, 1105, 97, 97, 97, 97, 1109, 97, 97, 97, 67, 67, 67, 67, 749, 67, 67, 67, 67, 67, 67, 67, 67, 67, 760, 67, 0, 97, 45, 67, 2058, 97, 45, 67, 0, 97, 45, 67, 97, 0, 0, 97, 97, 97, 97, 97, 45, 45, 45, 2041, 67, 67, 67, 67, 67, 780, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 516, 67, 67, 97, 97, 97, 878, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1629, 97, 0, 45, 979, 45, 45, 45, 45, 984, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1198, 45, 45, 45, 45, 45, 45, 67, 1023, 67, 67, 67, 67, 1028, 67, 67, 67, 67, 67, 67, 67, 67, 67, 470, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 25398, 0, 13112, 0, 54074, 0, 0, 0, 1094, 0, 0, 0, 1092, 1315, 0, 0, 0, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1486, 97, 1489, 97, 97, 97, 1117, 97, 97, 97, 97, 1122, 97, 97, 97, 97, 97, 97, 97, 1146, 97, 97, 97, 97, 97, 97, 97, 97, 881, 97, 97, 97, 886, 97, 97, 97, 1311, 0, 0, 0, 0, 0, 0, 0, 0, 97, 97, 97, 97, 97, 97, 97, 1615, 97, 97, 97, 97, 97, 1619, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1631, 97, 97, 1847, 97, 45, 45, 45, 45, 1852, 45, 45, 45, 45, 45, 45, 45, 1235, 45, 45, 45, 67, 67, 67, 67, 67, 1868, 67, 67, 67, 1872, 67, 67, 67, 67, 67, 97, 97, 97, 97, 1882, 0, 0, 0, 97, 97, 97, 97, 0, 1891, 67, 67, 67, 67, 67, 97, 97, 97, 97, 97, 1929, 0, 0, 97, 97, 97, 97, 97, 97, 45, 1900, 45, 1901, 45, 45, 45, 1905, 45, 67, 2054, 97, 45, 67, 0, 97, 45, 67, 0, 97, 45, 67, 97, 0, 0, 97, 2037, 2038, 97, 97, 45, 45, 45, 45, 67, 67, 67, 67, 1867, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1774, 97, 97, 97, 97, 97, 97, 0, 94242, 0, 0, 0, 38, 102439, 0, 0, 106538, 98347, 28809, 45, 45, 142, 45, 45, 45, 1412, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 432, 45, 45, 45, 45, 45, 157, 45, 45, 171, 45, 45, 45, 182, 45, 45, 45, 45, 200, 45, 45, 45, 1543, 45, 45, 45, 45, 45, 45, 45, 45, 1551, 45, 45, 45, 45, 1181, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1211, 45, 45, 45, 1214, 45, 45, 45, 67, 209, 67, 67, 67, 224, 67, 67, 238, 67, 67, 67, 249, 67, 0, 97, 2056, 2057, 0, 2059, 45, 67, 0, 97, 45, 67, 97, 0, 0, 1937, 97, 97, 97, 97, 97, 97, 45, 45, 45, 45, 45, 45, 1741, 45, 45, 45, 45, 45, 45, 67, 67, 67, 267, 67, 67, 67, 0, 24850, 12564, 0, 0, 0, 0, 28809, 53531, 97, 97, 289, 97, 97, 97, 304, 97, 97, 318, 97, 97, 97, 329, 97, 97, 0, 0, 97, 1783, 97, 97, 97, 97, 0, 0, 97, 97, 0, 97, 97, 97, 45, 2026, 45, 45, 45, 45, 67, 2030, 67, 67, 67, 67, 67, 67, 1041, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1044, 67, 67, 67, 67, 67, 67, 97, 97, 347, 97, 97, 97, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 45, 666, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1420, 45, 57889, 0, 0, 54074, 54074, 550, 0, 97, 97, 97, 97, 97, 97, 97, 97, 840, 67, 1007, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 759, 67, 67, 67, 67, 67, 67, 67, 1052, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1031, 67, 67, 67, 67, 67, 97, 97, 97, 1101, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 592, 97, 97, 97, 1190, 45, 45, 45, 45, 45, 1195, 45, 1197, 45, 45, 45, 45, 1201, 45, 45, 45, 45, 1952, 45, 45, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 250, 67, 67, 67, 1255, 67, 1257, 67, 67, 67, 67, 1261, 67, 67, 67, 67, 67, 67, 67, 67, 1685, 67, 67, 67, 67, 67, 67, 67, 0, 24851, 12565, 0, 0, 0, 0, 28809, 53532, 67, 67, 1267, 67, 67, 67, 67, 67, 67, 1273, 67, 67, 67, 67, 67, 67, 67, 67, 1696, 67, 67, 67, 67, 67, 67, 67, 0, 0, 0, 0, 0, 0, 2162688, 0, 0, 1281, 67, 67, 67, 67, 1285, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1070, 67, 67, 67, 67, 67, 1335, 97, 1337, 97, 97, 97, 97, 1341, 97, 97, 97, 97, 97, 97, 97, 97, 882, 97, 97, 97, 97, 97, 97, 97, 1347, 97, 97, 97, 97, 97, 97, 1353, 97, 97, 97, 97, 97, 97, 1361, 97, 18, 131427, 0, 638, 0, 0, 0, 0, 362, 0, 0, 365, 29315, 367, 0, 544, 0, 550, 0, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2473984, 2158592, 2158592, 2158592, 2990080, 2158592, 2158592, 2207744, 2207744, 2482176, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 2207744, 0, 0, 0, 0, 0, 0, 2162688, 0, 53530, 97, 97, 97, 1365, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 608, 97, 97, 97, 45, 45, 1424, 45, 1425, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1058, 67, 67, 67, 67, 45, 1555, 45, 45, 1557, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 707, 45, 45, 45, 45, 67, 67, 1570, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 773, 67, 67, 1595, 67, 67, 1597, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 139, 2158592, 2158592, 2158592, 2404352, 2412544, 97, 97, 97, 1636, 97, 97, 97, 1639, 97, 97, 1641, 97, 97, 97, 97, 97, 97, 1173, 0, 921, 0, 0, 0, 0, 0, 0, 45, 67, 67, 67, 1693, 67, 67, 67, 67, 67, 67, 67, 1698, 67, 67, 67, 67, 67, 67, 67, 1773, 67, 97, 97, 97, 97, 97, 97, 97, 625, 97, 97, 97, 97, 97, 97, 97, 97, 850, 97, 97, 97, 97, 97, 97, 97, 97, 880, 97, 97, 97, 97, 97, 97, 97, 97, 1106, 97, 97, 97, 97, 97, 97, 97, 1860, 45, 45, 67, 67, 1865, 67, 67, 67, 67, 1870, 67, 67, 67, 67, 1875, 67, 67, 97, 97, 1880, 97, 97, 0, 0, 0, 97, 97, 1888, 97, 0, 0, 0, 1938, 97, 97, 97, 97, 97, 45, 45, 45, 45, 45, 45, 1854, 45, 45, 45, 45, 45, 45, 45, 1909, 45, 45, 1911, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1248, 67, 67, 67, 67, 67, 67, 1922, 67, 67, 1924, 97, 97, 97, 97, 97, 0, 0, 0, 97, 97, 97, 97, 97, 1898, 45, 45, 45, 45, 45, 45, 1904, 45, 45, 67, 67, 67, 67, 97, 97, 97, 97, 0, 0, 16384, 97, 97, 97, 97, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 0, 1724, 2008, 2009, 45, 45, 67, 67, 67, 2014, 2015, 67, 67, 97, 97, 0, 0, 97, 97, 97, 0, 97, 97, 97, 97, 97, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 2022, 0, 2023, 97, 97, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 67, 1869, 67, 67, 67, 67, 67, 67, 0, 94242, 0, 0, 0, 38, 102439, 0, 0, 106538, 98347, 28809, 45, 45, 45, 147, 151, 154, 45, 162, 45, 45, 176, 178, 181, 45, 45, 45, 192, 196, 45, 45, 45, 45, 2012, 67, 67, 67, 67, 67, 67, 2018, 97, 0, 0, 97, 1978, 97, 97, 97, 1982, 45, 45, 45, 45, 45, 45, 45, 45, 45, 972, 973, 45, 45, 45, 45, 45, 67, 259, 263, 67, 67, 67, 67, 0, 24850, 12564, 0, 0, 0, 0, 28809, 53531, 97, 97, 97, 294, 298, 301, 97, 309, 97, 97, 323, 325, 328, 97, 97, 97, 97, 97, 560, 97, 97, 97, 569, 97, 97, 97, 97, 97, 97, 306, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1624, 97, 97, 97, 97, 97, 97, 97, 0, 921, 0, 1175, 0, 0, 0, 0, 45, 339, 343, 97, 97, 97, 97, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 67, 67, 503, 67, 67, 67, 67, 67, 67, 67, 67, 67, 512, 67, 67, 519, 97, 97, 600, 97, 97, 97, 97, 97, 97, 97, 97, 97, 609, 97, 97, 616, 45, 649, 45, 45, 45, 45, 45, 654, 45, 45, 45, 45, 45, 45, 45, 45, 1393, 45, 45, 45, 45, 45, 45, 45, 45, 1209, 45, 45, 45, 45, 45, 45, 45, 67, 763, 67, 67, 67, 67, 67, 67, 67, 67, 770, 67, 67, 67, 774, 67, 0, 2045, 97, 97, 97, 97, 45, 45, 67, 67, 0, 0, 97, 97, 45, 45, 45, 994, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 67, 67, 213, 67, 219, 67, 67, 232, 67, 242, 67, 247, 67, 67, 67, 779, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1018, 67, 67, 67, 67, 811, 67, 67, 67, 67, 67, 67, 67, 67, 67, 25398, 542, 13112, 544, 57889, 0, 0, 54074, 54074, 550, 0, 97, 834, 97, 97, 97, 97, 97, 839, 97, 18, 131427, 0, 638, 0, 0, 0, 0, 362, 0, 0, 365, 29315, 367, 645, 97, 97, 861, 97, 97, 97, 97, 97, 97, 97, 97, 868, 97, 97, 97, 872, 97, 97, 877, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 613, 97, 97, 97, 97, 97, 909, 97, 97, 97, 97, 97, 97, 97, 97, 97, 0, 0, 0, 18, 18, 24, 24, 27, 27, 27, 1036, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1047, 67, 67, 67, 1050, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1033, 67, 67, 67, 97, 97, 1130, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 638, 0, 0, 67, 67, 67, 1295, 67, 67, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 97, 1317, 97, 97, 97, 97, 97, 97, 1375, 97, 97, 97, 0, 0, 0, 45, 1379, 45, 45, 45, 45, 45, 45, 422, 45, 45, 45, 429, 431, 45, 45, 45, 45, 0, 1090, 0, 0, 97, 1479, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1357, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1716, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1723, 0, 921, 29315, 0, 0, 0, 0, 45, 929, 45, 45, 45, 45, 45, 45, 45, 1392, 45, 45, 45, 45, 45, 45, 45, 45, 45, 960, 45, 45, 45, 45, 45, 45, 97, 97, 97, 1738, 45, 45, 45, 45, 45, 45, 45, 1743, 45, 45, 45, 45, 166, 45, 45, 45, 45, 184, 186, 45, 45, 197, 45, 45, 97, 1779, 0, 0, 97, 97, 97, 97, 97, 97, 0, 0, 97, 97, 0, 97, 18, 131427, 0, 638, 0, 0, 0, 0, 362, 0, 640, 365, 29315, 367, 0, 921, 29315, 0, 0, 0, 0, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1537, 45, 45, 45, 45, 45, 1803, 45, 45, 45, 45, 45, 1809, 45, 45, 45, 67, 67, 67, 1814, 67, 67, 67, 67, 67, 67, 1821, 67, 67, 67, 67, 67, 67, 97, 97, 97, 97, 97, 0, 0, 0, 97, 97, 97, 97, 0, 0, 67, 67, 67, 1818, 67, 67, 67, 67, 67, 1824, 67, 67, 67, 97, 97, 97, 97, 97, 0, 0, 0, 97, 97, 97, 97, 1890, 0, 1829, 97, 97, 0, 0, 97, 97, 1836, 97, 97, 0, 0, 0, 97, 97, 97, 97, 1981, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1987, 1845, 97, 97, 97, 45, 45, 45, 45, 45, 1853, 45, 45, 45, 1857, 45, 45, 45, 67, 1864, 67, 1866, 67, 67, 67, 67, 67, 67, 67, 67, 67, 97, 97, 97, 97, 97, 97, 97, 1710, 1711, 67, 67, 97, 97, 97, 97, 97, 0, 0, 0, 1886, 97, 97, 97, 0, 0, 97, 97, 97, 97, 1838, 0, 0, 0, 97, 1843, 97, 0, 1893, 97, 97, 97, 97, 97, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1745, 45, 45, 67, 67, 67, 67, 67, 97, 97, 97, 97, 97, 0, 0, 1931, 97, 97, 97, 97, 97, 588, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 629, 97, 97, 97, 97, 97, 67, 2044, 0, 97, 97, 97, 97, 45, 45, 67, 67, 0, 0, 97, 97, 45, 45, 45, 1660, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 453, 45, 455, 67, 67, 67, 67, 268, 67, 67, 67, 0, 24850, 12564, 0, 0, 0, 0, 28809, 53531, 97, 97, 348, 97, 97, 97, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 131427, 0, 359, 0, 0, 362, 0, 365, 28809, 367, 139, 45, 45, 45, 45, 45, 421, 45, 45, 45, 45, 45, 45, 45, 434, 45, 45, 695, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1667, 45, 0, 921, 29315, 0, 925, 0, 0, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1811, 45, 67, 67, 67, 67, 67, 67, 1037, 67, 1039, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1277, 67, 67, 67, 67, 67, 67, 67, 67, 25398, 0, 13112, 0, 54074, 0, 0, 0, 1095, 0, 0, 0, 1096, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 869, 97, 97, 97, 97, 97, 97, 1131, 97, 1133, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1370, 97, 97, 97, 97, 97, 1312, 0, 0, 0, 0, 1096, 0, 0, 0, 97, 97, 97, 97, 97, 97, 97, 1327, 97, 97, 97, 97, 97, 1332, 97, 97, 97, 1830, 97, 0, 0, 97, 97, 97, 97, 97, 0, 0, 0, 97, 97, 97, 1896, 97, 97, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1548, 45, 45, 45, 45, 45, 45, 133, 94242, 0, 0, 0, 38, 102439, 0, 0, 106538, 98347, 28809, 45, 45, 45, 45, 380, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 401, 45, 45, 158, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1200, 45, 45, 45, 45, 206, 67, 67, 67, 67, 67, 225, 67, 67, 67, 67, 67, 67, 67, 67, 754, 67, 67, 67, 67, 67, 67, 67, 57889, 0, 0, 54074, 54074, 550, 832, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1342, 97, 97, 97, 97, 97, 97, 67, 67, 67, 67, 67, 25398, 1083, 13112, 1087, 54074, 1091, 0, 0, 0, 0, 0, 0, 1316, 0, 831, 97, 97, 97, 97, 97, 97, 97, 1174, 921, 0, 1175, 0, 0, 0, 0, 45, 0, 94242, 0, 0, 0, 38, 102439, 0, 0, 106538, 98347, 28809, 45, 45, 45, 148, 67, 67, 264, 67, 67, 67, 67, 0, 24850, 12564, 0, 0, 0, 0, 28809, 53531, 97, 97, 97, 295, 97, 97, 97, 97, 313, 97, 97, 97, 97, 331, 333, 97, 18, 131427, 356, 638, 0, 0, 0, 0, 362, 0, 0, 365, 0, 367, 0, 45, 45, 1530, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 988, 45, 45, 45, 97, 344, 97, 97, 97, 97, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 402, 404, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1756, 67, 438, 45, 45, 45, 45, 45, 45, 45, 45, 449, 450, 45, 45, 45, 67, 67, 214, 218, 221, 67, 229, 67, 67, 243, 245, 248, 67, 67, 67, 67, 67, 488, 490, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1071, 67, 1073, 67, 67, 67, 67, 67, 524, 67, 67, 67, 67, 67, 67, 67, 67, 535, 536, 67, 67, 67, 67, 67, 67, 1683, 1684, 67, 67, 67, 67, 1688, 1689, 67, 67, 67, 67, 67, 67, 1586, 67, 67, 67, 67, 67, 67, 67, 67, 67, 469, 67, 67, 67, 67, 67, 67, 97, 97, 97, 585, 587, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1163, 97, 97, 97, 97, 97, 97, 97, 621, 97, 97, 97, 97, 97, 97, 97, 97, 632, 633, 97, 97, 0, 0, 1782, 97, 97, 97, 97, 97, 0, 0, 97, 97, 0, 97, 712, 45, 45, 45, 717, 45, 45, 45, 45, 45, 45, 45, 45, 725, 45, 45, 45, 163, 167, 173, 177, 45, 45, 45, 45, 45, 193, 45, 45, 45, 45, 982, 45, 45, 45, 45, 45, 45, 987, 45, 45, 45, 45, 45, 1558, 45, 1560, 45, 45, 45, 45, 45, 45, 45, 45, 704, 705, 45, 45, 45, 45, 45, 45, 45, 45, 731, 45, 45, 45, 67, 67, 67, 67, 67, 739, 67, 67, 67, 67, 67, 67, 273, 0, 24850, 12564, 0, 0, 0, 0, 28809, 53531, 67, 67, 67, 764, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1290, 67, 67, 67, 67, 67, 67, 812, 67, 67, 67, 67, 818, 67, 67, 67, 25398, 542, 13112, 544, 57889, 0, 0, 54074, 54074, 550, 0, 97, 97, 97, 97, 97, 837, 97, 97, 97, 97, 97, 602, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1137, 97, 97, 97, 97, 97, 97, 97, 97, 97, 862, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1627, 97, 97, 97, 0, 97, 97, 97, 97, 910, 97, 97, 97, 97, 916, 97, 97, 97, 0, 0, 0, 97, 97, 1940, 97, 97, 1942, 45, 45, 45, 45, 45, 45, 385, 45, 45, 45, 45, 395, 45, 45, 45, 45, 966, 45, 969, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 975, 45, 45, 45, 406, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 974, 45, 45, 45, 67, 67, 67, 67, 1010, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1262, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1040, 67, 1042, 67, 1045, 67, 67, 67, 67, 67, 67, 67, 97, 1706, 97, 97, 97, 1709, 97, 97, 97, 67, 67, 67, 67, 1051, 67, 67, 67, 67, 67, 1057, 67, 67, 67, 67, 67, 67, 67, 1443, 67, 67, 1446, 67, 67, 67, 67, 67, 67, 67, 1297, 0, 0, 0, 1303, 0, 0, 0, 1309, 67, 67, 67, 67, 1079, 25398, 0, 13112, 0, 54074, 0, 0, 0, 0, 0, 0, 0, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2207744, 2207744, 2207744, 2207744, 2207744, 2572288, 2207744, 2207744, 2207744, 1098, 97, 97, 97, 97, 97, 1104, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1356, 97, 97, 97, 97, 97, 97, 1128, 97, 97, 97, 97, 97, 97, 1134, 97, 1136, 97, 1139, 97, 97, 97, 97, 97, 97, 1622, 97, 97, 97, 97, 97, 97, 97, 97, 0, 921, 0, 0, 0, 1176, 0, 646, 45, 67, 67, 67, 1268, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1469, 67, 67, 67, 97, 1348, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1127, 97, 67, 1569, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1448, 1449, 67, 1816, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1825, 67, 67, 1827, 97, 97, 0, 1781, 97, 97, 97, 97, 97, 97, 0, 0, 97, 97, 0, 97, 97, 97, 1831, 0, 0, 97, 97, 97, 97, 97, 0, 0, 0, 97, 97, 97, 1980, 97, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1395, 45, 45, 45, 45, 45, 97, 1846, 97, 97, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1212, 45, 45, 45, 45, 45, 45, 2010, 45, 67, 67, 67, 67, 67, 2016, 67, 97, 97, 0, 0, 97, 97, 97, 0, 97, 97, 97, 97, 97, 45, 45, 2007, 0, 94242, 0, 0, 0, 38, 102439, 0, 0, 106538, 98347, 28809, 45, 45, 143, 45, 45, 45, 1671, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 67, 1813, 67, 67, 1815, 45, 45, 67, 210, 67, 67, 67, 67, 67, 67, 239, 67, 67, 67, 67, 67, 67, 67, 1454, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1445, 67, 67, 67, 67, 67, 67, 97, 97, 290, 97, 97, 97, 97, 97, 97, 319, 97, 97, 97, 97, 97, 97, 303, 97, 97, 317, 97, 97, 97, 97, 97, 97, 305, 97, 97, 97, 97, 97, 97, 97, 97, 97, 899, 97, 97, 97, 97, 97, 97, 375, 45, 45, 45, 379, 45, 45, 390, 45, 45, 394, 45, 45, 45, 45, 45, 443, 45, 45, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 461, 67, 67, 67, 465, 67, 67, 476, 67, 67, 480, 67, 67, 67, 67, 67, 67, 1694, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1288, 67, 67, 67, 67, 67, 67, 500, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1075, 97, 97, 97, 558, 97, 97, 97, 562, 97, 97, 573, 97, 97, 577, 97, 97, 97, 97, 97, 895, 97, 97, 97, 97, 97, 97, 903, 97, 97, 97, 0, 97, 97, 1638, 97, 97, 97, 97, 97, 97, 97, 97, 1646, 597, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1334, 45, 681, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1396, 45, 45, 1399, 45, 45, 730, 45, 45, 45, 45, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1434, 67, 67, 67, 67, 67, 67, 750, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1456, 67, 67, 67, 67, 67, 45, 45, 993, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 67, 67, 1238, 67, 67, 1006, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1280, 1048, 1049, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1059, 67, 67, 67, 67, 67, 67, 1286, 67, 67, 67, 67, 67, 67, 67, 1291, 67, 97, 97, 1100, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 638, 0, 920, 97, 97, 1142, 1143, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1153, 97, 97, 97, 97, 97, 1158, 97, 97, 97, 1161, 97, 97, 97, 97, 1166, 97, 97, 97, 97, 97, 1325, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1328, 97, 97, 97, 97, 97, 97, 97, 45, 1218, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1678, 45, 45, 45, 67, 67, 67, 67, 67, 1269, 67, 67, 67, 67, 67, 67, 67, 67, 1278, 67, 67, 67, 67, 67, 67, 1761, 67, 67, 67, 67, 67, 67, 67, 67, 67, 530, 67, 67, 67, 67, 67, 67, 97, 97, 1349, 97, 97, 97, 97, 97, 97, 97, 97, 1358, 97, 97, 97, 97, 97, 97, 1623, 97, 97, 97, 97, 97, 97, 97, 97, 0, 921, 0, 0, 926, 0, 0, 0, 45, 45, 1411, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1754, 45, 45, 67, 67, 1301, 0, 1307, 0, 1313, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 21054, 97, 97, 97, 97, 67, 1757, 67, 67, 67, 1760, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1467, 67, 67, 67, 67, 67, 1778, 97, 0, 0, 97, 97, 97, 97, 97, 97, 0, 0, 97, 97, 0, 97, 97, 97, 97, 97, 1352, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1511, 97, 97, 97, 97, 97, 67, 67, 67, 67, 67, 1820, 67, 1822, 67, 67, 67, 67, 67, 97, 97, 97, 97, 97, 0, 0, 0, 97, 1933, 97, 1892, 97, 97, 97, 97, 97, 97, 1899, 45, 45, 45, 45, 45, 45, 45, 45, 1664, 45, 45, 45, 45, 45, 45, 45, 45, 1546, 45, 45, 45, 45, 45, 45, 45, 45, 1208, 45, 45, 45, 45, 45, 45, 45, 45, 1224, 45, 45, 45, 45, 45, 45, 45, 45, 673, 45, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 1925, 97, 97, 97, 97, 0, 0, 0, 97, 97, 97, 97, 97, 623, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 307, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1796, 97, 45, 45, 45, 45, 45, 45, 45, 970, 45, 45, 45, 45, 45, 45, 45, 45, 1417, 45, 45, 45, 45, 45, 45, 45, 67, 1964, 67, 67, 97, 97, 97, 97, 0, 0, 0, 97, 97, 97, 97, 0, 97, 97, 97, 97, 97, 97, 1721, 97, 97, 0, 0, 1997, 97, 0, 0, 2000, 97, 97, 0, 97, 97, 97, 97, 97, 45, 45, 45, 45, 733, 45, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 803, 67, 67, 67, 67, 67, 0, 94242, 0, 0, 0, 38, 102439, 0, 0, 106538, 98347, 28809, 45, 45, 144, 45, 45, 45, 1805, 45, 1807, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 67, 231, 67, 67, 67, 67, 67, 67, 67, 0, 24850, 12564, 0, 0, 0, 0, 28809, 53531, 45, 45, 67, 211, 67, 67, 67, 67, 230, 234, 240, 244, 67, 67, 67, 67, 67, 67, 464, 67, 67, 67, 67, 67, 67, 479, 67, 67, 67, 260, 67, 67, 67, 67, 67, 0, 24850, 12564, 0, 0, 0, 0, 28809, 53531, 97, 97, 291, 97, 97, 97, 97, 310, 314, 320, 324, 97, 97, 97, 97, 97, 97, 1367, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1355, 97, 97, 97, 97, 97, 97, 1362, 340, 97, 97, 97, 97, 97, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 131427, 0, 0, 360, 0, 362, 0, 365, 28809, 367, 139, 369, 45, 45, 45, 374, 67, 67, 460, 67, 67, 67, 67, 466, 67, 67, 67, 67, 67, 67, 67, 67, 801, 67, 67, 67, 67, 67, 67, 67, 67, 67, 487, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 498, 67, 67, 67, 67, 67, 67, 1772, 67, 67, 97, 97, 97, 97, 97, 97, 97, 0, 921, 922, 1175, 0, 0, 0, 0, 45, 67, 502, 67, 67, 67, 67, 67, 67, 67, 508, 67, 67, 67, 515, 517, 67, 67, 67, 67, 67, 97, 97, 97, 97, 97, 0, 0, 0, 1932, 97, 97, 0, 1999, 97, 97, 97, 0, 97, 97, 2004, 2005, 97, 45, 45, 45, 45, 1193, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 676, 45, 45, 45, 45, 67, 24850, 24850, 12564, 12564, 0, 57889, 0, 0, 0, 53531, 53531, 367, 286, 552, 97, 97, 97, 97, 97, 1377, 0, 0, 45, 45, 45, 45, 45, 45, 45, 45, 655, 45, 45, 45, 45, 45, 45, 45, 97, 97, 557, 97, 97, 97, 97, 563, 97, 97, 97, 97, 97, 97, 97, 97, 1135, 97, 97, 97, 97, 97, 97, 97, 97, 97, 584, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 595, 97, 97, 97, 97, 97, 911, 97, 97, 97, 97, 97, 97, 97, 638, 0, 0, 0, 0, 1315, 0, 0, 0, 0, 97, 97, 97, 1319, 97, 97, 97, 0, 97, 97, 97, 97, 97, 97, 1733, 97, 97, 97, 97, 97, 97, 1340, 97, 97, 97, 1343, 97, 97, 1345, 97, 1346, 97, 599, 97, 97, 97, 97, 97, 97, 97, 605, 97, 97, 97, 612, 614, 97, 97, 97, 97, 97, 1794, 97, 97, 97, 45, 45, 45, 45, 45, 45, 45, 1207, 45, 45, 45, 45, 45, 45, 1213, 45, 45, 745, 67, 67, 67, 67, 751, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1577, 67, 67, 67, 67, 67, 762, 67, 67, 67, 67, 766, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1765, 67, 67, 67, 67, 67, 777, 67, 67, 781, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1592, 1593, 67, 67, 97, 843, 97, 97, 97, 97, 849, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1510, 97, 97, 97, 97, 97, 97, 97, 860, 97, 97, 97, 97, 864, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1797, 45, 45, 45, 45, 1801, 45, 97, 875, 97, 97, 879, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1522, 97, 97, 97, 97, 97, 991, 45, 45, 45, 45, 996, 45, 45, 45, 45, 45, 45, 45, 45, 67, 67, 215, 67, 67, 67, 67, 233, 67, 67, 67, 67, 251, 253, 1022, 67, 67, 67, 1026, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1035, 67, 67, 1038, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1458, 67, 67, 67, 67, 67, 1064, 67, 67, 67, 1067, 67, 67, 67, 67, 1072, 67, 67, 67, 67, 67, 67, 1296, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2367488, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 67, 67, 67, 67, 67, 25398, 0, 13112, 0, 54074, 0, 0, 0, 0, 1096, 0, 921, 29315, 0, 0, 0, 0, 928, 45, 45, 45, 45, 45, 934, 45, 45, 45, 164, 45, 45, 45, 45, 45, 45, 45, 45, 45, 198, 45, 45, 45, 378, 45, 45, 45, 45, 45, 45, 393, 45, 45, 45, 398, 45, 97, 97, 1116, 97, 97, 97, 1120, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1147, 1148, 97, 97, 97, 97, 97, 97, 97, 1129, 97, 97, 1132, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1626, 97, 97, 97, 97, 0, 45, 1178, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1185, 45, 45, 45, 45, 441, 45, 45, 45, 45, 45, 45, 451, 45, 45, 67, 67, 67, 67, 67, 227, 67, 67, 67, 67, 67, 67, 67, 67, 1260, 67, 67, 67, 1263, 67, 67, 1265, 1203, 45, 45, 1205, 45, 1206, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1216, 67, 1266, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1276, 67, 67, 67, 67, 67, 67, 492, 67, 67, 67, 67, 67, 67, 67, 67, 67, 471, 67, 67, 67, 67, 481, 67, 45, 1386, 45, 1389, 45, 45, 45, 45, 1394, 45, 45, 45, 1397, 45, 45, 45, 45, 995, 45, 997, 45, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 1915, 67, 67, 67, 67, 67, 1422, 45, 45, 45, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1433, 67, 1436, 67, 67, 67, 67, 1441, 67, 67, 67, 1444, 67, 67, 67, 67, 67, 67, 67, 0, 24850, 12564, 0, 0, 0, 281, 28809, 53531, 97, 97, 97, 97, 1494, 97, 97, 97, 1497, 97, 97, 97, 97, 97, 97, 97, 1368, 97, 97, 97, 97, 97, 97, 97, 97, 851, 97, 97, 97, 97, 97, 97, 97, 67, 67, 67, 1571, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 25398, 542, 13112, 544, 67, 67, 1583, 67, 67, 67, 67, 67, 67, 67, 67, 1591, 67, 67, 67, 67, 67, 67, 752, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1056, 67, 67, 67, 67, 67, 67, 97, 1634, 97, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1125, 97, 97, 97, 1647, 97, 97, 97, 97, 97, 0, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1183, 45, 45, 45, 45, 45, 45, 45, 45, 45, 409, 45, 45, 45, 45, 45, 45, 1658, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1668, 1712, 97, 97, 97, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 0, 0, 1835, 97, 97, 97, 97, 0, 0, 0, 97, 97, 1844, 97, 97, 1726, 0, 97, 97, 97, 97, 97, 1732, 97, 1734, 97, 97, 97, 97, 97, 300, 97, 308, 97, 97, 97, 97, 97, 97, 97, 97, 866, 97, 97, 97, 97, 97, 97, 97, 67, 67, 67, 1758, 67, 67, 67, 1762, 67, 67, 67, 67, 67, 67, 67, 67, 1043, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1771, 67, 67, 67, 97, 97, 97, 97, 97, 1776, 97, 97, 97, 97, 297, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1108, 97, 97, 97, 97, 67, 67, 67, 1966, 97, 97, 97, 1970, 0, 0, 0, 97, 97, 97, 97, 0, 97, 97, 97, 1720, 97, 97, 97, 97, 97, 0, 0, 97, 97, 97, 1837, 97, 0, 1840, 1841, 97, 97, 97, 1988, 45, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1994, 1995, 67, 97, 97, 97, 97, 97, 1103, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 917, 97, 97, 0, 0, 0, 67, 67, 265, 67, 67, 67, 67, 0, 24850, 12564, 0, 0, 0, 0, 28809, 53531, 97, 345, 97, 97, 97, 97, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 131427, 0, 0, 0, 361, 362, 0, 365, 28809, 367, 139, 45, 45, 45, 45, 45, 671, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 411, 45, 45, 414, 45, 45, 45, 45, 377, 45, 45, 45, 386, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1223, 45, 45, 45, 45, 45, 45, 45, 45, 45, 426, 45, 45, 433, 45, 45, 45, 67, 67, 67, 67, 67, 463, 67, 67, 67, 472, 67, 67, 67, 67, 67, 67, 67, 527, 67, 67, 67, 67, 67, 67, 537, 67, 540, 24850, 24850, 12564, 12564, 0, 57889, 0, 0, 0, 53531, 53531, 367, 286, 97, 97, 97, 97, 97, 1119, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1509, 97, 97, 97, 97, 97, 97, 97, 97, 564, 97, 97, 97, 97, 97, 97, 97, 637, 18, 131427, 0, 0, 0, 0, 0, 0, 362, 0, 0, 365, 29315, 367, 0, 921, 29315, 0, 0, 0, 927, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1234, 45, 45, 45, 45, 67, 67, 67, 67, 1240, 45, 697, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 708, 45, 45, 45, 45, 1221, 45, 45, 45, 45, 1225, 45, 45, 45, 45, 45, 45, 384, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1210, 45, 45, 45, 45, 45, 45, 67, 67, 795, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1470, 67, 67, 67, 67, 67, 67, 67, 815, 67, 67, 67, 67, 67, 67, 25398, 542, 13112, 544, 97, 97, 97, 893, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1164, 97, 97, 97, 67, 67, 67, 1025, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1687, 67, 67, 67, 67, 67, 67, 67, 67, 67, 25398, 0, 13112, 0, 54074, 0, 0, 0, 0, 0, 1097, 1241, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1450, 45, 45, 1388, 45, 1390, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1236, 67, 67, 67, 67, 67, 1437, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1472, 1490, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1503, 67, 67, 67, 67, 67, 97, 97, 97, 97, 97, 0, 1930, 0, 97, 97, 97, 97, 97, 847, 97, 97, 97, 97, 97, 97, 97, 97, 97, 858, 67, 67, 1965, 67, 97, 97, 97, 97, 0, 0, 0, 97, 97, 97, 97, 0, 97, 97, 1719, 97, 97, 97, 97, 97, 97, 0, 0, 0, 45, 45, 45, 45, 1382, 45, 1383, 45, 45, 45, 159, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1563, 45, 45, 45, 45, 45, 67, 261, 67, 67, 67, 67, 67, 0, 24850, 12564, 0, 0, 0, 0, 28809, 53531, 341, 97, 97, 97, 97, 97, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 97, 1099, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1333, 97, 1230, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 67, 1992, 67, 1993, 67, 67, 67, 97, 97, 45, 45, 160, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1665, 45, 45, 45, 45, 45, 131427, 357, 0, 0, 0, 362, 0, 365, 28809, 367, 139, 45, 45, 45, 45, 45, 684, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 412, 45, 45, 45, 416, 45, 45, 45, 440, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 67, 67, 1990, 67, 1991, 67, 67, 67, 67, 67, 67, 67, 97, 97, 1707, 97, 97, 97, 97, 97, 97, 501, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1691, 67, 67, 67, 67, 67, 526, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1030, 67, 1032, 67, 67, 67, 67, 598, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1632, 0, 921, 29315, 923, 0, 0, 0, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1404, 45, 45, 45, 45, 45, 45, 45, 45, 45, 425, 45, 45, 45, 45, 45, 45, 67, 67, 67, 67, 67, 25398, 0, 13112, 0, 54074, 0, 0, 1093, 0, 0, 0, 0, 0, 97, 1609, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1369, 97, 97, 97, 1372, 97, 97, 67, 67, 266, 67, 67, 67, 67, 0, 24850, 12564, 0, 0, 0, 0, 28809, 53531, 97, 346, 97, 97, 97, 97, 0, 40976, 0, 18, 18, 24, 24, 27, 27, 27, 665, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1677, 45, 45, 45, 45, 67, 45, 45, 954, 45, 956, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1545, 45, 45, 45, 45, 45, 45, 45, 45, 45, 448, 45, 45, 45, 45, 67, 456, 67, 67, 67, 67, 67, 1270, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1069, 67, 67, 67, 67, 67, 67, 97, 97, 97, 1350, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1524, 97, 97, 97, 97, 97, 97, 97, 1376, 0, 0, 0, 45, 45, 45, 45, 45, 45, 45, 45, 1559, 1561, 45, 45, 45, 1564, 45, 1566, 1567, 45, 67, 67, 67, 67, 67, 1573, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 1247, 67, 67, 67, 67, 67, 1252, 97, 1725, 97, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1628, 97, 1630, 0, 0, 94242, 0, 0, 0, 2211840, 0, 1118208, 0, 0, 0, 0, 2158592, 2158731, 2158592, 2158592, 2158592, 3117056, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 3018752, 2158592, 3043328, 2158592, 2158592, 2158592, 2158592, 3080192, 2158592, 2158592, 3112960, 2158592, 2158592, 2158592, 2158592, 2158592, 2158878, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2605056, 2158592, 2158592, 2207744, 0, 542, 0, 544, 0, 0, 2166784, 0, 0, 0, 550, 0, 0, 2158592, 2158592, 2686976, 2158592, 2715648, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2867200, 2158592, 2904064, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 0, 94242, 0, 0, 0, 2211840, 0, 0, 1130496, 0, 0, 0, 2158592, 2158592, 2158592, 2158592, 2158592, 3186688, 2158592, 0, 0, 139, 0, 0, 0, 139, 0, 2367488, 2207744, 0, 0, 0, 0, 176128, 0, 2166784, 0, 0, 0, 0, 0, 286, 2158592, 2158592, 3170304, 3174400, 2158592, 0, 0, 0, 2158592, 2158592, 2158592, 2158592, 2158592, 2424832, 2158592, 2158592, 2158592, 1508, 2158592, 2908160, 2158592, 2158592, 2158592, 2977792, 2158592, 2158592, 2158592, 2158592, 3039232, 2158592, 2158592, 2158592, 2158592, 2158592, 2158592, 3158016, 67, 24850, 24850, 12564, 12564, 0, 0, 0, 0, 0, 53531, 53531, 0, 286, 97, 97, 97, 97, 97, 1144, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1149, 97, 97, 97, 97, 1154, 57889, 0, 0, 0, 0, 550, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 561, 97, 97, 97, 97, 97, 97, 576, 97, 97, 139264, 139264, 139264, 139264, 139264, 139264, 139264, 139264, 139264, 139264, 139264, 139264, 0, 0, 139264, 0, 921, 29315, 0, 0, 926, 0, 45, 45, 45, 45, 45, 45, 45, 45, 45, 719, 720, 45, 45, 45, 45, 45, 45, 45, 45, 685, 45, 45, 45, 45, 45, 45, 45, 45, 45, 942, 45, 45, 946, 45, 45, 45, 950, 45, 45, 0, 2146304, 2146304, 0, 0, 0, 0, 2224128, 2224128, 2224128, 2232320, 2232320, 2232320, 2232320, 0, 0, 1301, 0, 0, 0, 0, 0, 1307, 0, 0, 0, 0, 0, 1313, 0, 0, 0, 0, 0, 0, 0, 97, 97, 1318, 97, 97, 97, 97, 97, 97, 1795, 97, 97, 45, 45, 45, 45, 45, 45, 45, 446, 45, 45, 45, 45, 45, 45, 67, 67, 2158592, 2146304, 0, 0, 0, 0, 0, 0, 0, 2211840, 0, 0, 0, 0, 2158592, 0, 921, 29315, 0, 924, 0, 0, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1000, 45, 45, 45, 45, 67, 67 -]; - -XQueryTokenizer.EXPECTED = -[ 290, 300, 304, 353, 296, 309, 305, 319, 315, 324, 328, 352, 354, 334, 338, 330, 320, 345, 349, 293, 358, 362, 341, 366, 312, 370, 374, 378, 382, 386, 390, 394, 398, 737, 402, 634, 439, 604, 634, 634, 634, 634, 408, 634, 634, 634, 404, 634, 634, 634, 457, 634, 634, 963, 634, 634, 413, 634, 634, 634, 634, 634, 634, 634, 663, 418, 422, 903, 902, 426, 431, 548, 634, 437, 521, 919, 443, 615, 409, 449, 455, 624, 731, 751, 634, 461, 465, 672, 470, 469, 474, 481, 485, 477, 489, 493, 629, 542, 497, 505, 603, 602, 991, 648, 510, 804, 634, 515, 958, 526, 525, 530, 768, 634, 546, 552, 711, 710, 593, 558, 562, 618, 566, 570, 574, 578, 582, 586, 590, 608, 612, 660, 822, 821, 634, 622, 596, 444, 628, 533, 724, 633, 640, 653, 647, 652, 536, 1008, 451, 450, 445, 657, 670, 676, 685, 689, 693, 697, 701, 704, 707, 715, 719, 798, 815, 634, 723, 762, 996, 634, 728, 969, 730, 735, 908, 634, 741, 679, 889, 511, 747, 634, 750, 755, 499, 666, 499, 501, 759, 772, 776, 780, 634, 787, 784, 797, 802, 809, 808, 427, 814, 1006, 517, 634, 519, 853, 634, 813, 850, 793, 634, 819, 826, 833, 832, 837, 843, 847, 857, 861, 863, 867, 871, 875, 879, 883, 643, 887, 539, 980, 979, 634, 893, 944, 634, 900, 896, 634, 907, 933, 506, 912, 917, 828, 433, 636, 635, 554, 961, 923, 930, 927, 937, 941, 634, 634, 634, 974, 948, 952, 985, 913, 968, 967, 743, 634, 973, 839, 634, 978, 599, 634, 984, 989, 765, 444, 995, 1000, 634, 1003, 790, 955, 1012, 681, 634, 634, 634, 634, 634, 414, 1016, 1020, 1024, 1085, 1027, 1090, 1090, 1046, 1080, 1137, 1108, 1215, 1049, 1032, 1039, 1085, 1085, 1085, 1085, 1058, 1062, 1068, 1085, 1086, 1090, 1090, 1091, 1072, 1064, 1107, 1090, 1090, 1090, 1118, 1123, 1138, 1078, 1074, 1084, 1085, 1085, 1085, 1087, 1090, 1062, 1052, 1060, 1114, 1062, 1104, 1085, 1085, 1090, 1090, 1028, 1122, 1063, 1128, 1139, 1127, 1158, 1085, 1085, 1151, 1090, 1090, 1090, 1095, 1090, 1132, 1073, 1136, 1143, 1061, 1150, 1085, 1155, 1098, 1101, 1146, 1162, 1169, 1101, 1185, 1151, 1090, 1110, 1173, 1054, 1087, 1109, 1177, 1165, 1089, 1204, 1184, 1107, 1189, 1193, 1088, 1197, 1180, 1201, 1208, 1042, 1212, 1219, 1223, 1227, 1231, 1235, 1245, 1777, 1527, 1686, 1686, 1238, 1686, 1254, 1686, 1686, 1686, 1294, 1669, 1686, 1686, 1686, 1322, 1625, 1534, 1268, 1624, 1275, 1281, 1443, 1292, 1300, 1686, 1686, 1686, 1350, 1826, 1306, 1686, 1686, 1240, 2032, 1317, 1321, 1686, 1686, 1253, 1686, 1326, 1686, 1686, 1686, 1418, 1709, 1446, 1686, 1686, 1686, 1492, 1686, 1295, 1447, 1686, 1686, 1258, 1686, 1736, 1686, 1686, 1520, 1355, 1686, 1288, 1348, 1361, 1686, 1359, 1686, 1364, 1498, 1368, 1302, 1362, 1381, 1389, 1395, 1486, 1686, 1371, 1377, 1370, 1686, 1375, 1382, 1384, 1402, 1408, 1385, 1383, 1619, 1413, 1423, 1428, 1433, 1686, 1686, 1270, 1686, 1338, 1686, 1440, 1686, 1686, 1686, 1499, 1465, 1686, 1686, 1686, 1639, 1473, 1884, 1686, 1686, 1293, 1864, 1686, 1686, 1296, 1321, 1483, 1686, 1686, 1686, 1646, 1686, 1748, 1496, 1686, 1418, 1675, 1686, 1418, 1702, 1686, 1418, 1981, 1686, 1429, 1409, 1427, 1504, 1692, 1686, 1686, 1313, 1448, 1651, 1508, 1686, 1686, 1340, 1686, 1903, 1686, 1686, 1435, 1513, 1686, 1283, 1287, 1519, 1686, 1524, 1363, 1568, 1938, 1539, 1566, 1579, 1479, 1533, 1538, 1553, 1544, 1552, 1557, 1563, 1574, 1557, 1583, 1589, 1590, 1759, 1594, 1603, 1607, 1611, 1686, 1436, 1514, 1686, 1434, 1656, 1686, 1434, 1680, 1686, 1453, 1686, 1686, 1686, 1559, 1617, 1686, 1770, 1418, 1623, 1769, 1629, 1686, 1515, 1335, 1686, 1285, 1686, 1671, 1921, 1650, 1686, 1686, 1344, 1308, 1666, 1686, 1686, 1686, 1659, 1685, 1686, 1686, 1686, 1686, 1241, 1686, 1686, 1844, 1691, 1686, 1630, 1977, 1970, 1362, 1686, 1686, 1686, 1693, 1698, 1686, 1686, 1686, 1697, 1686, 1764, 1715, 1686, 1634, 1638, 1686, 1599, 1585, 1686, 1271, 1686, 1269, 1686, 1721, 1686, 1686, 1354, 1686, 1801, 1686, 1799, 1686, 1640, 1686, 1686, 1461, 1686, 1686, 1732, 1686, 1944, 1686, 1740, 1686, 1746, 1415, 1396, 1686, 1598, 1547, 1417, 1597, 1416, 1577, 1546, 1397, 1577, 1547, 1548, 1570, 1398, 1753, 1686, 1652, 1509, 1686, 1686, 1686, 1757, 1686, 1419, 1686, 1763, 1418, 1768, 1781, 1686, 1686, 1686, 1705, 1686, 2048, 1792, 1686, 1686, 1686, 1735, 1686, 1797, 1686, 1686, 1404, 1686, 1639, 1815, 1686, 1686, 1418, 2017, 1820, 1686, 1686, 1803, 1686, 1686, 1686, 1736, 1489, 1686, 1686, 1825, 1338, 1260, 1263, 1686, 1686, 1785, 1686, 1686, 1728, 1686, 1686, 1749, 1497, 1830, 1830, 1262, 1248, 1261, 1329, 1260, 1264, 1329, 1248, 1249, 1259, 1540, 1849, 1842, 1686, 1686, 1835, 1686, 1686, 1816, 1686, 1686, 1831, 1882, 1848, 1686, 1686, 1686, 1774, 2071, 1854, 1686, 1686, 1469, 1884, 1686, 1821, 1859, 1686, 1686, 1350, 1883, 1686, 1686, 1686, 1781, 1391, 1875, 1686, 1686, 1613, 1644, 1686, 1686, 1889, 1686, 1686, 1662, 1884, 1686, 1885, 1890, 1686, 1686, 1686, 1894, 1686, 1686, 1678, 1686, 1907, 1686, 1686, 1529, 1914, 1686, 1838, 1686, 1686, 1881, 1686, 1686, 1872, 1876, 1836, 1919, 1686, 1837, 1692, 1910, 1686, 1925, 1928, 1742, 1686, 1811, 1811, 1930, 1810, 1929, 1935, 1928, 1900, 1942, 1867, 1868, 1931, 1035, 1788, 1948, 1952, 1956, 1960, 1964, 1686, 1976, 1686, 1686, 1686, 2065, 1686, 1992, 2037, 1686, 1686, 1998, 2009, 1972, 2002, 1686, 1686, 1686, 2077, 1300, 2023, 1686, 1686, 1686, 1807, 2031, 1686, 1686, 1686, 1860, 1500, 2032, 1686, 1686, 1686, 2083, 1686, 2036, 1686, 1277, 1276, 2042, 1877, 1686, 1686, 2041, 1686, 1686, 2027, 2037, 2012, 1686, 2012, 1855, 1850, 1686, 2046, 1686, 1686, 2054, 1996, 1686, 1897, 1309, 2059, 2052, 1686, 2058, 1686, 1686, 2081, 1686, 1717, 1477, 1686, 1331, 1686, 1686, 1687, 1686, 1860, 1681, 1686, 1686, 1686, 1966, 1724, 1686, 1686, 1686, 1984, 2015, 1686, 1686, 1686, 1988, 1686, 2063, 1686, 1686, 1686, 2005, 1686, 1727, 1686, 1686, 1711, 1457, 2069, 1686, 1686, 1686, 2019, 2075, 1686, 1686, 1915, 1686, 1686, 1793, 1874, 1686, 1686, 1491, 1362, 1449, 1686, 1686, 1460, 2098, 2087, 2091, 2095, 2184, 2102, 2113, 2780, 2117, 2134, 2142, 2281, 2146, 2146, 2146, 2304, 2296, 2181, 2639, 2591, 2872, 2592, 2873, 2313, 2195, 2200, 2281, 2146, 2273, 2226, 2204, 2152, 2219, 2276, 2167, 2177, 2276, 2235, 2276, 2276, 2230, 2281, 2276, 2296, 2276, 2293, 2276, 2276, 2276, 2276, 2234, 2276, 2311, 2314, 2210, 2199, 2217, 2222, 2276, 2276, 2276, 2240, 2276, 2294, 2276, 2276, 2173, 2276, 2198, 2281, 2281, 2281, 2281, 2282, 2146, 2146, 2146, 2146, 2205, 2146, 2204, 2248, 2276, 2235, 2276, 2297, 2276, 2276, 2276, 2277, 2256, 2281, 2283, 2146, 2146, 2146, 2275, 2276, 2295, 2276, 2276, 2293, 2146, 2304, 2264, 2269, 2221, 2276, 2276, 2276, 2293, 2295, 2276, 2276, 2276, 2295, 2263, 2205, 2268, 2220, 2172, 2276, 2276, 2276, 2296, 2276, 2276, 2296, 2294, 2276, 2276, 2278, 2281, 2281, 2280, 2281, 2281, 2281, 2283, 2206, 2223, 2276, 2276, 2279, 2281, 2281, 2146, 2273, 2276, 2276, 2281, 2281, 2281, 2276, 2292, 2276, 2298, 2225, 2276, 2298, 2169, 2224, 2292, 2298, 2171, 2229, 2281, 2281, 2171, 2236, 2281, 2281, 2281, 2146, 2275, 2225, 2292, 2299, 2276, 2229, 2281, 2146, 2276, 2290, 2297, 2283, 2146, 2146, 2274, 2224, 2227, 2298, 2225, 2297, 2276, 2230, 2170, 2230, 2282, 2146, 2147, 2151, 2156, 2288, 2276, 2230, 2303, 2308, 2236, 2284, 2228, 2318, 2318, 2318, 2326, 2335, 2339, 2343, 2349, 2416, 2693, 2357, 2592, 2109, 2592, 2592, 2162, 2943, 2823, 2646, 2592, 2361, 2592, 2122, 2592, 2592, 2122, 2470, 2592, 2592, 2592, 2109, 2107, 2592, 2592, 2592, 2123, 2592, 2592, 2592, 2125, 2592, 2413, 2592, 2592, 2592, 2127, 2592, 2592, 2414, 2592, 2592, 2592, 2130, 2952, 2592, 2594, 2592, 2592, 2212, 2609, 2252, 2592, 2592, 2592, 2446, 2434, 2592, 2592, 2592, 2212, 2446, 2450, 2456, 2431, 2435, 2592, 2592, 2243, 2478, 2448, 2439, 2946, 2592, 2592, 2592, 2368, 2809, 2813, 2450, 2441, 2212, 2812, 2449, 2440, 2947, 2592, 2592, 2592, 2345, 2451, 2457, 2948, 2592, 2124, 2592, 2592, 2650, 2823, 2449, 2455, 2946, 2592, 2128, 2592, 2592, 2649, 2952, 2592, 2810, 2448, 2461, 2991, 2467, 2592, 2592, 2329, 2817, 2474, 2990, 2466, 2592, 2592, 2373, 2447, 2992, 2469, 2592, 2592, 2592, 2373, 2447, 2477, 2468, 2592, 2592, 2353, 2469, 2592, 2495, 2592, 2592, 2415, 2483, 2592, 2415, 2496, 2592, 2592, 2352, 2592, 2592, 2352, 2352, 2469, 2592, 2592, 2363, 2331, 2494, 2592, 2592, 2592, 2375, 2592, 2375, 2415, 2504, 2592, 2592, 2367, 2372, 2503, 2592, 2592, 2592, 2389, 2418, 2415, 2592, 2592, 2373, 2592, 2592, 2592, 2593, 2732, 2417, 2415, 2592, 2417, 2520, 2592, 2592, 2592, 2390, 2521, 2521, 2592, 2592, 2592, 2401, 2599, 2585, 2526, 2531, 2120, 2592, 2212, 2426, 2450, 2463, 2948, 2592, 2592, 2592, 2213, 2389, 2527, 2532, 2121, 2542, 2551, 2105, 2592, 2213, 2592, 2592, 2592, 2558, 2538, 2544, 2553, 2557, 2537, 2543, 2552, 2421, 2572, 2576, 2546, 2543, 2547, 2592, 2592, 2373, 2615, 2575, 2545, 2105, 2592, 2244, 2479, 2592, 2129, 2592, 2592, 2628, 2690, 2469, 2562, 2566, 2592, 2592, 2592, 2415, 2928, 2934, 2401, 2570, 2574, 2564, 2572, 2585, 2590, 2592, 2592, 2585, 2965, 2592, 2592, 2592, 2445, 2251, 2592, 2592, 2592, 2474, 2592, 2609, 2892, 2592, 2362, 2592, 2592, 2138, 2851, 2159, 2592, 2592, 2592, 2509, 2888, 2892, 2592, 2592, 2592, 2490, 2418, 2891, 2592, 2592, 2376, 2592, 2592, 2374, 2592, 2889, 2388, 2592, 2373, 2373, 2890, 2592, 2592, 2387, 2592, 2887, 2505, 2892, 2592, 2373, 2610, 2388, 2592, 2592, 2376, 2373, 2592, 2887, 2891, 2592, 2374, 2592, 2592, 2608, 2159, 2614, 2620, 2592, 2592, 2394, 2594, 2887, 2399, 2592, 2887, 2397, 2508, 2374, 2507, 2592, 2375, 2592, 2592, 2592, 2595, 2508, 2506, 2592, 2506, 2505, 2505, 2592, 2507, 2637, 2505, 2592, 2592, 2401, 2661, 2592, 2643, 2592, 2592, 2417, 2592, 2655, 2592, 2592, 2592, 2510, 2414, 2656, 2592, 2592, 2592, 2516, 2592, 2593, 2660, 2665, 2880, 2592, 2592, 2592, 2522, 2767, 2666, 2881, 2592, 2592, 2420, 2571, 2696, 2592, 2592, 2592, 2580, 2572, 2686, 2632, 2698, 2592, 2383, 2514, 2592, 2163, 2932, 2465, 2685, 2631, 2697, 2592, 2388, 2592, 2592, 2212, 2604, 2671, 2632, 2678, 2592, 2401, 2405, 2409, 2592, 2592, 2592, 2679, 2592, 2592, 2592, 2592, 2108, 2677, 2591, 2592, 2592, 2592, 2419, 2592, 2683, 2187, 2191, 2469, 2671, 2189, 2467, 2592, 2401, 2629, 2633, 2702, 2468, 2592, 2592, 2421, 2536, 2703, 2469, 2592, 2592, 2422, 2573, 2593, 2672, 2467, 2592, 2402, 2406, 2592, 2402, 2979, 2592, 2592, 2626, 2673, 2467, 2592, 2446, 2259, 2947, 2592, 2377, 2709, 2592, 2592, 2522, 2862, 2713, 2468, 2592, 2592, 2581, 2572, 2562, 2374, 2374, 2592, 2376, 2721, 2724, 2592, 2592, 2624, 2373, 2731, 2592, 2592, 2592, 2626, 2732, 2592, 2592, 2592, 2755, 2656, 2726, 2736, 2741, 2592, 2486, 2593, 2381, 2592, 2727, 2737, 2742, 2715, 2747, 2753, 2592, 2498, 2469, 2873, 2743, 2592, 2592, 2592, 2791, 2759, 2763, 2592, 2592, 2627, 2704, 2592, 2592, 2522, 2789, 2593, 2761, 2753, 2592, 2498, 2863, 2592, 2592, 2767, 2592, 2592, 2592, 2792, 2789, 2592, 2592, 2592, 2803, 2126, 2592, 2592, 2592, 2811, 2122, 2592, 2592, 2592, 2834, 2777, 2592, 2592, 2592, 2848, 2936, 2591, 2489, 2797, 2592, 2592, 2670, 2631, 2490, 2798, 2592, 2592, 2592, 2963, 2807, 2592, 2592, 2592, 2965, 2838, 2592, 2592, 2592, 2975, 2330, 2818, 2829, 2592, 2498, 2939, 2592, 2498, 2592, 2791, 2331, 2819, 2830, 2592, 2592, 2592, 2982, 2834, 2817, 2828, 2106, 2592, 2592, 2592, 2405, 2405, 2817, 2828, 2592, 2592, 2415, 2849, 2842, 2592, 2522, 2773, 2592, 2522, 2868, 2592, 2580, 2600, 2586, 2137, 2850, 2843, 2592, 2592, 2855, 2937, 2844, 2592, 2592, 2592, 2987, 2936, 2591, 2592, 2592, 2684, 2630, 2592, 2856, 2938, 2592, 2592, 2860, 2939, 2592, 2592, 2872, 2592, 2861, 2591, 2592, 2592, 2887, 2616, 2592, 2867, 2592, 2592, 2708, 2592, 2498, 2469, 2498, 2497, 2785, 2773, 2499, 2783, 2770, 2877, 2877, 2877, 2772, 2592, 2592, 2345, 2885, 2592, 2592, 2592, 2715, 2762, 2515, 2896, 2592, 2592, 2715, 2917, 2516, 2897, 2592, 2592, 2592, 2901, 2906, 2911, 2592, 2592, 2956, 2960, 2715, 2902, 2907, 2912, 2593, 2916, 2920, 2820, 2922, 2822, 2592, 2592, 2715, 2927, 2921, 2821, 2106, 2592, 2592, 2974, 2408, 2321, 2821, 2106, 2592, 2592, 2983, 2592, 2593, 2404, 2408, 2592, 2592, 2717, 2749, 2716, 2928, 2322, 2822, 2593, 2926, 2919, 2820, 2934, 2823, 2592, 2592, 2592, 2651, 2824, 2592, 2592, 2592, 2130, 2952, 2592, 2592, 2592, 2592, 2964, 2592, 2592, 2716, 2748, 2592, 2969, 2592, 2592, 2716, 2918, 2368, 2970, 2592, 2592, 2592, 2403, 2407, 2592, 2592, 2787, 2211, 2404, 2409, 2592, 2592, 2802, 2837, 2987, 2592, 2592, 2592, 2809, 2427, 2592, 2793, 2592, 2592, 2809, 2447, 1073741824, 0x80000000, 539754496, 542375936, 402653184, 554434560, 571736064, 545521856, 268451840, 335544320, 268693630, 512, 2048, 256, 1024, 0, 1024, 0, 1073741824, 0x80000000, 0, 0, 0, 8388608, 0, 0, 1073741824, 1073741824, 0, 0x80000000, 537133056, 4194304, 1048576, 268435456, -1073741824, 0, 0, 0, 1048576, 0, 0, 0, 1572864, 0, 0, 0, 4194304, 0, 134217728, 16777216, 0, 0, 32, 64, 98304, 0, 33554432, 8388608, 192, 67108864, 67108864, 67108864, 67108864, 16, 32, 4, 0, 8192, 196608, 196608, 229376, 80, 4096, 524288, 8388608, 0, 0, 32, 128, 256, 24576, 24600, 24576, 24576, 2, 24576, 24576, 24576, 24584, 24592, 24576, 24578, 24576, 24578, 24576, 24576, 16, 512, 2048, 2048, 256, 4096, 32768, 1048576, 4194304, 67108864, 134217728, 268435456, 262144, 134217728, 0, 128, 128, 64, 16384, 16384, 16384, 67108864, 32, 32, 4, 4, 4096, 262144, 134217728, 0, 0, 0, 2, 0, 8192, 131072, 131072, 4096, 4096, 4096, 4096, 24576, 24576, 24576, 8, 8, 24576, 24576, 16384, 16384, 16384, 24576, 24584, 24576, 24576, 24576, 16384, 24576, 536870912, 262144, 0, 0, 32, 2048, 8192, 4, 4096, 4096, 4096, 786432, 8388608, 16777216, 0, 128, 16384, 16384, 16384, 32768, 65536, 2097152, 32, 32, 32, 32, 4, 4, 4, 4, 4, 4096, 67108864, 67108864, 67108864, 24576, 24576, 24576, 24576, 0, 16384, 16384, 16384, 16384, 67108864, 67108864, 8, 67108864, 24576, 8, 8, 8, 24576, 24576, 24576, 24578, 24576, 24576, 24576, 2, 2, 2, 16384, 67108864, 67108864, 67108864, 32, 67108864, 8, 8, 24576, 2048, 0x80000000, 536870912, 262144, 262144, 262144, 67108864, 8, 24576, 16384, 32768, 1048576, 4194304, 25165824, 67108864, 24576, 32770, 2, 4, 112, 512, 98304, 524288, 50, 402653186, 1049090, 1049091, 10, 66, 100925514, 10, 66, 12582914, 0, 0, -1678194207, -1678194207, -1041543218, 0, 32768, 0, 0, 32, 65536, 268435456, 1, 1, 513, 1048577, 0, 12582912, 0, 0, 0, 4, 1792, 0, 0, 0, 7, 29360128, 0, 0, 0, 8, 0, 0, 0, 12, 1, 1, 0, 0, -604102721, -604102721, 4194304, 8388608, 0, 0, 0, 31, 925600, 997981306, 997981306, 997981306, 0, 0, 2048, 8388608, 0, 0, 1, 2, 4, 32, 64, 512, 8192, 0, 0, 0, 245760, 997720064, 0, 0, 0, 32, 0, 0, 0, 3, 12, 16, 32, 8, 112, 3072, 12288, 16384, 32768, 65536, 131072, 7864320, 16777216, 973078528, 0, 0, 65536, 131072, 3670016, 4194304, 16777216, 33554432, 2, 8, 48, 2048, 8192, 16384, 32768, 65536, 131072, 524288, 131072, 524288, 3145728, 4194304, 16777216, 33554432, 65536, 131072, 2097152, 4194304, 16777216, 33554432, 134217728, 268435456, 536870912, 0, 0, 0, 1024, 0, 8, 48, 2048, 8192, 65536, 33554432, 268435456, 536870912, 65536, 268435456, 536870912, 0, 0, 32768, 0, 0, 126, 623104, 65011712, 0, 32, 65536, 536870912, 0, 0, 65536, 524288, 0, 32, 65536, 0, 0, 0, 2048, 0, 0, 0, 15482, 245760, -604102721, 0, 0, 0, 18913, 33062912, 925600, -605028352, 0, 0, 0, 65536, 31, 8096, 131072, 786432, 3145728, 3145728, 12582912, 50331648, 134217728, 268435456, 160, 256, 512, 7168, 131072, 786432, 131072, 786432, 1048576, 2097152, 12582912, 16777216, 268435456, 1073741824, 0x80000000, 12582912, 16777216, 33554432, 268435456, 1073741824, 0x80000000, 3, 12, 16, 160, 256, 7168, 786432, 1048576, 12582912, 16777216, 268435456, 1073741824, 0, 8, 16, 32, 128, 256, 512, 7168, 786432, 1048576, 2097152, 0, 1, 2, 8, 16, 7168, 786432, 1048576, 8388608, 16777216, 16777216, 1073741824, 0, 0, 0, 0, 1, 0, 0, 8, 32, 128, 256, 7168, 8, 32, 0, 3072, 0, 8, 32, 3072, 4096, 524288, 8, 32, 0, 0, 3072, 4096, 0, 2048, 524288, 8388608, 8, 2048, 0, 0, 1, 12, 256, 4096, 32768, 262144, 1048576, 4194304, 67108864, 0, 2048, 0, 2048, 2048, 1073741824, -58805985, -58805985, -58805985, 0, 0, 262144, 0, 0, 32, 4194304, 16777216, 134217728, 4382, 172032, -58982400, 0, 0, 2, 28, 256, 4096, 8192, 8192, 32768, 131072, 262144, 524288, 1, 2, 12, 256, 4096, 0, 0, 4194304, 67108864, 134217728, 805306368, 1073741824, 0, 0, 1, 2, 12, 16, 256, 4096, 1048576, 67108864, 134217728, 268435456, 0, 512, 1048576, 4194304, 201326592, 1879048192, 0, 0, 12, 256, 4096, 134217728, 268435456, 536870912, 12, 256, 268435456, 536870912, 0, 12, 256, 0, 0, 1, 32, 64, 512, 0, 0, 205236961, 205236961, 0, 0, 0, 1, 96, 640, 1, 10976, 229376, 204996608, 0, 640, 2048, 8192, 229376, 1572864, 1572864, 2097152, 201326592, 0, 0, 0, 64, 512, 2048, 229376, 1572864, 201326592, 1572864, 201326592, 0, 0, 1, 4382, 0, 1, 32, 2048, 65536, 131072, 1572864, 201326592, 131072, 1572864, 134217728, 0, 0, 524288, 524288, 0, 0, 0, -68582786, -68582786, -68582786, 0, 0, 2097152, 524288, 0, 524288, 0, 0, 65536, 131072, 1572864, 0, 0, 2, 4, 0, 0, 65011712, -134217728, 0, 0, 0, 0, 2, 4, 120, 512, -268435456, 0, 0, 0, 2, 8, 48, 64, 2048, 8192, 98304, 524288, 2097152, 4194304, 25165824, 33554432, 134217728, 268435456, 0x80000000, 0, 0, 25165824, 33554432, 134217728, 1879048192, 0x80000000, 0, 0, 4, 112, 512, 622592, 65011712, 134217728, -268435456, 16777216, 33554432, 134217728, 1610612736, 0, 0, 0, 64, 98304, 524288, 4194304, 16777216, 33554432, 0, 98304, 524288, 16777216, 33554432, 0, 65536, 524288, 33554432, 536870912, 1073741824, 0, 65536, 524288, 536870912, 1073741824, 0, 0, 65536, 524288, 536870912, 0, 524288, 0, 524288, 524288, 1048576, 2086666240, 0x80000000, 0, -1678194207, 0, 0, 0, 8, 32, 2048, 524288, 8388608, 0, 0, 33062912, 436207616, 0x80000000, 0, 0, 32, 64, 2432, 16384, 32768, 32768, 524288, 3145728, 4194304, 25165824, 25165824, 167772160, 268435456, 0x80000000, 0, 32, 64, 384, 2048, 16384, 32768, 1048576, 2097152, 4194304, 25165824, 32, 64, 128, 256, 2048, 16384, 2048, 16384, 1048576, 4194304, 16777216, 33554432, 134217728, 536870912, 1073741824, 0, 0, 2048, 16384, 4194304, 16777216, 33554432, 134217728, 805306368, 0, 0, 16777216, 134217728, 268435456, 0x80000000, 0, 622592, 622592, 622592, 8807, 8807, 434791, 0, 0, 16777216, 0, 0, 0, 7, 608, 8192, 0, 0, 0, 3, 4, 96, 512, 32, 64, 8192, 0, 0, 16777216, 134217728, 0, 0, 2, 4, 8192, 16384, 65536, 2097152, 33554432, 268435456 -]; - -XQueryTokenizer.TOKEN = -[ - "(0)", - "ModuleDecl", - "Annotation", - "OptionDecl", - "Operator", - "Variable", - "Tag", - "EndTag", - "PragmaContents", - "DirCommentContents", - "DirPIContents", - "CDataSectionContents", - "AttrTest", - "Wildcard", - "EQName", - "IntegerLiteral", - "DecimalLiteral", - "DoubleLiteral", - "PredefinedEntityRef", - "'\"\"'", - "EscapeApos", - "QuotChar", - "AposChar", - "ElementContentChar", - "QuotAttrContentChar", - "AposAttrContentChar", - "NCName", - "QName", - "S", - "CharRef", - "CommentContents", - "DocTag", - "DocCommentContents", - "EOF", - "'!'", - "'\"'", - "'#'", - "'#)'", - "''''", - "'('", - "'(#'", - "'(:'", - "'(:~'", - "')'", - "'*'", - "'*'", - "','", - "'-->'", - "'.'", - "'/'", - "'/>'", - "':'", - "':)'", - "';'", - "'"] +],[ + "start" +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","cfset"], + ["text"," "], + ["entity.other.attribute-name","welcome"], + ["keyword.operator.separator","="], + ["string","\"Hello World!\""], + ["meta.tag.punctuation.end",">"] +],[ + "start" +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","cfoutput"], + ["meta.tag.punctuation.end",">"], + ["text","#welcome#"], + ["meta.tag.punctuation.begin",""] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_csharp.json b/addons/editor/ace/mode/_test/tokens_csharp.json new file mode 100755 index 00000000..dcc6d0e9 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_csharp.json @@ -0,0 +1,31 @@ +[[ + "start", + ["keyword","public"], + ["text"," "], + ["keyword","void"], + ["text"," "], + ["identifier","HelloWorld"], + ["paren.lparen","("], + ["paren.rparen",")"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["comment","//Say Hello!"] +],[ + "start", + ["text"," "], + ["identifier","Console"], + ["punctuation.operator","."], + ["identifier","WriteLine"], + ["paren.lparen","("], + ["string.start","\""], + ["string","Hello World"], + ["string.end","\""], + ["paren.rparen",")"], + ["punctuation.operator",";"] +],[ + "start", + ["paren.rparen","}"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_css.json b/addons/editor/ace/mode/_test/tokens_css.json new file mode 100755 index 00000000..e1a7ba05 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_css.json @@ -0,0 +1,148 @@ +[[ + "ruleset", + ["variable",".text-layer"], + ["text"," "], + ["paren.lparen","{"] +],[ + "ruleset", + ["text"," "], + ["support.type","font-family"], + ["text",": Monaco, "], + ["string","\"Courier New\""], + ["text",", "], + ["support.constant.fonts","monospace"], + ["text",";"] +],[ + "ruleset", + ["text"," "], + ["support.type","font-size"], + ["text",": "], + ["constant.numeric","12"], + ["keyword","pX"], + ["text",";"] +],[ + "ruleset", + ["text"," "], + ["support.type","cursor"], + ["text",": "], + ["support.constant","text"], + ["text",";"] +],[ + "start", + ["paren.rparen","}"] +],[ + "start" +],[ + "ruleset", + ["variable",".blinker"], + ["text"," "], + ["paren.lparen","{"] +],[ + "ruleset", + ["text"," "], + ["support.type","animation-duration"], + ["text",": "], + ["constant.numeric","1"], + ["keyword","s"], + ["text",";"] +],[ + "ruleset", + ["text"," "], + ["support.type","animation-name"], + ["text",": blink;"] +],[ + "ruleset", + ["text"," "], + ["support.type","animation-iteration-count"], + ["text",": infinite;"] +],[ + "ruleset", + ["text"," "], + ["support.type","animation-direction"], + ["text",": alternate;"] +],[ + "ruleset", + ["text"," "], + ["support.type","animation-timing-function"], + ["text",": "], + ["support.constant","linear"], + ["text",";"] +],[ + "start", + ["paren.rparen","}"] +],[ + "start" +],[ + "media", + ["string","@keyframes blink {"] +],[ + ["ruleset","media"], + ["text"," "], + ["constant","0"], + ["text","% "], + ["paren.lparen","{"] +],[ + ["ruleset","media"], + ["text"," "], + ["support.type","opacity"], + ["text",": "], + ["constant.numeric","0"], + ["text",";"] +],[ + "media", + ["text"," "], + ["paren.rparen","}"] +],[ + ["ruleset","media"], + ["text"," "], + ["constant","40"], + ["text","% "], + ["paren.lparen","{"] +],[ + ["ruleset","media"], + ["text"," "], + ["support.type","opacity"], + ["text",": "], + ["constant.numeric","0"], + ["text",";"] +],[ + "media", + ["text"," "], + ["paren.rparen","}"] +],[ + ["ruleset","media"], + ["text"," "], + ["constant","40"], + ["variable",".5"], + ["text","% "], + ["paren.lparen","{"] +],[ + ["ruleset","media"], + ["text"," "], + ["support.type","opacity"], + ["text",": "], + ["constant.numeric","1"] +],[ + "media", + ["text"," "], + ["paren.rparen","}"] +],[ + ["ruleset","media"], + ["text"," "], + ["constant","100"], + ["text","% "], + ["paren.lparen","{"] +],[ + ["ruleset","media"], + ["text"," "], + ["support.type","opacity"], + ["text",": "], + ["constant.numeric","1"] +],[ + "media", + ["text"," "], + ["paren.rparen","}"] +],[ + "start", + ["string","}"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_curly.json b/addons/editor/ace/mode/_test/tokens_curly.json new file mode 100755 index 00000000..110574b6 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_curly.json @@ -0,0 +1,56 @@ +[[ + "start", + ["text","tokenize Curly template"], + ["variable","{{"], + ["text","test"], + ["variable","}}"] +],[ + "start", + ["text","tokenize embedded script"] +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.script","script"], + ["text"," "], + ["entity.other.attribute-name","a"], + ["keyword.operator.separator","="], + ["string","'a'"], + ["meta.tag.punctuation.end",">"], + ["storage.type","var"], + ["meta.tag.punctuation.begin",""], + ["text","'123'"] +],[ + "start", + ["text","tokenize multiline attribute value with double quotes"] +],[ + ["qqstring_inner","start_tag_stuff"], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.anchor","a"], + ["text"," "], + ["entity.other.attribute-name","href"], + ["keyword.operator.separator","="], + ["string","\"abc{{xyz}}"] +],[ + "start", + ["string","def\""], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text","tokenize multiline attribute value with single quotes"] +],[ + ["qstring_inner","start_tag_stuff"], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.anchor","a"], + ["text"," "], + ["entity.other.attribute-name","href"], + ["keyword.operator.separator","="], + ["string","'abc"] +],[ + "start", + ["string","def\\\"'"], + ["meta.tag.punctuation.end",">"] +],[ + "start" +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_dart.json b/addons/editor/ace/mode/_test/tokens_dart.json new file mode 100755 index 00000000..5964791a --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_dart.json @@ -0,0 +1,368 @@ +[[ + "start", + ["identifier","main"], + ["text","() {"] +],[ + "start", + ["text"," "], + ["identifier","print"], + ["text","("], + ["string","'Hello World!'"], + ["text",");"] +],[ + "start", + ["text","}"] +],[ + "start" +],[ + "start" +],[ + "start", + ["storage.type.primitive.dart","int"], + ["text"," "], + ["identifier","fib"], + ["text","("], + ["storage.type.primitive.dart","int"], + ["text"," "], + ["identifier","n"], + ["text",") "], + ["keyword.operator.assignment.dart","="], + ["keyword.operator.comparison.dart",">"], + ["text"," ("], + ["identifier","n"], + ["text"," "], + ["keyword.operator.comparison.dart",">"], + ["text"," "], + ["constant.numeric","1"], + ["text",") "], + ["keyword.control.ternary.dart","?"], + ["text"," ("], + ["identifier","fib"], + ["text","("], + ["identifier","n"], + ["text"," "], + ["keyword.operator.arithmetic.dart","-"], + ["text"," "], + ["constant.numeric","1"], + ["text",") "], + ["keyword.operator.arithmetic.dart","+"], + ["text"," "], + ["identifier","fib"], + ["text","("], + ["identifier","n"], + ["text"," "], + ["keyword.operator.arithmetic.dart","-"], + ["text"," "], + ["constant.numeric","2"], + ["text",")) "], + ["keyword.control.ternary.dart",":"], + ["text"," "], + ["identifier","n"], + ["text",";"] +],[ + "start", + ["identifier","main"], + ["text","() {"] +],[ + "start", + ["text"," "], + ["identifier","print"], + ["text","("], + ["string","'fib(20) = ${fib(20)}'"], + ["text",");"] +],[ + "start", + ["text","}"] +],[ + "comment", + ["comment","/*asd"] +],[ + "comment", + ["comment","asdad"] +],[ + "start", + ["comment","*/"] +],[ + "start", + ["constant.numeric","0.67"] +],[ + "start", + ["constant.numeric","77"] +],[ + "start", + ["text","."], + ["constant.numeric","86"] +],[ + "start" +],[ + "start", + ["keyword.other.import.dart","import"], + ["text","("], + ["string","\"http://dartwatch.com/myOtherLibrary.dart\""], + ["text",");"] +],[ + "start", + ["keyword.other.import.dart","import"], + ["text","("], + ["string","\"myOtherLibrary.dart\""], + ["text",", "], + ["keyword.other.import.dart","prefix"], + ["text",":"], + ["string","\"lib1\""], + ["text",");"] +],[ + "start" +],[ + "qqdoc", + ["string","\"\"\"asdasdads"] +],[ + "qqdoc", + ["string","asdadsadsasd"] +],[ + "start", + ["string","asdasdasdad\"\"\""] +],[ + "start", + ["text"," "] +],[ + "start", + ["string","'23424'"] +],[ + "start" +],[ + "start", + ["constant.numeric","0x234"] +],[ + "start" +],[ + "start", + ["identifier","foo"], + ["text"," "], + ["keyword.operator.dart","is"], + ["text"," "], + ["identifier","bar"] +],[ + "start" +],[ + "start", + ["storage.type.primitive.dart","int"], + ["text"," "], + ["identifier","x"], + ["text"," "], + ["keyword.operator.assignment.dart","="], + ["text"," "], + ["constant.numeric","4"], + ["text"," "], + ["keyword.operator.bitwise.dart","<<"], + ["text"," "], + ["constant.numeric","10"], + ["text"," "] +],[ + "start", + ["comment","// Create a class for Point."] +],[ + "start", + ["keyword.declaration.dart","class"], + ["text"," "], + ["identifier","Point"], + ["text"," {"] +],[ + "start", + ["text"," "] +],[ + "start", + ["text"," "], + ["comment","// Final variables cannot be changed once they are assigned."] +],[ + "start", + ["text"," "], + ["comment","// Create two instance variables."] +],[ + "start", + ["text"," "], + ["storage.modifier.dart","final"], + ["text"," "], + ["storage.type.primitive.dart","num"], + ["text"," "], + ["identifier","x"], + ["text",", "], + ["identifier","y"], + ["text",";"] +],[ + "start", + ["text"," "] +],[ + "start", + ["text"," "], + ["comment","// A constructor, with syntactic sugar for setting instance variables."] +],[ + "start", + ["text"," "], + ["identifier","Point"], + ["text","("], + ["variable.language.dart","this"], + ["text","."], + ["identifier","x"], + ["text",", "], + ["variable.language.dart","this"], + ["text","."], + ["identifier","y"], + ["text",");"] +],[ + "start", + ["text"," "] +],[ + "start", + ["text"," "], + ["comment","// A named constructor with an initializer list."] +],[ + "start", + ["text"," "], + ["identifier","Point"], + ["text","."], + ["identifier","origin"], + ["text","() "], + ["keyword.control.ternary.dart",":"], + ["text"," "], + ["identifier","x"], + ["text"," "], + ["keyword.operator.assignment.dart","="], + ["text"," "], + ["constant.numeric","0"], + ["text",", "], + ["identifier","y"], + ["text"," "], + ["keyword.operator.assignment.dart","="], + ["text"," "], + ["constant.numeric","0"], + ["text",";"] +],[ + "start", + ["text"," "] +],[ + "start", + ["text"," "], + ["comment","// A method."] +],[ + "start", + ["text"," "], + ["storage.type.primitive.dart","num"], + ["text"," "], + ["identifier","distanceTo"], + ["text","("], + ["identifier","Point"], + ["text"," "], + ["identifier","other"], + ["text",") {"] +],[ + "start", + ["text"," "], + ["storage.type.primitive.dart","var"], + ["text"," "], + ["identifier","dx"], + ["text"," "], + ["keyword.operator.assignment.dart","="], + ["text"," "], + ["identifier","x"], + ["text"," "], + ["keyword.operator.arithmetic.dart","-"], + ["text"," "], + ["identifier","other"], + ["text","."], + ["identifier","x"], + ["text",";"] +],[ + "start", + ["text"," "], + ["storage.type.primitive.dart","var"], + ["text"," "], + ["identifier","dy"], + ["text"," "], + ["keyword.operator.assignment.dart","="], + ["text"," "], + ["identifier","y"], + ["text"," "], + ["keyword.operator.arithmetic.dart","-"], + ["text"," "], + ["identifier","other"], + ["text","."], + ["identifier","y"], + ["text",";"] +],[ + "start", + ["text"," "], + ["keyword.control.dart","return"], + ["text"," "], + ["identifier","sqrt"], + ["text","("], + ["identifier","dx"], + ["text"," "], + ["keyword.operator.arithmetic.dart","*"], + ["text"," "], + ["identifier","dx"], + ["text"," "], + ["keyword.operator.arithmetic.dart","+"], + ["text"," "], + ["identifier","dy"], + ["text"," "], + ["keyword.operator.arithmetic.dart","*"], + ["text"," "], + ["identifier","dy"], + ["text",");"] +],[ + "start", + ["text"," }"] +],[ + "start", + ["text","}"] +],[ + "start", + ["text"," "] +],[ + "start", + ["text"," "], + ["comment","// Check for null."] +],[ + "start", + ["storage.type.primitive.dart","var"], + ["text"," "], + ["identifier","unicorn"], + ["text",";"] +],[ + "start", + ["identifier","assert"], + ["text","("], + ["identifier","unicorn"], + ["text"," "], + ["keyword.operator.comparison.dart","=="], + ["text"," "], + ["constant.language.dart","null"], + ["text",");"] +],[ + "start" +],[ + "start", + ["comment","// Check for NaN."] +],[ + "start", + ["storage.type.primitive.dart","var"], + ["text"," "], + ["identifier","iMeantToDoThis"], + ["text"," "], + ["keyword.operator.assignment.dart","="], + ["text"," "], + ["constant.numeric","0"], + ["keyword.operator.arithmetic.dart","/"], + ["constant.numeric","0"], + ["text",";"] +],[ + "start", + ["identifier","assert"], + ["text","("], + ["identifier","iMeantToDoThis"], + ["text","."], + ["identifier","isNaN"], + ["text","());"] +],[ + "start" +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_diff.json b/addons/editor/ace/mode/_test/tokens_diff.json new file mode 100755 index 00000000..7cf9b728 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_diff.json @@ -0,0 +1,398 @@ +[[ + "start", + ["variable","diff"], + ["variable"," --git"], + ["keyword"," a/lib/ace/edit_session.js"], + ["variable"," b/lib/ace/edit_session.js"] +],[ + "start" +],[ + "start", + ["variable","index 23fc3fc..ed3b273 100644"] +],[ + "start" +],[ + "start", + ["constant.numeric","---"], + ["meta.tag"," a/lib/ace/edit_session.js"] +],[ + "start" +],[ + "start", + ["constant.numeric","+++"], + ["meta.tag"," b/lib/ace/edit_session.js"] +],[ + "start" +],[ + "start", + ["constant","@@"], + ["constant.numeric"," -51,6 +51,7 "], + ["constant","@@"], + ["comment.doc.tag"," var TextMode = require(\"./mode/text\").Mode;"] +],[ + "start" +],[ + "start", + ["invisible"," var Range = require(\"./range\").Range;"] +],[ + "start" +],[ + "start", + ["invisible"," var Document = require(\"./document\").Document;"] +],[ + "start" +],[ + "start", + ["invisible"," var BackgroundTokenizer = require(\"./background_tokenizer\").BackgroundTokenizer;"] +],[ + "start" +],[ + "start", + ["support.constant","+"], + ["text","var SearchHighlight = require(\"./search_highlight\").SearchHighlight;"] +],[ + "start" +],[ + "start", + ["text"," "] +],[ + "start" +],[ + "start", + ["invisible"," /**"] +],[ + "start" +],[ + "start", + ["invisible"," * class EditSession"] +],[ + "start" +],[ + "start", + ["constant","@@"], + ["constant.numeric"," -307,6 +308,13 "], + ["constant","@@"], + ["comment.doc.tag"," var EditSession = function(text, mode) {"] +],[ + "start" +],[ + "start", + ["invisible"," return token;"] +],[ + "start" +],[ + "start", + ["invisible"," };"] +],[ + "start" +],[ + "start", + ["text"," "] +],[ + "start" +],[ + "start", + ["support.constant","+"], + ["text"," this.highlight = function(re) {"] +],[ + "start" +],[ + "start", + ["support.constant","+"], + ["text"," if (!this.$searchHighlight) {"] +],[ + "start" +],[ + "start", + ["support.constant","+"], + ["text"," var highlight = new SearchHighlight(null, \"ace_selected-word\", \"text\");"] +],[ + "start" +],[ + "start", + ["support.constant","+"], + ["text"," this.$searchHighlight = this.addDynamicMarker(highlight);"] +],[ + "start" +],[ + "start", + ["support.constant","+"], + ["text"," }"] +],[ + "start" +],[ + "start", + ["support.constant","+"], + ["text"," this.$searchHighlight.setRegexp(re);"] +],[ + "start" +],[ + "start", + ["support.constant","+"], + ["text"," }"] +],[ + "start" +],[ + "start", + ["invisible"," /**"] +],[ + "start" +],[ + "start", + ["invisible"," * EditSession.setUndoManager(undoManager)"] +],[ + "start" +],[ + "start", + ["invisible"," * - undoManager (UndoManager): The new undo manager"] +],[ + "start" +],[ + "start", + ["constant","@@"], + ["constant.numeric"," -556,7 +564,8 "], + ["constant","@@"], + ["comment.doc.tag"," var EditSession = function(text, mode) {"] +],[ + "start" +],[ + "start", + ["invisible"," type : type || \"line\","] +],[ + "start" +],[ + "start", + ["invisible"," renderer: typeof type == \"function\" ? type : null,"] +],[ + "start" +],[ + "start", + ["invisible"," clazz : clazz,"] +],[ + "start" +],[ + "start", + ["support.function","-"], + ["string"," inFront: !!inFront"] +],[ + "start" +],[ + "start", + ["support.constant","+"], + ["text"," inFront: !!inFront,"] +],[ + "start" +],[ + "start", + ["support.constant","+"], + ["text"," id: id"] +],[ + "start" +],[ + "start", + ["invisible"," }"] +],[ + "start" +],[ + "start", + ["text"," "] +],[ + "start" +],[ + "start", + ["invisible"," if (inFront) {"] +],[ + "start" +],[ + "start", + ["variable","diff"], + ["variable"," --git"], + ["keyword"," a/lib/ace/editor.js"], + ["variable"," b/lib/ace/editor.js"] +],[ + "start" +],[ + "start", + ["variable","index 834e603..b27ec73 100644"] +],[ + "start" +],[ + "start", + ["constant.numeric","---"], + ["meta.tag"," a/lib/ace/editor.js"] +],[ + "start" +],[ + "start", + ["constant.numeric","+++"], + ["meta.tag"," b/lib/ace/editor.js"] +],[ + "start" +],[ + "start", + ["constant","@@"], + ["constant.numeric"," -494,7 +494,7 "], + ["constant","@@"], + ["comment.doc.tag"," var Editor = function(renderer, session) {"] +],[ + "start" +],[ + "start", + ["invisible"," * Emitted when a selection has changed."] +],[ + "start" +],[ + "start", + ["invisible"," **/"] +],[ + "start" +],[ + "start", + ["invisible"," this.onSelectionChange = function(e) {"] +],[ + "start" +],[ + "start", + ["support.function","-"], + ["string"," var session = this.getSession();"] +],[ + "start" +],[ + "start", + ["support.constant","+"], + ["text"," var session = this.session;"] +],[ + "start" +],[ + "start", + ["text"," "] +],[ + "start" +],[ + "start", + ["invisible"," if (session.$selectionMarker) {"] +],[ + "start" +],[ + "start", + ["invisible"," session.removeMarker(session.$selectionMarker);"] +],[ + "start" +],[ + "start", + ["constant","@@"], + ["constant.numeric"," -509,12 +509,40 "], + ["constant","@@"], + ["comment.doc.tag"," var Editor = function(renderer, session) {"] +],[ + "start" +],[ + "start", + ["invisible"," this.$updateHighlightActiveLine();"] +],[ + "start" +],[ + "start", + ["invisible"," }"] +],[ + "start" +],[ + "start", + ["text"," "] +],[ + "start" +],[ + "start", + ["support.function","-"], + ["string"," var self = this;"] +],[ + "start" +],[ + "start", + ["support.function","-"], + ["string"," if (this.$highlightSelectedWord && !this.$wordHighlightTimer)"] +],[ + "start" +],[ + "start", + ["support.function","-"], + ["string"," this.$wordHighlightTimer = setTimeout(function() {"] +],[ + "start" +],[ + "start", + ["support.function","-"], + ["string"," self.session.$mode.highlightSelection(self);"] +],[ + "start" +],[ + "start", + ["support.function","-"], + ["string"," self.$wordHighlightTimer = null;"] +],[ + "start" +],[ + "start", + ["support.function","-"], + ["string"," }, 30, this);"] +],[ + "start" +],[ + "start", + ["support.constant","+"], + ["text"," var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp()"] +],[ + "start" +],[ + "start", + ["invisible"," };"] +],[ + "start" +],[ + "start", + ["variable","diff"], + ["variable"," --git"], + ["keyword"," a/lib/ace/search_highlight.js"], + ["variable"," b/lib/ace/search_highlight.js"] +],[ + "start" +],[ + "start", + ["invisible","new file mode 100644"] +],[ + "start" +],[ + "start", + ["variable","index 0000000..b2df779"] +],[ + "start" +],[ + "start", + ["constant.numeric","---"], + ["meta.tag"," /dev/null"] +],[ + "start" +],[ + "start", + ["constant.numeric","+++"], + ["meta.tag"," b/lib/ace/search_highlight.js"] +],[ + "start" +],[ + "start", + ["constant","@@"], + ["constant.numeric"," -0,0 +1,3 "], + ["constant","@@"] +],[ + "start" +],[ + "start", + ["support.constant","+"], + ["text","new"] +],[ + "start" +],[ + "start", + ["support.constant","+"], + ["text","empty file"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_dot.json b/addons/editor/ace/mode/_test/tokens_dot.json new file mode 100755 index 00000000..fec8b969 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_dot.json @@ -0,0 +1,2254 @@ +[[ + "start", + ["comment","// Original source: http://www.graphviz.org/content/lion_share"] +],[ + "start", + ["comment","##\"A few people in the field of genetics are using dot to draw \"marriage node diagram\" pedigree drawings. Here is one I have done of a test pedigree from the FTREE pedigree drawing package (Lion Share was a racehorse).\" Contributed by David Duffy."] +],[ + "start" +],[ + "start", + ["comment","##Command to get the layout: \"dot -Tpng thisfile > thisfile.png\""] +],[ + "start" +],[ + "start", + ["keyword","digraph"], + ["text"," Ped_Lion_Share "], + ["paren.lparen","{"] +],[ + "start", + ["comment","# page = \"8.2677165,11.692913\" ;"] +],[ + "start", + ["variable","ratio"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["string","\"auto\""], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["text","mincross "], + ["keyword.operator","="], + ["text"," "], + ["constant.numeric","2.0"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["variable","label"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["string","\"Pedigree Lion_Share\""], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start" +],[ + "start", + ["string","\"001\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","box "], + ["punctuation.operator",","], + ["text"," "], + ["variable","regular"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","fillcolor"], + ["keyword.operator","="], + ["text","white "], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"002\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","box "], + ["punctuation.operator",","], + ["text"," "], + ["variable","regular"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","fillcolor"], + ["keyword.operator","="], + ["text","white "], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"003\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","circle "], + ["punctuation.operator",","], + ["text"," "], + ["variable","regular"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","fillcolor"], + ["keyword.operator","="], + ["text","white "], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"004\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","box "], + ["punctuation.operator",","], + ["text"," "], + ["variable","regular"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","fillcolor"], + ["keyword.operator","="], + ["text","white "], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"005\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","box "], + ["punctuation.operator",","], + ["text"," "], + ["variable","regular"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","fillcolor"], + ["keyword.operator","="], + ["text","white "], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"006\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","circle "], + ["punctuation.operator",","], + ["text"," "], + ["variable","regular"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","fillcolor"], + ["keyword.operator","="], + ["text","white "], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"007\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","circle "], + ["punctuation.operator",","], + ["text"," "], + ["variable","regular"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","fillcolor"], + ["keyword.operator","="], + ["text","white "], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"009\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","circle "], + ["punctuation.operator",","], + ["text"," "], + ["variable","regular"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","fillcolor"], + ["keyword.operator","="], + ["text","white "], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"014\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","circle "], + ["punctuation.operator",","], + ["text"," "], + ["variable","regular"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","fillcolor"], + ["keyword.operator","="], + ["text","white "], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"015\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","circle "], + ["punctuation.operator",","], + ["text"," "], + ["variable","regular"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","fillcolor"], + ["keyword.operator","="], + ["text","white "], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"016\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","circle "], + ["punctuation.operator",","], + ["text"," "], + ["variable","regular"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","fillcolor"], + ["keyword.operator","="], + ["text","white "], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"ZZ01\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","circle "], + ["punctuation.operator",","], + ["text"," "], + ["variable","regular"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","fillcolor"], + ["keyword.operator","="], + ["text","white "], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"ZZ02\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","circle "], + ["punctuation.operator",","], + ["text"," "], + ["variable","regular"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","fillcolor"], + ["keyword.operator","="], + ["text","white "], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"017\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","circle "], + ["punctuation.operator",","], + ["text"," "], + ["variable","regular"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","fillcolor"], + ["keyword.operator","="], + ["text","white "], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"012\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","circle "], + ["punctuation.operator",","], + ["text"," "], + ["variable","regular"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","fillcolor"], + ["keyword.operator","="], + ["text","white "], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"008\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","box "], + ["punctuation.operator",","], + ["text"," "], + ["variable","regular"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","fillcolor"], + ["keyword.operator","="], + ["text","white "], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"011\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","box "], + ["punctuation.operator",","], + ["text"," "], + ["variable","regular"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","fillcolor"], + ["keyword.operator","="], + ["text","white "], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"013\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","box "], + ["punctuation.operator",","], + ["text"," "], + ["variable","regular"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","fillcolor"], + ["keyword.operator","="], + ["text","white "], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"010\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","box "], + ["punctuation.operator",","], + ["text"," "], + ["variable","regular"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","fillcolor"], + ["keyword.operator","="], + ["text","white "], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"023\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","circle "], + ["punctuation.operator",","], + ["text"," "], + ["variable","regular"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","fillcolor"], + ["keyword.operator","="], + ["text","white "], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"020\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","circle "], + ["punctuation.operator",","], + ["text"," "], + ["variable","regular"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","fillcolor"], + ["keyword.operator","="], + ["text","white "], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"021\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","circle "], + ["punctuation.operator",","], + ["text"," "], + ["variable","regular"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","fillcolor"], + ["keyword.operator","="], + ["text","white "], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"018\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","circle "], + ["punctuation.operator",","], + ["text"," "], + ["variable","regular"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","fillcolor"], + ["keyword.operator","="], + ["text","white "], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"025\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","circle "], + ["punctuation.operator",","], + ["text"," "], + ["variable","regular"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","fillcolor"], + ["keyword.operator","="], + ["text","white "], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"019\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","box "], + ["punctuation.operator",","], + ["text"," "], + ["variable","regular"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","fillcolor"], + ["keyword.operator","="], + ["text","white "], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"022\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","box "], + ["punctuation.operator",","], + ["text"," "], + ["variable","regular"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","fillcolor"], + ["keyword.operator","="], + ["text","white "], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"024\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","box "], + ["punctuation.operator",","], + ["text"," "], + ["variable","regular"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","fillcolor"], + ["keyword.operator","="], + ["text","white "], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"027\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","circle "], + ["punctuation.operator",","], + ["text"," "], + ["variable","regular"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","fillcolor"], + ["keyword.operator","="], + ["text","white "], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"026\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","box "], + ["punctuation.operator",","], + ["text"," "], + ["variable","regular"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","fillcolor"], + ["keyword.operator","="], + ["text","white "], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"028\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","box "], + ["punctuation.operator",","], + ["text"," "], + ["variable","regular"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","fillcolor"], + ["keyword.operator","="], + ["text","grey "], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0001\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","diamond"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","label"], + ["keyword.operator","="], + ["string","\"\""], + ["punctuation.operator",","], + ["variable","height"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","width"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"001\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0001\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"007\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0001\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0001\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"017\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["text"," "], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","2"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0002\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","diamond"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","label"], + ["keyword.operator","="], + ["string","\"\""], + ["punctuation.operator",","], + ["variable","height"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","width"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"001\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0002\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"ZZ02\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0002\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0002\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"012\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["text"," "], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","2"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0003\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","diamond"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","label"], + ["keyword.operator","="], + ["string","\"\""], + ["punctuation.operator",","], + ["variable","height"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","width"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"002\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0003\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"003\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0003\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0003\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"008\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["text"," "], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","2"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0004\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","diamond"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","label"], + ["keyword.operator","="], + ["string","\"\""], + ["punctuation.operator",","], + ["variable","height"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","width"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"002\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0004\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"006\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0004\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0004\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"011\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["text"," "], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","2"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0005\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","diamond"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","label"], + ["keyword.operator","="], + ["string","\"\""], + ["punctuation.operator",","], + ["variable","height"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","width"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"002\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0005\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"ZZ01\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0005\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0005\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"013\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["text"," "], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","2"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0006\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","diamond"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","label"], + ["keyword.operator","="], + ["string","\"\""], + ["punctuation.operator",","], + ["variable","height"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","width"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"004\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0006\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"009\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0006\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0006\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"010\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["text"," "], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","2"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0007\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","diamond"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","label"], + ["keyword.operator","="], + ["string","\"\""], + ["punctuation.operator",","], + ["variable","height"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","width"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"005\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0007\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"015\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0007\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0007\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"023\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["text"," "], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","2"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0008\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","diamond"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","label"], + ["keyword.operator","="], + ["string","\"\""], + ["punctuation.operator",","], + ["variable","height"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","width"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"005\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0008\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"016\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0008\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0008\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"020\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["text"," "], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","2"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0009\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","diamond"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","label"], + ["keyword.operator","="], + ["string","\"\""], + ["punctuation.operator",","], + ["variable","height"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","width"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"005\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0009\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"012\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0009\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0009\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"021\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["text"," "], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","2"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0010\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","diamond"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","label"], + ["keyword.operator","="], + ["string","\"\""], + ["punctuation.operator",","], + ["variable","height"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","width"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"008\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0010\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"017\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0010\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0010\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"018\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["text"," "], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","2"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0011\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","diamond"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","label"], + ["keyword.operator","="], + ["string","\"\""], + ["punctuation.operator",","], + ["variable","height"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","width"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"011\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0011\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"023\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0011\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0011\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"025\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["text"," "], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","2"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0012\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","diamond"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","label"], + ["keyword.operator","="], + ["string","\"\""], + ["punctuation.operator",","], + ["variable","height"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","width"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"013\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0012\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"014\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0012\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0012\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"019\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["text"," "], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","2"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0013\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","diamond"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","label"], + ["keyword.operator","="], + ["string","\"\""], + ["punctuation.operator",","], + ["variable","height"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","width"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"010\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0013\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"021\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0013\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0013\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"022\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["text"," "], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","2"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0014\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","diamond"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","label"], + ["keyword.operator","="], + ["string","\"\""], + ["punctuation.operator",","], + ["variable","height"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","width"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"019\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0014\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"020\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0014\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0014\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"024\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["text"," "], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","2"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0015\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","diamond"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","label"], + ["keyword.operator","="], + ["string","\"\""], + ["punctuation.operator",","], + ["variable","height"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","width"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"022\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0015\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"025\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0015\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0015\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"027\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["text"," "], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","2"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0016\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","diamond"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","label"], + ["keyword.operator","="], + ["string","\"\""], + ["punctuation.operator",","], + ["variable","height"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","width"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"024\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0016\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"018\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0016\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0016\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"026\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["text"," "], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","2"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0017\""], + ["text"," "], + ["paren.lparen","["], + ["variable","shape"], + ["keyword.operator","="], + ["text","diamond"], + ["punctuation.operator",","], + ["variable","style"], + ["keyword.operator","="], + ["text","filled"], + ["punctuation.operator",","], + ["variable","label"], + ["keyword.operator","="], + ["string","\"\""], + ["punctuation.operator",","], + ["variable","height"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["variable","width"], + ["keyword.operator","="], + ["text","."], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"026\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0017\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"027\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"marr0017\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["string","\"marr0017\""], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["string","\"028\""], + ["text"," "], + ["paren.lparen","["], + ["variable","dir"], + ["keyword.operator","="], + ["text","none"], + ["punctuation.operator",","], + ["text"," "], + ["variable","weight"], + ["keyword.operator","="], + ["constant.numeric","2"], + ["paren.rparen","]"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["paren.rparen","}"] +],[ + "start" +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_erlang.json b/addons/editor/ace/mode/_test/tokens_erlang.json new file mode 100755 index 00000000..8a828976 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_erlang.json @@ -0,0 +1,166 @@ +[[ + "start", + ["text"," "], + ["punctuation.definition.comment.erlang","%% A process whose only job is to keep a counter."] +],[ + "start", + ["text"," "], + ["punctuation.definition.comment.erlang","%% First version"] +],[ + "start", + ["meta.directive.module.erlang"," "], + ["punctuation.section.directive.begin.erlang","-"], + ["keyword.control.directive.module.erlang","module"], + ["punctuation.definition.parameters.begin.erlang","("], + ["entity.name.type.class.module.definition.erlang","counter"], + ["punctuation.definition.parameters.end.erlang",")"], + ["punctuation.section.directive.end.erlang","."] +],[ + "start", + ["meta.directive.export.erlang"," "], + ["punctuation.section.directive.begin.erlang","-"], + ["keyword.control.directive.export.erlang","export"], + ["punctuation.definition.parameters.begin.erlang","("], + ["punctuation.definition.list.begin.erlang","["], + ["entity.name.function.erlang","start"], + ["punctuation.separator.function-arity.erlang","/"], + ["constant.numeric.integer.decimal.erlang","0"], + ["punctuation.separator.list.erlang",","], + ["meta.structure.list.function.erlang"," "], + ["entity.name.function.erlang","codeswitch"], + ["punctuation.separator.function-arity.erlang","/"], + ["constant.numeric.integer.decimal.erlang","1"], + ["punctuation.definition.list.end.erlang","]"], + ["punctuation.definition.parameters.end.erlang",")"], + ["punctuation.section.directive.end.erlang","."] +],[ + "start", + ["text"," "] +],[ + "start", + ["meta.function.erlang"," "], + ["entity.name.function.definition.erlang","start"], + ["punctuation.section.expression.begin.erlang","("], + ["punctuation.section.expression.end.erlang",")"], + ["text"," "], + ["keyword.operator.symbolic.erlang","->"], + ["text"," "], + ["entity.name.function.erlang","loop"], + ["punctuation.definition.parameters.begin.erlang","("], + ["constant.numeric.integer.decimal.erlang","0"], + ["punctuation.definition.parameters.end.erlang",")"], + ["punctuation.terminator.function.erlang","."] +],[ + "start", + ["text"," "] +],[ + ["text6","meta.function.erlang"], + ["meta.function.erlang"," "], + ["entity.name.function.definition.erlang","loop"], + ["punctuation.section.expression.begin.erlang","("], + ["variable.other.erlang","Sum"], + ["punctuation.section.expression.end.erlang",")"], + ["text"," "], + ["keyword.operator.symbolic.erlang","->"] +],[ + ["keyword.control.receive.erlang","text6","text6","meta.function.erlang"], + ["text"," "], + ["keyword.control.receive.erlang","receive"] +],[ + ["keyword.control.receive.erlang","text6","text6","meta.function.erlang"], + ["meta.expression.receive.erlang"," "], + ["punctuation.definition.tuple.begin.erlang","{"], + ["constant.other.symbol.unquoted.erlang","increment"], + ["punctuation.separator.tuple.erlang",","], + ["meta.structure.tuple.erlang"," "], + ["variable.other.erlang","Count"], + ["punctuation.definition.tuple.end.erlang","}"], + ["meta.expression.receive.erlang"," "], + ["punctuation.separator.clause-head-body.erlang","->"] +],[ + ["keyword.control.receive.erlang","text6","text6","meta.function.erlang"], + ["meta.expression.receive.erlang"," "], + ["entity.name.function.erlang","loop"], + ["punctuation.definition.parameters.begin.erlang","("], + ["variable.other.erlang","Sum"], + ["keyword.operator.symbolic.erlang","+"], + ["variable.other.erlang","Count"], + ["punctuation.definition.parameters.end.erlang",")"], + ["punctuation.separator.clauses.erlang",";"] +],[ + ["keyword.control.receive.erlang","text6","text6","meta.function.erlang"], + ["meta.expression.receive.erlang"," "], + ["punctuation.definition.tuple.begin.erlang","{"], + ["constant.other.symbol.unquoted.erlang","counter"], + ["punctuation.separator.tuple.erlang",","], + ["meta.structure.tuple.erlang"," "], + ["variable.other.erlang","Pid"], + ["punctuation.definition.tuple.end.erlang","}"], + ["meta.expression.receive.erlang"," "], + ["punctuation.separator.clause-head-body.erlang","->"] +],[ + ["keyword.control.receive.erlang","text6","text6","meta.function.erlang"], + ["meta.expression.receive.erlang"," "], + ["variable.other.erlang","Pid"], + ["meta.expression.receive.erlang"," "], + ["keyword.operator.symbolic.erlang","!"], + ["meta.expression.receive.erlang"," "], + ["punctuation.definition.tuple.begin.erlang","{"], + ["constant.other.symbol.unquoted.erlang","counter"], + ["punctuation.separator.tuple.erlang",","], + ["meta.structure.tuple.erlang"," "], + ["variable.other.erlang","Sum"], + ["punctuation.definition.tuple.end.erlang","}"], + ["punctuation.separator.expressions.erlang",","] +],[ + ["keyword.control.receive.erlang","text6","text6","meta.function.erlang"], + ["meta.expression.receive.erlang"," "], + ["entity.name.function.erlang","loop"], + ["punctuation.definition.parameters.begin.erlang","("], + ["variable.other.erlang","Sum"], + ["punctuation.definition.parameters.end.erlang",")"], + ["punctuation.separator.clauses.erlang",";"] +],[ + ["keyword.control.receive.erlang","text6","text6","meta.function.erlang"], + ["meta.expression.receive.erlang"," "], + ["constant.other.symbol.unquoted.erlang","code_switch"], + ["meta.expression.receive.erlang"," "], + ["punctuation.separator.clause-head-body.erlang","->"] +],[ + ["keyword.control.receive.erlang","text6","text6","meta.function.erlang"], + ["meta.expression.receive.erlang"," "], + ["keyword.operator.macro.erlang","?"], + ["entity.name.function.macro.erlang","MODULE"], + ["meta.expression.receive.erlang",":"], + ["entity.name.function.erlang","codeswitch"], + ["punctuation.definition.parameters.begin.erlang","("], + ["variable.other.erlang","Sum"], + ["punctuation.definition.parameters.end.erlang",")"] +],[ + ["keyword.control.receive.erlang","text6","text6","meta.function.erlang"], + ["meta.expression.receive.erlang"," "], + ["punctuation.definition.comment.erlang","% Force the use of 'codeswitch/1' from the latest MODULE version"] +],[ + "start", + ["meta.expression.receive.erlang"," "], + ["keyword.control.end.erlang","end"], + ["punctuation.terminator.function.erlang","."] +],[ + "start", + ["text"," "] +],[ + "start", + ["meta.function.erlang"," "], + ["entity.name.function.definition.erlang","codeswitch"], + ["punctuation.section.expression.begin.erlang","("], + ["variable.other.erlang","Sum"], + ["punctuation.section.expression.end.erlang",")"], + ["text"," "], + ["keyword.operator.symbolic.erlang","->"], + ["text"," "], + ["entity.name.function.erlang","loop"], + ["punctuation.definition.parameters.begin.erlang","("], + ["variable.other.erlang","Sum"], + ["punctuation.definition.parameters.end.erlang",")"], + ["punctuation.terminator.function.erlang","."] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_forth.json b/addons/editor/ace/mode/_test/tokens_forth.json new file mode 100755 index 00000000..8c8a007e --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_forth.json @@ -0,0 +1,219 @@ +[[ + "start", + ["keyword.other.compile-only.forth",":"], + ["meta.block.forth"," "], + ["entity.name.function.forth","HELLO"], + ["meta.block.forth"," "], + ["comment.line.parentheses.forth"," ( -- )"], + ["meta.block.forth"," CR "], + ["string.quoted.double.forth",".\" Hello, world!\""], + ["meta.block.forth"," "], + ["keyword.other.compile-only.forth",";"], + ["text"," "] +],[ + "start" +],[ + "start", + ["text","HELLO "] +],[ + "start", + ["text","Hello, world!"] +],[ + "start" +],[ + "start", + ["keyword.other.compile-only.forth",":"], + ["meta.block.forth"," "], + ["entity.name.function.forth","[CHAR]"], + ["meta.block.forth"," "], + ["keyword.other.non-immediate.forth"," CHAR"], + ["meta.block.forth"," "], + ["keyword.other.compile-only.forth"," POSTPONE"], + ["meta.block.forth"," LITERAL "], + ["keyword.other.compile-only.forth",";"], + ["keyword.other.immediate.forth"," IMMEDIATE"] +],[ + "start" +],[ + "start", + ["constant.numeric.forth","0"], + ["storage.type.forth"," value"], + ["text"," ii "], + ["constant.numeric.forth"," 0"], + ["storage.type.forth"," value"], + ["text"," jj"] +],[ + "start", + ["constant.numeric.forth","0"], + ["storage.type.forth"," value"], + ["text"," KeyAddr "], + ["constant.numeric.forth"," 0"], + ["storage.type.forth"," value"], + ["text"," KeyLen"] +],[ + "start", + ["storage.type.forth","create"], + ["text"," SArray "], + ["constant.numeric.forth"," 256"], + ["text"," allot "], + ["comment.line.backslash.forth"," \\ state array of 256 bytes"] +],[ + "start", + ["keyword.other.compile-only.forth",":"], + ["meta.block.forth"," "], + ["entity.name.function.forth","KeyArray"], + ["meta.block.forth"," KeyLen mod KeyAddr "], + ["keyword.other.compile-only.forth",";"] +],[ + "start" +],[ + "start", + ["keyword.other.compile-only.forth",":"], + ["meta.block.forth"," "], + ["entity.name.function.forth","get_byte"], + ["meta.block.forth"," + c@ "], + ["keyword.other.compile-only.forth",";"] +],[ + "start", + ["keyword.other.compile-only.forth",":"], + ["meta.block.forth"," "], + ["entity.name.function.forth","set_byte"], + ["meta.block.forth"," + c! "], + ["keyword.other.compile-only.forth",";"] +],[ + "start", + ["keyword.other.compile-only.forth",":"], + ["meta.block.forth"," "], + ["entity.name.function.forth","as_byte"], + ["meta.block.forth"," "], + ["constant.numeric.forth"," 255"], + ["meta.block.forth"," and "], + ["keyword.other.compile-only.forth",";"] +],[ + "start", + ["keyword.other.compile-only.forth",":"], + ["meta.block.forth"," "], + ["entity.name.function.forth","reset_ij"], + ["meta.block.forth"," "], + ["constant.numeric.forth"," 0"], + ["keyword.other.immediate.forth"," TO"], + ["meta.block.forth"," ii "], + ["constant.numeric.forth"," 0"], + ["keyword.other.immediate.forth"," TO"], + ["meta.block.forth"," jj "], + ["keyword.other.compile-only.forth",";"] +],[ + "start", + ["keyword.other.compile-only.forth",":"], + ["meta.block.forth"," "], + ["entity.name.function.forth","i_update"], + ["meta.block.forth"," "], + ["constant.numeric.forth"," 1"], + ["meta.block.forth"," + as_byte"], + ["keyword.other.immediate.forth"," TO"], + ["meta.block.forth"," ii "], + ["keyword.other.compile-only.forth",";"] +],[ + "start", + ["keyword.other.compile-only.forth",":"], + ["meta.block.forth"," "], + ["entity.name.function.forth","j_update"], + ["meta.block.forth"," ii SArray get_byte + as_byte"], + ["keyword.other.immediate.forth"," TO"], + ["meta.block.forth"," jj "], + ["keyword.other.compile-only.forth",";"] +],[ + "keyword.other.compile-only.forth", + ["keyword.other.compile-only.forth",":"], + ["meta.block.forth"," "], + ["entity.name.function.forth","swap_s_ij"] +],[ + "keyword.other.compile-only.forth", + ["meta.block.forth"," jj SArray get_byte"] +],[ + "keyword.other.compile-only.forth", + ["meta.block.forth"," ii SArray get_byte jj SArray set_byte"] +],[ + "keyword.other.compile-only.forth", + ["meta.block.forth"," ii SArray set_byte"] +],[ + "start", + ["keyword.other.compile-only.forth",";"] +],[ + "start" +],[ + "keyword.other.compile-only.forth", + ["keyword.other.compile-only.forth",":"], + ["meta.block.forth"," "], + ["entity.name.function.forth","rc4_init"], + ["comment.line.parentheses.forth"," ( KeyAddr KeyLen -- )"] +],[ + "keyword.other.compile-only.forth", + ["meta.block.forth"," "], + ["constant.numeric.forth"," 256"], + ["meta.block.forth"," min"], + ["keyword.other.immediate.forth"," TO"], + ["meta.block.forth"," KeyLen "], + ["keyword.other.immediate.forth"," TO"], + ["meta.block.forth"," KeyAddr"] +],[ + "keyword.other.compile-only.forth", + ["meta.block.forth"," "], + ["constant.numeric.forth"," 256 0"], + ["keyword.control.compile-only.forth"," DO"], + ["meta.block.forth"," "], + ["variable.language.forth","i"], + ["meta.block.forth"," "], + ["variable.language.forth","i"], + ["meta.block.forth"," SArray set_byte "], + ["keyword.control.compile-only.forth"," LOOP"] +],[ + "keyword.other.compile-only.forth", + ["meta.block.forth"," reset_ij"] +],[ + "keyword.other.compile-only.forth", + ["meta.block.forth"," "], + ["keyword.control.compile-only.forth"," BEGIN"] +],[ + "keyword.other.compile-only.forth", + ["meta.block.forth"," ii KeyArray get_byte jj + j_update"] +],[ + "keyword.other.compile-only.forth", + ["meta.block.forth"," swap_s_ij"] +],[ + "keyword.other.compile-only.forth", + ["meta.block.forth"," ii"], + ["constant.numeric.forth"," 255"], + ["meta.block.forth"," <"], + ["keyword.control.compile-only.forth"," WHILE"] +],[ + "keyword.other.compile-only.forth", + ["meta.block.forth"," ii i_update"] +],[ + "keyword.other.compile-only.forth", + ["meta.block.forth"," "], + ["keyword.control.compile-only.forth"," REPEAT"] +],[ + "keyword.other.compile-only.forth", + ["meta.block.forth"," reset_ij"] +],[ + "start", + ["keyword.other.compile-only.forth",";"] +],[ + "keyword.other.compile-only.forth", + ["keyword.other.compile-only.forth",":"], + ["meta.block.forth"," "], + ["entity.name.function.forth","rc4_byte"] +],[ + "keyword.other.compile-only.forth", + ["meta.block.forth"," ii i_update jj j_update"] +],[ + "keyword.other.compile-only.forth", + ["meta.block.forth"," swap_s_ij"] +],[ + "keyword.other.compile-only.forth", + ["meta.block.forth"," ii SArray get_byte jj SArray get_byte + as_byte SArray get_byte xor"] +],[ + "start", + ["keyword.other.compile-only.forth",";"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_ftl.json b/addons/editor/ace/mode/_test/tokens_ftl.json new file mode 100755 index 00000000..eb81f1fb --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_ftl.json @@ -0,0 +1,341 @@ +[[ + "start", + ["keyword.function","<#ftl"], + ["text"," "], + ["entity.other.attribute-name","encoding"], + ["keyword.operator","="], + ["string","\"utf-8\""], + ["text"," "], + ["keyword","/>"] +],[ + "start", + ["keyword.function","<#setting"], + ["text"," "], + ["entity.other.attribute-name","locale"], + ["keyword.operator","="], + ["string","\"en_US\""], + ["text"," "], + ["keyword","/>"] +],[ + "start", + ["keyword.function","<#import"], + ["text"," "], + ["string","\"library\""], + ["text"," "], + ["keyword.operator","as"], + ["text"," "], + ["variable","lib"], + ["text"," "], + ["keyword","/>"] +],[ + "ftl-dcomment", + ["comment","<#--"] +],[ + "ftl-dcomment", + ["comment"," FreeMarker comment"] +],[ + "ftl-dcomment", + ["comment"," ${abc} <#assign a=12 />"] +],[ + "start", + ["comment","-->"] +],[ + "start" +],[ + "start", + ["punctuation.doctype.begin",""] +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","html"], + ["text"," "], + ["entity.other.attribute-name","lang"], + ["keyword.operator.separator","="], + ["string","\"en-us\""], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","head"], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","meta"], + ["text"," "], + ["entity.other.attribute-name","charset"], + ["keyword.operator.separator","="], + ["string","\"utf-8\""], + ["text"," "], + ["meta.tag.punctuation.end","/>"] +],[ + "start", + ["text"," "] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","title"], + ["meta.tag.punctuation.end",">"], + ["string.interpolated","${"], + ["variable","title"], + ["keyword.operator","!"], + ["string","\"FreeMarker\""], + ["string.interpolated","}"], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","title"], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text"," "] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","body"], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text"," "] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","h1"], + ["meta.tag.punctuation.end",">"], + ["text","Hello "], + ["string.interpolated","${"], + ["variable","name"], + ["keyword.operator","!"], + ["string","\"\""], + ["string.interpolated","}"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text"," "] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","p"], + ["meta.tag.punctuation.end",">"], + ["text","Today is: "], + ["string.interpolated","${"], + ["language.variable",".now"], + ["support.function","?date"], + ["string.interpolated","}"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text"," "] +],[ + "start", + ["text"," "], + ["keyword.function","<#assign"], + ["text"," "], + ["variable","x"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["constant.numeric","13"], + ["keyword",">"] +],[ + "start", + ["text"," "], + ["keyword.function","<#if"], + ["text"," "], + ["variable","x"], + ["text"," "], + ["constant.character.entity",">"], + ["text"," "], + ["constant.numeric","12"], + ["text"," "], + ["keyword.operator","&&"], + ["text"," "], + ["variable","x"], + ["text"," "], + ["keyword.operator","lt"], + ["text"," "], + ["constant.numeric","14"], + ["keyword",">"], + ["text","x equals 13: "], + ["string.interpolated","${"], + ["variable","x"], + ["string.interpolated","}"], + ["keyword.function",""] +],[ + "start", + ["text"," "] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","ul"], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text"," "], + ["keyword.function","<#list"], + ["text"," "], + ["variable","items"], + ["text"," "], + ["keyword.operator","as"], + ["text"," "], + ["variable","item"], + ["keyword",">"] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","li"], + ["meta.tag.punctuation.end",">"], + ["string.interpolated","${"], + ["variable","item_index"], + ["string.interpolated","}"], + ["text",": "], + ["string.interpolated","${"], + ["variable","item.name"], + ["keyword.operator","!"], + ["support.function","?split"], + ["paren.lparen","("], + ["string","\""], + ["constant.character.escape","\\n"], + ["string","\""], + ["paren.rparen",")"], + ["paren.lparen","["], + ["constant.numeric","0"], + ["paren.rparen","]"], + ["string.interpolated","}"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text"," "], + ["keyword.function",""] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text"," "] +],[ + "start", + ["text"," User directive: "], + ["keyword.other","<@lib.function"], + ["text"," "], + ["variable","attr1"], + ["keyword.operator","="], + ["constant.language","true"], + ["text"," "], + ["variable","attr2"], + ["keyword.operator","="], + ["string","'value'"], + ["text"," "], + ["variable","attr3"], + ["keyword.operator","="], + ["constant.numeric","-42.12"], + ["keyword",">"], + ["text","Test"], + ["keyword.other",""] +],[ + "start", + ["text"," "], + ["keyword.other","<@anotherOne"], + ["text"," "], + ["keyword","/>"] +],[ + "start", + ["text"," "] +],[ + "start", + ["text"," "], + ["keyword.function","<#if"], + ["text"," "], + ["variable","variable"], + ["support.function.deprecated","?exists"], + ["keyword",">"] +],[ + "start", + ["text"," Deprecated"] +],[ + "start", + ["text"," "], + ["keyword.function","<#elseif"], + ["text"," "], + ["variable","variable"], + ["support.function","??"], + ["keyword",">"] +],[ + "start", + ["text"," Better"] +],[ + "start", + ["text"," "], + ["keyword.function","<#else"], + ["keyword",">"] +],[ + "start", + ["text"," Default"] +],[ + "start", + ["text"," "], + ["keyword.function",""] +],[ + "start", + ["text"," "] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.image","img"], + ["text"," "], + ["entity.other.attribute-name","src"], + ["keyword.operator.separator","="], + ["string","\"images/"], + ["string.interpolated","${"], + ["variable","user.id"], + ["string.interpolated","}"], + ["string",".png\""], + ["text"," "], + ["meta.tag.punctuation.end","/>"] +],[ + "start", + ["text"," "] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["meta.tag.punctuation.begin",""] +],[ + "start" +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_glsl.json b/addons/editor/ace/mode/_test/tokens_glsl.json new file mode 100755 index 00000000..ce8a4d16 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_glsl.json @@ -0,0 +1,127 @@ +[[ + "start", + ["keyword","uniform"], + ["text"," "], + ["keyword","float"], + ["text"," "], + ["identifier","amplitude"], + ["punctuation.operator",";"] +],[ + "start", + ["keyword","attribute"], + ["text"," "], + ["keyword","float"], + ["text"," "], + ["identifier","displacement"], + ["punctuation.operator",";"] +],[ + "start", + ["keyword","varying"], + ["text"," "], + ["keyword","vec3"], + ["text"," "], + ["identifier","vNormal"], + ["punctuation.operator",";"] +],[ + "start" +],[ + "start", + ["keyword","void"], + ["text"," "], + ["identifier","main"], + ["paren.lparen","("], + ["paren.rparen",")"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start" +],[ + "start", + ["text"," "], + ["identifier","vNormal"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["identifier","normal"], + ["punctuation.operator",";"] +],[ + "start", + ["text"," "] +],[ + "start", + ["text"," "], + ["comment","// multiply our displacement by the"] +],[ + "start", + ["text"," "], + ["comment","// amplitude. The amp will get animated"] +],[ + "start", + ["text"," "], + ["comment","// so we'll have animated displacement"] +],[ + "start", + ["text"," "], + ["keyword","vec3"], + ["text"," "], + ["identifier","newPosition"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["identifier","position"], + ["text"," "], + ["keyword.operator","+"], + ["text"," "] +],[ + "start", + ["text"," "], + ["identifier","normal"], + ["text"," "], + ["keyword.operator","*"], + ["text"," "] +],[ + "start", + ["text"," "], + ["keyword","vec3"], + ["paren.lparen","("], + ["identifier","displacement"], + ["text"," "], + ["keyword.operator","*"] +],[ + "start", + ["text"," "], + ["identifier","amplitude"], + ["paren.rparen",")"], + ["punctuation.operator",";"] +],[ + "start" +],[ + "start", + ["text"," "], + ["constant.language","gl_Position"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["identifier","projectionMatrix"], + ["text"," "], + ["keyword.operator","*"] +],[ + "start", + ["text"," "], + ["identifier","modelViewMatrix"], + ["text"," "], + ["keyword.operator","*"] +],[ + "start", + ["text"," "], + ["keyword","vec4"], + ["paren.lparen","("], + ["identifier","newPosition"], + ["punctuation.operator",","], + ["constant.numeric","1.0"], + ["paren.rparen",")"], + ["punctuation.operator",";"] +],[ + "start", + ["paren.rparen","}"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_golang.json b/addons/editor/ace/mode/_test/tokens_golang.json new file mode 100755 index 00000000..070c0a17 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_golang.json @@ -0,0 +1,256 @@ +[[ + "start", + ["comment","// Concurrent computation of pi."] +],[ + "start", + ["comment","// See http://goo.gl/ZuTZM."] +],[ + "start", + ["comment","//"] +],[ + "start", + ["comment","// This demonstrates Go's ability to handle"] +],[ + "start", + ["comment","// large numbers of concurrent processes."] +],[ + "start", + ["comment","// It is an unreasonable way to calculate pi."] +],[ + "start", + ["keyword","package"], + ["text"," "], + ["identifier","main"] +],[ + "start" +],[ + "start", + ["keyword","import"], + ["text"," "], + ["paren.lparen","("] +],[ + "start", + ["text"," "], + ["string","\"fmt\""] +],[ + "start", + ["text"," "], + ["string","\"math\""] +],[ + "start", + ["paren.rparen",")"] +],[ + "start" +],[ + "start", + ["keyword","func"], + ["text"," "], + ["identifier","main"], + ["paren.lparen","("], + ["paren.rparen",")"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["identifier","fmt"], + ["punctuation.operator","."], + ["identifier","Println"], + ["paren.lparen","("], + ["identifier","pi"], + ["paren.lparen","("], + ["constant.numeric","5000"], + ["paren.rparen","))"] +],[ + "start", + ["paren.rparen","}"] +],[ + "start" +],[ + "start", + ["comment","// pi launches n goroutines to compute an"] +],[ + "start", + ["comment","// approximation of pi."] +],[ + "start", + ["keyword","func"], + ["text"," "], + ["identifier","pi"], + ["paren.lparen","("], + ["identifier","n"], + ["text"," "], + ["support.type","int"], + ["paren.rparen",")"], + ["text"," "], + ["support.type","float64"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["identifier","ch"], + ["text"," "], + ["punctuation.operator",":"], + ["keyword.operator","="], + ["text"," "], + ["support.function","make"], + ["paren.lparen","("], + ["keyword","chan"], + ["text"," "], + ["support.type","float64"], + ["paren.rparen",")"] +],[ + "start", + ["text"," "], + ["keyword","for"], + ["text"," "], + ["identifier","k"], + ["text"," "], + ["punctuation.operator",":"], + ["keyword.operator","="], + ["text"," "], + ["constant.numeric","0"], + ["punctuation.operator",";"], + ["text"," "], + ["identifier","k"], + ["text"," "], + ["keyword.operator","<="], + ["text"," "], + ["identifier","n"], + ["punctuation.operator",";"], + ["text"," "], + ["identifier","k"], + ["keyword.operator","++"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["keyword","go"], + ["text"," "], + ["identifier","term"], + ["paren.lparen","("], + ["identifier","ch"], + ["punctuation.operator",","], + ["text"," "], + ["support.type","float64"], + ["paren.lparen","("], + ["identifier","k"], + ["paren.rparen","))"] +],[ + "start", + ["text"," "], + ["paren.rparen","}"] +],[ + "start", + ["text"," "], + ["identifier","f"], + ["text"," "], + ["punctuation.operator",":"], + ["keyword.operator","="], + ["text"," "], + ["constant.numeric","0.0"] +],[ + "start", + ["text"," "], + ["keyword","for"], + ["text"," "], + ["identifier","k"], + ["text"," "], + ["punctuation.operator",":"], + ["keyword.operator","="], + ["text"," "], + ["constant.numeric","0"], + ["punctuation.operator",";"], + ["text"," "], + ["identifier","k"], + ["text"," "], + ["keyword.operator","<="], + ["text"," "], + ["identifier","n"], + ["punctuation.operator",";"], + ["text"," "], + ["identifier","k"], + ["keyword.operator","++"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["identifier","f"], + ["text"," "], + ["keyword.operator","+="], + ["text"," "], + ["keyword.operator","<-"], + ["identifier","ch"] +],[ + "start", + ["text"," "], + ["paren.rparen","}"] +],[ + "start", + ["text"," "], + ["keyword","return"], + ["text"," "], + ["identifier","f"] +],[ + "start", + ["paren.rparen","}"] +],[ + "start" +],[ + "start", + ["keyword","func"], + ["text"," "], + ["identifier","term"], + ["paren.lparen","("], + ["identifier","ch"], + ["text"," "], + ["keyword","chan"], + ["text"," "], + ["support.type","float64"], + ["punctuation.operator",","], + ["text"," "], + ["identifier","k"], + ["text"," "], + ["support.type","float64"], + ["paren.rparen",")"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["identifier","ch"], + ["text"," "], + ["keyword.operator","<-"], + ["text"," "], + ["constant.numeric","4"], + ["text"," "], + ["keyword.operator","*"], + ["text"," "], + ["identifier","math"], + ["punctuation.operator","."], + ["identifier","Pow"], + ["paren.lparen","("], + ["constant.numeric","-1"], + ["punctuation.operator",","], + ["text"," "], + ["identifier","k"], + ["paren.rparen",")"], + ["text"," / "], + ["paren.lparen","("], + ["constant.numeric","2"], + ["keyword.operator","*"], + ["identifier","k"], + ["text"," "], + ["keyword.operator","+"], + ["text"," "], + ["constant.numeric","1"], + ["paren.rparen",")"] +],[ + "start", + ["paren.rparen","}"] +],[ + "start" +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_groovy.json b/addons/editor/ace/mode/_test/tokens_groovy.json new file mode 100755 index 00000000..c7dae6b1 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_groovy.json @@ -0,0 +1,410 @@ +[[ + "start", + ["comment","//http://groovy.codehaus.org/Martin+Fowler%27s+closure+examples+in+Groovy"] +],[ + "start" +],[ + "start", + ["keyword","class"], + ["text"," "], + ["identifier","Employee"], + ["text"," "], + ["lparen","{"] +],[ + "start", + ["text"," "], + ["keyword","def"], + ["text"," "], + ["identifier","name"], + ["text",", "], + ["identifier","salary"] +],[ + "start", + ["text"," "], + ["keyword","boolean"], + ["text"," "], + ["identifier","manager"] +],[ + "start", + ["text"," "], + ["support.function","String"], + ["text"," "], + ["identifier","toString"], + ["lparen","("], + ["rparen",")"], + ["text"," "], + ["lparen","{"], + ["text"," "], + ["keyword","return"], + ["text"," "], + ["identifier","name"], + ["text"," "], + ["rparen","}"] +],[ + "start", + ["rparen","}"] +],[ + "start" +],[ + "start", + ["keyword","def"], + ["text"," "], + ["identifier","emps"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["lparen","["], + ["keyword","new"], + ["text"," "], + ["identifier","Employee"], + ["lparen","("], + ["identifier","name"], + ["text",":"], + ["string","'Guillaume'"], + ["text",", "], + ["identifier","manager"], + ["text",":"], + ["constant.language.boolean","true"], + ["text",", "], + ["identifier","salary"], + ["text",":"], + ["constant.numeric","200"], + ["rparen",")"], + ["text",","] +],[ + "start", + ["text"," "], + ["keyword","new"], + ["text"," "], + ["identifier","Employee"], + ["lparen","("], + ["identifier","name"], + ["text",":"], + ["string","'Graeme'"], + ["text",", "], + ["identifier","manager"], + ["text",":"], + ["constant.language.boolean","true"], + ["text",", "], + ["identifier","salary"], + ["text",":"], + ["constant.numeric","200"], + ["rparen",")"], + ["text",","] +],[ + "start", + ["text"," "], + ["keyword","new"], + ["text"," "], + ["identifier","Employee"], + ["lparen","("], + ["identifier","name"], + ["text",":"], + ["string","'Dierk'"], + ["text",", "], + ["identifier","manager"], + ["text",":"], + ["constant.language.boolean","false"], + ["text",", "], + ["identifier","salary"], + ["text",":"], + ["constant.numeric","151"], + ["rparen",")"], + ["text",","] +],[ + "start", + ["text"," "], + ["keyword","new"], + ["text"," "], + ["identifier","Employee"], + ["lparen","("], + ["identifier","name"], + ["text",":"], + ["string","'Bernd'"], + ["text",", "], + ["identifier","manager"], + ["text",":"], + ["constant.language.boolean","false"], + ["text",", "], + ["identifier","salary"], + ["text",":"], + ["constant.numeric","50"], + ["rparen",")]"] +],[ + "start" +],[ + "start", + ["keyword","def"], + ["text"," "], + ["identifier","managers"], + ["lparen","("], + ["identifier","emps"], + ["rparen",")"], + ["text"," "], + ["lparen","{"] +],[ + "start", + ["text"," "], + ["identifier","emps"], + ["text","."], + ["identifier","findAll"], + ["text"," "], + ["lparen","{"], + ["text"," "], + ["identifier","e"], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["identifier","e"], + ["text","."], + ["identifier","isManager"], + ["lparen","("], + ["rparen",")"], + ["text"," "], + ["rparen","}"] +],[ + "start", + ["rparen","}"] +],[ + "start" +],[ + "start", + ["keyword","assert"], + ["text"," "], + ["identifier","emps"], + ["lparen","["], + ["constant.numeric","0"], + ["text",".."], + ["constant.numeric","1"], + ["rparen","]"], + ["text"," "], + ["keyword.operator","=="], + ["text"," "], + ["identifier","managers"], + ["lparen","("], + ["identifier","emps"], + ["rparen",")"], + ["text"," "], + ["comment","// [Guillaume, Graeme]"] +],[ + "start" +],[ + "start", + ["keyword","def"], + ["text"," "], + ["identifier","highPaid"], + ["lparen","("], + ["identifier","emps"], + ["rparen",")"], + ["text"," "], + ["lparen","{"] +],[ + "start", + ["text"," "], + ["identifier","threshold"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["constant.numeric","150"] +],[ + "start", + ["text"," "], + ["identifier","emps"], + ["text","."], + ["identifier","findAll"], + ["text"," "], + ["lparen","{"], + ["text"," "], + ["identifier","e"], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["identifier","e"], + ["text","."], + ["identifier","salary"], + ["text"," "], + ["keyword.operator",">"], + ["text"," "], + ["identifier","threshold"], + ["text"," "], + ["rparen","}"] +],[ + "start", + ["rparen","}"] +],[ + "start" +],[ + "start", + ["keyword","assert"], + ["text"," "], + ["identifier","emps"], + ["lparen","["], + ["constant.numeric","0"], + ["text",".."], + ["constant.numeric","2"], + ["rparen","]"], + ["text"," "], + ["keyword.operator","=="], + ["text"," "], + ["identifier","highPaid"], + ["lparen","("], + ["identifier","emps"], + ["rparen",")"], + ["text"," "], + ["comment","// [Guillaume, Graeme, Dierk]"] +],[ + "start" +],[ + "start", + ["keyword","def"], + ["text"," "], + ["identifier","paidMore"], + ["lparen","("], + ["identifier","amount"], + ["rparen",")"], + ["text"," "], + ["lparen","{"] +],[ + "start", + ["text"," "], + ["lparen","{"], + ["text"," "], + ["identifier","e"], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["identifier","e"], + ["text","."], + ["identifier","salary"], + ["text"," "], + ["keyword.operator",">"], + ["text"," "], + ["identifier","amount"], + ["rparen","}"] +],[ + "start", + ["rparen","}"] +],[ + "start", + ["keyword","def"], + ["text"," "], + ["identifier","highPaid"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["identifier","paidMore"], + ["lparen","("], + ["constant.numeric","150"], + ["rparen",")"] +],[ + "start" +],[ + "start", + ["keyword","assert"], + ["text"," "], + ["identifier","highPaid"], + ["lparen","("], + ["identifier","emps"], + ["lparen","["], + ["constant.numeric","0"], + ["rparen","])"], + ["text"," "], + ["comment","// true"] +],[ + "start", + ["keyword","assert"], + ["text"," "], + ["identifier","emps"], + ["lparen","["], + ["constant.numeric","0"], + ["text",".."], + ["constant.numeric","2"], + ["rparen","]"], + ["text"," "], + ["keyword.operator","=="], + ["text"," "], + ["identifier","emps"], + ["text","."], + ["identifier","findAll"], + ["lparen","("], + ["identifier","highPaid"], + ["rparen",")"] +],[ + "start" +],[ + "start", + ["keyword","def"], + ["text"," "], + ["identifier","filename"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["string","'test.txt'"] +],[ + "start", + ["keyword","new"], + ["text"," "], + ["identifier","File"], + ["lparen","("], + ["identifier","filename"], + ["rparen",")"], + ["text","."], + ["identifier","withReader"], + ["lparen","{"], + ["text"," "], + ["identifier","reader"], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["identifier","doSomethingWith"], + ["lparen","("], + ["identifier","reader"], + ["rparen",")"], + ["text"," "], + ["rparen","}"] +],[ + "start" +],[ + "start", + ["keyword","def"], + ["text"," "], + ["identifier","readersText"] +],[ + "start", + ["keyword","def"], + ["text"," "], + ["identifier","doSomethingWith"], + ["lparen","("], + ["identifier","reader"], + ["rparen",")"], + ["text"," "], + ["lparen","{"], + ["text"," "], + ["identifier","readersText"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["identifier","reader"], + ["text","."], + ["identifier","text"], + ["text"," "], + ["rparen","}"] +],[ + "start" +],[ + "start", + ["keyword","assert"], + ["text"," "], + ["keyword","new"], + ["text"," "], + ["identifier","File"], + ["lparen","("], + ["identifier","filename"], + ["rparen",")"], + ["text","."], + ["identifier","text"], + ["text"," "], + ["keyword.operator","=="], + ["text"," "], + ["identifier","readersText"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_haml.json b/addons/editor/ace/mode/_test/tokens_haml.json new file mode 100755 index 00000000..423c3bd5 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_haml.json @@ -0,0 +1,174 @@ +[[ + "start", + ["keyword.other.doctype","!!!5"] +],[ + "start" +],[ + "start", + ["punctuation.section.comment","# "] +],[ + "start", + ["punctuation.section.comment","# "] +],[ + "start", + ["punctuation.section.comment","# "] +],[ + "start", + ["punctuation.section.comment","# "] +],[ + "start" +],[ + "start" +],[ + "start", + ["punctuation.section.comment","/adasdasdad"] +],[ + "start", + ["entity.name.tag.haml","%div"], + ["punctuation.section","{"], + ["constant.other.symbol.ruby",":id"], + ["text"," => "], + ["string","\"#{@item.type}_#{@item.number}\""], + ["text",", "], + ["constant.other.symbol.ruby",":class"], + ["text"," => "], + ["string","'#{@item.type} #{@item.urgency}'"], + ["text",", "], + ["constant.other.symbol.ruby",":phoney"], + ["text"," => "], + ["string","`asdasdasd`"], + ["punctuation.section","}"] +],[ + "start", + ["punctuation.section.comment","/ file: app/views/movies/index.html.haml"] +],[ + "start", + ["meta.escape.haml","\\d"] +],[ + "start", + ["entity.name.tag.haml","%ads:"], + ["punctuation.section","{"], + ["constant.other.symbol.ruby",":bleh"], + ["text"," => "], + ["constant.numeric","33"], + ["punctuation.section","}"] +],[ + "embedded_ruby", + ["entity.name.tag.haml","%p"], + ["text","==ddd=="] +],[ + "start", + ["text"," Date/Time:"] +],[ + "embedded_ruby", + ["text"," - "], + ["identifier","now"], + ["text"," = "], + ["support.class","DateTime"], + ["text","."], + ["identifier","now"], + ["text"," "] +],[ + "start", + ["entity.name.tag.haml"," %strong"], + ["text","= now"] +],[ + "embedded_ruby", + ["text"," = "], + ["keyword","if"], + ["text"," "], + ["identifier","now"], + ["text"," "], + ["support.class","DateTime"], + ["text","."], + ["identifier","parse"], + ["text","(\""], + ["support.class","December"], + ["text"," "], + ["constant.numeric","31"], + ["text",", "], + ["constant.numeric","2006"], + ["text","\")"] +],[ + "embedded_ruby", + ["text"," = \""], + ["support.class","Happy"], + ["text"," "], + ["identifier","new"], + ["text"," \" + \""], + ["identifier","year"], + ["text","!\""] +],[ + "start", + ["entity.name.tag.haml","%sfd"], + ["entity.other.attribute-name.class.haml",".dfdfg"] +],[ + "start", + ["punctuation.section.comment","#content"] +],[ + "start", + ["text"," .title"] +],[ + "start", + ["entity.name.tag.haml"," %h1"], + ["text","= @title"] +],[ + "embedded_ruby", + ["text"," = "], + ["support.function","link_to"], + ["text"," '"], + ["support.class","Home"], + ["text","', "], + ["identifier","home_url"] +],[ + "start" +],[ + "start", + ["punctuation.section.comment"," #contents"] +],[ + "start", + ["entity.name.tag.haml","%div"], + ["entity.other.attribute-name.id.haml","#content"] +],[ + "start", + ["entity.name.tag.haml"," %div"], + ["entity.other.attribute-name.class.haml",".articles"] +],[ + "start", + ["entity.name.tag.haml"," %div"], + ["entity.other.attribute-name.class.haml",".article.title"], + ["text"," Blah"] +],[ + "start", + ["entity.name.tag.haml"," %div"], + ["entity.other.attribute-name.class.haml",".article.date"], + ["text"," "], + ["constant.numeric","2006-11-05"] +],[ + "start", + ["entity.name.tag.haml"," %div"], + ["entity.other.attribute-name.class.haml",".article.entry"] +],[ + "start", + ["text"," Neil Patrick Harris "] +],[ + "start" +],[ + "start", + ["entity.name.tag.haml","%div"], + ["text","[@user, "], + ["constant.other.symbol.ruby",":greeting"], + ["text","]"] +],[ + "start", + ["entity.name.tag.haml"," %bar"], + ["text","["], + ["constant.numeric","290"], + ["text","]/"] +],[ + "start", + ["text"," "], + ["string.quoted.double","==Hello!=="] +],[ + "start" +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_haskell.json b/addons/editor/ace/mode/_test/tokens_haskell.json new file mode 100755 index 00000000..8f9a2b38 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_haskell.json @@ -0,0 +1,156 @@ +[[ + "start", + ["punctuation.definition.comment.haskell","-- Type annotation (optional)"] +],[ + "start", + ["entity.name.function.haskell","fib"], + ["meta.function.type-declaration.haskell"," "], + ["keyword.other.double-colon.haskell","::"], + ["meta.function.type-declaration.haskell"," "], + ["support.type.prelude.haskell","Int"], + ["meta.function.type-declaration.haskell"," "], + ["keyword.other.arrow.haskell","->"], + ["meta.function.type-declaration.haskell"," "], + ["support.type.prelude.haskell","Integer"] +],[ + "start", + ["text"," "] +],[ + "start", + ["punctuation.definition.comment.haskell","-- With self-referencing data"] +],[ + "start", + ["text","fib n "], + ["keyword.operator.haskell","="], + ["text"," fibs "], + ["keyword.operator.haskell","!!"], + ["text"," n"] +],[ + "start", + ["text"," "], + ["keyword.other.haskell","where"], + ["text"," fibs "], + ["keyword.operator.haskell","="], + ["text"," "], + ["constant.numeric.haskell","0"], + ["text"," "], + ["keyword.operator.haskell",":"], + ["text"," "], + ["support.function.prelude.haskell","scanl"], + ["text"," "], + ["entity.name.function.infix.haskell","(+)"], + ["text"," "], + ["constant.numeric.haskell","1"], + ["text"," fibs"] +],[ + "start", + ["text"," "], + ["punctuation.definition.comment.haskell","-- 0,1,1,2,3,5,..."] +],[ + "start", + ["text"," "] +],[ + "start", + ["punctuation.definition.comment.haskell","-- Same, coded directly"] +],[ + "start", + ["text","fib n "], + ["keyword.operator.haskell","="], + ["text"," fibs "], + ["keyword.operator.haskell","!!"], + ["text"," n"] +],[ + "start", + ["text"," "], + ["keyword.other.haskell","where"], + ["text"," fibs "], + ["keyword.operator.haskell","="], + ["text"," "], + ["constant.numeric.haskell","0"], + ["text"," "], + ["keyword.operator.haskell",":"], + ["text"," "], + ["constant.numeric.haskell","1"], + ["text"," "], + ["keyword.operator.haskell",":"], + ["text"," next fibs"] +],[ + "start", + ["text"," next (a "], + ["keyword.operator.haskell",":"], + ["text"," t@(b"], + ["keyword.operator.haskell",":"], + ["text","_)) "], + ["keyword.operator.haskell","="], + ["text"," (a"], + ["keyword.operator.haskell","+"], + ["text","b) "], + ["keyword.operator.haskell",":"], + ["text"," next t"] +],[ + "start", + ["text"," "] +],[ + "start", + ["punctuation.definition.comment.haskell","-- Similar idea, using zipWith"] +],[ + "start", + ["text","fib n "], + ["keyword.operator.haskell","="], + ["text"," fibs "], + ["keyword.operator.haskell","!!"], + ["text"," n"] +],[ + "start", + ["text"," "], + ["keyword.other.haskell","where"], + ["text"," fibs "], + ["keyword.operator.haskell","="], + ["text"," "], + ["constant.numeric.haskell","0"], + ["text"," "], + ["keyword.operator.haskell",":"], + ["text"," "], + ["constant.numeric.haskell","1"], + ["text"," "], + ["keyword.operator.haskell",":"], + ["text"," "], + ["support.function.prelude.haskell","zipWith"], + ["text"," "], + ["entity.name.function.infix.haskell","(+)"], + ["text"," fibs ("], + ["support.function.prelude.haskell","tail"], + ["text"," fibs)"] +],[ + "start", + ["text"," "] +],[ + "start", + ["punctuation.definition.comment.haskell","-- Using a generator function"] +],[ + "start", + ["text","fib n "], + ["keyword.operator.haskell","="], + ["text"," fibs ("], + ["constant.numeric.haskell","0"], + ["punctuation.separator.comma.haskell",","], + ["constant.numeric.haskell","1"], + ["text",") "], + ["keyword.operator.haskell","!!"], + ["text"," n"] +],[ + "start", + ["text"," "], + ["keyword.other.haskell","where"], + ["text"," fibs (a"], + ["punctuation.separator.comma.haskell",","], + ["text","b) "], + ["keyword.operator.haskell","="], + ["text"," a "], + ["keyword.operator.haskell",":"], + ["text"," fibs (b"], + ["punctuation.separator.comma.haskell",","], + ["text","a"], + ["keyword.operator.haskell","+"], + ["text","b)"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_haxe.json b/addons/editor/ace/mode/_test/tokens_haxe.json new file mode 100755 index 00000000..f0f79a48 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_haxe.json @@ -0,0 +1,143 @@ +[[ + "start", + ["keyword","class"], + ["text"," "], + ["identifier","Haxe"], + ["text"," "] +],[ + "start", + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["keyword","public"], + ["text"," "], + ["keyword","static"], + ["text"," "], + ["keyword","function"], + ["text"," "], + ["identifier","main"], + ["paren.lparen","("], + ["paren.rparen",")"], + ["text"," "] +],[ + "start", + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["comment","// Say Hello!"] +],[ + "start", + ["text"," "], + ["keyword","var"], + ["text"," "], + ["identifier","greeting"], + ["punctuation.operator",":"], + ["keyword","String"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["string","\"Hello World\""], + ["punctuation.operator",";"] +],[ + "start", + ["text"," "], + ["keyword","trace"], + ["paren.lparen","("], + ["identifier","greeting"], + ["paren.rparen",")"], + ["punctuation.operator",";"] +],[ + "start", + ["text"," "] +],[ + "start", + ["text"," "], + ["keyword","var"], + ["text"," "], + ["identifier","targets"], + ["punctuation.operator",":"], + ["keyword","Array"], + ["keyword.operator","<"], + ["keyword","String"], + ["keyword.operator",">"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["paren.lparen","["], + ["string","\"Flash\""], + ["punctuation.operator",","], + ["string","\"Javascript\""], + ["punctuation.operator",","], + ["string","\"PHP\""], + ["punctuation.operator",","], + ["string","\"Neko\""], + ["punctuation.operator",","], + ["string","\"C++\""], + ["punctuation.operator",","], + ["string","\"iOS\""], + ["punctuation.operator",","], + ["string","\"Android\""], + ["punctuation.operator",","], + ["string","\"webOS\""], + ["paren.rparen","]"], + ["punctuation.operator",";"] +],[ + "start", + ["text"," "], + ["keyword","trace"], + ["paren.lparen","("], + ["string","\"Haxe is a great language that can target:\""], + ["paren.rparen",")"], + ["punctuation.operator",";"] +],[ + "start", + ["text"," "], + ["keyword","for"], + ["text"," "], + ["paren.lparen","("], + ["identifier","target"], + ["text"," "], + ["keyword","in"], + ["text"," "], + ["identifier","targets"], + ["paren.rparen",")"] +],[ + "start", + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["keyword","trace"], + ["text"," "], + ["paren.lparen","("], + ["string","\" - \""], + ["text"," "], + ["keyword.operator","+"], + ["text"," "], + ["identifier","target"], + ["paren.rparen",")"], + ["punctuation.operator",";"] +],[ + "start", + ["text"," "], + ["paren.rparen","}"] +],[ + "start", + ["text"," "], + ["keyword","trace"], + ["paren.lparen","("], + ["string","\"And many more!\""], + ["paren.rparen",")"], + ["punctuation.operator",";"] +],[ + "start", + ["text"," "], + ["paren.rparen","}"] +],[ + "start", + ["paren.rparen","}"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_html.json b/addons/editor/ace/mode/_test/tokens_html.json new file mode 100755 index 00000000..794ba26d --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_html.json @@ -0,0 +1,51 @@ +[[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","html"], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.script","script"], + ["text"," "], + ["entity.other.attribute-name","a"], + ["keyword.operator.separator","="], + ["string","'a'"], + ["meta.tag.punctuation.end",">"], + ["storage.type","var"], + ["meta.tag.punctuation.begin",""], + ["text","'123'"] +],[ + ["qqstring_inner","start_tag_stuff"], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.anchor","a"], + ["text"," "], + ["entity.other.attribute-name","href"], + ["keyword.operator.separator","="], + ["string","\"abc"] +],[ + "start", + ["string"," def\""], + ["meta.tag.punctuation.end",">"] +],[ + ["qstring_inner","start_tag_stuff"], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.anchor","a"], + ["text"," "], + ["entity.other.attribute-name","href"], + ["keyword.operator.separator","="], + ["string","'abc"] +],[ + "start", + ["string","def\\'"], + ["meta.tag.punctuation.end",">"] +],[ + "start" +],[ + "start", + ["meta.tag.punctuation.begin",""] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_html_ruby.json b/addons/editor/ace/mode/_test/tokens_html_ruby.json new file mode 100755 index 00000000..619fb5dc --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_html_ruby.json @@ -0,0 +1,247 @@ +[[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","h1"], + ["meta.tag.punctuation.end",">"], + ["text","Listing Books"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text"," "] +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.table","table"], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.table","tr"], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.table","th"], + ["meta.tag.punctuation.end",">"], + ["text","Title"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.table","th"], + ["meta.tag.punctuation.end",">"], + ["text","Summary"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.table","th"], + ["meta.tag.punctuation.end",">"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.table","th"], + ["meta.tag.punctuation.end",">"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.table","th"], + ["meta.tag.punctuation.end",">"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text"," "] +],[ + "start", + ["support.ruby_tag","<%"], + ["text"," "], + ["variable.instance","@books"], + ["text","."], + ["identifier","each"], + ["text"," "], + ["keyword","do"], + ["text"," |"], + ["identifier","book"], + ["text","| "], + ["support.ruby_tag","%>"] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.table","tr"], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text"," "], + ["comment.start.erb","<%#"], + ["comment"," comment "], + ["comment.end.erb","%>"] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.table","td"], + ["meta.tag.punctuation.end",">"], + ["support.ruby_tag","<%="], + ["text"," "], + ["identifier","book"], + ["text","."], + ["identifier","title"], + ["text"," "], + ["support.ruby_tag","%>"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.table","td"], + ["meta.tag.punctuation.end",">"], + ["support.ruby_tag","<%="], + ["text"," "], + ["identifier","book"], + ["text","."], + ["identifier","content"], + ["text"," "], + ["support.ruby_tag","%>"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.table","td"], + ["meta.tag.punctuation.end",">"], + ["support.ruby_tag","<%="], + ["text"," "], + ["support.function","link_to"], + ["text"," "], + ["string","'Show'"], + ["text",", "], + ["identifier","book"], + ["text"," "], + ["support.ruby_tag","%>"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.table","td"], + ["meta.tag.punctuation.end",">"], + ["support.ruby_tag","<%="], + ["text"," "], + ["support.function","link_to"], + ["text"," "], + ["string","'Edit'"], + ["text",", "], + ["identifier","edit_book_path"], + ["paren.lparen","("], + ["identifier","book"], + ["paren.rparen",")"], + ["text"," "], + ["support.ruby_tag","%>"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.table","td"], + ["meta.tag.punctuation.end",">"], + ["support.ruby_tag","<%="], + ["text"," "], + ["support.function","link_to"], + ["text"," "], + ["string","'Remove'"], + ["text",", "], + ["identifier","book"], + ["text",", "], + ["constant.other.symbol.ruby",":confirm"], + ["text"," "], + ["punctuation.separator.key-value","=>"], + ["text"," "], + ["string","'Are you sure?'"], + ["text",", "], + ["constant.other.symbol.ruby",":method"], + ["text"," "], + ["punctuation.separator.key-value","=>"], + ["text"," "], + ["constant.other.symbol.ruby",":delete"], + ["text"," "], + ["support.ruby_tag","%>"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["support.ruby_tag","<%"], + ["text"," "], + ["keyword","end"], + ["text"," "], + ["support.ruby_tag","%>"] +],[ + "start", + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text"," "] +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","br"], + ["text"," "], + ["meta.tag.punctuation.end","/>"] +],[ + "start", + ["text"," "] +],[ + "start", + ["support.ruby_tag","<%="], + ["text"," "], + ["support.function","link_to"], + ["text"," "], + ["string","'New book'"], + ["text",", "], + ["identifier","new_book_path"], + ["text"," "], + ["support.ruby_tag","%>"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_jade.json b/addons/editor/ace/mode/_test/tokens_jade.json new file mode 100755 index 00000000..5bf45968 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_jade.json @@ -0,0 +1,188 @@ +[[ + "start", + ["keyword.other.doctype.jade","!!!doctype"] +],[ + "start", + ["keyword.other.doctype.jade","!!!5"] +],[ + "start", + ["keyword.other.doctype.jade","!!!"] +],[ + "start" +],[ + "start", + ["keyword.control.import.include.jade","include"], + ["text"," something"] +],[ + "start" +],[ + "start", + ["keyword.control.import.include.jade"," include"], + ["text"," another_thing"] +],[ + "start" +],[ + "start", + ["punctuation.section.comment"," // let's talk about it"] +],[ + "start" +],[ + ["comment_block",0,"start"], + ["comment","// "] +],[ + ["comment_block",0,"start"], + ["comment"," here it is. a block comment!"] +],[ + ["comment_block",0,"start"], + ["comment"," and another row!"] +],[ + "start", + ["meta.tag.any.jade","but"], + ["text"," not here."] +],[ + "start" +],[ + ["comment_block",5,"start"], + ["comment"," // "] +],[ + ["comment_block",5,"start"], + ["comment"," a far spaced"] +],[ + "start", + ["text"," should be lack of block"] +],[ + "start" +],[ + "start", + ["punctuation.section.comment"," // also not a comment"] +],[ + "start", + ["meta.tag.any.jade"," div"], + ["entity.other.attribute-name.class.jade",".attemptAtBlock"] +],[ + "start", + ["text"," "] +],[ + "start", + ["meta.tag.any.jade"," span"], + ["entity.other.attribute-name.id.jade","#myName"] +],[ + "start" +],[ + "start", + ["text"," "], + ["string.interpolated.jade","#{implicit}"] +],[ + "start", + ["text"," "], + ["string.interpolated.jade","!{more_explicit}"] +],[ + "start" +],[ + "start", + ["text"," "], + ["suport.type.attribute.id.jade","#idDiv"] +],[ + "start" +],[ + "start", + ["text"," "], + ["suport.type.attribute.class.jade",".idDiv"] +],[ + "start" +],[ + "start", + ["meta.tag.any.jade"," test"], + ["punctuation","("], + ["entity.other.attribute-name.jade","id"], + ["text","="], + ["string","\"tag\""], + ["punctuation",")"] +],[ + "start", + ["meta.tag.any.jade"," header"], + ["punctuation","("], + ["entity.other.attribute-name.jade","id"], + ["text","="], + ["string","\"tag\""], + ["text",", "], + ["entity.other.attribute-name.jade","blah"], + ["text","="], + ["string","\"foo\""], + ["text",", "], + ["entity.other.attribute-name.jade","meh"], + ["text","="], + ["string","\"aads\""], + ["punctuation",")"] +],[ + "start", + ["storage.type.function.jade","mixin"], + ["entity.name.function.jade"," article"], + ["punctuation.definition.parameters.begin.jade","("], + ["variable.parameter.function.jade","obj, parents"], + ["punctuation.definition.parameters.end.jade",")"] +],[ + "start" +],[ + "start", + ["storage.type.function.jade"," mixin"], + ["entity.name.function.jade"," bleh"], + ["punctuation.definition.parameters.begin.jade","("], + ["punctuation.definition.parameters.end.jade",")"] +],[ + "start" +],[ + "start", + ["storage.type.function.jade"," mixin"], + ["entity.name.function.jade"," clever-name"] +],[ + "start" +],[ + "start", + ["source.js.embedded.jade"," -"], + ["storage.type","var"], + ["text"," "], + ["identifier","x"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["string","\"0\""], + ["text",";"] +],[ + "start", + ["source.js.embedded.jade"," -"], + ["text"," "], + ["identifier","y"], + ["text"," "], + ["identifier","each"], + ["text"," z"] +],[ + "start" +],[ + "start", + ["source.js.embedded.jade"," -"], + ["text"," "], + ["storage.type","var"], + ["text"," "], + ["identifier","items"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["paren.lparen","["], + ["string","\"one\""], + ["punctuation.operator",","], + ["text"," "], + ["string","\"two\""], + ["punctuation.operator",","], + ["text"," "], + ["string","\"three\""], + ["text","]"] +],[ + "start", + ["meta.tag.any.jade"," each"], + ["text"," item in items"] +],[ + "start", + ["meta.tag.any.jade"," li"], + ["text","= item"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_java.json b/addons/editor/ace/mode/_test/tokens_java.json new file mode 100755 index 00000000..799ebdb5 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_java.json @@ -0,0 +1,95 @@ +[[ + "start", + ["keyword","public"], + ["text"," "], + ["keyword","class"], + ["text"," "], + ["identifier","InfiniteLoop"], + ["text"," "], + ["lparen","{"] +],[ + "start" +],[ + "comment", + ["text"," "], + ["comment","/*"] +],[ + "comment", + ["comment"," * This will cause the program to hang..."] +],[ + "comment", + ["comment"," *"] +],[ + "comment", + ["comment"," * Taken from:"] +],[ + "comment", + ["comment"," * http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/"] +],[ + "start", + ["comment"," */"] +],[ + "start", + ["text"," "], + ["keyword","public"], + ["text"," "], + ["keyword","static"], + ["text"," "], + ["keyword","void"], + ["text"," "], + ["identifier","main"], + ["lparen","("], + ["support.function","String"], + ["lparen","["], + ["rparen","]"], + ["text"," "], + ["identifier","args"], + ["rparen",")"], + ["text"," "], + ["lparen","{"] +],[ + "start", + ["text"," "], + ["keyword","double"], + ["text"," "], + ["identifier","d"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["support.function","Double"], + ["text","."], + ["identifier","parseDouble"], + ["lparen","("], + ["string","\"2.2250738585072012e-308\""], + ["rparen",")"], + ["text",";"] +],[ + "start" +],[ + "start", + ["text"," "], + ["comment","// unreachable code"] +],[ + "start", + ["text"," "], + ["support.function","System"], + ["text","."], + ["identifier","out"], + ["text","."], + ["identifier","println"], + ["lparen","("], + ["string","\"Value: \""], + ["text"," "], + ["keyword.operator","+"], + ["text"," "], + ["identifier","d"], + ["rparen",")"], + ["text",";"] +],[ + "start", + ["text"," "], + ["rparen","}"] +],[ + "start", + ["rparen","}"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_javascript.json b/addons/editor/ace/mode/_test/tokens_javascript.json new file mode 100755 index 00000000..5044f21e --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_javascript.json @@ -0,0 +1,592 @@ +[[ + "start", + ["comment","//test: tokenize 'standard' functions"] +],[ + "no_regex", + ["identifier","string"], + ["punctuation.operator","."], + ["support.function","charCodeAt"], + ["paren.lparen","("], + ["constant.numeric","23"], + ["paren.rparen",")"], + ["punctuation.operator",";"], + ["text"," "], + ["variable.language","document"], + ["punctuation.operator","."], + ["support.function.dom","getElementById"], + ["paren.lparen","("], + ["string","'test'"], + ["paren.rparen",")"], + ["punctuation.operator",";"], + ["text"," "], + ["storage.type","console"], + ["punctuation.operator","."], + ["support.function.firebug","log"], + ["paren.lparen","("], + ["string","'Here it is'"], + ["paren.rparen",")"], + ["punctuation.operator",";"], + ["string","\";"] +],[ + "no_regex", + ["identifier","test"], + ["punctuation.operator",":"], + ["text"," "], + ["comment.doc","/**tokenize doc*/"], + ["text"," "], + ["identifier","comment"] +],[ + "no_regex", + ["comment.doc","/**tokenize doc comment with "], + ["comment.doc.tag","@tag"], + ["comment.doc"," {}*/"] +],[ + "no_regex", + ["comment","//test: tokenize parens"] +],[ + "start", + ["text"," "], + ["storage.type","var"], + ["text"," "], + ["identifier","line"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["string","\"[{( )}]\""], + ["punctuation.operator",";"] +],[ + "start", + ["comment","//test tokenize arithmetic expression which looks like a regexp"] +],[ + "no_regex", + ["identifier","a"], + ["keyword.operator","/"], + ["identifier","b"], + ["keyword.operator","/"], + ["identifier","c"] +],[ + "no_regex", + ["identifier","a"], + ["keyword.operator","/="], + ["identifier","b"], + ["keyword.operator","/"], + ["identifier","c"] +],[ + "no_regex", + ["comment","//test tokenize reg exps"] +],[ + "no_regex", + ["identifier","a"], + ["keyword.operator","="], + ["string.regexp","/b/g"] +],[ + "no_regex", + ["identifier","a"], + ["keyword.operator","+"], + ["string.regexp","/b/g"] +],[ + "no_regex", + ["identifier","a"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["constant.numeric","1"], + ["text"," "], + ["keyword.operator","+"], + ["text"," "], + ["string.regexp","/2 "], + ["constant.language.escape","+"], + ["string.regexp"," 1/b"] +],[ + "no_regex", + ["identifier","a"], + ["keyword.operator","="], + ["string.regexp","/a/"], + ["text"," "], + ["keyword.operator","/"], + ["text"," "], + ["string.regexp","/a/"] +],[ + "no_regex", + ["keyword","case"], + ["text"," "], + ["string.regexp","/a/"], + ["punctuation.operator","."], + ["support.function","test"], + ["paren.lparen","("], + ["identifier","c"], + ["paren.rparen",")"] +],[ + "no_regex", + ["comment","//test tokenize multi-line comment containing a single line comment"] +],[ + "no_regex", + ["identifier","noRegex"] +],[ + "no_regex", + ["comment","/* foo // bar */"] +],[ + "start", + ["identifier","canBeRegex"], + ["punctuation.operator",";"] +],[ + "start", + ["comment","/* foo // bar */"] +],[ + "start", + ["comment","// test tokenize identifier with umlauts"] +],[ + "no_regex", + ["identifier","fu"], + ["punctuation.operator","?"], + ["identifier","e"] +],[ + "no_regex", + ["comment","// test // is not a regexp"] +],[ + "start", + ["paren.lparen","{"], + ["text"," "], + ["comment","// 123"] +],[ + "start", + ["comment","//test skipping escaped chars"] +],[ + "no_regex", + ["string","'Meh"], + ["constant.language.escape","\\\\"], + ["string","nNeh'"] +],[ + "no_regex", + ["storage.type","console"], + ["punctuation.operator","."], + ["support.function.firebug","log"], + ["paren.lparen","("], + ["string","'"], + ["constant.language.escape","\\\\"], + ["string","u1232Feh'"] +],[ + "qqstring", + ["string","\"test multiline\\"] +],[ + "no_regex", + ["string"," strings\""] +],[ + "no_regex", + ["identifier","a"], + ["keyword.operator","="], + ["text","'"] +],[ + "qqstring", + ["identifier","b"], + ["keyword.operator","="], + ["string","\"\\"] +],[ + "no_regex", + ["string","still a string"] +],[ + "no_regex", + ["text"," "] +],[ + "no_regex", + ["text"," "] +],[ + "start", + ["storage.type","function"], + ["text"," "], + ["entity.name.function","foo"], + ["paren.lparen","("], + ["variable.parameter","items"], + ["punctuation.operator",", "], + ["variable.parameter","nada"], + ["paren.rparen",")"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["keyword","for"], + ["text"," "], + ["paren.lparen","("], + ["storage.type","var"], + ["text"," "], + ["identifier","i"], + ["keyword.operator","="], + ["constant.numeric","0"], + ["punctuation.operator",";"], + ["text"," "], + ["identifier","i"], + ["keyword.operator","<"], + ["identifier","items"], + ["punctuation.operator","."], + ["support.constant","length"], + ["punctuation.operator",";"], + ["text"," "], + ["identifier","i"], + ["keyword.operator","++"], + ["paren.rparen",")"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["support.function","alert"], + ["paren.lparen","("], + ["identifier","items"], + ["paren.lparen","["], + ["identifier","i"], + ["paren.rparen","]"], + ["text"," "], + ["keyword.operator","+"], + ["text"," "], + ["string","\"juhu"], + ["constant.language.escape","\\n"], + ["string","\""], + ["paren.rparen",")"], + ["punctuation.operator",";"] +],[ + "no_regex", + ["text"," "], + ["paren.rparen","}"], + ["text","\t"], + ["comment","// Real Tab."] +],[ + "no_regex", + ["paren.rparen","}"] +],[ + "no_regex" +],[ + "no_regex", + ["identifier","regexp"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["string.regexp","/p"], + ["constant.language.delimiter","|"], + ["string.regexp","p/"], + ["text"," "], + ["comment","// ends here"] +],[ + "no_regex" +],[ + "no_regex", + ["identifier","r"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["string.regexp","/d"], + ["constant.language.escape","{1,2}?"], + ["string.regexp","f{e}"], + ["invalid","++"], + ["string.regexp","r"], + ["constant.language.escape","*?"], + ["regexp.keyword.operator","\\d"], + ["constant.language.escape","+?[]"], + ["string.regexp","r"], + ["constant.language.escape","[^"], + ["string.regexp.charachterclass","r"], + ["constant.language.escape","-"], + ["string.regexp.charachterclass","o"], + ["regexp.keyword.operator","\\f\\f"], + ["string.regexp.charachterclass","["], + ["regexp.keyword.operator","\\f"], + ["constant.language.escape","]?"], + ["string.regexp","r"], + ["invalid","{7}+"], + ["string.regexp","r"], + ["regexp.keyword.operator","\\{"], + ["string.regexp","7}"], + ["constant.language.escape","+"], + ["string.regexp","rr--rr"], + ["constant.language.escape","$^(?:"], + ["string.regexp","d"], + ["constant.language.delimiter","|"], + ["string.regexp","s"], + ["constant.language.escape",")(?="], + ["string.regexp","a"], + ["constant.language.delimiter","|"], + ["constant.language.escape",")(?!"], + ["string.regexp","y"], + ["constant.language.escape",")[]"], + ["constant.language.delimiter","|"], + ["invalid","$?"], + ["constant.language.delimiter","|"], + ["invalid","^*"], + ["string.regexp","/"], + ["text"," "], + ["identifier","o"] +],[ + "no_regex", + ["identifier","a"], + ["keyword.operator","="], + ["string.regexp","/a/"], + ["text"," "], + ["identifier","jk"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["string.regexp","/ /"], + ["text"," "], + ["keyword.operator","/"], + ["text"," "], + ["string.regexp","/ /"] +],[ + "no_regex", + ["text"," "], + ["comment.doc","/************************************/"] +],[ + "no_regex", + ["comment.doc","/** total mess, tricky to highlight**/"] +],[ + "no_regex" +],[ + "start", + ["storage.type","function"], + ["text"," "], + ["paren.lparen","("], + ["paren.rparen",")"], + ["text"," "], + ["paren.lparen","{"] +],[ + "doc-start", + ["text","\t"], + ["comment.doc","/**"] +],[ + "doc-start", + ["comment.doc","\t * docComment"] +],[ + "no_regex", + ["comment.doc","\t **/"] +],[ + "no_regex", + ["text","\t"], + ["identifier","r"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["string.regexp","/u"], + ["regexp.keyword.operator","\\t"], + ["constant.language.escape","*"], + ["string.regexp","/"] +],[ + "no_regex", + ["text","\t"], + ["identifier","g"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["constant.numeric","1."], + ["text","00"], + ["identifier","E"], + ["text","^"], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["text"," "], + ["identifier","y"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["constant.numeric","1.2"], + ["text"," "], + ["keyword.operator","+"], + ["text"," "], + ["punctuation.operator","."], + ["constant.numeric","2"], + ["text"," "], + ["keyword.operator","+"], + ["text"," "], + ["constant.numeric","052"], + ["text"," "], + ["keyword.operator","+"], + ["text"," "], + ["constant.numeric","0x25"] +],[ + "no_regex", + ["text","\t"], + ["identifier","t"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["paren.lparen","["], + ["string","'d'"], + ["punctuation.operator",","], + ["text"," "], + ["string","''"], + ["paren.rparen","]"] +],[ + "no_regex", + ["paren.rparen","}"] +],[ + "start", + ["storage.type","function"], + ["text"," "], + ["paren.lparen","("], + ["paren.rparen",")"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text","\t"], + ["comment","/* eee */"] +],[ + "no_regex", + ["paren.rparen","}"] +],[ + "no_regex" +],[ + "qqstring", + ["string","\"s\\"] +],[ + "no_regex", + ["string","s"], + ["constant.language.escape","\\u7824"], + ["string","sss"], + ["constant.language.escape","\\u"], + ["string","1\""] +],[ + "no_regex" +],[ + "qstring", + ["string","'\\"] +],[ + "no_regex", + ["string","string'"] +],[ + "no_regex" +],[ + "no_regex", + ["text","'"] +],[ + "no_regex", + ["identifier","string"], + ["text","'"] +],[ + "no_regex" +],[ + "no_regex", + ["string","\"trailing space"], + ["constant.language.escape","\\ "], + ["string"," "] +],[ + "no_regex", + ["string","\" \""], + ["text"," "], + ["keyword.operator","/"], + ["identifier","not"], + ["text"," "], + ["identifier","a"], + ["text"," "], + ["identifier","regexp"], + ["keyword.operator","/"], + ["identifier","g"] +],[ + "no_regex" +],[ + "doc-start", + ["comment.doc","/**"] +],[ + "doc-start", + ["comment.doc"," *doc"] +],[ + "no_regex", + ["comment.doc"," */"] +],[ + "no_regex" +],[ + "start", + ["identifier","a"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text","\t"], + ["string","'a'"], + ["punctuation.operator",":"], + ["text"," "], + ["identifier","b"], + ["punctuation.operator",","] +],[ + "no_regex", + ["text","\t"], + ["string","'g'"], + ["text",":"], + ["text"," "], + ["storage.type","function"], + ["paren.lparen","("], + ["variable.parameter","t"], + ["paren.rparen",")"] +],[ + "no_regex", + ["text","\t"], + ["entity.name.function","gta"], + ["punctuation.operator",":"], + ["storage.type","function"], + ["paren.lparen","("], + ["variable.parameter","a"], + ["punctuation.operator",","], + ["variable.parameter","b"], + ["paren.rparen",")"] +],[ + "no_regex", + ["paren.rparen","}"] +],[ + "no_regex" +],[ + "no_regex" +],[ + "function_arguments", + ["identifier","foo"], + ["punctuation.operator","."], + ["storage.type","protoype"], + ["punctuation.operator","."], + ["entity.name.function","d"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["storage.type","function"], + ["paren.lparen","("], + ["variable.parameter","a"], + ["punctuation.operator",", "], + ["variable.parameter","b"], + ["punctuation.operator",","] +],[ + "no_regex", + ["punctuation.operator"," "], + ["variable.parameter","c"], + ["punctuation.operator",", "], + ["variable.parameter","d"], + ["paren.rparen",")"] +],[ + "no_regex", + ["storage.type","foo"], + ["punctuation.operator","."], + ["entity.name.function","d"], + ["text"," "], + ["keyword.operator","="], + ["storage.type","function"], + ["paren.lparen","("], + ["variable.parameter","a"], + ["punctuation.operator",", "], + ["variable.parameter","b"], + ["paren.rparen",")"] +],[ + "no_regex", + ["storage.type","foo"], + ["punctuation.operator","."], + ["entity.name.function","d"], + ["text"," "], + ["keyword.operator","="], + ["storage.type","function"], + ["paren.lparen","("], + ["variable.parameter","a"], + ["punctuation.operator",", "], + ["comment.doc","/*****/"], + ["text"," "], + ["identifier","d"], + ["string","\"string\""], + ["text"," "] +],[ + "no_regex" +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_json.json b/addons/editor/ace/mode/_test/tokens_json.json new file mode 100755 index 00000000..4420a740 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_json.json @@ -0,0 +1,412 @@ +[[ + "start", + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["variable","\"query\""], + ["text",": "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["variable","\"count\""], + ["text",": "], + ["constant.numeric","10"], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"created\""], + ["text",": "], + ["string","\"2011-06-21T08:10:46Z\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"lang\""], + ["text",": "], + ["string","\"en-US\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"results\""], + ["text",": "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["variable","\"photo\""], + ["text",": "], + ["paren.lparen","["] +],[ + "start", + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["variable","\"farm\""], + ["text",": "], + ["string","\"6\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"id\""], + ["text",": "], + ["string","\"5855620975\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"isfamily\""], + ["text",": "], + ["string","\"0\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"isfriend\""], + ["text",": "], + ["string","\"0\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"ispublic\""], + ["text",": "], + ["string","\"1\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"owner\""], + ["text",": "], + ["string","\"32021554@N04\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"secret\""], + ["text",": "], + ["string","\"f1f5e8515d\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"server\""], + ["text",": "], + ["string","\"5110\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"title\""], + ["text",": "], + ["string","\"7087 bandit cat\""] +],[ + "start", + ["text"," "], + ["paren.rparen","}"], + ["text",","] +],[ + "start", + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["variable","\"farm\""], + ["text",": "], + ["string","\"4\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"id\""], + ["text",": "], + ["string","\"5856170534\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"isfamily\""], + ["text",": "], + ["string","\"0\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"isfriend\""], + ["text",": "], + ["string","\"0\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"ispublic\""], + ["text",": "], + ["string","\"1\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"owner\""], + ["text",": "], + ["string","\"32021554@N04\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"secret\""], + ["text",": "], + ["string","\"ff1efb2a6f\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"server\""], + ["text",": "], + ["string","\"3217\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"title\""], + ["text",": "], + ["string","\"6975 rusty cat\""] +],[ + "start", + ["text"," "], + ["paren.rparen","}"], + ["text",","] +],[ + "start", + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["variable","\"farm\""], + ["text",": "], + ["string","\"6\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"id\""], + ["text",": "], + ["string","\"5856172972\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"isfamily\""], + ["text",": "], + ["string","\"0\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"isfriend\""], + ["text",": "], + ["string","\"0\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"ispublic\""], + ["text",": "], + ["string","\"1\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"owner\""], + ["text",": "], + ["string","\"51249875@N03\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"secret\""], + ["text",": "], + ["string","\"6c6887347c\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"server\""], + ["text",": "], + ["string","\"5192\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"title\""], + ["text",": "], + ["string","\"watermarked-cats\""] +],[ + "start", + ["text"," "], + ["paren.rparen","}"], + ["text",","] +],[ + "start", + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["variable","\"farm\""], + ["text",": "], + ["string","\"6\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"id\""], + ["text",": "], + ["string","\"5856168328\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"isfamily\""], + ["text",": "], + ["string","\"0\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"isfriend\""], + ["text",": "], + ["string","\"0\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"ispublic\""], + ["text",": "], + ["string","\"1\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"owner\""], + ["text",": "], + ["string","\"32021554@N04\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"secret\""], + ["text",": "], + ["string","\"0c1cfdf64c\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"server\""], + ["text",": "], + ["string","\"5078\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"title\""], + ["text",": "], + ["string","\"7020 mandy cat\""] +],[ + "start", + ["text"," "], + ["paren.rparen","}"], + ["text",","] +],[ + "start", + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["variable","\"farm\""], + ["text",": "], + ["string","\"3\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"id\""], + ["text",": "], + ["string","\"5856171774\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"isfamily\""], + ["text",": "], + ["string","\"0\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"isfriend\""], + ["text",": "], + ["string","\"0\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"ispublic\""], + ["text",": "], + ["string","\"1\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"owner\""], + ["text",": "], + ["string","\"32021554@N04\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"secret\""], + ["text",": "], + ["string","\"7f5a3180ab\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"server\""], + ["text",": "], + ["string","\"2696\""], + ["text",","] +],[ + "start", + ["text"," "], + ["variable","\"title\""], + ["text",": "], + ["string","\"7448 bobby cat\""] +],[ + "start", + ["text"," "], + ["paren.rparen","}"] +],[ + "start", + ["text"," "], + ["paren.rparen","]"] +],[ + "start", + ["text"," "], + ["paren.rparen","}"] +],[ + "start", + ["text"," "], + ["paren.rparen","}"] +],[ + "start", + ["paren.rparen","}"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_jsp.json b/addons/editor/ace/mode/_test/tokens_jsp.json new file mode 100755 index 00000000..cd556e46 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_jsp.json @@ -0,0 +1,435 @@ +[[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","html"], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","body"], + ["meta.tag.punctuation.end",">"] +],[ + "js-start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.script","script"], + ["meta.tag.punctuation.end",">"] +],[ + "js-start", + ["text"," "], + ["storage.type","var"], + ["text"," "], + ["identifier","x"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["string","\"abc\""], + ["punctuation.operator",";"] +],[ + "js-start", + ["text"," "], + ["storage.type","function"], + ["text"," "], + ["identifier","y"], + ["text"," "], + ["paren.lparen","{"] +],[ + "js-no_regex", + ["text"," "], + ["paren.rparen","}"] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin",""] +],[ + "css-start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.style","style"], + ["meta.tag.punctuation.end",">"] +],[ + ["css-ruleset","css-start"], + ["text"," "], + ["variable",".class"], + ["text"," "], + ["paren.lparen","{"] +],[ + ["css-ruleset","css-start"], + ["text"," "], + ["support.type","background"], + ["text",": "], + ["constant.numeric","#124356"], + ["text",";"] +],[ + "css-start", + ["text"," "], + ["paren.rparen","}"] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin",""] +],[ + "start" +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","p"], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text"," Today's date: "], + ["meta.tag","<%"], + ["keyword.operator","="], + ["text"," "], + ["lparen","("], + ["keyword","new"], + ["text"," "], + ["identifier","java"], + ["text","."], + ["identifier","util"], + ["text","."], + ["identifier","Date"], + ["lparen","("], + ["rparen","))"], + ["text","."], + ["identifier","toLocaleString"], + ["lparen","("], + ["rparen",")"], + ["meta.tag","%>"] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text"," "], + ["meta.tag","<%"], + ["keyword.operator","!"], + ["text"," "], + ["keyword","int"], + ["text"," "], + ["identifier","i"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["constant.numeric","0"], + ["text","; "], + ["meta.tag","%>"] +],[ + "jsp-start", + ["text"," "], + ["meta.tag",""] +],[ + "jsp-start", + ["text"," "], + ["keyword","int"], + ["text"," "], + ["identifier","j"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["constant.numeric","10"], + ["text",";"] +],[ + "start", + ["text"," "], + ["meta.tag",""] +],[ + "start" +],[ + "start", + ["text"," "], + ["comment","<%-- This is JSP comment --%>"] +],[ + "start", + ["text"," "], + ["meta.tag","<%@"], + ["text"," "], + ["identifier","directive"], + ["text"," "], + ["identifier","attribute"], + ["keyword.operator","="], + ["string","\"value\""], + ["text"," "], + ["meta.tag","%>"] +],[ + "start" +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","h2"], + ["meta.tag.punctuation.end",">"], + ["text","Select Languages:"], + ["meta.tag.punctuation.begin",""] +],[ + "start" +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.form","form"], + ["text"," "], + ["entity.other.attribute-name","ACTION"], + ["keyword.operator.separator","="], + ["string","\"jspCheckBox.jsp\""], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.form","input"], + ["text"," "], + ["entity.other.attribute-name","type"], + ["keyword.operator.separator","="], + ["string","\"checkbox\""], + ["text"," "], + ["entity.other.attribute-name","name"], + ["keyword.operator.separator","="], + ["string","\"id\""], + ["text"," "], + ["entity.other.attribute-name","value"], + ["keyword.operator.separator","="], + ["string","\"Java\""], + ["meta.tag.punctuation.end",">"], + ["text"," Java"], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","BR"], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.form","input"], + ["text"," "], + ["entity.other.attribute-name","type"], + ["keyword.operator.separator","="], + ["string","\"checkbox\""], + ["text"," "], + ["entity.other.attribute-name","name"], + ["keyword.operator.separator","="], + ["string","\"id\""], + ["text"," "], + ["entity.other.attribute-name","value"], + ["keyword.operator.separator","="], + ["string","\".NET\""], + ["meta.tag.punctuation.end",">"], + ["text"," .NET"], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","BR"], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.form","input"], + ["text"," "], + ["entity.other.attribute-name","type"], + ["keyword.operator.separator","="], + ["string","\"checkbox\""], + ["text"," "], + ["entity.other.attribute-name","name"], + ["keyword.operator.separator","="], + ["string","\"id\""], + ["text"," "], + ["entity.other.attribute-name","value"], + ["keyword.operator.separator","="], + ["string","\"PHP\""], + ["meta.tag.punctuation.end",">"], + ["text"," PHP"], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","BR"], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.form","input"], + ["text"," "], + ["entity.other.attribute-name","type"], + ["keyword.operator.separator","="], + ["string","\"checkbox\""], + ["text"," "], + ["entity.other.attribute-name","name"], + ["keyword.operator.separator","="], + ["string","\"id\""], + ["text"," "], + ["entity.other.attribute-name","value"], + ["keyword.operator.separator","="], + ["string","\"C/C++\""], + ["meta.tag.punctuation.end",">"], + ["text"," C/C++"], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","BR"], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.form","input"], + ["text"," "], + ["entity.other.attribute-name","type"], + ["keyword.operator.separator","="], + ["string","\"checkbox\""], + ["text"," "], + ["entity.other.attribute-name","name"], + ["keyword.operator.separator","="], + ["string","\"id\""], + ["text"," "], + ["entity.other.attribute-name","value"], + ["keyword.operator.separator","="], + ["string","\"PERL\""], + ["meta.tag.punctuation.end",">"], + ["text"," PERL "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","BR"], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.form","input"], + ["text"," "], + ["entity.other.attribute-name","type"], + ["keyword.operator.separator","="], + ["string","\"submit\""], + ["text"," "], + ["entity.other.attribute-name","value"], + ["keyword.operator.separator","="], + ["string","\"Submit\""], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin",""] +],[ + "start" +],[ + "jsp-start", + ["text"," "], + ["meta.tag","<%"] +],[ + "jsp-start", + ["text"," "], + ["support.function","String"], + ["text"," "], + ["identifier","select"], + ["lparen","["], + ["rparen","]"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["variable.language","request"], + ["text","."], + ["identifier","getParameterValues"], + ["lparen","("], + ["string","\"id\""], + ["rparen",")"], + ["text","; "] +],[ + "jsp-start", + ["text"," "], + ["keyword","if"], + ["text"," "], + ["lparen","("], + ["identifier","select"], + ["text"," "], + ["keyword.operator","!="], + ["text"," "], + ["constant.language","null"], + ["text"," "], + ["keyword.operator","&&"], + ["text"," "], + ["identifier","select"], + ["text","."], + ["identifier","length"], + ["text"," "], + ["keyword.operator","!="], + ["text"," "], + ["constant.numeric","0"], + ["rparen",")"], + ["text"," "], + ["lparen","{"] +],[ + "jsp-start", + ["text"," "], + ["variable.language","out"], + ["text","."], + ["identifier","println"], + ["lparen","("], + ["string","\"You have selected: \""], + ["rparen",")"], + ["text",";"] +],[ + "jsp-start", + ["text"," "], + ["keyword","for"], + ["text"," "], + ["lparen","("], + ["keyword","int"], + ["text"," "], + ["identifier","i"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["constant.numeric","0"], + ["text","; "], + ["identifier","i"], + ["text"," "], + ["keyword.operator","<"], + ["text"," "], + ["identifier","select"], + ["text","."], + ["identifier","length"], + ["text","; "], + ["identifier","i"], + ["keyword.operator","++"], + ["rparen",")"], + ["text"," "], + ["lparen","{"] +],[ + "jsp-start", + ["text"," "], + ["variable.language","out"], + ["text","."], + ["identifier","println"], + ["lparen","("], + ["identifier","select"], + ["lparen","["], + ["identifier","i"], + ["rparen","])"], + ["text","; "] +],[ + "jsp-start", + ["text"," "], + ["rparen","}"] +],[ + "jsp-start", + ["text"," "], + ["rparen","}"] +],[ + "start", + ["text"," "], + ["meta.tag","%>"] +],[ + "start", + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["meta.tag.punctuation.begin",""] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_jsx.json b/addons/editor/ace/mode/_test/tokens_jsx.json new file mode 100755 index 00000000..d1a740b0 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_jsx.json @@ -0,0 +1,51 @@ +[[ + "comment", + ["comment","/*EXPECTED"] +],[ + "comment", + ["comment","hello world!"] +],[ + "start", + ["comment","*/"] +],[ + "start", + ["keyword","class"], + ["text"," "], + ["language.support.class","Test"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["keyword","static"], + ["text"," "], + ["storage.type","function"], + ["text"," "], + ["entity.name.function","run"], + ["paren.lparen","("], + ["paren.rparen",")"], + ["text"," "], + ["punctuation.operator",":"], + ["text"," "], + ["keyword","void"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["comment","// console.log(\"hello world!\");"] +],[ + "start", + ["text"," "], + ["keyword","log"], + ["text"," "], + ["string","\"hello world!\""], + ["punctuation.operator",";"] +],[ + "start", + ["text"," "], + ["paren.rparen","}"] +],[ + "start", + ["paren.rparen","}"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_julia.json b/addons/editor/ace/mode/_test/tokens_julia.json new file mode 100755 index 00000000..f4ce4eab --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_julia.json @@ -0,0 +1,105 @@ +[[ + "start", + ["keyword.control.julia","for"], + ["text"," op "], + ["keyword.operator.update.julia","="], + ["text"," ("], + ["keyword.operator.ternary.julia",":"], + ["keyword.operator.arithmetic.julia","+"], + ["text",", "], + ["keyword.operator.ternary.julia",":"], + ["keyword.operator.arithmetic.julia","*"], + ["text",", "], + ["keyword.operator.ternary.julia",":"], + ["keyword.operator.bitwise.julia","&"], + ["text",", "], + ["keyword.operator.ternary.julia",":"], + ["keyword.operator.bitwise.julia","|"], + ["text",", "], + ["keyword.operator.ternary.julia",":"], + ["keyword.operator.interpolation.julia","$"], + ["text",")"] +],[ + "start", + ["text"," "], + ["variable.macro.julia","@eval"], + ["text"," ("], + ["keyword.operator.interpolation.julia","$"], + ["text","op)(a,b,c) "], + ["keyword.operator.update.julia","="], + ["text"," ("], + ["keyword.operator.interpolation.julia","$"], + ["text","op)(("], + ["keyword.operator.interpolation.julia","$"], + ["text","op)(a,b),c)"] +],[ + "start", + ["keyword.control.julia","end"] +],[ + "start" +],[ + "start" +],[ + "start", + ["keyword.other.julia","function"], + ["meta.function.julia"," "], + ["entity.name.function.julia","g"], + ["text","("], + ["text","x,y)"] +],[ + "start", + ["text"," "], + ["keyword.control.julia","return"], + ["text"," x "], + ["keyword.operator.arithmetic.julia","*"], + ["text"," y"] +],[ + "start", + ["text"," x "], + ["keyword.operator.arithmetic.julia","+"], + ["text"," y"] +],[ + "start", + ["keyword.control.julia","end"] +],[ + "start" +],[ + "start", + ["support.function.julia","cd"], + ["text","("], + ["punctuation.definition.string.begin.julia","\""], + ["string.quoted.double.julia","data"], + ["punctuation.definition.string.end.julia","\""], + ["text",") "], + ["keyword.control.julia","do"] +],[ + "start", + ["text"," "], + ["support.function.julia","open"], + ["text","("], + ["punctuation.definition.string.begin.julia","\""], + ["string.quoted.double.julia","outfile"], + ["punctuation.definition.string.end.julia","\""], + ["text",", "], + ["punctuation.definition.string.begin.julia","\""], + ["string.quoted.double.julia","w"], + ["punctuation.definition.string.end.julia","\""], + ["text",") "], + ["keyword.control.julia","do"], + ["text"," f"] +],[ + "start", + ["text"," "], + ["support.function.julia","write"], + ["text","("], + ["text","f, data)"] +],[ + "start", + ["text"," "], + ["keyword.control.julia","end"] +],[ + "start", + ["keyword.control.julia","end"] +],[ + "start" +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_latex.json b/addons/editor/ace/mode/_test/tokens_latex.json new file mode 100755 index 00000000..0ac37725 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_latex.json @@ -0,0 +1,127 @@ +[[ + "start", + ["keyword","\\usepackage"], + ["lparen","{"], + ["text","amsmath"], + ["rparen","}"] +],[ + "start", + ["keyword","\\title"], + ["lparen","{"], + ["keyword","\\LaTeX"], + ["rparen","}"] +],[ + "start", + ["keyword","\\date"], + ["lparen","{"], + ["rparen","}"] +],[ + "start", + ["keyword","\\begin"], + ["lparen","{"], + ["text","document"], + ["rparen","}"] +],[ + "start", + ["text"," "], + ["keyword","\\maketitle"] +],[ + "start", + ["text"," "], + ["keyword","\\LaTeX"], + ["lparen","{"], + ["rparen","}"], + ["text"," is a document preparation system for the "], + ["keyword","\\TeX"], + ["lparen","{"], + ["rparen","}"] +],[ + "start", + ["text"," typesetting program. It offers programmable desktop publishing"] +],[ + "start", + ["text"," features and extensive facilities for automating most aspects of"] +],[ + "start", + ["text"," typesetting and desktop publishing, including numbering and"] +],[ + "start", + ["text"," cross-referencing, tables and figures, page layout, bibliographies,"] +],[ + "start", + ["text"," and much more. "], + ["keyword","\\LaTeX"], + ["lparen","{"], + ["rparen","}"], + ["text"," was originally written in 1984 by Leslie"] +],[ + "start", + ["text"," Lamport and has become the dominant method for using "], + ["keyword","\\TeX"], + ["text","; few"] +],[ + "start", + ["text"," people write in plain "], + ["keyword","\\TeX"], + ["lparen","{"], + ["rparen","}"], + ["text"," anymore. The current version is"] +],[ + "start", + ["text"," "], + ["keyword","\\LaTeXe"], + ["text","."] +],[ + "start", + ["text"," "] +],[ + "start", + ["text"," "], + ["comment","% This is a comment; it will not be shown in the final output."] +],[ + "start", + ["text"," "], + ["comment","% The following shows a little of the typesetting power of LaTeX:"] +],[ + "start", + ["text"," "], + ["keyword","\\begin"], + ["lparen","{"], + ["text","align"], + ["rparen","}"] +],[ + "start", + ["text"," E &= mc^2 "], + ["keyword","\\\\"] +],[ + "start", + ["text"," m &= "], + ["keyword","\\frac"], + ["lparen","{"], + ["text","m_0"], + ["rparen","}"], + ["lparen","{"], + ["keyword","\\sqrt"], + ["lparen","{"], + ["text","1-"], + ["keyword","\\frac"], + ["lparen","{"], + ["text","v^2"], + ["rparen","}"], + ["lparen","{"], + ["text","c^2"], + ["rparen","}}}"] +],[ + "start", + ["text"," "], + ["keyword","\\end"], + ["lparen","{"], + ["text","align"], + ["rparen","}"] +],[ + "start", + ["keyword","\\end"], + ["lparen","{"], + ["text","document"], + ["rparen","}"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_less.json b/addons/editor/ace/mode/_test/tokens_less.json new file mode 100755 index 00000000..81fe0c20 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_less.json @@ -0,0 +1,204 @@ +[[ + "start", + ["comment","/* styles.less */"] +],[ + "start" +],[ + "start", + ["variable","@base"], + ["text",": "], + ["constant.numeric","#f938ab"], + ["text",";"] +],[ + "start" +],[ + "start", + ["variable.language",".box-shadow"], + ["paren.lparen","("], + ["variable","@style"], + ["text",", "], + ["variable","@c"], + ["paren.rparen",")"], + ["text"," "], + ["keyword","when"], + ["text"," "], + ["paren.lparen","("], + ["support.function","iscolor"], + ["paren.lparen","("], + ["variable","@c"], + ["paren.rparen","))"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," box-shadow: "], + ["variable","@style"], + ["text"," "], + ["variable","@c"], + ["text",";"] +],[ + "start", + ["text"," -webkit-box-shadow: "], + ["variable","@style"], + ["text"," "], + ["variable","@c"], + ["text",";"] +],[ + "start", + ["text"," -moz-box-shadow: "], + ["variable","@style"], + ["text"," "], + ["variable","@c"], + ["text",";"] +],[ + "start", + ["paren.rparen","}"] +],[ + "start", + ["variable.language",".box-shadow"], + ["paren.lparen","("], + ["variable","@style"], + ["text",", "], + ["variable","@alpha"], + ["text",": "], + ["constant.numeric","50%"], + ["paren.rparen",")"], + ["text"," "], + ["keyword","when"], + ["text"," "], + ["paren.lparen","("], + ["support.function","isnumber"], + ["paren.lparen","("], + ["variable","@alpha"], + ["paren.rparen","))"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["variable.language",".box-shadow"], + ["paren.lparen","("], + ["variable","@style"], + ["text",", "], + ["support.function","rgba"], + ["paren.lparen","("], + ["constant.numeric","0"], + ["text",", "], + ["constant.numeric","0"], + ["text",", "], + ["constant.numeric","0"], + ["text",", "], + ["variable","@alpha"], + ["paren.rparen","))"], + ["text",";"] +],[ + "start", + ["paren.rparen","}"] +],[ + "start" +],[ + "start", + ["comment","// Box styles"] +],[ + "start", + ["variable.language",".box"], + ["text"," "], + ["paren.lparen","{"], + ["text"," "] +],[ + "start", + ["text"," "], + ["support.type","color"], + ["text",": "], + ["support.function","saturate"], + ["paren.lparen","("], + ["variable","@base"], + ["text",", "], + ["constant.numeric","5%"], + ["paren.rparen",")"], + ["text",";"] +],[ + "start", + ["text"," "], + ["support.type","border-color"], + ["text",": "], + ["support.function","lighten"], + ["paren.lparen","("], + ["variable","@base"], + ["text",", "], + ["constant.numeric","30%"], + ["paren.rparen",")"], + ["text",";"] +],[ + "start", + ["text"," "] +],[ + "start", + ["text"," "], + ["variable.language","div"], + ["text"," "], + ["paren.lparen","{"], + ["text"," "], + ["variable.language",".box-shadow"], + ["paren.lparen","("], + ["constant.numeric","0"], + ["text"," "], + ["constant.numeric","0"], + ["text"," "], + ["constant.numeric","5px"], + ["text",", "], + ["constant.numeric","30%"], + ["paren.rparen",")"], + ["text"," "], + ["paren.rparen","}"] +],[ + "start", + ["text"," "] +],[ + "start", + ["text"," "], + ["variable.language","a"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["support.type","color"], + ["text",": "], + ["variable","@base"], + ["text",";"] +],[ + "start", + ["text"," "] +],[ + "start", + ["text"," &"], + ["variable.language",":hover"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["support.type","color"], + ["text",": "], + ["support.function","lighten"], + ["paren.lparen","("], + ["variable","@base"], + ["text",", "], + ["constant.numeric","50%"], + ["paren.rparen",")"], + ["text",";"] +],[ + "start", + ["text"," "], + ["paren.rparen","}"] +],[ + "start", + ["text"," "], + ["paren.rparen","}"] +],[ + "start", + ["paren.rparen","}"] +],[ + "start" +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_liquid.json b/addons/editor/ace/mode/_test/tokens_liquid.json new file mode 100755 index 00000000..a87c051d --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_liquid.json @@ -0,0 +1,551 @@ +[[ + "start", + ["text","The following examples can be found in full at http://liquidmarkup.org/"] +],[ + "start" +],[ + "start", + ["text","Liquid is an extraction from the e-commerce system Shopify."] +],[ + "start", + ["text","Shopify powers many thousands of e-commerce stores which all call for unique designs."] +],[ + "start", + ["text","For this we developed Liquid which allows our customers complete design freedom while"] +],[ + "start", + ["text","maintaining the integrity of our servers."] +],[ + "start" +],[ + "start", + ["text","Liquid has been in production use since June 2006 and is now used by many other"] +],[ + "start", + ["text","hosted web applications."] +],[ + "start" +],[ + "start", + ["text","It was developed for usage in Ruby on Rails web applications and integrates seamlessly"] +],[ + "start", + ["text","as a plugin but it also works excellently as a stand alone library."] +],[ + "start" +],[ + "start", + ["text","Here's what it looks like:"] +],[ + "start" +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","ul"], + ["text"," "], + ["entity.other.attribute-name","id"], + ["keyword.operator.separator","="], + ["string","\"products\""], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text"," "], + ["variable","{%"], + ["text"," "], + ["keyword","for"], + ["text"," "], + ["identifier","product"], + ["text"," "], + ["keyword","in"], + ["text"," "], + ["identifier","products"], + ["text"," "], + ["variable","%}"] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","li"], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","h2"], + ["meta.tag.punctuation.end",">"], + ["variable","{{"], + ["text"," "], + ["identifier","product"], + ["text","."], + ["identifier","title"], + ["text"," "], + ["variable","}}"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text"," Only "], + ["variable","{{"], + ["text"," "], + ["identifier","product"], + ["text","."], + ["identifier","price"], + ["text"," | "], + ["identifier","format_as_money"], + ["text"," "], + ["variable","}}"] +],[ + "start" +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","p"], + ["meta.tag.punctuation.end",">"], + ["variable","{{"], + ["text"," "], + ["identifier","product"], + ["text","."], + ["identifier","description"], + ["text"," | "], + ["identifier","prettyprint"], + ["text"," | "], + ["support.function","truncate"], + ["text",": "], + ["constant.numeric","200"], + ["text"," "], + ["variable","}}"], + ["meta.tag.punctuation.begin",""] +],[ + "start" +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text"," "], + ["variable","{%"], + ["text"," "], + ["keyword","endfor"], + ["text"," "], + ["variable","%}"] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin",""] +],[ + "start" +],[ + "start" +],[ + "start", + ["text","Some more features include:"] +],[ + "start" +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","h2"], + ["meta.tag.punctuation.end",">"], + ["text","Filters"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","p"], + ["meta.tag.punctuation.end",">"], + ["text"," The word \"tobi\" in uppercase: "], + ["variable","{{"], + ["text"," "], + ["string","'tobi'"], + ["text"," | "], + ["support.function","upcase"], + ["text"," "], + ["variable","}}"], + ["text"," "], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","p"], + ["meta.tag.punctuation.end",">"], + ["text","The word \"tobi\" has "], + ["variable","{{"], + ["text"," "], + ["string","'tobi'"], + ["text"," | "], + ["support.function","size"], + ["text"," "], + ["variable","}}"], + ["text"," letters! "], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","p"], + ["meta.tag.punctuation.end",">"], + ["text","Change \"Hello world\" to \"Hi world\": "], + ["variable","{{"], + ["text"," "], + ["string","'Hello world'"], + ["text"," | "], + ["support.function","replace"], + ["text",": "], + ["string","'Hello'"], + ["text",", "], + ["string","'Hi'"], + ["text"," "], + ["variable","}}"], + ["text"," "], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","p"], + ["meta.tag.punctuation.end",">"], + ["text","The date today is "], + ["variable","{{"], + ["text"," "], + ["string","'now'"], + ["text"," | "], + ["support.function","date"], + ["text",": "], + ["string","\"%Y %b %d\""], + ["text"," "], + ["variable","}}"], + ["text"," "], + ["meta.tag.punctuation.begin",""] +],[ + "start" +],[ + "start" +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","h2"], + ["meta.tag.punctuation.end",">"], + ["text","If"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","p"], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text"," "], + ["variable","{%"], + ["text"," "], + ["keyword","if"], + ["text"," "], + ["identifier","user"], + ["text","."], + ["identifier","name"], + ["text"," "], + ["keyword.operator","=="], + ["text"," "], + ["string","'tobi'"], + ["text"," "], + ["identifier","or"], + ["text"," "], + ["identifier","user"], + ["text","."], + ["identifier","name"], + ["text"," "], + ["keyword.operator","=="], + ["text"," "], + ["string","'marc'"], + ["text"," "], + ["variable","%}"], + ["text"," "] +],[ + "start", + ["text"," hi marc or tobi"] +],[ + "start", + ["text"," "], + ["variable","{%"], + ["text"," "], + ["keyword","endif"], + ["text"," "], + ["variable","%}"] +],[ + "start", + ["meta.tag.punctuation.begin",""] +],[ + "start" +],[ + "start" +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","h2"], + ["meta.tag.punctuation.end",">"], + ["text","Case"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","p"], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text"," "], + ["variable","{%"], + ["text"," "], + ["keyword","case"], + ["text"," "], + ["identifier","template"], + ["text"," "], + ["variable","%}"] +],[ + "start", + ["text"," "], + ["variable","{%"], + ["text"," "], + ["keyword","when"], + ["text"," "], + ["string","'index'"], + ["text"," "], + ["variable","%}"] +],[ + "start", + ["text"," Welcome"] +],[ + "start", + ["text"," "], + ["variable","{%"], + ["text"," "], + ["keyword","when"], + ["text"," "], + ["string","'product'"], + ["text"," "], + ["variable","%}"] +],[ + "start", + ["text"," "], + ["variable","{{"], + ["text"," "], + ["identifier","product"], + ["text","."], + ["identifier","vendor"], + ["text"," | "], + ["identifier","link_to_vendor"], + ["text"," "], + ["variable","}}"], + ["text"," / "], + ["variable","{{"], + ["text"," "], + ["identifier","product"], + ["text","."], + ["identifier","title"], + ["text"," "], + ["variable","}}"] +],[ + "start", + ["text"," "], + ["variable","{%"], + ["text"," "], + ["keyword","else"], + ["text"," "], + ["variable","%}"] +],[ + "start", + ["text"," "], + ["variable","{{"], + ["text"," "], + ["identifier","page_title"], + ["text"," "], + ["variable","}}"] +],[ + "start", + ["text"," "], + ["variable","{%"], + ["text"," "], + ["keyword","endcase"], + ["text"," "], + ["variable","%}"] +],[ + "start", + ["meta.tag.punctuation.begin",""] +],[ + "start" +],[ + "start" +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","h2"], + ["meta.tag.punctuation.end",">"], + ["text","For Loops"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","p"], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text"," "], + ["variable","{%"], + ["text"," "], + ["keyword","for"], + ["text"," "], + ["identifier","item"], + ["text"," "], + ["keyword","in"], + ["text"," "], + ["identifier","array"], + ["text"," "], + ["variable","%}"], + ["text"," "] +],[ + "start", + ["text"," "], + ["variable","{{"], + ["text"," "], + ["identifier","item"], + ["text"," "], + ["variable","}}"] +],[ + "start", + ["text"," "], + ["variable","{%"], + ["text"," "], + ["keyword","endfor"], + ["text"," "], + ["variable","%}"] +],[ + "start", + ["meta.tag.punctuation.begin",""] +],[ + "start" +],[ + "start" +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","h2"], + ["meta.tag.punctuation.end",">"], + ["text","Tables"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","p"], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text"," "], + ["variable","{%"], + ["text"," "], + ["keyword","tablerow"], + ["text"," "], + ["identifier","item"], + ["text"," "], + ["keyword","in"], + ["text"," "], + ["identifier","items"], + ["text"," "], + ["identifier","cols"], + ["text",": "], + ["constant.numeric","3"], + ["text"," "], + ["variable","%}"] +],[ + "start", + ["text"," "], + ["variable","{%"], + ["text"," "], + ["keyword","if"], + ["text"," "], + ["variable.language","tablerowloop"], + ["text","."], + ["identifier","col_first"], + ["text"," "], + ["variable","%}"] +],[ + "start", + ["text"," First column: "], + ["variable","{{"], + ["text"," "], + ["identifier","item"], + ["text","."], + ["identifier","variable"], + ["text"," "], + ["variable","}}"] +],[ + "start", + ["text"," "], + ["variable","{%"], + ["text"," "], + ["keyword","else"], + ["text"," "], + ["variable","%}"] +],[ + "start", + ["text"," Different column: "], + ["variable","{{"], + ["text"," "], + ["identifier","item"], + ["text","."], + ["identifier","variable"], + ["text"," "], + ["variable","}}"] +],[ + "start", + ["text"," "], + ["variable","{%"], + ["text"," "], + ["keyword","endif"], + ["text"," "], + ["variable","%}"] +],[ + "start", + ["text"," "], + ["variable","{%"], + ["text"," "], + ["keyword","endtablerow"], + ["text"," "], + ["variable","%}"] +],[ + "start", + ["meta.tag.punctuation.begin",""] +],[ + "start" +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_lisp.json b/addons/editor/ace/mode/_test/tokens_lisp.json new file mode 100755 index 00000000..2e70a555 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_lisp.json @@ -0,0 +1,248 @@ +[[ + "start", + ["text","("], + ["storage.type.function-type.lisp","defun"], + ["text"," "], + ["entity.name.function.lisp","prompt-for-cd"], + ["text"," ()"] +],[ + "start", + ["text"," "], + ["string","\"Prompts"] +],[ + "start", + ["text"," "], + ["identifier","for"], + ["text"," "], + ["identifier","CD"], + ["text","\""] +],[ + "start", + ["text"," ("], + ["identifier","prompt"], + ["text","-"], + ["identifier","read"], + ["text"," "], + ["string","\"Title\""], + ["text"," "], + ["constant.numeric","1.53"], + ["text"," "], + ["constant.numeric","1"], + ["text"," "], + ["constant.numeric","2"], + ["text","/"], + ["constant.numeric","4"], + ["text"," "], + ["constant.numeric","1.7"], + ["text"," "], + ["constant.numeric","1.7e0"], + ["text"," "], + ["constant.numeric","2.9E-4"], + ["text"," "], + ["constant.numeric","+42"], + ["text"," "], + ["constant.numeric","-7"], + ["text"," "], + ["punctuation.definition.constant.character.lisp","#"], + ["constant.character.lisp","b001"], + ["text"," "], + ["punctuation.definition.constant.character.lisp","#"], + ["constant.character.lisp","b001/100"], + ["text"," "], + ["punctuation.definition.constant.character.lisp","#"], + ["constant.character.lisp","o777"], + ["text"," "], + ["punctuation.definition.constant.character.lisp","#"], + ["constant.character.lisp","O777"], + ["text"," "], + ["punctuation.definition.constant.character.lisp","#"], + ["constant.character.lisp","xabc55"], + ["text"," "], + ["punctuation.definition.constant.character.lisp","#"], + ["constant.character.lisp","c"], + ["text","("], + ["constant.numeric","0"], + ["text"," "], + ["constant.numeric","-5.6"], + ["text","))"] +],[ + "start", + ["text"," ("], + ["identifier","prompt"], + ["text","-"], + ["identifier","read"], + ["text"," "], + ["string","\"Artist\""], + ["text"," &"], + ["identifier","rest"], + ["text",")"] +],[ + "start", + ["text"," ("], + ["keyword.operator","or"], + ["text"," ("], + ["identifier","parse"], + ["text","-"], + ["identifier","integer"], + ["text"," ("], + ["identifier","prompt"], + ["text","-"], + ["identifier","read"], + ["text"," "], + ["string","\"Rating\""], + ["text",") :"], + ["identifier","junk"], + ["text","-"], + ["identifier","allowed"], + ["text"," "], + ["support.function","t"], + ["text",") "], + ["constant.numeric","0"], + ["text",")"] +],[ + "start", + ["text"," ("], + ["keyword.control","if"], + ["text"," "], + ["identifier","x"], + ["text"," ("], + ["support.function","format"], + ["text"," "], + ["support.function","t"], + ["text"," "], + ["string","\"yes\""], + ["text",") ("], + ["support.function","format"], + ["text"," "], + ["support.function","t"], + ["text"," "], + ["string","\"no\""], + ["text"," "], + ["constant.language","nil"], + ["text",") "], + ["comment",";and here comment"] +],[ + "start", + ["text"," ) "], + ["constant.numeric","0xFFLL"], + ["text"," "], + ["constant.numeric","-23ull"] +],[ + "start", + ["text"," "], + ["comment",";; second line comment"] +],[ + "start", + ["text"," '(+ "], + ["constant.numeric","1"], + ["text"," "], + ["constant.numeric","2"], + ["text",")"] +],[ + "start", + ["text"," ("], + ["identifier","defvar"], + ["text"," "], + ["punctuation.definition.variable.lisp","*"], + ["variable.other.global.lisp","lines"], + ["punctuation.definition.variable.lisp","*"], + ["text",") "], + ["comment","; list of all lines"] +],[ + "start", + ["text"," ("], + ["identifier","position"], + ["text","-"], + ["keyword.control","if"], + ["text","-"], + ["identifier","not"], + ["text"," "], + ["punctuation.definition.constant.character.lisp","#"], + ["constant.character.lisp","'sys::whitespacep"], + ["text"," "], + ["identifier","line"], + ["text"," :"], + ["identifier","start"], + ["text"," "], + ["identifier","beg"], + ["text","))"] +],[ + "start", + ["text"," ("], + ["support.function","quote"], + ["text"," ("], + ["identifier","privet"], + ["text"," "], + ["constant.numeric","1"], + ["text"," "], + ["constant.numeric","2"], + ["text"," "], + ["constant.numeric","3"], + ["text","))"] +],[ + "start", + ["text"," '("], + ["identifier","hello"], + ["text"," "], + ["identifier","world"], + ["text",")"] +],[ + "start", + ["text"," (* "], + ["constant.numeric","5"], + ["text"," "], + ["constant.numeric","7"], + ["text",")"] +],[ + "start", + ["text"," ("], + ["constant.numeric","1"], + ["text"," "], + ["constant.numeric","2"], + ["text"," "], + ["constant.numeric","34"], + ["text"," "], + ["constant.numeric","5"], + ["text",")"] +],[ + "start", + ["text"," (:"], + ["identifier","use"], + ["text"," "], + ["string","\"aaaa\""], + ["text",")"] +],[ + "start", + ["text"," ("], + ["keyword.control","let"], + ["text"," (("], + ["identifier","x"], + ["text"," "], + ["constant.numeric","10"], + ["text",") ("], + ["identifier","y"], + ["text"," "], + ["constant.numeric","20"], + ["text","))"] +],[ + "start", + ["text"," ("], + ["identifier","print"], + ["text"," (+ "], + ["identifier","x"], + ["text"," "], + ["identifier","y"], + ["text","))"] +],[ + "start", + ["text"," ) "], + ["support.function","LAmbDa"] +],[ + "start" +],[ + "start", + ["text"," "], + ["string","\"asdad"], + ["constant.character.escape.lisp","\\0"], + ["string","eqweqe\""] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_livescript.json b/addons/editor/ace/mode/_test/tokens_livescript.json new file mode 100755 index 00000000..c2bd83df --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_livescript.json @@ -0,0 +1,6 @@ +[[ + "start", + ["comment","# comment"] +],[ + "start" +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_logiql.json b/addons/editor/ace/mode/_test/tokens_logiql.json new file mode 100755 index 00000000..5f7eda49 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_logiql.json @@ -0,0 +1,190 @@ +[[ + "start", + ["comment.single","// ancestors"] +],[ + "start", + ["entity.name","parentof"], + ["text","("], + ["string","\"douglas\""], + ["keyword.other",","], + ["text"," "], + ["string","\"john\""], + ["text",")"], + ["keyword.end","."] +],[ + "start", + ["entity.name","parentof"], + ["text","("], + ["string","\"john\""], + ["keyword.other",","], + ["text"," "], + ["string","\"bob\""], + ["text",")"], + ["keyword.end","."] +],[ + "start", + ["entity.name","parentof"], + ["text","("], + ["string","\"bob\""], + ["keyword.other",","], + ["text"," "], + ["string","\"ebbon\""], + ["text",")"], + ["keyword.end","."] +],[ + "start" +],[ + "start", + ["entity.name","parentof"], + ["text","("], + ["string","\"douglas\""], + ["keyword.other",","], + ["text"," "], + ["string","\"jane\""], + ["text",")"], + ["keyword.end","."] +],[ + "start", + ["entity.name","parentof"], + ["text","("], + ["string","\"jane\""], + ["keyword.other",","], + ["text"," "], + ["string","\"jan\""], + ["text",")"], + ["keyword.end","."] +],[ + "start" +],[ + "start", + ["entity.name","ancestorof"], + ["text","("], + ["variable.parameter","A"], + ["keyword.other",","], + ["text"," "], + ["variable.parameter","B"], + ["text",") "], + ["keyword.start","<-"], + ["text"," "], + ["entity.name","parentof"], + ["text","("], + ["variable.parameter","A"], + ["keyword.other",","], + ["text"," "], + ["variable.parameter","B"], + ["text",")"], + ["keyword.end","."] +],[ + "start", + ["entity.name","ancestorof"], + ["text","("], + ["variable.parameter","A"], + ["keyword.other",","], + ["text"," "], + ["variable.parameter","C"], + ["text",") "], + ["keyword.start","<-"], + ["text"," "], + ["entity.name","ancestorof"], + ["text","("], + ["variable.parameter","A"], + ["keyword.other",","], + ["text"," "], + ["variable.parameter","B"], + ["text",")"], + ["keyword.other",","], + ["text"," "], + ["entity.name","parentof"], + ["text","("], + ["variable.parameter","B"], + ["keyword.other",","], + ["variable.parameter","C"], + ["text",")"], + ["keyword.end","."] +],[ + "start" +],[ + "start", + ["entity.name","grandparentof"], + ["text","("], + ["variable.parameter","A"], + ["keyword.other",","], + ["text"," "], + ["variable.parameter","B"], + ["text",") "], + ["keyword.start","<-"], + ["text"," "], + ["entity.name","parentof"], + ["text","("], + ["variable.parameter","A"], + ["keyword.other",","], + ["text"," "], + ["variable.parameter","C"], + ["text",")"], + ["keyword.other",","], + ["text"," "], + ["entity.name","parentof"], + ["text","("], + ["variable.parameter","C"], + ["keyword.other",","], + ["text"," "], + ["variable.parameter","B"], + ["text",")"], + ["keyword.end","."] +],[ + "start" +],[ + "start", + ["entity.name","cousins"], + ["text","("], + ["variable.parameter","A"], + ["keyword.other",","], + ["variable.parameter","B"], + ["text",") "], + ["keyword.start","<-"], + ["text"," "], + ["entity.name","grandparentof"], + ["text","("], + ["variable.parameter","C"], + ["keyword.other",","], + ["variable.parameter","A"], + ["text",")"], + ["keyword.other",","], + ["text"," "], + ["entity.name","grandparentof"], + ["text","("], + ["variable.parameter","C"], + ["keyword.other",","], + ["variable.parameter","B"], + ["text",")"], + ["keyword.end","."] +],[ + "start" +],[ + "start", + ["entity.name","parentof"], + ["text","["], + ["entity.name.type.logicblox","`arg"], + ["text","]("], + ["variable.parameter","A"], + ["keyword.other",","], + ["text"," "], + ["variable.parameter","B"], + ["text",") "], + ["keyword.start","->"], + ["text"," "], + ["entity.name","int"], + ["text","["], + ["constant.numeric","32"], + ["text","]("], + ["variable.parameter","A"], + ["text",")"], + ["keyword.other",","], + ["text"," "], + ["keyword.other","!"], + ["entity.name","string"], + ["text","("], + ["variable.parameter","B"], + ["text",")"], + ["keyword.end","."] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_lsl.json b/addons/editor/ace/mode/_test/tokens_lsl.json new file mode 100755 index 00000000..83b7352b --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_lsl.json @@ -0,0 +1,495 @@ +[[ + "comment", + ["comment.block.lsl","/*"] +],[ + "comment", + ["comment.block.lsl"," Testing syntax highlighting"] +],[ + "comment", + ["comment.block.lsl"," of Ace Editor"] +],[ + "comment", + ["comment.block.lsl"," for the Linden Scripting Language"] +],[ + "start", + ["comment.block.lsl","*/"] +],[ + "start" +],[ + "start", + ["storage.type.lsl","integer"], + ["text.lsl"," "], + ["identifier","someIntNormal"], + ["text.lsl"," "], + ["keyword.operator.lsl","="], + ["text.lsl"," "], + ["constant.numeric.lsl","3672"], + ["punctuation.operator.lsl",";"] +],[ + "start", + ["storage.type.lsl","integer"], + ["text.lsl"," "], + ["identifier","someIntHex"], + ["text.lsl"," "], + ["keyword.operator.lsl","="], + ["text.lsl"," "], + ["constant.numeric.lsl","0x00000000"], + ["punctuation.operator.lsl",";"] +],[ + "start", + ["storage.type.lsl","integer"], + ["text.lsl"," "], + ["identifier","someIntMath"], + ["text.lsl"," "], + ["keyword.operator.lsl","="], + ["text.lsl"," "], + ["constant.language.float.lsl","PI_BY_TWO"], + ["punctuation.operator.lsl",";"] +],[ + "start" +],[ + "start", + ["storage.type.lsl","integer"], + ["text.lsl"," "], + ["invalid.unimplemented.lsl","event"], + ["text.lsl"," "], + ["keyword.operator.lsl","="], + ["text.lsl"," "], + ["constant.numeric.lsl","5673"], + ["punctuation.operator.lsl",";"], + ["text.lsl"," "], + ["comment.line.double-slash.lsl","// unimplemented reserved keyword!"] +],[ + "start" +],[ + "start", + ["storage.type.lsl","key"], + ["text.lsl"," "], + ["identifier","someKeyTexture"], + ["text.lsl"," "], + ["keyword.operator.lsl","="], + ["text.lsl"," "], + ["constant.language.string.lsl","TEXTURE_DEFAULT"], + ["punctuation.operator.lsl",";"] +],[ + "start", + ["storage.type.lsl","string"], + ["text.lsl"," "], + ["identifier","someStringSpecial"], + ["text.lsl"," "], + ["keyword.operator.lsl","="], + ["text.lsl"," "], + ["constant.language.string.lsl","EOF"], + ["punctuation.operator.lsl",";"] +],[ + "start" +],[ + "start", + ["identifier","some_user_defined_function_without_return_type"], + ["paren.lparen.lsl","("], + ["storage.type.lsl","string"], + ["text.lsl"," "], + ["identifier","inputAsString"], + ["paren.rparen.lsl",")"] +],[ + "start", + ["paren.lparen.lsl","{"] +],[ + "start", + ["text.lsl"," "], + ["support.function.lsl","llSay"], + ["paren.lparen.lsl","("], + ["constant.language.integer.lsl","PUBLIC_CHANNEL"], + ["punctuation.operator.lsl",","], + ["text.lsl"," "], + ["identifier","inputAsString"], + ["paren.rparen.lsl",")"], + ["punctuation.operator.lsl",";"] +],[ + "start", + ["paren.rparen.lsl","}"] +],[ + "start" +],[ + "start", + ["storage.type.lsl","string"], + ["text.lsl"," "], + ["identifier","user_defined_function_returning_a_string"], + ["paren.lparen.lsl","("], + ["storage.type.lsl","key"], + ["text.lsl"," "], + ["identifier","inputAsKey"], + ["paren.rparen.lsl",")"] +],[ + "start", + ["paren.lparen.lsl","{"] +],[ + "start", + ["text.lsl"," "], + ["keyword.control.lsl","return"], + ["text.lsl"," "], + ["paren.lparen.lsl","("], + ["storage.type.lsl","string"], + ["paren.rparen.lsl",")"], + ["identifier","inputAsKey"], + ["punctuation.operator.lsl",";"] +],[ + "start", + ["paren.rparen.lsl","}"] +],[ + "start" +],[ + "start", + ["entity.name.state.lsl","default"] +],[ + "start", + ["paren.lparen.lsl","{"] +],[ + "start", + ["text.lsl"," "], + ["support.function.event.lsl","state_entry"], + ["paren.lparen.lsl","("], + ["paren.rparen.lsl",")"] +],[ + "start", + ["text.lsl"," "], + ["paren.lparen.lsl","{"] +],[ + "start", + ["text.lsl"," "], + ["storage.type.lsl","key"], + ["text.lsl"," "], + ["identifier","someKey"], + ["text.lsl"," "], + ["keyword.operator.lsl","="], + ["text.lsl"," "], + ["constant.language.string.lsl","NULL_KEY"], + ["punctuation.operator.lsl",";"] +],[ + "start", + ["text.lsl"," "], + ["identifier","someKey"], + ["text.lsl"," "], + ["keyword.operator.lsl","="], + ["text.lsl"," "], + ["support.function.lsl","llGetOwner"], + ["paren.lparen.lsl","("], + ["paren.rparen.lsl",")"], + ["punctuation.operator.lsl",";"] +],[ + "start" +],[ + "start", + ["text.lsl"," "], + ["storage.type.lsl","string"], + ["text.lsl"," "], + ["identifier","someString"], + ["text.lsl"," "], + ["keyword.operator.lsl","="], + ["text.lsl"," "], + ["identifier","user_defined_function_returning_a_string"], + ["paren.lparen.lsl","("], + ["identifier","someKey"], + ["paren.rparen.lsl",")"], + ["punctuation.operator.lsl",";"] +],[ + "start" +],[ + "start", + ["text.lsl"," "], + ["identifier","some_user_defined_function_without_return_type"], + ["paren.lparen.lsl","("], + ["identifier","someString"], + ["paren.rparen.lsl",")"], + ["punctuation.operator.lsl",";"] +],[ + "start", + ["text.lsl"," "], + ["paren.rparen.lsl","}"] +],[ + "start" +],[ + "start", + ["text.lsl"," "], + ["support.function.event.lsl","touch_start"], + ["paren.lparen.lsl","("], + ["storage.type.lsl","integer"], + ["text.lsl"," "], + ["identifier","num_detected"], + ["paren.rparen.lsl",")"] +],[ + "start", + ["text.lsl"," "], + ["paren.lparen.lsl","{"] +],[ + "start", + ["text.lsl"," "], + ["storage.type.lsl","list"], + ["text.lsl"," "], + ["identifier","agentsInRegion"], + ["text.lsl"," "], + ["keyword.operator.lsl","="], + ["text.lsl"," "], + ["support.function.lsl","llGetAgentList"], + ["paren.lparen.lsl","("], + ["constant.language.integer.lsl","AGENT_LIST_REGION"], + ["punctuation.operator.lsl",","], + ["text.lsl"," "], + ["paren.lparen.lsl","["], + ["paren.rparen.lsl","])"], + ["punctuation.operator.lsl",";"] +],[ + "start", + ["text.lsl"," "], + ["storage.type.lsl","integer"], + ["text.lsl"," "], + ["identifier","numOfAgents"], + ["text.lsl"," "], + ["keyword.operator.lsl","="], + ["text.lsl"," "], + ["support.function.lsl","llGetListLength"], + ["paren.lparen.lsl","("], + ["identifier","agentsInRegion"], + ["paren.rparen.lsl",")"], + ["punctuation.operator.lsl",";"] +],[ + "start" +],[ + "start", + ["text.lsl"," "], + ["storage.type.lsl","integer"], + ["text.lsl"," "], + ["identifier","index"], + ["punctuation.operator.lsl",";"], + ["text.lsl"," "], + ["comment.line.double-slash.lsl","// defaults to 0"] +],[ + "start", + ["text.lsl"," "], + ["keyword.control.lsl","for"], + ["text.lsl"," "], + ["paren.lparen.lsl","("], + ["punctuation.operator.lsl",";"], + ["text.lsl"," "], + ["identifier","index"], + ["text.lsl"," "], + ["keyword.operator.lsl","<="], + ["text.lsl"," "], + ["identifier","numOfAgents"], + ["text.lsl"," "], + ["keyword.operator.lsl","-"], + ["text.lsl"," "], + ["constant.numeric.lsl","1"], + ["punctuation.operator.lsl",";"], + ["text.lsl"," "], + ["identifier","index"], + ["keyword.operator.lsl","++"], + ["paren.rparen.lsl",")"], + ["text.lsl"," "], + ["comment.line.double-slash.lsl","// for each agent in region"] +],[ + "start", + ["text.lsl"," "], + ["paren.lparen.lsl","{"] +],[ + "start", + ["text.lsl"," "], + ["support.function.lsl","llRegionSayTo"], + ["paren.lparen.lsl","("], + ["support.function.lsl","llList2Key"], + ["paren.lparen.lsl","("], + ["identifier","agentsInRegion"], + ["punctuation.operator.lsl",","], + ["text.lsl"," "], + ["identifier","index"], + ["paren.rparen.lsl",")"], + ["punctuation.operator.lsl",","], + ["text.lsl"," "], + ["constant.language.integer.lsl","PUBLIC_CHANNEL"], + ["punctuation.operator.lsl",","], + ["text.lsl"," "], + ["string.quoted.double.lsl.start","\""], + ["string.quoted.double.lsl","Hello, Avatar!"], + ["string.quoted.double.lsl.end","\""], + ["paren.rparen.lsl",")"], + ["punctuation.operator.lsl",";"] +],[ + "start", + ["text.lsl"," "], + ["paren.rparen.lsl","}"] +],[ + "start", + ["text.lsl"," "], + ["paren.rparen.lsl","}"] +],[ + "start" +],[ + "start", + ["text.lsl"," "], + ["support.function.event.lsl","touch_end"], + ["paren.lparen.lsl","("], + ["storage.type.lsl","integer"], + ["text.lsl"," "], + ["identifier","num_detected"], + ["paren.rparen.lsl",")"] +],[ + "start", + ["text.lsl"," "], + ["paren.lparen.lsl","{"] +],[ + "start", + ["text.lsl"," "], + ["identifier","someIntNormal"], + ["text.lsl"," "], + ["keyword.operator.lsl","="], + ["text.lsl"," "], + ["constant.numeric.lsl","3672"], + ["punctuation.operator.lsl",";"] +],[ + "start", + ["text.lsl"," "], + ["identifier","someIntHex"], + ["text.lsl"," "], + ["keyword.operator.lsl","="], + ["text.lsl"," "], + ["constant.numeric.lsl","0x00000000"], + ["punctuation.operator.lsl",";"] +],[ + "start", + ["text.lsl"," "], + ["identifier","someIntMath"], + ["text.lsl"," "], + ["keyword.operator.lsl","="], + ["text.lsl"," "], + ["constant.language.float.lsl","PI_BY_TWO"], + ["punctuation.operator.lsl",";"] +],[ + "start" +],[ + "start", + ["text.lsl"," "], + ["invalid.unimplemented.lsl","event"], + ["text.lsl"," "], + ["keyword.operator.lsl","="], + ["text.lsl"," "], + ["constant.numeric.lsl","5673"], + ["punctuation.operator.lsl",";"], + ["text.lsl"," "], + ["comment.line.double-slash.lsl","// unimplemented reserved keyword!"] +],[ + "start" +],[ + "start", + ["text.lsl"," "], + ["identifier","someKeyTexture"], + ["text.lsl"," "], + ["keyword.operator.lsl","="], + ["text.lsl"," "], + ["constant.language.string.lsl","TEXTURE_DEFAULT"], + ["punctuation.operator.lsl",";"] +],[ + "start", + ["text.lsl"," "], + ["identifier","someStringSpecial"], + ["text.lsl"," "], + ["keyword.operator.lsl","="], + ["text.lsl"," "], + ["constant.language.string.lsl","EOF"], + ["punctuation.operator.lsl",";"] +],[ + "start" +],[ + "start", + ["text.lsl"," "], + ["invalid.deprecated.lsl","llCloud"], + ["paren.lparen.lsl","("], + ["constant.language.vector.lsl","ZERO_VECTOR"], + ["paren.rparen.lsl",")"], + ["punctuation.operator.lsl",";"], + ["text.lsl"," "], + ["comment.line.double-slash.lsl","// invalid deprecated function!"] +],[ + "start" +],[ + "start", + ["text.lsl"," "], + ["support.function.lsl","llWhisper"], + ["paren.lparen.lsl","("], + ["constant.language.integer.lsl","PUBLIC_CHANNEL"], + ["punctuation.operator.lsl",","], + ["text.lsl"," "], + ["string.quoted.double.lsl.start","\""], + ["string.quoted.double.lsl","Leaving "], + ["constant.language.escape.lsl","\\\""], + ["string.quoted.double.lsl","default"], + ["constant.language.escape.lsl","\\\""], + ["string.quoted.double.lsl"," now..."], + ["string.quoted.double.lsl.end","\""], + ["paren.rparen.lsl",")"], + ["punctuation.operator.lsl",";"] +],[ + "start", + ["text.lsl"," "], + ["entity.name.state.lsl","state other"], + ["punctuation.operator.lsl",";"] +],[ + "start", + ["text.lsl"," "], + ["paren.rparen.lsl","}"] +],[ + "start", + ["paren.rparen.lsl","}"] +],[ + "start" +],[ + "start", + ["entity.name.state.lsl","state other"] +],[ + "start", + ["paren.lparen.lsl","{"] +],[ + "start", + ["text.lsl"," "], + ["support.function.event.lsl","state_entry"], + ["paren.lparen.lsl","("], + ["paren.rparen.lsl",")"] +],[ + "start", + ["text.lsl"," "], + ["paren.lparen.lsl","{"] +],[ + "start", + ["text.lsl"," "], + ["support.function.lsl","llWhisper"], + ["paren.lparen.lsl","("], + ["constant.language.integer.lsl","PUBLIC_CHANNEL"], + ["punctuation.operator.lsl",","], + ["text.lsl"," "], + ["string.quoted.double.lsl.start","\""], + ["string.quoted.double.lsl","Entered "], + ["constant.language.escape.lsl","\\\""], + ["string.quoted.double.lsl","state other"], + ["constant.language.escape.lsl","\\\""], + ["string.quoted.double.lsl",", returning to "], + ["constant.language.escape.lsl","\\\""], + ["string.quoted.double.lsl","default"], + ["constant.language.escape.lsl","\\\""], + ["string.quoted.double.lsl"," again..."], + ["string.quoted.double.lsl.end","\""], + ["paren.rparen.lsl",")"], + ["punctuation.operator.lsl",";"] +],[ + "start", + ["text.lsl"," "], + ["entity.name.state.lsl","state default"], + ["punctuation.operator.lsl",";"] +],[ + "start", + ["text.lsl"," "], + ["paren.rparen.lsl","}"] +],[ + "start", + ["paren.rparen.lsl","}"] +],[ + "start" +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_lua.json b/addons/editor/ace/mode/_test/tokens_lua.json new file mode 100755 index 00000000..276b3ffc --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_lua.json @@ -0,0 +1,348 @@ +[[ + ["bracketedComment",2,"start"], + ["comment","--[[--"] +],[ + ["bracketedComment",2,"start"], + ["comment","num_args takes in 5.1 byte code and extracts the number of arguments"] +],[ + ["bracketedComment",2,"start"], + ["comment","from its function header."] +],[ + "start", + ["comment","--]]--"] +],[ + "start" +],[ + "start", + ["keyword","function"], + ["text"," "], + ["identifier","int"], + ["paren.lparen","("], + ["identifier","t"], + ["paren.rparen",")"] +],[ + "start", + ["text","\t"], + ["keyword","return"], + ["text"," "], + ["identifier","t"], + ["keyword.operator",":"], + ["support.function","byte"], + ["paren.lparen","("], + ["constant.numeric","1"], + ["paren.rparen",")"], + ["keyword.operator","+"], + ["identifier","t"], + ["keyword.operator",":"], + ["support.function","byte"], + ["paren.lparen","("], + ["constant.numeric","2"], + ["paren.rparen",")"], + ["keyword.operator","*"], + ["constant.numeric","0x100"], + ["keyword.operator","+"], + ["identifier","t"], + ["keyword.operator",":"], + ["support.function","byte"], + ["paren.lparen","("], + ["constant.numeric","3"], + ["paren.rparen",")"], + ["keyword.operator","*"], + ["constant.numeric","0x10000"], + ["keyword.operator","+"], + ["identifier","t"], + ["keyword.operator",":"], + ["support.function","byte"], + ["paren.lparen","("], + ["constant.numeric","4"], + ["paren.rparen",")"], + ["keyword.operator","*"], + ["constant.numeric","0x1000000"] +],[ + "start", + ["keyword","end"] +],[ + "start" +],[ + "start", + ["keyword","function"], + ["text"," "], + ["identifier","num_args"], + ["paren.lparen","("], + ["identifier","func"], + ["paren.rparen",")"] +],[ + "start", + ["text","\t"], + ["keyword","local"], + ["text"," "], + ["support.function","dump"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["constant.library","string"], + ["text","."], + ["support.function","dump"], + ["paren.lparen","("], + ["identifier","func"], + ["paren.rparen",")"] +],[ + "start", + ["text","\t"], + ["keyword","local"], + ["text"," "], + ["identifier","offset"], + ["text",", "], + ["identifier","cursor"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["identifier","int"], + ["paren.lparen","("], + ["support.function","dump"], + ["keyword.operator",":"], + ["support.function","sub"], + ["paren.lparen","("], + ["constant.numeric","13"], + ["paren.rparen","))"], + ["text",", "], + ["identifier","offset"], + ["text"," "], + ["keyword.operator","+"], + ["text"," "], + ["constant.numeric","26"] +],[ + "start", + ["text","\t"], + ["comment","--Get the params and var flag (whether there's a ... in the param)"] +],[ + "start", + ["text","\t"], + ["keyword","return"], + ["text"," "], + ["support.function","dump"], + ["keyword.operator",":"], + ["support.function","sub"], + ["paren.lparen","("], + ["identifier","cursor"], + ["paren.rparen",")"], + ["keyword.operator",":"], + ["support.function","byte"], + ["paren.lparen","("], + ["paren.rparen",")"], + ["text",", "], + ["support.function","dump"], + ["keyword.operator",":"], + ["support.function","sub"], + ["paren.lparen","("], + ["identifier","cursor"], + ["keyword.operator","+"], + ["constant.numeric","1"], + ["paren.rparen",")"], + ["keyword.operator",":"], + ["support.function","byte"], + ["paren.lparen","("], + ["paren.rparen",")"] +],[ + "start", + ["keyword","end"] +],[ + "start" +],[ + "start", + ["comment","-- Usage:"] +],[ + "start", + ["identifier","num_args"], + ["paren.lparen","("], + ["keyword","function"], + ["paren.lparen","("], + ["identifier","a"], + ["text",","], + ["identifier","b"], + ["text",","], + ["identifier","c"], + ["text",","], + ["identifier","d"], + ["text",", "], + ["keyword.operator","..."], + ["paren.rparen",")"], + ["text"," "], + ["keyword","end"], + ["paren.rparen",")"], + ["text"," "], + ["comment","-- return 4, 7"] +],[ + "start" +],[ + "start", + ["comment","-- Python styled string format operator"] +],[ + "start", + ["keyword","local"], + ["text"," "], + ["identifier","gm"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["constant.library","debug"], + ["text","."], + ["support.function","getmetatable"], + ["paren.lparen","("], + ["string","\"\""], + ["paren.rparen",")"] +],[ + "start" +],[ + "start", + ["identifier","gm"], + ["text","."], + ["support.function","__mod"], + ["keyword.operator","="], + ["keyword","function"], + ["paren.lparen","("], + ["identifier","self"], + ["text",", "], + ["identifier","other"], + ["paren.rparen",")"] +],[ + "start", + ["text"," "], + ["keyword","if"], + ["text"," "], + ["support.function","type"], + ["paren.lparen","("], + ["identifier","other"], + ["paren.rparen",")"], + ["text"," "], + ["keyword.operator","~="], + ["text"," "], + ["string","\"table\""], + ["text"," "], + ["keyword","then"], + ["text"," "], + ["identifier","other"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["paren.lparen","{"], + ["identifier","other"], + ["paren.rparen","}"], + ["text"," "], + ["keyword","end"] +],[ + "start", + ["text"," "], + ["keyword","for"], + ["text"," "], + ["identifier","i"], + ["text",","], + ["identifier","v"], + ["text"," "], + ["keyword","in"], + ["text"," "], + ["support.function","ipairs"], + ["paren.lparen","("], + ["identifier","other"], + ["paren.rparen",")"], + ["text"," "], + ["keyword","do"], + ["text"," "], + ["identifier","other"], + ["paren.lparen","["], + ["identifier","i"], + ["paren.rparen","]"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["support.function","tostring"], + ["paren.lparen","("], + ["identifier","v"], + ["paren.rparen",")"], + ["text"," "], + ["keyword","end"] +],[ + "start", + ["text"," "], + ["keyword","return"], + ["text"," "], + ["identifier","self"], + ["keyword.operator",":"], + ["support.function","format"], + ["paren.lparen","("], + ["support.function","unpack"], + ["paren.lparen","("], + ["identifier","other"], + ["paren.rparen","))"] +],[ + "start", + ["keyword","end"] +],[ + "start" +],[ + ["bracketedString",5,"start"], + ["support.function","print"], + ["paren.lparen","("], + ["comment","[===["] +],[ + ["bracketedString",5,"start"], + ["comment"," blah blah %s, (%d %d)"] +],[ + "start", + ["comment","]===]"], + ["keyword.operator","%"], + ["paren.lparen","{"], + ["string","\"blah\""], + ["text",", "], + ["identifier","num_args"], + ["paren.lparen","("], + ["identifier","int"], + ["paren.rparen",")})"] +],[ + "start" +],[ + ["bracketedComment",3,"start"], + ["comment","--[=[--"] +],[ + ["bracketedComment",3,"start"], + ["comment","table.maxn is deprecated, use # instead."] +],[ + "start", + ["comment","--]=]--"] +],[ + "start", + ["support.function","print"], + ["paren.lparen","("], + ["constant.library","table"], + ["text","."], + ["invalid.deprecated","maxn"], + ["paren.lparen","{"], + ["constant.numeric","1"], + ["text",","], + ["constant.numeric","2"], + ["text",","], + ["paren.lparen","["], + ["constant.numeric","4"], + ["paren.rparen","]"], + ["keyword.operator","="], + ["constant.numeric","4"], + ["text",","], + ["paren.lparen","["], + ["constant.numeric","8"], + ["paren.rparen","]"], + ["keyword.operator","="], + ["constant.numeric","8"], + ["paren.rparen",")"], + ["text"," "], + ["comment","-- outputs 8 instead of 2"] +],[ + "start" +],[ + "start", + ["support.function","print"], + ["paren.lparen","("], + ["constant.numeric","5"], + ["text"," "], + ["comment","--[[ blah ]]"], + ["paren.rparen",")"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_luapage.json b/addons/editor/ace/mode/_test/tokens_luapage.json new file mode 100755 index 00000000..3cee0815 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_luapage.json @@ -0,0 +1,633 @@ +[[ + "doctype", + ["text",""], + ["punctuation.doctype.begin",""] +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","html"], + ["meta.tag.punctuation.end",">"] +],[ + ["lua-bracketedComment",2,"lua-start"], + ["keyword","<%"], + ["text"," "], + ["comment","--[[--"] +],[ + ["lua-bracketedComment",2,"lua-start"], + ["comment"," index.lp from the Kepler Project's LuaDoc HTML doclet."] +],[ + ["lua-bracketedComment",2,"lua-start"], + ["comment"," http://keplerproject.github.com/luadoc/"] +],[ + "start", + ["comment","--]]"], + ["text"," "], + ["keyword","%>"] +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","head"], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","title"], + ["meta.tag.punctuation.end",">"], + ["text","Reference"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","link"], + ["text"," "], + ["entity.other.attribute-name","rel"], + ["keyword.operator.separator","="], + ["string","\"stylesheet\""], + ["text"," "], + ["entity.other.attribute-name","href"], + ["keyword.operator.separator","="], + ["string","\""], + ["keyword","<%="], + ["identifier","luadoc"], + ["text","."], + ["identifier","doclet"], + ["text","."], + ["identifier","html"], + ["text","."], + ["identifier","link"], + ["paren.lparen","("], + ["string","\"luadoc.css\""], + ["paren.rparen",")"], + ["keyword","%>"], + ["string","\""], + ["text"," "], + ["entity.other.attribute-name","type"], + ["keyword.operator.separator","="], + ["string","\"text/css\""], + ["text"," "], + ["meta.tag.punctuation.end","/>"] +],[ + "start", + ["text","\t"], + ["comment",""] +],[ + "start", + ["meta.tag.punctuation.begin",""] +],[ + "start" +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","body"], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","div"], + ["text"," "], + ["entity.other.attribute-name","id"], + ["keyword.operator.separator","="], + ["string","\"container\""], + ["meta.tag.punctuation.end",">"] +],[ + "start" +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","div"], + ["text"," "], + ["entity.other.attribute-name","id"], + ["keyword.operator.separator","="], + ["string","\"product\""], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text","\t"], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","div"], + ["text"," "], + ["entity.other.attribute-name","id"], + ["keyword.operator.separator","="], + ["string","\"product_logo\""], + ["meta.tag.punctuation.end",">"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text","\t"], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","div"], + ["text"," "], + ["entity.other.attribute-name","id"], + ["keyword.operator.separator","="], + ["string","\"product_name\""], + ["meta.tag.punctuation.end",">"], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","big"], + ["meta.tag.punctuation.end",">"], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","b"], + ["meta.tag.punctuation.end",">"], + ["meta.tag.punctuation.begin",""], + ["meta.tag.punctuation.begin",""], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text","\t"], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","div"], + ["text"," "], + ["entity.other.attribute-name","id"], + ["keyword.operator.separator","="], + ["string","\"product_description\""], + ["meta.tag.punctuation.end",">"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["meta.tag.punctuation.begin",""], + ["text"," "], + ["comment",""] +],[ + "start" +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","div"], + ["text"," "], + ["entity.other.attribute-name","id"], + ["keyword.operator.separator","="], + ["string","\"main\""], + ["meta.tag.punctuation.end",">"] +],[ + "start" +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","div"], + ["text"," "], + ["entity.other.attribute-name","id"], + ["keyword.operator.separator","="], + ["string","\"navigation\""], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["keyword","<%="], + ["identifier","luadoc"], + ["text","."], + ["identifier","doclet"], + ["text","."], + ["identifier","html"], + ["text","."], + ["identifier","include"], + ["paren.lparen","("], + ["string","\"menu.lp\""], + ["text",", "], + ["paren.lparen","{"], + ["text"," "], + ["identifier","doc"], + ["keyword.operator","="], + ["identifier","doc"], + ["text"," "], + ["paren.rparen","})"], + ["keyword","%>"] +],[ + "start" +],[ + "start", + ["meta.tag.punctuation.begin",""], + ["text"," "], + ["comment",""] +],[ + "start" +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","div"], + ["text"," "], + ["entity.other.attribute-name","id"], + ["keyword.operator.separator","="], + ["string","\"content\""], + ["meta.tag.punctuation.end",">"] +],[ + "start" +],[ + "start" +],[ + "start", + ["keyword","<%if"], + ["text"," "], + ["keyword","not"], + ["text"," "], + ["identifier","options"], + ["text","."], + ["identifier","nomodules"], + ["text"," "], + ["keyword","and"], + ["text"," "], + ["keyword.operator","#"], + ["identifier","doc"], + ["text","."], + ["identifier","modules"], + ["text"," "], + ["keyword.operator",">"], + ["text"," "], + ["constant.numeric","0"], + ["text"," "], + ["keyword","then%>"] +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","h2"], + ["meta.tag.punctuation.end",">"], + ["text","Modules"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.table","table"], + ["text"," "], + ["entity.other.attribute-name","class"], + ["keyword.operator.separator","="], + ["string","\"module_list\""], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["comment",""] +],[ + "start", + ["keyword","<%for"], + ["text"," "], + ["identifier","_"], + ["text",", "], + ["identifier","modulename"], + ["text"," "], + ["keyword","in"], + ["text"," "], + ["support.function","ipairs"], + ["paren.lparen","("], + ["identifier","doc"], + ["text","."], + ["identifier","modules"], + ["paren.rparen",")"], + ["text"," "], + ["keyword","do%>"] +],[ + "start", + ["text","\t"], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.table","tr"], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text","\t\t"], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.table","td"], + ["text"," "], + ["entity.other.attribute-name","class"], + ["keyword.operator.separator","="], + ["string","\"name\""], + ["meta.tag.punctuation.end",">"], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.anchor","a"], + ["text"," "], + ["entity.other.attribute-name","href"], + ["keyword.operator.separator","="], + ["string","\""], + ["keyword","<%="], + ["identifier","luadoc"], + ["text","."], + ["identifier","doclet"], + ["text","."], + ["identifier","html"], + ["text","."], + ["identifier","module_link"], + ["paren.lparen","("], + ["identifier","modulename"], + ["text",", "], + ["identifier","doc"], + ["paren.rparen",")"], + ["keyword","%>"], + ["string","\""], + ["meta.tag.punctuation.end",">"], + ["keyword","<%="], + ["identifier","modulename"], + ["keyword","%>"], + ["meta.tag.punctuation.begin",""], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text","\t\t"], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.table","td"], + ["text"," "], + ["entity.other.attribute-name","class"], + ["keyword.operator.separator","="], + ["string","\"summary\""], + ["meta.tag.punctuation.end",">"], + ["keyword","<%="], + ["identifier","doc"], + ["text","."], + ["identifier","modules"], + ["paren.lparen","["], + ["identifier","modulename"], + ["paren.rparen","]"], + ["text","."], + ["identifier","summary"], + ["keyword","%>"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text","\t"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["keyword","<%end%>"] +],[ + "start", + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["keyword","<%end%>"] +],[ + "start" +],[ + "start" +],[ + "start" +],[ + "start", + ["keyword","<%if"], + ["text"," "], + ["keyword","not"], + ["text"," "], + ["identifier","options"], + ["text","."], + ["identifier","nofiles"], + ["text"," "], + ["keyword","and"], + ["text"," "], + ["keyword.operator","#"], + ["identifier","doc"], + ["text","."], + ["identifier","files"], + ["text"," "], + ["keyword.operator",">"], + ["text"," "], + ["constant.numeric","0"], + ["text"," "], + ["keyword","then%>"] +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","h2"], + ["meta.tag.punctuation.end",">"], + ["text","Files"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.table","table"], + ["text"," "], + ["entity.other.attribute-name","class"], + ["keyword.operator.separator","="], + ["string","\"file_list\""], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["comment",""] +],[ + "start", + ["keyword","<%for"], + ["text"," "], + ["identifier","_"], + ["text",", "], + ["identifier","filepath"], + ["text"," "], + ["keyword","in"], + ["text"," "], + ["support.function","ipairs"], + ["paren.lparen","("], + ["identifier","doc"], + ["text","."], + ["identifier","files"], + ["paren.rparen",")"], + ["text"," "], + ["keyword","do%>"] +],[ + "start", + ["text","\t"], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.table","tr"], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text","\t\t"], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.table","td"], + ["text"," "], + ["entity.other.attribute-name","class"], + ["keyword.operator.separator","="], + ["string","\"name\""], + ["meta.tag.punctuation.end",">"], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.anchor","a"], + ["text"," "], + ["entity.other.attribute-name","href"], + ["keyword.operator.separator","="], + ["string","\""], + ["keyword","<%="], + ["identifier","luadoc"], + ["text","."], + ["identifier","doclet"], + ["text","."], + ["identifier","html"], + ["text","."], + ["identifier","file_link"], + ["paren.lparen","("], + ["identifier","filepath"], + ["paren.rparen",")"], + ["keyword","%>"], + ["string","\""], + ["meta.tag.punctuation.end",">"], + ["keyword","<%="], + ["identifier","filepath"], + ["keyword","%>"], + ["meta.tag.punctuation.begin",""], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text","\t\t"], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.table","td"], + ["text"," "], + ["entity.other.attribute-name","class"], + ["keyword.operator.separator","="], + ["string","\"summary\""], + ["meta.tag.punctuation.end",">"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text","\t"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["keyword","<%end%>"] +],[ + "start", + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["keyword","<%end%>"] +],[ + "start" +],[ + "start", + ["meta.tag.punctuation.begin",""], + ["text"," "], + ["comment",""] +],[ + "start" +],[ + "start", + ["meta.tag.punctuation.begin",""], + ["text"," "], + ["comment",""] +],[ + "start" +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","div"], + ["text"," "], + ["entity.other.attribute-name","id"], + ["keyword.operator.separator","="], + ["string","\"about\""], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text","\t"], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","p"], + ["meta.tag.punctuation.end",">"], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.anchor","a"], + ["text"," "], + ["entity.other.attribute-name","href"], + ["keyword.operator.separator","="], + ["string","\"http://validator.w3.org/check?uri=referer\""], + ["meta.tag.punctuation.end",">"], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.image","img"], + ["text"," "], + ["entity.other.attribute-name","src"], + ["keyword.operator.separator","="], + ["string","\"http://www.w3.org/Icons/valid-xhtml10\""], + ["text"," "], + ["entity.other.attribute-name","alt"], + ["keyword.operator.separator","="], + ["string","\"Valid XHTML 1.0!\""], + ["text"," "], + ["entity.other.attribute-name","height"], + ["keyword.operator.separator","="], + ["string","\"31\""], + ["text"," "], + ["entity.other.attribute-name","width"], + ["keyword.operator.separator","="], + ["string","\"88\""], + ["text"," "], + ["meta.tag.punctuation.end","/>"], + ["meta.tag.punctuation.begin",""], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["meta.tag.punctuation.begin",""], + ["text"," "], + ["comment",""] +],[ + "start" +],[ + "start", + ["meta.tag.punctuation.begin",""], + ["text"," "], + ["comment",""], + ["text","\t"] +],[ + "start", + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["meta.tag.punctuation.begin",""] +],[ + "start" +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_lucene.json b/addons/editor/ace/mode/_test/tokens_lucene.json new file mode 100755 index 00000000..1f6d2985 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_lucene.json @@ -0,0 +1,92 @@ +[[ + "start", + ["keyword","test:"], + ["text"," recognises "], + ["keyword.operator","AND"], + ["text"," as keyword"] +],[ + "start", + ["keyword","test:"], + ["text"," recognises "], + ["keyword.operator","OR"], + ["text"," as keyword"] +],[ + "start", + ["keyword","test:"], + ["text"," recognises "], + ["keyword.operator","NOT"], + ["text"," as keyword"] +],[ + "start", + ["keyword","test:"], + ["text"," recognises "], + ["string","\"hello this is dog\""], + ["text"," as string"] +],[ + "start", + ["keyword","test:"], + ["text"," recognises "], + ["constant.character.negation","-"], + ["string","\"hello this is dog\""], + ["text"," as negation with string"] +],[ + "start", + ["keyword","test:"], + ["text"," recognises "], + ["constant.character.proximity","~100"], + ["text"," as text with proximity"] +],[ + "start", + ["keyword","test:"], + ["text"," recognises "], + ["string","\"hello this is dog\""], + ["constant.character.proximity","~100"], + ["text"," as string with proximity"] +],[ + "start", + ["keyword","test:"], + ["text"," recognises "], + ["keyword","raw:"], + ["string","\"hello this is dog\""], + ["text"," as keyword"] +],[ + "start", + ["keyword","test:"], + ["text"," recognises "], + ["keyword","raw:"], + ["text","foo as\"keyword'"] +],[ + "start", + ["keyword","test:"], + ["text"," recognises "], + ["string","\"(\""], + ["text"," as opening parenthesis"] +],[ + "start", + ["keyword","test:"], + ["text"," recognises "], + ["string","\")\""], + ["text"," as closing parenthesis"] +],[ + "start", + ["keyword","test:"], + ["text"," recognises foo"], + ["constant.character.asterisk","*"], + ["text"," as text with asterisk"] +],[ + "start", + ["keyword","test:"], + ["text"," recognises foo"], + ["constant.character.interro","?"], + ["text"," as text with interro"] +],[ + "start", + ["keyword","test:"], + ["text"," recognises single word as text"] +],[ + "start", + ["text"," foo"] +],[ + "start", + ["text"," "] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_markdown.json b/addons/editor/ace/mode/_test/tokens_markdown.json new file mode 100755 index 00000000..3c0db62f --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_markdown.json @@ -0,0 +1,114 @@ +[[ + "start", + ["text","test: header 1 "] +],[ + "start", + ["markup.heading.1","#"], + ["heading","f"] +],[ + "start", + ["text","test: header 2"] +],[ + "start", + ["markup.heading.2","##"], + ["heading"," foo"] +],[ + "start", + ["text","test: header ends with ' #'"] +],[ + "start", + ["markup.heading.1","#"], + ["heading"," # # "] +],[ + "start", + ["text","test: header ends with '#'"] +],[ + "start", + ["markup.heading.1","#"], + ["heading","foo# "] +],[ + "start", + ["text","test: 6+ #s is not a valid header"] +],[ + "start", + ["text","####### foo"] +],[ + "start", + ["text","test: # followed be only space is not a valid header"] +],[ + "start", + ["text","# "] +],[ + "start", + ["text","test: only space between #s is not a valid header"] +],[ + "start", + ["text","# #"] +],[ + "allowBlock" +],[ + "start", + ["markup.heading.1","#"], + ["heading"," test links "], + ["text","["], + ["string","Cloud9 IDE"], + ["text","]("], + ["markup.underline","http://www.c9.io/"], + ["text",")"], + ["heading"," #"] +],[ + "listblock", + ["markup.list","* "], + ["text","["], + ["string","demo"], + ["text","]("], + ["markup.underline","http://ajaxorg.github.com/ace/"], + ["text",")"], + ["list"," "], + ["text","["], + ["string","+"], + ["text","]("], + ["markup.underline","escape(\\) "], + ["text",")"], + ["list"," "], + ["text","["], + ["string","+"], + ["text","]("], + ["markup.underline","a"], + ["string"," \"title\""], + ["text",")"], + ["list"," "], + ["text","["], + ["string","+"], + ["text","]("], + ["markup.underline","a"], + ["string"," \"space\" "], + ["text",")"] +],[ + "listblock", + ["markup.list","* "], + ["list","usually "], + ["string","*work*"], + ["list"," fine ("], + ["string","_em_"], + ["list",")"] +],[ + "listblock", + ["list","in lists"] +],[ + "start" +],[ + "start", + ["text","in plain text "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","b"], + ["meta.tag.punctuation.end",">"], + ["text","http://ace.ajaxorg.com"], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","b"], + ["meta.tag.punctuation.end",">"] +],[ + "allowBlock" +],[ + "start" +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_mushcode.json b/addons/editor/ace/mode/_test/tokens_mushcode.json new file mode 100755 index 00000000..9f8e7cc2 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_mushcode.json @@ -0,0 +1,790 @@ +[[ + "start", + ["text","@"], + ["support.function","create"], + ["text"," "], + ["identifier","phone"] +],[ + "start", + ["text","&"], + ["identifier","pickup"], + ["text"," "], + ["identifier","phone"], + ["keyword.operator","="], + ["identifier","$pick"], + ["text"," "], + ["identifier","up"], + ["text",":@"], + ["support.function","ifelse"], + ["text"," "], + ["paren.lparen","["], + ["support.function","u"], + ["paren.lparen","("], + ["identifier","is"], + ["text",","], + ["support.function","u"], + ["paren.lparen","("], + ["identifier","mode"], + ["paren.rparen",")"], + ["text",","], + ["identifier","ICC"], + ["paren.rparen",")]"], + ["keyword.operator","="], + ["paren.lparen","{"], + ["text","@"], + ["support.function","pemit"], + ["text"," "], + ["keyword.operator","%#="], + ["identifier","You"], + ["text"," "], + ["support.function","pick"], + ["text"," "], + ["identifier","up"], + ["text"," "], + ["identifier","the"], + ["text"," "], + ["paren.lparen","["], + ["support.function","fullname"], + ["paren.lparen","("], + ["identifier","me"], + ["paren.rparen",")]"], + ["text","."], + ["paren.lparen","["], + ["support.function","set"], + ["paren.lparen","("], + ["identifier","me"], + ["text",","], + ["identifier","PHONER"], + ["text",":"], + ["keyword.operator","%#"], + ["paren.rparen",")]"], + ["paren.lparen","["], + ["support.function","set"], + ["paren.lparen","("], + ["identifier","me"], + ["text",","], + ["identifier","MODE"], + ["text",":"], + ["identifier","CIP"], + ["paren.rparen",")]"], + ["paren.lparen","["], + ["support.function","set"], + ["paren.lparen","(["], + ["support.function","u"], + ["paren.lparen","("], + ["identifier","INCOMING"], + ["paren.rparen",")]"], + ["text",","], + ["identifier","CONNECTED"], + ["text",":"], + ["paren.lparen","["], + ["support.function","num"], + ["paren.lparen","("], + ["identifier","me"], + ["paren.rparen",")])]"], + ["paren.lparen","["], + ["support.function","set"], + ["paren.lparen","("], + ["identifier","me"], + ["text",","], + ["identifier","CONNECTED"], + ["text",":"], + ["paren.lparen","["], + ["support.function","u"], + ["paren.lparen","("], + ["identifier","INCOMING"], + ["paren.rparen",")])]"], + ["variable","%r"], + ["paren.lparen","["], + ["support.function","showpicture"], + ["paren.lparen","("], + ["identifier","PICPICKUP"], + ["paren.rparen",")]"], + ["variable","%r"], + ["identifier","Use"], + ["text"," '"], + ["paren.lparen","["], + ["identifier","color"], + ["paren.lparen","("], + ["identifier","green"], + ["text",","], + ["identifier","black"], + ["text",","], + ["identifier","psay"], + ["text"," "], + ["keyword.operator","<"], + ["identifier","message"], + ["keyword.operator",">"], + ["paren.rparen",")]"], + ["text","' "], + ["paren.lparen","("], + ["support.function","or"], + ["text"," '"], + ["paren.lparen","["], + ["identifier","color"], + ["paren.lparen","("], + ["identifier","green"], + ["text",","], + ["identifier","black"], + ["text",","], + ["identifier","p"], + ["text"," "], + ["keyword.operator","<"], + ["identifier","message"], + ["keyword.operator",">"], + ["paren.rparen",")]"], + ["text","'"], + ["paren.rparen",")"], + ["text"," "], + ["identifier","to"], + ["text"," "], + ["identifier","talk"], + ["text"," "], + ["identifier","into"], + ["text"," "], + ["identifier","the"], + ["text"," "], + ["identifier","phone"], + ["text",".;@"], + ["support.function","oemit"], + ["text"," "], + ["keyword.operator","%#="], + ["variable","%N"], + ["text"," "], + ["identifier","picks"], + ["text"," "], + ["identifier","up"], + ["text"," "], + ["identifier","the"], + ["text"," "], + ["paren.lparen","["], + ["support.function","fullname"], + ["paren.lparen","("], + ["identifier","me"], + ["paren.rparen",")]"], + ["text","."], + ["paren.rparen","}"], + ["text",","], + ["paren.lparen","{"], + ["text","@"], + ["support.function","pemit"], + ["text"," "], + ["keyword.operator","%#="], + ["identifier","You"], + ["text"," "], + ["support.function","pick"], + ["text"," "], + ["identifier","up"], + ["text"," "], + ["identifier","the"], + ["text"," "], + ["identifier","phone"], + ["text"," "], + ["identifier","but"], + ["text"," "], + ["identifier","no"], + ["text"," "], + ["identifier","one"], + ["text"," "], + ["identifier","is"], + ["text"," "], + ["identifier","there"], + ["text",". "], + ["identifier","You"], + ["text"," "], + ["identifier","hear"], + ["text"," "], + ["identifier","a"], + ["text"," "], + ["identifier","dialtone"], + ["text"," "], + ["support.function","and"], + ["text"," "], + ["identifier","then"], + ["text"," "], + ["identifier","hang"], + ["text"," "], + ["identifier","up"], + ["text",". "], + ["paren.lparen","["], + ["support.function","play"], + ["paren.lparen","("], + ["support.function","u"], + ["paren.lparen","("], + ["identifier","DIALTONE"], + ["paren.rparen","))]"], + ["text",";@"], + ["support.function","oemit"], + ["text"," "], + ["keyword.operator","%#="], + ["variable","%N"], + ["text"," "], + ["identifier","picks"], + ["text"," "], + ["identifier","up"], + ["text"," "], + ["identifier","the"], + ["text"," "], + ["identifier","phone"], + ["text",", "], + ["identifier","but"], + ["text"," "], + ["identifier","no"], + ["text"," "], + ["identifier","one"], + ["text"," "], + ["identifier","is"], + ["text"," "], + ["identifier","on"], + ["text"," "], + ["identifier","the"], + ["text"," "], + ["identifier","other"], + ["text"," "], + ["identifier","end"], + ["text","."], + ["paren.rparen","}"] +],[ + "start", + ["text","&"], + ["identifier","ringfun"], + ["text"," "], + ["identifier","phone"], + ["keyword.operator","="], + ["paren.lparen","["], + ["support.function","ifelse"], + ["paren.lparen","("], + ["support.function","eq"], + ["paren.lparen","("], + ["support.function","comp"], + ["paren.lparen","(["], + ["support.function","u"], + ["paren.lparen","("], + ["variable","%0"], + ["keyword.operator","/"], + ["identifier","ringtone"], + ["paren.rparen",")]"], + ["text",","], + ["identifier","off"], + ["paren.rparen",")"], + ["text",","], + ["constant.numeric","0"], + ["paren.rparen",")"], + ["text",","], + ["paren.lparen","["], + ["identifier","color"], + ["paren.lparen","("], + ["identifier","black"], + ["text",","], + ["identifier","cyan"], + ["text",","], + ["identifier","INCOMING"], + ["text"," "], + ["identifier","CALL"], + ["text"," "], + ["identifier","FROM"], + ["text"," "], + ["variable","%1"], + ["paren.rparen",")]"], + ["text",","], + ["paren.lparen","["], + ["support.function","play"], + ["paren.lparen","(["], + ["support.function","switch"], + ["paren.lparen","(["], + ["support.function","u"], + ["paren.lparen","("], + ["variable","%0"], + ["keyword.operator","/"], + ["identifier","ringtone"], + ["paren.rparen",")]"], + ["text",","], + ["constant.numeric","1"], + ["text",","], + ["paren.lparen","["], + ["support.function","u"], + ["paren.lparen","("], + ["variable","%0"], + ["keyword.operator","/"], + ["identifier","ringtone1"], + ["paren.rparen",")]"], + ["text",","], + ["constant.numeric","2"], + ["text",","], + ["paren.lparen","["], + ["support.function","u"], + ["paren.lparen","("], + ["variable","%0"], + ["keyword.operator","/"], + ["identifier","ringtone2"], + ["paren.rparen",")]"], + ["text",","], + ["constant.numeric","3"], + ["text",","], + ["paren.lparen","["], + ["support.function","u"], + ["paren.lparen","("], + ["variable","%0"], + ["keyword.operator","/"], + ["identifier","ringtone3"], + ["paren.rparen",")]"], + ["text",","], + ["constant.numeric","4"], + ["text",","], + ["paren.lparen","["], + ["support.function","u"], + ["paren.lparen","("], + ["variable","%0"], + ["keyword.operator","/"], + ["identifier","ringtone4"], + ["paren.rparen",")]"], + ["text",","], + ["constant.numeric","5"], + ["text",","], + ["paren.lparen","["], + ["support.function","u"], + ["paren.lparen","("], + ["variable","%0"], + ["keyword.operator","/"], + ["identifier","ringtone5"], + ["paren.rparen",")]"], + ["text",","], + ["constant.numeric","6"], + ["text",","], + ["paren.lparen","["], + ["support.function","u"], + ["paren.lparen","("], + ["variable","%0"], + ["keyword.operator","/"], + ["identifier","ringtone6"], + ["paren.rparen",")]"], + ["text",","], + ["constant.numeric","7"], + ["text",","], + ["paren.lparen","["], + ["support.function","u"], + ["paren.lparen","("], + ["variable","%0"], + ["keyword.operator","/"], + ["identifier","ringtone7"], + ["paren.rparen",")]"], + ["text",","], + ["constant.numeric","8"], + ["text",","], + ["paren.lparen","["], + ["support.function","u"], + ["paren.lparen","("], + ["variable","%0"], + ["keyword.operator","/"], + ["identifier","ringtone8"], + ["paren.rparen",")]"], + ["text",","], + ["constant.numeric","9"], + ["text",","], + ["paren.lparen","["], + ["support.function","u"], + ["paren.lparen","("], + ["variable","%0"], + ["keyword.operator","/"], + ["identifier","ringtone9"], + ["paren.rparen",")]"], + ["text",","], + ["identifier","custom"], + ["text",","], + ["paren.lparen","["], + ["support.function","u"], + ["paren.lparen","("], + ["variable","%0"], + ["keyword.operator","/"], + ["identifier","customtone"], + ["paren.rparen",")]"], + ["text",","], + ["identifier","vibrate"], + ["text",","], + ["paren.lparen","["], + ["support.function","u"], + ["paren.lparen","("], + ["variable","%0"], + ["keyword.operator","/"], + ["identifier","vibrate"], + ["paren.rparen",")])])]"] +],[ + "start", + ["text","&"], + ["identifier","ringloop"], + ["text"," "], + ["identifier","phone"], + ["keyword.operator","="], + ["text","@"], + ["support.function","switch"], + ["text"," "], + ["paren.lparen","["], + ["support.function","u"], + ["paren.lparen","("], + ["identifier","ringstate"], + ["paren.rparen",")]"], + ["keyword.operator","="], + ["constant.numeric","1"], + ["text",","], + ["paren.lparen","{"], + ["text","@"], + ["support.function","emit"], + ["text"," "], + ["paren.lparen","["], + ["support.function","setq"], + ["paren.lparen","("], + ["identifier","q"], + ["text",","], + ["paren.lparen","["], + ["support.function","u"], + ["paren.lparen","("], + ["identifier","connecting"], + ["paren.rparen",")])]"], + ["paren.lparen","["], + ["support.function","set"], + ["paren.lparen","("], + ["variable","%qq"], + ["text",","], + ["identifier","rangs"], + ["text",":"], + ["constant.numeric","0"], + ["paren.rparen",")]"], + ["paren.lparen","["], + ["support.function","set"], + ["paren.lparen","("], + ["variable","%qq"], + ["text",","], + ["identifier","mode"], + ["text",":"], + ["identifier","WFC"], + ["paren.rparen",")]"], + ["paren.lparen","["], + ["support.function","set"], + ["paren.lparen","("], + ["variable","%qq"], + ["text",","], + ["identifier","INCOMING"], + ["text",":"], + ["paren.rparen",")]"], + ["text",";@"], + ["support.function","ifelse"], + ["text"," "], + ["paren.lparen","["], + ["support.function","u"], + ["paren.lparen","("], + ["variable","%qq"], + ["keyword.operator","/"], + ["identifier","HASVMB"], + ["paren.rparen",")]"], + ["keyword.operator","="], + ["paren.lparen","{"], + ["text","@"], + ["support.function","tr"], + ["text"," "], + ["identifier","me"], + ["keyword.operator","/"], + ["identifier","ROUTEVMB"], + ["keyword.operator","="], + ["paren.lparen","["], + ["support.function","u"], + ["paren.lparen","("], + ["identifier","connecting"], + ["paren.rparen",")]"], + ["text",";"], + ["paren.rparen","}"], + ["text",","], + ["paren.lparen","{"], + ["text","@"], + ["support.function","pemit"], + ["text"," "], + ["keyword.operator","%#="], + ["paren.lparen","["], + ["support.function","u"], + ["paren.lparen","("], + ["identifier","MSGCNC"], + ["paren.rparen",")]"], + ["text",";"], + ["paren.rparen","}}"], + ["text",","], + ["constant.numeric","2"], + ["text",","], + ["paren.lparen","{"], + ["text","@"], + ["support.function","pemit"], + ["text"," "], + ["keyword.operator","%#="], + ["identifier","The"], + ["text"," "], + ["identifier","call"], + ["text"," "], + ["identifier","is"], + ["text"," "], + ["identifier","connected"], + ["text","."], + ["paren.lparen","["], + ["support.function","setq"], + ["paren.lparen","("], + ["identifier","q"], + ["text",","], + ["paren.lparen","["], + ["support.function","u"], + ["paren.lparen","("], + ["identifier","CONNECTING"], + ["paren.rparen",")])]"], + ["paren.lparen","["], + ["support.function","set"], + ["paren.lparen","("], + ["identifier","me"], + ["text",","], + ["identifier","CONNECTED"], + ["text",":"], + ["variable","%qq"], + ["paren.rparen",")]"], + ["paren.lparen","["], + ["support.function","set"], + ["paren.lparen","("], + ["variable","%qq"], + ["text",","], + ["identifier","CONNECTED"], + ["text",":"], + ["paren.lparen","["], + ["support.function","num"], + ["paren.lparen","("], + ["identifier","me"], + ["paren.rparen",")])]"], + ["paren.lparen","["], + ["support.function","set"], + ["paren.lparen","("], + ["variable","%qq"], + ["text",","], + ["identifier","MODE"], + ["text",":"], + ["identifier","CIP"], + ["paren.rparen",")]"], + ["text",";@"], + ["support.function","tr"], + ["text"," "], + ["identifier","me"], + ["keyword.operator","/"], + ["identifier","ciploop"], + ["text",";@"], + ["support.function","tr"], + ["text"," "], + ["variable","%qq"], + ["keyword.operator","/"], + ["identifier","ciploop"], + ["text",";"], + ["paren.rparen","}"], + ["text",","], + ["constant.numeric","3"], + ["text",","], + ["paren.lparen","{"], + ["text","@"], + ["support.function","emit"], + ["text"," "], + ["identifier","On"], + ["text"," "], + ["paren.lparen","["], + ["support.function","fullname"], + ["paren.lparen","("], + ["identifier","me"], + ["paren.rparen",")]"], + ["text","'"], + ["support.function","s"], + ["text"," "], + ["identifier","earpiece"], + ["text"," "], + ["identifier","you"], + ["text"," "], + ["identifier","hear"], + ["text"," "], + ["identifier","a"], + ["text"," "], + ["identifier","ringing"], + ["text"," "], + ["identifier","sound"], + ["text","."], + ["paren.lparen","["], + ["support.function","play"], + ["paren.lparen","("], + ["support.function","u"], + ["paren.lparen","("], + ["identifier","LINETONE"], + ["paren.rparen","))]"], + ["text",";@"], + ["support.function","tr"], + ["text"," "], + ["identifier","me"], + ["keyword.operator","/"], + ["identifier","ringhere"], + ["text",";@"], + ["identifier","increment"], + ["text"," "], + ["paren.lparen","["], + ["support.function","u"], + ["paren.lparen","("], + ["identifier","connecting"], + ["paren.rparen",")]"], + ["keyword.operator","/"], + ["identifier","RANGS"], + ["text",";@"], + ["identifier","wait"], + ["text"," "], + ["constant.numeric","5"], + ["keyword.operator","="], + ["paren.lparen","{"], + ["text","@"], + ["support.function","tr"], + ["text"," "], + ["identifier","me"], + ["keyword.operator","/"], + ["identifier","ringloop"], + ["paren.rparen","}"], + ["text",";"], + ["paren.rparen","}"], + ["text",","], + ["constant.numeric","4"], + ["text",","], + ["paren.lparen","{"], + ["paren.rparen","}"] +],[ + "start", + ["text","&"], + ["identifier","ringstate"], + ["text"," "], + ["identifier","phone"], + ["keyword.operator","="], + ["paren.lparen","["], + ["support.function","setq"], + ["paren.lparen","("], + ["identifier","q"], + ["text",","], + ["support.function","u"], + ["paren.lparen","("], + ["identifier","connecting"], + ["paren.rparen","))]"], + ["paren.lparen","["], + ["support.function","setq"], + ["paren.lparen","("], + ["constant.numeric","1"], + ["text",","], + ["paren.lparen","["], + ["support.function","gt"], + ["paren.lparen","("], + ["support.function","u"], + ["paren.lparen","("], + ["variable","%qq"], + ["keyword.operator","/"], + ["identifier","rangs"], + ["paren.rparen",")"], + ["text",","], + ["support.function","sub"], + ["paren.lparen","("], + ["support.function","u"], + ["paren.lparen","("], + ["variable","%qq"], + ["keyword.operator","/"], + ["identifier","rings"], + ["paren.rparen",")"], + ["text",","], + ["constant.numeric","1"], + ["paren.rparen","))])]"], + ["paren.lparen","["], + ["support.function","setq"], + ["paren.lparen","("], + ["constant.numeric","2"], + ["text",","], + ["paren.lparen","["], + ["support.function","and"], + ["paren.lparen","("], + ["support.function","u"], + ["paren.lparen","("], + ["identifier","is"], + ["text",","], + ["support.function","u"], + ["paren.lparen","("], + ["variable","%qq"], + ["keyword.operator","/"], + ["identifier","MODE"], + ["paren.rparen",")"], + ["text",","], + ["identifier","CIP"], + ["paren.rparen",")"], + ["text",","], + ["support.function","u"], + ["paren.lparen","("], + ["identifier","is"], + ["text",","], + ["support.function","u"], + ["paren.lparen","("], + ["variable","%qq"], + ["keyword.operator","/"], + ["identifier","INCOMING"], + ["paren.rparen",")"], + ["text",","], + ["paren.lparen","["], + ["support.function","num"], + ["paren.lparen","("], + ["identifier","me"], + ["paren.rparen",")]))]"], + ["paren.lparen","["], + ["support.function","setq"], + ["paren.lparen","("], + ["constant.numeric","3"], + ["text",","], + ["paren.lparen","["], + ["support.function","u"], + ["paren.lparen","("], + ["identifier","is"], + ["text",","], + ["support.function","u"], + ["paren.lparen","("], + ["variable","%qq"], + ["keyword.operator","/"], + ["identifier","MODE"], + ["paren.rparen",")"], + ["text",","], + ["identifier","ICC"], + ["paren.rparen",")])]"], + ["paren.lparen","["], + ["support.function","ifelse"], + ["paren.lparen","("], + ["variable","%q1"], + ["text",","], + ["constant.numeric","1"], + ["text",","], + ["support.function","ifelse"], + ["paren.lparen","("], + ["variable","%q2"], + ["text",","], + ["constant.numeric","2"], + ["text",","], + ["support.function","ifelse"], + ["paren.lparen","("], + ["variable","%q3"], + ["text",","], + ["constant.numeric","3"], + ["text",","], + ["constant.numeric","4"], + ["paren.rparen",")))]"] +],[ + "start", + ["text",";"], + ["identifier","comment"] +],[ + "start", + ["text","@@"], + ["paren.lparen","("], + ["identifier","comment"], + ["paren.rparen",")"] +],[ + "start", + ["keyword","say"], + ["text"," "], + ["paren.lparen","["], + ["support.function","time"], + ["paren.lparen","("], + ["paren.rparen",")]"] +],[ + "start" +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_objectivec.json b/addons/editor/ace/mode/_test/tokens_objectivec.json new file mode 100755 index 00000000..c6582d20 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_objectivec.json @@ -0,0 +1,792 @@ +[[ + "start", + ["storage.type.objc","@"], + ["punctuation.definition.storage.type.objc","protocol"], + ["entity.name.type.objc"," Printing"], + ["text",": "], + ["entity.other.inherited-class.objc","someParent"] +],[ + "start", + ["meta.function.objc","-"], + ["paren.lparen","("], + ["storage.type","void"], + ["paren.rparen",")"], + ["text"," "], + ["identifier","print"], + ["punctuation.operator",";"] +],[ + "start", + ["storage.type.objc","@end"] +],[ + "start" +],[ + "start", + ["storage.type.objc","@"], + ["punctuation.definition.storage.type.objc","interface"], + ["entity.name.type.objc"," Fraction"], + ["text",": "], + ["entity.other.inherited-class.objc","NSObject"], + ["text"," "], + ["keyword.operator","<"], + ["identifier","Printing"], + ["punctuation.operator",","], + ["text"," "], + ["support.class.cocoa","NSCopying"], + ["keyword.operator",">"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["storage.type","int"], + ["text"," "], + ["identifier","numerator"], + ["punctuation.operator",";"] +],[ + "start", + ["text"," "], + ["storage.type","int"], + ["text"," "], + ["identifier","denominator"], + ["punctuation.operator",";"] +],[ + "start", + ["paren.rparen","}"] +],[ + "start", + ["storage.type.objc","@end"] +],[ + "start" +],[ + "start", + ["string.begin.objc","@\""], + ["string","blah"], + ["invalid.illegal.unknown-escape.objc","\\8"], + ["punctuation.definition.string.end","\""], + ["text"," "], + ["string.begin.objc","@\""], + ["string","a"], + ["constant.character.escape.objc","\\222"], + ["string","sd"], + ["invalid.illegal.unknown-escape.objc","\\d"], + ["punctuation.definition.string.end","\""], + ["text"," "], + ["string.begin.objc","@\""], + ["constant.character.escape.objc","\\f"], + ["string","aw"], + ["constant.character.escape.objc","\\\"\\?"], + ["string"," "], + ["constant.character.escape.objc","\\'"], + ["string"," "], + ["constant.character.escape.objc","\\4"], + ["string"," n"], + ["constant.character.escape.objc","\\\\"], + ["punctuation.definition.string.end","\""], + ["text"," "], + ["string.begin.objc","@\""], + ["constant.character.escape.objc","\\56"], + ["punctuation.definition.string.end","\""] +],[ + "start", + ["string.begin.objc","@\""], + ["constant.character.escape.objc","\\xSF42"], + ["punctuation.definition.string.end","\""] +],[ + "start" +],[ + "start", + ["meta.function.objc","-"], + ["paren.lparen","("], + ["support.class.cocoa","NSDecimalNumber"], + ["keyword.operator","*"], + ["paren.rparen",")"], + ["identifier","addCount"], + ["punctuation.operator",":"], + ["paren.lparen","("], + ["storage.type.id.objc","id"], + ["paren.rparen",")"], + ["identifier","addObject"], + ["paren.lparen","{"] +],[ + "start" +],[ + "start", + ["keyword.control","return"], + ["text"," "], + ["punctuation.section.scope.begin.objc","["], + ["identifier","count"], + ["text"," "], + ["support.function.any-method.objc","decimalNumberByAdding:"], + ["identifier","addObject"], + ["punctuation.operator","."], + ["identifier","count"], + ["paren.rparen","]"], + ["punctuation.operator",";"] +],[ + "start" +],[ + "start", + ["paren.rparen","}"] +],[ + "start" +],[ + "start", + ["text"," "], + ["keyword.control.macro.objc","NS_DURING"], + ["text"," "], + ["keyword.control.macro.objc","NS_HANDLER"], + ["text"," "], + ["keyword.control.macro.objc","NS_ENDHANDLER"] +],[ + "start" +],[ + "start", + ["punctuation.definition.keyword.objc","@"], + ["keyword.control.exception.objc","try"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["keyword.control","if"], + ["text"," "], + ["paren.lparen","("], + ["identifier","argc"], + ["text"," "], + ["keyword.operator",">"], + ["text"," "], + ["constant.numeric","1"], + ["paren.rparen",")"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["punctuation.definition.keyword.objc","@"], + ["keyword.control.exception.objc","throw"], + ["text"," "], + ["punctuation.section.scope.begin.objc","["], + ["support.class.cocoa","NSException"], + ["text"," "], + ["support.function.any-method.objc","exceptionWithName:"], + ["string.begin.objc","@\""], + ["string","Throwing a test exception"], + ["punctuation.definition.string.end","\""], + ["text"," "], + ["identifier","reason"], + ["punctuation.operator",":"], + ["string.begin.objc","@\""], + ["string","Testing the @throw directive."], + ["punctuation.definition.string.end","\""], + ["text"," "], + ["identifier","userInfo"], + ["punctuation.operator",":"], + ["constant.language.objc","nil"], + ["paren.rparen","]"], + ["punctuation.operator",";"] +],[ + "start", + ["text"," "], + ["paren.rparen","}"] +],[ + "start", + ["paren.rparen","}"], + ["text"," "] +],[ + "start", + ["punctuation.definition.keyword.objc","@"], + ["keyword.control.exception.objc","catch"], + ["text"," "], + ["paren.lparen","("], + ["storage.type.id.objc","id"], + ["text"," "], + ["identifier","theException"], + ["paren.rparen",")"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["support.function.cocoa","NSLog"], + ["paren.lparen","("], + ["string.begin.objc","@\""], + ["string","%@"], + ["punctuation.definition.string.end","\""], + ["punctuation.operator",","], + ["text"," "], + ["identifier","theException"], + ["paren.rparen",")"], + ["punctuation.operator",";"] +],[ + "start", + ["text"," "], + ["identifier","result"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["constant.numeric","1"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["paren.rparen","}"], + ["text"," "] +],[ + "start", + ["punctuation.definition.keyword.objc","@"], + ["keyword.control.exception.objc","finally"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["support.function.cocoa","NSLog"], + ["paren.lparen","("], + ["string.begin.objc","@\""], + ["string","This always happens."], + ["punctuation.definition.string.end","\""], + ["paren.rparen",")"], + ["punctuation.operator",";"] +],[ + "start", + ["text"," "], + ["identifier","result"], + ["text"," "], + ["keyword.operator","+="], + ["text"," "], + ["constant.numeric","2"], + ["text"," "], + ["punctuation.operator",";"] +],[ + "start", + ["paren.rparen","}"] +],[ + "start" +],[ + "start", + ["text"," "], + ["punctuation.definition.storage.modifier.objc","@"], + ["storage.modifier.objc","synchronized"], + ["paren.lparen","("], + ["identifier","lock"], + ["paren.rparen",")"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["support.function.cocoa","NSLog"], + ["paren.lparen","("], + ["string.begin.objc","@\""], + ["string","Hello World"], + ["punctuation.definition.string.end","\""], + ["paren.rparen",")"], + ["punctuation.operator",";"] +],[ + "start", + ["text"," "], + ["paren.rparen","}"] +],[ + "start" +],[ + "start", + ["storage.type","struct"], + ["text"," "], + ["paren.lparen","{"], + ["text"," "], + ["punctuation.definition.keyword.objc","@"], + ["keyword.other.objc","defs"], + ["paren.lparen","("], + ["text"," "], + ["support.class.cocoa","NSObject"], + ["paren.rparen",")"], + ["text"," "], + ["paren.rparen","}"] +],[ + "start" +],[ + "start", + ["storage.type","char"], + ["text"," "], + ["keyword.operator","*"], + ["identifier","enc1"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["punctuation.definition.keyword.objc","@"], + ["keyword.other.objc","encode"], + ["paren.lparen","("], + ["storage.type","int"], + ["paren.rparen",")"], + ["punctuation.operator",";"] +],[ + "start" +],[ + "start", + ["text"," "], + ["storage.type.objc","IBOutlet"], + ["text","|"], + ["storage.type.objc","IBAction"], + ["text","|"], + ["storage.type.objc","BOOL"], + ["text","|"], + ["storage.type.objc","SEL"], + ["text","|"], + ["storage.type.id.objc","id"], + ["text","|"], + ["storage.type.objc","unichar"], + ["text","|"], + ["storage.type.objc","IMP"], + ["text","|"], + ["storage.type.objc","Class"], + ["text"," "] +],[ + "start" +],[ + "start" +],[ + "start", + ["text"," "], + ["punctuation.definition.storage.type.objc","@"], + ["storage.type.objc","class"], + ["text"," "], + ["punctuation.definition.storage.type.objc","@"], + ["storage.type.objc","protocol"] +],[ + "start" +],[ + "start", + ["punctuation.definition.storage.modifier.objc","@"], + ["storage.modifier.objc","public"] +],[ + "start", + ["text"," "], + ["comment","// instance variables"] +],[ + "start", + ["punctuation.definition.storage.modifier.objc","@"], + ["storage.modifier.objc","package"] +],[ + "start", + ["text"," "], + ["comment","// instance variables"] +],[ + "start", + ["punctuation.definition.storage.modifier.objc","@"], + ["storage.modifier.objc","protected"] +],[ + "start", + ["text"," "], + ["comment","// instance variables"] +],[ + "start", + ["punctuation.definition.storage.modifier.objc","@"], + ["storage.modifier.objc","private"] +],[ + "start", + ["text"," "], + ["comment","// instance variables"] +],[ + "start" +],[ + "start", + ["text"," "], + ["constant.language.objc","YES"], + ["text"," "], + ["constant.language.objc","NO"], + ["text"," "], + ["constant.language.objc","Nil"], + ["text"," "], + ["constant.language.objc","nil"] +],[ + "start", + ["support.variable.foundation","NSApp"], + ["paren.lparen","("], + ["paren.rparen",")"] +],[ + "start", + ["support.function.cocoa.leopard","NSRectToCGRect"], + ["text"," "], + ["paren.lparen","("], + ["identifier","Protocol"], + ["text"," "], + ["identifier","ProtocolFromString"], + ["punctuation.operator",":"], + ["string","\"NSTableViewDelegate\""], + ["paren.rparen","))"] +],[ + "start" +],[ + "start", + ["punctuation.section.scope.begin.objc","["], + ["identifier","SPPoint"], + ["text"," "], + ["support.function.any-method.objc","pointFromCGPoint:"], + ["identifier","self"], + ["punctuation.operator","."], + ["identifier","position"], + ["paren.rparen","]"] +],[ + "start" +],[ + "start", + ["support.function.cocoa","NSRoundDownToMultipleOfPageSize"] +],[ + "start" +],[ + "start", + ["keyword","#import"], + ["constant.other"," "] +],[ + "start" +],[ + "start", + ["storage.type","int"], + ["text"," "], + ["identifier","main"], + ["paren.lparen","("], + ["text"," "], + ["storage.type","int"], + ["text"," "], + ["identifier","argc"], + ["punctuation.operator",","], + ["text"," "], + ["storage.modifier","const"], + ["text"," "], + ["storage.type","char"], + ["text"," "], + ["keyword.operator","*"], + ["identifier","argv"], + ["punctuation.section.scope.begin.objc","["], + ["punctuation.section.scope.end.objc","]"], + ["text"," "], + ["paren.rparen",")"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["support.function.C99.c","printf"], + ["paren.lparen","("], + ["text"," "], + ["string","\"hello world\\n\""], + ["text"," "], + ["paren.rparen",")"], + ["punctuation.operator",";"] +],[ + "start", + ["text"," "], + ["keyword.control","return"], + ["text"," "], + ["constant.numeric","0"], + ["punctuation.operator",";"] +],[ + "start", + ["paren.rparen","}"] +],[ + "start" +],[ + "start", + ["support.class.cocoa","NSChangeSpelling"] +],[ + "start" +],[ + "start", + ["string.begin.objc","@\""], + ["string","0 != SUBQUERY(image, $x, 0 != SUBQUERY($x.bookmarkItems, $y, $y.@count == 0).@count).@count"], + ["punctuation.definition.string.end","\""] +],[ + "start" +],[ + "start", + ["punctuation.definition.storage.type.objc","@selector"], + ["punctuation","("], + ["support.function.any-method.name-of-parameter.objc","lowercaseString"], + ["punctuation",")"], + ["text"," "], + ["punctuation.definition.storage.type.objc","@selector"], + ["punctuation","("], + ["support.function.any-method.name-of-parameter.objc","uppercaseString:"], + ["punctuation",")"] +],[ + "start" +],[ + "start", + ["identifier","NSFetchRequest"], + ["text"," "], + ["keyword.operator","*"], + ["identifier","localRequest"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["punctuation.section.scope.begin.objc","[["], + ["identifier","NSFetchRequest"], + ["text"," "], + ["support.function.any-method.objc","alloc"], + ["paren.rparen","]"], + ["text"," "], + ["identifier","init"], + ["paren.rparen","]"], + ["punctuation.operator",";"], + ["text"," "] +],[ + "start", + ["identifier","localRequest"], + ["punctuation.operator","."], + ["identifier","entity"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["punctuation.section.scope.begin.objc","["], + ["identifier","NSEntityDescription"], + ["text"," "], + ["support.function.any-method.objc","entityForName:"], + ["string.begin.objc","@\""], + ["string","VNSource"], + ["punctuation.definition.string.end","\""], + ["text"," "], + ["identifier","inManagedObjectContext"], + ["punctuation.operator",":"], + ["identifier","context"], + ["paren.rparen","]"], + ["punctuation.operator",";"], + ["text"," "] +],[ + "start", + ["identifier","localRequest"], + ["punctuation.operator","."], + ["identifier","sortDescriptors"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["punctuation.section.scope.begin.objc","["], + ["support.class.cocoa","NSArray"], + ["text"," "], + ["support.function.any-method.objc","arrayWithObject:"], + ["punctuation.section.scope.begin.objc","["], + ["support.class.cocoa","NSSortDescriptor"], + ["text"," "], + ["support.function.any-method.objc","sortDescriptorWithKey:"], + ["string.begin.objc","@\""], + ["string","resolution"], + ["punctuation.definition.string.end","\""], + ["text"," "], + ["identifier","ascending"], + ["punctuation.operator",":"], + ["constant.language.objc","YES"], + ["paren.rparen","]]"], + ["punctuation.operator",";"], + ["text"," "] +],[ + "start", + ["support.class.cocoa","NSPredicate"], + ["text"," "], + ["keyword.operator","*"], + ["identifier","predicate"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["punctuation.section.scope.begin.objc","["], + ["support.class.cocoa","NSPredicate"], + ["text"," "], + ["support.function.any-method.objc","predicateWithFormat:"], + ["string.begin.objc","@\""], + ["string","0 != SUBQUERY(image, $x, 0 != SUBQUERY($x.bookmarkItems, $y, $y.@count == 0).@count).@count"], + ["punctuation.definition.string.end","\""], + ["paren.rparen","]"], + ["punctuation.operator",";"] +],[ + "start", + ["punctuation.section.scope.begin.objc","["], + ["support.class.cocoa","NSPredicate"], + ["text"," "], + ["support.function.any-method.objc","predicateWithFormat:"], + ["paren.rparen","]"] +],[ + "start", + ["support.class.cocoa","NSString"], + ["text"," "], + ["keyword.operator","*"], + ["identifier","predicateString"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["punctuation.section.scope.begin.objc","["], + ["support.class.cocoa","NSString"], + ["text"," "], + ["support.function.any-method.objc","stringWithFormat:"], + ["string.begin.objc","@\""], + ["string","SELF beginsWith[cd] %@"], + ["punctuation.definition.string.end","\""], + ["punctuation.operator",","], + ["text"," "], + ["identifier","searchString"], + ["paren.rparen","]"], + ["punctuation.operator",";"] +],[ + "start", + ["support.class.cocoa","NSPredicate"], + ["text"," "], + ["keyword.operator","*"], + ["identifier","pred"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["punctuation.section.scope.begin.objc","["], + ["support.class.cocoa","NSPredicate"], + ["text"," "], + ["support.function.any-method.objc","predicateWithFormat:"], + ["identifier","predicateString"], + ["paren.rparen","]"], + ["punctuation.operator",";"] +],[ + "start", + ["support.class.cocoa","NSArray"], + ["text"," "], + ["keyword.operator","*"], + ["identifier","filteredKeys"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["punctuation.section.scope.begin.objc","[["], + ["identifier","myMutableDictionary"], + ["text"," "], + ["support.function.any-method.objc","allKeys"], + ["paren.rparen","]"], + ["text"," "], + ["identifier","filteredArrayUsingPredicate"], + ["punctuation.operator",":"], + ["identifier","pred"], + ["paren.rparen","]"], + ["punctuation.operator",";"], + ["text"," "] +],[ + "start" +],[ + "start", + ["identifier","localRequest"], + ["punctuation.operator","."], + ["identifier","predicate"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["punctuation.section.scope.begin.objc","["], + ["support.class.cocoa","NSPredicate"], + ["text"," "], + ["support.function.any-method.objc","predicateWithFormat:"], + ["string.begin.objc","@\""], + ["string","whichChart = %@"], + ["punctuation.definition.string.end","\""], + ["text"," "], + ["identifier","argumentArray"], + ["punctuation.operator",":"], + ["text"," "], + ["identifier","listChartToDownload"], + ["paren.rparen","]"], + ["punctuation.operator",";"] +],[ + "start", + ["identifier","localRequest"], + ["punctuation.operator","."], + ["identifier","fetchBatchSize"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["constant.numeric","100"], + ["punctuation.operator",";"] +],[ + "start", + ["identifier","arrayRequest"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["punctuation.section.scope.begin.objc","["], + ["identifier","context"], + ["text"," "], + ["support.function.any-method.objc","executeFetchRequest:"], + ["identifier","localRequest"], + ["text"," "], + ["identifier","error"], + ["punctuation.operator",":"], + ["keyword.operator","&"], + ["identifier","error1"], + ["paren.rparen","]"], + ["punctuation.operator",";"] +],[ + "start" +],[ + "start", + ["punctuation.section.scope.begin.objc","["], + ["identifier","localRequest"], + ["text"," "], + ["support.function.any-method.objc","release"], + ["paren.rparen","]"], + ["punctuation.operator",";"] +],[ + "start" +],[ + "start", + ["keyword","#ifndef"], + ["constant.other"," Nil"] +],[ + "start", + ["keyword","#define"], + ["constant.other"," Nil __DARWIN_NULL "], + ["comment","/* id of Nil class */"] +],[ + "start", + ["keyword","#endif"] +],[ + "start" +],[ + "start", + ["storage.type.objc","@implementation"], + ["entity.name.type.objc"," MyObject"] +],[ + "start", + ["meta.function.objc","- "], + ["paren.lparen","("], + ["storage.type","unsigned"], + ["text"," "], + ["storage.type","int"], + ["paren.rparen",")"], + ["identifier","areaOfWidth"], + ["punctuation.operator",":"], + ["paren.lparen","("], + ["storage.type","unsigned"], + ["text"," "], + ["storage.type","int"], + ["paren.rparen",")"], + ["identifier","width"] +],[ + "start", + ["text"," "], + ["identifier","height"], + ["punctuation.operator",":"], + ["paren.lparen","("], + ["storage.type","unsigned"], + ["text"," "], + ["storage.type","int"], + ["paren.rparen",")"], + ["identifier","height"] +],[ + "start", + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["keyword.control","return"], + ["text"," "], + ["identifier","width"], + ["keyword.operator","*"], + ["identifier","height"], + ["punctuation.operator",";"] +],[ + "start", + ["paren.rparen","}"] +],[ + "start", + ["storage.type.objc","@end"] +],[ + "start" +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_ocaml.json b/addons/editor/ace/mode/_test/tokens_ocaml.json new file mode 100755 index 00000000..73e3cfcd --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_ocaml.json @@ -0,0 +1,200 @@ +[[ + "comment", + ["comment","(*"] +],[ + "comment", + ["comment"," * Example of early return implementation taken from"] +],[ + "comment", + ["comment"," * http://ocaml.janestreet.com/?q=node/91"] +],[ + "start", + ["comment"," *)"] +],[ + "start" +],[ + "start", + ["keyword","let"], + ["text"," "], + ["identifier","with_return"], + ["text"," "], + ["paren.lparen","("], + ["keyword","type"], + ["text"," "], + ["identifier","t"], + ["paren.rparen",")"], + ["text"," "], + ["paren.lparen","("], + ["identifier","f"], + ["text"," : "], + ["identifier","_"], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["identifier","t"], + ["paren.rparen",")"], + ["text"," "], + ["keyword.operator","="] +],[ + "start", + ["text"," "], + ["keyword","let"], + ["text"," "], + ["keyword","module"], + ["text"," "], + ["identifier","M"], + ["text"," "], + ["keyword.operator","="] +],[ + "start", + ["text"," "], + ["keyword","struct"], + ["text"," "], + ["keyword","exception"], + ["text"," "], + ["identifier","Return"], + ["text"," "], + ["keyword","of"], + ["text"," "], + ["identifier","t"], + ["text"," "], + ["keyword","end"] +],[ + "start", + ["text"," "], + ["keyword","in"] +],[ + "start", + ["text"," "], + ["keyword","let"], + ["text"," "], + ["identifier","return"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["paren.lparen","{"], + ["text"," "], + ["identifier","return"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["paren.lparen","("], + ["keyword","fun"], + ["text"," "], + ["identifier","x"], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["support.function","raise"], + ["text"," "], + ["paren.lparen","("], + ["identifier","M"], + ["text","."], + ["identifier","Return"], + ["text"," "], + ["identifier","x"], + ["paren.rparen","))"], + ["text","; "], + ["paren.rparen","}"], + ["text"," "], + ["keyword","in"] +],[ + "start", + ["text"," "], + ["keyword","try"], + ["text"," "], + ["identifier","f"], + ["text"," "], + ["identifier","return"], + ["text"," "], + ["keyword","with"], + ["text"," "], + ["identifier","M"], + ["text","."], + ["identifier","Return"], + ["text"," "], + ["identifier","x"], + ["text"," "], + ["keyword.operator","->"], + ["text"," "], + ["identifier","x"] +],[ + "start" +],[ + "start" +],[ + "start", + ["comment","(* Function that uses the 'early return' functionality provided by `with_return` *)"] +],[ + "start", + ["keyword","let"], + ["text"," "], + ["identifier","sum_until_first_negative"], + ["text"," "], + ["support.function","list"], + ["text"," "], + ["keyword.operator","="] +],[ + "start", + ["text"," "], + ["identifier","with_return"], + ["text"," "], + ["paren.lparen","("], + ["keyword","fun"], + ["text"," "], + ["identifier","r"], + ["text"," "], + ["keyword.operator","->"] +],[ + "start", + ["text"," "], + ["support.function","List"], + ["text","."], + ["support.function","fold"], + ["text"," "], + ["support.function","list"], + ["text"," "], + ["keyword.operator","~"], + ["support.function","init"], + ["text",":"], + ["constant.numeric","0"], + ["text"," "], + ["keyword.operator","~"], + ["identifier","f"], + ["text",":"], + ["paren.lparen","("], + ["keyword","fun"], + ["text"," "], + ["identifier","acc"], + ["text"," "], + ["identifier","x"], + ["text"," "], + ["keyword.operator","->"] +],[ + "start", + ["text"," "], + ["keyword","if"], + ["text"," "], + ["identifier","x"], + ["text"," "], + ["keyword.operator",">="], + ["text"," "], + ["constant.numeric","0"], + ["text"," "], + ["keyword","then"], + ["text"," "], + ["identifier","acc"], + ["text"," "], + ["keyword.operator","+"], + ["text"," "], + ["identifier","x"], + ["text"," "], + ["keyword","else"], + ["text"," "], + ["identifier","r"], + ["text","."], + ["identifier","return"], + ["text"," "], + ["identifier","acc"], + ["paren.rparen","))"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_pascal.json b/addons/editor/ace/mode/_test/tokens_pascal.json new file mode 100755 index 00000000..22c1f0c4 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_pascal.json @@ -0,0 +1,297 @@ +[[ + "punctuation.definition.comment.pascal", + ["punctuation.definition.comment.pascal","(*"], + ["comment.block.pascal.one","****************************************************************************"] +],[ + "punctuation.definition.comment.pascal", + ["comment.block.pascal.one"," * A simple bubble sort program. Reads integers, one per line, and prints *"] +],[ + "punctuation.definition.comment.pascal", + ["comment.block.pascal.one"," * them out in sorted order. Blows up if there are more than 49. *"] +],[ + "start", + ["comment.block.pascal.one"," ****************************************************************************"], + ["punctuation.definition.comment.pascal","*)"] +],[ + "start", + ["keyword.control.pascal","PROGRAM"], + ["text"," Sort(input"], + ["keyword.operator",","], + ["text"," output)"], + ["keyword.operator",";"] +],[ + "start", + ["text"," "], + ["keyword.control.pascal","CONST"] +],[ + "start", + ["text"," "], + ["punctuation.definition.comment.pascal","(*"], + ["comment.block.pascal.one"," Max array size. "], + ["punctuation.definition.comment.pascal","*)"] +],[ + "start", + ["text"," MaxElts "], + ["keyword.operator","="], + ["text"," "], + ["constant.numeric.pascal","50"], + ["keyword.operator",";"] +],[ + "start", + ["text"," "], + ["keyword.control.pascal","TYPE"], + ["text"," "] +],[ + "start", + ["text"," "], + ["punctuation.definition.comment.pascal","(*"], + ["comment.block.pascal.one"," Type of the element array. "], + ["punctuation.definition.comment.pascal","*)"] +],[ + "start", + ["text"," IntArrType "], + ["keyword.operator","="], + ["text"," "], + ["keyword.control.pascal","ARRAY"], + ["text"," ["], + ["constant.numeric.pascal","1"], + ["text","..MaxElts] "], + ["keyword.control.pascal","OF"], + ["text"," Integer"], + ["keyword.operator",";"] +],[ + "start" +],[ + "start", + ["text"," "], + ["keyword.control.pascal","VAR"] +],[ + "start", + ["text"," "], + ["punctuation.definition.comment.pascal","(*"], + ["comment.block.pascal.one"," Indexes, exchange temp, array size. "], + ["punctuation.definition.comment.pascal","*)"] +],[ + "start", + ["text"," i"], + ["keyword.operator",","], + ["text"," j"], + ["keyword.operator",","], + ["text"," tmp"], + ["keyword.operator",","], + ["text"," size: integer"], + ["keyword.operator",";"] +],[ + "start" +],[ + "start", + ["text"," "], + ["punctuation.definition.comment.pascal","(*"], + ["comment.block.pascal.one"," Array of ints "], + ["punctuation.definition.comment.pascal","*)"] +],[ + "start", + ["text"," arr: IntArrType"], + ["keyword.operator",";"] +],[ + "start" +],[ + "start", + ["text"," "], + ["punctuation.definition.comment.pascal","(*"], + ["comment.block.pascal.one"," Read in the integers. "], + ["punctuation.definition.comment.pascal","*)"] +],[ + "start", + ["text"," "], + ["variable.pascal","PROCEDURE"], + ["text"," "], + ["storage.type.function.pascal","ReadArr"], + ["text","("], + ["keyword.control.pascal","VAR"], + ["text"," size: Integer"], + ["keyword.operator",";"], + ["text"," "], + ["keyword.control.pascal","VAR"], + ["text"," a: IntArrType)"], + ["keyword.operator",";"], + ["text"," "] +],[ + "start", + ["text"," "], + ["keyword.control.pascal","BEGIN"] +],[ + "start", + ["text"," size "], + ["keyword.operator",":="], + ["text"," "], + ["constant.numeric.pascal","1"], + ["keyword.operator",";"] +],[ + "start", + ["text"," "], + ["keyword.control.pascal","WHILE"], + ["text"," "], + ["keyword.control.pascal","NOT"], + ["text"," eof "], + ["keyword.control.pascal","DO"], + ["text"," "], + ["keyword.control.pascal","BEGIN"] +],[ + "start", + ["text"," readln(a[size])"], + ["keyword.operator",";"] +],[ + "start", + ["text"," "], + ["keyword.control.pascal","IF"], + ["text"," "], + ["keyword.control.pascal","NOT"], + ["text"," eof "], + ["keyword.control.pascal","THEN"], + ["text"," "] +],[ + "start", + ["text"," size "], + ["keyword.operator",":="], + ["text"," size "], + ["keyword.operator","+"], + ["text"," "], + ["constant.numeric.pascal","1"] +],[ + "start", + ["text"," "], + ["keyword.control.pascal","END"] +],[ + "start", + ["text"," "], + ["keyword.control.pascal","END"], + ["keyword.operator",";"] +],[ + "start" +],[ + "start", + ["text"," "], + ["keyword.control.pascal","BEGIN"] +],[ + "start", + ["text"," "], + ["punctuation.definition.comment.pascal","(*"], + ["comment.block.pascal.one"," Read "], + ["punctuation.definition.comment.pascal","*)"] +],[ + "start", + ["text"," ReadArr(size"], + ["keyword.operator",","], + ["text"," arr)"], + ["keyword.operator",";"] +],[ + "start" +],[ + "start", + ["text"," "], + ["punctuation.definition.comment.pascal","(*"], + ["comment.block.pascal.one"," Sort using bubble sort. "], + ["punctuation.definition.comment.pascal","*)"] +],[ + "start", + ["text"," "], + ["keyword.control.pascal","FOR"], + ["text"," i "], + ["keyword.operator",":="], + ["text"," size "], + ["keyword.operator","-"], + ["text"," "], + ["constant.numeric.pascal","1"], + ["text"," DOWNTO "], + ["constant.numeric.pascal","1"], + ["text"," "], + ["keyword.control.pascal","DO"] +],[ + "start", + ["text"," "], + ["keyword.control.pascal","FOR"], + ["text"," j "], + ["keyword.operator",":="], + ["text"," "], + ["constant.numeric.pascal","1"], + ["text"," "], + ["keyword.control.pascal","TO"], + ["text"," i "], + ["keyword.control.pascal","DO"], + ["text"," "] +],[ + "start", + ["text"," "], + ["keyword.control.pascal","IF"], + ["text"," arr[j] > arr[j "], + ["keyword.operator","+"], + ["text"," "], + ["constant.numeric.pascal","1"], + ["text","] "], + ["keyword.control.pascal","THEN"], + ["text"," "], + ["keyword.control.pascal","BEGIN"] +],[ + "start", + ["text"," tmp "], + ["keyword.operator",":="], + ["text"," arr[j]"], + ["keyword.operator",";"] +],[ + "start", + ["text"," arr[j] "], + ["keyword.operator",":="], + ["text"," arr[j "], + ["keyword.operator","+"], + ["text"," "], + ["constant.numeric.pascal","1"], + ["text","]"], + ["keyword.operator",";"] +],[ + "start", + ["text"," arr[j "], + ["keyword.operator","+"], + ["text"," "], + ["constant.numeric.pascal","1"], + ["text","] "], + ["keyword.operator",":="], + ["text"," tmp"], + ["keyword.operator",";"] +],[ + "start", + ["text"," "], + ["keyword.control.pascal","END"], + ["keyword.operator",";"] +],[ + "start" +],[ + "start", + ["text"," "], + ["punctuation.definition.comment.pascal","(*"], + ["comment.block.pascal.one"," Print. "], + ["punctuation.definition.comment.pascal","*)"] +],[ + "start", + ["text"," "], + ["keyword.control.pascal","FOR"], + ["text"," i "], + ["keyword.operator",":="], + ["text"," "], + ["constant.numeric.pascal","1"], + ["text"," "], + ["keyword.control.pascal","TO"], + ["text"," size "], + ["keyword.control.pascal","DO"] +],[ + "start", + ["text"," writeln(arr[i])"] +],[ + "start", + ["text"," "], + ["keyword.control.pascal","END"], + ["text","."] +],[ + "start", + ["text"," "] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_perl.json b/addons/editor/ace/mode/_test/tokens_perl.json new file mode 100755 index 00000000..30bb39c6 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_perl.json @@ -0,0 +1,227 @@ +[[ + "start", + ["comment","#!/usr/bin/perl"] +],[ + "block_comment", + ["comment.doc","=begin"] +],[ + "block_comment", + ["comment.doc"," perl example code for Ace"] +],[ + "start", + ["comment.doc","=cut"] +],[ + "start" +],[ + "start", + ["keyword","use"], + ["text"," "], + ["identifier","strict"], + ["text",";"] +],[ + "start", + ["keyword","use"], + ["text"," "], + ["identifier","warnings"], + ["text",";"] +],[ + "start", + ["keyword","my"], + ["text"," "], + ["identifier","$num_primes"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["constant.numeric","0"], + ["text",";"] +],[ + "start", + ["keyword","my"], + ["text"," @"], + ["identifier","primes"], + ["text",";"] +],[ + "start" +],[ + "start", + ["comment","# Put 2 as the first prime so we won't have an empty array"] +],[ + "start", + ["identifier","$primes"], + ["lparen","["], + ["identifier","$num_primes"], + ["rparen","]"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["constant.numeric","2"], + ["text",";"] +],[ + "start", + ["identifier","$num_primes"], + ["keyword.operator","++"], + ["text",";"] +],[ + "start" +],[ + "start", + ["identifier","MAIN_LOOP"], + ["text",":"] +],[ + "start", + ["keyword","for"], + ["text"," "], + ["keyword","my"], + ["text"," "], + ["identifier","$number_to_check"], + ["text"," "], + ["lparen","("], + ["constant.numeric","3"], + ["text"," "], + ["keyword.operator",".."], + ["text"," "], + ["constant.numeric","200"], + ["rparen",")"] +],[ + "start", + ["lparen","{"] +],[ + "start", + ["text"," "], + ["keyword","for"], + ["text"," "], + ["keyword","my"], + ["text"," "], + ["identifier","$p"], + ["text"," "], + ["lparen","("], + ["constant.numeric","0"], + ["text"," "], + ["keyword.operator",".."], + ["text"," "], + ["lparen","("], + ["identifier","$num_primes"], + ["constant.numeric","-1"], + ["rparen","))"] +],[ + "start", + ["text"," "], + ["lparen","{"] +],[ + "start", + ["text"," "], + ["keyword","if"], + ["text"," "], + ["lparen","("], + ["identifier","$number_to_check"], + ["text"," "], + ["keyword.operator","%"], + ["text"," "], + ["identifier","$primes"], + ["lparen","["], + ["identifier","$p"], + ["rparen","]"], + ["text"," "], + ["keyword.operator","=="], + ["text"," "], + ["constant.numeric","0"], + ["rparen",")"] +],[ + "start", + ["text"," "], + ["lparen","{"] +],[ + "start", + ["text"," "], + ["keyword","next"], + ["text"," "], + ["identifier","MAIN_LOOP"], + ["text",";"] +],[ + "start", + ["text"," "], + ["rparen","}"] +],[ + "start", + ["text"," "], + ["rparen","}"] +],[ + "start" +],[ + "start", + ["text"," "], + ["comment","# If we reached this point it means $number_to_check is not"] +],[ + "start", + ["text"," "], + ["comment","# divisable by any prime number that came before it."] +],[ + "start", + ["text"," "], + ["identifier","$primes"], + ["lparen","["], + ["identifier","$num_primes"], + ["rparen","]"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["identifier","$number_to_check"], + ["text",";"] +],[ + "start", + ["text"," "], + ["identifier","$num_primes"], + ["keyword.operator","++"], + ["text",";"] +],[ + "start", + ["rparen","}"] +],[ + "start" +],[ + "start", + ["keyword","for"], + ["text"," "], + ["keyword","my"], + ["text"," "], + ["identifier","$p"], + ["text"," "], + ["lparen","("], + ["constant.numeric","0"], + ["text"," "], + ["keyword.operator",".."], + ["text"," "], + ["lparen","("], + ["identifier","$num_primes"], + ["constant.numeric","-1"], + ["rparen","))"] +],[ + "start", + ["lparen","{"] +],[ + "start", + ["text"," "], + ["support.function","print"], + ["text"," "], + ["identifier","$primes"], + ["lparen","["], + ["identifier","$p"], + ["rparen","]"], + ["keyword.operator",","], + ["text"," "], + ["string","\", \""], + ["text",";"] +],[ + "start", + ["rparen","}"] +],[ + "start", + ["support.function","print"], + ["text"," "], + ["string","\"\\n\""], + ["text",";"] +],[ + "start" +],[ + "start" +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_pgsql.json b/addons/editor/ace/mode/_test/tokens_pgsql.json new file mode 100755 index 00000000..ded4bb86 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_pgsql.json @@ -0,0 +1,735 @@ +[[ + "start" +],[ + "start", + ["keyword.statementBegin","BEGIN"], + ["statementEnd",";"] +],[ + "start" +],[ + "doc-start", + ["comment.doc","/**"] +],[ + "doc-start", + ["comment.doc","* Samples from PostgreSQL src/tutorial/basics.source"] +],[ + "start", + ["comment.doc","*/"] +],[ + "statement", + ["keyword.statementBegin","CREATE"], + ["text"," "], + ["keyword","TABLE"], + ["text"," "], + ["identifier","weather"], + ["text"," "], + ["paren.lparen","("] +],[ + "statement", + ["text","\t"], + ["identifier","city"], + ["text","\t\t"], + ["keyword","varchar"], + ["paren.lparen","("], + ["constant.numeric","80"], + ["paren.rparen",")"], + ["text",","] +],[ + "statement", + ["text","\t"], + ["identifier","temp_lo"], + ["text","\t\t"], + ["keyword","int"], + ["text",",\t\t"], + ["comment","-- low temperature"] +],[ + "statement", + ["text","\t"], + ["identifier","temp_hi"], + ["text","\t\t"], + ["keyword","int"], + ["text",",\t\t"], + ["comment","-- high temperature"] +],[ + "statement", + ["text","\t"], + ["identifier","prcp"], + ["text","\t\t"], + ["keyword","real"], + ["text",",\t\t"], + ["comment","-- precipitation"] +],[ + "statement", + ["text","\t"], + ["variable.language","\"date\""], + ["text","\t\t"], + ["keyword","date"] +],[ + "start", + ["paren.rparen",")"], + ["statementEnd",";"] +],[ + "start" +],[ + "statement", + ["keyword.statementBegin","CREATE"], + ["text"," "], + ["keyword","TABLE"], + ["text"," "], + ["identifier","cities"], + ["text"," "], + ["paren.lparen","("] +],[ + "statement", + ["text","\t"], + ["keyword","name"], + ["text","\t\t"], + ["keyword","varchar"], + ["paren.lparen","("], + ["constant.numeric","80"], + ["paren.rparen",")"], + ["text",","] +],[ + "statement", + ["text","\t"], + ["keyword","location"], + ["text","\t"], + ["keyword","point"] +],[ + "start", + ["paren.rparen",")"], + ["statementEnd",";"] +],[ + "start" +],[ + "start" +],[ + "statement", + ["keyword.statementBegin","INSERT"], + ["text"," "], + ["keyword","INTO"], + ["text"," "], + ["identifier","weather"] +],[ + "start", + ["text"," "], + ["keyword","VALUES"], + ["text"," "], + ["paren.lparen","("], + ["string","'San Francisco'"], + ["text",", "], + ["constant.numeric","46"], + ["text",", "], + ["constant.numeric","50"], + ["text",", "], + ["constant.numeric","0.25"], + ["text",", "], + ["string","'1994-11-27'"], + ["paren.rparen",")"], + ["statementEnd",";"] +],[ + "start" +],[ + "statement", + ["keyword.statementBegin","INSERT"], + ["text"," "], + ["keyword","INTO"], + ["text"," "], + ["identifier","cities"] +],[ + "start", + ["text"," "], + ["keyword","VALUES"], + ["text"," "], + ["paren.lparen","("], + ["string","'San Francisco'"], + ["text",", "], + ["string","'(-194.0, 53.0)'"], + ["paren.rparen",")"], + ["statementEnd",";"] +],[ + "start" +],[ + "statement", + ["keyword.statementBegin","INSERT"], + ["text"," "], + ["keyword","INTO"], + ["text"," "], + ["identifier","weather"], + ["text"," "], + ["paren.lparen","("], + ["identifier","city"], + ["text",", "], + ["identifier","temp_lo"], + ["text",", "], + ["identifier","temp_hi"], + ["text",", "], + ["identifier","prcp"], + ["text",", "], + ["variable.language","\"date\""], + ["paren.rparen",")"] +],[ + "start", + ["text"," "], + ["keyword","VALUES"], + ["text"," "], + ["paren.lparen","("], + ["string","'San Francisco'"], + ["text",", "], + ["constant.numeric","43"], + ["text",", "], + ["constant.numeric","57"], + ["text",", "], + ["constant.numeric","0.0"], + ["text",", "], + ["string","'1994-11-29'"], + ["paren.rparen",")"], + ["statementEnd",";"] +],[ + "start" +],[ + "statement", + ["keyword.statementBegin","INSERT"], + ["text"," "], + ["keyword","INTO"], + ["text"," "], + ["identifier","weather"], + ["text"," "], + ["paren.lparen","("], + ["keyword","date"], + ["text",", "], + ["identifier","city"], + ["text",", "], + ["identifier","temp_hi"], + ["text",", "], + ["identifier","temp_lo"], + ["paren.rparen",")"] +],[ + "start", + ["text"," "], + ["keyword","VALUES"], + ["text"," "], + ["paren.lparen","("], + ["string","'1994-11-29'"], + ["text",", "], + ["string","'Hayward'"], + ["text",", "], + ["constant.numeric","54"], + ["text",", "], + ["constant.numeric","37"], + ["paren.rparen",")"], + ["statementEnd",";"] +],[ + "start" +],[ + "start" +],[ + "start", + ["keyword.statementBegin","SELECT"], + ["text"," "], + ["identifier","city"], + ["text",", "], + ["paren.lparen","("], + ["identifier","temp_hi"], + ["keyword.operator","+"], + ["identifier","temp_lo"], + ["paren.rparen",")"], + ["keyword.operator","/"], + ["constant.numeric","2"], + ["text"," "], + ["keyword","AS"], + ["text"," "], + ["identifier","temp_avg"], + ["text",", "], + ["variable.language","\"date\""], + ["text"," "], + ["keyword","FROM"], + ["text"," "], + ["identifier","weather"], + ["statementEnd",";"] +],[ + "start" +],[ + "statement", + ["keyword.statementBegin","SELECT"], + ["text"," "], + ["identifier","city"], + ["text",", "], + ["identifier","temp_lo"], + ["text",", "], + ["identifier","temp_hi"], + ["text",", "], + ["identifier","prcp"], + ["text",", "], + ["variable.language","\"date\""], + ["text",", "], + ["keyword","location"] +],[ + "statement", + ["text"," "], + ["keyword","FROM"], + ["text"," "], + ["identifier","weather"], + ["text",", "], + ["identifier","cities"] +],[ + "start", + ["text"," "], + ["keyword","WHERE"], + ["text"," "], + ["identifier","city"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["keyword","name"], + ["statementEnd",";"] +],[ + "start" +],[ + "start" +],[ + "start" +],[ + "doc-start", + ["comment.doc","/**"] +],[ + "doc-start", + ["comment.doc","* Dollar quotes starting at the end of the line are colored as SQL unless"] +],[ + "doc-start", + ["comment.doc","* a special language tag is used. Pearl and Python are currently implemented"] +],[ + "doc-start", + ["comment.doc","* but lots of others are possible."] +],[ + "start", + ["comment.doc","*/"] +],[ + "statement", + ["keyword.statementBegin","create"], + ["text"," "], + ["keyword","or"], + ["text"," "], + ["keyword","replace"], + ["text"," "], + ["keyword","function"], + ["text"," "], + ["identifier","blob_content_chunked"], + ["paren.lparen","("] +],[ + "statement", + ["text"," "], + ["keyword","in"], + ["text"," "], + ["identifier","p_data"], + ["text"," "], + ["keyword","bytea"], + ["text",", "] +],[ + "statement", + ["text"," "], + ["keyword","in"], + ["text"," "], + ["identifier","p_chunk"], + ["text"," "], + ["keyword","integer"], + ["paren.rparen",")"] +],[ + "dollarSql", + ["keyword","returns"], + ["text"," "], + ["keyword","setof"], + ["text"," "], + ["keyword","bytea"], + ["text"," "], + ["keyword","as"], + ["text"," "], + ["string","$$"] +],[ + "dollarSql", + ["comment","-- Still SQL comments"] +],[ + "dollarSql", + ["keyword","declare"] +],[ + "dollarSql", + ["text","\t"], + ["identifier","v_size"], + ["text"," "], + ["keyword","integer"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["support.function","octet_length"], + ["paren.lparen","("], + ["identifier","p_data"], + ["paren.rparen",")"], + ["text",";"] +],[ + "dollarSql", + ["keyword","begin"] +],[ + "dollarSql", + ["text","\t"], + ["keyword","for"], + ["text"," "], + ["identifier","i"], + ["text"," "], + ["keyword","in"], + ["text"," "], + ["constant.numeric","1"], + ["text",".."], + ["identifier","v_size"], + ["text"," "], + ["keyword","by"], + ["text"," "], + ["identifier","p_chunk"], + ["text"," "], + ["identifier","loop"] +],[ + "dollarSql", + ["text","\t\t"], + ["identifier","return"], + ["text"," "], + ["keyword","next"], + ["text"," "], + ["keyword","substring"], + ["paren.lparen","("], + ["identifier","p_data"], + ["text"," "], + ["keyword","from"], + ["text"," "], + ["identifier","i"], + ["text"," "], + ["keyword","for"], + ["text"," "], + ["identifier","p_chunk"], + ["paren.rparen",")"], + ["text",";"] +],[ + "dollarSql", + ["text","\t"], + ["keyword","end"], + ["text"," "], + ["identifier","loop"], + ["text",";"] +],[ + "dollarSql", + ["keyword","end"], + ["text",";"] +],[ + "start", + ["string","$$"], + ["text"," "], + ["keyword","language"], + ["text"," "], + ["identifier","plpgsql"], + ["text"," "], + ["keyword","stable"], + ["statementEnd",";"] +],[ + "start" +],[ + "start" +],[ + "start", + ["comment","-- pl/perl"] +],[ + "perl-start", + ["keyword.statementBegin","CREATE"], + ["text"," "], + ["keyword","FUNCTION"], + ["text"," "], + ["identifier","perl_max"], + ["text"," "], + ["paren.lparen","("], + ["keyword","integer"], + ["text",", "], + ["keyword","integer"], + ["paren.rparen",")"], + ["text"," "], + ["keyword","RETURNS"], + ["text"," "], + ["keyword","integer"], + ["text"," "], + ["keyword","AS"], + ["text"," "], + ["string","$perl$"] +],[ + "perl-start", + ["text"," "], + ["comment","# perl comment..."] +],[ + "perl-start", + ["text"," "], + ["keyword","my"], + ["text"," "], + ["lparen","("], + ["identifier","$x"], + ["keyword.operator",","], + ["identifier","$y"], + ["rparen",")"], + ["text"," "], + ["keyword.operator","="], + ["text"," @"], + ["identifier","_"], + ["text",";"] +],[ + "perl-start", + ["text"," "], + ["keyword","if"], + ["text"," "], + ["lparen","("], + ["keyword.operator","!"], + ["text"," "], + ["support.function","defined"], + ["text"," "], + ["identifier","$x"], + ["rparen",")"], + ["text"," "], + ["lparen","{"] +],[ + "perl-start", + ["text"," "], + ["keyword","if"], + ["text"," "], + ["lparen","("], + ["keyword.operator","!"], + ["text"," "], + ["support.function","defined"], + ["text"," "], + ["identifier","$y"], + ["rparen",")"], + ["text"," "], + ["lparen","{"], + ["text"," "], + ["support.function","return"], + ["text"," "], + ["support.function","undef"], + ["text","; "], + ["rparen","}"] +],[ + "perl-start", + ["text"," "], + ["support.function","return"], + ["text"," "], + ["identifier","$y"], + ["text",";"] +],[ + "perl-start", + ["text"," "], + ["rparen","}"] +],[ + "perl-start", + ["text"," "], + ["keyword","if"], + ["text"," "], + ["lparen","("], + ["keyword.operator","!"], + ["text"," "], + ["support.function","defined"], + ["text"," "], + ["identifier","$y"], + ["rparen",")"], + ["text"," "], + ["lparen","{"], + ["text"," "], + ["support.function","return"], + ["text"," "], + ["identifier","$x"], + ["text","; "], + ["rparen","}"] +],[ + "perl-start", + ["text"," "], + ["keyword","if"], + ["text"," "], + ["lparen","("], + ["identifier","$x"], + ["text"," "], + ["keyword.operator",">"], + ["text"," "], + ["identifier","$y"], + ["rparen",")"], + ["text"," "], + ["lparen","{"], + ["text"," "], + ["support.function","return"], + ["text"," "], + ["identifier","$x"], + ["text","; "], + ["rparen","}"] +],[ + "perl-start", + ["text"," "], + ["support.function","return"], + ["text"," "], + ["identifier","$y"], + ["text",";"] +],[ + "start", + ["string","$perl$"], + ["text"," "], + ["keyword","LANGUAGE"], + ["text"," "], + ["identifier","plperl"], + ["statementEnd",";"] +],[ + "start" +],[ + "start", + ["comment","-- pl/python"] +],[ + "python-start", + ["keyword.statementBegin","CREATE"], + ["text"," "], + ["keyword","FUNCTION"], + ["text"," "], + ["identifier","usesavedplan"], + ["paren.lparen","("], + ["paren.rparen",")"], + ["text"," "], + ["keyword","RETURNS"], + ["text"," "], + ["keyword","trigger"], + ["text"," "], + ["keyword","AS"], + ["text"," "], + ["string","$python$"] +],[ + "python-start", + ["text"," "], + ["comment","# python comment..."] +],[ + "python-start", + ["text"," "], + ["keyword","if"], + ["text"," "], + ["identifier","SD"], + ["text","."], + ["identifier","has_key"], + ["paren.lparen","("], + ["string","\"plan\""], + ["paren.rparen",")"], + ["text",":"] +],[ + "python-start", + ["text"," "], + ["identifier","plan"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["identifier","SD"], + ["paren.lparen","["], + ["string","\"plan\""], + ["paren.rparen","]"] +],[ + "python-start", + ["text"," "], + ["keyword","else"], + ["text",":"] +],[ + "python-start", + ["text"," "], + ["identifier","plan"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["identifier","plpy"], + ["text","."], + ["identifier","prepare"], + ["paren.lparen","("], + ["string","\"SELECT 1\""], + ["paren.rparen",")"] +],[ + "python-start", + ["text"," "], + ["identifier","SD"], + ["paren.lparen","["], + ["string","\"plan\""], + ["paren.rparen","]"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["identifier","plan"] +],[ + "start", + ["string","$python$"], + ["text"," "], + ["keyword","LANGUAGE"], + ["text"," "], + ["identifier","plpythonu"], + ["statementEnd",";"] +],[ + "start" +],[ + "start" +],[ + "start", + ["comment","-- psql commands"] +],[ + "start", + ["support.buildin","\\df cash*"] +],[ + "start" +],[ + "start" +],[ + "start", + ["comment","-- Some string samples."] +],[ + "start", + ["keyword.statementBegin","select"], + ["text"," "], + ["string","'don''t do it now;'"], + ["text"," "], + ["keyword.operator","||"], + ["text"," "], + ["string","'maybe later'"], + ["statementEnd",";"] +],[ + "start", + ["keyword.statementBegin","select"], + ["text"," "], + ["identifier","E"], + ["string","'dont\\'t do it'"], + ["statementEnd",";"] +],[ + "start", + ["keyword.statementBegin","select"], + ["text"," "], + ["support.function","length"], + ["paren.lparen","("], + ["string","'some other''s stuff'"], + ["text"," "], + ["keyword.operator","||"], + ["text"," "], + ["string","$$cat in hat's stuff $$"], + ["paren.rparen",")"], + ["statementEnd",";"] +],[ + "start" +],[ + "dollarStatementString", + ["keyword.statementBegin","select"], + ["text"," "], + ["string","$$ strings"] +],[ + "dollarStatementString", + ["string","over multiple "] +],[ + "dollarStatementString", + ["string","lines - use dollar quotes"] +],[ + "start", + ["string","$$"], + ["statementEnd",";"] +],[ + "start" +],[ + "start", + ["keyword.statementBegin","END"], + ["statementEnd",";"] +],[ + "start" +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_php.json b/addons/editor/ace/mode/_test/tokens_php.json new file mode 100755 index 00000000..d8a41eec --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_php.json @@ -0,0 +1,134 @@ +[[ + "php-start", + ["support.php_tag",""] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_powershell.json b/addons/editor/ace/mode/_test/tokens_powershell.json new file mode 100755 index 00000000..43b77db4 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_powershell.json @@ -0,0 +1,184 @@ +[[ + "start", + ["comment","# This is a simple comment"] +],[ + "start", + ["keyword","function"], + ["text"," "], + ["identifier","Hello"], + ["lparen","("], + ["variable.instance","$name"], + ["rparen",")"], + ["text"," "], + ["lparen","{"] +],[ + "start", + ["text"," "], + ["identifier","Write-host"], + ["text"," "], + ["string","\"Hello $name\""] +],[ + "start", + ["rparen","}"] +],[ + "start" +],[ + "start", + ["keyword","function"], + ["text"," "], + ["identifier","add"], + ["lparen","("], + ["variable.instance","$left"], + ["text",", "], + ["variable.instance","$right"], + ["keyword.operator","="], + ["constant.numeric","4"], + ["rparen",")"], + ["text"," "], + ["lparen","{"] +],[ + "start", + ["text"," "], + ["keyword","if"], + ["text"," "], + ["lparen","("], + ["variable.instance","$right"], + ["text"," "], + ["keyword.operator","-ne"], + ["text"," "], + ["constant.numeric","4"], + ["rparen",")"], + ["text"," "], + ["lparen","{"] +],[ + "start", + ["text"," "], + ["keyword","return"], + ["text"," "], + ["variable.instance","$left"] +],[ + "start", + ["text"," "], + ["rparen","}"], + ["text"," "], + ["keyword","elseif"], + ["text"," "], + ["lparen","("], + ["variable.instance","$left"], + ["text"," "], + ["keyword.operator","-eq"], + ["text"," "], + ["constant.language","$null"], + ["text"," "], + ["keyword.operator","-and"], + ["text"," "], + ["variable.instance","$right"], + ["text"," "], + ["keyword.operator","-eq"], + ["text"," "], + ["constant.numeric","2"], + ["rparen",")"], + ["text"," "], + ["lparen","{"] +],[ + "start", + ["text"," "], + ["keyword","return"], + ["text"," "], + ["constant.numeric","3"] +],[ + "start", + ["text"," "], + ["rparen","}"], + ["text"," "], + ["keyword","else"], + ["text"," "], + ["lparen","{"] +],[ + "start", + ["text"," "], + ["keyword","return"], + ["text"," "], + ["constant.numeric","2"] +],[ + "start", + ["text"," "], + ["rparen","}"] +],[ + "start", + ["rparen","}"] +],[ + "start" +],[ + "start", + ["variable.instance","$number"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["constant.numeric","1"], + ["text"," "], + ["keyword.operator","+"], + ["text"," "], + ["constant.numeric","2"], + ["text",";"] +],[ + "start", + ["variable.instance","$number"], + ["text"," "], + ["keyword.operator","+="], + ["text"," "], + ["constant.numeric","3"] +],[ + "start" +],[ + "start", + ["support.function","Write-Host"], + ["text"," "], + ["identifier","Hello"], + ["text"," "], + ["keyword.operator","-"], + ["identifier","name"], + ["text"," "], + ["string","\"World\""] +],[ + "start" +],[ + "start", + ["variable.instance","$an_array"], + ["text"," "], + ["keyword.operator","="], + ["text"," @"], + ["lparen","("], + ["constant.numeric","1"], + ["text",", "], + ["constant.numeric","2"], + ["text",", "], + ["constant.numeric","3"], + ["rparen",")"] +],[ + "start", + ["variable.instance","$a_hash"], + ["text"," "], + ["keyword.operator","="], + ["text"," @"], + ["lparen","{"], + ["string","\"something\""], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["string","\"something else\""], + ["rparen","}"] +],[ + "start" +],[ + "start", + ["keyword.operator","&"], + ["text"," "], + ["identifier","notepad"], + ["text"," .\\"], + ["identifier","readme"], + ["text","."], + ["identifier","md"] +],[ + "start" +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_prolog.json b/addons/editor/ace/mode/_test/tokens_prolog.json new file mode 100755 index 00000000..e42b65b5 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_prolog.json @@ -0,0 +1,265 @@ +[[ + "start", + ["entity.name.function.fact.prolog","partition"], + ["punctuation.begin.fact.parameters.prolog","("], + ["punctuation.begin.list.prolog","["], + ["punctuation.end.list.prolog","]"], + ["punctuation.separator.parameters.prolog",","], + ["meta.fact.prolog"," "], + ["variable.language.anonymous.prolog","_"], + ["punctuation.separator.parameters.prolog",","], + ["meta.fact.prolog"," "], + ["punctuation.begin.list.prolog","["], + ["punctuation.end.list.prolog","]"], + ["punctuation.separator.parameters.prolog",","], + ["meta.fact.prolog"," "], + ["punctuation.begin.list.prolog","["], + ["punctuation.end.list.prolog","]"], + ["punctuation.end.fact.parameters.prolog",")"], + ["punctuation.end.fact.prolog","."] +],[ + ["keyword.operator.definition.prolog","meta.rule.prolog"], + ["entity.name.function.rule.prolog","partition"], + ["punctuation.rule.parameters.begin.prolog","("], + ["punctuation.begin.list.prolog","["], + ["variable.other.prolog","X"], + ["punctuation.concat.list.prolog","|"], + ["variable.other.prolog","Xs"], + ["punctuation.end.list.prolog","]"], + ["punctuation.separator.parameters.prolog",","], + ["meta.rule.parameters.prolog"," "], + ["variable.parameter.prolog","Pivot"], + ["punctuation.separator.parameters.prolog",","], + ["meta.rule.parameters.prolog"," "], + ["variable.parameter.prolog","Smalls"], + ["punctuation.separator.parameters.prolog",","], + ["meta.rule.parameters.prolog"," "], + ["variable.parameter.prolog","Bigs"], + ["punctuation.rule.parameters.end.prolog",")"], + ["meta.rule.signature.prolog"," "], + ["keyword.operator.definition.prolog",":-"] +],[ + ["meta.expression.prolog","keyword.operator.definition.prolog","keyword.operator.definition.prolog","meta.rule.prolog"], + ["meta.rule.definition.prolog"," "], + ["meta.expression.prolog","( "], + ["variable.other.prolog","X"], + ["meta.expression.prolog"," @"], + ["keyword.operator.prolog","<"], + ["meta.expression.prolog"," "], + ["variable.other.prolog","Pivot"], + ["meta.expression.prolog"," "], + ["keyword.operator.prolog","->"] +],[ + ["meta.expression.prolog","keyword.operator.definition.prolog","keyword.operator.definition.prolog","meta.rule.prolog"], + ["meta.expression.prolog"," "], + ["variable.other.prolog","Smalls"], + ["meta.expression.prolog"," "], + ["keyword.operator.prolog","="], + ["meta.expression.prolog"," "], + ["punctuation.begin.list.prolog","["], + ["variable.other.prolog","X"], + ["punctuation.concat.list.prolog","|"], + ["variable.other.prolog","Rest"], + ["punctuation.end.list.prolog","]"], + ["punctuation.control.and.prolog",","] +],[ + ["meta.expression.prolog","keyword.operator.definition.prolog","keyword.operator.definition.prolog","meta.rule.prolog"], + ["meta.expression.prolog"," "], + ["constant.other.atom.prolog","partition"], + ["punctuation.begin.statement.parameters.prolog","("], + ["variable.other.prolog","Xs"], + ["punctuation.separator.statement.prolog",","], + ["meta.statement.parameters.prolog"," "], + ["variable.other.prolog","Pivot"], + ["punctuation.separator.statement.prolog",","], + ["meta.statement.parameters.prolog"," "], + ["variable.other.prolog","Rest"], + ["punctuation.separator.statement.prolog",","], + ["meta.statement.parameters.prolog"," "], + ["variable.other.prolog","Bigs"], + ["punctuation.end.statement.parameters.prolog",")"] +],[ + ["meta.expression.prolog","keyword.operator.definition.prolog","keyword.operator.definition.prolog","meta.rule.prolog"], + ["meta.expression.prolog"," "], + ["punctuation.control.or.prolog",";"], + ["meta.expression.prolog"," "], + ["variable.other.prolog","Bigs"], + ["meta.expression.prolog"," "], + ["keyword.operator.prolog","="], + ["meta.expression.prolog"," "], + ["punctuation.begin.list.prolog","["], + ["variable.other.prolog","X"], + ["punctuation.concat.list.prolog","|"], + ["variable.other.prolog","Rest"], + ["punctuation.end.list.prolog","]"], + ["punctuation.control.and.prolog",","] +],[ + ["meta.expression.prolog","keyword.operator.definition.prolog","keyword.operator.definition.prolog","meta.rule.prolog"], + ["meta.expression.prolog"," "], + ["constant.other.atom.prolog","partition"], + ["punctuation.begin.statement.parameters.prolog","("], + ["variable.other.prolog","Xs"], + ["punctuation.separator.statement.prolog",","], + ["meta.statement.parameters.prolog"," "], + ["variable.other.prolog","Pivot"], + ["punctuation.separator.statement.prolog",","], + ["meta.statement.parameters.prolog"," "], + ["variable.other.prolog","Smalls"], + ["punctuation.separator.statement.prolog",","], + ["meta.statement.parameters.prolog"," "], + ["variable.other.prolog","Rest"], + ["punctuation.end.statement.parameters.prolog",")"] +],[ + "start", + ["meta.expression.prolog"," )"], + ["punctuation.rule.end.prolog","."] +],[ + "start", + ["text"," "] +],[ + "entity.name.function.fact.prolog", + ["entity.name.function.fact.prolog","quicksort"], + ["punctuation.begin.fact.parameters.prolog","("], + ["punctuation.begin.list.prolog","["], + ["punctuation.end.list.prolog","]"], + ["invalid.illegal.invalidchar.prolog",")"], + ["meta.fact.prolog"," "], + ["invalid.illegal.invalidchar.prolog","-"], + ["keyword.operator.prolog","->"], + ["meta.fact.prolog"," "], + ["punctuation.begin.list.prolog","["], + ["punctuation.end.list.prolog","]"], + ["invalid.illegal.invalidchar.prolog","."] +],[ + "entity.name.function.fact.prolog", + ["constant.other.atom.prolog","quicksort"], + ["punctuation.begin.statement.parameters.prolog","("], + ["punctuation.begin.list.prolog","["], + ["variable.other.prolog","X"], + ["punctuation.concat.list.prolog","|"], + ["variable.other.prolog","Xs"], + ["punctuation.end.list.prolog","]"], + ["punctuation.end.statement.parameters.prolog",")"], + ["meta.fact.prolog"," "], + ["invalid.illegal.invalidchar.prolog","-"], + ["keyword.operator.prolog","->"] +],[ + "entity.name.function.fact.prolog", + ["meta.fact.prolog"," "], + ["invalid.illegal.invalidchar.prolog","{"], + ["meta.fact.prolog"," "], + ["constant.other.atom.prolog","partition"], + ["punctuation.begin.statement.parameters.prolog","("], + ["variable.other.prolog","Xs"], + ["punctuation.separator.statement.prolog",","], + ["meta.statement.parameters.prolog"," "], + ["variable.other.prolog","X"], + ["punctuation.separator.statement.prolog",","], + ["meta.statement.parameters.prolog"," "], + ["variable.other.prolog","Smaller"], + ["punctuation.separator.statement.prolog",","], + ["meta.statement.parameters.prolog"," "], + ["variable.other.prolog","Bigger"], + ["punctuation.end.statement.parameters.prolog",")"], + ["meta.fact.prolog"," "], + ["invalid.illegal.invalidchar.prolog","}"], + ["punctuation.separator.parameters.prolog",","] +],[ + "entity.name.function.fact.prolog", + ["meta.fact.prolog"," "], + ["constant.other.atom.prolog","quicksort"], + ["punctuation.begin.statement.parameters.prolog","("], + ["variable.other.prolog","Smaller"], + ["punctuation.end.statement.parameters.prolog",")"], + ["punctuation.separator.parameters.prolog",","], + ["meta.fact.prolog"," "], + ["punctuation.begin.list.prolog","["], + ["variable.other.prolog","X"], + ["punctuation.end.list.prolog","]"], + ["punctuation.separator.parameters.prolog",","], + ["meta.fact.prolog"," "], + ["constant.other.atom.prolog","quicksort"], + ["punctuation.begin.statement.parameters.prolog","("], + ["variable.other.prolog","Bigger"], + ["punctuation.end.statement.parameters.prolog",")"], + ["invalid.illegal.invalidchar.prolog","."] +],[ + "entity.name.function.fact.prolog" +],[ + "entity.name.function.fact.prolog", + ["constant.other.atom.prolog","perfect"], + ["punctuation.begin.statement.parameters.prolog","("], + ["variable.other.prolog","N"], + ["punctuation.end.statement.parameters.prolog",")"], + ["meta.fact.prolog"," "], + ["invalid.illegal.invalidchar.prolog",":-"] +],[ + "entity.name.function.fact.prolog", + ["meta.fact.prolog"," "], + ["constant.other.atom.prolog","between"], + ["punctuation.begin.statement.parameters.prolog","("], + ["constant.numeric.prolog","1"], + ["punctuation.separator.statement.prolog",","], + ["meta.statement.parameters.prolog"," "], + ["constant.other.atom.prolog","inf"], + ["punctuation.separator.statement.prolog",","], + ["meta.statement.parameters.prolog"," "], + ["variable.other.prolog","N"], + ["punctuation.end.statement.parameters.prolog",")"], + ["punctuation.separator.parameters.prolog",","], + ["meta.fact.prolog"," "], + ["variable.parameter.prolog","U"], + ["meta.fact.prolog"," "], + ["keyword.operator.prolog","is"], + ["meta.fact.prolog"," "], + ["variable.parameter.prolog","N"], + ["meta.fact.prolog"," "], + ["invalid.illegal.invalidchar.prolog","//"], + ["meta.fact.prolog"," "], + ["constant.numeric.prolog","2"], + ["punctuation.separator.parameters.prolog",","] +],[ + "entity.name.function.fact.prolog", + ["meta.fact.prolog"," "], + ["constant.other.atom.prolog","findall"], + ["punctuation.begin.statement.parameters.prolog","("], + ["variable.other.prolog","D"], + ["punctuation.separator.statement.prolog",","], + ["meta.statement.parameters.prolog"," ("], + ["constant.other.atom.prolog","between"], + ["punctuation.begin.statement.parameters.prolog","("], + ["constant.numeric.prolog","1"], + ["punctuation.separator.statement.prolog",","], + ["variable.other.prolog","U"], + ["punctuation.separator.statement.prolog",","], + ["variable.other.prolog","D"], + ["punctuation.end.statement.parameters.prolog",")"], + ["punctuation.separator.statement.prolog",","], + ["meta.statement.parameters.prolog"," "], + ["variable.other.prolog","N"], + ["meta.statement.parameters.prolog"," "], + ["constant.other.atom.prolog","mod"], + ["meta.statement.parameters.prolog"," "], + ["variable.other.prolog","D"], + ["meta.statement.parameters.prolog"," "], + ["keyword.operator.prolog","=:="], + ["meta.statement.parameters.prolog"," "], + ["constant.numeric.prolog","0"], + ["punctuation.end.statement.parameters.prolog",")"], + ["punctuation.separator.parameters.prolog",","], + ["meta.fact.prolog"," "], + ["variable.parameter.prolog","Ds"], + ["invalid.illegal.invalidchar.prolog",")"], + ["punctuation.separator.parameters.prolog",","] +],[ + "entity.name.function.fact.prolog", + ["meta.fact.prolog"," "], + ["constant.other.atom.prolog","sumlist"], + ["punctuation.begin.statement.parameters.prolog","("], + ["variable.other.prolog","Ds"], + ["punctuation.separator.statement.prolog",","], + ["meta.statement.parameters.prolog"," "], + ["variable.other.prolog","N"], + ["punctuation.end.statement.parameters.prolog",")"], + ["invalid.illegal.invalidchar.prolog","."] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_properties.json b/addons/editor/ace/mode/_test/tokens_properties.json new file mode 100755 index 00000000..8831045e --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_properties.json @@ -0,0 +1,68 @@ +[[ + "start", + ["comment","# You are reading the \".properties\" entry."] +],[ + "start", + ["comment","! The exclamation mark can also mark text as comments."] +],[ + "start", + ["comment","# The key and element characters #, !, =, and : are written with a preceding backslash to ensure that they are properly loaded."] +],[ + "start", + ["variable","website "], + ["keyword","="], + ["string"," http"], + ["constant.language.escape","\\"], + ["string","://en.wikipedia.org/"] +],[ + "start", + ["variable","language "], + ["keyword","="], + ["string"," English"] +],[ + "start", + ["comment","# The backslash below tells the application to continue reading"] +],[ + "start", + ["comment","# the value onto the next line."] +],[ + "value", + ["variable","message "], + ["keyword","="], + ["string"," Welcome to \\"] +],[ + "start", + ["string"," Wikipedia!"] +],[ + "start", + ["comment","# Add spaces to the key"] +],[ + "start", + ["variable","key"], + ["constant.language.escape","\\"], + ["variable"," with"], + ["constant.language.escape","\\"], + ["variable"," spaces "], + ["keyword","="], + ["string"," This is the value that could be looked up with the key \"key with spaces\"."] +],[ + "start", + ["comment","# Unicode"] +],[ + "start", + ["variable","tab "], + ["keyword",":"], + ["string"," "], + ["constant.language.escape","\\u0009"] +],[ + "start", + ["variable","empty-key"], + ["keyword","="] +],[ + "start", + ["variable","last.line"], + ["keyword","="], + ["string","value"] +],[ + "start" +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_python.json b/addons/editor/ace/mode/_test/tokens_python.json new file mode 100755 index 00000000..293c8ff2 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_python.json @@ -0,0 +1,152 @@ +[[ + "start", + ["comment","#!/usr/local/bin/python"] +],[ + "start" +],[ + "start", + ["keyword","import"], + ["text"," "], + ["identifier","string"], + ["text",", "], + ["identifier","sys"] +],[ + "start" +],[ + "start", + ["comment","# If no arguments were given, print a helpful message"] +],[ + "start", + ["keyword","if"], + ["text"," "], + ["support.function","len"], + ["paren.lparen","("], + ["identifier","sys"], + ["text","."], + ["identifier","argv"], + ["paren.rparen",")"], + ["keyword.operator","=="], + ["constant.numeric","1"], + ["text",":"] +],[ + "qstring3", + ["text"," "], + ["keyword","print"], + ["text"," "], + ["string","'''Usage:"] +],[ + "start", + ["string","celsius temp1 temp2 ...'''"] +],[ + "start", + ["text"," "], + ["identifier","sys"], + ["text","."], + ["identifier","exit"], + ["paren.lparen","("], + ["constant.numeric","0"], + ["paren.rparen",")"] +],[ + "start" +],[ + "start", + ["comment","# Loop over the arguments"] +],[ + "start", + ["keyword","for"], + ["text"," "], + ["identifier","i"], + ["text"," "], + ["keyword","in"], + ["text"," "], + ["identifier","sys"], + ["text","."], + ["identifier","argv"], + ["paren.lparen","["], + ["constant.numeric","1"], + ["text",":"], + ["paren.rparen","]"], + ["text",":"] +],[ + "start", + ["text"," "], + ["keyword","try"], + ["text",":"] +],[ + "start", + ["text"," "], + ["identifier","fahrenheit"], + ["keyword.operator","="], + ["support.function","float"], + ["paren.lparen","("], + ["identifier","string"], + ["text","."], + ["identifier","atoi"], + ["paren.lparen","("], + ["identifier","i"], + ["paren.rparen","))"] +],[ + "start", + ["text"," "], + ["keyword","except"], + ["text"," "], + ["identifier","string"], + ["text","."], + ["identifier","atoi_error"], + ["text",":"] +],[ + "start", + ["text"," "], + ["keyword","print"], + ["text"," "], + ["support.function","repr"], + ["paren.lparen","("], + ["identifier","i"], + ["paren.rparen",")"], + ["text",", "], + ["string","\"not a numeric value\""] +],[ + "start", + ["text"," "], + ["keyword","else"], + ["text",":"] +],[ + "start", + ["text"," "], + ["identifier","celsius"], + ["keyword.operator","="], + ["paren.lparen","("], + ["identifier","fahrenheit"], + ["keyword.operator","-"], + ["constant.numeric","32"], + ["paren.rparen",")"], + ["keyword.operator","*"], + ["constant.numeric","5.0"], + ["keyword.operator","/"], + ["constant.numeric","9.0"] +],[ + "start", + ["text"," "], + ["keyword","print"], + ["text"," "], + ["string","'%i"], + ["constant.language.escape","\\260"], + ["string","F = %i"], + ["constant.language.escape","\\260"], + ["string","C'"], + ["text"," "], + ["keyword.operator","%"], + ["text"," "], + ["paren.lparen","("], + ["support.function","int"], + ["paren.lparen","("], + ["identifier","fahrenheit"], + ["paren.rparen",")"], + ["text",", "], + ["support.function","int"], + ["paren.lparen","("], + ["identifier","celsius"], + ["keyword.operator","+"], + ["constant.numeric",".5"], + ["paren.rparen","))"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_r.json b/addons/editor/ace/mode/_test/tokens_r.json new file mode 100755 index 00000000..2d446bce --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_r.json @@ -0,0 +1,235 @@ +[[ + "start", + ["identifier","Call"], + ["keyword.operator",":"] +],[ + "start", + ["identifier","lm"], + ["paren.keyword.operator","("], + ["identifier","formula"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["identifier","y"], + ["text"," "], + ["keyword.operator","~"], + ["text"," "], + ["identifier","x"], + ["paren.keyword.operator",")"] +],[ + "start", + ["text"," "] +],[ + "start", + ["identifier","Residuals"], + ["keyword.operator",":"] +],[ + "start", + ["constant.numeric","1"], + ["text"," "], + ["constant.numeric","2"], + ["text"," "], + ["constant.numeric","3"], + ["text"," "], + ["constant.numeric","4"], + ["text"," "], + ["constant.numeric","5"], + ["text"," "], + ["constant.numeric","6"] +],[ + "start", + ["constant.numeric","3.3333"], + ["text"," "], + ["keyword.operator","-"], + ["constant.numeric","0.6667"], + ["text"," "], + ["keyword.operator","-"], + ["constant.numeric","2.6667"], + ["text"," "], + ["keyword.operator","-"], + ["constant.numeric","2.6667"], + ["text"," "], + ["keyword.operator","-"], + ["constant.numeric","0.6667"], + ["text"," "], + ["constant.numeric","3.3333"] +],[ + "start", + ["text"," "] +],[ + "start", + ["identifier","Coefficients"], + ["keyword.operator",":"] +],[ + "start", + ["text"," "], + ["identifier","Estimate"], + ["text"," "], + ["identifier","Std"], + ["text",". "], + ["identifier","Error"], + ["text"," "], + ["identifier","t"], + ["text"," "], + ["identifier","value"], + ["text"," "], + ["identifier","Pr"], + ["paren.keyword.operator","("], + ["keyword.operator",">|"], + ["identifier","t"], + ["keyword.operator","|"], + ["paren.keyword.operator",")"] +],[ + "start", + ["paren.keyword.operator","("], + ["identifier","Intercept"], + ["paren.keyword.operator",")"], + ["text"," "], + ["keyword.operator","-"], + ["constant.numeric","9.3333"], + ["text"," "], + ["constant.numeric","2.8441"], + ["text"," "], + ["keyword.operator","-"], + ["constant.numeric","3.282"], + ["text"," "], + ["constant.numeric","0.030453"], + ["text"," "], + ["keyword.operator","*"] +],[ + "start", + ["identifier","x"], + ["text"," "], + ["constant.numeric","7.0000"], + ["text"," "], + ["constant.numeric","0.7303"], + ["text"," "], + ["constant.numeric","9.585"], + ["text"," "], + ["constant.numeric","0.000662"], + ["text"," "], + ["keyword.operator","***"] +],[ + "start", + ["keyword.operator","---"] +],[ + "start", + ["identifier","Signif"], + ["text",". "], + ["identifier","codes"], + ["keyword.operator",":"], + ["text"," "], + ["constant.numeric","0"], + ["text"," ‘"], + ["keyword.operator","***"], + ["text","’ "], + ["constant.numeric","0.001"], + ["text"," ‘"], + ["keyword.operator","**"], + ["text","’ "], + ["constant.numeric","0.01"], + ["text"," ‘"], + ["keyword.operator","*"], + ["text","’ "], + ["constant.numeric","0.05"], + ["text"," ‘.’ "], + ["constant.numeric","0.1"], + ["text"," ‘ ’ "], + ["constant.numeric","1"] +],[ + "start", + ["text"," "] +],[ + "start", + ["identifier","Residual"], + ["text"," "], + ["identifier","standard"], + ["text"," "], + ["identifier","error"], + ["keyword.operator",":"], + ["text"," "], + ["constant.numeric","3.055"], + ["text"," "], + ["identifier","on"], + ["text"," "], + ["constant.numeric","4"], + ["text"," "], + ["identifier","degrees"], + ["text"," "], + ["identifier","of"], + ["text"," "], + ["identifier","freedom"] +],[ + "start", + ["identifier","Multiple"], + ["text"," "], + ["identifier","R"], + ["keyword.operator","-"], + ["identifier","squared"], + ["keyword.operator",":"], + ["text"," "], + ["constant.numeric","0.9583"], + ["text",", "], + ["identifier","Adjusted"], + ["text"," "], + ["identifier","R"], + ["keyword.operator","-"], + ["identifier","squared"], + ["keyword.operator",":"], + ["text"," "], + ["constant.numeric","0.9478"] +],[ + "start", + ["constant.language.boolean","F"], + ["keyword.operator","-"], + ["identifier","statistic"], + ["keyword.operator",":"], + ["text"," "], + ["constant.numeric","91.88"], + ["text"," "], + ["identifier","on"], + ["text"," "], + ["constant.numeric","1"], + ["text"," "], + ["identifier","and"], + ["text"," "], + ["constant.numeric","4"], + ["text"," "], + ["identifier","DF"], + ["text",", "], + ["identifier","p"], + ["keyword.operator","-"], + ["identifier","value"], + ["keyword.operator",":"], + ["text"," "], + ["constant.numeric","0.000662"] +],[ + "start", + ["text"," "] +],[ + "start", + ["keyword.operator",">"], + ["text"," "], + ["identifier","par"], + ["paren.keyword.operator","("], + ["identifier","mfrow"], + ["keyword.operator","="], + ["identifier","c"], + ["paren.keyword.operator","("], + ["constant.numeric","2"], + ["text",", "], + ["constant.numeric","2"], + ["paren.keyword.operator","))"], + ["text"," "], + ["comment","# Request 2x2 plot layout"] +],[ + "start", + ["keyword.operator",">"], + ["text"," "], + ["identifier","plot"], + ["paren.keyword.operator","("], + ["identifier","lm_1"], + ["paren.keyword.operator",")"], + ["text"," "], + ["comment","# Diagnostic plot of regression model"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_rdoc.json b/addons/editor/ace/mode/_test/tokens_rdoc.json new file mode 100755 index 00000000..0c757438 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_rdoc.json @@ -0,0 +1,441 @@ +[[ + "start", + ["keyword","\\name"], + ["paren.keyword.operator","{"], + ["nospell.text","picker"], + ["paren.keyword.operator","}"] +],[ + "start", + ["keyword","\\alias"], + ["paren.keyword.operator","{"], + ["nospell.text","picker"], + ["paren.keyword.operator","}"] +],[ + "start", + ["keyword","\\title"], + ["paren.keyword.operator","{"], + ["text","Create a picker control"], + ["paren.keyword.operator","}"] +],[ + "start", + ["keyword","\\description"], + ["paren.keyword.operator","{"] +],[ + "start", + ["text"," Create a picker control to enable manipulation of plot variables based on a set of fixed choices."] +],[ + "start", + ["paren.keyword.operator","}"] +],[ + "start" +],[ + "nospell", + ["keyword","\\usage"], + ["paren.keyword.operator","{"] +],[ + "nospell", + ["nospell.text","picker"], + ["paren.keyword.operator","("], + ["text","...,"], + ["nospell.text"," initial "], + ["text","="], + ["nospell.text"," NULL"], + ["text",","], + ["nospell.text"," label "], + ["text","="], + ["nospell.text"," NULL"], + ["paren.keyword.operator",")"] +],[ + "start", + ["paren.keyword.operator","}"] +],[ + "start" +],[ + "start" +],[ + "start", + ["keyword","\\arguments"], + ["paren.keyword.operator","{"] +],[ + "start", + ["text"," "], + ["keyword","\\item"], + ["paren.keyword.operator","{"], + ["keyword","\\dots"], + ["paren.keyword.operator","}{"] +],[ + "start", + ["text"," Arguments containing objects to be presented as choices for the picker "], + ["paren.keyword.operator","("], + ["text","or a list containing the choices"], + ["paren.keyword.operator",")"], + ["text",". If an element is named then the name is used to display it within the picker. If an element is not named then it is displayed within the picker using "], + ["keyword","\\code"], + ["paren.keyword.operator","{"], + ["keyword","\\link"], + ["paren.keyword.operator","{"], + ["nospell.text","as"], + ["text","."], + ["nospell.text","character"], + ["paren.keyword.operator","}}"], + ["text",". "] +],[ + "start", + ["paren.keyword.operator","}"] +],[ + "start", + ["text"," "], + ["keyword","\\item"], + ["paren.keyword.operator","{"], + ["nospell.text","initial"], + ["paren.keyword.operator","}{"] +],[ + "start", + ["text"," Initial value for picker. Value must be present in the list of choices specified. If not specified defaults to the first choice."] +],[ + "start", + ["paren.keyword.operator","}"] +],[ + "start", + ["text"," "], + ["keyword","\\item"], + ["paren.keyword.operator","{"], + ["nospell.text","label"], + ["paren.keyword.operator","}{"] +],[ + "start", + ["text"," Display label for picker. Defaults to the variable name if not specified."] +],[ + "start", + ["paren.keyword.operator","}"] +],[ + "start", + ["paren.keyword.operator","}"] +],[ + "start" +],[ + "start", + ["keyword","\\value"], + ["paren.keyword.operator","{"] +],[ + "start", + ["text"," An object of class \"manipulator.picker\" which can be passed to the "], + ["keyword","\\code"], + ["paren.keyword.operator","{"], + ["keyword","\\link"], + ["paren.keyword.operator","{"], + ["nospell.text","manipulate"], + ["paren.keyword.operator","}}"], + ["text"," function."] +],[ + "start", + ["paren.keyword.operator","}"] +],[ + "start" +],[ + "start", + ["keyword","\\seealso"], + ["paren.keyword.operator","{"] +],[ + "start", + ["keyword","\\code"], + ["paren.keyword.operator","{"], + ["keyword","\\link"], + ["paren.keyword.operator","{"], + ["nospell.text","manipulate"], + ["paren.keyword.operator","}}"], + ["text",", "], + ["keyword","\\code"], + ["paren.keyword.operator","{"], + ["keyword","\\link"], + ["paren.keyword.operator","{"], + ["nospell.text","slider"], + ["paren.keyword.operator","}}"], + ["text",", "], + ["keyword","\\code"], + ["paren.keyword.operator","{"], + ["keyword","\\link"], + ["paren.keyword.operator","{"], + ["nospell.text","checkbox"], + ["paren.keyword.operator","}}"], + ["text",", "], + ["keyword","\\code"], + ["paren.keyword.operator","{"], + ["keyword","\\link"], + ["paren.keyword.operator","{"], + ["nospell.text","button"], + ["paren.keyword.operator","}}"] +],[ + "start", + ["paren.keyword.operator","}"] +],[ + "start" +],[ + "start" +],[ + "nospell", + ["keyword","\\examples"], + ["paren.keyword.operator","{"] +],[ + "nospell", + ["keyword","\\dontrun"], + ["paren.keyword.operator","{"] +],[ + "nospell" +],[ + "nospell", + ["text","##"], + ["nospell.text"," Filtering data with a picker"] +],[ + "nospell", + ["nospell.text","manipulate"], + ["paren.keyword.operator","("] +],[ + "nospell", + ["nospell.text"," barplot"], + ["paren.keyword.operator","("], + ["nospell.text","as"], + ["text","."], + ["nospell.text","matrix"], + ["paren.keyword.operator","("], + ["nospell.text","longley"], + ["paren.keyword.operator","["], + ["text",","], + ["nospell.text","factor"], + ["paren.keyword.operator","])"], + ["text",","], + ["nospell.text"," "] +],[ + "nospell", + ["nospell.text"," beside "], + ["text","="], + ["nospell.text"," TRUE"], + ["text",","], + ["nospell.text"," main "], + ["text","="], + ["nospell.text"," factor"], + ["paren.keyword.operator",")"], + ["text",","] +],[ + "nospell", + ["nospell.text"," factor "], + ["text","="], + ["nospell.text"," picker"], + ["paren.keyword.operator","("], + ["text","\""], + ["nospell.text","GNP"], + ["text","\","], + ["nospell.text"," "], + ["text","\""], + ["nospell.text","Unemployed"], + ["text","\","], + ["nospell.text"," "], + ["text","\""], + ["nospell.text","Employed"], + ["text","\""], + ["paren.keyword.operator","))"] +],[ + "nospell" +],[ + "nospell", + ["text","##"], + ["nospell.text"," Create a picker with labels"] +],[ + "nospell", + ["nospell.text","manipulate"], + ["paren.keyword.operator","("] +],[ + "nospell", + ["nospell.text"," plot"], + ["paren.keyword.operator","("], + ["nospell.text","pressure"], + ["text",","], + ["nospell.text"," type "], + ["text","="], + ["nospell.text"," type"], + ["paren.keyword.operator",")"], + ["text",","], + ["nospell.text"," "] +],[ + "nospell", + ["nospell.text"," type "], + ["text","="], + ["nospell.text"," picker"], + ["paren.keyword.operator","("], + ["text","\""], + ["nospell.text","points"], + ["text","\""], + ["nospell.text"," "], + ["text","="], + ["nospell.text"," "], + ["text","\""], + ["nospell.text","p"], + ["text","\","], + ["nospell.text"," "], + ["text","\""], + ["nospell.text","line"], + ["text","\""], + ["nospell.text"," "], + ["text","="], + ["nospell.text"," "], + ["text","\""], + ["nospell.text","l"], + ["text","\","], + ["nospell.text"," "], + ["text","\""], + ["nospell.text","step"], + ["text","\""], + ["nospell.text"," "], + ["text","="], + ["nospell.text"," "], + ["text","\""], + ["nospell.text","s"], + ["text","\""], + ["paren.keyword.operator","))"] +],[ + "nospell", + ["nospell.text"," "] +],[ + "nospell", + ["text","##"], + ["nospell.text"," Picker with groups"] +],[ + "nospell", + ["nospell.text","manipulate"], + ["paren.keyword.operator","("] +],[ + "nospell", + ["nospell.text"," barplot"], + ["paren.keyword.operator","("], + ["nospell.text","as"], + ["text","."], + ["nospell.text","matrix"], + ["paren.keyword.operator","("], + ["nospell.text","mtcars"], + ["paren.keyword.operator","["], + ["nospell.text","group"], + ["text",",\""], + ["nospell.text","mpg"], + ["text","\""], + ["paren.keyword.operator","])"], + ["text",","], + ["nospell.text"," beside"], + ["text","="], + ["nospell.text","TRUE"], + ["paren.keyword.operator",")"], + ["text",","] +],[ + "nospell", + ["nospell.text"," group "], + ["text","="], + ["nospell.text"," picker"], + ["paren.keyword.operator","("], + ["text","\""], + ["nospell.text","Group 1"], + ["text","\""], + ["nospell.text"," "], + ["text","="], + ["nospell.text"," 1"], + ["text",":"], + ["nospell.text","11"], + ["text",","], + ["nospell.text"," "] +],[ + "nospell", + ["nospell.text"," "], + ["text","\""], + ["nospell.text","Group 2"], + ["text","\""], + ["nospell.text"," "], + ["text","="], + ["nospell.text"," 12"], + ["text",":"], + ["nospell.text","22"], + ["text",","], + ["nospell.text"," "] +],[ + "nospell", + ["nospell.text"," "], + ["text","\""], + ["nospell.text","Group 3"], + ["text","\""], + ["nospell.text"," "], + ["text","="], + ["nospell.text"," 23"], + ["text",":"], + ["nospell.text","32"], + ["paren.keyword.operator","))"] +],[ + "nospell" +],[ + "nospell", + ["text","##"], + ["nospell.text"," Histogram w"], + ["text","/"], + ["nospell.text"," picker to select type"] +],[ + "nospell", + ["nospell.text","require"], + ["paren.keyword.operator","("], + ["nospell.text","lattice"], + ["paren.keyword.operator",")"] +],[ + "nospell", + ["nospell.text","require"], + ["paren.keyword.operator","("], + ["nospell.text","stats"], + ["paren.keyword.operator",")"] +],[ + "nospell", + ["nospell.text","manipulate"], + ["paren.keyword.operator","("] +],[ + "nospell", + ["nospell.text"," histogram"], + ["paren.keyword.operator","("], + ["text","~"], + ["nospell.text"," height "], + ["text","|"], + ["nospell.text"," voice"], + ["text","."], + ["nospell.text","part"], + ["text",","], + ["nospell.text"," "] +],[ + "nospell", + ["nospell.text"," data "], + ["text","="], + ["nospell.text"," singer"], + ["text",","], + ["nospell.text"," type "], + ["text","="], + ["nospell.text"," type"], + ["paren.keyword.operator",")"], + ["text",","] +],[ + "nospell", + ["nospell.text"," type "], + ["text","="], + ["nospell.text"," picker"], + ["paren.keyword.operator","("], + ["text","\""], + ["nospell.text","percent"], + ["text","\","], + ["nospell.text"," "], + ["text","\""], + ["nospell.text","count"], + ["text","\","], + ["nospell.text"," "], + ["text","\""], + ["nospell.text","density"], + ["text","\""], + ["paren.keyword.operator","))"] +],[ + "nospell" +],[ + "start", + ["paren.keyword.operator","}"] +],[ + "start", + ["paren.keyword.operator","}"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_rhtml.json b/addons/editor/ace/mode/_test/tokens_rhtml.json new file mode 100755 index 00000000..6dca1c51 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_rhtml.json @@ -0,0 +1,106 @@ +[[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","html"], + ["meta.tag.punctuation.end",">"] +],[ + "start" +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","head"], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","title"], + ["meta.tag.punctuation.end",">"], + ["text","Title"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["meta.tag.punctuation.begin",""] +],[ + "start" +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","body"], + ["meta.tag.punctuation.end",">"] +],[ + "start" +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","p"], + ["meta.tag.punctuation.end",">"], + ["text","This is an R HTML document. When you click the "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","b"], + ["meta.tag.punctuation.end",">"], + ["text","Knit HTML"], + ["meta.tag.punctuation.begin",""], + ["text"," button a web page will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:"], + ["meta.tag.punctuation.begin",""] +],[ + "start" +],[ + "r-start", + ["support.function.codebegin",""] +],[ + "start" +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","p"], + ["meta.tag.punctuation.end",">"], + ["text","You can also embed plots, for example:"], + ["meta.tag.punctuation.begin",""] +],[ + "start" +],[ + "r-start", + ["support.function.codebegin",""] +],[ + "start" +],[ + "start", + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["meta.tag.punctuation.begin",""] +],[ + "start" +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_ruby.json b/addons/editor/ace/mode/_test/tokens_ruby.json new file mode 100755 index 00000000..19b98b70 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_ruby.json @@ -0,0 +1,232 @@ +[[ + "start", + ["text"," "], + ["comment","#test: symbol tokenizer"] +],[ + "start", + ["text"," "], + ["paren.lparen","["], + ["constant.other.symbol.ruby",":@thing"], + ["text",", "], + ["constant.other.symbol.ruby",":$thing"], + ["text",", "], + ["constant.other.symbol.ruby",":_thing"], + ["text",", "], + ["constant.other.symbol.ruby",":thing"], + ["text",", "], + ["constant.other.symbol.ruby",":Thing"], + ["text",", "], + ["constant.other.symbol.ruby",":thing1"], + ["text",", "], + ["constant.other.symbol.ruby",":thing_a"], + ["text",","] +],[ + "start", + ["text"," "], + ["constant.other.symbol.ruby",":THING"], + ["text",", "], + ["constant.other.symbol.ruby",":thing!"], + ["text",", "], + ["constant.other.symbol.ruby",":thing="], + ["text",", "], + ["constant.other.symbol.ruby",":thing?"], + ["text",", "], + ["constant.other.symbol.ruby",":t?"], + ["text",","] +],[ + "start", + ["text"," :, :@, :"], + ["keyword.operator","$"], + ["text",", :"], + ["constant.numeric","1"], + ["text",", :1"], + ["identifier","thing"], + ["text",", "], + ["constant.other.symbol.ruby",":th?"], + ["identifier","ing"], + ["text",", "], + ["constant.other.symbol.ruby",":thi="], + ["identifier","ng"], + ["text",", :1"], + ["identifier","thing"], + ["text",","] +],[ + "start", + ["text"," "], + ["constant.other.symbol.ruby",":th!"], + ["identifier","ing"], + ["text",", "], + ["constant.other.symbol.ruby",":thing"], + ["comment","#"] +],[ + "start", + ["text"," "], + ["paren.rparen","]"] +],[ + "start" +],[ + "start", + ["text"," "], + ["comment","#test: namespaces aren't symbols\" : function() {"] +],[ + "start", + ["text"," "], + ["support.class","Namespaced"], + ["text","::"], + ["support.class","Class"] +],[ + "start", + ["text"," "], + ["comment","#test: hex tokenizer "] +],[ + "start", + ["text"," "], + ["constant.numeric","0x9a"], + ["text",", "], + ["constant.numeric","0XA1"], + ["text",", "], + ["constant.numeric","0x9_a"], + ["text",", 0"], + ["identifier","x"], + ["text",", 0"], + ["identifier","x_9a"], + ["text",", 0"], + ["identifier","x9a_"], + ["text",","] +],[ + "start", + ["text"," "], + ["comment","#test: float tokenizer"] +],[ + "start", + ["text"," "], + ["paren.lparen","["], + ["constant.numeric","1"], + ["text",", "], + ["constant.numeric","+1"], + ["text",", "], + ["constant.numeric","-1"], + ["text",", "], + ["constant.numeric","12_345"], + ["text",", "], + ["constant.numeric","0.000_1"], + ["text",","] +],[ + "start", + ["text"," "], + ["identifier","_"], + ["text",", "], + ["constant.numeric","3_1"], + ["text",", "], + ["constant.numeric","1_2"], + ["text",", 1"], + ["identifier","_"], + ["text","."], + ["constant.numeric","0"], + ["text",", "], + ["constant.numeric","0"], + ["text","."], + ["identifier","_1"], + ["paren.rparen","]"], + ["text",";"] +],[ + "start", + ["text"," "] +],[ + "start", + ["paren.lparen","{"], + ["constant.other.symbol.ruby",":id"], + ["text"," "], + ["punctuation.separator.key-value","=>"], + ["text"," "], + ["constant.numeric","34"], + ["text",", "], + ["constant.other.symbol.ruby",":key"], + ["text"," "], + ["punctuation.separator.key-value","=>"], + ["text"," "], + ["string","\"value\""], + ["paren.rparen","}"] +],[ + "start" +],[ + "comment", + ["comment","=begin"] +],[ + "start", + ["comment","=end"] +],[ + "start" +],[ + "comment", + ["comment","=begin x"] +],[ + "comment", + ["comment","=end-"] +],[ + "start", + ["comment","=end x"] +],[ + "start" +],[ + ["heredoc","FOO","heredoc","BAR","indentedHeredoc","BAZ","indentedHeredoc","EXEC"], + ["text"," "], + ["identifier","herDocs"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["paren.lparen","["], + ["constant","<<"], + ["string","'"], + ["support.class","FOO"], + ["string","'"], + ["text",", "], + ["constant","<<"], + ["string",""], + ["support.class","BAR"], + ["string",""], + ["text",", "], + ["constant","<<-"], + ["string",""], + ["support.class","BAZ"], + ["string",""], + ["text",", "], + ["constant","<<-"], + ["string","`"], + ["support.class","EXEC"], + ["string","`"], + ["paren.rparen","]"], + ["text"," "], + ["comment","#comment"] +],[ + ["heredoc","FOO","heredoc","BAR","indentedHeredoc","BAZ","indentedHeredoc","EXEC"], + ["string"," FOO #{literal}"] +],[ + ["heredoc","BAR","indentedHeredoc","BAZ","indentedHeredoc","EXEC"], + ["support.class","FOO"] +],[ + ["heredoc","BAR","indentedHeredoc","BAZ","indentedHeredoc","EXEC"], + ["string"," BAR #{fact(10)}"] +],[ + ["indentedHeredoc","BAZ","indentedHeredoc","EXEC"], + ["support.class","BAR"] +],[ + ["indentedHeredoc","BAZ","indentedHeredoc","EXEC"], + ["string"," BAZ indented"] +],[ + ["indentedHeredoc","EXEC"], + ["string"," "], + ["support.class","BAZ"] +],[ + ["indentedHeredoc","EXEC"], + ["string"," echo hi"] +],[ + "start", + ["string"," "], + ["support.class","EXEC"] +],[ + "start", + ["support.function","puts"], + ["text"," "], + ["identifier","herDocs"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_rust.json b/addons/editor/ace/mode/_test/tokens_rust.json new file mode 100755 index 00000000..6592575b --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_rust.json @@ -0,0 +1,136 @@ +[[ + "start", + ["keyword.source.rust","use"], + ["text"," "], + ["support.constant","core::rand::"], + ["text","RngUtil"], + ["keyword.operator",";"] +],[ + "start" +],[ + "start", + ["keyword.source.rust","fn"], + ["meta.function.source.rust"," "], + ["entity.name.function.source.rust","main"], + ["meta.function.source.rust","("], + ["text",") {"] +],[ + "start", + ["text"," "], + ["keyword.source.rust","for"], + ["text"," ["], + ["string.quoted.double.source.rust","\"Alice\""], + ["keyword.operator",","], + ["text"," "], + ["string.quoted.double.source.rust","\"Bob\""], + ["keyword.operator",","], + ["text"," "], + ["string.quoted.double.source.rust","\"Carol\""], + ["text","].each |&name| {"] +],[ + "start", + ["text"," "], + ["keyword.source.rust","do"], + ["text"," spawn {"] +],[ + "start", + ["text"," "], + ["keyword.source.rust","let"], + ["text"," v "], + ["keyword.operator","="], + ["text"," "], + ["support.constant","rand::"], + ["text","Rng().shuffle(["], + ["constant.numeric.integer.source.rust","1"], + ["keyword.operator",","], + ["text"," "], + ["constant.numeric.integer.source.rust","2"], + ["keyword.operator",","], + ["text"," "], + ["constant.numeric.integer.source.rust","3"], + ["text","])"], + ["keyword.operator",";"] +],[ + "start", + ["text"," "], + ["keyword.source.rust","for"], + ["text"," v.each |&num| {"] +],[ + "start", + ["text"," print(fmt"], + ["keyword.operator","!"], + ["text","("], + ["string.quoted.double.source.rust","\"%s says: '%d'"], + ["constant.character.escape.source.rust","\\n"], + ["string.quoted.double.source.rust","\""], + ["keyword.operator",","], + ["text"," name"], + ["keyword.operator",","], + ["text"," num "], + ["keyword.operator","+"], + ["text"," "], + ["constant.numeric.integer.source.rust","1"], + ["text","))"] +],[ + "start", + ["text"," }"] +],[ + "start", + ["text"," }"] +],[ + "start", + ["text"," }"] +],[ + "start", + ["text","}"] +],[ + "start" +],[ + "start", + ["keyword.source.rust","fn"], + ["meta.function.source.rust"," "], + ["entity.name.function.source.rust","map"], + ["meta.function.source.rust","("], + ["text","vector: &[T]"], + ["keyword.operator",","], + ["text"," function: &fn(v: &T) "], + ["keyword.operator","->"], + ["text"," U) "], + ["keyword.operator","->"], + ["text"," ~[U] {"] +],[ + "start", + ["text"," "], + ["keyword.source.rust","let"], + ["text"," "], + ["keyword.source.rust","mut"], + ["text"," accumulator "], + ["keyword.operator","="], + ["text"," ~[]"], + ["keyword.operator",";"] +],[ + "start", + ["text"," "], + ["keyword.source.rust","for"], + ["text"," "], + ["support.constant","vec::"], + ["text","each(vector) |element| {"] +],[ + "start", + ["text"," accumulator.push(function(element))"], + ["keyword.operator",";"] +],[ + "start", + ["text"," }"] +],[ + "start", + ["text"," "], + ["keyword.source.rust","return"], + ["text"," accumulator"], + ["keyword.operator",";"] +],[ + "start", + ["text","}"] +],[ + "start" +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_sass.json b/addons/editor/ace/mode/_test/tokens_sass.json new file mode 100755 index 00000000..c0b85682 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_sass.json @@ -0,0 +1,229 @@ +[[ + "start", + ["comment","// sass ace mode;"] +],[ + "start" +],[ + "start", + ["keyword","@import"], + ["text"," "], + ["support.function","url("], + ["string","http://fonts.googleapis.com/css?family=Ace:700"], + ["support.function",")"] +],[ + "start" +],[ + "start", + ["variable.language","html"], + ["text",", "], + ["variable.language","body"] +],[ + "start", + ["support.type"," :background-color "], + ["constant.numeric","#ace"] +],[ + "start", + ["text"," "], + ["support.type","text-align"], + ["text",": "], + ["constant.language","center"] +],[ + "start", + ["text"," "], + ["support.type","height"], + ["text",": "], + ["constant.numeric","100%"] +],[ + ["comment",-1,2,"start"], + ["comment"," /*;*********;"] +],[ + ["comment",3,2,"start"], + ["comment"," ;comment ;"] +],[ + ["comment",3,2,"start"], + ["comment"," ;*********;"] +],[ + "start" +],[ + "start", + ["variable.language",".toggle"] +],[ + "start", + ["text"," "], + ["variable","$size"], + ["text",": "], + ["constant.numeric","14px"] +],[ + "start" +],[ + "start", + ["support.type"," :background "], + ["support.function","url("], + ["string","http://subtlepatterns.com/patterns/dark_stripes.png"], + ["support.function",")"] +],[ + "start", + ["text"," "], + ["support.type","border-radius"], + ["text",": "], + ["constant.numeric","8px"] +],[ + "start", + ["text"," "], + ["support.type","height"], + ["text",": "], + ["variable","$size"] +],[ + "start" +],[ + "start", + ["text"," &"], + ["variable.language",":before"] +],[ + "start", + ["text"," "], + ["variable","$radius"], + ["text",": "], + ["variable","$size"], + ["text"," "], + ["keyword.operator","*"], + ["text"," "], + ["constant.numeric","0.845"] +],[ + "start", + ["text"," "], + ["variable","$glow"], + ["text",": "], + ["variable","$size"], + ["text"," "], + ["keyword.operator","*"], + ["text"," "], + ["constant.numeric","0.125"] +],[ + "start" +],[ + "start", + ["text"," "], + ["support.type","box-shadow"], + ["text",": "], + ["constant.numeric","0"], + ["text"," "], + ["constant.numeric","0"], + ["text"," "], + ["variable","$glow"], + ["text"," "], + ["variable","$glow"], + ["text"," / "], + ["constant.numeric","2"], + ["text"," "], + ["constant.numeric","#fff"] +],[ + "start", + ["text"," "], + ["support.type","border-radius"], + ["text",": "], + ["variable","$radius"] +],[ + "start", + ["text"," "] +],[ + "start", + ["text"," &"], + ["variable.language",":active"] +],[ + "start", + ["text"," ~ "], + ["variable.language",".button"] +],[ + "start", + ["text"," "], + ["support.type","box-shadow"], + ["text",": "], + ["constant.numeric","0"], + ["text"," "], + ["constant.numeric","15px"], + ["text"," "], + ["constant.numeric","25px"], + ["text"," "], + ["constant.numeric","-4px"], + ["text"," "], + ["support.function","rgba"], + ["paren.lparen","("], + ["constant.numeric","0"], + ["text",","], + ["constant.numeric","0"], + ["text",","], + ["constant.numeric","0"], + ["text",","], + ["constant.numeric","0.4"], + ["paren.rparen",")"], + ["text"," "] +],[ + "start", + ["text"," ~ "], + ["variable.language",".label"] +],[ + "start", + ["text"," "], + ["support.type","font-size"], + ["text",": "], + ["constant.numeric","40px"] +],[ + "start", + ["text"," "], + ["support.type","color"], + ["text",": "], + ["support.function","rgba"], + ["paren.lparen","("], + ["constant.numeric","0"], + ["text",","], + ["constant.numeric","0"], + ["text",","], + ["constant.numeric","0"], + ["text",","], + ["constant.numeric","0.45"], + ["paren.rparen",")"] +],[ + "start" +],[ + "start", + ["text"," &"], + ["variable.language",":checked"], + ["text"," "] +],[ + "start", + ["text"," ~ "], + ["variable.language",".button"] +],[ + "start", + ["text"," "], + ["support.type","box-shadow"], + ["text",": "], + ["constant.numeric","0"], + ["text"," "], + ["constant.numeric","15px"], + ["text"," "], + ["constant.numeric","25px"], + ["text"," "], + ["constant.numeric","-4px"], + ["text"," "], + ["constant.numeric","#ace"] +],[ + "start", + ["text"," ~ "], + ["variable.language",".label"] +],[ + "start", + ["text"," "], + ["support.type","font-size"], + ["text",": "], + ["constant.numeric","40px"] +],[ + "start", + ["text"," "], + ["support.type","color"], + ["text",": "], + ["constant.numeric","#c9c9c9"] +],[ + "start" +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_scad.json b/addons/editor/ace/mode/_test/tokens_scad.json new file mode 100755 index 00000000..8f0ff637 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_scad.json @@ -0,0 +1,194 @@ +[[ + "start", + ["comment","// ace can highlight scad!"] +],[ + "start", + ["keyword","module"], + ["text"," "], + ["identifier","Element"], + ["paren.lparen","("], + ["identifier","xpos"], + ["text",", "], + ["identifier","ypos"], + ["text",", "], + ["identifier","zpos"], + ["paren.rparen",")"], + ["paren.lparen","{"] +],[ + "start", + ["text","\t"], + ["identifier","translate"], + ["paren.lparen","(["], + ["identifier","xpos"], + ["text",","], + ["identifier","ypos"], + ["text",","], + ["identifier","zpos"], + ["paren.rparen","])"], + ["paren.lparen","{"] +],[ + "start", + ["text","\t\t"], + ["identifier","union"], + ["paren.lparen","("], + ["paren.rparen",")"], + ["paren.lparen","{"] +],[ + "start", + ["text","\t\t\t"], + ["identifier","cube"], + ["paren.lparen","(["], + ["constant.numeric","10"], + ["text",","], + ["constant.numeric","10"], + ["text",","], + ["constant.numeric","4"], + ["paren.rparen","]"], + ["text",","], + ["identifier","true"], + ["paren.rparen",")"], + ["text",";"] +],[ + "start", + ["text","\t\t\t"], + ["identifier","cylinder"], + ["paren.lparen","("], + ["constant.numeric","10"], + ["text",","], + ["constant.numeric","15"], + ["text",","], + ["constant.numeric","5"], + ["paren.rparen",")"], + ["text",";"] +],[ + "start", + ["text","\t\t\t"], + ["identifier","translate"], + ["paren.lparen","(["], + ["constant.numeric","0"], + ["text",","], + ["constant.numeric","0"], + ["text",","], + ["constant.numeric","10"], + ["paren.rparen","])"], + ["identifier","sphere"], + ["paren.lparen","("], + ["constant.numeric","5"], + ["paren.rparen",")"], + ["text",";"] +],[ + "start", + ["text","\t\t"], + ["paren.rparen","}"] +],[ + "start", + ["text","\t"], + ["paren.rparen","}"] +],[ + "start", + ["paren.rparen","}"] +],[ + "start" +],[ + "start", + ["identifier","union"], + ["paren.lparen","("], + ["paren.rparen",")"], + ["paren.lparen","{"] +],[ + "start", + ["text","\t"], + ["keyword","for"], + ["paren.lparen","("], + ["identifier","i"], + ["keyword.operator","="], + ["paren.lparen","["], + ["constant.numeric","0"], + ["text",":"], + ["constant.numeric","30"], + ["paren.rparen","])"], + ["paren.lparen","{"] +],[ + "start", + ["text","\t\t# "], + ["identifier","Element"], + ["paren.lparen","("], + ["constant.numeric","0"], + ["text",","], + ["constant.numeric","0"], + ["text",","], + ["constant.numeric","0"], + ["paren.rparen",")"], + ["text",";"] +],[ + "start", + ["text","\t\t"], + ["identifier","Element"], + ["paren.lparen","("], + ["constant.numeric","15"], + ["keyword.operator","*"], + ["identifier","i"], + ["text",","], + ["constant.numeric","0"], + ["text",","], + ["constant.numeric","0"], + ["paren.rparen",")"], + ["text",";"] +],[ + "start", + ["text","\t"], + ["paren.rparen","}"] +],[ + "start", + ["paren.rparen","}"] +],[ + "start" +],[ + "start", + ["keyword","for"], + ["text"," "], + ["paren.lparen","("], + ["identifier","i"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["paren.lparen","["], + ["constant.numeric","3"], + ["text",", "], + ["constant.numeric","5"], + ["text",", "], + ["constant.numeric","7"], + ["text",", "], + ["constant.numeric","11"], + ["paren.rparen","])"], + ["paren.lparen","{"] +],[ + "start", + ["text","\t"], + ["identifier","rotate"], + ["paren.lparen","(["], + ["identifier","i"], + ["keyword.operator","*"], + ["constant.numeric","10"], + ["text",","], + ["constant.numeric","0"], + ["text",","], + ["constant.numeric","0"], + ["paren.rparen","])"], + ["identifier","scale"], + ["paren.lparen","(["], + ["constant.numeric","1"], + ["text",","], + ["constant.numeric","1"], + ["text",","], + ["identifier","i"], + ["paren.rparen","])"], + ["identifier","cube"], + ["paren.lparen","("], + ["constant.numeric","10"], + ["paren.rparen",")"], + ["text",";"] +],[ + "start", + ["paren.rparen","}"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_scala.json b/addons/editor/ace/mode/_test/tokens_scala.json new file mode 100755 index 00000000..01dd3ce3 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_scala.json @@ -0,0 +1,542 @@ +[[ + "start", + ["comment","// http://www.scala-lang.org/node/54"] +],[ + "start" +],[ + "start", + ["keyword","package"], + ["text"," "], + ["identifier","examples"], + ["text","."], + ["identifier","actors"] +],[ + "start" +],[ + "start", + ["keyword","import"], + ["text"," "], + ["identifier","scala"], + ["text","."], + ["identifier","actors"], + ["text","."], + ["identifier","Actor"] +],[ + "start", + ["keyword","import"], + ["text"," "], + ["identifier","scala"], + ["text","."], + ["identifier","actors"], + ["text","."], + ["identifier","Actor"], + ["text","."], + ["identifier","_"] +],[ + "start" +],[ + "start", + ["keyword","abstract"], + ["text"," "], + ["keyword","class"], + ["text"," "], + ["identifier","PingMessage"] +],[ + "start", + ["keyword","case"], + ["text"," "], + ["keyword","object"], + ["text"," "], + ["identifier","Start"], + ["text"," "], + ["keyword","extends"], + ["text"," "], + ["identifier","PingMessage"] +],[ + "start", + ["keyword","case"], + ["text"," "], + ["keyword","object"], + ["text"," "], + ["identifier","SendPing"], + ["text"," "], + ["keyword","extends"], + ["text"," "], + ["identifier","PingMessage"] +],[ + "start", + ["keyword","case"], + ["text"," "], + ["keyword","object"], + ["text"," "], + ["identifier","Pong"], + ["text"," "], + ["keyword","extends"], + ["text"," "], + ["identifier","PingMessage"] +],[ + "start" +],[ + "start", + ["keyword","abstract"], + ["text"," "], + ["keyword","class"], + ["text"," "], + ["identifier","PongMessage"] +],[ + "start", + ["keyword","case"], + ["text"," "], + ["keyword","object"], + ["text"," "], + ["identifier","Ping"], + ["text"," "], + ["keyword","extends"], + ["text"," "], + ["identifier","PongMessage"] +],[ + "start", + ["keyword","case"], + ["text"," "], + ["keyword","object"], + ["text"," "], + ["identifier","Stop"], + ["text"," "], + ["keyword","extends"], + ["text"," "], + ["identifier","PongMessage"] +],[ + "start" +],[ + "start", + ["keyword","object"], + ["text"," "], + ["identifier","pingpong"], + ["text"," "], + ["keyword","extends"], + ["text"," "], + ["identifier","Application"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["keyword","val"], + ["text"," "], + ["identifier","pong"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["keyword","new"], + ["text"," "], + ["identifier","Pong"] +],[ + "start", + ["text"," "], + ["keyword","val"], + ["text"," "], + ["identifier","ping"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["keyword","new"], + ["text"," "], + ["identifier","Ping"], + ["paren.lparen","("], + ["constant.numeric","100000"], + ["text",", "], + ["identifier","pong"], + ["paren.rparen",")"] +],[ + "start", + ["text"," "], + ["identifier","ping"], + ["text","."], + ["identifier","start"] +],[ + "start", + ["text"," "], + ["identifier","pong"], + ["text","."], + ["identifier","start"] +],[ + "start", + ["text"," "], + ["identifier","ping"], + ["text"," "], + ["keyword.operator","!"], + ["text"," "], + ["identifier","Start"] +],[ + "start", + ["paren.rparen","}"] +],[ + "start" +],[ + "start", + ["keyword","class"], + ["text"," "], + ["identifier","Ping"], + ["paren.lparen","("], + ["identifier","count"], + ["text",": "], + ["support.function","Int"], + ["text",", "], + ["identifier","pong"], + ["text",": "], + ["identifier","Actor"], + ["paren.rparen",")"], + ["text"," "], + ["keyword","extends"], + ["text"," "], + ["identifier","Actor"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["keyword","def"], + ["text"," "], + ["identifier","act"], + ["paren.lparen","("], + ["paren.rparen",")"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["identifier","println"], + ["paren.lparen","("], + ["string","\"Ping: Initializing with count \""], + ["keyword.operator","+"], + ["identifier","count"], + ["keyword.operator","+"], + ["string","\": \""], + ["keyword.operator","+"], + ["identifier","pong"], + ["paren.rparen",")"] +],[ + "start", + ["text"," "], + ["keyword","var"], + ["text"," "], + ["identifier","pingsLeft"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["identifier","count"] +],[ + "start", + ["text"," "], + ["identifier","loop"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["identifier","react"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["keyword","case"], + ["text"," "], + ["identifier","Start"], + ["text"," "], + ["keyword.operator","=>"] +],[ + "start", + ["text"," "], + ["identifier","println"], + ["paren.lparen","("], + ["string","\"Ping: starting.\""], + ["paren.rparen",")"] +],[ + "start", + ["text"," "], + ["identifier","pong"], + ["text"," "], + ["keyword.operator","!"], + ["text"," "], + ["identifier","Ping"] +],[ + "start", + ["text"," "], + ["identifier","pingsLeft"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["identifier","pingsLeft"], + ["text"," "], + ["keyword.operator","-"], + ["text"," "], + ["constant.numeric","1"] +],[ + "start", + ["text"," "], + ["keyword","case"], + ["text"," "], + ["identifier","SendPing"], + ["text"," "], + ["keyword.operator","=>"] +],[ + "start", + ["text"," "], + ["identifier","pong"], + ["text"," "], + ["keyword.operator","!"], + ["text"," "], + ["identifier","Ping"] +],[ + "start", + ["text"," "], + ["identifier","pingsLeft"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["identifier","pingsLeft"], + ["text"," "], + ["keyword.operator","-"], + ["text"," "], + ["constant.numeric","1"] +],[ + "start", + ["text"," "], + ["keyword","case"], + ["text"," "], + ["identifier","Pong"], + ["text"," "], + ["keyword.operator","=>"] +],[ + "start", + ["text"," "], + ["keyword","if"], + ["text"," "], + ["paren.lparen","("], + ["identifier","pingsLeft"], + ["text"," "], + ["keyword.operator","%"], + ["text"," "], + ["constant.numeric","1000"], + ["text"," "], + ["keyword.operator","=="], + ["text"," "], + ["constant.numeric","0"], + ["paren.rparen",")"] +],[ + "start", + ["text"," "], + ["identifier","println"], + ["paren.lparen","("], + ["string","\"Ping: pong from: \""], + ["keyword.operator","+"], + ["identifier","sender"], + ["paren.rparen",")"] +],[ + "start", + ["text"," "], + ["keyword","if"], + ["text"," "], + ["paren.lparen","("], + ["identifier","pingsLeft"], + ["text"," "], + ["keyword.operator",">"], + ["text"," "], + ["constant.numeric","0"], + ["paren.rparen",")"] +],[ + "start", + ["text"," "], + ["identifier","self"], + ["text"," "], + ["keyword.operator","!"], + ["text"," "], + ["identifier","SendPing"] +],[ + "start", + ["text"," "], + ["keyword","else"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["identifier","println"], + ["paren.lparen","("], + ["string","\"Ping: Stop.\""], + ["paren.rparen",")"] +],[ + "start", + ["text"," "], + ["identifier","pong"], + ["text"," "], + ["keyword.operator","!"], + ["text"," "], + ["identifier","Stop"] +],[ + "start", + ["text"," "], + ["identifier","exit"], + ["paren.lparen","("], + ["symbol.constant","'stop"], + ["paren.rparen",")"] +],[ + "start", + ["text"," "], + ["paren.rparen","}"] +],[ + "start", + ["text"," "], + ["paren.rparen","}"] +],[ + "start", + ["text"," "], + ["paren.rparen","}"] +],[ + "start", + ["text"," "], + ["paren.rparen","}"] +],[ + "start", + ["paren.rparen","}"] +],[ + "start" +],[ + "start", + ["keyword","class"], + ["text"," "], + ["identifier","Pong"], + ["text"," "], + ["keyword","extends"], + ["text"," "], + ["identifier","Actor"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["keyword","def"], + ["text"," "], + ["identifier","act"], + ["paren.lparen","("], + ["paren.rparen",")"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["keyword","var"], + ["text"," "], + ["identifier","pongCount"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["constant.numeric","0"] +],[ + "start", + ["text"," "], + ["identifier","loop"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["identifier","react"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["keyword","case"], + ["text"," "], + ["identifier","Ping"], + ["text"," "], + ["keyword.operator","=>"] +],[ + "start", + ["text"," "], + ["keyword","if"], + ["text"," "], + ["paren.lparen","("], + ["identifier","pongCount"], + ["text"," "], + ["keyword.operator","%"], + ["text"," "], + ["constant.numeric","1000"], + ["text"," "], + ["keyword.operator","=="], + ["text"," "], + ["constant.numeric","0"], + ["paren.rparen",")"] +],[ + "start", + ["text"," "], + ["identifier","println"], + ["paren.lparen","("], + ["string","\"Pong: ping \""], + ["keyword.operator","+"], + ["identifier","pongCount"], + ["keyword.operator","+"], + ["string","\" from \""], + ["keyword.operator","+"], + ["identifier","sender"], + ["paren.rparen",")"] +],[ + "start", + ["text"," "], + ["identifier","sender"], + ["text"," "], + ["keyword.operator","!"], + ["text"," "], + ["identifier","Pong"] +],[ + "start", + ["text"," "], + ["identifier","pongCount"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["identifier","pongCount"], + ["text"," "], + ["keyword.operator","+"], + ["text"," "], + ["constant.numeric","1"] +],[ + "start", + ["text"," "], + ["keyword","case"], + ["text"," "], + ["identifier","Stop"], + ["text"," "], + ["keyword.operator","=>"] +],[ + "start", + ["text"," "], + ["identifier","println"], + ["paren.lparen","("], + ["string","\"Pong: Stop.\""], + ["paren.rparen",")"] +],[ + "start", + ["text"," "], + ["identifier","exit"], + ["paren.lparen","("], + ["symbol.constant","'stop"], + ["paren.rparen",")"] +],[ + "start", + ["text"," "], + ["paren.rparen","}"] +],[ + "start", + ["text"," "], + ["paren.rparen","}"] +],[ + "start", + ["text"," "], + ["paren.rparen","}"] +],[ + "start", + ["paren.rparen","}"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_scheme.json b/addons/editor/ace/mode/_test/tokens_scheme.json new file mode 100755 index 00000000..42f4aa65 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_scheme.json @@ -0,0 +1,216 @@ +[[ + "start", + ["text","("], + ["storage.type.function-type.scheme","define"], + ["text"," "], + ["text","("], + ["identifier","prompt-for-cd"], + ["text",")"] +],[ + "start", + ["text"," "], + ["string","\"Prompts"] +],[ + "start", + ["text"," "], + ["identifier","for"], + ["text"," "], + ["identifier","CD"], + ["text","\""] +],[ + "start", + ["text"," ("], + ["identifier","prompt-read"], + ["text"," "], + ["string","\"Title\""], + ["text"," "], + ["constant.numeric","1.53"], + ["text"," "], + ["constant.numeric","1"], + ["text"," "], + ["constant.numeric","2"], + ["text","/"], + ["constant.numeric","4"], + ["text"," "], + ["constant.numeric","1.7"], + ["text"," "], + ["constant.numeric","1.7e0"], + ["text"," "], + ["constant.numeric","2.9E-4"], + ["text"," "], + ["constant.numeric","+42"], + ["text"," "], + ["constant.numeric","-7"], + ["text"," "], + ["constant.numeric","#b001"], + ["text"," "], + ["constant.numeric","#b001"], + ["text","/"], + ["constant.numeric","100"], + ["text"," "], + ["constant.numeric","#o777"], + ["text"," "], + ["constant.numeric","#O777"], + ["text"," "], + ["constant.numeric","#xabc55"], + ["text"," "], + ["identifier","#c"], + ["text","("], + ["constant.numeric","0"], + ["text"," "], + ["constant.numeric","-5.6"], + ["text","))"] +],[ + "start", + ["text"," ("], + ["identifier","prompt-read"], + ["text"," "], + ["string","\"Artist\""], + ["text",")"] +],[ + "start", + ["text"," ("], + ["keyword.operator","or"], + ["text"," ("], + ["identifier","parse-integer"], + ["text"," ("], + ["identifier","prompt-read"], + ["text"," "], + ["string","\"Rating\""], + ["text",") "], + ["punctuation.definition.constant.character.scheme","#:junk-allowed"], + ["text"," "], + ["constant.language","#t"], + ["text",") "], + ["constant.numeric","0"], + ["text",")"] +],[ + "start", + ["text"," ("], + ["keyword.control","if"], + ["text"," "], + ["identifier","x"], + ["text"," ("], + ["support.function","format"], + ["text"," "], + ["constant.language","#t"], + ["text"," "], + ["string","\"yes\""], + ["text",") ("], + ["support.function","format"], + ["text"," "], + ["constant.language","#f"], + ["text"," "], + ["string","\"no\""], + ["text",") "], + ["comment",";and here comment"] +],[ + "start", + ["text"," ) "] +],[ + "start", + ["text"," "], + ["comment",";; second line comment"] +],[ + "start", + ["text"," '(+ "], + ["constant.numeric","1"], + ["text"," "], + ["constant.numeric","2"], + ["text",")"] +],[ + "start", + ["text"," ("], + ["identifier","position-if-not"], + ["text"," "], + ["identifier","char-set"], + ["text",":"], + ["identifier","whitespace"], + ["text"," "], + ["identifier","line"], + ["text"," "], + ["punctuation.definition.constant.character.scheme","#:start"], + ["text"," "], + ["identifier","beg"], + ["text","))"] +],[ + "start", + ["text"," ("], + ["support.function","quote"], + ["text"," ("], + ["identifier","privet"], + ["text"," "], + ["constant.numeric","1"], + ["text"," "], + ["constant.numeric","2"], + ["text"," "], + ["constant.numeric","3"], + ["text","))"] +],[ + "start", + ["text"," '("], + ["identifier","hello"], + ["text"," "], + ["identifier","world"], + ["text",")"] +],[ + "start", + ["text"," (* "], + ["constant.numeric","5"], + ["text"," "], + ["constant.numeric","7"], + ["text",")"] +],[ + "start", + ["text"," ("], + ["constant.numeric","1"], + ["text"," "], + ["constant.numeric","2"], + ["text"," "], + ["constant.numeric","34"], + ["text"," "], + ["constant.numeric","5"], + ["text",")"] +],[ + "start", + ["text"," ("], + ["punctuation.definition.constant.character.scheme","#:use"], + ["text"," "], + ["string","\"aaaa\""], + ["text",")"] +],[ + "start", + ["text"," ("], + ["keyword.control","let"], + ["text"," (("], + ["identifier","x"], + ["text"," "], + ["constant.numeric","10"], + ["text",") ("], + ["identifier","y"], + ["text"," "], + ["constant.numeric","20"], + ["text","))"] +],[ + "start", + ["text"," ("], + ["identifier","display"], + ["text"," (+ "], + ["identifier","x"], + ["text"," "], + ["identifier","y"], + ["text","))"] +],[ + "start", + ["text"," ) "] +],[ + "start" +],[ + "start", + ["text"," "], + ["string","\"asdad"], + ["constant.character.escape.scheme","\\0"], + ["string","eqweqe\""] +],[ + "start" +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_scss.json b/addons/editor/ace/mode/_test/tokens_scss.json new file mode 100755 index 00000000..7e92f153 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_scss.json @@ -0,0 +1,123 @@ +[[ + "start", + ["comment","/* style.scss */"] +],[ + "start" +],[ + "start", + ["variable.language","#navbar"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["variable","$navbar-width"], + ["text",": "], + ["constant.numeric","800px"], + ["text",";"] +],[ + "start", + ["text"," "], + ["variable","$items"], + ["text",": "], + ["constant.numeric","5"], + ["text",";"] +],[ + "start", + ["text"," "], + ["variable","$navbar-color"], + ["text",": "], + ["constant.numeric","#ce4dd6"], + ["text",";"] +],[ + "start" +],[ + "start", + ["text"," "], + ["support.type","width"], + ["text",": "], + ["variable","$navbar-width"], + ["text",";"] +],[ + "start", + ["text"," "], + ["support.type","border-bottom"], + ["text",": "], + ["constant.numeric","2px"], + ["text"," "], + ["constant.language","solid"], + ["text"," "], + ["variable","$navbar-color"], + ["text",";"] +],[ + "start" +],[ + "start", + ["text"," "], + ["variable.language","li"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["support.type","float"], + ["text",": "], + ["support.type","left"], + ["text",";"] +],[ + "start", + ["text"," "], + ["support.type","width"], + ["text",": "], + ["variable","$navbar-width"], + ["text","/"], + ["variable","$items"], + ["text"," "], + ["constant","-"], + ["text"," "], + ["constant.numeric","10px"], + ["text",";"] +],[ + "start" +],[ + "start", + ["text"," "], + ["support.type","background-color"], + ["text",": "], + ["support.function","lighten"], + ["paren.lparen","("], + ["variable","$navbar-color"], + ["text",", "], + ["constant.numeric","20%"], + ["paren.rparen",")"], + ["text",";"] +],[ + "start", + ["text"," &"], + ["variable.language",":hover"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["support.type","background-color"], + ["text",": "], + ["support.function","lighten"], + ["paren.lparen","("], + ["variable","$navbar-color"], + ["text",", "], + ["constant.numeric","10%"], + ["paren.rparen",")"], + ["text",";"] +],[ + "start", + ["text"," "], + ["paren.rparen","}"] +],[ + "start", + ["text"," "], + ["paren.rparen","}"] +],[ + "start", + ["paren.rparen","}"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_sh.json b/addons/editor/ace/mode/_test/tokens_sh.json new file mode 100755 index 00000000..e4ab3412 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_sh.json @@ -0,0 +1,334 @@ +[[ + "start", + ["comment","#!/bin/sh"] +],[ + "start" +],[ + "start", + ["comment","# Script to open a browser to current branch"] +],[ + "start", + ["comment","# Repo formats:"] +],[ + "start", + ["comment","# ssh git@github.com:richoH/gh_pr.git"] +],[ + "start", + ["comment","# http https://richoH@github.com/richoH/gh_pr.git"] +],[ + "start", + ["comment","# git git://github.com/richoH/gh_pr.git"] +],[ + "start" +],[ + "start", + ["variable","username="], + ["text","`"], + ["identifier","git"], + ["text"," "], + ["identifier","config"], + ["text"," "], + ["keyword.operator","--"], + ["identifier","get"], + ["text"," "], + ["identifier","github"], + ["text","."], + ["identifier","user"], + ["text","`"] +],[ + "start" +],[ + "start", + ["support.function","get_repo()"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["identifier","git"], + ["text"," "], + ["identifier","remote"], + ["text"," "], + ["keyword.operator","-"], + ["identifier","v"], + ["text"," | "], + ["identifier","grep"], + ["text"," $"], + ["paren.lparen","{"], + ["text","@:"], + ["keyword.operator","-"], + ["variable","$username"], + ["paren.rparen","}"], + ["text"," | "], + ["keyword","while"], + ["text"," "], + ["keyword","read"], + ["text"," "], + ["identifier","remote"], + ["text","; "], + ["keyword","do"] +],[ + "start", + ["text"," "], + ["keyword","if"], + ["text"," "], + ["variable","repo="], + ["text","`"], + ["support.function.builtin","echo"], + ["text"," "], + ["variable","$remote"], + ["text"," | "], + ["identifier","grep"], + ["text"," "], + ["keyword.operator","-"], + ["identifier","E"], + ["text"," "], + ["keyword.operator","-"], + ["identifier","o"], + ["text"," "], + ["string","\"git@github.com:[^ ]*\""], + ["text","`; "], + ["keyword","then"] +],[ + "start", + ["text"," "], + ["support.function.builtin","echo"], + ["text"," "], + ["variable","$repo"], + ["text"," | "], + ["identifier","sed"], + ["text"," "], + ["keyword.operator","-"], + ["identifier","e"], + ["text"," "], + ["string","\"s/^git@github\\.com://\""], + ["text"," "], + ["keyword.operator","-"], + ["identifier","e"], + ["text"," "], + ["string","\"s/\\.git$//\""] +],[ + "start", + ["text"," "], + ["support.function.builtin","exit"], + ["text"," "], + ["constant.numeric","1"] +],[ + "start", + ["text"," "], + ["keyword","fi"] +],[ + "start", + ["text"," "], + ["keyword","if"], + ["text"," "], + ["variable","repo="], + ["text","`"], + ["support.function.builtin","echo"], + ["text"," "], + ["variable","$remote"], + ["text"," | "], + ["identifier","grep"], + ["text"," "], + ["keyword.operator","-"], + ["identifier","E"], + ["text"," "], + ["keyword.operator","-"], + ["identifier","o"], + ["text"," "], + ["string","\"https?://([^@]*@)?github.com/[^ ]*\\.git\""], + ["text","`; "], + ["keyword","then"] +],[ + "start", + ["text"," "], + ["support.function.builtin","echo"], + ["text"," "], + ["variable","$repo"], + ["text"," | "], + ["identifier","sed"], + ["text"," "], + ["keyword.operator","-"], + ["identifier","e"], + ["text"," "], + ["string","\"s|^https?://||\""], + ["text"," "], + ["keyword.operator","-"], + ["identifier","e"], + ["text"," "], + ["string","\"s/^.*github\\.com\\///\""], + ["text"," "], + ["keyword.operator","-"], + ["identifier","e"], + ["text"," "], + ["string","\"s/\\.git$//\""] +],[ + "start", + ["text"," "], + ["support.function.builtin","exit"], + ["text"," "], + ["constant.numeric","1"] +],[ + "start", + ["text"," "], + ["keyword","fi"] +],[ + "start", + ["text"," "], + ["keyword","if"], + ["text"," "], + ["variable","repo="], + ["text","`"], + ["support.function.builtin","echo"], + ["text"," "], + ["variable","$remote"], + ["text"," | "], + ["identifier","grep"], + ["text"," "], + ["keyword.operator","-"], + ["identifier","E"], + ["text"," "], + ["keyword.operator","-"], + ["identifier","o"], + ["text"," "], + ["string","\"git://github.com/[^ ]*\\.git\""], + ["text","`; "], + ["keyword","then"] +],[ + "start", + ["text"," "], + ["support.function.builtin","echo"], + ["text"," "], + ["variable","$repo"], + ["text"," | "], + ["identifier","sed"], + ["text"," "], + ["keyword.operator","-"], + ["identifier","e"], + ["text"," "], + ["string","\"s|^git://github.com/||\""], + ["text"," "], + ["keyword.operator","-"], + ["identifier","e"], + ["text"," "], + ["string","\"s/\\.git$//\""] +],[ + "start", + ["text"," "], + ["support.function.builtin","exit"], + ["text"," "], + ["constant.numeric","1"] +],[ + "start", + ["text"," "], + ["keyword","fi"] +],[ + "start", + ["text"," "], + ["keyword","done"] +],[ + "start" +],[ + "start", + ["text"," "], + ["keyword","if"], + ["text"," "], + ["paren.lparen","["], + ["text"," "], + ["variable.language","$?"], + ["text"," "], + ["keyword.operator","-"], + ["identifier","eq"], + ["text"," "], + ["constant.numeric","0"], + ["text"," "], + ["paren.rparen","]"], + ["text","; "], + ["keyword","then"] +],[ + "start", + ["text"," "], + ["support.function.builtin","echo"], + ["text"," "], + ["string","\"Couldn't find a valid remote\""], + ["text"," "], + ["keyword.operator",">"], + ["support.function","&2"] +],[ + "start", + ["text"," "], + ["support.function.builtin","exit"], + ["text"," "], + ["constant.numeric","1"] +],[ + "start", + ["text"," "], + ["keyword","fi"] +],[ + "start", + ["paren.rparen","}"] +],[ + "start" +],[ + "start", + ["support.function.builtin","echo"], + ["text"," $"], + ["paren.lparen","{"], + ["text","#"], + ["identifier","x"], + ["paren.lparen","["], + ["text","@"], + ["paren.rparen","]}"] +],[ + "start" +],[ + "start", + ["keyword","if"], + ["text"," "], + ["variable","repo="], + ["text","`"], + ["identifier","get_repo"], + ["text"," $@`; "], + ["keyword","then"] +],[ + "start", + ["text"," "], + ["variable","branch="], + ["text","`"], + ["identifier","git"], + ["text"," "], + ["identifier","symbolic"], + ["keyword.operator","-"], + ["identifier","ref"], + ["text"," "], + ["identifier","HEAD"], + ["text"," "], + ["constant.numeric","2"], + ["keyword.operator",">/"], + ["identifier","dev"], + ["keyword.operator","/"], + ["identifier","null"], + ["text","`"] +],[ + "start", + ["text"," "], + ["support.function.builtin","echo"], + ["text"," "], + ["string","\"http://github.com/"], + ["constant","$repo"], + ["string","/pull/new/${branch##refs/heads/}\""] +],[ + "start", + ["keyword","else"] +],[ + "start", + ["text"," "], + ["support.function.builtin","exit"], + ["text"," "], + ["constant.numeric","1"] +],[ + "start", + ["keyword","fi"] +],[ + "start" +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_snippets.json b/addons/editor/ace/mode/_test/tokens_snippets.json new file mode 100755 index 00000000..308683b7 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_snippets.json @@ -0,0 +1,159 @@ +[[ + "start", + ["comment","# Function"] +],[ + "start", + ["constant.language.escape","snippet"], + ["text"," fun"] +],[ + "sn-start", + ["text","\tfunction "], + ["markup.list","${"], + ["constant.numeric","1"], + ["text","?:function_name"], + ["markup.list","}"], + ["text","("], + ["markup.list","${"], + ["constant.numeric","2"], + ["punctuation.operator",":"], + ["text","argument"], + ["markup.list","}"], + ["text",") {"] +],[ + "sn-start", + ["text","\t\t"], + ["markup.list","${"], + ["constant.numeric","3"], + ["punctuation.operator",":"], + ["text","// body..."], + ["markup.list","}"] +],[ + "sn-start", + ["text","\t}"] +],[ + "start", + ["comment","# Anonymous Function"] +],[ + "start", + ["constant.language.escape","regex "], + ["keyword","/"], + ["text","((=)\\s*|(:)\\s*|(\\()|\\b)"], + ["keyword","/"], + ["text","f"], + ["keyword","/"], + ["text","(\\))?"], + ["keyword","/"] +],[ + "start", + ["constant.language.escape","name"], + ["text"," f"] +],[ + "sn-start", + ["text","\tfunction"], + ["markup.list","${"], + ["variable","M1"], + ["text","?: "], + ["markup.list","${"], + ["constant.numeric","1"], + ["punctuation.operator",":"], + ["text","functionName"], + ["markup.list","}}"], + ["text","("], + ["variable","$2"], + ["text",") {"] +],[ + "sn-start", + ["text","\t\t"], + ["markup.list","${"], + ["constant.numeric","0"], + ["punctuation.operator",":"], + ["keyword","$TM_SELECTED_TEXT"], + ["markup.list","}"] +],[ + "sn-start", + ["text","\t}"], + ["markup.list","${"], + ["variable","M2"], + ["text","?;"], + ["markup.list","}${"], + ["variable","M3"], + ["text","?,"], + ["markup.list","}${"], + ["variable","M4"], + ["text","?)"], + ["markup.list","}"] +],[ + "start", + ["comment","# Immediate function"] +],[ + "start", + ["constant.language.escape","trigger"], + ["text"," \\(?f\\("] +],[ + "start", + ["constant.language.escape","endTrigger"], + ["text"," \\)?"] +],[ + "start", + ["constant.language.escape","snippet"], + ["text"," f("] +],[ + "sn-start", + ["text","\t(function("], + ["markup.list","${"], + ["constant.numeric","1"], + ["markup.list","}"], + ["text",") {"] +],[ + "sn-start", + ["text","\t\t"], + ["markup.list","${"], + ["constant.numeric","0"], + ["punctuation.operator",":"], + ["markup.list","${"], + ["keyword","TM_SELECTED_TEXT"], + ["punctuation.operator",":"], + ["text","/* code */"], + ["markup.list","}}"] +],[ + "sn-start", + ["text","\t}("], + ["markup.list","${"], + ["constant.numeric","1"], + ["markup.list","}"], + ["text","));"] +],[ + "start", + ["comment","# if"] +],[ + "start", + ["constant.language.escape","snippet"], + ["text"," if"] +],[ + "sn-start", + ["text","\tif ("], + ["markup.list","${"], + ["constant.numeric","1"], + ["punctuation.operator",":"], + ["text","true"], + ["markup.list","}"], + ["text",") {"] +],[ + "sn-start", + ["text","\t\t"], + ["markup.list","${"], + ["constant.numeric","0"], + ["markup.list","}"] +],[ + "sn-start", + ["text","\t}"] +],[ + "sn-start", + ["text","\t"] +],[ + "sn-start", + ["text","\t"] +],[ + "sn-start", + ["text","\t"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_sql.json b/addons/editor/ace/mode/_test/tokens_sql.json new file mode 100755 index 00000000..09a3ef99 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_sql.json @@ -0,0 +1,54 @@ +[[ + "start", + ["keyword","SELECT"], + ["text"," "], + ["identifier","city"], + ["text",", "], + ["support.function","COUNT"], + ["paren.lparen","("], + ["identifier","id"], + ["paren.rparen",")"], + ["text"," "], + ["keyword","AS"], + ["text"," "], + ["identifier","users_count"] +],[ + "start", + ["keyword","FROM"], + ["text"," "], + ["identifier","users"] +],[ + "start", + ["keyword","WHERE"], + ["text"," "], + ["identifier","group_name"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["string","'salesman'"] +],[ + "start", + ["keyword","AND"], + ["text"," "], + ["identifier","created"], + ["text"," "], + ["keyword.operator",">"], + ["text"," "], + ["string","'2011-05-21'"] +],[ + "start", + ["keyword","GROUP"], + ["text"," "], + ["keyword","BY"], + ["text"," "], + ["constant.numeric","1"] +],[ + "start", + ["keyword","ORDER"], + ["text"," "], + ["keyword","BY"], + ["text"," "], + ["constant.numeric","2"], + ["text"," "], + ["keyword","DESC"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_stylus.json b/addons/editor/ace/mode/_test/tokens_stylus.json new file mode 100755 index 00000000..f24993f7 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_stylus.json @@ -0,0 +1,271 @@ +[[ + "start", + ["comment","// I'm a comment!"] +],[ + "start" +],[ + "comment", + ["comment","/*"] +],[ + "comment", + ["comment"," * Adds the given numbers together."] +],[ + "start", + ["comment"," */"] +],[ + "start" +],[ + "start" +],[ + "comment", + ["comment","/*!"] +],[ + "comment", + ["comment"," * Adds the given numbers together."] +],[ + "start", + ["comment"," */"] +],[ + "start" +],[ + "start" +],[ + "start", + ["entity.name.function.stylus","asdasdasdad"], + ["text","("], + ["text","df, ad"], + ["keyword.operator.stylus","="], + ["constant.numeric","23"], + ["text",")"] +],[ + "start" +],[ + "start", + ["entity.name.function.stylus","add"], + ["text","("], + ["entity.name.tag.stylus","a"], + ["text",", "], + ["entity.name.tag.stylus","b"], + ["text"," "], + ["keyword.operator.stylus","="], + ["text"," "], + ["entity.name.tag.stylus","a"], + ["text",")"] +],[ + "start", + ["text"," "], + ["entity.name.tag.stylus","a"], + ["text"," "], + ["keyword.operator.stylus","+"], + ["text"," "], + ["entity.name.tag.stylus","b"] +],[ + "start", + ["entity.name.function.stylus","green"], + ["text","("], + ["constant.numeric","#0c0"], + ["text",")"] +],[ + "start", + ["text"," add("], + ["constant.numeric","10"], + ["text",", "], + ["constant.numeric","5"], + ["text",")"] +],[ + "start", + ["text"," "], + ["comment","// => 15"] +],[ + "start" +],[ + "start", + ["text"," add("], + ["constant.numeric","10"], + ["text",")"] +],[ + "start", + ["text"," add("], + ["entity.name.tag.stylus","a"], + ["text",", "], + ["entity.name.tag.stylus","b"], + ["text",")"] +],[ + "start" +],[ + "start", + ["entity.language.stylus"," &"], + ["text","asdasd"] +],[ + "start" +],[ + "start", + ["text"," ("], + ["variable.language.stylus","arguments"], + ["text",")"] +],[ + "start" +],[ + "start", + ["text"," "], + ["keyword.stylus","@sdfsdf"] +],[ + "start", + ["entity.other.attribute-name.class.stylus",".signatures"] +],[ + "start", + ["text"," "], + ["support.type","background-color"], + ["text"," "], + ["constant.numeric","#e0e8e0"] +],[ + "start", + ["text"," "], + ["support.type","border"], + ["text"," "], + ["constant.numeric","1"], + ["keyword","px"], + ["text"," "], + ["support.constant","solid"], + ["text"," grayLighter"] +],[ + "start", + ["text"," "], + ["support.type","box-shadow"], + ["text"," "], + ["constant.numeric","0"], + ["text"," "], + ["constant.numeric","0"], + ["text"," "], + ["constant.numeric","3"], + ["keyword","px"], + ["text"," grayLightest"] +],[ + "start", + ["text"," "], + ["support.type","border-radius"], + ["text"," "], + ["constant.numeric","3"], + ["keyword","px"] +],[ + "start", + ["text"," "], + ["support.type","padding"], + ["text"," "], + ["constant.numeric","3"], + ["keyword","px"], + ["text"," "], + ["constant.numeric","5"], + ["keyword","px"] +],[ + "start", + ["text"," "], + ["string","\"adsads\""] +],[ + "start", + ["text"," "], + ["support.type","margin-left"], + ["text"," "], + ["constant.numeric","0"] +],[ + "start", + ["text"," "], + ["support.type","list-style"], + ["text"," "], + ["support.constant","none"] +],[ + "start", + ["entity.other.attribute-name.class.stylus",".signature"] +],[ + "start", + ["text"," "], + ["support.type","list-style"], + ["text"," "], + ["support.constant","none"] +],[ + "start", + ["text"," "], + ["support.type","display"], + ["text",": "], + ["support.constant","inline"] +],[ + "start", + ["text"," "], + ["support.type","margin-left"], + ["text"," "], + ["constant.numeric","0"] +],[ + "start", + ["text"," "], + ["keyword.operator.stylus",">"], + ["text"," "], + ["entity.name.tag.stylus","li"] +],[ + "start", + ["text"," "], + ["support.type","display"], + ["text"," "], + ["support.constant","inline"] +],[ + "start", + ["keyword.operator.stylus","is"], + ["text"," "], + ["keyword.operator.stylus","not"] +],[ + "start", + ["entity.other.attribute-name.class.stylus",".signature-values"] +],[ + "start", + ["text"," "], + ["support.type","list-style"], + ["text"," "], + ["support.constant","none"] +],[ + "start", + ["text"," "], + ["support.type","display"], + ["text"," "], + ["support.constant","inline"] +],[ + "start", + ["text"," "], + ["support.type","margin-left"], + ["text"," "], + ["constant.numeric","0"] +],[ + "start", + ["entity.language.stylus"," &"], + ["punctuation",":"], + ["entity.other.attribute-name.pseudo-element.css","before"] +],[ + "start", + ["text"," "], + ["support.type","content"], + ["text"," "], + ["string","'→'"] +],[ + "start", + ["text"," "], + ["support.type","margin"], + ["text"," "], + ["constant.numeric","0"], + ["text"," "], + ["constant.numeric","5"], + ["keyword","px"] +],[ + "start", + ["text"," "], + ["keyword.operator.stylus",">"], + ["text"," "], + ["entity.name.tag.stylus","li"] +],[ + "start", + ["text"," "], + ["keyword.control.stylus","!important"] +],[ + "start" +],[ + "start", + ["text"," "], + ["keyword.control.stylus","unless"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_svg.json b/addons/editor/ace/mode/_test/tokens_svg.json new file mode 100755 index 00000000..f92fbbb6 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_svg.json @@ -0,0 +1,684 @@ +[[ + "meta.tag.punctuation.begin0", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","svg"] +],[ + "meta.tag.punctuation.begin0", + ["text"," "], + ["entity.other.attribute-name","width"], + ["keyword.operator.separator","="], + ["string","\"800\""], + ["text"," "], + ["entity.other.attribute-name","height"], + ["keyword.operator.separator","="], + ["string","\"600\""] +],[ + "meta.tag.punctuation.begin0", + ["text"," "], + ["entity.other.attribute-name","xmlns"], + ["keyword.operator.separator","="], + ["string","\"http://www.w3.org/2000/svg\""] +],[ + "start", + ["text"," "], + ["entity.other.attribute-name","onload"], + ["keyword.operator.separator","="], + ["string","\"StartAnimation(evt)\""], + ["meta.tag.punctuation.end",">"] +],[ + "start" +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","title"], + ["meta.tag.punctuation.end",">"], + ["text","Test Tube Progress Bar"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","desc"], + ["meta.tag.punctuation.end",">"], + ["text","Created for the Web Directions SVG competition"], + ["meta.tag.punctuation.begin",""] +],[ + "start" +],[ + "js-no_regex", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.script","script"], + ["text"," "], + ["entity.other.attribute-name","type"], + ["keyword.operator.separator","="], + ["string","\"text/ecmascript\""], + ["meta.tag.punctuation.end",">"], + ["string.begin",""], + ["text"," "], + ["identifier","max_time"], + ["paren.rparen",")"] +],[ + "js-start", + ["text"," "], + ["keyword","return"], + ["punctuation.operator",";"] +],[ + "js-start", + ["text"," "], + ["comment","// Scale the text string gradually until it is 20 times larger"] +],[ + "js-start", + ["text"," "], + ["identifier","scalefactor"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["paren.lparen","("], + ["identifier","timevalue"], + ["text"," "], + ["keyword.operator","*"], + ["text"," "], + ["constant.numeric","650"], + ["paren.rparen",")"], + ["text"," "], + ["keyword.operator","/"], + ["text"," "], + ["identifier","max_time"], + ["punctuation.operator",";"] +],[ + "js-start" +],[ + "js-start", + ["text"," "], + ["keyword","if"], + ["text"," "], + ["paren.lparen","("], + ["identifier","timevalue"], + ["text"," "], + ["keyword.operator","<"], + ["text"," "], + ["constant.numeric","30"], + ["paren.rparen",")"], + ["text"," "], + ["paren.lparen","{"] +],[ + "js-start", + ["text"," "], + ["identifier","hickory"], + ["punctuation.operator","."], + ["support.function.dom","setAttribute"], + ["paren.lparen","("], + ["string","\"display\""], + ["punctuation.operator",","], + ["text"," "], + ["string","\"\""], + ["paren.rparen",")"], + ["punctuation.operator",";"] +],[ + "js-start", + ["text"," "], + ["identifier","hickory"], + ["punctuation.operator","."], + ["support.function.dom","setAttribute"], + ["paren.lparen","("], + ["string","\"transform\""], + ["punctuation.operator",","], + ["text"," "], + ["string","\"translate(\""], + ["text"," "], + ["keyword.operator","+"], + ["text"," "], + ["paren.lparen","("], + ["constant.numeric","600"], + ["keyword.operator","+"], + ["identifier","scalefactor"], + ["keyword.operator","*"], + ["constant.numeric","3"], + ["keyword.operator","*"], + ["constant.numeric","-1"], + ["text"," "], + ["paren.rparen",")"], + ["text"," "], + ["keyword.operator","+"], + ["text"," "], + ["string","\", -144 )\""], + ["paren.rparen",")"], + ["punctuation.operator",";"] +],[ + "js-no_regex", + ["text"," "], + ["paren.rparen","}"] +],[ + "js-no_regex" +],[ + "js-start", + ["text"," "], + ["keyword","if"], + ["text"," "], + ["paren.lparen","("], + ["identifier","timevalue"], + ["text"," "], + ["keyword.operator",">"], + ["text"," "], + ["constant.numeric","30"], + ["text"," "], + ["keyword.operator","&&"], + ["text"," "], + ["identifier","timevalue"], + ["text"," "], + ["keyword.operator","<"], + ["text"," "], + ["constant.numeric","66"], + ["paren.rparen",")"], + ["text"," "], + ["paren.lparen","{"] +],[ + "js-start", + ["text"," "], + ["identifier","dickory"], + ["punctuation.operator","."], + ["support.function.dom","setAttribute"], + ["paren.lparen","("], + ["string","\"display\""], + ["punctuation.operator",","], + ["text"," "], + ["string","\"\""], + ["paren.rparen",")"], + ["punctuation.operator",";"] +],[ + "js-start", + ["text"," "], + ["identifier","dickory"], + ["punctuation.operator","."], + ["support.function.dom","setAttribute"], + ["paren.lparen","("], + ["string","\"transform\""], + ["punctuation.operator",","], + ["text"," "], + ["string","\"translate(\""], + ["text"," "], + ["keyword.operator","+"], + ["text"," "], + ["paren.lparen","("], + ["constant.numeric","-795"], + ["keyword.operator","+"], + ["identifier","scalefactor"], + ["keyword.operator","*"], + ["constant.numeric","2"], + ["paren.rparen",")"], + ["text"," "], + ["keyword.operator","+"], + ["text"," "], + ["string","\", 0 )\""], + ["paren.rparen",")"], + ["punctuation.operator",";"] +],[ + "js-no_regex", + ["text"," "], + ["paren.rparen","}"] +],[ + "js-start", + ["text"," "], + ["keyword","if"], + ["text"," "], + ["paren.lparen","("], + ["identifier","timevalue"], + ["text"," "], + ["keyword.operator",">"], + ["text"," "], + ["constant.numeric","66"], + ["paren.rparen",")"], + ["text"," "], + ["paren.lparen","{"] +],[ + "js-start", + ["text"," "], + ["identifier","dock"], + ["punctuation.operator","."], + ["support.function.dom","setAttribute"], + ["paren.lparen","("], + ["string","\"display\""], + ["punctuation.operator",","], + ["text"," "], + ["string","\"\""], + ["paren.rparen",")"], + ["punctuation.operator",";"] +],[ + "js-start", + ["text"," "], + ["identifier","dock"], + ["punctuation.operator","."], + ["support.function.dom","setAttribute"], + ["paren.lparen","("], + ["string","\"transform\""], + ["punctuation.operator",","], + ["text"," "], + ["string","\"translate(\""], + ["text"," "], + ["keyword.operator","+"], + ["text"," "], + ["paren.lparen","("], + ["constant.numeric","1450"], + ["keyword.operator","+"], + ["identifier","scalefactor"], + ["keyword.operator","*"], + ["constant.numeric","2"], + ["keyword.operator","*"], + ["constant.numeric","-1"], + ["paren.rparen",")"], + ["text"," "], + ["keyword.operator","+"], + ["text"," "], + ["string","\", 144 )\""], + ["paren.rparen",")"], + ["punctuation.operator",";"] +],[ + "js-no_regex", + ["text"," "], + ["paren.rparen","}"] +],[ + "js-no_regex" +],[ + "js-no_regex", + ["text"," "], + ["comment","// Call ShowAndGrowElement again milliseconds later."] +],[ + "js-no_regex", + ["text"," "], + ["identifier","setTimeout"], + ["paren.lparen","("], + ["string","\"ShowAndGrowElement()\""], + ["punctuation.operator",","], + ["text"," "], + ["identifier","timer_increment"], + ["paren.rparen",")"] +],[ + "js-no_regex", + ["text"," "], + ["paren.rparen","}"] +],[ + "js-no_regex", + ["text"," "], + ["variable.language","window"], + ["punctuation.operator","."], + ["identifier","ShowAndGrowElement"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["identifier","ShowAndGrowElement"] +],[ + "start", + ["text"," "], + ["string.end","]]>"], + ["meta.tag.punctuation.begin",""] +],[ + "start" +],[ + "meta.tag.punctuation.begin0", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","rect"] +],[ + "meta.tag.punctuation.begin0", + ["text"," "], + ["entity.other.attribute-name","fill"], + ["keyword.operator.separator","="], + ["string","\"#2e3436\""] +],[ + "meta.tag.punctuation.begin0", + ["text"," "], + ["entity.other.attribute-name","fill-rule"], + ["keyword.operator.separator","="], + ["string","\"nonzero\""] +],[ + "meta.tag.punctuation.begin0", + ["text"," "], + ["entity.other.attribute-name","stroke-width"], + ["keyword.operator.separator","="], + ["string","\"3\""] +],[ + "meta.tag.punctuation.begin0", + ["text"," "], + ["entity.other.attribute-name","y"], + ["keyword.operator.separator","="], + ["string","\"0\""] +],[ + "meta.tag.punctuation.begin0", + ["text"," "], + ["entity.other.attribute-name","x"], + ["keyword.operator.separator","="], + ["string","\"0\""] +],[ + "meta.tag.punctuation.begin0", + ["text"," "], + ["entity.other.attribute-name","height"], + ["keyword.operator.separator","="], + ["string","\"600\""] +],[ + "meta.tag.punctuation.begin0", + ["text"," "], + ["entity.other.attribute-name","width"], + ["keyword.operator.separator","="], + ["string","\"800\""] +],[ + "start", + ["text"," "], + ["entity.other.attribute-name","id"], + ["keyword.operator.separator","="], + ["string","\"rect3590\""], + ["meta.tag.punctuation.end","/>"] +],[ + "start" +],[ + "meta.tag.punctuation.begin0", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","text"] +],[ + "meta.tag.punctuation.begin0", + ["text"," "], + ["entity.other.attribute-name","style"], + ["keyword.operator.separator","="], + ["string","\"font-size:144px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold\""] +],[ + "meta.tag.punctuation.begin0", + ["text"," "], + ["entity.other.attribute-name","x"], + ["keyword.operator.separator","="], + ["string","\"50\""] +],[ + "meta.tag.punctuation.begin0", + ["text"," "], + ["entity.other.attribute-name","y"], + ["keyword.operator.separator","="], + ["string","\"350\""] +],[ + "meta.tag.punctuation.begin0", + ["text"," "], + ["entity.other.attribute-name","id"], + ["keyword.operator.separator","="], + ["string","\"hickory\""] +],[ + "start", + ["text"," "], + ["entity.other.attribute-name","display"], + ["keyword.operator.separator","="], + ["string","\"none\""], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text"," Hickory,"], + ["meta.tag.punctuation.begin",""] +],[ + "meta.tag.punctuation.begin0", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","text"] +],[ + "meta.tag.punctuation.begin0", + ["text"," "], + ["entity.other.attribute-name","style"], + ["keyword.operator.separator","="], + ["string","\"font-size:144px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold\""] +],[ + "meta.tag.punctuation.begin0", + ["text"," "], + ["entity.other.attribute-name","x"], + ["keyword.operator.separator","="], + ["string","\"50\""] +],[ + "meta.tag.punctuation.begin0", + ["text"," "], + ["entity.other.attribute-name","y"], + ["keyword.operator.separator","="], + ["string","\"350\""] +],[ + "meta.tag.punctuation.begin0", + ["text"," "], + ["entity.other.attribute-name","id"], + ["keyword.operator.separator","="], + ["string","\"dickory\""] +],[ + "start", + ["text"," "], + ["entity.other.attribute-name","display"], + ["keyword.operator.separator","="], + ["string","\"none\""], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text"," dickory,"], + ["meta.tag.punctuation.begin",""] +],[ + "meta.tag.punctuation.begin0", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","text"] +],[ + "meta.tag.punctuation.begin0", + ["text"," "], + ["entity.other.attribute-name","style"], + ["keyword.operator.separator","="], + ["string","\"font-size:144px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold\""] +],[ + "meta.tag.punctuation.begin0", + ["text"," "], + ["entity.other.attribute-name","x"], + ["keyword.operator.separator","="], + ["string","\"50\""] +],[ + "meta.tag.punctuation.begin0", + ["text"," "], + ["entity.other.attribute-name","y"], + ["keyword.operator.separator","="], + ["string","\"350\""] +],[ + "meta.tag.punctuation.begin0", + ["text"," "], + ["entity.other.attribute-name","id"], + ["keyword.operator.separator","="], + ["string","\"dock\""] +],[ + "start", + ["text"," "], + ["entity.other.attribute-name","display"], + ["keyword.operator.separator","="], + ["string","\"none\""], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text"," dock!"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["meta.tag.punctuation.begin",""] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_tcl.json b/addons/editor/ace/mode/_test/tokens_tcl.json new file mode 100755 index 00000000..6a032ddc --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_tcl.json @@ -0,0 +1,385 @@ +[[ + "commandItem" +],[ + "commandItem", + ["keyword","proc"], + ["text"," "], + ["identifier","dijkstra"], + ["text"," "], + ["paren.lparen","{"], + ["keyword","graph"], + ["text"," "], + ["identifier","origin"], + ["paren.rparen","}"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["comment","# Initialize"] +],[ + "commandItem", + ["text"," "], + ["keyword","dict"], + ["text"," "], + ["identifier","for"], + ["text"," "], + ["paren.lparen","{"], + ["keyword","vertex"], + ["text"," "], + ["identifier","distmap"], + ["paren.rparen","}"], + ["text"," "], + ["variable.instance","$graph"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text","\t"], + ["keyword","dict"], + ["text"," "], + ["identifier","set"], + ["text"," "], + ["identifier","dist"], + ["text"," "], + ["variable.instance","$vertex"], + ["text"," "], + ["identifier","Inf"] +],[ + "commandItem", + ["text","\t"], + ["keyword","dict"], + ["text"," "], + ["identifier","set"], + ["text"," "], + ["identifier","path"], + ["text"," "], + ["variable.instance","$vertex"], + ["text"," "], + ["paren.lparen","{"], + ["paren.rparen","}"] +],[ + "commandItem", + ["text"," "], + ["paren.rparen","}"] +],[ + "start", + ["text"," "], + ["keyword","dict"], + ["text"," "], + ["identifier","set"], + ["text"," "], + ["identifier","dist"], + ["text"," "], + ["variable.instance","$origin"], + ["text"," 0"] +],[ + "start", + ["text"," "], + ["keyword","dict"], + ["text"," "], + ["identifier","set"], + ["text"," "], + ["identifier","path"], + ["text"," "], + ["variable.instance","$origin"], + ["text"," "], + ["paren.lparen","["], + ["keyword","list"], + ["text"," "], + ["variable.instance","$origin"], + ["paren.rparen","]"] +],[ + "commandItem", + ["text"," "] +],[ + "commandItem", + ["text"," "], + ["keyword","while"], + ["text"," "], + ["paren.lparen","{"], + ["text","["], + ["keyword","dict"], + ["text"," "], + ["identifier","size"], + ["text"," "], + ["variable.instance","$graph"], + ["paren.rparen","]}"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text","\t"], + ["comment","# Find unhandled node with least weight"] +],[ + "start", + ["text","\t"], + ["keyword","set"], + ["text"," "], + ["identifier","d"], + ["text"," "], + ["identifier","Inf"] +],[ + "commandItem", + ["text","\t"], + ["keyword","dict"], + ["text"," "], + ["identifier","for"], + ["text"," "], + ["paren.lparen","{"], + ["keyword","uu"], + ["text"," "], + ["support.function","-"], + ["paren.rparen","}"], + ["text"," "], + ["variable.instance","$graph"], + ["text"," "], + ["paren.lparen","{"] +],[ + "commandItem", + ["text","\t "], + ["keyword","if"], + ["text"," "], + ["paren.lparen","{"], + ["variable.instance","$d"], + ["text"," "], + ["support.function",">"], + ["text"," "], + ["paren.lparen","["], + ["keyword","set"], + ["text"," "], + ["identifier","dd"], + ["text"," "], + ["paren.lparen","["], + ["keyword","dict"], + ["text"," "], + ["identifier","get"], + ["text"," "], + ["variable.instance","$dist"], + ["text"," "], + ["variable.instance","$uu"], + ["paren.rparen","]]}"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text","\t\t"], + ["keyword","set"], + ["text"," "], + ["identifier","u"], + ["text"," "], + ["variable.instance","$uu"] +],[ + "start", + ["text","\t\t"], + ["keyword","set"], + ["text"," "], + ["identifier","d"], + ["text"," "], + ["variable.instance","$dd"] +],[ + "commandItem", + ["text","\t "], + ["paren.rparen","}"] +],[ + "commandItem", + ["text","\t"], + ["paren.rparen","}"] +],[ + "commandItem", + ["text"," "] +],[ + "start", + ["text","\t"], + ["comment","# No such node; graph must be disconnected"] +],[ + "start", + ["text","\t"], + ["keyword","if"], + ["text"," "], + ["paren.lparen","{"], + ["variable.instance","$d"], + ["text"," "], + ["support.function","=="], + ["text"," "], + ["identifier","Inf"], + ["paren.rparen","}"], + ["text"," "], + ["identifier","break"] +],[ + "commandItem", + ["text"," "] +],[ + "commentfollow", + ["text","\t"], + ["comment","# Update the weights for nodes\\"] +],[ + "start", + ["comment","\t lead to by the node we've picked"] +],[ + "commandItem", + ["text","\t"], + ["keyword","dict"], + ["text"," "], + ["identifier","for"], + ["text"," "], + ["paren.lparen","{"], + ["keyword","v"], + ["text"," "], + ["identifier","dd"], + ["paren.rparen","}"], + ["text"," "], + ["paren.lparen","["], + ["keyword","dict"], + ["text"," "], + ["identifier","get"], + ["text"," "], + ["variable.instance","$graph"], + ["text"," "], + ["variable.instance","$u"], + ["paren.rparen","]"], + ["text"," "], + ["paren.lparen","{"] +],[ + "commandItem", + ["text","\t "], + ["keyword","if"], + ["text"," "], + ["paren.lparen","{"], + ["text","["], + ["keyword","dict"], + ["text"," "], + ["identifier","exists"], + ["text"," "], + ["variable.instance","$graph"], + ["text"," "], + ["variable.instance","$v"], + ["paren.rparen","]}"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text","\t\t"], + ["keyword","set"], + ["text"," "], + ["identifier","alt"], + ["text"," "], + ["paren.lparen","["], + ["keyword","expr"], + ["text"," "], + ["paren.lparen","{"], + ["variable.instance","$d"], + ["text"," "], + ["support.function","+"], + ["text"," "], + ["variable.instance","$dd"], + ["paren.rparen","}]"] +],[ + "commandItem", + ["text","\t\t"], + ["keyword","if"], + ["text"," "], + ["paren.lparen","{"], + ["variable.instance","$alt"], + ["text"," "], + ["support.function","<"], + ["text"," "], + ["paren.lparen","["], + ["keyword","dict"], + ["text"," "], + ["identifier","get"], + ["text"," "], + ["variable.instance","$dist"], + ["text"," "], + ["variable.instance","$v"], + ["paren.rparen","]}"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text","\t\t "], + ["keyword","dict"], + ["text"," "], + ["identifier","set"], + ["text"," "], + ["identifier","dist"], + ["text"," "], + ["variable.instance","$v"], + ["text"," "], + ["variable.instance","$alt"] +],[ + "start", + ["text","\t\t "], + ["keyword","dict"], + ["text"," "], + ["identifier","set"], + ["text"," "], + ["identifier","path"], + ["text"," "], + ["variable.instance","$v"], + ["text"," "], + ["paren.lparen","["], + ["keyword","list"], + ["text"," "], + ["support.function","{*}"], + ["paren.lparen","["], + ["keyword","dict"], + ["text"," "], + ["identifier","get"], + ["text"," "], + ["variable.instance","$path"], + ["text"," "], + ["variable.instance","$u"], + ["paren.rparen","]"], + ["text"," "], + ["variable.instance","$v"], + ["paren.rparen","]"] +],[ + "commandItem", + ["text","\t\t"], + ["paren.rparen","}"] +],[ + "commandItem", + ["text","\t "], + ["paren.rparen","}"] +],[ + "commandItem", + ["text","\t"], + ["paren.rparen","}"] +],[ + "commandItem", + ["text"," "] +],[ + "start", + ["text","\t"], + ["comment","# Remove chosen node from graph still to be handled"] +],[ + "start", + ["text","\t"], + ["keyword","dict"], + ["text"," "], + ["identifier","unset"], + ["text"," "], + ["identifier","graph"], + ["text"," "], + ["variable.instance","$u"] +],[ + "commandItem", + ["text"," "], + ["paren.rparen","}"] +],[ + "start", + ["text"," "], + ["keyword","return"], + ["text"," "], + ["paren.lparen","["], + ["keyword","list"], + ["text"," "], + ["variable.instance","$dist"], + ["text"," "], + ["variable.instance","$path"], + ["paren.rparen","]"] +],[ + "commandItem", + ["paren.rparen","}"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_tex.json b/addons/editor/ace/mode/_test/tokens_tex.json new file mode 100755 index 00000000..2d023676 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_tex.json @@ -0,0 +1,130 @@ +[[ + "start", + ["text","The quadratic formula is $$-b "], + ["keyword","\\pm"], + ["text"," "], + ["keyword","\\sqrt"], + ["paren.keyword.operator","{"], + ["text","b^2 - 4ac"], + ["paren.keyword.operator","}"], + ["text"," "], + ["keyword","\\over"], + ["text"," 2a$$"] +],[ + "start", + ["keyword","\\bye"] +],[ + "start" +],[ + "start", + ["keyword","\\makeatletter"] +],[ + "start", + ["text"," "], + ["keyword","\\newcommand"], + ["paren.keyword.operator","{"], + ["keyword","\\be"], + ["paren.keyword.operator","}{"], + ["comment","%"] +],[ + "start", + ["text"," "], + ["keyword","\\begingroup"] +],[ + "start", + ["text"," "], + ["comment","% \\setlength{\\arraycolsep}{2pt}"] +],[ + "start", + ["text"," "], + ["keyword","\\eqnarray"], + ["comment","%"] +],[ + "start", + ["text"," "], + ["keyword","\\@"], + ["text","ifstar"], + ["paren.keyword.operator","{"], + ["keyword","\\nonumber"], + ["paren.keyword.operator","}{}"], + ["comment","%"] +],[ + "start", + ["text"," "], + ["paren.keyword.operator","}"] +],[ + "start", + ["text"," "], + ["keyword","\\newcommand"], + ["paren.keyword.operator","{"], + ["keyword","\\ee"], + ["paren.keyword.operator","}{"], + ["keyword","\\endeqnarray\\endgroup"], + ["paren.keyword.operator","}"] +],[ + "start", + ["text"," "], + ["keyword","\\makeatother"] +],[ + "start" +],[ + "start", + ["text"," "], + ["keyword","\\begin"], + ["paren.keyword.operator","{"], + ["nospell.text","equation"], + ["paren.keyword.operator","}"] +],[ + "start", + ["text"," x="], + ["keyword","\\left\\"], + ["paren.keyword.operator","{"], + ["text"," "], + ["keyword","\\begin"], + ["paren.keyword.operator","{"], + ["nospell.text","array"], + ["paren.keyword.operator","}{"], + ["text","cl"], + ["paren.keyword.operator","}"] +],[ + "start", + ["text"," 0 & "], + ["keyword","\\textrm"], + ["paren.keyword.operator","{"], + ["text","if "], + ["paren.keyword.operator","}"], + ["text","A="], + ["keyword","\\ldots\\\\"] +],[ + "start", + ["text"," 1 & "], + ["keyword","\\textrm"], + ["paren.keyword.operator","{"], + ["text","if "], + ["paren.keyword.operator","}"], + ["text","B="], + ["keyword","\\ldots\\\\"] +],[ + "start", + ["text"," x & "], + ["keyword","\\textrm"], + ["paren.keyword.operator","{"], + ["text","this runs with as much text as you like, but without an raggeright text"] +],[ + "start", + ["text","."], + ["paren.keyword.operator","}"], + ["keyword","\\end"], + ["paren.keyword.operator","{"], + ["nospell.text","array"], + ["paren.keyword.operator","}"], + ["keyword","\\right"], + ["text","."] +],[ + "start", + ["text"," "], + ["keyword","\\end"], + ["paren.keyword.operator","{"], + ["nospell.text","equation"], + ["paren.keyword.operator","}"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_text.json b/addons/editor/ace/mode/_test/tokens_text.json new file mode 100755 index 00000000..fff7ef42 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_text.json @@ -0,0 +1,29 @@ +[[ + "start", + ["text","Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."] +],[ + "start" +],[ + "start", + ["text","Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat."] +],[ + "start" +],[ + "start", + ["text","Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi."] +],[ + "start" +],[ + "start", + ["text","Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat."] +],[ + "start" +],[ + "start", + ["text","Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis."] +],[ + "start" +],[ + "start", + ["text","At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, At accusam aliquyam diam diam dolore dolores duo eirmod eos erat, et nonumy sed tempor et et invidunt justo labore Stet clita ea et gubergren, kasd magna no rebum. sanctus sea sed takimata ut vero voluptua. est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_textile.json b/addons/editor/ace/mode/_test/tokens_textile.json new file mode 100755 index 00000000..59000ce3 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_textile.json @@ -0,0 +1,113 @@ +[[ + "start", + ["markup.heading.1","h1"], + ["keyword",". "], + ["text","Textile document"] +],[ + "start" +],[ + "start", + ["markup.heading.2","h2"], + ["keyword",". "], + ["text","Heading Two"] +],[ + "start" +],[ + "start", + ["markup.heading.3","h3"], + ["keyword",". "], + ["text","A two-line"] +],[ + "start", + ["text"," header"] +],[ + "start" +],[ + "start", + ["markup.heading.2","h2"], + ["keyword",". "], + ["text","Another two-line"] +],[ + "start", + ["text","header"] +],[ + "start" +],[ + "start", + ["text","Paragraph:"] +],[ + "start", + ["text","one, two,"] +],[ + "start", + ["text","thee lines!"] +],[ + "start" +],[ + "start", + ["markup.heading","p"], + ["keyword","("], + ["string","classone"], + ["text"," "], + ["string","two"], + ["text"," "], + ["string","three"], + ["keyword","). "], + ["text","This is a paragraph with classes"] +],[ + "start" +],[ + "start", + ["markup.heading","p"], + ["keyword","(#"], + ["string","id"], + ["keyword","). "], + ["text","(one with an id)"] +],[ + "start" +],[ + "start", + ["markup.heading","p"], + ["keyword","("], + ["string","one"], + ["text"," "], + ["string","two"], + ["text"," "], + ["string","three"], + ["keyword","#"], + ["string","my_id"], + ["keyword","). "], + ["text","..classes + id"] +],[ + "start" +],[ + "start", + ["keyword","*"], + ["text"," Unordered list"] +],[ + "start", + ["keyword","**"], + ["text"," sublist"] +],[ + "start", + ["keyword","*"], + ["text"," back again!"] +],[ + "start", + ["keyword","**"], + ["text"," sublist again.."] +],[ + "start" +],[ + "start", + ["keyword","#"], + ["text"," ordered"] +],[ + "start" +],[ + "start", + ["text","bg. Blockquote!"] +],[ + "start", + ["text"," This is a two-list blockquote..!"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_toml.json b/addons/editor/ace/mode/_test/tokens_toml.json new file mode 100755 index 00000000..ec471f74 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_toml.json @@ -0,0 +1,131 @@ +[[ + "start", + ["comment.toml","# This is a TOML document. Boom."] +],[ + "start" +],[ + "start", + ["identifier","title"], + ["text"," = "], + ["string","\"TOML Example\""] +],[ + "start" +],[ + "start", + ["variable.keygroup.toml","[owner]"] +],[ + "start", + ["identifier","name"], + ["text"," = "], + ["string","\"Tom Preston-Werner\""] +],[ + "start", + ["identifier","organization"], + ["text"," = "], + ["string","\"GitHub\""] +],[ + "start", + ["identifier","bio"], + ["text"," = "], + ["string","\"GitHub Cofounder & CEO"], + ["constant.language.escape","\\n"], + ["string","Likes tater tots and beer.\""] +],[ + "start", + ["identifier","dob"], + ["text"," = "], + ["support.date.toml","1979-05-27T07:32:00Z"], + ["text"," "], + ["comment.toml","# First class dates? Why not?"] +],[ + "start" +],[ + "start", + ["variable.keygroup.toml","[database]"] +],[ + "start", + ["identifier","server"], + ["text"," = "], + ["string","\"192.168.1.1\""] +],[ + "start", + ["identifier","ports"], + ["text"," = [ "], + ["constant.numeric.toml","8001"], + ["text",", "], + ["constant.numeric.toml","8001"], + ["text",", "], + ["constant.numeric.toml","8002"], + ["text"," ]"] +],[ + "start", + ["identifier","connection_max"], + ["text"," = "], + ["constant.numeric.toml","5000"] +],[ + "start", + ["identifier","enabled"], + ["text"," = "], + ["constant.language.boolean","true"] +],[ + "start" +],[ + "start", + ["variable.keygroup.toml","[servers]"] +],[ + "start" +],[ + "start", + ["text"," "], + ["comment.toml","# You can indent as you please. Tabs or spaces. TOML don't care."] +],[ + "start", + ["variable.keygroup.toml"," [servers.alpha]"] +],[ + "start", + ["text"," "], + ["identifier","ip"], + ["text"," = "], + ["string","\"10.0.0.1\""] +],[ + "start", + ["text"," "], + ["identifier","dc"], + ["text"," = "], + ["string","\"eqdc10\""] +],[ + "start" +],[ + "start", + ["variable.keygroup.toml"," [servers.beta]"] +],[ + "start", + ["text"," "], + ["identifier","ip"], + ["text"," = "], + ["string","\"10.0.0.2\""] +],[ + "start", + ["text"," "], + ["identifier","dc"], + ["text"," = "], + ["string","\"eqdc10\""] +],[ + "start" +],[ + "start", + ["variable.keygroup.toml","[clients]"] +],[ + "start", + ["identifier","data"], + ["text"," = [ ["], + ["string","\"gamma\""], + ["text",", "], + ["string","\"delta\""], + ["text","], ["], + ["constant.numeric.toml","1"], + ["text",", "], + ["constant.numeric.toml","2"], + ["text","] ] "], + ["comment.toml","# just an update to make sure parsers support it"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_twig.json b/addons/editor/ace/mode/_test/tokens_twig.json new file mode 100755 index 00000000..c4101ded --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_twig.json @@ -0,0 +1,288 @@ +[[ + "start", + ["punctuation.doctype.begin",""] +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","html"], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","head"], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","title"], + ["meta.tag.punctuation.end",">"], + ["text","My Webpage"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","body"], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","ul"], + ["text"," "], + ["entity.other.attribute-name","id"], + ["keyword.operator.separator","="], + ["string","\"navigation\""], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text"," "], + ["meta.tag.twig","{%"], + ["text"," "], + ["keyword.control.twig","for"], + ["text"," "], + ["identifier","item"], + ["text"," "], + ["keyword.operator.twig","in"], + ["text"," "], + ["identifier","navigation"], + ["text"," "], + ["meta.tag.twig","%}"] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","li"], + ["meta.tag.punctuation.end",">"], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.anchor","a"], + ["text"," "], + ["entity.other.attribute-name","href"], + ["keyword.operator.separator","="], + ["string","\""], + ["variable.other.readwrite.local.twig","{{"], + ["text"," "], + ["identifier","item"], + ["punctuation.operator","."], + ["identifier","href"], + ["keyword.operator.other","|"], + ["support.function.twig","escape"], + ["text"," "], + ["variable.other.readwrite.local.twig","}}"], + ["string","\""], + ["meta.tag.punctuation.end",">"], + ["variable.other.readwrite.local.twig","{{"], + ["text"," "], + ["identifier","item"], + ["punctuation.operator","."], + ["identifier","caption"], + ["text"," "], + ["variable.other.readwrite.local.twig","}}"], + ["meta.tag.punctuation.begin",""], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text"," "], + ["meta.tag.twig","{%"], + ["text"," "], + ["keyword.control.twig","endfor"], + ["text"," "], + ["meta.tag.twig","%}"] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin",""] +],[ + "start" +],[ + "start", + ["text"," "], + ["meta.tag.twig","{%"], + ["text"," "], + ["keyword.control.twig","if"], + ["text"," "], + ["constant.numeric","1"], + ["text"," "], + ["keyword.operator.twig","not"], + ["text"," "], + ["keyword.operator.twig","in"], + ["text"," "], + ["paren.lparen","["], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["text"," "], + ["constant.numeric","2"], + ["punctuation.operator",","], + ["text"," "], + ["constant.numeric","3"], + ["paren.rparen","]"], + ["text"," "], + ["meta.tag.twig","%}"] +],[ + "start" +],[ + "start", + ["text"," "], + ["comment.block.twig","{# is equivalent to #}"] +],[ + "start", + ["text"," "], + ["meta.tag.twig","{%"], + ["text"," "], + ["keyword.control.twig","if"], + ["text"," "], + ["keyword.operator.twig","not"], + ["text"," "], + ["paren.lparen","("], + ["constant.numeric","1"], + ["text"," "], + ["keyword.operator.twig","in"], + ["text"," "], + ["paren.lparen","["], + ["constant.numeric","1"], + ["punctuation.operator",","], + ["text"," "], + ["constant.numeric","2"], + ["punctuation.operator",","], + ["text"," "], + ["constant.numeric","3"], + ["paren.rparen","])"], + ["text"," "], + ["meta.tag.twig","%}"] +],[ + "start" +],[ + "start", + ["text"," "], + ["meta.tag.twig","{%"], + ["text"," "], + ["keyword.control.twig","autoescape"], + ["text"," "], + ["constant.language.boolean","true"], + ["text"," "], + ["meta.tag.twig","%}"] +],[ + "start", + ["text"," "], + ["variable.other.readwrite.local.twig","{{"], + ["text"," "], + ["identifier","var"], + ["text"," "], + ["variable.other.readwrite.local.twig","}}"] +],[ + "start", + ["text"," "], + ["variable.other.readwrite.local.twig","{{"], + ["text"," "], + ["identifier","var"], + ["keyword.operator.other","|"], + ["support.function.twig","raw"], + ["text"," "], + ["variable.other.readwrite.local.twig","}}"], + ["text"," "], + ["comment.block.twig","{# var won't be escaped #}"] +],[ + "start", + ["text"," "], + ["variable.other.readwrite.local.twig","{{"], + ["text"," "], + ["identifier","var"], + ["keyword.operator.other","|"], + ["support.function.twig","escape"], + ["text"," "], + ["variable.other.readwrite.local.twig","}}"], + ["text"," "], + ["comment.block.twig","{# var won't be doubled-escaped #}"] +],[ + "start", + ["text"," "], + ["meta.tag.twig","{%"], + ["text"," "], + ["keyword.control.twig","endautoescape"], + ["text"," "], + ["meta.tag.twig","%}"] +],[ + "start" +],[ + "start", + ["text"," "], + ["variable.other.readwrite.local.twig","{{"], + ["text"," "], + ["keyword.control.twig","include"], + ["paren.lparen","("], + ["string","'twig.html'"], + ["punctuation.operator",","], + ["text"," "], + ["identifier","sandboxed"], + ["text"," "], + ["keyword.operator.assignment","="], + ["text"," "], + ["constant.language.boolean","true"], + ["paren.rparen",")"], + ["text"," "], + ["variable.other.readwrite.local.twig","}}"] +],[ + "start" +],[ + "start", + ["text"," "], + ["variable.other.readwrite.local.twig","{{"], + ["string","\"string "], + ["constant.language.escape","#{with}"], + ["string"," "], + ["constant.language.escape","\\\""], + ["string"," escapes\""], + ["text"," "], + ["string","'another#one'"], + ["text"," "], + ["variable.other.readwrite.local.twig","}}"] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","h1"], + ["meta.tag.punctuation.end",">"], + ["text","My Webpage"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text"," "], + ["variable.other.readwrite.local.twig","{{"], + ["text"," "], + ["identifier","a_variable"], + ["text"," "], + ["variable.other.readwrite.local.twig","}}"] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["meta.tag.punctuation.begin",""] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_typescript.json b/addons/editor/ace/mode/_test/tokens_typescript.json new file mode 100755 index 00000000..18f2eea6 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_typescript.json @@ -0,0 +1,559 @@ +[[ + "start", + ["keyword.operator.ts","class"], + ["text"," "], + ["identifier","Greeter"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text","\t"], + ["variable.parameter.function.ts","greeting"], + ["text",": "], + ["variable.parameter.function.ts","string"], + ["punctuation.operator",";"] +],[ + "start", + ["text","\t"], + ["keyword.operator.ts","constructor"], + ["text"," "], + ["paren.lparen","("], + ["variable.parameter.function.ts","message"], + ["text",": "], + ["variable.parameter.function.ts","string"], + ["paren.rparen",")"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text","\t\t"], + ["storage.type.variable.ts","this."], + ["identifier","greeting"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["identifier","message"], + ["punctuation.operator",";"] +],[ + "no_regex", + ["text","\t"], + ["paren.rparen","}"] +],[ + "start", + ["text","\t"], + ["identifier","greet"], + ["paren.lparen","("], + ["paren.rparen",")"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text","\t\t"], + ["keyword","return"], + ["text"," "], + ["string","\"Hello, \""], + ["text"," "], + ["keyword.operator","+"], + ["text"," "], + ["storage.type.variable.ts","this."], + ["identifier","greeting"], + ["punctuation.operator",";"] +],[ + "no_regex", + ["text","\t"], + ["paren.rparen","}"] +],[ + "no_regex", + ["paren.rparen","}"], + ["text"," "] +],[ + "no_regex" +],[ + "start", + ["storage.type","var"], + ["text"," "], + ["identifier","greeter"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["keyword","new"], + ["text"," "], + ["identifier","Greeter"], + ["paren.lparen","("], + ["string","\"world\""], + ["paren.rparen",")"], + ["punctuation.operator",";"] +],[ + "start" +],[ + "no_regex", + ["storage.type","var"], + ["text"," "], + ["identifier","button"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["variable.language","document"], + ["punctuation.operator","."], + ["support.function.dom","createElement"], + ["paren.lparen","("], + ["string","'button'"], + ["paren.rparen",")"] +],[ + "no_regex", + ["identifier","button"], + ["punctuation.operator","."], + ["identifier","innerText"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["string","\"Say Hello\""] +],[ + "start", + ["storage.type","button"], + ["punctuation.operator","."], + ["entity.name.function","onclick"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["storage.type","function"], + ["paren.lparen","("], + ["paren.rparen",")"], + ["text"," "], + ["paren.lparen","{"] +],[ + "no_regex", + ["text","\t"], + ["support.function","alert"], + ["paren.lparen","("], + ["entity.name.function.ts","greeter.greet"], + ["paren.lparen","("], + ["paren.rparen",")"], + ["paren.rparen",")"] +],[ + "no_regex", + ["paren.rparen","}"] +],[ + "no_regex" +],[ + "no_regex", + ["variable.language","document"], + ["punctuation.operator","."], + ["identifier","body"], + ["punctuation.operator","."], + ["support.function.dom","appendChild"], + ["paren.lparen","("], + ["identifier","button"], + ["paren.rparen",")"] +],[ + "no_regex" +],[ + "start", + ["keyword","class"], + ["text"," "], + ["identifier","Snake"], + ["text"," "], + ["keyword","extends"], + ["text"," "], + ["identifier","Animal"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["entity.name.function.ts","move"], + ["paren.lparen","("], + ["paren.rparen",")"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["support.function","alert"], + ["paren.lparen","("], + ["string","\"Slithering...\""], + ["paren.rparen",")"], + ["punctuation.operator",";"] +],[ + "start", + ["text"," "], + ["storage.type.variable.ts","super"], + ["text","("], + ["keyword.other.ts","5"], + ["text",")"], + ["punctuation.operator",";"] +],[ + "no_regex", + ["text"," "], + ["paren.rparen","}"] +],[ + "no_regex", + ["paren.rparen","}"] +],[ + "no_regex" +],[ + "start", + ["keyword","class"], + ["text"," "], + ["identifier","Horse"], + ["text"," "], + ["keyword","extends"], + ["text"," "], + ["identifier","Animal"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["entity.name.function.ts","move"], + ["paren.lparen","("], + ["paren.rparen",")"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["support.function","alert"], + ["paren.lparen","("], + ["string","\"Galloping...\""], + ["paren.rparen",")"], + ["punctuation.operator",";"] +],[ + "start", + ["text"," "], + ["keyword.operator.ts","super"], + ["punctuation.operator","."], + ["identifier","move"], + ["paren.lparen","("], + ["constant.numeric","45"], + ["paren.rparen",")"], + ["punctuation.operator",";"] +],[ + "no_regex", + ["text"," "], + ["paren.rparen","}"] +],[ + "no_regex", + ["paren.rparen","}"] +],[ + "no_regex" +],[ + "start", + ["identifier","module"], + ["text"," "], + ["identifier","Sayings"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["keyword.operator.ts","export"], + ["text"," "], + ["keyword.operator.ts","class"], + ["text"," "], + ["identifier","Greeter"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["variable.parameter.function.ts","greeting"], + ["text",": "], + ["variable.parameter.function.ts","string"], + ["punctuation.operator",";"] +],[ + "start", + ["text"," "], + ["keyword.operator.ts","constructor"], + ["text"," "], + ["paren.lparen","("], + ["variable.parameter.function.ts","message"], + ["text",": "], + ["variable.parameter.function.ts","string"], + ["paren.rparen",")"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["storage.type.variable.ts","this."], + ["identifier","greeting"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["identifier","message"], + ["punctuation.operator",";"] +],[ + "no_regex", + ["text"," "], + ["paren.rparen","}"] +],[ + "start", + ["text"," "], + ["identifier","greet"], + ["paren.lparen","("], + ["paren.rparen",")"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["keyword","return"], + ["text"," "], + ["string","\"Hello, \""], + ["text"," "], + ["keyword.operator","+"], + ["text"," "], + ["storage.type.variable.ts","this."], + ["identifier","greeting"], + ["punctuation.operator",";"] +],[ + "no_regex", + ["text"," "], + ["paren.rparen","}"] +],[ + "no_regex", + ["text"," "], + ["paren.rparen","}"] +],[ + "no_regex", + ["paren.rparen","}"] +],[ + "start", + ["identifier","module"], + ["text"," "], + ["identifier","Mankala"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["keyword.operator.ts","export"], + ["text"," "], + ["keyword.operator.ts","class"], + ["text"," "], + ["identifier","Features"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["keyword.operator.ts","public"], + ["text"," "], + ["identifier","turnContinues"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["constant.language.boolean","false"], + ["punctuation.operator",";"] +],[ + "start", + ["text"," "], + ["keyword.operator.ts","public"], + ["text"," "], + ["identifier","seedStoredCount"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["constant.numeric","0"], + ["punctuation.operator",";"] +],[ + "start", + ["text"," "], + ["keyword.operator.ts","public"], + ["text"," "], + ["identifier","capturedCount"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["constant.numeric","0"], + ["punctuation.operator",";"] +],[ + "start", + ["text"," "], + ["keyword.operator.ts","public"], + ["text"," "], + ["identifier","spaceCaptured"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["identifier","NoSpace"], + ["punctuation.operator",";"] +],[ + "start" +],[ + "start", + ["text"," "], + ["keyword.operator.ts","public"], + ["text"," "], + ["entity.name.function.ts","clear"], + ["paren.lparen","("], + ["paren.rparen",")"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["storage.type.variable.ts","this."], + ["identifier","turnContinues"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["constant.language.boolean","false"], + ["punctuation.operator",";"] +],[ + "start", + ["text"," "], + ["storage.type.variable.ts","this."], + ["identifier","seedStoredCount"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["constant.numeric","0"], + ["punctuation.operator",";"] +],[ + "start", + ["text"," "], + ["storage.type.variable.ts","this."], + ["identifier","capturedCount"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["constant.numeric","0"], + ["punctuation.operator",";"] +],[ + "start", + ["text"," "], + ["storage.type.variable.ts","this."], + ["identifier","spaceCaptured"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["identifier","NoSpace"], + ["punctuation.operator",";"] +],[ + "no_regex", + ["text"," "], + ["paren.rparen","}"] +],[ + "no_regex" +],[ + "start", + ["text"," "], + ["keyword","public"], + ["text"," "], + ["identifier","toString"], + ["paren.lparen","("], + ["paren.rparen",")"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["storage.type","var"], + ["text"," "], + ["identifier","stringBuilder"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["string","\"\""], + ["punctuation.operator",";"] +],[ + "start", + ["text"," "], + ["keyword","if"], + ["text"," "], + ["paren.lparen","("], + ["storage.type.variable.ts","this."], + ["identifier","turnContinues"], + ["paren.rparen",")"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["identifier","stringBuilder"], + ["text"," "], + ["keyword.operator","+="], + ["text"," "], + ["string","\" turn continues,\""], + ["punctuation.operator",";"] +],[ + "no_regex", + ["text"," "], + ["paren.rparen","}"] +],[ + "start", + ["text"," "], + ["identifier","stringBuilder"], + ["text"," "], + ["keyword.operator","+="], + ["text"," "], + ["string","\" stores \""], + ["text"," "], + ["keyword.operator","+"], + ["text"," "], + ["storage.type.variable.ts","this."], + ["identifier","seedStoredCount"], + ["punctuation.operator",";"] +],[ + "start", + ["text"," "], + ["keyword","if"], + ["text"," "], + ["paren.lparen","("], + ["storage.type.variable.ts","this."], + ["identifier","capturedCount"], + ["text"," "], + ["keyword.operator",">"], + ["text"," "], + ["constant.numeric","0"], + ["paren.rparen",")"], + ["text"," "], + ["paren.lparen","{"] +],[ + "start", + ["text"," "], + ["identifier","stringBuilder"], + ["text"," "], + ["keyword.operator","+="], + ["text"," "], + ["string","\" captures \""], + ["text"," "], + ["keyword.operator","+"], + ["text"," "], + ["storage.type.variable.ts","this."], + ["identifier","capturedCount"], + ["text"," "], + ["keyword.operator","+"], + ["text"," "], + ["string","\" from space \""], + ["text"," "], + ["keyword.operator","+"], + ["text"," "], + ["storage.type.variable.ts","this."], + ["identifier","spaceCaptured"], + ["punctuation.operator",";"] +],[ + "no_regex", + ["text"," "], + ["paren.rparen","}"] +],[ + "start", + ["text"," "], + ["keyword","return"], + ["text"," "], + ["identifier","stringBuilder"], + ["punctuation.operator",";"] +],[ + "no_regex", + ["text"," "], + ["paren.rparen","}"] +],[ + "no_regex", + ["text"," "], + ["paren.rparen","}"] +],[ + "no_regex", + ["paren.rparen","}"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_vbscript.json b/addons/editor/ace/mode/_test/tokens_vbscript.json new file mode 100755 index 00000000..6a2346d3 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_vbscript.json @@ -0,0 +1,249 @@ +[[ + "start", + ["text","myfilename "], + ["keyword.operator.asp","="], + ["text"," "], + ["punctuation.definition.string.begin.asp","\""], + ["string.quoted.double.asp","C:\\Wikipedia - VBScript - Example - Hello World.txt\""] +],[ + "start" +],[ + "start", + ["text","MakeHelloWorldFile myfilename"] +],[ + "start" +],[ + "state_4", + ["meta.leading-space"," "] +],[ + "state_4" +],[ + "start", + ["storage.type.function.asp","Sub"], + ["text"," "], + ["entity.name.function.asp","MakeHelloWorldFile"], + ["text"," "], + ["punctuation.definition.parameters.asp","("], + ["variable.parameter.function.asp","FileName"], + ["punctuation.definition.parameters.asp",")"] +],[ + "start" +],[ + "start", + ["punctuation.definition.comment.asp","'"], + ["comment.line.apostrophe.asp","Create a new file in C: drive or overwrite existing file"] +],[ + "start" +],[ + "start", + ["meta.odd-tab.spaces"," "], + ["meta.leading-space"," "], + ["storage.type.asp","Set"], + ["text"," FSO "], + ["keyword.operator.asp","="], + ["text"," "], + ["support.function.asp","CreateObject"], + ["text","("], + ["punctuation.definition.string.begin.asp","\""], + ["string.quoted.double.asp","Scripting.FileSystemObject\""], + ["text",")"] +],[ + "start" +],[ + "start", + ["meta.odd-tab.spaces"," "], + ["meta.leading-space"," "], + ["keyword.control.asp","If"], + ["text"," FSO."], + ["entity.name.function.asp","FileExists"], + ["text","(FileName) "], + ["keyword.control.asp","Then"], + ["text"," "] +],[ + "start" +],[ + "start", + ["meta.odd-tab.spaces"," "], + ["meta.even-tab.spaces"," "], + ["meta.odd-tab.spaces"," "], + ["text","Answer "], + ["keyword.operator.asp","="], + ["text"," "], + ["support.function.vb.asp","MsgBox"], + ["text"," ("], + ["punctuation.definition.string.begin.asp","\""], + ["string.quoted.double.asp","File \""], + ["text"," "], + ["keyword.operator.asp","&"], + ["text"," FileName "], + ["keyword.operator.asp","&"], + ["text"," "], + ["punctuation.definition.string.begin.asp","\""], + ["string.quoted.double.asp"," exists ... OK to overwrite?\""], + ["text",", vbOKCancel)"] +],[ + "start" +],[ + "start", + ["meta.odd-tab.spaces"," "], + ["meta.even-tab.spaces"," "], + ["meta.odd-tab.spaces"," "], + ["punctuation.definition.comment.asp","'"], + ["comment.line.apostrophe.asp","If button selected is not OK, then quit now"] +],[ + "start" +],[ + "start", + ["meta.odd-tab.spaces"," "], + ["meta.even-tab.spaces"," "], + ["meta.odd-tab.spaces"," "], + ["punctuation.definition.comment.asp","'"], + ["comment.line.apostrophe.asp","vbOK is a language constant"] +],[ + "start" +],[ + "start", + ["meta.odd-tab.spaces"," "], + ["meta.even-tab.spaces"," "], + ["meta.odd-tab.spaces"," "], + ["keyword.control.asp","If"], + ["text"," Answer "], + ["keyword.operator.asp","<>"], + ["text"," vbOK "], + ["keyword.control.asp","Then"], + ["text"," "], + ["keyword.control.asp","Exit Sub"] +],[ + "start" +],[ + "start", + ["meta.odd-tab.spaces"," "], + ["meta.leading-space"," "], + ["keyword.control.asp","Else"] +],[ + "start" +],[ + "start", + ["meta.odd-tab.spaces"," "], + ["meta.even-tab.spaces"," "], + ["meta.odd-tab.spaces"," "], + ["punctuation.definition.comment.asp","'"], + ["comment.line.apostrophe.asp","Confirm OK to create"] +],[ + "start" +],[ + "start", + ["meta.odd-tab.spaces"," "], + ["meta.even-tab.spaces"," "], + ["meta.odd-tab.spaces"," "], + ["text","Answer "], + ["keyword.operator.asp","="], + ["text"," "], + ["support.function.vb.asp","MsgBox"], + ["text"," ("], + ["punctuation.definition.string.begin.asp","\""], + ["string.quoted.double.asp","File \""], + ["text"," "], + ["keyword.operator.asp","&"], + ["text"," FileName "], + ["keyword.operator.asp","&"], + ["text"," "], + ["punctuation.definition.string.begin.asp","\""], + ["string.quoted.double.asp"," ... OK to create?\""], + ["text",", vbOKCancel)"] +],[ + "start" +],[ + "start", + ["meta.odd-tab.spaces"," "], + ["meta.even-tab.spaces"," "], + ["meta.odd-tab.spaces"," "], + ["keyword.control.asp","If"], + ["text"," Answer "], + ["keyword.operator.asp","<>"], + ["text"," vbOK "], + ["keyword.control.asp","Then"], + ["text"," "], + ["keyword.control.asp","Exit Sub"] +],[ + "start" +],[ + "start", + ["meta.odd-tab.spaces"," "], + ["meta.leading-space"," "], + ["keyword.control.asp","End If"] +],[ + "start" +],[ + "start", + ["meta.odd-tab.spaces"," "], + ["meta.leading-space"," "], + ["punctuation.definition.comment.asp","'"], + ["comment.line.apostrophe.asp","Create new file (or replace an existing file)"] +],[ + "start" +],[ + "start", + ["meta.odd-tab.spaces"," "], + ["meta.leading-space"," "], + ["storage.type.asp","Set"], + ["text"," FileObject "], + ["keyword.operator.asp","="], + ["text"," FSO.CreateTextFile (FileName)"] +],[ + "start" +],[ + "start", + ["meta.odd-tab.spaces"," "], + ["meta.leading-space"," "], + ["text","FileObject.WriteLine "], + ["punctuation.definition.string.begin.asp","\""], + ["string.quoted.double.asp","Time ... \""], + ["text"," "], + ["keyword.operator.asp","&"], + ["text"," "], + ["support.function.vb.asp","Now"], + ["text","()"] +],[ + "start" +],[ + "start", + ["meta.odd-tab.spaces"," "], + ["meta.leading-space"," "], + ["text","FileObject.WriteLine "], + ["punctuation.definition.string.begin.asp","\""], + ["string.quoted.double.asp","Hello World\""] +],[ + "start" +],[ + "start", + ["meta.odd-tab.spaces"," "], + ["meta.leading-space"," "], + ["text","FileObject."], + ["entity.name.function.asp","Close"], + ["text","()"] +],[ + "start" +],[ + "start", + ["meta.odd-tab.spaces"," "], + ["meta.leading-space"," "], + ["support.function.vb.asp","MsgBox"], + ["text"," "], + ["punctuation.definition.string.begin.asp","\""], + ["string.quoted.double.asp","File \""], + ["text"," "], + ["keyword.operator.asp","&"], + ["text"," FileName "], + ["keyword.operator.asp","&"], + ["text"," "], + ["punctuation.definition.string.begin.asp","\""], + ["string.quoted.double.asp"," ... updated.\""] +],[ + "start" +],[ + "start", + ["support.function.asp","End"], + ["text"," "], + ["storage.type.asp","Sub"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_velocity.json b/addons/editor/ace/mode/_test/tokens_velocity.json new file mode 100755 index 00000000..3eb7a9ab --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_velocity.json @@ -0,0 +1,281 @@ +[[ + "vm_comment", + ["comment.block","#*"] +],[ + "vm_comment", + ["comment"," This is a sample comment block that"] +],[ + "vm_comment", + ["comment"," spans multiple lines."] +],[ + "start", + ["comment","*#"] +],[ + "start" +],[ + "start", + ["keyword","#macro"], + ["text"," "], + ["lparen","("], + ["text"," "], + ["identifier","outputItem"], + ["text"," "], + ["variable","$item"], + ["text"," "], + ["rparen",")"] +],[ + "start", + ["text"," "], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","li"], + ["meta.tag.punctuation.end",">"], + ["variable","${"], + ["identifier","item"], + ["variable","}"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["keyword","#end"] +],[ + "start" +],[ + "start", + ["comment","## Define the items to iterate"] +],[ + "start", + ["keyword","#set"], + ["text"," "], + ["lparen","("], + ["text"," "], + ["variable","$items"], + ["text"," "], + ["keyword.operator","="], + ["text"," "], + ["lparen","["], + ["constant.numeric","1"], + ["text",", "], + ["constant.numeric","2"], + ["text",", "], + ["constant.numeric","3"], + ["text",", "], + ["constant.numeric","4"], + ["rparen","]"], + ["text"," "], + ["rparen",")"] +],[ + "start" +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","ul"], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text"," "], + ["comment","## Iterate over the items and output the evens."] +],[ + "start", + ["text"," "], + ["keyword","#foreach"], + ["text"," "], + ["lparen","("], + ["text"," "], + ["variable","$item"], + ["text"," "], + ["identifier","in"], + ["text"," "], + ["variable","$items"], + ["text"," "], + ["rparen",")"] +],[ + "start", + ["text"," "], + ["keyword","#if"], + ["text"," "], + ["lparen","("], + ["text"," "], + ["support.function","$_MathTool"], + ["text","."], + ["identifier","mod"], + ["lparen","("], + ["variable","$item"], + ["text",", "], + ["constant.numeric","2"], + ["rparen",")"], + ["text"," "], + ["keyword.operator","=="], + ["text"," "], + ["constant.numeric","0"], + ["text"," "], + ["rparen",")"] +],[ + "start", + ["text"," "], + ["identifier","#outputItem"], + ["text"," "], + ["lparen","("], + ["variable","$item"], + ["rparen",")"] +],[ + "start", + ["text"," "], + ["keyword","#end"] +],[ + "start", + ["text"," "], + ["keyword","#end"] +],[ + "start", + ["meta.tag.punctuation.begin",""] +],[ + "start" +],[ + "js-start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.script","script"], + ["meta.tag.punctuation.end",">"] +],[ + "js-comment_regex_allowed", + ["text"," "], + ["comment","/*"] +],[ + "js-comment_regex_allowed", + ["comment"," A sample function to decomstrate"] +],[ + "js-comment_regex_allowed", + ["comment"," JavaScript highlighting and folding."] +],[ + "js-start", + ["comment"," */"] +],[ + "js-start", + ["text"," "], + ["storage.type","function"], + ["text"," "], + ["entity.name.function","foo"], + ["paren.lparen","("], + ["variable.parameter","items"], + ["punctuation.operator",", "], + ["variable.parameter","nada"], + ["paren.rparen",")"], + ["text"," "], + ["paren.lparen","{"] +],[ + "js-start", + ["text"," "], + ["keyword","for"], + ["text"," "], + ["paren.lparen","("], + ["storage.type","var"], + ["text"," "], + ["identifier","i"], + ["keyword.operator","="], + ["constant.numeric","0"], + ["punctuation.operator",";"], + ["text"," "], + ["identifier","i"], + ["keyword.operator","<"], + ["identifier","items"], + ["punctuation.operator","."], + ["support.constant","length"], + ["punctuation.operator",";"], + ["text"," "], + ["identifier","i"], + ["keyword.operator","++"], + ["paren.rparen",")"], + ["text"," "], + ["paren.lparen","{"] +],[ + "js-start", + ["text"," "], + ["support.function","alert"], + ["paren.lparen","("], + ["identifier","items"], + ["paren.lparen","["], + ["identifier","i"], + ["paren.rparen","]"], + ["text"," "], + ["keyword.operator","+"], + ["text"," "], + ["string","\"juhu"], + ["constant.language.escape","\\n"], + ["string","\""], + ["paren.rparen",")"], + ["punctuation.operator",";"] +],[ + "js-no_regex", + ["text"," "], + ["paren.rparen","}"] +],[ + "js-no_regex", + ["text"," "], + ["paren.rparen","}"] +],[ + "start", + ["meta.tag.punctuation.begin",""] +],[ + "start" +],[ + "css-start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name.style","style"], + ["meta.tag.punctuation.end",">"] +],[ + ["css-comment","css-start"], + ["text"," "], + ["comment","/*"] +],[ + ["css-comment","css-start"], + ["comment"," A sample style to decomstrate"] +],[ + ["css-comment","css-start"], + ["comment"," CSS highlighting and folding."] +],[ + "css-start", + ["comment"," */"] +],[ + ["css-ruleset","css-start"], + ["text"," "], + ["variable",".class"], + ["text"," "], + ["paren.lparen","{"] +],[ + ["css-ruleset","css-start"], + ["text"," "], + ["support.type","font-family"], + ["text",": Monaco, "], + ["string","\"Courier New\""], + ["text",", "], + ["support.constant.fonts","monospace"], + ["text",";"] +],[ + ["css-ruleset","css-start"], + ["text"," "], + ["support.type","font-size"], + ["text",": "], + ["constant.numeric","12"], + ["keyword","px"], + ["text",";"] +],[ + ["css-ruleset","css-start"], + ["text"," "], + ["support.type","cursor"], + ["text",": "], + ["support.constant","text"], + ["text",";"] +],[ + "css-start", + ["text"," "], + ["paren.rparen","}"] +],[ + "start", + ["meta.tag.punctuation.begin",""] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_xml.json b/addons/editor/ace/mode/_test/tokens_xml.json new file mode 100755 index 00000000..70f73093 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_xml.json @@ -0,0 +1,43 @@ +[[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","Juhu"], + ["meta.tag.punctuation.end",">"], + ["text","//Juhu Kinners"], + ["meta.tag.punctuation.begin",""] +],[ + "start", + ["text","test: two tags in the same lines should be in separate tokens\""] +],[ + "start", + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","Juhu"], + ["meta.tag.punctuation.end",">"], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","Kinners"], + ["meta.tag.punctuation.end",">"] +],[ + "start", + ["text","test: multiline attributes\""] +],[ + ["qqstring_inner","meta.tag.punctuation.begin"], + ["meta.tag.punctuation.begin","<"], + ["meta.tag.name","copy"], + ["text"," "], + ["entity.other.attribute-name","set"], + ["keyword.operator.separator","="], + ["string","\"{"] +],[ + ["qqstring_inner","meta.tag.punctuation.begin"], + ["string","}\""], + ["text"," "], + ["entity.other.attribute-name","undo"], + ["keyword.operator.separator","="], + ["string","\"{"] +],[ + "start", + ["string","}\""], + ["meta.tag.punctuation.end","/>"] +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_xquery.json b/addons/editor/ace/mode/_test/tokens_xquery.json new file mode 100755 index 00000000..aaf9ab9b --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_xquery.json @@ -0,0 +1,44 @@ +[[ + "[\"start\"]", + ["keyword","xquery"], + ["text"," "], + ["keyword","version"], + ["text"," "], + ["string","\""], + ["string","1.0"], + ["string","\""], + ["text",";"] +],[ + "[\"start\"]" +],[ + "[\"start\"]", + ["keyword","let"], + ["text"," "], + ["variable","$message"], + ["text"," "], + ["keyword.operator",":="], + ["text"," "], + ["string","\""], + ["string","Hello World!"], + ["string","\""] +],[ + "[\"start\",\"StartTag\",\"TagContent\"]", + ["keyword","return"], + ["text"," "], + ["meta.tag",""] +],[ + "[\"start\",\"StartTag\",\"TagContent\"]", + ["text"," "], + ["meta.tag",""], + ["text","{"], + ["variable","$message"], + ["text","}"], + ["meta.tag",""] +],[ + "[\"start\"]", + ["meta.tag",""] +],[ + "[\"start\"]" +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/_test/tokens_yaml.json b/addons/editor/ace/mode/_test/tokens_yaml.json new file mode 100755 index 00000000..7c9b45f3 --- /dev/null +++ b/addons/editor/ace/mode/_test/tokens_yaml.json @@ -0,0 +1,150 @@ +[[ + "start", + ["comment","# This sample document was taken from wikipedia:"] +],[ + "start", + ["comment","# http://en.wikipedia.org/wiki/YAML#Sample_document"] +],[ + "start", + ["list.markup","---"] +],[ + "start", + ["meta.tag","receipt"], + ["keyword",": "], + ["text","Oz-Ware Purchase Invoice"] +],[ + "start", + ["meta.tag","date"], + ["keyword",": "], + ["constant.numeric","2007-08-06"] +],[ + "start", + ["meta.tag","customer"], + ["keyword",":"] +],[ + "start", + ["meta.tag"," given"], + ["keyword",": "], + ["text","Dorothy"] +],[ + "start", + ["meta.tag"," family"], + ["keyword",": "], + ["text","Gale"] +],[ + "start" +],[ + "start", + ["meta.tag","items"], + ["keyword",":"] +],[ + "start", + ["list.markup"," - "], + ["meta.tag","part_no"], + ["keyword",": "], + ["string","'A4786'"] +],[ + "start", + ["meta.tag"," descrip"], + ["keyword",": "], + ["text","Water Bucket "], + ["paren.lparen","("], + ["text","Filled"], + ["paren.rparen",")"] +],[ + "start", + ["meta.tag"," price"], + ["keyword",": "], + ["constant.numeric","1.47"] +],[ + "start", + ["meta.tag"," quantity"], + ["keyword",": "], + ["constant.numeric","4"] +],[ + "start" +],[ + "start", + ["list.markup"," - "], + ["meta.tag","part_no"], + ["keyword",": "], + ["string","'E1628'"] +],[ + "start", + ["meta.tag"," descrip"], + ["keyword",": "], + ["text","High Heeled "], + ["string","\"Ruby\""], + ["text"," Slippers"] +],[ + "start", + ["meta.tag"," size"], + ["keyword",": "], + ["constant.numeric","8"] +],[ + "start", + ["meta.tag"," price"], + ["keyword",": "], + ["constant.numeric","100.27"] +],[ + "start", + ["meta.tag"," quantity"], + ["keyword",": "], + ["constant.numeric","1"] +],[ + "start" +],[ + "start", + ["meta.tag","bill-to"], + ["keyword",": "], + ["constant.language","&id001"] +],[ + "qqstring", + ["meta.tag"," street"], + ["keyword",": "], + ["string","|"] +],[ + "qqstring", + ["string"," 123 Tornado Alley"] +],[ + "qqstring", + ["string"," Suite 16"] +],[ + "start", + ["meta.tag"," city"], + ["keyword",": "], + ["text","East Centerville"] +],[ + "start", + ["meta.tag"," state"], + ["keyword",": "], + ["text","KS"] +],[ + "start" +],[ + "start", + ["meta.tag","ship-to"], + ["keyword",": "], + ["constant.language","*id001"] +],[ + "start" +],[ + "qqstring", + ["meta.tag","specialDelivery"], + ["keyword",": "], + ["string",">"] +],[ + "qqstring", + ["string"," Follow the Yellow Brick"] +],[ + "qqstring", + ["string"," Road to the Emerald City."] +],[ + "qqstring", + ["string"," Pay no attention to the"] +],[ + "qqstring", + ["string"," man behind the curtain."] +],[ + "qqstring" +]] \ No newline at end of file diff --git a/addons/editor/ace/mode/abap.js b/addons/editor/ace/mode/abap.js new file mode 100755 index 00000000..6ec54c07 --- /dev/null +++ b/addons/editor/ace/mode/abap.js @@ -0,0 +1,77 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var Tokenizer = require("../tokenizer").Tokenizer; +var Rules = require("./abap_highlight_rules").AbapHighlightRules; +var FoldMode = require("./folding/coffee").FoldMode; +var Range = require("../range").Range; +var TextMode = require("./text").Mode; +var oop = require("../lib/oop"); + +function Mode() { + this.HighlightRules = Rules; + this.foldingRules = new FoldMode(); +} + +oop.inherits(Mode, TextMode); + +(function() { + + this.getNextLineIndent = function(state, line, tab) { + var indent = this.$getIndent(line); + return indent; + }; + + this.toggleCommentLines = function(state, doc, startRow, endRow){ + var range = new Range(0, 0, 0, 0); + for (var i = startRow; i <= endRow; ++i) { + var line = doc.getLine(i); + if (hereComment.test(line)) + continue; + + if (commentLine.test(line)) + line = line.replace(commentLine, '$1'); + else + line = line.replace(indentation, '$&#'); + + range.end.row = range.start.row = i; + range.end.column = line.length + 1; + doc.replace(range, line); + } + }; + +}).call(Mode.prototype); + +exports.Mode = Mode; + +}); diff --git a/addons/editor/ace/mode-abap.js b/addons/editor/ace/mode/abap_highlight_rules.js old mode 100644 new mode 100755 similarity index 61% rename from addons/editor/ace/mode-abap.js rename to addons/editor/ace/mode/abap_highlight_rules.js index b5e69c46..6b232c90 --- a/addons/editor/ace/mode-abap.js +++ b/addons/editor/ace/mode/abap_highlight_rules.js @@ -3,7 +3,7 @@ * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright @@ -14,7 +14,7 @@ * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -28,56 +28,17 @@ * * ***** END LICENSE BLOCK ***** */ -define('ace/mode/abap', ['require', 'exports', 'module' , 'ace/tokenizer', 'ace/mode/abap_highlight_rules', 'ace/mode/folding/coffee', 'ace/range', 'ace/mode/text', 'ace/lib/oop'], function(require, exports, module) { - - -var Tokenizer = require("../tokenizer").Tokenizer; -var Rules = require("./abap_highlight_rules").AbapHighlightRules; -var FoldMode = require("./folding/coffee").FoldMode; -var Range = require("../range").Range; -var TextMode = require("./text").Mode; -var oop = require("../lib/oop"); - -function Mode() { - this.HighlightRules = Rules; - this.foldingRules = new FoldMode(); -} - -oop.inherits(Mode, TextMode); - -(function() { - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - return indent; - }; - - this.toggleCommentLines = function(state, doc, startRow, endRow){ - var range = new Range(0, 0, 0, 0); - for (var i = startRow; i <= endRow; ++i) { - var line = doc.getLine(i); - if (hereComment.test(line)) - continue; - - if (commentLine.test(line)) - line = line.replace(commentLine, '$1'); - else - line = line.replace(indentation, '$&#'); - - range.end.row = range.start.row = i; - range.end.column = line.length + 1; - doc.replace(range, line); - } - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; - -}); - -define('ace/mode/abap_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { +/* + * based on + * " Vim ABAP syntax file + * " Language: SAP - ABAP/R4 + * " Revision: 2.1 + * " Maintainer: Marius Piedallu van Wyk + * " Last Change: 2012 Oct 23 + */ +define(function(require, exports, module) { +"use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; @@ -171,90 +132,3 @@ oop.inherits(AbapHighlightRules, TextHighlightRules); exports.AbapHighlightRules = AbapHighlightRules; }); - -define('ace/mode/folding/coffee', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var BaseFoldMode = require("./fold_mode").FoldMode; -var Range = require("../../range").Range; - -var FoldMode = exports.FoldMode = function() {}; -oop.inherits(FoldMode, BaseFoldMode); - -(function() { - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var range = this.indentationBlock(session, row); - if (range) - return range; - - var re = /\S/; - var line = session.getLine(row); - var startLevel = line.search(re); - if (startLevel == -1 || line[startLevel] != "#") - return; - - var startColumn = line.length; - var maxRow = session.getLength(); - var startRow = row; - var endRow = row; - - while (++row < maxRow) { - line = session.getLine(row); - var level = line.search(re); - - if (level == -1) - continue; - - if (line[level] != "#") - break; - - endRow = row; - } - - if (endRow > startRow) { - var endColumn = session.getLine(endRow).length; - return new Range(startRow, startColumn, endRow, endColumn); - } - }; - this.getFoldWidget = function(session, foldStyle, row) { - var line = session.getLine(row); - var indent = line.search(/\S/); - var next = session.getLine(row + 1); - var prev = session.getLine(row - 1); - var prevIndent = prev.search(/\S/); - var nextIndent = next.search(/\S/); - - if (indent == -1) { - session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : ""; - return ""; - } - if (prevIndent == -1) { - if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") { - session.foldWidgets[row - 1] = ""; - session.foldWidgets[row + 1] = ""; - return "start"; - } - } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") { - if (session.getLine(row - 2).search(/\S/) == -1) { - session.foldWidgets[row - 1] = "start"; - session.foldWidgets[row + 1] = ""; - return ""; - } - } - - if (prevIndent!= -1 && prevIndent < indent) - session.foldWidgets[row - 1] = "start"; - else - session.foldWidgets[row - 1] = ""; - - if (indent < nextIndent) - return "start"; - else - return ""; - }; - -}).call(FoldMode.prototype); - -}); diff --git a/addons/editor/ace/mode/actionscript.js b/addons/editor/ace/mode/actionscript.js new file mode 100755 index 00000000..47b9345d --- /dev/null +++ b/addons/editor/ace/mode/actionscript.js @@ -0,0 +1,62 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2012, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * Contributor(s): + * + * + * + * ***** END LICENSE BLOCK ***** */ + +/* + THIS FILE WAS AUTOGENERATED BY mode.tmpl.js +*/ + +define(function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextMode = require("./text").Mode; +var Tokenizer = require("../tokenizer").Tokenizer; +var ActionScriptHighlightRules = require("./actionscript_highlight_rules").ActionScriptHighlightRules; +// TODO: pick appropriate fold mode +var FoldMode = require("./folding/cstyle").FoldMode; + +var Mode = function() { + this.HighlightRules = ActionScriptHighlightRules; + this.foldingRules = new FoldMode(); +}; +oop.inherits(Mode, TextMode); + +(function() { + this.lineCommentStart = "//"; + this.blockComment = {start: "/*", end: "*/"}; +}).call(Mode.prototype); + +exports.Mode = Mode; +}); \ No newline at end of file diff --git a/addons/editor/ace/mode-actionscript.js b/addons/editor/ace/mode/actionscript_highlight_rules.js old mode 100644 new mode 100755 similarity index 88% rename from addons/editor/ace/mode-actionscript.js rename to addons/editor/ace/mode/actionscript_highlight_rules.js index f4b7de83..1f30d9c2 --- a/addons/editor/ace/mode-actionscript.js +++ b/addons/editor/ace/mode/actionscript_highlight_rules.js @@ -26,43 +26,23 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * - * Contributor(s): - * - * - * * ***** END LICENSE BLOCK ***** */ -define('ace/mode/actionscript', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/actionscript_highlight_rules', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var ActionScriptHighlightRules = require("./actionscript_highlight_rules").ActionScriptHighlightRules; -var FoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = ActionScriptHighlightRules; - this.foldingRules = new FoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/actionscript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { +/* This file was autogenerated from tm bundles\actionscript.tmbundle\Syntaxes\ActionScript.plist (uuid: ) */ +/**************************************************************************************** + * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * + * fileTypes * + ****************************************************************************************/ +define(function(require, exports, module) { +"use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var ActionScriptHighlightRules = function() { + // regexp must not have capturing parentheses. Use (?:) instead. + // regexps are ordered -> the first match is used this.$rules = { start: [ { token: 'support.class.actionscript.2', @@ -158,58 +138,4 @@ ActionScriptHighlightRules.metaData = { fileTypes: [ 'as' ], oop.inherits(ActionScriptHighlightRules, TextHighlightRules); exports.ActionScriptHighlightRules = ActionScriptHighlightRules; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); +}); \ No newline at end of file diff --git a/addons/editor/ace/mode/ada.js b/addons/editor/ace/mode/ada.js new file mode 100755 index 00000000..d368bfdd --- /dev/null +++ b/addons/editor/ace/mode/ada.js @@ -0,0 +1,54 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextMode = require("./text").Mode; +var Tokenizer = require("../tokenizer").Tokenizer; +var AdaHighlightRules = require("./ada_highlight_rules").AdaHighlightRules; +var Range = require("../range").Range; + +var Mode = function() { + this.HighlightRules = AdaHighlightRules; +}; +oop.inherits(Mode, TextMode); + +(function() { + + this.lineCommentStart = "--"; + +}).call(Mode.prototype); + +exports.Mode = Mode; + +}); + diff --git a/addons/editor/ace/mode-ada.js b/addons/editor/ace/mode/ada_highlight_rules.js old mode 100644 new mode 100755 similarity index 82% rename from addons/editor/ace/mode-ada.js rename to addons/editor/ace/mode/ada_highlight_rules.js index 94082ed4..b345966c --- a/addons/editor/ace/mode-ada.js +++ b/addons/editor/ace/mode/ada_highlight_rules.js @@ -28,32 +28,8 @@ * * ***** END LICENSE BLOCK ***** */ -define('ace/mode/ada', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/ada_highlight_rules', 'ace/range'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var AdaHighlightRules = require("./ada_highlight_rules").AdaHighlightRules; -var Range = require("../range").Range; - -var Mode = function() { - this.HighlightRules = AdaHighlightRules; -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "--"; - -}).call(Mode.prototype); - -exports.Mode = Mode; - -}); - -define('ace/mode/ada_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - +define(function(require, exports, module) { +"use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; diff --git a/addons/editor/ace/mode/asciidoc.js b/addons/editor/ace/mode/asciidoc.js new file mode 100755 index 00000000..02979f54 --- /dev/null +++ b/addons/editor/ace/mode/asciidoc.js @@ -0,0 +1,64 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextMode = require("./text").Mode; +var Tokenizer = require("../tokenizer").Tokenizer; +var AsciidocHighlightRules = require("./asciidoc_highlight_rules").AsciidocHighlightRules; +var AsciidocFoldMode = require("./folding/asciidoc").FoldMode; + +var Mode = function() { + this.HighlightRules = AsciidocHighlightRules; + + this.foldingRules = new AsciidocFoldMode(); +}; +oop.inherits(Mode, TextMode); + +(function() { + this.type = "text"; + this.getNextLineIndent = function(state, line, tab) { + if (state == "listblock") { + var match = /^((?:.+)?)([-+*][ ]+)/.exec(line); + if (match) { + return new Array(match[1].length + 1).join(" ") + match[2]; + } else { + return ""; + } + } else { + return this.$getIndent(line); + } + }; +}).call(Mode.prototype); + +exports.Mode = Mode; +}); diff --git a/addons/editor/ace/mode-asciidoc.js b/addons/editor/ace/mode/asciidoc_highlight_rules.js old mode 100644 new mode 100755 similarity index 65% rename from addons/editor/ace/mode-asciidoc.js rename to addons/editor/ace/mode/asciidoc_highlight_rules.js index 0e7b0ef6..c0d1a305 --- a/addons/editor/ace/mode-asciidoc.js +++ b/addons/editor/ace/mode/asciidoc_highlight_rules.js @@ -28,43 +28,8 @@ * * ***** END LICENSE BLOCK ***** */ -define('ace/mode/asciidoc', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/asciidoc_highlight_rules', 'ace/mode/folding/asciidoc'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var AsciidocHighlightRules = require("./asciidoc_highlight_rules").AsciidocHighlightRules; -var AsciidocFoldMode = require("./folding/asciidoc").FoldMode; - -var Mode = function() { - this.HighlightRules = AsciidocHighlightRules; - - this.foldingRules = new AsciidocFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - this.type = "text"; - this.getNextLineIndent = function(state, line, tab) { - if (state == "listblock") { - var match = /^((?:.+)?)([-+*][ ]+)/.exec(line); - if (match) { - return new Array(match[1].length + 1).join(" ") + match[2]; - } else { - return ""; - } - } else { - return this.$getIndent(line); - } - }; -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/asciidoc_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - +define(function(require, exports, module) { +"use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; @@ -80,6 +45,7 @@ var AsciidocHighlightRules = function() { {token: "string", regex: /^\+{4,}\s*$/, next: "passthroughBlock"}, {token: "keyword", regex: /^={4,}\s*$/}, {token: "text", regex: /^\s*$/}, + // immediately return to the start mode without matching anything {token: "empty", regex: "", next: "dissallowDelimitedBlock"} ], @@ -96,6 +62,7 @@ var AsciidocHighlightRules = function() { "paragraphEnd": [ {token: "doc.comment", regex: /^\/{4,}\s*$/, next: "commentBlock"}, {token: "tableBlock", regex: /^\s*[|!]=+\s*$/, next: "tableBlock"}, + // open block, ruller {token: "keyword", regex: /^(?:--|''')\s*$/, next: "start"}, {token: "option", regex: /^\[.*\]\s*$/, next: "start"}, {token: "pageBreak", regex: /^>{3,}$/, next: "start"}, @@ -104,6 +71,7 @@ var AsciidocHighlightRules = function() { {token: "singleLineTitle", regex: /^={1,5}\s+\S.*$/, next: "start"}, {token: "otherBlock", regex: /^(?:\*{2,}|_{2,})\s*$/, next: "start"}, + // .optional title {token: "optionalTitle", regex: /^\.[^.\s].+$/, next: "start"} ], @@ -111,6 +79,7 @@ var AsciidocHighlightRules = function() { {token: "keyword", regex: /^\s*(?:\d+\.|[a-zA-Z]\.|[ixvmIXVM]+\)|\*{1,5}|-|\.{1,5})\s/, next: "listText"}, {token: "meta.tag", regex: /^.+(?::{2,4}|;;)(?: |$)/, next: "listText"}, {token: "support.function.list.callout", regex: /^(?:<\d+>|\d+>|>) /, next: "text"}, + // continuation {token: "keyword", regex: /^\+\s*$/, next: "start"} ], @@ -124,15 +93,19 @@ var AsciidocHighlightRules = function() { {token: "escape", regex: /\((?:C|TM|R)\)|\.{3}|->|<-|=>|<=|&#(?:\d+|x[a-fA-F\d]+);|(?: |^)--(?=\s+\S)/}, {token: "escape", regex: /\\[_*'`+#]|\\{2}[_*'`+#]{2}/}, {token: "keyword", regex: /\s\+$/}, + // any word {token: "text", regex: identifierRe}, {token: ["keyword", "string", "keyword"], regex: /(<<[\w\d\-$]+,)(.*?)(>>|$)/}, {token: "keyword", regex: /<<[\w\d\-$]+,?|>>/}, {token: "constant.character", regex: /\({2,3}.*?\){2,3}/}, + // Anchor {token: "keyword", regex: /\[\[.+?\]\]/}, + // bibliography {token: "support", regex: /^\[{3}[\w\d =\-]+\]{3}/}, {include: "quotes"}, + // text block end {token: "empty", regex: /^\s*$/, next: "start"} ], @@ -221,6 +194,8 @@ var AsciidocHighlightRules = function() { return prefix + ch + "[^" + ch + "].*?" + ch + "(?![\\w*])"; } + //addQuoteBlock("text") + var tokenMap = { macro: "constant.character", tableBlock: "doc.comment", @@ -257,116 +232,3 @@ oop.inherits(AsciidocHighlightRules, TextHighlightRules); exports.AsciidocHighlightRules = AsciidocHighlightRules; }); - -define('ace/mode/folding/asciidoc', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var BaseFoldMode = require("./fold_mode").FoldMode; -var Range = require("../../range").Range; - -var FoldMode = exports.FoldMode = function() {}; -oop.inherits(FoldMode, BaseFoldMode); - -(function() { - this.foldingStartMarker = /^(?:\|={10,}|[\.\/=\-~^+]{4,}\s*$|={1,5} )/; - this.singleLineHeadingRe = /^={1,5}(?=\s+\S)/; - - this.getFoldWidget = function(session, foldStyle, row) { - var line = session.getLine(row); - if (!this.foldingStartMarker.test(line)) - return "" - - if (line[0] == "=") { - if (this.singleLineHeadingRe.test(line)) - return "start"; - if (session.getLine(row - 1).length != session.getLine(row).length) - return ""; - return "start"; - } - if (session.bgTokenizer.getState(row) == "dissallowDelimitedBlock") - return "end"; - return "start"; - }; - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var line = session.getLine(row); - var startColumn = line.length; - var maxRow = session.getLength(); - var startRow = row; - var endRow = row; - if (!line.match(this.foldingStartMarker)) - return; - - var token; - function getTokenType(row) { - token = session.getTokens(row)[0]; - return token && token.type; - } - - var levels = ["=","-","~","^","+"]; - var heading = "markup.heading"; - var singleLineHeadingRe = this.singleLineHeadingRe; - function getLevel() { - var match = token.value.match(singleLineHeadingRe); - if (match) - return match[0].length; - var level = levels.indexOf(token.value[0]) + 1; - if (level == 1) { - if (session.getLine(row - 1).length != session.getLine(row).length) - return Infinity; - } - return level; - } - - if (getTokenType(row) == heading) { - var startHeadingLevel = getLevel(); - while (++row < maxRow) { - if (getTokenType(row) != heading) - continue; - var level = getLevel(); - if (level <= startHeadingLevel) - break; - } - - var isSingleLineHeading = token && token.value.match(this.singleLineHeadingRe); - endRow = isSingleLineHeading ? row - 1 : row - 2; - - if (endRow > startRow) { - while (endRow > startRow && (!getTokenType(endRow) || token.value[0] == "[")) - endRow--; - } - - if (endRow > startRow) { - var endColumn = session.getLine(endRow).length; - return new Range(startRow, startColumn, endRow, endColumn); - } - } else { - var state = session.bgTokenizer.getState(row); - if (state == "dissallowDelimitedBlock") { - while (row -- > 0) { - if (session.bgTokenizer.getState(row).lastIndexOf("Block") == -1) - break; - } - endRow = row + 1; - if (endRow < startRow) { - var endColumn = session.getLine(row).length; - return new Range(endRow, 5, startRow, startColumn - 5); - } - } else { - while (++row < maxRow) { - if (session.bgTokenizer.getState(row) == "dissallowDelimitedBlock") - break; - } - endRow = row; - if (endRow > startRow) { - var endColumn = session.getLine(row).length; - return new Range(startRow, 5, endRow, endColumn - 5); - } - } - } - }; - -}).call(FoldMode.prototype); - -}); diff --git a/addons/editor/ace/mode/assembly_x86.js b/addons/editor/ace/mode/assembly_x86.js new file mode 100755 index 00000000..26989198 --- /dev/null +++ b/addons/editor/ace/mode/assembly_x86.js @@ -0,0 +1,56 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2012, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * ***** END LICENSE BLOCK ***** */ + +/* + THIS FILE WAS AUTOGENERATED BY mode.tmpl.js +*/ + +define(function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextMode = require("./text").Mode; +var Tokenizer = require("../tokenizer").Tokenizer; +var AssemblyX86HighlightRules = require("./assembly_x86_highlight_rules").AssemblyX86HighlightRules; +var FoldMode = require("./folding/coffee").FoldMode; + +var Mode = function() { + this.HighlightRules = AssemblyX86HighlightRules; + this.foldingRules = new FoldMode(); +}; +oop.inherits(Mode, TextMode); + +(function() { + this.lineCommentStart = ";"; +}).call(Mode.prototype); + +exports.Mode = Mode; +}); \ No newline at end of file diff --git a/addons/editor/ace/mode-assembly_x86.js b/addons/editor/ace/mode/assembly_x86_highlight_rules.js old mode 100644 new mode 100755 similarity index 72% rename from addons/editor/ace/mode-assembly_x86.js rename to addons/editor/ace/mode/assembly_x86_highlight_rules.js index 4f8fc53b..247d1d0c --- a/addons/editor/ace/mode-assembly_x86.js +++ b/addons/editor/ace/mode/assembly_x86_highlight_rules.js @@ -26,38 +26,23 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * * ***** END LICENSE BLOCK ***** */ -define('ace/mode/assembly_x86', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/assembly_x86_highlight_rules', 'ace/mode/folding/coffee'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var AssemblyX86HighlightRules = require("./assembly_x86_highlight_rules").AssemblyX86HighlightRules; -var FoldMode = require("./folding/coffee").FoldMode; - -var Mode = function() { - this.HighlightRules = AssemblyX86HighlightRules; - this.foldingRules = new FoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - this.lineCommentStart = ";"; -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/assembly_x86_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { +/* This file was autogenerated from Assembly x86.tmLanguage (uuid: ) */ +/**************************************************************************************** + * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * + * fileTypes * + ****************************************************************************************/ +define(function(require, exports, module) { +"use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var AssemblyX86HighlightRules = function() { + // regexp must not have capturing parentheses. Use (?:) instead. + // regexps are ordered -> the first match is used this.$rules = { start: [ { token: 'keyword.control.assembly', @@ -126,91 +111,4 @@ AssemblyX86HighlightRules.metaData = { fileTypes: [ 'asm' ], oop.inherits(AssemblyX86HighlightRules, TextHighlightRules); exports.AssemblyX86HighlightRules = AssemblyX86HighlightRules; -}); - -define('ace/mode/folding/coffee', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var BaseFoldMode = require("./fold_mode").FoldMode; -var Range = require("../../range").Range; - -var FoldMode = exports.FoldMode = function() {}; -oop.inherits(FoldMode, BaseFoldMode); - -(function() { - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var range = this.indentationBlock(session, row); - if (range) - return range; - - var re = /\S/; - var line = session.getLine(row); - var startLevel = line.search(re); - if (startLevel == -1 || line[startLevel] != "#") - return; - - var startColumn = line.length; - var maxRow = session.getLength(); - var startRow = row; - var endRow = row; - - while (++row < maxRow) { - line = session.getLine(row); - var level = line.search(re); - - if (level == -1) - continue; - - if (line[level] != "#") - break; - - endRow = row; - } - - if (endRow > startRow) { - var endColumn = session.getLine(endRow).length; - return new Range(startRow, startColumn, endRow, endColumn); - } - }; - this.getFoldWidget = function(session, foldStyle, row) { - var line = session.getLine(row); - var indent = line.search(/\S/); - var next = session.getLine(row + 1); - var prev = session.getLine(row - 1); - var prevIndent = prev.search(/\S/); - var nextIndent = next.search(/\S/); - - if (indent == -1) { - session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : ""; - return ""; - } - if (prevIndent == -1) { - if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") { - session.foldWidgets[row - 1] = ""; - session.foldWidgets[row + 1] = ""; - return "start"; - } - } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") { - if (session.getLine(row - 2).search(/\S/) == -1) { - session.foldWidgets[row - 1] = "start"; - session.foldWidgets[row + 1] = ""; - return ""; - } - } - - if (prevIndent!= -1 && prevIndent < indent) - session.foldWidgets[row - 1] = "start"; - else - session.foldWidgets[row - 1] = ""; - - if (indent < nextIndent) - return "start"; - else - return ""; - }; - -}).call(FoldMode.prototype); - -}); +}); \ No newline at end of file diff --git a/addons/editor/ace/mode/autohotkey.js b/addons/editor/ace/mode/autohotkey.js new file mode 100755 index 00000000..2a9ecee5 --- /dev/null +++ b/addons/editor/ace/mode/autohotkey.js @@ -0,0 +1,62 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2012, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * Contributor(s): + * + * + * + * ***** END LICENSE BLOCK ***** */ + +/* + THIS FILE WAS AUTOGENERATED BY mode.tmpl.js +*/ + +define(function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextMode = require("./text").Mode; +var Tokenizer = require("../tokenizer").Tokenizer; +var AutoHotKeyHighlightRules = require("./autohotkey_highlight_rules").AutoHotKeyHighlightRules; +// TODO: pick appropriate fold mode +var FoldMode = require("./folding/cstyle").FoldMode; + +var Mode = function() { + this.HighlightRules = AutoHotKeyHighlightRules; + this.foldingRules = new FoldMode(); +}; +oop.inherits(Mode, TextMode); + +(function() { + this.lineCommentStart = "/\\*"; + this.blockComment = {start: "/*", end: "*/"}; +}).call(Mode.prototype); + +exports.Mode = Mode; +}); \ No newline at end of file diff --git a/addons/editor/ace/mode-autohotkey.js b/addons/editor/ace/mode/autohotkey_highlight_rules.js old mode 100644 new mode 100755 similarity index 95% rename from addons/editor/ace/mode-autohotkey.js rename to addons/editor/ace/mode/autohotkey_highlight_rules.js index a276a382..45193996 --- a/addons/editor/ace/mode-autohotkey.js +++ b/addons/editor/ace/mode/autohotkey_highlight_rules.js @@ -26,38 +26,16 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * - * Contributor(s): - * - * - * * ***** END LICENSE BLOCK ***** */ -define('ace/mode/autohotkey', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/autohotkey_highlight_rules', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var AutoHotKeyHighlightRules = require("./autohotkey_highlight_rules").AutoHotKeyHighlightRules; -var FoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = AutoHotKeyHighlightRules; - this.foldingRules = new FoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - this.lineCommentStart = "/\\*"; - this.blockComment = {start: "/*", end: "*/"}; -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/autohotkey_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { +/* This file was autogenerated from C:\Users\LED\Desktop\AutoHotKey.tmLanguage (uuid: ) */ +/**************************************************************************************** + * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * + * fileTypes * + ****************************************************************************************/ +define(function(require, exports, module) { +"use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; @@ -126,58 +104,4 @@ AutoHotKeyHighlightRules.metaData = { name: 'AutoHotKey', oop.inherits(AutoHotKeyHighlightRules, TextHighlightRules); exports.AutoHotKeyHighlightRules = AutoHotKeyHighlightRules; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); +}); \ No newline at end of file diff --git a/addons/editor/ace/mode/batchfile.js b/addons/editor/ace/mode/batchfile.js new file mode 100755 index 00000000..2f10957f --- /dev/null +++ b/addons/editor/ace/mode/batchfile.js @@ -0,0 +1,61 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2012, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * Contributor(s): + * + * + * + * ***** END LICENSE BLOCK ***** */ + +/* + THIS FILE WAS AUTOGENERATED BY mode.tmpl.js +*/ + +define(function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextMode = require("./text").Mode; +var Tokenizer = require("../tokenizer").Tokenizer; +var BatchFileHighlightRules = require("./batchfile_highlight_rules").BatchFileHighlightRules; +var FoldMode = require("./folding/cstyle").FoldMode; + +var Mode = function() { + this.HighlightRules = BatchFileHighlightRules; + this.foldingRules = new FoldMode(); +}; +oop.inherits(Mode, TextMode); + +(function() { + this.lineCommentStart = "::"; + this.blockComment = ""; +}).call(Mode.prototype); + +exports.Mode = Mode; +}); \ No newline at end of file diff --git a/addons/editor/ace/mode-batchfile.js b/addons/editor/ace/mode/batchfile_highlight_rules.js old mode 100644 new mode 100755 similarity index 62% rename from addons/editor/ace/mode-batchfile.js rename to addons/editor/ace/mode/batchfile_highlight_rules.js index 979202ab..be0380d8 --- a/addons/editor/ace/mode-batchfile.js +++ b/addons/editor/ace/mode/batchfile_highlight_rules.js @@ -26,43 +26,23 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * - * Contributor(s): - * - * - * * ***** END LICENSE BLOCK ***** */ -define('ace/mode/batchfile', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/batchfile_highlight_rules', 'ace/mode/folding/cstyle'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var BatchFileHighlightRules = require("./batchfile_highlight_rules").BatchFileHighlightRules; -var FoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = BatchFileHighlightRules; - this.foldingRules = new FoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - this.lineCommentStart = "::"; - this.blockComment = ""; -}).call(Mode.prototype); - -exports.Mode = Mode; -}); - -define('ace/mode/batchfile_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { +/* This file was autogenerated from C:\Users\LED\AppData\Roaming\Sublime Text 2\Packages\Batch File\Batch File.tmLanguage (uuid: ) */ +/**************************************************************************************** + * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * + * fileTypes * + ****************************************************************************************/ +define(function(require, exports, module) { +"use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var BatchFileHighlightRules = function() { + // regexp must not have capturing parentheses. Use (?:) instead. + // regexps are ordered -> the first match is used this.$rules = { start: [ { token: 'keyword.command.dosbatch', @@ -114,58 +94,4 @@ BatchFileHighlightRules.metaData = { name: 'Batch File', oop.inherits(BatchFileHighlightRules, TextHighlightRules); exports.BatchFileHighlightRules = BatchFileHighlightRules; -}); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); +}); \ No newline at end of file diff --git a/addons/editor/ace/mode/behaviour.js b/addons/editor/ace/mode/behaviour.js new file mode 100755 index 00000000..c1c6cb15 --- /dev/null +++ b/addons/editor/ace/mode/behaviour.js @@ -0,0 +1,90 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var Behaviour = function() { + this.$behaviours = {}; +}; + +(function () { + + this.add = function (name, action, callback) { + switch (undefined) { + case this.$behaviours: + this.$behaviours = {}; + case this.$behaviours[name]: + this.$behaviours[name] = {}; + } + this.$behaviours[name][action] = callback; + } + + this.addBehaviours = function (behaviours) { + for (var key in behaviours) { + for (var action in behaviours[key]) { + this.add(key, action, behaviours[key][action]); + } + } + } + + this.remove = function (name) { + if (this.$behaviours && this.$behaviours[name]) { + delete this.$behaviours[name]; + } + } + + this.inherit = function (mode, filter) { + if (typeof mode === "function") { + var behaviours = new mode().getBehaviours(filter); + } else { + var behaviours = mode.getBehaviours(filter); + } + this.addBehaviours(behaviours); + } + + this.getBehaviours = function (filter) { + if (!filter) { + return this.$behaviours; + } else { + var ret = {} + for (var i = 0; i < filter.length; i++) { + if (this.$behaviours[filter[i]]) { + ret[filter[i]] = this.$behaviours[filter[i]]; + } + } + return ret; + } + } + +}).call(Behaviour.prototype); + +exports.Behaviour = Behaviour; +}); diff --git a/addons/editor/ace/mode/behaviour/css.js b/addons/editor/ace/mode/behaviour/css.js new file mode 100755 index 00000000..1c35f744 --- /dev/null +++ b/addons/editor/ace/mode/behaviour/css.js @@ -0,0 +1,108 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var oop = require("../../lib/oop"); +var Behaviour = require("../behaviour").Behaviour; +var CstyleBehaviour = require("./cstyle").CstyleBehaviour; +var TokenIterator = require("../../token_iterator").TokenIterator; + +var CssBehaviour = function () { + + this.inherit(CstyleBehaviour); + + this.add("colon", "insertion", function (state, action, editor, session, text) { + if (text === ':') { + var cursor = editor.getCursorPosition(); + var iterator = new TokenIterator(session, cursor.row, cursor.column); + var token = iterator.getCurrentToken(); + if (token && token.value.match(/\s+/)) { + token = iterator.stepBackward(); + } + if (token && token.type === 'support.type') { + var line = session.doc.getLine(cursor.row); + var rightChar = line.substring(cursor.column, cursor.column + 1); + if (rightChar === ':') { + return { + text: '', + selection: [1, 1] + } + } + if (!line.substring(cursor.column).match(/^\s*;/)) { + return { + text: ':;', + selection: [1, 1] + } + } + } + } + }); + + this.add("colon", "deletion", function (state, action, editor, session, range) { + var selected = session.doc.getTextRange(range); + if (!range.isMultiLine() && selected === ':') { + var cursor = editor.getCursorPosition(); + var iterator = new TokenIterator(session, cursor.row, cursor.column); + var token = iterator.getCurrentToken(); + if (token && token.value.match(/\s+/)) { + token = iterator.stepBackward(); + } + if (token && token.type === 'support.type') { + 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("semicolon", "insertion", function (state, action, editor, session, text) { + if (text === ';') { + var cursor = editor.getCursorPosition(); + var line = session.doc.getLine(cursor.row); + var rightChar = line.substring(cursor.column, cursor.column + 1); + if (rightChar === ';') { + return { + text: '', + selection: [1, 1] + } + } + } + }); + +} +oop.inherits(CssBehaviour, CstyleBehaviour); + +exports.CssBehaviour = CssBehaviour; +}); diff --git a/addons/editor/ace/mode-json.js b/addons/editor/ace/mode/behaviour/cstyle.js old mode 100644 new mode 100755 similarity index 68% rename from addons/editor/ace/mode-json.js rename to addons/editor/ace/mode/behaviour/cstyle.js index d1b3d472..54f75526 --- a/addons/editor/ace/mode-json.js +++ b/addons/editor/ace/mode/behaviour/cstyle.js @@ -28,180 +28,8 @@ * * ***** 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', 'ace/worker/worker_client'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -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.HighlightRules = HighlightRules; - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - if (state == "start") { - 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); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "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; -}); - -define('ace/mode/json_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var JsonHighlightRules = function() { - this.$rules = { - "start" : [ - { - token : "variable", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]\\s*(?=:)' - }, { - token : "string", // single line - regex : '"', - next : "string" - }, { - token : "constant.numeric", // hex - regex : "0[xX][0-9a-fA-F]+\\b" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "constant.language.boolean", - regex : "(?:true|false)\\b" - }, { - token : "invalid.illegal", // single quoted strings are not allowed - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - token : "invalid.illegal", // comments are not allowed - regex : "\\/\\/.*$" - }, { - token : "paren.lparen", - regex : "[[({]" - }, { - token : "paren.rparen", - regex : "[\\])}]" - }, { - token : "text", - regex : "\\s+" - } - ], - "string" : [ - { - token : "constant.language.escape", - regex : /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\\\/bfnrt])/ - }, { - token : "string", - regex : '[^"\\\\]+' - }, { - token : "string", - regex : '"', - next : "start" - }, { - token : "string", - regex : "", - next : "start" - } - ] - }; - -}; - -oop.inherits(JsonHighlightRules, TextHighlightRules); - -exports.JsonHighlightRules = JsonHighlightRules; -}); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { - +define(function(require, exports, module) { +"use strict"; var oop = require("../../lib/oop"); var Behaviour = require("../behaviour").Behaviour; @@ -227,11 +55,16 @@ var CstyleBehaviour = function () { CstyleBehaviour.isSaneInsertion = function(editor, session) { var cursor = editor.getCursorPosition(); var iterator = new TokenIterator(session, cursor.row, cursor.column); + + // Don't insert in the middle of a keyword/identifier/lexical if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { + // Look ahead in case we're at the end of a token var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) return false; } + + // Only insert in front of whitespace/comments iterator.stepForward(); return iterator.getCurrentTokenRow() !== cursor.row || this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); @@ -244,6 +77,7 @@ var CstyleBehaviour = function () { CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { var cursor = editor.getCursorPosition(); var line = session.doc.getLine(cursor.row); + // Reset previous state if text or context changed too much if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) autoInsertedBrackets = 0; autoInsertedRow = cursor.row; @@ -465,9 +299,13 @@ var CstyleBehaviour = function () { 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); var col = 0, token; var quotepos = -1; // Track whether we're inside an open quote. @@ -484,6 +322,8 @@ var CstyleBehaviour = function () { } 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)))) { if (!CstyleBehaviour.isSaneInsertion(editor, session)) return; @@ -492,6 +332,7 @@ var CstyleBehaviour = function () { 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 { @@ -522,57 +363,3 @@ oop.inherits(CstyleBehaviour, Behaviour); exports.CstyleBehaviour = CstyleBehaviour; }); - -define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -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); - - return session.getCommentFoldRange(row, i + match[0].length, 1); - } - - if (foldStyle !== "markbeginend") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - -}).call(FoldMode.prototype); - -}); diff --git a/addons/editor/ace/mode/behaviour/html.js b/addons/editor/ace/mode/behaviour/html.js new file mode 100755 index 00000000..1d500e0f --- /dev/null +++ b/addons/editor/ace/mode/behaviour/html.js @@ -0,0 +1,88 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var oop = require("../../lib/oop"); +var XmlBehaviour = require("../behaviour/xml").XmlBehaviour; +var CstyleBehaviour = require("./cstyle").CstyleBehaviour; +var TokenIterator = require("../../token_iterator").TokenIterator; +var voidElements = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']; + +function hasType(token, type) { + var tokenTypes = token.type.split('.'); + return type.split('.').every(function(type){ + return (tokenTypes.indexOf(type) !== -1); + }); + return hasType; +} + +var HtmlBehaviour = function () { + + this.inherit(XmlBehaviour); // Get xml behaviour + + this.add("autoclosing", "insertion", function (state, action, editor, session, text) { + if (text == '>') { + var position = editor.getCursorPosition(); + var iterator = new TokenIterator(session, position.row, position.column); + var token = iterator.getCurrentToken(); + + if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column) + return; + var atCursor = false; + if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ + do { + token = iterator.stepBackward(); + } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text'))); + } else { + atCursor = true; + } + if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) { + return; + } + var element = token.value; + if (atCursor){ + var element = element.substring(0, position.column - token.start); + } + if (voidElements.indexOf(element) !== -1){ + return; + } + return { + text: '>' + '', + selection: [1, 1] + } + } + }); +} +oop.inherits(HtmlBehaviour, XmlBehaviour); + +exports.HtmlBehaviour = HtmlBehaviour; +}); diff --git a/addons/editor/ace/mode/behaviour/xml.js b/addons/editor/ace/mode/behaviour/xml.js new file mode 100755 index 00000000..47261306 --- /dev/null +++ b/addons/editor/ace/mode/behaviour/xml.js @@ -0,0 +1,103 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var oop = require("../../lib/oop"); +var Behaviour = require("../behaviour").Behaviour; +var CstyleBehaviour = require("./cstyle").CstyleBehaviour; +var TokenIterator = require("../../token_iterator").TokenIterator; + +function hasType(token, type) { + var tokenTypes = token.type.split('.'); + return type.split('.').every(function(type){ + return (tokenTypes.indexOf(type) !== -1); + }); + return hasType; +} + +var XmlBehaviour = function () { + + this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour + + this.add("autoclosing", "insertion", function (state, action, editor, session, text) { + if (text == '>') { + var position = editor.getCursorPosition(); + var iterator = new TokenIterator(session, position.row, position.column); + var token = iterator.getCurrentToken(); + + if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column) + return; + var atCursor = false; + if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ + do { + token = iterator.stepBackward(); + } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text'))); + } else { + atCursor = true; + } + if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) { + return; + } + var tag = token.value; + if (atCursor){ + var tag = tag.substring(0, position.column - token.start); + } + + return { + text: '>' + '', + selection: [1, 1] + } + } + }); + + this.add('autoindent', 'insertion', function (state, action, editor, session, text) { + if (text == "\n") { + var cursor = editor.getCursorPosition(); + var line = session.getLine(cursor.row); + var rightChars = line.substring(cursor.column, cursor.column + 2); + if (rightChars == '') { + var position = editor.getCursorPosition(); + var iterator = new TokenIterator(session, position.row, position.column); + var token = iterator.getCurrentToken(); + var atCursor = false; + var state = JSON.parse(state).pop(); + if ((token && token.value === '>') || state !== "StartTag") return; + if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ + do { + token = iterator.stepBackward(); + } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text'))); + } else { + atCursor = true; + } + var previous = iterator.stepBackward(); + if (!token || !hasType(token, 'meta.tag') || (previous !== null && previous.value.match('/'))) { + return + } + var tag = token.value.substring(1); + if (atCursor){ + var tag = tag.substring(0, position.column - token.start); + } + + return { + text: '>' + '', + selection: [1, 1] + } + } + }); + + } + oop.inherits(XQueryBehaviour, Behaviour); + + exports.XQueryBehaviour = XQueryBehaviour; +}); diff --git a/addons/editor/ace/mode/c9search.js b/addons/editor/ace/mode/c9search.js new file mode 100755 index 00000000..18cfdd40 --- /dev/null +++ b/addons/editor/ace/mode/c9search.js @@ -0,0 +1,67 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextMode = require("./text").Mode; +var Tokenizer = require("../tokenizer").Tokenizer; +var C9SearchHighlightRules = require("./c9search_highlight_rules").C9SearchHighlightRules; +var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; +var C9StyleFoldMode = require("./folding/c9search").FoldMode; + +var Mode = function() { + this.HighlightRules = C9SearchHighlightRules; + this.$outdent = new MatchingBraceOutdent(); + this.foldingRules = new C9StyleFoldMode(); +}; +oop.inherits(Mode, TextMode); + +(function() { + + this.getNextLineIndent = function(state, line, tab) { + var indent = this.$getIndent(line); + 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; + +}); diff --git a/addons/editor/ace/mode/c9search_highlight_rules.js b/addons/editor/ace/mode/c9search_highlight_rules.js new file mode 100755 index 00000000..df31112b --- /dev/null +++ b/addons/editor/ace/mode/c9search_highlight_rules.js @@ -0,0 +1,59 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + +var C9SearchHighlightRules = function() { + + // regexp must not have capturing parentheses. Use (?:) instead. + // regexps are ordered -> the first match is used + this.$rules = { + "start" : [ + { + token : ["c9searchresults.constant.numeric", "c9searchresults.text", "c9searchresults.text"], + regex : "(^\\s+[0-9]+)(:\\s*)(.+)" + }, + { + token : ["string", "text"], // single line + regex : "(.+)(:$)" + } + ] + }; +}; + +oop.inherits(C9SearchHighlightRules, TextHighlightRules); + +exports.C9SearchHighlightRules = C9SearchHighlightRules; + +}); diff --git a/addons/editor/ace/mode/c_cpp.js b/addons/editor/ace/mode/c_cpp.js new file mode 100755 index 00000000..08ccf0bb --- /dev/null +++ b/addons/editor/ace/mode/c_cpp.js @@ -0,0 +1,101 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextMode = require("./text").Mode; +var Tokenizer = require("../tokenizer").Tokenizer; +var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules; +var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; +var Range = require("../range").Range; +var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; +var CStyleFoldMode = require("./folding/cstyle").FoldMode; + +var Mode = function() { + this.HighlightRules = c_cppHighlightRules; + + this.$outdent = new MatchingBraceOutdent(); + this.$behaviour = new CstyleBehaviour(); + + this.foldingRules = new CStyleFoldMode(); +}; +oop.inherits(Mode, TextMode); + +(function() { + + this.lineCommentStart = "//"; + this.blockComment = {start: "/*", end: "*/"}; + + this.getNextLineIndent = function(state, line, tab) { + var indent = this.$getIndent(line); + + var tokenizedLine = this.getTokenizer().getLineTokens(line, state); + var tokens = tokenizedLine.tokens; + var endState = tokenizedLine.state; + + if (tokens.length && tokens[tokens.length-1].type == "comment") { + return indent; + } + + if (state == "start") { + var match = line.match(/^.*[\{\(\[]\s*$/); + if (match) { + indent += tab; + } + } else if (state == "doc-start") { + if (endState == "start") { + return ""; + } + var match = line.match(/^\s*(\/?)\*/); + if (match) { + if (match[1]) { + indent += " "; + } + indent += "* "; + } + } + + 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; +}); diff --git a/addons/editor/ace/mode/c_cpp_highlight_rules.js b/addons/editor/ace/mode/c_cpp_highlight_rules.js new file mode 100755 index 00000000..d1de84af --- /dev/null +++ b/addons/editor/ace/mode/c_cpp_highlight_rules.js @@ -0,0 +1,183 @@ +define(function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; +var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + +// used by objective-c +var cFunctions = exports.cFunctions = "\\s*\\bhypot(?:f|l)?|s(?:scanf|ystem|nprintf|ca(?:nf|lb(?:n(?:f|l)?|ln(?:f|l)?))|i(?:n(?:h(?:f|l)?|f|l)?|gn(?:al|bit))|tr(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(?:jmp|vbuf|locale|buf)|qrt(?:f|l)?|w(?:scanf|printf)|rand)|n(?:e(?:arbyint(?:f|l)?|xt(?:toward(?:f|l)?|after(?:f|l)?))|an(?:f|l)?)|c(?:s(?:in(?:h(?:f|l)?|f|l)?|qrt(?:f|l)?)|cos(?:h(?:f)?|f|l)?|imag(?:f|l)?|t(?:ime|an(?:h(?:f|l)?|f|l)?)|o(?:s(?:h(?:f|l)?|f|l)?|nj(?:f|l)?|pysign(?:f|l)?)|p(?:ow(?:f|l)?|roj(?:f|l)?)|e(?:il(?:f|l)?|xp(?:f|l)?)|l(?:o(?:ck|g(?:f|l)?)|earerr)|a(?:sin(?:h(?:f|l)?|f|l)?|cos(?:h(?:f|l)?|f|l)?|tan(?:h(?:f|l)?|f|l)?|lloc|rg(?:f|l)?|bs(?:f|l)?)|real(?:f|l)?|brt(?:f|l)?)|t(?:ime|o(?:upper|lower)|an(?:h(?:f|l)?|f|l)?|runc(?:f|l)?|gamma(?:f|l)?|mp(?:nam|file))|i(?:s(?:space|n(?:ormal|an)|cntrl|inf|digit|u(?:nordered|pper)|p(?:unct|rint)|finite|w(?:space|c(?:ntrl|type)|digit|upper|p(?:unct|rint)|lower|al(?:num|pha)|graph|xdigit|blank)|l(?:ower|ess(?:equal|greater)?)|al(?:num|pha)|gr(?:eater(?:equal)?|aph)|xdigit|blank)|logb(?:f|l)?|max(?:div|abs))|di(?:v|fftime)|_Exit|unget(?:c|wc)|p(?:ow(?:f|l)?|ut(?:s|c(?:har)?|wc(?:har)?)|error|rintf)|e(?:rf(?:c(?:f|l)?|f|l)?|x(?:it|p(?:2(?:f|l)?|f|l|m1(?:f|l)?)?))|v(?:s(?:scanf|nprintf|canf|printf|w(?:scanf|printf))|printf|f(?:scanf|printf|w(?:scanf|printf))|w(?:scanf|printf)|a_(?:start|copy|end|arg))|qsort|f(?:s(?:canf|e(?:tpos|ek))|close|tell|open|dim(?:f|l)?|p(?:classify|ut(?:s|c|w(?:s|c))|rintf)|e(?:holdexcept|set(?:e(?:nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(?:aiseexcept|ror)|get(?:e(?:nv|xceptflag)|round))|flush|w(?:scanf|ide|printf|rite)|loor(?:f|l)?|abs(?:f|l)?|get(?:s|c|pos|w(?:s|c))|re(?:open|e|ad|xp(?:f|l)?)|m(?:in(?:f|l)?|od(?:f|l)?|a(?:f|l|x(?:f|l)?)?))|l(?:d(?:iv|exp(?:f|l)?)|o(?:ngjmp|cal(?:time|econv)|g(?:1(?:p(?:f|l)?|0(?:f|l)?)|2(?:f|l)?|f|l|b(?:f|l)?)?)|abs|l(?:div|abs|r(?:int(?:f|l)?|ound(?:f|l)?))|r(?:int(?:f|l)?|ound(?:f|l)?)|gamma(?:f|l)?)|w(?:scanf|c(?:s(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?|mbs)|pbrk|ftime|len|r(?:chr|tombs)|xfrm)|to(?:b|mb)|rtomb)|printf|mem(?:set|c(?:hr|py|mp)|move))|a(?:s(?:sert|ctime|in(?:h(?:f|l)?|f|l)?)|cos(?:h(?:f|l)?|f|l)?|t(?:o(?:i|f|l(?:l)?)|exit|an(?:h(?:f|l)?|2(?:f|l)?|f|l)?)|b(?:s|ort))|g(?:et(?:s|c(?:har)?|env|wc(?:har)?)|mtime)|r(?:int(?:f|l)?|ound(?:f|l)?|e(?:name|alloc|wind|m(?:ove|quo(?:f|l)?|ainder(?:f|l)?))|a(?:nd|ise))|b(?:search|towc)|m(?:odf(?:f|l)?|em(?:set|c(?:hr|py|mp)|move)|ktime|alloc|b(?:s(?:init|towcs|rtowcs)|towc|len|r(?:towc|len)))\\b" + +var c_cppHighlightRules = function() { + + var keywordControls = ( + "break|case|continue|default|do|else|for|goto|if|_Pragma|" + + "return|switch|while|catch|operator|try|throw|using" + ); + + var storageType = ( + "asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" + + "_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|" + + "class|wchar_t|template" + ); + + var storageModifiers = ( + "const|extern|register|restrict|static|volatile|inline|private:|" + + "protected:|public:|friend|explicit|virtual|export|mutable|typename" + ); + + var keywordOperators = ( + "and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq" + + "const_cast|dynamic_cast|reinterpret_cast|static_cast|sizeof|namespace" + ); + + var builtinConstants = ( + "NULL|true|false|TRUE|FALSE" + ); + + var keywordMapper = this.$keywords = this.createKeywordMapper({ + "keyword.control" : keywordControls, + "storage.type" : storageType, + "storage.modifier" : storageModifiers, + "keyword.operator" : keywordOperators, + "variable.language": "this", + "constant.language": builtinConstants + }, "identifier"); + + var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\d\\$_\u00a1-\uffff]*\\b"; + + // regexp must not have capturing parentheses. Use (?:) instead. + // regexps are ordered -> the first match is used + + this.$rules = { + "start" : [ + { + token : "comment", + regex : "\\/\\/.*$" + }, + DocCommentHighlightRules.getStartRule("doc-start"), + { + token : "comment", // multi line comment + regex : "\\/\\*", + next : "comment" + }, { + token : "string", // single line + regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' + }, { + token : "string", // multi line string start + regex : '["].*\\\\$', + next : "qqstring" + }, { + token : "string", // single line + regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" + }, { + token : "string", // multi line string start + regex : "['].*\\\\$", + next : "qstring" + }, { + token : "constant.numeric", // hex + regex : "0[xX][0-9a-fA-F]+(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b" + }, { + token : "constant.numeric", // float + regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b" + }, { + token : "keyword", // pre-compiler directives + regex : "#\\s*(?:include|import|pragma|line|define|undef|if|ifdef|else|elif|ifndef)\\b", + next : "directive" + }, { + token : "keyword", // special case pre-compiler directive + regex : "(?:#\\s*endif)\\b" + }, { + token : "support.function.C99.c", + regex : cFunctions + }, { + token : keywordMapper, + regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" + }, { + token : "keyword.operator", + regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)" + }, { + token : "punctuation.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 + regex : ".+" + } + ], + "qqstring" : [ + { + token : "string", + regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"', + next : "start" + }, { + token : "string", + regex : '.+' + } + ], + "qstring" : [ + { + token : "string", + regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'", + next : "start" + }, { + token : "string", + regex : '.+' + } + ], + "directive" : [ + { + token : "constant.other.multiline", + regex : /\\/ + }, + { + token : "constant.other.multiline", + regex : /.*\\/ + }, + { + token : "constant.other", + regex : "\\s*<.+?>", + next : "start" + }, + { + token : "constant.other", // single line + regex : '\\s*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]', + next : "start" + }, + { + token : "constant.other", // single line + regex : "\\s*['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']", + next : "start" + }, + // "\" implies multiline, while "/" implies comment + { + token : "constant.other", + regex : /[^\\\/]+/, + next : "start" + } + ] + }; + + this.embedRules(DocCommentHighlightRules, "doc-", + [ DocCommentHighlightRules.getEndRule("start") ]); +}; + +oop.inherits(c_cppHighlightRules, TextHighlightRules); + +exports.c_cppHighlightRules = c_cppHighlightRules; +}); diff --git a/addons/editor/ace/mode/clojure.js b/addons/editor/ace/mode/clojure.js new file mode 100755 index 00000000..71f842e7 --- /dev/null +++ b/addons/editor/ace/mode/clojure.js @@ -0,0 +1,86 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextMode = require("./text").Mode; +var Tokenizer = require("../tokenizer").Tokenizer; +var ClojureHighlightRules = require("./clojure_highlight_rules").ClojureHighlightRules; +var MatchingParensOutdent = require("./matching_parens_outdent").MatchingParensOutdent; +var Range = require("../range").Range; + +var Mode = function() { + this.HighlightRules = ClojureHighlightRules; + this.$outdent = new MatchingParensOutdent(); +}; +oop.inherits(Mode, TextMode); + +(function() { + + this.lineCommentStart = ";"; + + this.getNextLineIndent = function(state, line, tab) { + var indent = this.$getIndent(line); + + var tokenizedLine = this.getTokenizer().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(/[\(\[]/); + if (match) { + indent += " "; + } + match = line.match(/[\)]/); + if (match) { + indent = ""; + } + } + + 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; +}); diff --git a/addons/editor/ace/mode-clojure.js b/addons/editor/ace/mode/clojure_highlight_rules.js old mode 100644 new mode 100755 similarity index 77% rename from addons/editor/ace/mode-clojure.js rename to addons/editor/ace/mode/clojure_highlight_rules.js index b84e410b..f7e28d87 --- a/addons/editor/ace/mode-clojure.js +++ b/addons/editor/ace/mode/clojure_highlight_rules.js @@ -28,65 +28,8 @@ * * ***** END LICENSE BLOCK ***** */ -define('ace/mode/clojure', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/clojure_highlight_rules', 'ace/mode/matching_parens_outdent', 'ace/range'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var ClojureHighlightRules = require("./clojure_highlight_rules").ClojureHighlightRules; -var MatchingParensOutdent = require("./matching_parens_outdent").MatchingParensOutdent; -var Range = require("../range").Range; - -var Mode = function() { - this.HighlightRules = ClojureHighlightRules; - this.$outdent = new MatchingParensOutdent(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = ";"; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().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(/[\(\[]/); - if (match) { - indent += " "; - } - match = line.match(/[\)]/); - if (match) { - indent = ""; - } - } - - 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; -}); - -define('ace/mode/clojure_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - +define(function(require, exports, module) { +"use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; @@ -178,6 +121,9 @@ var ClojureHighlightRules = function() { "support.function": builtinFunctions }, "identifier", false, " "); + // regexp must not have capturing parentheses. Use (?:) instead. + // regexps are ordered -> the first match is used + this.$rules = { "start" : [ { @@ -252,48 +198,3 @@ oop.inherits(ClojureHighlightRules, TextHighlightRules); exports.ClojureHighlightRules = ClojureHighlightRules; }); - -define('ace/mode/matching_parens_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -var Range = require("../range").Range; - -var MatchingParensOutdent = 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(MatchingParensOutdent.prototype); - -exports.MatchingParensOutdent = MatchingParensOutdent; -}); diff --git a/addons/editor/ace/mode/cobol.js b/addons/editor/ace/mode/cobol.js new file mode 100755 index 00000000..a705d9bd --- /dev/null +++ b/addons/editor/ace/mode/cobol.js @@ -0,0 +1,53 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextMode = require("./text").Mode; +var Tokenizer = require("../tokenizer").Tokenizer; +var CobolHighlightRules = require("./cobol_highlight_rules").CobolHighlightRules; +var Range = require("../range").Range; + +var Mode = function() { + this.HighlightRules = CobolHighlightRules; +}; +oop.inherits(Mode, TextMode); + +(function() { + + this.lineCommentStart = "*"; + +}).call(Mode.prototype); + +exports.Mode = Mode; + +}); diff --git a/addons/editor/ace/mode-cobol.js b/addons/editor/ace/mode/cobol_highlight_rules.js old mode 100644 new mode 100755 similarity index 84% rename from addons/editor/ace/mode-cobol.js rename to addons/editor/ace/mode/cobol_highlight_rules.js index 316f9fe6..36335c93 --- a/addons/editor/ace/mode-cobol.js +++ b/addons/editor/ace/mode/cobol_highlight_rules.js @@ -28,32 +28,8 @@ * * ***** END LICENSE BLOCK ***** */ -define('ace/mode/cobol', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/cobol_highlight_rules', 'ace/range'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var Tokenizer = require("../tokenizer").Tokenizer; -var CobolHighlightRules = require("./cobol_highlight_rules").CobolHighlightRules; -var Range = require("../range").Range; - -var Mode = function() { - this.HighlightRules = CobolHighlightRules; -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "*"; - -}).call(Mode.prototype); - -exports.Mode = Mode; - -}); - -define('ace/mode/cobol_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - +define(function(require, exports, module) { +"use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; diff --git a/addons/editor/ace/mode/coffee.js b/addons/editor/ace/mode/coffee.js new file mode 100755 index 00000000..72ed0960 --- /dev/null +++ b/addons/editor/ace/mode/coffee.js @@ -0,0 +1,114 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var Tokenizer = require("../tokenizer").Tokenizer; +var Rules = require("./coffee_highlight_rules").CoffeeHighlightRules; +var Outdent = require("./matching_brace_outdent").MatchingBraceOutdent; +var FoldMode = require("./folding/coffee").FoldMode; +var Range = require("../range").Range; +var TextMode = require("./text").Mode; +var WorkerClient = require("../worker/worker_client").WorkerClient; +var oop = require("../lib/oop"); + +function Mode() { + this.HighlightRules = Rules; + this.$outdent = new Outdent(); + this.foldingRules = new FoldMode(); +} + +oop.inherits(Mode, TextMode); + +(function() { + + var indenter = /(?:[({[=:]|[-=]>|\b(?:else|switch|try|catch(?:\s*[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)?|finally))\s*$/; + var commentLine = /^(\s*)#/; + var hereComment = /^\s*###(?!#)/; + var indentation = /^\s*/; + + this.getNextLineIndent = function(state, line, tab) { + var indent = this.$getIndent(line); + var tokens = this.getTokenizer().getLineTokens(line, state).tokens; + + if (!(tokens.length && tokens[tokens.length - 1].type === 'comment') && + state === 'start' && indenter.test(line)) + indent += tab; + return indent; + }; + + this.toggleCommentLines = function(state, doc, startRow, endRow){ + console.log("toggle"); + var range = new Range(0, 0, 0, 0); + for (var i = startRow; i <= endRow; ++i) { + var line = doc.getLine(i); + if (hereComment.test(line)) + continue; + + if (commentLine.test(line)) + line = line.replace(commentLine, '$1'); + else + line = line.replace(indentation, '$&#'); + + range.end.row = range.start.row = i; + range.end.column = line.length + 1; + doc.replace(range, line); + } + }; + + this.checkOutdent = function(state, line, input) { + return this.$outdent.checkOutdent(line, input); + }; + + this.autoOutdent = function(state, doc, row) { + this.$outdent.autoOutdent(doc, row); + }; + + this.createWorker = function(session) { + var worker = new WorkerClient(["ace"], "ace/mode/coffee_worker", "Worker"); + worker.attachToDocument(session.getDocument()); + + worker.on("error", function(e) { + session.setAnnotations([e.data]); + }); + + worker.on("ok", function(e) { + session.clearAnnotations(); + }); + + return worker; + }; + +}).call(Mode.prototype); + +exports.Mode = Mode; + +}); diff --git a/addons/editor/ace/mode/coffee/coffee-script.js b/addons/editor/ace/mode/coffee/coffee-script.js new file mode 100755 index 00000000..9e9719f7 --- /dev/null +++ b/addons/editor/ace/mode/coffee/coffee-script.js @@ -0,0 +1,62 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { + + var Lexer = require("./lexer").Lexer; + var parser = require("./parser"); + + var lexer = new Lexer(); + parser.lexer = { + lex: function() { + var tag, token; + token = this.tokens[this.pos++]; + if (token) { + tag = token[0], this.yytext = token[1], this.yylloc = token[2]; + this.yylineno = this.yylloc.first_line; + } else { + tag = ''; + } + return tag; + }, + setInput: function(tokens) { + this.tokens = tokens; + return this.pos = 0; + }, + upcomingInput: function() { + return ""; + } + }; + parser.yy = require('./nodes'); + + exports.parse = function(code) { + return parser.parse(lexer.tokenize(code)); + }; +}); diff --git a/addons/editor/ace/mode/coffee/helpers.js b/addons/editor/ace/mode/coffee/helpers.js new file mode 100755 index 00000000..fe73f2b7 --- /dev/null +++ b/addons/editor/ace/mode/coffee/helpers.js @@ -0,0 +1,271 @@ +/** + * Copyright (c) 2009-2013 Jeremy Ashkenas + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + */ + +define(function(require, exports, module) { +// Generated by CoffeeScript 1.6.3 + + var buildLocationData, extend, flatten, last, repeat, syntaxErrorToString, _ref; + + exports.starts = function(string, literal, start) { + return literal === string.substr(start, literal.length); + }; + + exports.ends = function(string, literal, back) { + var len; + len = literal.length; + return literal === string.substr(string.length - len - (back || 0), len); + }; + + exports.repeat = repeat = function(str, n) { + var res; + res = ''; + while (n > 0) { + if (n & 1) { + res += str; + } + n >>>= 1; + str += str; + } + return res; + }; + + exports.compact = function(array) { + var item, _i, _len, _results; + _results = []; + for (_i = 0, _len = array.length; _i < _len; _i++) { + item = array[_i]; + if (item) { + _results.push(item); + } + } + return _results; + }; + + exports.count = function(string, substr) { + var num, pos; + num = pos = 0; + if (!substr.length) { + return 1 / 0; + } + while (pos = 1 + string.indexOf(substr, pos)) { + num++; + } + return num; + }; + + exports.merge = function(options, overrides) { + return extend(extend({}, options), overrides); + }; + + extend = exports.extend = function(object, properties) { + var key, val; + for (key in properties) { + val = properties[key]; + object[key] = val; + } + return object; + }; + + exports.flatten = flatten = function(array) { + var element, flattened, _i, _len; + flattened = []; + for (_i = 0, _len = array.length; _i < _len; _i++) { + element = array[_i]; + if (element instanceof Array) { + flattened = flattened.concat(flatten(element)); + } else { + flattened.push(element); + } + } + return flattened; + }; + + exports.del = function(obj, key) { + var val; + val = obj[key]; + delete obj[key]; + return val; + }; + + exports.last = last = function(array, back) { + return array[array.length - (back || 0) - 1]; + }; + + exports.some = (_ref = Array.prototype.some) != null ? _ref : function(fn) { + var e, _i, _len; + for (_i = 0, _len = this.length; _i < _len; _i++) { + e = this[_i]; + if (fn(e)) { + return true; + } + } + return false; + }; + + exports.invertLiterate = function(code) { + var line, lines, maybe_code; + maybe_code = true; + lines = (function() { + var _i, _len, _ref1, _results; + _ref1 = code.split('\n'); + _results = []; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + line = _ref1[_i]; + if (maybe_code && /^([ ]{4}|[ ]{0,3}\t)/.test(line)) { + _results.push(line); + } else if (maybe_code = /^\s*$/.test(line)) { + _results.push(line); + } else { + _results.push('# ' + line); + } + } + return _results; + })(); + return lines.join('\n'); + }; + + buildLocationData = function(first, last) { + if (!last) { + return first; + } else { + return { + first_line: first.first_line, + first_column: first.first_column, + last_line: last.last_line, + last_column: last.last_column + }; + } + }; + + exports.addLocationDataFn = function(first, last) { + return function(obj) { + if (((typeof obj) === 'object') && (!!obj['updateLocationDataIfMissing'])) { + obj.updateLocationDataIfMissing(buildLocationData(first, last)); + } + return obj; + }; + }; + + exports.locationDataToString = function(obj) { + var locationData; + if (("2" in obj) && ("first_line" in obj[2])) { + locationData = obj[2]; + } else if ("first_line" in obj) { + locationData = obj; + } + if (locationData) { + return ("" + (locationData.first_line + 1) + ":" + (locationData.first_column + 1) + "-") + ("" + (locationData.last_line + 1) + ":" + (locationData.last_column + 1)); + } else { + return "No location data"; + } + }; + + exports.baseFileName = function(file, stripExt, useWinPathSep) { + var parts, pathSep; + if (stripExt == null) { + stripExt = false; + } + if (useWinPathSep == null) { + useWinPathSep = false; + } + pathSep = useWinPathSep ? /\\|\// : /\//; + parts = file.split(pathSep); + file = parts[parts.length - 1]; + if (!stripExt) { + return file; + } + parts = file.split('.'); + parts.pop(); + if (parts[parts.length - 1] === 'coffee' && parts.length > 1) { + parts.pop(); + } + return parts.join('.'); + }; + + exports.isCoffee = function(file) { + return /\.((lit)?coffee|coffee\.md)$/.test(file); + }; + + exports.isLiterate = function(file) { + return /\.(litcoffee|coffee\.md)$/.test(file); + }; + + exports.throwSyntaxError = function(message, location) { + var error; + if (location.last_line == null) { + location.last_line = location.first_line; + } + if (location.last_column == null) { + location.last_column = location.first_column; + } + error = new SyntaxError(message); + error.location = location; + error.toString = syntaxErrorToString; + error.stack = error.toString(); + throw error; + }; + + exports.updateSyntaxError = function(error, code, filename) { + if (error.toString === syntaxErrorToString) { + error.code || (error.code = code); + error.filename || (error.filename = filename); + error.stack = error.toString(); + } + return error; + }; + + syntaxErrorToString = function() { + var codeLine, colorize, colorsEnabled, end, filename, first_column, first_line, last_column, last_line, marker, start, _ref1, _ref2; + if (!(this.code && this.location)) { + return Error.prototype.toString.call(this); + } + _ref1 = this.location, first_line = _ref1.first_line, first_column = _ref1.first_column, last_line = _ref1.last_line, last_column = _ref1.last_column; + if (last_line == null) { + last_line = first_line; + } + if (last_column == null) { + last_column = first_column; + } + filename = this.filename || '[stdin]'; + codeLine = this.code.split('\n')[first_line]; + start = first_column; + end = first_line === last_line ? last_column + 1 : codeLine.length; + marker = repeat(' ', start) + repeat('^', end - start); + if (typeof process !== "undefined" && process !== null) { + colorsEnabled = process.stdout.isTTY && !process.env.NODE_DISABLE_COLORS; + } + if ((_ref2 = this.colorful) != null ? _ref2 : colorsEnabled) { + colorize = function(str) { + return "\x1B[1;31m" + str + "\x1B[0m"; + }; + codeLine = codeLine.slice(0, start) + colorize(codeLine.slice(start, end)) + codeLine.slice(end); + marker = colorize(marker); + } + return "" + filename + ":" + (first_line + 1) + ":" + (first_column + 1) + ": error: " + this.message + "\n" + codeLine + "\n" + marker; + }; + + +}); \ No newline at end of file diff --git a/addons/editor/ace/mode/coffee/lexer.js b/addons/editor/ace/mode/coffee/lexer.js new file mode 100755 index 00000000..ed02bfe0 --- /dev/null +++ b/addons/editor/ace/mode/coffee/lexer.js @@ -0,0 +1,929 @@ +/** + * Copyright (c) 2009-2013 Jeremy Ashkenas + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + */ + +define(function(require, exports, module) { +// Generated by CoffeeScript 1.6.3 + + var BOM, BOOL, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_ALIAS_MAP, COFFEE_KEYWORDS, COMMENT, COMPARE, COMPOUND_ASSIGN, HEREDOC, HEREDOC_ILLEGAL, HEREDOC_INDENT, HEREGEX, HEREGEX_OMIT, IDENTIFIER, INDEXABLE, INVERSES, JSTOKEN, JS_FORBIDDEN, JS_KEYWORDS, LINE_BREAK, LINE_CONTINUER, LOGIC, Lexer, MATH, MULTILINER, MULTI_DENT, NOT_REGEX, NOT_SPACED_REGEX, NUMBER, OPERATOR, REGEX, RELATION, RESERVED, Rewriter, SHIFT, SIMPLESTR, STRICT_PROSCRIBED, TRAILING_SPACES, UNARY, WHITESPACE, compact, count, invertLiterate, key, last, locationDataToString, repeat, starts, throwSyntaxError, _ref, _ref1, + __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; + + _ref = require('./rewriter'), Rewriter = _ref.Rewriter, INVERSES = _ref.INVERSES; + + _ref1 = require('./helpers'), count = _ref1.count, starts = _ref1.starts, compact = _ref1.compact, last = _ref1.last, repeat = _ref1.repeat, invertLiterate = _ref1.invertLiterate, locationDataToString = _ref1.locationDataToString, throwSyntaxError = _ref1.throwSyntaxError; + + exports.Lexer = Lexer = (function() { + function Lexer() {} + + Lexer.prototype.tokenize = function(code, opts) { + var consumed, i, tag, _ref2; + if (opts == null) { + opts = {}; + } + this.literate = opts.literate; + this.indent = 0; + this.baseIndent = 0; + this.indebt = 0; + this.outdebt = 0; + this.indents = []; + this.ends = []; + this.tokens = []; + this.chunkLine = opts.line || 0; + this.chunkColumn = opts.column || 0; + code = this.clean(code); + i = 0; + while (this.chunk = code.slice(i)) { + consumed = this.identifierToken() || this.commentToken() || this.whitespaceToken() || this.lineToken() || this.heredocToken() || this.stringToken() || this.numberToken() || this.regexToken() || this.jsToken() || this.literalToken(); + _ref2 = this.getLineAndColumnFromChunk(consumed), this.chunkLine = _ref2[0], this.chunkColumn = _ref2[1]; + i += consumed; + } + this.closeIndentation(); + if (tag = this.ends.pop()) { + this.error("missing " + tag); + } + if (opts.rewrite === false) { + return this.tokens; + } + return (new Rewriter).rewrite(this.tokens); + }; + + Lexer.prototype.clean = function(code) { + if (code.charCodeAt(0) === BOM) { + code = code.slice(1); + } + code = code.replace(/\r/g, '').replace(TRAILING_SPACES, ''); + if (WHITESPACE.test(code)) { + code = "\n" + code; + this.chunkLine--; + } + if (this.literate) { + code = invertLiterate(code); + } + return code; + }; + + Lexer.prototype.identifierToken = function() { + var colon, colonOffset, forcedIdentifier, id, idLength, input, match, poppedToken, prev, tag, tagToken, _ref2, _ref3, _ref4; + if (!(match = IDENTIFIER.exec(this.chunk))) { + return 0; + } + input = match[0], id = match[1], colon = match[2]; + idLength = id.length; + poppedToken = void 0; + if (id === 'own' && this.tag() === 'FOR') { + this.token('OWN', id); + return id.length; + } + forcedIdentifier = colon || (prev = last(this.tokens)) && (((_ref2 = prev[0]) === '.' || _ref2 === '?.' || _ref2 === '::' || _ref2 === '?::') || !prev.spaced && prev[0] === '@'); + tag = 'IDENTIFIER'; + if (!forcedIdentifier && (__indexOf.call(JS_KEYWORDS, id) >= 0 || __indexOf.call(COFFEE_KEYWORDS, id) >= 0)) { + tag = id.toUpperCase(); + if (tag === 'WHEN' && (_ref3 = this.tag(), __indexOf.call(LINE_BREAK, _ref3) >= 0)) { + tag = 'LEADING_WHEN'; + } else if (tag === 'FOR') { + this.seenFor = true; + } else if (tag === 'UNLESS') { + tag = 'IF'; + } else if (__indexOf.call(UNARY, tag) >= 0) { + tag = 'UNARY'; + } else if (__indexOf.call(RELATION, tag) >= 0) { + if (tag !== 'INSTANCEOF' && this.seenFor) { + tag = 'FOR' + tag; + this.seenFor = false; + } else { + tag = 'RELATION'; + if (this.value() === '!') { + poppedToken = this.tokens.pop(); + id = '!' + id; + } + } + } + } + if (__indexOf.call(JS_FORBIDDEN, id) >= 0) { + if (forcedIdentifier) { + tag = 'IDENTIFIER'; + id = new String(id); + id.reserved = true; + } else if (__indexOf.call(RESERVED, id) >= 0) { + this.error("reserved word \"" + id + "\""); + } + } + if (!forcedIdentifier) { + if (__indexOf.call(COFFEE_ALIASES, id) >= 0) { + id = COFFEE_ALIAS_MAP[id]; + } + tag = (function() { + switch (id) { + case '!': + return 'UNARY'; + case '==': + case '!=': + return 'COMPARE'; + case '&&': + case '||': + return 'LOGIC'; + case 'true': + case 'false': + return 'BOOL'; + case 'break': + case 'continue': + return 'STATEMENT'; + default: + return tag; + } + })(); + } + tagToken = this.token(tag, id, 0, idLength); + if (poppedToken) { + _ref4 = [poppedToken[2].first_line, poppedToken[2].first_column], tagToken[2].first_line = _ref4[0], tagToken[2].first_column = _ref4[1]; + } + if (colon) { + colonOffset = input.lastIndexOf(':'); + this.token(':', ':', colonOffset, colon.length); + } + return input.length; + }; + + Lexer.prototype.numberToken = function() { + var binaryLiteral, lexedLength, match, number, octalLiteral; + if (!(match = NUMBER.exec(this.chunk))) { + return 0; + } + number = match[0]; + if (/^0[BOX]/.test(number)) { + this.error("radix prefix '" + number + "' must be lowercase"); + } else if (/E/.test(number) && !/^0x/.test(number)) { + this.error("exponential notation '" + number + "' must be indicated with a lowercase 'e'"); + } else if (/^0\d*[89]/.test(number)) { + this.error("decimal literal '" + number + "' must not be prefixed with '0'"); + } else if (/^0\d+/.test(number)) { + this.error("octal literal '" + number + "' must be prefixed with '0o'"); + } + lexedLength = number.length; + if (octalLiteral = /^0o([0-7]+)/.exec(number)) { + number = '0x' + parseInt(octalLiteral[1], 8).toString(16); + } + if (binaryLiteral = /^0b([01]+)/.exec(number)) { + number = '0x' + parseInt(binaryLiteral[1], 2).toString(16); + } + this.token('NUMBER', number, 0, lexedLength); + return lexedLength; + }; + + Lexer.prototype.stringToken = function() { + var match, octalEsc, string; + switch (this.chunk.charAt(0)) { + case "'": + if (!(match = SIMPLESTR.exec(this.chunk))) { + return 0; + } + string = match[0]; + this.token('STRING', string.replace(MULTILINER, '\\\n'), 0, string.length); + break; + case '"': + if (!(string = this.balancedString(this.chunk, '"'))) { + return 0; + } + if (0 < string.indexOf('#{', 1)) { + this.interpolateString(string.slice(1, -1), { + strOffset: 1, + lexedLength: string.length + }); + } else { + this.token('STRING', this.escapeLines(string, 0, string.length)); + } + break; + default: + return 0; + } + if (octalEsc = /^(?:\\.|[^\\])*\\(?:0[0-7]|[1-7])/.test(string)) { + this.error("octal escape sequences " + string + " are not allowed"); + } + return string.length; + }; + + Lexer.prototype.heredocToken = function() { + var doc, heredoc, match, quote; + if (!(match = HEREDOC.exec(this.chunk))) { + return 0; + } + heredoc = match[0]; + quote = heredoc.charAt(0); + doc = this.sanitizeHeredoc(match[2], { + quote: quote, + indent: null + }); + if (quote === '"' && 0 <= doc.indexOf('#{')) { + this.interpolateString(doc, { + heredoc: true, + strOffset: 3, + lexedLength: heredoc.length + }); + } else { + this.token('STRING', this.makeString(doc, quote, true), 0, heredoc.length); + } + return heredoc.length; + }; + + Lexer.prototype.commentToken = function() { + var comment, here, match; + if (!(match = this.chunk.match(COMMENT))) { + return 0; + } + comment = match[0], here = match[1]; + if (here) { + this.token('HERECOMMENT', this.sanitizeHeredoc(here, { + herecomment: true, + indent: repeat(' ', this.indent) + }), 0, comment.length); + } + return comment.length; + }; + + Lexer.prototype.jsToken = function() { + var match, script; + if (!(this.chunk.charAt(0) === '`' && (match = JSTOKEN.exec(this.chunk)))) { + return 0; + } + this.token('JS', (script = match[0]).slice(1, -1), 0, script.length); + return script.length; + }; + + Lexer.prototype.regexToken = function() { + var flags, length, match, prev, regex, _ref2, _ref3; + if (this.chunk.charAt(0) !== '/') { + return 0; + } + if (match = HEREGEX.exec(this.chunk)) { + length = this.heregexToken(match); + return length; + } + prev = last(this.tokens); + if (prev && (_ref2 = prev[0], __indexOf.call((prev.spaced ? NOT_REGEX : NOT_SPACED_REGEX), _ref2) >= 0)) { + return 0; + } + if (!(match = REGEX.exec(this.chunk))) { + return 0; + } + _ref3 = match, match = _ref3[0], regex = _ref3[1], flags = _ref3[2]; + if (regex.slice(0, 2) === '/*') { + this.error('regular expressions cannot begin with `*`'); + } + if (regex === '//') { + regex = '/(?:)/'; + } + this.token('REGEX', "" + regex + flags, 0, match.length); + return match.length; + }; + + Lexer.prototype.heregexToken = function(match) { + var body, flags, flagsOffset, heregex, plusToken, prev, re, tag, token, tokens, value, _i, _len, _ref2, _ref3, _ref4; + heregex = match[0], body = match[1], flags = match[2]; + if (0 > body.indexOf('#{')) { + re = body.replace(HEREGEX_OMIT, '').replace(/\//g, '\\/'); + if (re.match(/^\*/)) { + this.error('regular expressions cannot begin with `*`'); + } + this.token('REGEX', "/" + (re || '(?:)') + "/" + flags, 0, heregex.length); + return heregex.length; + } + this.token('IDENTIFIER', 'RegExp', 0, 0); + this.token('CALL_START', '(', 0, 0); + tokens = []; + _ref2 = this.interpolateString(body, { + regex: true + }); + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + token = _ref2[_i]; + tag = token[0], value = token[1]; + if (tag === 'TOKENS') { + tokens.push.apply(tokens, value); + } else if (tag === 'NEOSTRING') { + if (!(value = value.replace(HEREGEX_OMIT, ''))) { + continue; + } + value = value.replace(/\\/g, '\\\\'); + token[0] = 'STRING'; + token[1] = this.makeString(value, '"', true); + tokens.push(token); + } else { + this.error("Unexpected " + tag); + } + prev = last(this.tokens); + plusToken = ['+', '+']; + plusToken[2] = prev[2]; + tokens.push(plusToken); + } + tokens.pop(); + if (((_ref3 = tokens[0]) != null ? _ref3[0] : void 0) !== 'STRING') { + this.token('STRING', '""', 0, 0); + this.token('+', '+', 0, 0); + } + (_ref4 = this.tokens).push.apply(_ref4, tokens); + if (flags) { + flagsOffset = heregex.lastIndexOf(flags); + this.token(',', ',', flagsOffset, 0); + this.token('STRING', '"' + flags + '"', flagsOffset, flags.length); + } + this.token(')', ')', heregex.length - 1, 0); + return heregex.length; + }; + + Lexer.prototype.lineToken = function() { + var diff, indent, match, noNewlines, size; + if (!(match = MULTI_DENT.exec(this.chunk))) { + return 0; + } + indent = match[0]; + this.seenFor = false; + size = indent.length - 1 - indent.lastIndexOf('\n'); + noNewlines = this.unfinished(); + if (size - this.indebt === this.indent) { + if (noNewlines) { + this.suppressNewlines(); + } else { + this.newlineToken(0); + } + return indent.length; + } + if (size > this.indent) { + if (noNewlines) { + this.indebt = size - this.indent; + this.suppressNewlines(); + return indent.length; + } + if (!this.tokens.length) { + this.baseIndent = this.indent = size; + return indent.length; + } + diff = size - this.indent + this.outdebt; + this.token('INDENT', diff, indent.length - size, size); + this.indents.push(diff); + this.ends.push('OUTDENT'); + this.outdebt = this.indebt = 0; + } else if (size < this.baseIndent) { + this.error('missing indentation', indent.length); + } else { + this.indebt = 0; + this.outdentToken(this.indent - size, noNewlines, indent.length); + } + this.indent = size; + return indent.length; + }; + + Lexer.prototype.outdentToken = function(moveOut, noNewlines, outdentLength) { + var dent, len; + while (moveOut > 0) { + len = this.indents.length - 1; + if (this.indents[len] === void 0) { + moveOut = 0; + } else if (this.indents[len] === this.outdebt) { + moveOut -= this.outdebt; + this.outdebt = 0; + } else if (this.indents[len] < this.outdebt) { + this.outdebt -= this.indents[len]; + moveOut -= this.indents[len]; + } else { + dent = this.indents.pop() + this.outdebt; + moveOut -= dent; + this.outdebt = 0; + this.pair('OUTDENT'); + this.token('OUTDENT', dent, 0, outdentLength); + } + } + if (dent) { + this.outdebt -= moveOut; + } + while (this.value() === ';') { + this.tokens.pop(); + } + if (!(this.tag() === 'TERMINATOR' || noNewlines)) { + this.token('TERMINATOR', '\n', outdentLength, 0); + } + return this; + }; + + Lexer.prototype.whitespaceToken = function() { + var match, nline, prev; + if (!((match = WHITESPACE.exec(this.chunk)) || (nline = this.chunk.charAt(0) === '\n'))) { + return 0; + } + prev = last(this.tokens); + if (prev) { + prev[match ? 'spaced' : 'newLine'] = true; + } + if (match) { + return match[0].length; + } else { + return 0; + } + }; + + Lexer.prototype.newlineToken = function(offset) { + while (this.value() === ';') { + this.tokens.pop(); + } + if (this.tag() !== 'TERMINATOR') { + this.token('TERMINATOR', '\n', offset, 0); + } + return this; + }; + + Lexer.prototype.suppressNewlines = function() { + if (this.value() === '\\') { + this.tokens.pop(); + } + return this; + }; + + Lexer.prototype.literalToken = function() { + var match, prev, tag, value, _ref2, _ref3, _ref4, _ref5; + if (match = OPERATOR.exec(this.chunk)) { + value = match[0]; + if (CODE.test(value)) { + this.tagParameters(); + } + } else { + value = this.chunk.charAt(0); + } + tag = value; + prev = last(this.tokens); + if (value === '=' && prev) { + if (!prev[1].reserved && (_ref2 = prev[1], __indexOf.call(JS_FORBIDDEN, _ref2) >= 0)) { + this.error("reserved word \"" + (this.value()) + "\" can't be assigned"); + } + if ((_ref3 = prev[1]) === '||' || _ref3 === '&&') { + prev[0] = 'COMPOUND_ASSIGN'; + prev[1] += '='; + return value.length; + } + } + if (value === ';') { + this.seenFor = false; + tag = 'TERMINATOR'; + } else if (__indexOf.call(MATH, value) >= 0) { + tag = 'MATH'; + } else if (__indexOf.call(COMPARE, value) >= 0) { + tag = 'COMPARE'; + } else if (__indexOf.call(COMPOUND_ASSIGN, value) >= 0) { + tag = 'COMPOUND_ASSIGN'; + } else if (__indexOf.call(UNARY, value) >= 0) { + tag = 'UNARY'; + } else if (__indexOf.call(SHIFT, value) >= 0) { + tag = 'SHIFT'; + } else if (__indexOf.call(LOGIC, value) >= 0 || value === '?' && (prev != null ? prev.spaced : void 0)) { + tag = 'LOGIC'; + } else if (prev && !prev.spaced) { + if (value === '(' && (_ref4 = prev[0], __indexOf.call(CALLABLE, _ref4) >= 0)) { + if (prev[0] === '?') { + prev[0] = 'FUNC_EXIST'; + } + tag = 'CALL_START'; + } else if (value === '[' && (_ref5 = prev[0], __indexOf.call(INDEXABLE, _ref5) >= 0)) { + tag = 'INDEX_START'; + switch (prev[0]) { + case '?': + prev[0] = 'INDEX_SOAK'; + } + } + } + switch (value) { + case '(': + case '{': + case '[': + this.ends.push(INVERSES[value]); + break; + case ')': + case '}': + case ']': + this.pair(value); + } + this.token(tag, value); + return value.length; + }; + + Lexer.prototype.sanitizeHeredoc = function(doc, options) { + var attempt, herecomment, indent, match, _ref2; + indent = options.indent, herecomment = options.herecomment; + if (herecomment) { + if (HEREDOC_ILLEGAL.test(doc)) { + this.error("block comment cannot contain \"*/\", starting"); + } + if (doc.indexOf('\n') < 0) { + return doc; + } + } else { + while (match = HEREDOC_INDENT.exec(doc)) { + attempt = match[1]; + if (indent === null || (0 < (_ref2 = attempt.length) && _ref2 < indent.length)) { + indent = attempt; + } + } + } + if (indent) { + doc = doc.replace(RegExp("\\n" + indent, "g"), '\n'); + } + if (!herecomment) { + doc = doc.replace(/^\n/, ''); + } + return doc; + }; + + Lexer.prototype.tagParameters = function() { + var i, stack, tok, tokens; + if (this.tag() !== ')') { + return this; + } + stack = []; + tokens = this.tokens; + i = tokens.length; + tokens[--i][0] = 'PARAM_END'; + while (tok = tokens[--i]) { + switch (tok[0]) { + case ')': + stack.push(tok); + break; + case '(': + case 'CALL_START': + if (stack.length) { + stack.pop(); + } else if (tok[0] === '(') { + tok[0] = 'PARAM_START'; + return this; + } else { + return this; + } + } + } + return this; + }; + + Lexer.prototype.closeIndentation = function() { + return this.outdentToken(this.indent); + }; + + Lexer.prototype.balancedString = function(str, end) { + var continueCount, i, letter, match, prev, stack, _i, _ref2; + continueCount = 0; + stack = [end]; + for (i = _i = 1, _ref2 = str.length; 1 <= _ref2 ? _i < _ref2 : _i > _ref2; i = 1 <= _ref2 ? ++_i : --_i) { + if (continueCount) { + --continueCount; + continue; + } + switch (letter = str.charAt(i)) { + case '\\': + ++continueCount; + continue; + case end: + stack.pop(); + if (!stack.length) { + return str.slice(0, +i + 1 || 9e9); + } + end = stack[stack.length - 1]; + continue; + } + if (end === '}' && (letter === '"' || letter === "'")) { + stack.push(end = letter); + } else if (end === '}' && letter === '/' && (match = HEREGEX.exec(str.slice(i)) || REGEX.exec(str.slice(i)))) { + continueCount += match[0].length - 1; + } else if (end === '}' && letter === '{') { + stack.push(end = '}'); + } else if (end === '"' && prev === '#' && letter === '{') { + stack.push(end = '}'); + } + prev = letter; + } + return this.error("missing " + (stack.pop()) + ", starting"); + }; + + Lexer.prototype.interpolateString = function(str, options) { + var column, expr, heredoc, i, inner, interpolated, len, letter, lexedLength, line, locationToken, nested, offsetInChunk, pi, plusToken, popped, regex, rparen, strOffset, tag, token, tokens, value, _i, _len, _ref2, _ref3, _ref4; + if (options == null) { + options = {}; + } + heredoc = options.heredoc, regex = options.regex, offsetInChunk = options.offsetInChunk, strOffset = options.strOffset, lexedLength = options.lexedLength; + offsetInChunk = offsetInChunk || 0; + strOffset = strOffset || 0; + lexedLength = lexedLength || str.length; + if (heredoc && str.length > 0 && str[0] === '\n') { + str = str.slice(1); + strOffset++; + } + tokens = []; + pi = 0; + i = -1; + while (letter = str.charAt(i += 1)) { + if (letter === '\\') { + i += 1; + continue; + } + if (!(letter === '#' && str.charAt(i + 1) === '{' && (expr = this.balancedString(str.slice(i + 1), '}')))) { + continue; + } + if (pi < i) { + tokens.push(this.makeToken('NEOSTRING', str.slice(pi, i), strOffset + pi)); + } + inner = expr.slice(1, -1); + if (inner.length) { + _ref2 = this.getLineAndColumnFromChunk(strOffset + i + 1), line = _ref2[0], column = _ref2[1]; + nested = new Lexer().tokenize(inner, { + line: line, + column: column, + rewrite: false + }); + popped = nested.pop(); + if (((_ref3 = nested[0]) != null ? _ref3[0] : void 0) === 'TERMINATOR') { + popped = nested.shift(); + } + if (len = nested.length) { + if (len > 1) { + nested.unshift(this.makeToken('(', '(', strOffset + i + 1, 0)); + nested.push(this.makeToken(')', ')', strOffset + i + 1 + inner.length, 0)); + } + tokens.push(['TOKENS', nested]); + } + } + i += expr.length; + pi = i + 1; + } + if ((i > pi && pi < str.length)) { + tokens.push(this.makeToken('NEOSTRING', str.slice(pi), strOffset + pi)); + } + if (regex) { + return tokens; + } + if (!tokens.length) { + return this.token('STRING', '""', offsetInChunk, lexedLength); + } + if (tokens[0][0] !== 'NEOSTRING') { + tokens.unshift(this.makeToken('NEOSTRING', '', offsetInChunk)); + } + if (interpolated = tokens.length > 1) { + this.token('(', '(', offsetInChunk, 0); + } + for (i = _i = 0, _len = tokens.length; _i < _len; i = ++_i) { + token = tokens[i]; + tag = token[0], value = token[1]; + if (i) { + if (i) { + plusToken = this.token('+', '+'); + } + locationToken = tag === 'TOKENS' ? value[0] : token; + plusToken[2] = { + first_line: locationToken[2].first_line, + first_column: locationToken[2].first_column, + last_line: locationToken[2].first_line, + last_column: locationToken[2].first_column + }; + } + if (tag === 'TOKENS') { + (_ref4 = this.tokens).push.apply(_ref4, value); + } else if (tag === 'NEOSTRING') { + token[0] = 'STRING'; + token[1] = this.makeString(value, '"', heredoc); + this.tokens.push(token); + } else { + this.error("Unexpected " + tag); + } + } + if (interpolated) { + rparen = this.makeToken(')', ')', offsetInChunk + lexedLength, 0); + rparen.stringEnd = true; + this.tokens.push(rparen); + } + return tokens; + }; + + Lexer.prototype.pair = function(tag) { + var size, wanted; + if (tag !== (wanted = last(this.ends))) { + if ('OUTDENT' !== wanted) { + this.error("unmatched " + tag); + } + this.indent -= size = last(this.indents); + this.outdentToken(size, true); + return this.pair(tag); + } + return this.ends.pop(); + }; + + Lexer.prototype.getLineAndColumnFromChunk = function(offset) { + var column, lineCount, lines, string; + if (offset === 0) { + return [this.chunkLine, this.chunkColumn]; + } + if (offset >= this.chunk.length) { + string = this.chunk; + } else { + string = this.chunk.slice(0, +(offset - 1) + 1 || 9e9); + } + lineCount = count(string, '\n'); + column = this.chunkColumn; + if (lineCount > 0) { + lines = string.split('\n'); + column = last(lines).length; + } else { + column += string.length; + } + return [this.chunkLine + lineCount, column]; + }; + + Lexer.prototype.makeToken = function(tag, value, offsetInChunk, length) { + var lastCharacter, locationData, token, _ref2, _ref3; + if (offsetInChunk == null) { + offsetInChunk = 0; + } + if (length == null) { + length = value.length; + } + locationData = {}; + _ref2 = this.getLineAndColumnFromChunk(offsetInChunk), locationData.first_line = _ref2[0], locationData.first_column = _ref2[1]; + lastCharacter = Math.max(0, length - 1); + _ref3 = this.getLineAndColumnFromChunk(offsetInChunk + lastCharacter), locationData.last_line = _ref3[0], locationData.last_column = _ref3[1]; + token = [tag, value, locationData]; + return token; + }; + + Lexer.prototype.token = function(tag, value, offsetInChunk, length) { + var token; + token = this.makeToken(tag, value, offsetInChunk, length); + this.tokens.push(token); + return token; + }; + + Lexer.prototype.tag = function(index, tag) { + var tok; + return (tok = last(this.tokens, index)) && (tag ? tok[0] = tag : tok[0]); + }; + + Lexer.prototype.value = function(index, val) { + var tok; + return (tok = last(this.tokens, index)) && (val ? tok[1] = val : tok[1]); + }; + + Lexer.prototype.unfinished = function() { + var _ref2; + return LINE_CONTINUER.test(this.chunk) || ((_ref2 = this.tag()) === '\\' || _ref2 === '.' || _ref2 === '?.' || _ref2 === '?::' || _ref2 === 'UNARY' || _ref2 === 'MATH' || _ref2 === '+' || _ref2 === '-' || _ref2 === 'SHIFT' || _ref2 === 'RELATION' || _ref2 === 'COMPARE' || _ref2 === 'LOGIC' || _ref2 === 'THROW' || _ref2 === 'EXTENDS'); + }; + + Lexer.prototype.escapeLines = function(str, heredoc) { + return str.replace(MULTILINER, heredoc ? '\\n' : ''); + }; + + Lexer.prototype.makeString = function(body, quote, heredoc) { + if (!body) { + return quote + quote; + } + body = body.replace(/\\([\s\S])/g, function(match, contents) { + if (contents === '\n' || contents === quote) { + return contents; + } else { + return match; + } + }); + body = body.replace(RegExp("" + quote, "g"), '\\$&'); + return quote + this.escapeLines(body, heredoc) + quote; + }; + + Lexer.prototype.error = function(message, offset) { + var first_column, first_line, _ref2; + if (offset == null) { + offset = 0; + } + _ref2 = this.getLineAndColumnFromChunk(offset), first_line = _ref2[0], first_column = _ref2[1]; + return throwSyntaxError(message, { + first_line: first_line, + first_column: first_column + }); + }; + + return Lexer; + + })(); + + JS_KEYWORDS = ['true', 'false', 'null', 'this', 'new', 'delete', 'typeof', 'in', 'instanceof', 'return', 'throw', 'break', 'continue', 'debugger', 'if', 'else', 'switch', 'for', 'while', 'do', 'try', 'catch', 'finally', 'class', 'extends', 'super']; + + COFFEE_KEYWORDS = ['undefined', 'then', 'unless', 'until', 'loop', 'of', 'by', 'when']; + + COFFEE_ALIAS_MAP = { + and: '&&', + or: '||', + is: '==', + isnt: '!=', + not: '!', + yes: 'true', + no: 'false', + on: 'true', + off: 'false' + }; + + COFFEE_ALIASES = (function() { + var _results; + _results = []; + for (key in COFFEE_ALIAS_MAP) { + _results.push(key); + } + return _results; + })(); + + COFFEE_KEYWORDS = COFFEE_KEYWORDS.concat(COFFEE_ALIASES); + + RESERVED = ['case', 'default', 'function', 'var', 'void', 'with', 'const', 'let', 'enum', 'export', 'import', 'native', '__hasProp', '__extends', '__slice', '__bind', '__indexOf', 'implements', 'interface', 'package', 'private', 'protected', 'public', 'static', 'yield']; + + STRICT_PROSCRIBED = ['arguments', 'eval']; + + JS_FORBIDDEN = JS_KEYWORDS.concat(RESERVED).concat(STRICT_PROSCRIBED); + + exports.RESERVED = RESERVED.concat(JS_KEYWORDS).concat(COFFEE_KEYWORDS).concat(STRICT_PROSCRIBED); + + exports.STRICT_PROSCRIBED = STRICT_PROSCRIBED; + + BOM = 65279; + + IDENTIFIER = /^([$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)([^\n\S]*:(?!:))?/; + + NUMBER = /^0b[01]+|^0o[0-7]+|^0x[\da-f]+|^\d*\.?\d+(?:e[+-]?\d+)?/i; + + HEREDOC = /^("""|''')([\s\S]*?)(?:\n[^\n\S]*)?\1/; + + OPERATOR = /^(?:[-=]>|[-+*\/%<>&|^!?=]=|>>>=?|([-+:])\1|([&|<>])\2=?|\?(\.|::)|\.{2,3})/; + + WHITESPACE = /^[^\n\S]+/; + + COMMENT = /^###([^#][\s\S]*?)(?:###[^\n\S]*|(?:###)$)|^(?:\s*#(?!##[^#]).*)+/; + + CODE = /^[-=]>/; + + MULTI_DENT = /^(?:\n[^\n\S]*)+/; + + SIMPLESTR = /^'[^\\']*(?:\\.[^\\']*)*'/; + + JSTOKEN = /^`[^\\`]*(?:\\.[^\\`]*)*`/; + + REGEX = /^(\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/)([imgy]{0,4})(?!\w)/; + + HEREGEX = /^\/{3}([\s\S]+?)\/{3}([imgy]{0,4})(?!\w)/; + + HEREGEX_OMIT = /\s+(?:#.*)?/g; + + MULTILINER = /\n/g; + + HEREDOC_INDENT = /\n+([^\n\S]*)/g; + + HEREDOC_ILLEGAL = /\*\//; + + LINE_CONTINUER = /^\s*(?:,|\??\.(?![.\d])|::)/; + + TRAILING_SPACES = /\s+$/; + + COMPOUND_ASSIGN = ['-=', '+=', '/=', '*=', '%=', '||=', '&&=', '?=', '<<=', '>>=', '>>>=', '&=', '^=', '|=']; + + UNARY = ['!', '~', 'NEW', 'TYPEOF', 'DELETE', 'DO']; + + LOGIC = ['&&', '||', '&', '|', '^']; + + SHIFT = ['<<', '>>', '>>>']; + + COMPARE = ['==', '!=', '<', '>', '<=', '>=']; + + MATH = ['*', '/', '%']; + + RELATION = ['IN', 'OF', 'INSTANCEOF']; + + BOOL = ['TRUE', 'FALSE']; + + NOT_REGEX = ['NUMBER', 'REGEX', 'BOOL', 'NULL', 'UNDEFINED', '++', '--']; + + NOT_SPACED_REGEX = NOT_REGEX.concat(')', '}', 'THIS', 'IDENTIFIER', 'STRING', ']'); + + CALLABLE = ['IDENTIFIER', 'STRING', 'REGEX', ')', ']', '}', '?', '::', '@', 'THIS', 'SUPER']; + + INDEXABLE = CALLABLE.concat('NUMBER', 'BOOL', 'NULL', 'UNDEFINED'); + + LINE_BREAK = ['INDENT', 'OUTDENT', 'TERMINATOR']; + + +}); \ No newline at end of file diff --git a/addons/editor/ace/mode/coffee/nodes.js b/addons/editor/ace/mode/coffee/nodes.js new file mode 100755 index 00000000..b97dd58a --- /dev/null +++ b/addons/editor/ace/mode/coffee/nodes.js @@ -0,0 +1,3080 @@ +/** + * Copyright (c) 2009-2013 Jeremy Ashkenas + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + */ + +define(function(require, exports, module) { +// Generated by CoffeeScript 1.6.3 + + var Access, Arr, Assign, Base, Block, Call, Class, Closure, Code, CodeFragment, Comment, Existence, Extends, For, IDENTIFIER, IDENTIFIER_STR, IS_STRING, If, In, Index, LEVEL_ACCESS, LEVEL_COND, LEVEL_LIST, LEVEL_OP, LEVEL_PAREN, LEVEL_TOP, Literal, METHOD_DEF, NEGATE, NO, Obj, Op, Param, Parens, RESERVED, Range, Return, SIMPLENUM, STRICT_PROSCRIBED, Scope, Slice, Splat, Switch, TAB, THIS, Throw, Try, UTILITIES, Value, While, YES, addLocationDataFn, compact, del, ends, extend, flatten, fragmentsToText, last, locationDataToString, merge, multident, some, starts, throwSyntaxError, unfoldSoak, utility, _ref, _ref1, _ref2, _ref3, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, + __slice = [].slice; + + Error.stackTraceLimit = Infinity; + + Scope = require('./scope').Scope; + + _ref = require('./lexer'), RESERVED = _ref.RESERVED, STRICT_PROSCRIBED = _ref.STRICT_PROSCRIBED; + + _ref1 = require('./helpers'), compact = _ref1.compact, flatten = _ref1.flatten, extend = _ref1.extend, merge = _ref1.merge, del = _ref1.del, starts = _ref1.starts, ends = _ref1.ends, last = _ref1.last, some = _ref1.some, addLocationDataFn = _ref1.addLocationDataFn, locationDataToString = _ref1.locationDataToString, throwSyntaxError = _ref1.throwSyntaxError; + + exports.extend = extend; + + exports.addLocationDataFn = addLocationDataFn; + + YES = function() { + return true; + }; + + NO = function() { + return false; + }; + + THIS = function() { + return this; + }; + + NEGATE = function() { + this.negated = !this.negated; + return this; + }; + + exports.CodeFragment = CodeFragment = (function() { + function CodeFragment(parent, code) { + var _ref2; + this.code = "" + code; + this.locationData = parent != null ? parent.locationData : void 0; + this.type = (parent != null ? (_ref2 = parent.constructor) != null ? _ref2.name : void 0 : void 0) || 'unknown'; + } + + CodeFragment.prototype.toString = function() { + return "" + this.code + (this.locationData ? ": " + locationDataToString(this.locationData) : ''); + }; + + return CodeFragment; + + })(); + + fragmentsToText = function(fragments) { + var fragment; + return ((function() { + var _i, _len, _results; + _results = []; + for (_i = 0, _len = fragments.length; _i < _len; _i++) { + fragment = fragments[_i]; + _results.push(fragment.code); + } + return _results; + })()).join(''); + }; + + exports.Base = Base = (function() { + function Base() {} + + Base.prototype.compile = function(o, lvl) { + return fragmentsToText(this.compileToFragments(o, lvl)); + }; + + Base.prototype.compileToFragments = function(o, lvl) { + var node; + o = extend({}, o); + if (lvl) { + o.level = lvl; + } + node = this.unfoldSoak(o) || this; + node.tab = o.indent; + if (o.level === LEVEL_TOP || !node.isStatement(o)) { + return node.compileNode(o); + } else { + return node.compileClosure(o); + } + }; + + Base.prototype.compileClosure = function(o) { + var jumpNode; + if (jumpNode = this.jumps()) { + jumpNode.error('cannot use a pure statement in an expression'); + } + o.sharedScope = true; + return Closure.wrap(this).compileNode(o); + }; + + Base.prototype.cache = function(o, level, reused) { + var ref, sub; + if (!this.isComplex()) { + ref = level ? this.compileToFragments(o, level) : this; + return [ref, ref]; + } else { + ref = new Literal(reused || o.scope.freeVariable('ref')); + sub = new Assign(ref, this); + if (level) { + return [sub.compileToFragments(o, level), [this.makeCode(ref.value)]]; + } else { + return [sub, ref]; + } + } + }; + + Base.prototype.cacheToCodeFragments = function(cacheValues) { + return [fragmentsToText(cacheValues[0]), fragmentsToText(cacheValues[1])]; + }; + + Base.prototype.makeReturn = function(res) { + var me; + me = this.unwrapAll(); + if (res) { + return new Call(new Literal("" + res + ".push"), [me]); + } else { + return new Return(me); + } + }; + + Base.prototype.contains = function(pred) { + var node; + node = void 0; + this.traverseChildren(false, function(n) { + if (pred(n)) { + node = n; + return false; + } + }); + return node; + }; + + Base.prototype.lastNonComment = function(list) { + var i; + i = list.length; + while (i--) { + if (!(list[i] instanceof Comment)) { + return list[i]; + } + } + return null; + }; + + Base.prototype.toString = function(idt, name) { + var tree; + if (idt == null) { + idt = ''; + } + if (name == null) { + name = this.constructor.name; + } + tree = '\n' + idt + name; + if (this.soak) { + tree += '?'; + } + this.eachChild(function(node) { + return tree += node.toString(idt + TAB); + }); + return tree; + }; + + Base.prototype.eachChild = function(func) { + var attr, child, _i, _j, _len, _len1, _ref2, _ref3; + if (!this.children) { + return this; + } + _ref2 = this.children; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + attr = _ref2[_i]; + if (this[attr]) { + _ref3 = flatten([this[attr]]); + for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) { + child = _ref3[_j]; + if (func(child) === false) { + return this; + } + } + } + } + return this; + }; + + Base.prototype.traverseChildren = function(crossScope, func) { + return this.eachChild(function(child) { + var recur; + recur = func(child); + if (recur !== false) { + return child.traverseChildren(crossScope, func); + } + }); + }; + + Base.prototype.invert = function() { + return new Op('!', this); + }; + + Base.prototype.unwrapAll = function() { + var node; + node = this; + while (node !== (node = node.unwrap())) { + continue; + } + return node; + }; + + Base.prototype.children = []; + + Base.prototype.isStatement = NO; + + Base.prototype.jumps = NO; + + Base.prototype.isComplex = YES; + + Base.prototype.isChainable = NO; + + Base.prototype.isAssignable = NO; + + Base.prototype.unwrap = THIS; + + Base.prototype.unfoldSoak = NO; + + Base.prototype.assigns = NO; + + Base.prototype.updateLocationDataIfMissing = function(locationData) { + if (this.locationData) { + return this; + } + this.locationData = locationData; + return this.eachChild(function(child) { + return child.updateLocationDataIfMissing(locationData); + }); + }; + + Base.prototype.error = function(message) { + return throwSyntaxError(message, this.locationData); + }; + + Base.prototype.makeCode = function(code) { + return new CodeFragment(this, code); + }; + + Base.prototype.wrapInBraces = function(fragments) { + return [].concat(this.makeCode('('), fragments, this.makeCode(')')); + }; + + Base.prototype.joinFragmentArrays = function(fragmentsList, joinStr) { + var answer, fragments, i, _i, _len; + answer = []; + for (i = _i = 0, _len = fragmentsList.length; _i < _len; i = ++_i) { + fragments = fragmentsList[i]; + if (i) { + answer.push(this.makeCode(joinStr)); + } + answer = answer.concat(fragments); + } + return answer; + }; + + return Base; + + })(); + + exports.Block = Block = (function(_super) { + __extends(Block, _super); + + function Block(nodes) { + this.expressions = compact(flatten(nodes || [])); + } + + Block.prototype.children = ['expressions']; + + Block.prototype.push = function(node) { + this.expressions.push(node); + return this; + }; + + Block.prototype.pop = function() { + return this.expressions.pop(); + }; + + Block.prototype.unshift = function(node) { + this.expressions.unshift(node); + return this; + }; + + Block.prototype.unwrap = function() { + if (this.expressions.length === 1) { + return this.expressions[0]; + } else { + return this; + } + }; + + Block.prototype.isEmpty = function() { + return !this.expressions.length; + }; + + Block.prototype.isStatement = function(o) { + var exp, _i, _len, _ref2; + _ref2 = this.expressions; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + exp = _ref2[_i]; + if (exp.isStatement(o)) { + return true; + } + } + return false; + }; + + Block.prototype.jumps = function(o) { + var exp, _i, _len, _ref2; + _ref2 = this.expressions; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + exp = _ref2[_i]; + if (exp.jumps(o)) { + return exp; + } + } + }; + + Block.prototype.makeReturn = function(res) { + var expr, len; + len = this.expressions.length; + while (len--) { + expr = this.expressions[len]; + if (!(expr instanceof Comment)) { + this.expressions[len] = expr.makeReturn(res); + if (expr instanceof Return && !expr.expression) { + this.expressions.splice(len, 1); + } + break; + } + } + return this; + }; + + Block.prototype.compileToFragments = function(o, level) { + if (o == null) { + o = {}; + } + if (o.scope) { + return Block.__super__.compileToFragments.call(this, o, level); + } else { + return this.compileRoot(o); + } + }; + + Block.prototype.compileNode = function(o) { + var answer, compiledNodes, fragments, index, node, top, _i, _len, _ref2; + this.tab = o.indent; + top = o.level === LEVEL_TOP; + compiledNodes = []; + _ref2 = this.expressions; + for (index = _i = 0, _len = _ref2.length; _i < _len; index = ++_i) { + node = _ref2[index]; + node = node.unwrapAll(); + node = node.unfoldSoak(o) || node; + if (node instanceof Block) { + compiledNodes.push(node.compileNode(o)); + } else if (top) { + node.front = true; + fragments = node.compileToFragments(o); + if (!node.isStatement(o)) { + fragments.unshift(this.makeCode("" + this.tab)); + fragments.push(this.makeCode(";")); + } + compiledNodes.push(fragments); + } else { + compiledNodes.push(node.compileToFragments(o, LEVEL_LIST)); + } + } + if (top) { + if (this.spaced) { + return [].concat(this.joinFragmentArrays(compiledNodes, '\n\n'), this.makeCode("\n")); + } else { + return this.joinFragmentArrays(compiledNodes, '\n'); + } + } + if (compiledNodes.length) { + answer = this.joinFragmentArrays(compiledNodes, ', '); + } else { + answer = [this.makeCode("void 0")]; + } + if (compiledNodes.length > 1 && o.level >= LEVEL_LIST) { + return this.wrapInBraces(answer); + } else { + return answer; + } + }; + + Block.prototype.compileRoot = function(o) { + var exp, fragments, i, name, prelude, preludeExps, rest, _i, _len, _ref2; + o.indent = o.bare ? '' : TAB; + o.level = LEVEL_TOP; + this.spaced = true; + o.scope = new Scope(null, this, null); + _ref2 = o.locals || []; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + name = _ref2[_i]; + o.scope.parameter(name); + } + prelude = []; + if (!o.bare) { + preludeExps = (function() { + var _j, _len1, _ref3, _results; + _ref3 = this.expressions; + _results = []; + for (i = _j = 0, _len1 = _ref3.length; _j < _len1; i = ++_j) { + exp = _ref3[i]; + if (!(exp.unwrap() instanceof Comment)) { + break; + } + _results.push(exp); + } + return _results; + }).call(this); + rest = this.expressions.slice(preludeExps.length); + this.expressions = preludeExps; + if (preludeExps.length) { + prelude = this.compileNode(merge(o, { + indent: '' + })); + prelude.push(this.makeCode("\n")); + } + this.expressions = rest; + } + fragments = this.compileWithDeclarations(o); + if (o.bare) { + return fragments; + } + return [].concat(prelude, this.makeCode("(function() {\n"), fragments, this.makeCode("\n}).call(this);\n")); + }; + + Block.prototype.compileWithDeclarations = function(o) { + var assigns, declars, exp, fragments, i, post, rest, scope, spaced, _i, _len, _ref2, _ref3, _ref4; + fragments = []; + post = []; + _ref2 = this.expressions; + for (i = _i = 0, _len = _ref2.length; _i < _len; i = ++_i) { + exp = _ref2[i]; + exp = exp.unwrap(); + if (!(exp instanceof Comment || exp instanceof Literal)) { + break; + } + } + o = merge(o, { + level: LEVEL_TOP + }); + if (i) { + rest = this.expressions.splice(i, 9e9); + _ref3 = [this.spaced, false], spaced = _ref3[0], this.spaced = _ref3[1]; + _ref4 = [this.compileNode(o), spaced], fragments = _ref4[0], this.spaced = _ref4[1]; + this.expressions = rest; + } + post = this.compileNode(o); + scope = o.scope; + if (scope.expressions === this) { + declars = o.scope.hasDeclarations(); + assigns = scope.hasAssignments; + if (declars || assigns) { + if (i) { + fragments.push(this.makeCode('\n')); + } + fragments.push(this.makeCode("" + this.tab + "var ")); + if (declars) { + fragments.push(this.makeCode(scope.declaredVariables().join(', '))); + } + if (assigns) { + if (declars) { + fragments.push(this.makeCode(",\n" + (this.tab + TAB))); + } + fragments.push(this.makeCode(scope.assignedVariables().join(",\n" + (this.tab + TAB)))); + } + fragments.push(this.makeCode(";\n" + (this.spaced ? '\n' : ''))); + } else if (fragments.length && post.length) { + fragments.push(this.makeCode("\n")); + } + } + return fragments.concat(post); + }; + + Block.wrap = function(nodes) { + if (nodes.length === 1 && nodes[0] instanceof Block) { + return nodes[0]; + } + return new Block(nodes); + }; + + return Block; + + })(Base); + + exports.Literal = Literal = (function(_super) { + __extends(Literal, _super); + + function Literal(value) { + this.value = value; + } + + Literal.prototype.makeReturn = function() { + if (this.isStatement()) { + return this; + } else { + return Literal.__super__.makeReturn.apply(this, arguments); + } + }; + + Literal.prototype.isAssignable = function() { + return IDENTIFIER.test(this.value); + }; + + Literal.prototype.isStatement = function() { + var _ref2; + return (_ref2 = this.value) === 'break' || _ref2 === 'continue' || _ref2 === 'debugger'; + }; + + Literal.prototype.isComplex = NO; + + Literal.prototype.assigns = function(name) { + return name === this.value; + }; + + Literal.prototype.jumps = function(o) { + if (this.value === 'break' && !((o != null ? o.loop : void 0) || (o != null ? o.block : void 0))) { + return this; + } + if (this.value === 'continue' && !(o != null ? o.loop : void 0)) { + return this; + } + }; + + Literal.prototype.compileNode = function(o) { + var answer, code, _ref2; + code = this.value === 'this' ? ((_ref2 = o.scope.method) != null ? _ref2.bound : void 0) ? o.scope.method.context : this.value : this.value.reserved ? "\"" + this.value + "\"" : this.value; + answer = this.isStatement() ? "" + this.tab + code + ";" : code; + return [this.makeCode(answer)]; + }; + + Literal.prototype.toString = function() { + return ' "' + this.value + '"'; + }; + + return Literal; + + })(Base); + + exports.Undefined = (function(_super) { + __extends(Undefined, _super); + + function Undefined() { + _ref2 = Undefined.__super__.constructor.apply(this, arguments); + return _ref2; + } + + Undefined.prototype.isAssignable = NO; + + Undefined.prototype.isComplex = NO; + + Undefined.prototype.compileNode = function(o) { + return [this.makeCode(o.level >= LEVEL_ACCESS ? '(void 0)' : 'void 0')]; + }; + + return Undefined; + + })(Base); + + exports.Null = (function(_super) { + __extends(Null, _super); + + function Null() { + _ref3 = Null.__super__.constructor.apply(this, arguments); + return _ref3; + } + + Null.prototype.isAssignable = NO; + + Null.prototype.isComplex = NO; + + Null.prototype.compileNode = function() { + return [this.makeCode("null")]; + }; + + return Null; + + })(Base); + + exports.Bool = (function(_super) { + __extends(Bool, _super); + + Bool.prototype.isAssignable = NO; + + Bool.prototype.isComplex = NO; + + Bool.prototype.compileNode = function() { + return [this.makeCode(this.val)]; + }; + + function Bool(val) { + this.val = val; + } + + return Bool; + + })(Base); + + exports.Return = Return = (function(_super) { + __extends(Return, _super); + + function Return(expr) { + if (expr && !expr.unwrap().isUndefined) { + this.expression = expr; + } + } + + Return.prototype.children = ['expression']; + + Return.prototype.isStatement = YES; + + Return.prototype.makeReturn = THIS; + + Return.prototype.jumps = THIS; + + Return.prototype.compileToFragments = function(o, level) { + var expr, _ref4; + expr = (_ref4 = this.expression) != null ? _ref4.makeReturn() : void 0; + if (expr && !(expr instanceof Return)) { + return expr.compileToFragments(o, level); + } else { + return Return.__super__.compileToFragments.call(this, o, level); + } + }; + + Return.prototype.compileNode = function(o) { + var answer; + answer = []; + answer.push(this.makeCode(this.tab + ("return" + (this.expression ? " " : "")))); + if (this.expression) { + answer = answer.concat(this.expression.compileToFragments(o, LEVEL_PAREN)); + } + answer.push(this.makeCode(";")); + return answer; + }; + + return Return; + + })(Base); + + exports.Value = Value = (function(_super) { + __extends(Value, _super); + + function Value(base, props, tag) { + if (!props && base instanceof Value) { + return base; + } + this.base = base; + this.properties = props || []; + if (tag) { + this[tag] = true; + } + return this; + } + + Value.prototype.children = ['base', 'properties']; + + Value.prototype.add = function(props) { + this.properties = this.properties.concat(props); + return this; + }; + + Value.prototype.hasProperties = function() { + return !!this.properties.length; + }; + + Value.prototype.isArray = function() { + return !this.properties.length && this.base instanceof Arr; + }; + + Value.prototype.isComplex = function() { + return this.hasProperties() || this.base.isComplex(); + }; + + Value.prototype.isAssignable = function() { + return this.hasProperties() || this.base.isAssignable(); + }; + + Value.prototype.isSimpleNumber = function() { + return this.base instanceof Literal && SIMPLENUM.test(this.base.value); + }; + + Value.prototype.isString = function() { + return this.base instanceof Literal && IS_STRING.test(this.base.value); + }; + + Value.prototype.isAtomic = function() { + var node, _i, _len, _ref4; + _ref4 = this.properties.concat(this.base); + for (_i = 0, _len = _ref4.length; _i < _len; _i++) { + node = _ref4[_i]; + if (node.soak || node instanceof Call) { + return false; + } + } + return true; + }; + + Value.prototype.isStatement = function(o) { + return !this.properties.length && this.base.isStatement(o); + }; + + Value.prototype.assigns = function(name) { + return !this.properties.length && this.base.assigns(name); + }; + + Value.prototype.jumps = function(o) { + return !this.properties.length && this.base.jumps(o); + }; + + Value.prototype.isObject = function(onlyGenerated) { + if (this.properties.length) { + return false; + } + return (this.base instanceof Obj) && (!onlyGenerated || this.base.generated); + }; + + Value.prototype.isSplice = function() { + return last(this.properties) instanceof Slice; + }; + + Value.prototype.unwrap = function() { + if (this.properties.length) { + return this; + } else { + return this.base; + } + }; + + Value.prototype.cacheReference = function(o) { + var base, bref, name, nref; + name = last(this.properties); + if (this.properties.length < 2 && !this.base.isComplex() && !(name != null ? name.isComplex() : void 0)) { + return [this, this]; + } + base = new Value(this.base, this.properties.slice(0, -1)); + if (base.isComplex()) { + bref = new Literal(o.scope.freeVariable('base')); + base = new Value(new Parens(new Assign(bref, base))); + } + if (!name) { + return [base, bref]; + } + if (name.isComplex()) { + nref = new Literal(o.scope.freeVariable('name')); + name = new Index(new Assign(nref, name.index)); + nref = new Index(nref); + } + return [base.add(name), new Value(bref || base.base, [nref || name])]; + }; + + Value.prototype.compileNode = function(o) { + var fragments, prop, props, _i, _len; + this.base.front = this.front; + props = this.properties; + fragments = this.base.compileToFragments(o, (props.length ? LEVEL_ACCESS : null)); + if ((this.base instanceof Parens || props.length) && SIMPLENUM.test(fragmentsToText(fragments))) { + fragments.push(this.makeCode('.')); + } + for (_i = 0, _len = props.length; _i < _len; _i++) { + prop = props[_i]; + fragments.push.apply(fragments, prop.compileToFragments(o)); + } + return fragments; + }; + + Value.prototype.unfoldSoak = function(o) { + var _this = this; + return this.unfoldedSoak != null ? this.unfoldedSoak : this.unfoldedSoak = (function() { + var fst, i, ifn, prop, ref, snd, _i, _len, _ref4, _ref5; + if (ifn = _this.base.unfoldSoak(o)) { + (_ref4 = ifn.body.properties).push.apply(_ref4, _this.properties); + return ifn; + } + _ref5 = _this.properties; + for (i = _i = 0, _len = _ref5.length; _i < _len; i = ++_i) { + prop = _ref5[i]; + if (!prop.soak) { + continue; + } + prop.soak = false; + fst = new Value(_this.base, _this.properties.slice(0, i)); + snd = new Value(_this.base, _this.properties.slice(i)); + if (fst.isComplex()) { + ref = new Literal(o.scope.freeVariable('ref')); + fst = new Parens(new Assign(ref, fst)); + snd.base = ref; + } + return new If(new Existence(fst), snd, { + soak: true + }); + } + return false; + })(); + }; + + return Value; + + })(Base); + + exports.Comment = Comment = (function(_super) { + __extends(Comment, _super); + + function Comment(comment) { + this.comment = comment; + } + + Comment.prototype.isStatement = YES; + + Comment.prototype.makeReturn = THIS; + + Comment.prototype.compileNode = function(o, level) { + var code; + code = "/*" + (multident(this.comment, this.tab)) + (__indexOf.call(this.comment, '\n') >= 0 ? "\n" + this.tab : '') + "*/"; + if ((level || o.level) === LEVEL_TOP) { + code = o.indent + code; + } + return [this.makeCode("\n"), this.makeCode(code)]; + }; + + return Comment; + + })(Base); + + exports.Call = Call = (function(_super) { + __extends(Call, _super); + + function Call(variable, args, soak) { + this.args = args != null ? args : []; + this.soak = soak; + this.isNew = false; + this.isSuper = variable === 'super'; + this.variable = this.isSuper ? null : variable; + } + + Call.prototype.children = ['variable', 'args']; + + Call.prototype.newInstance = function() { + var base, _ref4; + base = ((_ref4 = this.variable) != null ? _ref4.base : void 0) || this.variable; + if (base instanceof Call && !base.isNew) { + base.newInstance(); + } else { + this.isNew = true; + } + return this; + }; + + Call.prototype.superReference = function(o) { + var accesses, method; + method = o.scope.namedMethod(); + if (method != null ? method.klass : void 0) { + accesses = [new Access(new Literal('__super__'))]; + if (method["static"]) { + accesses.push(new Access(new Literal('constructor'))); + } + accesses.push(new Access(new Literal(method.name))); + return (new Value(new Literal(method.klass), accesses)).compile(o); + } else if (method != null ? method.ctor : void 0) { + return "" + method.name + ".__super__.constructor"; + } else { + return this.error('cannot call super outside of an instance method.'); + } + }; + + Call.prototype.superThis = function(o) { + var method; + method = o.scope.method; + return (method && !method.klass && method.context) || "this"; + }; + + Call.prototype.unfoldSoak = function(o) { + var call, ifn, left, list, rite, _i, _len, _ref4, _ref5; + if (this.soak) { + if (this.variable) { + if (ifn = unfoldSoak(o, this, 'variable')) { + return ifn; + } + _ref4 = new Value(this.variable).cacheReference(o), left = _ref4[0], rite = _ref4[1]; + } else { + left = new Literal(this.superReference(o)); + rite = new Value(left); + } + rite = new Call(rite, this.args); + rite.isNew = this.isNew; + left = new Literal("typeof " + (left.compile(o)) + " === \"function\""); + return new If(left, new Value(rite), { + soak: true + }); + } + call = this; + list = []; + while (true) { + if (call.variable instanceof Call) { + list.push(call); + call = call.variable; + continue; + } + if (!(call.variable instanceof Value)) { + break; + } + list.push(call); + if (!((call = call.variable.base) instanceof Call)) { + break; + } + } + _ref5 = list.reverse(); + for (_i = 0, _len = _ref5.length; _i < _len; _i++) { + call = _ref5[_i]; + if (ifn) { + if (call.variable instanceof Call) { + call.variable = ifn; + } else { + call.variable.base = ifn; + } + } + ifn = unfoldSoak(o, call, 'variable'); + } + return ifn; + }; + + Call.prototype.compileNode = function(o) { + var arg, argIndex, compiledArgs, compiledArray, fragments, preface, _i, _len, _ref4, _ref5; + if ((_ref4 = this.variable) != null) { + _ref4.front = this.front; + } + compiledArray = Splat.compileSplattedArray(o, this.args, true); + if (compiledArray.length) { + return this.compileSplat(o, compiledArray); + } + compiledArgs = []; + _ref5 = this.args; + for (argIndex = _i = 0, _len = _ref5.length; _i < _len; argIndex = ++_i) { + arg = _ref5[argIndex]; + if (argIndex) { + compiledArgs.push(this.makeCode(", ")); + } + compiledArgs.push.apply(compiledArgs, arg.compileToFragments(o, LEVEL_LIST)); + } + fragments = []; + if (this.isSuper) { + preface = this.superReference(o) + (".call(" + (this.superThis(o))); + if (compiledArgs.length) { + preface += ", "; + } + fragments.push(this.makeCode(preface)); + } else { + if (this.isNew) { + fragments.push(this.makeCode('new ')); + } + fragments.push.apply(fragments, this.variable.compileToFragments(o, LEVEL_ACCESS)); + fragments.push(this.makeCode("(")); + } + fragments.push.apply(fragments, compiledArgs); + fragments.push(this.makeCode(")")); + return fragments; + }; + + Call.prototype.compileSplat = function(o, splatArgs) { + var answer, base, fun, idt, name, ref; + if (this.isSuper) { + return [].concat(this.makeCode("" + (this.superReference(o)) + ".apply(" + (this.superThis(o)) + ", "), splatArgs, this.makeCode(")")); + } + if (this.isNew) { + idt = this.tab + TAB; + return [].concat(this.makeCode("(function(func, args, ctor) {\n" + idt + "ctor.prototype = func.prototype;\n" + idt + "var child = new ctor, result = func.apply(child, args);\n" + idt + "return Object(result) === result ? result : child;\n" + this.tab + "})("), this.variable.compileToFragments(o, LEVEL_LIST), this.makeCode(", "), splatArgs, this.makeCode(", function(){})")); + } + answer = []; + base = new Value(this.variable); + if ((name = base.properties.pop()) && base.isComplex()) { + ref = o.scope.freeVariable('ref'); + answer = answer.concat(this.makeCode("(" + ref + " = "), base.compileToFragments(o, LEVEL_LIST), this.makeCode(")"), name.compileToFragments(o)); + } else { + fun = base.compileToFragments(o, LEVEL_ACCESS); + if (SIMPLENUM.test(fragmentsToText(fun))) { + fun = this.wrapInBraces(fun); + } + if (name) { + ref = fragmentsToText(fun); + fun.push.apply(fun, name.compileToFragments(o)); + } else { + ref = 'null'; + } + answer = answer.concat(fun); + } + return answer = answer.concat(this.makeCode(".apply(" + ref + ", "), splatArgs, this.makeCode(")")); + }; + + return Call; + + })(Base); + + exports.Extends = Extends = (function(_super) { + __extends(Extends, _super); + + function Extends(child, parent) { + this.child = child; + this.parent = parent; + } + + Extends.prototype.children = ['child', 'parent']; + + Extends.prototype.compileToFragments = function(o) { + return new Call(new Value(new Literal(utility('extends'))), [this.child, this.parent]).compileToFragments(o); + }; + + return Extends; + + })(Base); + + exports.Access = Access = (function(_super) { + __extends(Access, _super); + + function Access(name, tag) { + this.name = name; + this.name.asKey = true; + this.soak = tag === 'soak'; + } + + Access.prototype.children = ['name']; + + Access.prototype.compileToFragments = function(o) { + var name; + name = this.name.compileToFragments(o); + if (IDENTIFIER.test(fragmentsToText(name))) { + name.unshift(this.makeCode(".")); + } else { + name.unshift(this.makeCode("[")); + name.push(this.makeCode("]")); + } + return name; + }; + + Access.prototype.isComplex = NO; + + return Access; + + })(Base); + + exports.Index = Index = (function(_super) { + __extends(Index, _super); + + function Index(index) { + this.index = index; + } + + Index.prototype.children = ['index']; + + Index.prototype.compileToFragments = function(o) { + return [].concat(this.makeCode("["), this.index.compileToFragments(o, LEVEL_PAREN), this.makeCode("]")); + }; + + Index.prototype.isComplex = function() { + return this.index.isComplex(); + }; + + return Index; + + })(Base); + + exports.Range = Range = (function(_super) { + __extends(Range, _super); + + Range.prototype.children = ['from', 'to']; + + function Range(from, to, tag) { + this.from = from; + this.to = to; + this.exclusive = tag === 'exclusive'; + this.equals = this.exclusive ? '' : '='; + } + + Range.prototype.compileVariables = function(o) { + var step, _ref4, _ref5, _ref6, _ref7; + o = merge(o, { + top: true + }); + _ref4 = this.cacheToCodeFragments(this.from.cache(o, LEVEL_LIST)), this.fromC = _ref4[0], this.fromVar = _ref4[1]; + _ref5 = this.cacheToCodeFragments(this.to.cache(o, LEVEL_LIST)), this.toC = _ref5[0], this.toVar = _ref5[1]; + if (step = del(o, 'step')) { + _ref6 = this.cacheToCodeFragments(step.cache(o, LEVEL_LIST)), this.step = _ref6[0], this.stepVar = _ref6[1]; + } + _ref7 = [this.fromVar.match(SIMPLENUM), this.toVar.match(SIMPLENUM)], this.fromNum = _ref7[0], this.toNum = _ref7[1]; + if (this.stepVar) { + return this.stepNum = this.stepVar.match(SIMPLENUM); + } + }; + + Range.prototype.compileNode = function(o) { + var cond, condPart, from, gt, idx, idxName, known, lt, namedIndex, stepPart, to, varPart, _ref4, _ref5; + if (!this.fromVar) { + this.compileVariables(o); + } + if (!o.index) { + return this.compileArray(o); + } + known = this.fromNum && this.toNum; + idx = del(o, 'index'); + idxName = del(o, 'name'); + namedIndex = idxName && idxName !== idx; + varPart = "" + idx + " = " + this.fromC; + if (this.toC !== this.toVar) { + varPart += ", " + this.toC; + } + if (this.step !== this.stepVar) { + varPart += ", " + this.step; + } + _ref4 = ["" + idx + " <" + this.equals, "" + idx + " >" + this.equals], lt = _ref4[0], gt = _ref4[1]; + condPart = this.stepNum ? +this.stepNum > 0 ? "" + lt + " " + this.toVar : "" + gt + " " + this.toVar : known ? ((_ref5 = [+this.fromNum, +this.toNum], from = _ref5[0], to = _ref5[1], _ref5), from <= to ? "" + lt + " " + to : "" + gt + " " + to) : (cond = this.stepVar ? "" + this.stepVar + " > 0" : "" + this.fromVar + " <= " + this.toVar, "" + cond + " ? " + lt + " " + this.toVar + " : " + gt + " " + this.toVar); + stepPart = this.stepVar ? "" + idx + " += " + this.stepVar : known ? namedIndex ? from <= to ? "++" + idx : "--" + idx : from <= to ? "" + idx + "++" : "" + idx + "--" : namedIndex ? "" + cond + " ? ++" + idx + " : --" + idx : "" + cond + " ? " + idx + "++ : " + idx + "--"; + if (namedIndex) { + varPart = "" + idxName + " = " + varPart; + } + if (namedIndex) { + stepPart = "" + idxName + " = " + stepPart; + } + return [this.makeCode("" + varPart + "; " + condPart + "; " + stepPart)]; + }; + + Range.prototype.compileArray = function(o) { + var args, body, cond, hasArgs, i, idt, post, pre, range, result, vars, _i, _ref4, _ref5, _results; + if (this.fromNum && this.toNum && Math.abs(this.fromNum - this.toNum) <= 20) { + range = (function() { + _results = []; + for (var _i = _ref4 = +this.fromNum, _ref5 = +this.toNum; _ref4 <= _ref5 ? _i <= _ref5 : _i >= _ref5; _ref4 <= _ref5 ? _i++ : _i--){ _results.push(_i); } + return _results; + }).apply(this); + if (this.exclusive) { + range.pop(); + } + return [this.makeCode("[" + (range.join(', ')) + "]")]; + } + idt = this.tab + TAB; + i = o.scope.freeVariable('i'); + result = o.scope.freeVariable('results'); + pre = "\n" + idt + result + " = [];"; + if (this.fromNum && this.toNum) { + o.index = i; + body = fragmentsToText(this.compileNode(o)); + } else { + vars = ("" + i + " = " + this.fromC) + (this.toC !== this.toVar ? ", " + this.toC : ''); + cond = "" + this.fromVar + " <= " + this.toVar; + body = "var " + vars + "; " + cond + " ? " + i + " <" + this.equals + " " + this.toVar + " : " + i + " >" + this.equals + " " + this.toVar + "; " + cond + " ? " + i + "++ : " + i + "--"; + } + post = "{ " + result + ".push(" + i + "); }\n" + idt + "return " + result + ";\n" + o.indent; + hasArgs = function(node) { + return node != null ? node.contains(function(n) { + return n instanceof Literal && n.value === 'arguments' && !n.asKey; + }) : void 0; + }; + if (hasArgs(this.from) || hasArgs(this.to)) { + args = ', arguments'; + } + return [this.makeCode("(function() {" + pre + "\n" + idt + "for (" + body + ")" + post + "}).apply(this" + (args != null ? args : '') + ")")]; + }; + + return Range; + + })(Base); + + exports.Slice = Slice = (function(_super) { + __extends(Slice, _super); + + Slice.prototype.children = ['range']; + + function Slice(range) { + this.range = range; + Slice.__super__.constructor.call(this); + } + + Slice.prototype.compileNode = function(o) { + var compiled, compiledText, from, fromCompiled, to, toStr, _ref4; + _ref4 = this.range, to = _ref4.to, from = _ref4.from; + fromCompiled = from && from.compileToFragments(o, LEVEL_PAREN) || [this.makeCode('0')]; + if (to) { + compiled = to.compileToFragments(o, LEVEL_PAREN); + compiledText = fragmentsToText(compiled); + if (!(!this.range.exclusive && +compiledText === -1)) { + toStr = ', ' + (this.range.exclusive ? compiledText : SIMPLENUM.test(compiledText) ? "" + (+compiledText + 1) : (compiled = to.compileToFragments(o, LEVEL_ACCESS), "+" + (fragmentsToText(compiled)) + " + 1 || 9e9")); + } + } + return [this.makeCode(".slice(" + (fragmentsToText(fromCompiled)) + (toStr || '') + ")")]; + }; + + return Slice; + + })(Base); + + exports.Obj = Obj = (function(_super) { + __extends(Obj, _super); + + function Obj(props, generated) { + this.generated = generated != null ? generated : false; + this.objects = this.properties = props || []; + } + + Obj.prototype.children = ['properties']; + + Obj.prototype.compileNode = function(o) { + var answer, i, idt, indent, join, lastNoncom, node, prop, props, _i, _j, _len, _len1; + props = this.properties; + if (!props.length) { + return [this.makeCode(this.front ? '({})' : '{}')]; + } + if (this.generated) { + for (_i = 0, _len = props.length; _i < _len; _i++) { + node = props[_i]; + if (node instanceof Value) { + node.error('cannot have an implicit value in an implicit object'); + } + } + } + idt = o.indent += TAB; + lastNoncom = this.lastNonComment(this.properties); + answer = []; + for (i = _j = 0, _len1 = props.length; _j < _len1; i = ++_j) { + prop = props[i]; + join = i === props.length - 1 ? '' : prop === lastNoncom || prop instanceof Comment ? '\n' : ',\n'; + indent = prop instanceof Comment ? '' : idt; + if (prop instanceof Assign && prop.variable instanceof Value && prop.variable.hasProperties()) { + prop.variable.error('Invalid object key'); + } + if (prop instanceof Value && prop["this"]) { + prop = new Assign(prop.properties[0].name, prop, 'object'); + } + if (!(prop instanceof Comment)) { + if (!(prop instanceof Assign)) { + prop = new Assign(prop, prop, 'object'); + } + (prop.variable.base || prop.variable).asKey = true; + } + if (indent) { + answer.push(this.makeCode(indent)); + } + answer.push.apply(answer, prop.compileToFragments(o, LEVEL_TOP)); + if (join) { + answer.push(this.makeCode(join)); + } + } + answer.unshift(this.makeCode("{" + (props.length && '\n'))); + answer.push(this.makeCode("" + (props.length && '\n' + this.tab) + "}")); + if (this.front) { + return this.wrapInBraces(answer); + } else { + return answer; + } + }; + + Obj.prototype.assigns = function(name) { + var prop, _i, _len, _ref4; + _ref4 = this.properties; + for (_i = 0, _len = _ref4.length; _i < _len; _i++) { + prop = _ref4[_i]; + if (prop.assigns(name)) { + return true; + } + } + return false; + }; + + return Obj; + + })(Base); + + exports.Arr = Arr = (function(_super) { + __extends(Arr, _super); + + function Arr(objs) { + this.objects = objs || []; + } + + Arr.prototype.children = ['objects']; + + Arr.prototype.compileNode = function(o) { + var answer, compiledObjs, fragments, index, obj, _i, _len; + if (!this.objects.length) { + return [this.makeCode('[]')]; + } + o.indent += TAB; + answer = Splat.compileSplattedArray(o, this.objects); + if (answer.length) { + return answer; + } + answer = []; + compiledObjs = (function() { + var _i, _len, _ref4, _results; + _ref4 = this.objects; + _results = []; + for (_i = 0, _len = _ref4.length; _i < _len; _i++) { + obj = _ref4[_i]; + _results.push(obj.compileToFragments(o, LEVEL_LIST)); + } + return _results; + }).call(this); + for (index = _i = 0, _len = compiledObjs.length; _i < _len; index = ++_i) { + fragments = compiledObjs[index]; + if (index) { + answer.push(this.makeCode(", ")); + } + answer.push.apply(answer, fragments); + } + if (fragmentsToText(answer).indexOf('\n') >= 0) { + answer.unshift(this.makeCode("[\n" + o.indent)); + answer.push(this.makeCode("\n" + this.tab + "]")); + } else { + answer.unshift(this.makeCode("[")); + answer.push(this.makeCode("]")); + } + return answer; + }; + + Arr.prototype.assigns = function(name) { + var obj, _i, _len, _ref4; + _ref4 = this.objects; + for (_i = 0, _len = _ref4.length; _i < _len; _i++) { + obj = _ref4[_i]; + if (obj.assigns(name)) { + return true; + } + } + return false; + }; + + return Arr; + + })(Base); + + exports.Class = Class = (function(_super) { + __extends(Class, _super); + + function Class(variable, parent, body) { + this.variable = variable; + this.parent = parent; + this.body = body != null ? body : new Block; + this.boundFuncs = []; + this.body.classBody = true; + } + + Class.prototype.children = ['variable', 'parent', 'body']; + + Class.prototype.determineName = function() { + var decl, tail; + if (!this.variable) { + return null; + } + decl = (tail = last(this.variable.properties)) ? tail instanceof Access && tail.name.value : this.variable.base.value; + if (__indexOf.call(STRICT_PROSCRIBED, decl) >= 0) { + this.variable.error("class variable name may not be " + decl); + } + return decl && (decl = IDENTIFIER.test(decl) && decl); + }; + + Class.prototype.setContext = function(name) { + return this.body.traverseChildren(false, function(node) { + if (node.classBody) { + return false; + } + if (node instanceof Literal && node.value === 'this') { + return node.value = name; + } else if (node instanceof Code) { + node.klass = name; + if (node.bound) { + return node.context = name; + } + } + }); + }; + + Class.prototype.addBoundFunctions = function(o) { + var bvar, lhs, _i, _len, _ref4; + _ref4 = this.boundFuncs; + for (_i = 0, _len = _ref4.length; _i < _len; _i++) { + bvar = _ref4[_i]; + lhs = (new Value(new Literal("this"), [new Access(bvar)])).compile(o); + this.ctor.body.unshift(new Literal("" + lhs + " = " + (utility('bind')) + "(" + lhs + ", this)")); + } + }; + + Class.prototype.addProperties = function(node, name, o) { + var assign, base, exprs, func, props; + props = node.base.properties.slice(0); + exprs = (function() { + var _results; + _results = []; + while (assign = props.shift()) { + if (assign instanceof Assign) { + base = assign.variable.base; + delete assign.context; + func = assign.value; + if (base.value === 'constructor') { + if (this.ctor) { + assign.error('cannot define more than one constructor in a class'); + } + if (func.bound) { + assign.error('cannot define a constructor as a bound function'); + } + if (func instanceof Code) { + assign = this.ctor = func; + } else { + this.externalCtor = o.scope.freeVariable('class'); + assign = new Assign(new Literal(this.externalCtor), func); + } + } else { + if (assign.variable["this"]) { + func["static"] = true; + if (func.bound) { + func.context = name; + } + } else { + assign.variable = new Value(new Literal(name), [new Access(new Literal('prototype')), new Access(base)]); + if (func instanceof Code && func.bound) { + this.boundFuncs.push(base); + func.bound = false; + } + } + } + } + _results.push(assign); + } + return _results; + }).call(this); + return compact(exprs); + }; + + Class.prototype.walkBody = function(name, o) { + var _this = this; + return this.traverseChildren(false, function(child) { + var cont, exps, i, node, _i, _len, _ref4; + cont = true; + if (child instanceof Class) { + return false; + } + if (child instanceof Block) { + _ref4 = exps = child.expressions; + for (i = _i = 0, _len = _ref4.length; _i < _len; i = ++_i) { + node = _ref4[i]; + if (node instanceof Value && node.isObject(true)) { + cont = false; + exps[i] = _this.addProperties(node, name, o); + } + } + child.expressions = exps = flatten(exps); + } + return cont && !(child instanceof Class); + }); + }; + + Class.prototype.hoistDirectivePrologue = function() { + var expressions, index, node; + index = 0; + expressions = this.body.expressions; + while ((node = expressions[index]) && node instanceof Comment || node instanceof Value && node.isString()) { + ++index; + } + return this.directives = expressions.splice(0, index); + }; + + Class.prototype.ensureConstructor = function(name, o) { + var missing, ref, superCall; + missing = !this.ctor; + this.ctor || (this.ctor = new Code); + this.ctor.ctor = this.ctor.name = name; + this.ctor.klass = null; + this.ctor.noReturn = true; + if (missing) { + if (this.parent) { + superCall = new Literal("" + name + ".__super__.constructor.apply(this, arguments)"); + } + if (this.externalCtor) { + superCall = new Literal("" + this.externalCtor + ".apply(this, arguments)"); + } + if (superCall) { + ref = new Literal(o.scope.freeVariable('ref')); + this.ctor.body.unshift(new Assign(ref, superCall)); + } + this.addBoundFunctions(o); + if (superCall) { + this.ctor.body.push(ref); + this.ctor.body.makeReturn(); + } + return this.body.expressions.unshift(this.ctor); + } else { + return this.addBoundFunctions(o); + } + }; + + Class.prototype.compileNode = function(o) { + var call, decl, klass, lname, name, params, _ref4; + decl = this.determineName(); + name = decl || '_Class'; + if (name.reserved) { + name = "_" + name; + } + lname = new Literal(name); + this.hoistDirectivePrologue(); + this.setContext(name); + this.walkBody(name, o); + this.ensureConstructor(name, o); + this.body.spaced = true; + if (!(this.ctor instanceof Code)) { + this.body.expressions.unshift(this.ctor); + } + this.body.expressions.push(lname); + (_ref4 = this.body.expressions).unshift.apply(_ref4, this.directives); + call = Closure.wrap(this.body); + if (this.parent) { + this.superClass = new Literal(o.scope.freeVariable('super', false)); + this.body.expressions.unshift(new Extends(lname, this.superClass)); + call.args.push(this.parent); + params = call.variable.params || call.variable.base.params; + params.push(new Param(this.superClass)); + } + klass = new Parens(call, true); + if (this.variable) { + klass = new Assign(this.variable, klass); + } + return klass.compileToFragments(o); + }; + + return Class; + + })(Base); + + exports.Assign = Assign = (function(_super) { + __extends(Assign, _super); + + function Assign(variable, value, context, options) { + var forbidden, name, _ref4; + this.variable = variable; + this.value = value; + this.context = context; + this.param = options && options.param; + this.subpattern = options && options.subpattern; + forbidden = (_ref4 = (name = this.variable.unwrapAll().value), __indexOf.call(STRICT_PROSCRIBED, _ref4) >= 0); + if (forbidden && this.context !== 'object') { + this.variable.error("variable name may not be \"" + name + "\""); + } + } + + Assign.prototype.children = ['variable', 'value']; + + Assign.prototype.isStatement = function(o) { + return (o != null ? o.level : void 0) === LEVEL_TOP && (this.context != null) && __indexOf.call(this.context, "?") >= 0; + }; + + Assign.prototype.assigns = function(name) { + return this[this.context === 'object' ? 'value' : 'variable'].assigns(name); + }; + + Assign.prototype.unfoldSoak = function(o) { + return unfoldSoak(o, this, 'variable'); + }; + + Assign.prototype.compileNode = function(o) { + var answer, compiledName, isValue, match, name, val, varBase, _ref4, _ref5, _ref6, _ref7; + if (isValue = this.variable instanceof Value) { + if (this.variable.isArray() || this.variable.isObject()) { + return this.compilePatternMatch(o); + } + if (this.variable.isSplice()) { + return this.compileSplice(o); + } + if ((_ref4 = this.context) === '||=' || _ref4 === '&&=' || _ref4 === '?=') { + return this.compileConditional(o); + } + } + compiledName = this.variable.compileToFragments(o, LEVEL_LIST); + name = fragmentsToText(compiledName); + if (!this.context) { + varBase = this.variable.unwrapAll(); + if (!varBase.isAssignable()) { + this.variable.error("\"" + (this.variable.compile(o)) + "\" cannot be assigned"); + } + if (!(typeof varBase.hasProperties === "function" ? varBase.hasProperties() : void 0)) { + if (this.param) { + o.scope.add(name, 'var'); + } else { + o.scope.find(name); + } + } + } + if (this.value instanceof Code && (match = METHOD_DEF.exec(name))) { + if (match[1]) { + this.value.klass = match[1]; + } + this.value.name = (_ref5 = (_ref6 = (_ref7 = match[2]) != null ? _ref7 : match[3]) != null ? _ref6 : match[4]) != null ? _ref5 : match[5]; + } + val = this.value.compileToFragments(o, LEVEL_LIST); + if (this.context === 'object') { + return compiledName.concat(this.makeCode(": "), val); + } + answer = compiledName.concat(this.makeCode(" " + (this.context || '=') + " "), val); + if (o.level <= LEVEL_LIST) { + return answer; + } else { + return this.wrapInBraces(answer); + } + }; + + Assign.prototype.compilePatternMatch = function(o) { + var acc, assigns, code, fragments, i, idx, isObject, ivar, name, obj, objects, olen, ref, rest, splat, top, val, value, vvar, vvarText, _i, _len, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9; + top = o.level === LEVEL_TOP; + value = this.value; + objects = this.variable.base.objects; + if (!(olen = objects.length)) { + code = value.compileToFragments(o); + if (o.level >= LEVEL_OP) { + return this.wrapInBraces(code); + } else { + return code; + } + } + isObject = this.variable.isObject(); + if (top && olen === 1 && !((obj = objects[0]) instanceof Splat)) { + if (obj instanceof Assign) { + _ref4 = obj, (_ref5 = _ref4.variable, idx = _ref5.base), obj = _ref4.value; + } else { + idx = isObject ? obj["this"] ? obj.properties[0].name : obj : new Literal(0); + } + acc = IDENTIFIER.test(idx.unwrap().value || 0); + value = new Value(value); + value.properties.push(new (acc ? Access : Index)(idx)); + if (_ref6 = obj.unwrap().value, __indexOf.call(RESERVED, _ref6) >= 0) { + obj.error("assignment to a reserved word: " + (obj.compile(o))); + } + return new Assign(obj, value, null, { + param: this.param + }).compileToFragments(o, LEVEL_TOP); + } + vvar = value.compileToFragments(o, LEVEL_LIST); + vvarText = fragmentsToText(vvar); + assigns = []; + splat = false; + if (!IDENTIFIER.test(vvarText) || this.variable.assigns(vvarText)) { + assigns.push([this.makeCode("" + (ref = o.scope.freeVariable('ref')) + " = ")].concat(__slice.call(vvar))); + vvar = [this.makeCode(ref)]; + vvarText = ref; + } + for (i = _i = 0, _len = objects.length; _i < _len; i = ++_i) { + obj = objects[i]; + idx = i; + if (isObject) { + if (obj instanceof Assign) { + _ref7 = obj, (_ref8 = _ref7.variable, idx = _ref8.base), obj = _ref7.value; + } else { + if (obj.base instanceof Parens) { + _ref9 = new Value(obj.unwrapAll()).cacheReference(o), obj = _ref9[0], idx = _ref9[1]; + } else { + idx = obj["this"] ? obj.properties[0].name : obj; + } + } + } + if (!splat && obj instanceof Splat) { + name = obj.name.unwrap().value; + obj = obj.unwrap(); + val = "" + olen + " <= " + vvarText + ".length ? " + (utility('slice')) + ".call(" + vvarText + ", " + i; + if (rest = olen - i - 1) { + ivar = o.scope.freeVariable('i'); + val += ", " + ivar + " = " + vvarText + ".length - " + rest + ") : (" + ivar + " = " + i + ", [])"; + } else { + val += ") : []"; + } + val = new Literal(val); + splat = "" + ivar + "++"; + } else { + name = obj.unwrap().value; + if (obj instanceof Splat) { + obj.error("multiple splats are disallowed in an assignment"); + } + if (typeof idx === 'number') { + idx = new Literal(splat || idx); + acc = false; + } else { + acc = isObject && IDENTIFIER.test(idx.unwrap().value || 0); + } + val = new Value(new Literal(vvarText), [new (acc ? Access : Index)(idx)]); + } + if ((name != null) && __indexOf.call(RESERVED, name) >= 0) { + obj.error("assignment to a reserved word: " + (obj.compile(o))); + } + assigns.push(new Assign(obj, val, null, { + param: this.param, + subpattern: true + }).compileToFragments(o, LEVEL_LIST)); + } + if (!(top || this.subpattern)) { + assigns.push(vvar); + } + fragments = this.joinFragmentArrays(assigns, ', '); + if (o.level < LEVEL_LIST) { + return fragments; + } else { + return this.wrapInBraces(fragments); + } + }; + + Assign.prototype.compileConditional = function(o) { + var left, right, _ref4; + _ref4 = this.variable.cacheReference(o), left = _ref4[0], right = _ref4[1]; + if (!left.properties.length && left.base instanceof Literal && left.base.value !== "this" && !o.scope.check(left.base.value)) { + this.variable.error("the variable \"" + left.base.value + "\" can't be assigned with " + this.context + " because it has not been declared before"); + } + if (__indexOf.call(this.context, "?") >= 0) { + o.isExistentialEquals = true; + } + return new Op(this.context.slice(0, -1), left, new Assign(right, this.value, '=')).compileToFragments(o); + }; + + Assign.prototype.compileSplice = function(o) { + var answer, exclusive, from, fromDecl, fromRef, name, to, valDef, valRef, _ref4, _ref5, _ref6; + _ref4 = this.variable.properties.pop().range, from = _ref4.from, to = _ref4.to, exclusive = _ref4.exclusive; + name = this.variable.compile(o); + if (from) { + _ref5 = this.cacheToCodeFragments(from.cache(o, LEVEL_OP)), fromDecl = _ref5[0], fromRef = _ref5[1]; + } else { + fromDecl = fromRef = '0'; + } + if (to) { + if ((from != null ? from.isSimpleNumber() : void 0) && to.isSimpleNumber()) { + to = +to.compile(o) - +fromRef; + if (!exclusive) { + to += 1; + } + } else { + to = to.compile(o, LEVEL_ACCESS) + ' - ' + fromRef; + if (!exclusive) { + to += ' + 1'; + } + } + } else { + to = "9e9"; + } + _ref6 = this.value.cache(o, LEVEL_LIST), valDef = _ref6[0], valRef = _ref6[1]; + answer = [].concat(this.makeCode("[].splice.apply(" + name + ", [" + fromDecl + ", " + to + "].concat("), valDef, this.makeCode(")), "), valRef); + if (o.level > LEVEL_TOP) { + return this.wrapInBraces(answer); + } else { + return answer; + } + }; + + return Assign; + + })(Base); + + exports.Code = Code = (function(_super) { + __extends(Code, _super); + + function Code(params, body, tag) { + this.params = params || []; + this.body = body || new Block; + this.bound = tag === 'boundfunc'; + if (this.bound) { + this.context = '_this'; + } + } + + Code.prototype.children = ['params', 'body']; + + Code.prototype.isStatement = function() { + return !!this.ctor; + }; + + Code.prototype.jumps = NO; + + Code.prototype.compileNode = function(o) { + var answer, code, exprs, i, idt, lit, p, param, params, ref, splats, uniqs, val, wasEmpty, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref4, _ref5, _ref6, _ref7, _ref8; + o.scope = new Scope(o.scope, this.body, this); + o.scope.shared = del(o, 'sharedScope'); + o.indent += TAB; + delete o.bare; + delete o.isExistentialEquals; + params = []; + exprs = []; + this.eachParamName(function(name) { + if (!o.scope.check(name)) { + return o.scope.parameter(name); + } + }); + _ref4 = this.params; + for (_i = 0, _len = _ref4.length; _i < _len; _i++) { + param = _ref4[_i]; + if (!param.splat) { + continue; + } + _ref5 = this.params; + for (_j = 0, _len1 = _ref5.length; _j < _len1; _j++) { + p = _ref5[_j].name; + if (p["this"]) { + p = p.properties[0].name; + } + if (p.value) { + o.scope.add(p.value, 'var', true); + } + } + splats = new Assign(new Value(new Arr((function() { + var _k, _len2, _ref6, _results; + _ref6 = this.params; + _results = []; + for (_k = 0, _len2 = _ref6.length; _k < _len2; _k++) { + p = _ref6[_k]; + _results.push(p.asReference(o)); + } + return _results; + }).call(this))), new Value(new Literal('arguments'))); + break; + } + _ref6 = this.params; + for (_k = 0, _len2 = _ref6.length; _k < _len2; _k++) { + param = _ref6[_k]; + if (param.isComplex()) { + val = ref = param.asReference(o); + if (param.value) { + val = new Op('?', ref, param.value); + } + exprs.push(new Assign(new Value(param.name), val, '=', { + param: true + })); + } else { + ref = param; + if (param.value) { + lit = new Literal(ref.name.value + ' == null'); + val = new Assign(new Value(param.name), param.value, '='); + exprs.push(new If(lit, val)); + } + } + if (!splats) { + params.push(ref); + } + } + wasEmpty = this.body.isEmpty(); + if (splats) { + exprs.unshift(splats); + } + if (exprs.length) { + (_ref7 = this.body.expressions).unshift.apply(_ref7, exprs); + } + for (i = _l = 0, _len3 = params.length; _l < _len3; i = ++_l) { + p = params[i]; + params[i] = p.compileToFragments(o); + o.scope.parameter(fragmentsToText(params[i])); + } + uniqs = []; + this.eachParamName(function(name, node) { + if (__indexOf.call(uniqs, name) >= 0) { + node.error("multiple parameters named '" + name + "'"); + } + return uniqs.push(name); + }); + if (!(wasEmpty || this.noReturn)) { + this.body.makeReturn(); + } + if (this.bound) { + if ((_ref8 = o.scope.parent.method) != null ? _ref8.bound : void 0) { + this.bound = this.context = o.scope.parent.method.context; + } else if (!this["static"]) { + o.scope.parent.assign('_this', 'this'); + } + } + idt = o.indent; + code = 'function'; + if (this.ctor) { + code += ' ' + this.name; + } + code += '('; + answer = [this.makeCode(code)]; + for (i = _m = 0, _len4 = params.length; _m < _len4; i = ++_m) { + p = params[i]; + if (i) { + answer.push(this.makeCode(", ")); + } + answer.push.apply(answer, p); + } + answer.push(this.makeCode(') {')); + if (!this.body.isEmpty()) { + answer = answer.concat(this.makeCode("\n"), this.body.compileWithDeclarations(o), this.makeCode("\n" + this.tab)); + } + answer.push(this.makeCode('}')); + if (this.ctor) { + return [this.makeCode(this.tab)].concat(__slice.call(answer)); + } + if (this.front || (o.level >= LEVEL_ACCESS)) { + return this.wrapInBraces(answer); + } else { + return answer; + } + }; + + Code.prototype.eachParamName = function(iterator) { + var param, _i, _len, _ref4, _results; + _ref4 = this.params; + _results = []; + for (_i = 0, _len = _ref4.length; _i < _len; _i++) { + param = _ref4[_i]; + _results.push(param.eachName(iterator)); + } + return _results; + }; + + Code.prototype.traverseChildren = function(crossScope, func) { + if (crossScope) { + return Code.__super__.traverseChildren.call(this, crossScope, func); + } + }; + + return Code; + + })(Base); + + exports.Param = Param = (function(_super) { + __extends(Param, _super); + + function Param(name, value, splat) { + var _ref4; + this.name = name; + this.value = value; + this.splat = splat; + if (_ref4 = (name = this.name.unwrapAll().value), __indexOf.call(STRICT_PROSCRIBED, _ref4) >= 0) { + this.name.error("parameter name \"" + name + "\" is not allowed"); + } + } + + Param.prototype.children = ['name', 'value']; + + Param.prototype.compileToFragments = function(o) { + return this.name.compileToFragments(o, LEVEL_LIST); + }; + + Param.prototype.asReference = function(o) { + var node; + if (this.reference) { + return this.reference; + } + node = this.name; + if (node["this"]) { + node = node.properties[0].name; + if (node.value.reserved) { + node = new Literal(o.scope.freeVariable(node.value)); + } + } else if (node.isComplex()) { + node = new Literal(o.scope.freeVariable('arg')); + } + node = new Value(node); + if (this.splat) { + node = new Splat(node); + } + return this.reference = node; + }; + + Param.prototype.isComplex = function() { + return this.name.isComplex(); + }; + + Param.prototype.eachName = function(iterator, name) { + var atParam, node, obj, _i, _len, _ref4; + if (name == null) { + name = this.name; + } + atParam = function(obj) { + var node; + node = obj.properties[0].name; + if (!node.value.reserved) { + return iterator(node.value, node); + } + }; + if (name instanceof Literal) { + return iterator(name.value, name); + } + if (name instanceof Value) { + return atParam(name); + } + _ref4 = name.objects; + for (_i = 0, _len = _ref4.length; _i < _len; _i++) { + obj = _ref4[_i]; + if (obj instanceof Assign) { + this.eachName(iterator, obj.value.unwrap()); + } else if (obj instanceof Splat) { + node = obj.name.unwrap(); + iterator(node.value, node); + } else if (obj instanceof Value) { + if (obj.isArray() || obj.isObject()) { + this.eachName(iterator, obj.base); + } else if (obj["this"]) { + atParam(obj); + } else { + iterator(obj.base.value, obj.base); + } + } else { + obj.error("illegal parameter " + (obj.compile())); + } + } + }; + + return Param; + + })(Base); + + exports.Splat = Splat = (function(_super) { + __extends(Splat, _super); + + Splat.prototype.children = ['name']; + + Splat.prototype.isAssignable = YES; + + function Splat(name) { + this.name = name.compile ? name : new Literal(name); + } + + Splat.prototype.assigns = function(name) { + return this.name.assigns(name); + }; + + Splat.prototype.compileToFragments = function(o) { + return this.name.compileToFragments(o); + }; + + Splat.prototype.unwrap = function() { + return this.name; + }; + + Splat.compileSplattedArray = function(o, list, apply) { + var args, base, compiledNode, concatPart, fragments, i, index, node, _i, _len; + index = -1; + while ((node = list[++index]) && !(node instanceof Splat)) { + continue; + } + if (index >= list.length) { + return []; + } + if (list.length === 1) { + node = list[0]; + fragments = node.compileToFragments(o, LEVEL_LIST); + if (apply) { + return fragments; + } + return [].concat(node.makeCode("" + (utility('slice')) + ".call("), fragments, node.makeCode(")")); + } + args = list.slice(index); + for (i = _i = 0, _len = args.length; _i < _len; i = ++_i) { + node = args[i]; + compiledNode = node.compileToFragments(o, LEVEL_LIST); + args[i] = node instanceof Splat ? [].concat(node.makeCode("" + (utility('slice')) + ".call("), compiledNode, node.makeCode(")")) : [].concat(node.makeCode("["), compiledNode, node.makeCode("]")); + } + if (index === 0) { + node = list[0]; + concatPart = node.joinFragmentArrays(args.slice(1), ', '); + return args[0].concat(node.makeCode(".concat("), concatPart, node.makeCode(")")); + } + base = (function() { + var _j, _len1, _ref4, _results; + _ref4 = list.slice(0, index); + _results = []; + for (_j = 0, _len1 = _ref4.length; _j < _len1; _j++) { + node = _ref4[_j]; + _results.push(node.compileToFragments(o, LEVEL_LIST)); + } + return _results; + })(); + base = list[0].joinFragmentArrays(base, ', '); + concatPart = list[index].joinFragmentArrays(args, ', '); + return [].concat(list[0].makeCode("["), base, list[index].makeCode("].concat("), concatPart, (last(list)).makeCode(")")); + }; + + return Splat; + + })(Base); + + exports.While = While = (function(_super) { + __extends(While, _super); + + function While(condition, options) { + this.condition = (options != null ? options.invert : void 0) ? condition.invert() : condition; + this.guard = options != null ? options.guard : void 0; + } + + While.prototype.children = ['condition', 'guard', 'body']; + + While.prototype.isStatement = YES; + + While.prototype.makeReturn = function(res) { + if (res) { + return While.__super__.makeReturn.apply(this, arguments); + } else { + this.returns = !this.jumps({ + loop: true + }); + return this; + } + }; + + While.prototype.addBody = function(body) { + this.body = body; + return this; + }; + + While.prototype.jumps = function() { + var expressions, node, _i, _len; + expressions = this.body.expressions; + if (!expressions.length) { + return false; + } + for (_i = 0, _len = expressions.length; _i < _len; _i++) { + node = expressions[_i]; + if (node.jumps({ + loop: true + })) { + return node; + } + } + return false; + }; + + While.prototype.compileNode = function(o) { + var answer, body, rvar, set; + o.indent += TAB; + set = ''; + body = this.body; + if (body.isEmpty()) { + body = this.makeCode(''); + } else { + if (this.returns) { + body.makeReturn(rvar = o.scope.freeVariable('results')); + set = "" + this.tab + rvar + " = [];\n"; + } + if (this.guard) { + if (body.expressions.length > 1) { + body.expressions.unshift(new If((new Parens(this.guard)).invert(), new Literal("continue"))); + } else { + if (this.guard) { + body = Block.wrap([new If(this.guard, body)]); + } + } + } + body = [].concat(this.makeCode("\n"), body.compileToFragments(o, LEVEL_TOP), this.makeCode("\n" + this.tab)); + } + answer = [].concat(this.makeCode(set + this.tab + "while ("), this.condition.compileToFragments(o, LEVEL_PAREN), this.makeCode(") {"), body, this.makeCode("}")); + if (this.returns) { + answer.push(this.makeCode("\n" + this.tab + "return " + rvar + ";")); + } + return answer; + }; + + return While; + + })(Base); + + exports.Op = Op = (function(_super) { + var CONVERSIONS, INVERSIONS; + + __extends(Op, _super); + + function Op(op, first, second, flip) { + if (op === 'in') { + return new In(first, second); + } + if (op === 'do') { + return this.generateDo(first); + } + if (op === 'new') { + if (first instanceof Call && !first["do"] && !first.isNew) { + return first.newInstance(); + } + if (first instanceof Code && first.bound || first["do"]) { + first = new Parens(first); + } + } + this.operator = CONVERSIONS[op] || op; + this.first = first; + this.second = second; + this.flip = !!flip; + return this; + } + + CONVERSIONS = { + '==': '===', + '!=': '!==', + 'of': 'in' + }; + + INVERSIONS = { + '!==': '===', + '===': '!==' + }; + + Op.prototype.children = ['first', 'second']; + + Op.prototype.isSimpleNumber = NO; + + Op.prototype.isUnary = function() { + return !this.second; + }; + + Op.prototype.isComplex = function() { + var _ref4; + return !(this.isUnary() && ((_ref4 = this.operator) === '+' || _ref4 === '-')) || this.first.isComplex(); + }; + + Op.prototype.isChainable = function() { + var _ref4; + return (_ref4 = this.operator) === '<' || _ref4 === '>' || _ref4 === '>=' || _ref4 === '<=' || _ref4 === '===' || _ref4 === '!=='; + }; + + Op.prototype.invert = function() { + var allInvertable, curr, fst, op, _ref4; + if (this.isChainable() && this.first.isChainable()) { + allInvertable = true; + curr = this; + while (curr && curr.operator) { + allInvertable && (allInvertable = curr.operator in INVERSIONS); + curr = curr.first; + } + if (!allInvertable) { + return new Parens(this).invert(); + } + curr = this; + while (curr && curr.operator) { + curr.invert = !curr.invert; + curr.operator = INVERSIONS[curr.operator]; + curr = curr.first; + } + return this; + } else if (op = INVERSIONS[this.operator]) { + this.operator = op; + if (this.first.unwrap() instanceof Op) { + this.first.invert(); + } + return this; + } else if (this.second) { + return new Parens(this).invert(); + } else if (this.operator === '!' && (fst = this.first.unwrap()) instanceof Op && ((_ref4 = fst.operator) === '!' || _ref4 === 'in' || _ref4 === 'instanceof')) { + return fst; + } else { + return new Op('!', this); + } + }; + + Op.prototype.unfoldSoak = function(o) { + var _ref4; + return ((_ref4 = this.operator) === '++' || _ref4 === '--' || _ref4 === 'delete') && unfoldSoak(o, this, 'first'); + }; + + Op.prototype.generateDo = function(exp) { + var call, func, param, passedParams, ref, _i, _len, _ref4; + passedParams = []; + func = exp instanceof Assign && (ref = exp.value.unwrap()) instanceof Code ? ref : exp; + _ref4 = func.params || []; + for (_i = 0, _len = _ref4.length; _i < _len; _i++) { + param = _ref4[_i]; + if (param.value) { + passedParams.push(param.value); + delete param.value; + } else { + passedParams.push(param); + } + } + call = new Call(exp, passedParams); + call["do"] = true; + return call; + }; + + Op.prototype.compileNode = function(o) { + var answer, isChain, _ref4, _ref5; + isChain = this.isChainable() && this.first.isChainable(); + if (!isChain) { + this.first.front = this.front; + } + if (this.operator === 'delete' && o.scope.check(this.first.unwrapAll().value)) { + this.error('delete operand may not be argument or var'); + } + if (((_ref4 = this.operator) === '--' || _ref4 === '++') && (_ref5 = this.first.unwrapAll().value, __indexOf.call(STRICT_PROSCRIBED, _ref5) >= 0)) { + this.error("cannot increment/decrement \"" + (this.first.unwrapAll().value) + "\""); + } + if (this.isUnary()) { + return this.compileUnary(o); + } + if (isChain) { + return this.compileChain(o); + } + if (this.operator === '?') { + return this.compileExistence(o); + } + answer = [].concat(this.first.compileToFragments(o, LEVEL_OP), this.makeCode(' ' + this.operator + ' '), this.second.compileToFragments(o, LEVEL_OP)); + if (o.level <= LEVEL_OP) { + return answer; + } else { + return this.wrapInBraces(answer); + } + }; + + Op.prototype.compileChain = function(o) { + var fragments, fst, shared, _ref4; + _ref4 = this.first.second.cache(o), this.first.second = _ref4[0], shared = _ref4[1]; + fst = this.first.compileToFragments(o, LEVEL_OP); + fragments = fst.concat(this.makeCode(" " + (this.invert ? '&&' : '||') + " "), shared.compileToFragments(o), this.makeCode(" " + this.operator + " "), this.second.compileToFragments(o, LEVEL_OP)); + return this.wrapInBraces(fragments); + }; + + Op.prototype.compileExistence = function(o) { + var fst, ref; + if (!o.isExistentialEquals && this.first.isComplex()) { + ref = new Literal(o.scope.freeVariable('ref')); + fst = new Parens(new Assign(ref, this.first)); + } else { + fst = this.first; + ref = fst; + } + return new If(new Existence(fst), ref, { + type: 'if' + }).addElse(this.second).compileToFragments(o); + }; + + Op.prototype.compileUnary = function(o) { + var op, parts, plusMinus; + parts = []; + op = this.operator; + parts.push([this.makeCode(op)]); + if (op === '!' && this.first instanceof Existence) { + this.first.negated = !this.first.negated; + return this.first.compileToFragments(o); + } + if (o.level >= LEVEL_ACCESS) { + return (new Parens(this)).compileToFragments(o); + } + plusMinus = op === '+' || op === '-'; + if ((op === 'new' || op === 'typeof' || op === 'delete') || plusMinus && this.first instanceof Op && this.first.operator === op) { + parts.push([this.makeCode(' ')]); + } + if ((plusMinus && this.first instanceof Op) || (op === 'new' && this.first.isStatement(o))) { + this.first = new Parens(this.first); + } + parts.push(this.first.compileToFragments(o, LEVEL_OP)); + if (this.flip) { + parts.reverse(); + } + return this.joinFragmentArrays(parts, ''); + }; + + Op.prototype.toString = function(idt) { + return Op.__super__.toString.call(this, idt, this.constructor.name + ' ' + this.operator); + }; + + return Op; + + })(Base); + + exports.In = In = (function(_super) { + __extends(In, _super); + + function In(object, array) { + this.object = object; + this.array = array; + } + + In.prototype.children = ['object', 'array']; + + In.prototype.invert = NEGATE; + + In.prototype.compileNode = function(o) { + var hasSplat, obj, _i, _len, _ref4; + if (this.array instanceof Value && this.array.isArray()) { + _ref4 = this.array.base.objects; + for (_i = 0, _len = _ref4.length; _i < _len; _i++) { + obj = _ref4[_i]; + if (!(obj instanceof Splat)) { + continue; + } + hasSplat = true; + break; + } + if (!hasSplat) { + return this.compileOrTest(o); + } + } + return this.compileLoopTest(o); + }; + + In.prototype.compileOrTest = function(o) { + var cmp, cnj, i, item, ref, sub, tests, _i, _len, _ref4, _ref5, _ref6; + if (this.array.base.objects.length === 0) { + return [this.makeCode("" + (!!this.negated))]; + } + _ref4 = this.object.cache(o, LEVEL_OP), sub = _ref4[0], ref = _ref4[1]; + _ref5 = this.negated ? [' !== ', ' && '] : [' === ', ' || '], cmp = _ref5[0], cnj = _ref5[1]; + tests = []; + _ref6 = this.array.base.objects; + for (i = _i = 0, _len = _ref6.length; _i < _len; i = ++_i) { + item = _ref6[i]; + if (i) { + tests.push(this.makeCode(cnj)); + } + tests = tests.concat((i ? ref : sub), this.makeCode(cmp), item.compileToFragments(o, LEVEL_ACCESS)); + } + if (o.level < LEVEL_OP) { + return tests; + } else { + return this.wrapInBraces(tests); + } + }; + + In.prototype.compileLoopTest = function(o) { + var fragments, ref, sub, _ref4; + _ref4 = this.object.cache(o, LEVEL_LIST), sub = _ref4[0], ref = _ref4[1]; + fragments = [].concat(this.makeCode(utility('indexOf') + ".call("), this.array.compileToFragments(o, LEVEL_LIST), this.makeCode(", "), ref, this.makeCode(") " + (this.negated ? '< 0' : '>= 0'))); + if (fragmentsToText(sub) === fragmentsToText(ref)) { + return fragments; + } + fragments = sub.concat(this.makeCode(', '), fragments); + if (o.level < LEVEL_LIST) { + return fragments; + } else { + return this.wrapInBraces(fragments); + } + }; + + In.prototype.toString = function(idt) { + return In.__super__.toString.call(this, idt, this.constructor.name + (this.negated ? '!' : '')); + }; + + return In; + + })(Base); + + exports.Try = Try = (function(_super) { + __extends(Try, _super); + + function Try(attempt, errorVariable, recovery, ensure) { + this.attempt = attempt; + this.errorVariable = errorVariable; + this.recovery = recovery; + this.ensure = ensure; + } + + Try.prototype.children = ['attempt', 'recovery', 'ensure']; + + Try.prototype.isStatement = YES; + + Try.prototype.jumps = function(o) { + var _ref4; + return this.attempt.jumps(o) || ((_ref4 = this.recovery) != null ? _ref4.jumps(o) : void 0); + }; + + Try.prototype.makeReturn = function(res) { + if (this.attempt) { + this.attempt = this.attempt.makeReturn(res); + } + if (this.recovery) { + this.recovery = this.recovery.makeReturn(res); + } + return this; + }; + + Try.prototype.compileNode = function(o) { + var catchPart, ensurePart, placeholder, tryPart; + o.indent += TAB; + tryPart = this.attempt.compileToFragments(o, LEVEL_TOP); + catchPart = this.recovery ? (placeholder = new Literal('_error'), this.errorVariable ? this.recovery.unshift(new Assign(this.errorVariable, placeholder)) : void 0, [].concat(this.makeCode(" catch ("), placeholder.compileToFragments(o), this.makeCode(") {\n"), this.recovery.compileToFragments(o, LEVEL_TOP), this.makeCode("\n" + this.tab + "}"))) : !(this.ensure || this.recovery) ? [this.makeCode(' catch (_error) {}')] : []; + ensurePart = this.ensure ? [].concat(this.makeCode(" finally {\n"), this.ensure.compileToFragments(o, LEVEL_TOP), this.makeCode("\n" + this.tab + "}")) : []; + return [].concat(this.makeCode("" + this.tab + "try {\n"), tryPart, this.makeCode("\n" + this.tab + "}"), catchPart, ensurePart); + }; + + return Try; + + })(Base); + + exports.Throw = Throw = (function(_super) { + __extends(Throw, _super); + + function Throw(expression) { + this.expression = expression; + } + + Throw.prototype.children = ['expression']; + + Throw.prototype.isStatement = YES; + + Throw.prototype.jumps = NO; + + Throw.prototype.makeReturn = THIS; + + Throw.prototype.compileNode = function(o) { + return [].concat(this.makeCode(this.tab + "throw "), this.expression.compileToFragments(o), this.makeCode(";")); + }; + + return Throw; + + })(Base); + + exports.Existence = Existence = (function(_super) { + __extends(Existence, _super); + + function Existence(expression) { + this.expression = expression; + } + + Existence.prototype.children = ['expression']; + + Existence.prototype.invert = NEGATE; + + Existence.prototype.compileNode = function(o) { + var cmp, cnj, code, _ref4; + this.expression.front = this.front; + code = this.expression.compile(o, LEVEL_OP); + if (IDENTIFIER.test(code) && !o.scope.check(code)) { + _ref4 = this.negated ? ['===', '||'] : ['!==', '&&'], cmp = _ref4[0], cnj = _ref4[1]; + code = "typeof " + code + " " + cmp + " \"undefined\" " + cnj + " " + code + " " + cmp + " null"; + } else { + code = "" + code + " " + (this.negated ? '==' : '!=') + " null"; + } + return [this.makeCode(o.level <= LEVEL_COND ? code : "(" + code + ")")]; + }; + + return Existence; + + })(Base); + + exports.Parens = Parens = (function(_super) { + __extends(Parens, _super); + + function Parens(body) { + this.body = body; + } + + Parens.prototype.children = ['body']; + + Parens.prototype.unwrap = function() { + return this.body; + }; + + Parens.prototype.isComplex = function() { + return this.body.isComplex(); + }; + + Parens.prototype.compileNode = function(o) { + var bare, expr, fragments; + expr = this.body.unwrap(); + if (expr instanceof Value && expr.isAtomic()) { + expr.front = this.front; + return expr.compileToFragments(o); + } + fragments = expr.compileToFragments(o, LEVEL_PAREN); + bare = o.level < LEVEL_OP && (expr instanceof Op || expr instanceof Call || (expr instanceof For && expr.returns)); + if (bare) { + return fragments; + } else { + return this.wrapInBraces(fragments); + } + }; + + return Parens; + + })(Base); + + exports.For = For = (function(_super) { + __extends(For, _super); + + function For(body, source) { + var _ref4; + this.source = source.source, this.guard = source.guard, this.step = source.step, this.name = source.name, this.index = source.index; + this.body = Block.wrap([body]); + this.own = !!source.own; + this.object = !!source.object; + if (this.object) { + _ref4 = [this.index, this.name], this.name = _ref4[0], this.index = _ref4[1]; + } + if (this.index instanceof Value) { + this.index.error('index cannot be a pattern matching expression'); + } + this.range = this.source instanceof Value && this.source.base instanceof Range && !this.source.properties.length; + this.pattern = this.name instanceof Value; + if (this.range && this.index) { + this.index.error('indexes do not apply to range loops'); + } + if (this.range && this.pattern) { + this.name.error('cannot pattern match over range loops'); + } + if (this.own && !this.object) { + this.index.error('cannot use own with for-in'); + } + this.returns = false; + } + + For.prototype.children = ['body', 'source', 'guard', 'step']; + + For.prototype.compileNode = function(o) { + var body, bodyFragments, compare, compareDown, declare, declareDown, defPart, defPartFragments, down, forPartFragments, guardPart, idt1, increment, index, ivar, kvar, kvarAssign, lastJumps, lvar, name, namePart, ref, resultPart, returnResult, rvar, scope, source, step, stepNum, stepVar, svar, varPart, _ref4, _ref5; + body = Block.wrap([this.body]); + lastJumps = (_ref4 = last(body.expressions)) != null ? _ref4.jumps() : void 0; + if (lastJumps && lastJumps instanceof Return) { + this.returns = false; + } + source = this.range ? this.source.base : this.source; + scope = o.scope; + name = this.name && (this.name.compile(o, LEVEL_LIST)); + index = this.index && (this.index.compile(o, LEVEL_LIST)); + if (name && !this.pattern) { + scope.find(name); + } + if (index) { + scope.find(index); + } + if (this.returns) { + rvar = scope.freeVariable('results'); + } + ivar = (this.object && index) || scope.freeVariable('i'); + kvar = (this.range && name) || index || ivar; + kvarAssign = kvar !== ivar ? "" + kvar + " = " : ""; + if (this.step && !this.range) { + _ref5 = this.cacheToCodeFragments(this.step.cache(o, LEVEL_LIST)), step = _ref5[0], stepVar = _ref5[1]; + stepNum = stepVar.match(SIMPLENUM); + } + if (this.pattern) { + name = ivar; + } + varPart = ''; + guardPart = ''; + defPart = ''; + idt1 = this.tab + TAB; + if (this.range) { + forPartFragments = source.compileToFragments(merge(o, { + index: ivar, + name: name, + step: this.step + })); + } else { + svar = this.source.compile(o, LEVEL_LIST); + if ((name || this.own) && !IDENTIFIER.test(svar)) { + defPart += "" + this.tab + (ref = scope.freeVariable('ref')) + " = " + svar + ";\n"; + svar = ref; + } + if (name && !this.pattern) { + namePart = "" + name + " = " + svar + "[" + kvar + "]"; + } + if (!this.object) { + if (step !== stepVar) { + defPart += "" + this.tab + step + ";\n"; + } + if (!(this.step && stepNum && (down = +stepNum < 0))) { + lvar = scope.freeVariable('len'); + } + declare = "" + kvarAssign + ivar + " = 0, " + lvar + " = " + svar + ".length"; + declareDown = "" + kvarAssign + ivar + " = " + svar + ".length - 1"; + compare = "" + ivar + " < " + lvar; + compareDown = "" + ivar + " >= 0"; + if (this.step) { + if (stepNum) { + if (down) { + compare = compareDown; + declare = declareDown; + } + } else { + compare = "" + stepVar + " > 0 ? " + compare + " : " + compareDown; + declare = "(" + stepVar + " > 0 ? (" + declare + ") : " + declareDown + ")"; + } + increment = "" + ivar + " += " + stepVar; + } else { + increment = "" + (kvar !== ivar ? "++" + ivar : "" + ivar + "++"); + } + forPartFragments = [this.makeCode("" + declare + "; " + compare + "; " + kvarAssign + increment)]; + } + } + if (this.returns) { + resultPart = "" + this.tab + rvar + " = [];\n"; + returnResult = "\n" + this.tab + "return " + rvar + ";"; + body.makeReturn(rvar); + } + if (this.guard) { + if (body.expressions.length > 1) { + body.expressions.unshift(new If((new Parens(this.guard)).invert(), new Literal("continue"))); + } else { + if (this.guard) { + body = Block.wrap([new If(this.guard, body)]); + } + } + } + if (this.pattern) { + body.expressions.unshift(new Assign(this.name, new Literal("" + svar + "[" + kvar + "]"))); + } + defPartFragments = [].concat(this.makeCode(defPart), this.pluckDirectCall(o, body)); + if (namePart) { + varPart = "\n" + idt1 + namePart + ";"; + } + if (this.object) { + forPartFragments = [this.makeCode("" + kvar + " in " + svar)]; + if (this.own) { + guardPart = "\n" + idt1 + "if (!" + (utility('hasProp')) + ".call(" + svar + ", " + kvar + ")) continue;"; + } + } + bodyFragments = body.compileToFragments(merge(o, { + indent: idt1 + }), LEVEL_TOP); + if (bodyFragments && (bodyFragments.length > 0)) { + bodyFragments = [].concat(this.makeCode("\n"), bodyFragments, this.makeCode("\n")); + } + return [].concat(defPartFragments, this.makeCode("" + (resultPart || '') + this.tab + "for ("), forPartFragments, this.makeCode(") {" + guardPart + varPart), bodyFragments, this.makeCode("" + this.tab + "}" + (returnResult || ''))); + }; + + For.prototype.pluckDirectCall = function(o, body) { + var base, defs, expr, fn, idx, ref, val, _i, _len, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9; + defs = []; + _ref4 = body.expressions; + for (idx = _i = 0, _len = _ref4.length; _i < _len; idx = ++_i) { + expr = _ref4[idx]; + expr = expr.unwrapAll(); + if (!(expr instanceof Call)) { + continue; + } + val = expr.variable.unwrapAll(); + if (!((val instanceof Code) || (val instanceof Value && ((_ref5 = val.base) != null ? _ref5.unwrapAll() : void 0) instanceof Code && val.properties.length === 1 && ((_ref6 = (_ref7 = val.properties[0].name) != null ? _ref7.value : void 0) === 'call' || _ref6 === 'apply')))) { + continue; + } + fn = ((_ref8 = val.base) != null ? _ref8.unwrapAll() : void 0) || val; + ref = new Literal(o.scope.freeVariable('fn')); + base = new Value(ref); + if (val.base) { + _ref9 = [base, val], val.base = _ref9[0], base = _ref9[1]; + } + body.expressions[idx] = new Call(base, expr.args); + defs = defs.concat(this.makeCode(this.tab), new Assign(ref, fn).compileToFragments(o, LEVEL_TOP), this.makeCode(';\n')); + } + return defs; + }; + + return For; + + })(While); + + exports.Switch = Switch = (function(_super) { + __extends(Switch, _super); + + function Switch(subject, cases, otherwise) { + this.subject = subject; + this.cases = cases; + this.otherwise = otherwise; + } + + Switch.prototype.children = ['subject', 'cases', 'otherwise']; + + Switch.prototype.isStatement = YES; + + Switch.prototype.jumps = function(o) { + var block, conds, _i, _len, _ref4, _ref5, _ref6; + if (o == null) { + o = { + block: true + }; + } + _ref4 = this.cases; + for (_i = 0, _len = _ref4.length; _i < _len; _i++) { + _ref5 = _ref4[_i], conds = _ref5[0], block = _ref5[1]; + if (block.jumps(o)) { + return block; + } + } + return (_ref6 = this.otherwise) != null ? _ref6.jumps(o) : void 0; + }; + + Switch.prototype.makeReturn = function(res) { + var pair, _i, _len, _ref4, _ref5; + _ref4 = this.cases; + for (_i = 0, _len = _ref4.length; _i < _len; _i++) { + pair = _ref4[_i]; + pair[1].makeReturn(res); + } + if (res) { + this.otherwise || (this.otherwise = new Block([new Literal('void 0')])); + } + if ((_ref5 = this.otherwise) != null) { + _ref5.makeReturn(res); + } + return this; + }; + + Switch.prototype.compileNode = function(o) { + var block, body, cond, conditions, expr, fragments, i, idt1, idt2, _i, _j, _len, _len1, _ref4, _ref5, _ref6; + idt1 = o.indent + TAB; + idt2 = o.indent = idt1 + TAB; + fragments = [].concat(this.makeCode(this.tab + "switch ("), (this.subject ? this.subject.compileToFragments(o, LEVEL_PAREN) : this.makeCode("false")), this.makeCode(") {\n")); + _ref4 = this.cases; + for (i = _i = 0, _len = _ref4.length; _i < _len; i = ++_i) { + _ref5 = _ref4[i], conditions = _ref5[0], block = _ref5[1]; + _ref6 = flatten([conditions]); + for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) { + cond = _ref6[_j]; + if (!this.subject) { + cond = cond.invert(); + } + fragments = fragments.concat(this.makeCode(idt1 + "case "), cond.compileToFragments(o, LEVEL_PAREN), this.makeCode(":\n")); + } + if ((body = block.compileToFragments(o, LEVEL_TOP)).length > 0) { + fragments = fragments.concat(body, this.makeCode('\n')); + } + if (i === this.cases.length - 1 && !this.otherwise) { + break; + } + expr = this.lastNonComment(block.expressions); + if (expr instanceof Return || (expr instanceof Literal && expr.jumps() && expr.value !== 'debugger')) { + continue; + } + fragments.push(cond.makeCode(idt2 + 'break;\n')); + } + if (this.otherwise && this.otherwise.expressions.length) { + fragments.push.apply(fragments, [this.makeCode(idt1 + "default:\n")].concat(__slice.call(this.otherwise.compileToFragments(o, LEVEL_TOP)), [this.makeCode("\n")])); + } + fragments.push(this.makeCode(this.tab + '}')); + return fragments; + }; + + return Switch; + + })(Base); + + exports.If = If = (function(_super) { + __extends(If, _super); + + function If(condition, body, options) { + this.body = body; + if (options == null) { + options = {}; + } + this.condition = options.type === 'unless' ? condition.invert() : condition; + this.elseBody = null; + this.isChain = false; + this.soak = options.soak; + } + + If.prototype.children = ['condition', 'body', 'elseBody']; + + If.prototype.bodyNode = function() { + var _ref4; + return (_ref4 = this.body) != null ? _ref4.unwrap() : void 0; + }; + + If.prototype.elseBodyNode = function() { + var _ref4; + return (_ref4 = this.elseBody) != null ? _ref4.unwrap() : void 0; + }; + + If.prototype.addElse = function(elseBody) { + if (this.isChain) { + this.elseBodyNode().addElse(elseBody); + } else { + this.isChain = elseBody instanceof If; + this.elseBody = this.ensureBlock(elseBody); + this.elseBody.updateLocationDataIfMissing(elseBody.locationData); + } + return this; + }; + + If.prototype.isStatement = function(o) { + var _ref4; + return (o != null ? o.level : void 0) === LEVEL_TOP || this.bodyNode().isStatement(o) || ((_ref4 = this.elseBodyNode()) != null ? _ref4.isStatement(o) : void 0); + }; + + If.prototype.jumps = function(o) { + var _ref4; + return this.body.jumps(o) || ((_ref4 = this.elseBody) != null ? _ref4.jumps(o) : void 0); + }; + + If.prototype.compileNode = function(o) { + if (this.isStatement(o)) { + return this.compileStatement(o); + } else { + return this.compileExpression(o); + } + }; + + If.prototype.makeReturn = function(res) { + if (res) { + this.elseBody || (this.elseBody = new Block([new Literal('void 0')])); + } + this.body && (this.body = new Block([this.body.makeReturn(res)])); + this.elseBody && (this.elseBody = new Block([this.elseBody.makeReturn(res)])); + return this; + }; + + If.prototype.ensureBlock = function(node) { + if (node instanceof Block) { + return node; + } else { + return new Block([node]); + } + }; + + If.prototype.compileStatement = function(o) { + var answer, body, child, cond, exeq, ifPart, indent; + child = del(o, 'chainChild'); + exeq = del(o, 'isExistentialEquals'); + if (exeq) { + return new If(this.condition.invert(), this.elseBodyNode(), { + type: 'if' + }).compileToFragments(o); + } + indent = o.indent + TAB; + cond = this.condition.compileToFragments(o, LEVEL_PAREN); + body = this.ensureBlock(this.body).compileToFragments(merge(o, { + indent: indent + })); + ifPart = [].concat(this.makeCode("if ("), cond, this.makeCode(") {\n"), body, this.makeCode("\n" + this.tab + "}")); + if (!child) { + ifPart.unshift(this.makeCode(this.tab)); + } + if (!this.elseBody) { + return ifPart; + } + answer = ifPart.concat(this.makeCode(' else ')); + if (this.isChain) { + o.chainChild = true; + answer = answer.concat(this.elseBody.unwrap().compileToFragments(o, LEVEL_TOP)); + } else { + answer = answer.concat(this.makeCode("{\n"), this.elseBody.compileToFragments(merge(o, { + indent: indent + }), LEVEL_TOP), this.makeCode("\n" + this.tab + "}")); + } + return answer; + }; + + If.prototype.compileExpression = function(o) { + var alt, body, cond, fragments; + cond = this.condition.compileToFragments(o, LEVEL_COND); + body = this.bodyNode().compileToFragments(o, LEVEL_LIST); + alt = this.elseBodyNode() ? this.elseBodyNode().compileToFragments(o, LEVEL_LIST) : [this.makeCode('void 0')]; + fragments = cond.concat(this.makeCode(" ? "), body, this.makeCode(" : "), alt); + if (o.level >= LEVEL_COND) { + return this.wrapInBraces(fragments); + } else { + return fragments; + } + }; + + If.prototype.unfoldSoak = function() { + return this.soak && this; + }; + + return If; + + })(Base); + + Closure = { + wrap: function(expressions, statement, noReturn) { + var args, argumentsNode, call, func, meth; + if (expressions.jumps()) { + return expressions; + } + func = new Code([], Block.wrap([expressions])); + args = []; + argumentsNode = expressions.contains(this.isLiteralArguments); + if (argumentsNode && expressions.classBody) { + argumentsNode.error("Class bodies shouldn't reference arguments"); + } + if (argumentsNode || expressions.contains(this.isLiteralThis)) { + meth = new Literal(argumentsNode ? 'apply' : 'call'); + args = [new Literal('this')]; + if (argumentsNode) { + args.push(new Literal('arguments')); + } + func = new Value(func, [new Access(meth)]); + } + func.noReturn = noReturn; + call = new Call(func, args); + if (statement) { + return Block.wrap([call]); + } else { + return call; + } + }, + isLiteralArguments: function(node) { + return node instanceof Literal && node.value === 'arguments' && !node.asKey; + }, + isLiteralThis: function(node) { + return (node instanceof Literal && node.value === 'this' && !node.asKey) || (node instanceof Code && node.bound) || (node instanceof Call && node.isSuper); + } + }; + + unfoldSoak = function(o, parent, name) { + var ifn; + if (!(ifn = parent[name].unfoldSoak(o))) { + return; + } + parent[name] = ifn.body; + ifn.body = new Value(parent); + return ifn; + }; + + UTILITIES = { + "extends": function() { + return "function(child, parent) { for (var key in parent) { if (" + (utility('hasProp')) + ".call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }"; + }, + bind: function() { + return 'function(fn, me){ return function(){ return fn.apply(me, arguments); }; }'; + }, + indexOf: function() { + return "[].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }"; + }, + hasProp: function() { + return '{}.hasOwnProperty'; + }, + slice: function() { + return '[].slice'; + } + }; + + LEVEL_TOP = 1; + + LEVEL_PAREN = 2; + + LEVEL_LIST = 3; + + LEVEL_COND = 4; + + LEVEL_OP = 5; + + LEVEL_ACCESS = 6; + + TAB = ' '; + + IDENTIFIER_STR = "[$A-Za-z_\\x7f-\\uffff][$\\w\\x7f-\\uffff]*"; + + IDENTIFIER = RegExp("^" + IDENTIFIER_STR + "$"); + + SIMPLENUM = /^[+-]?\d+$/; + + METHOD_DEF = RegExp("^(?:(" + IDENTIFIER_STR + ")\\.prototype(?:\\.(" + IDENTIFIER_STR + ")|\\[(\"(?:[^\\\\\"\\r\\n]|\\\\.)*\"|'(?:[^\\\\'\\r\\n]|\\\\.)*')\\]|\\[(0x[\\da-fA-F]+|\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\]))|(" + IDENTIFIER_STR + ")$"); + + IS_STRING = /^['"]/; + + utility = function(name) { + var ref; + ref = "__" + name; + Scope.root.assign(ref, UTILITIES[name]()); + return ref; + }; + + multident = function(code, tab) { + code = code.replace(/\n/g, '$&' + tab); + return code.replace(/\s+$/, ''); + }; + + +}); \ No newline at end of file diff --git a/addons/editor/ace/mode/coffee/parser.js b/addons/editor/ace/mode/coffee/parser.js new file mode 100755 index 00000000..00d1b723 --- /dev/null +++ b/addons/editor/ace/mode/coffee/parser.js @@ -0,0 +1,724 @@ +/** + * Copyright (c) 2009-2013 Jeremy Ashkenas + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + */ + +define(function(require, exports, module) { +/* parser generated by jison 0.4.4 */ +/* + Returns a Parser object of the following structure: + + Parser: { + yy: {} + } + + Parser.prototype: { + yy: {}, + trace: function(), + symbols_: {associative list: name ==> number}, + terminals_: {associative list: number ==> name}, + productions_: [...], + performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), + table: [...], + defaultActions: {...}, + parseError: function(str, hash), + parse: function(input), + + lexer: { + EOF: 1, + parseError: function(str, hash), + setInput: function(input), + input: function(), + unput: function(str), + more: function(), + less: function(n), + pastInput: function(), + upcomingInput: function(), + showPosition: function(), + test_match: function(regex_match_array, rule_index), + next: function(), + lex: function(), + begin: function(condition), + popState: function(), + _currentRules: function(), + topState: function(), + pushState: function(condition), + + options: { + ranges: boolean (optional: true ==> token location info will include a .range[] member) + flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) + backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code) + }, + + performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), + rules: [...], + conditions: {associative list: name ==> set}, + } + } + + + token location info (@$, _$, etc.): { + first_line: n, + last_line: n, + first_column: n, + last_column: n, + range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) + } + + + the parseError function receives a 'hash' object with these members for lexer and parser errors: { + text: (matched text) + token: (the produced terminal token, if any) + line: (yylineno) + } + while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { + loc: (yylloc) + expected: (string describing the set of expected tokens) + recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) + } +*/ + +var parser = {trace: function trace() { }, +yy: {}, +symbols_: {"error":2,"Root":3,"Body":4,"Line":5,"TERMINATOR":6,"Expression":7,"Statement":8,"Return":9,"Comment":10,"STATEMENT":11,"Value":12,"Invocation":13,"Code":14,"Operation":15,"Assign":16,"If":17,"Try":18,"While":19,"For":20,"Switch":21,"Class":22,"Throw":23,"Block":24,"INDENT":25,"OUTDENT":26,"Identifier":27,"IDENTIFIER":28,"AlphaNumeric":29,"NUMBER":30,"STRING":31,"Literal":32,"JS":33,"REGEX":34,"DEBUGGER":35,"UNDEFINED":36,"NULL":37,"BOOL":38,"Assignable":39,"=":40,"AssignObj":41,"ObjAssignable":42,":":43,"ThisProperty":44,"RETURN":45,"HERECOMMENT":46,"PARAM_START":47,"ParamList":48,"PARAM_END":49,"FuncGlyph":50,"->":51,"=>":52,"OptComma":53,",":54,"Param":55,"ParamVar":56,"...":57,"Array":58,"Object":59,"Splat":60,"SimpleAssignable":61,"Accessor":62,"Parenthetical":63,"Range":64,"This":65,".":66,"?.":67,"::":68,"?::":69,"Index":70,"INDEX_START":71,"IndexValue":72,"INDEX_END":73,"INDEX_SOAK":74,"Slice":75,"{":76,"AssignList":77,"}":78,"CLASS":79,"EXTENDS":80,"OptFuncExist":81,"Arguments":82,"SUPER":83,"FUNC_EXIST":84,"CALL_START":85,"CALL_END":86,"ArgList":87,"THIS":88,"@":89,"[":90,"]":91,"RangeDots":92,"..":93,"Arg":94,"SimpleArgs":95,"TRY":96,"Catch":97,"FINALLY":98,"CATCH":99,"THROW":100,"(":101,")":102,"WhileSource":103,"WHILE":104,"WHEN":105,"UNTIL":106,"Loop":107,"LOOP":108,"ForBody":109,"FOR":110,"ForStart":111,"ForSource":112,"ForVariables":113,"OWN":114,"ForValue":115,"FORIN":116,"FOROF":117,"BY":118,"SWITCH":119,"Whens":120,"ELSE":121,"When":122,"LEADING_WHEN":123,"IfBlock":124,"IF":125,"POST_IF":126,"UNARY":127,"-":128,"+":129,"--":130,"++":131,"?":132,"MATH":133,"SHIFT":134,"COMPARE":135,"LOGIC":136,"RELATION":137,"COMPOUND_ASSIGN":138,"$accept":0,"$end":1}, +terminals_: {2:"error",6:"TERMINATOR",11:"STATEMENT",25:"INDENT",26:"OUTDENT",28:"IDENTIFIER",30:"NUMBER",31:"STRING",33:"JS",34:"REGEX",35:"DEBUGGER",36:"UNDEFINED",37:"NULL",38:"BOOL",40:"=",43:":",45:"RETURN",46:"HERECOMMENT",47:"PARAM_START",49:"PARAM_END",51:"->",52:"=>",54:",",57:"...",66:".",67:"?.",68:"::",69:"?::",71:"INDEX_START",73:"INDEX_END",74:"INDEX_SOAK",76:"{",78:"}",79:"CLASS",80:"EXTENDS",83:"SUPER",84:"FUNC_EXIST",85:"CALL_START",86:"CALL_END",88:"THIS",89:"@",90:"[",91:"]",93:"..",96:"TRY",98:"FINALLY",99:"CATCH",100:"THROW",101:"(",102:")",104:"WHILE",105:"WHEN",106:"UNTIL",108:"LOOP",110:"FOR",114:"OWN",116:"FORIN",117:"FOROF",118:"BY",119:"SWITCH",121:"ELSE",123:"LEADING_WHEN",125:"IF",126:"POST_IF",127:"UNARY",128:"-",129:"+",130:"--",131:"++",132:"?",133:"MATH",134:"SHIFT",135:"COMPARE",136:"LOGIC",137:"RELATION",138:"COMPOUND_ASSIGN"}, +productions_: [0,[3,0],[3,1],[4,1],[4,3],[4,2],[5,1],[5,1],[8,1],[8,1],[8,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[24,2],[24,3],[27,1],[29,1],[29,1],[32,1],[32,1],[32,1],[32,1],[32,1],[32,1],[32,1],[16,3],[16,4],[16,5],[41,1],[41,3],[41,5],[41,1],[42,1],[42,1],[42,1],[9,2],[9,1],[10,1],[14,5],[14,2],[50,1],[50,1],[53,0],[53,1],[48,0],[48,1],[48,3],[48,4],[48,6],[55,1],[55,2],[55,3],[56,1],[56,1],[56,1],[56,1],[60,2],[61,1],[61,2],[61,2],[61,1],[39,1],[39,1],[39,1],[12,1],[12,1],[12,1],[12,1],[12,1],[62,2],[62,2],[62,2],[62,2],[62,1],[62,1],[70,3],[70,2],[72,1],[72,1],[59,4],[77,0],[77,1],[77,3],[77,4],[77,6],[22,1],[22,2],[22,3],[22,4],[22,2],[22,3],[22,4],[22,5],[13,3],[13,3],[13,1],[13,2],[81,0],[81,1],[82,2],[82,4],[65,1],[65,1],[44,2],[58,2],[58,4],[92,1],[92,1],[64,5],[75,3],[75,2],[75,2],[75,1],[87,1],[87,3],[87,4],[87,4],[87,6],[94,1],[94,1],[95,1],[95,3],[18,2],[18,3],[18,4],[18,5],[97,3],[97,3],[97,2],[23,2],[63,3],[63,5],[103,2],[103,4],[103,2],[103,4],[19,2],[19,2],[19,2],[19,1],[107,2],[107,2],[20,2],[20,2],[20,2],[109,2],[109,2],[111,2],[111,3],[115,1],[115,1],[115,1],[115,1],[113,1],[113,3],[112,2],[112,2],[112,4],[112,4],[112,4],[112,6],[112,6],[21,5],[21,7],[21,4],[21,6],[120,1],[120,2],[122,3],[122,4],[124,3],[124,5],[17,1],[17,3],[17,3],[17,3],[15,2],[15,2],[15,2],[15,2],[15,2],[15,2],[15,2],[15,2],[15,3],[15,3],[15,3],[15,3],[15,3],[15,3],[15,3],[15,3],[15,5],[15,4],[15,3]], +performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { +/* this == yyval */ + +var $0 = $$.length - 1; +switch (yystate) { +case 1:return this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Block); +break; +case 2:return this.$ = $$[$0]; +break; +case 3:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(yy.Block.wrap([$$[$0]])); +break; +case 4:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-2].push($$[$0])); +break; +case 5:this.$ = $$[$0-1]; +break; +case 6:this.$ = $$[$0]; +break; +case 7:this.$ = $$[$0]; +break; +case 8:this.$ = $$[$0]; +break; +case 9:this.$ = $$[$0]; +break; +case 10:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0])); +break; +case 11:this.$ = $$[$0]; +break; +case 12:this.$ = $$[$0]; +break; +case 13:this.$ = $$[$0]; +break; +case 14:this.$ = $$[$0]; +break; +case 15:this.$ = $$[$0]; +break; +case 16:this.$ = $$[$0]; +break; +case 17:this.$ = $$[$0]; +break; +case 18:this.$ = $$[$0]; +break; +case 19:this.$ = $$[$0]; +break; +case 20:this.$ = $$[$0]; +break; +case 21:this.$ = $$[$0]; +break; +case 22:this.$ = $$[$0]; +break; +case 23:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Block); +break; +case 24:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-1]); +break; +case 25:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0])); +break; +case 26:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0])); +break; +case 27:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0])); +break; +case 28:this.$ = $$[$0]; +break; +case 29:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0])); +break; +case 30:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0])); +break; +case 31:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0])); +break; +case 32:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Undefined); +break; +case 33:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Null); +break; +case 34:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Bool($$[$0])); +break; +case 35:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Assign($$[$0-2], $$[$0])); +break; +case 36:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Assign($$[$0-3], $$[$0])); +break; +case 37:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Assign($$[$0-4], $$[$0-1])); +break; +case 38:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0])); +break; +case 39:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Assign(yy.addLocationDataFn(_$[$0-2])(new yy.Value($$[$0-2])), $$[$0], 'object')); +break; +case 40:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Assign(yy.addLocationDataFn(_$[$0-4])(new yy.Value($$[$0-4])), $$[$0-1], 'object')); +break; +case 41:this.$ = $$[$0]; +break; +case 42:this.$ = $$[$0]; +break; +case 43:this.$ = $$[$0]; +break; +case 44:this.$ = $$[$0]; +break; +case 45:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Return($$[$0])); +break; +case 46:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Return); +break; +case 47:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Comment($$[$0])); +break; +case 48:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Code($$[$0-3], $$[$0], $$[$0-1])); +break; +case 49:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Code([], $$[$0], $$[$0-1])); +break; +case 50:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])('func'); +break; +case 51:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])('boundfunc'); +break; +case 52:this.$ = $$[$0]; +break; +case 53:this.$ = $$[$0]; +break; +case 54:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([]); +break; +case 55:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([$$[$0]]); +break; +case 56:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-2].concat($$[$0])); +break; +case 57:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])($$[$0-3].concat($$[$0])); +break; +case 58:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])($$[$0-5].concat($$[$0-2])); +break; +case 59:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Param($$[$0])); +break; +case 60:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Param($$[$0-1], null, true)); +break; +case 61:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Param($$[$0-2], $$[$0])); +break; +case 62:this.$ = $$[$0]; +break; +case 63:this.$ = $$[$0]; +break; +case 64:this.$ = $$[$0]; +break; +case 65:this.$ = $$[$0]; +break; +case 66:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Splat($$[$0-1])); +break; +case 67:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0])); +break; +case 68:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0-1].add($$[$0])); +break; +case 69:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Value($$[$0-1], [].concat($$[$0]))); +break; +case 70:this.$ = $$[$0]; +break; +case 71:this.$ = $$[$0]; +break; +case 72:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0])); +break; +case 73:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0])); +break; +case 74:this.$ = $$[$0]; +break; +case 75:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0])); +break; +case 76:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0])); +break; +case 77:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0])); +break; +case 78:this.$ = $$[$0]; +break; +case 79:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Access($$[$0])); +break; +case 80:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Access($$[$0], 'soak')); +break; +case 81:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])([yy.addLocationDataFn(_$[$0-1])(new yy.Access(new yy.Literal('prototype'))), yy.addLocationDataFn(_$[$0])(new yy.Access($$[$0]))]); +break; +case 82:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])([yy.addLocationDataFn(_$[$0-1])(new yy.Access(new yy.Literal('prototype'), 'soak')), yy.addLocationDataFn(_$[$0])(new yy.Access($$[$0]))]); +break; +case 83:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Access(new yy.Literal('prototype'))); +break; +case 84:this.$ = $$[$0]; +break; +case 85:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-1]); +break; +case 86:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(yy.extend($$[$0], { + soak: true + })); +break; +case 87:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Index($$[$0])); +break; +case 88:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Slice($$[$0])); +break; +case 89:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Obj($$[$0-2], $$[$0-3].generated)); +break; +case 90:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([]); +break; +case 91:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([$$[$0]]); +break; +case 92:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-2].concat($$[$0])); +break; +case 93:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])($$[$0-3].concat($$[$0])); +break; +case 94:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])($$[$0-5].concat($$[$0-2])); +break; +case 95:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Class); +break; +case 96:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Class(null, null, $$[$0])); +break; +case 97:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Class(null, $$[$0])); +break; +case 98:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Class(null, $$[$0-1], $$[$0])); +break; +case 99:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Class($$[$0])); +break; +case 100:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Class($$[$0-1], null, $$[$0])); +break; +case 101:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Class($$[$0-2], $$[$0])); +break; +case 102:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Class($$[$0-3], $$[$0-1], $$[$0])); +break; +case 103:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Call($$[$0-2], $$[$0], $$[$0-1])); +break; +case 104:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Call($$[$0-2], $$[$0], $$[$0-1])); +break; +case 105:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Call('super', [new yy.Splat(new yy.Literal('arguments'))])); +break; +case 106:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Call('super', $$[$0])); +break; +case 107:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(false); +break; +case 108:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(true); +break; +case 109:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])([]); +break; +case 110:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])($$[$0-2]); +break; +case 111:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value(new yy.Literal('this'))); +break; +case 112:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value(new yy.Literal('this'))); +break; +case 113:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Value(yy.addLocationDataFn(_$[$0-1])(new yy.Literal('this')), [yy.addLocationDataFn(_$[$0])(new yy.Access($$[$0]))], 'this')); +break; +case 114:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Arr([])); +break; +case 115:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Arr($$[$0-2])); +break; +case 116:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])('inclusive'); +break; +case 117:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])('exclusive'); +break; +case 118:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Range($$[$0-3], $$[$0-1], $$[$0-2])); +break; +case 119:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Range($$[$0-2], $$[$0], $$[$0-1])); +break; +case 120:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Range($$[$0-1], null, $$[$0])); +break; +case 121:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Range(null, $$[$0], $$[$0-1])); +break; +case 122:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Range(null, null, $$[$0])); +break; +case 123:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([$$[$0]]); +break; +case 124:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-2].concat($$[$0])); +break; +case 125:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])($$[$0-3].concat($$[$0])); +break; +case 126:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])($$[$0-2]); +break; +case 127:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])($$[$0-5].concat($$[$0-2])); +break; +case 128:this.$ = $$[$0]; +break; +case 129:this.$ = $$[$0]; +break; +case 130:this.$ = $$[$0]; +break; +case 131:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])([].concat($$[$0-2], $$[$0])); +break; +case 132:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Try($$[$0])); +break; +case 133:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Try($$[$0-1], $$[$0][0], $$[$0][1])); +break; +case 134:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Try($$[$0-2], null, null, $$[$0])); +break; +case 135:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Try($$[$0-3], $$[$0-2][0], $$[$0-2][1], $$[$0])); +break; +case 136:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])([$$[$0-1], $$[$0]]); +break; +case 137:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])([yy.addLocationDataFn(_$[$0-1])(new yy.Value($$[$0-1])), $$[$0]]); +break; +case 138:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])([null, $$[$0]]); +break; +case 139:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Throw($$[$0])); +break; +case 140:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Parens($$[$0-1])); +break; +case 141:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Parens($$[$0-2])); +break; +case 142:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.While($$[$0])); +break; +case 143:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.While($$[$0-2], { + guard: $$[$0] + })); +break; +case 144:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.While($$[$0], { + invert: true + })); +break; +case 145:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.While($$[$0-2], { + invert: true, + guard: $$[$0] + })); +break; +case 146:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0-1].addBody($$[$0])); +break; +case 147:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0].addBody(yy.addLocationDataFn(_$[$0-1])(yy.Block.wrap([$$[$0-1]])))); +break; +case 148:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0].addBody(yy.addLocationDataFn(_$[$0-1])(yy.Block.wrap([$$[$0-1]])))); +break; +case 149:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])($$[$0]); +break; +case 150:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.While(yy.addLocationDataFn(_$[$0-1])(new yy.Literal('true'))).addBody($$[$0])); +break; +case 151:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.While(yy.addLocationDataFn(_$[$0-1])(new yy.Literal('true'))).addBody(yy.addLocationDataFn(_$[$0])(yy.Block.wrap([$$[$0]])))); +break; +case 152:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.For($$[$0-1], $$[$0])); +break; +case 153:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.For($$[$0-1], $$[$0])); +break; +case 154:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.For($$[$0], $$[$0-1])); +break; +case 155:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])({ + source: yy.addLocationDataFn(_$[$0])(new yy.Value($$[$0])) + }); +break; +case 156:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])((function () { + $$[$0].own = $$[$0-1].own; + $$[$0].name = $$[$0-1][0]; + $$[$0].index = $$[$0-1][1]; + return $$[$0]; + }())); +break; +case 157:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0]); +break; +case 158:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])((function () { + $$[$0].own = true; + return $$[$0]; + }())); +break; +case 159:this.$ = $$[$0]; +break; +case 160:this.$ = $$[$0]; +break; +case 161:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0])); +break; +case 162:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0])); +break; +case 163:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([$$[$0]]); +break; +case 164:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])([$$[$0-2], $$[$0]]); +break; +case 165:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])({ + source: $$[$0] + }); +break; +case 166:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])({ + source: $$[$0], + object: true + }); +break; +case 167:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])({ + source: $$[$0-2], + guard: $$[$0] + }); +break; +case 168:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])({ + source: $$[$0-2], + guard: $$[$0], + object: true + }); +break; +case 169:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])({ + source: $$[$0-2], + step: $$[$0] + }); +break; +case 170:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])({ + source: $$[$0-4], + guard: $$[$0-2], + step: $$[$0] + }); +break; +case 171:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])({ + source: $$[$0-4], + step: $$[$0-2], + guard: $$[$0] + }); +break; +case 172:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Switch($$[$0-3], $$[$0-1])); +break; +case 173:this.$ = yy.addLocationDataFn(_$[$0-6], _$[$0])(new yy.Switch($$[$0-5], $$[$0-3], $$[$0-1])); +break; +case 174:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Switch(null, $$[$0-1])); +break; +case 175:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])(new yy.Switch(null, $$[$0-3], $$[$0-1])); +break; +case 176:this.$ = $$[$0]; +break; +case 177:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0-1].concat($$[$0])); +break; +case 178:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])([[$$[$0-1], $$[$0]]]); +break; +case 179:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])([[$$[$0-2], $$[$0-1]]]); +break; +case 180:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.If($$[$0-1], $$[$0], { + type: $$[$0-2] + })); +break; +case 181:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])($$[$0-4].addElse(yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.If($$[$0-1], $$[$0], { + type: $$[$0-2] + })))); +break; +case 182:this.$ = $$[$0]; +break; +case 183:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-2].addElse($$[$0])); +break; +case 184:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.If($$[$0], yy.addLocationDataFn(_$[$0-2])(yy.Block.wrap([$$[$0-2]])), { + type: $$[$0-1], + statement: true + })); +break; +case 185:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.If($$[$0], yy.addLocationDataFn(_$[$0-2])(yy.Block.wrap([$$[$0-2]])), { + type: $$[$0-1], + statement: true + })); +break; +case 186:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op($$[$0-1], $$[$0])); +break; +case 187:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('-', $$[$0])); +break; +case 188:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('+', $$[$0])); +break; +case 189:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('--', $$[$0])); +break; +case 190:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('++', $$[$0])); +break; +case 191:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('--', $$[$0-1], null, true)); +break; +case 192:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('++', $$[$0-1], null, true)); +break; +case 193:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Existence($$[$0-1])); +break; +case 194:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op('+', $$[$0-2], $$[$0])); +break; +case 195:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op('-', $$[$0-2], $$[$0])); +break; +case 196:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op($$[$0-1], $$[$0-2], $$[$0])); +break; +case 197:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op($$[$0-1], $$[$0-2], $$[$0])); +break; +case 198:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op($$[$0-1], $$[$0-2], $$[$0])); +break; +case 199:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op($$[$0-1], $$[$0-2], $$[$0])); +break; +case 200:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])((function () { + if ($$[$0-1].charAt(0) === '!') { + return new yy.Op($$[$0-1].slice(1), $$[$0-2], $$[$0]).invert(); + } else { + return new yy.Op($$[$0-1], $$[$0-2], $$[$0]); + } + }())); +break; +case 201:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Assign($$[$0-2], $$[$0], $$[$0-1])); +break; +case 202:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Assign($$[$0-4], $$[$0-1], $$[$0-3])); +break; +case 203:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Assign($$[$0-3], $$[$0], $$[$0-2])); +break; +case 204:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Extends($$[$0-2], $$[$0])); +break; +} +}, +table: [{1:[2,1],3:1,4:2,5:3,7:4,8:5,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[3]},{1:[2,2],6:[1,72]},{1:[2,3],6:[2,3],26:[2,3],102:[2,3]},{1:[2,6],6:[2,6],26:[2,6],102:[2,6],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,7],6:[2,7],26:[2,7],102:[2,7],103:85,104:[1,63],106:[1,64],109:86,110:[1,66],111:67,126:[1,84]},{1:[2,11],6:[2,11],25:[2,11],26:[2,11],49:[2,11],54:[2,11],57:[2,11],62:88,66:[1,90],67:[1,91],68:[1,92],69:[1,93],70:94,71:[1,95],73:[2,11],74:[1,96],78:[2,11],81:87,84:[1,89],85:[2,107],86:[2,11],91:[2,11],93:[2,11],102:[2,11],104:[2,11],105:[2,11],106:[2,11],110:[2,11],118:[2,11],126:[2,11],128:[2,11],129:[2,11],132:[2,11],133:[2,11],134:[2,11],135:[2,11],136:[2,11],137:[2,11]},{1:[2,12],6:[2,12],25:[2,12],26:[2,12],49:[2,12],54:[2,12],57:[2,12],62:98,66:[1,90],67:[1,91],68:[1,92],69:[1,93],70:94,71:[1,95],73:[2,12],74:[1,96],78:[2,12],81:97,84:[1,89],85:[2,107],86:[2,12],91:[2,12],93:[2,12],102:[2,12],104:[2,12],105:[2,12],106:[2,12],110:[2,12],118:[2,12],126:[2,12],128:[2,12],129:[2,12],132:[2,12],133:[2,12],134:[2,12],135:[2,12],136:[2,12],137:[2,12]},{1:[2,13],6:[2,13],25:[2,13],26:[2,13],49:[2,13],54:[2,13],57:[2,13],73:[2,13],78:[2,13],86:[2,13],91:[2,13],93:[2,13],102:[2,13],104:[2,13],105:[2,13],106:[2,13],110:[2,13],118:[2,13],126:[2,13],128:[2,13],129:[2,13],132:[2,13],133:[2,13],134:[2,13],135:[2,13],136:[2,13],137:[2,13]},{1:[2,14],6:[2,14],25:[2,14],26:[2,14],49:[2,14],54:[2,14],57:[2,14],73:[2,14],78:[2,14],86:[2,14],91:[2,14],93:[2,14],102:[2,14],104:[2,14],105:[2,14],106:[2,14],110:[2,14],118:[2,14],126:[2,14],128:[2,14],129:[2,14],132:[2,14],133:[2,14],134:[2,14],135:[2,14],136:[2,14],137:[2,14]},{1:[2,15],6:[2,15],25:[2,15],26:[2,15],49:[2,15],54:[2,15],57:[2,15],73:[2,15],78:[2,15],86:[2,15],91:[2,15],93:[2,15],102:[2,15],104:[2,15],105:[2,15],106:[2,15],110:[2,15],118:[2,15],126:[2,15],128:[2,15],129:[2,15],132:[2,15],133:[2,15],134:[2,15],135:[2,15],136:[2,15],137:[2,15]},{1:[2,16],6:[2,16],25:[2,16],26:[2,16],49:[2,16],54:[2,16],57:[2,16],73:[2,16],78:[2,16],86:[2,16],91:[2,16],93:[2,16],102:[2,16],104:[2,16],105:[2,16],106:[2,16],110:[2,16],118:[2,16],126:[2,16],128:[2,16],129:[2,16],132:[2,16],133:[2,16],134:[2,16],135:[2,16],136:[2,16],137:[2,16]},{1:[2,17],6:[2,17],25:[2,17],26:[2,17],49:[2,17],54:[2,17],57:[2,17],73:[2,17],78:[2,17],86:[2,17],91:[2,17],93:[2,17],102:[2,17],104:[2,17],105:[2,17],106:[2,17],110:[2,17],118:[2,17],126:[2,17],128:[2,17],129:[2,17],132:[2,17],133:[2,17],134:[2,17],135:[2,17],136:[2,17],137:[2,17]},{1:[2,18],6:[2,18],25:[2,18],26:[2,18],49:[2,18],54:[2,18],57:[2,18],73:[2,18],78:[2,18],86:[2,18],91:[2,18],93:[2,18],102:[2,18],104:[2,18],105:[2,18],106:[2,18],110:[2,18],118:[2,18],126:[2,18],128:[2,18],129:[2,18],132:[2,18],133:[2,18],134:[2,18],135:[2,18],136:[2,18],137:[2,18]},{1:[2,19],6:[2,19],25:[2,19],26:[2,19],49:[2,19],54:[2,19],57:[2,19],73:[2,19],78:[2,19],86:[2,19],91:[2,19],93:[2,19],102:[2,19],104:[2,19],105:[2,19],106:[2,19],110:[2,19],118:[2,19],126:[2,19],128:[2,19],129:[2,19],132:[2,19],133:[2,19],134:[2,19],135:[2,19],136:[2,19],137:[2,19]},{1:[2,20],6:[2,20],25:[2,20],26:[2,20],49:[2,20],54:[2,20],57:[2,20],73:[2,20],78:[2,20],86:[2,20],91:[2,20],93:[2,20],102:[2,20],104:[2,20],105:[2,20],106:[2,20],110:[2,20],118:[2,20],126:[2,20],128:[2,20],129:[2,20],132:[2,20],133:[2,20],134:[2,20],135:[2,20],136:[2,20],137:[2,20]},{1:[2,21],6:[2,21],25:[2,21],26:[2,21],49:[2,21],54:[2,21],57:[2,21],73:[2,21],78:[2,21],86:[2,21],91:[2,21],93:[2,21],102:[2,21],104:[2,21],105:[2,21],106:[2,21],110:[2,21],118:[2,21],126:[2,21],128:[2,21],129:[2,21],132:[2,21],133:[2,21],134:[2,21],135:[2,21],136:[2,21],137:[2,21]},{1:[2,22],6:[2,22],25:[2,22],26:[2,22],49:[2,22],54:[2,22],57:[2,22],73:[2,22],78:[2,22],86:[2,22],91:[2,22],93:[2,22],102:[2,22],104:[2,22],105:[2,22],106:[2,22],110:[2,22],118:[2,22],126:[2,22],128:[2,22],129:[2,22],132:[2,22],133:[2,22],134:[2,22],135:[2,22],136:[2,22],137:[2,22]},{1:[2,8],6:[2,8],26:[2,8],102:[2,8],104:[2,8],106:[2,8],110:[2,8],126:[2,8]},{1:[2,9],6:[2,9],26:[2,9],102:[2,9],104:[2,9],106:[2,9],110:[2,9],126:[2,9]},{1:[2,10],6:[2,10],26:[2,10],102:[2,10],104:[2,10],106:[2,10],110:[2,10],126:[2,10]},{1:[2,74],6:[2,74],25:[2,74],26:[2,74],40:[1,99],49:[2,74],54:[2,74],57:[2,74],66:[2,74],67:[2,74],68:[2,74],69:[2,74],71:[2,74],73:[2,74],74:[2,74],78:[2,74],84:[2,74],85:[2,74],86:[2,74],91:[2,74],93:[2,74],102:[2,74],104:[2,74],105:[2,74],106:[2,74],110:[2,74],118:[2,74],126:[2,74],128:[2,74],129:[2,74],132:[2,74],133:[2,74],134:[2,74],135:[2,74],136:[2,74],137:[2,74]},{1:[2,75],6:[2,75],25:[2,75],26:[2,75],49:[2,75],54:[2,75],57:[2,75],66:[2,75],67:[2,75],68:[2,75],69:[2,75],71:[2,75],73:[2,75],74:[2,75],78:[2,75],84:[2,75],85:[2,75],86:[2,75],91:[2,75],93:[2,75],102:[2,75],104:[2,75],105:[2,75],106:[2,75],110:[2,75],118:[2,75],126:[2,75],128:[2,75],129:[2,75],132:[2,75],133:[2,75],134:[2,75],135:[2,75],136:[2,75],137:[2,75]},{1:[2,76],6:[2,76],25:[2,76],26:[2,76],49:[2,76],54:[2,76],57:[2,76],66:[2,76],67:[2,76],68:[2,76],69:[2,76],71:[2,76],73:[2,76],74:[2,76],78:[2,76],84:[2,76],85:[2,76],86:[2,76],91:[2,76],93:[2,76],102:[2,76],104:[2,76],105:[2,76],106:[2,76],110:[2,76],118:[2,76],126:[2,76],128:[2,76],129:[2,76],132:[2,76],133:[2,76],134:[2,76],135:[2,76],136:[2,76],137:[2,76]},{1:[2,77],6:[2,77],25:[2,77],26:[2,77],49:[2,77],54:[2,77],57:[2,77],66:[2,77],67:[2,77],68:[2,77],69:[2,77],71:[2,77],73:[2,77],74:[2,77],78:[2,77],84:[2,77],85:[2,77],86:[2,77],91:[2,77],93:[2,77],102:[2,77],104:[2,77],105:[2,77],106:[2,77],110:[2,77],118:[2,77],126:[2,77],128:[2,77],129:[2,77],132:[2,77],133:[2,77],134:[2,77],135:[2,77],136:[2,77],137:[2,77]},{1:[2,78],6:[2,78],25:[2,78],26:[2,78],49:[2,78],54:[2,78],57:[2,78],66:[2,78],67:[2,78],68:[2,78],69:[2,78],71:[2,78],73:[2,78],74:[2,78],78:[2,78],84:[2,78],85:[2,78],86:[2,78],91:[2,78],93:[2,78],102:[2,78],104:[2,78],105:[2,78],106:[2,78],110:[2,78],118:[2,78],126:[2,78],128:[2,78],129:[2,78],132:[2,78],133:[2,78],134:[2,78],135:[2,78],136:[2,78],137:[2,78]},{1:[2,105],6:[2,105],25:[2,105],26:[2,105],49:[2,105],54:[2,105],57:[2,105],66:[2,105],67:[2,105],68:[2,105],69:[2,105],71:[2,105],73:[2,105],74:[2,105],78:[2,105],82:100,84:[2,105],85:[1,101],86:[2,105],91:[2,105],93:[2,105],102:[2,105],104:[2,105],105:[2,105],106:[2,105],110:[2,105],118:[2,105],126:[2,105],128:[2,105],129:[2,105],132:[2,105],133:[2,105],134:[2,105],135:[2,105],136:[2,105],137:[2,105]},{6:[2,54],25:[2,54],27:105,28:[1,71],44:106,48:102,49:[2,54],54:[2,54],55:103,56:104,58:107,59:108,76:[1,68],89:[1,109],90:[1,110]},{24:111,25:[1,112]},{7:113,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:115,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:116,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{12:118,13:119,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:120,44:61,58:45,59:46,61:117,63:23,64:24,65:25,76:[1,68],83:[1,26],88:[1,56],89:[1,57],90:[1,55],101:[1,54]},{12:118,13:119,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:120,44:61,58:45,59:46,61:121,63:23,64:24,65:25,76:[1,68],83:[1,26],88:[1,56],89:[1,57],90:[1,55],101:[1,54]},{1:[2,71],6:[2,71],25:[2,71],26:[2,71],40:[2,71],49:[2,71],54:[2,71],57:[2,71],66:[2,71],67:[2,71],68:[2,71],69:[2,71],71:[2,71],73:[2,71],74:[2,71],78:[2,71],80:[1,125],84:[2,71],85:[2,71],86:[2,71],91:[2,71],93:[2,71],102:[2,71],104:[2,71],105:[2,71],106:[2,71],110:[2,71],118:[2,71],126:[2,71],128:[2,71],129:[2,71],130:[1,122],131:[1,123],132:[2,71],133:[2,71],134:[2,71],135:[2,71],136:[2,71],137:[2,71],138:[1,124]},{1:[2,182],6:[2,182],25:[2,182],26:[2,182],49:[2,182],54:[2,182],57:[2,182],73:[2,182],78:[2,182],86:[2,182],91:[2,182],93:[2,182],102:[2,182],104:[2,182],105:[2,182],106:[2,182],110:[2,182],118:[2,182],121:[1,126],126:[2,182],128:[2,182],129:[2,182],132:[2,182],133:[2,182],134:[2,182],135:[2,182],136:[2,182],137:[2,182]},{24:127,25:[1,112]},{24:128,25:[1,112]},{1:[2,149],6:[2,149],25:[2,149],26:[2,149],49:[2,149],54:[2,149],57:[2,149],73:[2,149],78:[2,149],86:[2,149],91:[2,149],93:[2,149],102:[2,149],104:[2,149],105:[2,149],106:[2,149],110:[2,149],118:[2,149],126:[2,149],128:[2,149],129:[2,149],132:[2,149],133:[2,149],134:[2,149],135:[2,149],136:[2,149],137:[2,149]},{24:129,25:[1,112]},{7:130,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,131],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,95],6:[2,95],12:118,13:119,24:132,25:[1,112],26:[2,95],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:120,44:61,49:[2,95],54:[2,95],57:[2,95],58:45,59:46,61:134,63:23,64:24,65:25,73:[2,95],76:[1,68],78:[2,95],80:[1,133],83:[1,26],86:[2,95],88:[1,56],89:[1,57],90:[1,55],91:[2,95],93:[2,95],101:[1,54],102:[2,95],104:[2,95],105:[2,95],106:[2,95],110:[2,95],118:[2,95],126:[2,95],128:[2,95],129:[2,95],132:[2,95],133:[2,95],134:[2,95],135:[2,95],136:[2,95],137:[2,95]},{7:135,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,46],6:[2,46],7:136,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,26:[2,46],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],102:[2,46],103:37,104:[2,46],106:[2,46],107:38,108:[1,65],109:39,110:[2,46],111:67,119:[1,40],124:35,125:[1,62],126:[2,46],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,47],6:[2,47],25:[2,47],26:[2,47],54:[2,47],78:[2,47],102:[2,47],104:[2,47],106:[2,47],110:[2,47],126:[2,47]},{1:[2,72],6:[2,72],25:[2,72],26:[2,72],40:[2,72],49:[2,72],54:[2,72],57:[2,72],66:[2,72],67:[2,72],68:[2,72],69:[2,72],71:[2,72],73:[2,72],74:[2,72],78:[2,72],84:[2,72],85:[2,72],86:[2,72],91:[2,72],93:[2,72],102:[2,72],104:[2,72],105:[2,72],106:[2,72],110:[2,72],118:[2,72],126:[2,72],128:[2,72],129:[2,72],132:[2,72],133:[2,72],134:[2,72],135:[2,72],136:[2,72],137:[2,72]},{1:[2,73],6:[2,73],25:[2,73],26:[2,73],40:[2,73],49:[2,73],54:[2,73],57:[2,73],66:[2,73],67:[2,73],68:[2,73],69:[2,73],71:[2,73],73:[2,73],74:[2,73],78:[2,73],84:[2,73],85:[2,73],86:[2,73],91:[2,73],93:[2,73],102:[2,73],104:[2,73],105:[2,73],106:[2,73],110:[2,73],118:[2,73],126:[2,73],128:[2,73],129:[2,73],132:[2,73],133:[2,73],134:[2,73],135:[2,73],136:[2,73],137:[2,73]},{1:[2,28],6:[2,28],25:[2,28],26:[2,28],49:[2,28],54:[2,28],57:[2,28],66:[2,28],67:[2,28],68:[2,28],69:[2,28],71:[2,28],73:[2,28],74:[2,28],78:[2,28],84:[2,28],85:[2,28],86:[2,28],91:[2,28],93:[2,28],102:[2,28],104:[2,28],105:[2,28],106:[2,28],110:[2,28],118:[2,28],126:[2,28],128:[2,28],129:[2,28],132:[2,28],133:[2,28],134:[2,28],135:[2,28],136:[2,28],137:[2,28]},{1:[2,29],6:[2,29],25:[2,29],26:[2,29],49:[2,29],54:[2,29],57:[2,29],66:[2,29],67:[2,29],68:[2,29],69:[2,29],71:[2,29],73:[2,29],74:[2,29],78:[2,29],84:[2,29],85:[2,29],86:[2,29],91:[2,29],93:[2,29],102:[2,29],104:[2,29],105:[2,29],106:[2,29],110:[2,29],118:[2,29],126:[2,29],128:[2,29],129:[2,29],132:[2,29],133:[2,29],134:[2,29],135:[2,29],136:[2,29],137:[2,29]},{1:[2,30],6:[2,30],25:[2,30],26:[2,30],49:[2,30],54:[2,30],57:[2,30],66:[2,30],67:[2,30],68:[2,30],69:[2,30],71:[2,30],73:[2,30],74:[2,30],78:[2,30],84:[2,30],85:[2,30],86:[2,30],91:[2,30],93:[2,30],102:[2,30],104:[2,30],105:[2,30],106:[2,30],110:[2,30],118:[2,30],126:[2,30],128:[2,30],129:[2,30],132:[2,30],133:[2,30],134:[2,30],135:[2,30],136:[2,30],137:[2,30]},{1:[2,31],6:[2,31],25:[2,31],26:[2,31],49:[2,31],54:[2,31],57:[2,31],66:[2,31],67:[2,31],68:[2,31],69:[2,31],71:[2,31],73:[2,31],74:[2,31],78:[2,31],84:[2,31],85:[2,31],86:[2,31],91:[2,31],93:[2,31],102:[2,31],104:[2,31],105:[2,31],106:[2,31],110:[2,31],118:[2,31],126:[2,31],128:[2,31],129:[2,31],132:[2,31],133:[2,31],134:[2,31],135:[2,31],136:[2,31],137:[2,31]},{1:[2,32],6:[2,32],25:[2,32],26:[2,32],49:[2,32],54:[2,32],57:[2,32],66:[2,32],67:[2,32],68:[2,32],69:[2,32],71:[2,32],73:[2,32],74:[2,32],78:[2,32],84:[2,32],85:[2,32],86:[2,32],91:[2,32],93:[2,32],102:[2,32],104:[2,32],105:[2,32],106:[2,32],110:[2,32],118:[2,32],126:[2,32],128:[2,32],129:[2,32],132:[2,32],133:[2,32],134:[2,32],135:[2,32],136:[2,32],137:[2,32]},{1:[2,33],6:[2,33],25:[2,33],26:[2,33],49:[2,33],54:[2,33],57:[2,33],66:[2,33],67:[2,33],68:[2,33],69:[2,33],71:[2,33],73:[2,33],74:[2,33],78:[2,33],84:[2,33],85:[2,33],86:[2,33],91:[2,33],93:[2,33],102:[2,33],104:[2,33],105:[2,33],106:[2,33],110:[2,33],118:[2,33],126:[2,33],128:[2,33],129:[2,33],132:[2,33],133:[2,33],134:[2,33],135:[2,33],136:[2,33],137:[2,33]},{1:[2,34],6:[2,34],25:[2,34],26:[2,34],49:[2,34],54:[2,34],57:[2,34],66:[2,34],67:[2,34],68:[2,34],69:[2,34],71:[2,34],73:[2,34],74:[2,34],78:[2,34],84:[2,34],85:[2,34],86:[2,34],91:[2,34],93:[2,34],102:[2,34],104:[2,34],105:[2,34],106:[2,34],110:[2,34],118:[2,34],126:[2,34],128:[2,34],129:[2,34],132:[2,34],133:[2,34],134:[2,34],135:[2,34],136:[2,34],137:[2,34]},{4:137,5:3,7:4,8:5,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,138],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:139,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,143],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,60:144,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],87:141,88:[1,56],89:[1,57],90:[1,55],91:[1,140],94:142,96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,111],6:[2,111],25:[2,111],26:[2,111],49:[2,111],54:[2,111],57:[2,111],66:[2,111],67:[2,111],68:[2,111],69:[2,111],71:[2,111],73:[2,111],74:[2,111],78:[2,111],84:[2,111],85:[2,111],86:[2,111],91:[2,111],93:[2,111],102:[2,111],104:[2,111],105:[2,111],106:[2,111],110:[2,111],118:[2,111],126:[2,111],128:[2,111],129:[2,111],132:[2,111],133:[2,111],134:[2,111],135:[2,111],136:[2,111],137:[2,111]},{1:[2,112],6:[2,112],25:[2,112],26:[2,112],27:145,28:[1,71],49:[2,112],54:[2,112],57:[2,112],66:[2,112],67:[2,112],68:[2,112],69:[2,112],71:[2,112],73:[2,112],74:[2,112],78:[2,112],84:[2,112],85:[2,112],86:[2,112],91:[2,112],93:[2,112],102:[2,112],104:[2,112],105:[2,112],106:[2,112],110:[2,112],118:[2,112],126:[2,112],128:[2,112],129:[2,112],132:[2,112],133:[2,112],134:[2,112],135:[2,112],136:[2,112],137:[2,112]},{25:[2,50]},{25:[2,51]},{1:[2,67],6:[2,67],25:[2,67],26:[2,67],40:[2,67],49:[2,67],54:[2,67],57:[2,67],66:[2,67],67:[2,67],68:[2,67],69:[2,67],71:[2,67],73:[2,67],74:[2,67],78:[2,67],80:[2,67],84:[2,67],85:[2,67],86:[2,67],91:[2,67],93:[2,67],102:[2,67],104:[2,67],105:[2,67],106:[2,67],110:[2,67],118:[2,67],126:[2,67],128:[2,67],129:[2,67],130:[2,67],131:[2,67],132:[2,67],133:[2,67],134:[2,67],135:[2,67],136:[2,67],137:[2,67],138:[2,67]},{1:[2,70],6:[2,70],25:[2,70],26:[2,70],40:[2,70],49:[2,70],54:[2,70],57:[2,70],66:[2,70],67:[2,70],68:[2,70],69:[2,70],71:[2,70],73:[2,70],74:[2,70],78:[2,70],80:[2,70],84:[2,70],85:[2,70],86:[2,70],91:[2,70],93:[2,70],102:[2,70],104:[2,70],105:[2,70],106:[2,70],110:[2,70],118:[2,70],126:[2,70],128:[2,70],129:[2,70],130:[2,70],131:[2,70],132:[2,70],133:[2,70],134:[2,70],135:[2,70],136:[2,70],137:[2,70],138:[2,70]},{7:146,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:147,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:148,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:150,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:149,25:[1,112],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{27:155,28:[1,71],44:156,58:157,59:158,64:151,76:[1,68],89:[1,109],90:[1,55],113:152,114:[1,153],115:154},{112:159,116:[1,160],117:[1,161]},{6:[2,90],10:165,25:[2,90],27:166,28:[1,71],29:167,30:[1,69],31:[1,70],41:163,42:164,44:168,46:[1,44],54:[2,90],77:162,78:[2,90],89:[1,109]},{1:[2,26],6:[2,26],25:[2,26],26:[2,26],43:[2,26],49:[2,26],54:[2,26],57:[2,26],66:[2,26],67:[2,26],68:[2,26],69:[2,26],71:[2,26],73:[2,26],74:[2,26],78:[2,26],84:[2,26],85:[2,26],86:[2,26],91:[2,26],93:[2,26],102:[2,26],104:[2,26],105:[2,26],106:[2,26],110:[2,26],118:[2,26],126:[2,26],128:[2,26],129:[2,26],132:[2,26],133:[2,26],134:[2,26],135:[2,26],136:[2,26],137:[2,26]},{1:[2,27],6:[2,27],25:[2,27],26:[2,27],43:[2,27],49:[2,27],54:[2,27],57:[2,27],66:[2,27],67:[2,27],68:[2,27],69:[2,27],71:[2,27],73:[2,27],74:[2,27],78:[2,27],84:[2,27],85:[2,27],86:[2,27],91:[2,27],93:[2,27],102:[2,27],104:[2,27],105:[2,27],106:[2,27],110:[2,27],118:[2,27],126:[2,27],128:[2,27],129:[2,27],132:[2,27],133:[2,27],134:[2,27],135:[2,27],136:[2,27],137:[2,27]},{1:[2,25],6:[2,25],25:[2,25],26:[2,25],40:[2,25],43:[2,25],49:[2,25],54:[2,25],57:[2,25],66:[2,25],67:[2,25],68:[2,25],69:[2,25],71:[2,25],73:[2,25],74:[2,25],78:[2,25],80:[2,25],84:[2,25],85:[2,25],86:[2,25],91:[2,25],93:[2,25],102:[2,25],104:[2,25],105:[2,25],106:[2,25],110:[2,25],116:[2,25],117:[2,25],118:[2,25],126:[2,25],128:[2,25],129:[2,25],130:[2,25],131:[2,25],132:[2,25],133:[2,25],134:[2,25],135:[2,25],136:[2,25],137:[2,25],138:[2,25]},{1:[2,5],5:169,6:[2,5],7:4,8:5,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,26:[2,5],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],102:[2,5],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,193],6:[2,193],25:[2,193],26:[2,193],49:[2,193],54:[2,193],57:[2,193],73:[2,193],78:[2,193],86:[2,193],91:[2,193],93:[2,193],102:[2,193],104:[2,193],105:[2,193],106:[2,193],110:[2,193],118:[2,193],126:[2,193],128:[2,193],129:[2,193],132:[2,193],133:[2,193],134:[2,193],135:[2,193],136:[2,193],137:[2,193]},{7:170,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:171,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:172,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:173,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:174,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:175,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:176,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:177,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,148],6:[2,148],25:[2,148],26:[2,148],49:[2,148],54:[2,148],57:[2,148],73:[2,148],78:[2,148],86:[2,148],91:[2,148],93:[2,148],102:[2,148],104:[2,148],105:[2,148],106:[2,148],110:[2,148],118:[2,148],126:[2,148],128:[2,148],129:[2,148],132:[2,148],133:[2,148],134:[2,148],135:[2,148],136:[2,148],137:[2,148]},{1:[2,153],6:[2,153],25:[2,153],26:[2,153],49:[2,153],54:[2,153],57:[2,153],73:[2,153],78:[2,153],86:[2,153],91:[2,153],93:[2,153],102:[2,153],104:[2,153],105:[2,153],106:[2,153],110:[2,153],118:[2,153],126:[2,153],128:[2,153],129:[2,153],132:[2,153],133:[2,153],134:[2,153],135:[2,153],136:[2,153],137:[2,153]},{7:178,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,147],6:[2,147],25:[2,147],26:[2,147],49:[2,147],54:[2,147],57:[2,147],73:[2,147],78:[2,147],86:[2,147],91:[2,147],93:[2,147],102:[2,147],104:[2,147],105:[2,147],106:[2,147],110:[2,147],118:[2,147],126:[2,147],128:[2,147],129:[2,147],132:[2,147],133:[2,147],134:[2,147],135:[2,147],136:[2,147],137:[2,147]},{1:[2,152],6:[2,152],25:[2,152],26:[2,152],49:[2,152],54:[2,152],57:[2,152],73:[2,152],78:[2,152],86:[2,152],91:[2,152],93:[2,152],102:[2,152],104:[2,152],105:[2,152],106:[2,152],110:[2,152],118:[2,152],126:[2,152],128:[2,152],129:[2,152],132:[2,152],133:[2,152],134:[2,152],135:[2,152],136:[2,152],137:[2,152]},{82:179,85:[1,101]},{1:[2,68],6:[2,68],25:[2,68],26:[2,68],40:[2,68],49:[2,68],54:[2,68],57:[2,68],66:[2,68],67:[2,68],68:[2,68],69:[2,68],71:[2,68],73:[2,68],74:[2,68],78:[2,68],80:[2,68],84:[2,68],85:[2,68],86:[2,68],91:[2,68],93:[2,68],102:[2,68],104:[2,68],105:[2,68],106:[2,68],110:[2,68],118:[2,68],126:[2,68],128:[2,68],129:[2,68],130:[2,68],131:[2,68],132:[2,68],133:[2,68],134:[2,68],135:[2,68],136:[2,68],137:[2,68],138:[2,68]},{85:[2,108]},{27:180,28:[1,71]},{27:181,28:[1,71]},{1:[2,83],6:[2,83],25:[2,83],26:[2,83],27:182,28:[1,71],40:[2,83],49:[2,83],54:[2,83],57:[2,83],66:[2,83],67:[2,83],68:[2,83],69:[2,83],71:[2,83],73:[2,83],74:[2,83],78:[2,83],80:[2,83],84:[2,83],85:[2,83],86:[2,83],91:[2,83],93:[2,83],102:[2,83],104:[2,83],105:[2,83],106:[2,83],110:[2,83],118:[2,83],126:[2,83],128:[2,83],129:[2,83],130:[2,83],131:[2,83],132:[2,83],133:[2,83],134:[2,83],135:[2,83],136:[2,83],137:[2,83],138:[2,83]},{27:183,28:[1,71]},{1:[2,84],6:[2,84],25:[2,84],26:[2,84],40:[2,84],49:[2,84],54:[2,84],57:[2,84],66:[2,84],67:[2,84],68:[2,84],69:[2,84],71:[2,84],73:[2,84],74:[2,84],78:[2,84],80:[2,84],84:[2,84],85:[2,84],86:[2,84],91:[2,84],93:[2,84],102:[2,84],104:[2,84],105:[2,84],106:[2,84],110:[2,84],118:[2,84],126:[2,84],128:[2,84],129:[2,84],130:[2,84],131:[2,84],132:[2,84],133:[2,84],134:[2,84],135:[2,84],136:[2,84],137:[2,84],138:[2,84]},{7:185,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],57:[1,189],58:45,59:46,61:34,63:23,64:24,65:25,72:184,75:186,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],92:187,93:[1,188],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{70:190,71:[1,95],74:[1,96]},{82:191,85:[1,101]},{1:[2,69],6:[2,69],25:[2,69],26:[2,69],40:[2,69],49:[2,69],54:[2,69],57:[2,69],66:[2,69],67:[2,69],68:[2,69],69:[2,69],71:[2,69],73:[2,69],74:[2,69],78:[2,69],80:[2,69],84:[2,69],85:[2,69],86:[2,69],91:[2,69],93:[2,69],102:[2,69],104:[2,69],105:[2,69],106:[2,69],110:[2,69],118:[2,69],126:[2,69],128:[2,69],129:[2,69],130:[2,69],131:[2,69],132:[2,69],133:[2,69],134:[2,69],135:[2,69],136:[2,69],137:[2,69],138:[2,69]},{6:[1,193],7:192,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,194],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,106],6:[2,106],25:[2,106],26:[2,106],49:[2,106],54:[2,106],57:[2,106],66:[2,106],67:[2,106],68:[2,106],69:[2,106],71:[2,106],73:[2,106],74:[2,106],78:[2,106],84:[2,106],85:[2,106],86:[2,106],91:[2,106],93:[2,106],102:[2,106],104:[2,106],105:[2,106],106:[2,106],110:[2,106],118:[2,106],126:[2,106],128:[2,106],129:[2,106],132:[2,106],133:[2,106],134:[2,106],135:[2,106],136:[2,106],137:[2,106]},{7:197,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,143],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,60:144,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],86:[1,195],87:196,88:[1,56],89:[1,57],90:[1,55],94:142,96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{6:[2,52],25:[2,52],49:[1,198],53:200,54:[1,199]},{6:[2,55],25:[2,55],26:[2,55],49:[2,55],54:[2,55]},{6:[2,59],25:[2,59],26:[2,59],40:[1,202],49:[2,59],54:[2,59],57:[1,201]},{6:[2,62],25:[2,62],26:[2,62],40:[2,62],49:[2,62],54:[2,62],57:[2,62]},{6:[2,63],25:[2,63],26:[2,63],40:[2,63],49:[2,63],54:[2,63],57:[2,63]},{6:[2,64],25:[2,64],26:[2,64],40:[2,64],49:[2,64],54:[2,64],57:[2,64]},{6:[2,65],25:[2,65],26:[2,65],40:[2,65],49:[2,65],54:[2,65],57:[2,65]},{27:145,28:[1,71]},{7:197,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,143],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,60:144,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],87:141,88:[1,56],89:[1,57],90:[1,55],91:[1,140],94:142,96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,49],6:[2,49],25:[2,49],26:[2,49],49:[2,49],54:[2,49],57:[2,49],73:[2,49],78:[2,49],86:[2,49],91:[2,49],93:[2,49],102:[2,49],104:[2,49],105:[2,49],106:[2,49],110:[2,49],118:[2,49],126:[2,49],128:[2,49],129:[2,49],132:[2,49],133:[2,49],134:[2,49],135:[2,49],136:[2,49],137:[2,49]},{4:204,5:3,7:4,8:5,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,26:[1,203],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,186],6:[2,186],25:[2,186],26:[2,186],49:[2,186],54:[2,186],57:[2,186],73:[2,186],78:[2,186],86:[2,186],91:[2,186],93:[2,186],102:[2,186],103:82,104:[2,186],105:[2,186],106:[2,186],109:83,110:[2,186],111:67,118:[2,186],126:[2,186],128:[2,186],129:[2,186],132:[1,73],133:[2,186],134:[2,186],135:[2,186],136:[2,186],137:[2,186]},{103:85,104:[1,63],106:[1,64],109:86,110:[1,66],111:67,126:[1,84]},{1:[2,187],6:[2,187],25:[2,187],26:[2,187],49:[2,187],54:[2,187],57:[2,187],73:[2,187],78:[2,187],86:[2,187],91:[2,187],93:[2,187],102:[2,187],103:82,104:[2,187],105:[2,187],106:[2,187],109:83,110:[2,187],111:67,118:[2,187],126:[2,187],128:[2,187],129:[2,187],132:[1,73],133:[2,187],134:[2,187],135:[2,187],136:[2,187],137:[2,187]},{1:[2,188],6:[2,188],25:[2,188],26:[2,188],49:[2,188],54:[2,188],57:[2,188],73:[2,188],78:[2,188],86:[2,188],91:[2,188],93:[2,188],102:[2,188],103:82,104:[2,188],105:[2,188],106:[2,188],109:83,110:[2,188],111:67,118:[2,188],126:[2,188],128:[2,188],129:[2,188],132:[1,73],133:[2,188],134:[2,188],135:[2,188],136:[2,188],137:[2,188]},{1:[2,189],6:[2,189],25:[2,189],26:[2,189],49:[2,189],54:[2,189],57:[2,189],66:[2,71],67:[2,71],68:[2,71],69:[2,71],71:[2,71],73:[2,189],74:[2,71],78:[2,189],84:[2,71],85:[2,71],86:[2,189],91:[2,189],93:[2,189],102:[2,189],104:[2,189],105:[2,189],106:[2,189],110:[2,189],118:[2,189],126:[2,189],128:[2,189],129:[2,189],132:[2,189],133:[2,189],134:[2,189],135:[2,189],136:[2,189],137:[2,189]},{62:88,66:[1,90],67:[1,91],68:[1,92],69:[1,93],70:94,71:[1,95],74:[1,96],81:87,84:[1,89],85:[2,107]},{62:98,66:[1,90],67:[1,91],68:[1,92],69:[1,93],70:94,71:[1,95],74:[1,96],81:97,84:[1,89],85:[2,107]},{66:[2,74],67:[2,74],68:[2,74],69:[2,74],71:[2,74],74:[2,74],84:[2,74],85:[2,74]},{1:[2,190],6:[2,190],25:[2,190],26:[2,190],49:[2,190],54:[2,190],57:[2,190],66:[2,71],67:[2,71],68:[2,71],69:[2,71],71:[2,71],73:[2,190],74:[2,71],78:[2,190],84:[2,71],85:[2,71],86:[2,190],91:[2,190],93:[2,190],102:[2,190],104:[2,190],105:[2,190],106:[2,190],110:[2,190],118:[2,190],126:[2,190],128:[2,190],129:[2,190],132:[2,190],133:[2,190],134:[2,190],135:[2,190],136:[2,190],137:[2,190]},{1:[2,191],6:[2,191],25:[2,191],26:[2,191],49:[2,191],54:[2,191],57:[2,191],73:[2,191],78:[2,191],86:[2,191],91:[2,191],93:[2,191],102:[2,191],104:[2,191],105:[2,191],106:[2,191],110:[2,191],118:[2,191],126:[2,191],128:[2,191],129:[2,191],132:[2,191],133:[2,191],134:[2,191],135:[2,191],136:[2,191],137:[2,191]},{1:[2,192],6:[2,192],25:[2,192],26:[2,192],49:[2,192],54:[2,192],57:[2,192],73:[2,192],78:[2,192],86:[2,192],91:[2,192],93:[2,192],102:[2,192],104:[2,192],105:[2,192],106:[2,192],110:[2,192],118:[2,192],126:[2,192],128:[2,192],129:[2,192],132:[2,192],133:[2,192],134:[2,192],135:[2,192],136:[2,192],137:[2,192]},{6:[1,207],7:205,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,206],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:208,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{24:209,25:[1,112],125:[1,210]},{1:[2,132],6:[2,132],25:[2,132],26:[2,132],49:[2,132],54:[2,132],57:[2,132],73:[2,132],78:[2,132],86:[2,132],91:[2,132],93:[2,132],97:211,98:[1,212],99:[1,213],102:[2,132],104:[2,132],105:[2,132],106:[2,132],110:[2,132],118:[2,132],126:[2,132],128:[2,132],129:[2,132],132:[2,132],133:[2,132],134:[2,132],135:[2,132],136:[2,132],137:[2,132]},{1:[2,146],6:[2,146],25:[2,146],26:[2,146],49:[2,146],54:[2,146],57:[2,146],73:[2,146],78:[2,146],86:[2,146],91:[2,146],93:[2,146],102:[2,146],104:[2,146],105:[2,146],106:[2,146],110:[2,146],118:[2,146],126:[2,146],128:[2,146],129:[2,146],132:[2,146],133:[2,146],134:[2,146],135:[2,146],136:[2,146],137:[2,146]},{1:[2,154],6:[2,154],25:[2,154],26:[2,154],49:[2,154],54:[2,154],57:[2,154],73:[2,154],78:[2,154],86:[2,154],91:[2,154],93:[2,154],102:[2,154],104:[2,154],105:[2,154],106:[2,154],110:[2,154],118:[2,154],126:[2,154],128:[2,154],129:[2,154],132:[2,154],133:[2,154],134:[2,154],135:[2,154],136:[2,154],137:[2,154]},{25:[1,214],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{120:215,122:216,123:[1,217]},{1:[2,96],6:[2,96],25:[2,96],26:[2,96],49:[2,96],54:[2,96],57:[2,96],73:[2,96],78:[2,96],86:[2,96],91:[2,96],93:[2,96],102:[2,96],104:[2,96],105:[2,96],106:[2,96],110:[2,96],118:[2,96],126:[2,96],128:[2,96],129:[2,96],132:[2,96],133:[2,96],134:[2,96],135:[2,96],136:[2,96],137:[2,96]},{7:218,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,99],6:[2,99],24:219,25:[1,112],26:[2,99],49:[2,99],54:[2,99],57:[2,99],66:[2,71],67:[2,71],68:[2,71],69:[2,71],71:[2,71],73:[2,99],74:[2,71],78:[2,99],80:[1,220],84:[2,71],85:[2,71],86:[2,99],91:[2,99],93:[2,99],102:[2,99],104:[2,99],105:[2,99],106:[2,99],110:[2,99],118:[2,99],126:[2,99],128:[2,99],129:[2,99],132:[2,99],133:[2,99],134:[2,99],135:[2,99],136:[2,99],137:[2,99]},{1:[2,139],6:[2,139],25:[2,139],26:[2,139],49:[2,139],54:[2,139],57:[2,139],73:[2,139],78:[2,139],86:[2,139],91:[2,139],93:[2,139],102:[2,139],103:82,104:[2,139],105:[2,139],106:[2,139],109:83,110:[2,139],111:67,118:[2,139],126:[2,139],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,45],6:[2,45],26:[2,45],102:[2,45],103:82,104:[2,45],106:[2,45],109:83,110:[2,45],111:67,126:[2,45],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{6:[1,72],102:[1,221]},{4:222,5:3,7:4,8:5,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{6:[2,128],25:[2,128],54:[2,128],57:[1,224],91:[2,128],92:223,93:[1,188],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,114],6:[2,114],25:[2,114],26:[2,114],40:[2,114],49:[2,114],54:[2,114],57:[2,114],66:[2,114],67:[2,114],68:[2,114],69:[2,114],71:[2,114],73:[2,114],74:[2,114],78:[2,114],84:[2,114],85:[2,114],86:[2,114],91:[2,114],93:[2,114],102:[2,114],104:[2,114],105:[2,114],106:[2,114],110:[2,114],116:[2,114],117:[2,114],118:[2,114],126:[2,114],128:[2,114],129:[2,114],132:[2,114],133:[2,114],134:[2,114],135:[2,114],136:[2,114],137:[2,114]},{6:[2,52],25:[2,52],53:225,54:[1,226],91:[2,52]},{6:[2,123],25:[2,123],26:[2,123],54:[2,123],86:[2,123],91:[2,123]},{7:197,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,143],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,60:144,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],87:227,88:[1,56],89:[1,57],90:[1,55],94:142,96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{6:[2,129],25:[2,129],26:[2,129],54:[2,129],86:[2,129],91:[2,129]},{1:[2,113],6:[2,113],25:[2,113],26:[2,113],40:[2,113],43:[2,113],49:[2,113],54:[2,113],57:[2,113],66:[2,113],67:[2,113],68:[2,113],69:[2,113],71:[2,113],73:[2,113],74:[2,113],78:[2,113],80:[2,113],84:[2,113],85:[2,113],86:[2,113],91:[2,113],93:[2,113],102:[2,113],104:[2,113],105:[2,113],106:[2,113],110:[2,113],116:[2,113],117:[2,113],118:[2,113],126:[2,113],128:[2,113],129:[2,113],130:[2,113],131:[2,113],132:[2,113],133:[2,113],134:[2,113],135:[2,113],136:[2,113],137:[2,113],138:[2,113]},{24:228,25:[1,112],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,142],6:[2,142],25:[2,142],26:[2,142],49:[2,142],54:[2,142],57:[2,142],73:[2,142],78:[2,142],86:[2,142],91:[2,142],93:[2,142],102:[2,142],103:82,104:[1,63],105:[1,229],106:[1,64],109:83,110:[1,66],111:67,118:[2,142],126:[2,142],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,144],6:[2,144],25:[2,144],26:[2,144],49:[2,144],54:[2,144],57:[2,144],73:[2,144],78:[2,144],86:[2,144],91:[2,144],93:[2,144],102:[2,144],103:82,104:[1,63],105:[1,230],106:[1,64],109:83,110:[1,66],111:67,118:[2,144],126:[2,144],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,150],6:[2,150],25:[2,150],26:[2,150],49:[2,150],54:[2,150],57:[2,150],73:[2,150],78:[2,150],86:[2,150],91:[2,150],93:[2,150],102:[2,150],104:[2,150],105:[2,150],106:[2,150],110:[2,150],118:[2,150],126:[2,150],128:[2,150],129:[2,150],132:[2,150],133:[2,150],134:[2,150],135:[2,150],136:[2,150],137:[2,150]},{1:[2,151],6:[2,151],25:[2,151],26:[2,151],49:[2,151],54:[2,151],57:[2,151],73:[2,151],78:[2,151],86:[2,151],91:[2,151],93:[2,151],102:[2,151],103:82,104:[1,63],105:[2,151],106:[1,64],109:83,110:[1,66],111:67,118:[2,151],126:[2,151],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,155],6:[2,155],25:[2,155],26:[2,155],49:[2,155],54:[2,155],57:[2,155],73:[2,155],78:[2,155],86:[2,155],91:[2,155],93:[2,155],102:[2,155],104:[2,155],105:[2,155],106:[2,155],110:[2,155],118:[2,155],126:[2,155],128:[2,155],129:[2,155],132:[2,155],133:[2,155],134:[2,155],135:[2,155],136:[2,155],137:[2,155]},{116:[2,157],117:[2,157]},{27:155,28:[1,71],44:156,58:157,59:158,76:[1,68],89:[1,109],90:[1,110],113:231,115:154},{54:[1,232],116:[2,163],117:[2,163]},{54:[2,159],116:[2,159],117:[2,159]},{54:[2,160],116:[2,160],117:[2,160]},{54:[2,161],116:[2,161],117:[2,161]},{54:[2,162],116:[2,162],117:[2,162]},{1:[2,156],6:[2,156],25:[2,156],26:[2,156],49:[2,156],54:[2,156],57:[2,156],73:[2,156],78:[2,156],86:[2,156],91:[2,156],93:[2,156],102:[2,156],104:[2,156],105:[2,156],106:[2,156],110:[2,156],118:[2,156],126:[2,156],128:[2,156],129:[2,156],132:[2,156],133:[2,156],134:[2,156],135:[2,156],136:[2,156],137:[2,156]},{7:233,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:234,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{6:[2,52],25:[2,52],53:235,54:[1,236],78:[2,52]},{6:[2,91],25:[2,91],26:[2,91],54:[2,91],78:[2,91]},{6:[2,38],25:[2,38],26:[2,38],43:[1,237],54:[2,38],78:[2,38]},{6:[2,41],25:[2,41],26:[2,41],54:[2,41],78:[2,41]},{6:[2,42],25:[2,42],26:[2,42],43:[2,42],54:[2,42],78:[2,42]},{6:[2,43],25:[2,43],26:[2,43],43:[2,43],54:[2,43],78:[2,43]},{6:[2,44],25:[2,44],26:[2,44],43:[2,44],54:[2,44],78:[2,44]},{1:[2,4],6:[2,4],26:[2,4],102:[2,4]},{1:[2,194],6:[2,194],25:[2,194],26:[2,194],49:[2,194],54:[2,194],57:[2,194],73:[2,194],78:[2,194],86:[2,194],91:[2,194],93:[2,194],102:[2,194],103:82,104:[2,194],105:[2,194],106:[2,194],109:83,110:[2,194],111:67,118:[2,194],126:[2,194],128:[2,194],129:[2,194],132:[1,73],133:[1,76],134:[2,194],135:[2,194],136:[2,194],137:[2,194]},{1:[2,195],6:[2,195],25:[2,195],26:[2,195],49:[2,195],54:[2,195],57:[2,195],73:[2,195],78:[2,195],86:[2,195],91:[2,195],93:[2,195],102:[2,195],103:82,104:[2,195],105:[2,195],106:[2,195],109:83,110:[2,195],111:67,118:[2,195],126:[2,195],128:[2,195],129:[2,195],132:[1,73],133:[1,76],134:[2,195],135:[2,195],136:[2,195],137:[2,195]},{1:[2,196],6:[2,196],25:[2,196],26:[2,196],49:[2,196],54:[2,196],57:[2,196],73:[2,196],78:[2,196],86:[2,196],91:[2,196],93:[2,196],102:[2,196],103:82,104:[2,196],105:[2,196],106:[2,196],109:83,110:[2,196],111:67,118:[2,196],126:[2,196],128:[2,196],129:[2,196],132:[1,73],133:[2,196],134:[2,196],135:[2,196],136:[2,196],137:[2,196]},{1:[2,197],6:[2,197],25:[2,197],26:[2,197],49:[2,197],54:[2,197],57:[2,197],73:[2,197],78:[2,197],86:[2,197],91:[2,197],93:[2,197],102:[2,197],103:82,104:[2,197],105:[2,197],106:[2,197],109:83,110:[2,197],111:67,118:[2,197],126:[2,197],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[2,197],135:[2,197],136:[2,197],137:[2,197]},{1:[2,198],6:[2,198],25:[2,198],26:[2,198],49:[2,198],54:[2,198],57:[2,198],73:[2,198],78:[2,198],86:[2,198],91:[2,198],93:[2,198],102:[2,198],103:82,104:[2,198],105:[2,198],106:[2,198],109:83,110:[2,198],111:67,118:[2,198],126:[2,198],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[2,198],136:[2,198],137:[1,80]},{1:[2,199],6:[2,199],25:[2,199],26:[2,199],49:[2,199],54:[2,199],57:[2,199],73:[2,199],78:[2,199],86:[2,199],91:[2,199],93:[2,199],102:[2,199],103:82,104:[2,199],105:[2,199],106:[2,199],109:83,110:[2,199],111:67,118:[2,199],126:[2,199],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[2,199],137:[1,80]},{1:[2,200],6:[2,200],25:[2,200],26:[2,200],49:[2,200],54:[2,200],57:[2,200],73:[2,200],78:[2,200],86:[2,200],91:[2,200],93:[2,200],102:[2,200],103:82,104:[2,200],105:[2,200],106:[2,200],109:83,110:[2,200],111:67,118:[2,200],126:[2,200],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[2,200],136:[2,200],137:[2,200]},{1:[2,185],6:[2,185],25:[2,185],26:[2,185],49:[2,185],54:[2,185],57:[2,185],73:[2,185],78:[2,185],86:[2,185],91:[2,185],93:[2,185],102:[2,185],103:82,104:[1,63],105:[2,185],106:[1,64],109:83,110:[1,66],111:67,118:[2,185],126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,184],6:[2,184],25:[2,184],26:[2,184],49:[2,184],54:[2,184],57:[2,184],73:[2,184],78:[2,184],86:[2,184],91:[2,184],93:[2,184],102:[2,184],103:82,104:[1,63],105:[2,184],106:[1,64],109:83,110:[1,66],111:67,118:[2,184],126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,103],6:[2,103],25:[2,103],26:[2,103],49:[2,103],54:[2,103],57:[2,103],66:[2,103],67:[2,103],68:[2,103],69:[2,103],71:[2,103],73:[2,103],74:[2,103],78:[2,103],84:[2,103],85:[2,103],86:[2,103],91:[2,103],93:[2,103],102:[2,103],104:[2,103],105:[2,103],106:[2,103],110:[2,103],118:[2,103],126:[2,103],128:[2,103],129:[2,103],132:[2,103],133:[2,103],134:[2,103],135:[2,103],136:[2,103],137:[2,103]},{1:[2,79],6:[2,79],25:[2,79],26:[2,79],40:[2,79],49:[2,79],54:[2,79],57:[2,79],66:[2,79],67:[2,79],68:[2,79],69:[2,79],71:[2,79],73:[2,79],74:[2,79],78:[2,79],80:[2,79],84:[2,79],85:[2,79],86:[2,79],91:[2,79],93:[2,79],102:[2,79],104:[2,79],105:[2,79],106:[2,79],110:[2,79],118:[2,79],126:[2,79],128:[2,79],129:[2,79],130:[2,79],131:[2,79],132:[2,79],133:[2,79],134:[2,79],135:[2,79],136:[2,79],137:[2,79],138:[2,79]},{1:[2,80],6:[2,80],25:[2,80],26:[2,80],40:[2,80],49:[2,80],54:[2,80],57:[2,80],66:[2,80],67:[2,80],68:[2,80],69:[2,80],71:[2,80],73:[2,80],74:[2,80],78:[2,80],80:[2,80],84:[2,80],85:[2,80],86:[2,80],91:[2,80],93:[2,80],102:[2,80],104:[2,80],105:[2,80],106:[2,80],110:[2,80],118:[2,80],126:[2,80],128:[2,80],129:[2,80],130:[2,80],131:[2,80],132:[2,80],133:[2,80],134:[2,80],135:[2,80],136:[2,80],137:[2,80],138:[2,80]},{1:[2,81],6:[2,81],25:[2,81],26:[2,81],40:[2,81],49:[2,81],54:[2,81],57:[2,81],66:[2,81],67:[2,81],68:[2,81],69:[2,81],71:[2,81],73:[2,81],74:[2,81],78:[2,81],80:[2,81],84:[2,81],85:[2,81],86:[2,81],91:[2,81],93:[2,81],102:[2,81],104:[2,81],105:[2,81],106:[2,81],110:[2,81],118:[2,81],126:[2,81],128:[2,81],129:[2,81],130:[2,81],131:[2,81],132:[2,81],133:[2,81],134:[2,81],135:[2,81],136:[2,81],137:[2,81],138:[2,81]},{1:[2,82],6:[2,82],25:[2,82],26:[2,82],40:[2,82],49:[2,82],54:[2,82],57:[2,82],66:[2,82],67:[2,82],68:[2,82],69:[2,82],71:[2,82],73:[2,82],74:[2,82],78:[2,82],80:[2,82],84:[2,82],85:[2,82],86:[2,82],91:[2,82],93:[2,82],102:[2,82],104:[2,82],105:[2,82],106:[2,82],110:[2,82],118:[2,82],126:[2,82],128:[2,82],129:[2,82],130:[2,82],131:[2,82],132:[2,82],133:[2,82],134:[2,82],135:[2,82],136:[2,82],137:[2,82],138:[2,82]},{73:[1,238]},{57:[1,189],73:[2,87],92:239,93:[1,188],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{73:[2,88]},{7:240,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,73:[2,122],76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{11:[2,116],28:[2,116],30:[2,116],31:[2,116],33:[2,116],34:[2,116],35:[2,116],36:[2,116],37:[2,116],38:[2,116],45:[2,116],46:[2,116],47:[2,116],51:[2,116],52:[2,116],73:[2,116],76:[2,116],79:[2,116],83:[2,116],88:[2,116],89:[2,116],90:[2,116],96:[2,116],100:[2,116],101:[2,116],104:[2,116],106:[2,116],108:[2,116],110:[2,116],119:[2,116],125:[2,116],127:[2,116],128:[2,116],129:[2,116],130:[2,116],131:[2,116]},{11:[2,117],28:[2,117],30:[2,117],31:[2,117],33:[2,117],34:[2,117],35:[2,117],36:[2,117],37:[2,117],38:[2,117],45:[2,117],46:[2,117],47:[2,117],51:[2,117],52:[2,117],73:[2,117],76:[2,117],79:[2,117],83:[2,117],88:[2,117],89:[2,117],90:[2,117],96:[2,117],100:[2,117],101:[2,117],104:[2,117],106:[2,117],108:[2,117],110:[2,117],119:[2,117],125:[2,117],127:[2,117],128:[2,117],129:[2,117],130:[2,117],131:[2,117]},{1:[2,86],6:[2,86],25:[2,86],26:[2,86],40:[2,86],49:[2,86],54:[2,86],57:[2,86],66:[2,86],67:[2,86],68:[2,86],69:[2,86],71:[2,86],73:[2,86],74:[2,86],78:[2,86],80:[2,86],84:[2,86],85:[2,86],86:[2,86],91:[2,86],93:[2,86],102:[2,86],104:[2,86],105:[2,86],106:[2,86],110:[2,86],118:[2,86],126:[2,86],128:[2,86],129:[2,86],130:[2,86],131:[2,86],132:[2,86],133:[2,86],134:[2,86],135:[2,86],136:[2,86],137:[2,86],138:[2,86]},{1:[2,104],6:[2,104],25:[2,104],26:[2,104],49:[2,104],54:[2,104],57:[2,104],66:[2,104],67:[2,104],68:[2,104],69:[2,104],71:[2,104],73:[2,104],74:[2,104],78:[2,104],84:[2,104],85:[2,104],86:[2,104],91:[2,104],93:[2,104],102:[2,104],104:[2,104],105:[2,104],106:[2,104],110:[2,104],118:[2,104],126:[2,104],128:[2,104],129:[2,104],132:[2,104],133:[2,104],134:[2,104],135:[2,104],136:[2,104],137:[2,104]},{1:[2,35],6:[2,35],25:[2,35],26:[2,35],49:[2,35],54:[2,35],57:[2,35],73:[2,35],78:[2,35],86:[2,35],91:[2,35],93:[2,35],102:[2,35],103:82,104:[2,35],105:[2,35],106:[2,35],109:83,110:[2,35],111:67,118:[2,35],126:[2,35],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{7:241,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:242,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,109],6:[2,109],25:[2,109],26:[2,109],49:[2,109],54:[2,109],57:[2,109],66:[2,109],67:[2,109],68:[2,109],69:[2,109],71:[2,109],73:[2,109],74:[2,109],78:[2,109],84:[2,109],85:[2,109],86:[2,109],91:[2,109],93:[2,109],102:[2,109],104:[2,109],105:[2,109],106:[2,109],110:[2,109],118:[2,109],126:[2,109],128:[2,109],129:[2,109],132:[2,109],133:[2,109],134:[2,109],135:[2,109],136:[2,109],137:[2,109]},{6:[2,52],25:[2,52],53:243,54:[1,226],86:[2,52]},{6:[2,128],25:[2,128],26:[2,128],54:[2,128],57:[1,244],86:[2,128],91:[2,128],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{50:245,51:[1,58],52:[1,59]},{6:[2,53],25:[2,53],26:[2,53],27:105,28:[1,71],44:106,55:246,56:104,58:107,59:108,76:[1,68],89:[1,109],90:[1,110]},{6:[1,247],25:[1,248]},{6:[2,60],25:[2,60],26:[2,60],49:[2,60],54:[2,60]},{7:249,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,23],6:[2,23],25:[2,23],26:[2,23],49:[2,23],54:[2,23],57:[2,23],73:[2,23],78:[2,23],86:[2,23],91:[2,23],93:[2,23],98:[2,23],99:[2,23],102:[2,23],104:[2,23],105:[2,23],106:[2,23],110:[2,23],118:[2,23],121:[2,23],123:[2,23],126:[2,23],128:[2,23],129:[2,23],132:[2,23],133:[2,23],134:[2,23],135:[2,23],136:[2,23],137:[2,23]},{6:[1,72],26:[1,250]},{1:[2,201],6:[2,201],25:[2,201],26:[2,201],49:[2,201],54:[2,201],57:[2,201],73:[2,201],78:[2,201],86:[2,201],91:[2,201],93:[2,201],102:[2,201],103:82,104:[2,201],105:[2,201],106:[2,201],109:83,110:[2,201],111:67,118:[2,201],126:[2,201],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{7:251,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:252,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,204],6:[2,204],25:[2,204],26:[2,204],49:[2,204],54:[2,204],57:[2,204],73:[2,204],78:[2,204],86:[2,204],91:[2,204],93:[2,204],102:[2,204],103:82,104:[2,204],105:[2,204],106:[2,204],109:83,110:[2,204],111:67,118:[2,204],126:[2,204],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,183],6:[2,183],25:[2,183],26:[2,183],49:[2,183],54:[2,183],57:[2,183],73:[2,183],78:[2,183],86:[2,183],91:[2,183],93:[2,183],102:[2,183],104:[2,183],105:[2,183],106:[2,183],110:[2,183],118:[2,183],126:[2,183],128:[2,183],129:[2,183],132:[2,183],133:[2,183],134:[2,183],135:[2,183],136:[2,183],137:[2,183]},{7:253,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,133],6:[2,133],25:[2,133],26:[2,133],49:[2,133],54:[2,133],57:[2,133],73:[2,133],78:[2,133],86:[2,133],91:[2,133],93:[2,133],98:[1,254],102:[2,133],104:[2,133],105:[2,133],106:[2,133],110:[2,133],118:[2,133],126:[2,133],128:[2,133],129:[2,133],132:[2,133],133:[2,133],134:[2,133],135:[2,133],136:[2,133],137:[2,133]},{24:255,25:[1,112]},{24:258,25:[1,112],27:256,28:[1,71],59:257,76:[1,68]},{120:259,122:216,123:[1,217]},{26:[1,260],121:[1,261],122:262,123:[1,217]},{26:[2,176],121:[2,176],123:[2,176]},{7:264,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],95:263,96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,97],6:[2,97],24:265,25:[1,112],26:[2,97],49:[2,97],54:[2,97],57:[2,97],73:[2,97],78:[2,97],86:[2,97],91:[2,97],93:[2,97],102:[2,97],103:82,104:[1,63],105:[2,97],106:[1,64],109:83,110:[1,66],111:67,118:[2,97],126:[2,97],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,100],6:[2,100],25:[2,100],26:[2,100],49:[2,100],54:[2,100],57:[2,100],73:[2,100],78:[2,100],86:[2,100],91:[2,100],93:[2,100],102:[2,100],104:[2,100],105:[2,100],106:[2,100],110:[2,100],118:[2,100],126:[2,100],128:[2,100],129:[2,100],132:[2,100],133:[2,100],134:[2,100],135:[2,100],136:[2,100],137:[2,100]},{7:266,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,140],6:[2,140],25:[2,140],26:[2,140],49:[2,140],54:[2,140],57:[2,140],66:[2,140],67:[2,140],68:[2,140],69:[2,140],71:[2,140],73:[2,140],74:[2,140],78:[2,140],84:[2,140],85:[2,140],86:[2,140],91:[2,140],93:[2,140],102:[2,140],104:[2,140],105:[2,140],106:[2,140],110:[2,140],118:[2,140],126:[2,140],128:[2,140],129:[2,140],132:[2,140],133:[2,140],134:[2,140],135:[2,140],136:[2,140],137:[2,140]},{6:[1,72],26:[1,267]},{7:268,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{6:[2,66],11:[2,117],25:[2,66],28:[2,117],30:[2,117],31:[2,117],33:[2,117],34:[2,117],35:[2,117],36:[2,117],37:[2,117],38:[2,117],45:[2,117],46:[2,117],47:[2,117],51:[2,117],52:[2,117],54:[2,66],76:[2,117],79:[2,117],83:[2,117],88:[2,117],89:[2,117],90:[2,117],91:[2,66],96:[2,117],100:[2,117],101:[2,117],104:[2,117],106:[2,117],108:[2,117],110:[2,117],119:[2,117],125:[2,117],127:[2,117],128:[2,117],129:[2,117],130:[2,117],131:[2,117]},{6:[1,270],25:[1,271],91:[1,269]},{6:[2,53],7:197,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[2,53],26:[2,53],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,60:144,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],86:[2,53],88:[1,56],89:[1,57],90:[1,55],91:[2,53],94:272,96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{6:[2,52],25:[2,52],26:[2,52],53:273,54:[1,226]},{1:[2,180],6:[2,180],25:[2,180],26:[2,180],49:[2,180],54:[2,180],57:[2,180],73:[2,180],78:[2,180],86:[2,180],91:[2,180],93:[2,180],102:[2,180],104:[2,180],105:[2,180],106:[2,180],110:[2,180],118:[2,180],121:[2,180],126:[2,180],128:[2,180],129:[2,180],132:[2,180],133:[2,180],134:[2,180],135:[2,180],136:[2,180],137:[2,180]},{7:274,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:275,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{116:[2,158],117:[2,158]},{27:155,28:[1,71],44:156,58:157,59:158,76:[1,68],89:[1,109],90:[1,110],115:276},{1:[2,165],6:[2,165],25:[2,165],26:[2,165],49:[2,165],54:[2,165],57:[2,165],73:[2,165],78:[2,165],86:[2,165],91:[2,165],93:[2,165],102:[2,165],103:82,104:[2,165],105:[1,277],106:[2,165],109:83,110:[2,165],111:67,118:[1,278],126:[2,165],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,166],6:[2,166],25:[2,166],26:[2,166],49:[2,166],54:[2,166],57:[2,166],73:[2,166],78:[2,166],86:[2,166],91:[2,166],93:[2,166],102:[2,166],103:82,104:[2,166],105:[1,279],106:[2,166],109:83,110:[2,166],111:67,118:[2,166],126:[2,166],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{6:[1,281],25:[1,282],78:[1,280]},{6:[2,53],10:165,25:[2,53],26:[2,53],27:166,28:[1,71],29:167,30:[1,69],31:[1,70],41:283,42:164,44:168,46:[1,44],78:[2,53],89:[1,109]},{7:284,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,285],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,85],6:[2,85],25:[2,85],26:[2,85],40:[2,85],49:[2,85],54:[2,85],57:[2,85],66:[2,85],67:[2,85],68:[2,85],69:[2,85],71:[2,85],73:[2,85],74:[2,85],78:[2,85],80:[2,85],84:[2,85],85:[2,85],86:[2,85],91:[2,85],93:[2,85],102:[2,85],104:[2,85],105:[2,85],106:[2,85],110:[2,85],118:[2,85],126:[2,85],128:[2,85],129:[2,85],130:[2,85],131:[2,85],132:[2,85],133:[2,85],134:[2,85],135:[2,85],136:[2,85],137:[2,85],138:[2,85]},{7:286,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,73:[2,120],76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{73:[2,121],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,36],6:[2,36],25:[2,36],26:[2,36],49:[2,36],54:[2,36],57:[2,36],73:[2,36],78:[2,36],86:[2,36],91:[2,36],93:[2,36],102:[2,36],103:82,104:[2,36],105:[2,36],106:[2,36],109:83,110:[2,36],111:67,118:[2,36],126:[2,36],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{26:[1,287],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{6:[1,270],25:[1,271],86:[1,288]},{6:[2,66],25:[2,66],26:[2,66],54:[2,66],86:[2,66],91:[2,66]},{24:289,25:[1,112]},{6:[2,56],25:[2,56],26:[2,56],49:[2,56],54:[2,56]},{27:105,28:[1,71],44:106,55:290,56:104,58:107,59:108,76:[1,68],89:[1,109],90:[1,110]},{6:[2,54],25:[2,54],26:[2,54],27:105,28:[1,71],44:106,48:291,54:[2,54],55:103,56:104,58:107,59:108,76:[1,68],89:[1,109],90:[1,110]},{6:[2,61],25:[2,61],26:[2,61],49:[2,61],54:[2,61],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,24],6:[2,24],25:[2,24],26:[2,24],49:[2,24],54:[2,24],57:[2,24],73:[2,24],78:[2,24],86:[2,24],91:[2,24],93:[2,24],98:[2,24],99:[2,24],102:[2,24],104:[2,24],105:[2,24],106:[2,24],110:[2,24],118:[2,24],121:[2,24],123:[2,24],126:[2,24],128:[2,24],129:[2,24],132:[2,24],133:[2,24],134:[2,24],135:[2,24],136:[2,24],137:[2,24]},{26:[1,292],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,203],6:[2,203],25:[2,203],26:[2,203],49:[2,203],54:[2,203],57:[2,203],73:[2,203],78:[2,203],86:[2,203],91:[2,203],93:[2,203],102:[2,203],103:82,104:[2,203],105:[2,203],106:[2,203],109:83,110:[2,203],111:67,118:[2,203],126:[2,203],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{24:293,25:[1,112],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{24:294,25:[1,112]},{1:[2,134],6:[2,134],25:[2,134],26:[2,134],49:[2,134],54:[2,134],57:[2,134],73:[2,134],78:[2,134],86:[2,134],91:[2,134],93:[2,134],102:[2,134],104:[2,134],105:[2,134],106:[2,134],110:[2,134],118:[2,134],126:[2,134],128:[2,134],129:[2,134],132:[2,134],133:[2,134],134:[2,134],135:[2,134],136:[2,134],137:[2,134]},{24:295,25:[1,112]},{24:296,25:[1,112]},{1:[2,138],6:[2,138],25:[2,138],26:[2,138],49:[2,138],54:[2,138],57:[2,138],73:[2,138],78:[2,138],86:[2,138],91:[2,138],93:[2,138],98:[2,138],102:[2,138],104:[2,138],105:[2,138],106:[2,138],110:[2,138],118:[2,138],126:[2,138],128:[2,138],129:[2,138],132:[2,138],133:[2,138],134:[2,138],135:[2,138],136:[2,138],137:[2,138]},{26:[1,297],121:[1,298],122:262,123:[1,217]},{1:[2,174],6:[2,174],25:[2,174],26:[2,174],49:[2,174],54:[2,174],57:[2,174],73:[2,174],78:[2,174],86:[2,174],91:[2,174],93:[2,174],102:[2,174],104:[2,174],105:[2,174],106:[2,174],110:[2,174],118:[2,174],126:[2,174],128:[2,174],129:[2,174],132:[2,174],133:[2,174],134:[2,174],135:[2,174],136:[2,174],137:[2,174]},{24:299,25:[1,112]},{26:[2,177],121:[2,177],123:[2,177]},{24:300,25:[1,112],54:[1,301]},{25:[2,130],54:[2,130],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,98],6:[2,98],25:[2,98],26:[2,98],49:[2,98],54:[2,98],57:[2,98],73:[2,98],78:[2,98],86:[2,98],91:[2,98],93:[2,98],102:[2,98],104:[2,98],105:[2,98],106:[2,98],110:[2,98],118:[2,98],126:[2,98],128:[2,98],129:[2,98],132:[2,98],133:[2,98],134:[2,98],135:[2,98],136:[2,98],137:[2,98]},{1:[2,101],6:[2,101],24:302,25:[1,112],26:[2,101],49:[2,101],54:[2,101],57:[2,101],73:[2,101],78:[2,101],86:[2,101],91:[2,101],93:[2,101],102:[2,101],103:82,104:[1,63],105:[2,101],106:[1,64],109:83,110:[1,66],111:67,118:[2,101],126:[2,101],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{102:[1,303]},{91:[1,304],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,115],6:[2,115],25:[2,115],26:[2,115],40:[2,115],49:[2,115],54:[2,115],57:[2,115],66:[2,115],67:[2,115],68:[2,115],69:[2,115],71:[2,115],73:[2,115],74:[2,115],78:[2,115],84:[2,115],85:[2,115],86:[2,115],91:[2,115],93:[2,115],102:[2,115],104:[2,115],105:[2,115],106:[2,115],110:[2,115],116:[2,115],117:[2,115],118:[2,115],126:[2,115],128:[2,115],129:[2,115],132:[2,115],133:[2,115],134:[2,115],135:[2,115],136:[2,115],137:[2,115]},{7:197,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,60:144,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],94:305,96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:197,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,143],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,60:144,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],87:306,88:[1,56],89:[1,57],90:[1,55],94:142,96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{6:[2,124],25:[2,124],26:[2,124],54:[2,124],86:[2,124],91:[2,124]},{6:[1,270],25:[1,271],26:[1,307]},{1:[2,143],6:[2,143],25:[2,143],26:[2,143],49:[2,143],54:[2,143],57:[2,143],73:[2,143],78:[2,143],86:[2,143],91:[2,143],93:[2,143],102:[2,143],103:82,104:[1,63],105:[2,143],106:[1,64],109:83,110:[1,66],111:67,118:[2,143],126:[2,143],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,145],6:[2,145],25:[2,145],26:[2,145],49:[2,145],54:[2,145],57:[2,145],73:[2,145],78:[2,145],86:[2,145],91:[2,145],93:[2,145],102:[2,145],103:82,104:[1,63],105:[2,145],106:[1,64],109:83,110:[1,66],111:67,118:[2,145],126:[2,145],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{116:[2,164],117:[2,164]},{7:308,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:309,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:310,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,89],6:[2,89],25:[2,89],26:[2,89],40:[2,89],49:[2,89],54:[2,89],57:[2,89],66:[2,89],67:[2,89],68:[2,89],69:[2,89],71:[2,89],73:[2,89],74:[2,89],78:[2,89],84:[2,89],85:[2,89],86:[2,89],91:[2,89],93:[2,89],102:[2,89],104:[2,89],105:[2,89],106:[2,89],110:[2,89],116:[2,89],117:[2,89],118:[2,89],126:[2,89],128:[2,89],129:[2,89],132:[2,89],133:[2,89],134:[2,89],135:[2,89],136:[2,89],137:[2,89]},{10:165,27:166,28:[1,71],29:167,30:[1,69],31:[1,70],41:311,42:164,44:168,46:[1,44],89:[1,109]},{6:[2,90],10:165,25:[2,90],26:[2,90],27:166,28:[1,71],29:167,30:[1,69],31:[1,70],41:163,42:164,44:168,46:[1,44],54:[2,90],77:312,89:[1,109]},{6:[2,92],25:[2,92],26:[2,92],54:[2,92],78:[2,92]},{6:[2,39],25:[2,39],26:[2,39],54:[2,39],78:[2,39],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{7:313,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{73:[2,119],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,37],6:[2,37],25:[2,37],26:[2,37],49:[2,37],54:[2,37],57:[2,37],73:[2,37],78:[2,37],86:[2,37],91:[2,37],93:[2,37],102:[2,37],104:[2,37],105:[2,37],106:[2,37],110:[2,37],118:[2,37],126:[2,37],128:[2,37],129:[2,37],132:[2,37],133:[2,37],134:[2,37],135:[2,37],136:[2,37],137:[2,37]},{1:[2,110],6:[2,110],25:[2,110],26:[2,110],49:[2,110],54:[2,110],57:[2,110],66:[2,110],67:[2,110],68:[2,110],69:[2,110],71:[2,110],73:[2,110],74:[2,110],78:[2,110],84:[2,110],85:[2,110],86:[2,110],91:[2,110],93:[2,110],102:[2,110],104:[2,110],105:[2,110],106:[2,110],110:[2,110],118:[2,110],126:[2,110],128:[2,110],129:[2,110],132:[2,110],133:[2,110],134:[2,110],135:[2,110],136:[2,110],137:[2,110]},{1:[2,48],6:[2,48],25:[2,48],26:[2,48],49:[2,48],54:[2,48],57:[2,48],73:[2,48],78:[2,48],86:[2,48],91:[2,48],93:[2,48],102:[2,48],104:[2,48],105:[2,48],106:[2,48],110:[2,48],118:[2,48],126:[2,48],128:[2,48],129:[2,48],132:[2,48],133:[2,48],134:[2,48],135:[2,48],136:[2,48],137:[2,48]},{6:[2,57],25:[2,57],26:[2,57],49:[2,57],54:[2,57]},{6:[2,52],25:[2,52],26:[2,52],53:314,54:[1,199]},{1:[2,202],6:[2,202],25:[2,202],26:[2,202],49:[2,202],54:[2,202],57:[2,202],73:[2,202],78:[2,202],86:[2,202],91:[2,202],93:[2,202],102:[2,202],104:[2,202],105:[2,202],106:[2,202],110:[2,202],118:[2,202],126:[2,202],128:[2,202],129:[2,202],132:[2,202],133:[2,202],134:[2,202],135:[2,202],136:[2,202],137:[2,202]},{1:[2,181],6:[2,181],25:[2,181],26:[2,181],49:[2,181],54:[2,181],57:[2,181],73:[2,181],78:[2,181],86:[2,181],91:[2,181],93:[2,181],102:[2,181],104:[2,181],105:[2,181],106:[2,181],110:[2,181],118:[2,181],121:[2,181],126:[2,181],128:[2,181],129:[2,181],132:[2,181],133:[2,181],134:[2,181],135:[2,181],136:[2,181],137:[2,181]},{1:[2,135],6:[2,135],25:[2,135],26:[2,135],49:[2,135],54:[2,135],57:[2,135],73:[2,135],78:[2,135],86:[2,135],91:[2,135],93:[2,135],102:[2,135],104:[2,135],105:[2,135],106:[2,135],110:[2,135],118:[2,135],126:[2,135],128:[2,135],129:[2,135],132:[2,135],133:[2,135],134:[2,135],135:[2,135],136:[2,135],137:[2,135]},{1:[2,136],6:[2,136],25:[2,136],26:[2,136],49:[2,136],54:[2,136],57:[2,136],73:[2,136],78:[2,136],86:[2,136],91:[2,136],93:[2,136],98:[2,136],102:[2,136],104:[2,136],105:[2,136],106:[2,136],110:[2,136],118:[2,136],126:[2,136],128:[2,136],129:[2,136],132:[2,136],133:[2,136],134:[2,136],135:[2,136],136:[2,136],137:[2,136]},{1:[2,137],6:[2,137],25:[2,137],26:[2,137],49:[2,137],54:[2,137],57:[2,137],73:[2,137],78:[2,137],86:[2,137],91:[2,137],93:[2,137],98:[2,137],102:[2,137],104:[2,137],105:[2,137],106:[2,137],110:[2,137],118:[2,137],126:[2,137],128:[2,137],129:[2,137],132:[2,137],133:[2,137],134:[2,137],135:[2,137],136:[2,137],137:[2,137]},{1:[2,172],6:[2,172],25:[2,172],26:[2,172],49:[2,172],54:[2,172],57:[2,172],73:[2,172],78:[2,172],86:[2,172],91:[2,172],93:[2,172],102:[2,172],104:[2,172],105:[2,172],106:[2,172],110:[2,172],118:[2,172],126:[2,172],128:[2,172],129:[2,172],132:[2,172],133:[2,172],134:[2,172],135:[2,172],136:[2,172],137:[2,172]},{24:315,25:[1,112]},{26:[1,316]},{6:[1,317],26:[2,178],121:[2,178],123:[2,178]},{7:318,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,102],6:[2,102],25:[2,102],26:[2,102],49:[2,102],54:[2,102],57:[2,102],73:[2,102],78:[2,102],86:[2,102],91:[2,102],93:[2,102],102:[2,102],104:[2,102],105:[2,102],106:[2,102],110:[2,102],118:[2,102],126:[2,102],128:[2,102],129:[2,102],132:[2,102],133:[2,102],134:[2,102],135:[2,102],136:[2,102],137:[2,102]},{1:[2,141],6:[2,141],25:[2,141],26:[2,141],49:[2,141],54:[2,141],57:[2,141],66:[2,141],67:[2,141],68:[2,141],69:[2,141],71:[2,141],73:[2,141],74:[2,141],78:[2,141],84:[2,141],85:[2,141],86:[2,141],91:[2,141],93:[2,141],102:[2,141],104:[2,141],105:[2,141],106:[2,141],110:[2,141],118:[2,141],126:[2,141],128:[2,141],129:[2,141],132:[2,141],133:[2,141],134:[2,141],135:[2,141],136:[2,141],137:[2,141]},{1:[2,118],6:[2,118],25:[2,118],26:[2,118],49:[2,118],54:[2,118],57:[2,118],66:[2,118],67:[2,118],68:[2,118],69:[2,118],71:[2,118],73:[2,118],74:[2,118],78:[2,118],84:[2,118],85:[2,118],86:[2,118],91:[2,118],93:[2,118],102:[2,118],104:[2,118],105:[2,118],106:[2,118],110:[2,118],118:[2,118],126:[2,118],128:[2,118],129:[2,118],132:[2,118],133:[2,118],134:[2,118],135:[2,118],136:[2,118],137:[2,118]},{6:[2,125],25:[2,125],26:[2,125],54:[2,125],86:[2,125],91:[2,125]},{6:[2,52],25:[2,52],26:[2,52],53:319,54:[1,226]},{6:[2,126],25:[2,126],26:[2,126],54:[2,126],86:[2,126],91:[2,126]},{1:[2,167],6:[2,167],25:[2,167],26:[2,167],49:[2,167],54:[2,167],57:[2,167],73:[2,167],78:[2,167],86:[2,167],91:[2,167],93:[2,167],102:[2,167],103:82,104:[2,167],105:[2,167],106:[2,167],109:83,110:[2,167],111:67,118:[1,320],126:[2,167],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,169],6:[2,169],25:[2,169],26:[2,169],49:[2,169],54:[2,169],57:[2,169],73:[2,169],78:[2,169],86:[2,169],91:[2,169],93:[2,169],102:[2,169],103:82,104:[2,169],105:[1,321],106:[2,169],109:83,110:[2,169],111:67,118:[2,169],126:[2,169],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,168],6:[2,168],25:[2,168],26:[2,168],49:[2,168],54:[2,168],57:[2,168],73:[2,168],78:[2,168],86:[2,168],91:[2,168],93:[2,168],102:[2,168],103:82,104:[2,168],105:[2,168],106:[2,168],109:83,110:[2,168],111:67,118:[2,168],126:[2,168],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{6:[2,93],25:[2,93],26:[2,93],54:[2,93],78:[2,93]},{6:[2,52],25:[2,52],26:[2,52],53:322,54:[1,236]},{26:[1,323],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{6:[1,247],25:[1,248],26:[1,324]},{26:[1,325]},{1:[2,175],6:[2,175],25:[2,175],26:[2,175],49:[2,175],54:[2,175],57:[2,175],73:[2,175],78:[2,175],86:[2,175],91:[2,175],93:[2,175],102:[2,175],104:[2,175],105:[2,175],106:[2,175],110:[2,175],118:[2,175],126:[2,175],128:[2,175],129:[2,175],132:[2,175],133:[2,175],134:[2,175],135:[2,175],136:[2,175],137:[2,175]},{26:[2,179],121:[2,179],123:[2,179]},{25:[2,131],54:[2,131],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{6:[1,270],25:[1,271],26:[1,326]},{7:327,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:328,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{6:[1,281],25:[1,282],26:[1,329]},{6:[2,40],25:[2,40],26:[2,40],54:[2,40],78:[2,40]},{6:[2,58],25:[2,58],26:[2,58],49:[2,58],54:[2,58]},{1:[2,173],6:[2,173],25:[2,173],26:[2,173],49:[2,173],54:[2,173],57:[2,173],73:[2,173],78:[2,173],86:[2,173],91:[2,173],93:[2,173],102:[2,173],104:[2,173],105:[2,173],106:[2,173],110:[2,173],118:[2,173],126:[2,173],128:[2,173],129:[2,173],132:[2,173],133:[2,173],134:[2,173],135:[2,173],136:[2,173],137:[2,173]},{6:[2,127],25:[2,127],26:[2,127],54:[2,127],86:[2,127],91:[2,127]},{1:[2,170],6:[2,170],25:[2,170],26:[2,170],49:[2,170],54:[2,170],57:[2,170],73:[2,170],78:[2,170],86:[2,170],91:[2,170],93:[2,170],102:[2,170],103:82,104:[2,170],105:[2,170],106:[2,170],109:83,110:[2,170],111:67,118:[2,170],126:[2,170],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,171],6:[2,171],25:[2,171],26:[2,171],49:[2,171],54:[2,171],57:[2,171],73:[2,171],78:[2,171],86:[2,171],91:[2,171],93:[2,171],102:[2,171],103:82,104:[2,171],105:[2,171],106:[2,171],109:83,110:[2,171],111:67,118:[2,171],126:[2,171],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{6:[2,94],25:[2,94],26:[2,94],54:[2,94],78:[2,94]}], +defaultActions: {58:[2,50],59:[2,51],89:[2,108],186:[2,88]}, +parseError: function parseError(str, hash) { + if (hash.recoverable) { + this.trace(str); + } else { + // ace_mod + var e = new Error(str) + e.location = hash.loc + throw e; + } +}, +parse: function parse(input) { + var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; + this.lexer.setInput(input); + this.lexer.yy = this.yy; + this.yy.lexer = this.lexer; + this.yy.parser = this; + if (typeof this.lexer.yylloc == 'undefined') { + this.lexer.yylloc = {}; + } + var yyloc = this.lexer.yylloc; + lstack.push(yyloc); + var ranges = this.lexer.options && this.lexer.options.ranges; + if (typeof this.yy.parseError === 'function') { + this.parseError = this.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } + function popStack(n) { + stack.length = stack.length - 2 * n; + vstack.length = vstack.length - n; + lstack.length = lstack.length - n; + } + function lex() { + var token; + token = self.lexer.lex() || EOF; + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + return token; + } + var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; + while (true) { + state = stack[stack.length - 1]; + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol === null || typeof symbol == 'undefined') { + symbol = lex(); + } + action = table[state] && table[state][symbol]; + } + if (typeof action === 'undefined' || !action.length || !action[0]) { + var errStr = ''; + expected = []; + for (p in table[state]) { + if (this.terminals_[p] && p > TERROR) { + expected.push('\'' + this.terminals_[p] + '\''); + } + } + if (this.lexer.showPosition) { + errStr = 'Expecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; + } else { + errStr = 'Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); + } + // ace_mod + if (this.lexer.yylloc.first_line !== yyloc.first_line) yyloc = this.lexer.yylloc; + this.parseError(errStr, { + text: this.lexer.match, + token: this.terminals_[symbol] || symbol, + line: this.lexer.yylineno, + loc: yyloc, + expected: expected + }); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(this.lexer.yytext); + lstack.push(this.lexer.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = this.lexer.yyleng; + yytext = this.lexer.yytext; + yylineno = this.lexer.yylineno; + yyloc = this.lexer.yylloc; + if (recovering > 0) { + recovering--; + } + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [ + lstack[lstack.length - (len || 1)].range[0], + lstack[lstack.length - 1].range[1] + ]; + } + r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); + if (typeof r !== 'undefined') { + return r; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState); + break; + case 3: + return true; + } + } + return true; +}}; +undefined +function Parser () { + this.yy = {}; +} +Parser.prototype = parser;parser.Parser = Parser; + +module.exports = new Parser; + + +}); \ No newline at end of file diff --git a/addons/editor/ace/mode/coffee/parser_test.js b/addons/editor/ace/mode/coffee/parser_test.js new file mode 100755 index 00000000..001262b6 --- /dev/null +++ b/addons/editor/ace/mode/coffee/parser_test.js @@ -0,0 +1,88 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +if (typeof process !== "undefined") { + require("amd-loader"); +} + +define(function(require, exports, module) { +"use strict"; + +var assert = require("../../test/assertions"); +var coffee = require("../coffee/coffee-script"); + +function assertLocation(e, sl, sc, el, ec) { + assert.equal(e.location.first_line, sl); + assert.equal(e.location.first_column, sc); + assert.equal(e.location.last_line, el); + assert.equal(e.location.last_column, ec); +} + +function parse(str) { + try { + coffee.parse(str).compile(); + } catch (e) { + return e; + } +} + +module.exports = { + "test parse valid coffee script": function() { + coffee.parse("square = (x) -> x * x"); + }, + + "test parse invalid coffee script": function() { + var e = parse("a = 12 f"); + assert.equal(e.message, "Unexpected 'IDENTIFIER'"); + assertLocation(e, 0, 4, 0, 5); + }, + + "test parse missing bracket": function() { + var e = parse("a = 12 f {\n\n"); + assert.equal(e.message, "missing }"); + assertLocation(e, 0, 10, 0, 10); + }, + "test unexpected indent": function() { + var e = parse("a\n a\n"); + assert.equal(e.message, "Unexpected 'INDENT'"); + assertLocation(e, 1, 0, 1, 1); + }, + "test invalid destructuring": function() { + var e = parse("\n{b: 5} = {}"); + assert.equal(e.message, '"5" cannot be assigned'); + assertLocation(e, 1, 4, 1, 4); + } +}; + +}); + +if (typeof module !== "undefined" && module === require.main) { + require("asyncjs").test.testcase(module.exports).exec(); +} diff --git a/addons/editor/ace/mode/coffee/rewriter.js b/addons/editor/ace/mode/coffee/rewriter.js new file mode 100755 index 00000000..009d17d0 --- /dev/null +++ b/addons/editor/ace/mode/coffee/rewriter.js @@ -0,0 +1,513 @@ +/** + * Copyright (c) 2009-2013 Jeremy Ashkenas + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + */ + +define(function(require, exports, module) { +// Generated by CoffeeScript 1.6.3 + + var BALANCED_PAIRS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, IMPLICIT_UNSPACED_CALL, INVERSES, LINEBREAKS, SINGLE_CLOSERS, SINGLE_LINERS, generate, left, rite, _i, _len, _ref, + __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, + __slice = [].slice; + + generate = function(tag, value) { + var tok; + tok = [tag, value]; + tok.generated = true; + return tok; + }; + + exports.Rewriter = (function() { + function Rewriter() {} + + Rewriter.prototype.rewrite = function(tokens) { + this.tokens = tokens; + this.removeLeadingNewlines(); + this.removeMidExpressionNewlines(); + this.closeOpenCalls(); + this.closeOpenIndexes(); + this.addImplicitIndentation(); + this.tagPostfixConditionals(); + this.addImplicitBracesAndParens(); + this.addLocationDataToGeneratedTokens(); + return this.tokens; + }; + + Rewriter.prototype.scanTokens = function(block) { + var i, token, tokens; + tokens = this.tokens; + i = 0; + while (token = tokens[i]) { + i += block.call(this, token, i, tokens); + } + return true; + }; + + Rewriter.prototype.detectEnd = function(i, condition, action) { + var levels, token, tokens, _ref, _ref1; + tokens = this.tokens; + levels = 0; + while (token = tokens[i]) { + if (levels === 0 && condition.call(this, token, i)) { + return action.call(this, token, i); + } + if (!token || levels < 0) { + return action.call(this, token, i - 1); + } + if (_ref = token[0], __indexOf.call(EXPRESSION_START, _ref) >= 0) { + levels += 1; + } else if (_ref1 = token[0], __indexOf.call(EXPRESSION_END, _ref1) >= 0) { + levels -= 1; + } + i += 1; + } + return i - 1; + }; + + Rewriter.prototype.removeLeadingNewlines = function() { + var i, tag, _i, _len, _ref; + _ref = this.tokens; + for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { + tag = _ref[i][0]; + if (tag !== 'TERMINATOR') { + break; + } + } + if (i) { + return this.tokens.splice(0, i); + } + }; + + Rewriter.prototype.removeMidExpressionNewlines = function() { + return this.scanTokens(function(token, i, tokens) { + var _ref; + if (!(token[0] === 'TERMINATOR' && (_ref = this.tag(i + 1), __indexOf.call(EXPRESSION_CLOSE, _ref) >= 0))) { + return 1; + } + tokens.splice(i, 1); + return 0; + }); + }; + + Rewriter.prototype.closeOpenCalls = function() { + var action, condition; + condition = function(token, i) { + var _ref; + return ((_ref = token[0]) === ')' || _ref === 'CALL_END') || token[0] === 'OUTDENT' && this.tag(i - 1) === ')'; + }; + action = function(token, i) { + return this.tokens[token[0] === 'OUTDENT' ? i - 1 : i][0] = 'CALL_END'; + }; + return this.scanTokens(function(token, i) { + if (token[0] === 'CALL_START') { + this.detectEnd(i + 1, condition, action); + } + return 1; + }); + }; + + Rewriter.prototype.closeOpenIndexes = function() { + var action, condition; + condition = function(token, i) { + var _ref; + return (_ref = token[0]) === ']' || _ref === 'INDEX_END'; + }; + action = function(token, i) { + return token[0] = 'INDEX_END'; + }; + return this.scanTokens(function(token, i) { + if (token[0] === 'INDEX_START') { + this.detectEnd(i + 1, condition, action); + } + return 1; + }); + }; + + Rewriter.prototype.matchTags = function() { + var fuzz, i, j, pattern, _i, _ref, _ref1; + i = arguments[0], pattern = 2 <= arguments.length ? __slice.call(arguments, 1) : []; + fuzz = 0; + for (j = _i = 0, _ref = pattern.length; 0 <= _ref ? _i < _ref : _i > _ref; j = 0 <= _ref ? ++_i : --_i) { + while (this.tag(i + j + fuzz) === 'HERECOMMENT') { + fuzz += 2; + } + if (pattern[j] == null) { + continue; + } + if (typeof pattern[j] === 'string') { + pattern[j] = [pattern[j]]; + } + if (_ref1 = this.tag(i + j + fuzz), __indexOf.call(pattern[j], _ref1) < 0) { + return false; + } + } + return true; + }; + + Rewriter.prototype.looksObjectish = function(j) { + return this.matchTags(j, '@', null, ':') || this.matchTags(j, null, ':'); + }; + + Rewriter.prototype.findTagsBackwards = function(i, tags) { + var backStack, _ref, _ref1, _ref2, _ref3, _ref4, _ref5; + backStack = []; + while (i >= 0 && (backStack.length || (_ref2 = this.tag(i), __indexOf.call(tags, _ref2) < 0) && ((_ref3 = this.tag(i), __indexOf.call(EXPRESSION_START, _ref3) < 0) || this.tokens[i].generated) && (_ref4 = this.tag(i), __indexOf.call(LINEBREAKS, _ref4) < 0))) { + if (_ref = this.tag(i), __indexOf.call(EXPRESSION_END, _ref) >= 0) { + backStack.push(this.tag(i)); + } + if ((_ref1 = this.tag(i), __indexOf.call(EXPRESSION_START, _ref1) >= 0) && backStack.length) { + backStack.pop(); + } + i -= 1; + } + return _ref5 = this.tag(i), __indexOf.call(tags, _ref5) >= 0; + }; + + Rewriter.prototype.addImplicitBracesAndParens = function() { + var stack; + stack = []; + return this.scanTokens(function(token, i, tokens) { + var endImplicitCall, endImplicitObject, forward, inImplicit, inImplicitCall, inImplicitControl, inImplicitObject, nextTag, offset, prevTag, s, sameLine, stackIdx, stackTag, stackTop, startIdx, startImplicitCall, startImplicitObject, startsLine, tag, _ref, _ref1, _ref2, _ref3, _ref4, _ref5; + tag = token[0]; + prevTag = (i > 0 ? tokens[i - 1] : [])[0]; + nextTag = (i < tokens.length - 1 ? tokens[i + 1] : [])[0]; + stackTop = function() { + return stack[stack.length - 1]; + }; + startIdx = i; + forward = function(n) { + return i - startIdx + n; + }; + inImplicit = function() { + var _ref, _ref1; + return (_ref = stackTop()) != null ? (_ref1 = _ref[2]) != null ? _ref1.ours : void 0 : void 0; + }; + inImplicitCall = function() { + var _ref; + return inImplicit() && ((_ref = stackTop()) != null ? _ref[0] : void 0) === '('; + }; + inImplicitObject = function() { + var _ref; + return inImplicit() && ((_ref = stackTop()) != null ? _ref[0] : void 0) === '{'; + }; + inImplicitControl = function() { + var _ref; + return inImplicit && ((_ref = stackTop()) != null ? _ref[0] : void 0) === 'CONTROL'; + }; + startImplicitCall = function(j) { + var idx; + idx = j != null ? j : i; + stack.push([ + '(', idx, { + ours: true + } + ]); + tokens.splice(idx, 0, generate('CALL_START', '(')); + if (j == null) { + return i += 1; + } + }; + endImplicitCall = function() { + stack.pop(); + tokens.splice(i, 0, generate('CALL_END', ')')); + return i += 1; + }; + startImplicitObject = function(j, startsLine) { + var idx; + if (startsLine == null) { + startsLine = true; + } + idx = j != null ? j : i; + stack.push([ + '{', idx, { + sameLine: true, + startsLine: startsLine, + ours: true + } + ]); + tokens.splice(idx, 0, generate('{', generate(new String('{')))); + if (j == null) { + return i += 1; + } + }; + endImplicitObject = function(j) { + j = j != null ? j : i; + stack.pop(); + tokens.splice(j, 0, generate('}', '}')); + return i += 1; + }; + if (inImplicitCall() && (tag === 'IF' || tag === 'TRY' || tag === 'FINALLY' || tag === 'CATCH' || tag === 'CLASS' || tag === 'SWITCH')) { + stack.push([ + 'CONTROL', i, { + ours: true + } + ]); + return forward(1); + } + if (tag === 'INDENT' && inImplicit()) { + if (prevTag !== '=>' && prevTag !== '->' && prevTag !== '[' && prevTag !== '(' && prevTag !== ',' && prevTag !== '{' && prevTag !== 'TRY' && prevTag !== 'ELSE' && prevTag !== '=') { + while (inImplicitCall()) { + endImplicitCall(); + } + } + if (inImplicitControl()) { + stack.pop(); + } + stack.push([tag, i]); + return forward(1); + } + if (__indexOf.call(EXPRESSION_START, tag) >= 0) { + stack.push([tag, i]); + return forward(1); + } + if (__indexOf.call(EXPRESSION_END, tag) >= 0) { + while (inImplicit()) { + if (inImplicitCall()) { + endImplicitCall(); + } else if (inImplicitObject()) { + endImplicitObject(); + } else { + stack.pop(); + } + } + stack.pop(); + } + if ((__indexOf.call(IMPLICIT_FUNC, tag) >= 0 && token.spaced && !token.stringEnd || tag === '?' && i > 0 && !tokens[i - 1].spaced) && (__indexOf.call(IMPLICIT_CALL, nextTag) >= 0 || __indexOf.call(IMPLICIT_UNSPACED_CALL, nextTag) >= 0 && !((_ref = tokens[i + 1]) != null ? _ref.spaced : void 0) && !((_ref1 = tokens[i + 1]) != null ? _ref1.newLine : void 0))) { + if (tag === '?') { + tag = token[0] = 'FUNC_EXIST'; + } + startImplicitCall(i + 1); + return forward(2); + } + if (__indexOf.call(IMPLICIT_FUNC, tag) >= 0 && this.matchTags(i + 1, 'INDENT', null, ':') && !this.findTagsBackwards(i, ['CLASS', 'EXTENDS', 'IF', 'CATCH', 'SWITCH', 'LEADING_WHEN', 'FOR', 'WHILE', 'UNTIL'])) { + startImplicitCall(i + 1); + stack.push(['INDENT', i + 2]); + return forward(3); + } + if (tag === ':') { + if (this.tag(i - 2) === '@') { + s = i - 2; + } else { + s = i - 1; + } + while (this.tag(s - 2) === 'HERECOMMENT') { + s -= 2; + } + startsLine = s === 0 || (_ref2 = this.tag(s - 1), __indexOf.call(LINEBREAKS, _ref2) >= 0) || tokens[s - 1].newLine; + if (stackTop()) { + _ref3 = stackTop(), stackTag = _ref3[0], stackIdx = _ref3[1]; + if ((stackTag === '{' || stackTag === 'INDENT' && this.tag(stackIdx - 1) === '{') && (startsLine || this.tag(s - 1) === ',' || this.tag(s - 1) === '{')) { + return forward(1); + } + } + startImplicitObject(s, !!startsLine); + return forward(2); + } + if (prevTag === 'OUTDENT' && inImplicitCall() && (tag === '.' || tag === '?.' || tag === '::' || tag === '?::')) { + endImplicitCall(); + return forward(1); + } + if (inImplicitObject() && __indexOf.call(LINEBREAKS, tag) >= 0) { + stackTop()[2].sameLine = false; + } + if (__indexOf.call(IMPLICIT_END, tag) >= 0) { + while (inImplicit()) { + _ref4 = stackTop(), stackTag = _ref4[0], stackIdx = _ref4[1], (_ref5 = _ref4[2], sameLine = _ref5.sameLine, startsLine = _ref5.startsLine); + if (inImplicitCall() && prevTag !== ',') { + endImplicitCall(); + } else if (inImplicitObject() && sameLine && !startsLine) { + endImplicitObject(); + } else if (inImplicitObject() && tag === 'TERMINATOR' && prevTag !== ',' && !(startsLine && this.looksObjectish(i + 1))) { + endImplicitObject(); + } else { + break; + } + } + } + if (tag === ',' && !this.looksObjectish(i + 1) && inImplicitObject() && (nextTag !== 'TERMINATOR' || !this.looksObjectish(i + 2))) { + offset = nextTag === 'OUTDENT' ? 1 : 0; + while (inImplicitObject()) { + endImplicitObject(i + offset); + } + } + return forward(1); + }); + }; + + Rewriter.prototype.addLocationDataToGeneratedTokens = function() { + return this.scanTokens(function(token, i, tokens) { + var column, line, nextLocation, prevLocation, _ref, _ref1; + if (token[2]) { + return 1; + } + if (!(token.generated || token.explicit)) { + return 1; + } + if (token[0] === '{' && (nextLocation = (_ref = tokens[i + 1]) != null ? _ref[2] : void 0)) { + line = nextLocation.first_line, column = nextLocation.first_column; + } else if (prevLocation = (_ref1 = tokens[i - 1]) != null ? _ref1[2] : void 0) { + line = prevLocation.last_line, column = prevLocation.last_column; + } else { + line = column = 0; + } + token[2] = { + first_line: line, + first_column: column, + last_line: line, + last_column: column + }; + return 1; + }); + }; + + Rewriter.prototype.addImplicitIndentation = function() { + var action, condition, indent, outdent, starter; + starter = indent = outdent = null; + condition = function(token, i) { + var _ref, _ref1; + return token[1] !== ';' && (_ref = token[0], __indexOf.call(SINGLE_CLOSERS, _ref) >= 0) && !(token[0] === 'ELSE' && starter !== 'THEN') && !(((_ref1 = token[0]) === 'CATCH' || _ref1 === 'FINALLY') && (starter === '->' || starter === '=>')); + }; + action = function(token, i) { + return this.tokens.splice((this.tag(i - 1) === ',' ? i - 1 : i), 0, outdent); + }; + return this.scanTokens(function(token, i, tokens) { + var j, tag, _i, _ref, _ref1; + tag = token[0]; + if (tag === 'TERMINATOR' && this.tag(i + 1) === 'THEN') { + tokens.splice(i, 1); + return 0; + } + if (tag === 'ELSE' && this.tag(i - 1) !== 'OUTDENT') { + tokens.splice.apply(tokens, [i, 0].concat(__slice.call(this.indentation()))); + return 2; + } + if (tag === 'CATCH') { + for (j = _i = 1; _i <= 2; j = ++_i) { + if (!((_ref = this.tag(i + j)) === 'OUTDENT' || _ref === 'TERMINATOR' || _ref === 'FINALLY')) { + continue; + } + tokens.splice.apply(tokens, [i + j, 0].concat(__slice.call(this.indentation()))); + return 2 + j; + } + } + if (__indexOf.call(SINGLE_LINERS, tag) >= 0 && this.tag(i + 1) !== 'INDENT' && !(tag === 'ELSE' && this.tag(i + 1) === 'IF')) { + starter = tag; + _ref1 = this.indentation(true), indent = _ref1[0], outdent = _ref1[1]; + if (starter === 'THEN') { + indent.fromThen = true; + } + tokens.splice(i + 1, 0, indent); + this.detectEnd(i + 2, condition, action); + if (tag === 'THEN') { + tokens.splice(i, 1); + } + return 1; + } + return 1; + }); + }; + + Rewriter.prototype.tagPostfixConditionals = function() { + var action, condition, original; + original = null; + condition = function(token, i) { + var prevTag, tag; + tag = token[0]; + prevTag = this.tokens[i - 1][0]; + return tag === 'TERMINATOR' || (tag === 'INDENT' && __indexOf.call(SINGLE_LINERS, prevTag) < 0); + }; + action = function(token, i) { + if (token[0] !== 'INDENT' || (token.generated && !token.fromThen)) { + return original[0] = 'POST_' + original[0]; + } + }; + return this.scanTokens(function(token, i) { + if (token[0] !== 'IF') { + return 1; + } + original = token; + this.detectEnd(i + 1, condition, action); + return 1; + }); + }; + + Rewriter.prototype.indentation = function(implicit) { + var indent, outdent; + if (implicit == null) { + implicit = false; + } + indent = ['INDENT', 2]; + outdent = ['OUTDENT', 2]; + if (implicit) { + indent.generated = outdent.generated = true; + } + if (!implicit) { + indent.explicit = outdent.explicit = true; + } + return [indent, outdent]; + }; + + Rewriter.prototype.generate = generate; + + Rewriter.prototype.tag = function(i) { + var _ref; + return (_ref = this.tokens[i]) != null ? _ref[0] : void 0; + }; + + return Rewriter; + + })(); + + BALANCED_PAIRS = [['(', ')'], ['[', ']'], ['{', '}'], ['INDENT', 'OUTDENT'], ['CALL_START', 'CALL_END'], ['PARAM_START', 'PARAM_END'], ['INDEX_START', 'INDEX_END']]; + + exports.INVERSES = INVERSES = {}; + + EXPRESSION_START = []; + + EXPRESSION_END = []; + + for (_i = 0, _len = BALANCED_PAIRS.length; _i < _len; _i++) { + _ref = BALANCED_PAIRS[_i], left = _ref[0], rite = _ref[1]; + EXPRESSION_START.push(INVERSES[rite] = left); + EXPRESSION_END.push(INVERSES[left] = rite); + } + + EXPRESSION_CLOSE = ['CATCH', 'WHEN', 'ELSE', 'FINALLY'].concat(EXPRESSION_END); + + IMPLICIT_FUNC = ['IDENTIFIER', 'SUPER', ')', 'CALL_END', ']', 'INDEX_END', '@', 'THIS']; + + IMPLICIT_CALL = ['IDENTIFIER', 'NUMBER', 'STRING', 'JS', 'REGEX', 'NEW', 'PARAM_START', 'CLASS', 'IF', 'TRY', 'SWITCH', 'THIS', 'BOOL', 'NULL', 'UNDEFINED', 'UNARY', 'SUPER', 'THROW', '@', '->', '=>', '[', '(', '{', '--', '++']; + + IMPLICIT_UNSPACED_CALL = ['+', '-']; + + IMPLICIT_END = ['POST_IF', 'FOR', 'WHILE', 'UNTIL', 'WHEN', 'BY', 'LOOP', 'TERMINATOR']; + + SINGLE_LINERS = ['ELSE', '->', '=>', 'TRY', 'FINALLY', 'THEN']; + + SINGLE_CLOSERS = ['TERMINATOR', 'CATCH', 'FINALLY', 'ELSE', 'OUTDENT', 'LEADING_WHEN']; + + LINEBREAKS = ['TERMINATOR', 'INDENT', 'OUTDENT']; + + +}); \ No newline at end of file diff --git a/addons/editor/ace/mode/coffee/scope.js b/addons/editor/ace/mode/coffee/scope.js new file mode 100755 index 00000000..5834963b --- /dev/null +++ b/addons/editor/ace/mode/coffee/scope.js @@ -0,0 +1,174 @@ +/** + * Copyright (c) 2009-2013 Jeremy Ashkenas + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + */ + +define(function(require, exports, module) { +// Generated by CoffeeScript 1.6.3 + + var Scope, extend, last, _ref; + + _ref = require('./helpers'), extend = _ref.extend, last = _ref.last; + + exports.Scope = Scope = (function() { + Scope.root = null; + + function Scope(parent, expressions, method) { + this.parent = parent; + this.expressions = expressions; + this.method = method; + this.variables = [ + { + name: 'arguments', + type: 'arguments' + } + ]; + this.positions = {}; + if (!this.parent) { + Scope.root = this; + } + } + + Scope.prototype.add = function(name, type, immediate) { + if (this.shared && !immediate) { + return this.parent.add(name, type, immediate); + } + if (Object.prototype.hasOwnProperty.call(this.positions, name)) { + return this.variables[this.positions[name]].type = type; + } else { + return this.positions[name] = this.variables.push({ + name: name, + type: type + }) - 1; + } + }; + + Scope.prototype.namedMethod = function() { + var _ref1; + if (((_ref1 = this.method) != null ? _ref1.name : void 0) || !this.parent) { + return this.method; + } + return this.parent.namedMethod(); + }; + + Scope.prototype.find = function(name) { + if (this.check(name)) { + return true; + } + this.add(name, 'var'); + return false; + }; + + Scope.prototype.parameter = function(name) { + if (this.shared && this.parent.check(name, true)) { + return; + } + return this.add(name, 'param'); + }; + + Scope.prototype.check = function(name) { + var _ref1; + return !!(this.type(name) || ((_ref1 = this.parent) != null ? _ref1.check(name) : void 0)); + }; + + Scope.prototype.temporary = function(name, index) { + if (name.length > 1) { + return '_' + name + (index > 1 ? index - 1 : ''); + } else { + return '_' + (index + parseInt(name, 36)).toString(36).replace(/\d/g, 'a'); + } + }; + + Scope.prototype.type = function(name) { + var v, _i, _len, _ref1; + _ref1 = this.variables; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + v = _ref1[_i]; + if (v.name === name) { + return v.type; + } + } + return null; + }; + + Scope.prototype.freeVariable = function(name, reserve) { + var index, temp; + if (reserve == null) { + reserve = true; + } + index = 0; + while (this.check((temp = this.temporary(name, index)))) { + index++; + } + if (reserve) { + this.add(temp, 'var', true); + } + return temp; + }; + + Scope.prototype.assign = function(name, value) { + this.add(name, { + value: value, + assigned: true + }, true); + return this.hasAssignments = true; + }; + + Scope.prototype.hasDeclarations = function() { + return !!this.declaredVariables().length; + }; + + Scope.prototype.declaredVariables = function() { + var realVars, tempVars, v, _i, _len, _ref1; + realVars = []; + tempVars = []; + _ref1 = this.variables; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + v = _ref1[_i]; + if (v.type === 'var') { + (v.name.charAt(0) === '_' ? tempVars : realVars).push(v.name); + } + } + return realVars.sort().concat(tempVars.sort()); + }; + + Scope.prototype.assignedVariables = function() { + var v, _i, _len, _ref1, _results; + _ref1 = this.variables; + _results = []; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + v = _ref1[_i]; + if (v.type.assigned) { + _results.push("" + v.name + " = " + v.type.value); + } + } + return _results; + }; + + return Scope; + + })(); + + +}); \ No newline at end of file diff --git a/addons/editor/ace/mode-coffee.js b/addons/editor/ace/mode/coffee_highlight_rules.js old mode 100644 new mode 100755 similarity index 59% rename from addons/editor/ace/mode-coffee.js rename to addons/editor/ace/mode/coffee_highlight_rules.js index 42a70ebc..a6d33abb --- a/addons/editor/ace/mode-coffee.js +++ b/addons/editor/ace/mode/coffee_highlight_rules.js @@ -3,7 +3,7 @@ * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright @@ -14,7 +14,7 @@ * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -28,93 +28,8 @@ * * ***** END LICENSE BLOCK ***** */ -define('ace/mode/coffee', ['require', 'exports', 'module' , 'ace/tokenizer', 'ace/mode/coffee_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/folding/coffee', 'ace/range', 'ace/mode/text', 'ace/worker/worker_client', 'ace/lib/oop'], function(require, exports, module) { - - -var Tokenizer = require("../tokenizer").Tokenizer; -var Rules = require("./coffee_highlight_rules").CoffeeHighlightRules; -var Outdent = require("./matching_brace_outdent").MatchingBraceOutdent; -var FoldMode = require("./folding/coffee").FoldMode; -var Range = require("../range").Range; -var TextMode = require("./text").Mode; -var WorkerClient = require("../worker/worker_client").WorkerClient; -var oop = require("../lib/oop"); - -function Mode() { - this.HighlightRules = Rules; - this.$outdent = new Outdent(); - this.foldingRules = new FoldMode(); -} - -oop.inherits(Mode, TextMode); - -(function() { - - var indenter = /(?:[({[=:]|[-=]>|\b(?:else|switch|try|catch(?:\s*[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)?|finally))\s*$/; - var commentLine = /^(\s*)#/; - var hereComment = /^\s*###(?!#)/; - var indentation = /^\s*/; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - var tokens = this.getTokenizer().getLineTokens(line, state).tokens; - - if (!(tokens.length && tokens[tokens.length - 1].type === 'comment') && - state === 'start' && indenter.test(line)) - indent += tab; - return indent; - }; - - this.toggleCommentLines = function(state, doc, startRow, endRow){ - console.log("toggle"); - var range = new Range(0, 0, 0, 0); - for (var i = startRow; i <= endRow; ++i) { - var line = doc.getLine(i); - if (hereComment.test(line)) - continue; - - if (commentLine.test(line)) - line = line.replace(commentLine, '$1'); - else - line = line.replace(indentation, '$&#'); - - range.end.row = range.start.row = i; - range.end.column = line.length + 1; - doc.replace(range, line); - } - }; - - this.checkOutdent = function(state, line, input) { - return this.$outdent.checkOutdent(line, input); - }; - - this.autoOutdent = function(state, doc, row) { - this.$outdent.autoOutdent(doc, row); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], "ace/mode/coffee_worker", "Worker"); - worker.attachToDocument(session.getDocument()); - - worker.on("error", function(e) { - session.setAnnotations([e.data]); - }); - - worker.on("ok", function(e) { - session.clearAnnotations(); - }); - - return worker; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; - -}); - -define('ace/mode/coffee_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { - +define(function(require, exports, module) { +"use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; @@ -126,7 +41,7 @@ define('ace/mode/coffee_highlight_rules', ['require', 'exports', 'module' , 'ace var keywords = ( "this|throw|then|try|typeof|super|switch|return|break|by|continue|" + - "catch|class|in|instanceof|is|isnt|if|else|extends|for|forown|" + + "catch|class|in|instanceof|is|isnt|if|else|extends|for|own|" + "finally|function|while|when|new|no|not|delete|debugger|do|loop|of|off|" + "or|on|unless|until|and|yes" ); @@ -254,10 +169,12 @@ define('ace/mode/coffee_highlight_rules', ['require', 'exports', 'module' , 'ace token : "punctuation.operator", regex : "\\." }, { + //class A extends B token : ["keyword", "text", "language.support.class", "text", "keyword", "text", "language.support.class"], regex : "(class)(\\s+)(" + identifier + ")(?:(\\s+)(extends)(\\s+)(" + identifier + "))?" }, { + //play = (...) -> token : ["entity.name.function", "text", "keyword.operator", "text"].concat(functionRule.token), regex : "(" + identifier + ")(\\s*)([=:])(\\s*)" + functionRule.regex }, @@ -314,130 +231,3 @@ define('ace/mode/coffee_highlight_rules', ['require', 'exports', 'module' , 'ace exports.CoffeeHighlightRules = CoffeeHighlightRules; }); - -define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { - - -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) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -define('ace/mode/folding/coffee', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) { - - -var oop = require("../../lib/oop"); -var BaseFoldMode = require("./fold_mode").FoldMode; -var Range = require("../../range").Range; - -var FoldMode = exports.FoldMode = function() {}; -oop.inherits(FoldMode, BaseFoldMode); - -(function() { - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var range = this.indentationBlock(session, row); - if (range) - return range; - - var re = /\S/; - var line = session.getLine(row); - var startLevel = line.search(re); - if (startLevel == -1 || line[startLevel] != "#") - return; - - var startColumn = line.length; - var maxRow = session.getLength(); - var startRow = row; - var endRow = row; - - while (++row < maxRow) { - line = session.getLine(row); - var level = line.search(re); - - if (level == -1) - continue; - - if (line[level] != "#") - break; - - endRow = row; - } - - if (endRow > startRow) { - var endColumn = session.getLine(endRow).length; - return new Range(startRow, startColumn, endRow, endColumn); - } - }; - this.getFoldWidget = function(session, foldStyle, row) { - var line = session.getLine(row); - var indent = line.search(/\S/); - var next = session.getLine(row + 1); - var prev = session.getLine(row - 1); - var prevIndent = prev.search(/\S/); - var nextIndent = next.search(/\S/); - - if (indent == -1) { - session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : ""; - return ""; - } - if (prevIndent == -1) { - if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") { - session.foldWidgets[row - 1] = ""; - session.foldWidgets[row + 1] = ""; - return "start"; - } - } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") { - if (session.getLine(row - 2).search(/\S/) == -1) { - session.foldWidgets[row - 1] = "start"; - session.foldWidgets[row + 1] = ""; - return ""; - } - } - - if (prevIndent!= -1 && prevIndent < indent) - session.foldWidgets[row - 1] = "start"; - else - session.foldWidgets[row - 1] = ""; - - if (indent < nextIndent) - return "start"; - else - return ""; - }; - -}).call(FoldMode.prototype); - -}); diff --git a/addons/editor/ace/mode/coffee_worker.js b/addons/editor/ace/mode/coffee_worker.js new file mode 100755 index 00000000..a5f700f8 --- /dev/null +++ b/addons/editor/ace/mode/coffee_worker.js @@ -0,0 +1,74 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var Mirror = require("../worker/mirror").Mirror; +var coffee = require("../mode/coffee/coffee-script"); + +window.addEventListener = function() {}; + + +var Worker = exports.Worker = function(sender) { + Mirror.call(this, sender); + this.setTimeout(250); +}; + +oop.inherits(Worker, Mirror); + +(function() { + + this.onUpdate = function() { + var value = this.doc.getValue(); + + try { + coffee.parse(value).compile(); + } catch(e) { + var loc = e.location; + if (loc) { + this.sender.emit("error", { + row: loc.first_line, + column: loc.first_column, + endRow: loc.last_line, + endColumn: loc.last_column, + text: e.message, + type: "error" + }); + } + return; + } + this.sender.emit("ok"); + }; + +}).call(Worker.prototype); + +}); diff --git a/addons/editor/ace/mode/coldfusion.js b/addons/editor/ace/mode/coldfusion.js new file mode 100755 index 00000000..25a2b17a --- /dev/null +++ b/addons/editor/ace/mode/coldfusion.js @@ -0,0 +1,62 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var XmlMode = require("./xml").Mode; +var JavaScriptMode = require("./javascript").Mode; +var CssMode = require("./css").Mode; +var Tokenizer = require("../tokenizer").Tokenizer; +var ColdfusionHighlightRules = require("./coldfusion_highlight_rules").ColdfusionHighlightRules; + +var Mode = function() { + XmlMode.call(this); + + this.HighlightRules = ColdfusionHighlightRules; + + this.createModeDelegates({ + "js-": JavaScriptMode, + "css-": CssMode + }); +}; +oop.inherits(Mode, XmlMode); + +(function() { + + this.getNextLineIndent = function(state, line, tab) { + return this.$getIndent(line); + }; + +}).call(Mode.prototype); + +exports.Mode = Mode; +}); diff --git a/addons/editor/ace/mode/coldfusion_highlight_rules.js b/addons/editor/ace/mode/coldfusion_highlight_rules.js new file mode 100755 index 00000000..5feff6d6 --- /dev/null +++ b/addons/editor/ace/mode/coldfusion_highlight_rules.js @@ -0,0 +1,49 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; +var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; + +var ColdfusionHighlightRules = function() { + HtmlHighlightRules.call(this); + + this.embedTagRules(JavaScriptHighlightRules, "cfjs-", "cfscript"); + + this.normalizeRules(); +}; + +oop.inherits(ColdfusionHighlightRules, HtmlHighlightRules); + +exports.ColdfusionHighlightRules = ColdfusionHighlightRules; +}); diff --git a/addons/editor/ace/mode/coldfusion_test.js b/addons/editor/ace/mode/coldfusion_test.js new file mode 100755 index 00000000..b55fb1c5 --- /dev/null +++ b/addons/editor/ace/mode/coldfusion_test.js @@ -0,0 +1,67 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +if (typeof process !== "undefined") { + require("amd-loader"); +} + +define(function(require, exports, module) { +"use strict"; + +var EditSession = require("../edit_session").EditSession; +var Range = require("../range").Range; +var ColdfusionMode = require("./coldfusion").Mode; +var assert = require("../test/assertions"); + +module.exports = { + setUp : function() { + this.mode = new ColdfusionMode(); + }, + + "test: toggle comment lines" : function() { + var session = new EditSession([" abc", " cde", "fg"]); + + var range = new Range(0, 3, 1, 1); + var comment = this.mode.toggleCommentLines("start", session, 0, 1); + assert.equal([" ", " ", "fg"].join("\n"), session.toString()); + }, + + "test: next line indent should be the same as the current line indent" : function() { + assert.equal(" ", this.mode.getNextLineIndent("start", " abc")); + assert.equal("", this.mode.getNextLineIndent("start", "abc")); + assert.equal("\t", this.mode.getNextLineIndent("start", "\tabc")); + } +}; + +}); + +if (typeof module !== "undefined" && module === require.main) { + require("asyncjs").test.testcase(module.exports).exec() +} diff --git a/addons/editor/ace/mode/csharp.js b/addons/editor/ace/mode/csharp.js new file mode 100755 index 00000000..95846a4c --- /dev/null +++ b/addons/editor/ace/mode/csharp.js @@ -0,0 +1,61 @@ +define(function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextMode = require("./text").Mode; +var Tokenizer = require("../tokenizer").Tokenizer; +var CSharpHighlightRules = require("./csharp_highlight_rules").CSharpHighlightRules; +var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; +var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; +var CStyleFoldMode = require("./folding/csharp").FoldMode; + +var Mode = function() { + this.HighlightRules = CSharpHighlightRules; + this.$outdent = new MatchingBraceOutdent(); + this.$behaviour = new CstyleBehaviour(); + this.foldingRules = new CStyleFoldMode(); +}; +oop.inherits(Mode, TextMode); + +(function() { + + this.lineCommentStart = "//"; + this.blockComment = {start: "/*", end: "*/"}; + + this.getNextLineIndent = function(state, line, tab) { + var indent = this.$getIndent(line); + + var tokenizedLine = this.getTokenizer().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; + }; + + this.checkOutdent = function(state, line, input) { + return this.$outdent.checkOutdent(line, input); + }; + + this.autoOutdent = function(state, doc, row) { + this.$outdent.autoOutdent(doc, row); + }; + + + this.createWorker = function(session) { + return null; + }; + +}).call(Mode.prototype); + +exports.Mode = Mode; +}); diff --git a/addons/editor/ace/mode/csharp_highlight_rules.js b/addons/editor/ace/mode/csharp_highlight_rules.js new file mode 100755 index 00000000..89cbc2d5 --- /dev/null +++ b/addons/editor/ace/mode/csharp_highlight_rules.js @@ -0,0 +1,96 @@ +define(function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; +var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + +var CSharpHighlightRules = function() { + var keywordMapper = this.createKeywordMapper({ + "variable.language": "this", + "keyword": "abstract|event|new|struct|as|explicit|null|switch|base|extern|object|this|bool|false|operator|throw|break|finally|out|true|byte|fixed|override|try|case|float|params|typeof|catch|for|private|uint|char|foreach|protected|ulong|checked|goto|public|unchecked|class|if|readonly|unsafe|const|implicit|ref|ushort|continue|in|return|using|decimal|int|sbyte|virtual|default|interface|sealed|volatile|delegate|internal|short|void|do|is|sizeof|while|double|lock|stackalloc|else|long|static|enum|namespace|string|var|dynamic", + "constant.language": "null|true|false" + }, "identifier"); + + // regexp must not have capturing parentheses. Use (?:) instead. + // regexps are ordered -> the first match is used + + this.$rules = { + "start" : [ + { + token : "comment", + regex : "\\/\\/.*$" + }, + DocCommentHighlightRules.getStartRule("doc-start"), + { + token : "comment", // multi line comment + regex : "\\/\\*", + next : "comment" + }, { + token : "string.regexp", + regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" + }, { + token : "string", // character + regex : /'(?:.|\\(:?u[\da-fA-F]+|x[\da-fA-F]+|[tbrf'"n]))'/ + }, { + token : "string", start : '"', end : '"|$', next: [ + {token: "constant.language.escape", regex: /\\(:?u[\da-fA-F]+|x[\da-fA-F]+|[tbrf'"n])/}, + {token: "invalid", regex: /\\./} + ] + }, { + token : "string", start : '@"', end : '"', next:[ + {token: "constant.language.escape", regex: '""'} + ] + }, { + token : "constant.numeric", // hex + regex : "0[xX][0-9a-fA-F]+\\b" + }, { + token : "constant.numeric", // float + regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" + }, { + token : "constant.language.boolean", + regex : "(?:true|false)\\b" + }, { + token : keywordMapper, + regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" + }, { + token : "keyword.operator", + regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" + }, { + token : "keyword", + regex : "^\\s*#(if|else|elif|endif|define|undef|warning|error|line|region|endregion|pragma)" + }, { + token : "punctuation.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 + regex : ".+" + } + ] + }; + + this.embedRules(DocCommentHighlightRules, "doc-", + [ DocCommentHighlightRules.getEndRule("start") ]); + this.normalizeRules(); +}; + +oop.inherits(CSharpHighlightRules, TextHighlightRules); + +exports.CSharpHighlightRules = CSharpHighlightRules; +}); diff --git a/addons/editor/ace/mode/css.js b/addons/editor/ace/mode/css.js new file mode 100755 index 00000000..9a4234c6 --- /dev/null +++ b/addons/editor/ace/mode/css.js @@ -0,0 +1,100 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextMode = require("./text").Mode; +var Tokenizer = require("../tokenizer").Tokenizer; +var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; +var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; +var WorkerClient = require("../worker/worker_client").WorkerClient; +var CssBehaviour = require("./behaviour/css").CssBehaviour; +var CStyleFoldMode = require("./folding/cstyle").FoldMode; + +var Mode = function() { + this.HighlightRules = CssHighlightRules; + this.$outdent = new MatchingBraceOutdent(); + this.$behaviour = new CssBehaviour(); + this.foldingRules = new CStyleFoldMode(); +}; +oop.inherits(Mode, TextMode); + +(function() { + + this.foldingRules = "cStyle"; + this.blockComment = {start: "/*", end: "*/"}; + + this.getNextLineIndent = function(state, line, tab) { + var indent = this.$getIndent(line); + + // ignore braces in comments + var tokens = this.getTokenizer().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); + }; + + this.createWorker = function(session) { + var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker"); + worker.attachToDocument(session.getDocument()); + + worker.on("csslint", function(e) { + session.setAnnotations(e.data); + }); + + worker.on("terminate", function() { + session.clearAnnotations(); + }); + + return worker; + }; + +}).call(Mode.prototype); + +exports.Mode = Mode; + +}); diff --git a/addons/editor/ace/worker-css.js b/addons/editor/ace/mode/css/csslint.js old mode 100644 new mode 100755 similarity index 71% rename from addons/editor/ace/worker-css.js rename to addons/editor/ace/mode/css/csslint.js index 1a4bfcb5..9f4c3bc8 --- a/addons/editor/ace/worker-css.js +++ b/addons/editor/ace/mode/css/csslint.js @@ -1,2065 +1,100 @@ -"no use strict"; -;(function(window) { -if (typeof window.window != "undefined" && window.document) { - return; -} - -window.console = function() { - var msgs = Array.prototype.slice.call(arguments, 0); - postMessage({type: "log", data: msgs}); -}; -window.console.error = -window.console.warn = -window.console.log = -window.console.trace = window.console; - -window.window = window; -window.ace = window; - -window.normalizeModule = function(parentId, moduleName) { - if (moduleName.indexOf("!") !== -1) { - var chunks = moduleName.split("!"); - return window.normalizeModule(parentId, chunks[0]) + "!" + window.normalizeModule(parentId, chunks[1]); - } - if (moduleName.charAt(0) == ".") { - var base = parentId.split("/").slice(0, -1).join("/"); - moduleName = (base ? base + "/" : "") + moduleName; - - while(moduleName.indexOf(".") !== -1 && previous != moduleName) { - var previous = moduleName; - moduleName = moduleName.replace(/^\.\//, "").replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, ""); - } - } - - return moduleName; -}; - -window.require = function(parentId, id) { - if (!id) { - id = parentId - parentId = null; - } - if (!id.charAt) - throw new Error("worker.js require() accepts only (parentId, id) as arguments"); - - id = window.normalizeModule(parentId, id); - - var module = window.require.modules[id]; - if (module) { - if (!module.initialized) { - module.initialized = true; - module.exports = module.factory().exports; - } - return module.exports; - } - - var chunks = id.split("/"); - if (!window.require.tlns) - return console.log("unable to load " + id); - chunks[0] = window.require.tlns[chunks[0]] || chunks[0]; - var path = chunks.join("/") + ".js"; - - window.require.id = id; - importScripts(path); - return window.require(parentId, id); -}; -window.require.modules = {}; -window.require.tlns = {}; - -window.define = function(id, deps, factory) { - if (arguments.length == 2) { - factory = deps; - if (typeof id != "string") { - deps = id; - id = window.require.id; - } - } else if (arguments.length == 1) { - factory = id; - deps = [] - id = window.require.id; - } - - if (!deps.length) - deps = ['require', 'exports', 'module'] - - if (id.indexOf("text!") === 0) - return; - - var req = function(childId) { - return window.require(id, childId); - }; - - window.require.modules[id] = { - exports: {}, - factory: function() { - var module = this; - var returnExports = factory.apply(this, deps.map(function(dep) { - switch(dep) { - case 'require': return req - case 'exports': return module.exports - case 'module': return module - default: return req(dep) - } - })); - if (returnExports) - module.exports = returnExports; - return module; - } - }; -}; -window.define.amd = {} - -window.initBaseUrls = function initBaseUrls(topLevelNamespaces) { - require.tlns = topLevelNamespaces; -} - -window.initSender = function initSender() { - - var EventEmitter = window.require("ace/lib/event_emitter").EventEmitter; - var oop = window.require("ace/lib/oop"); - - var Sender = function() {}; - - (function() { - - oop.implement(this, EventEmitter); - - this.callback = function(data, callbackId) { - postMessage({ - type: "call", - id: callbackId, - data: data - }); - }; - - this.emit = function(name, data) { - postMessage({ - type: "event", - name: name, - data: data - }); - }; - - }).call(Sender.prototype); - - return new Sender(); -} - -window.main = null; -window.sender = null; - -window.onmessage = function(e) { - var msg = e.data; - if (msg.command) { - if (main[msg.command]) - main[msg.command].apply(main, msg.args); - else - throw new Error("Unknown command:" + msg.command); - } - else if (msg.init) { - initBaseUrls(msg.tlns); - require("ace/lib/es5-shim"); - sender = initSender(); - var clazz = require(msg.module)[msg.classname]; - main = new clazz(sender); - } - else if (msg.event && sender) { - sender._emit(msg.event, msg.data); - } -}; -})(this);// https://github.com/kriskowal/es5-shim - -define('ace/lib/es5-shim', ['require', 'exports', 'module' ], function(require, exports, module) { - -function Empty() {} - -if (!Function.prototype.bind) { - Function.prototype.bind = function bind(that) { // .length is 1 - var target = this; - if (typeof target != "function") { - throw new TypeError("Function.prototype.bind called on incompatible " + target); - } - var args = slice.call(arguments, 1); // for normal call - var bound = function () { - - if (this instanceof bound) { - - var result = target.apply( - this, - args.concat(slice.call(arguments)) - ); - if (Object(result) === result) { - return result; - } - return this; - - } else { - return target.apply( - that, - args.concat(slice.call(arguments)) - ); - - } - - }; - if(target.prototype) { - Empty.prototype = target.prototype; - bound.prototype = new Empty(); - Empty.prototype = null; - } - return bound; - }; -} -var call = Function.prototype.call; -var prototypeOfArray = Array.prototype; -var prototypeOfObject = Object.prototype; -var slice = prototypeOfArray.slice; -var _toString = call.bind(prototypeOfObject.toString); -var owns = call.bind(prototypeOfObject.hasOwnProperty); -var defineGetter; -var defineSetter; -var lookupGetter; -var lookupSetter; -var supportsAccessors; -if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) { - defineGetter = call.bind(prototypeOfObject.__defineGetter__); - defineSetter = call.bind(prototypeOfObject.__defineSetter__); - lookupGetter = call.bind(prototypeOfObject.__lookupGetter__); - lookupSetter = call.bind(prototypeOfObject.__lookupSetter__); -} -if ([1,2].splice(0).length != 2) { - if(function() { // test IE < 9 to splice bug - see issue #138 - function makeArray(l) { - var a = new Array(l+2); - a[0] = a[1] = 0; - return a; - } - var array = [], lengthBefore; - - array.splice.apply(array, makeArray(20)); - array.splice.apply(array, makeArray(26)); - - lengthBefore = array.length; //46 - array.splice(5, 0, "XXX"); // add one element - - lengthBefore + 1 == array.length - - if (lengthBefore + 1 == array.length) { - return true;// has right splice implementation without bugs - } - }()) {//IE 6/7 - var array_splice = Array.prototype.splice; - Array.prototype.splice = function(start, deleteCount) { - if (!arguments.length) { - return []; - } else { - return array_splice.apply(this, [ - start === void 0 ? 0 : start, - deleteCount === void 0 ? (this.length - start) : deleteCount - ].concat(slice.call(arguments, 2))) - } - }; - } else {//IE8 - Array.prototype.splice = function(pos, removeCount){ - var length = this.length; - if (pos > 0) { - if (pos > length) - pos = length; - } else if (pos == void 0) { - pos = 0; - } else if (pos < 0) { - pos = Math.max(length + pos, 0); - } - - if (!(pos+removeCount < length)) - removeCount = length - pos; - - var removed = this.slice(pos, pos+removeCount); - var insert = slice.call(arguments, 2); - var add = insert.length; - if (pos === length) { - if (add) { - this.push.apply(this, insert); - } - } else { - var remove = Math.min(removeCount, length - pos); - var tailOldPos = pos + remove; - var tailNewPos = tailOldPos + add - remove; - var tailCount = length - tailOldPos; - var lengthAfterRemove = length - remove; - - if (tailNewPos < tailOldPos) { // case A - for (var i = 0; i < tailCount; ++i) { - this[tailNewPos+i] = this[tailOldPos+i]; - } - } else if (tailNewPos > tailOldPos) { // case B - for (i = tailCount; i--; ) { - this[tailNewPos+i] = this[tailOldPos+i]; - } - } // else, add == remove (nothing to do) - - if (add && pos === lengthAfterRemove) { - this.length = lengthAfterRemove; // truncate array - this.push.apply(this, insert); - } else { - this.length = lengthAfterRemove + add; // reserves space - for (i = 0; i < add; ++i) { - this[pos+i] = insert[i]; - } - } - } - return removed; - }; - } -} -if (!Array.isArray) { - Array.isArray = function isArray(obj) { - return _toString(obj) == "[object Array]"; - }; -} -var boxedString = Object("a"), - splitString = boxedString[0] != "a" || !(0 in boxedString); - -if (!Array.prototype.forEach) { - Array.prototype.forEach = function forEach(fun /*, thisp*/) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - thisp = arguments[1], - i = -1, - length = self.length >>> 0; - if (_toString(fun) != "[object Function]") { - throw new TypeError(); // TODO message - } - - while (++i < length) { - if (i in self) { - fun.call(thisp, self[i], i, object); - } - } - }; -} -if (!Array.prototype.map) { - Array.prototype.map = function map(fun /*, thisp*/) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0, - result = Array(length), - thisp = arguments[1]; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - - for (var i = 0; i < length; i++) { - if (i in self) - result[i] = fun.call(thisp, self[i], i, object); - } - return result; - }; -} -if (!Array.prototype.filter) { - Array.prototype.filter = function filter(fun /*, thisp */) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0, - result = [], - value, - thisp = arguments[1]; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - - for (var i = 0; i < length; i++) { - if (i in self) { - value = self[i]; - if (fun.call(thisp, value, i, object)) { - result.push(value); - } - } - } - return result; - }; -} -if (!Array.prototype.every) { - Array.prototype.every = function every(fun /*, thisp */) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0, - thisp = arguments[1]; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - - for (var i = 0; i < length; i++) { - if (i in self && !fun.call(thisp, self[i], i, object)) { - return false; - } - } - return true; - }; -} -if (!Array.prototype.some) { - Array.prototype.some = function some(fun /*, thisp */) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0, - thisp = arguments[1]; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - - for (var i = 0; i < length; i++) { - if (i in self && fun.call(thisp, self[i], i, object)) { - return true; - } - } - return false; - }; -} -if (!Array.prototype.reduce) { - Array.prototype.reduce = function reduce(fun /*, initial*/) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - if (!length && arguments.length == 1) { - throw new TypeError("reduce of empty array with no initial value"); - } - - var i = 0; - var result; - if (arguments.length >= 2) { - result = arguments[1]; - } else { - do { - if (i in self) { - result = self[i++]; - break; - } - if (++i >= length) { - throw new TypeError("reduce of empty array with no initial value"); - } - } while (true); - } - - for (; i < length; i++) { - if (i in self) { - result = fun.call(void 0, result, self[i], i, object); - } - } - - return result; - }; -} -if (!Array.prototype.reduceRight) { - Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - if (!length && arguments.length == 1) { - throw new TypeError("reduceRight of empty array with no initial value"); - } - - var result, i = length - 1; - if (arguments.length >= 2) { - result = arguments[1]; - } else { - do { - if (i in self) { - result = self[i--]; - break; - } - if (--i < 0) { - throw new TypeError("reduceRight of empty array with no initial value"); - } - } while (true); - } - - do { - if (i in this) { - result = fun.call(void 0, result, self[i], i, object); - } - } while (i--); - - return result; - }; -} -if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) { - Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) { - var self = splitString && _toString(this) == "[object String]" ? - this.split("") : - toObject(this), - length = self.length >>> 0; - - if (!length) { - return -1; - } - - var i = 0; - if (arguments.length > 1) { - i = toInteger(arguments[1]); - } - i = i >= 0 ? i : Math.max(0, length + i); - for (; i < length; i++) { - if (i in self && self[i] === sought) { - return i; - } - } - return -1; - }; -} -if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) { - Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) { - var self = splitString && _toString(this) == "[object String]" ? - this.split("") : - toObject(this), - length = self.length >>> 0; - - if (!length) { - return -1; - } - var i = length - 1; - if (arguments.length > 1) { - i = Math.min(i, toInteger(arguments[1])); - } - i = i >= 0 ? i : length - Math.abs(i); - for (; i >= 0; i--) { - if (i in self && sought === self[i]) { - return i; - } - } - return -1; - }; -} -if (!Object.getPrototypeOf) { - Object.getPrototypeOf = function getPrototypeOf(object) { - return object.__proto__ || ( - object.constructor ? - object.constructor.prototype : - prototypeOfObject - ); - }; -} -if (!Object.getOwnPropertyDescriptor) { - var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " + - "non-object: "; - Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) { - if ((typeof object != "object" && typeof object != "function") || object === null) - throw new TypeError(ERR_NON_OBJECT + object); - if (!owns(object, property)) - return; - - var descriptor, getter, setter; - descriptor = { enumerable: true, configurable: true }; - if (supportsAccessors) { - var prototype = object.__proto__; - object.__proto__ = prototypeOfObject; - - var getter = lookupGetter(object, property); - var setter = lookupSetter(object, property); - object.__proto__ = prototype; - - if (getter || setter) { - if (getter) descriptor.get = getter; - if (setter) descriptor.set = setter; - return descriptor; - } - } - descriptor.value = object[property]; - return descriptor; - }; -} -if (!Object.getOwnPropertyNames) { - Object.getOwnPropertyNames = function getOwnPropertyNames(object) { - return Object.keys(object); - }; -} -if (!Object.create) { - var createEmpty; - if (Object.prototype.__proto__ === null) { - createEmpty = function () { - return { "__proto__": null }; - }; - } else { - createEmpty = function () { - var empty = {}; - for (var i in empty) - empty[i] = null; - empty.constructor = - empty.hasOwnProperty = - empty.propertyIsEnumerable = - empty.isPrototypeOf = - empty.toLocaleString = - empty.toString = - empty.valueOf = - empty.__proto__ = null; - return empty; - } - } - - Object.create = function create(prototype, properties) { - var object; - if (prototype === null) { - object = createEmpty(); - } else { - if (typeof prototype != "object") - throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'"); - var Type = function () {}; - Type.prototype = prototype; - object = new Type(); - object.__proto__ = prototype; - } - if (properties !== void 0) - Object.defineProperties(object, properties); - return object; - }; -} - -function doesDefinePropertyWork(object) { - try { - Object.defineProperty(object, "sentinel", {}); - return "sentinel" in object; - } catch (exception) { - } -} -if (Object.defineProperty) { - var definePropertyWorksOnObject = doesDefinePropertyWork({}); - var definePropertyWorksOnDom = typeof document == "undefined" || - doesDefinePropertyWork(document.createElement("div")); - if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) { - var definePropertyFallback = Object.defineProperty; - } -} - -if (!Object.defineProperty || definePropertyFallback) { - var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: "; - var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: " - var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " + - "on this javascript engine"; - - Object.defineProperty = function defineProperty(object, property, descriptor) { - if ((typeof object != "object" && typeof object != "function") || object === null) - throw new TypeError(ERR_NON_OBJECT_TARGET + object); - if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null) - throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor); - if (definePropertyFallback) { - try { - return definePropertyFallback.call(Object, object, property, descriptor); - } catch (exception) { - } - } - if (owns(descriptor, "value")) { - - if (supportsAccessors && (lookupGetter(object, property) || - lookupSetter(object, property))) - { - var prototype = object.__proto__; - object.__proto__ = prototypeOfObject; - delete object[property]; - object[property] = descriptor.value; - object.__proto__ = prototype; - } else { - object[property] = descriptor.value; - } - } else { - if (!supportsAccessors) - throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED); - if (owns(descriptor, "get")) - defineGetter(object, property, descriptor.get); - if (owns(descriptor, "set")) - defineSetter(object, property, descriptor.set); - } - - return object; - }; -} -if (!Object.defineProperties) { - Object.defineProperties = function defineProperties(object, properties) { - for (var property in properties) { - if (owns(properties, property)) - Object.defineProperty(object, property, properties[property]); - } - return object; - }; -} -if (!Object.seal) { - Object.seal = function seal(object) { - return object; - }; -} -if (!Object.freeze) { - Object.freeze = function freeze(object) { - return object; - }; -} -try { - Object.freeze(function () {}); -} catch (exception) { - Object.freeze = (function freeze(freezeObject) { - return function freeze(object) { - if (typeof object == "function") { - return object; - } else { - return freezeObject(object); - } - }; - })(Object.freeze); -} -if (!Object.preventExtensions) { - Object.preventExtensions = function preventExtensions(object) { - return object; - }; -} -if (!Object.isSealed) { - Object.isSealed = function isSealed(object) { - return false; - }; -} -if (!Object.isFrozen) { - Object.isFrozen = function isFrozen(object) { - return false; - }; -} -if (!Object.isExtensible) { - Object.isExtensible = function isExtensible(object) { - if (Object(object) === object) { - throw new TypeError(); // TODO message - } - var name = ''; - while (owns(object, name)) { - name += '?'; - } - object[name] = true; - var returnValue = owns(object, name); - delete object[name]; - return returnValue; - }; -} -if (!Object.keys) { - var hasDontEnumBug = true, - dontEnums = [ - "toString", - "toLocaleString", - "valueOf", - "hasOwnProperty", - "isPrototypeOf", - "propertyIsEnumerable", - "constructor" - ], - dontEnumsLength = dontEnums.length; - - for (var key in {"toString": null}) { - hasDontEnumBug = false; - } - - Object.keys = function keys(object) { - - if ( - (typeof object != "object" && typeof object != "function") || - object === null - ) { - throw new TypeError("Object.keys called on a non-object"); - } - - var keys = []; - for (var name in object) { - if (owns(object, name)) { - keys.push(name); - } - } - - if (hasDontEnumBug) { - for (var i = 0, ii = dontEnumsLength; i < ii; i++) { - var dontEnum = dontEnums[i]; - if (owns(object, dontEnum)) { - keys.push(dontEnum); - } - } - } - return keys; - }; - -} -if (!Date.now) { - Date.now = function now() { - return new Date().getTime(); - }; -} -var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" + - "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" + - "\u2029\uFEFF"; -if (!String.prototype.trim || ws.trim()) { - ws = "[" + ws + "]"; - var trimBeginRegexp = new RegExp("^" + ws + ws + "*"), - trimEndRegexp = new RegExp(ws + ws + "*$"); - String.prototype.trim = function trim() { - return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, ""); - }; -} - -function toInteger(n) { - n = +n; - if (n !== n) { // isNaN - n = 0; - } else if (n !== 0 && n !== (1/0) && n !== -(1/0)) { - n = (n > 0 || -1) * Math.floor(Math.abs(n)); - } - return n; -} - -function isPrimitive(input) { - var type = typeof input; - return ( - input === null || - type === "undefined" || - type === "boolean" || - type === "number" || - type === "string" - ); -} - -function toPrimitive(input) { - var val, valueOf, toString; - if (isPrimitive(input)) { - return input; - } - valueOf = input.valueOf; - if (typeof valueOf === "function") { - val = valueOf.call(input); - if (isPrimitive(val)) { - return val; - } - } - toString = input.toString; - if (typeof toString === "function") { - val = toString.call(input); - if (isPrimitive(val)) { - return val; - } - } - throw new TypeError(); -} -var toObject = function (o) { - if (o == null) { // this matches both null and undefined - throw new TypeError("can't convert "+o+" to object"); - } - return Object(o); -}; - -}); - -define('ace/mode/css_worker', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/worker/mirror', 'ace/mode/css/csslint'], function(require, exports, module) { - - -var oop = require("../lib/oop"); -var lang = require("../lib/lang"); -var Mirror = require("../worker/mirror").Mirror; -var CSSLint = require("./css/csslint").CSSLint; - -var Worker = exports.Worker = function(sender) { - Mirror.call(this, sender); - this.setTimeout(400); - this.ruleset = null; - this.setDisabledRules("ids"); - this.setInfoRules("adjoining-classes|qualified-headings|zero-units|gradients|import|outline-none"); -}; - -oop.inherits(Worker, Mirror); - -(function() { - this.setInfoRules = function(ruleNames) { - if (typeof ruleNames == "string") - ruleNames = ruleNames.split("|"); - this.infoRules = lang.arrayToMap(ruleNames); - this.doc.getValue() && this.deferredUpdate.schedule(100); - }; - - this.setDisabledRules = function(ruleNames) { - if (!ruleNames) { - this.ruleset = null; - } else { - if (typeof ruleNames == "string") - ruleNames = ruleNames.split("|"); - var all = {}; - - CSSLint.getRules().forEach(function(x){ - all[x.id] = true; - }); - ruleNames.forEach(function(x) { - delete all[x]; - }); - - this.ruleset = all; - } - this.doc.getValue() && this.deferredUpdate.schedule(100); - }; - - this.onUpdate = function() { - var value = this.doc.getValue(); - var infoRules = this.infoRules; - - var result = CSSLint.verify(value, this.ruleset); - this.sender.emit("csslint", result.messages.map(function(msg) { - return { - row: msg.line - 1, - column: msg.col - 1, - text: msg.message, - type: infoRules[msg.rule.id] ? "info" : msg.type, - rule: msg.rule.name - } - })); - }; - -}).call(Worker.prototype); - -}); - -define('ace/lib/oop', ['require', 'exports', 'module' ], function(require, exports, module) { - - -exports.inherits = (function() { - var tempCtor = function() {}; - return function(ctor, superCtor) { - tempCtor.prototype = superCtor.prototype; - ctor.super_ = superCtor.prototype; - ctor.prototype = new tempCtor(); - ctor.prototype.constructor = ctor; - }; -}()); - -exports.mixin = function(obj, mixin) { - for (var key in mixin) { - obj[key] = mixin[key]; - } - return obj; -}; - -exports.implement = function(proto, mixin) { - exports.mixin(proto, mixin); -}; - -}); - -define('ace/lib/lang', ['require', 'exports', 'module' ], function(require, exports, module) { - - -exports.stringReverse = function(string) { - return string.split("").reverse().join(""); -}; - -exports.stringRepeat = function (string, count) { - var result = ''; - while (count > 0) { - if (count & 1) - result += string; - - if (count >>= 1) - string += string; - } - return result; -}; - -var trimBeginRegexp = /^\s\s*/; -var trimEndRegexp = /\s\s*$/; - -exports.stringTrimLeft = function (string) { - return string.replace(trimBeginRegexp, ''); -}; - -exports.stringTrimRight = function (string) { - return string.replace(trimEndRegexp, ''); -}; - -exports.copyObject = function(obj) { - var copy = {}; - for (var key in obj) { - copy[key] = obj[key]; - } - return copy; -}; - -exports.copyArray = function(array){ - var copy = []; - for (var i=0, l=array.length; i= length) { - position.row = Math.max(0, length - 1); - position.column = this.getLine(length-1).length; - } else if (position.row < 0) - position.row = 0; - return position; - }; - this.insert = function(position, text) { - if (!text || text.length === 0) - return position; - - position = this.$clipPosition(position); - if (this.getLength() <= 1) - this.$detectNewLine(text); - - var lines = this.$split(text); - var firstLine = lines.splice(0, 1)[0]; - var lastLine = lines.length == 0 ? null : lines.splice(lines.length - 1, 1)[0]; - - position = this.insertInLine(position, firstLine); - if (lastLine !== null) { - position = this.insertNewLine(position); // terminate first line - position = this._insertLines(position.row, lines); - position = this.insertInLine(position, lastLine || ""); - } - return position; - }; - this.insertLines = function(row, lines) { - if (row >= this.getLength()) - return this.insert({row: row, column: 0}, "\n" + lines.join("\n")); - return this._insertLines(Math.max(row, 0), lines); - }; - this._insertLines = function(row, lines) { - if (lines.length == 0) - return {row: row, column: 0}; - if (lines.length > 0xFFFF) { - var end = this._insertLines(row, lines.slice(0xFFFF)); - lines = lines.slice(0, 0xFFFF); - } - - var args = [row, 0]; - args.push.apply(args, lines); - this.$lines.splice.apply(this.$lines, args); - - var range = new Range(row, 0, row + lines.length, 0); - var delta = { - action: "insertLines", - range: range, - lines: lines - }; - this._emit("change", { data: delta }); - return end || range.end; - }; - this.insertNewLine = function(position) { - position = this.$clipPosition(position); - var line = this.$lines[position.row] || ""; - - this.$lines[position.row] = line.substring(0, position.column); - this.$lines.splice(position.row + 1, 0, line.substring(position.column, line.length)); - - var end = { - row : position.row + 1, - column : 0 - }; - - var delta = { - action: "insertText", - range: Range.fromPoints(position, end), - text: this.getNewLineCharacter() - }; - this._emit("change", { data: delta }); - - return end; - }; - this.insertInLine = function(position, text) { - if (text.length == 0) - return position; - - var line = this.$lines[position.row] || ""; - - this.$lines[position.row] = line.substring(0, position.column) + text - + line.substring(position.column); - - var end = { - row : position.row, - column : position.column + text.length - }; - - var delta = { - action: "insertText", - range: Range.fromPoints(position, end), - text: text - }; - this._emit("change", { data: delta }); - - return end; - }; - this.remove = function(range) { - if (!range instanceof Range) - range = Range.fromPoints(range.start, range.end); - range.start = this.$clipPosition(range.start); - range.end = this.$clipPosition(range.end); - - if (range.isEmpty()) - return range.start; - - var firstRow = range.start.row; - var lastRow = range.end.row; - - if (range.isMultiLine()) { - var firstFullRow = range.start.column == 0 ? firstRow : firstRow + 1; - var lastFullRow = lastRow - 1; - - if (range.end.column > 0) - this.removeInLine(lastRow, 0, range.end.column); - - if (lastFullRow >= firstFullRow) - this._removeLines(firstFullRow, lastFullRow); - - if (firstFullRow != firstRow) { - this.removeInLine(firstRow, range.start.column, this.getLine(firstRow).length); - this.removeNewLine(range.start.row); - } - } - else { - this.removeInLine(firstRow, range.start.column, range.end.column); - } - return range.start; - }; - this.removeInLine = function(row, startColumn, endColumn) { - if (startColumn == endColumn) - return; - - var range = new Range(row, startColumn, row, endColumn); - var line = this.getLine(row); - var removed = line.substring(startColumn, endColumn); - var newLine = line.substring(0, startColumn) + line.substring(endColumn, line.length); - this.$lines.splice(row, 1, newLine); - - var delta = { - action: "removeText", - range: range, - text: removed - }; - this._emit("change", { data: delta }); - return range.start; - }; - this.removeLines = function(firstRow, lastRow) { - if (firstRow < 0 || lastRow >= this.getLength()) - return this.remove(new Range(firstRow, 0, lastRow + 1, 0)); - return this._removeLines(firstRow, lastRow); - }; - - this._removeLines = function(firstRow, lastRow) { - var range = new Range(firstRow, 0, lastRow + 1, 0); - var removed = this.$lines.splice(firstRow, lastRow - firstRow + 1); - - var delta = { - action: "removeLines", - range: range, - nl: this.getNewLineCharacter(), - lines: removed - }; - this._emit("change", { data: delta }); - return removed; - }; - this.removeNewLine = function(row) { - var firstLine = this.getLine(row); - var secondLine = this.getLine(row+1); - - var range = new Range(row, firstLine.length, row+1, 0); - var line = firstLine + secondLine; - - this.$lines.splice(row, 2, line); - - var delta = { - action: "removeText", - range: range, - text: this.getNewLineCharacter() - }; - this._emit("change", { data: delta }); - }; - this.replace = function(range, text) { - if (!range instanceof Range) - range = Range.fromPoints(range.start, range.end); - if (text.length == 0 && range.isEmpty()) - return range.start; - if (text == this.getTextRange(range)) - return range.end; - - this.remove(range); - if (text) { - var end = this.insert(range.start, text); - } - else { - end = range.start; - } - - return end; - }; - this.applyDeltas = function(deltas) { - for (var i=0; i=0; i--) { - var delta = deltas[i]; - - var range = Range.fromPoints(delta.range.start, delta.range.end); - - if (delta.action == "insertLines") - this._removeLines(range.start.row, range.end.row - 1); - else if (delta.action == "insertText") - this.remove(range); - else if (delta.action == "removeLines") - this._insertLines(range.start.row, delta.lines); - else if (delta.action == "removeText") - this.insert(range.start, delta.text); - } - }; - this.indexToPosition = function(index, startRow) { - var lines = this.$lines || this.getAllLines(); - var newlineLength = this.getNewLineCharacter().length; - for (var i = startRow || 0, l = lines.length; i < l; i++) { - index -= lines[i].length + newlineLength; - if (index < 0) - return {row: i, column: index + lines[i].length + newlineLength}; - } - return {row: l-1, column: lines[l-1].length}; - }; - this.positionToIndex = function(pos, startRow) { - var lines = this.$lines || this.getAllLines(); - var newlineLength = this.getNewLineCharacter().length; - var index = 0; - var row = Math.min(pos.row, lines.length); - for (var i = startRow || 0; i < row; ++i) - index += lines[i].length + newlineLength; - - return index + pos.column; - }; - -}).call(Document.prototype); - -exports.Document = Document; -}); - -define('ace/lib/event_emitter', ['require', 'exports', 'module' ], function(require, exports, module) { - - -var EventEmitter = {}; -var stopPropagation = function() { this.propagationStopped = true; }; -var preventDefault = function() { this.defaultPrevented = true; }; - -EventEmitter._emit = -EventEmitter._dispatchEvent = function(eventName, e) { - this._eventRegistry || (this._eventRegistry = {}); - this._defaultHandlers || (this._defaultHandlers = {}); - - var listeners = this._eventRegistry[eventName] || []; - var defaultHandler = this._defaultHandlers[eventName]; - if (!listeners.length && !defaultHandler) - return; - - if (typeof e != "object" || !e) - e = {}; - - if (!e.type) - e.type = eventName; - if (!e.stopPropagation) - e.stopPropagation = stopPropagation; - if (!e.preventDefault) - e.preventDefault = preventDefault; - - listeners = listeners.slice(); - for (var i=0; i [" + this.end.row + "/" + this.end.column + "]"); - }; - - this.contains = function(row, column) { - return this.compare(row, column) == 0; - }; - this.compareRange = function(range) { - var cmp, - end = range.end, - start = range.start; - - cmp = this.compare(end.row, end.column); - if (cmp == 1) { - cmp = this.compare(start.row, start.column); - if (cmp == 1) { - return 2; - } else if (cmp == 0) { - return 1; - } else { - return 0; - } - } else if (cmp == -1) { - return -2; - } else { - cmp = this.compare(start.row, start.column); - if (cmp == -1) { - return -1; - } else if (cmp == 1) { - return 42; - } else { - return 0; - } - } - }; - this.comparePoint = function(p) { - return this.compare(p.row, p.column); - }; - this.containsRange = function(range) { - return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0; - }; - this.intersects = function(range) { - var cmp = this.compareRange(range); - return (cmp == -1 || cmp == 0 || cmp == 1); - }; - this.isEnd = function(row, column) { - return this.end.row == row && this.end.column == column; - }; - this.isStart = function(row, column) { - return this.start.row == row && this.start.column == column; - }; - this.setStart = function(row, column) { - if (typeof row == "object") { - this.start.column = row.column; - this.start.row = row.row; - } else { - this.start.row = row; - this.start.column = column; - } - }; - this.setEnd = function(row, column) { - if (typeof row == "object") { - this.end.column = row.column; - this.end.row = row.row; - } else { - this.end.row = row; - this.end.column = column; - } - }; - this.inside = function(row, column) { - if (this.compare(row, column) == 0) { - if (this.isEnd(row, column) || this.isStart(row, column)) { - return false; - } else { - return true; - } - } - return false; - }; - this.insideStart = function(row, column) { - if (this.compare(row, column) == 0) { - if (this.isEnd(row, column)) { - return false; - } else { - return true; - } - } - return false; - }; - this.insideEnd = function(row, column) { - if (this.compare(row, column) == 0) { - if (this.isStart(row, column)) { - return false; - } else { - return true; - } - } - return false; - }; - this.compare = function(row, column) { - if (!this.isMultiLine()) { - if (row === this.start.row) { - return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0); - }; - } - - if (row < this.start.row) - return -1; - - if (row > this.end.row) - return 1; - - if (this.start.row === row) - return column >= this.start.column ? 0 : -1; - - if (this.end.row === row) - return column <= this.end.column ? 0 : 1; - - return 0; - }; - this.compareStart = function(row, column) { - if (this.start.row == row && this.start.column == column) { - return -1; - } else { - return this.compare(row, column); - } - }; - this.compareEnd = function(row, column) { - if (this.end.row == row && this.end.column == column) { - return 1; - } else { - return this.compare(row, column); - } - }; - this.compareInside = function(row, column) { - if (this.end.row == row && this.end.column == column) { - return 1; - } else if (this.start.row == row && this.start.column == column) { - return -1; - } else { - return this.compare(row, column); - } - }; - this.clipRows = function(firstRow, lastRow) { - if (this.end.row > lastRow) - var end = {row: lastRow + 1, column: 0}; - else if (this.end.row < firstRow) - var end = {row: firstRow, column: 0}; - - if (this.start.row > lastRow) - var start = {row: lastRow + 1, column: 0}; - else if (this.start.row < firstRow) - var start = {row: firstRow, column: 0}; - - return Range.fromPoints(start || this.start, end || this.end); - }; - this.extend = function(row, column) { - var cmp = this.compare(row, column); - - if (cmp == 0) - return this; - else if (cmp == -1) - var start = {row: row, column: column}; - else - var end = {row: row, column: column}; - - return Range.fromPoints(start || this.start, end || this.end); - }; - - this.isEmpty = function() { - return (this.start.row === this.end.row && this.start.column === this.end.column); - }; - this.isMultiLine = function() { - return (this.start.row !== this.end.row); - }; - this.clone = function() { - return Range.fromPoints(this.start, this.end); - }; - this.collapseRows = function() { - if (this.end.column == 0) - return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0) - else - return new Range(this.start.row, 0, this.end.row, 0) - }; - this.toScreenRange = function(session) { - var screenPosStart = session.documentToScreenPosition(this.start); - var screenPosEnd = session.documentToScreenPosition(this.end); - - return new Range( - screenPosStart.row, screenPosStart.column, - screenPosEnd.row, screenPosEnd.column - ); - }; - this.moveBy = function(row, column) { - this.start.row += row; - this.start.column += column; - this.end.row += row; - this.end.column += column; - }; - -}).call(Range.prototype); -Range.fromPoints = function(start, end) { - return new Range(start.row, start.column, end.row, end.column); -}; -Range.comparePoints = comparePoints; - -Range.comparePoints = function(p1, p2) { - return p1.row - p2.row || p1.column - p2.column; -}; - - -exports.Range = Range; -}); - -define('ace/anchor', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event_emitter'], function(require, exports, module) { - - -var oop = require("./lib/oop"); -var EventEmitter = require("./lib/event_emitter").EventEmitter; - -var Anchor = exports.Anchor = function(doc, row, column) { - this.$onChange = this.onChange.bind(this); - this.attach(doc); - - if (typeof column == "undefined") - this.setPosition(row.row, row.column); - else - this.setPosition(row, column); -}; - -(function() { - - oop.implement(this, EventEmitter); - this.getPosition = function() { - return this.$clipPositionToDocument(this.row, this.column); - }; - this.getDocument = function() { - return this.document; - }; - this.$insertRight = false; - this.onChange = function(e) { - var delta = e.data; - var range = delta.range; - - if (range.start.row == range.end.row && range.start.row != this.row) - return; - - if (range.start.row > this.row) - return; - - if (range.start.row == this.row && range.start.column > this.column) - return; - - var row = this.row; - var column = this.column; - var start = range.start; - var end = range.end; - - if (delta.action === "insertText") { - if (start.row === row && start.column <= column) { - if (start.column === column && this.$insertRight) { - } else if (start.row === end.row) { - column += end.column - start.column; - } else { - column -= start.column; - row += end.row - start.row; - } - } else if (start.row !== end.row && start.row < row) { - row += end.row - start.row; - } - } else if (delta.action === "insertLines") { - if (start.row <= row) { - row += end.row - start.row; - } - } else if (delta.action === "removeText") { - if (start.row === row && start.column < column) { - if (end.column >= column) - column = start.column; - else - column = Math.max(0, column - (end.column - start.column)); - - } else if (start.row !== end.row && start.row < row) { - if (end.row === row) - column = Math.max(0, column - end.column) + start.column; - row -= (end.row - start.row); - } else if (end.row === row) { - row -= end.row - start.row; - column = Math.max(0, column - end.column) + start.column; - } - } else if (delta.action == "removeLines") { - if (start.row <= row) { - if (end.row <= row) - row -= end.row - start.row; - else { - row = start.row; - column = 0; - } - } - } - - this.setPosition(row, column, true); - }; - this.setPosition = function(row, column, noClip) { - var pos; - if (noClip) { - pos = { - row: row, - column: column - }; - } else { - pos = this.$clipPositionToDocument(row, column); - } - - if (this.row == pos.row && this.column == pos.column) - return; - - var old = { - row: this.row, - column: this.column - }; - - this.row = pos.row; - this.column = pos.column; - this._emit("change", { - old: old, - value: pos - }); - }; - this.detach = function() { - this.document.removeEventListener("change", this.$onChange); - }; - this.attach = function(doc) { - this.document = doc || this.document; - this.document.on("change", this.$onChange); - }; - this.$clipPositionToDocument = function(row, column) { - var pos = {}; - - if (row >= this.document.getLength()) { - pos.row = Math.max(0, this.document.getLength() - 1); - pos.column = this.document.getLine(pos.row).length; - } - else if (row < 0) { - pos.row = 0; - pos.column = 0; - } - else { - pos.row = row; - pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column)); - } - - if (column < 0) - pos.column = 0; - - return pos; - }; - -}).call(Anchor.prototype); - -}); -define('ace/mode/css/csslint', ['require', 'exports', 'module' ], function(require, exports, module) { +define(function(require, exports, module) { +/*! +CSSLint +Copyright (c) 2011 Nicole Sullivan and Nicholas C. Zakas. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +*/ +/* Build time: 17-January-2013 10:55:01 */ +/*! +Parser-Lib +Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +*/ +/* Version v0.2.2, Build time: 17-January-2013 10:26:34 */ var parserlib = {}; (function(){ + + +/** + * A generic base to inherit from for any object + * that needs event handling. + * @class EventTarget + * @constructor + */ function EventTarget(){ + + /** + * The array of listeners for various events. + * @type Object + * @property _listeners + * @private + */ this._listeners = {}; } EventTarget.prototype = { + + //restore constructor constructor: EventTarget, + + /** + * Adds a listener for a given event type. + * @param {String} type The type of event to add a listener for. + * @param {Function} listener The function to call when the event occurs. + * @return {void} + * @method addListener + */ addListener: function(type, listener){ if (!this._listeners[type]){ this._listeners[type] = []; } this._listeners[type].push(listener); - }, + }, + + /** + * Fires an event based on the passed-in object. + * @param {Object|String} event An object with at least a 'type' attribute + * or a string indicating the event name. + * @return {void} + * @method fire + */ fire: function(event){ if (typeof event == "string"){ event = { type: event }; @@ -2073,12 +108,22 @@ EventTarget.prototype = { } if (this._listeners[event.type]){ + + //create a copy of the array and use that so listeners can't chane var listeners = this._listeners[event.type].concat(); for (var i=0, len=listeners.length; i < len; i++){ listeners[i].call(this, event); } } }, + + /** + * Removes a listener for a given event type. + * @param {String} type The type of event to remove a listener from. + * @param {Function} listener The function to remove from the event. + * @return {void} + * @method removeListener + */ removeListener: function(type, listener){ if (this._listeners[type]){ var listeners = this._listeners[type]; @@ -2093,47 +138,147 @@ EventTarget.prototype = { } } }; +/** + * Convenient way to read through strings. + * @namespace parserlib.util + * @class StringReader + * @constructor + * @param {String} text The text to read. + */ function StringReader(text){ + + /** + * The input text with line endings normalized. + * @property _input + * @type String + * @private + */ this._input = text.replace(/\n\r?/g, "\n"); + + + /** + * The row for the character to be read next. + * @property _line + * @type int + * @private + */ this._line = 1; + + + /** + * The column for the character to be read next. + * @property _col + * @type int + * @private + */ this._col = 1; + + /** + * The index of the character in the input to be read next. + * @property _cursor + * @type int + * @private + */ this._cursor = 0; } StringReader.prototype = { + + //restore constructor constructor: StringReader, + + //------------------------------------------------------------------------- + // Position info + //------------------------------------------------------------------------- + + /** + * Returns the column of the character to be read next. + * @return {int} The column of the character to be read next. + * @method getCol + */ getCol: function(){ return this._col; }, + + /** + * Returns the row of the character to be read next. + * @return {int} The row of the character to be read next. + * @method getLine + */ getLine: function(){ return this._line ; }, + + /** + * Determines if you're at the end of the input. + * @return {Boolean} True if there's no more input, false otherwise. + * @method eof + */ eof: function(){ return (this._cursor == this._input.length); }, + + //------------------------------------------------------------------------- + // Basic reading + //------------------------------------------------------------------------- + + /** + * Reads the next character without advancing the cursor. + * @param {int} count How many characters to look ahead (default is 1). + * @return {String} The next character or null if there is no next character. + * @method peek + */ peek: function(count){ var c = null; count = (typeof count == "undefined" ? 1 : count); + + //if we're not at the end of the input... if (this._cursor < this._input.length){ + + //get character and increment cursor and column c = this._input.charAt(this._cursor + count - 1); } return c; }, + + /** + * Reads the next character from the input and adjusts the row and column + * accordingly. + * @return {String} The next character or null if there is no next character. + * @method read + */ read: function(){ var c = null; + + //if we're not at the end of the input... if (this._cursor < this._input.length){ + + //if the last character was a newline, increment row count + //and reset column count if (this._input.charAt(this._cursor) == "\n"){ this._line++; this._col=1; } else { this._col++; } + + //get character and increment cursor and column c = this._input.charAt(this._cursor++); } return c; }, + + //------------------------------------------------------------------------- + // Misc + //------------------------------------------------------------------------- + + /** + * Saves the current location so it can be returned to later. + * @method mark + * @return {void} + */ mark: function(){ this._bookmark = { cursor: this._cursor, @@ -2150,10 +295,29 @@ StringReader.prototype = { delete this._bookmark; } }, + + //------------------------------------------------------------------------- + // Advanced reading + //------------------------------------------------------------------------- + + /** + * Reads up to and including the given string. Throws an error if that + * string is not found. + * @param {String} pattern The string to read. + * @return {String} The string when it is found. + * @throws Error when the string pattern is not found. + * @method readTo + */ readTo: function(pattern){ var buffer = "", c; + + /* + * First, buffer must be the same length as the pattern. + * Then, buffer must end with the pattern or else reach the + * end of the input. + */ while (buffer.length < pattern.length || buffer.lastIndexOf(pattern) != buffer.length - pattern.length){ c = this.read(); if (c){ @@ -2166,6 +330,17 @@ StringReader.prototype = { return buffer; }, + + /** + * Reads characters while each character causes the given + * filter function to return true. The function is passed + * in each character and either returns true to continue + * reading or false to stop. + * @param {Function} filter The function to read on each character. + * @return {String} The string made up of all characters that passed the + * filter check. + * @method readWhile + */ readWhile: function(filter){ var buffer = "", @@ -2179,10 +354,25 @@ StringReader.prototype = { return buffer; }, + + /** + * Reads characters that match either text or a regular expression and + * returns those characters. If a match is found, the row and column + * are adjusted; if no match is found, the reader's state is unchanged. + * reading or false to stop. + * @param {String|RegExp} matchter If a string, then the literal string + * value is searched for. If a regular expression, then any string + * matching the pattern is search for. + * @return {String} The string made up of all characters that matched or + * null if there was no match. + * @method readMatch + */ readMatch: function(matcher){ var source = this._input.substring(this._cursor), value = null; + + //if it's a string, just do a straight match if (typeof matcher == "string"){ if (source.indexOf(matcher) === 0){ value = this.readCount(matcher.length); @@ -2195,6 +385,15 @@ StringReader.prototype = { return value; }, + + + /** + * Reads a given number of characters. If the end of the input is reached, + * it reads only the remaining characters and does not throw an error. + * @param {int} count The number of characters to read. + * @return {String} The string made up the read characters. + * @method readCount + */ readCount: function(count){ var buffer = ""; @@ -2206,42 +405,184 @@ StringReader.prototype = { } }; +/** + * Type to use when a syntax error occurs. + * @class SyntaxError + * @namespace parserlib.util + * @constructor + * @param {String} message The error message. + * @param {int} line The line at which the error occurred. + * @param {int} col The column at which the error occurred. + */ function SyntaxError(message, line, col){ + + /** + * The column at which the error occurred. + * @type int + * @property col + */ this.col = col; + + /** + * The line at which the error occurred. + * @type int + * @property line + */ this.line = line; + + /** + * The text representation of the unit. + * @type String + * @property text + */ this.message = message; } + +//inherit from Error SyntaxError.prototype = new Error(); +/** + * Base type to represent a single syntactic unit. + * @class SyntaxUnit + * @namespace parserlib.util + * @constructor + * @param {String} text The text of the unit. + * @param {int} line The line of text on which the unit resides. + * @param {int} col The column of text on which the unit resides. + */ function SyntaxUnit(text, line, col, type){ + + + /** + * The column of text on which the unit resides. + * @type int + * @property col + */ this.col = col; + + /** + * The line of text on which the unit resides. + * @type int + * @property line + */ this.line = line; + + /** + * The text representation of the unit. + * @type String + * @property text + */ this.text = text; + + /** + * The type of syntax unit. + * @type int + * @property type + */ this.type = type; } + +/** + * Create a new syntax unit based solely on the given token. + * Convenience method for creating a new syntax unit when + * it represents a single token instead of multiple. + * @param {Object} token The token object to represent. + * @return {parserlib.util.SyntaxUnit} The object representing the token. + * @static + * @method fromToken + */ SyntaxUnit.fromToken = function(token){ return new SyntaxUnit(token.value, token.startLine, token.startCol); }; SyntaxUnit.prototype = { + + //restore constructor constructor: SyntaxUnit, + + /** + * Returns the text representation of the unit. + * @return {String} The text representation of the unit. + * @method valueOf + */ valueOf: function(){ return this.toString(); }, + + /** + * Returns the text representation of the unit. + * @return {String} The text representation of the unit. + * @method toString + */ toString: function(){ return this.text; } }; +/*global StringReader, SyntaxError*/ + +/** + * Generic TokenStream providing base functionality. + * @class TokenStreamBase + * @namespace parserlib.util + * @constructor + * @param {String|StringReader} input The text to tokenize or a reader from + * which to read the input. + */ function TokenStreamBase(input, tokenData){ + + /** + * The string reader for easy access to the text. + * @type StringReader + * @property _reader + * @private + */ this._reader = input ? new StringReader(input.toString()) : null; - this._token = null; + + /** + * Token object for the last consumed token. + * @type Token + * @property _token + * @private + */ + this._token = null; + + /** + * The array of token information. + * @type Array + * @property _tokenData + * @private + */ this._tokenData = tokenData; + + /** + * Lookahead token buffer. + * @type Array + * @property _lt + * @private + */ this._lt = []; + + /** + * Lookahead token buffer index. + * @type int + * @property _ltIndex + * @private + */ this._ltIndex = 0; this._ltIndexCache = []; } + +/** + * Accepts an array of token information and outputs + * an array of token data containing key-value mappings + * and matching functions that the TokenStream needs. + * @param {Array} tokens An array of token descriptors. + * @return {Array} An array of processed token data. + * @method createTokenData + * @static + */ TokenStreamBase.createTokenData = function(tokens){ var nameMap = [], @@ -2273,8 +614,31 @@ TokenStreamBase.createTokenData = function(tokens){ }; TokenStreamBase.prototype = { + + //restore constructor constructor: TokenStreamBase, + + //------------------------------------------------------------------------- + // Matching methods + //------------------------------------------------------------------------- + + /** + * Determines if the next token matches the given token type. + * If so, that token is consumed; if not, the token is placed + * back onto the token stream. You can pass in any number of + * token types and this will return true if any of the token + * types is found. + * @param {int|int[]} tokenTypes Either a single token type or an array of + * token types that the next token might be. If an array is passed, + * it's assumed that the token can be any of these. + * @param {variant} channel (Optional) The channel to read from. If not + * provided, reads from the default (unnamed) channel. + * @return {Boolean} True if the token type matches, false if not. + * @method match + */ match: function(tokenTypes, channel){ + + //always convert to an array, makes things easier if (!(tokenTypes instanceof Array)){ tokenTypes = [tokenTypes]; } @@ -2288,12 +652,28 @@ TokenStreamBase.prototype = { return true; } } + + //no match found, put the token back this.unget(); return false; - }, + }, + + /** + * Determines if the next token matches the given token type. + * If so, that token is consumed; if not, an error is thrown. + * @param {int|int[]} tokenTypes Either a single token type or an array of + * token types that the next token should be. If an array is passed, + * it's assumed that the token must be one of these. + * @param {variant} channel (Optional) The channel to read from. If not + * provided, reads from the default (unnamed) channel. + * @return {void} + * @method mustMatch + */ mustMatch: function(tokenTypes, channel){ var token; + + //always convert to an array, makes things easier if (!(tokenTypes instanceof Array)){ tokenTypes = [tokenTypes]; } @@ -2304,6 +684,22 @@ TokenStreamBase.prototype = { " at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol); } }, + + //------------------------------------------------------------------------- + // Consuming methods + //------------------------------------------------------------------------- + + /** + * Keeps reading from the token stream until either one of the specified + * token types is found or until the end of the input is reached. + * @param {int|int[]} tokenTypes Either a single token type or an array of + * token types that the next token should be. If an array is passed, + * it's assumed that the token must be one of these. + * @param {variant} channel (Optional) The channel to read from. If not + * provided, reads from the default (unnamed) channel. + * @return {void} + * @method advance + */ advance: function(tokenTypes, channel){ while(this.LA(0) !== 0 && !this.match(tokenTypes, channel)){ @@ -2311,7 +707,13 @@ TokenStreamBase.prototype = { } return this.LA(0); - }, + }, + + /** + * Consumes the next token from the token stream. + * @return {int} The token type of the token that was just consumed. + * @method get + */ get: function(channel){ var tokenInfo = this._tokenData, @@ -2322,57 +724,102 @@ TokenStreamBase.prototype = { found = false, token, info; + + //check the lookahead buffer first if (this._lt.length && this._ltIndex >= 0 && this._ltIndex < this._lt.length){ i++; this._token = this._lt[this._ltIndex++]; info = tokenInfo[this._token.type]; + + //obey channels logic while((info.channel !== undefined && channel !== info.channel) && this._ltIndex < this._lt.length){ this._token = this._lt[this._ltIndex++]; info = tokenInfo[this._token.type]; i++; } + + //here be dragons if ((info.channel === undefined || channel === info.channel) && this._ltIndex <= this._lt.length){ this._ltIndexCache.push(i); return this._token.type; } } + + //call token retriever method token = this._getToken(); + + //if it should be hidden, don't save a token if (token.type > -1 && !tokenInfo[token.type].hide){ + + //apply token channel token.channel = tokenInfo[token.type].channel; + + //save for later this._token = token; this._lt.push(token); + + //save space that will be moved (must be done before array is truncated) this._ltIndexCache.push(this._lt.length - this._ltIndex + i); + + //keep the buffer under 5 items if (this._lt.length > 5){ this._lt.shift(); } + + //also keep the shift buffer under 5 items if (this._ltIndexCache.length > 5){ this._ltIndexCache.shift(); } + + //update lookahead index this._ltIndex = this._lt.length; } + + /* + * Skip to the next token if: + * 1. The token type is marked as hidden. + * 2. The token type has a channel specified and it isn't the current channel. + */ info = tokenInfo[token.type]; if (info && (info.hide || (info.channel !== undefined && channel !== info.channel))){ return this.get(channel); } else { + //return just the type return token.type; } }, + + /** + * Looks ahead a certain number of tokens and returns the token type at + * that position. This will throw an error if you lookahead past the + * end of input, past the size of the lookahead buffer, or back past + * the first token in the lookahead buffer. + * @param {int} The index of the token type to retrieve. 0 for the + * current token, 1 for the next, -1 for the previous, etc. + * @return {int} The token type of the token in the given position. + * @method LA + */ LA: function(index){ var total = index, tt; if (index > 0){ + //TODO: Store 5 somewhere if (index > 5){ throw new Error("Too much lookahead."); } + + //get all those tokens while(total){ tt = this.get(); total--; } + + //unget all those tokens while(total < index){ this.unget(); total++; @@ -2391,28 +838,78 @@ TokenStreamBase.prototype = { return tt; - }, + }, + + /** + * Looks ahead a certain number of tokens and returns the token at + * that position. This will throw an error if you lookahead past the + * end of input, past the size of the lookahead buffer, or back past + * the first token in the lookahead buffer. + * @param {int} The index of the token type to retrieve. 0 for the + * current token, 1 for the next, -1 for the previous, etc. + * @return {Object} The token of the token in the given position. + * @method LA + */ LT: function(index){ + + //lookahead first to prime the token buffer this.LA(index); + + //now find the token, subtract one because _ltIndex is already at the next index return this._lt[this._ltIndex+index-1]; }, + + /** + * Returns the token type for the next token in the stream without + * consuming it. + * @return {int} The token type of the next token in the stream. + * @method peek + */ peek: function(){ return this.LA(1); }, + + /** + * Returns the actual token object for the last consumed token. + * @return {Token} The token object for the last consumed token. + * @method token + */ token: function(){ return this._token; }, + + /** + * Returns the name of the token for the given token type. + * @param {int} tokenType The type of token to get the name of. + * @return {String} The name of the token or "UNKNOWN_TOKEN" for any + * invalid token type. + * @method tokenName + */ tokenName: function(tokenType){ if (tokenType < 0 || tokenType > this._tokenData.length){ return "UNKNOWN_TOKEN"; } else { return this._tokenData[tokenType].name; } - }, + }, + + /** + * Returns the token type value for the given token name. + * @param {String} tokenName The name of the token whose value should be returned. + * @return {int} The token type value for the given token name or -1 + * for an unknown token. + * @method tokenName + */ tokenType: function(tokenName){ return this._tokenData[tokenName] || -1; - }, + }, + + /** + * Returns the last consumed token to the token stream. + * @method unget + */ unget: function(){ + //if (this._ltIndex > -1){ if (this._ltIndexCache.length){ this._ltIndex -= this._ltIndexCache.pop();//--; this._token = this._lt[this._ltIndex - 1]; @@ -2434,6 +931,32 @@ EventTarget : EventTarget, TokenStreamBase : TokenStreamBase }; })(); + + +/* +Parser-Lib +Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +*/ +/* Version v0.2.2, Build time: 17-January-2013 10:26:34 */ (function(){ var EventTarget = parserlib.util.EventTarget, TokenStreamBase = parserlib.util.TokenStreamBase, @@ -2583,6 +1106,7 @@ var Colors = { whitesmoke :"#f5f5f5", yellow :"#ffff00", yellowgreen :"#9acd32", + //CSS2 system colors http://www.w3.org/TR/css3-color/#css2-system activeBorder :"Active window border.", activecaption :"Active window caption.", appworkspace :"Background color of multiple document interface.", @@ -2612,10 +1136,29 @@ var Colors = { windowframe :"Window frame.", windowtext :"Text in windows." }; +/*global SyntaxUnit, Parser*/ +/** + * Represents a selector combinator (whitespace, +, >). + * @namespace parserlib.css + * @class Combinator + * @extends parserlib.util.SyntaxUnit + * @constructor + * @param {String} text The text representation of the unit. + * @param {int} line The line of text on which the unit resides. + * @param {int} col The column of text on which the unit resides. + */ function Combinator(text, line, col){ SyntaxUnit.call(this, text, line, col, Parser.COMBINATOR_TYPE); + + /** + * The type of modifier. + * @type String + * @property type + */ this.type = "unknown"; + + //pretty simple if (/^\s+$/.test(text)){ this.type = "descendant"; } else if (text == ">"){ @@ -2630,27 +1173,104 @@ function Combinator(text, line, col){ Combinator.prototype = new SyntaxUnit(); Combinator.prototype.constructor = Combinator; + + +/*global SyntaxUnit, Parser*/ +/** + * Represents a media feature, such as max-width:500. + * @namespace parserlib.css + * @class MediaFeature + * @extends parserlib.util.SyntaxUnit + * @constructor + * @param {SyntaxUnit} name The name of the feature. + * @param {SyntaxUnit} value The value of the feature or null if none. + */ function MediaFeature(name, value){ SyntaxUnit.call(this, "(" + name + (value !== null ? ":" + value : "") + ")", name.startLine, name.startCol, Parser.MEDIA_FEATURE_TYPE); + + /** + * The name of the media feature + * @type String + * @property name + */ this.name = name; + + /** + * The value for the feature or null if there is none. + * @type SyntaxUnit + * @property value + */ this.value = value; } MediaFeature.prototype = new SyntaxUnit(); MediaFeature.prototype.constructor = MediaFeature; + + +/*global SyntaxUnit, Parser*/ +/** + * Represents an individual media query. + * @namespace parserlib.css + * @class MediaQuery + * @extends parserlib.util.SyntaxUnit + * @constructor + * @param {String} modifier The modifier "not" or "only" (or null). + * @param {String} mediaType The type of media (i.e., "print"). + * @param {Array} parts Array of selectors parts making up this selector. + * @param {int} line The line of text on which the unit resides. + * @param {int} col The column of text on which the unit resides. + */ function MediaQuery(modifier, mediaType, features, line, col){ - SyntaxUnit.call(this, (modifier ? modifier + " ": "") + (mediaType ? mediaType : "") + (mediaType && features.length > 0 ? " and " : "") + features.join(" and "), line, col, Parser.MEDIA_QUERY_TYPE); + SyntaxUnit.call(this, (modifier ? modifier + " ": "") + (mediaType ? mediaType : "") + (mediaType && features.length > 0 ? " and " : "") + features.join(" and "), line, col, Parser.MEDIA_QUERY_TYPE); + + /** + * The media modifier ("not" or "only") + * @type String + * @property modifier + */ this.modifier = modifier; - this.mediaType = mediaType; + + /** + * The mediaType (i.e., "print") + * @type String + * @property mediaType + */ + this.mediaType = mediaType; + + /** + * The parts that make up the selector. + * @type Array + * @property features + */ this.features = features; } MediaQuery.prototype = new SyntaxUnit(); MediaQuery.prototype.constructor = MediaQuery; + + +/*global Tokens, TokenStream, SyntaxError, Properties, Validation, ValidationError, SyntaxUnit, + PropertyValue, PropertyValuePart, SelectorPart, SelectorSubPart, Selector, + PropertyName, Combinator, MediaFeature, MediaQuery, EventTarget */ + +/** + * A CSS3 parser. + * @namespace parserlib.css + * @class Parser + * @constructor + * @param {Object} options (Optional) Various options for the parser: + * starHack (true|false) to allow IE6 star hack as valid, + * underscoreHack (true|false) to interpret leading underscores + * as IE6-7 targeting for known properties, ieFilters (true|false) + * to indicate that IE < 8 filters should be accepted and not throw + * syntax errors. + */ function Parser(options){ + + //inherit event functionality EventTarget.call(this); @@ -2658,6 +1278,8 @@ function Parser(options){ this._tokenStream = null; } + +//Static constants Parser.DEFAULT_TYPE = 0; Parser.COMBINATOR_TYPE = 1; Parser.MEDIA_FEATURE_TYPE = 2; @@ -2674,7 +1296,11 @@ Parser.prototype = function(){ var proto = new EventTarget(), //new prototype prop, additions = { + + //restore constructor constructor: Parser, + + //instance constants - yuck DEFAULT_TYPE : 0, COMBINATOR_TYPE : 1, MEDIA_FEATURE_TYPE : 2, @@ -2686,7 +1312,20 @@ Parser.prototype = function(){ SELECTOR_PART_TYPE : 8, SELECTOR_SUB_PART_TYPE : 9, - _stylesheet: function(){ + //----------------------------------------------------------------- + // Grammar + //----------------------------------------------------------------- + + _stylesheet: function(){ + + /* + * stylesheet + * : [ CHARSET_SYM S* STRING S* ';' ]? + * [S|CDO|CDC]* [ import [S|CDO|CDC]* ]* + * [ namespace [S|CDO|CDC]* ]* + * [ [ ruleset | media | page | font_face | keyframes ] [S|CDO|CDC]* ]* + * ; + */ var tokenStream = this._tokenStream, charset = null, @@ -2695,18 +1334,28 @@ Parser.prototype = function(){ tt; this.fire("startstylesheet"); + + //try to read character set this._charset(); this._skipCruft(); + + //try to read imports - may be more than one while (tokenStream.peek() == Tokens.IMPORT_SYM){ this._import(); this._skipCruft(); } + + //try to read namespaces - may be more than one while (tokenStream.peek() == Tokens.NAMESPACE_SYM){ this._namespace(); this._skipCruft(); } + + //get the next token tt = tokenStream.peek(); + + //try to read the rest while(tt > Tokens.EOF){ try { @@ -2731,6 +1380,8 @@ Parser.prototype = function(){ case Tokens.UNKNOWN_SYM: //unknown @ rule tokenStream.get(); if (!this.options.strict){ + + //fire error event this.fire({ type: "error", error: null, @@ -2738,6 +1389,8 @@ Parser.prototype = function(){ line: tokenStream.LT(0).startLine, col: tokenStream.LT(0).startCol }); + + //skip braces count=0; while (tokenStream.advance([Tokens.LBRACE, Tokens.RBRACE]) == Tokens.LBRACE){ count++; //keep track of nesting depth @@ -2749,6 +1402,7 @@ Parser.prototype = function(){ } } else { + //not a syntax error, rethrow it throw new SyntaxError("Unknown @ rule.", tokenStream.LT(0).startLine, tokenStream.LT(0).startCol); } break; @@ -2757,6 +1411,8 @@ Parser.prototype = function(){ break; default: if(!this._ruleset()){ + + //error handling for known issues switch(tt){ case Tokens.CHARSET_SYM: token = tokenStream.LT(1); @@ -2832,23 +1488,34 @@ Parser.prototype = function(){ } }, - _import: function(emit){ + _import: function(emit){ + /* + * import + * : IMPORT_SYM S* + * [STRING|URI] S* media_query_list? ';' S* + */ var tokenStream = this._tokenStream, tt, uri, importToken, mediaList = []; + + //read import symbol tokenStream.mustMatch(Tokens.IMPORT_SYM); importToken = tokenStream.token(); this._readWhitespace(); tokenStream.mustMatch([Tokens.STRING, Tokens.URI]); + + //grab the URI value uri = tokenStream.token().value.replace(/(?:url\()?["']([^"']+)["']\)?/, "$1"); this._readWhitespace(); mediaList = this._media_query_list(); + + //must end with a semicolon tokenStream.mustMatch(Tokens.SEMICOLON); this._readWhitespace(); @@ -2864,26 +1531,41 @@ Parser.prototype = function(){ }, - _namespace: function(emit){ + _namespace: function(emit){ + /* + * namespace + * : NAMESPACE_SYM S* [namespace_prefix S*]? [STRING|URI] S* ';' S* + */ var tokenStream = this._tokenStream, line, col, prefix, uri; + + //read import symbol tokenStream.mustMatch(Tokens.NAMESPACE_SYM); line = tokenStream.token().startLine; col = tokenStream.token().startCol; this._readWhitespace(); + + //it's a namespace prefix - no _namespace_prefix() method because it's just an IDENT if (tokenStream.match(Tokens.IDENT)){ prefix = tokenStream.token().value; this._readWhitespace(); } tokenStream.mustMatch([Tokens.STRING, Tokens.URI]); + /*if (!tokenStream.match(Tokens.STRING)){ + tokenStream.mustMatch(Tokens.URI); + }*/ + + //grab the URI value uri = tokenStream.token().value.replace(/(?:url\()?["']([^"']+)["']\)?/, "$1"); this._readWhitespace(); + + //must end with a semicolon tokenStream.mustMatch(Tokens.SEMICOLON); this._readWhitespace(); @@ -2900,10 +1582,17 @@ Parser.prototype = function(){ }, _media: function(){ + /* + * media + * : MEDIA_SYM S* media_query_list S* '{' S* ruleset* '}' S* + * ; + */ var tokenStream = this._tokenStream, line, col, mediaList;// = []; + + //look for @media tokenStream.mustMatch(Tokens.MEDIA_SYM); line = tokenStream.token().startLine; col = tokenStream.token().startCol; @@ -2940,7 +1629,15 @@ Parser.prototype = function(){ col: col }); }, + + + //CSS3 Media Queries _media_query_list: function(){ + /* + * media_query_list + * : S* [media_query [ ',' S* media_query ]* ]? + * ; + */ var tokenStream = this._tokenStream, mediaList = []; @@ -2958,7 +1655,19 @@ Parser.prototype = function(){ return mediaList; }, + + /* + * Note: "expression" in the grammar maps to the _media_expression + * method. + + */ _media_query: function(){ + /* + * media_query + * : [ONLY | NOT]? S* media_type S* [ AND S* expression ]* + * | expression [ AND S* expression ]* + * ; + */ var tokenStream = this._tokenStream, type = null, ident = null, @@ -2967,6 +1676,8 @@ Parser.prototype = function(){ if (tokenStream.match(Tokens.IDENT)){ ident = tokenStream.token().value.toLowerCase(); + + //since there's no custom tokens for these, need to manually check if (ident != "only" && ident != "not"){ tokenStream.unget(); ident = null; @@ -3005,10 +1716,31 @@ Parser.prototype = function(){ return new MediaQuery(ident, type, expressions, token.startLine, token.startCol); }, + + //CSS3 Media Queries _media_type: function(){ + /* + * media_type + * : IDENT + * ; + */ return this._media_feature(); }, + + /** + * Note: in CSS3 Media Queries, this is called "expression". + * Renamed here to avoid conflict with CSS3 Selectors + * definition of "expression". Also note that "expr" in the + * grammar now maps to "expression" from CSS3 selectors. + * @method _media_expression + * @private + */ _media_expression: function(){ + /* + * expression + * : '(' S* media_feature S* [ ':' S* expr ]? ')' S* + * ; + */ var tokenStream = this._tokenStream, feature = null, token, @@ -3030,19 +1762,36 @@ Parser.prototype = function(){ return new MediaFeature(feature, (expression ? new SyntaxUnit(expression, token.startLine, token.startCol) : null)); }, + + //CSS3 Media Queries _media_feature: function(){ + /* + * media_feature + * : IDENT + * ; + */ var tokenStream = this._tokenStream; tokenStream.mustMatch(Tokens.IDENT); return SyntaxUnit.fromToken(tokenStream.token()); }, - _page: function(){ + + //CSS3 Paged Media + _page: function(){ + /* + * page: + * PAGE_SYM S* IDENT? pseudo_page? S* + * '{' S* [ declaration | margin ]? [ ';' S* [ declaration | margin ]? ]* '}' S* + * ; + */ var tokenStream = this._tokenStream, line, col, identifier = null, pseudoPage = null; + + //look for @page tokenStream.mustMatch(Tokens.PAGE_SYM); line = tokenStream.token().startLine; col = tokenStream.token().startCol; @@ -3051,10 +1800,14 @@ Parser.prototype = function(){ if (tokenStream.match(Tokens.IDENT)){ identifier = tokenStream.token().value; + + //The value 'auto' may not be used as a page name and MUST be treated as a syntax error. if (identifier.toLowerCase() === "auto"){ this._unexpectedToken(tokenStream.token()); } } + + //see if there's a colon upcoming if (tokenStream.peek() == Tokens.COLON){ pseudoPage = this._pseudo_page(); } @@ -3080,7 +1833,14 @@ Parser.prototype = function(){ }); }, + + //CSS3 Paged Media _margin: function(){ + /* + * margin : + * margin_sym S* '{' declaration [ ';' S* declaration? ]* '}' S* + * ; + */ var tokenStream = this._tokenStream, line, col, @@ -3110,8 +1870,31 @@ Parser.prototype = function(){ return false; } }, + + //CSS3 Paged Media _margin_sym: function(){ + /* + * margin_sym : + * TOPLEFTCORNER_SYM | + * TOPLEFT_SYM | + * TOPCENTER_SYM | + * TOPRIGHT_SYM | + * TOPRIGHTCORNER_SYM | + * BOTTOMLEFTCORNER_SYM | + * BOTTOMLEFT_SYM | + * BOTTOMCENTER_SYM | + * BOTTOMRIGHT_SYM | + * BOTTOMRIGHTCORNER_SYM | + * LEFTTOP_SYM | + * LEFTMIDDLE_SYM | + * LEFTBOTTOM_SYM | + * RIGHTTOP_SYM | + * RIGHTMIDDLE_SYM | + * RIGHTBOTTOM_SYM + * ; + */ + var tokenStream = this._tokenStream; if(tokenStream.match([Tokens.TOPLEFTCORNER_SYM, Tokens.TOPLEFT_SYM, @@ -3130,19 +1913,34 @@ Parser.prototype = function(){ }, _pseudo_page: function(){ + /* + * pseudo_page + * : ':' IDENT + * ; + */ var tokenStream = this._tokenStream; tokenStream.mustMatch(Tokens.COLON); tokenStream.mustMatch(Tokens.IDENT); + //TODO: CSS3 Paged Media says only "left", "center", and "right" are allowed + return tokenStream.token().value; }, - _font_face: function(){ + _font_face: function(){ + /* + * font_face + * : FONT_FACE_SYM S* + * '{' S* declaration [ ';' S* declaration ]* '}' S* + * ; + */ var tokenStream = this._tokenStream, line, col; + + //look for @page tokenStream.mustMatch(Tokens.FONT_FACE_SYM); line = tokenStream.token().startLine; col = tokenStream.token().startCol; @@ -3164,7 +1962,15 @@ Parser.prototype = function(){ }); }, - _operator: function(inFunction){ + _operator: function(inFunction){ + + /* + * operator (outside function) + * : '/' S* | ',' S* | /( empty )/ + * operator (inside function) + * : '/' S* | '+' S* | '*' S* | '-' S* /( empty )/ + * ; + */ var tokenStream = this._tokenStream, token = null; @@ -3178,7 +1984,13 @@ Parser.prototype = function(){ }, - _combinator: function(){ + _combinator: function(){ + + /* + * combinator + * : PLUS S* | GREATER S* | TILDE S* | S+ + * ; + */ var tokenStream = this._tokenStream, value = null, @@ -3194,6 +2006,12 @@ Parser.prototype = function(){ }, _unary_operator: function(){ + + /* + * unary_operator + * : '-' | '+' + * ; + */ var tokenStream = this._tokenStream; @@ -3205,6 +2023,12 @@ Parser.prototype = function(){ }, _property: function(){ + + /* + * property + * : IDENT S* + * ; + */ var tokenStream = this._tokenStream, value = null, @@ -3213,6 +2037,8 @@ Parser.prototype = function(){ token, line, col; + + //check for star hack - throws error if not allowed if (tokenStream.peek() == Tokens.STAR && this.options.starHack){ tokenStream.get(); token = tokenStream.token(); @@ -3224,6 +2050,8 @@ Parser.prototype = function(){ if(tokenStream.match(Tokens.IDENT)){ token = tokenStream.token(); tokenValue = token.value; + + //check for underscore hack - no error if not allowed because it's valid CSS syntax if (tokenValue.charAt(0) == "_" && this.options.underscoreHack){ hack = "_"; tokenValue = tokenValue.substring(1); @@ -3235,15 +2063,31 @@ Parser.prototype = function(){ return value; }, - _ruleset: function(){ + + //Augmented with CSS3 Selectors + _ruleset: function(){ + /* + * ruleset + * : selectors_group + * '{' S* declaration? [ ';' S* declaration? ]* '}' S* + * ; + */ var tokenStream = this._tokenStream, tt, selectors; + + + /* + * Error Recovery: If even a single selector fails to parse, + * then the entire ruleset should be thrown away. + */ try { selectors = this._selectors_group(); } catch (ex){ if (ex instanceof SyntaxError && !this.options.strict){ + + //fire error event this.fire({ type: "error", error: ex, @@ -3251,17 +2095,26 @@ Parser.prototype = function(){ line: ex.line, col: ex.col }); + + //skip over everything until closing brace tt = tokenStream.advance([Tokens.RBRACE]); if (tt == Tokens.RBRACE){ + //if there's a right brace, the rule is finished so don't do anything } else { + //otherwise, rethrow the error because it wasn't handled properly throw ex; } } else { + //not a syntax error, rethrow it throw ex; } + + //trigger parser to continue return true; } + + //if it got here, all selectors parsed if (selectors){ this.fire({ @@ -3285,7 +2138,15 @@ Parser.prototype = function(){ return selectors; }, - _selectors_group: function(){ + + //CSS3 Selectors + _selectors_group: function(){ + + /* + * selectors_group + * : selector [ COMMA S* selector ]* + * ; + */ var tokenStream = this._tokenStream, selectors = [], selector; @@ -3307,13 +2168,22 @@ Parser.prototype = function(){ return selectors.length ? selectors : null; }, + + //CSS3 Selectors _selector: function(){ + /* + * selector + * : simple_selector_sequence [ combinator simple_selector_sequence ]* + * ; + */ var tokenStream = this._tokenStream, selector = [], nextSelector = null, combinator = null, ws = null; + + //if there's no simple selector, then there's no selector nextSelector = this._simple_selector_sequence(); if (nextSelector === null){ return null; @@ -3322,20 +2192,34 @@ Parser.prototype = function(){ selector.push(nextSelector); do { + + //look for a combinator combinator = this._combinator(); if (combinator !== null){ selector.push(combinator); nextSelector = this._simple_selector_sequence(); + + //there must be a next selector if (nextSelector === null){ this._unexpectedToken(tokenStream.LT(1)); } else { + + //nextSelector is an instance of SelectorPart selector.push(nextSelector); } } else { + + //if there's not whitespace, we're done if (this._readWhitespace()){ + + //add whitespace separator ws = new Combinator(tokenStream.token().value, tokenStream.token().startLine, tokenStream.token().startCol); + + //combinator is not required combinator = this._combinator(); + + //selector is required if there's a combinator nextSelector = this._simple_selector_sequence(); if (nextSelector === null){ if (combinator !== null){ @@ -3360,13 +2244,29 @@ Parser.prototype = function(){ return new Selector(selector, selector[0].line, selector[0].col); }, + + //CSS3 Selectors _simple_selector_sequence: function(){ + /* + * simple_selector_sequence + * : [ type_selector | universal ] + * [ HASH | class | attrib | pseudo | negation ]* + * | [ HASH | class | attrib | pseudo | negation ]+ + * ; + */ var tokenStream = this._tokenStream, + + //parts of a simple selector elementName = null, modifiers = [], + + //complete selector text selectorText= "", + + //the different parts after the element name to search for components = [ + //HASH function(){ return tokenStream.match(Tokens.HASH) ? new SelectorSubPart(tokenStream.token().value, "id", tokenStream.token().startLine, tokenStream.token().startCol) : @@ -3383,6 +2283,9 @@ Parser.prototype = function(){ found = false, line, col; + + + //get starting line and column for the selector line = tokenStream.LT(1).startLine; col = tokenStream.LT(1).startCol; @@ -3396,14 +2299,20 @@ Parser.prototype = function(){ } while(true){ + + //whitespace means we're done if (tokenStream.peek() === Tokens.S){ break; } + + //check for each component while(i < len && component === null){ component = components[i++].call(this); } if (component === null){ + + //we don't have a selector if (selectorText === ""){ return null; } else { @@ -3422,13 +2331,26 @@ Parser.prototype = function(){ new SelectorPart(elementName, modifiers, selectorText, line, col) : null; }, + + //CSS3 Selectors _type_selector: function(){ + /* + * type_selector + * : [ namespace_prefix ]? element_name + * ; + */ var tokenStream = this._tokenStream, ns = this._namespace_prefix(), elementName = this._element_name(); if (!elementName){ + /* + * Need to back out the namespace that was read due to both + * type_selector and universal reading namespace_prefix + * first. Kind of hacky, but only way I can figure out + * right now how to not change the grammar. + */ if (ns){ tokenStream.unget(); if (ns.length > 1){ @@ -3445,7 +2367,14 @@ Parser.prototype = function(){ return elementName; } }, - _class: function(){ + + //CSS3 Selectors + _class: function(){ + /* + * class + * : '.' IDENT + * ; + */ var tokenStream = this._tokenStream, token; @@ -3459,7 +2388,14 @@ Parser.prototype = function(){ } }, - _element_name: function(){ + + //CSS3 Selectors + _element_name: function(){ + /* + * element_name + * : IDENT + * ; + */ var tokenStream = this._tokenStream, token; @@ -3472,9 +2408,18 @@ Parser.prototype = function(){ return null; } }, + + //CSS3 Selectors _namespace_prefix: function(){ + /* + * namespace_prefix + * : [ IDENT | '*' ]? '|' + * ; + */ var tokenStream = this._tokenStream, value = ""; + + //verify that this is a namespace prefix if (tokenStream.LA(1) === Tokens.PIPE || tokenStream.LA(2) === Tokens.PIPE){ if(tokenStream.match([Tokens.IDENT, Tokens.STAR])){ @@ -3488,7 +2433,14 @@ Parser.prototype = function(){ return value.length ? value : null; }, + + //CSS3 Selectors _universal: function(){ + /* + * universal + * : [ namespace_prefix ]? '*' + * ; + */ var tokenStream = this._tokenStream, value = "", ns; @@ -3505,7 +2457,21 @@ Parser.prototype = function(){ return value.length ? value : null; }, + + //CSS3 Selectors _attrib: function(){ + /* + * attrib + * : '[' S* [ namespace_prefix ]? IDENT S* + * [ [ PREFIXMATCH | + * SUFFIXMATCH | + * SUBSTRINGMATCH | + * '=' | + * INCLUDES | + * DASHMATCH ] S* [ IDENT | STRING ] S* + * ]? ']' + * ; + */ var tokenStream = this._tokenStream, value = null, @@ -3545,7 +2511,15 @@ Parser.prototype = function(){ return null; } }, - _pseudo: function(){ + + //CSS3 Selectors + _pseudo: function(){ + + /* + * pseudo + * : ':' ':'? [ IDENT | functional_pseudo ] + * ; + */ var tokenStream = this._tokenStream, pseudo = null, @@ -3576,7 +2550,14 @@ Parser.prototype = function(){ return pseudo; }, - _functional_pseudo: function(){ + + //CSS3 Selectors + _functional_pseudo: function(){ + /* + * functional_pseudo + * : FUNCTION S* expression ')' + * ; + */ var tokenStream = this._tokenStream, value = null; @@ -3591,7 +2572,14 @@ Parser.prototype = function(){ return value; }, + + //CSS3 Selectors _expression: function(){ + /* + * expression + * : [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+ + * ; + */ var tokenStream = this._tokenStream, value = ""; @@ -3608,7 +2596,14 @@ Parser.prototype = function(){ return value.length ? value : null; }, + + //CSS3 Selectors _negation: function(){ + /* + * negation + * : NOT S* negation_arg S* ')' + * ; + */ var tokenStream = this._tokenStream, line, @@ -3634,7 +2629,14 @@ Parser.prototype = function(){ return subpart; }, - _negation_arg: function(){ + + //CSS3 Selectors + _negation_arg: function(){ + /* + * negation_arg + * : type_selector | universal | HASH | class | attrib | pseudo + * ; + */ var tokenStream = this._tokenStream, args = [ @@ -3665,9 +2667,13 @@ Parser.prototype = function(){ arg = args[i].call(this); i++; } + + //must be a negation arg if (arg === null){ this._unexpectedToken(tokenStream.LT(1)); } + + //it's an element name if (arg.type == "elementName"){ part = new SelectorPart(arg, [], arg.toString(), line, col); } else { @@ -3677,7 +2683,14 @@ Parser.prototype = function(){ return part; }, - _declaration: function(){ + _declaration: function(){ + + /* + * declaration + * : property ':' S* expr prio? + * | /( empty )/ + * ; + */ var tokenStream = this._tokenStream, property = null, @@ -3694,11 +2707,19 @@ Parser.prototype = function(){ this._readWhitespace(); expr = this._expr(); + + //if there's no parts for the value, it's an error if (!expr || expr.length === 0){ this._unexpectedToken(tokenStream.LT(1)); } prio = this._prio(); + + /* + * If hacks should be allowed, then only check the root + * property. If hacks should not be allowed, treat + * _property or *property as invalid properties. + */ propertyName = property.toString(); if (this.options.starHack && property.hack == "*" || this.options.underscoreHack && property.hack == "_") { @@ -3729,6 +2750,11 @@ Parser.prototype = function(){ }, _prio: function(){ + /* + * prio + * : IMPORTANT_SYM S* + * ; + */ var tokenStream = this._tokenStream, result = tokenStream.match(Tokens.IMPORTANT_SYM); @@ -3738,9 +2764,15 @@ Parser.prototype = function(){ }, _expr: function(inFunction){ + /* + * expr + * : term [ operator term ]* + * ; + */ var tokenStream = this._tokenStream, values = [], + //valueParts = [], value = null, operator = null; @@ -3751,9 +2783,12 @@ Parser.prototype = function(){ do { operator = this._operator(inFunction); + + //if there's an operator, keep building up the value parts if (operator){ values.push(operator); } /*else { + //if there's not an operator, you have a full value values.push(new PropertyValue(valueParts, valueParts[0].line, valueParts[0].col)); valueParts = []; }*/ @@ -3767,11 +2802,25 @@ Parser.prototype = function(){ } } while(true); } + + //cleanup + /*if (valueParts.length){ + values.push(new PropertyValue(valueParts, valueParts[0].line, valueParts[0].col)); + }*/ return values.length > 0 ? new PropertyValue(values, values[0].line, values[0].col) : null; }, - _term: function(){ + _term: function(){ + + /* + * term + * : unary_operator? + * [ NUMBER S* | PERCENTAGE S* | LENGTH S* | ANGLE S* | + * TIME S* | FREQ S* | function | ie_function ] + * | STRING S* | IDENT S* | URI S* | UNICODERANGE S* | hexcolor + * ; + */ var tokenStream = this._tokenStream, unary = null, @@ -3779,11 +2828,15 @@ Parser.prototype = function(){ token, line, col; + + //returns the operator or null unary = this._unary_operator(); if (unary !== null){ line = tokenStream.token().startLine; col = tokenStream.token().startCol; } + + //exception for IE filters if (tokenStream.peek() == Tokens.IE_FUNCTION && this.options.ieFilters){ value = this._ie_function(); @@ -3791,6 +2844,8 @@ Parser.prototype = function(){ line = tokenStream.token().startLine; col = tokenStream.token().startCol; } + + //see if there's a simple match } else if (tokenStream.match([Tokens.NUMBER, Tokens.PERCENTAGE, Tokens.LENGTH, Tokens.ANGLE, Tokens.TIME, Tokens.FREQ, Tokens.STRING, Tokens.IDENT, Tokens.URI, Tokens.UNICODE_RANGE])){ @@ -3802,19 +2857,35 @@ Parser.prototype = function(){ } this._readWhitespace(); } else { + + //see if it's a color token = this._hexcolor(); if (token === null){ + + //if there's no unary, get the start of the next token for line/col info if (unary === null){ line = tokenStream.LT(1).startLine; col = tokenStream.LT(1).startCol; } + + //has to be a function if (value === null){ + + /* + * This checks for alpha(opacity=0) style of IE + * functions. IE_FUNCTION only presents progid: style. + */ if (tokenStream.LA(3) == Tokens.EQUALS && this.options.ieFilters){ value = this._ie_function(); } else { value = this._function(); } } + + /*if (value === null){ + return null; + //throw new Error("Expected identifier at line " + tokenStream.token().startLine + ", character " + tokenStream.token().startCol + "."); + }*/ } else { value = token.value; @@ -3833,6 +2904,12 @@ Parser.prototype = function(){ }, _function: function(){ + + /* + * function + * : FUNCTION S* expr ')' S* + * ; + */ var tokenStream = this._tokenStream, functionText = null, @@ -3844,12 +2921,16 @@ Parser.prototype = function(){ this._readWhitespace(); expr = this._expr(true); functionText += expr; + + //START: Horrible hack in case it's an IE filter if (this.options.ieFilters && tokenStream.peek() == Tokens.EQUALS){ do { if (this._readWhitespace()){ functionText += tokenStream.token().value; } + + //might be second time in the loop if (tokenStream.LA(0) == Tokens.COMMA){ functionText += tokenStream.token().value; } @@ -3859,6 +2940,8 @@ Parser.prototype = function(){ tokenStream.match(Tokens.EQUALS); functionText += tokenStream.token().value; + + //functionText += this._term(); lt = tokenStream.peek(); while(lt != Tokens.COMMA && lt != Tokens.S && lt != Tokens.RPAREN){ tokenStream.get(); @@ -3867,6 +2950,8 @@ Parser.prototype = function(){ } } while(tokenStream.match([Tokens.COMMA, Tokens.S])); } + + //END: Horrible Hack tokenStream.match(Tokens.RPAREN); functionText += ")"; @@ -3877,11 +2962,19 @@ Parser.prototype = function(){ }, _ie_function: function(){ + + /* (My own extension) + * ie_function + * : IE_FUNCTION S* IDENT '=' term [S* ','? IDENT '=' term]+ ')' S* + * ; + */ var tokenStream = this._tokenStream, functionText = null, expr = null, lt; + + //IE function can begin like a regular function, too if (tokenStream.match([Tokens.IE_FUNCTION, Tokens.FUNCTION])){ functionText = tokenStream.token().value; @@ -3890,6 +2983,8 @@ Parser.prototype = function(){ if (this._readWhitespace()){ functionText += tokenStream.token().value; } + + //might be second time in the loop if (tokenStream.LA(0) == Tokens.COMMA){ functionText += tokenStream.token().value; } @@ -3899,6 +2994,8 @@ Parser.prototype = function(){ tokenStream.match(Tokens.EQUALS); functionText += tokenStream.token().value; + + //functionText += this._term(); lt = tokenStream.peek(); while(lt != Tokens.COMMA && lt != Tokens.S && lt != Tokens.RPAREN){ tokenStream.get(); @@ -3916,12 +3013,23 @@ Parser.prototype = function(){ }, _hexcolor: function(){ + /* + * There is a constraint on the color that it must + * have either 3 or 6 hex-digits (i.e., [0-9a-fA-F]) + * after the "#"; e.g., "#000" is OK, but "#abcd" is not. + * + * hexcolor + * : HASH S* + * ; + */ var tokenStream = this._tokenStream, token = null, color; if(tokenStream.match(Tokens.HASH)){ + + //need to do some validation here token = tokenStream.token(); color = token.value; @@ -3934,7 +3042,17 @@ Parser.prototype = function(){ return token; }, + //----------------------------------------------------------------- + // Animations methods + //----------------------------------------------------------------- + _keyframes: function(){ + + /* + * keyframes: + * : KEYFRAMES_SYM S* keyframe_name S* '{' S* keyframe_rule* '}' { + * ; + */ var tokenStream = this._tokenStream, token, tt, @@ -3963,6 +3081,8 @@ Parser.prototype = function(){ this._readWhitespace(); tt = tokenStream.peek(); + + //check for key while(tt == Tokens.IDENT || tt == Tokens.PERCENTAGE) { this._keyframe_rule(); this._readWhitespace(); @@ -3983,6 +3103,13 @@ Parser.prototype = function(){ }, _keyframe_name: function(){ + + /* + * keyframe_name: + * : IDENT + * | STRING + * ; + */ var tokenStream = this._tokenStream, token; @@ -3991,6 +3118,13 @@ Parser.prototype = function(){ }, _keyframe_rule: function(){ + + /* + * keyframe_rule: + * : key_list S* + * '{' S* declaration [ ';' S* declaration ]* '}' S* + * ; + */ var tokenStream = this._tokenStream, token, keyList = this._key_list(); @@ -4014,10 +3148,18 @@ Parser.prototype = function(){ }, _key_list: function(){ + + /* + * key_list: + * : key [ S* ',' S* key]* + * ; + */ var tokenStream = this._tokenStream, token, key, keyList = []; + + //must be least one key keyList.push(this._key()); this._readWhitespace(); @@ -4032,6 +3174,14 @@ Parser.prototype = function(){ }, _key: function(){ + /* + * There is a restriction that IDENT can be only "from" or "to". + * + * key + * : PERCENTAGE + * | IDENT + * ; + */ var tokenStream = this._tokenStream, token; @@ -4047,13 +3197,50 @@ Parser.prototype = function(){ tokenStream.unget(); } + + //if it gets here, there wasn't a valid token, so time to explode this._unexpectedToken(tokenStream.LT(1)); }, + + //----------------------------------------------------------------- + // Helper methods + //----------------------------------------------------------------- + + /** + * Not part of CSS grammar, but useful for skipping over + * combination of white space and HTML-style comments. + * @return {void} + * @method _skipCruft + * @private + */ _skipCruft: function(){ while(this._tokenStream.match([Tokens.S, Tokens.CDO, Tokens.CDC])){ + //noop } }, + + /** + * Not part of CSS grammar, but this pattern occurs frequently + * in the official CSS grammar. Split out here to eliminate + * duplicate code. + * @param {Boolean} checkStart Indicates if the rule should check + * for the left brace at the beginning. + * @param {Boolean} readMargins Indicates if the rule should check + * for margin patterns. + * @return {void} + * @method _readDeclarations + * @private + */ _readDeclarations: function(checkStart, readMargins){ + /* + * Reads the pattern + * S* '{' S* declaration [ ';' S* declaration ]* '}' S* + * or + * S* '{' S* [ declaration | margin ]? [ ';' S* [ declaration | margin ]? ]* '}' S* + * Note that this is how it is described in CSS3 Paged Media, but is actually incorrect. + * A semicolon is only necessary following a delcaration is there's another declaration + * or margin afterwards. + */ var tokenStream = this._tokenStream, tt; @@ -4071,6 +3258,7 @@ Parser.prototype = function(){ while(true){ if (tokenStream.match(Tokens.SEMICOLON) || (readMargins && this._margin())){ + //noop } else if (this._declaration()){ if (!tokenStream.match(Tokens.SEMICOLON)){ break; @@ -4078,6 +3266,10 @@ Parser.prototype = function(){ } else { break; } + + //if ((!this._margin() && !this._declaration()) || !tokenStream.match(Tokens.SEMICOLON)){ + // break; + //} this._readWhitespace(); } @@ -4086,6 +3278,8 @@ Parser.prototype = function(){ } catch (ex) { if (ex instanceof SyntaxError && !this.options.strict){ + + //fire error event this.fire({ type: "error", error: ex, @@ -4093,19 +3287,35 @@ Parser.prototype = function(){ line: ex.line, col: ex.col }); + + //see if there's another declaration tt = tokenStream.advance([Tokens.SEMICOLON, Tokens.RBRACE]); if (tt == Tokens.SEMICOLON){ + //if there's a semicolon, then there might be another declaration this._readDeclarations(false, readMargins); } else if (tt != Tokens.RBRACE){ + //if there's a right brace, the rule is finished so don't do anything + //otherwise, rethrow the error because it wasn't handled properly throw ex; } } else { + //not a syntax error, rethrow it throw ex; } } }, + + /** + * In some cases, you can end up with two white space tokens in a + * row. Instead of making a change in every function that looks for + * white space, this function is used to match as much white space + * as necessary. + * @method _readWhitespace + * @return {String} The white space if found, empty string if not. + * @private + */ _readWhitespace: function(){ var tokenStream = this._tokenStream, @@ -4117,68 +3327,152 @@ Parser.prototype = function(){ return ws; }, + + + /** + * Throws an error when an unexpected token is found. + * @param {Object} token The token that was found. + * @method _unexpectedToken + * @return {void} + * @private + */ _unexpectedToken: function(token){ throw new SyntaxError("Unexpected token '" + token.value + "' at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol); }, + + /** + * Helper method used for parsing subparts of a style sheet. + * @return {void} + * @method _verifyEnd + * @private + */ _verifyEnd: function(){ if (this._tokenStream.LA(1) != Tokens.EOF){ this._unexpectedToken(this._tokenStream.LT(1)); } }, + + //----------------------------------------------------------------- + // Validation methods + //----------------------------------------------------------------- _validateProperty: function(property, value){ Validation.validate(property, value); }, + //----------------------------------------------------------------- + // Parsing methods + //----------------------------------------------------------------- + parse: function(input){ this._tokenStream = new TokenStream(input, Tokens); this._stylesheet(); }, parseStyleSheet: function(input){ + //just passthrough return this.parse(input); }, parseMediaQuery: function(input){ this._tokenStream = new TokenStream(input, Tokens); var result = this._media_query(); + + //if there's anything more, then it's an invalid selector this._verifyEnd(); + + //otherwise return result return result; - }, + }, + + /** + * Parses a property value (everything after the semicolon). + * @return {parserlib.css.PropertyValue} The property value. + * @throws parserlib.util.SyntaxError If an unexpected token is found. + * @method parserPropertyValue + */ parsePropertyValue: function(input){ this._tokenStream = new TokenStream(input, Tokens); this._readWhitespace(); var result = this._expr(); + + //okay to have a trailing white space this._readWhitespace(); + + //if there's anything more, then it's an invalid selector this._verifyEnd(); + + //otherwise return result return result; }, + + /** + * Parses a complete CSS rule, including selectors and + * properties. + * @param {String} input The text to parser. + * @return {Boolean} True if the parse completed successfully, false if not. + * @method parseRule + */ parseRule: function(input){ this._tokenStream = new TokenStream(input, Tokens); + + //skip any leading white space this._readWhitespace(); var result = this._ruleset(); + + //skip any trailing white space this._readWhitespace(); + + //if there's anything more, then it's an invalid selector this._verifyEnd(); + + //otherwise return result return result; }, + + /** + * Parses a single CSS selector (no comma) + * @param {String} input The text to parse as a CSS selector. + * @return {Selector} An object representing the selector. + * @throws parserlib.util.SyntaxError If an unexpected token is found. + * @method parseSelector + */ parseSelector: function(input){ this._tokenStream = new TokenStream(input, Tokens); + + //skip any leading white space this._readWhitespace(); var result = this._selector(); + + //skip any trailing white space this._readWhitespace(); + + //if there's anything more, then it's an invalid selector this._verifyEnd(); + + //otherwise return result return result; }, + + /** + * Parses an HTML style attribute: a set of CSS declarations + * separated by semicolons. + * @param {String} input The text to parse as a style attribute + * @return {void} + * @method parseStyleAttribute + */ parseStyleAttribute: function(input){ input += "}"; // for error recovery in _readDeclarations() this._tokenStream = new TokenStream(input, Tokens); this._readDeclarations(); } }; + + //copy over onto prototype for (prop in additions){ if (additions.hasOwnProperty(prop)){ proto[prop] = additions[prop]; @@ -4187,7 +3481,18 @@ Parser.prototype = function(){ return proto; }(); + + +/* +nth + : S* [ ['-'|'+']? INTEGER? {N} [ S* ['-'|'+'] S* INTEGER ]? | + ['-'|'+']? INTEGER | {O}{D}{D} | {E}{V}{E}{N} ] S* + ; +*/ +/*global Validation, ValidationTypes, ValidationError*/ var Properties = { + + //A "alignment-adjust" : "auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical | | ", "alignment-baseline" : "baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical", "animation" : 1, @@ -4198,6 +3503,8 @@ var Properties = { "animation-name" : { multi: "none | ", comma: true }, "animation-play-state" : { multi: "running | paused", comma: true }, "animation-timing-function" : 1, + + //vendor prefixed "-moz-animation-delay" : { multi: "