| @@ -0,0 +1,334 @@ | ||
| ace.define("ace/ext/beautify/php_rules",["require","exports","module","ace/token_iterator"], function(require, exports, module) { | ||
| "use strict"; | ||
| var TokenIterator = require("ace/token_iterator").TokenIterator; | ||
| exports.newLines = [{ | ||
| type: 'support.php_tag', | ||
| value: '<?php' | ||
| }, { | ||
| type: 'support.php_tag', | ||
| value: '<?' | ||
| }, { | ||
| type: 'support.php_tag', | ||
| value: '?>' | ||
| }, { | ||
| type: 'paren.lparen', | ||
| value: '{', | ||
| indent: true | ||
| }, { | ||
| type: 'paren.rparen', | ||
| breakBefore: true, | ||
| value: '}', | ||
| indent: false | ||
| }, { | ||
| type: 'paren.rparen', | ||
| breakBefore: true, | ||
| value: '})', | ||
| indent: false, | ||
| dontBreak: true | ||
| }, { | ||
| type: 'comment' | ||
| }, { | ||
| type: 'text', | ||
| value: ';' | ||
| }, { | ||
| type: 'text', | ||
| value: ':', | ||
| context: 'php' | ||
| }, { | ||
| type: 'keyword', | ||
| value: 'case', | ||
| indent: true, | ||
| dontBreak: true | ||
| }, { | ||
| type: 'keyword', | ||
| value: 'default', | ||
| indent: true, | ||
| dontBreak: true | ||
| }, { | ||
| type: 'keyword', | ||
| value: 'break', | ||
| indent: false, | ||
| dontBreak: true | ||
| }, { | ||
| type: 'punctuation.doctype.end', | ||
| value: '>' | ||
| }, { | ||
| type: 'meta.tag.punctuation.end', | ||
| value: '>' | ||
| }, { | ||
| type: 'meta.tag.punctuation.begin', | ||
| value: '<', | ||
| blockTag: true, | ||
| indent: true, | ||
| dontBreak: true | ||
| }, { | ||
| type: 'meta.tag.punctuation.begin', | ||
| value: '</', | ||
| indent: false, | ||
| breakBefore: true, | ||
| dontBreak: true | ||
| }, { | ||
| type: 'punctuation.operator', | ||
| value: ';' | ||
| }]; | ||
|
|
||
| exports.spaces = [{ | ||
| type: 'xml-pe', | ||
| prepend: true | ||
| },{ | ||
| type: 'entity.other.attribute-name', | ||
| prepend: true | ||
| }, { | ||
| type: 'storage.type', | ||
| value: 'var', | ||
| append: true | ||
| }, { | ||
| type: 'storage.type', | ||
| value: 'function', | ||
| append: true | ||
| }, { | ||
| type: 'keyword.operator', | ||
| value: '=' | ||
| }, { | ||
| type: 'keyword', | ||
| value: 'as', | ||
| prepend: true, | ||
| append: true | ||
| }, { | ||
| type: 'keyword', | ||
| value: 'function', | ||
| append: true | ||
| }, { | ||
| type: 'support.function', | ||
| next: /[^\(]/, | ||
| append: true | ||
| }, { | ||
| type: 'keyword', | ||
| value: 'or', | ||
| append: true, | ||
| prepend: true | ||
| }, { | ||
| type: 'keyword', | ||
| value: 'and', | ||
| append: true, | ||
| prepend: true | ||
| }, { | ||
| type: 'keyword', | ||
| value: 'case', | ||
| append: true | ||
| }, { | ||
| type: 'keyword.operator', | ||
| value: '||', | ||
| append: true, | ||
| prepend: true | ||
| }, { | ||
| type: 'keyword.operator', | ||
| value: '&&', | ||
| append: true, | ||
| prepend: true | ||
| }]; | ||
| exports.singleTags = ['!doctype','area','base','br','hr','input','img','link','meta']; | ||
|
|
||
| exports.transform = function(iterator, maxPos, context) { | ||
| var token = iterator.getCurrentToken(); | ||
|
|
||
| var newLines = exports.newLines; | ||
| var spaces = exports.spaces; | ||
| var singleTags = exports.singleTags; | ||
|
|
||
| var code = ''; | ||
|
|
||
| var indentation = 0; | ||
| var dontBreak = false; | ||
| var tag; | ||
| var lastTag; | ||
| var lastToken = {}; | ||
| var nextTag; | ||
| var nextToken = {}; | ||
| var breakAdded = false; | ||
| var value = ''; | ||
|
|
||
| while (token!==null) { | ||
| console.log(token); | ||
|
|
||
| if( !token ){ | ||
| token = iterator.stepForward(); | ||
| continue; | ||
| } | ||
| if( token.type == 'support.php_tag' && token.value != '?>' ){ | ||
| context = 'php'; | ||
| } | ||
| else if( token.type == 'support.php_tag' && token.value == '?>' ){ | ||
| context = 'html'; | ||
| } | ||
| else if( token.type == 'meta.tag.name.style' && context != 'css' ){ | ||
| context = 'css'; | ||
| } | ||
| else if( token.type == 'meta.tag.name.style' && context == 'css' ){ | ||
| context = 'html'; | ||
| } | ||
| else if( token.type == 'meta.tag.name.script' && context != 'js' ){ | ||
| context = 'js'; | ||
| } | ||
| else if( token.type == 'meta.tag.name.script' && context == 'js' ){ | ||
| context = 'html'; | ||
| } | ||
|
|
||
| nextToken = iterator.stepForward(); | ||
| if (nextToken && nextToken.type.indexOf('meta.tag.name') == 0) { | ||
| nextTag = nextToken.value; | ||
| } | ||
| if ( lastToken.type == 'support.php_tag' && lastToken.value == '<?=') { | ||
| dontBreak = true; | ||
| } | ||
| if (token.type == 'meta.tag.name') { | ||
| token.value = token.value.toLowerCase(); | ||
| } | ||
| if (token.type == 'text') { | ||
| token.value = token.value.trim(); | ||
| } | ||
| if (!token.value) { | ||
| token = nextToken; | ||
| continue; | ||
| } | ||
| value = token.value; | ||
| for (var i in spaces) { | ||
| if ( | ||
| token.type == spaces[i].type && | ||
| (!spaces[i].value || token.value == spaces[i].value) && | ||
| ( | ||
| nextToken && | ||
| (!spaces[i].next || spaces[i].next.test(nextToken.value)) | ||
| ) | ||
| ) { | ||
| if (spaces[i].prepend) { | ||
| value = ' ' + token.value; | ||
| } | ||
|
|
||
| if (spaces[i].append) { | ||
| value += ' '; | ||
| } | ||
| } | ||
| } | ||
| if (token.type.indexOf('meta.tag.name') == 0) { | ||
| tag = token.value; | ||
| } | ||
| breakAdded = false; | ||
| for (i in newLines) { | ||
| if ( | ||
| token.type == newLines[i].type && | ||
| ( | ||
| !newLines[i].value || | ||
| token.value == newLines[i].value | ||
| ) && | ||
| ( | ||
| !newLines[i].blockTag || | ||
| singleTags.indexOf(nextTag) === -1 | ||
| ) && | ||
| ( | ||
| !newLines[i].context || | ||
| newLines[i].context === context | ||
| ) | ||
| ) { | ||
| if (newLines[i].indent === false) { | ||
| indentation--; | ||
| } | ||
|
|
||
| if ( | ||
| newLines[i].breakBefore && | ||
| ( !newLines[i].prev || newLines[i].prev.test(lastToken.value) ) | ||
| ) { | ||
| code += "\n"; | ||
| breakAdded = true; | ||
| for (i = 0; i < indentation; i++) { | ||
| code += "\t"; | ||
| } | ||
| } | ||
|
|
||
| break; | ||
| } | ||
| } | ||
|
|
||
| if (dontBreak===false) { | ||
| for (i in newLines) { | ||
| if ( | ||
| lastToken.type == newLines[i].type && | ||
| ( | ||
| !newLines[i].value || lastToken.value == newLines[i].value | ||
| ) && | ||
| ( | ||
| !newLines[i].blockTag || | ||
| singleTags.indexOf(tag) === -1 | ||
| ) && | ||
| ( | ||
| !newLines[i].context || | ||
| newLines[i].context === context | ||
| ) | ||
| ) { | ||
| if (newLines[i].indent === true) { | ||
| indentation++; | ||
| } | ||
|
|
||
| if (!newLines[i].dontBreak && !breakAdded) { | ||
| code += "\n"; | ||
| for (i = 0; i < indentation; i++) { | ||
| code += "\t"; | ||
| } | ||
| } | ||
|
|
||
| break; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| code += value; | ||
| if ( lastToken.type == 'support.php_tag' && lastToken.value == '?>' ) { | ||
| dontBreak = false; | ||
| } | ||
| lastTag = tag; | ||
|
|
||
| lastToken = token; | ||
|
|
||
| token = nextToken; | ||
|
|
||
| if (token===null) { | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| return code; | ||
| }; | ||
|
|
||
|
|
||
|
|
||
| }); | ||
|
|
||
| ace.define("ace/ext/beautify",["require","exports","module","ace/token_iterator","ace/ext/beautify/php_rules"], function(require, exports, module) { | ||
| "use strict"; | ||
| var TokenIterator = require("ace/token_iterator").TokenIterator; | ||
|
|
||
| var phpTransform = require("./beautify/php_rules").transform; | ||
|
|
||
| exports.beautify = function(session) { | ||
| var iterator = new TokenIterator(session, 0, 0); | ||
| var token = iterator.getCurrentToken(); | ||
|
|
||
| var context = session.$modeId.split("/").pop(); | ||
|
|
||
| var code = phpTransform(iterator, context); | ||
| session.doc.setValue(code); | ||
| }; | ||
|
|
||
| exports.commands = [{ | ||
| name: "beautify", | ||
| exec: function(editor) { | ||
| exports.beautify(editor.session); | ||
| }, | ||
| bindKey: "Ctrl-Shift-B" | ||
| }] | ||
|
|
||
| }); | ||
| (function() { | ||
| ace.require(["ace/ext/beautify"], function() {}); | ||
| })(); | ||
|
|
| @@ -0,0 +1,274 @@ | ||
| ace.define("ace/ext/elastic_tabstops_lite",["require","exports","module","ace/editor","ace/config"], function(require, exports, module) { | ||
| "use strict"; | ||
|
|
||
| var ElasticTabstopsLite = function(editor) { | ||
| this.$editor = editor; | ||
| var self = this; | ||
| var changedRows = []; | ||
| var recordChanges = false; | ||
| this.onAfterExec = function() { | ||
| recordChanges = false; | ||
| self.processRows(changedRows); | ||
| changedRows = []; | ||
| }; | ||
| this.onExec = function() { | ||
| recordChanges = true; | ||
| }; | ||
| this.onChange = function(delta) { | ||
| if (recordChanges) { | ||
| if (changedRows.indexOf(delta.start.row) == -1) | ||
| changedRows.push(delta.start.row); | ||
| if (delta.end.row != delta.start.row) | ||
| changedRows.push(delta.end.row); | ||
| } | ||
| }; | ||
| }; | ||
|
|
||
| (function() { | ||
| this.processRows = function(rows) { | ||
| this.$inChange = true; | ||
| var checkedRows = []; | ||
|
|
||
| for (var r = 0, rowCount = rows.length; r < rowCount; r++) { | ||
| var row = rows[r]; | ||
|
|
||
| if (checkedRows.indexOf(row) > -1) | ||
| continue; | ||
|
|
||
| var cellWidthObj = this.$findCellWidthsForBlock(row); | ||
| var cellWidths = this.$setBlockCellWidthsToMax(cellWidthObj.cellWidths); | ||
| var rowIndex = cellWidthObj.firstRow; | ||
|
|
||
| for (var w = 0, l = cellWidths.length; w < l; w++) { | ||
| var widths = cellWidths[w]; | ||
| checkedRows.push(rowIndex); | ||
| this.$adjustRow(rowIndex, widths); | ||
| rowIndex++; | ||
| } | ||
| } | ||
| this.$inChange = false; | ||
| }; | ||
|
|
||
| this.$findCellWidthsForBlock = function(row) { | ||
| var cellWidths = [], widths; | ||
| var rowIter = row; | ||
| while (rowIter >= 0) { | ||
| widths = this.$cellWidthsForRow(rowIter); | ||
| if (widths.length == 0) | ||
| break; | ||
|
|
||
| cellWidths.unshift(widths); | ||
| rowIter--; | ||
| } | ||
| var firstRow = rowIter + 1; | ||
| rowIter = row; | ||
| var numRows = this.$editor.session.getLength(); | ||
|
|
||
| while (rowIter < numRows - 1) { | ||
| rowIter++; | ||
|
|
||
| widths = this.$cellWidthsForRow(rowIter); | ||
| if (widths.length == 0) | ||
| break; | ||
|
|
||
| cellWidths.push(widths); | ||
| } | ||
|
|
||
| return { cellWidths: cellWidths, firstRow: firstRow }; | ||
| }; | ||
|
|
||
| this.$cellWidthsForRow = function(row) { | ||
| var selectionColumns = this.$selectionColumnsForRow(row); | ||
|
|
||
| var tabs = [-1].concat(this.$tabsForRow(row)); | ||
| var widths = tabs.map(function(el) { return 0; } ).slice(1); | ||
| var line = this.$editor.session.getLine(row); | ||
|
|
||
| for (var i = 0, len = tabs.length - 1; i < len; i++) { | ||
| var leftEdge = tabs[i]+1; | ||
| var rightEdge = tabs[i+1]; | ||
|
|
||
| var rightmostSelection = this.$rightmostSelectionInCell(selectionColumns, rightEdge); | ||
| var cell = line.substring(leftEdge, rightEdge); | ||
| widths[i] = Math.max(cell.replace(/\s+$/g,'').length, rightmostSelection - leftEdge); | ||
| } | ||
|
|
||
| return widths; | ||
| }; | ||
|
|
||
| this.$selectionColumnsForRow = function(row) { | ||
| var selections = [], cursor = this.$editor.getCursorPosition(); | ||
| if (this.$editor.session.getSelection().isEmpty()) { | ||
| if (row == cursor.row) | ||
| selections.push(cursor.column); | ||
| } | ||
|
|
||
| return selections; | ||
| }; | ||
|
|
||
| this.$setBlockCellWidthsToMax = function(cellWidths) { | ||
| var startingNewBlock = true, blockStartRow, blockEndRow, maxWidth; | ||
| var columnInfo = this.$izip_longest(cellWidths); | ||
|
|
||
| for (var c = 0, l = columnInfo.length; c < l; c++) { | ||
| var column = columnInfo[c]; | ||
| if (!column.push) { | ||
| console.error(column); | ||
| continue; | ||
| } | ||
| column.push(NaN); | ||
|
|
||
| for (var r = 0, s = column.length; r < s; r++) { | ||
| var width = column[r]; | ||
| if (startingNewBlock) { | ||
| blockStartRow = r; | ||
| maxWidth = 0; | ||
| startingNewBlock = false; | ||
| } | ||
| if (isNaN(width)) { | ||
| blockEndRow = r; | ||
|
|
||
| for (var j = blockStartRow; j < blockEndRow; j++) { | ||
| cellWidths[j][c] = maxWidth; | ||
| } | ||
| startingNewBlock = true; | ||
| } | ||
|
|
||
| maxWidth = Math.max(maxWidth, width); | ||
| } | ||
| } | ||
|
|
||
| return cellWidths; | ||
| }; | ||
|
|
||
| this.$rightmostSelectionInCell = function(selectionColumns, cellRightEdge) { | ||
| var rightmost = 0; | ||
|
|
||
| if (selectionColumns.length) { | ||
| var lengths = []; | ||
| for (var s = 0, length = selectionColumns.length; s < length; s++) { | ||
| if (selectionColumns[s] <= cellRightEdge) | ||
| lengths.push(s); | ||
| else | ||
| lengths.push(0); | ||
| } | ||
| rightmost = Math.max.apply(Math, lengths); | ||
| } | ||
|
|
||
| return rightmost; | ||
| }; | ||
|
|
||
| this.$tabsForRow = function(row) { | ||
| var rowTabs = [], line = this.$editor.session.getLine(row), | ||
| re = /\t/g, match; | ||
|
|
||
| while ((match = re.exec(line)) != null) { | ||
| rowTabs.push(match.index); | ||
| } | ||
|
|
||
| return rowTabs; | ||
| }; | ||
|
|
||
| this.$adjustRow = function(row, widths) { | ||
| var rowTabs = this.$tabsForRow(row); | ||
|
|
||
| if (rowTabs.length == 0) | ||
| return; | ||
|
|
||
| var bias = 0, location = -1; | ||
| var expandedSet = this.$izip(widths, rowTabs); | ||
|
|
||
| for (var i = 0, l = expandedSet.length; i < l; i++) { | ||
| var w = expandedSet[i][0], it = expandedSet[i][1]; | ||
| location += 1 + w; | ||
| it += bias; | ||
| var difference = location - it; | ||
|
|
||
| if (difference == 0) | ||
| continue; | ||
|
|
||
| var partialLine = this.$editor.session.getLine(row).substr(0, it ); | ||
| var strippedPartialLine = partialLine.replace(/\s*$/g, ""); | ||
| var ispaces = partialLine.length - strippedPartialLine.length; | ||
|
|
||
| if (difference > 0) { | ||
| this.$editor.session.getDocument().insertInLine({row: row, column: it + 1}, Array(difference + 1).join(" ") + "\t"); | ||
| this.$editor.session.getDocument().removeInLine(row, it, it + 1); | ||
|
|
||
| bias += difference; | ||
| } | ||
|
|
||
| if (difference < 0 && ispaces >= -difference) { | ||
| this.$editor.session.getDocument().removeInLine(row, it + difference, it); | ||
| bias += difference; | ||
| } | ||
| } | ||
| }; | ||
| this.$izip_longest = function(iterables) { | ||
| if (!iterables[0]) | ||
| return []; | ||
| var longest = iterables[0].length; | ||
| var iterablesLength = iterables.length; | ||
|
|
||
| for (var i = 1; i < iterablesLength; i++) { | ||
| var iLength = iterables[i].length; | ||
| if (iLength > longest) | ||
| longest = iLength; | ||
| } | ||
|
|
||
| var expandedSet = []; | ||
|
|
||
| for (var l = 0; l < longest; l++) { | ||
| var set = []; | ||
| for (var i = 0; i < iterablesLength; i++) { | ||
| if (iterables[i][l] === "") | ||
| set.push(NaN); | ||
| else | ||
| set.push(iterables[i][l]); | ||
| } | ||
|
|
||
| expandedSet.push(set); | ||
| } | ||
|
|
||
|
|
||
| return expandedSet; | ||
| }; | ||
| this.$izip = function(widths, tabs) { | ||
| var size = widths.length >= tabs.length ? tabs.length : widths.length; | ||
|
|
||
| var expandedSet = []; | ||
| for (var i = 0; i < size; i++) { | ||
| var set = [ widths[i], tabs[i] ]; | ||
| expandedSet.push(set); | ||
| } | ||
| return expandedSet; | ||
| }; | ||
|
|
||
| }).call(ElasticTabstopsLite.prototype); | ||
|
|
||
| exports.ElasticTabstopsLite = ElasticTabstopsLite; | ||
|
|
||
| var Editor = require("../editor").Editor; | ||
| require("../config").defineOptions(Editor.prototype, "editor", { | ||
| useElasticTabstops: { | ||
| set: function(val) { | ||
| if (val) { | ||
| if (!this.elasticTabstops) | ||
| this.elasticTabstops = new ElasticTabstopsLite(this); | ||
| this.commands.on("afterExec", this.elasticTabstops.onAfterExec); | ||
| this.commands.on("exec", this.elasticTabstops.onExec); | ||
| this.on("change", this.elasticTabstops.onChange); | ||
| } else if (this.elasticTabstops) { | ||
| this.commands.removeListener("afterExec", this.elasticTabstops.onAfterExec); | ||
| this.commands.removeListener("exec", this.elasticTabstops.onExec); | ||
| this.removeListener("change", this.elasticTabstops.onChange); | ||
| } | ||
| } | ||
| } | ||
| }); | ||
|
|
||
| }); | ||
| (function() { | ||
| ace.require(["ace/ext/elastic_tabstops_lite"], function() {}); | ||
| })(); | ||
|
|
| @@ -0,0 +1,6 @@ | ||
|
|
||
| ; | ||
| (function() { | ||
| ace.require(["ace/ext/error_marker"], function() {}); | ||
| })(); | ||
|
|
| @@ -0,0 +1,170 @@ | ||
| ace.define("ace/ext/menu_tools/overlay_page",["require","exports","module","ace/lib/dom"], function(require, exports, module) { | ||
| 'use strict'; | ||
| var dom = require("../../lib/dom"); | ||
| var cssText = "#ace_settingsmenu, #kbshortcutmenu {\ | ||
| background-color: #F7F7F7;\ | ||
| color: black;\ | ||
| box-shadow: -5px 4px 5px rgba(126, 126, 126, 0.55);\ | ||
| padding: 1em 0.5em 2em 1em;\ | ||
| overflow: auto;\ | ||
| position: absolute;\ | ||
| margin: 0;\ | ||
| bottom: 0;\ | ||
| right: 0;\ | ||
| top: 0;\ | ||
| z-index: 9991;\ | ||
| cursor: default;\ | ||
| }\ | ||
| .ace_dark #ace_settingsmenu, .ace_dark #kbshortcutmenu {\ | ||
| box-shadow: -20px 10px 25px rgba(126, 126, 126, 0.25);\ | ||
| background-color: rgba(255, 255, 255, 0.6);\ | ||
| color: black;\ | ||
| }\ | ||
| .ace_optionsMenuEntry:hover {\ | ||
| background-color: rgba(100, 100, 100, 0.1);\ | ||
| -webkit-transition: all 0.5s;\ | ||
| transition: all 0.3s\ | ||
| }\ | ||
| .ace_closeButton {\ | ||
| background: rgba(245, 146, 146, 0.5);\ | ||
| border: 1px solid #F48A8A;\ | ||
| border-radius: 50%;\ | ||
| padding: 7px;\ | ||
| position: absolute;\ | ||
| right: -8px;\ | ||
| top: -8px;\ | ||
| z-index: 1000;\ | ||
| }\ | ||
| .ace_closeButton{\ | ||
| background: rgba(245, 146, 146, 0.9);\ | ||
| }\ | ||
| .ace_optionsMenuKey {\ | ||
| color: darkslateblue;\ | ||
| font-weight: bold;\ | ||
| }\ | ||
| .ace_optionsMenuCommand {\ | ||
| color: darkcyan;\ | ||
| font-weight: normal;\ | ||
| }"; | ||
| dom.importCssString(cssText); | ||
| module.exports.overlayPage = function overlayPage(editor, contentElement, top, right, bottom, left) { | ||
| top = top ? 'top: ' + top + ';' : ''; | ||
| bottom = bottom ? 'bottom: ' + bottom + ';' : ''; | ||
| right = right ? 'right: ' + right + ';' : ''; | ||
| left = left ? 'left: ' + left + ';' : ''; | ||
|
|
||
| var closer = document.createElement('div'); | ||
| var contentContainer = document.createElement('div'); | ||
|
|
||
| function documentEscListener(e) { | ||
| if (e.keyCode === 27) { | ||
| closer.click(); | ||
| } | ||
| } | ||
|
|
||
| closer.style.cssText = 'margin: 0; padding: 0; ' + | ||
| 'position: fixed; top:0; bottom:0; left:0; right:0;' + | ||
| 'z-index: 9990; ' + | ||
| 'background-color: rgba(0, 0, 0, 0.3);'; | ||
| closer.addEventListener('click', function() { | ||
| document.removeEventListener('keydown', documentEscListener); | ||
| closer.parentNode.removeChild(closer); | ||
| editor.focus(); | ||
| closer = null; | ||
| }); | ||
| document.addEventListener('keydown', documentEscListener); | ||
|
|
||
| contentContainer.style.cssText = top + right + bottom + left; | ||
| contentContainer.addEventListener('click', function(e) { | ||
| e.stopPropagation(); | ||
| }); | ||
|
|
||
| var wrapper = dom.createElement("div"); | ||
| wrapper.style.position = "relative"; | ||
|
|
||
| var closeButton = dom.createElement("div"); | ||
| closeButton.className = "ace_closeButton"; | ||
| closeButton.addEventListener('click', function() { | ||
| closer.click(); | ||
| }); | ||
|
|
||
| wrapper.appendChild(closeButton); | ||
| contentContainer.appendChild(wrapper); | ||
|
|
||
| contentContainer.appendChild(contentElement); | ||
| closer.appendChild(contentContainer); | ||
| document.body.appendChild(closer); | ||
| editor.blur(); | ||
| }; | ||
|
|
||
| }); | ||
|
|
||
| ace.define("ace/ext/menu_tools/get_editor_keyboard_shortcuts",["require","exports","module","ace/lib/keys"], function(require, exports, module) { | ||
| "use strict"; | ||
| var keys = require("../../lib/keys"); | ||
| module.exports.getEditorKeybordShortcuts = function(editor) { | ||
| var KEY_MODS = keys.KEY_MODS; | ||
| var keybindings = []; | ||
| var commandMap = {}; | ||
| editor.keyBinding.$handlers.forEach(function(handler) { | ||
| var ckb = handler.commandKeyBinding; | ||
| for (var i in ckb) { | ||
| var key = i.replace(/(^|-)\w/g, function(x) { return x.toUpperCase(); }); | ||
| var commands = ckb[i]; | ||
| if (!Array.isArray(commands)) | ||
| commands = [commands]; | ||
| commands.forEach(function(command) { | ||
| if (typeof command != "string") | ||
| command = command.name | ||
| if (commandMap[command]) { | ||
| commandMap[command].key += "|" + key; | ||
| } else { | ||
| commandMap[command] = {key: key, command: command}; | ||
| keybindings.push(commandMap[command]); | ||
| } | ||
| }); | ||
| } | ||
| }); | ||
| return keybindings; | ||
| }; | ||
|
|
||
| }); | ||
|
|
||
| ace.define("ace/ext/keybinding_menu",["require","exports","module","ace/editor","ace/ext/menu_tools/overlay_page","ace/ext/menu_tools/get_editor_keyboard_shortcuts"], function(require, exports, module) { | ||
| "use strict"; | ||
| var Editor = require("ace/editor").Editor; | ||
| function showKeyboardShortcuts (editor) { | ||
| if(!document.getElementById('kbshortcutmenu')) { | ||
| var overlayPage = require('./menu_tools/overlay_page').overlayPage; | ||
| var getEditorKeybordShortcuts = require('./menu_tools/get_editor_keyboard_shortcuts').getEditorKeybordShortcuts; | ||
| var kb = getEditorKeybordShortcuts(editor); | ||
| var el = document.createElement('div'); | ||
| var commands = kb.reduce(function(previous, current) { | ||
| return previous + '<div class="ace_optionsMenuEntry"><span class="ace_optionsMenuCommand">' | ||
| + current.command + '</span> : ' | ||
| + '<span class="ace_optionsMenuKey">' + current.key + '</span></div>'; | ||
| }, ''); | ||
|
|
||
| el.id = 'kbshortcutmenu'; | ||
| el.innerHTML = '<h1>Keyboard Shortcuts</h1>' + commands + '</div>'; | ||
| overlayPage(editor, el, '0', '0', '0', null); | ||
| } | ||
| } | ||
| module.exports.init = function(editor) { | ||
| Editor.prototype.showKeyboardShortcuts = function() { | ||
| showKeyboardShortcuts(this); | ||
| }; | ||
| editor.commands.addCommands([{ | ||
| name: "showKeyboardShortcuts", | ||
| bindKey: {win: "Ctrl-Alt-h", mac: "Command-Alt-h"}, | ||
| exec: function(editor, line) { | ||
| editor.showKeyboardShortcuts(); | ||
| } | ||
| }]); | ||
| }; | ||
|
|
||
| }); | ||
| (function() { | ||
| ace.require(["ace/ext/keybinding_menu"], function() {}); | ||
| })(); | ||
|
|
| @@ -0,0 +1,52 @@ | ||
| ace.define("ace/ext/linking",["require","exports","module","ace/editor","ace/config"], function(require, exports, module) { | ||
|
|
||
| var Editor = require("ace/editor").Editor; | ||
|
|
||
| require("../config").defineOptions(Editor.prototype, "editor", { | ||
| enableLinking: { | ||
| set: function(val) { | ||
| if (val) { | ||
| this.on("click", onClick); | ||
| this.on("mousemove", onMouseMove); | ||
| } else { | ||
| this.off("click", onClick); | ||
| this.off("mousemove", onMouseMove); | ||
| } | ||
| }, | ||
| value: false | ||
| } | ||
| }) | ||
|
|
||
| function onMouseMove(e) { | ||
| var editor = e.editor; | ||
| var ctrl = e.getAccelKey(); | ||
|
|
||
| if (ctrl) { | ||
| var editor = e.editor; | ||
| var docPos = e.getDocumentPosition(); | ||
| var session = editor.session; | ||
| var token = session.getTokenAt(docPos.row, docPos.column); | ||
|
|
||
| editor._emit("linkHover", {position: docPos, token: token}); | ||
| } | ||
| } | ||
|
|
||
| function onClick(e) { | ||
| var ctrl = e.getAccelKey(); | ||
| var button = e.getButton(); | ||
|
|
||
| if (button == 0 && ctrl) { | ||
| var editor = e.editor; | ||
| var docPos = e.getDocumentPosition(); | ||
| var session = editor.session; | ||
| var token = session.getTokenAt(docPos.row, docPos.column); | ||
|
|
||
| editor._emit("linkClick", {position: docPos, token: token}); | ||
| } | ||
| } | ||
|
|
||
| }); | ||
| (function() { | ||
| ace.require(["ace/ext/linking"], function() {}); | ||
| })(); | ||
|
|
| @@ -0,0 +1,202 @@ | ||
| ace.define("ace/ext/modelist",["require","exports","module"], function(require, exports, module) { | ||
| "use strict"; | ||
|
|
||
| var modes = []; | ||
| function getModeForPath(path) { | ||
| var mode = modesByName.text; | ||
| var fileName = path.split(/[\/\\]/).pop(); | ||
| for (var i = 0; i < modes.length; i++) { | ||
| if (modes[i].supportsFile(fileName)) { | ||
| mode = modes[i]; | ||
| break; | ||
| } | ||
| } | ||
| return mode; | ||
| } | ||
|
|
||
| var Mode = function(name, caption, extensions) { | ||
| this.name = name; | ||
| this.caption = caption; | ||
| this.mode = "ace/mode/" + name; | ||
| this.extensions = extensions; | ||
| var re; | ||
| if (/\^/.test(extensions)) { | ||
| re = extensions.replace(/\|(\^)?/g, function(a, b){ | ||
| return "$|" + (b ? "^" : "^.*\\."); | ||
| }) + "$"; | ||
| } else { | ||
| re = "^.*\\.(" + extensions + ")$"; | ||
| } | ||
|
|
||
| this.extRe = new RegExp(re, "gi"); | ||
| }; | ||
|
|
||
| Mode.prototype.supportsFile = function(filename) { | ||
| return filename.match(this.extRe); | ||
| }; | ||
| var supportedModes = { | ||
| ABAP: ["abap"], | ||
| ABC: ["abc"], | ||
| ActionScript:["as"], | ||
| ADA: ["ada|adb"], | ||
| Apache_Conf: ["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"], | ||
| AsciiDoc: ["asciidoc|adoc"], | ||
| Assembly_x86:["asm|a"], | ||
| AutoHotKey: ["ahk"], | ||
| BatchFile: ["bat|cmd"], | ||
| C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp|ino"], | ||
| C9Search: ["c9search_results"], | ||
| Cirru: ["cirru|cr"], | ||
| Clojure: ["clj|cljs"], | ||
| Cobol: ["CBL|COB"], | ||
| coffee: ["coffee|cf|cson|^Cakefile"], | ||
| ColdFusion: ["cfm"], | ||
| CSharp: ["cs"], | ||
| CSS: ["css"], | ||
| Curly: ["curly"], | ||
| D: ["d|di"], | ||
| Dart: ["dart"], | ||
| Diff: ["diff|patch"], | ||
| Dockerfile: ["^Dockerfile"], | ||
| Dot: ["dot"], | ||
| Dummy: ["dummy"], | ||
| DummySyntax: ["dummy"], | ||
| Eiffel: ["e|ge"], | ||
| EJS: ["ejs"], | ||
| Elixir: ["ex|exs"], | ||
| Elm: ["elm"], | ||
| Erlang: ["erl|hrl"], | ||
| Forth: ["frt|fs|ldr"], | ||
| Fortran: ["f|f90"], | ||
| FTL: ["ftl"], | ||
| Gcode: ["gcode"], | ||
| Gherkin: ["feature"], | ||
| Gitignore: ["^.gitignore"], | ||
| Glsl: ["glsl|frag|vert"], | ||
| Gobstones: ["gbs"], | ||
| golang: ["go"], | ||
| Groovy: ["groovy"], | ||
| HAML: ["haml"], | ||
| Handlebars: ["hbs|handlebars|tpl|mustache"], | ||
| Haskell: ["hs"], | ||
| haXe: ["hx"], | ||
| HTML: ["html|htm|xhtml"], | ||
| HTML_Elixir: ["eex|html.eex"], | ||
| HTML_Ruby: ["erb|rhtml|html.erb"], | ||
| INI: ["ini|conf|cfg|prefs"], | ||
| Io: ["io"], | ||
| Jack: ["jack"], | ||
| Jade: ["jade"], | ||
| Java: ["java"], | ||
| JavaScript: ["js|jsm|jsx"], | ||
| JSON: ["json"], | ||
| JSONiq: ["jq"], | ||
| JSP: ["jsp"], | ||
| JSX: ["jsx"], | ||
| Julia: ["jl"], | ||
| LaTeX: ["tex|latex|ltx|bib"], | ||
| Lean: ["lean|hlean"], | ||
| LESS: ["less"], | ||
| Liquid: ["liquid"], | ||
| Lisp: ["lisp"], | ||
| LiveScript: ["ls"], | ||
| LogiQL: ["logic|lql"], | ||
| LSL: ["lsl"], | ||
| Lua: ["lua"], | ||
| LuaPage: ["lp"], | ||
| Lucene: ["lucene"], | ||
| Makefile: ["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"], | ||
| Markdown: ["md|markdown"], | ||
| Mask: ["mask"], | ||
| MATLAB: ["matlab"], | ||
| Maze: ["mz"], | ||
| MEL: ["mel"], | ||
| MUSHCode: ["mc|mush"], | ||
| MySQL: ["mysql"], | ||
| Nix: ["nix"], | ||
| NSIS: ["nsi|nsh"], | ||
| ObjectiveC: ["m|mm"], | ||
| OCaml: ["ml|mli"], | ||
| Pascal: ["pas|p"], | ||
| Perl: ["pl|pm"], | ||
| pgSQL: ["pgsql"], | ||
| PHP: ["php|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"], | ||
| Powershell: ["ps1"], | ||
| Praat: ["praat|praatscript|psc|proc"], | ||
| Prolog: ["plg|prolog"], | ||
| Properties: ["properties"], | ||
| Protobuf: ["proto"], | ||
| Python: ["py"], | ||
| R: ["r"], | ||
| Razor: ["cshtml"], | ||
| RDoc: ["Rd"], | ||
| RHTML: ["Rhtml"], | ||
| RST: ["rst"], | ||
| Ruby: ["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"], | ||
| Rust: ["rs"], | ||
| SASS: ["sass"], | ||
| SCAD: ["scad"], | ||
| Scala: ["scala"], | ||
| Scheme: ["scm|sm|rkt|oak|scheme"], | ||
| SCSS: ["scss"], | ||
| SH: ["sh|bash|^.bashrc"], | ||
| SJS: ["sjs"], | ||
| Smarty: ["smarty|tpl"], | ||
| snippets: ["snippets"], | ||
| Soy_Template:["soy"], | ||
| Space: ["space"], | ||
| SQL: ["sql"], | ||
| SQLServer: ["sqlserver"], | ||
| Stylus: ["styl|stylus"], | ||
| SVG: ["svg"], | ||
| Swift: ["swift"], | ||
| Tcl: ["tcl"], | ||
| Tex: ["tex"], | ||
| Text: ["txt"], | ||
| Textile: ["textile"], | ||
| Toml: ["toml"], | ||
| Twig: ["twig|swig"], | ||
| Typescript: ["ts|typescript|str"], | ||
| Vala: ["vala"], | ||
| VBScript: ["vbs|vb"], | ||
| Velocity: ["vm"], | ||
| Verilog: ["v|vh|sv|svh"], | ||
| VHDL: ["vhd|vhdl"], | ||
| Wollok: ["wlk|wpgm|wtest"], | ||
| XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml"], | ||
| XQuery: ["xq"], | ||
| YAML: ["yaml|yml"], | ||
| Django: ["html"] | ||
| }; | ||
|
|
||
| var nameOverrides = { | ||
| ObjectiveC: "Objective-C", | ||
| CSharp: "C#", | ||
| golang: "Go", | ||
| C_Cpp: "C and C++", | ||
| coffee: "CoffeeScript", | ||
| HTML_Ruby: "HTML (Ruby)", | ||
| HTML_Elixir: "HTML (Elixir)", | ||
| FTL: "FreeMarker" | ||
| }; | ||
| var modesByName = {}; | ||
| for (var name in supportedModes) { | ||
| var data = supportedModes[name]; | ||
| var displayName = (nameOverrides[name] || name).replace(/_/g, " "); | ||
| var filename = name.toLowerCase(); | ||
| var mode = new Mode(filename, displayName, data[0]); | ||
| modesByName[filename] = mode; | ||
| modes.push(mode); | ||
| } | ||
|
|
||
| module.exports = { | ||
| getModeForPath: getModeForPath, | ||
| modes: modes, | ||
| modesByName: modesByName | ||
| }; | ||
|
|
||
| }); | ||
| (function() { | ||
| ace.require(["ace/ext/modelist"], function() {}); | ||
| })(); | ||
|
|
| @@ -0,0 +1,71 @@ | ||
| ace.define("ace/ext/spellcheck",["require","exports","module","ace/lib/event","ace/editor","ace/config"], function(require, exports, module) { | ||
| "use strict"; | ||
| var event = require("../lib/event"); | ||
|
|
||
| exports.contextMenuHandler = function(e){ | ||
| var host = e.target; | ||
| var text = host.textInput.getElement(); | ||
| if (!host.selection.isEmpty()) | ||
| return; | ||
| var c = host.getCursorPosition(); | ||
| var r = host.session.getWordRange(c.row, c.column); | ||
| var w = host.session.getTextRange(r); | ||
|
|
||
| host.session.tokenRe.lastIndex = 0; | ||
| if (!host.session.tokenRe.test(w)) | ||
| return; | ||
| var PLACEHOLDER = "\x01\x01"; | ||
| var value = w + " " + PLACEHOLDER; | ||
| text.value = value; | ||
| text.setSelectionRange(w.length, w.length + 1); | ||
| text.setSelectionRange(0, 0); | ||
| text.setSelectionRange(0, w.length); | ||
|
|
||
| var afterKeydown = false; | ||
| event.addListener(text, "keydown", function onKeydown() { | ||
| event.removeListener(text, "keydown", onKeydown); | ||
| afterKeydown = true; | ||
| }); | ||
|
|
||
| host.textInput.setInputHandler(function(newVal) { | ||
| console.log(newVal , value, text.selectionStart, text.selectionEnd) | ||
| if (newVal == value) | ||
| return ''; | ||
| if (newVal.lastIndexOf(value, 0) === 0) | ||
| return newVal.slice(value.length); | ||
| if (newVal.substr(text.selectionEnd) == value) | ||
| return newVal.slice(0, -value.length); | ||
| if (newVal.slice(-2) == PLACEHOLDER) { | ||
| var val = newVal.slice(0, -2); | ||
| if (val.slice(-1) == " ") { | ||
| if (afterKeydown) | ||
| return val.substring(0, text.selectionEnd); | ||
| val = val.slice(0, -1); | ||
| host.session.replace(r, val); | ||
| return ""; | ||
| } | ||
| } | ||
|
|
||
| return newVal; | ||
| }); | ||
| }; | ||
| var Editor = require("../editor").Editor; | ||
| require("../config").defineOptions(Editor.prototype, "editor", { | ||
| spellcheck: { | ||
| set: function(val) { | ||
| var text = this.textInput.getElement(); | ||
| text.spellcheck = !!val; | ||
| if (!val) | ||
| this.removeListener("nativecontextmenu", exports.contextMenuHandler); | ||
| else | ||
| this.on("nativecontextmenu", exports.contextMenuHandler); | ||
| }, | ||
| value: true | ||
| } | ||
| }); | ||
|
|
||
| }); | ||
| (function() { | ||
| ace.require(["ace/ext/spellcheck"], function() {}); | ||
| })(); | ||
|
|
| @@ -0,0 +1,246 @@ | ||
| ace.define("ace/split",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/editor","ace/virtual_renderer","ace/edit_session"], function(require, exports, module) { | ||
| "use strict"; | ||
|
|
||
| var oop = require("./lib/oop"); | ||
| var lang = require("./lib/lang"); | ||
| var EventEmitter = require("./lib/event_emitter").EventEmitter; | ||
|
|
||
| var Editor = require("./editor").Editor; | ||
| var Renderer = require("./virtual_renderer").VirtualRenderer; | ||
| var EditSession = require("./edit_session").EditSession; | ||
|
|
||
|
|
||
| var Split = function(container, theme, splits) { | ||
| this.BELOW = 1; | ||
| this.BESIDE = 0; | ||
|
|
||
| this.$container = container; | ||
| this.$theme = theme; | ||
| this.$splits = 0; | ||
| this.$editorCSS = ""; | ||
| this.$editors = []; | ||
| this.$orientation = this.BESIDE; | ||
|
|
||
| this.setSplits(splits || 1); | ||
| this.$cEditor = this.$editors[0]; | ||
|
|
||
|
|
||
| this.on("focus", function(editor) { | ||
| this.$cEditor = editor; | ||
| }.bind(this)); | ||
| }; | ||
|
|
||
| (function(){ | ||
|
|
||
| oop.implement(this, EventEmitter); | ||
|
|
||
| this.$createEditor = function() { | ||
| var el = document.createElement("div"); | ||
| el.className = this.$editorCSS; | ||
| el.style.cssText = "position: absolute; top:0px; bottom:0px"; | ||
| this.$container.appendChild(el); | ||
| var editor = new Editor(new Renderer(el, this.$theme)); | ||
|
|
||
| editor.on("focus", function() { | ||
| this._emit("focus", editor); | ||
| }.bind(this)); | ||
|
|
||
| this.$editors.push(editor); | ||
| editor.setFontSize(this.$fontSize); | ||
| return editor; | ||
| }; | ||
|
|
||
| this.setSplits = function(splits) { | ||
| var editor; | ||
| if (splits < 1) { | ||
| throw "The number of splits have to be > 0!"; | ||
| } | ||
|
|
||
| if (splits == this.$splits) { | ||
| return; | ||
| } else if (splits > this.$splits) { | ||
| while (this.$splits < this.$editors.length && this.$splits < splits) { | ||
| editor = this.$editors[this.$splits]; | ||
| this.$container.appendChild(editor.container); | ||
| editor.setFontSize(this.$fontSize); | ||
| this.$splits ++; | ||
| } | ||
| while (this.$splits < splits) { | ||
| this.$createEditor(); | ||
| this.$splits ++; | ||
| } | ||
| } else { | ||
| while (this.$splits > splits) { | ||
| editor = this.$editors[this.$splits - 1]; | ||
| this.$container.removeChild(editor.container); | ||
| this.$splits --; | ||
| } | ||
| } | ||
| this.resize(); | ||
| }; | ||
| this.getSplits = function() { | ||
| return this.$splits; | ||
| }; | ||
| this.getEditor = function(idx) { | ||
| return this.$editors[idx]; | ||
| }; | ||
| this.getCurrentEditor = function() { | ||
| return this.$cEditor; | ||
| }; | ||
| this.focus = function() { | ||
| this.$cEditor.focus(); | ||
| }; | ||
| this.blur = function() { | ||
| this.$cEditor.blur(); | ||
| }; | ||
| this.setTheme = function(theme) { | ||
| this.$editors.forEach(function(editor) { | ||
| editor.setTheme(theme); | ||
| }); | ||
| }; | ||
| this.setKeyboardHandler = function(keybinding) { | ||
| this.$editors.forEach(function(editor) { | ||
| editor.setKeyboardHandler(keybinding); | ||
| }); | ||
| }; | ||
| this.forEach = function(callback, scope) { | ||
| this.$editors.forEach(callback, scope); | ||
| }; | ||
|
|
||
|
|
||
| this.$fontSize = ""; | ||
| this.setFontSize = function(size) { | ||
| this.$fontSize = size; | ||
| this.forEach(function(editor) { | ||
| editor.setFontSize(size); | ||
| }); | ||
| }; | ||
|
|
||
| this.$cloneSession = function(session) { | ||
| var s = new EditSession(session.getDocument(), session.getMode()); | ||
|
|
||
| var undoManager = session.getUndoManager(); | ||
| if (undoManager) { | ||
| var undoManagerProxy = new UndoManagerProxy(undoManager, s); | ||
| s.setUndoManager(undoManagerProxy); | ||
| } | ||
| s.$informUndoManager = lang.delayedCall(function() { s.$deltas = []; }); | ||
| s.setTabSize(session.getTabSize()); | ||
| s.setUseSoftTabs(session.getUseSoftTabs()); | ||
| s.setOverwrite(session.getOverwrite()); | ||
| s.setBreakpoints(session.getBreakpoints()); | ||
| s.setUseWrapMode(session.getUseWrapMode()); | ||
| s.setUseWorker(session.getUseWorker()); | ||
| s.setWrapLimitRange(session.$wrapLimitRange.min, | ||
| session.$wrapLimitRange.max); | ||
| s.$foldData = session.$cloneFoldData(); | ||
|
|
||
| return s; | ||
| }; | ||
| this.setSession = function(session, idx) { | ||
| var editor; | ||
| if (idx == null) { | ||
| editor = this.$cEditor; | ||
| } else { | ||
| editor = this.$editors[idx]; | ||
| } | ||
| var isUsed = this.$editors.some(function(editor) { | ||
| return editor.session === session; | ||
| }); | ||
|
|
||
| if (isUsed) { | ||
| session = this.$cloneSession(session); | ||
| } | ||
| editor.setSession(session); | ||
| return session; | ||
| }; | ||
| this.getOrientation = function() { | ||
| return this.$orientation; | ||
| }; | ||
| this.setOrientation = function(orientation) { | ||
| if (this.$orientation == orientation) { | ||
| return; | ||
| } | ||
| this.$orientation = orientation; | ||
| this.resize(); | ||
| }; | ||
| this.resize = function() { | ||
| var width = this.$container.clientWidth; | ||
| var height = this.$container.clientHeight; | ||
| var editor; | ||
|
|
||
| if (this.$orientation == this.BESIDE) { | ||
| var editorWidth = width / this.$splits; | ||
| for (var i = 0; i < this.$splits; i++) { | ||
| editor = this.$editors[i]; | ||
| editor.container.style.width = editorWidth + "px"; | ||
| editor.container.style.top = "0px"; | ||
| editor.container.style.left = i * editorWidth + "px"; | ||
| editor.container.style.height = height + "px"; | ||
| editor.resize(); | ||
| } | ||
| } else { | ||
| var editorHeight = height / this.$splits; | ||
| for (var i = 0; i < this.$splits; i++) { | ||
| editor = this.$editors[i]; | ||
| editor.container.style.width = width + "px"; | ||
| editor.container.style.top = i * editorHeight + "px"; | ||
| editor.container.style.left = "0px"; | ||
| editor.container.style.height = editorHeight + "px"; | ||
| editor.resize(); | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| }).call(Split.prototype); | ||
|
|
||
|
|
||
| function UndoManagerProxy(undoManager, session) { | ||
| this.$u = undoManager; | ||
| this.$doc = session; | ||
| } | ||
|
|
||
| (function() { | ||
| this.execute = function(options) { | ||
| this.$u.execute(options); | ||
| }; | ||
|
|
||
| this.undo = function() { | ||
| var selectionRange = this.$u.undo(true); | ||
| if (selectionRange) { | ||
| this.$doc.selection.setSelectionRange(selectionRange); | ||
| } | ||
| }; | ||
|
|
||
| this.redo = function() { | ||
| var selectionRange = this.$u.redo(true); | ||
| if (selectionRange) { | ||
| this.$doc.selection.setSelectionRange(selectionRange); | ||
| } | ||
| }; | ||
|
|
||
| this.reset = function() { | ||
| this.$u.reset(); | ||
| }; | ||
|
|
||
| this.hasUndo = function() { | ||
| return this.$u.hasUndo(); | ||
| }; | ||
|
|
||
| this.hasRedo = function() { | ||
| return this.$u.hasRedo(); | ||
| }; | ||
| }).call(UndoManagerProxy.prototype); | ||
|
|
||
| exports.Split = Split; | ||
| }); | ||
|
|
||
| ace.define("ace/ext/split",["require","exports","module","ace/split"], function(require, exports, module) { | ||
| "use strict"; | ||
| module.exports = require("../split"); | ||
|
|
||
| }); | ||
| (function() { | ||
| ace.require(["ace/ext/split"], function() {}); | ||
| })(); | ||
|
|
| @@ -0,0 +1,161 @@ | ||
| ace.define("ace/ext/static_highlight",["require","exports","module","ace/edit_session","ace/layer/text","ace/config","ace/lib/dom"], function(require, exports, module) { | ||
| "use strict"; | ||
|
|
||
| var EditSession = require("../edit_session").EditSession; | ||
| var TextLayer = require("../layer/text").Text; | ||
| var baseStyles = ".ace_static_highlight {\ | ||
| font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', 'Droid Sans Mono', monospace;\ | ||
| font-size: 12px;\ | ||
| white-space: pre-wrap\ | ||
| }\ | ||
| .ace_static_highlight .ace_gutter {\ | ||
| width: 2em;\ | ||
| text-align: right;\ | ||
| padding: 0 3px 0 0;\ | ||
| margin-right: 3px;\ | ||
| }\ | ||
| .ace_static_highlight.ace_show_gutter .ace_line {\ | ||
| padding-left: 2.6em;\ | ||
| }\ | ||
| .ace_static_highlight .ace_line { position: relative; }\ | ||
| .ace_static_highlight .ace_gutter-cell {\ | ||
| -moz-user-select: -moz-none;\ | ||
| -khtml-user-select: none;\ | ||
| -webkit-user-select: none;\ | ||
| user-select: none;\ | ||
| top: 0;\ | ||
| bottom: 0;\ | ||
| left: 0;\ | ||
| position: absolute;\ | ||
| }\ | ||
| .ace_static_highlight .ace_gutter-cell:before {\ | ||
| content: counter(ace_line, decimal);\ | ||
| counter-increment: ace_line;\ | ||
| }\ | ||
| .ace_static_highlight {\ | ||
| counter-reset: ace_line;\ | ||
| }\ | ||
| "; | ||
| var config = require("../config"); | ||
| var dom = require("../lib/dom"); | ||
|
|
||
| var SimpleTextLayer = function() { | ||
| this.config = {}; | ||
| }; | ||
| SimpleTextLayer.prototype = TextLayer.prototype; | ||
|
|
||
| var highlight = function(el, opts, callback) { | ||
| var m = el.className.match(/lang-(\w+)/); | ||
| var mode = opts.mode || m && ("ace/mode/" + m[1]); | ||
| if (!mode) | ||
| return false; | ||
| var theme = opts.theme || "ace/theme/textmate"; | ||
|
|
||
| var data = ""; | ||
| var nodes = []; | ||
|
|
||
| if (el.firstElementChild) { | ||
| var textLen = 0; | ||
| for (var i = 0; i < el.childNodes.length; i++) { | ||
| var ch = el.childNodes[i]; | ||
| if (ch.nodeType == 3) { | ||
| textLen += ch.data.length; | ||
| data += ch.data; | ||
| } else { | ||
| nodes.push(textLen, ch); | ||
| } | ||
| } | ||
| } else { | ||
| data = dom.getInnerText(el); | ||
| if (opts.trim) | ||
| data = data.trim(); | ||
| } | ||
|
|
||
| highlight.render(data, mode, theme, opts.firstLineNumber, !opts.showGutter, function (highlighted) { | ||
| dom.importCssString(highlighted.css, "ace_highlight"); | ||
| el.innerHTML = highlighted.html; | ||
| var container = el.firstChild.firstChild; | ||
| for (var i = 0; i < nodes.length; i += 2) { | ||
| var pos = highlighted.session.doc.indexToPosition(nodes[i]); | ||
| var node = nodes[i + 1]; | ||
| var lineEl = container.children[pos.row]; | ||
| lineEl && lineEl.appendChild(node); | ||
| } | ||
| callback && callback(); | ||
| }); | ||
| }; | ||
| highlight.render = function(input, mode, theme, lineStart, disableGutter, callback) { | ||
| var waiting = 1; | ||
| var modeCache = EditSession.prototype.$modes; | ||
| if (typeof theme == "string") { | ||
| waiting++; | ||
| config.loadModule(['theme', theme], function(m) { | ||
| theme = m; | ||
| --waiting || done(); | ||
| }); | ||
| } | ||
| var modeOptions; | ||
| if (mode && typeof mode === "object" && !mode.getTokenizer) { | ||
| modeOptions = mode; | ||
| mode = modeOptions.path; | ||
| } | ||
| if (typeof mode == "string") { | ||
| waiting++; | ||
| config.loadModule(['mode', mode], function(m) { | ||
| if (!modeCache[mode] || modeOptions) | ||
| modeCache[mode] = new m.Mode(modeOptions); | ||
| mode = modeCache[mode]; | ||
| --waiting || done(); | ||
| }); | ||
| } | ||
| function done() { | ||
| var result = highlight.renderSync(input, mode, theme, lineStart, disableGutter); | ||
| return callback ? callback(result) : result; | ||
| } | ||
| return --waiting || done(); | ||
| }; | ||
| highlight.renderSync = function(input, mode, theme, lineStart, disableGutter) { | ||
| lineStart = parseInt(lineStart || 1, 10); | ||
|
|
||
| var session = new EditSession(""); | ||
| session.setUseWorker(false); | ||
| session.setMode(mode); | ||
|
|
||
| var textLayer = new SimpleTextLayer(); | ||
| textLayer.setSession(session); | ||
|
|
||
| session.setValue(input); | ||
|
|
||
| var stringBuilder = []; | ||
| var length = session.getLength(); | ||
|
|
||
| for(var ix = 0; ix < length; ix++) { | ||
| stringBuilder.push("<div class='ace_line'>"); | ||
| if (!disableGutter) | ||
| stringBuilder.push("<span class='ace_gutter ace_gutter-cell' unselectable='on'>" + /*(ix + lineStart) + */ "</span>"); | ||
| textLayer.$renderLine(stringBuilder, ix, true, false); | ||
| stringBuilder.push("\n</div>"); | ||
| } | ||
| var html = "<div class='" + theme.cssClass + "'>" + | ||
| "<div class='ace_static_highlight" + (disableGutter ? "" : " ace_show_gutter") + | ||
| "' style='counter-reset:ace_line " + (lineStart - 1) + "'>" + | ||
| stringBuilder.join("") + | ||
| "</div>" + | ||
| "</div>"; | ||
|
|
||
| textLayer.destroy(); | ||
|
|
||
| return { | ||
| css: baseStyles + theme.cssText, | ||
| html: html, | ||
| session: session | ||
| }; | ||
| }; | ||
|
|
||
| module.exports = highlight; | ||
| module.exports.highlight =highlight; | ||
| }); | ||
| (function() { | ||
| ace.require(["ace/ext/static_highlight"], function() {}); | ||
| })(); | ||
|
|
| @@ -0,0 +1,53 @@ | ||
| ace.define("ace/ext/statusbar",["require","exports","module","ace/lib/dom","ace/lib/lang"], function(require, exports, module) { | ||
| "use strict"; | ||
| var dom = require("ace/lib/dom"); | ||
| var lang = require("ace/lib/lang"); | ||
|
|
||
| var StatusBar = function(editor, parentNode) { | ||
| this.element = dom.createElement("div"); | ||
| this.element.className = "ace_status-indicator"; | ||
| this.element.style.cssText = "display: inline-block;"; | ||
| parentNode.appendChild(this.element); | ||
|
|
||
| var statusUpdate = lang.delayedCall(function(){ | ||
| this.updateStatus(editor) | ||
| }.bind(this)).schedule.bind(null, 100); | ||
|
|
||
| editor.on("changeStatus", statusUpdate); | ||
| editor.on("changeSelection", statusUpdate); | ||
| editor.on("keyboardActivity", statusUpdate); | ||
| }; | ||
|
|
||
| (function(){ | ||
| this.updateStatus = function(editor) { | ||
| var status = []; | ||
| function add(str, separator) { | ||
| str && status.push(str, separator || "|"); | ||
| } | ||
|
|
||
| add(editor.keyBinding.getStatusText(editor)); | ||
| if (editor.commands.recording) | ||
| add("REC"); | ||
|
|
||
| var sel = editor.selection; | ||
| var c = sel.lead; | ||
|
|
||
| if (!sel.isEmpty()) { | ||
| var r = editor.getSelectionRange(); | ||
| add("(" + (r.end.row - r.start.row) + ":" +(r.end.column - r.start.column) + ")", " "); | ||
| } | ||
| add(c.row + ":" + c.column, " "); | ||
| if (sel.rangeCount) | ||
| add("[" + sel.rangeCount + "]", " "); | ||
| status.pop(); | ||
| this.element.textContent = status.join(""); | ||
| }; | ||
| }).call(StatusBar.prototype); | ||
|
|
||
| exports.StatusBar = StatusBar; | ||
|
|
||
| }); | ||
| (function() { | ||
| ace.require(["ace/ext/statusbar"], function() {}); | ||
| })(); | ||
|
|
| @@ -0,0 +1,60 @@ | ||
| ace.define("ace/ext/themelist",["require","exports","module","ace/lib/fixoldbrowsers"], function(require, exports, module) { | ||
| "use strict"; | ||
| require("ace/lib/fixoldbrowsers"); | ||
|
|
||
| var themeData = [ | ||
| ["Chrome" ], | ||
| ["Clouds" ], | ||
| ["Crimson Editor" ], | ||
| ["Dawn" ], | ||
| ["Dreamweaver" ], | ||
| ["Eclipse" ], | ||
| ["GitHub" ], | ||
| ["IPlastic" ], | ||
| ["Solarized Light"], | ||
| ["TextMate" ], | ||
| ["Tomorrow" ], | ||
| ["XCode" ], | ||
| ["Kuroir"], | ||
| ["KatzenMilch"], | ||
| ["SQL Server" ,"sqlserver" , "light"], | ||
| ["Ambiance" ,"ambiance" , "dark"], | ||
| ["Chaos" ,"chaos" , "dark"], | ||
| ["Clouds Midnight" ,"clouds_midnight" , "dark"], | ||
| ["Cobalt" ,"cobalt" , "dark"], | ||
| ["idle Fingers" ,"idle_fingers" , "dark"], | ||
| ["krTheme" ,"kr_theme" , "dark"], | ||
| ["Merbivore" ,"merbivore" , "dark"], | ||
| ["Merbivore Soft" ,"merbivore_soft" , "dark"], | ||
| ["Mono Industrial" ,"mono_industrial" , "dark"], | ||
| ["Monokai" ,"monokai" , "dark"], | ||
| ["Pastel on dark" ,"pastel_on_dark" , "dark"], | ||
| ["Solarized Dark" ,"solarized_dark" , "dark"], | ||
| ["Terminal" ,"terminal" , "dark"], | ||
| ["Tomorrow Night" ,"tomorrow_night" , "dark"], | ||
| ["Tomorrow Night Blue" ,"tomorrow_night_blue" , "dark"], | ||
| ["Tomorrow Night Bright","tomorrow_night_bright" , "dark"], | ||
| ["Tomorrow Night 80s" ,"tomorrow_night_eighties" , "dark"], | ||
| ["Twilight" ,"twilight" , "dark"], | ||
| ["Vibrant Ink" ,"vibrant_ink" , "dark"] | ||
| ]; | ||
|
|
||
|
|
||
| exports.themesByName = {}; | ||
| exports.themes = themeData.map(function(data) { | ||
| var name = data[1] || data[0].replace(/ /g, "_").toLowerCase(); | ||
| var theme = { | ||
| caption: data[0], | ||
| theme: "ace/theme/" + name, | ||
| isDark: data[2] == "dark", | ||
| name: name | ||
| }; | ||
| exports.themesByName[name] = theme; | ||
| return theme; | ||
| }); | ||
|
|
||
| }); | ||
| (function() { | ||
| ace.require(["ace/ext/themelist"], function() {}); | ||
| })(); | ||
|
|
| @@ -0,0 +1,185 @@ | ||
| ace.define("ace/ext/whitespace",["require","exports","module","ace/lib/lang"], function(require, exports, module) { | ||
| "use strict"; | ||
|
|
||
| var lang = require("../lib/lang"); | ||
| exports.$detectIndentation = function(lines, fallback) { | ||
| var stats = []; | ||
| var changes = []; | ||
| var tabIndents = 0; | ||
| var prevSpaces = 0; | ||
| var max = Math.min(lines.length, 1000); | ||
| for (var i = 0; i < max; i++) { | ||
| var line = lines[i]; | ||
| if (!/^\s*[^*+\-\s]/.test(line)) | ||
| continue; | ||
|
|
||
| if (line[0] == "\t") { | ||
| tabIndents++; | ||
| prevSpaces = -Number.MAX_VALUE; | ||
| } else { | ||
| var spaces = line.match(/^ */)[0].length; | ||
| if (spaces && line[spaces] != "\t") { | ||
| var diff = spaces - prevSpaces; | ||
| if (diff > 0 && !(prevSpaces%diff) && !(spaces%diff)) | ||
| changes[diff] = (changes[diff] || 0) + 1; | ||
|
|
||
| stats[spaces] = (stats[spaces] || 0) + 1; | ||
| } | ||
| prevSpaces = spaces; | ||
| } | ||
| while (i < max && line[line.length - 1] == "\\") | ||
| line = lines[i++]; | ||
| } | ||
|
|
||
| function getScore(indent) { | ||
| var score = 0; | ||
| for (var i = indent; i < stats.length; i += indent) | ||
| score += stats[i] || 0; | ||
| return score; | ||
| } | ||
|
|
||
| var changesTotal = changes.reduce(function(a,b){return a+b}, 0); | ||
|
|
||
| var first = {score: 0, length: 0}; | ||
| var spaceIndents = 0; | ||
| for (var i = 1; i < 12; i++) { | ||
| var score = getScore(i); | ||
| if (i == 1) { | ||
| spaceIndents = score; | ||
| score = stats[1] ? 0.9 : 0.8; | ||
| if (!stats.length) | ||
| score = 0; | ||
| } else | ||
| score /= spaceIndents; | ||
|
|
||
| if (changes[i]) | ||
| score += changes[i] / changesTotal; | ||
|
|
||
| if (score > first.score) | ||
| first = {score: score, length: i}; | ||
| } | ||
|
|
||
| if (first.score && first.score > 1.4) | ||
| var tabLength = first.length; | ||
|
|
||
| if (tabIndents > spaceIndents + 1) { | ||
| if (tabLength == 1 || spaceIndents < tabIndents / 4 || first.score < 1.8) | ||
| tabLength = undefined; | ||
| return {ch: "\t", length: tabLength}; | ||
| } | ||
| if (spaceIndents > tabIndents + 1) | ||
| return {ch: " ", length: tabLength}; | ||
| }; | ||
|
|
||
| exports.detectIndentation = function(session) { | ||
| var lines = session.getLines(0, 1000); | ||
| var indent = exports.$detectIndentation(lines) || {}; | ||
|
|
||
| if (indent.ch) | ||
| session.setUseSoftTabs(indent.ch == " "); | ||
|
|
||
| if (indent.length) | ||
| session.setTabSize(indent.length); | ||
| return indent; | ||
| }; | ||
|
|
||
| exports.trimTrailingSpace = function(session, trimEmpty) { | ||
| var doc = session.getDocument(); | ||
| var lines = doc.getAllLines(); | ||
|
|
||
| var min = trimEmpty ? -1 : 0; | ||
|
|
||
| for (var i = 0, l=lines.length; i < l; i++) { | ||
| var line = lines[i]; | ||
| var index = line.search(/\s+$/); | ||
|
|
||
| if (index > min) | ||
| doc.removeInLine(i, index, line.length); | ||
| } | ||
| }; | ||
|
|
||
| exports.convertIndentation = function(session, ch, len) { | ||
| var oldCh = session.getTabString()[0]; | ||
| var oldLen = session.getTabSize(); | ||
| if (!len) len = oldLen; | ||
| if (!ch) ch = oldCh; | ||
|
|
||
| var tab = ch == "\t" ? ch: lang.stringRepeat(ch, len); | ||
|
|
||
| var doc = session.doc; | ||
| var lines = doc.getAllLines(); | ||
|
|
||
| var cache = {}; | ||
| var spaceCache = {}; | ||
| for (var i = 0, l=lines.length; i < l; i++) { | ||
| var line = lines[i]; | ||
| var match = line.match(/^\s*/)[0]; | ||
| if (match) { | ||
| var w = session.$getStringScreenWidth(match)[0]; | ||
| var tabCount = Math.floor(w/oldLen); | ||
| var reminder = w%oldLen; | ||
| var toInsert = cache[tabCount] || (cache[tabCount] = lang.stringRepeat(tab, tabCount)); | ||
| toInsert += spaceCache[reminder] || (spaceCache[reminder] = lang.stringRepeat(" ", reminder)); | ||
|
|
||
| if (toInsert != match) { | ||
| doc.removeInLine(i, 0, match.length); | ||
| doc.insertInLine({row: i, column: 0}, toInsert); | ||
| } | ||
| } | ||
| } | ||
| session.setTabSize(len); | ||
| session.setUseSoftTabs(ch == " "); | ||
| }; | ||
|
|
||
| exports.$parseStringArg = function(text) { | ||
| var indent = {}; | ||
| if (/t/.test(text)) | ||
| indent.ch = "\t"; | ||
| else if (/s/.test(text)) | ||
| indent.ch = " "; | ||
| var m = text.match(/\d+/); | ||
| if (m) | ||
| indent.length = parseInt(m[0], 10); | ||
| return indent; | ||
| }; | ||
|
|
||
| exports.$parseArg = function(arg) { | ||
| if (!arg) | ||
| return {}; | ||
| if (typeof arg == "string") | ||
| return exports.$parseStringArg(arg); | ||
| if (typeof arg.text == "string") | ||
| return exports.$parseStringArg(arg.text); | ||
| return arg; | ||
| }; | ||
|
|
||
| exports.commands = [{ | ||
| name: "detectIndentation", | ||
| exec: function(editor) { | ||
| exports.detectIndentation(editor.session); | ||
| } | ||
| }, { | ||
| name: "trimTrailingSpace", | ||
| exec: function(editor) { | ||
| exports.trimTrailingSpace(editor.session); | ||
| } | ||
| }, { | ||
| name: "convertIndentation", | ||
| exec: function(editor, arg) { | ||
| var indent = exports.$parseArg(arg); | ||
| exports.convertIndentation(editor.session, indent.ch, indent.length); | ||
| } | ||
| }, { | ||
| name: "setIndentation", | ||
| exec: function(editor, arg) { | ||
| var indent = exports.$parseArg(arg); | ||
| indent.length && editor.session.setTabSize(indent.length); | ||
| indent.ch && editor.session.setUseSoftTabs(indent.ch == " "); | ||
| } | ||
| }]; | ||
|
|
||
| }); | ||
| (function() { | ||
| ace.require(["ace/ext/whitespace"], function() {}); | ||
| })(); | ||
|
|
| @@ -0,0 +1,214 @@ | ||
| ace.define("ace/mode/abap_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { | ||
| "use strict"; | ||
|
|
||
| var oop = require("../lib/oop"); | ||
| var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; | ||
|
|
||
| var AbapHighlightRules = function() { | ||
|
|
||
| var keywordMapper = this.createKeywordMapper({ | ||
| "variable.language": "this", | ||
| "keyword": | ||
| "ADD ALIAS ALIASES ASCENDING ASSERT ASSIGN ASSIGNING AT BACK" + | ||
| " CALL CASE CATCH CHECK CLASS CLEAR CLOSE CNT COLLECT COMMIT COMMUNICATION COMPUTE CONCATENATE CONDENSE CONSTANTS CONTINUE CONTROLS CONVERT CREATE CURRENCY" + | ||
| " DATA DEFINE DEFINITION DEFERRED DELETE DESCENDING DESCRIBE DETAIL DIVIDE DO" + | ||
| " ELSE ELSEIF ENDAT ENDCASE ENDCLASS ENDDO ENDEXEC ENDFORM ENDFUNCTION ENDIF ENDIFEND ENDINTERFACE ENDLOOP ENDMETHOD ENDMODULE ENDON ENDPROVIDE ENDSELECT ENDTRY ENDWHILE EVENT EVENTS EXEC EXIT EXPORT EXPORTING EXTRACT" + | ||
| " FETCH FIELDS FORM FORMAT FREE FROM FUNCTION" + | ||
| " GENERATE GET" + | ||
| " HIDE" + | ||
| " IF IMPORT IMPORTING INDEX INFOTYPES INITIALIZATION INTERFACE INTERFACES INPUT INSERT IMPLEMENTATION" + | ||
| " LEAVE LIKE LINE LOAD LOCAL LOOP" + | ||
| " MESSAGE METHOD METHODS MODIFY MODULE MOVE MULTIPLY" + | ||
| " ON OVERLAY OPTIONAL OTHERS" + | ||
| " PACK PARAMETERS PERFORM POSITION PROGRAM PROVIDE PUT" + | ||
| " RAISE RANGES READ RECEIVE RECEIVING REDEFINITION REFERENCE REFRESH REJECT REPLACE REPORT RESERVE RESTORE RETURN RETURNING ROLLBACK" + | ||
| " SCAN SCROLL SEARCH SELECT SET SHIFT SKIP SORT SORTED SPLIT STANDARD STATICS STEP STOP SUBMIT SUBTRACT SUM SUMMARY SUPPRESS" + | ||
| " TABLES TIMES TRANSFER TRANSLATE TRY TYPE TYPES" + | ||
| " UNASSIGN ULINE UNPACK UPDATE" + | ||
| " WHEN WHILE WINDOW WRITE" + | ||
| " OCCURS STRUCTURE OBJECT PROPERTY" + | ||
| " CASTING APPEND RAISING VALUE COLOR" + | ||
| " CHANGING EXCEPTION EXCEPTIONS DEFAULT CHECKBOX COMMENT" + | ||
| " ID NUMBER FOR TITLE OUTPUT" + | ||
| " WITH EXIT USING" + | ||
| " INTO WHERE GROUP BY HAVING ORDER BY SINGLE" + | ||
| " APPENDING CORRESPONDING FIELDS OF TABLE" + | ||
| " LEFT RIGHT OUTER INNER JOIN AS CLIENT SPECIFIED BYPASSING BUFFER UP TO ROWS CONNECTING" + | ||
| " EQ NE LT LE GT GE NOT AND OR XOR IN LIKE BETWEEN", | ||
| "constant.language": | ||
| "TRUE FALSE NULL SPACE", | ||
| "support.type": | ||
| "c n i p f d t x string xstring decfloat16 decfloat34", | ||
| "keyword.operator": | ||
| "abs sign ceil floor trunc frac acos asin atan cos sin tan" + | ||
| " abapOperator cosh sinh tanh exp log log10 sqrt" + | ||
| " strlen xstrlen charlen numofchar dbmaxlen lines" | ||
| }, "text", true, " "); | ||
|
|
||
| var compoundKeywords = "WITH\\W+(?:HEADER\\W+LINE|FRAME|KEY)|NO\\W+STANDARD\\W+PAGE\\W+HEADING|"+ | ||
| "EXIT\\W+FROM\\W+STEP\\W+LOOP|BEGIN\\W+OF\\W+(?:BLOCK|LINE)|BEGIN\\W+OF|"+ | ||
| "END\\W+OF\\W+(?:BLOCK|LINE)|END\\W+OF|NO\\W+INTERVALS|"+ | ||
| "RESPECTING\\W+BLANKS|SEPARATED\\W+BY|USING\\W+(?:EDIT\\W+MASK)|"+ | ||
| "WHERE\\W+(?:LINE)|RADIOBUTTON\\W+GROUP|REF\\W+TO|"+ | ||
| "(?:PUBLIC|PRIVATE|PROTECTED)(?:\\W+SECTION)?|DELETING\\W+(?:TRAILING|LEADING)"+ | ||
| "(?:ALL\\W+OCCURRENCES)|(?:FIRST|LAST)\\W+OCCURRENCE|INHERITING\\W+FROM|"+ | ||
| "LINE-COUNT|ADD-CORRESPONDING|AUTHORITY-CHECK|BREAK-POINT|CLASS-DATA|CLASS-METHODS|"+ | ||
| "CLASS-METHOD|DIVIDE-CORRESPONDING|EDITOR-CALL|END-OF-DEFINITION|END-OF-PAGE|END-OF-SELECTION|"+ | ||
| "FIELD-GROUPS|FIELD-SYMBOLS|FUNCTION-POOL|MOVE-CORRESPONDING|MULTIPLY-CORRESPONDING|NEW-LINE|"+ | ||
| "NEW-PAGE|NEW-SECTION|PRINT-CONTROL|RP-PROVIDE-FROM-LAST|SELECT-OPTIONS|SELECTION-SCREEN|"+ | ||
| "START-OF-SELECTION|SUBTRACT-CORRESPONDING|SYNTAX-CHECK|SYNTAX-TRACE|TOP-OF-PAGE|TYPE-POOL|"+ | ||
| "TYPE-POOLS|LINE-SIZE|LINE-COUNT|MESSAGE-ID|DISPLAY-MODE|READ(?:-ONLY)?|"+ | ||
| "IS\\W+(?:NOT\\W+)?(?:ASSIGNED|BOUND|INITIAL|SUPPLIED)"; | ||
|
|
||
| this.$rules = { | ||
| "start" : [ | ||
| {token : "string", regex : "`", next : "string"}, | ||
| {token : "string", regex : "'", next : "qstring"}, | ||
| {token : "doc.comment", regex : /^\*.+/}, | ||
| {token : "comment", regex : /".+$/}, | ||
| {token : "invalid", regex: "\\.{2,}"}, | ||
| {token : "keyword.operator", regex: /\W[\-+\%=<>*]\W|\*\*|[~:,\.&$]|->*?|=>/}, | ||
| {token : "paren.lparen", regex : "[\\[({]"}, | ||
| {token : "paren.rparen", regex : "[\\])}]"}, | ||
| {token : "constant.numeric", regex: "[+-]?\\d+\\b"}, | ||
| {token : "variable.parameter", regex : /sy|pa?\d\d\d\d\|t\d\d\d\.|innnn/}, | ||
| {token : "keyword", regex : compoundKeywords}, | ||
| {token : "variable.parameter", regex : /\w+-\w+(?:-\w+)*/}, | ||
| {token : keywordMapper, regex : "\\b\\w+\\b"}, | ||
| {caseInsensitive: true} | ||
| ], | ||
| "qstring" : [ | ||
| {token : "constant.language.escape", regex : "''"}, | ||
| {token : "string", regex : "'", next : "start"}, | ||
| {defaultToken : "string"} | ||
| ], | ||
| "string" : [ | ||
| {token : "constant.language.escape", regex : "``"}, | ||
| {token : "string", regex : "`", next : "start"}, | ||
| {defaultToken : "string"} | ||
| ] | ||
| }; | ||
| }; | ||
| oop.inherits(AbapHighlightRules, TextHighlightRules); | ||
|
|
||
| exports.AbapHighlightRules = AbapHighlightRules; | ||
| }); | ||
|
|
||
| ace.define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module) { | ||
| "use strict"; | ||
|
|
||
| var oop = require("../../lib/oop"); | ||
| var BaseFoldMode = require("./fold_mode").FoldMode; | ||
| var Range = require("../../range").Range; | ||
|
|
||
| var FoldMode = exports.FoldMode = function() {}; | ||
| oop.inherits(FoldMode, BaseFoldMode); | ||
|
|
||
| (function() { | ||
|
|
||
| this.getFoldWidgetRange = function(session, foldStyle, row) { | ||
| var range = this.indentationBlock(session, row); | ||
| if (range) | ||
| return range; | ||
|
|
||
| var re = /\S/; | ||
| var line = session.getLine(row); | ||
| var startLevel = line.search(re); | ||
| if (startLevel == -1 || line[startLevel] != "#") | ||
| return; | ||
|
|
||
| var startColumn = line.length; | ||
| var maxRow = session.getLength(); | ||
| var startRow = row; | ||
| var endRow = row; | ||
|
|
||
| while (++row < maxRow) { | ||
| line = session.getLine(row); | ||
| var level = line.search(re); | ||
|
|
||
| if (level == -1) | ||
| continue; | ||
|
|
||
| if (line[level] != "#") | ||
| break; | ||
|
|
||
| endRow = row; | ||
| } | ||
|
|
||
| if (endRow > startRow) { | ||
| var endColumn = session.getLine(endRow).length; | ||
| return new Range(startRow, startColumn, endRow, endColumn); | ||
| } | ||
| }; | ||
| this.getFoldWidget = function(session, foldStyle, row) { | ||
| var line = session.getLine(row); | ||
| var indent = line.search(/\S/); | ||
| var next = session.getLine(row + 1); | ||
| var prev = session.getLine(row - 1); | ||
| var prevIndent = prev.search(/\S/); | ||
| var nextIndent = next.search(/\S/); | ||
|
|
||
| if (indent == -1) { | ||
| session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : ""; | ||
| return ""; | ||
| } | ||
| if (prevIndent == -1) { | ||
| if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") { | ||
| session.foldWidgets[row - 1] = ""; | ||
| session.foldWidgets[row + 1] = ""; | ||
| return "start"; | ||
| } | ||
| } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") { | ||
| if (session.getLine(row - 2).search(/\S/) == -1) { | ||
| session.foldWidgets[row - 1] = "start"; | ||
| session.foldWidgets[row + 1] = ""; | ||
| return ""; | ||
| } | ||
| } | ||
|
|
||
| if (prevIndent!= -1 && prevIndent < indent) | ||
| session.foldWidgets[row - 1] = "start"; | ||
| else | ||
| session.foldWidgets[row - 1] = ""; | ||
|
|
||
| if (indent < nextIndent) | ||
| return "start"; | ||
| else | ||
| return ""; | ||
| }; | ||
|
|
||
| }).call(FoldMode.prototype); | ||
|
|
||
| }); | ||
|
|
||
| ace.define("ace/mode/abap",["require","exports","module","ace/mode/abap_highlight_rules","ace/mode/folding/coffee","ace/range","ace/mode/text","ace/lib/oop"], function(require, exports, module) { | ||
| "use strict"; | ||
|
|
||
| var Rules = require("./abap_highlight_rules").AbapHighlightRules; | ||
| var FoldMode = require("./folding/coffee").FoldMode; | ||
| var Range = require("../range").Range; | ||
| var TextMode = require("./text").Mode; | ||
| var oop = require("../lib/oop"); | ||
|
|
||
| function Mode() { | ||
| this.HighlightRules = Rules; | ||
| this.foldingRules = new FoldMode(); | ||
| } | ||
|
|
||
| oop.inherits(Mode, TextMode); | ||
|
|
||
| (function() { | ||
|
|
||
| this.lineCommentStart = '"' | ||
|
|
||
| this.getNextLineIndent = function(state, line, tab) { | ||
| var indent = this.$getIndent(line); | ||
| return indent; | ||
| }; | ||
|
|
||
| this.$id = "ace/mode/abap"; | ||
| }).call(Mode.prototype); | ||
|
|
||
| exports.Mode = Mode; | ||
|
|
||
| }); |
| @@ -0,0 +1,260 @@ | ||
| ace.define("ace/mode/abc_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function (require, exports, module) { | ||
| "use strict"; | ||
|
|
||
| var oop = require("../lib/oop"); | ||
| var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; | ||
|
|
||
| var ABCHighlightRules = function () { | ||
|
|
||
| this.$rules = { | ||
| start: [ | ||
| { | ||
| token: ['zupfnoter.information.comment.line.percentage', 'information.keyword', 'in formation.keyword.embedded'], | ||
| regex: '(%%%%)(hn\\.[a-z]*)(.*)', | ||
| comment: 'Instruction Comment' | ||
| }, | ||
| { | ||
| token: ['information.comment.line.percentage', 'information.keyword.embedded'], | ||
| regex: '(%%)(.*)', | ||
| comment: 'Instruction Comment' | ||
| }, | ||
|
|
||
| { | ||
| token: 'comment.line.percentage', | ||
| regex: '%.*', | ||
| comment: 'Comments' | ||
| }, | ||
|
|
||
| { | ||
| token: 'barline.keyword.operator', | ||
| regex: '[\\[:]*[|:][|\\]:]*(?:\\[?[0-9]+)?|\\[[0-9]+', | ||
| comment: 'Bar lines' | ||
| }, | ||
| { | ||
| token: ['information.keyword.embedded', 'information.argument.string.unquoted'], | ||
| regex: '(\\[[A-Za-z]:)([^\\]]*\\])', | ||
| comment: 'embedded Header lines' | ||
| }, | ||
| { | ||
| token: ['information.keyword', 'information.argument.string.unquoted'], | ||
| regex: '^([A-Za-z]:)([^%\\\\]*)', | ||
| comment: 'Header lines' | ||
| }, | ||
| { | ||
| token: ['text', 'entity.name.function', 'string.unquoted', 'text'], | ||
| regex: '(\\[)([A-Z]:)(.*?)(\\])', | ||
| comment: 'Inline fields' | ||
| }, | ||
| { | ||
| token: ['accent.constant.language', 'pitch.constant.numeric', 'duration.constant.numeric'], | ||
| regex: '([\\^=_]*)([A-Ga-gz][,\']*)([0-9]*/*[><0-9]*)', | ||
| comment: 'Notes' | ||
| }, | ||
| { | ||
| token: 'zupfnoter.jumptarget.string.quoted', | ||
| regex: '[\\"!]\\^\\:.*?[\\"!]', | ||
| comment: 'Zupfnoter jumptarget' | ||
| }, { | ||
| token: 'zupfnoter.goto.string.quoted', | ||
| regex: '[\\"!]\\^\\@.*?[\\"!]', | ||
| comment: 'Zupfnoter goto' | ||
| }, | ||
| { | ||
| token: 'zupfnoter.annotation.string.quoted', | ||
| regex: '[\\"!]\\^\\!.*?[\\"!]', | ||
| comment: 'Zupfnoter annoation' | ||
| }, | ||
| { | ||
| token: 'zupfnoter.annotationref.string.quoted', | ||
| regex: '[\\"!]\\^\\#.*?[\\"!]', | ||
| comment: 'Zupfnoter annotation reference' | ||
| }, | ||
| { | ||
| token: 'chordname.string.quoted', | ||
| regex: '[\\"!]\\^.*?[\\"!]', | ||
| comment: 'abc chord' | ||
| }, | ||
| { | ||
| token: 'string.quoted', | ||
| regex: '[\\"!].*?[\\"!]', | ||
| comment: 'abc annotation' | ||
| } | ||
|
|
||
| ] | ||
| }; | ||
|
|
||
| this.normalizeRules(); | ||
| }; | ||
|
|
||
| ABCHighlightRules.metaData = { | ||
| fileTypes: ['abc'], | ||
| name: 'ABC', | ||
| scopeName: 'text.abcnotation' | ||
| }; | ||
|
|
||
|
|
||
| oop.inherits(ABCHighlightRules, TextHighlightRules); | ||
|
|
||
| exports.ABCHighlightRules = ABCHighlightRules; | ||
| }); | ||
|
|
||
| ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) { | ||
| "use strict"; | ||
|
|
||
| var oop = require("../../lib/oop"); | ||
| var Range = require("../../range").Range; | ||
| var BaseFoldMode = require("./fold_mode").FoldMode; | ||
|
|
||
| var FoldMode = exports.FoldMode = function(commentRegex) { | ||
| if (commentRegex) { | ||
| this.foldingStartMarker = new RegExp( | ||
| this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) | ||
| ); | ||
| this.foldingStopMarker = new RegExp( | ||
| this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) | ||
| ); | ||
| } | ||
| }; | ||
| oop.inherits(FoldMode, BaseFoldMode); | ||
|
|
||
| (function() { | ||
|
|
||
| this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/; | ||
| this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/; | ||
| this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/; | ||
| this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; | ||
| this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; | ||
| this._getFoldWidgetBase = this.getFoldWidget; | ||
| this.getFoldWidget = function(session, foldStyle, row) { | ||
| var line = session.getLine(row); | ||
|
|
||
| if (this.singleLineBlockCommentRe.test(line)) { | ||
| if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) | ||
| return ""; | ||
| } | ||
|
|
||
| var fw = this._getFoldWidgetBase(session, foldStyle, row); | ||
|
|
||
| if (!fw && this.startRegionRe.test(line)) | ||
| return "start"; // lineCommentRegionStart | ||
|
|
||
| return fw; | ||
| }; | ||
|
|
||
| this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { | ||
| var line = session.getLine(row); | ||
|
|
||
| if (this.startRegionRe.test(line)) | ||
| return this.getCommentRegionBlock(session, line, row); | ||
|
|
||
| var match = line.match(this.foldingStartMarker); | ||
| if (match) { | ||
| var i = match.index; | ||
|
|
||
| if (match[1]) | ||
| return this.openingBracketBlock(session, match[1], row, i); | ||
|
|
||
| var range = session.getCommentFoldRange(row, i + match[0].length, 1); | ||
|
|
||
| if (range && !range.isMultiLine()) { | ||
| if (forceMultiline) { | ||
| range = this.getSectionRange(session, row); | ||
| } else if (foldStyle != "all") | ||
| range = null; | ||
| } | ||
|
|
||
| return range; | ||
| } | ||
|
|
||
| if (foldStyle === "markbegin") | ||
| return; | ||
|
|
||
| var match = line.match(this.foldingStopMarker); | ||
| if (match) { | ||
| var i = match.index + match[0].length; | ||
|
|
||
| if (match[1]) | ||
| return this.closingBracketBlock(session, match[1], row, i); | ||
|
|
||
| return session.getCommentFoldRange(row, i, -1); | ||
| } | ||
| }; | ||
|
|
||
| this.getSectionRange = function(session, row) { | ||
| var line = session.getLine(row); | ||
| var startIndent = line.search(/\S/); | ||
| var startRow = row; | ||
| var startColumn = line.length; | ||
| row = row + 1; | ||
| var endRow = row; | ||
| var maxRow = session.getLength(); | ||
| while (++row < maxRow) { | ||
| line = session.getLine(row); | ||
| var indent = line.search(/\S/); | ||
| if (indent === -1) | ||
| continue; | ||
| if (startIndent > indent) | ||
| break; | ||
| var subRange = this.getFoldWidgetRange(session, "all", row); | ||
|
|
||
| if (subRange) { | ||
| if (subRange.start.row <= startRow) { | ||
| break; | ||
| } else if (subRange.isMultiLine()) { | ||
| row = subRange.end.row; | ||
| } else if (startIndent == indent) { | ||
| break; | ||
| } | ||
| } | ||
| endRow = row; | ||
| } | ||
|
|
||
| return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); | ||
| }; | ||
| this.getCommentRegionBlock = function(session, line, row) { | ||
| var startColumn = line.search(/\s*$/); | ||
| var maxRow = session.getLength(); | ||
| var startRow = row; | ||
|
|
||
| var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; | ||
| var depth = 1; | ||
| while (++row < maxRow) { | ||
| line = session.getLine(row); | ||
| var m = re.exec(line); | ||
| if (!m) continue; | ||
| if (m[1]) depth--; | ||
| else depth++; | ||
|
|
||
| if (!depth) break; | ||
| } | ||
|
|
||
| var endRow = row; | ||
| if (endRow > startRow) { | ||
| return new Range(startRow, startColumn, endRow, line.length); | ||
| } | ||
| }; | ||
|
|
||
| }).call(FoldMode.prototype); | ||
|
|
||
| }); | ||
|
|
||
| ace.define("ace/mode/abc",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/abc_highlight_rules","ace/mode/folding/cstyle"], function (require, exports, module) { | ||
| "use strict"; | ||
|
|
||
| var oop = require("../lib/oop"); | ||
| var TextMode = require("./text").Mode; | ||
| var ABCHighlightRules = require("./abc_highlight_rules").ABCHighlightRules; | ||
| var FoldMode = require("./folding/cstyle").FoldMode; | ||
|
|
||
| var Mode = function () { | ||
| this.HighlightRules = ABCHighlightRules; | ||
| this.foldingRules = new FoldMode(); | ||
| }; | ||
| oop.inherits(Mode, TextMode); | ||
|
|
||
| (function () { | ||
| this.$id = "ace/mode/abc" | ||
| }).call(Mode.prototype); | ||
|
|
||
| exports.Mode = Mode; | ||
| }); |
| @@ -0,0 +1,87 @@ | ||
| ace.define("ace/mode/ada_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { | ||
| "use strict"; | ||
|
|
||
| var oop = require("../lib/oop"); | ||
| var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; | ||
|
|
||
| var AdaHighlightRules = function() { | ||
| var keywords = "abort|else|new|return|abs|elsif|not|reverse|abstract|end|null|accept|entry|select|" + | ||
| "access|exception|of|separate|aliased|exit|or|some|all|others|subtype|and|for|out|synchronized|" + | ||
| "array|function|overriding|at|tagged|generic|package|task|begin|goto|pragma|terminate|" + | ||
| "body|private|then|if|procedure|type|case|in|protected|constant|interface|until|" + | ||
| "|is|raise|use|declare|range|delay|limited|record|when|delta|loop|rem|while|digits|renames|with|do|mod|requeue|xor"; | ||
|
|
||
| var builtinConstants = ( | ||
| "true|false|null" | ||
| ); | ||
|
|
||
| var builtinFunctions = ( | ||
| "count|min|max|avg|sum|rank|now|coalesce|main" | ||
| ); | ||
|
|
||
| var keywordMapper = this.createKeywordMapper({ | ||
| "support.function": builtinFunctions, | ||
| "keyword": keywords, | ||
| "constant.language": builtinConstants | ||
| }, "identifier", true); | ||
|
|
||
| this.$rules = { | ||
| "start" : [ { | ||
| token : "comment", | ||
| regex : "--.*$" | ||
| }, { | ||
| token : "string", // " string | ||
| regex : '".*?"' | ||
| }, { | ||
| token : "string", // ' string | ||
| regex : "'.*?'" | ||
| }, { | ||
| token : "constant.numeric", // float | ||
| regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" | ||
| }, { | ||
| token : keywordMapper, | ||
| regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" | ||
| }, { | ||
| token : "keyword.operator", | ||
| regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|=" | ||
| }, { | ||
| token : "paren.lparen", | ||
| regex : "[\\(]" | ||
| }, { | ||
| token : "paren.rparen", | ||
| regex : "[\\)]" | ||
| }, { | ||
| token : "text", | ||
| regex : "\\s+" | ||
| } ] | ||
| }; | ||
| }; | ||
|
|
||
| oop.inherits(AdaHighlightRules, TextHighlightRules); | ||
|
|
||
| exports.AdaHighlightRules = AdaHighlightRules; | ||
| }); | ||
|
|
||
| ace.define("ace/mode/ada",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ada_highlight_rules","ace/range"], function(require, exports, module) { | ||
| "use strict"; | ||
|
|
||
| var oop = require("../lib/oop"); | ||
| var TextMode = require("./text").Mode; | ||
| var AdaHighlightRules = require("./ada_highlight_rules").AdaHighlightRules; | ||
| var Range = require("../range").Range; | ||
|
|
||
| var Mode = function() { | ||
| this.HighlightRules = AdaHighlightRules; | ||
| }; | ||
| oop.inherits(Mode, TextMode); | ||
|
|
||
| (function() { | ||
|
|
||
| this.lineCommentStart = "--"; | ||
|
|
||
| this.$id = "ace/mode/ada"; | ||
| }).call(Mode.prototype); | ||
|
|
||
| exports.Mode = Mode; | ||
|
|
||
| }); |
| @@ -0,0 +1,271 @@ | ||
| ace.define("ace/mode/applescript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { | ||
| "use strict"; | ||
|
|
||
| var oop = require("../lib/oop"); | ||
| var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; | ||
|
|
||
| var AppleScriptHighlightRules = function() { | ||
| var keywords = ( | ||
| "about|above|after|against|and|around|as|at|back|before|beginning|" + | ||
| "behind|below|beneath|beside|between|but|by|considering|" + | ||
| "contain|contains|continue|copy|div|does|eighth|else|end|equal|" + | ||
| "equals|error|every|exit|fifth|first|for|fourth|from|front|" + | ||
| "get|given|global|if|ignoring|in|into|is|it|its|last|local|me|" + | ||
| "middle|mod|my|ninth|not|of|on|onto|or|over|prop|property|put|ref|" + | ||
| "reference|repeat|returning|script|second|set|seventh|since|" + | ||
| "sixth|some|tell|tenth|that|the|then|third|through|thru|" + | ||
| "timeout|times|to|transaction|try|until|where|while|whose|with|without" | ||
| ); | ||
|
|
||
| var builtinConstants = ( | ||
| "AppleScript|false|linefeed|return|pi|quote|result|space|tab|true" | ||
| ); | ||
|
|
||
| var builtinFunctions = ( | ||
| "activate|beep|count|delay|launch|log|offset|read|round|run|say|" + | ||
| "summarize|write" | ||
| ); | ||
|
|
||
| var builtinTypes = ( | ||
| "alias|application|boolean|class|constant|date|file|integer|list|" + | ||
| "number|real|record|string|text|character|characters|contents|day|" + | ||
| "frontmost|id|item|length|month|name|paragraph|paragraphs|rest|" + | ||
| "reverse|running|time|version|weekday|word|words|year" | ||
| ); | ||
|
|
||
| var keywordMapper = this.createKeywordMapper({ | ||
| "support.function": builtinFunctions, | ||
| "constant.language": builtinConstants, | ||
| "support.type": builtinTypes, | ||
| "keyword": keywords | ||
| }, "identifier"); | ||
|
|
||
| this.$rules = { | ||
| "start": [ | ||
| { | ||
| token: "comment", | ||
| regex: "--.*$" | ||
| }, | ||
| { | ||
| token : "comment", // multi line comment | ||
| regex : "\\(\\*", | ||
| next : "comment" | ||
| }, | ||
| { | ||
| token: "string", // " string | ||
| regex: '".*?"' | ||
| }, | ||
| { | ||
| token: "support.type", | ||
| regex: '\\b(POSIX file|POSIX path|(date|time) string|quoted form)\\b' | ||
| }, | ||
| { | ||
| token: "support.function", | ||
| regex: '\\b(clipboard info|the clipboard|info for|list (disks|folder)|' + | ||
| 'mount volume|path to|(close|open for) access|(get|set) eof|' + | ||
| 'current date|do shell script|get volume settings|random number|' + | ||
| 'set volume|system attribute|system info|time to GMT|' + | ||
| '(load|run|store) script|scripting components|' + | ||
| 'ASCII (character|number)|localized string|' + | ||
| 'choose (application|color|file|file name|' + | ||
| 'folder|from list|remote application|URL)|' + | ||
| 'display (alert|dialog))\\b|^\\s*return\\b' | ||
| }, | ||
| { | ||
| token: "constant.language", | ||
| regex: '\\b(text item delimiters|current application|missing value)\\b' | ||
| }, | ||
| { | ||
| token: "keyword", | ||
| regex: '\\b(apart from|aside from|instead of|out of|greater than|' + | ||
| "isn't|(doesn't|does not) (equal|come before|come after|contain)|" + | ||
| '(greater|less) than( or equal)?|(starts?|ends|begins?) with|' + | ||
| 'contained by|comes (before|after)|a (ref|reference))\\b' | ||
| }, | ||
| { | ||
| token: keywordMapper, | ||
| regex: "[a-zA-Z][a-zA-Z0-9_]*\\b" | ||
| } | ||
| ], | ||
| "comment": [ | ||
| { | ||
| token: "comment", // closing comment | ||
| regex: "\\*\\)", | ||
| next: "start" | ||
| }, { | ||
| defaultToken: "comment" | ||
| } | ||
| ] | ||
| } | ||
|
|
||
| this.normalizeRules(); | ||
| }; | ||
|
|
||
| oop.inherits(AppleScriptHighlightRules, TextHighlightRules); | ||
|
|
||
| exports.AppleScriptHighlightRules = AppleScriptHighlightRules; | ||
| }); | ||
|
|
||
| ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) { | ||
| "use strict"; | ||
|
|
||
| var oop = require("../../lib/oop"); | ||
| var Range = require("../../range").Range; | ||
| var BaseFoldMode = require("./fold_mode").FoldMode; | ||
|
|
||
| var FoldMode = exports.FoldMode = function(commentRegex) { | ||
| if (commentRegex) { | ||
| this.foldingStartMarker = new RegExp( | ||
| this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) | ||
| ); | ||
| this.foldingStopMarker = new RegExp( | ||
| this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) | ||
| ); | ||
| } | ||
| }; | ||
| oop.inherits(FoldMode, BaseFoldMode); | ||
|
|
||
| (function() { | ||
|
|
||
| this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/; | ||
| this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/; | ||
| this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/; | ||
| this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; | ||
| this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; | ||
| this._getFoldWidgetBase = this.getFoldWidget; | ||
| this.getFoldWidget = function(session, foldStyle, row) { | ||
| var line = session.getLine(row); | ||
|
|
||
| if (this.singleLineBlockCommentRe.test(line)) { | ||
| if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) | ||
| return ""; | ||
| } | ||
|
|
||
| var fw = this._getFoldWidgetBase(session, foldStyle, row); | ||
|
|
||
| if (!fw && this.startRegionRe.test(line)) | ||
| return "start"; // lineCommentRegionStart | ||
|
|
||
| return fw; | ||
| }; | ||
|
|
||
| this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { | ||
| var line = session.getLine(row); | ||
|
|
||
| if (this.startRegionRe.test(line)) | ||
| return this.getCommentRegionBlock(session, line, row); | ||
|
|
||
| var match = line.match(this.foldingStartMarker); | ||
| if (match) { | ||
| var i = match.index; | ||
|
|
||
| if (match[1]) | ||
| return this.openingBracketBlock(session, match[1], row, i); | ||
|
|
||
| var range = session.getCommentFoldRange(row, i + match[0].length, 1); | ||
|
|
||
| if (range && !range.isMultiLine()) { | ||
| if (forceMultiline) { | ||
| range = this.getSectionRange(session, row); | ||
| } else if (foldStyle != "all") | ||
| range = null; | ||
| } | ||
|
|
||
| return range; | ||
| } | ||
|
|
||
| if (foldStyle === "markbegin") | ||
| return; | ||
|
|
||
| var match = line.match(this.foldingStopMarker); | ||
| if (match) { | ||
| var i = match.index + match[0].length; | ||
|
|
||
| if (match[1]) | ||
| return this.closingBracketBlock(session, match[1], row, i); | ||
|
|
||
| return session.getCommentFoldRange(row, i, -1); | ||
| } | ||
| }; | ||
|
|
||
| this.getSectionRange = function(session, row) { | ||
| var line = session.getLine(row); | ||
| var startIndent = line.search(/\S/); | ||
| var startRow = row; | ||
| var startColumn = line.length; | ||
| row = row + 1; | ||
| var endRow = row; | ||
| var maxRow = session.getLength(); | ||
| while (++row < maxRow) { | ||
| line = session.getLine(row); | ||
| var indent = line.search(/\S/); | ||
| if (indent === -1) | ||
| continue; | ||
| if (startIndent > indent) | ||
| break; | ||
| var subRange = this.getFoldWidgetRange(session, "all", row); | ||
|
|
||
| if (subRange) { | ||
| if (subRange.start.row <= startRow) { | ||
| break; | ||
| } else if (subRange.isMultiLine()) { | ||
| row = subRange.end.row; | ||
| } else if (startIndent == indent) { | ||
| break; | ||
| } | ||
| } | ||
| endRow = row; | ||
| } | ||
|
|
||
| return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); | ||
| }; | ||
| this.getCommentRegionBlock = function(session, line, row) { | ||
| var startColumn = line.search(/\s*$/); | ||
| var maxRow = session.getLength(); | ||
| var startRow = row; | ||
|
|
||
| var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; | ||
| var depth = 1; | ||
| while (++row < maxRow) { | ||
| line = session.getLine(row); | ||
| var m = re.exec(line); | ||
| if (!m) continue; | ||
| if (m[1]) depth--; | ||
| else depth++; | ||
|
|
||
| if (!depth) break; | ||
| } | ||
|
|
||
| var endRow = row; | ||
| if (endRow > startRow) { | ||
| return new Range(startRow, startColumn, endRow, line.length); | ||
| } | ||
| }; | ||
|
|
||
| }).call(FoldMode.prototype); | ||
|
|
||
| }); | ||
|
|
||
| ace.define("ace/mode/applescript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/applescript_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) { | ||
| "use strict"; | ||
|
|
||
| var oop = require("../lib/oop"); | ||
| var TextMode = require("./text").Mode; | ||
| var Tokenizer = require("../tokenizer").Tokenizer; | ||
| var AppleScriptHighlightRules = require("./applescript_highlight_rules").AppleScriptHighlightRules; | ||
| var FoldMode = require("./folding/cstyle").FoldMode; | ||
|
|
||
| var Mode = function() { | ||
| this.HighlightRules = AppleScriptHighlightRules; | ||
| this.foldingRules = new FoldMode(); | ||
| }; | ||
| oop.inherits(Mode, TextMode); | ||
|
|
||
| (function() { | ||
| this.lineCommentStart = "--"; | ||
| this.blockComment = {start: "(*", end: "*)"}; | ||
| this.$id = "ace/mode/applescript"; | ||
| }).call(Mode.prototype); | ||
|
|
||
| exports.Mode = Mode; | ||
| }); |