ace-rails-ap 2.0.0 → 2.0.1

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