stackprofiler 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -1
  3. data/README.md +1 -1
  4. data/config.ru +3 -2
  5. data/lib/stackprofiler.rb +0 -1
  6. data/lib/stackprofiler/filters/build_tree.rb +3 -4
  7. data/lib/stackprofiler/filters/gem_removal.rb +3 -0
  8. data/lib/stackprofiler/web_ui.rb +34 -11
  9. data/lib/stackprofiler/web_ui/public/css/stackprofiler.css +77 -0
  10. data/lib/stackprofiler/web_ui/public/js/stackprofiler.js +129 -58
  11. data/lib/stackprofiler/web_ui/public/vendor/ace/ace.js +18298 -0
  12. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-beautify.js +334 -0
  13. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-chromevox.js +541 -0
  14. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-elastic_tabstops_lite.js +275 -0
  15. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-emmet.js +1190 -0
  16. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-error_marker.js +6 -0
  17. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-keybinding_menu.js +170 -0
  18. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-language_tools.js +1934 -0
  19. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-linking.js +52 -0
  20. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-modelist.js +187 -0
  21. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-old_ie.js +494 -0
  22. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-searchbox.js +409 -0
  23. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-settings_menu.js +637 -0
  24. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-spellcheck.js +71 -0
  25. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-split.js +246 -0
  26. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-static_highlight.js +154 -0
  27. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-statusbar.js +51 -0
  28. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-textarea.js +632 -0
  29. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-themelist.js +58 -0
  30. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-whitespace.js +181 -0
  31. data/lib/stackprofiler/web_ui/public/vendor/ace/keybinding-emacs.js +1182 -0
  32. data/lib/stackprofiler/web_ui/public/vendor/ace/keybinding-vim.js +5320 -0
  33. data/lib/stackprofiler/web_ui/public/vendor/ace/mode-haml.js +525 -0
  34. data/lib/stackprofiler/web_ui/public/vendor/ace/mode-html.js +2427 -0
  35. data/lib/stackprofiler/web_ui/public/vendor/ace/mode-html_ruby.js +2955 -0
  36. data/lib/stackprofiler/web_ui/public/vendor/ace/mode-javascript.js +1025 -0
  37. data/lib/stackprofiler/web_ui/public/vendor/ace/mode-json.js +668 -0
  38. data/lib/stackprofiler/web_ui/public/vendor/ace/mode-ruby.js +839 -0
  39. data/lib/stackprofiler/web_ui/public/vendor/ace/mode-xml.js +637 -0
  40. data/lib/stackprofiler/web_ui/public/vendor/ace/mode-yaml.js +256 -0
  41. data/lib/stackprofiler/web_ui/public/vendor/ace/theme-xcode.js +89 -0
  42. data/lib/stackprofiler/web_ui/public/vendor/ace/worker-coffee.js +7599 -0
  43. data/lib/stackprofiler/web_ui/public/vendor/ace/worker-css.js +8682 -0
  44. data/lib/stackprofiler/web_ui/public/vendor/ace/worker-html.js +11527 -0
  45. data/lib/stackprofiler/web_ui/public/vendor/ace/worker-javascript.js +10429 -0
  46. data/lib/stackprofiler/web_ui/public/vendor/ace/worker-json.js +2319 -0
  47. data/lib/stackprofiler/web_ui/views/index.erb +1 -1
  48. data/lib/stackprofiler/web_ui/views/layout.erb +2 -55
  49. data/stackprofiler.gemspec +2 -4
  50. metadata +42 -19
  51. data/lib/stackprofiler/web_ui/views/code.erb +0 -17
