Projekt

Obecné

Profil

Stáhnout (8.07 KB) Statistiky
| Větev: | Tag: | Revize:
1
ace.define("ace/mode/latex_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 LatexHighlightRules = function() {  
8

    
9
    this.$rules = {
10
        "start" : [{
11
            token : "comment",
12
            regex : "%.*$"
13
        }, {
14
            token : ["keyword", "lparen", "variable.parameter", "rparen", "lparen", "storage.type", "rparen"],
15
            regex : "(\\\\(?:documentclass|usepackage|input))(?:(\\[)([^\\]]*)(\\]))?({)([^}]*)(})"
16
        }, {
17
            token : ["keyword","lparen", "variable.parameter", "rparen"],
18
            regex : "(\\\\(?:label|v?ref|cite(?:[^{]*)))(?:({)([^}]*)(}))?"
19
        }, {
20
            token : ["storage.type", "lparen", "variable.parameter", "rparen"],
21
            regex : "(\\\\begin)({)(verbatim)(})",
22
            next : "verbatim"
23
        },  {
24
            token : ["storage.type", "lparen", "variable.parameter", "rparen"],
25
            regex : "(\\\\begin)({)(lstlisting)(})",
26
            next : "lstlisting"
27
        },  {
28
            token : ["storage.type", "lparen", "variable.parameter", "rparen"],
29
            regex : "(\\\\(?:begin|end))({)([\\w*]*)(})"
30
        }, {
31
            token : "storage.type",
32
            regex : /\\verb\b\*?/,
33
            next : [{
34
                token : ["keyword.operator", "string", "keyword.operator"],
35
                regex : "(.)(.*?)(\\1|$)|",
36
                next : "start"
37
            }]
38
        }, {
39
            token : "storage.type",
40
            regex : "\\\\[a-zA-Z]+"
41
        }, {
42
            token : "lparen",
43
            regex : "[[({]"
44
        }, {
45
            token : "rparen",
46
            regex : "[\\])}]"
47
        }, {
48
            token : "constant.character.escape",
49
            regex : "\\\\[^a-zA-Z]?"
50
        }, {
51
            token : "string",
52
            regex : "\\${1,2}",
53
            next  : "equation"
54
        }],
55
        "equation" : [{
56
            token : "comment",
57
            regex : "%.*$"
58
        }, {
59
            token : "string",
60
            regex : "\\${1,2}",
61
            next  : "start"
62
        }, {
63
            token : "constant.character.escape",
64
            regex : "\\\\(?:[^a-zA-Z]|[a-zA-Z]+)"
65
        }, {
66
            token : "error", 
67
            regex : "^\\s*$", 
68
            next : "start" 
69
        }, {
70
            defaultToken : "string"
71
        }],
72
        "verbatim": [{
73
            token : ["storage.type", "lparen", "variable.parameter", "rparen"],
74
            regex : "(\\\\end)({)(verbatim)(})",
75
            next : "start"
76
        }, {
77
            defaultToken : "text"
78
        }],
79
        "lstlisting": [{
80
            token : ["storage.type", "lparen", "variable.parameter", "rparen"],
81
            regex : "(\\\\end)({)(lstlisting)(})",
82
            next : "start"
83
        }, {
84
            defaultToken : "text"
85
        }]
86
    };
87
    
88
    this.normalizeRules();
89
};
90
oop.inherits(LatexHighlightRules, TextHighlightRules);
91

    
92
exports.LatexHighlightRules = LatexHighlightRules;
93

    
94
});
95

    
96
ace.define("ace/mode/rdoc_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules","ace/mode/latex_highlight_rules"], function(require, exports, module) {
97
"use strict";
98

    
99
var oop = require("../lib/oop");
100
var lang = require("../lib/lang");
101
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
102
var LaTeXHighlightRules = require("./latex_highlight_rules");
103

    
104
var RDocHighlightRules = function() {
105

    
106
    this.$rules = {
107
        "start" : [
108
            {
109
                token : "comment",
110
                regex : "%.*$"
111
            }, {
112
                token : "text", // non-command
113
                regex : "\\\\[$&%#\\{\\}]"
114
            }, {
115
                token : "keyword", // command
116
                regex : "\\\\(?:name|alias|method|S3method|S4method|item|code|preformatted|kbd|pkg|var|env|option|command|author|email|url|source|cite|acronym|href|code|preformatted|link|eqn|deqn|keyword|usage|examples|dontrun|dontshow|figure|if|ifelse|Sexpr|RdOpts|inputencoding|usepackage)\\b",
117
               next : "nospell"
118
            }, {
119
                token : "keyword", // command
120
                regex : "\\\\(?:[a-zA-Z0-9]+|[^a-zA-Z0-9])"
121
            }, {
122
               token : "paren.keyword.operator",
123
                regex : "[[({]"
124
            }, {
125
               token : "paren.keyword.operator",
126
                regex : "[\\])}]"
127
            }, {
128
                token : "text",
129
                regex : "\\s+"
130
            }
131
        ],
132
        "nospell" : [
133
           {
134
               token : "comment",
135
               regex : "%.*$",
136
               next : "start"
137
           }, {
138
               token : "nospell.text", // non-command
139
               regex : "\\\\[$&%#\\{\\}]"
140
           }, {
141
               token : "keyword", // command
142
               regex : "\\\\(?:name|alias|method|S3method|S4method|item|code|preformatted|kbd|pkg|var|env|option|command|author|email|url|source|cite|acronym|href|code|preformatted|link|eqn|deqn|keyword|usage|examples|dontrun|dontshow|figure|if|ifelse|Sexpr|RdOpts|inputencoding|usepackage)\\b"
143
           }, {
144
               token : "keyword", // command
145
               regex : "\\\\(?:[a-zA-Z0-9]+|[^a-zA-Z0-9])",
146
               next : "start"
147
           }, {
148
               token : "paren.keyword.operator",
149
               regex : "[[({]"
150
           }, {
151
               token : "paren.keyword.operator",
152
               regex : "[\\])]"
153
           }, {
154
               token : "paren.keyword.operator",
155
               regex : "}",
156
               next : "start"
157
           }, {
158
               token : "nospell.text",
159
               regex : "\\s+"
160
           }, {
161
               token : "nospell.text",
162
               regex : "\\w+"
163
           }
164
        ]
165
    };
166
};
167

    
168
oop.inherits(RDocHighlightRules, TextHighlightRules);
169

    
170
exports.RDocHighlightRules = RDocHighlightRules;
171
});
172

    
173
ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
174
"use strict";
175

    
176
var Range = require("../range").Range;
177

    
178
var MatchingBraceOutdent = function() {};
179

    
180
(function() {
181

    
182
    this.checkOutdent = function(line, input) {
183
        if (! /^\s+$/.test(line))
184
            return false;
185

    
186
        return /^\s*\}/.test(input);
187
    };
188

    
189
    this.autoOutdent = function(doc, row) {
190
        var line = doc.getLine(row);
191
        var match = line.match(/^(\s*\})/);
192

    
193
        if (!match) return 0;
194

    
195
        var column = match[1].length;
196
        var openBracePos = doc.findMatchingBracket({row: row, column: column});
197

    
198
        if (!openBracePos || openBracePos.row == row) return 0;
199

    
200
        var indent = this.$getIndent(doc.getLine(openBracePos.row));
201
        doc.replace(new Range(row, 0, row, column-1), indent);
202
    };
