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