Projekt

Obecné

Profil

Stáhnout (4.89 KB) Statistiky
| Větev: | Tag: | Revize:
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

    
4
var oop = require("../lib/oop");
5
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
6

    
7
var escapeRe = "\\\\(?:[\\\\0abtrn;#=:]|x[a-fA-F\\d]{4})";
8

    
9
var IniHighlightRules = function() {
10
    this.$rules = {
11
        start: [{
12
            token: 'punctuation.definition.comment.ini',
13
            regex: '#.*',
14
            push_: [{
15
                token: 'comment.line.number-sign.ini',
16
                regex: '$|^',
17
                next: 'pop'
18
            }, {
19
                defaultToken: 'comment.line.number-sign.ini'
20
            }]
21
        }, {
22
            token: 'punctuation.definition.comment.ini',
23
            regex: ';.*',
24
            push_: [{
25
                token: 'comment.line.semicolon.ini',
26
                regex: '$|^',
27
                next: 'pop'
28
            }, {
29
                defaultToken: 'comment.line.semicolon.ini'
30
            }]
31
        }, {
32
            token: ['keyword.other.definition.ini', 'text', 'punctuation.separator.key-value.ini'],
33
            regex: '\\b([a-zA-Z0-9_.-]+)\\b(\\s*)(=)'
34
        }, {
35
            token: ['punctuation.definition.entity.ini', 'constant.section.group-title.ini', 'punctuation.definition.entity.ini'],
36
            regex: '^(\\[)(.*?)(\\])'
37
        }, {
38
            token: 'punctuation.definition.string.begin.ini',
39
            regex: "'",
40
            push: [{
41
                token: 'punctuation.definition.string.end.ini',
42
                regex: "'",
43
                next: 'pop'
44
            }, {
45
                token: "constant.language.escape",
46
                regex: escapeRe
47
            }, {
48
                defaultToken: 'string.quoted.single.ini'
49
            }]
50
        }, {
51
            token: 'punctuation.definition.string.begin.ini',
52
            regex: '"',
53
            push: [{
54
                token: "constant.language.escape",
55
                regex: escapeRe
56
            }, {
57
                token: 'punctuation.definition.string.end.ini',
58
                regex: '"',
59
                next: 'pop'
60
            }, {
61
                defaultToken: 'string.quoted.double.ini'
62
            }]
63
        }]
64
    };
65

    
66
    this.normalizeRules();
67
};
68

    
69
IniHighlightRules.metaData = {
70
    fileTypes: ['ini', 'conf'],
71
    keyEquivalent: '^~I',
72
    name: 'Ini',
73
    scopeName: 'source.ini'
74
};
75

    
76

    
77
oop.inherits(IniHighlightRules, TextHighlightRules);
78

    
79
exports.IniHighlightRules = IniHighlightRules;
80
});
81

    
82
ace.define("ace/mode/folding/ini",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
83
"use strict";
84

    
85
var oop = require("../../lib/oop");
86
var Range = require("../../range").Range;
87
var BaseFoldMode = require("./fold_mode").FoldMode;
88

    
89
var FoldMode = exports.FoldMode = function() {
90
};
91
oop.inherits(FoldMode, BaseFoldMode);
92

    
93
(function() {
94

    
95
    this.foldingStartMarker = /^\s*\[([^\])]*)]\s*(?:$|[;#])/;
96

    
97
    this.getFoldWidgetRange = function(session, foldStyle, row) {
98
        var re = this.foldingStartMarker;
99
        var line = session.getLine(row);
100
        
101
        var m = line.match(re);
102
        
103
        if (!m) return;
104
        
105
        var startName = m[1] + ".";
106
        
107
        var startColumn = line.length;
108
        var maxRow = session.getLength();
109
        var startRow = row;
110
        var endRow = row;
111

    
112
        while (++row < maxRow) {
113
            line = session.getLine(row);
114
            if (/^\s*$/.test(line))
115
                continue;
116
            m = line.match(re);
117
            if (m && m[1].lastIndexOf(startName, 0) !== 0)
118
                break;
119

    
120
            endRow = row;
121
        }
122

    
123
        if (endRow > startRow) {
124
            var endColumn = session.getLine(endRow).length;
125
            return new Range(startRow, startColumn, endRow, endColumn);
126
        }
127
    };
128

    
129
}).call(FoldMode.prototype);
130

    
131
});
132

    
133
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) {
134
"use strict";
135

    
136
var oop = require("../lib/oop");
137
var TextMode = require("./text").Mode;
138
var IniHighlightRules = require("./ini_highlight_rules").IniHighlightRules;
139
var FoldMode = require("./folding/ini").FoldMode;
140

    
141
var Mode = function() {
142
    this.HighlightRules = IniHighlightRules;
143
    this.foldingRules = new FoldMode();
144
    this.$behaviour = this.$defaultBehaviour;
145
};
146
oop.inherits(Mode, TextMode);
147

    
148
(function() {
149
    this.lineCommentStart = ";";
150
    this.blockComment = null;
151
    this.$id = "ace/mode/ini";
152
}).call(Mode.prototype);
153

    
154
exports.Mode = Mode;
155
});                (function() {
156
                    ace.require(["ace/mode/ini"], function(m) {
157
                        if (typeof module == "object" && typeof exports == "object" && module) {
158
                            module.exports = m;
159
                        }
160
                    });
161
                })();
162
            
(91-91/244)