203

    
204
    this.$getIndent = function(line) {
205
        return line.match(/^\s*/)[0];
206
    };
207

    
208
}).call(MatchingBraceOutdent.prototype);
209

    
210
exports.MatchingBraceOutdent = MatchingBraceOutdent;
211
});
212

    
213
ace.define("ace/mode/rdoc",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/rdoc_highlight_rules","ace/mode/matching_brace_outdent"], function(require, exports, module) {
214
"use strict";
215

    
216
var oop = require("../lib/oop");
217
var TextMode = require("./text").Mode;
218
var RDocHighlightRules = require("./rdoc_highlight_rules").RDocHighlightRules;
219
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
220

    
221
var Mode = function(suppressHighlighting) {
222
	this.HighlightRules = RDocHighlightRules;
223
    this.$outdent = new MatchingBraceOutdent();
224
    this.$behaviour = this.$defaultBehaviour;
225
};
226
oop.inherits(Mode, TextMode);
227

    
228
(function() {
229
    this.getNextLineIndent = function(state, line, tab) {
230
        return this.$getIndent(line);
231
    };
232
    this.$id = "ace/mode/rdoc";
233
}).call(Mode.prototype);
234

    
235
exports.Mode = Mode;
236
});                (function() {
237
                    ace.require(["ace/mode/rdoc"], function(m) {
238
                        if (typeof module == "object" && typeof exports == "object" && module) {
239
                            module.exports = m;
240
                        }
241
                    });
242
                })();
243
            
(152-152/244)