Debian Codegraph @

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

raw symbols SCIP
1 ace.define("ace/mode/rst_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
2 var oop = require("../lib/oop");
3 var lang = require("../lib/lang");
4 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
5 var RSTHighlightRules = function () {
6 var tokens = {
7 title: "markup.heading",
8 list: "markup.heading",
9 table: "constant",
10 directive: "keyword.operator",
11 entity: "string",
12 link: "markup.underline.list",
13 bold: "markup.bold",
14 italic: "markup.italic",
15 literal: "support.function",
16 comment: "comment"
17 };
18 var startStringPrefix = "(^|\\s|[\"'(<\\[{\\-/:])";
19 var endStringSuffix = "(?:$|(?=\\s|[\\\\.,;!?\\-/:\"')>\\]}]))";
20 this.$rules = {
21 "start": [
22 {
23 token: tokens.title,
24 regex: "(^)([\\=\\-`:\\.'\"~\\^_\\*\\+#])(\\2{2,}\\s*$)"
25 },
26 {
27 token: ["text", tokens.directive, tokens.literal],
28 regex: "(^\\s*\\.\\. )([^: ]+::)(.*$)",
29 next: "codeblock"
30 },
31 {
32 token: tokens.directive,
33 regex: "::$",
34 next: "codeblock"
35 },
36 {
37 token: [tokens.entity, tokens.link],
38 regex: "(^\\.\\. _[^:]+:)(.*$)"
39 },
40 {
41 token: [tokens.entity, tokens.link],
42 regex: "(^__ )(https?://.*$)"
43 },
44 {
45 token: tokens.entity,
46 regex: "^\\.\\. \\[[^\\]]+\\] "
47 },
48 {
49 token: tokens.comment,
50 regex: "^\\.\\. .*$",
51 next: "comment"
52 },
53 {
54 token: tokens.list,
55 regex: "^\\s*[\\*\\+-] "
56 },
57 {
58 token: tokens.list,
59 regex: "^\\s*(?:[A-Za-z]|[0-9]+|[ivxlcdmIVXLCDM]+)\\. "
60 },
61 {
62 token: tokens.list,
63 regex: "^\\s*\\(?(?:[A-Za-z]|[0-9]+|[ivxlcdmIVXLCDM]+)\\) "
64 },
65 {
66 token: tokens.table,
67 regex: "^={2,}(?: +={2,})+$"
68 },
69 {
70 token: tokens.table,
71 regex: "^\\+-{2,}(?:\\+-{2,})+\\+$"
72 },
73 {
74 token: tokens.table,
75 regex: "^\\+={2,}(?:\\+={2,})+\\+$"
76 },
77 {
78 token: ["text", tokens.literal],
79 regex: startStringPrefix + "(``)(?=\\S)",
80 next: "code"
81 },
82 {
83 token: ["text", tokens.bold],
84 regex: startStringPrefix + "(\\*\\*)(?=\\S)",
85 next: "bold"
86 },
87 {
88 token: ["text", tokens.italic],
89 regex: startStringPrefix + "(\\*)(?=\\S)",
90 next: "italic"
91 },
92 {
93 token: tokens.entity,
94 regex: "\\|[\\w\\-]+?\\|"
95 },
96 {
97 token: tokens.entity,
98 regex: ":[\\w-:]+:`\\S",
99 next: "entity"
100 },
101 {
102 token: ["text", tokens.entity],
103 regex: startStringPrefix + "(_`)(?=\\S)",
104 next: "entity"
105 },
106 {
107 token: tokens.entity,
108 regex: "_[A-Za-z0-9\\-]+?"
109 },
110 {
111 token: ["text", tokens.link],
112 regex: startStringPrefix + "(`)(?=\\S)",
113 next: "link"
114 },
115 {
116 token: tokens.link,
117 regex: "[A-Za-z0-9\\-]+?__?"
118 },
119 {
120 token: tokens.link,
121 regex: "\\[[^\\]]+?\\]_"
122 },
123 {
124 token: tokens.link,
125 regex: "https?://\\S+"
126 },
127 {
128 token: tokens.table,
129 regex: "\\|"
130 }
131 ],
132 "codeblock": [
133 {
134 token: tokens.literal,
135 regex: "^ +.+$",
136 next: "codeblock"
137 },
138 {
139 token: tokens.literal,
140 regex: '^$',
141 next: "codeblock"
142 },
143 {
144 token: "empty",
145 regex: "",
146 next: "start"
147 }
148 ],
149 "code": [
150 {
151 token: tokens.literal,
152 regex: "\\S``" + endStringSuffix,
153 next: "start"
154 },
155 {
156 defaultToken: tokens.literal
157 }
158 ],
159 "bold": [
160 {
161 token: tokens.bold,
162 regex: "\\S\\*\\*" + endStringSuffix,
163 next: "start"
164 },
165 {
166 defaultToken: tokens.bold
167 }
168 ],
169 "italic": [
170 {
171 token: tokens.italic,
172 regex: "\\S\\*" + endStringSuffix,
173 next: "start"
174 },
175 {
176 defaultToken: tokens.italic
177 }
178 ],
179 "entity": [
180 {
181 token: tokens.entity,
182 regex: "\\S`" + endStringSuffix,
183 next: "start"
184 },
185 {
186 defaultToken: tokens.entity
187 }
188 ],
189 "link": [
190 {
191 token: tokens.link,
192 regex: "\\S`__?" + endStringSuffix,
193 next: "start"
194 },
195 {
196 defaultToken: tokens.link
197 }
198 ],
199 "comment": [
200 {
201 token: tokens.comment,
202 regex: "^ +.+$",
203 next: "comment"
204 },
205 {
206 token: tokens.comment,
207 regex: '^$',
208 next: "comment"
209 },
210 {
211 token: "empty",
212 regex: "",
213 next: "start"
214 }
215 ]
216 };
217 };
218 oop.inherits(RSTHighlightRules, TextHighlightRules);
219 exports.RSTHighlightRules = RSTHighlightRules;
220
221 });
222
223 ace.define("ace/mode/rst",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/rst_highlight_rules"], function(require, exports, module){"use strict";
224 var oop = require("../lib/oop");
225 var TextMode = require("./text").Mode;
226 var RSTHighlightRules = require("./rst_highlight_rules").RSTHighlightRules;
227 var Mode = function () {
228 this.HighlightRules = RSTHighlightRules;
229 };
230 oop.inherits(Mode, TextMode);
231 (function () {
232 this.type = "text";
233 this.$id = "ace/mode/rst";
234 this.snippetFileId = "ace/snippets/rst";
235 }).call(Mode.prototype);
236 exports.Mode = Mode;
237
238 }); (function() {
239 ace.require(["ace/mode/rst"], function(m) {
240 if (typeof module == "object" && typeof exports == "object" && module) {
241 module.exports = m;
242 }
243 });
244 })();
245