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,1025 @@
1
+ ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
2
+ "use strict";
3
+
4
+ var oop = require("../lib/oop");
5
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
6
+
7
+ var DocCommentHighlightRules = function() {
8
+ this.$rules = {
9
+ "start" : [ {
10
+ token : "comment.doc.tag",
11
+ regex : "@[\\w\\d_]+" // TODO: fix email addresses
12
+ },
13
+ DocCommentHighlightRules.getTagRule(),
14
+ {
15
+ defaultToken : "comment.doc",
16
+ caseInsensitive: true
17
+ }]
18
+ };
19
+ };
20
+
21
+ oop.inherits(DocCommentHighlightRules, TextHighlightRules);
22
+
23
+ DocCommentHighlightRules.getTagRule = function(start) {
24
+ return {
25
+ token : "comment.doc.tag.storage.type",
26
+ regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
27
+ };
28
+ }
29
+
30
+ DocCommentHighlightRules.getStartRule = function(start) {
31
+ return {
32
+ token : "comment.doc", // doc comment
33
+ regex : "\\/\\*(?=\\*)",
34
+ next : start
35
+ };
36
+ };
37
+
38
+ DocCommentHighlightRules.getEndRule = function (start) {
39
+ return {
40
+ token : "comment.doc", // closing comment
41
+ regex : "\\*\\/",
42
+ next : start
43
+ };
44
+ };
45
+
46
+
47
+ exports.DocCommentHighlightRules = DocCommentHighlightRules;
48
+
49
+ });
50
+
51
+ ace.define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) {
52
+ "use strict";
53
+
54
+ var oop = require("../lib/oop");
55
+ var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
56
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
57
+
58
+ var JavaScriptHighlightRules = function(options) {
59
+ var keywordMapper = this.createKeywordMapper({
60
+ "variable.language":
61
+ "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
62
+ "Namespace|QName|XML|XMLList|" + // E4X
63
+ "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
64
+ "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
65
+ "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
66
+ "SyntaxError|TypeError|URIError|" +
67
+ "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
68
+ "isNaN|parseFloat|parseInt|" +
69
+ "JSON|Math|" + // Other
70
+ "this|arguments|prototype|window|document" , // Pseudo
71
+ "keyword":
72
+ "const|yield|import|get|set|" +
73
+ "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
74
+ "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
75
+ "__parent__|__count__|escape|unescape|with|__proto__|" +
76
+ "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
77
+ "storage.type":
78
+ "const|let|var|function",
79
+ "constant.language":
80
+ "null|Infinity|NaN|undefined",
81
+ "support.function":
82
+ "alert",
83
+ "constant.language.boolean": "true|false"
84
+ }, "identifier");
85
+ var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
86
+ var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
87
+
88
+ var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
89
+ "u[0-9a-fA-F]{4}|" + // unicode
90
+ "[0-2][0-7]{0,2}|" + // oct
91
+ "3[0-6][0-7]?|" + // oct
92
+ "37[0-7]?|" + // oct
93
+ "[4-7][0-7]?|" + //oct
94
+ ".)";
95
+
96
+ this.$rules = {
97
+ "no_regex" : [
98
+ {
99
+ token : "comment",
100
+ regex : "\\/\\/",
101
+ next : "line_comment"
102
+ },
103
+ DocCommentHighlightRules.getStartRule("doc-start"),
104
+ {
105
+ token : "comment", // multi line comment
106
+ regex : /\/\*/,
107
+ next : "comment"
108
+ }, {
109
+ token : "string",
110
+ regex : "'(?=.)",
111
+ next : "qstring"
112
+ }, {
113
+ token : "string",
114
+ regex : '"(?=.)',
115
+ next : "qqstring"
116
+ }, {
117
+ token : "constant.numeric", // hex
118
+ regex : /0[xX][0-9a-fA-F]+\b/
119
+ }, {
120
+ token : "constant.numeric", // float
121
+ regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
122
+ }, {
123
+ token : [
124
+ "storage.type", "punctuation.operator", "support.function",
125
+ "punctuation.operator", "entity.name.function", "text","keyword.operator"
126
+ ],
127
+ regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
128
+ next: "function_arguments"
129
+ }, {
130
+ token : [
131
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
132
+ "keyword.operator", "text", "storage.type", "text", "paren.lparen"
133
+ ],
134
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
135
+ next: "function_arguments"
136
+ }, {
137
+ token : [
138
+ "entity.name.function", "text", "keyword.operator", "text", "storage.type",
139
+ "text", "paren.lparen"
140
+ ],
141
+ regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
142
+ next: "function_arguments"
143
+ }, {
144
+ token : [
145
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
146
+ "keyword.operator", "text",
147
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
148
+ ],
149
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
150
+ next: "function_arguments"
151
+ }, {
152
+ token : [
153
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
154
+ ],
155
+ regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
156
+ next: "function_arguments"
157
+ }, {
158
+ token : [
159
+ "entity.name.function", "text", "punctuation.operator",
160
+ "text", "storage.type", "text", "paren.lparen"
161
+ ],
162
+ regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
163
+ next: "function_arguments"
164
+ }, {
165
+ token : [
166
+ "text", "text", "storage.type", "text", "paren.lparen"
167
+ ],
168
+ regex : "(:)(\\s*)(function)(\\s*)(\\()",
169
+ next: "function_arguments"
170
+ }, {
171
+ token : "keyword",
172
+ regex : "(?:" + kwBeforeRe + ")\\b",
173
+ next : "start"
174
+ }, {
175
+ token : ["punctuation.operator", "support.function"],
176
+ regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
177
+ }, {
178
+ token : ["punctuation.operator", "support.function.dom"],
179
+ regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
180
+ }, {
181
+ token : ["punctuation.operator", "support.constant"],
182
+ regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
183
+ }, {
184
+ token : ["support.constant"],
185
+ regex : /that\b/
186
+ }, {
187
+ token : ["storage.type", "punctuation.operator", "support.function.firebug"],
188
+ regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
189
+ }, {
190
+ token : keywordMapper,
191
+ regex : identifierRe
192
+ }, {
193
+ token : "keyword.operator",
194
+ regex : /--|\+\+|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|[!$%&*+\-~\/^]=?/,
195
+ next : "start"
196
+ }, {
197
+ token : "punctuation.operator",
198
+ regex : /[?:,;.]/,
199
+ next : "start"
200
+ }, {
201
+ token : "paren.lparen",
202
+ regex : /[\[({]/,
203
+ next : "start"
204
+ }, {
205
+ token : "paren.rparen",
206
+ regex : /[\])}]/
207
+ }, {
208
+ token: "comment",
209
+ regex: /^#!.*$/
210
+ }
211
+ ],
212
+ "start": [
213
+ DocCommentHighlightRules.getStartRule("doc-start"),
214
+ {
215
+ token : "comment", // multi line comment
216
+ regex : "\\/\\*",
217
+ next : "comment_regex_allowed"
218
+ }, {
219
+ token : "comment",
220
+ regex : "\\/\\/",
221
+ next : "line_comment_regex_allowed"
222
+ }, {
223
+ token: "string.regexp",
224
+ regex: "\\/",
225
+ next: "regex"
226
+ }, {
227
+ token : "text",
228
+ regex : "\\s+|^$",
229
+ next : "start"
230
+ }, {
231
+ token: "empty",
232
+ regex: "",
233
+ next: "no_regex"
234
+ }
235
+ ],
236
+ "regex": [
237
+ {
238
+ token: "regexp.keyword.operator",
239
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
240
+ }, {
241
+ token: "string.regexp",
242
+ regex: "/[sxngimy]*",
243
+ next: "no_regex"
244
+ }, {
245
+ token : "invalid",
246
+ regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
247
+ }, {
248
+ token : "constant.language.escape",
249
+ regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
250
+ }, {
251
+ token : "constant.language.delimiter",
252
+ regex: /\|/
253
+ }, {
254
+ token: "constant.language.escape",
255
+ regex: /\[\^?/,
256
+ next: "regex_character_class"
257
+ }, {
258
+ token: "empty",
259
+ regex: "$",
260
+ next: "no_regex"
261
+ }, {
262
+ defaultToken: "string.regexp"
263
+ }
264
+ ],
265
+ "regex_character_class": [
266
+ {
267
+ token: "regexp.charclass.keyword.operator",
268
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
269
+ }, {
270
+ token: "constant.language.escape",
271
+ regex: "]",
272
+ next: "regex"
273
+ }, {
274
+ token: "constant.language.escape",
275
+ regex: "-"
276
+ }, {
277
+ token: "empty",
278
+ regex: "$",
279
+ next: "no_regex"
280
+ }, {
281
+ defaultToken: "string.regexp.charachterclass"
282
+ }
283
+ ],
284
+ "function_arguments": [
285
+ {
286
+ token: "variable.parameter",
287
+ regex: identifierRe
288
+ }, {
289
+ token: "punctuation.operator",
290
+ regex: "[, ]+"
291
+ }, {
292
+ token: "punctuation.operator",
293
+ regex: "$"
294
+ }, {
295
+ token: "empty",
296
+ regex: "",
297
+ next: "no_regex"
298
+ }
299
+ ],
300
+ "comment_regex_allowed" : [
301
+ DocCommentHighlightRules.getTagRule(),
302
+ {token : "comment", regex : "\\*\\/", next : "start"},
303
+ {defaultToken : "comment", caseInsensitive: true}
304
+ ],
305
+ "comment" : [
306
+ DocCommentHighlightRules.getTagRule(),
307
+ {token : "comment", regex : "\\*\\/", next : "no_regex"},
308
+ {defaultToken : "comment", caseInsensitive: true}
309
+ ],
310
+ "line_comment_regex_allowed" : [
311
+ DocCommentHighlightRules.getTagRule(),
312
+ {token : "comment", regex : "$|^", next : "start"},
313
+ {defaultToken : "comment", caseInsensitive: true}
314
+ ],
315
+ "line_comment" : [
316
+ DocCommentHighlightRules.getTagRule(),
317
+ {token : "comment", regex : "$|^", next : "no_regex"},
318
+ {defaultToken : "comment", caseInsensitive: true}
319
+ ],
320
+ "qqstring" : [
321
+ {
322
+ token : "constant.language.escape",
323
+ regex : escapedRe
324
+ }, {
325
+ token : "string",
326
+ regex : "\\\\$",
327
+ next : "qqstring"
328
+ }, {
329
+ token : "string",
330
+ regex : '"|$',
331
+ next : "no_regex"
332
+ }, {
333
+ defaultToken: "string"
334
+ }
335
+ ],
336
+ "qstring" : [
337
+ {
338
+ token : "constant.language.escape",
339
+ regex : escapedRe
340
+ }, {
341
+ token : "string",
342
+ regex : "\\\\$",
343
+ next : "qstring"
344
+ }, {
345
+ token : "string",
346
+ regex : "'|$",
347
+ next : "no_regex"
348
+ }, {
349
+ defaultToken: "string"
350
+ }
351
+ ]
352
+ };
353
+
354
+
355
+ if (!options || !options.noES6) {
356
+ this.$rules.no_regex.unshift({
357
+ regex: "[{}]", onMatch: function(val, state, stack) {
358
+ this.next = val == "{" ? this.nextState : "";
359
+ if (val == "{" && stack.length) {
360
+ stack.unshift("start", state);
361
+ return "paren";
362
+ }
363
+ if (val == "}" && stack.length) {
364
+ stack.shift();
365
+ this.next = stack.shift();
366
+ if (this.next.indexOf("string") != -1)
367
+ return "paren.quasi.end";
368
+ }
369
+ return val == "{" ? "paren.lparen" : "paren.rparen";
370
+ },
371
+ nextState: "start"
372
+ }, {
373
+ token : "string.quasi.start",
374
+ regex : /`/,
375
+ push : [{
376
+ token : "constant.language.escape",
377
+ regex : escapedRe
378
+ }, {
379
+ token : "paren.quasi.start",
380
+ regex : /\${/,
381
+ push : "start"
382
+ }, {
383
+ token : "string.quasi.end",
384
+ regex : /`/,
385
+ next : "pop"
386
+ }, {
387
+ defaultToken: "string.quasi"
388
+ }]
389
+ });
390
+ }
391
+
392
+ this.embedRules(DocCommentHighlightRules, "doc-",
393
+ [ DocCommentHighlightRules.getEndRule("no_regex") ]);
394
+
395
+ this.normalizeRules();
396
+ };
397
+
398
+ oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
399
+
400
+ exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
401
+ });
402
+
403
+ ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
404
+ "use strict";
405
+
406
+ var Range = require("../range").Range;
407
+
408
+ var MatchingBraceOutdent = function() {};
409
+
410
+ (function() {
411
+
412
+ this.checkOutdent = function(line, input) {
413
+ if (! /^\s+$/.test(line))
414
+ return false;
415
+
416
+ return /^\s*\}/.test(input);
417
+ };
418
+
419
+ this.autoOutdent = function(doc, row) {
420
+ var line = doc.getLine(row);
421
+ var match = line.match(/^(\s*\})/);
422
+
423
+ if (!match) return 0;
424
+
425
+ var column = match[1].length;
426
+ var openBracePos = doc.findMatchingBracket({row: row, column: column});
427
+
428
+ if (!openBracePos || openBracePos.row == row) return 0;
429
+
430
+ var indent = this.$getIndent(doc.getLine(openBracePos.row));
431
+ doc.replace(new Range(row, 0, row, column-1), indent);
432
+ };
433
+
434
+ this.$getIndent = function(line) {
435
+ return line.match(/^\s*/)[0];
436
+ };
437
+
438
+ }).call(MatchingBraceOutdent.prototype);
439
+
440
+ exports.MatchingBraceOutdent = MatchingBraceOutdent;
441
+ });
442
+
443
+ ace.define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module) {
444
+ "use strict";
445
+
446
+ var oop = require("../../lib/oop");
447
+ var Behaviour = require("../behaviour").Behaviour;
448
+ var TokenIterator = require("../../token_iterator").TokenIterator;
449
+ var lang = require("../../lib/lang");
450
+
451
+ var SAFE_INSERT_IN_TOKENS =
452
+ ["text", "paren.rparen", "punctuation.operator"];
453
+ var SAFE_INSERT_BEFORE_TOKENS =
454
+ ["text", "paren.rparen", "punctuation.operator", "comment"];
455
+
456
+ var context;
457
+ var contextCache = {};
458
+ var initContext = function(editor) {
459
+ var id = -1;
460
+ if (editor.multiSelect) {
461
+ id = editor.selection.index;
462
+ if (contextCache.rangeCount != editor.multiSelect.rangeCount)
463
+ contextCache = {rangeCount: editor.multiSelect.rangeCount};
464
+ }
465
+ if (contextCache[id])
466
+ return context = contextCache[id];
467
+ context = contextCache[id] = {
468
+ autoInsertedBrackets: 0,
469
+ autoInsertedRow: -1,
470
+ autoInsertedLineEnd: "",
471
+ maybeInsertedBrackets: 0,
472
+ maybeInsertedRow: -1,
473
+ maybeInsertedLineStart: "",
474
+ maybeInsertedLineEnd: ""
475
+ };
476
+ };
477
+
478
+ var CstyleBehaviour = function() {
479
+ this.add("braces", "insertion", function(state, action, editor, session, text) {
480
+ var cursor = editor.getCursorPosition();
481
+ var line = session.doc.getLine(cursor.row);
482
+ if (text == '{') {
483
+ initContext(editor);
484
+ var selection = editor.getSelectionRange();
485
+ var selected = session.doc.getTextRange(selection);
486
+ if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
487
+ return {
488
+ text: '{' + selected + '}',
489
+ selection: false
490
+ };
491
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
492
+ if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
493
+ CstyleBehaviour.recordAutoInsert(editor, session, "}");
494
+ return {
495
+ text: '{}',
496
+ selection: [1, 1]
497
+ };
498
+ } else {
499
+ CstyleBehaviour.recordMaybeInsert(editor, session, "{");
500
+ return {
501
+ text: '{',
502
+ selection: [1, 1]
503
+ };
504
+ }
505
+ }
506
+ } else if (text == '}') {
507
+ initContext(editor);
508
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
509
+ if (rightChar == '}') {
510
+ var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
511
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
512
+ CstyleBehaviour.popAutoInsertedClosing();
513
+ return {
514
+ text: '',
515
+ selection: [1, 1]
516
+ };
517
+ }
518
+ }
519
+ } else if (text == "\n" || text == "\r\n") {
520
+ initContext(editor);
521
+ var closing = "";
522
+ if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
523
+ closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
524
+ CstyleBehaviour.clearMaybeInsertedClosing();
525
+ }
526
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
527
+ if (rightChar === '}') {
528
+ var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
529
+ if (!openBracePos)
530
+ return null;
531
+ var next_indent = this.$getIndent(session.getLine(openBracePos.row));
532
+ } else if (closing) {
533
+ var next_indent = this.$getIndent(line);
534
+ } else {
535
+ CstyleBehaviour.clearMaybeInsertedClosing();
536
+ return;
537
+ }
538
+ var indent = next_indent + session.getTabString();
539
+
540
+ return {
541
+ text: '\n' + indent + '\n' + next_indent + closing,
542
+ selection: [1, indent.length, 1, indent.length]
543
+ };
544
+ } else {
545
+ CstyleBehaviour.clearMaybeInsertedClosing();
546
+ }
547
+ });
548
+
549
+ this.add("braces", "deletion", function(state, action, editor, session, range) {
550
+ var selected = session.doc.getTextRange(range);
551
+ if (!range.isMultiLine() && selected == '{') {
552
+ initContext(editor);
553
+ var line = session.doc.getLine(range.start.row);
554
+ var rightChar = line.substring(range.end.column, range.end.column + 1);
555
+ if (rightChar == '}') {
556
+ range.end.column++;
557
+ return range;
558
+ } else {
559
+ context.maybeInsertedBrackets--;
560
+ }
561
+ }
562
+ });
563
+
564
+ this.add("parens", "insertion", function(state, action, editor, session, text) {
565
+ if (text == '(') {
566
+ initContext(editor);
567
+ var selection = editor.getSelectionRange();
568
+ var selected = session.doc.getTextRange(selection);
569
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
570
+ return {
571
+ text: '(' + selected + ')',
572
+ selection: false
573
+ };
574
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
575
+ CstyleBehaviour.recordAutoInsert(editor, session, ")");
576
+ return {
577
+ text: '()',
578
+ selection: [1, 1]
579
+ };
580
+ }
581
+ } else if (text == ')') {
582
+ initContext(editor);
583
+ var cursor = editor.getCursorPosition();
584
+ var line = session.doc.getLine(cursor.row);
585
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
586
+ if (rightChar == ')') {
587
+ var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
588
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
589
+ CstyleBehaviour.popAutoInsertedClosing();
590
+ return {
591
+ text: '',
592
+ selection: [1, 1]
593
+ };
594
+ }
595
+ }
596
+ }
597
+ });
598
+
599
+ this.add("parens", "deletion", function(state, action, editor, session, range) {
600
+ var selected = session.doc.getTextRange(range);
601
+ if (!range.isMultiLine() && selected == '(') {
602
+ initContext(editor);
603
+ var line = session.doc.getLine(range.start.row);
604
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
605
+ if (rightChar == ')') {
606
+ range.end.column++;
607
+ return range;
608
+ }
609
+ }
610
+ });
611
+
612
+ this.add("brackets", "insertion", function(state, action, editor, session, text) {
613
+ if (text == '[') {
614
+ initContext(editor);
615
+ var selection = editor.getSelectionRange();
616
+ var selected = session.doc.getTextRange(selection);
617
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
618
+ return {
619
+ text: '[' + selected + ']',
620
+ selection: false
621
+ };
622
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
623
+ CstyleBehaviour.recordAutoInsert(editor, session, "]");
624
+ return {
625
+ text: '[]',
626
+ selection: [1, 1]
627
+ };
628
+ }
629
+ } else if (text == ']') {
630
+ initContext(editor);
631
+ var cursor = editor.getCursorPosition();
632
+ var line = session.doc.getLine(cursor.row);
633
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
634
+ if (rightChar == ']') {
635
+ var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
636
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
637
+ CstyleBehaviour.popAutoInsertedClosing();
638
+ return {
639
+ text: '',
640
+ selection: [1, 1]
641
+ };
642
+ }
643
+ }
644
+ }
645
+ });
646
+
647
+ this.add("brackets", "deletion", function(state, action, editor, session, range) {
648
+ var selected = session.doc.getTextRange(range);
649
+ if (!range.isMultiLine() && selected == '[') {
650
+ initContext(editor);
651
+ var line = session.doc.getLine(range.start.row);
652
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
653
+ if (rightChar == ']') {
654
+ range.end.column++;
655
+ return range;
656
+ }
657
+ }
658
+ });
659
+
660
+ this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
661
+ if (text == '"' || text == "'") {
662
+ initContext(editor);
663
+ var quote = text;
664
+ var selection = editor.getSelectionRange();
665
+ var selected = session.doc.getTextRange(selection);
666
+ if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
667
+ return {
668
+ text: quote + selected + quote,
669
+ selection: false
670
+ };
671
+ } else {
672
+ var cursor = editor.getCursorPosition();
673
+ var line = session.doc.getLine(cursor.row);
674
+ var leftChar = line.substring(cursor.column-1, cursor.column);
675
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
676
+
677
+ var token = session.getTokenAt(cursor.row, cursor.column);
678
+ var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
679
+ if (leftChar == "\\" && token && /escape/.test(token.type))
680
+ return null;
681
+
682
+ var stringBefore = token && /string/.test(token.type);
683
+ var stringAfter = !rightToken || /string/.test(rightToken.type);
684
+
685
+ var pair;
686
+ if (rightChar == quote) {
687
+ pair = stringBefore !== stringAfter;
688
+ } else {
689
+ if (stringBefore && !stringAfter)
690
+ return null; // wrap string with different quote
691
+ if (stringBefore && stringAfter)
692
+ return null; // do not pair quotes inside strings
693
+ var wordRe = session.$mode.tokenRe;
694
+ wordRe.lastIndex = 0;
695
+ var isWordBefore = wordRe.test(leftChar);
696
+ wordRe.lastIndex = 0;
697
+ var isWordAfter = wordRe.test(leftChar);
698
+ if (isWordBefore || isWordAfter)
699
+ return null; // before or after alphanumeric
700
+ if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
701
+ return null; // there is rightChar and it isn't closing
702
+ pair = true;
703
+ }
704
+ return {
705
+ text: pair ? quote + quote : "",
706
+ selection: [1,1]
707
+ };
708
+ }
709
+ }
710
+ });
711
+
712
+ this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
713
+ var selected = session.doc.getTextRange(range);
714
+ if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
715
+ initContext(editor);
716
+ var line = session.doc.getLine(range.start.row);
717
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
718
+ if (rightChar == selected) {
719
+ range.end.column++;
720
+ return range;
721
+ }
722
+ }
723
+ });
724
+
725
+ };
726
+
727
+
728
+ CstyleBehaviour.isSaneInsertion = function(editor, session) {
729
+ var cursor = editor.getCursorPosition();
730
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
731
+ if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
732
+ var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
733
+ if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
734
+ return false;
735
+ }
736
+ iterator.stepForward();
737
+ return iterator.getCurrentTokenRow() !== cursor.row ||
738
+ this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
739
+ };
740
+
741
+ CstyleBehaviour.$matchTokenType = function(token, types) {
742
+ return types.indexOf(token.type || token) > -1;
743
+ };
744
+
745
+ CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
746
+ var cursor = editor.getCursorPosition();
747
+ var line = session.doc.getLine(cursor.row);
748
+ if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
749
+ context.autoInsertedBrackets = 0;
750
+ context.autoInsertedRow = cursor.row;
751
+ context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
752
+ context.autoInsertedBrackets++;
753
+ };
754
+
755
+ CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
756
+ var cursor = editor.getCursorPosition();
757
+ var line = session.doc.getLine(cursor.row);
758
+ if (!this.isMaybeInsertedClosing(cursor, line))
759
+ context.maybeInsertedBrackets = 0;
760
+ context.maybeInsertedRow = cursor.row;
761
+ context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
762
+ context.maybeInsertedLineEnd = line.substr(cursor.column);
763
+ context.maybeInsertedBrackets++;
764
+ };
765
+
766
+ CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
767
+ return context.autoInsertedBrackets > 0 &&
768
+ cursor.row === context.autoInsertedRow &&
769
+ bracket === context.autoInsertedLineEnd[0] &&
770
+ line.substr(cursor.column) === context.autoInsertedLineEnd;
771
+ };
772
+
773
+ CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
774
+ return context.maybeInsertedBrackets > 0 &&
775
+ cursor.row === context.maybeInsertedRow &&
776
+ line.substr(cursor.column) === context.maybeInsertedLineEnd &&
777
+ line.substr(0, cursor.column) == context.maybeInsertedLineStart;
778
+ };
779
+
780
+ CstyleBehaviour.popAutoInsertedClosing = function() {
781
+ context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
782
+ context.autoInsertedBrackets--;
783
+ };
784
+
785
+ CstyleBehaviour.clearMaybeInsertedClosing = function() {
786
+ if (context) {
787
+ context.maybeInsertedBrackets = 0;
788
+ context.maybeInsertedRow = -1;
789
+ }
790
+ };
791
+
792
+
793
+
794
+ oop.inherits(CstyleBehaviour, Behaviour);
795
+
796
+ exports.CstyleBehaviour = CstyleBehaviour;
797
+ });
798
+
799
+ ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
800
+ "use strict";
801
+
802
+ var oop = require("../../lib/oop");
803
+ var Range = require("../../range").Range;
804
+ var BaseFoldMode = require("./fold_mode").FoldMode;
805
+
806
+ var FoldMode = exports.FoldMode = function(commentRegex) {
807
+ if (commentRegex) {
808
+ this.foldingStartMarker = new RegExp(
809
+ this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
810
+ );
811
+ this.foldingStopMarker = new RegExp(
812
+ this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
813
+ );
814
+ }
815
+ };
816
+ oop.inherits(FoldMode, BaseFoldMode);
817
+
818
+ (function() {
819
+
820
+ this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
821
+ this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
822
+ this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
823
+ this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
824
+ this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
825
+ this._getFoldWidgetBase = this.getFoldWidget;
826
+ this.getFoldWidget = function(session, foldStyle, row) {
827
+ var line = session.getLine(row);
828
+
829
+ if (this.singleLineBlockCommentRe.test(line)) {
830
+ if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
831
+ return "";
832
+ }
833
+
834
+ var fw = this._getFoldWidgetBase(session, foldStyle, row);
835
+
836
+ if (!fw && this.startRegionRe.test(line))
837
+ return "start"; // lineCommentRegionStart
838
+
839
+ return fw;
840
+ };
841
+
842
+ this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
843
+ var line = session.getLine(row);
844
+
845
+ if (this.startRegionRe.test(line))
846
+ return this.getCommentRegionBlock(session, line, row);
847
+
848
+ var match = line.match(this.foldingStartMarker);
849
+ if (match) {
850
+ var i = match.index;
851
+
852
+ if (match[1])
853
+ return this.openingBracketBlock(session, match[1], row, i);
854
+
855
+ var range = session.getCommentFoldRange(row, i + match[0].length, 1);
856
+
857
+ if (range && !range.isMultiLine()) {
858
+ if (forceMultiline) {
859
+ range = this.getSectionRange(session, row);
860
+ } else if (foldStyle != "all")
861
+ range = null;
862
+ }
863
+
864
+ return range;
865
+ }
866
+
867
+ if (foldStyle === "markbegin")
868
+ return;
869
+
870
+ var match = line.match(this.foldingStopMarker);
871
+ if (match) {
872
+ var i = match.index + match[0].length;
873
+
874
+ if (match[1])
875
+ return this.closingBracketBlock(session, match[1], row, i);
876
+
877
+ return session.getCommentFoldRange(row, i, -1);
878
+ }
879
+ };
880
+
881
+ this.getSectionRange = function(session, row) {
882
+ var line = session.getLine(row);
883
+ var startIndent = line.search(/\S/);
884
+ var startRow = row;
885
+ var startColumn = line.length;
886
+ row = row + 1;
887
+ var endRow = row;
888
+ var maxRow = session.getLength();
889
+ while (++row < maxRow) {
890
+ line = session.getLine(row);
891
+ var indent = line.search(/\S/);
892
+ if (indent === -1)
893
+ continue;
894
+ if (startIndent > indent)
895
+ break;
896
+ var subRange = this.getFoldWidgetRange(session, "all", row);
897
+
898
+ if (subRange) {
899
+ if (subRange.start.row <= startRow) {
900
+ break;
901
+ } else if (subRange.isMultiLine()) {
902
+ row = subRange.end.row;
903
+ } else if (startIndent == indent) {
904
+ break;
905
+ }
906
+ }
907
+ endRow = row;
908
+ }
909
+
910
+ return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
911
+ };
912
+
913
+ this.getCommentRegionBlock = function(session, line, row) {
914
+ var startColumn = line.search(/\s*$/);
915
+ var maxRow = session.getLength();
916
+ var startRow = row;
917
+
918
+ var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
919
+ var depth = 1;
920
+ while (++row < maxRow) {
921
+ line = session.getLine(row);
922
+ var m = re.exec(line);
923
+ if (!m) continue;
924
+ if (m[1]) depth--;
925
+ else depth++;
926
+
927
+ if (!depth) break;
928
+ }
929
+
930
+ var endRow = row;
931
+ if (endRow > startRow) {
932
+ return new Range(startRow, startColumn, endRow, line.length);
933
+ }
934
+ };
935
+
936
+ }).call(FoldMode.prototype);
937
+
938
+ });
939
+
940
+ ace.define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) {
941
+ "use strict";
942
+
943
+ var oop = require("../lib/oop");
944
+ var TextMode = require("./text").Mode;
945
+ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
946
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
947
+ var Range = require("../range").Range;
948
+ var WorkerClient = require("../worker/worker_client").WorkerClient;
949
+ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
950
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
951
+
952
+ var Mode = function() {
953
+ this.HighlightRules = JavaScriptHighlightRules;
954
+
955
+ this.$outdent = new MatchingBraceOutdent();
956
+ this.$behaviour = new CstyleBehaviour();
957
+ this.foldingRules = new CStyleFoldMode();
958
+ };
959
+ oop.inherits(Mode, TextMode);
960
+
961
+ (function() {
962
+
963
+ this.lineCommentStart = "//";
964
+ this.blockComment = {start: "/*", end: "*/"};
965
+
966
+ this.getNextLineIndent = function(state, line, tab) {
967
+ var indent = this.$getIndent(line);
968
+
969
+ var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
970
+ var tokens = tokenizedLine.tokens;
971
+ var endState = tokenizedLine.state;
972
+
973
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
974
+ return indent;
975
+ }
976
+
977
+ if (state == "start" || state == "no_regex") {
978
+ var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
979
+ if (match) {
980
+ indent += tab;
981
+ }
982
+ } else if (state == "doc-start") {
983
+ if (endState == "start" || endState == "no_regex") {
984
+ return "";
985
+ }
986
+ var match = line.match(/^\s*(\/?)\*/);
987
+ if (match) {
988
+ if (match[1]) {
989
+ indent += " ";
990
+ }
991
+ indent += "* ";
992
+ }
993
+ }
994
+
995
+ return indent;
996
+ };
997
+
998
+ this.checkOutdent = function(state, line, input) {
999
+ return this.$outdent.checkOutdent(line, input);
1000
+ };
1001
+
1002
+ this.autoOutdent = function(state, doc, row) {
1003
+ this.$outdent.autoOutdent(doc, row);
1004
+ };
1005
+
1006
+ this.createWorker = function(session) {
1007
+ var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
1008
+ worker.attachToDocument(session.getDocument());
1009
+
1010
+ worker.on("jslint", function(results) {
1011
+ session.setAnnotations(results.data);
1012
+ });
1013
+
1014
+ worker.on("terminate", function() {
1015
+ session.clearAnnotations();
1016
+ });
1017
+
1018
+ return worker;
1019
+ };
1020
+
1021
+ this.$id = "ace/mode/javascript";
1022
+ }).call(Mode.prototype);
1023
+
1024
+ exports.Mode = Mode;
1025
+ });