diff --git a/build/ace/background_tokenizer.js b/build/ace/background_tokenizer.js new file mode 100644 index 00000000..54e2e4af --- /dev/null +++ b/build/ace/background_tokenizer.js @@ -0,0 +1,79 @@ +define(function(f) { + var i = f("./lib/oop"), j = f("./event_emitter"); + f = function(a, c) { + this.running = false; + this.textLines = []; + this.lines = []; + this.currentLine = 0; + this.tokenizer = a; + var b = this; + this.$worker = function() { + if(b.running) { + for(var e = new Date, g = b.currentLine, d = b.textLines, h = 0, k = c.getLastVisibleRow();b.currentLine < d.length;) { + b.lines[b.currentLine] = b.$tokenizeRows(b.currentLine, b.currentLine)[0]; + b.currentLine++; + h += 1; + if(h % 5 == 0 && new Date - e > 20) { + b.fireUpdateEvent(g, b.currentLine - 1); + b.running = setTimeout(b.$worker, b.currentLine < k ? 20 : 100); + return + } + }b.running = false; + b.fireUpdateEvent(g, d.length - 1) + } + } + }; + (function() { + i.implement(this, j); + this.setTokenizer = function(a) { + this.tokenizer = a; + this.lines = []; + this.start(0) + }; + this.setLines = function(a) { + this.textLines = a; + this.lines = []; + this.stop() + }; + this.fireUpdateEvent = function(a, c) { + this.$dispatchEvent("update", {data:{first:a, last:c}}) + }; + this.start = function(a) { + this.currentLine = Math.min(a || 0, this.currentLine, this.textLines.length); + this.lines.splice(this.currentLine, this.lines.length); + this.stop(); + this.running = setTimeout(this.$worker, 700) + }; + this.stop = function() { + this.running && clearTimeout(this.running); + this.running = false + }; + this.getTokens = function(a, c, b) { + b(this.$tokenizeRows(a, c)) + }; + this.getState = function(a, c) { + c(this.$tokenizeRows(a, a)[0].state) + }; + this.$tokenizeRows = function(a, c) { + var b = [], e = "start", g = false; + if(a > 0 && this.lines[a - 1]) { + e = this.lines[a - 1].state; + g = true + }for(a = a;a <= c;a++) { + if(this.lines[a]) { + d = this.lines[a]; + e = d.state; + b.push(d) + }else { + var d = this.tokenizer.getLineTokens(this.textLines[a] || "", e); + e = d.state; + b.push(d); + if(g) { + this.lines[a] = d + } + } + }return b + } + }).call(f.prototype); + return f +}); \ No newline at end of file diff --git a/build/ace/commands/default_commands.js b/build/ace/commands/default_commands.js new file mode 100644 index 00000000..23655967 --- /dev/null +++ b/build/ace/commands/default_commands.js @@ -0,0 +1,152 @@ +define(function(b) { + b = b("../plugin_manager"); + b.registerCommand("selectall", function(a, c) { + c.selectAll() + }); + b.registerCommand("removeline", function(a) { + a.removeLines() + }); + b.registerCommand("gotoline", function(a) { + var c = parseInt(prompt("Enter line number:")); + isNaN(c) || a.gotoLine(c) + }); + b.registerCommand("togglecomment", function(a) { + a.toggleCommentLines() + }); + b.registerCommand("findnext", function(a) { + a.findNext() + }); + b.registerCommand("findprevious", function(a) { + a.findPrevious() + }); + b.registerCommand("find", function(a) { + var c = prompt("Find:"); + a.find(c) + }); + b.registerCommand("undo", function(a) { + a.undo() + }); + b.registerCommand("redo", function(a) { + a.redo() + }); + b.registerCommand("redo", function(a) { + a.redo() + }); + b.registerCommand("overwrite", function(a) { + a.toggleOverwrite() + }); + b.registerCommand("copylinesup", function(a) { + a.copyLinesUp() + }); + b.registerCommand("movelinesup", function(a) { + a.moveLinesUp() + }); + b.registerCommand("selecttostart", function(a, c) { + c.selectFileStart() + }); + b.registerCommand("gotostart", function(a) { + a.navigateFileStart() + }); + b.registerCommand("selectup", function(a, c) { + c.selectUp() + }); + b.registerCommand("golineup", function(a) { + a.navigateUp() + }); + b.registerCommand("copylinesdown", function(a) { + a.copyLinesDown() + }); + b.registerCommand("movelinesdown", function(a) { + a.moveLinesDown() + }); + b.registerCommand("selecttoend", function(a, c) { + c.selectFileEnd() + }); + b.registerCommand("gotoend", function(a) { + a.navigateFileEnd() + }); + b.registerCommand("selectdown", function(a, c) { + c.selectDown() + }); + b.registerCommand("godown", function(a) { + a.navigateDown() + }); + b.registerCommand("selectwordleft", function(a, c) { + c.selectWordLeft() + }); + b.registerCommand("gotowordleft", function(a) { + a.navigateWordLeft() + }); + b.registerCommand("selecttolinestart", function(a, c) { + c.selectLineStart() + }); + b.registerCommand("gotolinestart", function(a) { + a.navigateLineStart() + }); + b.registerCommand("selectleft", function(a, c) { + c.selectLeft() + }); + b.registerCommand("gotoleft", function(a) { + a.navigateLeft() + }); + b.registerCommand("selectwordright", function(a, c) { + c.selectWordRight() + }); + b.registerCommand("gotowordright", function(a) { + a.navigateWordRight() + }); + b.registerCommand("selecttolineend", function(a, c) { + c.selectLineEnd() + }); + b.registerCommand("gotolineend", function(a) { + a.navigateLineEnd() + }); + b.registerCommand("selectright", function(a, c) { + c.selectRight() + }); + b.registerCommand("gotoright", function(a) { + a.navigateRight() + }); + b.registerCommand("selectpagedown", function(a) { + a.selectPageDown() + }); + b.registerCommand("pagedown", function(a) { + a.scrollPageDown() + }); + b.registerCommand("gotopagedown", function(a) { + a.gotoPageDown() + }); + b.registerCommand("selectpageup", function(a) { + a.selectPageUp() + }); + b.registerCommand("pageup", function(a) { + a.scrollPageUp() + }); + b.registerCommand("gotopageup", function(a) { + a.gotoPageUp() + }); + b.registerCommand("selectlinestart", function(a, c) { + c.selectLineStart() + }); + b.registerCommand("gotolinestart", function(a) { + a.navigateLineStart() + }); + b.registerCommand("selectlineend", function(a, c) { + c.selectLineEnd() + }); + b.registerCommand("gotolineend", function(a) { + a.navigateLineEnd() + }); + b.registerCommand("del", function(a) { + a.removeRight() + }); + b.registerCommand("backspace", function(a) { + a.removeLeft() + }); + b.registerCommand("outdent", function(a) { + a.blockOutdent() + }); + b.registerCommand("indent", function(a) { + a.indent() + }) +}); \ No newline at end of file diff --git a/build/ace/conf/keybindings/default_mac.js b/build/ace/conf/keybindings/default_mac.js new file mode 100644 index 00000000..4903199a --- /dev/null +++ b/build/ace/conf/keybindings/default_mac.js @@ -0,0 +1,5 @@ +define(function() { + return{selectall:"Command-A", removeline:"Command-D", gotoline:"Command-L", togglecomment:"Command-7", findnext:"Command-K", findprevious:"Command-Shift-K", find:"Command-F", replace:"Command-R", undo:"Command-Z", redo:"Command-Shift-Z|Command-Y", overwrite:"Insert", copylinesup:"Command-Option-Up", movelinesup:"Option-Up", selecttostart:"Command-Shift-Up", gotostart:"Command-Home|Command-Up", selectup:"Shift-Up", golineup:"Up", copylinesdown:"Command-Option-Down", movelinesdown:"Option-Down", + selecttoend:"Command-Shift-Down", gotoend:"Command-End|Command-Down", selectdown:"Shift-Down", godown:"Down", selectwordleft:"Option-Shift-Left", gotowordleft:"Option-Left", selecttolinestart:"Command-Shift-Left", gotolinestart:"Command-Left|Home", selectleft:"Shift-Left", gotoleft:"Left", selectwordright:"Option-Shift-Right", gotowordright:"Option-Right", selecttolineend:"Command-Shift-Right", gotolineend:"Command-Right|End", selectright:"Shift-Right", gotoright:"Right", selectpagedown:"Shift-PageDown", + pagedown:"PageDown", selectpageup:"Shift-PageUp", pageup:"PageUp", selectlinestart:"Shift-Home", selectlineend:"Shift-End", del:"Delete", backspace:"Backspace", outdent:"Shift-Tab", indent:"Tab"} +}); \ No newline at end of file diff --git a/build/ace/conf/keybindings/default_win.js b/build/ace/conf/keybindings/default_win.js new file mode 100644 index 00000000..5e2a5ef5 --- /dev/null +++ b/build/ace/conf/keybindings/default_win.js @@ -0,0 +1,5 @@ +define(function() { + return{selectall:"Ctrl-A", removeline:"Ctrl-D", gotoline:"Ctrl-L", togglecomment:"Ctrl-7", findnext:"Ctrl-K", findprevious:"Ctrl-Shift-K", find:"Ctrl-F", replace:"Ctrl-R", undo:"Ctrl-Z", redo:"Ctrl-Shift-Z|Ctrl-Y", overwrite:"Insert", copylinesup:"Ctrl-Alt-Up", movelinesup:"Alt-Up", selecttostart:"Alt-Shift-Up", gotostart:"Ctrl-Home|Ctrl-Up", selectup:"Shift-Up", golineup:"Up", copylinesdown:"Ctrl-Alt-Down", movelinesdown:"Alt-Down", selecttoend:"Alt-Shift-Down", gotoend:"Ctrl-End|Ctrl-Down", selectdown:"Shift-Down", + godown:"Down", selectwordleft:"Ctrl-Shift-Left", gotowordleft:"Ctrl-Left", selecttolinestart:"Ctrl-Shift-Left", gotolinestart:"Alt-Left|Home", selectleft:"Shift-Left", gotoleft:"Left", selectwordright:"Ctrl-Shift-Right", gotowordright:"Ctrl-Right", selecttolineend:"Ctrl-Shift-Right", gotolineend:"Alt-Right|End", selectright:"Shift-Right", gotoright:"Right", selectpagedown:"Shift-PageDown", pagedown:"PageDown", selectpageup:"Shift-PageUp", pageup:"PageUp", selectlinestart:"Shift-Home", selectlineend:"Shift-End", + del:"Delete", backspace:"Backspace", outdent:"Shift-Tab", indent:"Tab"} +}); \ No newline at end of file diff --git a/build/ace/css/editor.css b/build/ace/css/editor.css new file mode 100644 index 00000000..b8125397 --- /dev/null +++ b/build/ace/css/editor.css @@ -0,0 +1,71 @@ +.ace_editor { + position: absolute; + overflow: hidden; + font-family: "Menlo", "Monaco", "Courier New", monospace; + font-size: 12px; +} +.ace_scroller { + position: absolute; + overflow-x: scroll; + overflow-y: hidden; +} +.ace_gutter { + position: absolute; + overflow-x: hidden; + overflow-y: hidden; + height: 100%; +} +.ace_editor .ace_sb { + position: absolute; + overflow-x: hidden; + overflow-y: scroll; + right: 0; +} +.ace_editor .ace_sb div { + position: absolute; + width: 1px; + left: 0px; +} +.ace_editor .ace_printMargin { + position: absolute; + height: 100%; +} +.ace_layer { + z-index: 0; + position: absolute; + overflow: hidden; + white-space: nowrap; + height: 100%; +} +.ace_text-layer { + font-family: Monaco, "Courier New", monospace; + color: black; +} +.ace_cursor-layer { + cursor: text; +} +.ace_cursor { + z-index: 3; + position: absolute; +} +.ace_line { + white-space: nowrap; +} +.ace_marker-layer { +} +.ace_marker-layer .ace_step { + position: absolute; + z-index: 2; +} +.ace_marker-layer .ace_selection { + position: absolute; + z-index: 3; +} +.ace_marker-layer .ace_bracket { + position: absolute; + z-index: 4; +} +.ace_marker-layer .ace_active_line { + position: absolute; + z-index: 1; +} diff --git a/build/ace/document.js b/build/ace/document.js new file mode 100644 index 00000000..d3b0effa --- /dev/null +++ b/build/ace/document.js @@ -0,0 +1,459 @@ +define(function(g) { + var l = g("./lib/oop"), j = g("./lib/lang"), m = g("./event_emitter"), n = g("./selection"), o = g("./mode/text"), h = g("./range"); + g = function(a, b) { + this.modified = true; + this.lines = []; + this.selection = new n(this); + this.$breakpoints = []; + this.listeners = []; + b && this.setMode(b); + j.isArray(a) ? this.$insertLines(0, a) : this.$insert({row:0, column:0}, a) + }; + (function() { + l.implement(this, m); + this.$undoManager = null; + this.$split = function(a) { + return a.split(/\r\n|\r|\n/) + }; + this.setValue = function(a) { + var b = [0, this.lines.length]; + b.push.apply(b, this.$split(a)); + this.lines.splice.apply(this.lines, b); + this.modified = true; + this.fireChangeEvent(0) + }; + this.toString = function() { + return this.lines.join(this.$getNewLineCharacter()) + }; + this.getSelection = function() { + return this.selection + }; + this.fireChangeEvent = function(a, b) { + this.$dispatchEvent("change", {data:{firstRow:a, lastRow:b}}) + }; + this.setUndoManager = function(a) { + this.$undoManager = a; + this.$deltas = []; + this.$informUndoManager && this.$informUndoManager.cancel(); + if(a) { + var b = this; + this.$informUndoManager = j.deferredCall(function() { + b.$deltas.length > 0 && a.execute({action:"aceupdate", args:[b.$deltas, b]}); + b.$deltas = [] + }) + } + }; + this.$defaultUndoManager = {undo:function() { + }, redo:function() { + }}; + this.getUndoManager = function() { + return this.$undoManager || this.$defaultUndoManager + }; + this.getTabString = function() { + return this.getUseSoftTabs() ? j.stringRepeat(" ", this.getTabSize()) : "\t" + }; + this.$useSoftTabs = true; + this.setUseSoftTabs = function(a) { + if(this.$useSoftTabs !== a) { + this.$useSoftTabs = a + } + }; + this.getUseSoftTabs = function() { + return this.$useSoftTabs + }; + this.$tabSize = 4; + this.setTabSize = function(a) { + if(!(isNaN(a) || this.$tabSize === a)) { + this.modified = true; + this.$tabSize = a; + this.$dispatchEvent("changeTabSize") + } + }; + this.getTabSize = function() { + return this.$tabSize + }; + this.getBreakpoints = function() { + return this.$breakpoints + }; + this.setBreakpoints = function(a) { + this.$breakpoints = []; + for(var b = 0;b < a.length;b++) { + this.$breakpoints[a[b]] = true + }this.$dispatchEvent("changeBreakpoint", {}) + }; + this.clearBreakpoints = function() { + this.$breakpoints = []; + this.$dispatchEvent("changeBreakpoint", {}) + }; + this.setBreakpoint = function(a) { + this.$breakpoints[a] = true; + this.$dispatchEvent("changeBreakpoint", {}) + }; + this.clearBreakpoint = function(a) { + delete this.$breakpoints[a]; + this.$dispatchEvent("changeBreakpoint", {}) + }; + this.$detectNewLine = function(a) { + this.$autoNewLine = (a = a.match(/^.*?(\r?\n)/m)) ? a[1] : "\n" + }; + this.tokenRe = /^[\w\d]+/g; + this.nonTokenRe = /^[^\w\d]+/g; + this.getWordRange = function(a, b) { + var c = this.getLine(a), d = false; + if(b > 0) { + d = !!c.charAt(b - 1).match(this.tokenRe) + }d || (d = !!c.charAt(b).match(this.tokenRe)); + d = d ? this.tokenRe : this.nonTokenRe; + var e = b; + if(e > 0) { + do { + e-- + }while(e >= 0 && c.charAt(e).match(d)); + e++ + }for(b = b;b < c.length && c.charAt(b).match(d);) { + b++ + }return new h(a, e, a, b) + }; + this.$getNewLineCharacter = function() { + switch(this.$newLineMode) { + case "windows": + return"\r\n"; + case "unix": + return"\n"; + case "auto": + return this.$autoNewLine + } + }; + this.$autoNewLine = "\n"; + this.$newLineMode = "auto"; + this.setNewLineMode = function(a) { + if(this.$newLineMode !== a) { + this.$newLineMode = a + } + }; + this.getNewLineMode = function() { + return this.$newLineMode + }; + this.$mode = null; + this.setMode = function(a) { + if(this.$mode !== a) { + this.$mode = a; + this.$dispatchEvent("changeMode") + } + }; + this.getMode = function() { + if(!this.$mode) { + this.$mode = new o + }return this.$mode + }; + this.$scrollTop = 0; + this.setScrollTopRow = function(a) { + if(this.$scrollTop !== a) { + this.$scrollTop = a; + this.$dispatchEvent("changeScrollTop") + } + }; + this.getScrollTopRow = function() { + return this.$scrollTop + }; + this.getWidth = function() { + this.$computeWidth(); + return this.width + }; + this.getScreenWidth = function() { + this.$computeWidth(); + return this.screenWith + }; + this.$computeWidth = function() { + if(this.modified) { + this.modified = false; + for(var a = this.lines, b = 0, c = 0, d = this.getTabSize(), e = 0;e < a.length;e++) { + var f = a[e].length; + b = Math.max(b, f); + a[e].replace("\t", function(i) { + f += d - 1; + return i + }); + c = Math.max(c, f) + }this.width = b; + this.screenWith = c + } + }; + this.getLine = function(a) { + return this.lines[a] || "" + }; + this.getDisplayLine = function(a) { + var b = (new Array(this.getTabSize() + 1)).join(" "); + return this.lines[a].replace(/\t/g, b) + }; + this.getLines = function(a, b) { + return this.lines.slice(a, b + 1) + }; + this.getLength = function() { + return this.lines.length + }; + this.getTextRange = function(a) { + if(a.start.row == a.end.row) { + return this.lines[a.start.row].substring(a.start.column, a.end.column) + }else { + var b = []; + b.push(this.lines[a.start.row].substring(a.start.column)); + b.push.apply(b, this.getLines(a.start.row + 1, a.end.row - 1)); + b.push(this.lines[a.end.row].substring(0, a.end.column)); + return b.join(this.$getNewLineCharacter()) + } + }; + this.findMatchingBracket = function(a) { + if(a.column == 0) { + return null + }var b = this.getLine(a.row).charAt(a.column - 1); + if(b == "") { + return null + }b = b.match(/([\(\[\{])|([\)\]\}])/); + if(!b) { + return null + }return b[1] ? this.$findClosingBracket(b[1], a) : this.$findOpeningBracket(b[2], a) + }; + this.$brackets = {")":"(", "(":")", "]":"[", "[":"]", "{":"}", "}":"{"}; + this.$findOpeningBracket = function(a, b) { + var c = this.$brackets[a], d = b.column - 2; + b = b.row; + for(var e = 1, f = this.getLine(b);;) { + for(;d >= 0;) { + var i = f.charAt(d); + if(i == c) { + e -= 1; + if(e == 0) { + return{row:b, column:d} + } + }else { + if(i == a) { + e += 1 + } + }d -= 1 + }b -= 1; + if(b < 0) { + break + }f = this.getLine(b); + d = f.length - 1 + }return null + }; + this.$findClosingBracket = function(a, b) { + var c = this.$brackets[a], d = b.column; + b = b.row; + for(var e = 1, f = this.getLine(b), i = this.getLength();;) { + for(;d < f.length;) { + var k = f.charAt(d); + if(k == c) { + e -= 1; + if(e == 0) { + return{row:b, column:d} + } + }else { + if(k == a) { + e += 1 + } + }d += 1 + }b += 1; + if(b >= i) { + break + }f = this.getLine(b); + d = 0 + }return null + }; + this.insert = function(a, b, c) { + b = this.$insert(a, b, c); + this.fireChangeEvent(a.row, a.row == b.row ? a.row : undefined); + return b + }; + this.$insertLines = function(a, b, c) { + if(b.length != 0) { + var d = [a, 0]; + d.push.apply(d, b); + this.lines.splice.apply(this.lines, d); + if(!c && this.$undoManager) { + c = this.$getNewLineCharacter(); + this.$deltas.push({action:"insertText", range:new h(a, 0, a + b.length, 0), text:b.join(c) + c}); + this.$informUndoManager.schedule() + } + } + }; + this.$insert = function(a, b, c) { + if(b.length == 0) { + return a + }this.modified = true; + this.lines.length <= 1 && this.$detectNewLine(b); + var d = this.$split(b); + if(this.$isNewLine(b)) { + var e = this.lines[a.row] || ""; + this.lines[a.row] = e.substring(0, a.column); + this.lines.splice(a.row + 1, 0, e.substring(a.column)); + d = {row:a.row + 1, column:0} + }else { + if(d.length == 1) { + e = this.lines[a.row] || ""; + this.lines[a.row] = e.substring(0, a.column) + b + e.substring(a.column); + d = {row:a.row, column:a.column + b.length} + }else { + e = this.lines[a.row] || ""; + var f = e.substring(0, a.column) + d[0]; + e = d[d.length - 1] + e.substring(a.column); + this.lines[a.row] = f; + this.$insertLines(a.row + 1, [e], true); + d.length > 2 && this.$insertLines(a.row + 1, d.slice(1, -1), true); + d = {row:a.row + d.length - 1, column:d[d.length - 1].length} + } + }if(!c && this.$undoManager) { + this.$deltas.push({action:"insertText", range:h.fromPoints(a, d), text:b}); + this.$informUndoManager.schedule() + }return d + }; + this.$isNewLine = function(a) { + return a == "\r\n" || a == "\r" || a == "\n" + }; + this.remove = function(a, b) { + if(a.isEmpty()) { + return a.start + }this.$remove(a, b); + this.fireChangeEvent(a.start.row, a.isMultiLine() ? undefined : a.start.row); + return a.start + }; + this.$remove = function(a, b) { + if(!a.isEmpty()) { + if(!b && this.$undoManager) { + this.$getNewLineCharacter(); + this.$deltas.push({action:"removeText", range:a.clone(), text:this.getTextRange(a)}); + this.$informUndoManager.schedule() + }this.modified = true; + b = a.start.row; + var c = a.end.row, d = this.getLine(b).substring(0, a.start.column) + this.getLine(c).substring(a.end.column); + this.lines.splice(b, c - b + 1, d); + return a.start + } + }; + this.undoChanges = function(a) { + this.selection.clearSelection(); + for(var b = a.length - 1;b >= 0;b--) { + var c = a[b]; + if(c.action == "insertText") { + this.remove(c.range, true); + this.selection.moveCursorToPosition(c.range.start) + }else { + this.insert(c.range.start, c.text, true); + this.selection.clearSelection() + } + } + }; + this.redoChanges = function(a) { + this.selection.clearSelection(); + for(var b = 0;b < a.length;b++) { + var c = a[b]; + if(c.action == "insertText") { + this.insert(c.range.start, c.text, true); + this.selection.setSelectionRange(c.range) + }else { + this.remove(c.range, true); + this.selection.moveCursorToPosition(c.range.start) + } + } + }; + this.replace = function(a, b) { + this.$remove(a); + b = b ? this.$insert(a.start, b) : a.start; + var c = a.end.column == 0 ? a.end.column - 1 : a.end.column; + this.fireChangeEvent(a.start.row, c == b.row ? c : undefined); + return b + }; + this.indentRows = function(a, b) { + b.replace("\t", this.getTabString()); + for(var c = a.start.row;c <= a.end.row;c++) { + this.$insert({row:c, column:0}, b) + }this.fireChangeEvent(a.start.row, a.end.row); + return b.length + }; + this.outdentRows = function(a) { + for(var b = new h(0, 0, 0, 0), c = this.getTabSize(), d = a.start.row;d <= a.end.row;++d) { + var e = this.getLine(d); + b.start.row = d; + b.end.row = d; + for(var f = 0;f < c;++f) { + if(e.charAt(f) != " ") { + break + } + }if(f < c && e.charAt(f) == "\t") { + b.start.column = f; + b.end.column = f + 1 + }else { + b.start.column = 0; + b.end.column = f + }if(d == a.start.row) { + a.start.column -= b.end.column - b.start.column + }if(d == a.end.row) { + a.end.column -= b.end.column - b.start.column + }this.$remove(b) + }this.fireChangeEvent(a.start.row, a.end.row); + return a + }; + this.moveLinesUp = function(a, b) { + if(a <= 0) { + return 0 + }var c = this.lines.slice(a, b + 1); + this.$remove(new h(a, 0, b + 1, 0)); + this.$insertLines(a - 1, c); + this.fireChangeEvent(a - 1, b); + return-1 + }; + this.moveLinesDown = function(a, b) { + if(b >= this.lines.length - 1) { + return 0 + }var c = this.lines.slice(a, b + 1); + this.$remove(new h(a, 0, b + 1, 0)); + this.$insertLines(a + 1, c); + this.fireChangeEvent(a, b + 1); + return 1 + }; + this.duplicateLines = function(a, b) { + a = this.$clipRowToDocument(a); + b = this.$clipRowToDocument(b); + var c = this.getLines(a, b); + this.$insertLines(a, c); + b = b - a + 1; + this.fireChangeEvent(a); + return b + }; + this.$clipRowToDocument = function(a) { + return Math.max(0, Math.min(a, this.lines.length - 1)) + }; + this.documentToScreenColumn = function(a, b) { + var c = this.getTabSize(), d = 0; + b = b; + a = this.getLine(a).split("\t"); + for(var e = 0;e < a.length;e++) { + var f = a[e].length; + if(b > f) { + b -= f + 1; + d += f + c + }else { + d += b; + break + } + }return d + }; + this.screenToDocumentColumn = function(a, b) { + var c = this.getTabSize(), d = 0; + b = b; + a = this.getLine(a).split("\t"); + for(var e = 0;e < a.length;e++) { + var f = a[e].length; + if(b >= f + c) { + b -= f + c; + d += f + 1 + }else { + d += b > f ? f : b; + break + } + }return d + } + }).call(g.prototype); + return g +}); \ No newline at end of file diff --git a/build/ace/editor.js b/build/ace/editor.js new file mode 100644 index 00000000..55fe732c --- /dev/null +++ b/build/ace/editor.js @@ -0,0 +1,3413 @@ +/* + RequireJS text Copyright (c) 2010, The Dojo Foundation All Rights Reserved. + Available via the MIT or new BSD license. + see: http://github.com/jrburke/requirejs for details +*/ +(function() { + var h = ["Msxml2.XMLHTTP", "Microsoft.XMLHTTP", "Msxml2.XMLHTTP.4.0"], g = /^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im, e = /]*>\s*([\s\S]+)\s*<\/body>/im; + if(!require.textStrip) { + require.textStrip = function(d) { + if(d) { + d = d.replace(g, ""); + var i = d.match(e); + if(i) { + d = i[1] + } + }else { + d = "" + }return d + } + }if(!require.getXhr) { + require.getXhr = function() { + var d, i, c; + if(typeof XMLHttpRequest !== "undefined") { + return new XMLHttpRequest + }else { + for(i = 0;i < 3;i++) { + c = h[i]; + try { + d = new ActiveXObject(c) + }catch(j) { + }if(d) { + h = [c]; + break + } + } + }if(!d) { + throw new Error("require.getXhr(): XMLHttpRequest not available"); + }return d + } + }if(!require.fetchText) { + require.fetchText = function(d, i) { + var c = require.getXhr(); + c.open("GET", d, true); + c.onreadystatechange = function() { + c.readyState === 4 && i(c.responseText) + }; + c.send(null) + } + }require.plugin({prefix:"text", require:function() { + }, newContext:function(d) { + require.mixin(d, {text:{}, textWaiting:[]}) + }, load:function(d, i) { + var c = false, j = null, a, f = d.indexOf("."), m = d.substring(0, f), n = d.substring(f + 1, d.length), b = require.s.contexts[i], k = b.textWaiting; + f = n.indexOf("!"); + if(f !== -1) { + c = n.substring(f + 1, n.length); + n = n.substring(0, f); + f = c.indexOf("!"); + if(f !== -1 && c.substring(0, f) === "strip") { + j = c.substring(f + 1, c.length); + c = "strip" + }else { + if(c !== "strip") { + j = c; + c = null + } + } + }a = m + "!" + n; + f = c ? a + "!" + c : a; + if(j !== null && !b.text[a]) { + b.defined[d] = b.text[a] = j + }else { + if(!b.text[a] && !b.textWaiting[a] && !b.textWaiting[f]) { + k[f] || (k[f] = k[k.push({name:d, key:a, fullKey:f, strip:!!c}) - 1]); + i = require.nameToUrl(m, "." + n, i); + b.loaded[d] = false; + require.fetchText(i, function(p) { + b.text[a] = p; + b.loaded[d] = true + }) + } + } + }, checkDeps:function() { + }, isWaiting:function(d) { + return!!d.textWaiting.length + }, orderDeps:function(d) { + var i, c, j, a = d.textWaiting; + d.textWaiting = []; + for(i = 0;c = a[i];i++) { + j = d.text[c.key]; + d.defined[c.name] = c.strip ? require.textStrip(j) : j + } + }}) +})(); +define("ace/lib/oop", ["require", "exports", "module"], function() { + var h = {}; + h.inherits = function(g, e) { + var d = function() { + }; + d.prototype = e.prototype; + g.super_ = e.prototype; + g.prototype = new d; + g.prototype.constructor = g + }; + h.mixin = function(g, e) { + for(var d in e) { + g[d] = e[d] + } + }; + h.implement = function(g, e) { + h.mixin(g, e) + }; + return h +}); +define("ace/lib/core", ["require", "exports", "module"], function() { + var h = {}, g = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase(); + h.isWin = g == "win"; + h.isMac = g == "mac"; + h.isLinux = g == "linux"; + h.isIE = !+"\u000b1"; + h.isGecko = window.controllers && window.navigator.product === "Gecko"; + h.provide = function(e) { + e = e.split("."); + for(var d = window, i = 0;i < e.length;i++) { + var c = e[i]; + d[c] || (d[c] = {}); + d = d[c] + } + }; + return h +}); +define("ace/lib/event", ["require", "exports", "module", "./core"], function(h) { + var g = h("./core"), e = {}; + e.addListener = function(d, i, c) { + if(d.addEventListener) { + return d.addEventListener(i, c, false) + }if(d.attachEvent) { + var j = function() { + c(window.event) + }; + c.$$wrapper = j; + d.attachEvent("on" + i, j) + } + }; + e.removeListener = function(d, i, c) { + if(d.removeEventListener) { + return d.removeEventListener(i, c, false) + }if(d.detachEvent) { + d.detachEvent("on" + i, c.$$wrapper || c) + } + }; + e.stopEvent = function(d) { + e.stopPropagation(d); + e.preventDefault(d); + return false + }; + e.stopPropagation = function(d) { + if(d.stopPropagation) { + d.stopPropagation() + }else { + d.cancelBubble = true + } + }; + e.preventDefault = function(d) { + if(d.preventDefault) { + d.preventDefault() + }else { + d.returnValue = false + } + }; + e.getDocumentX = function(d) { + return d.clientX ? d.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) : d.pageX + }; + e.getDocumentY = function(d) { + return d.clientY ? d.clientY + (document.documentElement.scrollTop || document.body.scrollTop) : d.pageX + }; + e.getButton = function(d) { + return d.preventDefault ? d.button : Math.max(d.button - 1, 2) + }; + e.capture = document.documentElement.setCapture ? function(d, i, c) { + function j(a) { + i && i(a); + c && c(); + e.removeListener(d, "mousemove", i); + e.removeListener(d, "mouseup", j); + e.removeListener(d, "losecapture", j); + d.releaseCapture() + } + e.addListener(d, "mousemove", i); + e.addListener(d, "mouseup", j); + e.addListener(d, "losecapture", j); + d.setCapture() + } : function(d, i, c) { + function j(f) { + i(f); + f.stopPropagation() + } + function a(f) { + i && i(f); + c && c(); + document.removeEventListener("mousemove", j, true); + document.removeEventListener("mouseup", a, true); + f.stopPropagation() + } + document.addEventListener("mousemove", j, true); + document.addEventListener("mouseup", a, true) + }; + e.addMouseWheelListener = function(d, i) { + var c = function(j) { + if(j.wheelDelta !== undefined) { + if(j.wheelDeltaX !== undefined) { + j.wheelX = -j.wheelDeltaX / 8; + j.wheelY = -j.wheelDeltaY / 8 + }else { + j.wheelX = 0; + j.wheelY = -j.wheelDelta / 8 + } + }else { + if(j.axis && j.axis == j.HORIZONTAL_AXIS) { + j.wheelX = (j.detail || 0) * 5; + j.wheelY = 0 + }else { + j.wheelX = 0; + j.wheelY = (j.detail || 0) * 5 + } + }i(j) + }; + e.addListener(d, "DOMMouseScroll", c); + e.addListener(d, "mousewheel", c) + }; + e.addMultiMouseDownListener = function(d, i, c, j, a) { + var f = 0, m, n, b = function(k) { + f += 1; + if(f == 1) { + m = k.clientX; + n = k.clientY; + setTimeout(function() { + f = 0 + }, j || 600) + }if(e.getButton(k) != i || Math.abs(k.clientX - m) > 5 || Math.abs(k.clientY - n) > 5) { + f = 0 + }if(f == c) { + f = 0; + a(k) + }return e.preventDefault(k) + }; + e.addListener(d, "mousedown", b); + g.isIE && e.addListener(d, "dblclick", b) + }; + e.addKeyListener = function(d, i) { + var c = null; + e.addListener(d, "keydown", function(j) { + c = j.keyIdentifier || j.keyCode; + return i(j) + }); + g.isMac && g.isGecko && e.addListener(d, "keypress", function(j) { + if(c !== (j.keyIdentifier || j.keyCode)) { + return i(j) + }else { + c = null + } + }) + }; + return e +}); +define("ace/lib/lang", ["require", "exports", "module"], function() { + var h = {}; + h.stringReverse = function(g) { + return g.split("").reverse().join("") + }; + h.stringRepeat = function(g, e) { + return(new Array(e + 1)).join(g) + }; + h.arrayIndexOf = Array.prototype.indexOf ? function(g, e) { + return g.indexOf(e) + } : function(g, e) { + for(var d = 0;d < g.length;d++) { + if(g[d] == e) { + return d + } + }return-1 + }; + h.isArray = function(g) { + return Object.prototype.toString.call(g) == "[object Array]" + }; + h.copyObject = function(g) { + var e = {}; + for(var d in g) { + e[d] = g[d] + }return e + }; + h.arrayToMap = function(g) { + for(var e = {}, d = 0;d < g.length;d++) { + e[g[d]] = 1 + }return e + }; + h.escapeRegExp = function(g) { + return g.replace(/([.*+?^${}()|[\]\/\\])/g, "\\$1") + }; + h.bind = function(g, e) { + return function() { + return g.apply(e, arguments) + } + }; + h.deferredCall = function(g) { + var e = null, d = function() { + e = null; + g() + }; + return{schedule:function() { + e || (e = setTimeout(d, 0)) + }, call:function() { + h.cancel(); + g() + }, cancel:function() { + clearTimeout(e); + e = null + }} + }; + return h +}); +define("ace/textinput", ["require", "exports", "module", "./lib/event"], function(h) { + var g = h("./lib/event"); + return function(e, d) { + function i() { + if(!m) { + var k = c.value; + if(k) { + if(k.charCodeAt(k.length - 1) == a.charCodeAt(0)) { + (k = k.slice(0, -1)) && d.onTextInput(k) + }else { + d.onTextInput(k) + } + } + }m = false; + c.value = a; + c.select() + } + var c = document.createElement("textarea"), j = c.style; + j.position = "absolute"; + j.left = "-10000px"; + j.top = "-10000px"; + e.appendChild(c); + var a = String.fromCharCode(0); + i(); + var f = false, m = false, n = function() { + setTimeout(function() { + f || i() + }, 0) + }, b = function() { + d.onCompositionUpdate(c.value) + }; + g.addListener(c, "keypress", n); + g.addListener(c, "textInput", n); + g.addListener(c, "paste", n); + g.addListener(c, "propertychange", n); + g.addListener(c, "copy", function() { + m = true; + c.value = d.getCopyText(); + c.select(); + m = true; + setTimeout(i, 0) + }); + g.addListener(c, "cut", function() { + m = true; + c.value = d.getCopyText(); + d.onCut(); + c.select(); + setTimeout(i, 0) + }); + g.addListener(c, "compositionstart", function() { + f = true; + i(); + c.value = ""; + d.onCompositionStart(); + setTimeout(b, 0) + }); + g.addListener(c, "compositionupdate", b); + g.addListener(c, "compositionend", function() { + f = false; + d.onCompositionEnd(); + n() + }); + g.addListener(c, "blur", function() { + d.onBlur() + }); + g.addListener(c, "focus", function() { + d.onFocus(); + c.select() + }); + this.focus = function() { + d.onFocus(); + c.select(); + c.focus() + }; + this.blur = function() { + c.blur() + } + } +}); +define("ace/conf/keybindings/default_mac", ["require", "exports", "module"], function() { + return{selectall:"Command-A", removeline:"Command-D", gotoline:"Command-L", togglecomment:"Command-7", findnext:"Command-K", findprevious:"Command-Shift-K", find:"Command-F", replace:"Command-R", undo:"Command-Z", redo:"Command-Shift-Z|Command-Y", overwrite:"Insert", copylinesup:"Command-Option-Up", movelinesup:"Option-Up", selecttostart:"Command-Shift-Up", gotostart:"Command-Home|Command-Up", selectup:"Shift-Up", golineup:"Up", copylinesdown:"Command-Option-Down", movelinesdown:"Option-Down", + selecttoend:"Command-Shift-Down", gotoend:"Command-End|Command-Down", selectdown:"Shift-Down", godown:"Down", selectwordleft:"Option-Shift-Left", gotowordleft:"Option-Left", selecttolinestart:"Command-Shift-Left", gotolinestart:"Command-Left|Home", selectleft:"Shift-Left", gotoleft:"Left", selectwordright:"Option-Shift-Right", gotowordright:"Option-Right", selecttolineend:"Command-Shift-Right", gotolineend:"Command-Right|End", selectright:"Shift-Right", gotoright:"Right", selectpagedown:"Shift-PageDown", + pagedown:"PageDown", selectpageup:"Shift-PageUp", pageup:"PageUp", selectlinestart:"Shift-Home", selectlineend:"Shift-End", del:"Delete", backspace:"Backspace", outdent:"Shift-Tab", indent:"Tab"} +}); +define("ace/conf/keybindings/default_win", ["require", "exports", "module"], function() { + return{selectall:"Ctrl-A", removeline:"Ctrl-D", gotoline:"Ctrl-L", togglecomment:"Ctrl-7", findnext:"Ctrl-K", findprevious:"Ctrl-Shift-K", find:"Ctrl-F", replace:"Ctrl-R", undo:"Ctrl-Z", redo:"Ctrl-Shift-Z|Ctrl-Y", overwrite:"Insert", copylinesup:"Ctrl-Alt-Up", movelinesup:"Alt-Up", selecttostart:"Alt-Shift-Up", gotostart:"Ctrl-Home|Ctrl-Up", selectup:"Shift-Up", golineup:"Up", copylinesdown:"Ctrl-Alt-Down", movelinesdown:"Alt-Down", selecttoend:"Alt-Shift-Down", gotoend:"Ctrl-End|Ctrl-Down", selectdown:"Shift-Down", + godown:"Down", selectwordleft:"Ctrl-Shift-Left", gotowordleft:"Ctrl-Left", selecttolinestart:"Ctrl-Shift-Left", gotolinestart:"Alt-Left|Home", selectleft:"Shift-Left", gotoleft:"Left", selectwordright:"Ctrl-Shift-Right", gotowordright:"Ctrl-Right", selecttolineend:"Ctrl-Shift-Right", gotolineend:"Alt-Right|End", selectright:"Shift-Right", gotoright:"Right", selectpagedown:"Shift-PageDown", pagedown:"PageDown", selectpageup:"Shift-PageUp", pageup:"PageUp", selectlinestart:"Shift-Home", selectlineend:"Shift-End", + del:"Delete", backspace:"Backspace", outdent:"Shift-Tab", indent:"Tab"} +}); +define("ace/plugin_manager", ["require", "exports", "module"], function() { + return{commands:{}, registerCommand:function(h, g) { + this.commands[h] = g + }} +}); +define("ace/commands/default_commands", ["require", "exports", "module", "../plugin_manager"], function(h) { + h = h("../plugin_manager"); + h.registerCommand("selectall", function(g, e) { + e.selectAll() + }); + h.registerCommand("removeline", function(g) { + g.removeLines() + }); + h.registerCommand("gotoline", function(g) { + var e = parseInt(prompt("Enter line number:")); + isNaN(e) || g.gotoLine(e) + }); + h.registerCommand("togglecomment", function(g) { + g.toggleCommentLines() + }); + h.registerCommand("findnext", function(g) { + g.findNext() + }); + h.registerCommand("findprevious", function(g) { + g.findPrevious() + }); + h.registerCommand("find", function(g) { + var e = prompt("Find:"); + g.find(e) + }); + h.registerCommand("undo", function(g) { + g.undo() + }); + h.registerCommand("redo", function(g) { + g.redo() + }); + h.registerCommand("redo", function(g) { + g.redo() + }); + h.registerCommand("overwrite", function(g) { + g.toggleOverwrite() + }); + h.registerCommand("copylinesup", function(g) { + g.copyLinesUp() + }); + h.registerCommand("movelinesup", function(g) { + g.moveLinesUp() + }); + h.registerCommand("selecttostart", function(g, e) { + e.selectFileStart() + }); + h.registerCommand("gotostart", function(g) { + g.navigateFileStart() + }); + h.registerCommand("selectup", function(g, e) { + e.selectUp() + }); + h.registerCommand("golineup", function(g) { + g.navigateUp() + }); + h.registerCommand("copylinesdown", function(g) { + g.copyLinesDown() + }); + h.registerCommand("movelinesdown", function(g) { + g.moveLinesDown() + }); + h.registerCommand("selecttoend", function(g, e) { + e.selectFileEnd() + }); + h.registerCommand("gotoend", function(g) { + g.navigateFileEnd() + }); + h.registerCommand("selectdown", function(g, e) { + e.selectDown() + }); + h.registerCommand("godown", function(g) { + g.navigateDown() + }); + h.registerCommand("selectwordleft", function(g, e) { + e.selectWordLeft() + }); + h.registerCommand("gotowordleft", function(g) { + g.navigateWordLeft() + }); + h.registerCommand("selecttolinestart", function(g, e) { + e.selectLineStart() + }); + h.registerCommand("gotolinestart", function(g) { + g.navigateLineStart() + }); + h.registerCommand("selectleft", function(g, e) { + e.selectLeft() + }); + h.registerCommand("gotoleft", function(g) { + g.navigateLeft() + }); + h.registerCommand("selectwordright", function(g, e) { + e.selectWordRight() + }); + h.registerCommand("gotowordright", function(g) { + g.navigateWordRight() + }); + h.registerCommand("selecttolineend", function(g, e) { + e.selectLineEnd() + }); + h.registerCommand("gotolineend", function(g) { + g.navigateLineEnd() + }); + h.registerCommand("selectright", function(g, e) { + e.selectRight() + }); + h.registerCommand("gotoright", function(g) { + g.navigateRight() + }); + h.registerCommand("selectpagedown", function(g) { + g.selectPageDown() + }); + h.registerCommand("pagedown", function(g) { + g.scrollPageDown() + }); + h.registerCommand("gotopagedown", function(g) { + g.gotoPageDown() + }); + h.registerCommand("selectpageup", function(g) { + g.selectPageUp() + }); + h.registerCommand("pageup", function(g) { + g.scrollPageUp() + }); + h.registerCommand("gotopageup", function(g) { + g.gotoPageUp() + }); + h.registerCommand("selectlinestart", function(g, e) { + e.selectLineStart() + }); + h.registerCommand("gotolinestart", function(g) { + g.navigateLineStart() + }); + h.registerCommand("selectlineend", function(g, e) { + e.selectLineEnd() + }); + h.registerCommand("gotolineend", function(g) { + g.navigateLineEnd() + }); + h.registerCommand("del", function(g) { + g.removeRight() + }); + h.registerCommand("backspace", function(g) { + g.removeLeft() + }); + h.registerCommand("outdent", function(g) { + g.blockOutdent() + }); + h.registerCommand("indent", function(g) { + g.indent() + }) +}); +define("ace/keybinding", ["require", "exports", "module", "./lib/core", "./lib/event", "./conf/keybindings/default_mac", "./conf/keybindings/default_win", "./plugin_manager", "./commands/default_commands"], function(h) { + var g = h("./lib/core"), e = h("./lib/event"), d = h("./conf/keybindings/default_mac"), i = h("./conf/keybindings/default_win"), c = h("./plugin_manager"); + h("./commands/default_commands"); + h = function(j, a, f) { + this.setConfig(f); + var m = this; + e.addKeyListener(j, function(n) { + var b = (m.config.reverse[0 | (n.ctrlKey ? 1 : 0) | (n.altKey ? 2 : 0) | (n.shiftKey ? 4 : 0) | (n.metaKey ? 8 : 0)] || {})[(m.keyNames[n.keyCode] || String.fromCharCode(n.keyCode)).toLowerCase()]; + if(b = c.commands[b]) { + b(a, a.getSelection()); + return e.stopEvent(n) + } + }) + }; + (function() { + function j(m, n, b, k) { + return(k && m.toLowerCase() || m).replace(/(?:^\s+|\n|\s+$)/g, "").split(new RegExp("[\\s ]*" + n + "[\\s ]*", "g"), b || 999) + } + function a(m, n, b) { + var k, p = 0; + m = j(m, "\\-", null, true); + for(var o = 0, l = m.length;o < l;++o) { + if(this.keyMods[m[o]]) { + p |= this.keyMods[m[o]] + }else { + k = m[o] || "-" + } + }(b[p] || (b[p] = {}))[k] = n; + return b + } + function f(m, n) { + var b, k, p, o, l = {}; + for(b in m) { + o = m[b]; + if(n && typeof o == "string") { + o = o.split(n); + k = 0; + for(p = o.length;k < p;++k) { + a.call(this, o[k], b, l) + } + }else { + a.call(this, o, b, l) + } + }return l + } + this.keyMods = {ctrl:1, alt:2, option:2, shift:4, meta:8, command:8}; + this.keyNames = {"8":"Backspace", "9":"Tab", "13":"Enter", "27":"Esc", "32":"Space", "33":"PageUp", "34":"PageDown", "35":"End", "36":"Home", "37":"Left", "38":"Up", "39":"Right", "40":"Down", "45":"Insert", "46":"Delete", "107":"+", "112":"F1", "113":"F2", "114":"F3", "115":"F4", "116":"F5", "117":"F6", "118":"F7", "119":"F8", "120":"F9", "121":"F10", "122":"F11", "123":"F12"}; + this.setConfig = function(m) { + this.config = m || (g.isMac ? d : i); + if(typeof this.config.reverse == "undefined") { + this.config.reverse = f.call(this, this.config, "|") + } + } + }).call(h.prototype); + return h +}); +define("ace/event_emitter", ["require", "exports", "module", "./lib/lang"], function(h) { + var g = h("./lib/lang"); + h = {}; + h.$dispatchEvent = function(e, d) { + this.$eventRegistry = this.$eventRegistry || {}; + var i = this.$eventRegistry[e]; + if(i && i.length) { + d = d || {}; + d.type = e; + for(e = 0;e < i.length;e++) { + i[e](d) + } + } + }; + h.on = h.addEventListener = function(e, d) { + this.$eventRegistry = this.$eventRegistry || {}; + var i = this.$eventRegistry[e]; + i || (i = this.$eventRegistry[e] = []); + g.arrayIndexOf(i, d) == -1 && i.push(d) + }; + h.removeEventListener = function(e, d) { + this.$eventRegistry = this.$eventRegistry || {}; + if(e = this.$eventRegistry[e]) { + d = g.arrayIndexOf(e, d); + d !== -1 && e.splice(d, 1) + } + }; + return h +}); +define("ace/range", ["require", "exports", "module"], function() { + var h = function(g, e, d, i) { + this.start = {row:g, column:e}; + this.end = {row:d, column:i} + }; + (function() { + this.toString = function() { + return"Range: [" + this.start.row + "/" + this.start.column + "] -> [" + this.end.row + "/" + this.end.column + "]" + }; + this.contains = function(g, e) { + return this.compare(g, e) == 0 + }; + this.compare = function(g, e) { + if(!this.isMultiLine()) { + if(g === this.start.row) { + return e < this.start.column ? -1 : e > this.end.column ? 1 : 0 + } + }if(g < this.start.row) { + return-1 + }if(g > this.end.row) { + return 1 + }if(this.start.row === g) { + return e >= this.start.column ? 0 : -1 + }if(this.end.row === g) { + return e <= this.end.column ? 0 : 1 + }return 0 + }; + this.clipRows = function(g, e) { + if(this.end.row > e) { + var d = {row:e + 1, column:0} + }if(this.start.row > e) { + var i = {row:e + 1, column:0} + }if(this.start.row < g) { + i = {row:g, column:0} + }if(this.end.row < g) { + d = {row:g, column:0} + }return h.fromPoints(i || this.start, d || this.end) + }; + this.extend = function(g, e) { + var d = this.compare(g, e); + if(d == 0) { + return this + }else { + if(d == -1) { + var i = {row:g, column:e} + }else { + var c = {row:g, column:e} + } + }return h.fromPoints(i || this.start, c || 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 h.fromPoints(this.start, this.end) + }; + this.toScreenRange = function(g) { + return new h(this.start.row, g.documentToScreenColumn(this.start.row, this.start.column), this.end.row, g.documentToScreenColumn(this.end.row, this.end.column)) + } + }).call(h.prototype); + h.fromPoints = function(g, e) { + return new h(g.row, g.column, e.row, e.column) + }; + return h +}); +define("ace/selection", ["require", "exports", "module", "./lib/oop", "./lib/lang", "./event_emitter", "./range"], function(h) { + var g = h("./lib/oop"), e = h("./lib/lang"), d = h("./event_emitter"), i = h("./range"); + h = function(c) { + this.doc = c; + this.clearSelection(); + this.selectionLead = {row:0, column:0} + }; + (function() { + g.implement(this, d); + this.isEmpty = function() { + return!this.selectionAnchor || this.selectionAnchor.row == this.selectionLead.row && this.selectionAnchor.column == this.selectionLead.column + }; + this.isMultiLine = function() { + if(this.isEmpty()) { + return false + }return this.getRange().isMultiLine() + }; + this.getCursor = function() { + return this.selectionLead + }; + this.setSelectionAnchor = function(c, j) { + c = this.$clipPositionToDocument(c, j); + if(this.selectionAnchor) { + if(this.selectionAnchor.row !== c.row || this.selectionAnchor.column !== c.column) { + this.selectionAnchor = c; + this.$dispatchEvent("changeSelection", {}) + } + }else { + this.selectionAnchor = c; + this.$dispatchEvent("changeSelection", {}) + } + }; + this.getSelectionAnchor = function() { + return this.selectionAnchor ? this.$clone(this.selectionAnchor) : this.$clone(this.selectionLead) + }; + this.getSelectionLead = function() { + return this.$clone(this.selectionLead) + }; + this.shiftSelection = function(c) { + if(this.isEmpty()) { + this.moveCursorTo(this.selectionLead.row, this.selectionLead.column + c) + }else { + var j = this.getSelectionAnchor(), a = this.getSelectionLead(), f = this.isBackwards(); + if(!f || j.column !== 0) { + this.setSelectionAnchor(j.row, j.column + c) + }if(f || a.column !== 0) { + this.$moveSelection(function() { + this.moveCursorTo(a.row, a.column + c) + }) + } + } + }; + this.isBackwards = function() { + var c = this.selectionAnchor || this.selectionLead, j = this.selectionLead; + return c.row > j.row || c.row == j.row && c.column > j.column + }; + this.getRange = function() { + var c = this.selectionAnchor || this.selectionLead, j = this.selectionLead; + return this.isBackwards() ? i.fromPoints(j, c) : i.fromPoints(c, j) + }; + this.clearSelection = function() { + if(this.selectionAnchor) { + this.selectionAnchor = null; + this.$dispatchEvent("changeSelection", {}) + } + }; + this.selectAll = function() { + var c = this.doc.getLength() - 1; + this.setSelectionAnchor(c, this.doc.getLine(c).length); + this.$moveSelection(function() { + this.moveCursorTo(0, 0) + }) + }; + this.setSelectionRange = function(c, j) { + if(j) { + this.setSelectionAnchor(c.end.row, c.end.column); + this.selectTo(c.start.row, c.start.column) + }else { + this.setSelectionAnchor(c.start.row, c.start.column); + this.selectTo(c.end.row, c.end.column) + } + }; + this.$moveSelection = function(c) { + var j = false; + if(!this.selectionAnchor) { + j = true; + this.selectionAnchor = this.$clone(this.selectionLead) + }var a = this.$clone(this.selectionLead); + c.call(this); + if(a.row !== this.selectionLead.row || a.column !== this.selectionLead.column) { + j = true + }j && this.$dispatchEvent("changeSelection", {}) + }; + this.selectTo = function(c, j) { + this.$moveSelection(function() { + this.moveCursorTo(c, j) + }) + }; + this.selectToPosition = function(c) { + this.$moveSelection(function() { + this.moveCursorToPosition(c) + }) + }; + 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.selectWord = function() { + var c = this.selectionLead; + this.setSelectionRange(this.doc.getWordRange(c.row, c.column)) + }; + this.selectLine = function() { + this.setSelectionAnchor(this.selectionLead.row, 0); + this.$moveSelection(function() { + this.moveCursorTo(this.selectionLead.row + 1, 0) + }) + }; + this.moveCursorUp = function() { + this.moveCursorBy(-1, 0) + }; + this.moveCursorDown = function() { + this.moveCursorBy(1, 0) + }; + this.moveCursorLeft = function() { + if(this.selectionLead.column == 0) { + this.selectionLead.row > 0 && this.moveCursorTo(this.selectionLead.row - 1, this.doc.getLine(this.selectionLead.row - 1).length) + }else { + this.moveCursorBy(0, -1) + } + }; + this.moveCursorRight = function() { + if(this.selectionLead.column == this.doc.getLine(this.selectionLead.row).length) { + this.selectionLead.row < this.doc.getLength() - 1 && this.moveCursorTo(this.selectionLead.row + 1, 0) + }else { + this.moveCursorBy(0, 1) + } + }; + this.moveCursorLineStart = function() { + var c = this.selectionLead.row, j = this.selectionLead.column, a = this.doc.getLine(c).slice(0, j).match(/^\s*/); + if(a[0].length == 0) { + this.moveCursorTo(c, this.doc.getLine(c).match(/^\s*/)[0].length) + }else { + a[0].length >= j ? this.moveCursorTo(c, 0) : this.moveCursorTo(c, a[0].length) + } + }; + this.moveCursorLineEnd = function() { + this.moveCursorTo(this.selectionLead.row, this.doc.getLine(this.selectionLead.row).length) + }; + this.moveCursorFileEnd = function() { + var c = this.doc.getLength() - 1, j = this.doc.getLine(c).length; + this.moveCursorTo(c, j) + }; + this.moveCursorFileStart = function() { + this.moveCursorTo(0, 0) + }; + this.moveCursorWordRight = function() { + var c = this.selectionLead.row, j = this.selectionLead.column, a = this.doc.getLine(c), f = a.substring(j); + this.doc.nonTokenRe.lastIndex = 0; + this.doc.tokenRe.lastIndex = 0; + if(j == a.length) { + this.moveCursorRight() + }else { + if(this.doc.nonTokenRe.exec(f)) { + j += this.doc.nonTokenRe.lastIndex; + this.doc.nonTokenRe.lastIndex = 0 + }else { + if(this.doc.tokenRe.exec(f)) { + j += this.doc.tokenRe.lastIndex; + this.doc.tokenRe.lastIndex = 0 + } + }this.moveCursorTo(c, j) + } + }; + this.moveCursorWordLeft = function() { + var c = this.selectionLead.row, j = this.selectionLead.column, a = this.doc.getLine(c); + a = e.stringReverse(a.substring(0, j)); + this.doc.nonTokenRe.lastIndex = 0; + this.doc.tokenRe.lastIndex = 0; + if(j == 0) { + this.moveCursorLeft() + }else { + if(this.doc.nonTokenRe.exec(a)) { + j -= this.doc.nonTokenRe.lastIndex; + this.doc.nonTokenRe.lastIndex = 0 + }else { + if(this.doc.tokenRe.exec(a)) { + j -= this.doc.tokenRe.lastIndex; + this.doc.tokenRe.lastIndex = 0 + } + }this.moveCursorTo(c, j) + } + }; + this.moveCursorBy = function(c, j) { + this.moveCursorTo(this.selectionLead.row + c, this.selectionLead.column + j) + }; + this.moveCursorToPosition = function(c) { + this.moveCursorTo(c.row, c.column) + }; + this.moveCursorTo = function(c, j) { + c = this.$clipPositionToDocument(c, j); + if(c.row !== this.selectionLead.row || c.column !== this.selectionLead.column) { + this.selectionLead = c; + this.$dispatchEvent("changeCursor", {data:this.getCursor()}) + } + }; + this.moveCursorUp = function() { + this.moveCursorBy(-1, 0) + }; + this.$clipPositionToDocument = function(c, j) { + var a = {}; + if(c >= this.doc.getLength()) { + a.row = Math.max(0, this.doc.getLength() - 1); + a.column = this.doc.getLine(a.row).length + }else { + if(c < 0) { + a.row = 0; + a.column = 0 + }else { + a.row = c; + a.column = Math.min(this.doc.getLine(a.row).length, Math.max(0, j)) + } + }return a + }; + this.$clone = function(c) { + return{row:c.row, column:c.column} + } + }).call(h.prototype); + return h +}); +define("ace/tokenizer", ["require", "exports", "module"], function() { + var h = function(g) { + this.rules = g; + this.regExps = {}; + for(var e in this.rules) { + g = this.rules[e]; + for(var d = [], i = 0;i < g.length;i++) { + d.push(g[i].regex) + }this.regExps[e] = new RegExp("(?:(" + d.join(")|(") + ")|(.))", "g") + } + }; + (function() { + this.getLineTokens = function(g, e) { + e = e; + var d = this.rules[e], i = this.regExps[e]; + i.lastIndex = 0; + for(var c, j = [], a = 0, f = {type:null, value:""};c = i.exec(g);) { + var m = "text", n = c[0]; + if(i.lastIndex == a) { + throw new Error("tokenizer error"); + }a = i.lastIndex; + window.LOG && console.log(e, c); + for(var b = 0;b < d.length;b++) { + if(c[b + 1]) { + m = typeof d[b].token == "function" ? d[b].token(c[0]) : d[b].token; + if(d[b].next && d[b].next !== e) { + e = d[b].next; + d = this.rules[e]; + a = i.lastIndex; + i = this.regExps[e]; + i.lastIndex = a + }break + } + }if(f.type !== m) { + f.type && j.push(f); + f = {type:m, value:n} + }else { + f.value += n + } + }f.type && j.push(f); + window.LOG && console.log(j, e); + return{tokens:j, state:e} + } + }).call(h.prototype); + return h +}); +define("ace/mode/text_highlight_rules", ["require", "exports", "module"], function() { + var h = function() { + this.$rules = {start:[{token:"text", regex:".+"}]} + }; + (function() { + this.addRules = function(g, e) { + for(var d in g) { + for(var i = g[d], c = 0;c < i.length;c++) { + var j = i[c]; + j.next = j.next ? e + j.next : e + d + }this.$rules[e + d] = i + } + }; + this.getRules = function() { + return this.$rules + } + }).call(h.prototype); + return h +}); +define("ace/mode/text", ["require", "exports", "module", "../tokenizer", "./text_highlight_rules"], function(h) { + var g = h("../tokenizer"), e = h("./text_highlight_rules"); + h = function() { + this.$tokenizer = new g((new e).getRules()) + }; + (function() { + this.getTokenizer = function() { + return this.$tokenizer + }; + this.toggleCommentLines = function() { + return 0 + }; + this.getNextLineIndent = function() { + return"" + }; + this.checkOutdent = function() { + return false + }; + this.autoOutdent = function() { + }; + this.$getIndent = function(d) { + if(d = d.match(/^(\s+)/)) { + return d[1] + }return"" + } + }).call(h.prototype); + return h +}); +define("ace/document", ["require", "exports", "module", "./lib/oop", "./lib/lang", "./event_emitter", "./selection", "./mode/text", "./range"], function(h) { + var g = h("./lib/oop"), e = h("./lib/lang"), d = h("./event_emitter"), i = h("./selection"), c = h("./mode/text"), j = h("./range"); + h = function(a, f) { + this.modified = true; + this.lines = []; + this.selection = new i(this); + this.$breakpoints = []; + this.listeners = []; + f && this.setMode(f); + e.isArray(a) ? this.$insertLines(0, a) : this.$insert({row:0, column:0}, a) + }; + (function() { + g.implement(this, d); + this.$undoManager = null; + this.$split = function(a) { + return a.split(/\r\n|\r|\n/) + }; + this.setValue = function(a) { + var f = [0, this.lines.length]; + f.push.apply(f, this.$split(a)); + this.lines.splice.apply(this.lines, f); + this.modified = true; + this.fireChangeEvent(0) + }; + this.toString = function() { + return this.lines.join(this.$getNewLineCharacter()) + }; + this.getSelection = function() { + return this.selection + }; + this.fireChangeEvent = function(a, f) { + this.$dispatchEvent("change", {data:{firstRow:a, lastRow:f}}) + }; + this.setUndoManager = function(a) { + this.$undoManager = a; + this.$deltas = []; + this.$informUndoManager && this.$informUndoManager.cancel(); + if(a) { + var f = this; + this.$informUndoManager = e.deferredCall(function() { + f.$deltas.length > 0 && a.execute({action:"aceupdate", args:[f.$deltas, f]}); + f.$deltas = [] + }) + } + }; + this.$defaultUndoManager = {undo:function() { + }, redo:function() { + }}; + this.getUndoManager = function() { + return this.$undoManager || this.$defaultUndoManager + }; + this.getTabString = function() { + return this.getUseSoftTabs() ? e.stringRepeat(" ", this.getTabSize()) : "\t" + }; + this.$useSoftTabs = true; + this.setUseSoftTabs = function(a) { + if(this.$useSoftTabs !== a) { + this.$useSoftTabs = a + } + }; + this.getUseSoftTabs = function() { + return this.$useSoftTabs + }; + this.$tabSize = 4; + this.setTabSize = function(a) { + if(!(isNaN(a) || this.$tabSize === a)) { + this.modified = true; + this.$tabSize = a; + this.$dispatchEvent("changeTabSize") + } + }; + this.getTabSize = function() { + return this.$tabSize + }; + this.getBreakpoints = function() { + return this.$breakpoints + }; + this.setBreakpoints = function(a) { + this.$breakpoints = []; + for(var f = 0;f < a.length;f++) { + this.$breakpoints[a[f]] = true + }this.$dispatchEvent("changeBreakpoint", {}) + }; + this.clearBreakpoints = function() { + this.$breakpoints = []; + this.$dispatchEvent("changeBreakpoint", {}) + }; + this.setBreakpoint = function(a) { + this.$breakpoints[a] = true; + this.$dispatchEvent("changeBreakpoint", {}) + }; + this.clearBreakpoint = function(a) { + delete this.$breakpoints[a]; + this.$dispatchEvent("changeBreakpoint", {}) + }; + this.$detectNewLine = function(a) { + this.$autoNewLine = (a = a.match(/^.*?(\r?\n)/m)) ? a[1] : "\n" + }; + this.tokenRe = /^[\w\d]+/g; + this.nonTokenRe = /^[^\w\d]+/g; + this.getWordRange = function(a, f) { + var m = this.getLine(a), n = false; + if(f > 0) { + n = !!m.charAt(f - 1).match(this.tokenRe) + }n || (n = !!m.charAt(f).match(this.tokenRe)); + n = n ? this.tokenRe : this.nonTokenRe; + var b = f; + if(b > 0) { + do { + b-- + }while(b >= 0 && m.charAt(b).match(n)); + b++ + }for(f = f;f < m.length && m.charAt(f).match(n);) { + f++ + }return new j(a, b, a, f) + }; + this.$getNewLineCharacter = function() { + switch(this.$newLineMode) { + case "windows": + return"\r\n"; + case "unix": + return"\n"; + case "auto": + return this.$autoNewLine + } + }; + this.$autoNewLine = "\n"; + this.$newLineMode = "auto"; + this.setNewLineMode = function(a) { + if(this.$newLineMode !== a) { + this.$newLineMode = a + } + }; + this.getNewLineMode = function() { + return this.$newLineMode + }; + this.$mode = null; + this.setMode = function(a) { + if(this.$mode !== a) { + this.$mode = a; + this.$dispatchEvent("changeMode") + } + }; + this.getMode = function() { + if(!this.$mode) { + this.$mode = new c + }return this.$mode + }; + this.$scrollTop = 0; + this.setScrollTopRow = function(a) { + if(this.$scrollTop !== a) { + this.$scrollTop = a; + this.$dispatchEvent("changeScrollTop") + } + }; + this.getScrollTopRow = function() { + return this.$scrollTop + }; + this.getWidth = function() { + this.$computeWidth(); + return this.width + }; + this.getScreenWidth = function() { + this.$computeWidth(); + return this.screenWith + }; + this.$computeWidth = function() { + if(this.modified) { + this.modified = false; + for(var a = this.lines, f = 0, m = 0, n = this.getTabSize(), b = 0;b < a.length;b++) { + var k = a[b].length; + f = Math.max(f, k); + a[b].replace("\t", function(p) { + k += n - 1; + return p + }); + m = Math.max(m, k) + }this.width = f; + this.screenWith = m + } + }; + this.getLine = function(a) { + return this.lines[a] || "" + }; + this.getDisplayLine = function(a) { + var f = (new Array(this.getTabSize() + 1)).join(" "); + return this.lines[a].replace(/\t/g, f) + }; + this.getLines = function(a, f) { + return this.lines.slice(a, f + 1) + }; + this.getLength = function() { + return this.lines.length + }; + this.getTextRange = function(a) { + if(a.start.row == a.end.row) { + return this.lines[a.start.row].substring(a.start.column, a.end.column) + }else { + var f = []; + f.push(this.lines[a.start.row].substring(a.start.column)); + f.push.apply(f, this.getLines(a.start.row + 1, a.end.row - 1)); + f.push(this.lines[a.end.row].substring(0, a.end.column)); + return f.join(this.$getNewLineCharacter()) + } + }; + this.findMatchingBracket = function(a) { + if(a.column == 0) { + return null + }var f = this.getLine(a.row).charAt(a.column - 1); + if(f == "") { + return null + }f = f.match(/([\(\[\{])|([\)\]\}])/); + if(!f) { + return null + }return f[1] ? this.$findClosingBracket(f[1], a) : this.$findOpeningBracket(f[2], a) + }; + this.$brackets = {")":"(", "(":")", "]":"[", "[":"]", "{":"}", "}":"{"}; + this.$findOpeningBracket = function(a, f) { + var m = this.$brackets[a], n = f.column - 2; + f = f.row; + for(var b = 1, k = this.getLine(f);;) { + for(;n >= 0;) { + var p = k.charAt(n); + if(p == m) { + b -= 1; + if(b == 0) { + return{row:f, column:n} + } + }else { + if(p == a) { + b += 1 + } + }n -= 1 + }f -= 1; + if(f < 0) { + break + }k = this.getLine(f); + n = k.length - 1 + }return null + }; + this.$findClosingBracket = function(a, f) { + var m = this.$brackets[a], n = f.column; + f = f.row; + for(var b = 1, k = this.getLine(f), p = this.getLength();;) { + for(;n < k.length;) { + var o = k.charAt(n); + if(o == m) { + b -= 1; + if(b == 0) { + return{row:f, column:n} + } + }else { + if(o == a) { + b += 1 + } + }n += 1 + }f += 1; + if(f >= p) { + break + }k = this.getLine(f); + n = 0 + }return null + }; + this.insert = function(a, f, m) { + f = this.$insert(a, f, m); + this.fireChangeEvent(a.row, a.row == f.row ? a.row : undefined); + return f + }; + this.$insertLines = function(a, f, m) { + if(f.length != 0) { + var n = [a, 0]; + n.push.apply(n, f); + this.lines.splice.apply(this.lines, n); + if(!m && this.$undoManager) { + m = this.$getNewLineCharacter(); + this.$deltas.push({action:"insertText", range:new j(a, 0, a + f.length, 0), text:f.join(m) + m}); + this.$informUndoManager.schedule() + } + } + }; + this.$insert = function(a, f, m) { + if(f.length == 0) { + return a + }this.modified = true; + this.lines.length <= 1 && this.$detectNewLine(f); + var n = this.$split(f); + if(this.$isNewLine(f)) { + var b = this.lines[a.row] || ""; + this.lines[a.row] = b.substring(0, a.column); + this.lines.splice(a.row + 1, 0, b.substring(a.column)); + n = {row:a.row + 1, column:0} + }else { + if(n.length == 1) { + b = this.lines[a.row] || ""; + this.lines[a.row] = b.substring(0, a.column) + f + b.substring(a.column); + n = {row:a.row, column:a.column + f.length} + }else { + b = this.lines[a.row] || ""; + var k = b.substring(0, a.column) + n[0]; + b = n[n.length - 1] + b.substring(a.column); + this.lines[a.row] = k; + this.$insertLines(a.row + 1, [b], true); + n.length > 2 && this.$insertLines(a.row + 1, n.slice(1, -1), true); + n = {row:a.row + n.length - 1, column:n[n.length - 1].length} + } + }if(!m && this.$undoManager) { + this.$deltas.push({action:"insertText", range:j.fromPoints(a, n), text:f}); + this.$informUndoManager.schedule() + }return n + }; + this.$isNewLine = function(a) { + return a == "\r\n" || a == "\r" || a == "\n" + }; + this.remove = function(a, f) { + if(a.isEmpty()) { + return a.start + }this.$remove(a, f); + this.fireChangeEvent(a.start.row, a.isMultiLine() ? undefined : a.start.row); + return a.start + }; + this.$remove = function(a, f) { + if(!a.isEmpty()) { + if(!f && this.$undoManager) { + this.$getNewLineCharacter(); + this.$deltas.push({action:"removeText", range:a.clone(), text:this.getTextRange(a)}); + this.$informUndoManager.schedule() + }this.modified = true; + f = a.start.row; + var m = a.end.row, n = this.getLine(f).substring(0, a.start.column) + this.getLine(m).substring(a.end.column); + this.lines.splice(f, m - f + 1, n); + return a.start + } + }; + this.undoChanges = function(a) { + this.selection.clearSelection(); + for(var f = a.length - 1;f >= 0;f--) { + var m = a[f]; + if(m.action == "insertText") { + this.remove(m.range, true); + this.selection.moveCursorToPosition(m.range.start) + }else { + this.insert(m.range.start, m.text, true); + this.selection.clearSelection() + } + } + }; + this.redoChanges = function(a) { + this.selection.clearSelection(); + for(var f = 0;f < a.length;f++) { + var m = a[f]; + if(m.action == "insertText") { + this.insert(m.range.start, m.text, true); + this.selection.setSelectionRange(m.range) + }else { + this.remove(m.range, true); + this.selection.moveCursorToPosition(m.range.start) + } + } + }; + this.replace = function(a, f) { + this.$remove(a); + f = f ? this.$insert(a.start, f) : a.start; + var m = a.end.column == 0 ? a.end.column - 1 : a.end.column; + this.fireChangeEvent(a.start.row, m == f.row ? m : undefined); + return f + }; + this.indentRows = function(a, f) { + f.replace("\t", this.getTabString()); + for(var m = a.start.row;m <= a.end.row;m++) { + this.$insert({row:m, column:0}, f) + }this.fireChangeEvent(a.start.row, a.end.row); + return f.length + }; + this.outdentRows = function(a) { + for(var f = new j(0, 0, 0, 0), m = this.getTabSize(), n = a.start.row;n <= a.end.row;++n) { + var b = this.getLine(n); + f.start.row = n; + f.end.row = n; + for(var k = 0;k < m;++k) { + if(b.charAt(k) != " ") { + break + } + }if(k < m && b.charAt(k) == "\t") { + f.start.column = k; + f.end.column = k + 1 + }else { + f.start.column = 0; + f.end.column = k + }if(n == a.start.row) { + a.start.column -= f.end.column - f.start.column + }if(n == a.end.row) { + a.end.column -= f.end.column - f.start.column + }this.$remove(f) + }this.fireChangeEvent(a.start.row, a.end.row); + return a + }; + this.moveLinesUp = function(a, f) { + if(a <= 0) { + return 0 + }var m = this.lines.slice(a, f + 1); + this.$remove(new j(a, 0, f + 1, 0)); + this.$insertLines(a - 1, m); + this.fireChangeEvent(a - 1, f); + return-1 + }; + this.moveLinesDown = function(a, f) { + if(f >= this.lines.length - 1) { + return 0 + }var m = this.lines.slice(a, f + 1); + this.$remove(new j(a, 0, f + 1, 0)); + this.$insertLines(a + 1, m); + this.fireChangeEvent(a, f + 1); + return 1 + }; + this.duplicateLines = function(a, f) { + a = this.$clipRowToDocument(a); + f = this.$clipRowToDocument(f); + var m = this.getLines(a, f); + this.$insertLines(a, m); + f = f - a + 1; + this.fireChangeEvent(a); + return f + }; + this.$clipRowToDocument = function(a) { + return Math.max(0, Math.min(a, this.lines.length - 1)) + }; + this.documentToScreenColumn = function(a, f) { + var m = this.getTabSize(), n = 0; + f = f; + a = this.getLine(a).split("\t"); + for(var b = 0;b < a.length;b++) { + var k = a[b].length; + if(f > k) { + f -= k + 1; + n += k + m + }else { + n += f; + break + } + }return n + }; + this.screenToDocumentColumn = function(a, f) { + var m = this.getTabSize(), n = 0; + f = f; + a = this.getLine(a).split("\t"); + for(var b = 0;b < a.length;b++) { + var k = a[b].length; + if(f >= k + m) { + f -= k + m; + n += k + 1 + }else { + n += f > k ? k : f; + break + } + }return n + } + }).call(h.prototype); + return h +}); +define("ace/search", ["require", "exports", "module", "./lib/lang", "./lib/oop", "./range"], function(h) { + var g = h("./lib/lang"), e = h("./lib/oop"), d = h("./range"), i = function() { + this.$options = {needle:"", backwards:false, wrap:false, caseSensitive:false, wholeWord:false, scope:i.ALL, regExp:false} + }; + i.ALL = 1; + i.SELECTION = 2; + (function() { + this.set = function(c) { + e.mixin(this.$options, c); + return this + }; + this.getOptions = function() { + return g.copyObject(this.$options) + }; + this.find = function(c) { + if(!this.$options.needle) { + return null + }var j = null; + (this.$options.backwards ? this.$backwardMatchIterator(c) : this.$forwardMatchIterator(c)).forEach(function(a) { + j = a; + return true + }); + return j + }; + this.findAll = function(c) { + if(!this.$options.needle) { + return[] + }var j = []; + (this.$options.backwards ? this.$backwardMatchIterator(c) : this.$forwardMatchIterator(c)).forEach(function(a) { + j.push(a) + }); + return j + }; + this.replace = function(c, j) { + var a = this.$assembleRegExp(), f = a.exec(c); + return f && f[0].length == c.length ? this.$options.regExp ? c.replace(a, j) : j : null + }; + this.$forwardMatchIterator = function(c) { + var j = this.$assembleRegExp(), a = this; + return{forEach:function(f) { + a.$forwardLineIterator(c).forEach(function(m, n, b) { + if(n) { + m = m.substring(n) + }var k = []; + m.replace(j, function(o) { + k.push({str:o, offset:n + arguments[arguments.length - 2]}); + return o + }); + for(m = 0;m < k.length;m++) { + var p = k[m]; + p = a.$rangeFromMatch(b, p.offset, p.str.length); + if(f(p)) { + return true + } + } + }) + }} + }; + this.$backwardMatchIterator = function(c) { + var j = this.$assembleRegExp(), a = this; + return{forEach:function(f) { + a.$backwardLineIterator(c).forEach(function(m, n, b) { + if(n) { + m = m.substring(n) + }var k = []; + m.replace(j, function(o, l) { + k.push({str:o, offset:n + l}); + return o + }); + for(m = k.length - 1;m >= 0;m--) { + var p = k[m]; + p = a.$rangeFromMatch(b, p.offset, p.str.length); + if(f(p)) { + return true + } + } + }) + }} + }; + this.$rangeFromMatch = function(c, j, a) { + return new d(c, j, c, j + a) + }; + this.$assembleRegExp = function() { + var c = this.$options.regExp ? this.$options.needle : g.escapeRegExp(this.$options.needle); + if(this.$options.wholeWord) { + c = "\\b" + c + "\\b" + }var j = "g"; + this.$options.caseSensitive || (j += "i"); + return new RegExp(c, j) + }; + this.$forwardLineIterator = function(c) { + function j(o) { + var l = c.getLine(o); + if(a && o == f.end.row) { + l = l.substring(0, f.end.column) + }return l + } + var a = this.$options.scope == i.SELECTION, f = c.getSelection().getRange(), m = c.getSelection().getCursor(), n = a ? f.start.row : 0, b = a ? f.start.column : 0, k = a ? f.end.row : c.getLength() - 1, p = this.$options.wrap; + return{forEach:function(o) { + for(var l = m.row, r = j(l), q = m.column, s = false;!o(r, q, l);) { + if(s) { + return + }l++; + q = 0; + if(l > k) { + if(p) { + l = n; + q = b + }else { + return + } + }if(l == m.row) { + s = true + }r = j(l) + } + }} + }; + this.$backwardLineIterator = function(c) { + var j = this.$options.scope == i.SELECTION, a = c.getSelection().getRange(), f = j ? a.end : a.start, m = j ? a.start.row : 0, n = j ? a.start.column : 0, b = j ? a.end.row : c.getLength() - 1, k = this.$options.wrap; + return{forEach:function(p) { + for(var o = f.row, l = c.getLine(o).substring(0, f.column), r = 0, q = false;!p(l, r, o);) { + if(q) { + return + }o--; + r = 0; + if(o < m) { + if(k) { + o = b + }else { + return + } + }if(o == f.row) { + q = true + }l = c.getLine(o); + if(j) { + if(o == m) { + r = n + }else { + if(o == b) { + l = l.substring(0, a.end.column) + } + } + } + } + }} + } + }).call(i.prototype); + return i +}); +define("ace/background_tokenizer", ["require", "exports", "module", "./lib/oop", "./event_emitter"], function(h) { + var g = h("./lib/oop"), e = h("./event_emitter"); + h = function(d, i) { + this.running = false; + this.textLines = []; + this.lines = []; + this.currentLine = 0; + this.tokenizer = d; + var c = this; + this.$worker = function() { + if(c.running) { + for(var j = new Date, a = c.currentLine, f = c.textLines, m = 0, n = i.getLastVisibleRow();c.currentLine < f.length;) { + c.lines[c.currentLine] = c.$tokenizeRows(c.currentLine, c.currentLine)[0]; + c.currentLine++; + m += 1; + if(m % 5 == 0 && new Date - j > 20) { + c.fireUpdateEvent(a, c.currentLine - 1); + c.running = setTimeout(c.$worker, c.currentLine < n ? 20 : 100); + return + } + }c.running = false; + c.fireUpdateEvent(a, f.length - 1) + } + } + }; + (function() { + g.implement(this, e); + this.setTokenizer = function(d) { + this.tokenizer = d; + this.lines = []; + this.start(0) + }; + this.setLines = function(d) { + this.textLines = d; + this.lines = []; + this.stop() + }; + this.fireUpdateEvent = function(d, i) { + this.$dispatchEvent("update", {data:{first:d, last:i}}) + }; + this.start = function(d) { + this.currentLine = Math.min(d || 0, this.currentLine, this.textLines.length); + this.lines.splice(this.currentLine, this.lines.length); + this.stop(); + this.running = setTimeout(this.$worker, 700) + }; + this.stop = function() { + this.running && clearTimeout(this.running); + this.running = false + }; + this.getTokens = function(d, i, c) { + c(this.$tokenizeRows(d, i)) + }; + this.getState = function(d, i) { + i(this.$tokenizeRows(d, d)[0].state) + }; + this.$tokenizeRows = function(d, i) { + var c = [], j = "start", a = false; + if(d > 0 && this.lines[d - 1]) { + j = this.lines[d - 1].state; + a = true + }for(d = d;d <= i;d++) { + if(this.lines[d]) { + f = this.lines[d]; + j = f.state; + c.push(f) + }else { + var f = this.tokenizer.getLineTokens(this.textLines[d] || "", j); + j = f.state; + c.push(f); + if(a) { + this.lines[d] = f + } + } + }return c + } + }).call(h.prototype); + return h +}); +define("ace/editor", ["require", "exports", "module", "./lib/oop", "./lib/event", "./lib/lang", "./textinput", "./keybinding", "./document", "./search", "./background_tokenizer", "./range", "./event_emitter"], function(h) { + var g = h("./lib/oop"), e = h("./lib/event"), d = h("./lib/lang"), i = h("./textinput"), c = h("./keybinding"), j = h("./document"), a = h("./search"), f = h("./background_tokenizer"), m = h("./range"), n = h("./event_emitter"); + h = function(b, k) { + var p = b.getContainerElement(); + this.container = p; + this.renderer = b; + this.textInput = new i(p, this); + this.keyBinding = new c(p, this); + var o = this; + e.addListener(p, "mousedown", function(l) { + setTimeout(function() { + o.focus() + }); + return e.preventDefault(l) + }); + e.addListener(p, "selectstart", function(l) { + return e.preventDefault(l) + }); + b = b.getMouseEventTarget(); + e.addListener(b, "mousedown", d.bind(this.onMouseDown, this)); + e.addMultiMouseDownListener(b, 0, 2, 500, d.bind(this.onMouseDoubleClick, this)); + e.addMultiMouseDownListener(b, 0, 3, 600, d.bind(this.onMouseTripleClick, this)); + e.addMouseWheelListener(b, d.bind(this.onMouseWheel, this)); + this.$highlightLineMarker = this.$selectionMarker = null; + this.$blockScrolling = false; + this.$search = (new a).set({wrap:true}); + this.setDocument(k || new j("")); + this.focus() + }; + (function() { + g.implement(this, n); + this.$forwardEvents = {gutterclick:1, gutterdblclick:1}; + this.$originalAddEventListener = this.addEventListener; + this.$originalRemoveEventListener = this.removeEventListener; + this.addEventListener = function(b, k) { + return this.$forwardEvents[b] ? this.renderer.addEventListener(b, k) : this.$originalAddEventListener(b, k) + }; + this.removeEventListener = function(b, k) { + return this.$forwardEvents[b] ? this.renderer.removeEventListener(b, k) : this.$originalRemoveEventListener(b, k) + }; + this.setDocument = function(b) { + if(this.doc != b) { + if(this.doc) { + this.doc.removeEventListener("change", this.$onDocumentChange); + this.doc.removeEventListener("changeMode", this.$onDocumentModeChange); + this.doc.removeEventListener("changeTabSize", this.$onDocumentChangeTabSize); + this.doc.removeEventListener("changeBreakpoint", this.$onDocumentChangeBreakpoint); + var k = this.doc.getSelection(); + k.removeEventListener("changeCursor", this.$onCursorChange); + k.removeEventListener("changeSelection", this.$onSelectionChange); + this.doc.setScrollTopRow(this.renderer.getScrollTopRow()) + }this.doc = b; + this.$onDocumentChange = d.bind(this.onDocumentChange, this); + b.addEventListener("change", this.$onDocumentChange); + this.renderer.setDocument(b); + this.$onDocumentModeChange = d.bind(this.onDocumentModeChange, this); + b.addEventListener("changeMode", this.$onDocumentModeChange); + this.$onDocumentChangeTabSize = d.bind(this.renderer.updateText, this.renderer); + b.addEventListener("changeTabSize", this.$onDocumentChangeTabSize); + this.$onDocumentChangeBreakpoint = d.bind(this.onDocumentChangeBreakpoint, this); + this.doc.addEventListener("changeBreakpoint", this.$onDocumentChangeBreakpoint); + this.selection = b.getSelection(); + this.$desiredColumn = 0; + this.$onCursorChange = d.bind(this.onCursorChange, this); + this.selection.addEventListener("changeCursor", this.$onCursorChange); + this.$onSelectionChange = d.bind(this.onSelectionChange, this); + this.selection.addEventListener("changeSelection", this.$onSelectionChange); + this.onDocumentModeChange(); + this.bgTokenizer.setLines(this.doc.lines); + this.bgTokenizer.start(0); + this.onCursorChange(); + this.onSelectionChange(); + this.onDocumentChangeBreakpoint(); + this.renderer.scrollToRow(b.getScrollTopRow()); + this.renderer.updateFull() + } + }; + this.getDocument = function() { + return this.doc + }; + this.getSelection = function() { + return this.selection + }; + this.resize = function() { + this.renderer.onResize() + }; + this.setTheme = function(b) { + this.renderer.setTheme(b) + }; + this.$highlightBrackets = function() { + if(this.$bracketHighlight) { + this.renderer.removeMarker(this.$bracketHighlight); + this.$bracketHighlight = null + }if(!this.$highlightPending) { + var b = this; + this.$highlightPending = true; + setTimeout(function() { + b.$highlightPending = false; + var k = b.doc.findMatchingBracket(b.getCursorPosition()); + if(k) { + k = new m(k.row, k.column, k.row, k.column + 1); + b.$bracketHighlight = b.renderer.addMarker(k, "ace_bracket") + } + }, 10) + } + }; + this.focus = function() { + this.textInput.focus() + }; + this.blur = function() { + this.textInput.blur() + }; + this.onFocus = function() { + this.renderer.showCursor(); + this.renderer.visualizeFocus() + }; + this.onBlur = function() { + this.renderer.hideCursor(); + this.renderer.visualizeBlur() + }; + this.onDocumentChange = function(b) { + b = b.data; + this.bgTokenizer.start(b.firstRow); + this.renderer.updateLines(b.firstRow, b.lastRow); + this.renderer.updateCursor(this.getCursorPosition(), this.$overwrite) + }; + this.onTokenizerUpdate = function(b) { + b = b.data; + this.renderer.updateLines(b.first, b.last) + }; + this.onCursorChange = function() { + this.$highlightBrackets(); + this.renderer.updateCursor(this.getCursorPosition(), this.$overwrite); + this.$blockScrolling || this.renderer.scrollCursorIntoView(); + this.$updateHighlightActiveLine() + }; + this.$updateHighlightActiveLine = function() { + this.$highlightLineMarker && this.renderer.removeMarker(this.$highlightLineMarker); + this.$highlightLineMarker = null; + if(this.getHighlightActiveLine() && (this.getSelectionStyle() != "line" || !this.selection.isMultiLine())) { + var b = this.getCursorPosition(); + this.$highlightLineMarker = this.renderer.addMarker(new m(b.row, 0, b.row + 1, 0), "ace_active_line", "line") + } + }; + this.onSelectionChange = function() { + this.$selectionMarker && this.renderer.removeMarker(this.$selectionMarker); + this.$selectionMarker = null; + if(!this.selection.isEmpty()) { + var b = this.selection.getRange(), k = this.getSelectionStyle(); + this.$selectionMarker = this.renderer.addMarker(b, "ace_selection", k) + }this.onCursorChange() + }; + this.onDocumentChangeBreakpoint = function() { + this.renderer.setBreakpoints(this.doc.getBreakpoints()) + }; + this.onDocumentModeChange = function() { + var b = this.doc.getMode(); + if(this.mode != b) { + this.mode = b; + b = b.getTokenizer(); + if(this.bgTokenizer) { + this.bgTokenizer.setTokenizer(b) + }else { + var k = d.bind(this.onTokenizerUpdate, this); + this.bgTokenizer = new f(b, this); + this.bgTokenizer.addEventListener("update", k) + }this.renderer.setTokenizer(this.bgTokenizer) + } + }; + this.onMouseDown = function(b) { + var k = e.getDocumentX(b), p = e.getDocumentY(b); + k = this.renderer.screenToTextCoordinates(k, p); + k.row = Math.max(0, Math.min(k.row, this.doc.getLength() - 1)); + if(e.getButton(b) != 0) { + this.selection.isEmpty() && this.moveCursorToPosition(k) + }else { + if(b.shiftKey) { + this.selection.selectToPosition(k) + }else { + this.moveCursorToPosition(k); + this.$clickSelection || this.selection.clearSelection(k.row, k.column) + }this.renderer.scrollCursorIntoView(); + var o = this, l, r; + e.capture(this.container, function(s) { + l = e.getDocumentX(s); + r = e.getDocumentY(s) + }, function() { + clearInterval(q); + o.$clickSelection = null + }); + var q = setInterval(function() { + if(!(l === undefined || r === undefined)) { + var s = o.renderer.screenToTextCoordinates(l, r); + s.row = Math.max(0, Math.min(s.row, o.doc.getLength() - 1)); + if(o.$clickSelection) { + if(o.$clickSelection.contains(s.row, s.column)) { + o.selection.setSelectionRange(o.$clickSelection) + }else { + var t = o.$clickSelection.compare(s.row, s.column) == -1 ? o.$clickSelection.end : o.$clickSelection.start; + o.selection.setSelectionAnchor(t.row, t.column); + o.selection.selectToPosition(s) + } + }else { + o.selection.selectToPosition(s) + }o.renderer.scrollCursorIntoView() + } + }, 20); + return e.preventDefault(b) + } + }; + this.onMouseDoubleClick = function() { + this.selection.selectWord(); + this.$clickSelection = this.getSelectionRange(); + this.$updateDesiredColumn() + }; + this.onMouseTripleClick = function() { + this.selection.selectLine(); + this.$clickSelection = this.getSelectionRange(); + this.$updateDesiredColumn() + }; + this.onMouseWheel = function(b) { + var k = this.$scrollSpeed * 2; + this.renderer.scrollBy(b.wheelX * k, b.wheelY * k); + return e.preventDefault(b) + }; + this.getCopyText = function() { + return this.selection.isEmpty() ? "" : this.doc.getTextRange(this.getSelectionRange()) + }; + this.onCut = function() { + if(!this.$readOnly) { + if(!this.selection.isEmpty()) { + this.moveCursorToPosition(this.doc.remove(this.getSelectionRange())); + this.clearSelection() + } + } + }; + this.onTextInput = function(b) { + if(!this.$readOnly) { + var k = this.getCursorPosition(); + b = b.replace("\t", this.doc.getTabString()); + if(this.selection.isEmpty()) { + if(this.$overwrite) { + var p = new m.fromPoints(k, k); + p.end.column += b.length; + this.doc.remove(p) + } + }else { + k = this.doc.remove(this.getSelectionRange()); + this.clearSelection() + }this.clearSelection(); + var o = this; + this.bgTokenizer.getState(k.row, function(l) { + var r = o.mode.checkOutdent(l, o.doc.getLine(k.row), b), q = o.doc.getLine(k.row), s = o.mode.getNextLineIndent(l, q, o.doc.getTabString()), t = o.doc.insert(k, b); + o.bgTokenizer.getState(k.row, function(u) { + if(k.row !== t.row) { + u = o.doc.getTabSize(); + for(var y = Number.MAX_VALUE, w = k.row + 1;w <= t.row;++w) { + var x = 0; + q = o.doc.getLine(w); + for(var v = 0;v < q.length;++v) { + if(q.charAt(v) == "\t") { + x += u + }else { + if(q.charAt(v) == " ") { + x += 1 + }else { + break + } + } + }if(/[^\s]$/.test(q)) { + y = Math.min(x, y) + } + }for(w = k.row + 1;w <= t.row;++w) { + x = y; + q = o.doc.getLine(w); + for(v = 0;v < q.length && x > 0;++v) { + if(q.charAt(v) == "\t") { + x -= u + }else { + if(q.charAt(v) == " ") { + x -= 1 + } + } + }o.doc.replace(new m(w, 0, w, q.length), q.substr(v)) + }t.column += o.doc.indentRows(new m(k.row + 1, 0, t.row, t.column), s) + }else { + if(r) { + t.column += o.mode.autoOutdent(u, o.doc, k.row) + } + }o.moveCursorToPosition(t); + o.renderer.scrollCursorIntoView() + }) + }) + } + }; + this.$overwrite = false; + this.setOverwrite = function(b) { + if(this.$overwrite != b) { + this.$overwrite = b; + this.$blockScrolling = true; + this.onCursorChange(); + this.$blockScrolling = false; + this.$dispatchEvent("changeOverwrite", {data:b}) + } + }; + this.getOverwrite = function() { + return this.$overwrite + }; + this.toggleOverwrite = function() { + this.setOverwrite(!this.$overwrite) + }; + this.$scrollSpeed = 1; + this.setScrollSpeed = function(b) { + this.$scrollSpeed = b + }; + this.getScrollSpeed = function() { + return this.$scrollSpeed + }; + this.$selectionStyle = "line"; + this.setSelectionStyle = function(b) { + if(this.$selectionStyle != b) { + this.$selectionStyle = b; + this.onSelectionChange(); + this.$dispatchEvent("changeSelectionStyle", {data:b}) + } + }; + this.getSelectionStyle = function() { + return this.$selectionStyle + }; + this.$highlightActiveLine = true; + this.setHighlightActiveLine = function(b) { + if(this.$highlightActiveLine != b) { + this.$highlightActiveLine = b; + this.$updateHighlightActiveLine() + } + }; + this.getHighlightActiveLine = function() { + return this.$highlightActiveLine + }; + this.setShowInvisibles = function(b) { + this.getShowInvisibles() != b && this.renderer.setShowInvisibles(b) + }; + this.getShowInvisibles = function() { + return this.renderer.getShowInvisibles() + }; + this.setShowPrintMargin = function(b) { + this.renderer.setShowPrintMargin(b) + }; + this.getShowPrintMargin = function() { + return this.renderer.getShowPrintMargin() + }; + this.setPrintMarginColumn = function(b) { + this.renderer.setPrintMarginColumn(b) + }; + this.getPrintMarginColumn = function() { + return this.renderer.getPrintMarginColumn() + }; + this.$readOnly = false; + this.setReadOnly = function(b) { + this.$readOnly = b + }; + this.getReadOnly = function() { + return this.$readOnly + }; + this.removeRight = function() { + if(!this.$readOnly) { + this.selection.isEmpty() && this.selection.selectRight(); + this.moveCursorToPosition(this.doc.remove(this.getSelectionRange())); + this.clearSelection() + } + }; + this.removeLeft = function() { + if(!this.$readOnly) { + this.selection.isEmpty() && this.selection.selectLeft(); + this.moveCursorToPosition(this.doc.remove(this.getSelectionRange())); + this.clearSelection() + } + }; + this.indent = function() { + if(!this.$readOnly) { + var b = this.getSelectionRange(); + if(b.start.row < b.end.row || b.start.column < b.end.column) { + b = this.doc.indentRows(this.getSelectionRange(), "\t"); + this.selection.shiftSelection(b) + }else { + if(this.doc.getUseSoftTabs()) { + b = this.doc.getTabSize(); + b = b - this.getCursorPosition().column % b; + b = d.stringRepeat(" ", b) + }else { + b = "\t" + }return this.onTextInput(b) + } + } + }; + this.blockOutdent = function() { + if(!this.$readOnly) { + var b = this.doc.getSelection(), k = this.doc.outdentRows(b.getRange()); + b.setSelectionRange(k, b.isBackwards()); + this.$updateDesiredColumn() + } + }; + this.toggleCommentLines = function() { + if(!this.$readOnly) { + var b = this.$getSelectedRows(), k = new m(b.first, 0, b.last, 0), p = this; + this.bgTokenizer.getState(this.getCursorPosition().row, function(o) { + o = p.mode.toggleCommentLines(o, p.doc, k); + p.selection.shiftSelection(o) + }) + } + }; + this.removeLines = function() { + if(!this.$readOnly) { + var b = this.$getSelectedRows(); + this.selection.setSelectionAnchor(b.last + 1, 0); + this.selection.selectTo(b.first, 0); + this.doc.remove(this.getSelectionRange()); + this.clearSelection() + } + }; + this.moveLinesDown = function() { + this.$readOnly || this.$moveLines(function(b, k) { + return this.doc.moveLinesDown(b, k) + }) + }; + this.moveLinesUp = function() { + this.$readOnly || this.$moveLines(function(b, k) { + return this.doc.moveLinesUp(b, k) + }) + }; + this.copyLinesUp = function() { + this.$readOnly || this.$moveLines(function(b, k) { + this.doc.duplicateLines(b, k); + return 0 + }) + }; + this.copyLinesDown = function() { + this.$readOnly || this.$moveLines(function(b, k) { + return this.doc.duplicateLines(b, k) + }) + }; + this.$moveLines = function(b) { + var k = this.$getSelectedRows(), p = b.call(this, k.first, k.last), o = this.selection; + o.setSelectionAnchor(k.last + p + 1, 0); + o.$moveSelection(function() { + o.moveCursorTo(k.first + p, 0) + }) + }; + this.$getSelectedRows = function() { + var b = this.getSelectionRange(), k = b.start.row, p = b.end.row; + if(b.end.column == 0 && b.start.row !== b.end.row) { + p -= 1 + }return{first:k, last:p} + }; + this.onCompositionStart = function() { + this.renderer.showComposition(this.getCursorPosition()) + }; + this.onCompositionUpdate = function(b) { + this.renderer.setCompositionText(b) + }; + this.onCompositionEnd = function() { + this.renderer.hideComposition() + }; + this.getFirstVisibleRow = function() { + return this.renderer.getFirstVisibleRow() + }; + this.getLastVisibleRow = function() { + return this.renderer.getLastVisibleRow() + }; + this.isRowVisible = function(b) { + return b >= this.getFirstVisibleRow() && b <= this.getLastVisibleRow() + }; + this.getVisibleRowCount = function() { + return this.getLastVisibleRow() - this.getFirstVisibleRow() + 1 + }; + this.getPageDownRow = function() { + return this.renderer.getLastVisibleRow() - 1 + }; + this.getPageUpRow = function() { + var b = this.renderer.getFirstVisibleRow(), k = this.renderer.getLastVisibleRow(); + return b - (k - b) + 1 + }; + this.selectPageDown = function() { + var b = this.getPageDownRow() + Math.floor(this.getVisibleRowCount() / 2); + this.scrollPageDown(); + var k = this.getSelection(); + k.$moveSelection(function() { + k.moveCursorTo(b, k.getSelectionLead().column) + }) + }; + this.selectPageUp = function() { + var b = this.getLastVisibleRow() - this.getFirstVisibleRow(), k = this.getPageUpRow() + Math.round(b / 2); + this.scrollPageUp(); + var p = this.getSelection(); + p.$moveSelection(function() { + p.moveCursorTo(k, p.getSelectionLead().column) + }) + }; + this.gotoPageDown = function() { + var b = this.getPageDownRow(), k = Math.min(this.getCursorPosition().column, this.doc.getLine(b).length); + this.scrollToRow(b); + this.getSelection().moveCursorTo(b, k) + }; + this.gotoPageUp = function() { + var b = this.getPageUpRow(), k = Math.min(this.getCursorPosition().column, this.doc.getLine(b).length); + this.scrollToRow(b); + this.getSelection().moveCursorTo(b, k) + }; + this.scrollPageDown = function() { + this.scrollToRow(this.getPageDownRow()) + }; + this.scrollPageUp = function() { + this.renderer.scrollToRow(this.getPageUpRow()) + }; + this.scrollToRow = function(b) { + this.renderer.scrollToRow(b) + }; + this.getCursorPosition = function() { + return this.selection.getCursor() + }; + this.getSelectionRange = function() { + return this.selection.getRange() + }; + this.clearSelection = function() { + this.selection.clearSelection(); + this.$updateDesiredColumn() + }; + this.moveCursorTo = function(b, k) { + this.selection.moveCursorTo(b, k); + this.$updateDesiredColumn() + }; + this.moveCursorToPosition = function(b) { + this.selection.moveCursorToPosition(b); + this.$updateDesiredColumn() + }; + this.gotoLine = function(b, k) { + this.selection.clearSelection(); + this.$blockScrolling = true; + this.moveCursorTo(b - 1, k || 0); + this.$blockScrolling = false; + this.isRowVisible(this.getCursorPosition().row) || this.scrollToRow(b - 1 - Math.floor(this.getVisibleRowCount() / 2)) + }; + this.navigateTo = function(b, k) { + this.clearSelection(); + this.moveCursorTo(b, k); + this.$updateDesiredColumn(k) + }; + this.navigateUp = function() { + this.selection.clearSelection(); + this.selection.moveCursorBy(-1, 0); + if(this.$desiredColumn) { + var b = this.getCursorPosition(), k = this.doc.screenToDocumentColumn(b.row, this.$desiredColumn); + this.selection.moveCursorTo(b.row, k) + } + }; + this.navigateDown = function() { + this.selection.clearSelection(); + this.selection.moveCursorBy(1, 0); + if(this.$desiredColumn) { + var b = this.getCursorPosition(), k = this.doc.screenToDocumentColumn(b.row, this.$desiredColumn); + this.selection.moveCursorTo(b.row, k) + } + }; + this.$updateDesiredColumn = function() { + var b = this.getCursorPosition(); + this.$desiredColumn = this.doc.documentToScreenColumn(b.row, b.column) + }; + this.navigateLeft = function() { + this.selection.isEmpty() ? this.selection.moveCursorLeft() : this.moveCursorToPosition(this.getSelectionRange().start); + this.clearSelection() + }; + this.navigateRight = function() { + this.selection.isEmpty() ? this.selection.moveCursorRight() : this.moveCursorToPosition(this.getSelectionRange().end); + this.clearSelection() + }; + this.navigateLineStart = function() { + this.selection.moveCursorLineStart(); + this.clearSelection() + }; + this.navigateLineEnd = function() { + this.selection.moveCursorLineEnd(); + this.clearSelection() + }; + this.navigateFileEnd = function() { + this.selection.moveCursorFileEnd(); + this.clearSelection() + }; + this.navigateFileStart = function() { + this.selection.moveCursorFileStart(); + this.clearSelection() + }; + this.navigateWordRight = function() { + this.selection.moveCursorWordRight(); + this.clearSelection() + }; + this.navigateWordLeft = function() { + this.selection.moveCursorWordLeft(); + this.clearSelection() + }; + this.replace = function(b, k) { + k && this.$search.set(k); + k = this.$search.find(this.doc); + this.$tryReplace(k, b); + k !== null && this.selection.setSelectionRange(k); + this.$updateDesiredColumn() + }; + this.replaceAll = function(b, k) { + k && this.$search.set(k); + this.clearSelection(); + this.selection.moveCursorTo(0, 0); + k = this.$search.findAll(this.doc); + if(k.length) { + for(var p = k.length - 1;p >= 0;--p) { + this.$tryReplace(k[p], b) + }k[0] !== null && this.selection.setSelectionRange(k[0]); + this.$updateDesiredColumn() + } + }; + this.$tryReplace = function(b, k) { + k = this.$search.replace(this.doc.getTextRange(b), k); + if(k !== null) { + b.end = this.doc.replace(b, k); + return b + }else { + return null + } + }; + this.getLastSearchOptions = function() { + return this.$search.getOptions() + }; + this.find = function(b, k) { + this.clearSelection(); + k = k || {}; + k.needle = b; + this.$search.set(k); + this.$find() + }; + this.findNext = function(b) { + b = b || {}; + if(typeof b.backwards == "undefined") { + b.backwards = false + }this.$search.set(b); + this.$find() + }; + this.findPrevious = function(b) { + b = b || {}; + if(typeof b.backwards == "undefined") { + b.backwards = true + }this.$search.set(b); + this.$find() + }; + this.$find = function(b) { + this.selection.isEmpty() || this.$search.set({needle:this.doc.getTextRange(this.getSelectionRange())}); + typeof b != "undefined" && this.$search.set({backwards:b}); + if(b = this.$search.find(this.doc)) { + this.gotoLine(b.end.row + 1, b.end.column); + this.$updateDesiredColumn(); + this.selection.setSelectionRange(b) + } + }; + this.undo = function() { + this.doc.getUndoManager().undo() + }; + this.redo = function() { + this.doc.getUndoManager().redo() + } + }).call(h.prototype); + return h +}); +define("ace/undomanager", ["require", "exports", "module"], function() { + var h = function() { + this.$undoStack = []; + this.$redoStack = [] + }; + (function() { + this.execute = function(g) { + var e = g.args[0]; + this.$doc = g.args[1]; + this.$undoStack.push(e) + }; + this.undo = function() { + var g = this.$undoStack.pop(); + if(g) { + this.$doc.undoChanges(g); + this.$redoStack.push(g) + } + }; + this.redo = function() { + var g = this.$redoStack.pop(); + if(g) { + this.$doc.redoChanges(g); + this.$undoStack.push(g) + } + } + }).call(h.prototype); + return h +}); +define("ace/layer/gutter", ["require", "exports", "module"], function() { + var h = function(g) { + this.element = document.createElement("div"); + this.element.className = "ace_layer ace_gutter-layer"; + g.appendChild(this.element); + this.$breakpoints = []; + this.$decorations = [] + }; + (function() { + this.addGutterDecoration = function(g, e) { + this.$decorations[g] || (this.$decorations[g] = ""); + this.$decorations[g] += " ace_" + e + }; + this.removeGutterDecoration = function(g, e) { + this.$decorations[g] = this.$decorations[g].replace(" ace_" + e, "") + }; + this.setBreakpoints = function(g) { + this.$breakpoints = g.concat() + }; + this.update = function(g) { + this.$config = g; + for(var e = [], d = g.firstRow;d <= g.lastRow;d++) { + e.push("
", d + 1, "
"); + e.push("") + }this.element.innerHTML = e.join(""); + this.element.style.height = g.minHeight + "px" + } + }).call(h.prototype); + return h +}); +define("ace/layer/marker", ["require", "exports", "module", "../range"], function(h) { + var g = h("../range"); + h = function(e) { + this.element = document.createElement("div"); + this.element.className = "ace_layer ace_marker-layer"; + e.appendChild(this.element); + this.markers = {}; + this.$markerId = 1 + }; + (function() { + this.setDocument = function(e) { + this.doc = e + }; + this.addMarker = function(e, d, i) { + var c = this.$markerId++; + this.markers[c] = {range:e, type:i || "line", clazz:d}; + return c + }; + this.removeMarker = function(e) { + this.markers[e] && delete this.markers[e] + }; + this.update = function(e) { + if(e = e || this.config) { + this.config = e; + var d = []; + for(var i in this.markers) { + var c = this.markers[i], j = c.range.clipRows(e.firstRow, e.lastRow); + if(!j.isEmpty()) { + if(j.isMultiLine()) { + c.type == "text" ? this.drawTextMarker(d, j, c.clazz, e) : this.drawMultiLineMarker(d, j, c.clazz, e) + }else { + this.drawSingleLineMarker(d, j, c.clazz, e) + } + } + }this.element.innerHTML = d.join("") + } + }; + this.drawTextMarker = function(e, d, i, c) { + var j = d.start.row, a = new g(j, d.start.column, j, this.doc.getLine(j).length); + this.drawSingleLineMarker(e, a, i, c); + j = d.end.row; + a = new g(j, 0, j, d.end.column); + this.drawSingleLineMarker(e, a, i, c); + for(j = d.start.row + 1;j < d.end.row;j++) { + a.start.row = j; + a.end.row = j; + a.end.column = this.doc.getLine(j).length; + this.drawSingleLineMarker(e, a, i, c) + } + }; + this.drawMultiLineMarker = function(e, d, i, c) { + d = d.toScreenRange(this.doc); + var j = c.lineHeight, a = Math.round(c.width - d.start.column * c.characterWidth), f = (d.start.row - c.firstRow) * c.lineHeight, m = Math.round(d.start.column * c.characterWidth); + e.push("
"); + f = (d.end.row - c.firstRow) * c.lineHeight; + a = Math.round(d.end.column * c.characterWidth); + e.push("
"); + j = (d.end.row - d.start.row - 1) * c.lineHeight; + if(!(j < 0)) { + f = (d.start.row + 1 - c.firstRow) * c.lineHeight; + e.push("
") + } + }; + this.drawSingleLineMarker = function(e, d, i, c) { + d = d.toScreenRange(this.doc); + var j = c.lineHeight, a = Math.round((d.end.column - d.start.column) * c.characterWidth), f = (d.start.row - c.firstRow) * c.lineHeight; + d = Math.round(d.start.column * c.characterWidth); + e.push("
") + } + }).call(h.prototype); + return h +}); +define("ace/lib/dom", ["require", "exports", "module", "./lang"], function(h) { + var g = h("./lang"), e = {}; + e.setText = function(d, i) { + if(d.innerText !== undefined) { + d.innerText = i + }if(d.textContent !== undefined) { + d.textContent = i + } + }; + e.hasCssClass = function(d, i) { + d = d.className.split(/\s+/g); + return g.arrayIndexOf(d, i) !== -1 + }; + e.addCssClass = function(d, i) { + e.hasCssClass(d, i) || (d.className += " " + i) + }; + e.removeCssClass = function(d, i) { + for(var c = d.className.split(/\s+/g);;) { + var j = g.arrayIndexOf(c, i); + if(j == -1) { + break + }c.splice(j, 1) + }d.className = c.join(" ") + }; + e.importCssString = function(d, i) { + i = i || document; + if(i.createStyleSheet) { + i.createStyleSheet().cssText = d + }else { + var c = i.createElement("style"); + c.appendChild(i.createTextNode(d)); + i.getElementsByTagName("head")[0].appendChild(c) + } + }; + e.getInnerWidth = function(d) { + return parseInt(e.computedStyle(d, "paddingLeft")) + parseInt(e.computedStyle(d, "paddingRight")) + d.clientWidth + }; + e.getInnerHeight = function(d) { + return parseInt(e.computedStyle(d, "paddingTop")) + parseInt(e.computedStyle(d, "paddingBottom")) + d.clientHeight + }; + e.computedStyle = function(d, i) { + return window.getComputedStyle ? (window.getComputedStyle(d, "") || {})[i] || "" : d.currentStyle[i] + }; + e.scrollbarWidth = function() { + var d = document.createElement("p"); + d.style.width = "100%"; + d.style.height = "200px"; + var i = document.createElement("div"), c = i.style; + c.position = "absolute"; + c.left = "-10000px"; + c.overflow = "hidden"; + c.width = "200px"; + c.height = "150px"; + i.appendChild(d); + document.body.appendChild(i); + var j = d.offsetWidth; + c.overflow = "scroll"; + d = d.offsetWidth; + if(j == d) { + d = i.clientWidth + }document.body.removeChild(i); + return j - d + }; + return e +}); +define("ace/layer/text", ["require", "exports", "module", "../lib/oop", "../lib/dom", "../event_emitter"], function(h) { + var g = h("../lib/oop"), e = h("../lib/dom"), d = h("../event_emitter"); + h = function(i) { + this.element = document.createElement("div"); + this.element.className = "ace_layer ace_text-layer"; + i.appendChild(this.element); + this.$characterSize = this.$measureSizes(); + this.$pollSizeChanges() + }; + (function() { + g.implement(this, d); + this.EOF_CHAR = "¶"; + this.EOL_CHAR = "¬"; + this.TAB_CHAR = "→"; + this.SPACE_CHAR = "·"; + this.setTokenizer = function(i) { + this.tokenizer = i + }; + this.getLineHeight = function() { + return this.$characterSize.height || 1 + }; + this.getCharacterWidth = function() { + return this.$characterSize.width || 1 + }; + this.$pollSizeChanges = function() { + var i = this; + setInterval(function() { + var c = i.$measureSizes(); + if(i.$characterSize.width !== c.width || i.$characterSize.height !== c.height) { + i.$characterSize = c; + i.$dispatchEvent("changeCharaterSize", {data:c}) + } + }, 500) + }; + this.$fontStyles = {fontFamily:1, fontSize:1, fontWeight:1, fontStyle:1, lineHeight:1}; + this.$measureSizes = function() { + var i = document.createElement("div"), c = i.style; + c.width = c.height = "auto"; + c.left = c.top = "-1000px"; + c.visibility = "hidden"; + c.position = "absolute"; + c.overflow = "visible"; + for(var j in this.$fontStyles) { + var a = e.computedStyle(this.element, j); + c[j] = a + }i.innerHTML = (new Array(1E3)).join("Xy"); + document.body.insertBefore(i, document.body.firstChild); + c = {height:i.offsetHeight, width:i.offsetWidth / 2E3}; + document.body.removeChild(i); + return c + }; + this.setDocument = function(i) { + this.doc = i + }; + this.$showInvisibles = false; + this.setShowInvisibles = function(i) { + this.$showInvisibles = i + }; + this.$computeTabString = function() { + var i = this.doc.getTabSize(); + if(this.$showInvisibles) { + i = i / 2; + this.$tabString = "" + (new Array(Math.floor(i))).join(" ") + this.TAB_CHAR + (new Array(Math.ceil(i) + 1)).join(" ") + "" + }else { + this.$tabString = (new Array(i + 1)).join(" ") + } + }; + this.updateLines = function(i, c, j) { + this.$computeTabString(); + var a = Math.max(c, i.firstRow), f = Math.min(j, i.lastRow), m = this.element.childNodes, n = this; + this.tokenizer.getTokens(a, f, function(b) { + for(var k = a;k <= f;k++) { + var p = m[k - i.firstRow]; + if(p) { + var o = []; + n.$renderLine(o, k, b[k - a].tokens); + p.innerHTML = o.join("") + } + } + }) + }; + this.scrollLines = function(i) { + function c(b) { + i.firstRow < f.firstRow ? a.$renderLinesFragment(i, i.firstRow, f.firstRow - 1, function(k) { + m.firstChild ? m.insertBefore(k, m.firstChild) : m.appendChild(k); + b() + }) : b() + } + function j() { + i.lastRow > f.lastRow && a.$renderLinesFragment(i, f.lastRow + 1, i.lastRow, function(b) { + m.appendChild(b) + }) + } + var a = this; + this.$computeTabString(); + var f = this.config; + this.config = i; + if(!f || f.lastRow < i.firstRow) { + return this.update(i) + }if(i.lastRow < f.firstRow) { + return this.update(i) + }var m = this.element; + if(f.firstRow < i.firstRow) { + for(var n = f.firstRow;n < i.firstRow;n++) { + m.removeChild(m.firstChild) + } + }if(f.lastRow > i.lastRow) { + for(n = i.lastRow + 1;n <= f.lastRow;n++) { + m.removeChild(m.lastChild) + } + }c(j) + }; + this.$renderLinesFragment = function(i, c, j, a) { + var f = document.createDocumentFragment(), m = this; + this.tokenizer.getTokens(c, j, function(n) { + for(var b = c;b <= j;b++) { + var k = document.createElement("div"); + k.className = "ace_line"; + var p = k.style; + p.height = m.$characterSize.height + "px"; + p.width = i.width + "px"; + p = []; + m.$renderLine(p, b, n[b - c].tokens); + k.innerHTML = p.join(""); + f.appendChild(k) + }a(f) + }) + }; + this.update = function(i) { + this.$computeTabString(); + var c = [], j = this; + this.tokenizer.getTokens(i.firstRow, i.lastRow, function(a) { + for(var f = i.firstRow;f <= i.lastRow;f++) { + c.push("
"); + j.$renderLine(c, f, a[f - i.firstRow].tokens); + c.push("
") + }j.element.innerHTML = c.join("") + }) + }; + this.$textToken = {text:true, rparen:true, lparen:true}; + this.$renderLine = function(i, c, j) { + for(var a = /[\v\f \u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000]/g, f = 0;f < j.length;f++) { + var m = j[f], n = m.value.replace(/&/g, "&").replace(/", n, "") + } + }if(this.$showInvisibles) { + c !== this.doc.getLength() - 1 ? i.push("" + this.EOL_CHAR + "") : i.push("" + this.EOF_CHAR + "") + } + } + }).call(h.prototype); + return h +}); +define("ace/layer/cursor", ["require", "exports", "module", "../lib/dom"], function(h) { + var g = h("../lib/dom"); + h = function(e) { + this.element = document.createElement("div"); + this.element.className = "ace_layer ace_cursor-layer"; + e.appendChild(this.element); + this.cursor = document.createElement("div"); + this.cursor.className = "ace_cursor"; + this.isVisible = false + }; + (function() { + this.setDocument = function(e) { + this.doc = e + }; + this.setCursor = function(e, d) { + this.position = {row:e.row, column:this.doc.documentToScreenColumn(e.row, e.column)}; + d ? g.addCssClass(this.cursor, "ace_overwrite") : g.removeCssClass(this.cursor, "ace_overwrite") + }; + this.hideCursor = function() { + this.isVisible = false; + this.cursor.parentNode && this.cursor.parentNode.removeChild(this.cursor); + clearInterval(this.blinkId) + }; + this.showCursor = function() { + this.isVisible = true; + this.element.appendChild(this.cursor); + this.cursor.style.visibility = "visible"; + this.restartTimer() + }; + this.restartTimer = function() { + clearInterval(this.blinkId); + if(this.isVisible) { + var e = this.cursor; + this.blinkId = setInterval(function() { + e.style.visibility = "hidden"; + setTimeout(function() { + e.style.visibility = "visible" + }, 400) + }, 1E3) + } + }; + this.getPixelPosition = function() { + if(!this.config || !this.position) { + return{left:0, top:0} + }var e = this.position.row * this.config.lineHeight; + return{left:Math.round(this.position.column * this.config.characterWidth), top:e} + }; + this.update = function(e) { + if(this.position) { + this.config = e; + var d = Math.round(this.position.column * e.characterWidth), i = this.position.row * e.lineHeight; + this.pixelPos = {left:d, top:i}; + this.cursor.style.left = d + "px"; + this.cursor.style.top = i - e.firstRow * e.lineHeight + "px"; + this.cursor.style.width = e.characterWidth + "px"; + this.cursor.style.height = e.lineHeight + "px"; + this.isVisible && this.element.appendChild(this.cursor); + this.restartTimer() + } + } + }).call(h.prototype); + return h +}); +define("ace/scrollbar", ["require", "exports", "module", "./lib/oop", "./lib/lang", "./lib/dom", "./lib/event", "./event_emitter"], function(h) { + var g = h("./lib/oop"), e = h("./lib/lang"), d = h("./lib/dom"), i = h("./lib/event"), c = h("./event_emitter"); + h = function(j) { + this.element = document.createElement("div"); + this.element.className = "ace_sb"; + this.inner = document.createElement("div"); + this.element.appendChild(this.inner); + j.appendChild(this.element); + this.width = d.scrollbarWidth(); + this.element.style.width = this.width; + i.addListener(this.element, "scroll", e.bind(this.onScroll, this)) + }; + (function() { + g.implement(this, c); + this.onScroll = function() { + this.$dispatchEvent("scroll", {data:this.element.scrollTop}) + }; + this.getWidth = function() { + return this.width + }; + this.setHeight = function(j) { + this.element.style.height = Math.max(0, j - this.width) + "px" + }; + this.setInnerHeight = function(j) { + this.inner.style.height = j + "px" + }; + this.setScrollTop = function(j) { + this.element.scrollTop = j + } + }).call(h.prototype); + return h +}); +define("ace/renderloop", ["require", "exports", "module", "./lib/event"], function(h) { + var g = h("./lib/event"); + h = function(e) { + this.onRender = e; + this.pending = false; + this.changes = 0 + }; + (function() { + this.schedule = function(e) { + this.changes |= e; + if(!this.pending) { + this.pending = true; + var d = this; + this.setTimeoutZero(function() { + d.pending = false; + d.onRender(d.changes); + d.changes = 0 + }) + } + }; + if(window.postMessage) { + this.messageName = "zero-timeout-message"; + this.setTimeoutZero = function(e) { + if(!this.attached) { + var d = this; + g.addListener(window, "message", function(i) { + if(i.source == window && d.callback && i.data == d.messageName) { + g.stopPropagation(i); + d.callback() + } + }); + this.attached = true + }this.callback = e; + window.postMessage(this.messageName, "*") + } + }else { + this.setTimeoutZero = function(e) { + setTimeout(e, 0) + } + } + }).call(h.prototype); + return h +}); +define("ace/virtual_renderer", ["require", "exports", "module", 'text!ace/css/editor.css!.ace_editor {\n position: absolute;\n overflow: hidden;\n\n font-family: "Menlo", "Monaco", "Courier New", monospace;\n font-size: 12px; \n}\n\n.ace_scroller {\n position: absolute;\n overflow-x: scroll;\n overflow-y: hidden; \n}\n\n.ace_gutter {\n position: absolute;\n overflow-x: hidden;\n overflow-y: hidden;\n height: 100%;\n}\n\n.ace_editor .ace_sb {\n position: absolute;\n overflow-x: hidden;\n overflow-y: scroll;\n right: 0;\n}\n\n.ace_editor .ace_sb div {\n position: absolute;\n width: 1px;\n left: 0px;\n}\n\n.ace_editor .ace_printMargin {\n position: absolute;\n height: 100%;\n}\n\n.ace_layer {\n z-index: 0;\n position: absolute;\n overflow: hidden; \n white-space: nowrap;\n height: 100%;\n}\n\n.ace_text-layer {\n font-family: Monaco, "Courier New", monospace;\n color: black;\n}\n\n.ace_cursor-layer {\n cursor: text;\n}\n\n.ace_cursor {\n z-index: 3;\n position: absolute;\n}\n\n.ace_line {\n white-space: nowrap;\n}\n\n.ace_marker-layer {\n}\n\n.ace_marker-layer .ace_step {\n position: absolute;\n z-index: 2;\n}\n\n.ace_marker-layer .ace_selection {\n position: absolute;\n z-index: 3;\n}\n\n.ace_marker-layer .ace_bracket {\n position: absolute;\n z-index: 4;\n}\n\n.ace_marker-layer .ace_active_line {\n position: absolute;\n z-index: 1;\n}', +"./lib/oop", "./lib/oop", "./lib/event", "./layer/gutter", "./layer/marker", "./layer/text", "./layer/cursor", "./scrollbar", "./renderloop", "./event_emitter"], function(h, g, e, d) { + var i = h("./lib/oop"), c = h("./lib/lang"), j = h("./lib/dom"), a = h("./lib/event"), f = h("./layer/gutter"), m = h("./layer/marker"), n = h("./layer/text"), b = h("./layer/cursor"), k = h("./scrollbar"), p = h("./renderloop"), o = h("./event_emitter"); + j.importCssString(d); + g = function(l, r) { + this.container = l; + j.addCssClass(this.container, "ace_editor"); + this.setTheme(r); + this.scroller = document.createElement("div"); + this.scroller.className = "ace_scroller"; + this.container.appendChild(this.scroller); + this.$gutter = document.createElement("div"); + this.$gutter.className = "ace_gutter"; + this.container.appendChild(this.$gutter); + this.content = document.createElement("div"); + this.content.style.position = "absolute"; + this.scroller.appendChild(this.content); + this.$gutterLayer = new f(this.$gutter); + this.$markerLayer = new m(this.content); + var q = this.$textLayer = new n(this.content); + this.canvas = q.element; + this.characterWidth = q.getCharacterWidth(); + this.lineHeight = q.getLineHeight(); + this.$cursorLayer = new b(this.content); + this.layers = [this.$markerLayer, q, this.$cursorLayer]; + this.scrollBar = new k(l); + this.scrollBar.addEventListener("scroll", c.bind(this.onScroll, this)); + this.scrollTop = 0; + this.cursorPos = {row:0, column:0}; + var s = this; + this.$textLayer.addEventListener("changeCharaterSize", function() { + s.characterWidth = q.getCharacterWidth(); + s.lineHeight = q.getLineHeight(); + s.$loop.schedule(s.CHANGE_FULL) + }); + a.addListener(this.$gutter, "click", c.bind(this.$onGutterClick, this)); + a.addListener(this.$gutter, "dblclick", c.bind(this.$onGutterClick, this)); + this.$size = {width:0, height:0, scrollerHeight:0, scrollerWidth:0}; + this.$loop = new p(c.bind(this.$renderChanges, this)); + this.$loop.schedule(this.CHANGE_FULL); + this.$updatePrintMargin(); + this.setPadding(4) + }; + (function() { + this.showGutter = true; + 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_FULL = 128; + i.implement(this, o); + this.setDocument = function(l) { + this.lines = l.lines; + this.doc = l; + this.$cursorLayer.setDocument(l); + this.$markerLayer.setDocument(l); + this.$textLayer.setDocument(l); + this.$loop.schedule(this.CHANGE_FULL) + }; + this.updateLines = function(l, r) { + if(r === undefined) { + r = Infinity + }if(this.$changedLines) { + if(this.$changedLines.firstRow > l) { + this.$changedLines.firstRow = l + }if(this.$changedLines.lastRow < r) { + this.$changedLines.lastRow = r + } + }else { + this.$changedLines = {firstRow:l, lastRow:r} + }this.$loop.schedule(this.CHANGE_LINES) + }; + this.updateText = function() { + this.$loop.schedule(this.CHANGE_TEXT) + }; + this.updateFull = function() { + this.$loop.schedule(this.CHANGE_FULL) + }; + this.onResize = function() { + this.$loop.schedule(this.CHANGE_SIZE); + var l = j.getInnerHeight(this.container); + if(this.$size.height != l) { + this.$size.height = l; + this.scroller.style.height = l + "px"; + this.scrollBar.setHeight(l); + if(this.doc) { + this.scrollToY(this.getScrollTop()); + this.$loop.schedule(this.CHANGE_FULL) + } + }l = j.getInnerWidth(this.container); + if(this.$size.width != l) { + this.$size.width = l; + var r = this.showGutter ? this.$gutter.offsetWidth : 0; + this.scroller.style.left = r + "px"; + this.scroller.style.width = Math.max(0, l - r - this.scrollBar.getWidth()) + "px" + }this.$size.scrollerWidth = this.scroller.clientWidth; + this.$size.scrollerHeight = this.scroller.clientHeight + }; + this.setTokenizer = function(l) { + this.$tokenizer = l; + this.$textLayer.setTokenizer(l); + this.$loop.schedule(this.CHANGE_TEXT) + }; + this.$onGutterClick = function(l) { + var r = a.getDocumentX(l), q = a.getDocumentY(l); + this.$dispatchEvent("gutter" + l.type, {row:this.screenToTextCoordinates(r, q).row, htmlEvent:l}) + }; + this.$showInvisibles = true; + this.setShowInvisibles = function(l) { + this.$showInvisibles = l; + this.$textLayer.setShowInvisibles(l); + this.$loop.schedule(this.CHANGE_TEXT) + }; + this.getShowInvisibles = function() { + return this.$showInvisibles + }; + this.$showPrintMargin = true; + this.setShowPrintMargin = function(l) { + this.$showPrintMargin = l; + this.$updatePrintMargin() + }; + this.getShowPrintMargin = function() { + return this.$showPrintMargin + }; + this.$printMarginColumn = 80; + this.setPrintMarginColumn = function(l) { + this.$printMarginColumn = l; + this.$updatePrintMargin() + }; + this.getPrintMarginColumn = function() { + return this.$printMarginColumn + }; + this.setShowGutter = function(l) { + this.$gutter.style.display = l ? "block" : "none"; + this.showGutter = l; + this.onResize() + }; + this.$updatePrintMargin = function() { + if(this.$showPrintMargin || this.$printMarginEl) { + if(!this.$printMarginEl) { + this.$printMarginEl = document.createElement("div"); + this.$printMarginEl.className = "ace_printMargin"; + this.content.insertBefore(this.$printMarginEl, this.$textLayer.element) + }var l = this.$printMarginEl.style; + l.left = this.characterWidth * this.$printMarginColumn + "px"; + l.visibility = this.$showPrintMargin ? "visible" : "hidden" + } + }; + this.getContainerElement = function() { + return this.container + }; + this.getMouseEventTarget = function() { + return this.content + }; + this.getFirstVisibleRow = function() { + return(this.layerConfig || {}).firstRow || 0 + }; + this.getFirstFullyVisibleRow = function() { + if(!this.layerConfig) { + return 0 + }return this.layerConfig.firstRow + (this.layerConfig.offset == 0 ? 0 : 1) + }; + this.getLastFullyVisibleRow = function() { + if(!this.layerConfig) { + return 0 + }return this.layerConfig.firstRow - 1 + Math.floor((this.layerConfig.height + this.layerConfig.offset) / this.layerConfig.lineHeight) + }; + this.getLastVisibleRow = function() { + return(this.layerConfig || {}).lastRow || 0 + }; + this.$padding = null; + this.setPadding = function(l) { + this.$padding = l; + this.content.style.padding = "0 " + l + "px"; + this.$loop.schedule(this.CHANGE_FULL) + }; + this.onScroll = function(l) { + this.scrollToY(l.data) + }; + this.$updateScrollBar = function() { + this.scrollBar.setInnerHeight(this.doc.getLength() * this.lineHeight); + this.scrollBar.setScrollTop(this.scrollTop) + }; + this.$renderChanges = function(l) { + if(!(!l || !this.doc || !this.$tokenizer)) { + if(!this.layerConfig || l & this.CHANGE_FULL || l & this.CHANGE_SIZE || l & this.CHANGE_TEXT || l & this.CHANGE_LINES || l & this.CHANGE_SCROLL) { + this.$computeLayerConfig() + }if(l & this.CHANGE_FULL) { + this.$textLayer.update(this.layerConfig); + this.showGutter && this.$gutterLayer.update(this.layerConfig); + this.$markerLayer.update(this.layerConfig); + this.$cursorLayer.update(this.layerConfig); + this.$updateScrollBar() + }else { + if(l & this.CHANGE_SCROLL) { + l & this.CHANGE_TEXT || l & this.CHANGE_LINES ? this.$textLayer.scrollLines(this.layerConfig) : this.$textLayer.update(this.layerConfig); + this.showGutter && this.$gutterLayer.update(this.layerConfig); + this.$markerLayer.update(this.layerConfig); + this.$cursorLayer.update(this.layerConfig); + this.$updateScrollBar() + }else { + if(l & this.CHANGE_TEXT) { + this.$textLayer.update(this.layerConfig); + this.showGutter && this.$gutterLayer.update(this.layerConfig) + }else { + if(l & this.CHANGE_LINES) { + this.$updateLines(); + this.$updateScrollBar() + }else { + if(l & this.CHANGE_SCROLL) { + this.$textLayer.scrollLines(this.layerConfig); + this.showGutter && this.$gutterLayer.update(this.layerConfig) + } + } + }l & this.CHANGE_GUTTER && this.showGutter && this.$gutterLayer.update(this.layerConfig); + l & this.CHANGE_CURSOR && this.$cursorLayer.update(this.layerConfig); + l & this.CHANGE_MARKER && this.$markerLayer.update(this.layerConfig); + l & this.CHANGE_SIZE && this.$updateScrollBar() + } + } + } + }; + this.$computeLayerConfig = function() { + var l = this.scrollTop % this.lineHeight, r = this.$size.scrollerHeight + this.lineHeight, q = this.$getLongestLine(), s = !this.layerConfig ? true : this.layerConfig.width != q, t = Math.ceil(r / this.lineHeight), u = Math.max(0, Math.round((this.scrollTop - l) / this.lineHeight)); + t = Math.min(this.lines.length, u + t) - 1; + this.layerConfig = {width:q, padding:this.$padding, firstRow:u, lastRow:t, lineHeight:this.lineHeight, characterWidth:this.characterWidth, minHeight:r, offset:l, height:this.$size.scrollerHeight}; + for(u = 0;u < this.layers.length;u++) { + t = this.layers[u]; + if(s) { + t.element.style.width = q + "px" + } + }this.$gutterLayer.element.style.marginTop = -l + "px"; + this.content.style.marginTop = -l + "px"; + this.content.style.width = q + "px"; + this.content.style.height = r + "px" + }; + this.$updateLines = function() { + var l = this.$changedLines.firstRow, r = this.$changedLines.lastRow; + this.$changedLines = null; + var q = this.layerConfig; + if(q.width != this.$getLongestLine()) { + return this.$textLayer.update(q) + }if(!(l > q.lastRow + 1)) { + if(!(r < q.firstRow)) { + if(r === Infinity) { + this.showGutter && this.$gutterLayer.update(q); + this.$textLayer.update(q) + }else { + this.$textLayer.updateLines(q, l, r) + } + } + } + }; + this.$getLongestLine = function() { + var l = this.doc.getScreenWidth(); + if(this.$showInvisibles) { + l += 1 + }return Math.max(this.$size.scrollerWidth - this.$padding * 2, Math.round(l * this.characterWidth)) + }; + this.addMarker = function(l, r, q) { + l = this.$markerLayer.addMarker(l, r, q); + this.$loop.schedule(this.CHANGE_MARKER); + return l + }; + this.removeMarker = function(l) { + this.$markerLayer.removeMarker(l); + this.$loop.schedule(this.CHANGE_MARKER) + }; + this.addGutterDecoration = function(l, r) { + this.$gutterLayer.addGutterDecoration(l, r); + this.$loop.schedule(this.CHANGE_GUTTER) + }; + this.removeGutterDecoration = function(l, r) { + this.$gutterLayer.removeGutterDecoration(l, r); + this.$loop.schedule(this.CHANGE_GUTTER) + }; + this.setBreakpoints = function(l) { + this.$gutterLayer.setBreakpoints(l); + this.$loop.schedule(this.CHANGE_GUTTER) + }; + this.updateCursor = function(l, r) { + this.$cursorLayer.setCursor(l, r); + this.$loop.schedule(this.CHANGE_CURSOR) + }; + this.hideCursor = function() { + this.$cursorLayer.hideCursor() + }; + this.showCursor = function() { + this.$cursorLayer.showCursor() + }; + this.scrollCursorIntoView = function() { + var l = this.$cursorLayer.getPixelPosition(), r = l.left + this.$padding; + l = l.top; + this.getScrollTop() > l && this.scrollToY(l); + this.getScrollTop() + this.$size.scrollerHeight < l + this.lineHeight && this.scrollToY(l + this.lineHeight - this.$size.scrollerHeight); + this.scroller.scrollLeft > r && this.scrollToX(r); + this.scroller.scrollLeft + this.$size.scrollerWidth < r + this.characterWidth && this.scrollToX(Math.round(r + this.characterWidth - this.$size.scrollerWidth)) + }; + this.getScrollTop = function() { + return this.scrollTop + }; + this.getScrollLeft = function() { + return this.scroller.scrollLeft + }; + this.getScrollTopRow = function() { + return this.scrollTop / this.lineHeight + }; + this.scrollToRow = function(l) { + this.scrollToY(l * this.lineHeight) + }; + this.scrollToY = function(l) { + l = Math.max(0, Math.min(this.lines.length * this.lineHeight - this.$size.scrollerHeight, l)); + if(this.scrollTop !== l) { + this.scrollTop = l; + this.$loop.schedule(this.CHANGE_SCROLL) + } + }; + this.scrollToX = function(l) { + if(l <= this.$padding) { + l = 0 + }this.scroller.scrollLeft = l + }; + this.scrollBy = function(l, r) { + r && this.scrollToY(this.scrollTop + r); + l && this.scrollToX(this.scroller.scrollLeft + l) + }; + this.screenToTextCoordinates = function(l, r) { + var q = this.scroller.getBoundingClientRect(); + l = Math.round((l + this.scroller.scrollLeft - q.left - this.$padding) / this.characterWidth); + r = Math.floor((r + this.scrollTop - q.top) / this.lineHeight); + return{row:r, column:this.doc.screenToDocumentColumn(Math.max(0, Math.min(r, this.doc.getLength() - 1)), l)} + }; + this.textToScreenCoordinates = function(l, r) { + var q = this.scroller.getBoundingClientRect(); + r = this.padding + Math.round(this.doc.documentToScreenColumn(l, r) * this.characterWidth); + l = l * this.lineHeight; + return{pageX:q.left + r - this.getScrollLeft(), pageY:q.top + l - this.getScrollTop()} + }; + this.visualizeFocus = function() { + j.addCssClass(this.container, "ace_focus") + }; + this.visualizeBlur = function() { + j.removeCssClass(this.container, "ace_focus") + }; + this.showComposition = function() { + }; + this.setCompositionText = function() { + }; + this.hideComposition = function() { + }; + this.setTheme = function(l) { + function r(s) { + q.$theme && j.removeCssClass(q.container, q.$theme); + q.$theme = s ? s.cssClass : null; + q.$theme && j.addCssClass(q.container, q.$theme); + if(q.$size) { + q.$size.width = 0; + q.onResize() + } + } + var q = this; + if(!l || typeof l == "string") { + l = l || "ace/theme/TextMate"; + h([l], function(s) { + r(s) + }) + }else { + r(l) + }q = this + } + }).call(g.prototype); + return g +}); +define("ace/mode/doc_comment_highlight_rules", ["require", "exports", "module", "../lib/oop", "./text_highlight_rules"], function(h) { + var g = h("../lib/oop"); + h = h("./text_highlight_rules"); + var e = function() { + this.$rules = {start:[{token:"comment.doc", regex:"\\*\\/", next:"start"}, {token:"comment.doc.tag", regex:"@[\\w\\d_]+"}, {token:"comment.doc", regex:"s+"}, {token:"comment.doc", regex:"[^@\\*]+"}, {token:"comment.doc", regex:"."}]} + }; + g.inherits(e, h); + (function() { + this.getStartRule = function(d) { + return{token:"comment.doc", regex:"\\/\\*(?=\\*)", next:d} + } + }).call(e.prototype); + return e +}); +define("ace/mode/javascript_highlight_rules", ["require", "exports", "module", "../lib/oop", "../lib/lang", "./doc_comment_highlight_rules", "./text_highlight_rules"], function(h) { + var g = h("../lib/oop"), e = h("../lib/lang"), d = h("./doc_comment_highlight_rules"); + h = h("./text_highlight_rules"); + JavaScriptHighlightRules = function() { + var i = new d, c = e.arrayToMap("break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|var|while|with".split("|")), j = e.arrayToMap("true|false|null|undefined|Infinity|NaN|undefined".split("|")), a = e.arrayToMap("class|enum|extends|super|const|export|import|implements|let|private|public|yield|interface|package|protected|static".split("|")); + this.$rules = {start:[{token:"comment", regex:"\\/\\/.*$"}, i.getStartRule("doc-start"), {token:"comment", regex:"\\/\\*", next:"comment"}, {token:"string.regexp", regex:"[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/][gimy]*\\s*(?=[).,;]|$)"}, {token:"string", regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'}, {token:"string", regex:'["].*\\\\$', next:"qqstring"}, {token:"string", regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"}, {token:"string", regex:"['].*\\\\$", next:"qstring"}, {token:"constant.numeric", + regex:"0[xX][0-9a-fA-F]+\\b"}, {token:"constant.numeric", regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"}, {token:function(f) { + return f == "this" ? "variable.language" : c[f] ? "keyword" : j[f] ? "constant.language" : a[f] ? "invalid.illegal" : f == "debugger" ? "invalid.deprecated" : "identifier" + }, 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", regex:".*?\\*\\/", next:"start"}, {token:"comment", regex:".+"}], qqstring:[{token:"string", regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"', + next:"start"}, {token:"string", regex:".+"}], qstring:[{token:"string", regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'", next:"start"}, {token:"string", regex:".+"}]}; + this.addRules(i.getRules(), "doc-"); + this.$rules["doc-start"][0].next = "start" + }; + g.inherits(JavaScriptHighlightRules, h); + return JavaScriptHighlightRules +}); +define("ace/mode/matching_brace_outdent", ["require", "exports", "module", "../range"], function(h) { + var g = h("../range"); + h = function() { + }; + (function() { + this.checkOutdent = function(e, d) { + if(!/^\s+$/.test(e)) { + return false + }return/^\s*\}/.test(d) + }; + this.autoOutdent = function(e, d) { + var i = e.getLine(d).match(/^(\s*\})/); + if(!i) { + return 0 + }i = i[1].length; + var c = e.findMatchingBracket({row:d, column:i}); + if(!c || c.row == d) { + return 0 + }c = this.$getIndent(e.getLine(c.row)); + e.replace(new g(d, 0, d, i - 1), c); + return c.length - (i - 1) + }; + this.$getIndent = function(e) { + if(e = e.match(/^(\s+)/)) { + return e[1] + }return"" + } + }).call(h.prototype); + return h +}); +define("ace/mode/javascript", ["require", "exports", "module", "../lib/oop", "./text", "../tokenizer", "./javascript_highlight_rules", "./matching_brace_outdent", "../range"], function(h) { + var g = h("../lib/oop"), e = h("./text"), d = h("../tokenizer"), i = h("./javascript_highlight_rules"), c = h("./matching_brace_outdent"), j = h("../range"); + h = function() { + this.$tokenizer = new d((new i).getRules()); + this.$outdent = new c + }; + g.inherits(h, e); + (function() { + this.toggleCommentLines = function(a, f, m) { + var n = true; + a = /^(\s*)\/\//; + for(var b = m.start.row;b <= m.end.row;b++) { + if(!a.test(f.getLine(b))) { + n = false; + break + } + }if(n) { + n = new j(0, 0, 0, 0); + for(b = m.start.row;b <= m.end.row;b++) { + var k = f.getLine(b).replace(a, "$1"); + n.start.row = b; + n.end.row = b; + n.end.column = k.length + 2; + f.replace(n, k) + }return-2 + }else { + return f.indentRows(m, "//") + } + }; + this.getNextLineIndent = function(a, f, m) { + var n = this.$getIndent(f), b = this.$tokenizer.getLineTokens(f, a), k = b.tokens; + b = b.state; + if(k.length && k[k.length - 1].type == "comment") { + return n + }if(a == "start") { + if(a = f.match(/^.*[\{\(\[]\s*$/)) { + n += m + } + }else { + if(a == "doc-start") { + if(b == "start") { + return"" + }if(a = f.match(/^\s*(\/?)\*/)) { + if(a[1]) { + n += " " + }n += "* " + } + } + }return n + }; + this.checkOutdent = function(a, f, m) { + return this.$outdent.checkOutdent(f, m) + }; + this.autoOutdent = function(a, f, m) { + return this.$outdent.autoOutdent(f, m) + } + }).call(h.prototype); + return h +}); +define("ace/theme/textmate", ["require", "exports", "module", "text!ace/theme/tm.css!.ace-tm .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-tm .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-tm .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-tm .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-tm .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-tm .ace_editor .ace_printMargin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-tm .ace_text-layer {\n cursor: text;\n}\n\n.ace-tm .ace_cursor {\n border-left: 2px solid black;\n}\n\n.ace-tm .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid black;\n}\n \n.ace-tm .ace_line .ace_invisible {\n color: rgb(191, 191, 191);\n}\n\n.ace-tm .ace_line .ace_keyword {\n color: blue;\n}\n\n.ace-tm .ace_line .ace_constant.ace_buildin {\n color: rgb(88, 72, 246);\n}\n\n.ace-tm .ace_line .ace_constant.ace_library {\n color: rgb(6, 150, 14);\n}\n\n.ace-tm .ace_line .ace_invalid {\n background-color: rgb(153, 0, 0);\n color: white;\n}\n\n.ace-tm .ace_line .ace_support.ace_function {\n color: rgb(60, 76, 114);\n}\n\n.ace-tm .ace_line .ace_keyword.ace_operator {\n color: rgb(104, 118, 135);\n}\n\n.ace-tm .ace_line .ace_string {\n color: rgb(3, 106, 7);\n}\n\n.ace-tm .ace_line .ace_comment {\n color: rgb(76, 136, 107);\n}\n\n.ace-tm .ace_line .ace_comment.ace_doc {\n color: rgb(0, 102, 255);\n}\n\n.ace-tm .ace_line .ace_comment.ace_doc.ace_tag {\n color: rgb(128, 159, 191);\n}\n\n.ace-tm .ace_line .ace_constant.ace_numeric {\n color: rgb(0, 0, 205);\n}\n\n.ace-tm .ace_line .ace_variable {\n color: rgb(49, 132, 149);\n}\n\n.ace-tm .ace_line .ace_xml_pe {\n color: rgb(104, 104, 91);\n}\n\n.ace-tm .ace_marker-layer .ace_selection {\n background: rgb(181, 213, 255);\n}\n\n.ace-tm .ace_marker-layer .ace_step {\n background: rgb(252, 255, 0);\n}\n\n.ace-tm .ace_marker-layer .ace_stack {\n background: rgb(164, 229, 101);\n}\n\n.ace-tm .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgb(192, 192, 192);\n}\n\n.ace-tm .ace_marker-layer .ace_active_line {\n background: rgb(232, 242, 254);\n}\n\n.ace-tm .ace_string.ace_regex {\n color: rgb(255, 0, 0) \n}", +"../lib/dom"], function(h, g, e, d) { + h("../lib/dom").importCssString(d); + return{cssClass:"ace-tm"} +}); \ No newline at end of file diff --git a/build/ace/event_emitter.js b/build/ace/event_emitter.js new file mode 100644 index 00000000..3579934c --- /dev/null +++ b/build/ace/event_emitter.js @@ -0,0 +1,29 @@ +define(function(d) { + var e = d("./lib/lang"); + d = {}; + d.$dispatchEvent = function(a, b) { + this.$eventRegistry = this.$eventRegistry || {}; + var c = this.$eventRegistry[a]; + if(c && c.length) { + b = b || {}; + b.type = a; + for(a = 0;a < c.length;a++) { + c[a](b) + } + } + }; + d.on = d.addEventListener = function(a, b) { + this.$eventRegistry = this.$eventRegistry || {}; + var c = this.$eventRegistry[a]; + c || (c = this.$eventRegistry[a] = []); + e.arrayIndexOf(c, b) == -1 && c.push(b) + }; + d.removeEventListener = function(a, b) { + this.$eventRegistry = this.$eventRegistry || {}; + if(a = this.$eventRegistry[a]) { + b = e.arrayIndexOf(a, b); + b !== -1 && a.splice(b, 1) + } + }; + return d +}); \ No newline at end of file diff --git a/build/ace/keybinding.js b/build/ace/keybinding.js new file mode 100644 index 00000000..2751eb22 --- /dev/null +++ b/build/ace/keybinding.js @@ -0,0 +1,56 @@ +define(function(e) { + var m = e("./lib/core"), l = e("./lib/event"), n = e("./conf/keybindings/default_mac"), o = e("./conf/keybindings/default_win"), p = e("./plugin_manager"); + e("./commands/default_commands"); + e = function(j, h, k) { + this.setConfig(k); + var a = this; + l.addKeyListener(j, function(b) { + var c = (a.config.reverse[0 | (b.ctrlKey ? 1 : 0) | (b.altKey ? 2 : 0) | (b.shiftKey ? 4 : 0) | (b.metaKey ? 8 : 0)] || {})[(a.keyNames[b.keyCode] || String.fromCharCode(b.keyCode)).toLowerCase()]; + if(c = p.commands[c]) { + c(h, h.getSelection()); + return l.stopEvent(b) + } + }) + }; + (function() { + function j(a, b, c, f) { + return(f && a.toLowerCase() || a).replace(/(?:^\s+|\n|\s+$)/g, "").split(new RegExp("[\\s ]*" + b + "[\\s ]*", "g"), c || 999) + } + function h(a, b, c) { + var f, g = 0; + a = j(a, "\\-", null, true); + for(var d = 0, i = a.length;d < i;++d) { + if(this.keyMods[a[d]]) { + g |= this.keyMods[a[d]] + }else { + f = a[d] || "-" + } + }(c[g] || (c[g] = {}))[f] = b; + return c + } + function k(a, b) { + var c, f, g, d, i = {}; + for(c in a) { + d = a[c]; + if(b && typeof d == "string") { + d = d.split(b); + f = 0; + for(g = d.length;f < g;++f) { + h.call(this, d[f], c, i) + } + }else { + h.call(this, d, c, i) + } + }return i + } + this.keyMods = {ctrl:1, alt:2, option:2, shift:4, meta:8, command:8}; + this.keyNames = {"8":"Backspace", "9":"Tab", "13":"Enter", "27":"Esc", "32":"Space", "33":"PageUp", "34":"PageDown", "35":"End", "36":"Home", "37":"Left", "38":"Up", "39":"Right", "40":"Down", "45":"Insert", "46":"Delete", "107":"+", "112":"F1", "113":"F2", "114":"F3", "115":"F4", "116":"F5", "117":"F6", "118":"F7", "119":"F8", "120":"F9", "121":"F10", "122":"F11", "123":"F12"}; + this.setConfig = function(a) { + this.config = a || (m.isMac ? n : o); + if(typeof this.config.reverse == "undefined") { + this.config.reverse = k.call(this, this.config, "|") + } + } + }).call(e.prototype); + return e +}); \ No newline at end of file diff --git a/build/ace/layer/cursor.js b/build/ace/layer/cursor.js new file mode 100644 index 00000000..c8450fa9 --- /dev/null +++ b/build/ace/layer/cursor.js @@ -0,0 +1,63 @@ +define(function(b) { + var d = b("../lib/dom"); + b = function(a) { + this.element = document.createElement("div"); + this.element.className = "ace_layer ace_cursor-layer"; + a.appendChild(this.element); + this.cursor = document.createElement("div"); + this.cursor.className = "ace_cursor"; + this.isVisible = false + }; + (function() { + this.setDocument = function(a) { + this.doc = a + }; + this.setCursor = function(a, c) { + this.position = {row:a.row, column:this.doc.documentToScreenColumn(a.row, a.column)}; + c ? d.addCssClass(this.cursor, "ace_overwrite") : d.removeCssClass(this.cursor, "ace_overwrite") + }; + this.hideCursor = function() { + this.isVisible = false; + this.cursor.parentNode && this.cursor.parentNode.removeChild(this.cursor); + clearInterval(this.blinkId) + }; + this.showCursor = function() { + this.isVisible = true; + this.element.appendChild(this.cursor); + this.cursor.style.visibility = "visible"; + this.restartTimer() + }; + this.restartTimer = function() { + clearInterval(this.blinkId); + if(this.isVisible) { + var a = this.cursor; + this.blinkId = setInterval(function() { + a.style.visibility = "hidden"; + setTimeout(function() { + a.style.visibility = "visible" + }, 400) + }, 1E3) + } + }; + this.getPixelPosition = function() { + if(!this.config || !this.position) { + return{left:0, top:0} + }var a = this.position.row * this.config.lineHeight; + return{left:Math.round(this.position.column * this.config.characterWidth), top:a} + }; + this.update = function(a) { + if(this.position) { + this.config = a; + var c = Math.round(this.position.column * a.characterWidth), e = this.position.row * a.lineHeight; + this.pixelPos = {left:c, top:e}; + this.cursor.style.left = c + "px"; + this.cursor.style.top = e - a.firstRow * a.lineHeight + "px"; + this.cursor.style.width = a.characterWidth + "px"; + this.cursor.style.height = a.lineHeight + "px"; + this.isVisible && this.element.appendChild(this.cursor); + this.restartTimer() + } + } + }).call(b.prototype); + return b +}); \ No newline at end of file diff --git a/build/ace/layer/gutter.js b/build/ace/layer/gutter.js new file mode 100644 index 00000000..5934bb53 --- /dev/null +++ b/build/ace/layer/gutter.js @@ -0,0 +1,30 @@ +define(function() { + var d = function(a) { + this.element = document.createElement("div"); + this.element.className = "ace_layer ace_gutter-layer"; + a.appendChild(this.element); + this.$breakpoints = []; + this.$decorations = [] + }; + (function() { + this.addGutterDecoration = function(a, b) { + this.$decorations[a] || (this.$decorations[a] = ""); + this.$decorations[a] += " ace_" + b + }; + this.removeGutterDecoration = function(a, b) { + this.$decorations[a] = this.$decorations[a].replace(" ace_" + b, "") + }; + this.setBreakpoints = function(a) { + this.$breakpoints = a.concat() + }; + this.update = function(a) { + this.$config = a; + for(var b = [], c = a.firstRow;c <= a.lastRow;c++) { + b.push("
", c + 1, "
"); + b.push("") + }this.element.innerHTML = b.join(""); + this.element.style.height = a.minHeight + "px" + } + }).call(d.prototype); + return d +}); \ No newline at end of file diff --git a/build/ace/layer/marker.js b/build/ace/layer/marker.js new file mode 100644 index 00000000..ab3dc1d7 --- /dev/null +++ b/build/ace/layer/marker.js @@ -0,0 +1,72 @@ +define(function(h) { + var i = h("../range"); + h = function(c) { + this.element = document.createElement("div"); + this.element.className = "ace_layer ace_marker-layer"; + c.appendChild(this.element); + this.markers = {}; + this.$markerId = 1 + }; + (function() { + this.setDocument = function(c) { + this.doc = c + }; + this.addMarker = function(c, a, e) { + var b = this.$markerId++; + this.markers[b] = {range:c, type:e || "line", clazz:a}; + return b + }; + this.removeMarker = function(c) { + this.markers[c] && delete this.markers[c] + }; + this.update = function(c) { + if(c = c || this.config) { + this.config = c; + var a = []; + for(var e in this.markers) { + var b = this.markers[e], d = b.range.clipRows(c.firstRow, c.lastRow); + if(!d.isEmpty()) { + if(d.isMultiLine()) { + b.type == "text" ? this.drawTextMarker(a, d, b.clazz, c) : this.drawMultiLineMarker(a, d, b.clazz, c) + }else { + this.drawSingleLineMarker(a, d, b.clazz, c) + } + } + }this.element.innerHTML = a.join("") + } + }; + this.drawTextMarker = function(c, a, e, b) { + var d = a.start.row, f = new i(d, a.start.column, d, this.doc.getLine(d).length); + this.drawSingleLineMarker(c, f, e, b); + d = a.end.row; + f = new i(d, 0, d, a.end.column); + this.drawSingleLineMarker(c, f, e, b); + for(d = a.start.row + 1;d < a.end.row;d++) { + f.start.row = d; + f.end.row = d; + f.end.column = this.doc.getLine(d).length; + this.drawSingleLineMarker(c, f, e, b) + } + }; + this.drawMultiLineMarker = function(c, a, e, b) { + a = a.toScreenRange(this.doc); + var d = b.lineHeight, f = Math.round(b.width - a.start.column * b.characterWidth), g = (a.start.row - b.firstRow) * b.lineHeight, j = Math.round(a.start.column * b.characterWidth); + c.push("
"); + g = (a.end.row - b.firstRow) * b.lineHeight; + f = Math.round(a.end.column * b.characterWidth); + c.push("
"); + d = (a.end.row - a.start.row - 1) * b.lineHeight; + if(!(d < 0)) { + g = (a.start.row + 1 - b.firstRow) * b.lineHeight; + c.push("
") + } + }; + this.drawSingleLineMarker = function(c, a, e, b) { + a = a.toScreenRange(this.doc); + var d = b.lineHeight, f = Math.round((a.end.column - a.start.column) * b.characterWidth), g = (a.start.row - b.firstRow) * b.lineHeight; + a = Math.round(a.start.column * b.characterWidth); + c.push("
") + } + }).call(h.prototype); + return h +}); \ No newline at end of file diff --git a/build/ace/layer/text.js b/build/ace/layer/text.js new file mode 100644 index 00000000..58692e6a --- /dev/null +++ b/build/ace/layer/text.js @@ -0,0 +1,156 @@ +define(function(k) { + var m = k("../lib/oop"), n = k("../lib/dom"), o = k("../event_emitter"); + k = function(a) { + this.element = document.createElement("div"); + this.element.className = "ace_layer ace_text-layer"; + a.appendChild(this.element); + this.$characterSize = this.$measureSizes(); + this.$pollSizeChanges() + }; + (function() { + m.implement(this, o); + this.EOF_CHAR = "¶"; + this.EOL_CHAR = "¬"; + this.TAB_CHAR = "→"; + this.SPACE_CHAR = "·"; + this.setTokenizer = function(a) { + this.tokenizer = a + }; + this.getLineHeight = function() { + return this.$characterSize.height || 1 + }; + this.getCharacterWidth = function() { + return this.$characterSize.width || 1 + }; + this.$pollSizeChanges = function() { + var a = this; + setInterval(function() { + var b = a.$measureSizes(); + if(a.$characterSize.width !== b.width || a.$characterSize.height !== b.height) { + a.$characterSize = b; + a.$dispatchEvent("changeCharaterSize", {data:b}) + } + }, 500) + }; + this.$fontStyles = {fontFamily:1, fontSize:1, fontWeight:1, fontStyle:1, lineHeight:1}; + this.$measureSizes = function() { + var a = document.createElement("div"), b = a.style; + b.width = b.height = "auto"; + b.left = b.top = "-1000px"; + b.visibility = "hidden"; + b.position = "absolute"; + b.overflow = "visible"; + for(var e in this.$fontStyles) { + var f = n.computedStyle(this.element, e); + b[e] = f + }a.innerHTML = (new Array(1E3)).join("Xy"); + document.body.insertBefore(a, document.body.firstChild); + b = {height:a.offsetHeight, width:a.offsetWidth / 2E3}; + document.body.removeChild(a); + return b + }; + this.setDocument = function(a) { + this.doc = a + }; + this.$showInvisibles = false; + this.setShowInvisibles = function(a) { + this.$showInvisibles = a + }; + this.$computeTabString = function() { + var a = this.doc.getTabSize(); + if(this.$showInvisibles) { + a = a / 2; + this.$tabString = "" + (new Array(Math.floor(a))).join(" ") + this.TAB_CHAR + (new Array(Math.ceil(a) + 1)).join(" ") + "" + }else { + this.$tabString = (new Array(a + 1)).join(" ") + } + }; + this.updateLines = function(a, b, e) { + this.$computeTabString(); + var f = Math.max(b, a.firstRow), c = Math.min(e, a.lastRow), d = this.element.childNodes, h = this; + this.tokenizer.getTokens(f, c, function(i) { + for(var g = f;g <= c;g++) { + var j = d[g - a.firstRow]; + if(j) { + var l = []; + h.$renderLine(l, g, i[g - f].tokens); + j.innerHTML = l.join("") + } + } + }) + }; + this.scrollLines = function(a) { + function b(i) { + a.firstRow < c.firstRow ? f.$renderLinesFragment(a, a.firstRow, c.firstRow - 1, function(g) { + d.firstChild ? d.insertBefore(g, d.firstChild) : d.appendChild(g); + i() + }) : i() + } + function e() { + a.lastRow > c.lastRow && f.$renderLinesFragment(a, c.lastRow + 1, a.lastRow, function(i) { + d.appendChild(i) + }) + } + var f = this; + this.$computeTabString(); + var c = this.config; + this.config = a; + if(!c || c.lastRow < a.firstRow) { + return this.update(a) + }if(a.lastRow < c.firstRow) { + return this.update(a) + }var d = this.element; + if(c.firstRow < a.firstRow) { + for(var h = c.firstRow;h < a.firstRow;h++) { + d.removeChild(d.firstChild) + } + }if(c.lastRow > a.lastRow) { + for(h = a.lastRow + 1;h <= c.lastRow;h++) { + d.removeChild(d.lastChild) + } + }b(e) + }; + this.$renderLinesFragment = function(a, b, e, f) { + var c = document.createDocumentFragment(), d = this; + this.tokenizer.getTokens(b, e, function(h) { + for(var i = b;i <= e;i++) { + var g = document.createElement("div"); + g.className = "ace_line"; + var j = g.style; + j.height = d.$characterSize.height + "px"; + j.width = a.width + "px"; + j = []; + d.$renderLine(j, i, h[i - b].tokens); + g.innerHTML = j.join(""); + c.appendChild(g) + }f(c) + }) + }; + this.update = function(a) { + this.$computeTabString(); + var b = [], e = this; + this.tokenizer.getTokens(a.firstRow, a.lastRow, function(f) { + for(var c = a.firstRow;c <= a.lastRow;c++) { + b.push("
"); + e.$renderLine(b, c, f[c - a.firstRow].tokens); + b.push("
") + }e.element.innerHTML = b.join("") + }) + }; + this.$textToken = {text:true, rparen:true, lparen:true}; + this.$renderLine = function(a, b, e) { + for(var f = /[\v\f \u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000]/g, c = 0;c < e.length;c++) { + var d = e[c], h = d.value.replace(/&/g, "&").replace(/", h, "") + } + }if(this.$showInvisibles) { + b !== this.doc.getLength() - 1 ? a.push("" + this.EOL_CHAR + "") : a.push("" + this.EOF_CHAR + "") + } + } + }).call(k.prototype); + return k +}); \ No newline at end of file diff --git a/build/ace/lib/core.js b/build/ace/lib/core.js new file mode 100644 index 00000000..ee9f8a15 --- /dev/null +++ b/build/ace/lib/core.js @@ -0,0 +1,17 @@ +define(function() { + var a = {}, d = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase(); + a.isWin = d == "win"; + a.isMac = d == "mac"; + a.isLinux = d == "linux"; + a.isIE = !+"\u000b1"; + a.isGecko = window.controllers && window.navigator.product === "Gecko"; + a.provide = function(b) { + b = b.split("."); + for(var c = window, e = 0;e < b.length;e++) { + var f = b[e]; + c[f] || (c[f] = {}); + c = c[f] + } + }; + return a +}); \ No newline at end of file diff --git a/build/ace/lib/dom.js b/build/ace/lib/dom.js new file mode 100644 index 00000000..86245469 --- /dev/null +++ b/build/ace/lib/dom.js @@ -0,0 +1,65 @@ +define(function(g) { + var f = g("./lang"), c = {}; + c.setText = function(a, b) { + if(a.innerText !== undefined) { + a.innerText = b + }if(a.textContent !== undefined) { + a.textContent = b + } + }; + c.hasCssClass = function(a, b) { + a = a.className.split(/\s+/g); + return f.arrayIndexOf(a, b) !== -1 + }; + c.addCssClass = function(a, b) { + c.hasCssClass(a, b) || (a.className += " " + b) + }; + c.removeCssClass = function(a, b) { + for(var d = a.className.split(/\s+/g);;) { + var e = f.arrayIndexOf(d, b); + if(e == -1) { + break + }d.splice(e, 1) + }a.className = d.join(" ") + }; + c.importCssString = function(a, b) { + b = b || document; + if(b.createStyleSheet) { + b.createStyleSheet().cssText = a + }else { + var d = b.createElement("style"); + d.appendChild(b.createTextNode(a)); + b.getElementsByTagName("head")[0].appendChild(d) + } + }; + c.getInnerWidth = function(a) { + return parseInt(c.computedStyle(a, "paddingLeft")) + parseInt(c.computedStyle(a, "paddingRight")) + a.clientWidth + }; + c.getInnerHeight = function(a) { + return parseInt(c.computedStyle(a, "paddingTop")) + parseInt(c.computedStyle(a, "paddingBottom")) + a.clientHeight + }; + c.computedStyle = function(a, b) { + return window.getComputedStyle ? (window.getComputedStyle(a, "") || {})[b] || "" : a.currentStyle[b] + }; + c.scrollbarWidth = function() { + var a = document.createElement("p"); + a.style.width = "100%"; + a.style.height = "200px"; + var b = document.createElement("div"), d = b.style; + d.position = "absolute"; + d.left = "-10000px"; + d.overflow = "hidden"; + d.width = "200px"; + d.height = "150px"; + b.appendChild(a); + document.body.appendChild(b); + var e = a.offsetWidth; + d.overflow = "scroll"; + a = a.offsetWidth; + if(e == a) { + a = b.clientWidth + }document.body.removeChild(b); + return e - a + }; + return c +}); \ No newline at end of file diff --git a/build/ace/lib/event.js b/build/ace/lib/event.js new file mode 100644 index 00000000..a067cd6b --- /dev/null +++ b/build/ace/lib/event.js @@ -0,0 +1,134 @@ +define(function(m) { + var i = m("./core"), c = {}; + c.addListener = function(a, e, d) { + if(a.addEventListener) { + return a.addEventListener(e, d, false) + }if(a.attachEvent) { + var b = function() { + d(window.event) + }; + d.$$wrapper = b; + a.attachEvent("on" + e, b) + } + }; + c.removeListener = function(a, e, d) { + if(a.removeEventListener) { + return a.removeEventListener(e, d, false) + }if(a.detachEvent) { + a.detachEvent("on" + e, d.$$wrapper || d) + } + }; + c.stopEvent = function(a) { + c.stopPropagation(a); + c.preventDefault(a); + return false + }; + c.stopPropagation = function(a) { + if(a.stopPropagation) { + a.stopPropagation() + }else { + a.cancelBubble = true + } + }; + c.preventDefault = function(a) { + if(a.preventDefault) { + a.preventDefault() + }else { + a.returnValue = false + } + }; + c.getDocumentX = function(a) { + return a.clientX ? a.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) : a.pageX + }; + c.getDocumentY = function(a) { + return a.clientY ? a.clientY + (document.documentElement.scrollTop || document.body.scrollTop) : a.pageX + }; + c.getButton = function(a) { + return a.preventDefault ? a.button : Math.max(a.button - 1, 2) + }; + c.capture = document.documentElement.setCapture ? function(a, e, d) { + function b(h) { + e && e(h); + d && d(); + c.removeListener(a, "mousemove", e); + c.removeListener(a, "mouseup", b); + c.removeListener(a, "losecapture", b); + a.releaseCapture() + } + c.addListener(a, "mousemove", e); + c.addListener(a, "mouseup", b); + c.addListener(a, "losecapture", b); + a.setCapture() + } : function(a, e, d) { + function b(f) { + e(f); + f.stopPropagation() + } + function h(f) { + e && e(f); + d && d(); + document.removeEventListener("mousemove", b, true); + document.removeEventListener("mouseup", h, true); + f.stopPropagation() + } + document.addEventListener("mousemove", b, true); + document.addEventListener("mouseup", h, true) + }; + c.addMouseWheelListener = function(a, e) { + var d = function(b) { + if(b.wheelDelta !== undefined) { + if(b.wheelDeltaX !== undefined) { + b.wheelX = -b.wheelDeltaX / 8; + b.wheelY = -b.wheelDeltaY / 8 + }else { + b.wheelX = 0; + b.wheelY = -b.wheelDelta / 8 + } + }else { + if(b.axis && b.axis == b.HORIZONTAL_AXIS) { + b.wheelX = (b.detail || 0) * 5; + b.wheelY = 0 + }else { + b.wheelX = 0; + b.wheelY = (b.detail || 0) * 5 + } + }e(b) + }; + c.addListener(a, "DOMMouseScroll", d); + c.addListener(a, "mousewheel", d) + }; + c.addMultiMouseDownListener = function(a, e, d, b, h) { + var f = 0, j, k, l = function(g) { + f += 1; + if(f == 1) { + j = g.clientX; + k = g.clientY; + setTimeout(function() { + f = 0 + }, b || 600) + }if(c.getButton(g) != e || Math.abs(g.clientX - j) > 5 || Math.abs(g.clientY - k) > 5) { + f = 0 + }if(f == d) { + f = 0; + h(g) + }return c.preventDefault(g) + }; + c.addListener(a, "mousedown", l); + i.isIE && c.addListener(a, "dblclick", l) + }; + c.addKeyListener = function(a, e) { + var d = null; + c.addListener(a, "keydown", function(b) { + d = b.keyIdentifier || b.keyCode; + return e(b) + }); + i.isMac && i.isGecko && c.addListener(a, "keypress", function(b) { + if(d !== (b.keyIdentifier || b.keyCode)) { + return e(b) + }else { + d = null + } + }) + }; + return c +}); \ No newline at end of file diff --git a/build/ace/lib/lang.js b/build/ace/lib/lang.js new file mode 100644 index 00000000..4a3fac87 --- /dev/null +++ b/build/ace/lib/lang.js @@ -0,0 +1,56 @@ +define(function() { + var d = {}; + d.stringReverse = function(a) { + return a.split("").reverse().join("") + }; + d.stringRepeat = function(a, b) { + return(new Array(b + 1)).join(a) + }; + d.arrayIndexOf = Array.prototype.indexOf ? function(a, b) { + return a.indexOf(b) + } : function(a, b) { + for(var c = 0;c < a.length;c++) { + if(a[c] == b) { + return c + } + }return-1 + }; + d.isArray = function(a) { + return Object.prototype.toString.call(a) == "[object Array]" + }; + d.copyObject = function(a) { + var b = {}; + for(var c in a) { + b[c] = a[c] + }return b + }; + d.arrayToMap = function(a) { + for(var b = {}, c = 0;c < a.length;c++) { + b[a[c]] = 1 + }return b + }; + d.escapeRegExp = function(a) { + return a.replace(/([.*+?^${}()|[\]\/\\])/g, "\\$1") + }; + d.bind = function(a, b) { + return function() { + return a.apply(b, arguments) + } + }; + d.deferredCall = function(a) { + var b = null, c = function() { + b = null; + a() + }; + return{schedule:function() { + b || (b = setTimeout(c, 0)) + }, call:function() { + d.cancel(); + a() + }, cancel:function() { + clearTimeout(b); + b = null + }} + }; + return d +}); \ No newline at end of file diff --git a/build/ace/lib/oop.js b/build/ace/lib/oop.js new file mode 100644 index 00000000..53011e61 --- /dev/null +++ b/build/ace/lib/oop.js @@ -0,0 +1,20 @@ +define(function() { + var c = {}; + c.inherits = function(a, b) { + var d = function() { + }; + d.prototype = b.prototype; + a.super_ = b.prototype; + a.prototype = new d; + a.prototype.constructor = a + }; + c.mixin = function(a, b) { + for(var d in b) { + a[d] = b[d] + } + }; + c.implement = function(a, b) { + c.mixin(a, b) + }; + return c +}); \ No newline at end of file diff --git a/build/ace/mode/css.js b/build/ace/mode/css.js new file mode 100644 index 00000000..a41740fb --- /dev/null +++ b/build/ace/mode/css.js @@ -0,0 +1,80 @@ +define("ace/mode/css_highlight_rules", ["require", "exports", "module", "../lib/oop", "../lib/lang", "./text_highlight_rules"], function(b) { + var j = b("../lib/oop"), c = b("../lib/lang"); + b = b("./text_highlight_rules"); + var e = function() { + function a(d) { + var l = []; + d = d.split(""); + for(var k = 0;k < d.length;k++) { + l.push("[", d[k].toLowerCase(), d[k].toUpperCase(), "]") + }return l.join("") + } + var f = c.arrayToMap("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|caption-side|clear|clip|color|content|counter-increment|counter-reset|cue-after|cue-before|cue|cursor|direction|display|elevation|empty-cells|float|font-family|font-size-adjust|font-size|font-stretch|font-style|font-variant|font-weight|font|height|left|letter-spacing|line-height|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|marker-offset|margin|marks|max-height|max-width|min-height|min-width|-moz-border-radius|opacity|orphans|outline-color|outline-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("|")), + g = c.arrayToMap("rgb|rgba|url|attr|counter|counters".split("|")), h = c.arrayToMap("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|block|bold|bolder|both|bottom|break-all|break-word|capitalize|center|char|circle|cjk-ideographic|col-resize|collapse|crosshair|dashed|decimal-leading-zero|decimal|default|disabled|disc|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|inactive|inherit|inline-block|inline|inset|inside|inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|keep-all|left|lighter|line-edge|line-through|line|list-item|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|solid|square|static|strict|super|sw-resize|table-footer-group|table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|zero".split("|")), + i = c.arrayToMap("aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow".split("|")); + this.$rules = {start:[{token:"comment", regex:"\\/\\*", next:"comment"}, {token:"string", regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'}, {token:"string", regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("em")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("ex")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("px")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + + a("cm")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("mm")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("in")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("pt")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("pc")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("deg")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + + a("rad")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("grad")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("ms")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("s")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("hz")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("khz")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))%"}, + {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))"}, {token:"constant.numeric", regex:"#[a-fA-F0-9]{6}"}, {token:"constant.numeric", regex:"#[a-fA-F0-9]{3}"}, {token:"lparen", regex:"{"}, {token:"rparen", regex:"}"}, {token:function(d) { + return f[d.toLowerCase()] ? "support.type" : g[d.toLowerCase()] ? "support.function" : h[d.toLowerCase()] ? "support.constant" : i[d.toLowerCase()] ? "support.constant.color" : "text" + }, regex:"\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"}], comment:[{token:"comment", regex:".*?\\*\\/", next:"start"}, {token:"comment", regex:".+"}]} + }; + j.inherits(e, b); + return e +}); +define("ace/mode/matching_brace_outdent", ["require", "exports", "module", "../range"], function(b) { + var j = b("../range"); + b = function() { + }; + (function() { + this.checkOutdent = function(c, e) { + if(!/^\s+$/.test(c)) { + return false + }return/^\s*\}/.test(e) + }; + this.autoOutdent = function(c, e) { + var a = c.getLine(e).match(/^(\s*\})/); + if(!a) { + return 0 + }a = a[1].length; + var f = c.findMatchingBracket({row:e, column:a}); + if(!f || f.row == e) { + return 0 + }f = this.$getIndent(c.getLine(f.row)); + c.replace(new j(e, 0, e, a - 1), f); + return f.length - (a - 1) + }; + this.$getIndent = function(c) { + if(c = c.match(/^(\s+)/)) { + return c[1] + }return"" + } + }).call(b.prototype); + return b +}); +define("ace/mode/css", ["require", "exports", "module", "../lib/oop", "./text", "../tokenizer", "./css_highlight_rules", "./matching_brace_outdent"], function(b) { + var j = b("../lib/oop"), c = b("./text"), e = b("../tokenizer"), a = b("./css_highlight_rules"), f = b("./matching_brace_outdent"); + b = function() { + this.$tokenizer = new e((new a).getRules()); + this.$outdent = new f + }; + j.inherits(b, c); + (function() { + this.getNextLineIndent = function(g, h, i) { + var d = this.$getIndent(h); + g = this.$tokenizer.getLineTokens(h, g).tokens; + if(g.length && g[g.length - 1].type == "comment") { + return d + }if(h.match(/^.*\{\s*$/)) { + d += i + }return d + }; + this.checkOutdent = function(g, h, i) { + return this.$outdent.checkOutdent(h, i) + }; + this.autoOutdent = function(g, h, i) { + return this.$outdent.autoOutdent(h, i) + } + }).call(b.prototype); + return b +}); \ No newline at end of file diff --git a/build/ace/mode/css_highlight_rules.js b/build/ace/mode/css_highlight_rules.js new file mode 100644 index 00000000..a68b8b16 --- /dev/null +++ b/build/ace/mode/css_highlight_rules.js @@ -0,0 +1,24 @@ +define(function(c) { + var h = c("../lib/oop"), d = c("../lib/lang"); + c = c("./text_highlight_rules"); + var g = function() { + function a(b) { + var f = []; + b = b.split(""); + for(var e = 0;e < b.length;e++) { + f.push("[", b[e].toLowerCase(), b[e].toUpperCase(), "]") + }return f.join("") + } + var i = d.arrayToMap("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|caption-side|clear|clip|color|content|counter-increment|counter-reset|cue-after|cue-before|cue|cursor|direction|display|elevation|empty-cells|float|font-family|font-size-adjust|font-size|font-stretch|font-style|font-variant|font-weight|font|height|left|letter-spacing|line-height|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|marker-offset|margin|marks|max-height|max-width|min-height|min-width|-moz-border-radius|opacity|orphans|outline-color|outline-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("|")), + j = d.arrayToMap("rgb|rgba|url|attr|counter|counters".split("|")), k = d.arrayToMap("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|block|bold|bolder|both|bottom|break-all|break-word|capitalize|center|char|circle|cjk-ideographic|col-resize|collapse|crosshair|dashed|decimal-leading-zero|decimal|default|disabled|disc|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|inactive|inherit|inline-block|inline|inset|inside|inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|keep-all|left|lighter|line-edge|line-through|line|list-item|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|solid|square|static|strict|super|sw-resize|table-footer-group|table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|zero".split("|")), + l = d.arrayToMap("aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow".split("|")); + this.$rules = {start:[{token:"comment", regex:"\\/\\*", next:"comment"}, {token:"string", regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'}, {token:"string", regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("em")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("ex")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("px")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + + a("cm")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("mm")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("in")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("pt")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("pc")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("deg")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + + a("rad")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("grad")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("ms")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("s")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("hz")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("khz")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))%"}, + {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))"}, {token:"constant.numeric", regex:"#[a-fA-F0-9]{6}"}, {token:"constant.numeric", regex:"#[a-fA-F0-9]{3}"}, {token:"lparen", regex:"{"}, {token:"rparen", regex:"}"}, {token:function(b) { + return i[b.toLowerCase()] ? "support.type" : j[b.toLowerCase()] ? "support.function" : k[b.toLowerCase()] ? "support.constant" : l[b.toLowerCase()] ? "support.constant.color" : "text" + }, regex:"\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"}], comment:[{token:"comment", regex:".*?\\*\\/", next:"start"}, {token:"comment", regex:".+"}]} + }; + h.inherits(g, c); + return g +}); \ No newline at end of file diff --git a/build/ace/mode/doc_comment_highlight_rules.js b/build/ace/mode/doc_comment_highlight_rules.js new file mode 100644 index 00000000..9a924e0c --- /dev/null +++ b/build/ace/mode/doc_comment_highlight_rules.js @@ -0,0 +1,14 @@ +define(function(a) { + var c = a("../lib/oop"); + a = a("./text_highlight_rules"); + var b = function() { + this.$rules = {start:[{token:"comment.doc", regex:"\\*\\/", next:"start"}, {token:"comment.doc.tag", regex:"@[\\w\\d_]+"}, {token:"comment.doc", regex:"s+"}, {token:"comment.doc", regex:"[^@\\*]+"}, {token:"comment.doc", regex:"."}]} + }; + c.inherits(b, a); + (function() { + this.getStartRule = function(d) { + return{token:"comment.doc", regex:"\\/\\*(?=\\*)", next:d} + } + }).call(b.prototype); + return b +}); \ No newline at end of file diff --git a/build/ace/mode/html.js b/build/ace/mode/html.js new file mode 100644 index 00000000..e4522585 --- /dev/null +++ b/build/ace/mode/html.js @@ -0,0 +1,57 @@ +define("ace/mode/html_highlight_rules", ["require", "exports", "module", "../lib/oop", "./css_highlight_rules", "./javascript_highlight_rules", "./text_highlight_rules"], function(a) { + var f = a("../lib/oop"), g = a("./css_highlight_rules"), h = a("./javascript_highlight_rules"); + a = a("./text_highlight_rules"); + var d = function() { + this.$rules = {start:[{token:"text", regex:"<\\!\\[CDATA\\[", next:"cdata"}, {token:"xml_pe", regex:"<\\?.*?\\?>"}, {token:"comment", regex:"<\\!--", next:"comment"}, {token:"text", regex:"<(?=s*script)", next:"script"}, {token:"text", regex:"<(?=s*style)", next:"css"}, {token:"text", regex:"<\\/?", next:"tag"}, {token:"text", regex:"\\s+"}, {token:"text", regex:"[^<]+"}], script:[{token:"text", regex:">", next:"js-start"}, {token:"keyword", regex:"[-_a-zA-Z0-9:]+"}, {token:"text", regex:"\\s+"}, + {token:"string", regex:'".*?"'}, {token:"string", regex:"'.*?'"}], css:[{token:"text", regex:">", next:"css-start"}, {token:"keyword", regex:"[-_a-zA-Z0-9:]+"}, {token:"text", regex:"\\s+"}, {token:"string", regex:'".*?"'}, {token:"string", regex:"'.*?'"}], tag:[{token:"text", regex:">", next:"start"}, {token:"keyword", regex:"[-_a-zA-Z0-9:]+"}, {token:"text", regex:"\\s+"}, {token:"string", regex:'".*?"'}, {token:"string", regex:"'.*?'"}], cdata:[{token:"text", regex:"\\]\\]>", next:"start"}, + {token:"text", regex:"\\s+"}, {token:"text", regex:".+"}], comment:[{token:"comment", regex:".*?--\>", next:"start"}, {token:"comment", regex:".+"}]}; + this.addRules((new h).getRules(), "js-"); + this.$rules["js-start"].unshift({token:"comment", regex:"\\/\\/.*(?=<\\/script>)", next:"tag"}, {token:"text", regex:"<\\/(?=script)", next:"tag"}); + this.addRules((new g).getRules(), "css-"); + this.$rules["css-start"].unshift({token:"text", regex:"<\\/(?=style)", next:"tag"}) + }; + f.inherits(d, a); + return d +}); +define("ace/mode/html", ["require", "exports", "module", "../lib/oop", "./text", "./javascript", "./css", "../tokenizer", "./html_highlight_rules"], function(a) { + var f = a("../lib/oop"), g = a("./text"), h = a("./javascript"), d = a("./css"), k = a("../tokenizer"), l = a("./html_highlight_rules"); + a = function() { + this.$tokenizer = new k((new l).getRules()); + this.$js = new h; + this.$css = new d + }; + f.inherits(a, g); + (function() { + this.toggleCommentLines = function() { + return this.$delegate("toggleCommentLines", arguments, function() { + return 0 + }) + }; + this.getNextLineIndent = function(i, b) { + var e = this; + return this.$delegate("getNextLineIndent", arguments, function() { + return e.$getIndent(b) + }) + }; + this.checkOutdent = function() { + return this.$delegate("checkOutdent", arguments, function() { + return false + }) + }; + this.autoOutdent = function() { + return this.$delegate("autoOutdent", arguments) + }; + this.$delegate = function(i, b, e) { + var j = b[0], c = j.split("js-"); + if(!c[0] && c[1]) { + b[0] = c[1]; + return this.$js[i].apply(this.$js, b) + }c = j.split("css-"); + if(!c[0] && c[1]) { + b[0] = c[1]; + return this.$css[i].apply(this.$css, b) + }return e ? e() : undefined + } + }).call(a.prototype); + return a +}); \ No newline at end of file diff --git a/build/ace/mode/html_highlight_rules.js b/build/ace/mode/html_highlight_rules.js new file mode 100644 index 00000000..f0025ca9 --- /dev/null +++ b/build/ace/mode/html_highlight_rules.js @@ -0,0 +1,15 @@ +define(function(a) { + var c = a("../lib/oop"), d = a("./css_highlight_rules"), e = a("./javascript_highlight_rules"); + a = a("./text_highlight_rules"); + var b = function() { + this.$rules = {start:[{token:"text", regex:"<\\!\\[CDATA\\[", next:"cdata"}, {token:"xml_pe", regex:"<\\?.*?\\?>"}, {token:"comment", regex:"<\\!--", next:"comment"}, {token:"text", regex:"<(?=s*script)", next:"script"}, {token:"text", regex:"<(?=s*style)", next:"css"}, {token:"text", regex:"<\\/?", next:"tag"}, {token:"text", regex:"\\s+"}, {token:"text", regex:"[^<]+"}], script:[{token:"text", regex:">", next:"js-start"}, {token:"keyword", regex:"[-_a-zA-Z0-9:]+"}, {token:"text", regex:"\\s+"}, + {token:"string", regex:'".*?"'}, {token:"string", regex:"'.*?'"}], css:[{token:"text", regex:">", next:"css-start"}, {token:"keyword", regex:"[-_a-zA-Z0-9:]+"}, {token:"text", regex:"\\s+"}, {token:"string", regex:'".*?"'}, {token:"string", regex:"'.*?'"}], tag:[{token:"text", regex:">", next:"start"}, {token:"keyword", regex:"[-_a-zA-Z0-9:]+"}, {token:"text", regex:"\\s+"}, {token:"string", regex:'".*?"'}, {token:"string", regex:"'.*?'"}], cdata:[{token:"text", regex:"\\]\\]>", next:"start"}, + {token:"text", regex:"\\s+"}, {token:"text", regex:".+"}], comment:[{token:"comment", regex:".*?--\>", next:"start"}, {token:"comment", regex:".+"}]}; + this.addRules((new e).getRules(), "js-"); + this.$rules["js-start"].unshift({token:"comment", regex:"\\/\\/.*(?=<\\/script>)", next:"tag"}, {token:"text", regex:"<\\/(?=script)", next:"tag"}); + this.addRules((new d).getRules(), "css-"); + this.$rules["css-start"].unshift({token:"text", regex:"<\\/(?=style)", next:"tag"}) + }; + c.inherits(b, a); + return b +}); \ No newline at end of file diff --git a/build/ace/mode/javascript.js b/build/ace/mode/javascript.js new file mode 100644 index 00000000..5db7b0ef --- /dev/null +++ b/build/ace/mode/javascript.js @@ -0,0 +1,59 @@ +define(function(f) { + var h = f("../lib/oop"), i = f("./text"), j = f("../tokenizer"), k = f("./javascript_highlight_rules"), l = f("./matching_brace_outdent"), m = f("../range"); + f = function() { + this.$tokenizer = new j((new k).getRules()); + this.$outdent = new l + }; + h.inherits(f, i); + (function() { + this.toggleCommentLines = function(d, b, e) { + var c = true; + d = /^(\s*)\/\//; + for(var a = e.start.row;a <= e.end.row;a++) { + if(!d.test(b.getLine(a))) { + c = false; + break + } + }if(c) { + c = new m(0, 0, 0, 0); + for(a = e.start.row;a <= e.end.row;a++) { + var g = b.getLine(a).replace(d, "$1"); + c.start.row = a; + c.end.row = a; + c.end.column = g.length + 2; + b.replace(c, g) + }return-2 + }else { + return b.indentRows(e, "//") + } + }; + this.getNextLineIndent = function(d, b, e) { + var c = this.$getIndent(b), a = this.$tokenizer.getLineTokens(b, d), g = a.tokens; + a = a.state; + if(g.length && g[g.length - 1].type == "comment") { + return c + }if(d == "start") { + if(d = b.match(/^.*[\{\(\[]\s*$/)) { + c += e + } + }else { + if(d == "doc-start") { + if(a == "start") { + return"" + }if(d = b.match(/^\s*(\/?)\*/)) { + if(d[1]) { + c += " " + }c += "* " + } + } + }return c + }; + this.checkOutdent = function(d, b, e) { + return this.$outdent.checkOutdent(b, e) + }; + this.autoOutdent = function(d, b, e) { + return this.$outdent.autoOutdent(b, e) + } + }).call(f.prototype); + return f +}); \ No newline at end of file diff --git a/build/ace/mode/javascript_highlight_rules.js b/build/ace/mode/javascript_highlight_rules.js new file mode 100644 index 00000000..dbc502e7 --- /dev/null +++ b/build/ace/mode/javascript_highlight_rules.js @@ -0,0 +1,16 @@ +define(function(a) { + var e = a("../lib/oop"), c = a("../lib/lang"), f = a("./doc_comment_highlight_rules"); + a = a("./text_highlight_rules"); + JavaScriptHighlightRules = function() { + var d = new f, g = c.arrayToMap("break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|var|while|with".split("|")), h = c.arrayToMap("true|false|null|undefined|Infinity|NaN|undefined".split("|")), i = c.arrayToMap("class|enum|extends|super|const|export|import|implements|let|private|public|yield|interface|package|protected|static".split("|")); + this.$rules = {start:[{token:"comment", regex:"\\/\\/.*$"}, d.getStartRule("doc-start"), {token:"comment", regex:"\\/\\*", next:"comment"}, {token:"string.regexp", regex:"[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/][gimy]*\\s*(?=[).,;]|$)"}, {token:"string", regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'}, {token:"string", regex:'["].*\\\\$', next:"qqstring"}, {token:"string", regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"}, {token:"string", regex:"['].*\\\\$", next:"qstring"}, {token:"constant.numeric", + regex:"0[xX][0-9a-fA-F]+\\b"}, {token:"constant.numeric", regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"}, {token:function(b) { + return b == "this" ? "variable.language" : g[b] ? "keyword" : h[b] ? "constant.language" : i[b] ? "invalid.illegal" : b == "debugger" ? "invalid.deprecated" : "identifier" + }, 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", regex:".*?\\*\\/", next:"start"}, {token:"comment", regex:".+"}], qqstring:[{token:"string", regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"', + next:"start"}, {token:"string", regex:".+"}], qstring:[{token:"string", regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'", next:"start"}, {token:"string", regex:".+"}]}; + this.addRules(d.getRules(), "doc-"); + this.$rules["doc-start"][0].next = "start" + }; + e.inherits(JavaScriptHighlightRules, a); + return JavaScriptHighlightRules +}); \ No newline at end of file diff --git a/build/ace/mode/matching_brace_outdent.js b/build/ace/mode/matching_brace_outdent.js new file mode 100644 index 00000000..d6a9d5b4 --- /dev/null +++ b/build/ace/mode/matching_brace_outdent.js @@ -0,0 +1,30 @@ +define(function(e) { + var f = e("../range"); + e = function() { + }; + (function() { + this.checkOutdent = function(a, b) { + if(!/^\s+$/.test(a)) { + return false + }return/^\s*\}/.test(b) + }; + this.autoOutdent = function(a, b) { + var c = a.getLine(b).match(/^(\s*\})/); + if(!c) { + return 0 + }c = c[1].length; + var d = a.findMatchingBracket({row:b, column:c}); + if(!d || d.row == b) { + return 0 + }d = this.$getIndent(a.getLine(d.row)); + a.replace(new f(b, 0, b, c - 1), d); + return d.length - (c - 1) + }; + this.$getIndent = function(a) { + if(a = a.match(/^(\s+)/)) { + return a[1] + }return"" + } + }).call(e.prototype); + return e +}); \ No newline at end of file diff --git a/build/ace/mode/text.js b/build/ace/mode/text.js new file mode 100644 index 00000000..a6f218e6 --- /dev/null +++ b/build/ace/mode/text.js @@ -0,0 +1,28 @@ +define(function(a) { + var c = a("../tokenizer"), d = a("./text_highlight_rules"); + a = function() { + this.$tokenizer = new c((new d).getRules()) + }; + (function() { + this.getTokenizer = function() { + return this.$tokenizer + }; + this.toggleCommentLines = function() { + return 0 + }; + this.getNextLineIndent = function() { + return"" + }; + this.checkOutdent = function() { + return false + }; + this.autoOutdent = function() { + }; + this.$getIndent = function(b) { + if(b = b.match(/^(\s+)/)) { + return b[1] + }return"" + } + }).call(a.prototype); + return a +}); \ No newline at end of file diff --git a/build/ace/mode/text_highlight_rules.js b/build/ace/mode/text_highlight_rules.js new file mode 100644 index 00000000..848b6076 --- /dev/null +++ b/build/ace/mode/text_highlight_rules.js @@ -0,0 +1,19 @@ +define(function() { + var f = function() { + this.$rules = {start:[{token:"text", regex:".+"}]} + }; + (function() { + this.addRules = function(g, a) { + for(var b in g) { + for(var c = g[b], d = 0;d < c.length;d++) { + var e = c[d]; + e.next = e.next ? a + e.next : a + b + }this.$rules[a + b] = c + } + }; + this.getRules = function() { + return this.$rules + } + }).call(f.prototype); + return f +}); \ No newline at end of file diff --git a/build/ace/mode/xml.js b/build/ace/mode/xml.js new file mode 100644 index 00000000..c99c913d --- /dev/null +++ b/build/ace/mode/xml.js @@ -0,0 +1,23 @@ +define("ace/mode/xml_highlight_rules", ["require", "exports", "module", "../lib/oop", "./text_highlight_rules"], function(a) { + var c = a("../lib/oop"); + a = a("./text_highlight_rules"); + var b = function() { + this.$rules = {start:[{token:"text", regex:"<\\!\\[CDATA\\[", next:"cdata"}, {token:"xml_pe", regex:"<\\?.*?\\?>"}, {token:"comment", regex:"<\\!--", next:"comment"}, {token:"text", regex:"<\\/?", next:"tag"}, {token:"text", regex:"\\s+"}, {token:"text", regex:"[^<]+"}], tag:[{token:"text", regex:">", next:"start"}, {token:"keyword", regex:"[-_a-zA-Z0-9:]+"}, {token:"text", regex:"\\s+"}, {token:"string", regex:'".*?"'}, {token:"string", regex:"'.*?'"}], cdata:[{token:"text", regex:"\\]\\]>", + next:"start"}, {token:"text", regex:"\\s+"}, {token:"text", regex:"(?:[^\\]]|\\](?!\\]>))+"}], comment:[{token:"comment", regex:".*?--\>", next:"start"}, {token:"comment", regex:".+"}]} + }; + c.inherits(b, a); + return b +}); +define("ace/mode/xml", ["require", "exports", "module", "../lib/oop", "./text", "../tokenizer", "./xml_highlight_rules"], function(a) { + var c = a("../lib/oop"), b = a("./text"), d = a("../tokenizer"), e = a("./xml_highlight_rules"); + a = function() { + this.$tokenizer = new d((new e).getRules()) + }; + c.inherits(a, b); + (function() { + this.getNextLineIndent = function(g, f) { + return this.$getIndent(f) + } + }).call(a.prototype); + return a +}); \ No newline at end of file diff --git a/build/ace/mode/xml_highlight_rules.js b/build/ace/mode/xml_highlight_rules.js new file mode 100644 index 00000000..89886e5e --- /dev/null +++ b/build/ace/mode/xml_highlight_rules.js @@ -0,0 +1,10 @@ +define(function(a) { + var c = a("../lib/oop"); + a = a("./text_highlight_rules"); + var b = function() { + this.$rules = {start:[{token:"text", regex:"<\\!\\[CDATA\\[", next:"cdata"}, {token:"xml_pe", regex:"<\\?.*?\\?>"}, {token:"comment", regex:"<\\!--", next:"comment"}, {token:"text", regex:"<\\/?", next:"tag"}, {token:"text", regex:"\\s+"}, {token:"text", regex:"[^<]+"}], tag:[{token:"text", regex:">", next:"start"}, {token:"keyword", regex:"[-_a-zA-Z0-9:]+"}, {token:"text", regex:"\\s+"}, {token:"string", regex:'".*?"'}, {token:"string", regex:"'.*?'"}], cdata:[{token:"text", regex:"\\]\\]>", + next:"start"}, {token:"text", regex:"\\s+"}, {token:"text", regex:"(?:[^\\]]|\\](?!\\]>))+"}], comment:[{token:"comment", regex:".*?--\>", next:"start"}, {token:"comment", regex:".+"}]} + }; + c.inherits(b, a); + return b +}); \ No newline at end of file diff --git a/build/ace/plugin_manager.js b/build/ace/plugin_manager.js new file mode 100644 index 00000000..0d8b92f2 --- /dev/null +++ b/build/ace/plugin_manager.js @@ -0,0 +1,5 @@ +define(function() { + return{commands:{}, registerCommand:function(a, b) { + this.commands[a] = b + }} +}); \ No newline at end of file diff --git a/build/ace/range.js b/build/ace/range.js new file mode 100644 index 00000000..504e370b --- /dev/null +++ b/build/ace/range.js @@ -0,0 +1,68 @@ +define(function() { + var c = function(a, b, d, e) { + this.start = {row:a, column:b}; + this.end = {row:d, column:e} + }; + (function() { + this.toString = function() { + return"Range: [" + this.start.row + "/" + this.start.column + "] -> [" + this.end.row + "/" + this.end.column + "]" + }; + this.contains = function(a, b) { + return this.compare(a, b) == 0 + }; + this.compare = function(a, b) { + if(!this.isMultiLine()) { + if(a === this.start.row) { + return b < this.start.column ? -1 : b > this.end.column ? 1 : 0 + } + }if(a < this.start.row) { + return-1 + }if(a > this.end.row) { + return 1 + }if(this.start.row === a) { + return b >= this.start.column ? 0 : -1 + }if(this.end.row === a) { + return b <= this.end.column ? 0 : 1 + }return 0 + }; + this.clipRows = function(a, b) { + if(this.end.row > b) { + var d = {row:b + 1, column:0} + }if(this.start.row > b) { + var e = {row:b + 1, column:0} + }if(this.start.row < a) { + e = {row:a, column:0} + }if(this.end.row < a) { + d = {row:a, column:0} + }return c.fromPoints(e || this.start, d || this.end) + }; + this.extend = function(a, b) { + var d = this.compare(a, b); + if(d == 0) { + return this + }else { + if(d == -1) { + var e = {row:a, column:b} + }else { + var f = {row:a, column:b} + } + }return c.fromPoints(e || this.start, f || 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 c.fromPoints(this.start, this.end) + }; + this.toScreenRange = function(a) { + return new c(this.start.row, a.documentToScreenColumn(this.start.row, this.start.column), this.end.row, a.documentToScreenColumn(this.end.row, this.end.column)) + } + }).call(c.prototype); + c.fromPoints = function(a, b) { + return new c(a.row, a.column, b.row, b.column) + }; + return c +}); \ No newline at end of file diff --git a/build/ace/renderloop.js b/build/ace/renderloop.js new file mode 100644 index 00000000..7eac3a96 --- /dev/null +++ b/build/ace/renderloop.js @@ -0,0 +1,43 @@ +define(function(c) { + var e = c("./lib/event"); + c = function(b) { + this.onRender = b; + this.pending = false; + this.changes = 0 + }; + (function() { + this.schedule = function(b) { + this.changes |= b; + if(!this.pending) { + this.pending = true; + var a = this; + this.setTimeoutZero(function() { + a.pending = false; + a.onRender(a.changes); + a.changes = 0 + }) + } + }; + if(window.postMessage) { + this.messageName = "zero-timeout-message"; + this.setTimeoutZero = function(b) { + if(!this.attached) { + var a = this; + e.addListener(window, "message", function(d) { + if(d.source == window && a.callback && d.data == a.messageName) { + e.stopPropagation(d); + a.callback() + } + }); + this.attached = true + }this.callback = b; + window.postMessage(this.messageName, "*") + } + }else { + this.setTimeoutZero = function(b) { + setTimeout(b, 0) + } + } + }).call(c.prototype); + return c +}); \ No newline at end of file diff --git a/build/ace/scrollbar.js b/build/ace/scrollbar.js new file mode 100644 index 00000000..7bcbfcb8 --- /dev/null +++ b/build/ace/scrollbar.js @@ -0,0 +1,32 @@ +define(function(a) { + var c = a("./lib/oop"), d = a("./lib/lang"), e = a("./lib/dom"), f = a("./lib/event"), g = a("./event_emitter"); + a = function(b) { + this.element = document.createElement("div"); + this.element.className = "ace_sb"; + this.inner = document.createElement("div"); + this.element.appendChild(this.inner); + b.appendChild(this.element); + this.width = e.scrollbarWidth(); + this.element.style.width = this.width; + f.addListener(this.element, "scroll", d.bind(this.onScroll, this)) + }; + (function() { + c.implement(this, g); + this.onScroll = function() { + this.$dispatchEvent("scroll", {data:this.element.scrollTop}) + }; + this.getWidth = function() { + return this.width + }; + this.setHeight = function(b) { + this.element.style.height = Math.max(0, b - this.width) + "px" + }; + this.setInnerHeight = function(b) { + this.inner.style.height = b + "px" + }; + this.setScrollTop = function(b) { + this.element.scrollTop = b + } + }).call(a.prototype); + return a +}); \ No newline at end of file diff --git a/build/ace/search.js b/build/ace/search.js new file mode 100644 index 00000000..507feec3 --- /dev/null +++ b/build/ace/search.js @@ -0,0 +1,149 @@ +define(function(o) { + var p = o("./lib/lang"), r = o("./lib/oop"), s = o("./range"), l = function() { + this.$options = {needle:"", backwards:false, wrap:false, caseSensitive:false, wholeWord:false, scope:l.ALL, regExp:false} + }; + l.ALL = 1; + l.SELECTION = 2; + (function() { + this.set = function(a) { + r.mixin(this.$options, a); + return this + }; + this.getOptions = function() { + return p.copyObject(this.$options) + }; + this.find = function(a) { + if(!this.$options.needle) { + return null + }var b = null; + (this.$options.backwards ? this.$backwardMatchIterator(a) : this.$forwardMatchIterator(a)).forEach(function(c) { + b = c; + return true + }); + return b + }; + this.findAll = function(a) { + if(!this.$options.needle) { + return[] + }var b = []; + (this.$options.backwards ? this.$backwardMatchIterator(a) : this.$forwardMatchIterator(a)).forEach(function(c) { + b.push(c) + }); + return b + }; + this.replace = function(a, b) { + var c = this.$assembleRegExp(), g = c.exec(a); + return g && g[0].length == a.length ? this.$options.regExp ? a.replace(c, b) : b : null + }; + this.$forwardMatchIterator = function(a) { + var b = this.$assembleRegExp(), c = this; + return{forEach:function(g) { + c.$forwardLineIterator(a).forEach(function(d, i, k) { + if(i) { + d = d.substring(i) + }var j = []; + d.replace(b, function(e) { + j.push({str:e, offset:i + arguments[arguments.length - 2]}); + return e + }); + for(d = 0;d < j.length;d++) { + var h = j[d]; + h = c.$rangeFromMatch(k, h.offset, h.str.length); + if(g(h)) { + return true + } + } + }) + }} + }; + this.$backwardMatchIterator = function(a) { + var b = this.$assembleRegExp(), c = this; + return{forEach:function(g) { + c.$backwardLineIterator(a).forEach(function(d, i, k) { + if(i) { + d = d.substring(i) + }var j = []; + d.replace(b, function(e, f) { + j.push({str:e, offset:i + f}); + return e + }); + for(d = j.length - 1;d >= 0;d--) { + var h = j[d]; + h = c.$rangeFromMatch(k, h.offset, h.str.length); + if(g(h)) { + return true + } + } + }) + }} + }; + this.$rangeFromMatch = function(a, b, c) { + return new s(a, b, a, b + c) + }; + this.$assembleRegExp = function() { + var a = this.$options.regExp ? this.$options.needle : p.escapeRegExp(this.$options.needle); + if(this.$options.wholeWord) { + a = "\\b" + a + "\\b" + }var b = "g"; + this.$options.caseSensitive || (b += "i"); + return new RegExp(a, b) + }; + this.$forwardLineIterator = function(a) { + function b(e) { + var f = a.getLine(e); + if(c && e == g.end.row) { + f = f.substring(0, g.end.column) + }return f + } + var c = this.$options.scope == l.SELECTION, g = a.getSelection().getRange(), d = a.getSelection().getCursor(), i = c ? g.start.row : 0, k = c ? g.start.column : 0, j = c ? g.end.row : a.getLength() - 1, h = this.$options.wrap; + return{forEach:function(e) { + for(var f = d.row, m = b(f), n = d.column, q = false;!e(m, n, f);) { + if(q) { + return + }f++; + n = 0; + if(f > j) { + if(h) { + f = i; + n = k + }else { + return + } + }if(f == d.row) { + q = true + }m = b(f) + } + }} + }; + this.$backwardLineIterator = function(a) { + var b = this.$options.scope == l.SELECTION, c = a.getSelection().getRange(), g = b ? c.end : c.start, d = b ? c.start.row : 0, i = b ? c.start.column : 0, k = b ? c.end.row : a.getLength() - 1, j = this.$options.wrap; + return{forEach:function(h) { + for(var e = g.row, f = a.getLine(e).substring(0, g.column), m = 0, n = false;!h(f, m, e);) { + if(n) { + return + }e--; + m = 0; + if(e < d) { + if(j) { + e = k + }else { + return + } + }if(e == g.row) { + n = true + }f = a.getLine(e); + if(b) { + if(e == d) { + m = i + }else { + if(e == k) { + f = f.substring(0, c.end.column) + } + } + } + } + }} + } + }).call(l.prototype); + return l +}); \ No newline at end of file diff --git a/build/ace/selection.js b/build/ace/selection.js new file mode 100644 index 00000000..dbbb4ebc --- /dev/null +++ b/build/ace/selection.js @@ -0,0 +1,255 @@ +define(function(d) { + var g = d("./lib/oop"), h = d("./lib/lang"), i = d("./event_emitter"), f = d("./range"); + d = function(a) { + this.doc = a; + this.clearSelection(); + this.selectionLead = {row:0, column:0} + }; + (function() { + g.implement(this, i); + this.isEmpty = function() { + return!this.selectionAnchor || this.selectionAnchor.row == this.selectionLead.row && this.selectionAnchor.column == this.selectionLead.column + }; + this.isMultiLine = function() { + if(this.isEmpty()) { + return false + }return this.getRange().isMultiLine() + }; + this.getCursor = function() { + return this.selectionLead + }; + this.setSelectionAnchor = function(a, b) { + a = this.$clipPositionToDocument(a, b); + if(this.selectionAnchor) { + if(this.selectionAnchor.row !== a.row || this.selectionAnchor.column !== a.column) { + this.selectionAnchor = a; + this.$dispatchEvent("changeSelection", {}) + } + }else { + this.selectionAnchor = a; + this.$dispatchEvent("changeSelection", {}) + } + }; + this.getSelectionAnchor = function() { + return this.selectionAnchor ? this.$clone(this.selectionAnchor) : this.$clone(this.selectionLead) + }; + this.getSelectionLead = function() { + return this.$clone(this.selectionLead) + }; + this.shiftSelection = function(a) { + if(this.isEmpty()) { + this.moveCursorTo(this.selectionLead.row, this.selectionLead.column + a) + }else { + var b = this.getSelectionAnchor(), c = this.getSelectionLead(), e = this.isBackwards(); + if(!e || b.column !== 0) { + this.setSelectionAnchor(b.row, b.column + a) + }if(e || c.column !== 0) { + this.$moveSelection(function() { + this.moveCursorTo(c.row, c.column + a) + }) + } + } + }; + this.isBackwards = function() { + var a = this.selectionAnchor || this.selectionLead, b = this.selectionLead; + return a.row > b.row || a.row == b.row && a.column > b.column + }; + this.getRange = function() { + var a = this.selectionAnchor || this.selectionLead, b = this.selectionLead; + return this.isBackwards() ? f.fromPoints(b, a) : f.fromPoints(a, b) + }; + this.clearSelection = function() { + if(this.selectionAnchor) { + this.selectionAnchor = null; + this.$dispatchEvent("changeSelection", {}) + } + }; + this.selectAll = function() { + var a = this.doc.getLength() - 1; + this.setSelectionAnchor(a, this.doc.getLine(a).length); + this.$moveSelection(function() { + this.moveCursorTo(0, 0) + }) + }; + this.setSelectionRange = function(a, b) { + if(b) { + this.setSelectionAnchor(a.end.row, a.end.column); + this.selectTo(a.start.row, a.start.column) + }else { + this.setSelectionAnchor(a.start.row, a.start.column); + this.selectTo(a.end.row, a.end.column) + } + }; + this.$moveSelection = function(a) { + var b = false; + if(!this.selectionAnchor) { + b = true; + this.selectionAnchor = this.$clone(this.selectionLead) + }var c = this.$clone(this.selectionLead); + a.call(this); + if(c.row !== this.selectionLead.row || c.column !== this.selectionLead.column) { + b = true + }b && this.$dispatchEvent("changeSelection", {}) + }; + this.selectTo = function(a, b) { + this.$moveSelection(function() { + this.moveCursorTo(a, b) + }) + }; + this.selectToPosition = function(a) { + this.$moveSelection(function() { + this.moveCursorToPosition(a) + }) + }; + 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.selectWord = function() { + var a = this.selectionLead; + this.setSelectionRange(this.doc.getWordRange(a.row, a.column)) + }; + this.selectLine = function() { + this.setSelectionAnchor(this.selectionLead.row, 0); + this.$moveSelection(function() { + this.moveCursorTo(this.selectionLead.row + 1, 0) + }) + }; + this.moveCursorUp = function() { + this.moveCursorBy(-1, 0) + }; + this.moveCursorDown = function() { + this.moveCursorBy(1, 0) + }; + this.moveCursorLeft = function() { + if(this.selectionLead.column == 0) { + this.selectionLead.row > 0 && this.moveCursorTo(this.selectionLead.row - 1, this.doc.getLine(this.selectionLead.row - 1).length) + }else { + this.moveCursorBy(0, -1) + } + }; + this.moveCursorRight = function() { + if(this.selectionLead.column == this.doc.getLine(this.selectionLead.row).length) { + this.selectionLead.row < this.doc.getLength() - 1 && this.moveCursorTo(this.selectionLead.row + 1, 0) + }else { + this.moveCursorBy(0, 1) + } + }; + this.moveCursorLineStart = function() { + var a = this.selectionLead.row, b = this.selectionLead.column, c = this.doc.getLine(a).slice(0, b).match(/^\s*/); + if(c[0].length == 0) { + this.moveCursorTo(a, this.doc.getLine(a).match(/^\s*/)[0].length) + }else { + c[0].length >= b ? this.moveCursorTo(a, 0) : this.moveCursorTo(a, c[0].length) + } + }; + this.moveCursorLineEnd = function() { + this.moveCursorTo(this.selectionLead.row, this.doc.getLine(this.selectionLead.row).length) + }; + this.moveCursorFileEnd = function() { + var a = this.doc.getLength() - 1, b = this.doc.getLine(a).length; + this.moveCursorTo(a, b) + }; + this.moveCursorFileStart = function() { + this.moveCursorTo(0, 0) + }; + this.moveCursorWordRight = function() { + var a = this.selectionLead.row, b = this.selectionLead.column, c = this.doc.getLine(a), e = c.substring(b); + this.doc.nonTokenRe.lastIndex = 0; + this.doc.tokenRe.lastIndex = 0; + if(b == c.length) { + this.moveCursorRight() + }else { + if(this.doc.nonTokenRe.exec(e)) { + b += this.doc.nonTokenRe.lastIndex; + this.doc.nonTokenRe.lastIndex = 0 + }else { + if(this.doc.tokenRe.exec(e)) { + b += this.doc.tokenRe.lastIndex; + this.doc.tokenRe.lastIndex = 0 + } + }this.moveCursorTo(a, b) + } + }; + this.moveCursorWordLeft = function() { + var a = this.selectionLead.row, b = this.selectionLead.column, c = this.doc.getLine(a); + c = h.stringReverse(c.substring(0, b)); + this.doc.nonTokenRe.lastIndex = 0; + this.doc.tokenRe.lastIndex = 0; + if(b == 0) { + this.moveCursorLeft() + }else { + if(this.doc.nonTokenRe.exec(c)) { + b -= this.doc.nonTokenRe.lastIndex; + this.doc.nonTokenRe.lastIndex = 0 + }else { + if(this.doc.tokenRe.exec(c)) { + b -= this.doc.tokenRe.lastIndex; + this.doc.tokenRe.lastIndex = 0 + } + }this.moveCursorTo(a, b) + } + }; + this.moveCursorBy = function(a, b) { + this.moveCursorTo(this.selectionLead.row + a, this.selectionLead.column + b) + }; + this.moveCursorToPosition = function(a) { + this.moveCursorTo(a.row, a.column) + }; + this.moveCursorTo = function(a, b) { + a = this.$clipPositionToDocument(a, b); + if(a.row !== this.selectionLead.row || a.column !== this.selectionLead.column) { + this.selectionLead = a; + this.$dispatchEvent("changeCursor", {data:this.getCursor()}) + } + }; + this.moveCursorUp = function() { + this.moveCursorBy(-1, 0) + }; + this.$clipPositionToDocument = function(a, b) { + var c = {}; + if(a >= this.doc.getLength()) { + c.row = Math.max(0, this.doc.getLength() - 1); + c.column = this.doc.getLine(c.row).length + }else { + if(a < 0) { + c.row = 0; + c.column = 0 + }else { + c.row = a; + c.column = Math.min(this.doc.getLine(c.row).length, Math.max(0, b)) + } + }return c + }; + this.$clone = function(a) { + return{row:a.row, column:a.column} + } + }).call(d.prototype); + return d +}); \ No newline at end of file diff --git a/build/ace/test/all.js b/build/ace/test/all.js new file mode 100644 index 00000000..ece34003 --- /dev/null +++ b/build/ace/test/all.js @@ -0,0 +1,4 @@ +require({paths:{ace:"../src/ace"}}, ["ace/test/assertions", "ace/test/ChangeDocumentTest"], function(a) { + console.log(a); + alert("a " + a) +}); \ No newline at end of file diff --git a/build/ace/test/assertions.js b/build/ace/test/assertions.js new file mode 100644 index 00000000..c7c5eefa --- /dev/null +++ b/build/ace/test/assertions.js @@ -0,0 +1,16 @@ +/* + LGPLv3 +*/ +require.def([], function() { + window.assertPosition = function(a, b, c) { + assertEquals(a, c.row); + assertEquals(b, c.column) + }; + window.assertRange = function(a, b, c, e, d) { + assertPosition(a, b, d.start); + assertPosition(c, e, d.end) + }; + window.assertJsonEquals = function(a, b) { + assertEquals(JSON.stringify(a), JSON.stringify(b)) + } +}); \ No newline at end of file diff --git a/build/ace/test/change_document_test.js b/build/ace/test/change_document_test.js new file mode 100644 index 00000000..afd3d113 --- /dev/null +++ b/build/ace/test/change_document_test.js @@ -0,0 +1,79 @@ +/* + LGPLv3 +*/ +require.def(["ace/Document", "ace/Editor", "ace/mode/Text", "ace/mode/JavaScript", "ace/test/MockRenderer"], function(b, c, f, d, e) { + new TestCase("ChangeDocumentTest", {setUp:function() { + this.doc1 = new b("abc\ndef"); + this.doc2 = new b("ghi\njkl"); + this.editor = new c(new e) + }, "test: change document":function() { + this.editor.setDocument(this.doc1); + assertEquals(this.doc1, this.editor.getDocument()); + this.editor.setDocument(this.doc2); + assertEquals(this.doc2, this.editor.getDocument()) + }, "test: only changes to the new document should have effect":function() { + var a = false; + this.editor.onDocumentChange = function() { + a = true + }; + this.editor.setDocument(this.doc1); + this.editor.setDocument(this.doc2); + this.doc1.duplicateLines(0, 0); + assertFalse(a); + this.doc2.duplicateLines(0, 0); + assertTrue(a) + }, "test: should use cursor of new document":function() { + this.doc1.getSelection().moveCursorTo(0, 1); + this.doc2.getSelection().moveCursorTo(1, 0); + this.editor.setDocument(this.doc1); + assertPosition(0, 1, this.editor.getCursorPosition()); + this.editor.setDocument(this.doc2); + assertPosition(1, 0, this.editor.getCursorPosition()) + }, "test: only changing the cursor of the new doc should not have an effect":function() { + this.editor.onCursorChange = function() { + a = true + }; + this.editor.setDocument(this.doc1); + this.editor.setDocument(this.doc2); + assertPosition(0, 0, this.editor.getCursorPosition()); + var a = false; + this.doc1.getSelection().moveCursorTo(0, 1); + assertPosition(0, 0, this.editor.getCursorPosition()); + assertFalse(a); + this.doc2.getSelection().moveCursorTo(1, 1); + assertPosition(1, 1, this.editor.getCursorPosition()); + assertTrue(a) + }, "test: should use selection of new document":function() { + this.doc1.getSelection().selectTo(0, 1); + this.doc2.getSelection().selectTo(1, 0); + this.editor.setDocument(this.doc1); + assertPosition(0, 1, this.editor.getSelection().getSelectionLead()); + this.editor.setDocument(this.doc2); + assertPosition(1, 0, this.editor.getSelection().getSelectionLead()) + }, "test: only changing the selection of the new doc should not have an effect":function() { + this.editor.onSelectionChange = function() { + a = true + }; + this.editor.setDocument(this.doc1); + this.editor.setDocument(this.doc2); + assertPosition(0, 0, this.editor.getSelection().getSelectionLead()); + var a = false; + this.doc1.getSelection().selectTo(0, 1); + assertPosition(0, 0, this.editor.getSelection().getSelectionLead()); + assertFalse(a); + this.doc2.getSelection().selectTo(1, 1); + assertPosition(1, 1, this.editor.getSelection().getSelectionLead()); + assertTrue(a) + }, "test: should use mode of new document":function() { + this.editor.onDocumentModeChange = function() { + a = true + }; + this.editor.setDocument(this.doc1); + this.editor.setDocument(this.doc2); + var a = false; + this.doc1.setMode(new Text); + assertFalse(a); + this.doc2.setMode(new d); + assertTrue(a) + }}) +}); \ No newline at end of file diff --git a/build/ace/test/document_test.js b/build/ace/test/document_test.js new file mode 100644 index 00000000..c9e44b04 --- /dev/null +++ b/build/ace/test/document_test.js @@ -0,0 +1,148 @@ +/* + LGPLv3 +*/ +require.def(["ace/Document", "ace/UndoManager", "ace/Editor", "ace/test/MockRenderer"], function(b, h, i, j) { + new TestCase("TextDocumentTest", {"test: find matching opening bracket":function() { + var a = new b(["(()(", "())))"]); + assertPosition(0, 1, a.findMatchingBracket({row:0, column:3})); + assertPosition(1, 0, a.findMatchingBracket({row:1, column:2})); + assertPosition(0, 3, a.findMatchingBracket({row:1, column:3})); + assertPosition(0, 0, a.findMatchingBracket({row:1, column:4})); + assertEquals(null, a.findMatchingBracket({row:1, column:5})) + }, "test: find matching closing bracket":function() { + var a = new b(["(()(", "())))"]); + assertPosition(1, 1, a.findMatchingBracket({row:1, column:1})); + assertPosition(1, 1, a.findMatchingBracket({row:1, column:1})); + assertPosition(1, 2, a.findMatchingBracket({row:0, column:4})); + assertPosition(0, 2, a.findMatchingBracket({row:0, column:2})); + assertPosition(1, 3, a.findMatchingBracket({row:0, column:1})); + assertEquals(null, a.findMatchingBracket({row:0, column:0})) + }, "test: match different bracket types":function() { + var a = new b(["({[", ")]}"]); + assertPosition(1, 0, a.findMatchingBracket({row:0, column:1})); + assertPosition(1, 2, a.findMatchingBracket({row:0, column:2})); + assertPosition(1, 1, a.findMatchingBracket({row:0, column:3})); + assertPosition(0, 0, a.findMatchingBracket({row:1, column:1})); + assertPosition(0, 2, a.findMatchingBracket({row:1, column:2})); + assertPosition(0, 1, a.findMatchingBracket({row:1, column:3})) + }, "test: move lines down":function() { + var a = new b(["1", "2", "3", "4"]); + a.moveLinesDown(0, 1); + assertEquals("3\n1\n2\n4", a.toString()); + a.moveLinesDown(1, 2); + assertEquals("3\n4\n1\n2", a.toString()); + a.moveLinesDown(2, 3); + assertEquals("3\n4\n1\n2", a.toString()); + a.moveLinesDown(2, 2); + assertEquals("3\n4\n2\n1", a.toString()) + }, "test: move lines up":function() { + var a = new b(["1", "2", "3", "4"]); + a.moveLinesUp(2, 3); + assertEquals("1\n3\n4\n2", a.toString()); + a.moveLinesUp(1, 2); + assertEquals("3\n4\n1\n2", a.toString()); + a.moveLinesUp(0, 1); + assertEquals("3\n4\n1\n2", a.toString()); + a.moveLinesUp(2, 2); + assertEquals("3\n1\n4\n2", a.toString()) + }, "test: duplicate lines":function() { + var a = new b(["1", "2", "3", "4"]); + a.duplicateLines(1, 2); + assertEquals("1\n2\n3\n2\n3\n4", a.toString()) + }, "test: duplicate last line":function() { + var a = new b(["1", "2", "3"]); + a.duplicateLines(2, 2); + assertEquals("1\n2\n3\n3", a.toString()) + }, "test: duplicate first line":function() { + var a = new b(["1", "2", "3"]); + a.duplicateLines(0, 0); + assertEquals("1\n1\n2\n3", a.toString()) + }, "test: should handle unix style new lines":function() { + var a = new b(["1", "2", "3"]); + assertEquals("1\n2\n3", a.toString()) + }, "test: should handle windows style new lines":function() { + var a = new b("1\r\n2\r\n3"); + a.setNewLineMode("unix"); + assertEquals("1\n2\n3", a.toString()) + }, "test: set new line mode to 'windows' should use '\r\n' as new lines":function() { + var a = new b("1\n2\n3"); + a.setNewLineMode("windows"); + assertEquals("1\r\n2\r\n3", a.toString()) + }, "test: set new line mode to 'unix' should use '\n' as new lines":function() { + var a = new b("1\r\n2\r\n3"); + a.setNewLineMode("unix"); + assertEquals("1\n2\n3", a.toString()) + }, "test: set new line mode to 'auto' should use detect the incoming nl type":function() { + var a = new b("1\n2\n3"); + a.setNewLineMode("auto"); + assertEquals("1\n2\n3", a.toString()); + a = new b("1\r\n2\r\n3"); + a.setNewLineMode("auto"); + assertEquals("1\r\n2\r\n3", a.toString()); + a.replace(new Range(0, 0, 2, 1), "4\n5\n6"); + assertEquals("4\n5\n6", a.toString()) + }, "test: undo/redo for delete line":function() { + var a = new b(["111", "222", "333"]), c = new h; + a.setUndoManager(c); + var e = a.toString(), d = new i(new j, a); + d.removeLines(); + var f = a.toString(); + assertEquals("222\n333", f); + a.$informUndoManager.call(); + d.removeLines(); + var g = a.toString(); + assertEquals("333", g); + a.$informUndoManager.call(); + d.removeLines(); + d = a.toString(); + assertEquals("", d); + a.$informUndoManager.call(); + c.undo(); + a.$informUndoManager.call(); + assertEquals(g, a.toString()); + c.undo(); + a.$informUndoManager.call(); + assertEquals(f, a.toString()); + c.undo(); + a.$informUndoManager.call(); + assertEquals(e, a.toString()); + c.undo(); + a.$informUndoManager.call(); + assertEquals(e, a.toString()) + }, "test: convert document to screen coordinates":function() { + var a = new b("01234\t567890\t1234"); + a.setTabSize(4); + assertEquals(0, a.documentToScreenColumn(0, 0)); + assertEquals(4, a.documentToScreenColumn(0, 4)); + assertEquals(5, a.documentToScreenColumn(0, 5)); + assertEquals(9, a.documentToScreenColumn(0, 6)); + assertEquals(15, a.documentToScreenColumn(0, 12)); + assertEquals(19, a.documentToScreenColumn(0, 13)); + a.setTabSize(2); + assertEquals(0, a.documentToScreenColumn(0, 0)); + assertEquals(4, a.documentToScreenColumn(0, 4)); + assertEquals(5, a.documentToScreenColumn(0, 5)); + assertEquals(7, a.documentToScreenColumn(0, 6)); + assertEquals(13, a.documentToScreenColumn(0, 12)); + assertEquals(15, a.documentToScreenColumn(0, 13)) + }, "test: convert document to scrren coordinates with leading tabs":function() { + var a = new b("\t\t123"); + a.setTabSize(4); + assertEquals(0, a.documentToScreenColumn(0, 0)); + assertEquals(4, a.documentToScreenColumn(0, 1)); + assertEquals(8, a.documentToScreenColumn(0, 2)); + assertEquals(9, a.documentToScreenColumn(0, 3)) + }, "test: convert screen to document coordinates":function() { + var a = new b("01234\t567890\t1234"); + a.setTabSize(4); + assertEquals(0, a.screenToDocumentColumn(0, 0)); + assertEquals(4, a.screenToDocumentColumn(0, 4)); + assertEquals(5, a.screenToDocumentColumn(0, 5)); + assertEquals(5, a.screenToDocumentColumn(0, 6)); + assertEquals(5, a.screenToDocumentColumn(0, 7)); + assertEquals(5, a.screenToDocumentColumn(0, 8)); + assertEquals(6, a.screenToDocumentColumn(0, 9)); + assertEquals(12, a.screenToDocumentColumn(0, 15)); + assertEquals(13, a.screenToDocumentColumn(0, 19)) + }}) +}); \ No newline at end of file diff --git a/build/ace/test/event_emitter_test.js b/build/ace/test/event_emitter_test.js new file mode 100644 index 00000000..5b91cdfa --- /dev/null +++ b/build/ace/test/event_emitter_test.js @@ -0,0 +1,17 @@ +/* + LGPLv3 +*/ +require.def(["ace/lib/oop", "ace/MEventEmitter"], function(d, e) { + var a = function() { + }; + d.implement(a.prototype, e); + new TestCase("EventEmitterTest", {"test: dispatch event with no data":function() { + var b = new a, c = false; + b.addEventListener("juhu", function(f) { + c = true; + assertEquals("juhu", f.type) + }); + b.$dispatchEvent("juhu"); + assertTrue(c) + }}) +}); \ No newline at end of file diff --git a/build/ace/test/mockrenderer.js b/build/ace/test/mockrenderer.js new file mode 100644 index 00000000..80df09eb --- /dev/null +++ b/build/ace/test/mockrenderer.js @@ -0,0 +1,56 @@ +/* + LGPLv3 +*/ +require.def([], function() { + MockRenderer = function(a) { + this.container = document.createElement("div"); + this.cursor = {row:0, column:0}; + this.visibleRowCount = a || 20; + this.layerConfig = {firstVisibleRow:0, lastVisibleRow:this.visibleRowCount} + }; + MockRenderer.prototype.getFirstVisibleRow = function() { + return this.layerConfig.firstVisibleRow + }; + MockRenderer.prototype.getLastVisibleRow = function() { + return this.layerConfig.lastVisibleRow + }; + MockRenderer.prototype.getContainerElement = function() { + return this.container + }; + MockRenderer.prototype.getMouseEventTarget = function() { + return this.container + }; + MockRenderer.prototype.setDocument = function(a) { + this.lines = a.lines + }; + MockRenderer.prototype.setTokenizer = function() { + }; + MockRenderer.prototype.updateCursor = function(a) { + this.cursor.row = a.row; + this.cursor.column = a.column + }; + MockRenderer.prototype.scrollCursorIntoView = function() { + if(this.cursor.row < this.layerConfig.firstVisibleRow) { + this.scrollToRow(this.cursor.row) + }else { + this.cursor.row > this.layerConfig.lastVisibleRow && this.scrollToRow(this.cursor.row) + } + }; + MockRenderer.prototype.scrollToRow = function(a) { + a = Math.min(this.lines.length - this.visibleRowCount, Math.max(0, a)); + this.layerConfig.firstVisibleRow = a; + this.layerConfig.lastVisibleRow = a + this.visibleRowCount + }; + MockRenderer.prototype.getScrollTopRow = function() { + return this.layerConfig.firstVisibleRow + }; + MockRenderer.prototype.draw = function() { + }; + MockRenderer.prototype.updateLines = function() { + }; + MockRenderer.prototype.addMarker = function() { + }; + MockRenderer.prototype.setBreakpoints = function() { + }; + return MockRenderer +}); \ No newline at end of file diff --git a/build/ace/test/mode/css_test.js b/build/ace/test/mode/css_test.js new file mode 100644 index 00000000..d2a1eef8 --- /dev/null +++ b/build/ace/test/mode/css_test.js @@ -0,0 +1,21 @@ +/* + LGPLv3 +*/ +require.def(["ace/Document", "ace/Range", "ace/mode/Css"], function(b, c, d) { + new TestCase("mode.CssTest", {setUp:function() { + this.mode = new d + }, "test: toggle comment lines should not do anything":function() { + var a = new b(" abc\ncde\nfg"), e = new c(0, 3, 1, 1); + this.mode.toggleCommentLines("start", a, e); + assertEquals(" abc\ncde\nfg", a.toString()) + }, "test: lines should keep indentation":function() { + assertEquals(" ", this.mode.getNextLineIndent("start", " abc", " ")); + assertEquals("\t", this.mode.getNextLineIndent("start", "\tabc", " ")) + }, "test: new line after { should increase indent":function() { + assertEquals(" ", this.mode.getNextLineIndent("start", " abc{", " ")); + assertEquals("\t ", this.mode.getNextLineIndent("start", "\tabc { ", " ")) + }, "test: no indent increase after { in a comment":function() { + assertEquals(" ", this.mode.getNextLineIndent("start", " /*{", " ")); + assertEquals(" ", this.mode.getNextLineIndent("start", " /*{ ", " ")) + }}) +}); \ No newline at end of file diff --git a/build/ace/test/mode/css_tokenizer_test.js b/build/ace/test/mode/css_tokenizer_test.js new file mode 100644 index 00000000..759dfb95 --- /dev/null +++ b/build/ace/test/mode/css_tokenizer_test.js @@ -0,0 +1,26 @@ +/* + LGPLv3 +*/ +require.def(["ace/mode/Css"], function(b) { + new TestCase("mode.CssTest", {setUp:function() { + this.tokenizer = (new b).getTokenizer() + }, "test: tokenize pixel number":function() { + var a = this.tokenizer.getLineTokens("-12px", "start").tokens; + assertEquals(1, a.length); + assertEquals("number", a[0].type) + }, "test: tokenize hex3 color":function() { + var a = this.tokenizer.getLineTokens("#abc", "start").tokens; + assertEquals(1, a.length); + assertEquals("number", a[0].type) + }, "test: tokenize hex6 color":function() { + var a = this.tokenizer.getLineTokens("#abc012", "start").tokens; + assertEquals(1, a.length); + assertEquals("number", a[0].type) + }, "test: tokenize parens":function() { + var a = this.tokenizer.getLineTokens("{()}", "start").tokens; + assertEquals(3, a.length); + assertEquals("lparen", a[0].type); + assertEquals("text", a[1].type); + assertEquals("rparen", a[2].type) + }}) +}); \ No newline at end of file diff --git a/build/ace/test/mode/html_test.js b/build/ace/test/mode/html_test.js new file mode 100644 index 00000000..2af56ba6 --- /dev/null +++ b/build/ace/test/mode/html_test.js @@ -0,0 +1,16 @@ +/* + LGPLv3 +*/ +require.def(["ace/Document", "ace/Range", "ace/mode/Html"], function(b, c, d) { + new TestCase("mode.HtmlTest", {setUp:function() { + this.mode = new d + }, "test: toggle comment lines should not do anything":function() { + var a = new b([" abc", "cde", "fg"]), e = new c(0, 3, 1, 1); + this.mode.toggleCommentLines("start", a, e); + assertEquals(" abc\ncde\nfg", a.toString()) + }, "test: next line indent should be the same as the current line indent":function() { + assertEquals(" ", this.mode.getNextLineIndent("start", " abc")); + assertEquals("", this.mode.getNextLineIndent("start", "abc")); + assertEquals("\t", this.mode.getNextLineIndent("start", "\tabc")) + }}) +}); \ No newline at end of file diff --git a/build/ace/test/mode/html_tokenizer_test.js b/build/ace/test/mode/html_tokenizer_test.js new file mode 100644 index 00000000..3ed6b4b2 --- /dev/null +++ b/build/ace/test/mode/html_tokenizer_test.js @@ -0,0 +1,21 @@ +/* + LGPLv3 +*/ +require.def(["ace/mode/Html"], function(b) { + new TestCase("mode.HtmlTest", {setUp:function() { + this.tokenizer = (new b).getTokenizer() + }, "test: tokenize embedded script":function() { + var a = this.tokenizer.getLineTokens("