Debian Codegraph @

extensions/CodeEditor/modules/lib/ace/mode-rdoc.js

raw symbols SCIP
1 ace.define("ace/mode/latex_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
2 var oop = require("../lib/oop");
3 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
4 var LatexHighlightRules = function () {
5 this.$rules = {
6 "start": [{
7 token: "comment",
8 regex: "%.*$"
9 }, {
10 token: ["keyword", "lparen", "variable.parameter", "rparen", "lparen", "storage.type", "rparen"],
11 regex: "(\\\\(?:documentclass|usepackage|input))(?:(\\[)([^\\]]*)(\\]))?({)([^}]*)(})"
12 }, {
13 token: ["keyword", "lparen", "variable.parameter", "rparen"],
14 regex: "(\\\\(?:label|v?ref|cite(?:[^{]*)))(?:({)([^}]*)(}))?"
15 }, {
16 token: ["storage.type", "lparen", "variable.parameter", "rparen"],
17 regex: "(\\\\begin)({)(verbatim)(})",
18 next: "verbatim"
19 }, {
20 token: ["storage.type", "lparen", "variable.parameter", "rparen"],
21 regex: "(\\\\begin)({)(lstlisting)(})",
22 next: "lstlisting"
23 }, {
24 token: ["storage.type", "lparen", "variable.parameter", "rparen"],
25 regex: "(\\\\(?:begin|end))({)([\\w*]*)(})"
26 }, {
27 token: "storage.type",
28 regex: /\\verb\b\*?/,
29 next: [{
30 token: ["keyword.operator", "string", "keyword.operator"],
31 regex: "(.)(.*?)(\\1|$)|",
32 next: "start"
33 }]
34 }, {
35 token: "storage.type",
36 regex: "\\\\[a-zA-Z]+"
37 }, {
38 token: "lparen",
39 regex: "[[({]"
40 }, {
41 token: "rparen",
42 regex: "[\\])}]"
43 }, {
44 token: "constant.character.escape",
45 regex: "\\\\[^a-zA-Z]?"
46 }, {
47 token: "string",
48 regex: "\\${1,2}",
49 next: "equation"
50 }],
51 "equation": [{
52 token: "comment",
53 regex: "%.*$"
54 }, {
55 token: "string",
56 regex: "\\${1,2}",
57 next: "start"
58 }, {
59 token: "constant.character.escape",
60 regex: "\\\\(?:[^a-zA-Z]|[a-zA-Z]+)"
61 }, {
62 token: "error",
63 regex: "^\\s*$",
64 next: "start"
65 }, {
66 defaultToken: "string"
67 }],
68 "verbatim": [{
69 token: ["storage.type", "lparen", "variable.parameter", "rparen"],
70 regex: "(\\\\end)({)(verbatim)(})",
71 next: "start"
72 }, {
73 defaultToken: "text"
74 }],
75 "lstlisting": [{
76 token: ["storage.type", "lparen", "variable.parameter", "rparen"],
77 regex: "(\\\\end)({)(lstlisting)(})",
78 next: "start"
79 }, {
80 defaultToken: "text"
81 }]
82 };
83 this.normalizeRules();
84 };
85 oop.inherits(LatexHighlightRules, TextHighlightRules);
86 exports.LatexHighlightRules = LatexHighlightRules;
87
88 });
89
90 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){/*
91 * rdoc_highlight_rules.js
92 *
93 * Copyright (C) 2009-11 by RStudio, Inc.
94 *
95 * Distributed under the BSD license:
96 *
97 * Copyright (c) 2010, Ajax.org B.V.
98 * All rights reserved.
99 *
100 * Redistribution and use in source and binary forms, with or without
101 * modification, are permitted provided that the following conditions are met:
102 * * Redistributions of source code must retain the above copyright
103 * notice, this list of conditions and the following disclaimer.
104 * * Redistributions in binary form must reproduce the above copyright
105 * notice, this list of conditions and the following disclaimer in the
106 * documentation and/or other materials provided with the distribution.
107 * * Neither the name of Ajax.org B.V. nor the
108 * names of its contributors may be used to endorse or promote products
109 * derived from this software without specific prior written permission.
110 *
111 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
112 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
113 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
114 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
115 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
116 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
117 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
118 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
119 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
120 *
121 */
122 "use strict";
123 var oop = require("../lib/oop");
124 var lang = require("../lib/lang");
125 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
126 var LaTeXHighlightRules = require("./latex_highlight_rules");
127 var RDocHighlightRules = function () {
128 this.$rules = {
129 "start": [
130 {
131 token: "comment",
132 regex: "%.*$"
133 }, {
134 token: "text", // non-command
135 regex: "\\\\[$&%#\\{\\}]"
136 }, {
137 token: "keyword", // command
138 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",
139 next: "nospell"
140 }, {
141 token: "keyword", // command
142 regex: "\\\\(?:[a-zA-Z0-9]+|[^a-zA-Z0-9])"
143 }, {
144 token: "paren.keyword.operator",
145 regex: "[[({]"
146 }, {
147 token: "paren.keyword.operator",
148 regex: "[\\])}]"
149 }, {
150 token: "text",
151 regex: "\\s+"
152 }
153 ],
154 "nospell": [
155 {
156 token: "comment",
157 regex: "%.*$",
158 next: "start"
159 }, {
160 token: "nospell.text", // non-command
161 regex: "\\\\[$&%#\\{\\}]"
162 }, {
163 token: "keyword", // command
164 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"
165 }, {
166 token: "keyword", // command
167 regex: "\\\\(?:[a-zA-Z0-9]+|[^a-zA-Z0-9])",
168 next: "start"
169 }, {
170 token: "paren.keyword.operator",
171 regex: "[[({]"
172 }, {
173 token: "paren.keyword.operator",
174 regex: "[\\])]"
175 }, {
176 token: "paren.keyword.operator",
177 regex: "}",
178 next: "start"
179 }, {
180 token: "nospell.text",
181 regex: "\\s+"
182 }, {
183 token: "nospell.text",
184 regex: "\\w+"
185 }
186 ]
187 };
188 };
189 oop.inherits(RDocHighlightRules, TextHighlightRules);
190 exports.RDocHighlightRules = RDocHighlightRules;
191
192 });
193
194 ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict";
195 var Range = require("../range").Range;
196 var MatchingBraceOutdent = function () { };
197 (function () {
198 this.checkOutdent = function (line, input) {
199 if (!/^\s+$/.test(line))
200 return false;
201 return /^\s*\}/.test(input);
202 };
203 this.autoOutdent = function (doc, row) {
204 var line = doc.getLine(row);
205 var match = line.match(/^(\s*\})/);
206 if (!match)
207 return 0;
208 var column = match[1].length;
209 var openBracePos = doc.findMatchingBracket({ row: row, column: column });
210 if (!openBracePos || openBracePos.row == row)
211 return 0;
212 var indent = this.$getIndent(doc.getLine(openBracePos.row));
213 doc.replace(new Range(row, 0, row, column - 1), indent);
214 };
215 this.$getIndent = function (line) {
216 return line.match(/^\s*/)[0];
217 };
218 }).call(MatchingBraceOutdent.prototype);
219 exports.MatchingBraceOutdent = MatchingBraceOutdent;
220
221 });
222
223 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){/*
224 * rdoc.js
225 *
226 * Copyright (C) 2009-11 by RStudio, Inc.
227 *
228 * The Initial Developer of the Original Code is
229 * Ajax.org B.V.
230 * Portions created by the Initial Developer are Copyright (C) 2010
231 * the Initial Developer. All Rights Reserved.
232 *
233 * Distributed under the BSD license:
234 *
235 * Copyright (c) 2010, Ajax.org B.V.
236 * All rights reserved.
237 *
238 * Redistribution and use in source and binary forms, with or without
239 * modification, are permitted provided that the following conditions are met:
240 * * Redistributions of source code must retain the above copyright
241 * notice, this list of conditions and the following disclaimer.
242 * * Redistributions in binary form must reproduce the above copyright
243 * notice, this list of conditions and the following disclaimer in the
244 * documentation and/or other materials provided with the distribution.
245 * * Neither the name of Ajax.org B.V. nor the
246 * names of its contributors may be used to endorse or promote products
247 * derived from this software without specific prior written permission.
248 *
249 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
250 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
251 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
252 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
253 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
254 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
255 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
256 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
257 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
258 *
259 */
260 "use strict";
261 var oop = require("../lib/oop");
262 var TextMode = require("./text").Mode;
263 var RDocHighlightRules = require("./rdoc_highlight_rules").RDocHighlightRules;
264 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
265 var Mode = function (suppressHighlighting) {
266 this.HighlightRules = RDocHighlightRules;
267 this.$outdent = new MatchingBraceOutdent();
268 this.$behaviour = this.$defaultBehaviour;
269 };
270 oop.inherits(Mode, TextMode);
271 (function () {
272 this.getNextLineIndent = function (state, line, tab) {
273 return this.$getIndent(line);
274 };
275 this.$id = "ace/mode/rdoc";
276 }).call(Mode.prototype);
277 exports.Mode = Mode;
278
279 }); (function() {
280 ace.require(["ace/mode/rdoc"], function(m) {
281 if (typeof module == "object" && typeof exports == "object" && module) {
282 module.exports = m;
283 }
284 });
285 })();
286