Projekt

Obecné

Profil

Stáhnout (5.15 KB) Statistiky
| Větev: | Tag: | Revize:
1
ace.define("ace/mode/eiffel_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 EiffelHighlightRules = function() {
8
    var keywords = "across|agent|alias|all|attached|as|assign|attribute|check|" +
9
        "class|convert|create|debug|deferred|detachable|do|else|elseif|end|" +
10
        "ensure|expanded|export|external|feature|from|frozen|if|inherit|" +
11
        "inspect|invariant|like|local|loop|not|note|obsolete|old|once|" +
12
        "Precursor|redefine|rename|require|rescue|retry|select|separate|" +
13
        "some|then|undefine|until|variant|when";
14

    
15
    var operatorKeywords = "and|implies|or|xor";
16

    
17
    var languageConstants = "Void";
18

    
19
    var booleanConstants = "True|False";
20

    
21
    var languageVariables = "Current|Result";
22

    
23
    var keywordMapper = this.createKeywordMapper({
24
        "constant.language": languageConstants,
25
        "constant.language.boolean": booleanConstants,
26
        "variable.language": languageVariables,
27
        "keyword.operator": operatorKeywords,
28
        "keyword": keywords
29
    }, "identifier", true);
30

    
31
    var simpleString = /(?:[^"%\b\f\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)+?/;
32

    
33
    this.$rules = {
34
        "start": [{
35
                token : "string.quoted.other", // Aligned-verbatim-strings (verbatim option not supported)
36
                regex : /"\[/,
37
                next: "aligned_verbatim_string"
38
            }, {
39
                token : "string.quoted.other", // Non-aligned-verbatim-strings (verbatim option not supported)
40
                regex : /"\{/,
41
                next: "non-aligned_verbatim_string"
42
            }, {
43
                token : "string.quoted.double",
44
                regex : /"(?:[^%\b\f\n\r\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)*?"/
45
            }, {
46
                token : "comment.line.double-dash",
47
                regex : /--.*/
48
            }, {
49
                token : "constant.character",
50
                regex : /'(?:[^%\b\f\n\r\t\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)'/
51
            }, {
52
                token : "constant.numeric", // hexa | octal | bin
53
                regex : /\b0(?:[xX][\da-fA-F](?:_*[\da-fA-F])*|[cC][0-7](?:_*[0-7])*|[bB][01](?:_*[01])*)\b/
54
            }, {
55
                token : "constant.numeric",
56
                regex : /(?:\d(?:_*\d)*)?\.(?:(?:\d(?:_*\d)*)?[eE][+-]?)?\d(?:_*\d)*|\d(?:_*\d)*\.?/
57
            }, {
58
                token : "paren.lparen",
59
                regex : /[\[({]|<<|\|\(/
60
            }, {
61
                token : "paren.rparen",
62
                regex : /[\])}]|>>|\|\)/
63
            }, {
64
                token : "keyword.operator", // punctuation
65
                regex : /:=|->|\.(?=\w)|[;,:?]/
66
            }, {
67
                token : "keyword.operator",
68
                regex : /\\\\|\|\.\.\||\.\.|\/[~\/]?|[><\/]=?|[-+*^=~]/
69
            }, {
70
                token : function (v) {
71
                    var result = keywordMapper(v);
72
                    if (result === "identifier" && v === v.toUpperCase()) {
73
                        result =  "entity.name.type";
74
                    }
75
                    return result;
76
                },
77
                regex : /[a-zA-Z][a-zA-Z\d_]*\b/
78
            }, {
79
                token : "text",
80
                regex : /\s+/
81
            }
82
        ],
83
        "aligned_verbatim_string" : [{
84
                token : "string",
85
                regex : /]"/,
86
                next : "start"
87
            }, {
88
                token : "string",
89
                regex : simpleString
90
            }
91
        ],
92
        "non-aligned_verbatim_string" : [{
93
                token : "string.quoted.other",
94
                regex : /}"/,
95
                next : "start"
96
            }, {
97
                token : "string.quoted.other",
98
                regex : simpleString
99
            }
100
        ]};
101
};
102

    
103
oop.inherits(EiffelHighlightRules, TextHighlightRules);
104

    
105
exports.EiffelHighlightRules = EiffelHighlightRules;
106
});
107

    
108
ace.define("ace/mode/eiffel",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/eiffel_highlight_rules"], function(require, exports, module) {
109
"use strict";
110

    
111
var oop = require("../lib/oop");
112
var TextMode = require("./text").Mode;
113
var EiffelHighlightRules = require("./eiffel_highlight_rules").EiffelHighlightRules;
114

    
115
var Mode = function() {
116
    this.HighlightRules = EiffelHighlightRules;
117
    this.$behaviour = this.$defaultBehaviour;
118
};
119
oop.inherits(Mode, TextMode);
120

    
121
(function() {
122
    this.lineCommentStart = "--";
123
    this.$id = "ace/mode/eiffel";
124
}).call(Mode.prototype);
125

    
126
exports.Mode = Mode;
127

    
128
});                (function() {
129
                    ace.require(["ace/mode/eiffel"], function(m) {
130
                        if (typeof module == "object" && typeof exports == "object" && module) {
131
                            module.exports = m;
132
                        }
133
                    });
134
                })();
135
            
(64-64/244)