express_admin 1.6.4 → 1.6.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (24) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/ace/mode-html.js +2437 -0
  3. data/app/assets/javascripts/express_admin.js +2 -0
  4. data/app/assets/javascripts/express_admin/admin.js.coffee +8 -2
  5. data/app/assets/javascripts/express_admin/form_validation.js.coffee +24 -0
  6. data/app/assets/stylesheets/express_admin/shared/_forms.sass +12 -3
  7. data/app/assets/stylesheets/express_admin/shared/_tables.sass +41 -0
  8. data/app/components/express_admin/code_editor.rb +44 -0
  9. data/{vendor/gems/express_templates/lib/express_templates/components/forms → app/components/express_admin}/country_select.rb +1 -1
  10. data/app/components/express_admin/smart_form.rb +5 -14
  11. data/app/components/express_admin/smart_table.rb +65 -26
  12. data/lib/express_admin/engine.rb +1 -0
  13. data/lib/express_admin/version.rb +1 -1
  14. data/test/dummy/test/components/code_editor_test.rb +53 -0
  15. data/test/dummy/test/components/country_select_test.rb +36 -0
  16. data/test/test_helper.rb +8 -0
  17. data/vendor/gems/express_templates/express_templates.gemspec +0 -1
  18. data/vendor/gems/express_templates/lib/express_templates/components/base.rb +29 -0
  19. data/vendor/gems/express_templates/lib/express_templates/components/configurable.rb +3 -1
  20. data/vendor/gems/express_templates/lib/express_templates/components/container.rb +3 -1
  21. data/vendor/gems/express_templates/lib/express_templates/components/forms.rb +0 -1
  22. data/vendor/gems/express_templates/lib/express_templates/version.rb +1 -1
  23. metadata +40 -6
  24. data/vendor/gems/express_templates/test/components/forms/country_select_test.rb +0 -34
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a43f56f4e0dadb43337d599139a3c886d8c5800a
4
- data.tar.gz: 9797b798d4717832c64ec0679d6b6dc0415d942e
3
+ metadata.gz: 1a316ca28a17d07d0cb8bdd06b0387bd2405e40d
4
+ data.tar.gz: 1caf49f457f068e95037c57ed5c64f1b21d512fb
5
5
  SHA512:
