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,2955 @@
1
+ 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) {
2
+ "use strict";
3
+
4
+ var oop = require("../lib/oop");
5
+ var lang = require("../lib/lang");
6
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
7
+ 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";
8
+ var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
9
+ 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";
10
+ var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow";
11
+ 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";
12
+
13
+ var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
14
+ var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
15
+ 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";
16
+
17
+ var CssHighlightRules = function() {
18
+
19
+ var keywordMapper = this.createKeywordMapper({
20
+ "support.function": supportFunction,
21
+ "support.constant": supportConstant,
22
+ "support.type": supportType,
23
+ "support.constant.color": supportConstantColor,
24
+ "support.constant.fonts": supportConstantFonts
25
+ }, "text", true);
26
+
27
+ this.$rules = {
28
+ "start" : [{
29
+ token : "comment", // multi line comment
30
+ regex : "\\/\\*",
31
+ push : "comment"
32
+ }, {
33
+ token: "paren.lparen",
34
+ regex: "\\{",
35
+ push: "ruleset"
36
+ }, {
37
+ token: "string",
38
+ regex: "@.*?{",
39
+ push: "media"
40
+ }, {
41
+ token: "keyword",
42
+ regex: "#[a-z0-9-_]+"
43
+ }, {
44
+ token: "variable",
45
+ regex: "\\.[a-z0-9-_]+"
46
+ }, {
47
+ token: "string",
48
+ regex: ":[a-z0-9-_]+"
49
+ }, {
50
+ token: "constant",
51
+ regex: "[a-z0-9-_]+"
52
+ }, {
53
+ caseInsensitive: true
54
+ }],
55
+
56
+ "media" : [{
57
+ token : "comment", // multi line comment
58
+ regex : "\\/\\*",
59
+ push : "comment"
60
+ }, {
61
+ token: "paren.lparen",
62
+ regex: "\\{",
63
+ push: "ruleset"
64
+ }, {
65
+ token: "string",
66
+ regex: "\\}",
67
+ next: "pop"
68
+ }, {
69
+ token: "keyword",
70
+ regex: "#[a-z0-9-_]+"
71
+ }, {
72
+ token: "variable",
73
+ regex: "\\.[a-z0-9-_]+"
74
+ }, {
75
+ token: "string",
76
+ regex: ":[a-z0-9-_]+"
77
+ }, {
78
+ token: "constant",
79
+ regex: "[a-z0-9-_]+"
80
+ }, {
81
+ caseInsensitive: true
82
+ }],
83
+
84
+ "comment" : [{
85
+ token : "comment",
86
+ regex : "\\*\\/",
87
+ next : "pop"
88
+ }, {
89
+ defaultToken : "comment"
90
+ }],
91
+
92
+ "ruleset" : [
93
+ {
94
+ token : "paren.rparen",
95
+ regex : "\\}",
96
+ next: "pop"
97
+ }, {
98
+ token : "comment", // multi line comment
99
+ regex : "\\/\\*",
100
+ push : "comment"
101
+ }, {
102
+ token : "string", // single line
103
+ regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
104
+ }, {
105
+ token : "string", // single line
106
+ regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
107
+ }, {
108
+ token : ["constant.numeric", "keyword"],
109
+ 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|%)"
110
+ }, {
111
+ token : "constant.numeric",
112
+ regex : numRe
113
+ }, {
114
+ token : "constant.numeric", // hex6 color
115
+ regex : "#[a-f0-9]{6}"
116
+ }, {
117
+ token : "constant.numeric", // hex3 color
118
+ regex : "#[a-f0-9]{3}"
119
+ }, {
120
+ token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
121
+ regex : pseudoElements
122
+ }, {
123
+ token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
124
+ regex : pseudoClasses
125
+ }, {
126
+ token : ["support.function", "string", "support.function"],
127
+ regex : "(url\\()(.*)(\\))"
128
+ }, {
129
+ token : keywordMapper,
130
+ regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
131
+ }, {
132
+ caseInsensitive: true
133
+ }]
134
+ };
135
+
136
+ this.normalizeRules();
137
+ };
138
+
139
+ oop.inherits(CssHighlightRules, TextHighlightRules);
140
+
141
+ exports.CssHighlightRules = CssHighlightRules;
142
+
143
+ });
144
+
145
+ ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
146
+ "use strict";
147
+
148
+ var oop = require("../lib/oop");
149
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
150
+
151
+ var DocCommentHighlightRules = function() {
152
+ this.$rules = {
153
+ "start" : [ {
154
+ token : "comment.doc.tag",
155
+ regex : "@[\\w\\d_]+" // TODO: fix email addresses
156
+ },
157
+ DocCommentHighlightRules.getTagRule(),
158
+ {
159
+ defaultToken : "comment.doc",
160
+ caseInsensitive: true
161
+ }]
162
+ };
163
+ };
164
+
165
+ oop.inherits(DocCommentHighlightRules, TextHighlightRules);
166
+
167
+ DocCommentHighlightRules.getTagRule = function(start) {
168
+ return {
169
+ token : "comment.doc.tag.storage.type",
170
+ regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
171
+ };
172
+ }
173
+
174
+ DocCommentHighlightRules.getStartRule = function(start) {
175
+ return {
176
+ token : "comment.doc", // doc comment
177
+ regex : "\\/\\*(?=\\*)",
178
+ next : start
179
+ };
180
+ };
181
+
182
+ DocCommentHighlightRules.getEndRule = function (start) {
183
+ return {
184
+ token : "comment.doc", // closing comment
185
+ regex : "\\*\\/",
186
+ next : start
187
+ };
188
+ };
189
+
190
+
191
+ exports.DocCommentHighlightRules = DocCommentHighlightRules;
192
+
193
+ });
194
+
195
+ 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) {
196
+ "use strict";
197
+
198
+ var oop = require("../lib/oop");
199
+ var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
200
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
201
+
202
+ var JavaScriptHighlightRules = function(options) {
203
+ var keywordMapper = this.createKeywordMapper({
204
+ "variable.language":
205
+ "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
206
+ "Namespace|QName|XML|XMLList|" + // E4X
207
+ "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
208
+ "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
209
+ "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
210
+ "SyntaxError|TypeError|URIError|" +
211
+ "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
212
+ "isNaN|parseFloat|parseInt|" +
213
+ "JSON|Math|" + // Other
214
+ "this|arguments|prototype|window|document" , // Pseudo
215
+ "keyword":
216
+ "const|yield|import|get|set|" +
217
+ "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
218
+ "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
219
+ "__parent__|__count__|escape|unescape|with|__proto__|" +
220
+ "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
221
+ "storage.type":
222
+ "const|let|var|function",
223
+ "constant.language":
224
+ "null|Infinity|NaN|undefined",
225
+ "support.function":
226
+ "alert",
227
+ "constant.language.boolean": "true|false"
228
+ }, "identifier");
229
+ var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
230
+ var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
231
+
232
+ var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
233
+ "u[0-9a-fA-F]{4}|" + // unicode
234
+ "[0-2][0-7]{0,2}|" + // oct
235
+ "3[0-6][0-7]?|" + // oct
236
+ "37[0-7]?|" + // oct
237
+ "[4-7][0-7]?|" + //oct
238
+ ".)";
239
+
240
+ this.$rules = {
241
+ "no_regex" : [
242
+ {
243
+ token : "comment",
244
+ regex : "\\/\\/",
245
+ next : "line_comment"
246
+ },
247
+ DocCommentHighlightRules.getStartRule("doc-start"),
248
+ {
249
+ token : "comment", // multi line comment
250
+ regex : /\/\*/,
251
+ next : "comment"
252
+ }, {
253
+ token : "string",
254
+ regex : "'(?=.)",
255
+ next : "qstring"
256
+ }, {
257
+ token : "string",
258
+ regex : '"(?=.)',
259
+ next : "qqstring"
260
+ }, {
261
+ token : "constant.numeric", // hex
262
+ regex : /0[xX][0-9a-fA-F]+\b/
263
+ }, {
264
+ token : "constant.numeric", // float
265
+ regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
266
+ }, {
267
+ token : [
268
+ "storage.type", "punctuation.operator", "support.function",
269
+ "punctuation.operator", "entity.name.function", "text","keyword.operator"
270
+ ],
271
+ regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
272
+ next: "function_arguments"
273
+ }, {
274
+ token : [
275
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
276
+ "keyword.operator", "text", "storage.type", "text", "paren.lparen"
277
+ ],
278
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
279
+ next: "function_arguments"
280
+ }, {
281
+ token : [
282
+ "entity.name.function", "text", "keyword.operator", "text", "storage.type",
283
+ "text", "paren.lparen"
284
+ ],
285
+ regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
286
+ next: "function_arguments"
287
+ }, {
288
+ token : [
289
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
290
+ "keyword.operator", "text",
291
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
292
+ ],
293
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
294
+ next: "function_arguments"
295
+ }, {
296
+ token : [
297
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
298
+ ],
299
+ regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
300
+ next: "function_arguments"
301
+ }, {
302
+ token : [
303
+ "entity.name.function", "text", "punctuation.operator",
304
+ "text", "storage.type", "text", "paren.lparen"
305
+ ],
306
+ regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
307
+ next: "function_arguments"
308
+ }, {
309
+ token : [
310
+ "text", "text", "storage.type", "text", "paren.lparen"
311
+ ],
312
+ regex : "(:)(\\s*)(function)(\\s*)(\\()",
313
+ next: "function_arguments"
314
+ }, {
315
+ token : "keyword",
316
+ regex : "(?:" + kwBeforeRe + ")\\b",
317
+ next : "start"
318
+ }, {
319
+ token : ["punctuation.operator", "support.function"],
320
+ 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(?=\()/
321
+ }, {
322
+ token : ["punctuation.operator", "support.function.dom"],
323
+ 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(?=\()/
324
+ }, {
325
+ token : ["punctuation.operator", "support.constant"],
326
+ 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/
327
+ }, {
328
+ token : ["support.constant"],
329
+ regex : /that\b/
330
+ }, {
331
+ token : ["storage.type", "punctuation.operator", "support.function.firebug"],
332
+ regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
333
+ }, {
334
+ token : keywordMapper,
335
+ regex : identifierRe
336
+ }, {
337
+ token : "keyword.operator",
338
+ regex : /--|\+\+|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|[!$%&*+\-~\/^]=?/,
339
+ next : "start"
340
+ }, {
341
+ token : "punctuation.operator",
342
+ regex : /[?:,;.]/,
343
+ next : "start"
344
+ }, {
345
+ token : "paren.lparen",
346
+ regex : /[\[({]/,
347
+ next : "start"
348
+ }, {
349
+ token : "paren.rparen",
350
+ regex : /[\])}]/
351
+ }, {
352
+ token: "comment",
353
+ regex: /^#!.*$/
354
+ }
355
+ ],
356
+ "start": [
357
+ DocCommentHighlightRules.getStartRule("doc-start"),
358
+ {
359
+ token : "comment", // multi line comment
360
+ regex : "\\/\\*",
361
+ next : "comment_regex_allowed"
362
+ }, {
363
+ token : "comment",
364
+ regex : "\\/\\/",
365
+ next : "line_comment_regex_allowed"
366
+ }, {
367
+ token: "string.regexp",
368
+ regex: "\\/",
369
+ next: "regex"
370
+ }, {
371
+ token : "text",
372
+ regex : "\\s+|^$",
373
+ next : "start"
374
+ }, {
375
+ token: "empty",
376
+ regex: "",
377
+ next: "no_regex"
378
+ }
379
+ ],
380
+ "regex": [
381
+ {
382
+ token: "regexp.keyword.operator",
383
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
384
+ }, {
385
+ token: "string.regexp",
386
+ regex: "/[sxngimy]*",
387
+ next: "no_regex"
388
+ }, {
389
+ token : "invalid",
390
+ regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
391
+ }, {
392
+ token : "constant.language.escape",
393
+ regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
394
+ }, {
395
+ token : "constant.language.delimiter",
396
+ regex: /\|/
397
+ }, {
398
+ token: "constant.language.escape",
399
+ regex: /\[\^?/,
400
+ next: "regex_character_class"
401
+ }, {
402
+ token: "empty",
403
+ regex: "$",
404
+ next: "no_regex"
405
+ }, {
406
+ defaultToken: "string.regexp"
407
+ }
408
+ ],
409
+ "regex_character_class": [
410
+ {
411
+ token: "regexp.charclass.keyword.operator",
412
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
413
+ }, {
414
+ token: "constant.language.escape",
415
+ regex: "]",
416
+ next: "regex"
417
+ }, {
418
+ token: "constant.language.escape",
419
+ regex: "-"
420
+ }, {
421
+ token: "empty",
422
+ regex: "$",
423
+ next: "no_regex"
424
+ }, {
425
+ defaultToken: "string.regexp.charachterclass"
426
+ }
427
+ ],
428
+ "function_arguments": [
429
+ {
430
+ token: "variable.parameter",
431
+ regex: identifierRe
432
+ }, {
433
+ token: "punctuation.operator",
434
+ regex: "[, ]+"
435
+ }, {
436
+ token: "punctuation.operator",
437
+ regex: "$"
438
+ }, {
439
+ token: "empty",
440
+ regex: "",
441
+ next: "no_regex"
442
+ }
443
+ ],
444
+ "comment_regex_allowed" : [
445
+ DocCommentHighlightRules.getTagRule(),
446
+ {token : "comment", regex : "\\*\\/", next : "start"},
447
+ {defaultToken : "comment", caseInsensitive: true}
448
+ ],
449
+ "comment" : [
450
+ DocCommentHighlightRules.getTagRule(),
451
+ {token : "comment", regex : "\\*\\/", next : "no_regex"},
452
+ {defaultToken : "comment", caseInsensitive: true}
453
+ ],
454
+ "line_comment_regex_allowed" : [
455
+ DocCommentHighlightRules.getTagRule(),
456
+ {token : "comment", regex : "$|^", next : "start"},
457
+ {defaultToken : "comment", caseInsensitive: true}
458
+ ],
459
+ "line_comment" : [
460
+ DocCommentHighlightRules.getTagRule(),
461
+ {token : "comment", regex : "$|^", next : "no_regex"},
462
+ {defaultToken : "comment", caseInsensitive: true}
463
+ ],
464
+ "qqstring" : [
465
+ {
466
+ token : "constant.language.escape",
467
+ regex : escapedRe
468
+ }, {
469
+ token : "string",
470
+ regex : "\\\\$",
471
+ next : "qqstring"
472
+ }, {
473
+ token : "string",
474
+ regex : '"|$',
475
+ next : "no_regex"
476
+ }, {
477
+ defaultToken: "string"
478
+ }
479
+ ],
480
+ "qstring" : [
481
+ {
482
+ token : "constant.language.escape",
483
+ regex : escapedRe
484
+ }, {
485
+ token : "string",
486
+ regex : "\\\\$",
487
+ next : "qstring"
488
+ }, {
489
+ token : "string",
490
+ regex : "'|$",
491
+ next : "no_regex"
492
+ }, {
493
+ defaultToken: "string"
494
+ }
495
+ ]
496
+ };
497
+
498
+
499
+ if (!options || !options.noES6) {
500
+ this.$rules.no_regex.unshift({
501
+ regex: "[{}]", onMatch: function(val, state, stack) {
502
+ this.next = val == "{" ? this.nextState : "";
503
+ if (val == "{" && stack.length) {
504
+ stack.unshift("start", state);
505
+ return "paren";
506
+ }
507
+ if (val == "}" && stack.length) {
508
+ stack.shift();
509
+ this.next = stack.shift();
510
+ if (this.next.indexOf("string") != -1)
511
+ return "paren.quasi.end";
512
+ }
513
+ return val == "{" ? "paren.lparen" : "paren.rparen";
514
+ },
515
+ nextState: "start"
516
+ }, {
517
+ token : "string.quasi.start",
518
+ regex : /`/,
519
+ push : [{
520
+ token : "constant.language.escape",
521
+ regex : escapedRe
522
+ }, {
523
+ token : "paren.quasi.start",
524
+ regex : /\${/,
525
+ push : "start"
526
+ }, {
527
+ token : "string.quasi.end",
528
+ regex : /`/,
529
+ next : "pop"
530
+ }, {
531
+ defaultToken: "string.quasi"
532
+ }]
533
+ });
534
+ }
535
+
536
+ this.embedRules(DocCommentHighlightRules, "doc-",
537
+ [ DocCommentHighlightRules.getEndRule("no_regex") ]);
538
+
539
+ this.normalizeRules();
540
+ };
541
+
542
+ oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
543
+
544
+ exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
545
+ });
546
+
547
+ ace.define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
548
+ "use strict";
549
+
550
+ var oop = require("../lib/oop");
551
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
552
+
553
+ var XmlHighlightRules = function(normalize) {
554
+ this.$rules = {
555
+ start : [
556
+ {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"},
557
+ {
558
+ token : ["punctuation.xml-decl.xml", "keyword.xml-decl.xml"],
559
+ regex : "(<\\?)(xml)(?=[\\s])", next : "xml_decl", caseInsensitive: true
560
+ },
561
+ {
562
+ token : ["punctuation.instruction.xml", "keyword.instruction.xml"],
563
+ regex : "(<\\?)([-_a-zA-Z0-9]+)", next : "processing_instruction",
564
+ },
565
+ {token : "comment.xml", regex : "<\\!--", next : "comment"},
566
+ {
567
+ token : ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
568
+ regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype", caseInsensitive: true
569
+ },
570
+ {include : "tag"},
571
+ {token : "text.end-tag-open.xml", regex: "</"},
572
+ {token : "text.tag-open.xml", regex: "<"},
573
+ {include : "reference"},
574
+ {defaultToken : "text.xml"}
575
+ ],
576
+
577
+ xml_decl : [{
578
+ token : "entity.other.attribute-name.decl-attribute-name.xml",
579
+ regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+"
580
+ }, {
581
+ token : "keyword.operator.decl-attribute-equals.xml",
582
+ regex : "="
583
+ }, {
584
+ include: "whitespace"
585
+ }, {
586
+ include: "string"
587
+ }, {
588
+ token : "punctuation.xml-decl.xml",
589
+ regex : "\\?>",
590
+ next : "start"
591
+ }],
592
+
593
+ processing_instruction : [
594
+ {token : "punctuation.instruction.xml", regex : "\\?>", next : "start"},
595
+ {defaultToken : "instruction.xml"}
596
+ ],
597
+
598
+ doctype : [
599
+ {include : "whitespace"},
600
+ {include : "string"},
601
+ {token : "xml-pe.doctype.xml", regex : ">", next : "start"},
602
+ {token : "xml-pe.xml", regex : "[-_a-zA-Z0-9:]+"},
603
+ {token : "punctuation.int-subset", regex : "\\[", push : "int_subset"}
604
+ ],
605
+
606
+ int_subset : [{
607
+ token : "text.xml",
608
+ regex : "\\s+"
609
+ }, {
610
+ token: "punctuation.int-subset.xml",
611
+ regex: "]",
612
+ next: "pop"
613
+ }, {
614
+ token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
615
+ regex : "(<\\!)([-_a-zA-Z0-9]+)",
616
+ push : [{
617
+ token : "text",
618
+ regex : "\\s+"
619
+ },
620
+ {
621
+ token : "punctuation.markup-decl.xml",
622
+ regex : ">",
623
+ next : "pop"
624
+ },
625
+ {include : "string"}]
626
+ }],
627
+
628
+ cdata : [
629
+ {token : "string.cdata.xml", regex : "\\]\\]>", next : "start"},
630
+ {token : "text.xml", regex : "\\s+"},
631
+ {token : "text.xml", regex : "(?:[^\\]]|\\](?!\\]>))+"}
632
+ ],
633
+
634
+ comment : [
635
+ {token : "comment.xml", regex : "-->", next : "start"},
636
+ {defaultToken : "comment.xml"}
637
+ ],
638
+
639
+ reference : [{
640
+ token : "constant.language.escape.reference.xml",
641
+ regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
642
+ }],
643
+
644
+ attr_reference : [{
645
+ token : "constant.language.escape.reference.attribute-value.xml",
646
+ regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
647
+ }],
648
+
649
+ tag : [{
650
+ token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
651
+ regex : "(?:(<)|(</))((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)",
652
+ next: [
653
+ {include : "attributes"},
654
+ {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
655
+ ]
656
+ }],
657
+
658
+ tag_whitespace : [
659
+ {token : "text.tag-whitespace.xml", regex : "\\s+"}
660
+ ],
661
+ whitespace : [
662
+ {token : "text.whitespace.xml", regex : "\\s+"}
663
+ ],
664
+ string: [{
665
+ token : "string.xml",
666
+ regex : "'",
667
+ push : [
668
+ {token : "string.xml", regex: "'", next: "pop"},
669
+ {defaultToken : "string.xml"}
670
+ ]
671
+ }, {
672
+ token : "string.xml",
673
+ regex : '"',
674
+ push : [
675
+ {token : "string.xml", regex: '"', next: "pop"},
676
+ {defaultToken : "string.xml"}
677
+ ]
678
+ }],
679
+
680
+ attributes: [{
681
+ token : "entity.other.attribute-name.xml",
682
+ regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+"
683
+ }, {
684
+ token : "keyword.operator.attribute-equals.xml",
685
+ regex : "="
686
+ }, {
687
+ include: "tag_whitespace"
688
+ }, {
689
+ include: "attribute_value"
690
+ }],
691
+
692
+ attribute_value: [{
693
+ token : "string.attribute-value.xml",
694
+ regex : "'",
695
+ push : [
696
+ {token : "string.attribute-value.xml", regex: "'", next: "pop"},
697
+ {include : "attr_reference"},
698
+ {defaultToken : "string.attribute-value.xml"}
699
+ ]
700
+ }, {
701
+ token : "string.attribute-value.xml",
702
+ regex : '"',
703
+ push : [
704
+ {token : "string.attribute-value.xml", regex: '"', next: "pop"},
705
+ {include : "attr_reference"},
706
+ {defaultToken : "string.attribute-value.xml"}
707
+ ]
708
+ }]
709
+ };
710
+
711
+ if (this.constructor === XmlHighlightRules)
712
+ this.normalizeRules();
713
+ };
714
+
715
+
716
+ (function() {
717
+
718
+ this.embedTagRules = function(HighlightRules, prefix, tag){
719
+ this.$rules.tag.unshift({
720
+ token : ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
721
+ regex : "(<)(" + tag + "(?=\\s|>|$))",
722
+ next: [
723
+ {include : "attributes"},
724
+ {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : prefix + "start"}
725
+ ]
726
+ });
727
+
728
+ this.$rules[tag + "-end"] = [
729
+ {include : "attributes"},
730
+ {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next: "start",
731
+ onMatch : function(value, currentState, stack) {
732
+ stack.splice(0);
733
+ return this.token;
734
+ }}
735
+ ]
736
+
737
+ this.embedRules(HighlightRules, prefix, [{
738
+ token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
739
+ regex : "(</)(" + tag + "(?=\\s|>|$))",
740
+ next: tag + "-end"
741
+ }, {
742
+ token: "string.cdata.xml",
743
+ regex : "<\\!\\[CDATA\\["
744
+ }, {
745
+ token: "string.cdata.xml",
746
+ regex : "\\]\\]>"
747
+ }]);
748
+ };
749
+
750
+ }).call(TextHighlightRules.prototype);
751
+
752
+ oop.inherits(XmlHighlightRules, TextHighlightRules);
753
+
754
+ exports.XmlHighlightRules = XmlHighlightRules;
755
+ });
756
+
757
+ 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) {
758
+ "use strict";
759
+
760
+ var oop = require("../lib/oop");
761
+ var lang = require("../lib/lang");
762
+ var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
763
+ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
764
+ var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
765
+
766
+ var tagMap = lang.createMap({
767
+ a : 'anchor',
768
+ button : 'form',
769
+ form : 'form',
770
+ img : 'image',
771
+ input : 'form',
772
+ label : 'form',
773
+ option : 'form',
774
+ script : 'script',
775
+ select : 'form',
776
+ textarea : 'form',
777
+ style : 'style',
778
+ table : 'table',
779
+ tbody : 'table',
780
+ td : 'table',
781
+ tfoot : 'table',
782
+ th : 'table',
783
+ tr : 'table'
784
+ });
785
+
786
+ var HtmlHighlightRules = function() {
787
+ XmlHighlightRules.call(this);
788
+
789
+ this.addRules({
790
+ attributes: [{
791
+ include : "tag_whitespace"
792
+ }, {
793
+ token : "entity.other.attribute-name.xml",
794
+ regex : "[-_a-zA-Z0-9:]+"
795
+ }, {
796
+ token : "keyword.operator.attribute-equals.xml",
797
+ regex : "=",
798
+ push : [{
799
+ include: "tag_whitespace"
800
+ }, {
801
+ token : "string.unquoted.attribute-value.html",
802
+ regex : "[^<>='\"`\\s]+",
803
+ next : "pop"
804
+ }, {
805
+ token : "empty",
806
+ regex : "",
807
+ next : "pop"
808
+ }]
809
+ }, {
810
+ include : "attribute_value"
811
+ }],
812
+ tag: [{
813
+ token : function(start, tag) {
814
+ var group = tagMap[tag];
815
+ return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
816
+ "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
817
+ },
818
+ regex : "(</?)([-_a-zA-Z0-9:]+)",
819
+ next: "tag_stuff"
820
+ }],
821
+ tag_stuff: [
822
+ {include : "attributes"},
823
+ {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
824
+ ],
825
+ });
826
+
827
+ this.embedTagRules(CssHighlightRules, "css-", "style");
828
+ this.embedTagRules(JavaScriptHighlightRules, "js-", "script");
829
+
830
+ if (this.constructor === HtmlHighlightRules)
831
+ this.normalizeRules();
832
+ };
833
+
834
+ oop.inherits(HtmlHighlightRules, XmlHighlightRules);
835
+
836
+ exports.HtmlHighlightRules = HtmlHighlightRules;
837
+ });
838
+
839
+ ace.define("ace/mode/ruby_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
840
+ "use strict";
841
+
842
+ var oop = require("../lib/oop");
843
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
844
+ var constantOtherSymbol = exports.constantOtherSymbol = {
845
+ token : "constant.other.symbol.ruby", // symbol
846
+ regex : "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?"
847
+ };
848
+
849
+ var qString = exports.qString = {
850
+ token : "string", // single line
851
+ regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
852
+ };
853
+
854
+ var qqString = exports.qqString = {
855
+ token : "string", // single line
856
+ regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
857
+ };
858
+
859
+ var tString = exports.tString = {
860
+ token : "string", // backtick string
861
+ regex : "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]"
862
+ };
863
+
864
+ var constantNumericHex = exports.constantNumericHex = {
865
+ token : "constant.numeric", // hex
866
+ regex : "0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b"
867
+ };
868
+
869
+ var constantNumericFloat = exports.constantNumericFloat = {
870
+ token : "constant.numeric", // float
871
+ regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?\\b"
872
+ };
873
+
874
+ var RubyHighlightRules = function() {
875
+
876
+ var builtinFunctions = (
877
+ "abort|Array|assert|assert_equal|assert_not_equal|assert_same|assert_not_same|" +
878
+ "assert_nil|assert_not_nil|assert_match|assert_no_match|assert_in_delta|assert_throws|" +
879
+ "assert_raise|assert_nothing_raised|assert_instance_of|assert_kind_of|assert_respond_to|" +
880
+ "assert_operator|assert_send|assert_difference|assert_no_difference|assert_recognizes|" +
881
+ "assert_generates|assert_response|assert_redirected_to|assert_template|assert_select|" +
882
+ "assert_select_email|assert_select_rjs|assert_select_encoded|css_select|at_exit|" +
883
+ "attr|attr_writer|attr_reader|attr_accessor|attr_accessible|autoload|binding|block_given?|callcc|" +
884
+ "caller|catch|chomp|chomp!|chop|chop!|defined?|delete_via_redirect|eval|exec|exit|" +
885
+ "exit!|fail|Float|flunk|follow_redirect!|fork|form_for|form_tag|format|gets|global_variables|gsub|" +
886
+ "gsub!|get_via_redirect|host!|https?|https!|include|Integer|lambda|link_to|" +
887
+ "link_to_unless_current|link_to_function|link_to_remote|load|local_variables|loop|open|open_session|" +
888
+ "p|print|printf|proc|putc|puts|post_via_redirect|put_via_redirect|raise|rand|" +
889
+ "raw|readline|readlines|redirect?|request_via_redirect|require|scan|select|" +
890
+ "set_trace_func|sleep|split|sprintf|srand|String|stylesheet_link_tag|syscall|system|sub|sub!|test|" +
891
+ "throw|trace_var|trap|untrace_var|atan2|cos|exp|frexp|ldexp|log|log10|sin|sqrt|tan|" +
892
+ "render|javascript_include_tag|csrf_meta_tag|label_tag|text_field_tag|submit_tag|check_box_tag|" +
893
+ "content_tag|radio_button_tag|text_area_tag|password_field_tag|hidden_field_tag|" +
894
+ "fields_for|select_tag|options_for_select|options_from_collection_for_select|collection_select|" +
895
+ "time_zone_select|select_date|select_time|select_datetime|date_select|time_select|datetime_select|" +
896
+ "select_year|select_month|select_day|select_hour|select_minute|select_second|file_field_tag|" +
897
+ "file_field|respond_to|skip_before_filter|around_filter|after_filter|verify|" +
898
+ "protect_from_forgery|rescue_from|helper_method|redirect_to|before_filter|" +
899
+ "send_data|send_file|validates_presence_of|validates_uniqueness_of|validates_length_of|" +
900
+ "validates_format_of|validates_acceptance_of|validates_associated|validates_exclusion_of|" +
901
+ "validates_inclusion_of|validates_numericality_of|validates_with|validates_each|" +
902
+ "authenticate_or_request_with_http_basic|authenticate_or_request_with_http_digest|" +
903
+ "filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" +
904
+ "translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|" +
905
+ "cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" +
906
+ "has_many|has_one|belongs_to|has_and_belongs_to_many"
907
+ );
908
+
909
+ var keywords = (
910
+ "alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" +
911
+ "__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" +
912
+ "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield"
913
+ );
914
+
915
+ var buildinConstants = (
916
+ "true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" +
917
+ "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING"
918
+ );
919
+
920
+ var builtinVariables = (
921
+ "\$DEBUG|\$defout|\$FILENAME|\$LOAD_PATH|\$SAFE|\$stdin|\$stdout|\$stderr|\$VERBOSE|" +
922
+ "$!|root_url|flash|session|cookies|params|request|response|logger|self"
923
+ );
924
+
925
+ var keywordMapper = this.$keywords = this.createKeywordMapper({
926
+ "keyword": keywords,
927
+ "constant.language": buildinConstants,
928
+ "variable.language": builtinVariables,
929
+ "support.function": builtinFunctions,
930
+ "invalid.deprecated": "debugger" // TODO is this a remnant from js mode?
931
+ }, "identifier");
932
+
933
+ this.$rules = {
934
+ "start" : [
935
+ {
936
+ token : "comment",
937
+ regex : "#.*$"
938
+ }, {
939
+ token : "comment", // multi line comment
940
+ regex : "^=begin(?:$|\\s.*$)",
941
+ next : "comment"
942
+ }, {
943
+ token : "string.regexp",
944
+ regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
945
+ },
946
+
947
+ [{
948
+ regex: "[{}]", onMatch: function(val, state, stack) {
949
+ this.next = val == "{" ? this.nextState : "";
950
+ if (val == "{" && stack.length) {
951
+ stack.unshift("start", state);
952
+ return "paren.lparen";
953
+ }
954
+ if (val == "}" && stack.length) {
955
+ stack.shift();
956
+ this.next = stack.shift();
957
+ if (this.next.indexOf("string") != -1)
958
+ return "paren.end";
959
+ }
960
+ return val == "{" ? "paren.lparen" : "paren.rparen";
961
+ },
962
+ nextState: "start"
963
+ }, {
964
+ token : "string.start",
965
+ regex : /"/,
966
+ push : [{
967
+ token : "constant.language.escape",
968
+ regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/
969
+ }, {
970
+ token : "paren.start",
971
+ regex : /\#{/,
972
+ push : "start"
973
+ }, {
974
+ token : "string.end",
975
+ regex : /"/,
976
+ next : "pop"
977
+ }, {
978
+ defaultToken: "string"
979
+ }]
980
+ }, {
981
+ token : "string.start",
982
+ regex : /`/,
983
+ push : [{
984
+ token : "constant.language.escape",
985
+ regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/
986
+ }, {
987
+ token : "paren.start",
988
+ regex : /\#{/,
989
+ push : "start"
990
+ }, {
991
+ token : "string.end",
992
+ regex : /`/,
993
+ next : "pop"
994
+ }, {
995
+ defaultToken: "string"
996
+ }]
997
+ }, {
998
+ token : "string.start",
999
+ regex : /'/,
1000
+ push : [{
1001
+ token : "constant.language.escape",
1002
+ regex : /\\['\\]/
1003
+ }, {
1004
+ token : "string.end",
1005
+ regex : /'/,
1006
+ next : "pop"
1007
+ }, {
1008
+ defaultToken: "string"
1009
+ }]
1010
+ }],
1011
+
1012
+ {
1013
+ token : "text", // namespaces aren't symbols
1014
+ regex : "::"
1015
+ }, {
1016
+ token : "variable.instance", // instance variable
1017
+ regex : "@{1,2}[a-zA-Z_\\d]+"
1018
+ }, {
1019
+ token : "support.class", // class name
1020
+ regex : "[A-Z][a-zA-Z_\\d]+"
1021
+ },
1022
+
1023
+ constantOtherSymbol,
1024
+ constantNumericHex,
1025
+ constantNumericFloat,
1026
+
1027
+ {
1028
+ token : "constant.language.boolean",
1029
+ regex : "(?:true|false)\\b"
1030
+ }, {
1031
+ token : keywordMapper,
1032
+ regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
1033
+ }, {
1034
+ token : "punctuation.separator.key-value",
1035
+ regex : "=>"
1036
+ }, {
1037
+ stateName: "heredoc",
1038
+ onMatch : function(value, currentState, stack) {
1039
+ var next = value[2] == '-' ? "indentedHeredoc" : "heredoc";
1040
+ var tokens = value.split(this.splitRegex);
1041
+ stack.push(next, tokens[3]);
1042
+ return [
1043
+ {type:"constant", value: tokens[1]},
1044
+ {type:"string", value: tokens[2]},
1045
+ {type:"support.class", value: tokens[3]},
1046
+ {type:"string", value: tokens[4]}
1047
+ ];
1048
+ },
1049
+ regex : "(<<-?)(['\"`]?)([\\w]+)(['\"`]?)",
1050
+ rules: {
1051
+ heredoc: [{
1052
+ onMatch: function(value, currentState, stack) {
1053
+ if (value === stack[1]) {
1054
+ stack.shift();
1055
+ stack.shift();
1056
+ this.next = stack[0] || "start";
1057
+ return "support.class";
1058
+ }
1059
+ this.next = "";
1060
+ return "string";
1061
+ },
1062
+ regex: ".*$",
1063
+ next: "start"
1064
+ }],
1065
+ indentedHeredoc: [{
1066
+ token: "string",
1067
+ regex: "^ +"
1068
+ }, {
1069
+ onMatch: function(value, currentState, stack) {
1070
+ if (value === stack[1]) {
1071
+ stack.shift();
1072
+ stack.shift();
1073
+ this.next = stack[0] || "start";
1074
+ return "support.class";
1075
+ }
1076
+ this.next = "";
1077
+ return "string";
1078
+ },
1079
+ regex: ".*$",
1080
+ next: "start"
1081
+ }]
1082
+ }
1083
+ }, {
1084
+ regex : "$",
1085
+ token : "empty",
1086
+ next : function(currentState, stack) {
1087
+ if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc")
1088
+ return stack[0];
1089
+ return currentState;
1090
+ }
1091
+ }, {
1092
+ token : "keyword.operator",
1093
+ regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
1094
+ }, {
1095
+ token : "paren.lparen",
1096
+ regex : "[[({]"
1097
+ }, {
1098
+ token : "paren.rparen",
1099
+ regex : "[\\])}]"
1100
+ }, {
1101
+ token : "text",
1102
+ regex : "\\s+"
1103
+ }
1104
+ ],
1105
+ "comment" : [
1106
+ {
1107
+ token : "comment", // closing comment
1108
+ regex : "^=end(?:$|\\s.*$)",
1109
+ next : "start"
1110
+ }, {
1111
+ token : "comment", // comment spanning whole line
1112
+ regex : ".+"
1113
+ }
1114
+ ]
1115
+ };
1116
+
1117
+ this.normalizeRules();
1118
+ };
1119
+
1120
+ oop.inherits(RubyHighlightRules, TextHighlightRules);
1121
+
1122
+ exports.RubyHighlightRules = RubyHighlightRules;
1123
+ });
1124
+
1125
+ ace.define("ace/mode/html_ruby_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/html_highlight_rules","ace/mode/ruby_highlight_rules"], function(require, exports, module) {
1126
+ "use strict";
1127
+
1128
+ var oop = require("../lib/oop");
1129
+ var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
1130
+ var RubyHighlightRules = require("./ruby_highlight_rules").RubyHighlightRules;
1131
+
1132
+ var HtmlRubyHighlightRules = function() {
1133
+ HtmlHighlightRules.call(this);
1134
+
1135
+ var startRules = [
1136
+ {
1137
+ regex: "<%%|%%>",
1138
+ token: "constant.language.escape"
1139
+ }, {
1140
+ token : "comment.start.erb",
1141
+ regex : "<%#",
1142
+ push : [{
1143
+ token : "comment.end.erb",
1144
+ regex: "%>",
1145
+ next: "pop",
1146
+ defaultToken:"comment"
1147
+ }]
1148
+ }, {
1149
+ token : "support.ruby_tag",
1150
+ regex : "<%+(?!>)[-=]?",
1151
+ push : "ruby-start"
1152
+ }
1153
+ ];
1154
+
1155
+ var endRules = [
1156
+ {
1157
+ token : "support.ruby_tag",
1158
+ regex : "%>",
1159
+ next : "pop"
1160
+ }, {
1161
+ token: "comment",
1162
+ regex: "#(?:[^%]|%[^>])*"
1163
+ }
1164
+ ];
1165
+
1166
+ for (var key in this.$rules)
1167
+ this.$rules[key].unshift.apply(this.$rules[key], startRules);
1168
+
1169
+ this.embedRules(RubyHighlightRules, "ruby-", endRules, ["start"]);
1170
+
1171
+ this.normalizeRules();
1172
+ };
1173
+
1174
+
1175
+ oop.inherits(HtmlRubyHighlightRules, HtmlHighlightRules);
1176
+
1177
+ exports.HtmlRubyHighlightRules = HtmlRubyHighlightRules;
1178
+ });
1179
+
1180
+ ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
1181
+ "use strict";
1182
+
1183
+ var Range = require("../range").Range;
1184
+
1185
+ var MatchingBraceOutdent = function() {};
1186
+
1187
+ (function() {
1188
+
1189
+ this.checkOutdent = function(line, input) {
1190
+ if (! /^\s+$/.test(line))
1191
+ return false;
1192
+
1193
+ return /^\s*\}/.test(input);
1194
+ };
1195
+
1196
+ this.autoOutdent = function(doc, row) {
1197
+ var line = doc.getLine(row);
1198
+ var match = line.match(/^(\s*\})/);
1199
+
1200
+ if (!match) return 0;
1201
+
1202
+ var column = match[1].length;
1203
+ var openBracePos = doc.findMatchingBracket({row: row, column: column});
1204
+
1205
+ if (!openBracePos || openBracePos.row == row) return 0;
1206
+
1207
+ var indent = this.$getIndent(doc.getLine(openBracePos.row));
1208
+ doc.replace(new Range(row, 0, row, column-1), indent);
1209
+ };
1210
+
1211
+ this.$getIndent = function(line) {
1212
+ return line.match(/^\s*/)[0];
1213
+ };
1214
+
1215
+ }).call(MatchingBraceOutdent.prototype);
1216
+
1217
+ exports.MatchingBraceOutdent = MatchingBraceOutdent;
1218
+ });
1219
+
1220
+ 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) {
1221
+ "use strict";
1222
+
1223
+ var oop = require("../../lib/oop");
1224
+ var Behaviour = require("../behaviour").Behaviour;
1225
+ var TokenIterator = require("../../token_iterator").TokenIterator;
1226
+ var lang = require("../../lib/lang");
1227
+
1228
+ var SAFE_INSERT_IN_TOKENS =
1229
+ ["text", "paren.rparen", "punctuation.operator"];
1230
+ var SAFE_INSERT_BEFORE_TOKENS =
1231
+ ["text", "paren.rparen", "punctuation.operator", "comment"];
1232
+
1233
+ var context;
1234
+ var contextCache = {};
1235
+ var initContext = function(editor) {
1236
+ var id = -1;
1237
+ if (editor.multiSelect) {
1238
+ id = editor.selection.index;
1239
+ if (contextCache.rangeCount != editor.multiSelect.rangeCount)
1240
+ contextCache = {rangeCount: editor.multiSelect.rangeCount};
1241
+ }
1242
+ if (contextCache[id])
1243
+ return context = contextCache[id];
1244
+ context = contextCache[id] = {
1245
+ autoInsertedBrackets: 0,
1246
+ autoInsertedRow: -1,
1247
+ autoInsertedLineEnd: "",
1248
+ maybeInsertedBrackets: 0,
1249
+ maybeInsertedRow: -1,
1250
+ maybeInsertedLineStart: "",
1251
+ maybeInsertedLineEnd: ""
1252
+ };
1253
+ };
1254
+
1255
+ var CstyleBehaviour = function() {
1256
+ this.add("braces", "insertion", function(state, action, editor, session, text) {
1257
+ var cursor = editor.getCursorPosition();
1258
+ var line = session.doc.getLine(cursor.row);
1259
+ if (text == '{') {
1260
+ initContext(editor);
1261
+ var selection = editor.getSelectionRange();
1262
+ var selected = session.doc.getTextRange(selection);
1263
+ if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
1264
+ return {
1265
+ text: '{' + selected + '}',
1266
+ selection: false
1267
+ };
1268
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
1269
+ if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
1270
+ CstyleBehaviour.recordAutoInsert(editor, session, "}");
1271
+ return {
1272
+ text: '{}',
1273
+ selection: [1, 1]
1274
+ };
1275
+ } else {
1276
+ CstyleBehaviour.recordMaybeInsert(editor, session, "{");
1277
+ return {
1278
+ text: '{',
1279
+ selection: [1, 1]
1280
+ };
1281
+ }
1282
+ }
1283
+ } else if (text == '}') {
1284
+ initContext(editor);
1285
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1286
+ if (rightChar == '}') {
1287
+ var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
1288
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
1289
+ CstyleBehaviour.popAutoInsertedClosing();
1290
+ return {
1291
+ text: '',
1292
+ selection: [1, 1]
1293
+ };
1294
+ }
1295
+ }
1296
+ } else if (text == "\n" || text == "\r\n") {
1297
+ initContext(editor);
1298
+ var closing = "";
1299
+ if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
1300
+ closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
1301
+ CstyleBehaviour.clearMaybeInsertedClosing();
1302
+ }
1303
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1304
+ if (rightChar === '}') {
1305
+ var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
1306
+ if (!openBracePos)
1307
+ return null;
1308
+ var next_indent = this.$getIndent(session.getLine(openBracePos.row));
1309
+ } else if (closing) {
1310
+ var next_indent = this.$getIndent(line);
1311
+ } else {
1312
+ CstyleBehaviour.clearMaybeInsertedClosing();
1313
+ return;
1314
+ }
1315
+ var indent = next_indent + session.getTabString();
1316
+
1317
+ return {
1318
+ text: '\n' + indent + '\n' + next_indent + closing,
1319
+ selection: [1, indent.length, 1, indent.length]
1320
+ };
1321
+ } else {
1322
+ CstyleBehaviour.clearMaybeInsertedClosing();
1323
+ }
1324
+ });
1325
+
1326
+ this.add("braces", "deletion", function(state, action, editor, session, range) {
1327
+ var selected = session.doc.getTextRange(range);
1328
+ if (!range.isMultiLine() && selected == '{') {
1329
+ initContext(editor);
1330
+ var line = session.doc.getLine(range.start.row);
1331
+ var rightChar = line.substring(range.end.column, range.end.column + 1);
1332
+ if (rightChar == '}') {
1333
+ range.end.column++;
1334
+ return range;
1335
+ } else {
1336
+ context.maybeInsertedBrackets--;
1337
+ }
1338
+ }
1339
+ });
1340
+
1341
+ this.add("parens", "insertion", function(state, action, editor, session, text) {
1342
+ if (text == '(') {
1343
+ initContext(editor);
1344
+ var selection = editor.getSelectionRange();
1345
+ var selected = session.doc.getTextRange(selection);
1346
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
1347
+ return {
1348
+ text: '(' + selected + ')',
1349
+ selection: false
1350
+ };
1351
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
1352
+ CstyleBehaviour.recordAutoInsert(editor, session, ")");
1353
+ return {
1354
+ text: '()',
1355
+ selection: [1, 1]
1356
+ };
1357
+ }
1358
+ } else if (text == ')') {
1359
+ initContext(editor);
1360
+ var cursor = editor.getCursorPosition();
1361
+ var line = session.doc.getLine(cursor.row);
1362
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1363
+ if (rightChar == ')') {
1364
+ var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
1365
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
1366
+ CstyleBehaviour.popAutoInsertedClosing();
1367
+ return {
1368
+ text: '',
1369
+ selection: [1, 1]
1370
+ };
1371
+ }
1372
+ }
1373
+ }
1374
+ });
1375
+
1376
+ this.add("parens", "deletion", function(state, action, editor, session, range) {
1377
+ var selected = session.doc.getTextRange(range);
1378
+ if (!range.isMultiLine() && selected == '(') {
1379
+ initContext(editor);
1380
+ var line = session.doc.getLine(range.start.row);
1381
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
1382
+ if (rightChar == ')') {
1383
+ range.end.column++;
1384
+ return range;
1385
+ }
1386
+ }
1387
+ });
1388
+
1389
+ this.add("brackets", "insertion", function(state, action, editor, session, text) {
1390
+ if (text == '[') {
1391
+ initContext(editor);
1392
+ var selection = editor.getSelectionRange();
1393
+ var selected = session.doc.getTextRange(selection);
1394
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
1395
+ return {
1396
+ text: '[' + selected + ']',
1397
+ selection: false
1398
+ };
1399
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
1400
+ CstyleBehaviour.recordAutoInsert(editor, session, "]");
1401
+ return {
1402
+ text: '[]',
1403
+ selection: [1, 1]
1404
+ };
1405
+ }
1406
+ } else if (text == ']') {
1407
+ initContext(editor);
1408
+ var cursor = editor.getCursorPosition();
1409
+ var line = session.doc.getLine(cursor.row);
1410
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1411
+ if (rightChar == ']') {
1412
+ var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
1413
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
1414
+ CstyleBehaviour.popAutoInsertedClosing();
1415
+ return {
1416
+ text: '',
1417
+ selection: [1, 1]
1418
+ };
1419
+ }
1420
+ }
1421
+ }
1422
+ });
1423
+
1424
+ this.add("brackets", "deletion", function(state, action, editor, session, range) {
1425
+ var selected = session.doc.getTextRange(range);
1426
+ if (!range.isMultiLine() && selected == '[') {
1427
+ initContext(editor);
1428
+ var line = session.doc.getLine(range.start.row);
1429
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
1430
+ if (rightChar == ']') {
1431
+ range.end.column++;
1432
+ return range;
1433
+ }
1434
+ }
1435
+ });
1436
+
1437
+ this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
1438
+ if (text == '"' || text == "'") {
1439
+ initContext(editor);
1440
+ var quote = text;
1441
+ var selection = editor.getSelectionRange();
1442
+ var selected = session.doc.getTextRange(selection);
1443
+ if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
1444
+ return {
1445
+ text: quote + selected + quote,
1446
+ selection: false
1447
+ };
1448
+ } else {
1449
+ var cursor = editor.getCursorPosition();
1450
+ var line = session.doc.getLine(cursor.row);
1451
+ var leftChar = line.substring(cursor.column-1, cursor.column);
1452
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1453
+
1454
+ var token = session.getTokenAt(cursor.row, cursor.column);
1455
+ var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
1456
+ if (leftChar == "\\" && token && /escape/.test(token.type))
1457
+ return null;
1458
+
1459
+ var stringBefore = token && /string/.test(token.type);
1460
+ var stringAfter = !rightToken || /string/.test(rightToken.type);
1461
+
1462
+ var pair;
1463
+ if (rightChar == quote) {
1464
+ pair = stringBefore !== stringAfter;
1465
+ } else {
1466
+ if (stringBefore && !stringAfter)
1467
+ return null; // wrap string with different quote
1468
+ if (stringBefore && stringAfter)
1469
+ return null; // do not pair quotes inside strings
1470
+ var wordRe = session.$mode.tokenRe;
1471
+ wordRe.lastIndex = 0;
1472
+ var isWordBefore = wordRe.test(leftChar);
1473
+ wordRe.lastIndex = 0;
1474
+ var isWordAfter = wordRe.test(leftChar);
1475
+ if (isWordBefore || isWordAfter)
1476
+ return null; // before or after alphanumeric
1477
+ if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
1478
+ return null; // there is rightChar and it isn't closing
1479
+ pair = true;
1480
+ }
1481
+ return {
1482
+ text: pair ? quote + quote : "",
1483
+ selection: [1,1]
1484
+ };
1485
+ }
1486
+ }
1487
+ });
1488
+
1489
+ this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
1490
+ var selected = session.doc.getTextRange(range);
1491
+ if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
1492
+ initContext(editor);
1493
+ var line = session.doc.getLine(range.start.row);
1494
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
1495
+ if (rightChar == selected) {
1496
+ range.end.column++;
1497
+ return range;
1498
+ }
1499
+ }
1500
+ });
1501
+
1502
+ };
1503
+
1504
+
1505
+ CstyleBehaviour.isSaneInsertion = function(editor, session) {
1506
+ var cursor = editor.getCursorPosition();
1507
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
1508
+ if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
1509
+ var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
1510
+ if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
1511
+ return false;
1512
+ }
1513
+ iterator.stepForward();
1514
+ return iterator.getCurrentTokenRow() !== cursor.row ||
1515
+ this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
1516
+ };
1517
+
1518
+ CstyleBehaviour.$matchTokenType = function(token, types) {
1519
+ return types.indexOf(token.type || token) > -1;
1520
+ };
1521
+
1522
+ CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
1523
+ var cursor = editor.getCursorPosition();
1524
+ var line = session.doc.getLine(cursor.row);
1525
+ if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
1526
+ context.autoInsertedBrackets = 0;
1527
+ context.autoInsertedRow = cursor.row;
1528
+ context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
1529
+ context.autoInsertedBrackets++;
1530
+ };
1531
+
1532
+ CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
1533
+ var cursor = editor.getCursorPosition();
1534
+ var line = session.doc.getLine(cursor.row);
1535
+ if (!this.isMaybeInsertedClosing(cursor, line))
1536
+ context.maybeInsertedBrackets = 0;
1537
+ context.maybeInsertedRow = cursor.row;
1538
+ context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
1539
+ context.maybeInsertedLineEnd = line.substr(cursor.column);
1540
+ context.maybeInsertedBrackets++;
1541
+ };
1542
+
1543
+ CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
1544
+ return context.autoInsertedBrackets > 0 &&
1545
+ cursor.row === context.autoInsertedRow &&
1546
+ bracket === context.autoInsertedLineEnd[0] &&
1547
+ line.substr(cursor.column) === context.autoInsertedLineEnd;
1548
+ };
1549
+
1550
+ CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
1551
+ return context.maybeInsertedBrackets > 0 &&
1552
+ cursor.row === context.maybeInsertedRow &&
1553
+ line.substr(cursor.column) === context.maybeInsertedLineEnd &&
1554
+ line.substr(0, cursor.column) == context.maybeInsertedLineStart;
1555
+ };
1556
+
1557
+ CstyleBehaviour.popAutoInsertedClosing = function() {
1558
+ context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
1559
+ context.autoInsertedBrackets--;
1560
+ };
1561
+
1562
+ CstyleBehaviour.clearMaybeInsertedClosing = function() {
1563
+ if (context) {
1564
+ context.maybeInsertedBrackets = 0;
1565
+ context.maybeInsertedRow = -1;
1566
+ }
1567
+ };
1568
+
1569
+
1570
+
1571
+ oop.inherits(CstyleBehaviour, Behaviour);
1572
+
1573
+ exports.CstyleBehaviour = CstyleBehaviour;
1574
+ });
1575
+
1576
+ ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
1577
+ "use strict";
1578
+
1579
+ var oop = require("../../lib/oop");
1580
+ var Range = require("../../range").Range;
1581
+ var BaseFoldMode = require("./fold_mode").FoldMode;
1582
+
1583
+ var FoldMode = exports.FoldMode = function(commentRegex) {
1584
+ if (commentRegex) {
1585
+ this.foldingStartMarker = new RegExp(
1586
+ this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
1587
+ );
1588
+ this.foldingStopMarker = new RegExp(
1589
+ this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
1590
+ );
1591
+ }
1592
+ };
1593
+ oop.inherits(FoldMode, BaseFoldMode);
1594
+
1595
+ (function() {
1596
+
1597
+ this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
1598
+ this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
1599
+ this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
1600
+ this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
1601
+ this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
1602
+ this._getFoldWidgetBase = this.getFoldWidget;
1603
+ this.getFoldWidget = function(session, foldStyle, row) {
1604
+ var line = session.getLine(row);
1605
+
1606
+ if (this.singleLineBlockCommentRe.test(line)) {
1607
+ if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
1608
+ return "";
1609
+ }
1610
+
1611
+ var fw = this._getFoldWidgetBase(session, foldStyle, row);
1612
+
1613
+ if (!fw && this.startRegionRe.test(line))
1614
+ return "start"; // lineCommentRegionStart
1615
+
1616
+ return fw;
1617
+ };
1618
+
1619
+ this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
1620
+ var line = session.getLine(row);
1621
+
1622
+ if (this.startRegionRe.test(line))
1623
+ return this.getCommentRegionBlock(session, line, row);
1624
+
1625
+ var match = line.match(this.foldingStartMarker);
1626
+ if (match) {
1627
+ var i = match.index;
1628
+
1629
+ if (match[1])
1630
+ return this.openingBracketBlock(session, match[1], row, i);
1631
+
1632
+ var range = session.getCommentFoldRange(row, i + match[0].length, 1);
1633
+
1634
+ if (range && !range.isMultiLine()) {
1635
+ if (forceMultiline) {
1636
+ range = this.getSectionRange(session, row);
1637
+ } else if (foldStyle != "all")
1638
+ range = null;
1639
+ }
1640
+
1641
+ return range;
1642
+ }
1643
+
1644
+ if (foldStyle === "markbegin")
1645
+ return;
1646
+
1647
+ var match = line.match(this.foldingStopMarker);
1648
+ if (match) {
1649
+ var i = match.index + match[0].length;
1650
+
1651
+ if (match[1])
1652
+ return this.closingBracketBlock(session, match[1], row, i);
1653
+
1654
+ return session.getCommentFoldRange(row, i, -1);
1655
+ }
1656
+ };
1657
+
1658
+ this.getSectionRange = function(session, row) {
1659
+ var line = session.getLine(row);
1660
+ var startIndent = line.search(/\S/);
1661
+ var startRow = row;
1662
+ var startColumn = line.length;
1663
+ row = row + 1;
1664
+ var endRow = row;
1665
+ var maxRow = session.getLength();
1666
+ while (++row < maxRow) {
1667
+ line = session.getLine(row);
1668
+ var indent = line.search(/\S/);
1669
+ if (indent === -1)
1670
+ continue;
1671
+ if (startIndent > indent)
1672
+ break;
1673
+ var subRange = this.getFoldWidgetRange(session, "all", row);
1674
+
1675
+ if (subRange) {
1676
+ if (subRange.start.row <= startRow) {
1677
+ break;
1678
+ } else if (subRange.isMultiLine()) {
1679
+ row = subRange.end.row;
1680
+ } else if (startIndent == indent) {
1681
+ break;
1682
+ }
1683
+ }
1684
+ endRow = row;
1685
+ }
1686
+
1687
+ return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
1688
+ };
1689
+
1690
+ this.getCommentRegionBlock = function(session, line, row) {
1691
+ var startColumn = line.search(/\s*$/);
1692
+ var maxRow = session.getLength();
1693
+ var startRow = row;
1694
+
1695
+ var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
1696
+ var depth = 1;
1697
+ while (++row < maxRow) {
1698
+ line = session.getLine(row);
1699
+ var m = re.exec(line);
1700
+ if (!m) continue;
1701
+ if (m[1]) depth--;
1702
+ else depth++;
1703
+
1704
+ if (!depth) break;
1705
+ }
1706
+
1707
+ var endRow = row;
1708
+ if (endRow > startRow) {
1709
+ return new Range(startRow, startColumn, endRow, line.length);
1710
+ }
1711
+ };
1712
+
1713
+ }).call(FoldMode.prototype);
1714
+
1715
+ });
1716
+
1717
+ 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) {
1718
+ "use strict";
1719
+
1720
+ var oop = require("../lib/oop");
1721
+ var TextMode = require("./text").Mode;
1722
+ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
1723
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
1724
+ var Range = require("../range").Range;
1725
+ var WorkerClient = require("../worker/worker_client").WorkerClient;
1726
+ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
1727
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
1728
+
1729
+ var Mode = function() {
1730
+ this.HighlightRules = JavaScriptHighlightRules;
1731
+
1732
+ this.$outdent = new MatchingBraceOutdent();
1733
+ this.$behaviour = new CstyleBehaviour();
1734
+ this.foldingRules = new CStyleFoldMode();
1735
+ };
1736
+ oop.inherits(Mode, TextMode);
1737
+
1738
+ (function() {
1739
+
1740
+ this.lineCommentStart = "//";
1741
+ this.blockComment = {start: "/*", end: "*/"};
1742
+
1743
+ this.getNextLineIndent = function(state, line, tab) {
1744
+ var indent = this.$getIndent(line);
1745
+
1746
+ var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
1747
+ var tokens = tokenizedLine.tokens;
1748
+ var endState = tokenizedLine.state;
1749
+
1750
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
1751
+ return indent;
1752
+ }
1753
+
1754
+ if (state == "start" || state == "no_regex") {
1755
+ var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
1756
+ if (match) {
1757
+ indent += tab;
1758
+ }
1759
+ } else if (state == "doc-start") {
1760
+ if (endState == "start" || endState == "no_regex") {
1761
+ return "";
1762
+ }
1763
+ var match = line.match(/^\s*(\/?)\*/);
1764
+ if (match) {
1765
+ if (match[1]) {
1766
+ indent += " ";
1767
+ }
1768
+ indent += "* ";
1769
+ }
1770
+ }
1771
+
1772
+ return indent;
1773
+ };
1774
+
1775
+ this.checkOutdent = function(state, line, input) {
1776
+ return this.$outdent.checkOutdent(line, input);
1777
+ };
1778
+
1779
+ this.autoOutdent = function(state, doc, row) {
1780
+ this.$outdent.autoOutdent(doc, row);
1781
+ };
1782
+
1783
+ this.createWorker = function(session) {
1784
+ var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
1785
+ worker.attachToDocument(session.getDocument());
1786
+
1787
+ worker.on("jslint", function(results) {
1788
+ session.setAnnotations(results.data);
1789
+ });
1790
+
1791
+ worker.on("terminate", function() {
1792
+ session.clearAnnotations();
1793
+ });
1794
+
1795
+ return worker;
1796
+ };
1797
+
1798
+ this.$id = "ace/mode/javascript";
1799
+ }).call(Mode.prototype);
1800
+
1801
+ exports.Mode = Mode;
1802
+ });
1803
+
1804
+ 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) {
1805
+ "use strict";
1806
+
1807
+ var oop = require("../../lib/oop");
1808
+ var Behaviour = require("../behaviour").Behaviour;
1809
+ var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
1810
+ var TokenIterator = require("../../token_iterator").TokenIterator;
1811
+
1812
+ var CssBehaviour = function () {
1813
+
1814
+ this.inherit(CstyleBehaviour);
1815
+
1816
+ this.add("colon", "insertion", function (state, action, editor, session, text) {
1817
+ if (text === ':') {
1818
+ var cursor = editor.getCursorPosition();
1819
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
1820
+ var token = iterator.getCurrentToken();
1821
+ if (token && token.value.match(/\s+/)) {
1822
+ token = iterator.stepBackward();
1823
+ }
1824
+ if (token && token.type === 'support.type') {
1825
+ var line = session.doc.getLine(cursor.row);
1826
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1827
+ if (rightChar === ':') {
1828
+ return {
1829
+ text: '',
1830
+ selection: [1, 1]
1831
+ }
1832
+ }
1833
+ if (!line.substring(cursor.column).match(/^\s*;/)) {
1834
+ return {
1835
+ text: ':;',
1836
+ selection: [1, 1]
1837
+ }
1838
+ }
1839
+ }
1840
+ }
1841
+ });
1842
+
1843
+ this.add("colon", "deletion", function (state, action, editor, session, range) {
1844
+ var selected = session.doc.getTextRange(range);
1845
+ if (!range.isMultiLine() && selected === ':') {
1846
+ var cursor = editor.getCursorPosition();
1847
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
1848
+ var token = iterator.getCurrentToken();
1849
+ if (token && token.value.match(/\s+/)) {
1850
+ token = iterator.stepBackward();
1851
+ }
1852
+ if (token && token.type === 'support.type') {
1853
+ var line = session.doc.getLine(range.start.row);
1854
+ var rightChar = line.substring(range.end.column, range.end.column + 1);
1855
+ if (rightChar === ';') {
1856
+ range.end.column ++;
1857
+ return range;
1858
+ }
1859
+ }
1860
+ }
1861
+ });
1862
+
1863
+ this.add("semicolon", "insertion", function (state, action, editor, session, text) {
1864
+ if (text === ';') {
1865
+ var cursor = editor.getCursorPosition();
1866
+ var line = session.doc.getLine(cursor.row);
1867
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1868
+ if (rightChar === ';') {
1869
+ return {
1870
+ text: '',
1871
+ selection: [1, 1]
1872
+ }
1873
+ }
1874
+ }
1875
+ });
1876
+
1877
+ }
1878
+ oop.inherits(CssBehaviour, CstyleBehaviour);
1879
+
1880
+ exports.CssBehaviour = CssBehaviour;
1881
+ });
1882
+
1883
+ 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) {
1884
+ "use strict";
1885
+
1886
+ var oop = require("../lib/oop");
1887
+ var TextMode = require("./text").Mode;
1888
+ var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
1889
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
1890
+ var WorkerClient = require("../worker/worker_client").WorkerClient;
1891
+ var CssBehaviour = require("./behaviour/css").CssBehaviour;
1892
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
1893
+
1894
+ var Mode = function() {
1895
+ this.HighlightRules = CssHighlightRules;
1896
+ this.$outdent = new MatchingBraceOutdent();
1897
+ this.$behaviour = new CssBehaviour();
1898
+ this.foldingRules = new CStyleFoldMode();
1899
+ };
1900
+ oop.inherits(Mode, TextMode);
1901
+
1902
+ (function() {
1903
+
1904
+ this.foldingRules = "cStyle";
1905
+ this.blockComment = {start: "/*", end: "*/"};
1906
+
1907
+ this.getNextLineIndent = function(state, line, tab) {
1908
+ var indent = this.$getIndent(line);
1909
+ var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
1910
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
1911
+ return indent;
1912
+ }
1913
+
1914
+ var match = line.match(/^.*\{\s*$/);
1915
+ if (match) {
1916
+ indent += tab;
1917
+ }
1918
+
1919
+ return indent;
1920
+ };
1921
+
1922
+ this.checkOutdent = function(state, line, input) {
1923
+ return this.$outdent.checkOutdent(line, input);
1924
+ };
1925
+
1926
+ this.autoOutdent = function(state, doc, row) {
1927
+ this.$outdent.autoOutdent(doc, row);
1928
+ };
1929
+
1930
+ this.createWorker = function(session) {
1931
+ var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
1932
+ worker.attachToDocument(session.getDocument());
1933
+
1934
+ worker.on("csslint", function(e) {
1935
+ session.setAnnotations(e.data);
1936
+ });
1937
+
1938
+ worker.on("terminate", function() {
1939
+ session.clearAnnotations();
1940
+ });
1941
+
1942
+ return worker;
1943
+ };
1944
+
1945
+ this.$id = "ace/mode/css";
1946
+ }).call(Mode.prototype);
1947
+
1948
+ exports.Mode = Mode;
1949
+
1950
+ });
1951
+
1952
+ 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) {
1953
+ "use strict";
1954
+
1955
+ var oop = require("../../lib/oop");
1956
+ var Behaviour = require("../behaviour").Behaviour;
1957
+ var TokenIterator = require("../../token_iterator").TokenIterator;
1958
+ var lang = require("../../lib/lang");
1959
+
1960
+ function is(token, type) {
1961
+ return token.type.lastIndexOf(type + ".xml") > -1;
1962
+ }
1963
+
1964
+ var XmlBehaviour = function () {
1965
+
1966
+ this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
1967
+ if (text == '"' || text == "'") {
1968
+ var quote = text;
1969
+ var selected = session.doc.getTextRange(editor.getSelectionRange());
1970
+ if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
1971
+ return {
1972
+ text: quote + selected + quote,
1973
+ selection: false
1974
+ };
1975
+ }
1976
+
1977
+ var cursor = editor.getCursorPosition();
1978
+ var line = session.doc.getLine(cursor.row);
1979
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1980
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
1981
+ var token = iterator.getCurrentToken();
1982
+
1983
+ if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) {
1984
+ return {
1985
+ text: "",
1986
+ selection: [1, 1]
1987
+ };
1988
+ }
1989
+
1990
+ if (!token)
1991
+ token = iterator.stepBackward();
1992
+
1993
+ if (!token)
1994
+ return;
1995
+
1996
+ while (is(token, "tag-whitespace") || is(token, "whitespace")) {
1997
+ token = iterator.stepBackward();
1998
+ }
1999
+ var rightSpace = !rightChar || rightChar.match(/\s/);
2000
+ if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) {
2001
+ return {
2002
+ text: quote + quote,
2003
+ selection: [1, 1]
2004
+ };
2005
+ }
2006
+ }
2007
+ });
2008
+
2009
+ this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
2010
+ var selected = session.doc.getTextRange(range);
2011
+ if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
2012
+ var line = session.doc.getLine(range.start.row);
2013
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
2014
+ if (rightChar == selected) {
2015
+ range.end.column++;
2016
+ return range;
2017
+ }
2018
+ }
2019
+ });
2020
+
2021
+ this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
2022
+ if (text == '>') {
2023
+ var position = editor.getCursorPosition();
2024
+ var iterator = new TokenIterator(session, position.row, position.column);
2025
+ var token = iterator.getCurrentToken() || iterator.stepBackward();
2026
+ if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value")))
2027
+ return;
2028
+ if (is(token, "reference.attribute-value"))
2029
+ return;
2030
+ if (is(token, "attribute-value")) {
2031
+ var firstChar = token.value.charAt(0);
2032
+ if (firstChar == '"' || firstChar == "'") {
2033
+ var lastChar = token.value.charAt(token.value.length - 1);
2034
+ var tokenEnd = iterator.getCurrentTokenColumn() + token.value.length;
2035
+ if (tokenEnd > position.column || tokenEnd == position.column && firstChar != lastChar)
2036
+ return;
2037
+ }
2038
+ }
2039
+ while (!is(token, "tag-name")) {
2040
+ token = iterator.stepBackward();
2041
+ }
2042
+
2043
+ var tokenRow = iterator.getCurrentTokenRow();
2044
+ var tokenColumn = iterator.getCurrentTokenColumn();
2045
+ if (is(iterator.stepBackward(), "end-tag-open"))
2046
+ return;
2047
+
2048
+ var element = token.value;
2049
+ if (tokenRow == position.row)
2050
+ element = element.substring(0, position.column - tokenColumn);
2051
+
2052
+ if (this.voidElements.hasOwnProperty(element.toLowerCase()))
2053
+ return;
2054
+
2055
+ return {
2056
+ text: ">" + "</" + element + ">",
2057
+ selection: [1, 1]
2058
+ };
2059
+ }
2060
+ });
2061
+
2062
+ this.add("autoindent", "insertion", function (state, action, editor, session, text) {
2063
+ if (text == "\n") {
2064
+ var cursor = editor.getCursorPosition();
2065
+ var line = session.getLine(cursor.row);
2066
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
2067
+ var token = iterator.getCurrentToken();
2068
+
2069
+ if (token && token.type.indexOf("tag-close") !== -1) {
2070
+ while (token && token.type.indexOf("tag-name") === -1) {
2071
+ token = iterator.stepBackward();
2072
+ }
2073
+
2074
+ if (!token) {
2075
+ return;
2076
+ }
2077
+
2078
+ var tag = token.value;
2079
+ var row = iterator.getCurrentTokenRow();
2080
+ token = iterator.stepBackward();
2081
+ if (!token || token.type.indexOf("end-tag") !== -1) {
2082
+ return;
2083
+ }
2084
+
2085
+ if (this.voidElements && !this.voidElements[tag]) {
2086
+ var nextToken = session.getTokenAt(cursor.row, cursor.column+1);
2087
+ var line = session.getLine(row);
2088
+ var nextIndent = this.$getIndent(line);
2089
+ var indent = nextIndent + session.getTabString();
2090
+
2091
+ if (nextToken && nextToken.value === "</") {
2092
+ return {
2093
+ text: "\n" + indent + "\n" + nextIndent,
2094
+ selection: [1, indent.length, 1, indent.length]
2095
+ };
2096
+ } else {
2097
+ return {
2098
+ text: "\n" + indent
2099
+ };
2100
+ }
2101
+ }
2102
+ }
2103
+ }
2104
+ });
2105
+
2106
+ };
2107
+
2108
+ oop.inherits(XmlBehaviour, Behaviour);
2109
+
2110
+ exports.XmlBehaviour = XmlBehaviour;
2111
+ });
2112
+
2113
+ ace.define("ace/mode/folding/mixed",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"], function(require, exports, module) {
2114
+ "use strict";
2115
+
2116
+ var oop = require("../../lib/oop");
2117
+ var BaseFoldMode = require("./fold_mode").FoldMode;
2118
+
2119
+ var FoldMode = exports.FoldMode = function(defaultMode, subModes) {
2120
+ this.defaultMode = defaultMode;
2121
+ this.subModes = subModes;
2122
+ };
2123
+ oop.inherits(FoldMode, BaseFoldMode);
2124
+
2125
+ (function() {
2126
+
2127
+
2128
+ this.$getMode = function(state) {
2129
+ if (typeof state != "string")
2130
+ state = state[0];
2131
+ for (var key in this.subModes) {
2132
+ if (state.indexOf(key) === 0)
2133
+ return this.subModes[key];
2134
+ }
2135
+ return null;
2136
+ };
2137
+
2138
+ this.$tryMode = function(state, session, foldStyle, row) {
2139
+ var mode = this.$getMode(state);
2140
+ return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
2141
+ };
2142
+
2143
+ this.getFoldWidget = function(session, foldStyle, row) {
2144
+ return (
2145
+ this.$tryMode(session.getState(row-1), session, foldStyle, row) ||
2146
+ this.$tryMode(session.getState(row), session, foldStyle, row) ||
2147
+ this.defaultMode.getFoldWidget(session, foldStyle, row)
2148
+ );
2149
+ };
2150
+
2151
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
2152
+ var mode = this.$getMode(session.getState(row-1));
2153
+
2154
+ if (!mode || !mode.getFoldWidget(session, foldStyle, row))
2155
+ mode = this.$getMode(session.getState(row));
2156
+
2157
+ if (!mode || !mode.getFoldWidget(session, foldStyle, row))
2158
+ mode = this.defaultMode;
2159
+
2160
+ return mode.getFoldWidgetRange(session, foldStyle, row);
2161
+ };
2162
+
2163
+ }).call(FoldMode.prototype);
2164
+
2165
+ });
2166
+
2167
+ 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) {
2168
+ "use strict";
2169
+
2170
+ var oop = require("../../lib/oop");
2171
+ var lang = require("../../lib/lang");
2172
+ var Range = require("../../range").Range;
2173
+ var BaseFoldMode = require("./fold_mode").FoldMode;
2174
+ var TokenIterator = require("../../token_iterator").TokenIterator;
2175
+
2176
+ var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
2177
+ BaseFoldMode.call(this);
2178
+ this.voidElements = voidElements || {};
2179
+ this.optionalEndTags = oop.mixin({}, this.voidElements);
2180
+ if (optionalEndTags)
2181
+ oop.mixin(this.optionalEndTags, optionalEndTags);
2182
+
2183
+ };
2184
+ oop.inherits(FoldMode, BaseFoldMode);
2185
+
2186
+ var Tag = function() {
2187
+ this.tagName = "";
2188
+ this.closing = false;
2189
+ this.selfClosing = false;
2190
+ this.start = {row: 0, column: 0};
2191
+ this.end = {row: 0, column: 0};
2192
+ };
2193
+
2194
+ function is(token, type) {
2195
+ return token.type.lastIndexOf(type + ".xml") > -1;
2196
+ }
2197
+
2198
+ (function() {
2199
+
2200
+ this.getFoldWidget = function(session, foldStyle, row) {
2201
+ var tag = this._getFirstTagInLine(session, row);
2202
+
2203
+ if (!tag)
2204
+ return "";
2205
+
2206
+ if (tag.closing || (!tag.tagName && tag.selfClosing))
2207
+ return foldStyle == "markbeginend" ? "end" : "";
2208
+
2209
+ if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase()))
2210
+ return "";
2211
+
2212
+ if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column))
2213
+ return "";
2214
+
2215
+ return "start";
2216
+ };
2217
+ this._getFirstTagInLine = function(session, row) {
2218
+ var tokens = session.getTokens(row);
2219
+ var tag = new Tag();
2220
+
2221
+ for (var i = 0; i < tokens.length; i++) {
2222
+ var token = tokens[i];
2223
+ if (is(token, "tag-open")) {
2224
+ tag.end.column = tag.start.column + token.value.length;
2225
+ tag.closing = is(token, "end-tag-open");
2226
+ token = tokens[++i];
2227
+ if (!token)
2228
+ return null;
2229
+ tag.tagName = token.value;
2230
+ tag.end.column += token.value.length;
2231
+ for (i++; i < tokens.length; i++) {
2232
+ token = tokens[i];
2233
+ tag.end.column += token.value.length;
2234
+ if (is(token, "tag-close")) {
2235
+ tag.selfClosing = token.value == '/>';
2236
+ break;
2237
+ }
2238
+ }
2239
+ return tag;
2240
+ } else if (is(token, "tag-close")) {
2241
+ tag.selfClosing = token.value == '/>';
2242
+ return tag;
2243
+ }
2244
+ tag.start.column += token.value.length;
2245
+ }
2246
+
2247
+ return null;
2248
+ };
2249
+
2250
+ this._findEndTagInLine = function(session, row, tagName, startColumn) {
2251
+ var tokens = session.getTokens(row);
2252
+ var column = 0;
2253
+ for (var i = 0; i < tokens.length; i++) {
2254
+ var token = tokens[i];
2255
+ column += token.value.length;
2256
+ if (column < startColumn)
2257
+ continue;
2258
+ if (is(token, "end-tag-open")) {
2259
+ token = tokens[i + 1];
2260
+ if (token && token.value == tagName)
2261
+ return true;
2262
+ }
2263
+ }
2264
+ return false;
2265
+ };
2266
+ this._readTagForward = function(iterator) {
2267
+ var token = iterator.getCurrentToken();
2268
+ if (!token)
2269
+ return null;
2270
+
2271
+ var tag = new Tag();
2272
+ do {
2273
+ if (is(token, "tag-open")) {
2274
+ tag.closing = is(token, "end-tag-open");
2275
+ tag.start.row = iterator.getCurrentTokenRow();
2276
+ tag.start.column = iterator.getCurrentTokenColumn();
2277
+ } else if (is(token, "tag-name")) {
2278
+ tag.tagName = token.value;
2279
+ } else if (is(token, "tag-close")) {
2280
+ tag.selfClosing = token.value == "/>";
2281
+ tag.end.row = iterator.getCurrentTokenRow();
2282
+ tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
2283
+ iterator.stepForward();
2284
+ return tag;
2285
+ }
2286
+ } while(token = iterator.stepForward());
2287
+
2288
+ return null;
2289
+ };
2290
+
2291
+ this._readTagBackward = function(iterator) {
2292
+ var token = iterator.getCurrentToken();
2293
+ if (!token)
2294
+ return null;
2295
+
2296
+ var tag = new Tag();
2297
+ do {
2298
+ if (is(token, "tag-open")) {
2299
+ tag.closing = is(token, "end-tag-open");
2300
+ tag.start.row = iterator.getCurrentTokenRow();
2301
+ tag.start.column = iterator.getCurrentTokenColumn();
2302
+ iterator.stepBackward();
2303
+ return tag;
2304
+ } else if (is(token, "tag-name")) {
2305
+ tag.tagName = token.value;
2306
+ } else if (is(token, "tag-close")) {
2307
+ tag.selfClosing = token.value == "/>";
2308
+ tag.end.row = iterator.getCurrentTokenRow();
2309
+ tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
2310
+ }
2311
+ } while(token = iterator.stepBackward());
2312
+
2313
+ return null;
2314
+ };
2315
+
2316
+ this._pop = function(stack, tag) {
2317
+ while (stack.length) {
2318
+
2319
+ var top = stack[stack.length-1];
2320
+ if (!tag || top.tagName == tag.tagName) {
2321
+ return stack.pop();
2322
+ }
2323
+ else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
2324
+ stack.pop();
2325
+ continue;
2326
+ } else {
2327
+ return null;
2328
+ }
2329
+ }
2330
+ };
2331
+
2332
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
2333
+ var firstTag = this._getFirstTagInLine(session, row);
2334
+
2335
+ if (!firstTag)
2336
+ return null;
2337
+
2338
+ var isBackward = firstTag.closing || firstTag.selfClosing;
2339
+ var stack = [];
2340
+ var tag;
2341
+
2342
+ if (!isBackward) {
2343
+ var iterator = new TokenIterator(session, row, firstTag.start.column);
2344
+ var start = {
2345
+ row: row,
2346
+ column: firstTag.start.column + firstTag.tagName.length + 2
2347
+ };
2348
+ while (tag = this._readTagForward(iterator)) {
2349
+ if (tag.selfClosing) {
2350
+ if (!stack.length) {
2351
+ tag.start.column += tag.tagName.length + 2;
2352
+ tag.end.column -= 2;
2353
+ return Range.fromPoints(tag.start, tag.end);
2354
+ } else
2355
+ continue;
2356
+ }
2357
+
2358
+ if (tag.closing) {
2359
+ this._pop(stack, tag);
2360
+ if (stack.length == 0)
2361
+ return Range.fromPoints(start, tag.start);
2362
+ }
2363
+ else {
2364
+ stack.push(tag);
2365
+ }
2366
+ }
2367
+ }
2368
+ else {
2369
+ var iterator = new TokenIterator(session, row, firstTag.end.column);
2370
+ var end = {
2371
+ row: row,
2372
+ column: firstTag.start.column
2373
+ };
2374
+
2375
+ while (tag = this._readTagBackward(iterator)) {
2376
+ if (tag.selfClosing) {
2377
+ if (!stack.length) {
2378
+ tag.start.column += tag.tagName.length + 2;
2379
+ tag.end.column -= 2;
2380
+ return Range.fromPoints(tag.start, tag.end);
2381
+ } else
2382
+ continue;
2383
+ }
2384
+
2385
+ if (!tag.closing) {
2386
+ this._pop(stack, tag);
2387
+ if (stack.length == 0) {
2388
+ tag.start.column += tag.tagName.length + 2;
2389
+ return Range.fromPoints(tag.start, end);
2390
+ }
2391
+ }
2392
+ else {
2393
+ stack.push(tag);
2394
+ }
2395
+ }
2396
+ }
2397
+
2398
+ };
2399
+
2400
+ }).call(FoldMode.prototype);
2401
+
2402
+ });
2403
+
2404
+ 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) {
2405
+ "use strict";
2406
+
2407
+ var oop = require("../../lib/oop");
2408
+ var MixedFoldMode = require("./mixed").FoldMode;
2409
+ var XmlFoldMode = require("./xml").FoldMode;
2410
+ var CStyleFoldMode = require("./cstyle").FoldMode;
2411
+
2412
+ var FoldMode = exports.FoldMode = function(voidElements, optionalTags) {
2413
+ MixedFoldMode.call(this, new XmlFoldMode(voidElements, optionalTags), {
2414
+ "js-": new CStyleFoldMode(),
2415
+ "css-": new CStyleFoldMode()
2416
+ });
2417
+ };
2418
+
2419
+ oop.inherits(FoldMode, MixedFoldMode);
2420
+
2421
+ });
2422
+
2423
+ ace.define("ace/mode/html_completions",["require","exports","module","ace/token_iterator"], function(require, exports, module) {
2424
+ "use strict";
2425
+
2426
+ var TokenIterator = require("../token_iterator").TokenIterator;
2427
+
2428
+ var commonAttributes = [
2429
+ "accesskey",
2430
+ "class",
2431
+ "contenteditable",
2432
+ "contextmenu",
2433
+ "dir",
2434
+ "draggable",
2435
+ "dropzone",
2436
+ "hidden",
2437
+ "id",
2438
+ "inert",
2439
+ "itemid",
2440
+ "itemprop",
2441
+ "itemref",
2442
+ "itemscope",
2443
+ "itemtype",
2444
+ "lang",
2445
+ "spellcheck",
2446
+ "style",
2447
+ "tabindex",
2448
+ "title",
2449
+ "translate"
2450
+ ];
2451
+
2452
+ var eventAttributes = [
2453
+ "onabort",
2454
+ "onblur",
2455
+ "oncancel",
2456
+ "oncanplay",
2457
+ "oncanplaythrough",
2458
+ "onchange",
2459
+ "onclick",
2460
+ "onclose",
2461
+ "oncontextmenu",
2462
+ "oncuechange",
2463
+ "ondblclick",
2464
+ "ondrag",
2465
+ "ondragend",
2466
+ "ondragenter",
2467
+ "ondragleave",
2468
+ "ondragover",
2469
+ "ondragstart",
2470
+ "ondrop",
2471
+ "ondurationchange",
2472
+ "onemptied",
2473
+ "onended",
2474
+ "onerror",
2475
+ "onfocus",
2476
+ "oninput",
2477
+ "oninvalid",
2478
+ "onkeydown",
2479
+ "onkeypress",
2480
+ "onkeyup",
2481
+ "onload",
2482
+ "onloadeddata",
2483
+ "onloadedmetadata",
2484
+ "onloadstart",
2485
+ "onmousedown",
2486
+ "onmousemove",
2487
+ "onmouseout",
2488
+ "onmouseover",
2489
+ "onmouseup",
2490
+ "onmousewheel",
2491
+ "onpause",
2492
+ "onplay",
2493
+ "onplaying",
2494
+ "onprogress",
2495
+ "onratechange",
2496
+ "onreset",
2497
+ "onscroll",
2498
+ "onseeked",
2499
+ "onseeking",
2500
+ "onselect",
2501
+ "onshow",
2502
+ "onstalled",
2503
+ "onsubmit",
2504
+ "onsuspend",
2505
+ "ontimeupdate",
2506
+ "onvolumechange",
2507
+ "onwaiting"
2508
+ ];
2509
+
2510
+ var globalAttributes = commonAttributes.concat(eventAttributes);
2511
+
2512
+ var attributeMap = {
2513
+ "html": ["manifest"],
2514
+ "head": [],
2515
+ "title": [],
2516
+ "base": ["href", "target"],
2517
+ "link": ["href", "hreflang", "rel", "media", "type", "sizes"],
2518
+ "meta": ["http-equiv", "name", "content", "charset"],
2519
+ "style": ["type", "media", "scoped"],
2520
+ "script": ["charset", "type", "src", "defer", "async"],
2521
+ "noscript": ["href"],
2522
+ "body": ["onafterprint", "onbeforeprint", "onbeforeunload", "onhashchange", "onmessage", "onoffline", "onpopstate", "onredo", "onresize", "onstorage", "onundo", "onunload"],
2523
+ "section": [],
2524
+ "nav": [],
2525
+ "article": ["pubdate"],
2526
+ "aside": [],
2527
+ "h1": [],
2528
+ "h2": [],
2529
+ "h3": [],
2530
+ "h4": [],
2531
+ "h5": [],
2532
+ "h6": [],
2533
+ "header": [],
2534
+ "footer": [],
2535
+ "address": [],
2536
+ "main": [],
2537
+ "p": [],
2538
+ "hr": [],
2539
+ "pre": [],
2540
+ "blockquote": ["cite"],
2541
+ "ol": ["start", "reversed"],
2542
+ "ul": [],
2543
+ "li": ["value"],
2544
+ "dl": [],
2545
+ "dt": [],
2546
+ "dd": [],
2547
+ "figure": [],
2548
+ "figcaption": [],
2549
+ "div": [],
2550
+ "a": ["href", "target", "ping", "rel", "media", "hreflang", "type"],
2551
+ "em": [],
2552
+ "strong": [],
2553
+ "small": [],
2554
+ "s": [],
2555
+ "cite": [],
2556
+ "q": ["cite"],
2557
+ "dfn": [],
2558
+ "abbr": [],
2559
+ "data": [],
2560
+ "time": ["datetime"],
2561
+ "code": [],
2562
+ "var": [],
2563
+ "samp": [],
2564
+ "kbd": [],
2565
+ "sub": [],
2566
+ "sup": [],
2567
+ "i": [],
2568
+ "b": [],
2569
+ "u": [],
2570
+ "mark": [],
2571
+ "ruby": [],
2572
+ "rt": [],
2573
+ "rp": [],
2574
+ "bdi": [],
2575
+ "bdo": [],
2576
+ "span": [],
2577
+ "br": [],
2578
+ "wbr": [],
2579
+ "ins": ["cite", "datetime"],
2580
+ "del": ["cite", "datetime"],
2581
+ "img": ["alt", "src", "height", "width", "usemap", "ismap"],
2582
+ "iframe": ["name", "src", "height", "width", "sandbox", "seamless"],
2583
+ "embed": ["src", "height", "width", "type"],
2584
+ "object": ["param", "data", "type", "height" , "width", "usemap", "name", "form", "classid"],
2585
+ "param": ["name", "value"],
2586
+ "video": ["src", "autobuffer", "autoplay", "loop", "controls", "width", "height", "poster"],
2587
+ "audio": ["src", "autobuffer", "autoplay", "loop", "controls"],
2588
+ "source": ["src", "type", "media"],
2589
+ "track": ["kind", "src", "srclang", "label", "default"],
2590
+ "canvas": ["width", "height"],
2591
+ "map": ["name"],
2592
+ "area": ["shape", "coords", "href", "hreflang", "alt", "target", "media", "rel", "ping", "type"],
2593
+ "svg": [],
2594
+ "math": [],
2595
+ "table": ["summary"],
2596
+ "caption": [],
2597
+ "colgroup": ["span"],
2598
+ "col": ["span"],
2599
+ "tbody": [],
2600
+ "thead": [],
2601
+ "tfoot": [],
2602
+ "tr": [],
2603
+ "td": ["headers", "rowspan", "colspan"],
2604
+ "th": ["headers", "rowspan", "colspan", "scope"],
2605
+ "form": ["accept-charset", "action", "autocomplete", "enctype", "method", "name", "novalidate", "target"],
2606
+ "fieldset": ["disabled", "form", "name"],
2607
+ "legend": [],
2608
+ "label": ["form", "for"],
2609
+ "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"],
2610
+ "button": ["autofocus", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "name", "value", "type"],
2611
+ "select": ["autofocus", "disabled", "form", "multiple", "name", "size"],
2612
+ "datalist": [],
2613
+ "optgroup": ["disabled", "label"],
2614
+ "option": ["disabled", "selected", "label", "value"],
2615
+ "textarea": ["autofocus", "disabled", "form", "maxlength", "name", "placeholder", "readonly", "required", "rows", "cols", "wrap"],
2616
+ "keygen": ["autofocus", "challenge", "disabled", "form", "keytype", "name"],
2617
+ "output": ["for", "form", "name"],
2618
+ "progress": ["value", "max"],
2619
+ "meter": ["value", "min", "max", "low", "high", "optimum"],
2620
+ "details": ["open"],
2621
+ "summary": [],
2622
+ "command": ["type", "label", "icon", "disabled", "checked", "radiogroup", "command"],
2623
+ "menu": ["type", "label"],
2624
+ "dialog": ["open"]
2625
+ };
2626
+
2627
+ var elements = Object.keys(attributeMap);
2628
+
2629
+ function is(token, type) {
2630
+ return token.type.lastIndexOf(type + ".xml") > -1;
2631
+ }
2632
+
2633
+ function findTagName(session, pos) {
2634
+ var iterator = new TokenIterator(session, pos.row, pos.column);
2635
+ var token = iterator.getCurrentToken();
2636
+ while (token && !is(token, "tag-name")){
2637
+ token = iterator.stepBackward();
2638
+ }
2639
+ if (token)
2640
+ return token.value;
2641
+ }
2642
+
2643
+ var HtmlCompletions = function() {
2644
+
2645
+ };
2646
+
2647
+ (function() {
2648
+
2649
+ this.getCompletions = function(state, session, pos, prefix) {
2650
+ var token = session.getTokenAt(pos.row, pos.column);
2651
+
2652
+ if (!token)
2653
+ return [];
2654
+ if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open"))
2655
+ return this.getTagCompletions(state, session, pos, prefix);
2656
+ if (is(token, "tag-whitespace") || is(token, "attribute-name"))
2657
+ return this.getAttributeCompetions(state, session, pos, prefix);
2658
+
2659
+ return [];
2660
+ };
2661
+
2662
+ this.getTagCompletions = function(state, session, pos, prefix) {
2663
+ return elements.map(function(element){
2664
+ return {
2665
+ value: element,
2666
+ meta: "tag",
2667
+ score: Number.MAX_VALUE
2668
+ };
2669
+ });
2670
+ };
2671
+
2672
+ this.getAttributeCompetions = function(state, session, pos, prefix) {
2673
+ var tagName = findTagName(session, pos);
2674
+ if (!tagName)
2675
+ return [];
2676
+ var attributes = globalAttributes;
2677
+ if (tagName in attributeMap) {
2678
+ attributes = attributes.concat(attributeMap[tagName]);
2679
+ }
2680
+ return attributes.map(function(attribute){
2681
+ return {
2682
+ caption: attribute,
2683
+ snippet: attribute + '="$0"',
2684
+ meta: "attribute",
2685
+ score: Number.MAX_VALUE
2686
+ };
2687
+ });
2688
+ };
2689
+
2690
+ }).call(HtmlCompletions.prototype);
2691
+
2692
+ exports.HtmlCompletions = HtmlCompletions;
2693
+ });
2694
+
2695
+ 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) {
2696
+ "use strict";
2697
+
2698
+ var oop = require("../lib/oop");
2699
+ var lang = require("../lib/lang");
2700
+ var TextMode = require("./text").Mode;
2701
+ var JavaScriptMode = require("./javascript").Mode;
2702
+ var CssMode = require("./css").Mode;
2703
+ var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
2704
+ var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
2705
+ var HtmlFoldMode = require("./folding/html").FoldMode;
2706
+ var HtmlCompletions = require("./html_completions").HtmlCompletions;
2707
+ var WorkerClient = require("../worker/worker_client").WorkerClient;
2708
+ var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr"];
2709
+ var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"];
2710
+
2711
+ var Mode = function(options) {
2712
+ this.fragmentContext = options && options.fragmentContext;
2713
+ this.HighlightRules = HtmlHighlightRules;
2714
+ this.$behaviour = new XmlBehaviour();
2715
+ this.$completer = new HtmlCompletions();
2716
+
2717
+ this.createModeDelegates({
2718
+ "js-": JavaScriptMode,
2719
+ "css-": CssMode
2720
+ });
2721
+
2722
+ this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags));
2723
+ };
2724
+ oop.inherits(Mode, TextMode);
2725
+
2726
+ (function() {
2727
+
2728
+ this.blockComment = {start: "<!--", end: "-->"};
2729
+
2730
+ this.voidElements = lang.arrayToMap(voidElements);
2731
+
2732
+ this.getNextLineIndent = function(state, line, tab) {
2733
+ return this.$getIndent(line);
2734
+ };
2735
+
2736
+ this.checkOutdent = function(state, line, input) {
2737
+ return false;
2738
+ };
2739
+
2740
+ this.getCompletions = function(state, session, pos, prefix) {
2741
+ return this.$completer.getCompletions(state, session, pos, prefix);
2742
+ };
2743
+
2744
+ this.createWorker = function(session) {
2745
+ if (this.constructor != Mode)
2746
+ return;
2747
+ var worker = new WorkerClient(["ace"], "ace/mode/html_worker", "Worker");
2748
+ worker.attachToDocument(session.getDocument());
2749
+
2750
+ if (this.fragmentContext)
2751
+ worker.call("setOptions", [{context: this.fragmentContext}]);
2752
+
2753
+ worker.on("error", function(e) {
2754
+ session.setAnnotations(e.data);
2755
+ });
2756
+
2757
+ worker.on("terminate", function() {
2758
+ session.clearAnnotations();
2759
+ });
2760
+
2761
+ return worker;
2762
+ };
2763
+
2764
+ this.$id = "ace/mode/html";
2765
+ }).call(Mode.prototype);
2766
+
2767
+ exports.Mode = Mode;
2768
+ });
2769
+
2770
+ ace.define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module) {
2771
+ "use strict";
2772
+
2773
+ var oop = require("../../lib/oop");
2774
+ var BaseFoldMode = require("./fold_mode").FoldMode;
2775
+ var Range = require("../../range").Range;
2776
+
2777
+ var FoldMode = exports.FoldMode = function() {};
2778
+ oop.inherits(FoldMode, BaseFoldMode);
2779
+
2780
+ (function() {
2781
+
2782
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
2783
+ var range = this.indentationBlock(session, row);
2784
+ if (range)
2785
+ return range;
2786
+
2787
+ var re = /\S/;
2788
+ var line = session.getLine(row);
2789
+ var startLevel = line.search(re);
2790
+ if (startLevel == -1 || line[startLevel] != "#")
2791
+ return;
2792
+
2793
+ var startColumn = line.length;
2794
+ var maxRow = session.getLength();
2795
+ var startRow = row;
2796
+ var endRow = row;
2797
+
2798
+ while (++row < maxRow) {
2799
+ line = session.getLine(row);
2800
+ var level = line.search(re);
2801
+
2802
+ if (level == -1)
2803
+ continue;
2804
+
2805
+ if (line[level] != "#")
2806
+ break;
2807
+
2808
+ endRow = row;
2809
+ }
2810
+
2811
+ if (endRow > startRow) {
2812
+ var endColumn = session.getLine(endRow).length;
2813
+ return new Range(startRow, startColumn, endRow, endColumn);
2814
+ }
2815
+ };
2816
+ this.getFoldWidget = function(session, foldStyle, row) {
2817
+ var line = session.getLine(row);
2818
+ var indent = line.search(/\S/);
2819
+ var next = session.getLine(row + 1);
2820
+ var prev = session.getLine(row - 1);
2821
+ var prevIndent = prev.search(/\S/);
2822
+ var nextIndent = next.search(/\S/);
2823
+
2824
+ if (indent == -1) {
2825
+ session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
2826
+ return "";
2827
+ }
2828
+ if (prevIndent == -1) {
2829
+ if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
2830
+ session.foldWidgets[row - 1] = "";
2831
+ session.foldWidgets[row + 1] = "";
2832
+ return "start";
2833
+ }
2834
+ } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
2835
+ if (session.getLine(row - 2).search(/\S/) == -1) {
2836
+ session.foldWidgets[row - 1] = "start";
2837
+ session.foldWidgets[row + 1] = "";
2838
+ return "";
2839
+ }
2840
+ }
2841
+
2842
+ if (prevIndent!= -1 && prevIndent < indent)
2843
+ session.foldWidgets[row - 1] = "start";
2844
+ else
2845
+ session.foldWidgets[row - 1] = "";
2846
+
2847
+ if (indent < nextIndent)
2848
+ return "start";
2849
+ else
2850
+ return "";
2851
+ };
2852
+
2853
+ }).call(FoldMode.prototype);
2854
+
2855
+ });
2856
+
2857
+ ace.define("ace/mode/ruby",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ruby_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/coffee"], function(require, exports, module) {
2858
+ "use strict";
2859
+
2860
+ var oop = require("../lib/oop");
2861
+ var TextMode = require("./text").Mode;
2862
+ var RubyHighlightRules = require("./ruby_highlight_rules").RubyHighlightRules;
2863
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
2864
+ var Range = require("../range").Range;
2865
+ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
2866
+ var FoldMode = require("./folding/coffee").FoldMode;
2867
+
2868
+ var Mode = function() {
2869
+ this.HighlightRules = RubyHighlightRules;
2870
+ this.$outdent = new MatchingBraceOutdent();
2871
+ this.$behaviour = new CstyleBehaviour();
2872
+ this.foldingRules = new FoldMode();
2873
+ };
2874
+ oop.inherits(Mode, TextMode);
2875
+
2876
+ (function() {
2877
+
2878
+
2879
+ this.lineCommentStart = "#";
2880
+
2881
+ this.getNextLineIndent = function(state, line, tab) {
2882
+ var indent = this.$getIndent(line);
2883
+
2884
+ var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
2885
+ var tokens = tokenizedLine.tokens;
2886
+
2887
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
2888
+ return indent;
2889
+ }
2890
+
2891
+ if (state == "start") {
2892
+ var match = line.match(/^.*[\{\(\[]\s*$/);
2893
+ var startingClassOrMethod = line.match(/^\s*(class|def|module)\s.*$/);
2894
+ var startingDoBlock = line.match(/.*do(\s*|\s+\|.*\|\s*)$/);
2895
+ var startingConditional = line.match(/^\s*(if|else)\s*/)
2896
+ if (match || startingClassOrMethod || startingDoBlock || startingConditional) {
2897
+ indent += tab;
2898
+ }
2899
+ }
2900
+
2901
+ return indent;
2902
+ };
2903
+
2904
+ this.checkOutdent = function(state, line, input) {
2905
+ return /^\s+(end|else)$/.test(line + input) || this.$outdent.checkOutdent(line, input);
2906
+ };
2907
+
2908
+ this.autoOutdent = function(state, session, row) {
2909
+ var line = session.getLine(row);
2910
+ if (/}/.test(line))
2911
+ return this.$outdent.autoOutdent(session, row);
2912
+ var indent = this.$getIndent(line);
2913
+ var prevLine = session.getLine(row - 1);
2914
+ var prevIndent = this.$getIndent(prevLine);
2915
+ var tab = session.getTabString();
2916
+ if (prevIndent.length <= indent.length) {
2917
+ if (indent.slice(-tab.length) == tab)
2918
+ session.remove(new Range(row, indent.length-tab.length, row, indent.length));
2919
+ }
2920
+ };
2921
+
2922
+ this.$id = "ace/mode/ruby";
2923
+ }).call(Mode.prototype);
2924
+
2925
+ exports.Mode = Mode;
2926
+ });
2927
+
2928
+ ace.define("ace/mode/html_ruby",["require","exports","module","ace/lib/oop","ace/mode/html_ruby_highlight_rules","ace/mode/html","ace/mode/javascript","ace/mode/css","ace/mode/ruby"], function(require, exports, module) {
2929
+ "use strict";
2930
+
2931
+ var oop = require("../lib/oop");
2932
+ var HtmlRubyHighlightRules = require("./html_ruby_highlight_rules").HtmlRubyHighlightRules;
2933
+ var HtmlMode = require("./html").Mode;
2934
+ var JavaScriptMode = require("./javascript").Mode;
2935
+ var CssMode = require("./css").Mode;
2936
+ var RubyMode = require("./ruby").Mode;
2937
+
2938
+ var Mode = function() {
2939
+ HtmlMode.call(this);
2940
+ this.HighlightRules = HtmlRubyHighlightRules;
2941
+ this.createModeDelegates({
2942
+ "js-": JavaScriptMode,
2943
+ "css-": CssMode,
2944
+ "ruby-": RubyMode
2945
+ });
2946
+ };
2947
+ oop.inherits(Mode, HtmlMode);
2948
+
2949
+ (function() {
2950
+
2951
+ this.$id = "ace/mode/html_ruby";
2952
+ }).call(Mode.prototype);
2953
+
2954
+ exports.Mode = Mode;
2955
+ });