Debian Codegraph @

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

raw symbols SCIP
1 ace.define("ace/mode/tex_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(require, exports, module){/*
2 * tex_highlight_rules.js
3 *
4 * Copyright (C) 2009-11 by RStudio, Inc.
5 *
6 * The Initial Developer of the Original Code is
7 * Ajax.org B.V.
8 * Portions created by the Initial Developer are Copyright (C) 2010
9 * the Initial Developer. All Rights Reserved.
10 *
11 * Distributed under the BSD license:
12 *
13 * Copyright (c) 2010, Ajax.org B.V.
14 * All rights reserved.
15 *
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions are met:
18 * * Redistributions of source code must retain the above copyright
19 * notice, this list of conditions and the following disclaimer.
20 * * Redistributions in binary form must reproduce the above copyright
21 * notice, this list of conditions and the following disclaimer in the
22 * documentation and/or other materials provided with the distribution.
23 * * Neither the name of Ajax.org B.V. nor the
24 * names of its contributors may be used to endorse or promote products
25 * derived from this software without specific prior written permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
28 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
29 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
30 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
31 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
32 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
33 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
34 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
36 *
37 */
38 "use strict";
39 var oop = require("../lib/oop");
40 var lang = require("../lib/lang");
41 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
42 var TexHighlightRules = function (textClass) {
43 if (!textClass)
44 textClass = "text";
45 this.$rules = {
46 "start": [
47 {
48 token: "comment",
49 regex: "%.*$"
50 }, {
51 token: textClass, // non-command
52 regex: "\\\\[$&%#\\{\\}]"
53 }, {
54 token: "keyword", // command
55 regex: "\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\b",
56 next: "nospell"
57 }, {
58 token: "keyword", // command
59 regex: "\\\\(?:[a-zA-Z0-9]+|[^a-zA-Z0-9])"
60 }, {
61 token: "paren.keyword.operator",
62 regex: "[[({]"
63 }, {
64 token: "paren.keyword.operator",
65 regex: "[\\])}]"
66 }, {
67 token: textClass,
68 regex: "\\s+"
69 }
70 ],
71 "nospell": [
72 {
73 token: "comment",
74 regex: "%.*$",
75 next: "start"
76 }, {
77 token: "nospell." + textClass, // non-command
78 regex: "\\\\[$&%#\\{\\}]"
79 }, {
80 token: "keyword", // command
81 regex: "\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\b"
82 }, {
83 token: "keyword", // command
84 regex: "\\\\(?:[a-zA-Z0-9]+|[^a-zA-Z0-9])",
85 next: "start"
86 }, {
87 token: "paren.keyword.operator",
88 regex: "[[({]"
89 }, {
90 token: "paren.keyword.operator",
91 regex: "[\\])]"
92 }, {
93 token: "paren.keyword.operator",
94 regex: "}",
95 next: "start"
96 }, {
97 token: "nospell." + textClass,
98 regex: "\\s+"
99 }, {
100 token: "nospell." + textClass,
101 regex: "\\w+"
102 }
103 ]
104 };
105 };
106 oop.inherits(TexHighlightRules, TextHighlightRules);
107 exports.TexHighlightRules = TexHighlightRules;
108
109 });
110
111 ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict";
112 var Range = require("../range").Range;
113 var MatchingBraceOutdent = function () { };
114 (function () {
115 this.checkOutdent = function (line, input) {
116 if (!/^\s+$/.test(line))
117 return false;
118 return /^\s*\}/.test(input);
119 };
120 this.autoOutdent = function (doc, row) {
121 var line = doc.getLine(row);
122 var match = line.match(/^(\s*\})/);
123 if (!match)
124 return 0;
125 var column = match[1].length;
126 var openBracePos = doc.findMatchingBracket({ row: row, column: column });
127 if (!openBracePos || openBracePos.row == row)
128 return 0;
129 var indent = this.$getIndent(doc.getLine(openBracePos.row));
130 doc.replace(new Range(row, 0, row, column - 1), indent);
131 };
132 this.$getIndent = function (line) {
133 return line.match(/^\s*/)[0];
134 };
135 }).call(MatchingBraceOutdent.prototype);
136 exports.MatchingBraceOutdent = MatchingBraceOutdent;
137
138 });
139
140 ace.define("ace/mode/tex",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/text_highlight_rules","ace/mode/tex_highlight_rules","ace/mode/matching_brace_outdent"], function(require, exports, module){/*
141 * tex.js
142 *
143 * Copyright (C) 2009-11 by RStudio, Inc.
144 *
145 * The Initial Developer of the Original Code is
146 * Ajax.org B.V.
147 * Portions created by the Initial Developer are Copyright (C) 2010
148 * the Initial Developer. All Rights Reserved.
149 *
150 * Distributed under the BSD license:
151 *
152 * Copyright (c) 2010, Ajax.org B.V.
153 * All rights reserved.
154 *
155 * Redistribution and use in source and binary forms, with or without
156 * modification, are permitted provided that the following conditions are met:
157 * * Redistributions of source code must retain the above copyright
158 * notice, this list of conditions and the following disclaimer.
159 * * Redistributions in binary form must reproduce the above copyright
160 * notice, this list of conditions and the following disclaimer in the
161 * documentation and/or other materials provided with the distribution.
162 * * Neither the name of Ajax.org B.V. nor the
163 * names of its contributors may be used to endorse or promote products
164 * derived from this software without specific prior written permission.
165 *
166 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
167 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
168 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
169 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
170 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
171 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
172 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
173 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
174 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
175 *
176 */
177 "use strict";
178 var oop = require("../lib/oop");
179 var TextMode = require("./text").Mode;
180 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
181 var TexHighlightRules = require("./tex_highlight_rules").TexHighlightRules;
182 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
183 var Mode = function (suppressHighlighting) {
184 if (suppressHighlighting)
185 this.HighlightRules = TextHighlightRules;
186 else
187 this.HighlightRules = TexHighlightRules;
188 this.$outdent = new MatchingBraceOutdent();
189 this.$behaviour = this.$defaultBehaviour;
190 };
191 oop.inherits(Mode, TextMode);
192 (function () {
193 this.lineCommentStart = "%";
194 this.getNextLineIndent = function (state, line, tab) {
195 return this.$getIndent(line);
196 };
197 this.allowAutoInsert = function () {
198 return false;
199 };
200 this.$id = "ace/mode/tex";
201 this.snippetFileId = "ace/snippets/tex";
202 }).call(Mode.prototype);
203 exports.Mode = Mode;
204
205 }); (function() {
206 ace.require(["ace/mode/tex"], function(m) {
207 if (typeof module == "object" && typeof exports == "object" && module) {
208 module.exports = m;
209 }
210 });
211 })();
212