| 1 |
ace.define("ace/mode/pascal_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict"; |
| 2 |
var oop = require("../lib/oop"); |
| 3 |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
| 4 |
var PascalHighlightRules = function () { |
| 5 |
var keywordMapper = this.createKeywordMapper({ |
| 6 |
"keyword.control": "absolute|abstract|all|and|and_then|array|as|asm|attribute|begin|bindable|case|class" + |
| 7 |
"|const|constructor|destructor|div|do|do|else|end|except|export|exports|external|far|file|finalization" + |
| 8 |
"|finally|for|forward|goto|if|implementation|import|in|inherited|initialization|interface|interrupt|is" + |
| 9 |
"|label|library|mod|module|name|near|nil|not|object|of|only|operator|or|or_else|otherwise|packed|pow|private" + |
| 10 |
"|program|property|protected|public|published|qualified|record|repeat|resident|restricted|segment|set|shl|shr" + |
| 11 |
"|then|to|try|type|unit|until|uses|value|var|view|virtual|while|with|xor" |
| 12 |
}, "identifier", true); |
| 13 |
this.$rules = { |
| 14 |
start: [{ |
| 15 |
caseInsensitive: true, |
| 16 |
token: ['variable', "text", |
| 17 |
'storage.type.prototype', |
| 18 |
'entity.name.function.prototype' |
| 19 |
], |
| 20 |
regex: '\\b(function|procedure)(\\s+)(\\w+)(\\.\\w+)?(?=(?:\\(.*?\\))?;\\s*(?:attribute|forward|external))' |
| 21 |
}, { |
| 22 |
caseInsensitive: true, |
| 23 |
token: ['variable', "text", 'storage.type.function', 'entity.name.function'], |
| 24 |
regex: '\\b(function|procedure)(\\s+)(\\w+)(\\.\\w+)?' |
| 25 |
}, { |
| 26 |
caseInsensitive: true, |
| 27 |
token: keywordMapper, |
| 28 |
regex: /\b[a-z_]+\b/ |
| 29 |
}, { |
| 30 |
token: 'constant.numeric', |
| 31 |
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|ll|LL|ull|ULL)?\\b' |
| 32 |
}, { |
| 33 |
token: 'punctuation.definition.comment', |
| 34 |
regex: '--.*$' |
| 35 |
}, { |
| 36 |
token: 'punctuation.definition.comment', |
| 37 |
regex: '//.*$' |
| 38 |
}, { |
| 39 |
token: 'punctuation.definition.comment', |
| 40 |
regex: '\\(\\*', |
| 41 |
push: [{ |
| 42 |
token: 'punctuation.definition.comment', |
| 43 |
regex: '\\*\\)', |
| 44 |
next: 'pop' |
| 45 |
}, |
| 46 |
{ defaultToken: 'comment.block.one' } |
| 47 |
] |
| 48 |
}, { |
| 49 |
token: 'punctuation.definition.comment', |
| 50 |
regex: '\\{', |
| 51 |
push: [{ |
| 52 |
token: 'punctuation.definition.comment', |
| 53 |
regex: '\\}', |
| 54 |
next: 'pop' |
| 55 |
}, |
| 56 |
{ defaultToken: 'comment.block.two' } |
| 57 |
] |
| 58 |
}, { |
| 59 |
token: 'punctuation.definition.string.begin', |
| 60 |
regex: '"', |
| 61 |
push: [{ token: 'constant.character.escape', regex: '\\\\.' }, |
| 62 |
{ |
| 63 |
token: 'punctuation.definition.string.end', |
| 64 |
regex: '"', |
| 65 |
next: 'pop' |
| 66 |
}, |
| 67 |
{ defaultToken: 'string.quoted.double' } |
| 68 |
] |
| 69 |
}, { |
| 70 |
token: 'punctuation.definition.string.begin', |
| 71 |
regex: '\'', |
| 72 |
push: [{ |
| 73 |
token: 'constant.character.escape.apostrophe', |
| 74 |
regex: '\'\'' |
| 75 |
}, |
| 76 |
{ |
| 77 |
token: 'punctuation.definition.string.end', |
| 78 |
regex: '\'', |
| 79 |
next: 'pop' |
| 80 |
}, |
| 81 |
{ defaultToken: 'string.quoted.single' } |
| 82 |
] |
| 83 |
}, { |
| 84 |
token: 'keyword.operator', |
| 85 |
regex: '[+\\-;,/*%]|:=|=' |
| 86 |
} |
| 87 |
] |
| 88 |
}; |
| 89 |
this.normalizeRules(); |
| 90 |
}; |
| 91 |
oop.inherits(PascalHighlightRules, TextHighlightRules); |
| 92 |
exports.PascalHighlightRules = PascalHighlightRules; |
| 93 |
|
| 94 |
}); |
| 95 |
|
| 96 |
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"; |
| 97 |
var oop = require("../../lib/oop"); |
| 98 |
var BaseFoldMode = require("./fold_mode").FoldMode; |
| 99 |
var Range = require("../../range").Range; |
| 100 |
var FoldMode = exports.FoldMode = function () { }; |
| 101 |
oop.inherits(FoldMode, BaseFoldMode); |
| 102 |
(function () { |
| 103 |
this.commentBlock = function (session, row) { |
| 104 |
var re = /\S/; |
| 105 |
var line = session.getLine(row); |
| 106 |
var startLevel = line.search(re); |
| 107 |
if (startLevel == -1 || line[startLevel] != "#") |
| 108 |
return; |
| 109 |
var startColumn = line.length; |
| 110 |
var maxRow = session.getLength(); |
| 111 |
var startRow = row; |
| 112 |
var endRow = row; |
| 113 |
while (++row < maxRow) { |
| 114 |
line = session.getLine(row); |
| 115 |
var level = line.search(re); |
| 116 |
if (level == -1) |
| 117 |
continue; |
| 118 |
if (line[level] != "#") |
| 119 |
break; |
| 120 |
endRow = row; |
| 121 |
} |
| 122 |
if (endRow > startRow) { |
| 123 |
var endColumn = session.getLine(endRow).length; |
| 124 |
return new Range(startRow, startColumn, endRow, endColumn); |
| 125 |
} |
| 126 |
}; |
| 127 |
this.getFoldWidgetRange = function (session, foldStyle, row) { |
| 128 |
var range = this.indentationBlock(session, row); |
| 129 |
if (range) |
| 130 |
return range; |
| 131 |
range = this.commentBlock(session, row); |
| 132 |
if (range) |
| 133 |
return range; |
| 134 |
}; |
| 135 |
this.getFoldWidget = function (session, foldStyle, row) { |
| 136 |
var line = session.getLine(row); |
| 137 |
var indent = line.search(/\S/); |
| 138 |
var next = session.getLine(row + 1); |
| 139 |
var prev = session.getLine(row - 1); |
| 140 |
var prevIndent = prev.search(/\S/); |
| 141 |
var nextIndent = next.search(/\S/); |
| 142 |
if (indent == -1) { |
| 143 |
session.foldWidgets[row - 1] = prevIndent != -1 && prevIndent < nextIndent ? "start" : ""; |
| 144 |
return ""; |
| 145 |
} |
| 146 |
if (prevIndent == -1) { |
| 147 |
if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") { |
| 148 |
session.foldWidgets[row - 1] = ""; |
| 149 |
session.foldWidgets[row + 1] = ""; |
| 150 |
return "start"; |
| 151 |
} |
| 152 |
} |
| 153 |
else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") { |
| 154 |
if (session.getLine(row - 2).search(/\S/) == -1) { |
| 155 |
session.foldWidgets[row - 1] = "start"; |
| 156 |
session.foldWidgets[row + 1] = ""; |
| 157 |
return ""; |
| 158 |
} |
| 159 |
} |
| 160 |
if (prevIndent != -1 && prevIndent < indent) |
| 161 |
session.foldWidgets[row - 1] = "start"; |
| 162 |
else |
| 163 |
session.foldWidgets[row - 1] = ""; |
| 164 |
if (indent < nextIndent) |
| 165 |
return "start"; |
| 166 |
else |
| 167 |
return ""; |
| 168 |
}; |
| 169 |
}).call(FoldMode.prototype); |
| 170 |
|
| 171 |
}); |
| 172 |
|
| 173 |
ace.define("ace/mode/pascal",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/pascal_highlight_rules","ace/mode/folding/coffee"], function(require, exports, module){ |
| 174 |
|
| 175 |
|
| 176 |
"use strict"; |
| 177 |
var oop = require("../lib/oop"); |
| 178 |
var TextMode = require("./text").Mode; |
| 179 |
var PascalHighlightRules = require("./pascal_highlight_rules").PascalHighlightRules; |
| 180 |
var FoldMode = require("./folding/coffee").FoldMode; |
| 181 |
var Mode = function () { |
| 182 |
this.HighlightRules = PascalHighlightRules; |
| 183 |
this.foldingRules = new FoldMode(); |
| 184 |
this.$behaviour = this.$defaultBehaviour; |
| 185 |
}; |
| 186 |
oop.inherits(Mode, TextMode); |
| 187 |
(function () { |
| 188 |
this.lineCommentStart = ["--", "//"]; |
| 189 |
this.blockComment = [ |
| 190 |
{ start: "(*", end: "*)" }, |
| 191 |
{ start: "{", end: "}" } |
| 192 |
]; |
| 193 |
this.$id = "ace/mode/pascal"; |
| 194 |
}).call(Mode.prototype); |
| 195 |
exports.Mode = Mode; |
| 196 |
|
| 197 |
}); (function() { |
| 198 |
ace.require(["ace/mode/pascal"], function(m) { |
| 199 |
if (typeof module == "object" && typeof exports == "object" && module) { |
| 200 |
module.exports = m; |
| 201 |
} |
| 202 |
}); |
| 203 |
})(); |
| 204 |
|