| 1 |
ace.define("ace/mode/io_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){ |
| 2 |
"use strict"; |
| 3 |
var oop = require("../lib/oop"); |
| 4 |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
| 5 |
var IoHighlightRules = function () { |
| 6 |
this.$rules = { start: [{ token: 'keyword.control.io', |
| 7 |
regex: '\\b(?:if|ifTrue|ifFalse|ifTrueIfFalse|for|loop|reverseForeach|foreach|map|continue|break|while|do|return)\\b' }, |
| 8 |
{ token: 'punctuation.definition.comment.io', |
| 9 |
regex: '/\\*', |
| 10 |
push: [{ token: 'punctuation.definition.comment.io', |
| 11 |
regex: '\\*/', |
| 12 |
next: 'pop' }, |
| 13 |
{ defaultToken: 'comment.block.io' }] }, |
| 14 |
{ token: 'punctuation.definition.comment.io', |
| 15 |
regex: '//', |
| 16 |
push: [{ token: 'comment.line.double-slash.io', |
| 17 |
regex: '$', |
| 18 |
next: 'pop' }, |
| 19 |
{ defaultToken: 'comment.line.double-slash.io' }] }, |
| 20 |
{ token: 'punctuation.definition.comment.io', |
| 21 |
regex: '#', |
| 22 |
push: [{ token: 'comment.line.number-sign.io', regex: '$', next: 'pop' }, |
| 23 |
{ defaultToken: 'comment.line.number-sign.io' }] }, |
| 24 |
{ token: 'variable.language.io', |
| 25 |
regex: '\\b(?:self|sender|target|proto|protos|parent)\\b', |
| 26 |
comment: 'I wonder if some of this isn\'t variable.other.language? --Allan; scoping this as variable.language to match Objective-C\'s handling of \'self\', which is inconsistent with C++\'s handling of \'this\' but perhaps intentionally so -- Rob' }, |
| 27 |
{ token: 'keyword.operator.io', |
| 28 |
regex: '<=|>=|=|:=|\\*|\\||\\|\\||\\+|-|/|&|&&|>|<|\\?|@|@@|\\b(?:and|or)\\b' }, |
| 29 |
{ token: 'constant.other.io', regex: '\\bGL[\\w_]+\\b' }, |
| 30 |
{ token: 'support.class.io', regex: '\\b[A-Z](?:\\w+)?\\b' }, |
| 31 |
{ token: 'support.function.io', |
| 32 |
regex: '\\b(?:clone|call|init|method|list|vector|block|\\w+(?=\\s*\\())\\b' }, |
| 33 |
{ token: 'support.function.open-gl.io', |
| 34 |
regex: '\\bgl(?:u|ut)?[A-Z]\\w+\\b' }, |
| 35 |
{ token: 'punctuation.definition.string.begin.io', |
| 36 |
regex: '"""', |
| 37 |
push: [{ token: 'punctuation.definition.string.end.io', |
| 38 |
regex: '"""', |
| 39 |
next: 'pop' }, |
| 40 |
{ token: 'constant.character.escape.io', regex: '\\\\.' }, |
| 41 |
{ defaultToken: 'string.quoted.triple.io' }] }, |
| 42 |
{ token: 'punctuation.definition.string.begin.io', |
| 43 |
regex: '"', |
| 44 |
push: [{ token: 'punctuation.definition.string.end.io', |
| 45 |
regex: '"', |
| 46 |
next: 'pop' }, |
| 47 |
{ token: 'constant.character.escape.io', regex: '\\\\.' }, |
| 48 |
{ defaultToken: 'string.quoted.double.io' }] }, |
| 49 |
{ token: 'constant.numeric.io', |
| 50 |
regex: '\\b(?:0(?:x|X)[0-9a-fA-F]*|(?:[0-9]+\\.?[0-9]*|\\.[0-9]+)(?:(?:e|E)(?:\\+|-)?[0-9]+)?)(?:L|l|UL|ul|u|U|F|f)?\\b' }, |
| 51 |
{ token: 'variable.other.global.io', regex: 'Lobby\\b' }, |
| 52 |
{ token: 'constant.language.io', |
| 53 |
regex: '\\b(?:TRUE|true|FALSE|false|NULL|null|Null|Nil|nil|YES|NO)\\b' }] }; |
| 54 |
this.normalizeRules(); |
| 55 |
}; |
| 56 |
IoHighlightRules.metaData = { fileTypes: ['io'], |
| 57 |
keyEquivalent: '^~I', |
| 58 |
name: 'Io', |
| 59 |
scopeName: 'source.io' }; |
| 60 |
oop.inherits(IoHighlightRules, TextHighlightRules); |
| 61 |
exports.IoHighlightRules = IoHighlightRules; |
| 62 |
|
| 63 |
}); |
| 64 |
|
| 65 |
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"; |
| 66 |
var oop = require("../../lib/oop"); |
| 67 |
var Range = require("../../range").Range; |
| 68 |
var BaseFoldMode = require("./fold_mode").FoldMode; |
| 69 |
var FoldMode = exports.FoldMode = function (commentRegex) { |
| 70 |
if (commentRegex) { |
| 71 |
this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)); |
| 72 |
this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)); |
| 73 |
} |
| 74 |
}; |
| 75 |
oop.inherits(FoldMode, BaseFoldMode); |
| 76 |
(function () { |
| 77 |
this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/; |
| 78 |
this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/; |
| 79 |
this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/; |
| 80 |
this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; |
| 81 |
this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; |
| 82 |
this._getFoldWidgetBase = this.getFoldWidget; |
| 83 |
this.getFoldWidget = function (session, foldStyle, row) { |
| 84 |
var line = session.getLine(row); |
| 85 |
if (this.singleLineBlockCommentRe.test(line)) { |
| 86 |
if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) |
| 87 |
return ""; |
| 88 |
} |
| 89 |
var fw = this._getFoldWidgetBase(session, foldStyle, row); |
| 90 |
if (!fw && this.startRegionRe.test(line)) |
| 91 |
return "start"; |
| 92 |
return fw; |
| 93 |
}; |
| 94 |
this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) { |
| 95 |
var line = session.getLine(row); |
| 96 |
if (this.startRegionRe.test(line)) |
| 97 |
return this.getCommentRegionBlock(session, line, row); |
| 98 |
var match = line.match(this.foldingStartMarker); |
| 99 |
if (match) { |
| 100 |
var i = match.index; |
| 101 |
if (match[1]) |
| 102 |
return this.openingBracketBlock(session, match[1], row, i); |
| 103 |
var range = session.getCommentFoldRange(row, i + match[0].length, 1); |
| 104 |
if (range && !range.isMultiLine()) { |
| 105 |
if (forceMultiline) { |
| 106 |
range = this.getSectionRange(session, row); |
| 107 |
} |
| 108 |
else if (foldStyle != "all") |
| 109 |
range = null; |
| 110 |
} |
| 111 |
return range; |
| 112 |
} |
| 113 |
if (foldStyle === "markbegin") |
| 114 |
return; |
| 115 |
var match = line.match(this.foldingStopMarker); |
| 116 |
if (match) { |
| 117 |
var i = match.index + match[0].length; |
| 118 |
if (match[1]) |
| 119 |
return this.closingBracketBlock(session, match[1], row, i); |
| 120 |
return session.getCommentFoldRange(row, i, -1); |
| 121 |
} |
| 122 |
}; |
| 123 |
this.getSectionRange = function (session, row) { |
| 124 |
var line = session.getLine(row); |
| 125 |
var startIndent = line.search(/\S/); |
| 126 |
var startRow = row; |
| 127 |
var startColumn = line.length; |
| 128 |
row = row + 1; |
| 129 |
var endRow = row; |
| 130 |
var maxRow = session.getLength(); |
| 131 |
while (++row < maxRow) { |
| 132 |
line = session.getLine(row); |
| 133 |
var indent = line.search(/\S/); |
| 134 |
if (indent === -1) |
| 135 |
continue; |
| 136 |
if (startIndent > indent) |
| 137 |
break; |
| 138 |
var subRange = this.getFoldWidgetRange(session, "all", row); |
| 139 |
if (subRange) { |
| 140 |
if (subRange.start.row <= startRow) { |
| 141 |
break; |
| 142 |
} |
| 143 |
else if (subRange.isMultiLine()) { |
| 144 |
row = subRange.end.row; |
| 145 |
} |
| 146 |
else if (startIndent == indent) { |
| 147 |
break; |
| 148 |
} |
| 149 |
} |
| 150 |
endRow = row; |
| 151 |
} |
| 152 |
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); |
| 153 |
}; |
| 154 |
this.getCommentRegionBlock = function (session, line, row) { |
| 155 |
var startColumn = line.search(/\s*$/); |
| 156 |
var maxRow = session.getLength(); |
| 157 |
var startRow = row; |
| 158 |
var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; |
| 159 |
var depth = 1; |
| 160 |
while (++row < maxRow) { |
| 161 |
line = session.getLine(row); |
| 162 |
var m = re.exec(line); |
| 163 |
if (!m) |
| 164 |
continue; |
| 165 |
if (m[1]) |
| 166 |
depth--; |
| 167 |
else |
| 168 |
depth++; |
| 169 |
if (!depth) |
| 170 |
break; |
| 171 |
} |
| 172 |
var endRow = row; |
| 173 |
if (endRow > startRow) { |
| 174 |
return new Range(startRow, startColumn, endRow, line.length); |
| 175 |
} |
| 176 |
}; |
| 177 |
}).call(FoldMode.prototype); |
| 178 |
|
| 179 |
}); |
| 180 |
|
| 181 |
ace.define("ace/mode/io",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/io_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module){ |
| 182 |
|
| 183 |
|
| 184 |
"use strict"; |
| 185 |
var oop = require("../lib/oop"); |
| 186 |
var TextMode = require("./text").Mode; |
| 187 |
var IoHighlightRules = require("./io_highlight_rules").IoHighlightRules; |
| 188 |
var FoldMode = require("./folding/cstyle").FoldMode; |
| 189 |
var Mode = function () { |
| 190 |
this.HighlightRules = IoHighlightRules; |
| 191 |
this.foldingRules = new FoldMode(); |
| 192 |
this.$behaviour = this.$defaultBehaviour; |
| 193 |
}; |
| 194 |
oop.inherits(Mode, TextMode); |
| 195 |
(function () { |
| 196 |
this.lineCommentStart = "//"; |
| 197 |
this.blockComment = { start: "/*", end: "*/" }; |
| 198 |
this.$id = "ace/mode/io"; |
| 199 |
this.snippetFileId = "ace/snippets/io"; |
| 200 |
}).call(Mode.prototype); |
| 201 |
exports.Mode = Mode; |
| 202 |
|
| 203 |
}); (function() { |
| 204 |
ace.require(["ace/mode/io"], function(m) { |
| 205 |
if (typeof module == "object" && typeof exports == "object" && module) { |
| 206 |
module.exports = m; |
| 207 |
} |
| 208 |
}); |
| 209 |
})(); |
| 210 |
|