@@ -0,0 +1,2427 @@
1
+ ace.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
+ ace.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)|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
+ ace.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
+ ace.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 CstyleBehaviour = function() {
479
+ this.add("braces", "insertion", function(state, action, editor, session, text) {
480
+ var cursor = editor.getCursorPosition();
481
+ var line = session.doc.getLine(cursor.row);
482
+ if (text == '{') {
483
+ initContext(editor);
484
+ var selection = editor.getSelectionRange();
485
+ var selected = session.doc.getTextRange(selection);
486
+ if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
487
+ return {
488
+ text: '{' + selected + '}',
489
+ selection: false
490
+ };
491
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
492
+ if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
493
+ CstyleBehaviour.recordAutoInsert(editor, session, "}");
494
+ return {
495
+ text: '{}',
496
+ selection: [1, 1]
497
+ };
498
+ } else {
499
+ CstyleBehaviour.recordMaybeInsert(editor, session, "{");
500
+ return {
501
+ text: '{',
502
+ selection: [1, 1]
503
+ };
504
+ }
505
+ }
506
+ } else if (text == '}') {
507
+ initContext(editor);
508
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
509
+ if (rightChar == '}') {
510
+ var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
511
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
512
+ CstyleBehaviour.popAutoInsertedClosing();
513
+ return {
514
+ text: '',
515
+ selection: [1, 1]
516
+ };
517
+ }
518
+ }
519
+ } else if (text == "\n" || text == "\r\n") {
520
+ initContext(editor);
521
+ var closing = "";
522
+ if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
523
+ closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
524
+ CstyleBehaviour.clearMaybeInsertedClosing();
525
+ }
526
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
527
+ if (rightChar === '}') {
528
+ var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
529
+ if (!openBracePos)
530
+ return null;
531
+ var next_indent = this.$getIndent(session.getLine(openBracePos.row));
532
+ } else if (closing) {
533
+ var next_indent = this.$getIndent(line);
534
+ } else {
535
+ CstyleBehaviour.clearMaybeInsertedClosing();
536
+ return;
537
+ }
538
+ var indent = next_indent + session.getTabString();
539
+
540
+ return {
541
+ text: '\n' + indent + '\n' + next_indent + closing,
542
+ selection: [1, indent.length, 1, indent.length]
543
+ };
544
+ } else {
545
+ CstyleBehaviour.clearMaybeInsertedClosing();
546
+ }
547
+ });
548
+
549
+ this.add("braces", "deletion", function(state, action, editor, session, range) {
550
+ var selected = session.doc.getTextRange(range);
551
+ if (!range.isMultiLine() && selected == '{') {
552
+ initContext(editor);
553
+ var line = session.doc.getLine(range.start.row);
554
+ var rightChar = line.substring(range.end.column, range.end.column + 1);
555
+ if (rightChar == '}') {
556
+ range.end.column++;
557
+ return range;
558
+ } else {
559
+ context.maybeInsertedBrackets--;
560
+ }
561
+ }
562
+ });
563
+
564
+ this.add("parens", "insertion", function(state, action, editor, session, text) {
565
+ if (text == '(') {
566
+ initContext(editor);
567
+ var selection = editor.getSelectionRange();
568
+ var selected = session.doc.getTextRange(selection);
569
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
570
+ return {
571
+ text: '(' + selected + ')',
572
+ selection: false
573
+ };
574
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
575
+ CstyleBehaviour.recordAutoInsert(editor, session, ")");
576
+ return {
577
+ text: '()',
578
+ selection: [1, 1]
579
+ };
580
+ }
581
+ } else if (text == ')') {
582
+ initContext(editor);
583
+ var cursor = editor.getCursorPosition();
584
+ var line = session.doc.getLine(cursor.row);
585
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
586
+ if (rightChar == ')') {
587
+ var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
588
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
589
+ CstyleBehaviour.popAutoInsertedClosing();
590
+ return {
591
+ text: '',
592
+ selection: [1, 1]
593
+ };
594
+ }
595
+ }
596
+ }
597
+ });
598
+
599
+ this.add("parens", "deletion", function(state, action, editor, session, range) {
600
+ var selected = session.doc.getTextRange(range);
601
+ if (!range.isMultiLine() && selected == '(') {
602
+ initContext(editor);
603
+ var line = session.doc.getLine(range.start.row);
604
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
605
+ if (rightChar == ')') {
606
+ range.end.column++;
607
+ return range;
608
+ }
609
+ }
610
+ });
611
+
612
+ this.add("brackets", "insertion", function(state, action, editor, session, text) {
613
+ if (text == '[') {
614
+ initContext(editor);
615
+ var selection = editor.getSelectionRange();
616
+ var selected = session.doc.getTextRange(selection);
617
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
618
+ return {
619
+ text: '[' + selected + ']',
620
+ selection: false
621
+ };
622
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
623
+ CstyleBehaviour.recordAutoInsert(editor, session, "]");
624
+ return {
625
+ text: '[]',
626
+ selection: [1, 1]
627
+ };
628
+ }
629
+ } else if (text == ']') {
630
+ initContext(editor);
631
+ var cursor = editor.getCursorPosition();
632
+ var line = session.doc.getLine(cursor.row);
633
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
634
+ if (rightChar == ']') {
635
+ var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
636
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
637
+ CstyleBehaviour.popAutoInsertedClosing();
638
+ return {
639
+ text: '',
640
+ selection: [1, 1]
641
+ };
642
+ }
643
+ }
644
+ }
645
+ });
646
+
647
+ this.add("brackets", "deletion", function(state, action, editor, session, range) {
648
+ var selected = session.doc.getTextRange(range);
649
+ if (!range.isMultiLine() && selected == '[') {
650
+ initContext(editor);
651
+ var line = session.doc.getLine(range.start.row);
652
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
653
+ if (rightChar == ']') {
654
+ range.end.column++;
655
+ return range;
656
+ }
657
+ }
658
+ });
659
+
660
+ this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
661
+ if (text == '"' || text == "'") {
662
+ initContext(editor);
663
+ var quote = text;
664
+ var selection = editor.getSelectionRange();
665
+ var selected = session.doc.getTextRange(selection);
666
+ if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
667
+ return {
668
+ text: quote + selected + quote,
669
+ selection: false
670
+ };
671
+ } else {
672
+ var cursor = editor.getCursorPosition();
673
+ var line = session.doc.getLine(cursor.row);
674
+ var leftChar = line.substring(cursor.column-1, cursor.column);
675
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
676
+
677
+ var token = session.getTokenAt(cursor.row, cursor.column);
678
+ var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
679
+ if (leftChar == "\\" && token && /escape/.test(token.type))
680
+ return null;
681
+
682
+ var stringBefore = token && /string/.test(token.type);
683
+ var stringAfter = !rightToken || /string/.test(rightToken.type);
684
+
685
+ var pair;
686
+ if (rightChar == quote) {
687
+ pair = stringBefore !== stringAfter;
688
+ } else {
689
+ if (stringBefore && !stringAfter)
690
+ return null; // wrap string with different quote
691
+ if (stringBefore && stringAfter)
692
+ return null; // do not pair quotes inside strings
693
+ var wordRe = session.$mode.tokenRe;
694
+ wordRe.lastIndex = 0;
695
+ var isWordBefore = wordRe.test(leftChar);
696
+ wordRe.lastIndex = 0;
697
+ var isWordAfter = wordRe.test(leftChar);
698
+ if (isWordBefore || isWordAfter)
699
+ return null; // before or after alphanumeric
700
+ if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
701
+ return null; // there is rightChar and it isn't closing
702
+ pair = true;
703
+ }
704
+ return {
705
+ text: pair ? quote + quote : "",
706
+ selection: [1,1]
707
+ };
708
+ }
709
+ }
710
+ });
711
+
712
+ this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
713
+ var selected = session.doc.getTextRange(range);
714
+ if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
715
+ initContext(editor);
716
+ var line = session.doc.getLine(range.start.row);
717
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
718
+ if (rightChar == selected) {
719
+ range.end.column++;
720
+ return range;
721
+ }
722
+ }
723
+ });
724
+
725
+ };
726
+
727
+
728
+ CstyleBehaviour.isSaneInsertion = function(editor, session) {
729
+ var cursor = editor.getCursorPosition();
730
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
731
+ if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
732
+ var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
733
+ if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
734
+ return false;
735
+ }
736
+ iterator.stepForward();
737
+ return iterator.getCurrentTokenRow() !== cursor.row ||
738
+ this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
739
+ };
740
+
741
+ CstyleBehaviour.$matchTokenType = function(token, types) {
742
+ return types.indexOf(token.type || token) > -1;
743
+ };
744
+
745
+ CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
746
+ var cursor = editor.getCursorPosition();
747
+ var line = session.doc.getLine(cursor.row);
748
+ if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
749
+ context.autoInsertedBrackets = 0;
750
+ context.autoInsertedRow = cursor.row;
751
+ context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
752
+ context.autoInsertedBrackets++;
753
+ };
754
+
755
+ CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
756
+ var cursor = editor.getCursorPosition();
757
+ var line = session.doc.getLine(cursor.row);
758
+ if (!this.isMaybeInsertedClosing(cursor, line))
759
+ context.maybeInsertedBrackets = 0;
760
+ context.maybeInsertedRow = cursor.row;
761
+ context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
762
+ context.maybeInsertedLineEnd = line.substr(cursor.column);
763
+ context.maybeInsertedBrackets++;
764
+ };
765
+
766
+ CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
767
+ return context.autoInsertedBrackets > 0 &&
768
+ cursor.row === context.autoInsertedRow &&
769
+ bracket === context.autoInsertedLineEnd[0] &&
770
+ line.substr(cursor.column) === context.autoInsertedLineEnd;
771
+ };
772
+
773
+ CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
774
+ return context.maybeInsertedBrackets > 0 &&
775
+ cursor.row === context.maybeInsertedRow &&
776
+ line.substr(cursor.column) === context.maybeInsertedLineEnd &&
777
+ line.substr(0, cursor.column) == context.maybeInsertedLineStart;
778
+ };
779
+
780
+ CstyleBehaviour.popAutoInsertedClosing = function() {
781
+ context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
782
+ context.autoInsertedBrackets--;
783
+ };
784
+
785
+ CstyleBehaviour.clearMaybeInsertedClosing = function() {
786
+ if (context) {
787
+ context.maybeInsertedBrackets = 0;
788
+ context.maybeInsertedRow = -1;
789
+ }
790
+ };
791
+
792
+
793
+
794
+ oop.inherits(CstyleBehaviour, Behaviour);
795
+
796
+ exports.CstyleBehaviour = CstyleBehaviour;
797
+ });
798
+
799
+ ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
800
+ "use strict";
801
+
802
+ var oop = require("../../lib/oop");
803
+ var Range = require("../../range").Range;
804
+ var BaseFoldMode = require("./fold_mode").FoldMode;
805
+
806
+ var FoldMode = exports.FoldMode = function(commentRegex) {
807
+ if (commentRegex) {
808
+ this.foldingStartMarker = new RegExp(
809
+ this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
810
+ );
811
+ this.foldingStopMarker = new RegExp(
812
+ this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
813
+ );
814
+ }
815
+ };
816
+ oop.inherits(FoldMode, BaseFoldMode);
817
+
818
+ (function() {
819
+
820
+ this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
821
+ this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
822
+ this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
823
+ this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
824
+ this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
825
+ this._getFoldWidgetBase = this.getFoldWidget;
826
+ this.getFoldWidget = function(session, foldStyle, row) {
827
+ var line = session.getLine(row);
828
+
829
+ if (this.singleLineBlockCommentRe.test(line)) {
830
+ if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
831
+ return "";
832
+ }
833
+
834
+ var fw = this._getFoldWidgetBase(session, foldStyle, row);
835
+
836
+ if (!fw && this.startRegionRe.test(line))
837
+ return "start"; // lineCommentRegionStart
838
+
839
+ return fw;
840
+ };
841
+
842
+ this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
843
+ var line = session.getLine(row);
844
+
845
+ if (this.startRegionRe.test(line))
846
+ return this.getCommentRegionBlock(session, line, row);
847
+
848
+ var match = line.match(this.foldingStartMarker);
849
+ if (match) {
850
+ var i = match.index;
851
+
852
+ if (match[1])
853
+ return this.openingBracketBlock(session, match[1], row, i);
854
+
855
+ var range = session.getCommentFoldRange(row, i + match[0].length, 1);
856
+
857
+ if (range && !range.isMultiLine()) {
858
+ if (forceMultiline) {
859
+ range = this.getSectionRange(session, row);
860
+ } else if (foldStyle != "all")
861
+ range = null;
862
+ }
863
+
864
+ return range;
865
+ }
866
+
867
+ if (foldStyle === "markbegin")
868
+ return;
869
+
870
+ var match = line.match(this.foldingStopMarker);
871
+ if (match) {
872
+ var i = match.index + match[0].length;
873
+
874
+ if (match[1])
875
+ return this.closingBracketBlock(session, match[1], row, i);
876
+
877
+ return session.getCommentFoldRange(row, i, -1);
878
+ }
879
+ };
880
+
881
+ this.getSectionRange = function(session, row) {
882
+ var line = session.getLine(row);
883
+ var startIndent = line.search(/\S/);
884
+ var startRow = row;
885
+ var startColumn = line.length;
886
+ row = row + 1;
887
+ var endRow = row;
888
+ var maxRow = session.getLength();
889
+ while (++row < maxRow) {
890
+ line = session.getLine(row);
891
+ var indent = line.search(/\S/);
892
+ if (indent === -1)
893
+ continue;
894
+ if (startIndent > indent)
895
+ break;
896
+ var subRange = this.getFoldWidgetRange(session, "all", row);
897
+
898
+ if (subRange) {
899
+ if (subRange.start.row <= startRow) {
900
+ break;
901
+ } else if (subRange.isMultiLine()) {
902
+ row = subRange.end.row;
903
+ } else if (startIndent == indent) {
904
+ break;
905
+ }
906
+ }
907
+ endRow = row;
908
+ }
909
+
910
+ return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
911
+ };
912
+
913
+ this.getCommentRegionBlock = function(session, line, row) {
914
+ var startColumn = line.search(/\s*$/);
915
+ var maxRow = session.getLength();
916
+ var startRow = row;
917
+
918
+ var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
919
+ var depth = 1;
920
+ while (++row < maxRow) {
921
+ line = session.getLine(row);
922
+ var m = re.exec(line);
923
+ if (!m) continue;
924
+ if (m[1]) depth--;
925
+ else depth++;
926
+
927
+ if (!depth) break;
928
+ }
929
+
930
+ var endRow = row;
931
+ if (endRow > startRow) {
932
+ return new Range(startRow, startColumn, endRow, line.length);
933
+ }
934
+ };
935
+
936
+ }).call(FoldMode.prototype);
937
+
938
+ });
939
+
940
+ ace.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) {
941
+ "use strict";
942
+
943
+ var oop = require("../lib/oop");
944
+ var TextMode = require("./text").Mode;
945
+ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
946
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
947
+ var Range = require("../range").Range;
948
+ var WorkerClient = require("../worker/worker_client").WorkerClient;
949
+ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
950
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
951
+
952
+ var Mode = function() {
953
+ this.HighlightRules = JavaScriptHighlightRules;
954
+
955
+ this.$outdent = new MatchingBraceOutdent();
956
+ this.$behaviour = new CstyleBehaviour();
957
+ this.foldingRules = new CStyleFoldMode();
958
+ };
959
+ oop.inherits(Mode, TextMode);
960
+
961
+ (function() {
962
+
963
+ this.lineCommentStart = "//";
964
+ this.blockComment = {start: "/*", end: "*/"};
965
+
966
+ this.getNextLineIndent = function(state, line, tab) {
967
+ var indent = this.$getIndent(line);
968
+
969
+ var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
970
+ var tokens = tokenizedLine.tokens;
971
+ var endState = tokenizedLine.state;
972
+
973
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
974
+ return indent;
975
+ }
976
+
977
+ if (state == "start" || state == "no_regex") {
978
+ var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
979
+ if (match) {
980
+ indent += tab;
981
+ }
982
+ } else if (state == "doc-start") {
983
+ if (endState == "start" || endState == "no_regex") {
984
+ return "";
985
+ }
986
+ var match = line.match(/^\s*(\/?)\*/);
987
+ if (match) {
988
+ if (match[1]) {
989
+ indent += " ";
990
+ }
991
+ indent += "* ";
992
+ }
993
+ }
994
+
995
+ return indent;
996
+ };
997
+
998
+ this.checkOutdent = function(state, line, input) {
999
+ return this.$outdent.checkOutdent(line, input);
1000
+ };
1001
+
1002
+ this.autoOutdent = function(state, doc, row) {
1003
+ this.$outdent.autoOutdent(doc, row);
1004
+ };
1005
+
1006
+ this.createWorker = function(session) {
1007
+ var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
1008
+ worker.attachToDocument(session.getDocument());
1009
+
1010
+ worker.on("jslint", function(results) {
1011
+ session.setAnnotations(results.data);
1012
+ });
1013
+
1014
+ worker.on("terminate", function() {
1015
+ session.clearAnnotations();
1016
+ });
1017
+
1018
+ return worker;
1019
+ };
1020
+
1021
+ this.$id = "ace/mode/javascript";
1022
+ }).call(Mode.prototype);
1023
+
1024
+ exports.Mode = Mode;
1025
+ });
1026
+
1027
+ ace.define("ace/mode/css_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(require, exports, module) {
1028
+ "use strict";
1029
+
1030
+ var oop = require("../lib/oop");
1031
+ var lang = require("../lib/lang");
1032
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1033
+ 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";
1034
+ var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
1035
+ 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";
1036
+ var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow";
1037
+ var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace";
1038
+
1039
+ var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
1040
+ var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
1041
+ 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";
1042
+
1043
+ var CssHighlightRules = function() {
1044
+
1045
+ var keywordMapper = this.createKeywordMapper({
1046
+ "support.function": supportFunction,
1047
+ "support.constant": supportConstant,
1048
+ "support.type": supportType,
1049
+ "support.constant.color": supportConstantColor,
1050
+ "support.constant.fonts": supportConstantFonts
1051
+ }, "text", true);
1052
+
1053
+ this.$rules = {
1054
+ "start" : [{
1055
+ token : "comment", // multi line comment
1056
+ regex : "\\/\\*",
1057
+ push : "comment"
1058
+ }, {
1059
+ token: "paren.lparen",
1060
+ regex: "\\{",
1061
+ push: "ruleset"
1062
+ }, {
1063
+ token: "string",
1064
+ regex: "@.*?{",
1065
+ push: "media"
1066
+ }, {
1067
+ token: "keyword",
1068
+ regex: "#[a-z0-9-_]+"
1069
+ }, {
1070
+ token: "variable",
1071
+ regex: "\\.[a-z0-9-_]+"
1072
+ }, {
1073
+ token: "string",
1074
+ regex: ":[a-z0-9-_]+"
1075
+ }, {
1076
+ token: "constant",
1077
+ regex: "[a-z0-9-_]+"
1078
+ }, {
1079
+ caseInsensitive: true
1080
+ }],
1081
+
1082
+ "media" : [{
1083
+ token : "comment", // multi line comment
1084
+ regex : "\\/\\*",
1085
+ push : "comment"
1086
+ }, {
1087
+ token: "paren.lparen",
1088
+ regex: "\\{",
1089
+ push: "ruleset"
1090
+ }, {
1091
+ token: "string",
1092
+ regex: "\\}",
1093
+ next: "pop"
1094
+ }, {
1095
+ token: "keyword",
1096
+ regex: "#[a-z0-9-_]+"
1097
+ }, {
1098
+ token: "variable",
1099
+ regex: "\\.[a-z0-9-_]+"
1100
+ }, {
1101
+ token: "string",
1102
+ regex: ":[a-z0-9-_]+"
1103
+ }, {
1104
+ token: "constant",
1105
+ regex: "[a-z0-9-_]+"
1106
+ }, {
1107
+ caseInsensitive: true
1108
+ }],
1109
+
1110
+ "comment" : [{
1111
+ token : "comment",
1112
+ regex : "\\*\\/",
1113
+ next : "pop"
1114
+ }, {
1115
+ defaultToken : "comment"
1116
+ }],
1117
+
1118
+ "ruleset" : [
1119
+ {
1120
+ token : "paren.rparen",
1121
+ regex : "\\}",
1122
+ next: "pop"
1123
+ }, {
1124
+ token : "comment", // multi line comment
1125
+ regex : "\\/\\*",
1126
+ push : "comment"
1127
+ }, {
1128
+ token : "string", // single line
1129
+ regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
1130
+ }, {
1131
+ token : "string", // single line
1132
+ regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
1133
+ }, {
1134
+ token : ["constant.numeric", "keyword"],
1135
+ 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|%)"
1136
+ }, {
1137
+ token : "constant.numeric",
1138
+ regex : numRe
1139
+ }, {
1140
+ token : "constant.numeric", // hex6 color
1141
+ regex : "#[a-f0-9]{6}"
1142
+ }, {
1143
+ token : "constant.numeric", // hex3 color
1144
+ regex : "#[a-f0-9]{3}"
1145
+ }, {
1146
+ token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
1147
+ regex : pseudoElements
1148
+ }, {
1149
+ token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
1150
+ regex : pseudoClasses
1151
+ }, {
1152
+ token : ["support.function", "string", "support.function"],
1153
+ regex : "(url\\()(.*)(\\))"
1154
+ }, {
1155
+ token : keywordMapper,
1156
+ regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
1157
+ }, {
1158
+ caseInsensitive: true
1159
+ }]
1160
+ };
1161
+
1162
+ this.normalizeRules();
1163
+ };
1164
+
1165
+ oop.inherits(CssHighlightRules, TextHighlightRules);
1166
+
1167
+ exports.CssHighlightRules = CssHighlightRules;
1168
+
1169
+ });
1170
+
1171
+ ace.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) {
1172
+ "use strict";
1173
+
1174
+ var oop = require("../../lib/oop");
1175
+ var Behaviour = require("../behaviour").Behaviour;
1176
+ var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
1177
+ var TokenIterator = require("../../token_iterator").TokenIterator;
1178
+
1179
+ var CssBehaviour = function () {
1180
+
1181
+ this.inherit(CstyleBehaviour);
1182
+
1183
+ this.add("colon", "insertion", function (state, action, editor, session, text) {
1184
+ if (text === ':') {
1185
+ var cursor = editor.getCursorPosition();
1186
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
1187
+ var token = iterator.getCurrentToken();
1188
+ if (token && token.value.match(/\s+/)) {
1189
+ token = iterator.stepBackward();
1190
+ }
1191
+ if (token && token.type === 'support.type') {
1192
+ var line = session.doc.getLine(cursor.row);
1193
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1194
+ if (rightChar === ':') {
1195
+ return {
1196
+ text: '',
1197
+ selection: [1, 1]
1198
+ }
1199
+ }
1200
+ if (!line.substring(cursor.column).match(/^\s*;/)) {
1201
+ return {
1202
+ text: ':;',
1203
+ selection: [1, 1]
1204
+ }
1205
+ }
1206
+ }
1207
+ }
1208
+ });
1209
+
1210
+ this.add("colon", "deletion", function (state, action, editor, session, range) {
1211
+ var selected = session.doc.getTextRange(range);
1212
+ if (!range.isMultiLine() && selected === ':') {
1213
+ var cursor = editor.getCursorPosition();
1214
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
1215
+ var token = iterator.getCurrentToken();
1216
+ if (token && token.value.match(/\s+/)) {
1217
+ token = iterator.stepBackward();
1218
+ }
1219
+ if (token && token.type === 'support.type') {
1220
+ var line = session.doc.getLine(range.start.row);
1221
+ var rightChar = line.substring(range.end.column, range.end.column + 1);
1222
+ if (rightChar === ';') {
1223
+ range.end.column ++;
1224
+ return range;
1225
+ }
1226
+ }
1227
+ }
1228
+ });
1229
+
1230
+ this.add("semicolon", "insertion", function (state, action, editor, session, text) {
1231
+ if (text === ';') {
1232
+ var cursor = editor.getCursorPosition();
1233
+ var line = session.doc.getLine(cursor.row);
1234
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1235
+ if (rightChar === ';') {
1236
+ return {
1237
+ text: '',
1238
+ selection: [1, 1]
1239
+ }
1240
+ }
1241
+ }
1242
+ });
1243
+
1244
+ }
1245
+ oop.inherits(CssBehaviour, CstyleBehaviour);
1246
+
1247
+ exports.CssBehaviour = CssBehaviour;
1248
+ });
1249
+
1250
+ ace.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) {
1251
+ "use strict";
1252
+
1253
+ var oop = require("../lib/oop");
1254
+ var TextMode = require("./text").Mode;
1255
+ var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
1256
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
1257
+ var WorkerClient = require("../worker/worker_client").WorkerClient;
1258
+ var CssBehaviour = require("./behaviour/css").CssBehaviour;
1259
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
1260
+
1261
+ var Mode = function() {
1262
+ this.HighlightRules = CssHighlightRules;
1263
+ this.$outdent = new MatchingBraceOutdent();
1264
+ this.$behaviour = new CssBehaviour();
1265
+ this.foldingRules = new CStyleFoldMode();
1266
+ };
1267
+ oop.inherits(Mode, TextMode);
1268
+
1269
+ (function() {
1270
+
1271
+ this.foldingRules = "cStyle";
1272
+ this.blockComment = {start: "/*", end: "*/"};
1273
+
1274
+ this.getNextLineIndent = function(state, line, tab) {
1275
+ var indent = this.$getIndent(line);
1276
+ var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
1277
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
1278
+ return indent;
1279
+ }
1280
+
1281
+ var match = line.match(/^.*\{\s*$/);
1282
+ if (match) {
1283
+ indent += tab;
1284
+ }
1285
+
1286
+ return indent;
1287
+ };
1288
+
1289
+ this.checkOutdent = function(state, line, input) {
1290
+ return this.$outdent.checkOutdent(line, input);
1291
+ };
1292
+
1293
+ this.autoOutdent = function(state, doc, row) {
1294
+ this.$outdent.autoOutdent(doc, row);
1295
+ };
1296
+
1297
+ this.createWorker = function(session) {
1298
+ var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
1299
+ worker.attachToDocument(session.getDocument());
1300
+
1301
+ worker.on("csslint", function(e) {
1302
+ session.setAnnotations(e.data);
1303
+ });
1304
+
1305
+ worker.on("terminate", function() {
1306
+ session.clearAnnotations();
1307
+ });
1308
+
1309
+ return worker;
1310
+ };
1311
+
1312
+ this.$id = "ace/mode/css";
1313
+ }).call(Mode.prototype);
1314
+
1315
+ exports.Mode = Mode;
1316
+
1317
+ });
1318
+
1319
+ ace.define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
1320
+ "use strict";
1321
+
1322
+ var oop = require("../lib/oop");
1323
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1324
+
1325
+ var XmlHighlightRules = function(normalize) {
1326
+ this.$rules = {
1327
+ start : [
1328
+ {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"},
1329
+ {
1330
+ token : ["punctuation.xml-decl.xml", "keyword.xml-decl.xml"],
1331
+ regex : "(<\\?)(xml)(?=[\\s])", next : "xml_decl", caseInsensitive: true
1332
+ },
1333
+ {
1334
+ token : ["punctuation.instruction.xml", "keyword.instruction.xml"],
1335
+ regex : "(<\\?)([-_a-zA-Z0-9]+)", next : "processing_instruction",
1336
+ },
1337
+ {token : "comment.xml", regex : "<\\!--", next : "comment"},
1338
+ {
1339
+ token : ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
1340
+ regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype", caseInsensitive: true
1341
+ },
1342
+ {include : "tag"},
1343
+ {token : "text.end-tag-open.xml", regex: "</"},
1344
+ {token : "text.tag-open.xml", regex: "<"},
1345
+ {include : "reference"},
1346
+ {defaultToken : "text.xml"}
1347
+ ],
1348
+
1349
+ xml_decl : [{
1350
+ token : "entity.other.attribute-name.decl-attribute-name.xml",
1351
+ regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+"
1352
+ }, {
1353
+ token : "keyword.operator.decl-attribute-equals.xml",
1354
+ regex : "="
1355
+ }, {
1356
+ include: "whitespace"
1357
+ }, {
1358
+ include: "string"
1359
+ }, {
1360
+ token : "punctuation.xml-decl.xml",
1361
+ regex : "\\?>",
1362
+ next : "start"
1363
+ }],
1364
+
1365
+ processing_instruction : [
1366
+ {token : "punctuation.instruction.xml", regex : "\\?>", next : "start"},
1367
+ {defaultToken : "instruction.xml"}
1368
+ ],
1369
+
1370
+ doctype : [
1371
+ {include : "whitespace"},
1372
+ {include : "string"},
1373
+ {token : "xml-pe.doctype.xml", regex : ">", next : "start"},
1374
+ {token : "xml-pe.xml", regex : "[-_a-zA-Z0-9:]+"},
1375
+ {token : "punctuation.int-subset", regex : "\\[", push : "int_subset"}
1376
+ ],
1377
+
1378
+ int_subset : [{
1379
+ token : "text.xml",
1380
+ regex : "\\s+"
1381
+ }, {
1382
+ token: "punctuation.int-subset.xml",
1383
+ regex: "]",
1384
+ next: "pop"
1385
+ }, {
1386
+ token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
1387
+ regex : "(<\\!)([-_a-zA-Z0-9]+)",
1388
+ push : [{
1389
+ token : "text",
1390
+ regex : "\\s+"
1391
+ },
1392
+ {
1393
+ token : "punctuation.markup-decl.xml",
1394
+ regex : ">",
1395
+ next : "pop"
1396
+ },
1397
+ {include : "string"}]
1398
+ }],
1399
+
1400
+ cdata : [
1401
+ {token : "string.cdata.xml", regex : "\\]\\]>", next : "start"},
1402
+ {token : "text.xml", regex : "\\s+"},
1403
+ {token : "text.xml", regex : "(?:[^\\]]|\\](?!\\]>))+"}
1404
+ ],
1405
+
1406
+ comment : [
1407
+ {token : "comment.xml", regex : "-->", next : "start"},
1408
+ {defaultToken : "comment.xml"}
1409
+ ],
1410
+
1411
+ reference : [{
1412
+ token : "constant.language.escape.reference.xml",
1413
+ regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
1414
+ }],
1415
+
1416
+ attr_reference : [{
1417
+ token : "constant.language.escape.reference.attribute-value.xml",
1418
+ regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
1419
+ }],
1420
+
1421
+ tag : [{
1422
+ token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
1423
+ regex : "(?:(<)|(</))((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)",
1424
+ next: [
1425
+ {include : "attributes"},
1426
+ {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
1427
+ ]
1428
+ }],
1429
+
1430
+ tag_whitespace : [
1431
+ {token : "text.tag-whitespace.xml", regex : "\\s+"}
1432
+ ],
1433
+ whitespace : [
1434
+ {token : "text.whitespace.xml", regex : "\\s+"}
1435
+ ],
1436
+ string: [{
1437
+ token : "string.xml",
1438
+ regex : "'",
1439
+ push : [
1440
+ {token : "string.xml", regex: "'", next: "pop"},
1441
+ {defaultToken : "string.xml"}
1442
+ ]
1443
+ }, {
1444
+ token : "string.xml",
1445
+ regex : '"',
1446
+ push : [
1447
+ {token : "string.xml", regex: '"', next: "pop"},
1448
+ {defaultToken : "string.xml"}
1449
+ ]
1450
+ }],
1451
+
1452
+ attributes: [{
1453
+ token : "entity.other.attribute-name.xml",
1454
+ regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+"
1455
+ }, {
1456
+ token : "keyword.operator.attribute-equals.xml",
1457
+ regex : "="
1458
+ }, {
1459
+ include: "tag_whitespace"
1460
+ }, {
1461
+ include: "attribute_value"
1462
+ }],
1463
+
1464
+ attribute_value: [{
1465
+ token : "string.attribute-value.xml",
1466
+ regex : "'",
1467
+ push : [
1468
+ {token : "string.attribute-value.xml", regex: "'", next: "pop"},
1469
+ {include : "attr_reference"},
1470
+ {defaultToken : "string.attribute-value.xml"}
1471
+ ]
1472
+ }, {
1473
+ token : "string.attribute-value.xml",
1474
+ regex : '"',
1475
+ push : [
1476
+ {token : "string.attribute-value.xml", regex: '"', next: "pop"},
1477
+ {include : "attr_reference"},
1478
+ {defaultToken : "string.attribute-value.xml"}
1479
+ ]
1480
+ }]
1481
+ };
1482
+
1483
+ if (this.constructor === XmlHighlightRules)
1484
+ this.normalizeRules();
1485
+ };
1486
+
1487
+
1488
+ (function() {
1489
+
1490
+ this.embedTagRules = function(HighlightRules, prefix, tag){
1491
+ this.$rules.tag.unshift({
1492
+ token : ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
1493
+ regex : "(<)(" + tag + "(?=\\s|>|$))",
1494
+ next: [
1495
+ {include : "attributes"},
1496
+ {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : prefix + "start"}
1497
+ ]
1498
+ });
1499
+
1500
+ this.$rules[tag + "-end"] = [
1501
+ {include : "attributes"},
1502
+ {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next: "start",
1503
+ onMatch : function(value, currentState, stack) {
1504
+ stack.splice(0);
1505
+ return this.token;
1506
+ }}
1507
+ ]
1508
+
1509
+ this.embedRules(HighlightRules, prefix, [{
1510
+ token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
1511
+ regex : "(</)(" + tag + "(?=\\s|>|$))",
1512
+ next: tag + "-end"
1513
+ }, {
1514
+ token: "string.cdata.xml",
1515
+ regex : "<\\!\\[CDATA\\["
1516
+ }, {
1517
+ token: "string.cdata.xml",
1518
+ regex : "\\]\\]>"
1519
+ }]);
1520
+ };
1521
+
1522
+ }).call(TextHighlightRules.prototype);
1523
+
1524
+ oop.inherits(XmlHighlightRules, TextHighlightRules);
1525
+
1526
+ exports.XmlHighlightRules = XmlHighlightRules;
1527
+ });
1528
+
1529
+ ace.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) {
1530
+ "use strict";
1531
+
1532
+ var oop = require("../lib/oop");
1533
+ var lang = require("../lib/lang");
1534
+ var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
1535
+ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
1536
+ var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
1537
+
1538
+ var tagMap = lang.createMap({
1539
+ a : 'anchor',
1540
+ button : 'form',
1541
+ form : 'form',
1542
+ img : 'image',
1543
+ input : 'form',
1544
+ label : 'form',
1545
+ option : 'form',
1546
+ script : 'script',
1547
+ select : 'form',
1548
+ textarea : 'form',
1549
+ style : 'style',
1550
+ table : 'table',
1551
+ tbody : 'table',
1552
+ td : 'table',
1553
+ tfoot : 'table',
1554
+ th : 'table',
1555
+ tr : 'table'
1556
+ });
1557
+
1558
+ var HtmlHighlightRules = function() {
1559
+ XmlHighlightRules.call(this);
1560
+
1561
+ this.addRules({
1562
+ attributes: [{
1563
+ include : "tag_whitespace"
1564
+ }, {
1565
+ token : "entity.other.attribute-name.xml",
1566
+ regex : "[-_a-zA-Z0-9:]+"
1567
+ }, {
1568
+ token : "keyword.operator.attribute-equals.xml",
1569
+ regex : "=",
1570
+ push : [{
1571
+ include: "tag_whitespace"
1572
+ }, {
1573
+ token : "string.unquoted.attribute-value.html",
1574
+ regex : "[^<>='\"`\\s]+",
1575
+ next : "pop"
1576
+ }, {
1577
+ token : "empty",
1578
+ regex : "",
1579
+ next : "pop"
1580
+ }]
1581
+ }, {
1582
+ include : "attribute_value"
1583
+ }],
1584
+ tag: [{
1585
+ token : function(start, tag) {
1586
+ var group = tagMap[tag];
1587
+ return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
1588
+ "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
1589
+ },
1590
+ regex : "(</?)([-_a-zA-Z0-9:]+)",
1591
+ next: "tag_stuff"
1592
+ }],
1593
+ tag_stuff: [
1594
+ {include : "attributes"},
1595
+ {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
1596
+ ],
1597
+ });
1598
+
1599
+ this.embedTagRules(CssHighlightRules, "css-", "style");
1600
+ this.embedTagRules(JavaScriptHighlightRules, "js-", "script");
1601
+
1602
+ if (this.constructor === HtmlHighlightRules)
1603
+ this.normalizeRules();
1604
+ };
1605
+
1606
+ oop.inherits(HtmlHighlightRules, XmlHighlightRules);
1607
+
1608
+ exports.HtmlHighlightRules = HtmlHighlightRules;
1609
+ });
1610
+
1611
+ ace.define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module) {
1612
+ "use strict";
1613
+
1614
+ var oop = require("../../lib/oop");
1615
+ var Behaviour = require("../behaviour").Behaviour;
1616
+ var TokenIterator = require("../../token_iterator").TokenIterator;
1617
+ var lang = require("../../lib/lang");
1618
+
1619
+ function is(token, type) {
1620
+ return token.type.lastIndexOf(type + ".xml") > -1;
1621
+ }
1622
+
1623
+ var XmlBehaviour = function () {
1624
+
1625
+ this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
1626
+ if (text == '"' || text == "'") {
1627
+ var quote = text;
1628
+ var selected = session.doc.getTextRange(editor.getSelectionRange());
1629
+ if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
1630
+ return {
1631
+ text: quote + selected + quote,
1632
+ selection: false
1633
+ };
1634
+ }
1635
+
1636
+ var cursor = editor.getCursorPosition();
1637
+ var line = session.doc.getLine(cursor.row);
1638
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1639
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
1640
+ var token = iterator.getCurrentToken();
1641
+
1642
+ if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) {
1643
+ return {
1644
+ text: "",
1645
+ selection: [1, 1]
1646
+ };
1647
+ }
1648
+
1649
+ if (!token)
1650
+ token = iterator.stepBackward();
1651
+
1652
+ if (!token)
1653
+ return;
1654
+
1655
+ while (is(token, "tag-whitespace") || is(token, "whitespace")) {
1656
+ token = iterator.stepBackward();
1657
+ }
1658
+ var rightSpace = !rightChar || rightChar.match(/\s/);
1659
+ if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) {
1660
+ return {
1661
+ text: quote + quote,
1662
+ selection: [1, 1]
1663
+ };
1664
+ }
1665
+ }
1666
+ });
1667
+
1668
+ this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
1669
+ var selected = session.doc.getTextRange(range);
1670
+ if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
1671
+ var line = session.doc.getLine(range.start.row);
1672
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
1673
+ if (rightChar == selected) {
1674
+ range.end.column++;
1675
+ return range;
1676
+ }
1677
+ }
1678
+ });
1679
+
1680
+ this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
1681
+ if (text == '>') {
1682
+ var position = editor.getCursorPosition();
1683
+ var iterator = new TokenIterator(session, position.row, position.column);
1684
+ var token = iterator.getCurrentToken() || iterator.stepBackward();
1685
+ if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value")))
1686
+ return;
1687
+ if (is(token, "reference.attribute-value"))
1688
+ return;
1689
+ if (is(token, "attribute-value")) {
1690
+ var firstChar = token.value.charAt(0);
1691
+ if (firstChar == '"' || firstChar == "'") {
1692
+ var lastChar = token.value.charAt(token.value.length - 1);
1693
+ var tokenEnd = iterator.getCurrentTokenColumn() + token.value.length;
1694
+ if (tokenEnd > position.column || tokenEnd == position.column && firstChar != lastChar)
1695
+ return;
1696
+ }
1697
+ }
1698
+ while (!is(token, "tag-name")) {
1699
+ token = iterator.stepBackward();
1700
+ }
1701
+
1702
+ var tokenRow = iterator.getCurrentTokenRow();
1703
+ var tokenColumn = iterator.getCurrentTokenColumn();
1704
+ if (is(iterator.stepBackward(), "end-tag-open"))
1705
+ return;
1706
+
1707
+ var element = token.value;
1708
+ if (tokenRow == position.row)
1709
+ element = element.substring(0, position.column - tokenColumn);
1710
+
1711
+ if (this.voidElements.hasOwnProperty(element.toLowerCase()))
1712
+ return;
1713
+
1714
+ return {
1715
+ text: ">" + "</" + element + ">",
1716
+ selection: [1, 1]
1717
+ };
1718
+ }
1719
+ });
1720
+
1721
+ this.add("autoindent", "insertion", function (state, action, editor, session, text) {
1722
+ if (text == "\n") {
1723
+ var cursor = editor.getCursorPosition();
1724
+ var line = session.getLine(cursor.row);
1725
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
1726
+ var token = iterator.getCurrentToken();
1727
+
1728
+ if (token && token.type.indexOf("tag-close") !== -1) {
1729
+ while (token && token.type.indexOf("tag-name") === -1) {
1730
+ token = iterator.stepBackward();
1731
+ }
1732
+
1733
+ if (!token) {
1734
+ return;
1735
+ }
1736
+
1737
+ var tag = token.value;
1738
+ var row = iterator.getCurrentTokenRow();
1739
+ token = iterator.stepBackward();
1740
+ if (!token || token.type.indexOf("end-tag") !== -1) {
1741
+ return;
1742
+ }
1743
+
1744
+ if (this.voidElements && !this.voidElements[tag]) {
1745
+ var nextToken = session.getTokenAt(cursor.row, cursor.column+1);
1746
+ var line = session.getLine(row);
1747
+ var nextIndent = this.$getIndent(line);
1748
+ var indent = nextIndent + session.getTabString();
1749
+
1750
+ if (nextToken && nextToken.value === "</") {
1751
+ return {
1752
+ text: "\n" + indent + "\n" + nextIndent,
1753
+ selection: [1, indent.length, 1, indent.length]
1754
+ };
1755
+ } else {
1756
+ return {
1757
+ text: "\n" + indent
1758
+ };
1759
+ }
1760
+ }
1761
+ }
1762
+ }
1763
+ });
1764
+
1765
+ };
1766
+
1767
+ oop.inherits(XmlBehaviour, Behaviour);
1768
+
1769
+ exports.XmlBehaviour = XmlBehaviour;
1770
+ });
1771
+
1772
+ ace.define("ace/mode/folding/mixed",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"], function(require, exports, module) {
1773
+ "use strict";
1774
+
1775
+ var oop = require("../../lib/oop");
1776
+ var BaseFoldMode = require("./fold_mode").FoldMode;
1777
+
1778
+ var FoldMode = exports.FoldMode = function(defaultMode, subModes) {
1779
+ this.defaultMode = defaultMode;
1780
+ this.subModes = subModes;
1781
+ };
1782
+ oop.inherits(FoldMode, BaseFoldMode);
1783
+
1784
+ (function() {
1785
+
1786
+
1787
+ this.$getMode = function(state) {
1788
+ if (typeof state != "string")
1789
+ state = state[0];
1790
+ for (var key in this.subModes) {
1791
+ if (state.indexOf(key) === 0)
1792
+ return this.subModes[key];
1793
+ }
1794
+ return null;
1795
+ };
1796
+
1797
+ this.$tryMode = function(state, session, foldStyle, row) {
1798
+ var mode = this.$getMode(state);
1799
+ return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
1800
+ };
1801
+
1802
+ this.getFoldWidget = function(session, foldStyle, row) {
1803
+ return (
1804
+ this.$tryMode(session.getState(row-1), session, foldStyle, row) ||
1805
+ this.$tryMode(session.getState(row), session, foldStyle, row) ||
1806
+ this.defaultMode.getFoldWidget(session, foldStyle, row)
1807
+ );
1808
+ };
1809
+
1810
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
1811
+ var mode = this.$getMode(session.getState(row-1));
1812
+
1813
+ if (!mode || !mode.getFoldWidget(session, foldStyle, row))
1814
+ mode = this.$getMode(session.getState(row));
1815
+
1816
+ if (!mode || !mode.getFoldWidget(session, foldStyle, row))
1817
+ mode = this.defaultMode;
1818
+
1819
+ return mode.getFoldWidgetRange(session, foldStyle, row);
1820
+ };
1821
+
1822
+ }).call(FoldMode.prototype);
1823
+
1824
+ });
1825
+
1826
+ ace.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) {
1827
+ "use strict";
1828
+
1829
+ var oop = require("../../lib/oop");
1830
+ var lang = require("../../lib/lang");
1831
+ var Range = require("../../range").Range;
1832
+ var BaseFoldMode = require("./fold_mode").FoldMode;
1833
+ var TokenIterator = require("../../token_iterator").TokenIterator;
1834
+
1835
+ var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
1836
+ BaseFoldMode.call(this);
1837
+ this.voidElements = voidElements || {};
1838
+ this.optionalEndTags = oop.mixin({}, this.voidElements);
1839
+ if (optionalEndTags)
1840
+ oop.mixin(this.optionalEndTags, optionalEndTags);
1841
+
1842
+ };
1843
+ oop.inherits(FoldMode, BaseFoldMode);
1844
+
1845
+ var Tag = function() {
1846
+ this.tagName = "";
1847
+ this.closing = false;
1848
+ this.selfClosing = false;
1849
+ this.start = {row: 0, column: 0};
1850
+ this.end = {row: 0, column: 0};
1851
+ };
1852
+
1853
+ function is(token, type) {
1854
+ return token.type.lastIndexOf(type + ".xml") > -1;
1855
+ }
1856
+
1857
+ (function() {
1858
+
1859
+ this.getFoldWidget = function(session, foldStyle, row) {
1860
+ var tag = this._getFirstTagInLine(session, row);
1861
+
1862
+ if (!tag)
1863
+ return "";
1864
+
1865
+ if (tag.closing || (!tag.tagName && tag.selfClosing))
1866
+ return foldStyle == "markbeginend" ? "end" : "";
1867
+
1868
+ if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase()))
1869
+ return "";
1870
+
1871
+ if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column))
1872
+ return "";
1873
+
1874
+ return "start";
1875
+ };
1876
+ this._getFirstTagInLine = function(session, row) {
1877
+ var tokens = session.getTokens(row);
1878
+ var tag = new Tag();
1879
+
1880
+ for (var i = 0; i < tokens.length; i++) {
1881
+ var token = tokens[i];
1882
+ if (is(token, "tag-open")) {
1883
+ tag.end.column = tag.start.column + token.value.length;
1884
+ tag.closing = is(token, "end-tag-open");
1885
+ token = tokens[++i];
1886
+ if (!token)
1887
+ return null;
1888
+ tag.tagName = token.value;
1889
+ tag.end.column += token.value.length;
1890
+ for (i++; i < tokens.length; i++) {
1891
+ token = tokens[i];
1892
+ tag.end.column += token.value.length;
1893
+ if (is(token, "tag-close")) {
1894
+ tag.selfClosing = token.value == '/>';
1895
+ break;
1896
+ }
1897
+ }
1898
+ return tag;
1899
+ } else if (is(token, "tag-close")) {
1900
+ tag.selfClosing = token.value == '/>';
1901
+ return tag;
1902
+ }
1903
+ tag.start.column += token.value.length;
1904
+ }
1905
+
1906
+ return null;
1907
+ };
1908
+
1909
+ this._findEndTagInLine = function(session, row, tagName, startColumn) {
1910
+ var tokens = session.getTokens(row);
1911
+ var column = 0;
1912
+ for (var i = 0; i < tokens.length; i++) {
1913
+ var token = tokens[i];
1914
+ column += token.value.length;
1915
+ if (column < startColumn)
1916
+ continue;
1917
+ if (is(token, "end-tag-open")) {
1918
+ token = tokens[i + 1];
1919
+ if (token && token.value == tagName)
1920
+ return true;
1921
+ }
1922
+ }
1923
+ return false;
1924
+ };
1925
+ this._readTagForward = function(iterator) {
1926
+ var token = iterator.getCurrentToken();
1927
+ if (!token)
1928
+ return null;
1929
+
1930
+ var tag = new Tag();
1931
+ do {
1932
+ if (is(token, "tag-open")) {
1933
+ tag.closing = is(token, "end-tag-open");
1934
+ tag.start.row = iterator.getCurrentTokenRow();
1935
+ tag.start.column = iterator.getCurrentTokenColumn();
1936
+ } else if (is(token, "tag-name")) {
1937
+ tag.tagName = token.value;
1938
+ } else if (is(token, "tag-close")) {
1939
+ tag.selfClosing = token.value == "/>";
1940
+ tag.end.row = iterator.getCurrentTokenRow();
1941
+ tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
1942
+ iterator.stepForward();
1943
+ return tag;
1944
+ }
1945
+ } while(token = iterator.stepForward());
1946
+
1947
+ return null;
1948
+ };
1949
+
1950
+ this._readTagBackward = function(iterator) {
1951
+ var token = iterator.getCurrentToken();
1952
+ if (!token)
1953
+ return null;
1954
+
1955
+ var tag = new Tag();
1956
+ do {
1957
+ if (is(token, "tag-open")) {
1958
+ tag.closing = is(token, "end-tag-open");
1959
+ tag.start.row = iterator.getCurrentTokenRow();
1960
+ tag.start.column = iterator.getCurrentTokenColumn();
1961
+ iterator.stepBackward();
1962
+ return tag;
1963
+ } else if (is(token, "tag-name")) {
1964
+ tag.tagName = token.value;
1965
+ } else if (is(token, "tag-close")) {
1966
+ tag.selfClosing = token.value == "/>";
1967
+ tag.end.row = iterator.getCurrentTokenRow();
1968
+ tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
1969
+ }
1970
+ } while(token = iterator.stepBackward());
1971
+
1972
+ return null;
1973
+ };
1974
+
1975
+ this._pop = function(stack, tag) {
1976
+ while (stack.length) {
1977
+
1978
+ var top = stack[stack.length-1];
1979
+ if (!tag || top.tagName == tag.tagName) {
1980
+ return stack.pop();
1981
+ }
1982
+ else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
1983
+ stack.pop();
1984
+ continue;
1985
+ } else {
1986
+ return null;
1987
+ }
1988
+ }
1989
+ };
1990
+
1991
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
1992
+ var firstTag = this._getFirstTagInLine(session, row);
1993
+
1994
+ if (!firstTag)
1995
+ return null;
1996
+
1997
+ var isBackward = firstTag.closing || firstTag.selfClosing;
1998
+ var stack = [];
1999
+ var tag;
2000
+
2001
+ if (!isBackward) {
2002
+ var iterator = new TokenIterator(session, row, firstTag.start.column);
2003
+ var start = {
2004
+ row: row,
2005
+ column: firstTag.start.column + firstTag.tagName.length + 2
2006
+ };
2007
+ while (tag = this._readTagForward(iterator)) {
2008
+ if (tag.selfClosing) {
2009
+ if (!stack.length) {
2010
+ tag.start.column += tag.tagName.length + 2;
2011
+ tag.end.column -= 2;
2012
+ return Range.fromPoints(tag.start, tag.end);
2013
+ } else
2014
+ continue;
2015
+ }
2016
+
2017
+ if (tag.closing) {
2018
+ this._pop(stack, tag);
2019
+ if (stack.length == 0)
2020
+ return Range.fromPoints(start, tag.start);
2021
+ }
2022
+ else {
2023
+ stack.push(tag);
2024
+ }
2025
+ }
2026
+ }
2027
+ else {
2028
+ var iterator = new TokenIterator(session, row, firstTag.end.column);
2029
+ var end = {
2030
+ row: row,
2031
+ column: firstTag.start.column
2032
+ };
2033
+
2034
+ while (tag = this._readTagBackward(iterator)) {
2035
+ if (tag.selfClosing) {
2036
+ if (!stack.length) {
2037
+ tag.start.column += tag.tagName.length + 2;
2038
+ tag.end.column -= 2;
2039
+ return Range.fromPoints(tag.start, tag.end);
2040
+ } else
2041
+ continue;
2042
+ }
2043
+
2044
+ if (!tag.closing) {
2045
+ this._pop(stack, tag);
2046
+ if (stack.length == 0) {
2047
+ tag.start.column += tag.tagName.length + 2;
2048
+ return Range.fromPoints(tag.start, end);
2049
+ }
2050
+ }
2051
+ else {
2052
+ stack.push(tag);
2053
+ }
2054
+ }
2055
+ }
2056
+
2057
+ };
2058
+
2059
+ }).call(FoldMode.prototype);
2060
+
2061
+ });
2062
+
2063
+ ace.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) {
2064
+ "use strict";
2065
+
2066
+ var oop = require("../../lib/oop");
2067
+ var MixedFoldMode = require("./mixed").FoldMode;
2068
+ var XmlFoldMode = require("./xml").FoldMode;
2069
+ var CStyleFoldMode = require("./cstyle").FoldMode;
2070
+
2071
+ var FoldMode = exports.FoldMode = function(voidElements, optionalTags) {
2072
+ MixedFoldMode.call(this, new XmlFoldMode(voidElements, optionalTags), {
2073
+ "js-": new CStyleFoldMode(),
2074
+ "css-": new CStyleFoldMode()
2075
+ });
2076
+ };
2077
+
2078
+ oop.inherits(FoldMode, MixedFoldMode);
2079
+
2080
+ });
2081
+
2082
+ ace.define("ace/mode/html_completions",["require","exports","module","ace/token_iterator"], function(require, exports, module) {
2083
+ "use strict";
2084
+
2085
+ var TokenIterator = require("../token_iterator").TokenIterator;
2086
+
2087
+ var commonAttributes = [
2088
+ "accesskey",
2089
+ "class",
2090
+ "contenteditable",
2091
+ "contextmenu",
2092
+ "dir",
2093
+ "draggable",
2094
+ "dropzone",
2095
+ "hidden",
2096
+ "id",
2097
+ "inert",
2098
+ "itemid",
2099
+ "itemprop",
2100
+ "itemref",
2101
+ "itemscope",
2102
+ "itemtype",
2103
+ "lang",
2104
+ "spellcheck",
2105
+ "style",
2106
+ "tabindex",
2107
+ "title",
2108
+ "translate"
2109
+ ];
2110
+
2111
+ var eventAttributes = [
2112
+ "onabort",
2113
+ "onblur",
2114
+ "oncancel",
2115
+ "oncanplay",
2116
+ "oncanplaythrough",
2117
+ "onchange",
2118
+ "onclick",
2119
+ "onclose",
2120
+ "oncontextmenu",
2121
+ "oncuechange",
2122
+ "ondblclick",
2123
+ "ondrag",
2124
+ "ondragend",
2125
+ "ondragenter",
2126
+ "ondragleave",
2127
+ "ondragover",
2128
+ "ondragstart",
2129
+ "ondrop",
2130
+ "ondurationchange",
2131
+ "onemptied",
2132
+ "onended",
2133
+ "onerror",
2134
+ "onfocus",
2135
+ "oninput",
2136
+ "oninvalid",
2137
+ "onkeydown",
2138
+ "onkeypress",
2139
+ "onkeyup",
2140
+ "onload",
2141
+ "onloadeddata",
2142
+ "onloadedmetadata",
2143
+ "onloadstart",
2144
+ "onmousedown",
2145
+ "onmousemove",
2146
+ "onmouseout",
2147
+ "onmouseover",
2148
+ "onmouseup",
2149
+ "onmousewheel",
2150
+ "onpause",
2151
+ "onplay",
2152
+ "onplaying",
2153
+ "onprogress",
2154
+ "onratechange",
2155
+ "onreset",
2156
+ "onscroll",
2157
+ "onseeked",
2158
+ "onseeking",
2159
+ "onselect",
2160
+ "onshow",
2161
+ "onstalled",
2162
+ "onsubmit",
2163
+ "onsuspend",
2164
+ "ontimeupdate",
2165
+ "onvolumechange",
2166
+ "onwaiting"
2167
+ ];
2168
+
2169
+ var globalAttributes = commonAttributes.concat(eventAttributes);
2170
+
2171
+ var attributeMap = {
2172
+ "html": ["manifest"],
2173
+ "head": [],
2174
+ "title": [],
2175
+ "base": ["href", "target"],
2176
+ "link": ["href", "hreflang", "rel", "media", "type", "sizes"],
2177
+ "meta": ["http-equiv", "name", "content", "charset"],
2178
+ "style": ["type", "media", "scoped"],
2179
+ "script": ["charset", "type", "src", "defer", "async"],
2180
+ "noscript": ["href"],
2181
+ "body": ["onafterprint", "onbeforeprint", "onbeforeunload", "onhashchange", "onmessage", "onoffline", "onpopstate", "onredo", "onresize", "onstorage", "onundo", "onunload"],
2182
+ "section": [],
2183
+ "nav": [],
2184
+ "article": ["pubdate"],
2185
+ "aside": [],
2186
+ "h1": [],
2187
+ "h2": [],
2188
+ "h3": [],
2189
+ "h4": [],
2190
+ "h5": [],
2191
+ "h6": [],
2192
+ "header": [],
2193
+ "footer": [],
2194
+ "address": [],
2195
+ "main": [],
2196
+ "p": [],
2197
+ "hr": [],
2198
+ "pre": [],
2199
+ "blockquote": ["cite"],
2200
+ "ol": ["start", "reversed"],
2201
+ "ul": [],
2202
+ "li": ["value"],
2203
+ "dl": [],
2204
+ "dt": [],
2205
+ "dd": [],
2206
+ "figure": [],
2207
+ "figcaption": [],
2208
+ "div": [],
2209
+ "a": ["href", "target", "ping", "rel", "media", "hreflang", "type"],
2210
+ "em": [],
2211
+ "strong": [],
2212
+ "small": [],
2213
+ "s": [],
2214
+ "cite": [],
2215
+ "q": ["cite"],
2216
+ "dfn": [],
2217
+ "abbr": [],
2218
+ "data": [],
2219
+ "time": ["datetime"],
2220
+ "code": [],
2221
+ "var": [],
2222
+ "samp": [],
2223
+ "kbd": [],
2224
+ "sub": [],
2225
+ "sup": [],
2226
+ "i": [],
2227
+ "b": [],
2228
+ "u": [],
2229
+ "mark": [],
2230
+ "ruby": [],
2231
+ "rt": [],
2232
+ "rp": [],
2233
+ "bdi": [],
2234
+ "bdo": [],
2235
+ "span": [],
2236
+ "br": [],
2237
+ "wbr": [],
2238
+ "ins": ["cite", "datetime"],
2239
+ "del": ["cite", "datetime"],
2240
+ "img": ["alt", "src", "height", "width", "usemap", "ismap"],
2241
+ "iframe": ["name", "src", "height", "width", "sandbox", "seamless"],
2242
+ "embed": ["src", "height", "width", "type"],
2243
+ "object": ["param", "data", "type", "height" , "width", "usemap", "name", "form", "classid"],
2244
+ "param": ["name", "value"],
2245
+ "video": ["src", "autobuffer", "autoplay", "loop", "controls", "width", "height", "poster"],
2246
+ "audio": ["src", "autobuffer", "autoplay", "loop", "controls"],
2247
+ "source": ["src", "type", "media"],
2248
+ "track": ["kind", "src", "srclang", "label", "default"],
2249
+ "canvas": ["width", "height"],
2250
+ "map": ["name"],
2251
+ "area": ["shape", "coords", "href", "hreflang", "alt", "target", "media", "rel", "ping", "type"],
2252
+ "svg": [],
2253
+ "math": [],
2254
+ "table": ["summary"],
2255
+ "caption": [],
2256
+ "colgroup": ["span"],
2257
+ "col": ["span"],
2258
+ "tbody": [],
2259
+ "thead": [],
2260
+ "tfoot": [],
2261
+ "tr": [],
2262
+ "td": ["headers", "rowspan", "colspan"],
2263
+ "th": ["headers", "rowspan", "colspan", "scope"],
2264
+ "form": ["accept-charset", "action", "autocomplete", "enctype", "method", "name", "novalidate", "target"],
2265
+ "fieldset": ["disabled", "form", "name"],
2266
+ "legend": [],
2267
+ "label": ["form", "for"],
2268
+ "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"],
2269
+ "button": ["autofocus", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "name", "value", "type"],
2270
+ "select": ["autofocus", "disabled", "form", "multiple", "name", "size"],
2271
+ "datalist": [],
2272
+ "optgroup": ["disabled", "label"],
2273
+ "option": ["disabled", "selected", "label", "value"],
2274
+ "textarea": ["autofocus", "disabled", "form", "maxlength", "name", "placeholder", "readonly", "required", "rows", "cols", "wrap"],
2275
+ "keygen": ["autofocus", "challenge", "disabled", "form", "keytype", "name"],
2276
+ "output": ["for", "form", "name"],
2277
+ "progress": ["value", "max"],
2278
+ "meter": ["value", "min", "max", "low", "high", "optimum"],
2279
+ "details": ["open"],
2280
+ "summary": [],
2281
+ "command": ["type", "label", "icon", "disabled", "checked", "radiogroup", "command"],
2282
+ "menu": ["type", "label"],
2283
+ "dialog": ["open"]
2284
+ };
2285
+
2286
+ var elements = Object.keys(attributeMap);
2287
+
2288
+ function is(token, type) {
2289
+ return token.type.lastIndexOf(type + ".xml") > -1;
2290
+ }
2291
+
2292
+ function findTagName(session, pos) {
2293
+ var iterator = new TokenIterator(session, pos.row, pos.column);
2294
+ var token = iterator.getCurrentToken();
2295
+ while (token && !is(token, "tag-name")){
2296
+ token = iterator.stepBackward();
2297
+ }
2298
+ if (token)
2299
+ return token.value;
2300
+ }
2301
+
2302
+ var HtmlCompletions = function() {
2303
+
2304
+ };
2305
+
2306
+ (function() {
2307
+
2308
+ this.getCompletions = function(state, session, pos, prefix) {
2309
+ var token = session.getTokenAt(pos.row, pos.column);
2310
+
2311
+ if (!token)
2312
+ return [];
2313
+ if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open"))
2314
+ return this.getTagCompletions(state, session, pos, prefix);
2315
+ if (is(token, "tag-whitespace") || is(token, "attribute-name"))
2316
+ return this.getAttributeCompetions(state, session, pos, prefix);
2317
+
2318
+ return [];
2319
+ };
2320
+
2321
+ this.getTagCompletions = function(state, session, pos, prefix) {
2322
+ return elements.map(function(element){
2323
+ return {
2324
+ value: element,
2325
+ meta: "tag",
2326
+ score: Number.MAX_VALUE
2327
+ };
2328
+ });
2329
+ };
2330
+
2331
+ this.getAttributeCompetions = function(state, session, pos, prefix) {
2332
+ var tagName = findTagName(session, pos);
2333
+ if (!tagName)
2334
+ return [];
2335
+ var attributes = globalAttributes;
2336
+ if (tagName in attributeMap) {
2337
+ attributes = attributes.concat(attributeMap[tagName]);
2338
+ }
2339
+ return attributes.map(function(attribute){
2340
+ return {
2341
+ caption: attribute,
2342
+ snippet: attribute + '="$0"',
2343
+ meta: "attribute",
2344
+ score: Number.MAX_VALUE
2345
+ };
2346
+ });
2347
+ };
2348
+
2349
+ }).call(HtmlCompletions.prototype);
2350
+
2351
+ exports.HtmlCompletions = HtmlCompletions;
2352
+ });
2353
+
2354
+ ace.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) {
2355
+ "use strict";
2356
+
2357
+ var oop = require("../lib/oop");
2358
+ var lang = require("../lib/lang");
2359
+ var TextMode = require("./text").Mode;
2360
+ var JavaScriptMode = require("./javascript").Mode;
2361
+ var CssMode = require("./css").Mode;
2362
+ var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
2363
+ var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
2364
+ var HtmlFoldMode = require("./folding/html").FoldMode;
2365
+ var HtmlCompletions = require("./html_completions").HtmlCompletions;
2366
+ var WorkerClient = require("../worker/worker_client").WorkerClient;
2367
+ var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr"];
2368
+ var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"];
2369
+
2370
+ var Mode = function(options) {
2371
+ this.fragmentContext = options && options.fragmentContext;
2372
+ this.HighlightRules = HtmlHighlightRules;
2373
+ this.$behaviour = new XmlBehaviour();
2374
+ this.$completer = new HtmlCompletions();
2375
+
2376
+ this.createModeDelegates({
2377
+ "js-": JavaScriptMode,
2378
+ "css-": CssMode
2379
+ });
2380
+
2381
+ this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags));
2382
+ };
2383
+ oop.inherits(Mode, TextMode);
2384
+
2385
+ (function() {
2386
+
2387
+ this.blockComment = {start: "<!--", end: "-->"};
2388
+
2389
+ this.voidElements = lang.arrayToMap(voidElements);
2390
+
2391
+ this.getNextLineIndent = function(state, line, tab) {
2392
+ return this.$getIndent(line);
2393
+ };
2394
+
2395
+ this.checkOutdent = function(state, line, input) {
2396
+ return false;
2397
+ };
2398
+
2399
+ this.getCompletions = function(state, session, pos, prefix) {
2400
+ return this.$completer.getCompletions(state, session, pos, prefix);
2401
+ };
2402
+
2403
+ this.createWorker = function(session) {
2404
+ if (this.constructor != Mode)
2405
+ return;
2406
+ var worker = new WorkerClient(["ace"], "ace/mode/html_worker", "Worker");
2407
+ worker.attachToDocument(session.getDocument());
2408
+
2409
+ if (this.fragmentContext)
2410
+ worker.call("setOptions", [{context: this.fragmentContext}]);
2411
+
2412
+ worker.on("error", function(e) {
2413
+ session.setAnnotations(e.data);
2414
+ });
2415
+
2416
+ worker.on("terminate", function() {
2417
+ session.clearAnnotations();
2418
+ });
2419
+
2420
+ return worker;
2421
+ };
2422
+
2423
+ this.$id = "ace/mode/html";
2424
+ }).call(Mode.prototype);
2425
+
2426
+ exports.Mode = Mode;
2427
+ });