Projekt

Obecné

Profil

Stáhnout (7.93 KB) Statistiky
| Větev: | Tag: | Revize:
1
ace.define("ace/mode/pascal_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 PascalHighlightRules = function() {
8
    var keywordMapper = this.createKeywordMapper({
9
        "keyword.control": "absolute|abstract|all|and|and_then|array|as|asm|attribute|begin|bindable|case|class" +
10
            "|const|constructor|destructor|div|do|do|else|end|except|export|exports|external|far|file|finalization" +
11
            "|finally|for|forward|goto|if|implementation|import|in|inherited|initialization|interface|interrupt|is" +
12
            "|label|library|mod|module|name|near|nil|not|object|of|only|operator|or|or_else|otherwise|packed|pow|private" +
13
            "|program|property|protected|public|published|qualified|record|repeat|resident|restricted|segment|set|shl|shr" +
14
            "|then|to|try|type|unit|until|uses|value|var|view|virtual|while|with|xor"
15
    }, "identifier", true);
16

    
17
    this.$rules = {
18
        start: [{
19
                caseInsensitive: true,
20
                token: ['variable', "text",
21
                    'storage.type.prototype',
22
                    'entity.name.function.prototype'
23
                ],
24
                regex: '\\b(function|procedure)(\\s+)(\\w+)(\\.\\w+)?(?=(?:\\(.*?\\))?;\\s*(?:attribute|forward|external))'
25
            }, {
26
                caseInsensitive: true,
27
                token: ['variable', "text", 'storage.type.function', 'entity.name.function'],
28
                regex: '\\b(function|procedure)(\\s+)(\\w+)(\\.\\w+)?'
29
            }, {
30
                caseInsensitive: true,
31
                token: keywordMapper,
32
                regex: /\b[a-z_]+\b/
33
            }, {
34
                token: 'constant.numeric',
35
                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'
36
            }, {
37
                token: 'punctuation.definition.comment',
38
                regex: '--.*$'
39
            }, {
40
                token: 'punctuation.definition.comment',
41
                regex: '//.*$'
42
            }, {
43
                token: 'punctuation.definition.comment',
44
                regex: '\\(\\*',
45
                push: [{
46
                        token: 'punctuation.definition.comment',
47
                        regex: '\\*\\)',
48
                        next: 'pop'
49
                    },
50
                    { defaultToken: 'comment.block.one' }
51
                ]
52
            }, {
53
                token: 'punctuation.definition.comment',
54
                regex: '\\{',
55
                push: [{
56
                        token: 'punctuation.definition.comment',
57
                        regex: '\\}',
58
                        next: 'pop'
59
                    },
60
                    { defaultToken: 'comment.block.two' }
61
                ]
62
            }, {
63
                token: 'punctuation.definition.string.begin',
64
                regex: '"',
65
                push: [{ token: 'constant.character.escape', regex: '\\\\.' },
66
                    {
67
                        token: 'punctuation.definition.string.end',
68
                        regex: '"',
69
                        next: 'pop'
70
                    },
71
                    { defaultToken: 'string.quoted.double' }
72
                ]
73
            }, {
74
                token: 'punctuation.definition.string.begin',
75
                regex: '\'',
76
                push: [{
77
                        token: 'constant.character.escape.apostrophe',
78
                        regex: '\'\''
79
                    },
80
                    {
81
                        token: 'punctuation.definition.string.end',
82
                        regex: '\'',
83
                        next: 'pop'
84
                    },
85
                    { defaultToken: 'string.quoted.single' }
86
                ]
87
            }, {
88
                token: 'keyword.operator',
89
                regex: '[+\\-;,/*%]|:=|='
90
            }
91
        ]
92
    };
93

    
94
    this.normalizeRules();
95
};
96

    
97
oop.inherits(PascalHighlightRules, TextHighlightRules);
98

    
99
exports.PascalHighlightRules = PascalHighlightRules;
100
});
101

    
102
ace.define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module) {
103
"use strict";
104

    
105
var oop = require("../../lib/oop");
106
var BaseFoldMode = require("./fold_mode").FoldMode;
107
var Range = require("../../range").Range;
108

    
109
var FoldMode = exports.FoldMode = function() {};
110
oop.inherits(FoldMode, BaseFoldMode);
111

    
112
(function() {
113

    
114
    this.getFoldWidgetRange = function(session, foldStyle, row) {
115
        var range = this.indentationBlock(session, row);
116
        if (range)
117
            return range;
118

    
119
        var re = /\S/;
120
        var line = session.getLine(row);
121
        var startLevel = line.search(re);
122
        if (startLevel == -1 || line[startLevel] != "#")
123
            return;
124

    
125
        var startColumn = line.length;
126
        var maxRow = session.getLength();
127
        var startRow = row;
128
        var endRow = row;
129

    
130
        while (++row < maxRow) {
131
            line = session.getLine(row);
132
            var level = line.search(re);
133

    
134
            if (level == -1)
135
                continue;
136

    
137
            if (line[level] != "#")
138
                break;
139

    
140
            endRow = row;
141
        }
142

    
143
        if (endRow > startRow) {
144
            var endColumn = session.getLine(endRow).length;
145
            return new Range(startRow, startColumn, endRow, endColumn);
146
        }
147
    };
148
    this.getFoldWidget = function(session, foldStyle, row) {
149
        var line = session.getLine(row);
150
        var indent = line.search(/\S/);
151
        var next = session.getLine(row + 1);
152
        var prev = session.getLine(row - 1);
153
        var prevIndent = prev.search(/\S/);
154
        var nextIndent = next.search(/\S/);
155

    
156
        if (indent == -1) {
157
            session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
158
            return "";
159
        }
160
        if (prevIndent == -1) {
161
            if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
162
                session.foldWidgets[row - 1] = "";
163
                session.foldWidgets[row + 1] = "";
164
                return "start";
165
            }
166
        } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
167
            if (session.getLine(row - 2).search(/\S/) == -1) {
168
                session.foldWidgets[row - 1] = "start";
169
                session.foldWidgets[row + 1] = "";
170
                return "";
171
            }
172
        }
173

    
174
        if (prevIndent!= -1 && prevIndent < indent)
175
            session.foldWidgets[row - 1] = "start";
176
        else
177
            session.foldWidgets[row - 1] = "";
178

    
179
        if (indent < nextIndent)
180
            return "start";
181
        else
182
            return "";
183
    };
184

    
185
}).call(FoldMode.prototype);
186

    
187
});
188

    
189
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) {
190
"use strict";
191

    
192
var oop = require("../lib/oop");
193
var TextMode = require("./text").Mode;
194
var PascalHighlightRules = require("./pascal_highlight_rules").PascalHighlightRules;
195
var FoldMode = require("./folding/coffee").FoldMode;
196

    
197
var Mode = function() {
198
    this.HighlightRules = PascalHighlightRules;
199
    this.foldingRules = new FoldMode();
200
    this.$behaviour = this.$defaultBehaviour;
201
};
202
oop.inherits(Mode, TextMode);
203

    
204
(function() {
205
       
206
    this.lineCommentStart = ["--", "//"];
207
    this.blockComment = [
208
        {start: "(*", end: "*)"},
209
        {start: "{", end: "}"}
210
    ];
211
    
212
    this.$id = "ace/mode/pascal";
213
}).call(Mode.prototype);
214

    
215
exports.Mode = Mode;
216
});                (function() {
217
                    ace.require(["ace/mode/pascal"], function(m) {
218
                        if (typeof module == "object" && typeof exports == "object" && module) {
219
                            module.exports = m;
220
                        }
221
                    });
222
                })();
223
            
(133-133/244)