From 98e2821b38a775737e42a2479a6bc65107210859 Mon Sep 17 00:00:00 2001 From: Elliot Kroo Date: Thu, 11 Mar 2010 15:21:30 -0800 Subject: reorganizing the first level of folders (trunk/branch folders are not the git way :) --- infrastructure/ace/www/ace2_common.js | 115 + infrastructure/ace/www/ace2_common_dev.js | 296 ++ infrastructure/ace/www/ace2_inner.js | 4778 ++++++++++++++++++++++++ infrastructure/ace/www/ace2_outer.js | 214 ++ infrastructure/ace/www/ace2_wrapper.js | 226 ++ infrastructure/ace/www/bbtree.js | 372 ++ infrastructure/ace/www/changesettracker.js | 170 + infrastructure/ace/www/colorutils.js | 91 + infrastructure/ace/www/contentcollector.js | 509 +++ infrastructure/ace/www/cssmanager.js | 88 + infrastructure/ace/www/dev.html | 39 + infrastructure/ace/www/domline.js | 210 ++ infrastructure/ace/www/easy_sync.js | 923 +++++ infrastructure/ace/www/easysync2.js | 1968 ++++++++++ infrastructure/ace/www/easysync2_tests.js | 877 +++++ infrastructure/ace/www/editor.css | 109 + infrastructure/ace/www/firebug/errorIcon.png | Bin 0 -> 457 bytes infrastructure/ace/www/firebug/firebug.css | 209 ++ infrastructure/ace/www/firebug/firebug.html | 23 + infrastructure/ace/www/firebug/firebug.js | 688 ++++ infrastructure/ace/www/firebug/firebugx.js | 26 + infrastructure/ace/www/firebug/infoIcon.png | Bin 0 -> 524 bytes infrastructure/ace/www/firebug/warningIcon.png | Bin 0 -> 516 bytes infrastructure/ace/www/index.html | 50 + infrastructure/ace/www/inner.css | 48 + infrastructure/ace/www/jquery-1.2.1.js | 2992 +++++++++++++++ infrastructure/ace/www/lang_html.js | 1685 +++++++++ infrastructure/ace/www/lang_js.js | 102 + infrastructure/ace/www/lexer_support.js | 1068 ++++++ infrastructure/ace/www/linestylefilter.js | 247 ++ infrastructure/ace/www/magicdom.js | 293 ++ infrastructure/ace/www/multilang_lexer.js | 349 ++ infrastructure/ace/www/processing.js | 1714 +++++++++ infrastructure/ace/www/profiler.js | 117 + infrastructure/ace/www/skiplist.js | 347 ++ infrastructure/ace/www/spanlist.js | 279 ++ infrastructure/ace/www/syntax-new.css | 35 + infrastructure/ace/www/syntax.css | 32 + infrastructure/ace/www/test.html | 11 + infrastructure/ace/www/testcode.js | 36 + infrastructure/ace/www/toSource.js | 274 ++ infrastructure/ace/www/undomodule.js | 258 ++ infrastructure/ace/www/virtual_lines.js | 287 ++ 43 files changed, 22155 insertions(+) create mode 100644 infrastructure/ace/www/ace2_common.js create mode 100644 infrastructure/ace/www/ace2_common_dev.js create mode 100644 infrastructure/ace/www/ace2_inner.js create mode 100644 infrastructure/ace/www/ace2_outer.js create mode 100644 infrastructure/ace/www/ace2_wrapper.js create mode 100644 infrastructure/ace/www/bbtree.js create mode 100644 infrastructure/ace/www/changesettracker.js create mode 100644 infrastructure/ace/www/colorutils.js create mode 100644 infrastructure/ace/www/contentcollector.js create mode 100644 infrastructure/ace/www/cssmanager.js create mode 100644 infrastructure/ace/www/dev.html create mode 100644 infrastructure/ace/www/domline.js create mode 100644 infrastructure/ace/www/easy_sync.js create mode 100644 infrastructure/ace/www/easysync2.js create mode 100644 infrastructure/ace/www/easysync2_tests.js create mode 100644 infrastructure/ace/www/editor.css create mode 100644 infrastructure/ace/www/firebug/errorIcon.png create mode 100644 infrastructure/ace/www/firebug/firebug.css create mode 100644 infrastructure/ace/www/firebug/firebug.html create mode 100644 infrastructure/ace/www/firebug/firebug.js create mode 100644 infrastructure/ace/www/firebug/firebugx.js create mode 100644 infrastructure/ace/www/firebug/infoIcon.png create mode 100644 infrastructure/ace/www/firebug/warningIcon.png create mode 100644 infrastructure/ace/www/index.html create mode 100644 infrastructure/ace/www/inner.css create mode 100644 infrastructure/ace/www/jquery-1.2.1.js create mode 100644 infrastructure/ace/www/lang_html.js create mode 100644 infrastructure/ace/www/lang_js.js create mode 100644 infrastructure/ace/www/lexer_support.js create mode 100644 infrastructure/ace/www/linestylefilter.js create mode 100644 infrastructure/ace/www/magicdom.js create mode 100644 infrastructure/ace/www/multilang_lexer.js create mode 100644 infrastructure/ace/www/processing.js create mode 100644 infrastructure/ace/www/profiler.js create mode 100644 infrastructure/ace/www/skiplist.js create mode 100644 infrastructure/ace/www/spanlist.js create mode 100644 infrastructure/ace/www/syntax-new.css create mode 100644 infrastructure/ace/www/syntax.css create mode 100644 infrastructure/ace/www/test.html create mode 100644 infrastructure/ace/www/testcode.js create mode 100644 infrastructure/ace/www/toSource.js create mode 100644 infrastructure/ace/www/undomodule.js create mode 100644 infrastructure/ace/www/virtual_lines.js (limited to 'infrastructure/ace/www') diff --git a/infrastructure/ace/www/ace2_common.js b/infrastructure/ace/www/ace2_common.js new file mode 100644 index 0000000..4a08de6 --- /dev/null +++ b/infrastructure/ace/www/ace2_common.js @@ -0,0 +1,115 @@ +/** + * Copyright 2009 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS-IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +function isNodeText(node) { + return (node.nodeType == 3); +} + +function object(o) { + var f = function() {}; + f.prototype = o; + return new f(); +} + +function extend(obj, props) { + for(var p in props) { + obj[p] = props[p]; + } + return obj; +} + +function forEach(array, func) { + for(var i=0;i 1) { + var x = Math.floor((low+high)/2); // x != low, x != high + if (func(x)) high = x; + else low = x; + } + return high; +} + +function binarySearchInfinite(expectedLength, func) { + var i = 0; + while (!func(i)) i += expectedLength; + return binarySearch(i, func); +} + +function htmlPrettyEscape(str) { + return str.replace(/&/g, '&').replace(//g, '>') + .replace(/\r?\n/g, '\\n'); +} diff --git a/infrastructure/ace/www/ace2_common_dev.js b/infrastructure/ace/www/ace2_common_dev.js new file mode 100644 index 0000000..8fb88b0 --- /dev/null +++ b/infrastructure/ace/www/ace2_common_dev.js @@ -0,0 +1,296 @@ +/** + * Copyright 2009 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS-IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* Remove non-cross-browser stuff I'm tempted to use */ +if (Array.prototype.filter) delete Array.prototype.filter; +if (Array.prototype.forEach) delete Array.prototype.forEach; +if (Array.prototype.map) delete Array.prototype.map; +/* */ + +function busyWait(ms) { + var start = (new Date()).getTime(); + while ((new Date()).getTime() < start+ms) {} +} + +/* + based on: http://www.JSON.org/json2.js + 2008-07-15 +*/ +toSource = function () { + + function f(n) { + // Format integers to have at least two digits. + return n < 10 ? '0' + n : n; + } + + Date.prototype.toJSON = function (key) { + + return this.getUTCFullYear() + '-' + + f(this.getUTCMonth() + 1) + '-' + + f(this.getUTCDate()) + 'T' + + f(this.getUTCHours()) + ':' + + f(this.getUTCMinutes()) + ':' + + f(this.getUTCSeconds()) + 'Z'; + }; + + String.prototype.toJSON = + Number.prototype.toJSON = + Boolean.prototype.toJSON = function (key) { + return this.valueOf(); + }; + + var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, + escapeable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, + gap, + indent, + meta = { // table of character substitutions + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '"' : '\\"', + '\\': '\\\\' + }, + rep; + + + function quote(string) { + + // If the string contains no control characters, no quote characters, and no + // backslash characters, then we can safely slap some quotes around it. + // Otherwise we must also replace the offending characters with safe escape + // sequences. + + escapeable.lastIndex = 0; + return escapeable.test(string) ? + '"' + string.replace(escapeable, function (a) { + var c = meta[a]; + if (typeof c === 'string') { + return c; + } + return '\\u' + ('0000' + + (+(a.charCodeAt(0))).toString(16)).slice(-4); + }) + '"' : + '"' + string + '"'; + } + + + function str(key, holder) { + + // Produce a string from holder[key]. + + var i, // The loop counter. + k, // The member key. + v, // The member value. + length, + mind = gap, + partial, + value = holder[key]; + + // If the value has a toJSON method, call it to obtain a replacement value. + + if (value && typeof value === 'object' && + typeof value.toJSON === 'function') { + value = value.toJSON(key); + } + + // If we were called with a replacer function, then call the replacer to + // obtain a replacement value. + + if (typeof rep === 'function') { + value = rep.call(holder, key, value); + } + + // What happens next depends on the value's type. + + switch (typeof value) { + case 'string': + return quote(value); + + case 'number': + + // JSON numbers must be finite. Encode non-finite numbers as null. + + return isFinite(value) ? String(value) : 'null'; + + case 'boolean': + case 'null': + + // If the value is a boolean or null, convert it to a string. Note: + // typeof null does not produce 'null'. The case is included here in + // the remote chance that this gets fixed someday. + + return String(value); + + // If the type is 'object', we might be dealing with an object or an array or + // null. + + case 'object': + + // Due to a specification blunder in ECMAScript, typeof null is 'object', + // so watch out for that case. + + if (!value) { + return 'null'; + } + + // Make an array to hold the partial results of stringifying this object value. + + gap += indent; + partial = []; + + // If the object has a dontEnum length property, we'll treat it as an array. + + if (typeof value.length === 'number' && + !(value.propertyIsEnumerable('length'))) { + + // The object is an array. Stringify every element. Use null as a placeholder + // for non-JSON values. + + length = value.length; + for (i = 0; i < length; i += 1) { + partial[i] = str(i, value) || 'null'; + } + + // Join all of the elements together, separated with commas, and wrap them in + // brackets. + + v = partial.length === 0 ? '[]' : + gap ? '[\n' + gap + + partial.join(',\n' + gap) + '\n' + + mind + ']' : + '[' + partial.join(',') + ']'; + gap = mind; + return v; + } + + // If the replacer is an array, use it to select the members to be stringified. + + if (rep && typeof rep === 'object') { + length = rep.length; + for (i = 0; i < length; i += 1) { + k = rep[i]; + if (typeof k === 'string') { + v = str(k, value); + if (v) { + partial.push(quote(k) + (gap ? ': ' : ':') + v); + } + } + } + } else { + + // Otherwise, iterate through all of the keys in the object. + + for (k in value) { + if (Object.hasOwnProperty.call(value, k)) { + v = str(k, value); + if (v) { + partial.push(quote(k) + (gap ? ': ' : ':') + v); + } + } + } + } + + // Join all of the member texts together, separated with commas, + // and wrap them in braces. + + v = partial.length === 0 ? '{}' : + gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + + mind + '}' : '{' + partial.join(',') + '}'; + gap = mind; + return v; + } + } + + return function (value, replacer, space) { + + // The stringify method takes a value and an optional replacer, and an optional + // space parameter, and returns a JSON text. The replacer can be a function + // that can replace values, or an array of strings that will select the keys. + // A default replacer method can be provided. Use of the space parameter can + // produce text that is more easily readable. + + var i; + gap = ''; + indent = ''; + + // If the space parameter is a number, make an indent string containing that + // many spaces. + + if (typeof space === 'number') { + for (i = 0; i < space; i += 1) { + indent += ' '; + } + + // If the space parameter is a string, it will be used as the indent string. + + } else if (typeof space === 'string') { + indent = space; + } + + // If there is a replacer, it must be a function or an array. + // Otherwise, throw an error. + + rep = replacer; + if (replacer && typeof replacer !== 'function' && + (typeof replacer !== 'object' || + typeof replacer.length !== 'number')) { + throw new Error('JSON.stringify'); + } + + // Make a fake root object containing our value under the key of ''. + // Return the result of stringifying the value. + + return str('', {'': value}); + } +}(); + +function debugFrame(optName, func) { + var name = "something"; + if ((typeof optName) == "string") { + name = optName; + } + else func = optName; + + return function() { + try { + return func.apply(this, arguments); + } + catch (e) { + console.warn(name+" didn't complete"); + throw e; + } + } +} + +function makeRecentSet(size) { + var ringBuffer = {}; + var nextIndex = 0; + return { + contains: function (elem) { + for(var i=0;i= rep.alltext.length) { + offset = rep.alltext.length-1; + } + dirtyLineKeys[getLineKeyForOffset(offset)] = true; + } + + module.setCharRangeNeedsRecoloring = function(offset1, offset2) { + if (offset1 >= rep.alltext.length) { + offset1 = rep.alltext.length-1; + } + if (offset2 >= rep.alltext.length) { + offset2 = rep.alltext.length-1; + } + var firstEntry = rep.lines.atOffset(offset1); + var lastKey = rep.lines.atOffset(offset2).key; + dirtyLineKeys[lastKey] = true; + var entry = firstEntry; + while (entry && entry.key != lastKey) { + dirtyLineKeys[entry.key] = true; + entry = rep.lines.next(entry); + } + } + + module.recolorLines = function() { + for(var k in dirtyLineKeys) { + recolorLineByKey(k); + } + dirtyLineKeys = {}; + } + + return module; + })(); + + var parenModule = (function() { + var module = {}; + module.notifyTick = function() { handleFlashing(false); }; + module.notifyChange = function() { handleFlashing(true); }; + module.shouldNormalizeOnChar = function (c) { + if (parenFlashRep.active) { + // avoid highlight style from carrying on to typed text + return true; + } + c = String.fromCharCode(c); + return !! (bracketMap[c]); + } + + var parenFlashRep = { active: false, whichChars: null, whichLineKeys: null, expireTime: null }; + var bracketMap = {'(': 1, ')':-1, '[':2, ']':-2, '{':3, '}':-3}; + var bracketRegex = /[{}\[\]()]/g; + function handleFlashing(docChanged) { + function getSearchRange(aroundLoc) { + var rng = getVisibleCharRange(); + var d = 100; // minimum radius + var e = 3000; // maximum radius; + if (rng[0] > aroundLoc-d) rng[0] = aroundLoc-d; + if (rng[0] < aroundLoc-e) rng[0] = aroundLoc-e; + if (rng[0] < 0) rng[0] = 0; + if (rng[1] < aroundLoc+d) rng[1] = aroundLoc+d; + if (rng[1] > aroundLoc+e) rng[1] = aroundLoc+e; + if (rng[1] > rep.lines.totalWidth()) rng[1] = rep.lines.totalWidth(); + return rng; + } + function findMatchingVisibleBracket(startLoc, forwards) { + var rng = getSearchRange(startLoc); + var str = rep.alltext.substring(rng[0], rng[1]); + var bstr = str.replace(bracketRegex, '('); // handy for searching + var loc = startLoc - rng[0]; + var bracketState = []; + var foundParen = false; + var goodParen = false; + function nextLoc() { + if (loc < 0) return; + if (forwards) loc++; else loc--; + if (loc < 0 || loc >= str.length) loc = -1; + if (loc >= 0) { + if (forwards) loc = bstr.indexOf('(', loc); + else loc = bstr.lastIndexOf('(', loc); + } + } + while ((! foundParen) && (loc >= 0)) { + if (getCharType(loc + rng[0]) == "p") { + var b = bracketMap[str.charAt(loc)]; // -1, 1, -2, 2, -3, 3 + var into = forwards; + var typ = b; + if (typ < 0) { into = ! into; typ = -typ; } + if (into) bracketState.push(typ); + else { + var recent = bracketState.pop(); + if (recent != typ) { + foundParen = true; goodParen = false; + } + else if (bracketState.length == 0) { + foundParen = true; goodParen = true; + } + } + } + //console.log(bracketState.toSource()); + if ((! foundParen) && (loc >= 0)) nextLoc(); + } + if (! foundParen) return null; + return {chr: (loc + rng[0]), good: goodParen}; + } + + var r = parenFlashRep; + var charsToHighlight = null; + var linesToUnhighlight = null; + if (r.active && (docChanged || (now() > r.expireTime))) { + linesToUnhighlight = r.whichLineKeys; + r.active = false; + } + if ((! r.active) && docChanged && isCaret() && caretColumn() > 0) { + var caret = caretDocChar(); + if (caret > 0 && getCharType(caret-1) == "p") { + var charBefore = rep.alltext.charAt(caret-1); + if (bracketMap[charBefore]) { + var lookForwards = (bracketMap[charBefore] > 0); + var findResult = findMatchingVisibleBracket(caret-1, lookForwards); + if (findResult) { + var mateLoc = findResult.chr; + var mateGood = findResult.good; + r.active = true; + charsToHighlight = {}; + charsToHighlight[caret-1] = 'flash'; + charsToHighlight[mateLoc] = (mateGood ? 'flash' : 'flashbad'); + r.whichLineKeys = []; + r.whichLineKeys.push(getLineKeyForOffset(caret-1)); + r.whichLineKeys.push(getLineKeyForOffset(mateLoc)); + r.expireTime = now() + 4000; + newlyActive = true; + } + } + } + + } + if (linesToUnhighlight) { + recolorLineByKey(linesToUnhighlight[0]); + recolorLineByKey(linesToUnhighlight[1]); + } + if (r.active && charsToHighlight) { + function f(txt, cls, next, ofst) { + var flashClass = charsToHighlight[ofst]; + if (cls) { + next(txt, cls+" "+flashClass); + } + else next(txt, cls); + } + for(var c in charsToHighlight) { + recolorLinesInRange((+c), (+c)+1, null, f); + } + } + } + + return module; + })(); + + function dispose() { + disposed = true; + if (idleWorkTimer) idleWorkTimer.never(); + teardown(); + } + + function checkALines() { + return; // disable for speed + function error() { throw new Error("checkALines"); } + if (rep.alines.length != rep.lines.length()) { + error(); + } + for(var i=0;i