| 1 |
ace.define("ace/mode/ini_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 escapeRe = "\\\\(?:[\\\\0abtrn;#=:]|x[a-fA-F\\d]{4})"; |
| 6 |
var IniHighlightRules = function () { |
| 7 |
this.$rules = { |
| 8 |
start: [{ |
| 9 |
token: 'punctuation.definition.comment.ini', |
| 10 |
regex: '#.*', |
| 11 |
push_: [{ |
| 12 |
token: 'comment.line.number-sign.ini', |
| 13 |
regex: '$|^', |
| 14 |
next: 'pop' |
| 15 |
}, { |
| 16 |
defaultToken: 'comment.line.number-sign.ini' |
| 17 |
}] |
| 18 |
}, { |
| 19 |
token: 'punctuation.definition.comment.ini', |
| 20 |
regex: ';.*', |
| 21 |
push_: [{ |
| 22 |
token: 'comment.line.semicolon.ini', |
| 23 |
regex: '$|^', |
| 24 |
next: 'pop' |
| 25 |
}, { |
| 26 |
defaultToken: 'comment.line.semicolon.ini' |
| 27 |
}] |
| 28 |
}, { |
| 29 |
token: ['keyword.other.definition.ini', 'text', 'punctuation.separator.key-value.ini'], |
| 30 |
regex: '\\b([a-zA-Z0-9_.-]+)\\b(\\s*)(=)' |
| 31 |
}, { |
| 32 |
token: ['punctuation.definition.entity.ini', 'constant.section.group-title.ini', 'punctuation.definition.entity.ini'], |
| 33 |
regex: '^(\\[)(.*?)(\\])' |
| 34 |
}, { |
| 35 |
token: 'punctuation.definition.string.begin.ini', |
| 36 |
regex: "'", |
| 37 |
push: [{ |
| 38 |
token: 'punctuation.definition.string.end.ini', |
| 39 |
regex: "'", |
| 40 |
next: 'pop' |
| 41 |
}, { |
| 42 |
token: "constant.language.escape", |
| 43 |
regex: escapeRe |
| 44 |
}, { |
| 45 |
defaultToken: 'string.quoted.single.ini' |
| 46 |
}] |
| 47 |
}, { |
| 48 |
token: 'punctuation.definition.string.begin.ini', |
| 49 |
regex: '"', |
| 50 |
push: [{ |
| 51 |
token: "constant.language.escape", |
| 52 |
regex: escapeRe |
| 53 |
}, { |
| 54 |
token: 'punctuation.definition.string.end.ini', |
| 55 |
regex: '"', |
| 56 |
next: 'pop' |
| 57 |
}, { |
| 58 |
defaultToken: 'string.quoted.double.ini' |
| 59 |
}] |
| 60 |
}] |
| 61 |
}; |
| 62 |
this.normalizeRules(); |
| 63 |
}; |
| 64 |
IniHighlightRules.metaData = { |
| 65 |
fileTypes: ['ini', 'conf'], |
| 66 |
keyEquivalent: '^~I', |
| 67 |
name: 'Ini', |
| 68 |
scopeName: 'source.ini' |
| 69 |
}; |
| 70 |
oop.inherits(IniHighlightRules, TextHighlightRules); |
| 71 |
exports.IniHighlightRules = IniHighlightRules; |
| 72 |
|
| 73 |
}); |
| 74 |
|
| 75 |
ace.define("ace/mode/folding/ini",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module){"use strict"; |
| 76 |
var oop = require("../../lib/oop"); |
| 77 |
var Range = require("../../range").Range; |
| 78 |
var BaseFoldMode = require("./fold_mode").FoldMode; |
| 79 |
var FoldMode = exports.FoldMode = function () { |
| 80 |
}; |
| 81 |
oop.inherits(FoldMode, BaseFoldMode); |
| 82 |
(function () { |
| 83 |
this.foldingStartMarker = /^\s*\[([^\])]*)]\s*(?:$|[;#])/; |
| 84 |
this.getFoldWidgetRange = function (session, foldStyle, row) { |
| 85 |
var re = this.foldingStartMarker; |
| 86 |
var line = session.getLine(row); |
| 87 |
var m = line.match(re); |
| 88 |
if (!m) |
| 89 |
return; |
| 90 |
var startName = m[1] + "."; |
| 91 |
var startColumn = line.length; |
| 92 |
var maxRow = session.getLength(); |
| 93 |
var startRow = row; |
| 94 |
var endRow = row; |
| 95 |
while (++row < maxRow) { |
| 96 |
line = session.getLine(row); |
| 97 |
if (/^\s*$/.test(line)) |
| 98 |
continue; |
| 99 |
m = line.match(re); |
| 100 |
if (m && m[1].lastIndexOf(startName, 0) !== 0) |
| 101 |
break; |
| 102 |
endRow = row; |
| 103 |
} |
| 104 |
if (endRow > startRow) { |
| 105 |
var endColumn = session.getLine(endRow).length; |
| 106 |
return new Range(startRow, startColumn, endRow, endColumn); |
| 107 |
} |
| 108 |
}; |
| 109 |
}).call(FoldMode.prototype); |
| 110 |
|
| 111 |
}); |
| 112 |
|
| 113 |
ace.define("ace/mode/ini",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ini_highlight_rules","ace/mode/folding/ini"], function(require, exports, module){"use strict"; |
| 114 |
var oop = require("../lib/oop"); |
| 115 |
var TextMode = require("./text").Mode; |
| 116 |
var IniHighlightRules = require("./ini_highlight_rules").IniHighlightRules; |
| 117 |
var FoldMode = require("./folding/ini").FoldMode; |
| 118 |
var Mode = function () { |
| 119 |
this.HighlightRules = IniHighlightRules; |
| 120 |
this.foldingRules = new FoldMode(); |
| 121 |
this.$behaviour = this.$defaultBehaviour; |
| 122 |
}; |
| 123 |
oop.inherits(Mode, TextMode); |
| 124 |
(function () { |
| 125 |
this.lineCommentStart = ";"; |
| 126 |
this.blockComment = null; |
| 127 |
this.$id = "ace/mode/ini"; |
| 128 |
}).call(Mode.prototype); |
| 129 |
exports.Mode = Mode; |
| 130 |
|
| 131 |
}); (function() { |
| 132 |
ace.require(["ace/mode/ini"], function(m) { |
| 133 |
if (typeof module == "object" && typeof exports == "object" && module) { |
| 134 |
module.exports = m; |
| 135 |
} |
| 136 |
}); |
| 137 |
})(); |
| 138 |
|