6
- metadata.gz: e3dfd3f8c023ad92b0a13e20dd47bf006c8eeea331abb057e4f1a45acd54ee62af9ca2aa0d1a7ce4775f62292e4519d53a122e8fce736ab881cb80fd1d0e585e
7
- data.tar.gz: 17d6d0a62dbfc2dfa99314d46f0aedd77fbaf38b042a5fdb3769b673a99815da03aca1906da7a15bbd38d520b9c76ab8541b5f4e9dcf4d9121fc398195dc96e9
6
+ metadata.gz: 59f9f013b1470ec36b44c1b2ef389494e0bcc427f999f09839a4136b9c2017ea452f89f9805225cb4825e5322dab8972d086f625e5b47084ec32bc5925e11908
7
+ data.tar.gz: 11f4f3f574a53a2d1fe44a6accd38fba1a30ce2f90385c00259c75c348570d5257f9bca1999a5e075207ef78aaf33f76a5162899e0940e9160651d62ffc82f44
@@ -0,0 +1,2437 @@
1
+ define("ace/mode/doc_comment_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 DocCommentHighlightRules = function() {
8
+ this.$rules = {
9
+ "start" : [ {
10
+ token : "comment.doc.tag",
11
+ regex : "@[\\w\\d_]+" // TODO: fix email addresses
12
+ },
13
+ DocCommentHighlightRules.getTagRule(),
14
+ {
15
+ defaultToken : "comment.doc",
16
+ caseInsensitive: true
17
+ }]
18
+ };
19
+ };
20
+
21
+ oop.inherits(DocCommentHighlightRules, TextHighlightRules);
22
+
23
+ DocCommentHighlightRules.getTagRule = function(start) {
24
+ return {
25
+ token : "comment.doc.tag.storage.type",
26
+ regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
27
+ };
28
+ }
29
+
30
+ DocCommentHighlightRules.getStartRule = function(start) {
31
+ return {
32
+ token : "comment.doc", // doc comment
33
+ regex : "\\/\\*(?=\\*)",
34
+ next : start
35
+ };
36
+ };
37
+
38
+ DocCommentHighlightRules.getEndRule = function (start) {
39
+ return {
40
+ token : "comment.doc", // closing comment
41
+ regex : "\\*\\/",
42
+ next : start
43
+ };
44
+ };
45
+
46
+
47
+ exports.DocCommentHighlightRules = DocCommentHighlightRules;
48
+
49
+ });
50
+
51
+ define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) {
52
+ "use strict";
53
+
54
+ var oop = require("../lib/oop");
55
+ var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
56
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
57
+
58
+ var JavaScriptHighlightRules = function(options) {
59
+ var keywordMapper = this.createKeywordMapper({
60
+ "variable.language":
61
+ "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
62
+ "Namespace|QName|XML|XMLList|" + // E4X
63
+ "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
64
+ "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
65
+ "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
66
+ "SyntaxError|TypeError|URIError|" +
67
+ "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
68
+ "isNaN|parseFloat|parseInt|" +
69
+ "JSON|Math|" + // Other
70
+ "this|arguments|prototype|window|document" , // Pseudo
71
+ "keyword":
72
+ "const|yield|import|get|set|" +
73
+ "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
74
+ "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
75
+ "__parent__|__count__|escape|unescape|with|__proto__|" +
76
+ "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
77
+ "storage.type":
78
+ "const|let|var|function",
79
+ "constant.language":
80
+ "null|Infinity|NaN|undefined",
81
+ "support.function":
82
+ "alert",
83
+ "constant.language.boolean": "true|false"
84
+ }, "identifier");
85
+ var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
86
+ var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
87
+
88
+ var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
89
+ "u[0-9a-fA-F]{4}|" + // unicode
90
+ "[0-2][0-7]{0,2}|" + // oct
91
+ "3[0-6][0-7]?|" + // oct
92
+ "37[0-7]?|" + // oct
93
+ "[4-7][0-7]?|" + //oct
94
+ ".)";
95
+
96
+ this.$rules = {
97
+ "no_regex" : [
98
+ {
99
+ token : "comment",
100
+ regex : "\\/\\/",
101
+ next : "line_comment"
102
+ },
103
+ DocCommentHighlightRules.getStartRule("doc-start"),
104
+ {
105
+ token : "comment", // multi line comment
106
+ regex : /\/\*/,
107
+ next : "comment"
108
+ }, {
109
+ token : "string",
110
+ regex : "'(?=.)",
111
+ next : "qstring"
112
+ }, {
113
+ token : "string",
114
+ regex : '"(?=.)',
115
+ next : "qqstring"
116
+ }, {
117
+ token : "constant.numeric", // hex
118
+ regex : /0[xX][0-9a-fA-F]+\b/
119
+ }, {
120
+ token : "constant.numeric", // float
121
+ regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
122
+ }, {
123
+ token : [
124
+ "storage.type", "punctuation.operator", "support.function",
125
+ "punctuation.operator", "entity.name.function", "text","keyword.operator"
126
+ ],
127
+ regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
128
+ next: "function_arguments"
129
+ }, {
130
+ token : [
131
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
132
+ "keyword.operator", "text", "storage.type", "text", "paren.lparen"
133
+ ],
134
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
135
+ next: "function_arguments"
136
+ }, {
137
+ token : [
138
+ "entity.name.function", "text", "keyword.operator", "text", "storage.type",
139
+ "text", "paren.lparen"
140
+ ],
141
+ regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
142
+ next: "function_arguments"
143
+ }, {
144
+ token : [
145
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
146
+ "keyword.operator", "text",
147
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
148
+ ],
149
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
150
+ next: "function_arguments"
151
+ }, {
152
+ token : [
153
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
154
+ ],
155
+ regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
156
+ next: "function_arguments"
157
+ }, {
158
+ token : [
159
+ "entity.name.function", "text", "punctuation.operator",
160
+ "text", "storage.type", "text", "paren.lparen"
161
+ ],
162
+ regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
163
+ next: "function_arguments"
164
+ }, {
165
+ token : [
166
+ "text", "text", "storage.type", "text", "paren.lparen"
167
+ ],
168
+ regex : "(:)(\\s*)(function)(\\s*)(\\()",
169
+ next: "function_arguments"
170
+ }, {
171
+ token : "keyword",
172
+ regex : "(?:" + kwBeforeRe + ")\\b",
173
+ next : "start"
174
+ }, {
175
+ token : ["punctuation.operator", "support.function"],
176
+ regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
177
+ }, {
178
+ token : ["punctuation.operator", "support.function.dom"],
179
+ regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
180
+ }, {
181
+ token : ["punctuation.operator", "support.constant"],
182
+ regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
183
+ }, {
184
+ token : ["support.constant"],
185
+ regex : /that\b/
186
+ }, {
187
+ token : ["storage.type", "punctuation.operator", "support.function.firebug"],
188
+ regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
189
+ }, {
190
+ token : keywordMapper,
191
+ regex : identifierRe
192
+ }, {
193
+ token : "keyword.operator",
194
+ regex : /--|\+\+|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|[!$%&*+\-~\/^]=?/,
195
+ next : "start"
196
+ }, {
197
+ token : "punctuation.operator",
198
+ regex : /[?:,;.]/,
199
+ next : "start"
200
+ }, {
201
+ token : "paren.lparen",
202
+ regex : /[\[({]/,
203
+ next : "start"
204
+ }, {
205
+ token : "paren.rparen",
206
+ regex : /[\])}]/
207
+ }, {
208
+ token: "comment",
209
+ regex: /^#!.*$/
210
+ }
211
+ ],
212
+ "start": [
213
+ DocCommentHighlightRules.getStartRule("doc-start"),
214
+ {
215
+ token : "comment", // multi line comment
216
+ regex : "\\/\\*",
217
+ next : "comment_regex_allowed"
218
+ }, {
219
+ token : "comment",
220
+ regex : "\\/\\/",
221
+ next : "line_comment_regex_allowed"
222
+ }, {
223
+ token: "string.regexp",
224
+ regex: "\\/",
225
+ next: "regex"
226
+ }, {
227
+ token : "text",
228
+ regex : "\\s+|^$",
229
+ next : "start"
230
+ }, {
231
+ token: "empty",
232
+ regex: "",
233
+ next: "no_regex"
234
+ }
235
+ ],
236
+ "regex": [
237
+ {
238
+ token: "regexp.keyword.operator",
239
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
240
+ }, {
241
+ token: "string.regexp",
242
+ regex: "/[sxngimy]*",
243
+ next: "no_regex"
244
+ }, {
245
+ token : "invalid",
246
+ regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
247
+ }, {
248
+ token : "constant.language.escape",
249
+ regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
250
+ }, {
251
+ token : "constant.language.delimiter",
252
+ regex: /\|/
253
+ }, {
254
+ token: "constant.language.escape",
255
+ regex: /\[\^?/,
256
+ next: "regex_character_class"
257
+ }, {
258
+ token: "empty",
259
+ regex: "$",
260
+ next: "no_regex"
261
+ }, {
262
+ defaultToken: "string.regexp"
263
+ }
264
+ ],
265
+ "regex_character_class": [
266
+ {
267
+ token: "regexp.charclass.keyword.operator",
268
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
269
+ }, {
270
+ token: "constant.language.escape",
271
+ regex: "]",
272
+ next: "regex"
273
+ }, {
274
+ token: "constant.language.escape",
275
+ regex: "-"
276
+ }, {
277
+ token: "empty",
278
+ regex: "$",
279
+ next: "no_regex"
280
+ }, {
281
+ defaultToken: "string.regexp.charachterclass"
282
+ }
283
+ ],
284
+ "function_arguments": [
285
+ {
286
+ token: "variable.parameter",
287
+ regex: identifierRe
288
+ }, {
289
+ token: "punctuation.operator",
290
+ regex: "[, ]+"
291
+ }, {
292
+ token: "punctuation.operator",
293
+ regex: "$"
294
+ }, {
295
+ token: "empty",
296
+ regex: "",
297
+ next: "no_regex"
298
+ }
299
+ ],
300
+ "comment_regex_allowed" : [
301
+ DocCommentHighlightRules.getTagRule(),
302
+ {token : "comment", regex : "\\*\\/", next : "start"},
303
+ {defaultToken : "comment", caseInsensitive: true}
304
+ ],
305
+ "comment" : [
306
+ DocCommentHighlightRules.getTagRule(),
307
+ {token : "comment", regex : "\\*\\/", next : "no_regex"},
308
+ {defaultToken : "comment", caseInsensitive: true}
309
+ ],
310
+ "line_comment_regex_allowed" : [
311
+ DocCommentHighlightRules.getTagRule(),
312
+ {token : "comment", regex : "$|^", next : "start"},
313
+ {defaultToken : "comment", caseInsensitive: true}
314
+ ],
315
+ "line_comment" : [
316
+ DocCommentHighlightRules.getTagRule(),
317
+ {token : "comment", regex : "$|^", next : "no_regex"},
318
+ {defaultToken : "comment", caseInsensitive: true}
319
+ ],
320
+ "qqstring" : [
321
+ {
322
+ token : "constant.language.escape",
323
+ regex : escapedRe
324
+ }, {
325
+ token : "string",
326
+ regex : "\\\\$",
327
+ next : "qqstring"
328
+ }, {
329
+ token : "string",
330
+ regex : '"|$',
331
+ next : "no_regex"
332
+ }, {
333
+ defaultToken: "string"
334
+ }
335
+ ],
336
+ "qstring" : [
337
+ {
338
+ token : "constant.language.escape",
339
+ regex : escapedRe
340
+ }, {
341
+ token : "string",
342
+ regex : "\\\\$",
343
+ next : "qstring"
344
+ }, {
345
+ token : "string",
346
+ regex : "'|$",
347
+ next : "no_regex"
348
+ }, {
349
+ defaultToken: "string"
350
+ }
351
+ ]
352
+ };
353
+
354
+
355
+ if (!options || !options.noES6) {
356
+ this.$rules.no_regex.unshift({
357
+ regex: "[{}]", onMatch: function(val, state, stack) {
358
+ this.next = val == "{" ? this.nextState : "";
359
+ if (val == "{" && stack.length) {
360
+ stack.unshift("start", state);
361
+ return "paren";
362
+ }
363
+ if (val == "}" && stack.length) {
364
+ stack.shift();
365
+ this.next = stack.shift();
366
+ if (this.next.indexOf("string") != -1)
367
+ return "paren.quasi.end";
368
+ }
369
+ return val == "{" ? "paren.lparen" : "paren.rparen";
370
+ },
371
+ nextState: "start"
372
+ }, {
373
+ token : "string.quasi.start",
374
+ regex : /`/,
375
+ push : [{
376
+ token : "constant.language.escape",
377
+ regex : escapedRe
378
+ }, {
379
+ token : "paren.quasi.start",
380
+ regex : /\${/,
381
+ push : "start"
382
+ }, {
383
+ token : "string.quasi.end",
384
+ regex : /`/,
385
+ next : "pop"
386
+ }, {
387
+ defaultToken: "string.quasi"
388
+ }]
389
+ });
390
+ }
391
+
392
+ this.embedRules(DocCommentHighlightRules, "doc-",
393
+ [ DocCommentHighlightRules.getEndRule("no_regex") ]);
394
+
395
+ this.normalizeRules();
396
+ };
397
+
398
+ oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
399
+
400
+ exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
401
+ });
402
+
403
+ define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
404
+ "use strict";
405
+
406
+ var Range = require("../range").Range;
407
+
408
+ var MatchingBraceOutdent = function() {};
409
+
410
+ (function() {
411
+
412
+ this.checkOutdent = function(line, input) {
413
+ if (! /^\s+$/.test(line))
414
+ return false;
415
+
416
+ return /^\s*\}/.test(input);
417
+ };
418
+
419
+ this.autoOutdent = function(doc, row) {
420
+ var line = doc.getLine(row);
421
+ var match = line.match(/^(\s*\})/);
422
+
423
+ if (!match) return 0;
424
+
425
+ var column = match[1].length;
426
+ var openBracePos = doc.findMatchingBracket({row: row, column: column});
427
+
428
+ if (!openBracePos || openBracePos.row == row) return 0;
429
+
430
+ var indent = this.$getIndent(doc.getLine(openBracePos.row));
431
+ doc.replace(new Range(row, 0, row, column-1), indent);
432
+ };
433
+
434
+ this.$getIndent = function(line) {
435
+ return line.match(/^\s*/)[0];
436
+ };
437
+
438
+ }).call(MatchingBraceOutdent.prototype);
439
+
440
+ exports.MatchingBraceOutdent = MatchingBraceOutdent;
441
+ });
442
+
443
+ define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module) {
444
+ "use strict";
445
+
446
+ var oop = require("../../lib/oop");
447
+ var Behaviour = require("../behaviour").Behaviour;
448
+ var TokenIterator = require("../../token_iterator").TokenIterator;
449
+ var lang = require("../../lib/lang");
450
+
451
+ var SAFE_INSERT_IN_TOKENS =
452
+ ["text", "paren.rparen", "punctuation.operator"];
453
+ var SAFE_INSERT_BEFORE_TOKENS =
454
+ ["text", "paren.rparen", "punctuation.operator", "comment"];
455
+
456
+ var context;
457
+ var contextCache = {};
458
+ var initContext = function(editor) {
459
+ var id = -1;
460
+ if (editor.multiSelect) {
461
+ id = editor.selection.index;
462
+ if (contextCache.rangeCount != editor.multiSelect.rangeCount)
463
+ contextCache = {rangeCount: editor.multiSelect.rangeCount};
464
+ }
465
+ if (contextCache[id])
466
+ return context = contextCache[id];
467
+ context = contextCache[id] = {
468
+ autoInsertedBrackets: 0,
469
+ autoInsertedRow: -1,
470
+ autoInsertedLineEnd: "",
471
+ maybeInsertedBrackets: 0,
472
+ maybeInsertedRow: -1,
473
+ maybeInsertedLineStart: "",
474
+ maybeInsertedLineEnd: ""
475
+ };
476
+ };
477
+
478
+ var getWrapped = function(selection, selected, opening, closing) {
479
+ var rowDiff = selection.end.row - selection.start.row;
480
+ return {
481
+ text: opening + selected + closing,
482
+ selection: [
483
+ 0,
484
+ selection.start.column + 1,
485
+ rowDiff,
486
+ selection.end.column + (rowDiff ? 0 : 1)
487
+ ]
488
+ };
489
+ };
490
+
491
+ var CstyleBehaviour = function() {
492
+ this.add("braces", "insertion", function(state, action, editor, session, text) {
493
+ var cursor = editor.getCursorPosition();
494
+ var line = session.doc.getLine(cursor.row);
495
+ if (text == '{') {
496
+ initContext(editor);
497
+ var selection = editor.getSelectionRange();
498
+ var selected = session.doc.getTextRange(selection);
499
+ if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
500
+ return getWrapped(selection, selected, '{', '}');
501
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
502
+ if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
503
+ CstyleBehaviour.recordAutoInsert(editor, session, "}");
504
+ return {
505
+ text: '{}',
506
+ selection: [1, 1]
507
+ };
508
+ } else {
509
+ CstyleBehaviour.recordMaybeInsert(editor, session, "{");
510
+ return {
511
+ text: '{',
512
+ selection: [1, 1]
513
+ };
514
+ }
515
+ }
516
+ } else if (text == '}') {
517
+ initContext(editor);
518
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
519
+ if (rightChar == '}') {
520
+ var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
521
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
522
+ CstyleBehaviour.popAutoInsertedClosing();
523
+ return {
524
+ text: '',
525
+ selection: [1, 1]
526
+ };
527
+ }
528
+ }
529
+ } else if (text == "\n" || text == "\r\n") {
530
+ initContext(editor);
531
+ var closing = "";
532
+ if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
533
+ closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
534
+ CstyleBehaviour.clearMaybeInsertedClosing();
535
+ }
536
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
537
+ if (rightChar === '}') {
538
+ var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
539
+ if (!openBracePos)
540
+ return null;
541
+ var next_indent = this.$getIndent(session.getLine(openBracePos.row));
542
+ } else if (closing) {
543
+ var next_indent = this.$getIndent(line);
544
+ } else {
545
+ CstyleBehaviour.clearMaybeInsertedClosing();
546
+ return;
547
+ }
548
+ var indent = next_indent + session.getTabString();
549
+
550
+ return {
551
+ text: '\n' + indent + '\n' + next_indent + closing,
552
+ selection: [1, indent.length, 1, indent.length]
553
+ };
554
+ } else {
555
+ CstyleBehaviour.clearMaybeInsertedClosing();
556
+ }
557
+ });
558
+
559
+ this.add("braces", "deletion", function(state, action, editor, session, range) {
560
+ var selected = session.doc.getTextRange(range);
561
+ if (!range.isMultiLine() && selected == '{') {
562
+ initContext(editor);
563
+ var line = session.doc.getLine(range.start.row);
564
+ var rightChar = line.substring(range.end.column, range.end.column + 1);
565
+ if (rightChar == '}') {
566
+ range.end.column++;
567
+ return range;
568
+ } else {
569
+ context.maybeInsertedBrackets--;
570
+ }
571
+ }
572
+ });
573
+
574
+ this.add("parens", "insertion", function(state, action, editor, session, text) {
575
+ if (text == '(') {
576
+ initContext(editor);
577
+ var selection = editor.getSelectionRange();
578
+ var selected = session.doc.getTextRange(selection);
579
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
580
+ return getWrapped(selection, selected, '(', ')');
581
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
582
+ CstyleBehaviour.recordAutoInsert(editor, session, ")");
583
+ return {
584
+ text: '()',
585
+ selection: [1, 1]
586
+ };
587
+ }
588
+ } else if (text == ')') {
589
+ initContext(editor);
590
+ var cursor = editor.getCursorPosition();
591
+ var line = session.doc.getLine(cursor.row);
592
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
593
+ if (rightChar == ')') {
594
+ var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
595
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
596
+ CstyleBehaviour.popAutoInsertedClosing();
597
+ return {
598
+ text: '',
599
+ selection: [1, 1]
600
+ };
601
+ }
602
+ }
603
+ }
604
+ });
605
+
606
+ this.add("parens", "deletion", function(state, action, editor, session, range) {
607
+ var selected = session.doc.getTextRange(range);
608
+ if (!range.isMultiLine() && selected == '(') {
609
+ initContext(editor);
610
+ var line = session.doc.getLine(range.start.row);
611
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
612
+ if (rightChar == ')') {
613
+ range.end.column++;
614
+ return range;
615
+ }
616
+ }
617
+ });
618
+
619
+ this.add("brackets", "insertion", function(state, action, editor, session, text) {
620
+ if (text == '[') {
621
+ initContext(editor);
622
+ var selection = editor.getSelectionRange();
623
+ var selected = session.doc.getTextRange(selection);
624
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
625
+ return getWrapped(selection, selected, '[', ']');
626
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
627
+ CstyleBehaviour.recordAutoInsert(editor, session, "]");
628
+ return {
629
+ text: '[]',
630
+ selection: [1, 1]
631
+ };
632
+ }
633
+ } else if (text == ']') {
634
+ initContext(editor);
635
+ var cursor = editor.getCursorPosition();
636
+ var line = session.doc.getLine(cursor.row);
637
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
638
+ if (rightChar == ']') {
639
+ var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
640
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
641
+ CstyleBehaviour.popAutoInsertedClosing();
642
+ return {
643
+ text: '',
644
+ selection: [1, 1]
645
+ };
646
+ }
647
+ }
648
+ }
649
+ });
650
+
651
+ this.add("brackets", "deletion", function(state, action, editor, session, range) {
652
+ var selected = session.doc.getTextRange(range);
653
+ if (!range.isMultiLine() && selected == '[') {
654
+ initContext(editor);
655
+ var line = session.doc.getLine(range.start.row);
656
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
657
+ if (rightChar == ']') {
658
+ range.end.column++;
659
+ return range;
660
+ }
661
+ }
662
+ });
663
+
664
+ this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
665
+ if (text == '"' || text == "'") {
666
+ initContext(editor);
667
+ var quote = text;
668
+ var selection = editor.getSelectionRange();
669
+ var selected = session.doc.getTextRange(selection);
670
+ if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
671
+ return getWrapped(selection, selected, quote, quote);
672
+ } else if (!selected) {
673
+ var cursor = editor.getCursorPosition();
674
+ var line = session.doc.getLine(cursor.row);
675
+ var leftChar = line.substring(cursor.column-1, cursor.column);
676
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
677
+
678
+ var token = session.getTokenAt(cursor.row, cursor.column);
679
+ var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
680
+ if (leftChar == "\\" && token && /escape/.test(token.type))
681
+ return null;
682
+
683
+ var stringBefore = token && /string/.test(token.type);
684
+ var stringAfter = !rightToken || /string/.test(rightToken.type);
685
+
686
+ var pair;
687
+ if (rightChar == quote) {
688
+ pair = stringBefore !== stringAfter;
689
+ } else {
690
+ if (stringBefore && !stringAfter)
691
+ return null; // wrap string with different quote
692
+ if (stringBefore && stringAfter)
693
+ return null; // do not pair quotes inside strings
694
+ var wordRe = session.$mode.tokenRe;
695
+ wordRe.lastIndex = 0;
696
+ var isWordBefore = wordRe.test(leftChar);
697
+ wordRe.lastIndex = 0;
698
+ var isWordAfter = wordRe.test(leftChar);
699
+ if (isWordBefore || isWordAfter)
700
+ return null; // before or after alphanumeric
701
+ if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
702
+ return null; // there is rightChar and it isn't closing
703
+ pair = true;
704
+ }
705
+ return {
706
+ text: pair ? quote + quote : "",
707
+ selection: [1,1]
708
+ };
709
+ }
710
+ }
711
+ });
712
+
713
+ this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
714
+ var selected = session.doc.getTextRange(range);
715
+ if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
716
+ initContext(editor);
717
+ var line = session.doc.getLine(range.start.row);
718
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
719
+ if (rightChar == selected) {
720
+ range.end.column++;
721
+ return range;
722
+ }
723
+ }
724
+ });
725
+
726
+ };
727
+
728
+
729
+ CstyleBehaviour.isSaneInsertion = function(editor, session) {
730
+ var cursor = editor.getCursorPosition();
731
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
732
+ if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
733
+ var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
734
+ if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
735
+ return false;
736
+ }
737
+ iterator.stepForward();
738
+ return iterator.getCurrentTokenRow() !== cursor.row ||
739
+ this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
740
+ };
741
+
742
+ CstyleBehaviour.$matchTokenType = function(token, types) {
743
+ return types.indexOf(token.type || token) > -1;
744
+ };
745
+
746
+ CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
747
+ var cursor = editor.getCursorPosition();
748
+ var line = session.doc.getLine(cursor.row);
749
+ if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
750
+ context.autoInsertedBrackets = 0;
751
+ context.autoInsertedRow = cursor.row;
752
+ context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
753
+ context.autoInsertedBrackets++;
754
+ };
755
+
756
+ CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
757
+ var cursor = editor.getCursorPosition();
758
+ var line = session.doc.getLine(cursor.row);
759
+ if (!this.isMaybeInsertedClosing(cursor, line))
760
+ context.maybeInsertedBrackets = 0;
761
+ context.maybeInsertedRow = cursor.row;
762
+ context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
763
+ context.maybeInsertedLineEnd = line.substr(cursor.column);
764
+ context.maybeInsertedBrackets++;
765
+ };
766
+
767
+ CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
768
+ return context.autoInsertedBrackets > 0 &&
769
+ cursor.row === context.autoInsertedRow &&
770
+ bracket === context.autoInsertedLineEnd[0] &&
771
+ line.substr(cursor.column) === context.autoInsertedLineEnd;
772
+ };
773
+
774
+ CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
775
+ return context.maybeInsertedBrackets > 0 &&
776
+ cursor.row === context.maybeInsertedRow &&
777
+ line.substr(cursor.column) === context.maybeInsertedLineEnd &&
778
+ line.substr(0, cursor.column) == context.maybeInsertedLineStart;
779
+ };
780
+
781
+ CstyleBehaviour.popAutoInsertedClosing = function() {
782
+ context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
783
+ context.autoInsertedBrackets--;
784
+ };
785
+
786
+ CstyleBehaviour.clearMaybeInsertedClosing = function() {
787
+ if (context) {
788
+ context.maybeInsertedBrackets = 0;
789
+ context.maybeInsertedRow = -1;
790
+ }
791
+ };
792
+
793
+
794
+
795
+ oop.inherits(CstyleBehaviour, Behaviour);
796
+
797
+ exports.CstyleBehaviour = CstyleBehaviour;
798
+ });
799
+
800
+ define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
801
+ "use strict";
802
+
803
+ var oop = require("../../lib/oop");
804
+ var Range = require("../../range").Range;
805
+ var BaseFoldMode = require("./fold_mode").FoldMode;
806
+
807
+ var FoldMode = exports.FoldMode = function(commentRegex) {
808
+ if (commentRegex) {
809
+ this.foldingStartMarker = new RegExp(
810
+ this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
811
+ );
812
+ this.foldingStopMarker = new RegExp(
813
+ this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
814
+ );
815
+ }
816
+ };
817
+ oop.inherits(FoldMode, BaseFoldMode);
818
+
819
+ (function() {
820
+
821
+ this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
822
+ this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
823
+ this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
824
+ this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
825
+ this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
826
+ this._getFoldWidgetBase = this.getFoldWidget;
827
+ this.getFoldWidget = function(session, foldStyle, row) {
828
+ var line = session.getLine(row);
829
+
830
+ if (this.singleLineBlockCommentRe.test(line)) {
831
+ if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
832
+ return "";
833
+ }
834
+
835
+ var fw = this._getFoldWidgetBase(session, foldStyle, row);
836
+
837
+ if (!fw && this.startRegionRe.test(line))
838
+ return "start"; // lineCommentRegionStart
839
+
840
+ return fw;
841
+ };
842
+
843
+ this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
844
+ var line = session.getLine(row);
845
+
846
+ if (this.startRegionRe.test(line))
847
+ return this.getCommentRegionBlock(session, line, row);
848
+
849
+ var match = line.match(this.foldingStartMarker);
850
+ if (match) {
851
+ var i = match.index;
852
+
853
+ if (match[1])
854
+ return this.openingBracketBlock(session, match[1], row, i);
855
+
856
+ var range = session.getCommentFoldRange(row, i + match[0].length, 1);
857
+
858
+ if (range && !range.isMultiLine()) {
859
+ if (forceMultiline) {
860
+ range = this.getSectionRange(session, row);
861
+ } else if (foldStyle != "all")
862
+ range = null;
863
+ }
864
+
865
+ return range;
866
+ }
867
+
868
+ if (foldStyle === "markbegin")
869
+ return;
870
+
871
+ var match = line.match(this.foldingStopMarker);
872
+ if (match) {
873
+ var i = match.index + match[0].length;
874
+
875
+ if (match[1])
876
+ return this.closingBracketBlock(session, match[1], row, i);
877
+
878
+ return session.getCommentFoldRange(row, i, -1);
879
+ }
880
+ };
881
+
882
+ this.getSectionRange = function(session, row) {
883
+ var line = session.getLine(row);
884
+ var startIndent = line.search(/\S/);
885
+ var startRow = row;
886
+ var startColumn = line.length;
887
+ row = row + 1;
888
+ var endRow = row;
889
+ var maxRow = session.getLength();
890
+ while (++row < maxRow) {
891
+ line = session.getLine(row);
892
+ var indent = line.search(/\S/);
893
+ if (indent === -1)
894
+ continue;
895
+ if (startIndent > indent)
896
+ break;
897
+ var subRange = this.getFoldWidgetRange(session, "all", row);
898
+
899
+ if (subRange) {
900
+ if (subRange.start.row <= startRow) {
901
+ break;
902
+ } else if (subRange.isMultiLine()) {
903
+ row = subRange.end.row;
904
+ } else if (startIndent == indent) {
905
+ break;
906
+ }
907
+ }
908
+ endRow = row;
909
+ }
910
+
911
+ return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
912
+ };
913
+
914
+ this.getCommentRegionBlock = function(session, line, row) {
915
+ var startColumn = line.search(/\s*$/);
916
+ var maxRow = session.getLength();
917
+ var startRow = row;
918
+
919
+ var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
920
+ var depth = 1;
921
+ while (++row < maxRow) {
922
+ line = session.getLine(row);
923
+ var m = re.exec(line);
924
+ if (!m) continue;
925
+ if (m[1]) depth--;
926
+ else depth++;
927
+
928
+ if (!depth) break;
929
+ }
930
+
931
+ var endRow = row;
932
+ if (endRow > startRow) {
933
+ return new Range(startRow, startColumn, endRow, line.length);
934
+ }
935
+ };
936
+
937
+ }).call(FoldMode.prototype);
938
+
939
+ });
940
+
941
+ define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) {
942
+ "use strict";
943
+
944
+ var oop = require("../lib/oop");
945
+ var TextMode = require("./text").Mode;
946
+ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
947
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
948
+ var Range = require("../range").Range;
949
+ var WorkerClient = require("../worker/worker_client").WorkerClient;
950
+ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
951
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
952
+
953
+ var Mode = function() {
954
+ this.HighlightRules = JavaScriptHighlightRules;
955
+
956
+ this.$outdent = new MatchingBraceOutdent();
957
+ this.$behaviour = new CstyleBehaviour();
958
+ this.foldingRules = new CStyleFoldMode();
959
+ };
960
+ oop.inherits(Mode, TextMode);
961
+
962
+ (function() {
963
+
964
+ this.lineCommentStart = "//";
965
+ this.blockComment = {start: "/*", end: "*/"};
966
+
967
+ this.getNextLineIndent = function(state, line, tab) {
968
+ var indent = this.$getIndent(line);
969
+
970
+ var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
971
+ var tokens = tokenizedLine.tokens;
972
+ var endState = tokenizedLine.state;
973
+
974
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
975
+ return indent;
976
+ }
977
+
978
+ if (state == "start" || state == "no_regex") {
979
+ var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
980
+ if (match) {
981
+ indent += tab;
982
+ }
983
+ } else if (state == "doc-start") {
984
+ if (endState == "start" || endState == "no_regex") {
985
+ return "";
986
+ }
987
+ var match = line.match(/^\s*(\/?)\*/);
988
+ if (match) {
989
+ if (match[1]) {
990
+ indent += " ";
991
+ }
992
+ indent += "* ";
993
+ }
994
+ }
995
+
996
+ return indent;
997
+ };
998
+
999
+ this.checkOutdent = function(state, line, input) {
1000
+ return this.$outdent.checkOutdent(line, input);
1001
+ };
1002
+
1003
+ this.autoOutdent = function(state, doc, row) {
1004
+ this.$outdent.autoOutdent(doc, row);
1005
+ };
1006
+
1007
+ this.createWorker = function(session) {
1008
+ var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
1009
+ worker.attachToDocument(session.getDocument());
1010
+
1011
+ worker.on("annotate", function(results) {
1012
+ session.setAnnotations(results.data);
1013
+ });
1014
+
1015
+ worker.on("terminate", function() {
1016
+ session.clearAnnotations();
1017
+ });
1018
+
1019
+ return worker;
1020
+ };
1021
+
1022
+ this.$id = "ace/mode/javascript";
1023
+ }).call(Mode.prototype);
1024
+
1025
+ exports.Mode = Mode;
1026
+ });
1027
+
1028
+ define("ace/mode/css_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(require, exports, module) {
1029
+ "use strict";
1030
+
1031
+ var oop = require("../lib/oop");
1032
+ var lang = require("../lib/lang");
1033
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1034
+ var supportType = exports.supportType = "animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index";
1035
+ var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
1036
+ var supportConstant = exports.supportConstant = "absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero";
1037
+ var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow";
1038
+ var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|cursive|fantasy|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace";
1039
+
1040
+ var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
1041
+ var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
1042
+ var pseudoClasses = exports.pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
1043
+
1044
+ var CssHighlightRules = function() {
1045
+
1046
+ var keywordMapper = this.createKeywordMapper({
1047
+ "support.function": supportFunction,
1048
+ "support.constant": supportConstant,
1049
+ "support.type": supportType,
1050
+ "support.constant.color": supportConstantColor,
1051
+ "support.constant.fonts": supportConstantFonts
1052
+ }, "text", true);
1053
+
1054
+ this.$rules = {
1055
+ "start" : [{
1056
+ token : "comment", // multi line comment
1057
+ regex : "\\/\\*",
1058
+ push : "comment"
1059
+ }, {
1060
+ token: "paren.lparen",
1061
+ regex: "\\{",
1062
+ push: "ruleset"
1063
+ }, {
1064
+ token: "string",
1065
+ regex: "@.*?{",
1066
+ push: "media"
1067
+ }, {
1068
+ token: "keyword",
1069
+ regex: "#[a-z0-9-_]+"
1070
+ }, {
1071
+ token: "variable",
1072
+ regex: "\\.[a-z0-9-_]+"
1073
+ }, {
1074
+ token: "string",
1075
+ regex: ":[a-z0-9-_]+"
1076
+ }, {
1077
+ token: "constant",
1078
+ regex: "[a-z0-9-_]+"
1079
+ }, {
1080
+ caseInsensitive: true
1081
+ }],
1082
+
1083
+ "media" : [{
1084
+ token : "comment", // multi line comment
1085
+ regex : "\\/\\*",
1086
+ push : "comment"
1087
+ }, {
1088
+ token: "paren.lparen",
1089
+ regex: "\\{",
1090
+ push: "ruleset"
1091
+ }, {
1092
+ token: "string",
1093
+ regex: "\\}",
1094
+ next: "pop"
1095
+ }, {
1096
+ token: "keyword",
1097
+ regex: "#[a-z0-9-_]+"
1098
+ }, {
1099
+ token: "variable",
1100
+ regex: "\\.[a-z0-9-_]+"
1101
+ }, {
1102
+ token: "string",
1103
+ regex: ":[a-z0-9-_]+"
1104
+ }, {
1105
+ token: "constant",
1106
+ regex: "[a-z0-9-_]+"
1107
+ }, {
1108
+ caseInsensitive: true
1109
+ }],
1110
+
1111
+ "comment" : [{
1112
+ token : "comment",
1113
+ regex : "\\*\\/",
1114
+ next : "pop"
1115
+ }, {
1116
+ defaultToken : "comment"
1117
+ }],
1118
+
1119
+ "ruleset" : [
1120
+ {
1121
+ token : "paren.rparen",
1122
+ regex : "\\}",
1123
+ next: "pop"
1124
+ }, {
1125
+ token : "comment", // multi line comment
1126
+ regex : "\\/\\*",
1127
+ push : "comment"
1128
+ }, {
1129
+ token : "string", // single line
1130
+ regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
1131
+ }, {
1132
+ token : "string", // single line
1133
+ regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
1134
+ }, {
1135
+ token : ["constant.numeric", "keyword"],
1136
+ regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
1137
+ }, {
1138
+ token : "constant.numeric",
1139
+ regex : numRe
1140
+ }, {
1141
+ token : "constant.numeric", // hex6 color
1142
+ regex : "#[a-f0-9]{6}"
1143
+ }, {
1144
+ token : "constant.numeric", // hex3 color
1145
+ regex : "#[a-f0-9]{3}"
1146
+ }, {
1147
+ token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
1148
+ regex : pseudoElements
1149
+ }, {
1150
+ token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
1151
+ regex : pseudoClasses
1152
+ }, {
1153
+ token : ["support.function", "string", "support.function"],
1154
+ regex : "(url\\()(.*)(\\))"
1155
+ }, {
1156
+ token : keywordMapper,
1157
+ regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
1158
+ }, {
1159
+ caseInsensitive: true
1160
+ }]
1161
+ };
1162
+
1163
+ this.normalizeRules();
1164
+ };
1165
+
1166
+ oop.inherits(CssHighlightRules, TextHighlightRules);
1167
+
1168
+ exports.CssHighlightRules = CssHighlightRules;
1169
+
1170
+ });
1171
+
1172
+ define("ace/mode/behaviour/css",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/mode/behaviour/cstyle","ace/token_iterator"], function(require, exports, module) {
1173
+ "use strict";
1174
+
1175
+ var oop = require("../../lib/oop");
1176
+ var Behaviour = require("../behaviour").Behaviour;
1177
+ var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
1178
+ var TokenIterator = require("../../token_iterator").TokenIterator;
1179
+
1180
+ var CssBehaviour = function () {
1181
+
1182
+ this.inherit(CstyleBehaviour);
1183
+
1184
+ this.add("colon", "insertion", function (state, action, editor, session, text) {
1185
+ if (text === ':') {
1186
+ var cursor = editor.getCursorPosition();
1187
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
1188
+ var token = iterator.getCurrentToken();
1189
+ if (token && token.value.match(/\s+/)) {
1190
+ token = iterator.stepBackward();
1191
+ }
1192
+ if (token && token.type === 'support.type') {
1193
+ var line = session.doc.getLine(cursor.row);
1194
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1195
+ if (rightChar === ':') {
1196
+ return {
1197
+ text: '',
1198
+ selection: [1, 1]
1199
+ }
1200
+ }
1201
+ if (!line.substring(cursor.column).match(/^\s*;/)) {
1202
+ return {
1203
+ text: ':;',
1204
+ selection: [1, 1]
1205
+ }
1206
+ }
1207
+ }
1208
+ }
1209
+ });
1210
+
1211
+ this.add("colon", "deletion", function (state, action, editor, session, range) {
1212
+ var selected = session.doc.getTextRange(range);
1213
+ if (!range.isMultiLine() && selected === ':') {
1214
+ var cursor = editor.getCursorPosition();
1215
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
1216
+ var token = iterator.getCurrentToken();
1217
+ if (token && token.value.match(/\s+/)) {
1218
+ token = iterator.stepBackward();
1219
+ }
1220
+ if (token && token.type === 'support.type') {
1221
+ var line = session.doc.getLine(range.start.row);
1222
+ var rightChar = line.substring(range.end.column, range.end.column + 1);
1223
+ if (rightChar === ';') {
1224
+ range.end.column ++;
1225
+ return range;
1226
+ }
1227
+ }
1228
+ }
1229
+ });
1230
+
1231
+ this.add("semicolon", "insertion", function (state, action, editor, session, text) {
1232
+ if (text === ';') {
1233
+ var cursor = editor.getCursorPosition();
1234
+ var line = session.doc.getLine(cursor.row);
1235
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1236
+ if (rightChar === ';') {
1237
+ return {
1238
+ text: '',
1239
+ selection: [1, 1]
1240
+ }
1241
+ }
1242
+ }
1243
+ });
1244
+
1245
+ }
1246
+ oop.inherits(CssBehaviour, CstyleBehaviour);
1247
+
1248
+ exports.CssBehaviour = CssBehaviour;
1249
+ });
1250
+
1251
+ define("ace/mode/css",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/css_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/css","ace/mode/folding/cstyle"], function(require, exports, module) {
1252
+ "use strict";
1253
+
1254
+ var oop = require("../lib/oop");
1255
+ var TextMode = require("./text").Mode;
1256
+ var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
1257
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
1258
+ var WorkerClient = require("../worker/worker_client").WorkerClient;
1259
+ var CssBehaviour = require("./behaviour/css").CssBehaviour;
1260
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
1261
+
1262
+ var Mode = function() {
1263
+ this.HighlightRules = CssHighlightRules;
1264
+ this.$outdent = new MatchingBraceOutdent();
1265
+ this.$behaviour = new CssBehaviour();
1266
+ this.foldingRules = new CStyleFoldMode();
1267
+ };
1268
+ oop.inherits(Mode, TextMode);
1269
+
1270
+ (function() {
1271
+
1272
+ this.foldingRules = "cStyle";
1273
+ this.blockComment = {start: "/*", end: "*/"};
1274
+
1275
+ this.getNextLineIndent = function(state, line, tab) {
1276
+ var indent = this.$getIndent(line);
1277
+ var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
1278
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
1279
+ return indent;
1280
+ }
1281
+
1282
+ var match = line.match(/^.*\{\s*$/);
1283
+ if (match) {
1284
+ indent += tab;
1285
+ }
1286
+
1287
+ return indent;
1288
+ };
1289
+
1290
+ this.checkOutdent = function(state, line, input) {
1291
+ return this.$outdent.checkOutdent(line, input);
1292
+ };
1293
+
1294
+ this.autoOutdent = function(state, doc, row) {
1295
+ this.$outdent.autoOutdent(doc, row);
1296
+ };
1297
+
1298
+ this.createWorker = function(session) {
1299
+ var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
1300
+ worker.attachToDocument(session.getDocument());
1301
+
1302
+ worker.on("annotate", function(e) {
1303
+ session.setAnnotations(e.data);
1304
+ });
1305
+
1306
+ worker.on("terminate", function() {
1307
+ session.clearAnnotations();
1308
+ });
1309
+
1310
+ return worker;
1311
+ };
1312
+
1313
+ this.$id = "ace/mode/css";
1314
+ }).call(Mode.prototype);
1315
+
1316
+ exports.Mode = Mode;
1317
+
1318
+ });
1319
+
1320
+ define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
1321
+ "use strict";
1322
+
1323
+ var oop = require("../lib/oop");
1324
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1325
+
1326
+ var XmlHighlightRules = function(normalize) {
1327
+
1328
+ var tagRegex = "[a-zA-Z][-_a-zA-Z0-9]*";
1329
+
1330
+ this.$rules = {
1331
+ start : [
1332
+ {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"},
1333
+ {
1334
+ token : ["punctuation.xml-decl.xml", "keyword.xml-decl.xml"],
1335
+ regex : "(<\\?)(xml)(?=[\\s])", next : "xml_decl", caseInsensitive: true
1336
+ },
1337
+ {
1338
+ token : ["punctuation.instruction.xml", "keyword.instruction.xml"],
1339
+ regex : "(<\\?)(" + tagRegex + ")", next : "processing_instruction",
1340
+ },
1341
+ {token : "comment.xml", regex : "<\\!--", next : "comment"},
1342
+ {
1343
+ token : ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
1344
+ regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype", caseInsensitive: true
1345
+ },
1346
+ {include : "tag"},
1347
+ {token : "text.end-tag-open.xml", regex: "</"},
1348
+ {token : "text.tag-open.xml", regex: "<"},
1349
+ {include : "reference"},
1350
+ {defaultToken : "text.xml"}
1351
+ ],
1352
+
1353
+ xml_decl : [{
1354
+ token : "entity.other.attribute-name.decl-attribute-name.xml",
1355
+ regex : "(?:" + tagRegex + ":)?" + tagRegex + ""
1356
+ }, {
1357
+ token : "keyword.operator.decl-attribute-equals.xml",
1358
+ regex : "="
1359
+ }, {
1360
+ include: "whitespace"
1361
+ }, {
1362
+ include: "string"
1363
+ }, {
1364
+ token : "punctuation.xml-decl.xml",
1365
+ regex : "\\?>",
1366
+ next : "start"
1367
+ }],
1368
+
1369
+ processing_instruction : [
1370
+ {token : "punctuation.instruction.xml", regex : "\\?>", next : "start"},
1371
+ {defaultToken : "instruction.xml"}
1372
+ ],
1373
+
1374
+ doctype : [
1375
+ {include : "whitespace"},
1376
+ {include : "string"},
1377
+ {token : "xml-pe.doctype.xml", regex : ">", next : "start"},
1378
+ {token : "xml-pe.xml", regex : "[-_a-zA-Z0-9:]+"},
1379
+ {token : "punctuation.int-subset", regex : "\\[", push : "int_subset"}
1380
+ ],
1381
+
1382
+ int_subset : [{
1383
+ token : "text.xml",
1384
+ regex : "\\s+"
1385
+ }, {
1386
+ token: "punctuation.int-subset.xml",
1387
+ regex: "]",
1388
+ next: "pop"
1389
+ }, {
1390
+ token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
1391
+ regex : "(<\\!)(" + tagRegex + ")",
1392
+ push : [{
1393
+ token : "text",
1394
+ regex : "\\s+"
1395
+ },
1396
+ {
1397
+ token : "punctuation.markup-decl.xml",
1398
+ regex : ">",
1399
+ next : "pop"
1400
+ },
1401
+ {include : "string"}]
1402
+ }],
1403
+
1404
+ cdata : [
1405
+ {token : "string.cdata.xml", regex : "\\]\\]>", next : "start"},
1406
+ {token : "text.xml", regex : "\\s+"},
1407
+ {token : "text.xml", regex : "(?:[^\\]]|\\](?!\\]>))+"}
1408
+ ],
1409
+
1410
+ comment : [
1411
+ {token : "comment.xml", regex : "-->", next : "start"},
1412
+ {defaultToken : "comment.xml"}
1413
+ ],
1414
+
1415
+ reference : [{
1416
+ token : "constant.language.escape.reference.xml",
1417
+ regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
1418
+ }],
1419
+
1420
+ attr_reference : [{
1421
+ token : "constant.language.escape.reference.attribute-value.xml",
1422
+ regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
1423
+ }],
1424
+
1425
+ tag : [{
1426
+ token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
1427
+ regex : "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")",
1428
+ next: [
1429
+ {include : "attributes"},
1430
+ {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
1431
+ ]
1432
+ }],
1433
+
1434
+ tag_whitespace : [
1435
+ {token : "text.tag-whitespace.xml", regex : "\\s+"}
1436
+ ],
1437
+ whitespace : [
1438
+ {token : "text.whitespace.xml", regex : "\\s+"}
1439
+ ],
1440
+ string: [{
1441
+ token : "string.xml",
1442
+ regex : "'",
1443
+ push : [
1444
+ {token : "string.xml", regex: "'", next: "pop"},
1445
+ {defaultToken : "string.xml"}
1446
+ ]
1447
+ }, {
1448
+ token : "string.xml",
1449
+ regex : '"',
1450
+ push : [
1451
+ {token : "string.xml", regex: '"', next: "pop"},
1452
+ {defaultToken : "string.xml"}
1453
+ ]
1454
+ }],
1455
+
1456
+ attributes: [{
1457
+ token : "entity.other.attribute-name.xml",
1458
+ regex : "(?:" + tagRegex + ":)?" + tagRegex + ""
1459
+ }, {
1460
+ token : "keyword.operator.attribute-equals.xml",
1461
+ regex : "="
1462
+ }, {
1463
+ include: "tag_whitespace"
1464
+ }, {
1465
+ include: "attribute_value"
1466
+ }],
1467
+
1468
+ attribute_value: [{
1469
+ token : "string.attribute-value.xml",
1470
+ regex : "'",
1471
+ push : [
1472
+ {token : "string.attribute-value.xml", regex: "'", next: "pop"},
1473
+ {include : "attr_reference"},
1474
+ {defaultToken : "string.attribute-value.xml"}
1475
+ ]
1476
+ }, {
1477
+ token : "string.attribute-value.xml",
1478
+ regex : '"',
1479
+ push : [
1480
+ {token : "string.attribute-value.xml", regex: '"', next: "pop"},
1481
+ {include : "attr_reference"},
1482
+ {defaultToken : "string.attribute-value.xml"}
1483
+ ]
1484
+ }]
1485
+ };
1486
+
1487
+ if (this.constructor === XmlHighlightRules)
1488
+ this.normalizeRules();
1489
+ };
1490
+
1491
+
1492
+ (function() {
1493
+
1494
+ this.embedTagRules = function(HighlightRules, prefix, tag){
1495
+ this.$rules.tag.unshift({
1496
+ token : ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
1497
+ regex : "(<)(" + tag + "(?=\\s|>|$))",
1498
+ next: [
1499
+ {include : "attributes"},
1500
+ {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : prefix + "start"}
1501
+ ]
1502
+ });
1503
+
1504
+ this.$rules[tag + "-end"] = [
1505
+ {include : "attributes"},
1506
+ {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next: "start",
1507
+ onMatch : function(value, currentState, stack) {
1508
+ stack.splice(0);
1509
+ return this.token;
1510
+ }}
1511
+ ]
1512
+
1513
+ this.embedRules(HighlightRules, prefix, [{
1514
+ token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
1515
+ regex : "(</)(" + tag + "(?=\\s|>|$))",
1516
+ next: tag + "-end"
1517
+ }, {
1518
+ token: "string.cdata.xml",
1519
+ regex : "<\\!\\[CDATA\\["
1520
+ }, {
1521
+ token: "string.cdata.xml",
1522
+ regex : "\\]\\]>"
1523
+ }]);
1524
+ };
1525
+
1526
+ }).call(TextHighlightRules.prototype);
1527
+
1528
+ oop.inherits(XmlHighlightRules, TextHighlightRules);
1529
+
1530
+ exports.XmlHighlightRules = XmlHighlightRules;
1531
+ });
1532
+
1533
+ define("ace/mode/html_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/css_highlight_rules","ace/mode/javascript_highlight_rules","ace/mode/xml_highlight_rules"], function(require, exports, module) {
1534
+ "use strict";
1535
+
1536
+ var oop = require("../lib/oop");
1537
+ var lang = require("../lib/lang");
1538
+ var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
1539
+ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
1540
+ var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
1541
+
1542
+ var tagMap = lang.createMap({
1543
+ a : 'anchor',
1544
+ button : 'form',
1545
+ form : 'form',
1546
+ img : 'image',
1547
+ input : 'form',
1548
+ label : 'form',
1549
+ option : 'form',
1550
+ script : 'script',
1551
+ select : 'form',
1552
+ textarea : 'form',
1553
+ style : 'style',
1554
+ table : 'table',
1555
+ tbody : 'table',
1556
+ td : 'table',
1557
+ tfoot : 'table',
1558
+ th : 'table',
1559
+ tr : 'table'
1560
+ });
1561
+
1562
+ var HtmlHighlightRules = function() {
1563
+ XmlHighlightRules.call(this);
1564
+
1565
+ this.addRules({
1566
+ attributes: [{
1567
+ include : "tag_whitespace"
1568
+ }, {
1569
+ token : "entity.other.attribute-name.xml",
1570
+ regex : "[-_a-zA-Z0-9:]+"
1571
+ }, {
1572
+ token : "keyword.operator.attribute-equals.xml",
1573
+ regex : "=",
1574
+ push : [{
1575
+ include: "tag_whitespace"
1576
+ }, {
1577
+ token : "string.unquoted.attribute-value.html",
1578
+ regex : "[^<>='\"`\\s]+",
1579
+ next : "pop"
1580
+ }, {
1581
+ token : "empty",
1582
+ regex : "",
1583
+ next : "pop"
1584
+ }]
1585
+ }, {
1586
+ include : "attribute_value"
1587
+ }],
1588
+ tag: [{
1589
+ token : function(start, tag) {
1590
+ var group = tagMap[tag];
1591
+ return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
1592
+ "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
1593
+ },
1594
+ regex : "(</?)([-_a-zA-Z0-9:]+)",
1595
+ next: "tag_stuff"
1596
+ }],
1597
+ tag_stuff: [
1598
+ {include : "attributes"},
1599
+ {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
1600
+ ],
1601
+ });
1602
+
1603
+ this.embedTagRules(CssHighlightRules, "css-", "style");
1604
+ this.embedTagRules(JavaScriptHighlightRules, "js-", "script");
1605
+
1606
+ if (this.constructor === HtmlHighlightRules)
1607
+ this.normalizeRules();
1608
+ };
1609
+
1610
+ oop.inherits(HtmlHighlightRules, XmlHighlightRules);
1611
+
1612
+ exports.HtmlHighlightRules = HtmlHighlightRules;
1613
+ });
1614
+
1615
+ define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module) {
1616
+ "use strict";
1617
+
1618
+ var oop = require("../../lib/oop");
1619
+ var Behaviour = require("../behaviour").Behaviour;
1620
+ var TokenIterator = require("../../token_iterator").TokenIterator;
1621
+ var lang = require("../../lib/lang");
1622
+
1623
+ function is(token, type) {
1624
+ return token.type.lastIndexOf(type + ".xml") > -1;
1625
+ }
1626
+
1627
+ var XmlBehaviour = function () {
1628
+
1629
+ this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
1630
+ if (text == '"' || text == "'") {
1631
+ var quote = text;
1632
+ var selected = session.doc.getTextRange(editor.getSelectionRange());
1633
+ if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
1634
+ return {
1635
+ text: quote + selected + quote,
1636
+ selection: false
1637
+ };
1638
+ }
1639
+
1640
+ var cursor = editor.getCursorPosition();
1641
+ var line = session.doc.getLine(cursor.row);
1642
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1643
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
1644
+ var token = iterator.getCurrentToken();
1645
+
1646
+ if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) {
1647
+ return {
1648
+ text: "",
1649
+ selection: [1, 1]
1650
+ };
1651
+ }
1652
+
1653
+ if (!token)
1654
+ token = iterator.stepBackward();
1655
+
1656
+ if (!token)
1657
+ return;
1658
+
1659
+ while (is(token, "tag-whitespace") || is(token, "whitespace")) {
1660
+ token = iterator.stepBackward();
1661
+ }
1662
+ var rightSpace = !rightChar || rightChar.match(/\s/);
1663
+ if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) {
1664
+ return {
1665
+ text: quote + quote,
1666
+ selection: [1, 1]
1667
+ };
1668
+ }
1669
+ }
1670
+ });
1671
+
1672
+ this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
1673
+ var selected = session.doc.getTextRange(range);
1674
+ if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
1675
+ var line = session.doc.getLine(range.start.row);
1676
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
1677
+ if (rightChar == selected) {
1678
+ range.end.column++;
1679
+ return range;
1680
+ }
1681
+ }
1682
+ });
1683
+
1684
+ this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
1685
+ if (text == '>') {
1686
+ var position = editor.getCursorPosition();
1687
+ var iterator = new TokenIterator(session, position.row, position.column);
1688
+ var token = iterator.getCurrentToken() || iterator.stepBackward();
1689
+ if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value")))
1690
+ return;
1691
+ if (is(token, "reference.attribute-value"))
1692
+ return;
1693
+ if (is(token, "attribute-value")) {
1694
+ var firstChar = token.value.charAt(0);
1695
+ if (firstChar == '"' || firstChar == "'") {
1696
+ var lastChar = token.value.charAt(token.value.length - 1);
1697
+ var tokenEnd = iterator.getCurrentTokenColumn() + token.value.length;
1698
+ if (tokenEnd > position.column || tokenEnd == position.column && firstChar != lastChar)
1699
+ return;
1700
+ }
1701
+ }
1702
+ while (!is(token, "tag-name")) {
1703
+ token = iterator.stepBackward();
1704
+ }
1705
+
1706
+ var tokenRow = iterator.getCurrentTokenRow();
1707
+ var tokenColumn = iterator.getCurrentTokenColumn();
1708
+ if (is(iterator.stepBackward(), "end-tag-open"))
1709
+ return;
1710
+
1711
+ var element = token.value;
1712
+ if (tokenRow == position.row)
1713
+ element = element.substring(0, position.column - tokenColumn);
1714
+
1715
+ if (this.voidElements.hasOwnProperty(element.toLowerCase()))
1716
+ return;
1717
+
1718
+ return {
1719
+ text: ">" + "</" + element + ">",
1720
+ selection: [1, 1]
1721
+ };
1722
+ }
1723
+ });
1724
+
1725
+ this.add("autoindent", "insertion", function (state, action, editor, session, text) {
1726
+ if (text == "\n") {
1727
+ var cursor = editor.getCursorPosition();
1728
+ var line = session.getLine(cursor.row);
1729
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
1730
+ var token = iterator.getCurrentToken();
1731
+
1732
+ if (token && token.type.indexOf("tag-close") !== -1) {
1733
+ if (token.value == "/>")
1734
+ return;
1735
+ while (token && token.type.indexOf("tag-name") === -1) {
1736
+ token = iterator.stepBackward();
1737
+ }
1738
+
1739
+ if (!token) {
1740
+ return;
1741
+ }
1742
+
1743
+ var tag = token.value;
1744
+ var row = iterator.getCurrentTokenRow();
1745
+ token = iterator.stepBackward();
1746
+ if (!token || token.type.indexOf("end-tag") !== -1) {
1747
+ return;
1748
+ }
1749
+
1750
+ if (this.voidElements && !this.voidElements[tag]) {
1751
+ var nextToken = session.getTokenAt(cursor.row, cursor.column+1);
1752
+ var line = session.getLine(row);
1753
+ var nextIndent = this.$getIndent(line);
1754
+ var indent = nextIndent + session.getTabString();
1755
+
1756
+ if (nextToken && nextToken.value === "</") {
1757
+ return {
1758
+ text: "\n" + indent + "\n" + nextIndent,
1759
+ selection: [1, indent.length, 1, indent.length]
1760
+ };
1761
+ } else {
1762
+ return {
1763
+ text: "\n" + indent
1764
+ };
1765
+ }
1766
+ }
1767
+ }
1768
+ }
1769
+ });
1770
+
1771
+ };
1772
+
1773
+ oop.inherits(XmlBehaviour, Behaviour);
1774
+
1775
+ exports.XmlBehaviour = XmlBehaviour;
1776
+ });
1777
+
1778
+ define("ace/mode/folding/mixed",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"], function(require, exports, module) {
1779
+ "use strict";
1780
+
1781
+ var oop = require("../../lib/oop");
1782
+ var BaseFoldMode = require("./fold_mode").FoldMode;
1783
+
1784
+ var FoldMode = exports.FoldMode = function(defaultMode, subModes) {
1785
+ this.defaultMode = defaultMode;
1786
+ this.subModes = subModes;
1787
+ };
1788
+ oop.inherits(FoldMode, BaseFoldMode);
1789
+
1790
+ (function() {
1791
+
1792
+
1793
+ this.$getMode = function(state) {
1794
+ if (typeof state != "string")
1795
+ state = state[0];
1796
+ for (var key in this.subModes) {
1797
+ if (state.indexOf(key) === 0)
1798
+ return this.subModes[key];
1799
+ }
1800
+ return null;
1801
+ };
1802
+
1803
+ this.$tryMode = function(state, session, foldStyle, row) {
1804
+ var mode = this.$getMode(state);
1805
+ return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
1806
+ };
1807
+
1808
+ this.getFoldWidget = function(session, foldStyle, row) {
1809
+ return (
1810
+ this.$tryMode(session.getState(row-1), session, foldStyle, row) ||
1811
+ this.$tryMode(session.getState(row), session, foldStyle, row) ||
1812
+ this.defaultMode.getFoldWidget(session, foldStyle, row)
1813
+ );
1814
+ };
1815
+
1816
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
1817
+ var mode = this.$getMode(session.getState(row-1));
1818
+
1819
+ if (!mode || !mode.getFoldWidget(session, foldStyle, row))
1820
+ mode = this.$getMode(session.getState(row));
1821
+
1822
+ if (!mode || !mode.getFoldWidget(session, foldStyle, row))
1823
+ mode = this.defaultMode;
1824
+
1825
+ return mode.getFoldWidgetRange(session, foldStyle, row);
1826
+ };
1827
+
1828
+ }).call(FoldMode.prototype);
1829
+
1830
+ });
1831
+
1832
+ define("ace/mode/folding/xml",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/range","ace/mode/folding/fold_mode","ace/token_iterator"], function(require, exports, module) {
1833
+ "use strict";
1834
+
1835
+ var oop = require("../../lib/oop");
1836
+ var lang = require("../../lib/lang");
1837
+ var Range = require("../../range").Range;
1838
+ var BaseFoldMode = require("./fold_mode").FoldMode;
1839
+ var TokenIterator = require("../../token_iterator").TokenIterator;
1840
+
1841
+ var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
1842
+ BaseFoldMode.call(this);
1843
+ this.voidElements = voidElements || {};
1844
+ this.optionalEndTags = oop.mixin({}, this.voidElements);
1845
+ if (optionalEndTags)
1846
+ oop.mixin(this.optionalEndTags, optionalEndTags);
1847
+
1848
+ };
1849
+ oop.inherits(FoldMode, BaseFoldMode);
1850
+
1851
+ var Tag = function() {
1852
+ this.tagName = "";
1853
+ this.closing = false;
1854
+ this.selfClosing = false;
1855
+ this.start = {row: 0, column: 0};
1856
+ this.end = {row: 0, column: 0};
1857
+ };
1858
+
1859
+ function is(token, type) {
1860
+ return token.type.lastIndexOf(type + ".xml") > -1;
1861
+ }
1862
+
1863
+ (function() {
1864
+
1865
+ this.getFoldWidget = function(session, foldStyle, row) {
1866
+ var tag = this._getFirstTagInLine(session, row);
1867
+
1868
+ if (!tag)
1869
+ return "";
1870
+
1871
+ if (tag.closing || (!tag.tagName && tag.selfClosing))
1872
+ return foldStyle == "markbeginend" ? "end" : "";
1873
+
1874
+ if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase()))
1875
+ return "";
1876
+
1877
+ if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column))
1878
+ return "";
1879
+
1880
+ return "start";
1881
+ };
1882
+ this._getFirstTagInLine = function(session, row) {
1883
+ var tokens = session.getTokens(row);
1884
+ var tag = new Tag();
1885
+
1886
+ for (var i = 0; i < tokens.length; i++) {
1887
+ var token = tokens[i];
1888
+ if (is(token, "tag-open")) {
1889
+ tag.end.column = tag.start.column + token.value.length;
1890
+ tag.closing = is(token, "end-tag-open");
1891
+ token = tokens[++i];
1892
+ if (!token)
1893
+ return null;
1894
+ tag.tagName = token.value;
1895
+ tag.end.column += token.value.length;
1896
+ for (i++; i < tokens.length; i++) {
1897
+ token = tokens[i];
1898
+ tag.end.column += token.value.length;
1899
+ if (is(token, "tag-close")) {
1900
+ tag.selfClosing = token.value == '/>';
1901
+ break;
1902
+ }
1903
+ }
1904
+ return tag;
1905
+ } else if (is(token, "tag-close")) {
1906
+ tag.selfClosing = token.value == '/>';
1907
+ return tag;
1908
+ }
1909
+ tag.start.column += token.value.length;
1910
+ }
1911
+
1912
+ return null;
1913
+ };
1914
+
1915
+ this._findEndTagInLine = function(session, row, tagName, startColumn) {
1916
+ var tokens = session.getTokens(row);
1917
+ var column = 0;
1918
+ for (var i = 0; i < tokens.length; i++) {
1919
+ var token = tokens[i];
1920
+ column += token.value.length;
1921
+ if (column < startColumn)
1922
+ continue;
1923
+ if (is(token, "end-tag-open")) {
1924
+ token = tokens[i + 1];
1925
+ if (token && token.value == tagName)
1926
+ return true;
1927
+ }
1928
+ }
1929
+ return false;
1930
+ };
1931
+ this._readTagForward = function(iterator) {
1932
+ var token = iterator.getCurrentToken();
1933
+ if (!token)
1934
+ return null;
1935
+
1936
+ var tag = new Tag();
1937
+ do {
1938
+ if (is(token, "tag-open")) {
1939
+ tag.closing = is(token, "end-tag-open");
1940
+ tag.start.row = iterator.getCurrentTokenRow();
1941
+ tag.start.column = iterator.getCurrentTokenColumn();
1942
+ } else if (is(token, "tag-name")) {
1943
+ tag.tagName = token.value;
1944
+ } else if (is(token, "tag-close")) {
1945
+ tag.selfClosing = token.value == "/>";
1946
+ tag.end.row = iterator.getCurrentTokenRow();
1947
+ tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
1948
+ iterator.stepForward();
1949
+ return tag;
1950
+ }
1951
+ } while(token = iterator.stepForward());
1952
+
1953
+ return null;
1954
+ };
1955
+
1956
+ this._readTagBackward = function(iterator) {
1957
+ var token = iterator.getCurrentToken();
1958
+ if (!token)
1959
+ return null;
1960
+
1961
+ var tag = new Tag();
1962
+ do {
1963
+ if (is(token, "tag-open")) {
1964
+ tag.closing = is(token, "end-tag-open");
1965
+ tag.start.row = iterator.getCurrentTokenRow();
1966
+ tag.start.column = iterator.getCurrentTokenColumn();
1967
+ iterator.stepBackward();
1968
+ return tag;
1969
+ } else if (is(token, "tag-name")) {
1970
+ tag.tagName = token.value;
1971
+ } else if (is(token, "tag-close")) {
1972
+ tag.selfClosing = token.value == "/>";
1973
+ tag.end.row = iterator.getCurrentTokenRow();
1974
+ tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
1975
+ }
1976
+ } while(token = iterator.stepBackward());
1977
+
1978
+ return null;
1979
+ };
1980
+
1981
+ this._pop = function(stack, tag) {
1982
+ while (stack.length) {
1983
+
1984
+ var top = stack[stack.length-1];
1985
+ if (!tag || top.tagName == tag.tagName) {
1986
+ return stack.pop();
1987
+ }
1988
+ else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
1989
+ stack.pop();
1990
+ continue;
1991
+ } else {
1992
+ return null;
1993
+ }
1994
+ }
1995
+ };
1996
+
1997
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
1998
+ var firstTag = this._getFirstTagInLine(session, row);
1999
+
2000
+ if (!firstTag)
2001
+ return null;
2002
+
2003
+ var isBackward = firstTag.closing || firstTag.selfClosing;
2004
+ var stack = [];
2005
+ var tag;
2006
+
2007
+ if (!isBackward) {
2008
+ var iterator = new TokenIterator(session, row, firstTag.start.column);
2009
+ var start = {
2010
+ row: row,
2011
+ column: firstTag.start.column + firstTag.tagName.length + 2
2012
+ };
2013
+ if (firstTag.start.row == firstTag.end.row)
2014
+ start.column = firstTag.end.column;
2015
+ while (tag = this._readTagForward(iterator)) {
2016
+ if (tag.selfClosing) {
2017
+ if (!stack.length) {
2018
+ tag.start.column += tag.tagName.length + 2;
2019
+ tag.end.column -= 2;
2020
+ return Range.fromPoints(tag.start, tag.end);
2021
+ } else
2022
+ continue;
2023
+ }
2024
+
2025
+ if (tag.closing) {
2026
+ this._pop(stack, tag);
2027
+ if (stack.length == 0)
2028
+ return Range.fromPoints(start, tag.start);
2029
+ }
2030
+ else {
2031
+ stack.push(tag);
2032
+ }
2033
+ }
2034
+ }
2035
+ else {
2036
+ var iterator = new TokenIterator(session, row, firstTag.end.column);
2037
+ var end = {
2038
+ row: row,
2039
+ column: firstTag.start.column
2040
+ };
2041
+
2042
+ while (tag = this._readTagBackward(iterator)) {
2043
+ if (tag.selfClosing) {
2044
+ if (!stack.length) {
2045
+ tag.start.column += tag.tagName.length + 2;
2046
+ tag.end.column -= 2;
2047
+ return Range.fromPoints(tag.start, tag.end);
2048
+ } else
2049
+ continue;
2050
+ }
2051
+
2052
+ if (!tag.closing) {
2053
+ this._pop(stack, tag);
2054
+ if (stack.length == 0) {
2055
+ tag.start.column += tag.tagName.length + 2;
2056
+ if (tag.start.row == tag.end.row && tag.start.column < tag.end.column)
2057
+ tag.start.column = tag.end.column;
2058
+ return Range.fromPoints(tag.start, end);
2059
+ }
2060
+ }
2061
+ else {
2062
+ stack.push(tag);
2063
+ }
2064
+ }
2065
+ }
2066
+
2067
+ };
2068
+
2069
+ }).call(FoldMode.prototype);
2070
+
2071
+ });
2072
+
2073
+ define("ace/mode/folding/html",["require","exports","module","ace/lib/oop","ace/mode/folding/mixed","ace/mode/folding/xml","ace/mode/folding/cstyle"], function(require, exports, module) {
2074
+ "use strict";
2075
+
2076
+ var oop = require("../../lib/oop");
2077
+ var MixedFoldMode = require("./mixed").FoldMode;
2078
+ var XmlFoldMode = require("./xml").FoldMode;
2079
+ var CStyleFoldMode = require("./cstyle").FoldMode;
2080
+
2081
+ var FoldMode = exports.FoldMode = function(voidElements, optionalTags) {
2082
+ MixedFoldMode.call(this, new XmlFoldMode(voidElements, optionalTags), {
2083
+ "js-": new CStyleFoldMode(),
2084
+ "css-": new CStyleFoldMode()
2085
+ });
2086
+ };
2087
+
2088
+ oop.inherits(FoldMode, MixedFoldMode);
2089
+
2090
+ });
2091
+
2092
+ define("ace/mode/html_completions",["require","exports","module","ace/token_iterator"], function(require, exports, module) {
2093
+ "use strict";
2094
+
2095
+ var TokenIterator = require("../token_iterator").TokenIterator;
2096
+
2097
+ var commonAttributes = [
2098
+ "accesskey",
2099
+ "class",
2100
+ "contenteditable",
2101
+ "contextmenu",
2102
+ "dir",
2103
+ "draggable",
2104
+ "dropzone",
2105
+ "hidden",
2106
+ "id",
2107
+ "inert",
2108
+ "itemid",
2109
+ "itemprop",
2110
+ "itemref",
2111
+ "itemscope",
2112
+ "itemtype",
2113
+ "lang",
2114
+ "spellcheck",
2115
+ "style",
2116
+ "tabindex",
2117
+ "title",
2118
+ "translate"
2119
+ ];
2120
+
2121
+ var eventAttributes = [
2122
+ "onabort",
2123
+ "onblur",
2124
+ "oncancel",
2125
+ "oncanplay",
2126
+ "oncanplaythrough",
2127
+ "onchange",
2128
+ "onclick",
2129
+ "onclose",
2130
+ "oncontextmenu",
2131
+ "oncuechange",
2132
+ "ondblclick",
2133
+ "ondrag",
2134
+ "ondragend",
2135
+ "ondragenter",
2136
+ "ondragleave",
2137
+ "ondragover",
2138
+ "ondragstart",
2139
+ "ondrop",
2140
+ "ondurationchange",
2141
+ "onemptied",
2142
+ "onended",
2143
+ "onerror",
2144
+ "onfocus",
2145
+ "oninput",
2146
+ "oninvalid",
2147
+ "onkeydown",
2148
+ "onkeypress",
2149
+ "onkeyup",
2150
+ "onload",
2151
+ "onloadeddata",
2152
+ "onloadedmetadata",
2153
+ "onloadstart",
2154
+ "onmousedown",
2155
+ "onmousemove",
2156
+ "onmouseout",
2157
+ "onmouseover",
2158
+ "onmouseup",
2159
+ "onmousewheel",
2160
+ "onpause",
2161
+ "onplay",
2162
+ "onplaying",
2163
+ "onprogress",
2164
+ "onratechange",
2165
+ "onreset",
2166
+ "onscroll",
2167
+ "onseeked",
2168
+ "onseeking",
2169
+ "onselect",
2170
+ "onshow",
2171
+ "onstalled",
2172
+ "onsubmit",
2173
+ "onsuspend",
2174
+ "ontimeupdate",
2175
+ "onvolumechange",
2176
+ "onwaiting"
2177
+ ];
2178
+
2179
+ var globalAttributes = commonAttributes.concat(eventAttributes);
2180
+
2181
+ var attributeMap = {
2182
+ "html": ["manifest"],
2183
+ "head": [],
2184
+ "title": [],
2185
+ "base": ["href", "target"],
2186
+ "link": ["href", "hreflang", "rel", "media", "type", "sizes"],
2187
+ "meta": ["http-equiv", "name", "content", "charset"],
2188
+ "style": ["type", "media", "scoped"],
2189
+ "script": ["charset", "type", "src", "defer", "async"],
2190
+ "noscript": ["href"],
2191
+ "body": ["onafterprint", "onbeforeprint", "onbeforeunload", "onhashchange", "onmessage", "onoffline", "onpopstate", "onredo", "onresize", "onstorage", "onundo", "onunload"],
2192
+ "section": [],
2193
+ "nav": [],
2194
+ "article": ["pubdate"],
2195
+ "aside": [],
2196
+ "h1": [],
2197
+ "h2": [],
2198
+ "h3": [],
2199
+ "h4": [],
2200
+ "h5": [],
2201
+ "h6": [],
2202
+ "header": [],
2203
+ "footer": [],
2204
+ "address": [],
2205
+ "main": [],
2206
+ "p": [],
2207
+ "hr": [],
2208
+ "pre": [],
2209
+ "blockquote": ["cite"],
2210
+ "ol": ["start", "reversed"],
2211
+ "ul": [],
2212
+ "li": ["value"],
2213
+ "dl": [],
2214
+ "dt": [],
2215
+ "dd": [],
2216
+ "figure": [],
2217
+ "figcaption": [],
2218
+ "div": [],
2219
+ "a": ["href", "target", "ping", "rel", "media", "hreflang", "type"],
2220
+ "em": [],
2221
+ "strong": [],
2222
+ "small": [],
2223
+ "s": [],
2224
+ "cite": [],
2225
+ "q": ["cite"],
2226
+ "dfn": [],
2227
+ "abbr": [],
2228
+ "data": [],
2229
+ "time": ["datetime"],
2230
+ "code": [],
2231
+ "var": [],
2232
+ "samp": [],
2233
+ "kbd": [],
2234
+ "sub": [],
2235
+ "sup": [],
2236
+ "i": [],
2237
+ "b": [],
2238
+ "u": [],
2239
+ "mark": [],
2240
+ "ruby": [],
2241
+ "rt": [],
2242
+ "rp": [],
2243
+ "bdi": [],
2244
+ "bdo": [],
2245
+ "span": [],
2246
+ "br": [],
2247
+ "wbr": [],
2248
+ "ins": ["cite", "datetime"],
2249
+ "del": ["cite", "datetime"],
2250
+ "img": ["alt", "src", "height", "width", "usemap", "ismap"],
2251
+ "iframe": ["name", "src", "height", "width", "sandbox", "seamless"],
2252
+ "embed": ["src", "height", "width", "type"],
2253
+ "object": ["param", "data", "type", "height" , "width", "usemap", "name", "form", "classid"],
2254
+ "param": ["name", "value"],
2255
+ "video": ["src", "autobuffer", "autoplay", "loop", "controls", "width", "height", "poster"],
2256
+ "audio": ["src", "autobuffer", "autoplay", "loop", "controls"],
2257
+ "source": ["src", "type", "media"],
2258
+ "track": ["kind", "src", "srclang", "label", "default"],
2259
+ "canvas": ["width", "height"],
2260
+ "map": ["name"],
2261
+ "area": ["shape", "coords", "href", "hreflang", "alt", "target", "media", "rel", "ping", "type"],
2262
+ "svg": [],
2263
+ "math": [],
2264
+ "table": ["summary"],
2265
+ "caption": [],
2266
+ "colgroup": ["span"],
2267
+ "col": ["span"],
2268
+ "tbody": [],
2269
+ "thead": [],
2270
+ "tfoot": [],
2271
+ "tr": [],
2272
+ "td": ["headers", "rowspan", "colspan"],
2273
+ "th": ["headers", "rowspan", "colspan", "scope"],
2274
+ "form": ["accept-charset", "action", "autocomplete", "enctype", "method", "name", "novalidate", "target"],
2275
+ "fieldset": ["disabled", "form", "name"],
2276
+ "legend": [],
2277
+ "label": ["form", "for"],
2278
+ "input": ["type", "accept", "alt", "autocomplete", "checked", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "height", "list", "max", "maxlength", "min", "multiple", "pattern", "placeholder", "readonly", "required", "size", "src", "step", "width", "files", "value"],
2279
+ "button": ["autofocus", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "name", "value", "type"],
2280
+ "select": ["autofocus", "disabled", "form", "multiple", "name", "size"],
2281
+ "datalist": [],
2282
+ "optgroup": ["disabled", "label"],
2283
+ "option": ["disabled", "selected", "label", "value"],
2284
+ "textarea": ["autofocus", "disabled", "form", "maxlength", "name", "placeholder", "readonly", "required", "rows", "cols", "wrap"],
2285
+ "keygen": ["autofocus", "challenge", "disabled", "form", "keytype", "name"],
2286
+ "output": ["for", "form", "name"],
2287
+ "progress": ["value", "max"],
2288
+ "meter": ["value", "min", "max", "low", "high", "optimum"],
2289
+ "details": ["open"],
2290
+ "summary": [],
2291
+ "command": ["type", "label", "icon", "disabled", "checked", "radiogroup", "command"],
2292
+ "menu": ["type", "label"],
2293
+ "dialog": ["open"]
2294
+ };
2295
+
2296
+ var elements = Object.keys(attributeMap);
2297
+
2298
+ function is(token, type) {
2299
+ return token.type.lastIndexOf(type + ".xml") > -1;
2300
+ }
2301
+
2302
+ function findTagName(session, pos) {
2303
+ var iterator = new TokenIterator(session, pos.row, pos.column);
2304
+ var token = iterator.getCurrentToken();
2305
+ while (token && !is(token, "tag-name")){
2306
+ token = iterator.stepBackward();
2307
+ }
2308
+ if (token)
2309
+ return token.value;
2310
+ }
2311
+
2312
+ var HtmlCompletions = function() {
2313
+
2314
+ };
2315
+
2316
+ (function() {
2317
+
2318
+ this.getCompletions = function(state, session, pos, prefix) {
2319
+ var token = session.getTokenAt(pos.row, pos.column);
2320
+
2321
+ if (!token)
2322
+ return [];
2323
+ if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open"))
2324
+ return this.getTagCompletions(state, session, pos, prefix);
2325
+ if (is(token, "tag-whitespace") || is(token, "attribute-name"))
2326
+ return this.getAttributeCompetions(state, session, pos, prefix);
2327
+
2328
+ return [];
2329
+ };
2330
+
2331
+ this.getTagCompletions = function(state, session, pos, prefix) {
2332
+ return elements.map(function(element){
2333
+ return {
2334
+ value: element,
2335
+ meta: "tag",
2336
+ score: Number.MAX_VALUE
2337
+ };
2338
+ });
2339
+ };
2340
+
2341
+ this.getAttributeCompetions = function(state, session, pos, prefix) {
2342
+ var tagName = findTagName(session, pos);
2343
+ if (!tagName)
2344
+ return [];
2345
+ var attributes = globalAttributes;
2346
+ if (tagName in attributeMap) {
2347
+ attributes = attributes.concat(attributeMap[tagName]);
2348
+ }
2349
+ return attributes.map(function(attribute){
2350
+ return {
2351
+ caption: attribute,
2352
+ snippet: attribute + '="$0"',
2353
+ meta: "attribute",
2354
+ score: Number.MAX_VALUE
2355
+ };
2356
+ });
2357
+ };
2358
+
2359
+ }).call(HtmlCompletions.prototype);
2360
+
2361
+ exports.HtmlCompletions = HtmlCompletions;
2362
+ });
2363
+
2364
+ define("ace/mode/html",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text","ace/mode/javascript","ace/mode/css","ace/mode/html_highlight_rules","ace/mode/behaviour/xml","ace/mode/folding/html","ace/mode/html_completions","ace/worker/worker_client"], function(require, exports, module) {
2365
+ "use strict";
2366
+
2367
+ var oop = require("../lib/oop");
2368
+ var lang = require("../lib/lang");
2369
+ var TextMode = require("./text").Mode;
2370
+ var JavaScriptMode = require("./javascript").Mode;
2371
+ var CssMode = require("./css").Mode;
2372
+ var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
2373
+ var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
2374
+ var HtmlFoldMode = require("./folding/html").FoldMode;
2375
+ var HtmlCompletions = require("./html_completions").HtmlCompletions;
2376
+ var WorkerClient = require("../worker/worker_client").WorkerClient;
2377
+ var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr"];
2378
+ var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"];
2379
+
2380
+ var Mode = function(options) {
2381
+ this.fragmentContext = options && options.fragmentContext;
2382
+ this.HighlightRules = HtmlHighlightRules;
2383
+ this.$behaviour = new XmlBehaviour();
2384
+ this.$completer = new HtmlCompletions();
2385
+
2386
+ this.createModeDelegates({
2387
+ "js-": JavaScriptMode,
2388
+ "css-": CssMode
2389
+ });
2390
+
2391
+ this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags));
2392
+ };
2393
+ oop.inherits(Mode, TextMode);
2394
+
2395
+ (function() {
2396
+
2397
+ this.blockComment = {start: "<!--", end: "-->"};
2398
+
2399
+ this.voidElements = lang.arrayToMap(voidElements);
2400
+
2401
+ this.getNextLineIndent = function(state, line, tab) {
2402
+ return this.$getIndent(line);
2403
+ };
2404
+
2405
+ this.checkOutdent = function(state, line, input) {
2406
+ return false;
2407
+ };
2408
+
2409
+ this.getCompletions = function(state, session, pos, prefix) {
2410
+ return this.$completer.getCompletions(state, session, pos, prefix);
2411
+ };
2412
+
2413
+ this.createWorker = function(session) {
2414
+ if (this.constructor != Mode)
2415
+ return;
2416
+ var worker = new WorkerClient(["ace"], "ace/mode/html_worker", "Worker");
2417
+ worker.attachToDocument(session.getDocument());
2418
+
2419
+ if (this.fragmentContext)
2420
+ worker.call("setOptions", [{context: this.fragmentContext}]);
2421
+
2422
+ worker.on("error", function(e) {
2423
+ session.setAnnotations(e.data);
2424
+ });
2425
+
2426
+ worker.on("terminate", function() {
2427
+ session.clearAnnotations();
2428
+ });
2429
+
2430
+ return worker;
2431
+ };
2432
+
2433
+ this.$id = "ace/mode/html";
2434
+ }).call(Mode.prototype);
2435
+
2436
+ exports.Mode = Mode;
2437
+ });