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,2228 @@
1
+ /* ***** BEGIN LICENSE BLOCK *****
2
+ * Distributed under the BSD license:
3
+ *
4
+ * Copyright (c) 2013, 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/twig', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/javascript', 'ace/mode/css', 'ace/tokenizer', 'ace/mode/twig_highlight_rules', 'ace/mode/behaviour/html', 'ace/mode/folding/html', 'ace/mode/matching_brace_outdent'], function(require, exports, module) {
32
+
33
+
34
+ var oop = require("../lib/oop");
35
+ var TextMode = require("./text").Mode;
36
+ var JavaScriptMode = require("./javascript").Mode;
37
+ var CssMode = require("./css").Mode;
38
+ var Tokenizer = require("../tokenizer").Tokenizer;
39
+ var TwigHighlightRules = require("./twig_highlight_rules").TwigHighlightRules;
40
+ var HtmlBehaviour = require("./behaviour/html").HtmlBehaviour;
41
+ var HtmlFoldMode = require("./folding/html").FoldMode;
42
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
43
+
44
+ var Mode = function() {
45
+ this.HighlightRules = TwigHighlightRules;
46
+ this.$outdent = new MatchingBraceOutdent();
47
+ this.$behaviour = new HtmlBehaviour();
48
+
49
+ this.createModeDelegates({
50
+ "js-": JavaScriptMode,
51
+ "css-": CssMode
52
+ });
53
+
54
+ this.foldingRules = new HtmlFoldMode();
55
+ };
56
+ oop.inherits(Mode, TextMode);
57
+
58
+ (function() {
59
+ this.blockComment = {start: "{#", end: "#}"};
60
+
61
+ this.getNextLineIndent = function(state, line, tab) {
62
+ var indent = this.$getIndent(line);
63
+
64
+ var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
65
+ var tokens = tokenizedLine.tokens;
66
+ var endState = tokenizedLine.state;
67
+
68
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
69
+ return indent;
70
+ }
71
+
72
+ if (state == "start") {
73
+ var match = line.match(/^.*[\{\(\[]\s*$/);
74
+ if (match) {
75
+ indent += tab;
76
+ }
77
+ }
78
+
79
+ return indent;
80
+ };
81
+
82
+ this.checkOutdent = function(state, line, input) {
83
+ return this.$outdent.checkOutdent(line, input);
84
+ };
85
+
86
+ this.autoOutdent = function(state, doc, row) {
87
+ this.$outdent.autoOutdent(doc, row);
88
+ };
89
+ this.$id = "ace/mode/twig";
90
+ }).call(Mode.prototype);
91
+
92
+ exports.Mode = Mode;
93
+ });
94
+
95
+ 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) {
96
+
97
+
98
+ var oop = require("../lib/oop");
99
+ var TextMode = require("./text").Mode;
100
+ var Tokenizer = require("../tokenizer").Tokenizer;
101
+ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
102
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
103
+ var Range = require("../range").Range;
104
+ var WorkerClient = require("../worker/worker_client").WorkerClient;
105
+ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
106
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
107
+
108
+ var Mode = function() {
109
+ this.HighlightRules = JavaScriptHighlightRules;
110
+
111
+ this.$outdent = new MatchingBraceOutdent();
112
+ this.$behaviour = new CstyleBehaviour();
113
+ this.foldingRules = new CStyleFoldMode();
114
+ };
115
+ oop.inherits(Mode, TextMode);
116
+
117
+ (function() {
118
+
119
+ this.lineCommentStart = "//";
120
+ this.blockComment = {start: "/*", end: "*/"};
121
+
122
+ this.getNextLineIndent = function(state, line, tab) {
123
+ var indent = this.$getIndent(line);
124
+
125
+ var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
126
+ var tokens = tokenizedLine.tokens;
127
+ var endState = tokenizedLine.state;
128
+
129
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
130
+ return indent;
131
+ }
132
+
133
+ if (state == "start" || state == "no_regex") {
134
+ var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
135
+ if (match) {
136
+ indent += tab;
137
+ }
138
+ } else if (state == "doc-start") {
139
+ if (endState == "start" || endState == "no_regex") {
140
+ return "";
141
+ }
142
+ var match = line.match(/^\s*(\/?)\*/);
143
+ if (match) {
144
+ if (match[1]) {
145
+ indent += " ";
146
+ }
147
+ indent += "* ";
148
+ }
149
+ }
150
+
151
+ return indent;
152
+ };
153
+
154
+ this.checkOutdent = function(state, line, input) {
155
+ return this.$outdent.checkOutdent(line, input);
156
+ };
157
+
158
+ this.autoOutdent = function(state, doc, row) {
159
+ this.$outdent.autoOutdent(doc, row);
160
+ };
161
+
162
+ this.createWorker = function(session) {
163
+ var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
164
+ worker.attachToDocument(session.getDocument());
165
+
166
+ worker.on("jslint", function(results) {
167
+ session.setAnnotations(results.data);
168
+ });
169
+
170
+ worker.on("terminate", function() {
171
+ session.clearAnnotations();
172
+ });
173
+
174
+ return worker;
175
+ };
176
+
177
+ this.$id = "ace/mode/javascript";
178
+ }).call(Mode.prototype);
179
+
180
+ exports.Mode = Mode;
181
+ });
182
+
183
+ 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) {
184
+
185
+
186
+ var oop = require("../lib/oop");
187
+ var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
188
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
189
+
190
+ var JavaScriptHighlightRules = function() {
191
+ var keywordMapper = this.createKeywordMapper({
192
+ "variable.language":
193
+ "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
194
+ "Namespace|QName|XML|XMLList|" + // E4X
195
+ "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
196
+ "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
197
+ "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
198
+ "SyntaxError|TypeError|URIError|" +
199
+ "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
200
+ "isNaN|parseFloat|parseInt|" +
201
+ "JSON|Math|" + // Other
202
+ "this|arguments|prototype|window|document" , // Pseudo
203
+ "keyword":
204
+ "const|yield|import|get|set|" +
205
+ "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
206
+ "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
207
+ "__parent__|__count__|escape|unescape|with|__proto__|" +
208
+ "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
209
+ "storage.type":
210
+ "const|let|var|function",
211
+ "constant.language":
212
+ "null|Infinity|NaN|undefined",
213
+ "support.function":
214
+ "alert",
215
+ "constant.language.boolean": "true|false"
216
+ }, "identifier");
217
+ var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
218
+ var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
219
+
220
+ var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
221
+ "u[0-9a-fA-F]{4}|" + // unicode
222
+ "[0-2][0-7]{0,2}|" + // oct
223
+ "3[0-6][0-7]?|" + // oct
224
+ "37[0-7]?|" + // oct
225
+ "[4-7][0-7]?|" + //oct
226
+ ".)";
227
+
228
+ this.$rules = {
229
+ "no_regex" : [
230
+ {
231
+ token : "comment",
232
+ regex : "\\/\\/",
233
+ next : "line_comment"
234
+ },
235
+ DocCommentHighlightRules.getStartRule("doc-start"),
236
+ {
237
+ token : "comment", // multi line comment
238
+ regex : /\/\*/,
239
+ next : "comment"
240
+ }, {
241
+ token : "string",
242
+ regex : "'(?=.)",
243
+ next : "qstring"
244
+ }, {
245
+ token : "string",
246
+ regex : '"(?=.)',
247
+ next : "qqstring"
248
+ }, {
249
+ token : "constant.numeric", // hex
250
+ regex : /0[xX][0-9a-fA-F]+\b/
251
+ }, {
252
+ token : "constant.numeric", // float
253
+ regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
254
+ }, {
255
+ token : [
256
+ "storage.type", "punctuation.operator", "support.function",
257
+ "punctuation.operator", "entity.name.function", "text","keyword.operator"
258
+ ],
259
+ regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
260
+ next: "function_arguments"
261
+ }, {
262
+ token : [
263
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
264
+ "keyword.operator", "text", "storage.type", "text", "paren.lparen"
265
+ ],
266
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
267
+ next: "function_arguments"
268
+ }, {
269
+ token : [
270
+ "entity.name.function", "text", "keyword.operator", "text", "storage.type",
271
+ "text", "paren.lparen"
272
+ ],
273
+ regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
274
+ next: "function_arguments"
275
+ }, {
276
+ token : [
277
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
278
+ "keyword.operator", "text",
279
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
280
+ ],
281
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
282
+ next: "function_arguments"
283
+ }, {
284
+ token : [
285
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
286
+ ],
287
+ regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
288
+ next: "function_arguments"
289
+ }, {
290
+ token : [
291
+ "entity.name.function", "text", "punctuation.operator",
292
+ "text", "storage.type", "text", "paren.lparen"
293
+ ],
294
+ regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
295
+ next: "function_arguments"
296
+ }, {
297
+ token : [
298
+ "text", "text", "storage.type", "text", "paren.lparen"
299
+ ],
300
+ regex : "(:)(\\s*)(function)(\\s*)(\\()",
301
+ next: "function_arguments"
302
+ }, {
303
+ token : "keyword",
304
+ regex : "(?:" + kwBeforeRe + ")\\b",
305
+ next : "start"
306
+ }, {
307
+ token : ["punctuation.operator", "support.function"],
308
+ 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(?=\()/
309
+ }, {
310
+ token : ["punctuation.operator", "support.function.dom"],
311
+ 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(?=\()/
312
+ }, {
313
+ token : ["punctuation.operator", "support.constant"],
314
+ 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/
315
+ }, {
316
+ token : ["storage.type", "punctuation.operator", "support.function.firebug"],
317
+ regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
318
+ }, {
319
+ token : keywordMapper,
320
+ regex : identifierRe
321
+ }, {
322
+ token : "keyword.operator",
323
+ regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/,
324
+ next : "start"
325
+ }, {
326
+ token : "punctuation.operator",
327
+ regex : /\?|\:|\,|\;|\./,
328
+ next : "start"
329
+ }, {
330
+ token : "paren.lparen",
331
+ regex : /[\[({]/,
332
+ next : "start"
333
+ }, {
334
+ token : "paren.rparen",
335
+ regex : /[\])}]/
336
+ }, {
337
+ token : "keyword.operator",
338
+ regex : /\/=?/,
339
+ next : "start"
340
+ }, {
341
+ token: "comment",
342
+ regex: /^#!.*$/
343
+ }
344
+ ],
345
+ "start": [
346
+ DocCommentHighlightRules.getStartRule("doc-start"),
347
+ {
348
+ token : "comment", // multi line comment
349
+ regex : "\\/\\*",
350
+ next : "comment_regex_allowed"
351
+ }, {
352
+ token : "comment",
353
+ regex : "\\/\\/",
354
+ next : "line_comment_regex_allowed"
355
+ }, {
356
+ token: "string.regexp",
357
+ regex: "\\/",
358
+ next: "regex"
359
+ }, {
360
+ token : "text",
361
+ regex : "\\s+|^$",
362
+ next : "start"
363
+ }, {
364
+ token: "empty",
365
+ regex: "",
366
+ next: "no_regex"
367
+ }
368
+ ],
369
+ "regex": [
370
+ {
371
+ token: "regexp.keyword.operator",
372
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
373
+ }, {
374
+ token: "string.regexp",
375
+ regex: "/[sxngimy]*",
376
+ next: "no_regex"
377
+ }, {
378
+ token : "invalid",
379
+ regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
380
+ }, {
381
+ token : "constant.language.escape",
382
+ regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
383
+ }, {
384
+ token : "constant.language.delimiter",
385
+ regex: /\|/
386
+ }, {
387
+ token: "constant.language.escape",
388
+ regex: /\[\^?/,
389
+ next: "regex_character_class"
390
+ }, {
391
+ token: "empty",
392
+ regex: "$",
393
+ next: "no_regex"
394
+ }, {
395
+ defaultToken: "string.regexp"
396
+ }
397
+ ],
398
+ "regex_character_class": [
399
+ {
400
+ token: "regexp.keyword.operator",
401
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
402
+ }, {
403
+ token: "constant.language.escape",
404
+ regex: "]",
405
+ next: "regex"
406
+ }, {
407
+ token: "constant.language.escape",
408
+ regex: "-"
409
+ }, {
410
+ token: "empty",
411
+ regex: "$",
412
+ next: "no_regex"
413
+ }, {
414
+ defaultToken: "string.regexp.charachterclass"
415
+ }
416
+ ],
417
+ "function_arguments": [
418
+ {
419
+ token: "variable.parameter",
420
+ regex: identifierRe
421
+ }, {
422
+ token: "punctuation.operator",
423
+ regex: "[, ]+"
424
+ }, {
425
+ token: "punctuation.operator",
426
+ regex: "$"
427
+ }, {
428
+ token: "empty",
429
+ regex: "",
430
+ next: "no_regex"
431
+ }
432
+ ],
433
+ "comment_regex_allowed" : [
434
+ {token : "comment", regex : "\\*\\/", next : "start"},
435
+ {defaultToken : "comment"}
436
+ ],
437
+ "comment" : [
438
+ {token : "comment", regex : "\\*\\/", next : "no_regex"},
439
+ {defaultToken : "comment"}
440
+ ],
441
+ "line_comment_regex_allowed" : [
442
+ {token : "comment", regex : "$|^", next : "start"},
443
+ {defaultToken : "comment"}
444
+ ],
445
+ "line_comment" : [
446
+ {token : "comment", regex : "$|^", next : "no_regex"},
447
+ {defaultToken : "comment"}
448
+ ],
449
+ "qqstring" : [
450
+ {
451
+ token : "constant.language.escape",
452
+ regex : escapedRe
453
+ }, {
454
+ token : "string",
455
+ regex : "\\\\$",
456
+ next : "qqstring"
457
+ }, {
458
+ token : "string",
459
+ regex : '"|$',
460
+ next : "no_regex"
461
+ }, {
462
+ defaultToken: "string"
463
+ }
464
+ ],
465
+ "qstring" : [
466
+ {
467
+ token : "constant.language.escape",
468
+ regex : escapedRe
469
+ }, {
470
+ token : "string",
471
+ regex : "\\\\$",
472
+ next : "qstring"
473
+ }, {
474
+ token : "string",
475
+ regex : "'|$",
476
+ next : "no_regex"
477
+ }, {
478
+ defaultToken: "string"
479
+ }
480
+ ]
481
+ };
482
+
483
+ this.embedRules(DocCommentHighlightRules, "doc-",
484
+ [ DocCommentHighlightRules.getEndRule("no_regex") ]);
485
+ };
486
+
487
+ oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
488
+
489
+ exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
490
+ });
491
+
492
+ define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
493
+
494
+
495
+ var oop = require("../lib/oop");
496
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
497
+
498
+ var DocCommentHighlightRules = function() {
499
+
500
+ this.$rules = {
501
+ "start" : [ {
502
+ token : "comment.doc.tag",
503
+ regex : "@[\\w\\d_]+" // TODO: fix email addresses
504
+ }, {
505
+ token : "comment.doc.tag",
506
+ regex : "\\bTODO\\b"
507
+ }, {
508
+ defaultToken : "comment.doc"
509
+ }]
510
+ };
511
+ };
512
+
513
+ oop.inherits(DocCommentHighlightRules, TextHighlightRules);
514
+
515
+ DocCommentHighlightRules.getStartRule = function(start) {
516
+ return {
517
+ token : "comment.doc", // doc comment
518
+ regex : "\\/\\*(?=\\*)",
519
+ next : start
520
+ };
521
+ };
522
+
523
+ DocCommentHighlightRules.getEndRule = function (start) {
524
+ return {
525
+ token : "comment.doc", // closing comment
526
+ regex : "\\*\\/",
527
+ next : start
528
+ };
529
+ };
530
+
531
+
532
+ exports.DocCommentHighlightRules = DocCommentHighlightRules;
533
+
534
+ });
535
+
536
+ define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
537
+
538
+
539
+ var Range = require("../range").Range;
540
+
541
+ var MatchingBraceOutdent = function() {};
542
+
543
+ (function() {
544
+
545
+ this.checkOutdent = function(line, input) {
546
+ if (! /^\s+$/.test(line))
547
+ return false;
548
+
549
+ return /^\s*\}/.test(input);
550
+ };
551
+
552
+ this.autoOutdent = function(doc, row) {
553
+ var line = doc.getLine(row);
554
+ var match = line.match(/^(\s*\})/);
555
+
556
+ if (!match) return 0;
557
+
558
+ var column = match[1].length;
559
+ var openBracePos = doc.findMatchingBracket({row: row, column: column});
560
+
561
+ if (!openBracePos || openBracePos.row == row) return 0;
562
+
563
+ var indent = this.$getIndent(doc.getLine(openBracePos.row));
564
+ doc.replace(new Range(row, 0, row, column-1), indent);
565
+ };
566
+
567
+ this.$getIndent = function(line) {
568
+ return line.match(/^\s*/)[0];
569
+ };
570
+
571
+ }).call(MatchingBraceOutdent.prototype);
572
+
573
+ exports.MatchingBraceOutdent = MatchingBraceOutdent;
574
+ });
575
+
576
+ define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
577
+
578
+
579
+ var oop = require("../../lib/oop");
580
+ var Behaviour = require("../behaviour").Behaviour;
581
+ var TokenIterator = require("../../token_iterator").TokenIterator;
582
+ var lang = require("../../lib/lang");
583
+
584
+ var SAFE_INSERT_IN_TOKENS =
585
+ ["text", "paren.rparen", "punctuation.operator"];
586
+ var SAFE_INSERT_BEFORE_TOKENS =
587
+ ["text", "paren.rparen", "punctuation.operator", "comment"];
588
+
589
+
590
+ var autoInsertedBrackets = 0;
591
+ var autoInsertedRow = -1;
592
+ var autoInsertedLineEnd = "";
593
+ var maybeInsertedBrackets = 0;
594
+ var maybeInsertedRow = -1;
595
+ var maybeInsertedLineStart = "";
596
+ var maybeInsertedLineEnd = "";
597
+
598
+ var CstyleBehaviour = function () {
599
+
600
+ CstyleBehaviour.isSaneInsertion = function(editor, session) {
601
+ var cursor = editor.getCursorPosition();
602
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
603
+ if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
604
+ var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
605
+ if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
606
+ return false;
607
+ }
608
+ iterator.stepForward();
609
+ return iterator.getCurrentTokenRow() !== cursor.row ||
610
+ this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
611
+ };
612
+
613
+ CstyleBehaviour.$matchTokenType = function(token, types) {
614
+ return types.indexOf(token.type || token) > -1;
615
+ };
616
+
617
+ CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
618
+ var cursor = editor.getCursorPosition();
619
+ var line = session.doc.getLine(cursor.row);
620
+ if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
621
+ autoInsertedBrackets = 0;
622
+ autoInsertedRow = cursor.row;
623
+ autoInsertedLineEnd = bracket + line.substr(cursor.column);
624
+ autoInsertedBrackets++;
625
+ };
626
+
627
+ CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
628
+ var cursor = editor.getCursorPosition();
629
+ var line = session.doc.getLine(cursor.row);
630
+ if (!this.isMaybeInsertedClosing(cursor, line))
631
+ maybeInsertedBrackets = 0;
632
+ maybeInsertedRow = cursor.row;
633
+ maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
634
+ maybeInsertedLineEnd = line.substr(cursor.column);
635
+ maybeInsertedBrackets++;
636
+ };
637
+
638
+ CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
639
+ return autoInsertedBrackets > 0 &&
640
+ cursor.row === autoInsertedRow &&
641
+ bracket === autoInsertedLineEnd[0] &&
642
+ line.substr(cursor.column) === autoInsertedLineEnd;
643
+ };
644
+
645
+ CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
646
+ return maybeInsertedBrackets > 0 &&
647
+ cursor.row === maybeInsertedRow &&
648
+ line.substr(cursor.column) === maybeInsertedLineEnd &&
649
+ line.substr(0, cursor.column) == maybeInsertedLineStart;
650
+ };
651
+
652
+ CstyleBehaviour.popAutoInsertedClosing = function() {
653
+ autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
654
+ autoInsertedBrackets--;
655
+ };
656
+
657
+ CstyleBehaviour.clearMaybeInsertedClosing = function() {
658
+ maybeInsertedBrackets = 0;
659
+ maybeInsertedRow = -1;
660
+ };
661
+
662
+ this.add("braces", "insertion", function (state, action, editor, session, text) {
663
+ var cursor = editor.getCursorPosition();
664
+ var line = session.doc.getLine(cursor.row);
665
+ if (text == '{') {
666
+ var selection = editor.getSelectionRange();
667
+ var selected = session.doc.getTextRange(selection);
668
+ if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
669
+ return {
670
+ text: '{' + selected + '}',
671
+ selection: false
672
+ };
673
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
674
+ if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
675
+ CstyleBehaviour.recordAutoInsert(editor, session, "}");
676
+ return {
677
+ text: '{}',
678
+ selection: [1, 1]
679
+ };
680
+ } else {
681
+ CstyleBehaviour.recordMaybeInsert(editor, session, "{");
682
+ return {
683
+ text: '{',
684
+ selection: [1, 1]
685
+ };
686
+ }
687
+ }
688
+ } else if (text == '}') {
689
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
690
+ if (rightChar == '}') {
691
+ var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
692
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
693
+ CstyleBehaviour.popAutoInsertedClosing();
694
+ return {
695
+ text: '',
696
+ selection: [1, 1]
697
+ };
698
+ }
699
+ }
700
+ } else if (text == "\n" || text == "\r\n") {
701
+ var closing = "";
702
+ if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
703
+ closing = lang.stringRepeat("}", maybeInsertedBrackets);
704
+ CstyleBehaviour.clearMaybeInsertedClosing();
705
+ }
706
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
707
+ if (rightChar === '}') {
708
+ var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
709
+ if (!openBracePos)
710
+ return null;
711
+ var next_indent = this.$getIndent(session.getLine(openBracePos.row));
712
+ } else if (closing) {
713
+ var next_indent = this.$getIndent(line);
714
+ } else {
715
+ return;
716
+ }
717
+ var indent = next_indent + session.getTabString();
718
+
719
+ return {
720
+ text: '\n' + indent + '\n' + next_indent + closing,
721
+ selection: [1, indent.length, 1, indent.length]
722
+ };
723
+ } else {
724
+ CstyleBehaviour.clearMaybeInsertedClosing();
725
+ }
726
+ });
727
+
728
+ this.add("braces", "deletion", function (state, action, editor, session, range) {
729
+ var selected = session.doc.getTextRange(range);
730
+ if (!range.isMultiLine() && selected == '{') {
731
+ var line = session.doc.getLine(range.start.row);
732
+ var rightChar = line.substring(range.end.column, range.end.column + 1);
733
+ if (rightChar == '}') {
734
+ range.end.column++;
735
+ return range;
736
+ } else {
737
+ maybeInsertedBrackets--;
738
+ }
739
+ }
740
+ });
741
+
742
+ this.add("parens", "insertion", function (state, action, editor, session, text) {
743
+ if (text == '(') {
744
+ var selection = editor.getSelectionRange();
745
+ var selected = session.doc.getTextRange(selection);
746
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
747
+ return {
748
+ text: '(' + selected + ')',
749
+ selection: false
750
+ };
751
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
752
+ CstyleBehaviour.recordAutoInsert(editor, session, ")");
753
+ return {
754
+ text: '()',
755
+ selection: [1, 1]
756
+ };
757
+ }
758
+ } else if (text == ')') {
759
+ var cursor = editor.getCursorPosition();
760
+ var line = session.doc.getLine(cursor.row);
761
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
762
+ if (rightChar == ')') {
763
+ var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
764
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
765
+ CstyleBehaviour.popAutoInsertedClosing();
766
+ return {
767
+ text: '',
768
+ selection: [1, 1]
769
+ };
770
+ }
771
+ }
772
+ }
773
+ });
774
+
775
+ this.add("parens", "deletion", function (state, action, editor, session, range) {
776
+ var selected = session.doc.getTextRange(range);
777
+ if (!range.isMultiLine() && selected == '(') {
778
+ var line = session.doc.getLine(range.start.row);
779
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
780
+ if (rightChar == ')') {
781
+ range.end.column++;
782
+ return range;
783
+ }
784
+ }
785
+ });
786
+
787
+ this.add("brackets", "insertion", function (state, action, editor, session, text) {
788
+ if (text == '[') {
789
+ var selection = editor.getSelectionRange();
790
+ var selected = session.doc.getTextRange(selection);
791
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
792
+ return {
793
+ text: '[' + selected + ']',
794
+ selection: false
795
+ };
796
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
797
+ CstyleBehaviour.recordAutoInsert(editor, session, "]");
798
+ return {
799
+ text: '[]',
800
+ selection: [1, 1]
801
+ };
802
+ }
803
+ } else if (text == ']') {
804
+ var cursor = editor.getCursorPosition();
805
+ var line = session.doc.getLine(cursor.row);
806
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
807
+ if (rightChar == ']') {
808
+ var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
809
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
810
+ CstyleBehaviour.popAutoInsertedClosing();
811
+ return {
812
+ text: '',
813
+ selection: [1, 1]
814
+ };
815
+ }
816
+ }
817
+ }
818
+ });
819
+
820
+ this.add("brackets", "deletion", function (state, action, editor, session, range) {
821
+ var selected = session.doc.getTextRange(range);
822
+ if (!range.isMultiLine() && selected == '[') {
823
+ var line = session.doc.getLine(range.start.row);
824
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
825
+ if (rightChar == ']') {
826
+ range.end.column++;
827
+ return range;
828
+ }
829
+ }
830
+ });
831
+
832
+ this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
833
+ if (text == '"' || text == "'") {
834
+ var quote = text;
835
+ var selection = editor.getSelectionRange();
836
+ var selected = session.doc.getTextRange(selection);
837
+ if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
838
+ return {
839
+ text: quote + selected + quote,
840
+ selection: false
841
+ };
842
+ } else {
843
+ var cursor = editor.getCursorPosition();
844
+ var line = session.doc.getLine(cursor.row);
845
+ var leftChar = line.substring(cursor.column-1, cursor.column);
846
+ if (leftChar == '\\') {
847
+ return null;
848
+ }
849
+ var tokens = session.getTokens(selection.start.row);
850
+ var col = 0, token;
851
+ var quotepos = -1; // Track whether we're inside an open quote.
852
+
853
+ for (var x = 0; x < tokens.length; x++) {
854
+ token = tokens[x];
855
+ if (token.type == "string") {
856
+ quotepos = -1;
857
+ } else if (quotepos < 0) {
858
+ quotepos = token.value.indexOf(quote);
859
+ }
860
+ if ((token.value.length + col) > selection.start.column) {
861
+ break;
862
+ }
863
+ col += tokens[x].value.length;
864
+ }
865
+ 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)))) {
866
+ if (!CstyleBehaviour.isSaneInsertion(editor, session))
867
+ return;
868
+ return {
869
+ text: quote + quote,
870
+ selection: [1,1]
871
+ };
872
+ } else if (token && token.type === "string") {
873
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
874
+ if (rightChar == quote) {
875
+ return {
876
+ text: '',
877
+ selection: [1, 1]
878
+ };
879
+ }
880
+ }
881
+ }
882
+ }
883
+ });
884
+
885
+ this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
886
+ var selected = session.doc.getTextRange(range);
887
+ if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
888
+ var line = session.doc.getLine(range.start.row);
889
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
890
+ if (rightChar == selected) {
891
+ range.end.column++;
892
+ return range;
893
+ }
894
+ }
895
+ });
896
+
897
+ };
898
+
899
+ oop.inherits(CstyleBehaviour, Behaviour);
900
+
901
+ exports.CstyleBehaviour = CstyleBehaviour;
902
+ });
903
+
904
+ define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
905
+
906
+
907
+ var oop = require("../../lib/oop");
908
+ var Range = require("../../range").Range;
909
+ var BaseFoldMode = require("./fold_mode").FoldMode;
910
+
911
+ var FoldMode = exports.FoldMode = function(commentRegex) {
912
+ if (commentRegex) {
913
+ this.foldingStartMarker = new RegExp(
914
+ this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
915
+ );
916
+ this.foldingStopMarker = new RegExp(
917
+ this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
918
+ );
919
+ }
920
+ };
921
+ oop.inherits(FoldMode, BaseFoldMode);
922
+
923
+ (function() {
924
+
925
+ this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
926
+ this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
927
+
928
+ this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
929
+ var line = session.getLine(row);
930
+ var match = line.match(this.foldingStartMarker);
931
+ if (match) {
932
+ var i = match.index;
933
+
934
+ if (match[1])
935
+ return this.openingBracketBlock(session, match[1], row, i);
936
+
937
+ var range = session.getCommentFoldRange(row, i + match[0].length, 1);
938
+
939
+ if (range && !range.isMultiLine()) {
940
+ if (forceMultiline) {
941
+ range = this.getSectionRange(session, row);
942
+ } else if (foldStyle != "all")
943
+ range = null;
944
+ }
945
+
946
+ return range;
947
+ }
948
+
949
+ if (foldStyle === "markbegin")
950
+ return;
951
+
952
+ var match = line.match(this.foldingStopMarker);
953
+ if (match) {
954
+ var i = match.index + match[0].length;
955
+
956
+ if (match[1])
957
+ return this.closingBracketBlock(session, match[1], row, i);
958
+
959
+ return session.getCommentFoldRange(row, i, -1);
960
+ }
961
+ };
962
+
963
+ this.getSectionRange = function(session, row) {
964
+ var line = session.getLine(row);
965
+ var startIndent = line.search(/\S/);
966
+ var startRow = row;
967
+ var startColumn = line.length;
968
+ row = row + 1;
969
+ var endRow = row;
970
+ var maxRow = session.getLength();
971
+ while (++row < maxRow) {
972
+ line = session.getLine(row);
973
+ var indent = line.search(/\S/);
974
+ if (indent === -1)
975
+ continue;
976
+ if (startIndent > indent)
977
+ break;
978
+ var subRange = this.getFoldWidgetRange(session, "all", row);
979
+
980
+ if (subRange) {
981
+ if (subRange.start.row <= startRow) {
982
+ break;
983
+ } else if (subRange.isMultiLine()) {
984
+ row = subRange.end.row;
985
+ } else if (startIndent == indent) {
986
+ break;
987
+ }
988
+ }
989
+ endRow = row;
990
+ }
991
+
992
+ return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
993
+ };
994
+
995
+ }).call(FoldMode.prototype);
996
+
997
+ });
998
+
999
+ 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) {
1000
+
1001
+
1002
+ var oop = require("../lib/oop");
1003
+ var TextMode = require("./text").Mode;
1004
+ var Tokenizer = require("../tokenizer").Tokenizer;
1005
+ var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
1006
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
1007
+ var WorkerClient = require("../worker/worker_client").WorkerClient;
1008
+ var CssBehaviour = require("./behaviour/css").CssBehaviour;
1009
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
1010
+
1011
+ var Mode = function() {
1012
+ this.HighlightRules = CssHighlightRules;
1013
+ this.$outdent = new MatchingBraceOutdent();
1014
+ this.$behaviour = new CssBehaviour();
1015
+ this.foldingRules = new CStyleFoldMode();
1016
+ };
1017
+ oop.inherits(Mode, TextMode);
1018
+
1019
+ (function() {
1020
+
1021
+ this.foldingRules = "cStyle";
1022
+ this.blockComment = {start: "/*", end: "*/"};
1023
+
1024
+ this.getNextLineIndent = function(state, line, tab) {
1025
+ var indent = this.$getIndent(line);
1026
+ var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
1027
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
1028
+ return indent;
1029
+ }
1030
+
1031
+ var match = line.match(/^.*\{\s*$/);
1032
+ if (match) {
1033
+ indent += tab;
1034
+ }
1035
+
1036
+ return indent;
1037
+ };
1038
+
1039
+ this.checkOutdent = function(state, line, input) {
1040
+ return this.$outdent.checkOutdent(line, input);
1041
+ };
1042
+
1043
+ this.autoOutdent = function(state, doc, row) {
1044
+ this.$outdent.autoOutdent(doc, row);
1045
+ };
1046
+
1047
+ this.createWorker = function(session) {
1048
+ var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
1049
+ worker.attachToDocument(session.getDocument());
1050
+
1051
+ worker.on("csslint", function(e) {
1052
+ session.setAnnotations(e.data);
1053
+ });
1054
+
1055
+ worker.on("terminate", function() {
1056
+ session.clearAnnotations();
1057
+ });
1058
+
1059
+ return worker;
1060
+ };
1061
+
1062
+ this.$id = "ace/mode/css";
1063
+ }).call(Mode.prototype);
1064
+
1065
+ exports.Mode = Mode;
1066
+
1067
+ });
1068
+
1069
+ define('ace/mode/css_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
1070
+
1071
+
1072
+ var oop = require("../lib/oop");
1073
+ var lang = require("../lib/lang");
1074
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1075
+ 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";
1076
+ var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
1077
+ 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";
1078
+ var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow";
1079
+ 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";
1080
+
1081
+ var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
1082
+ var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
1083
+ 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";
1084
+
1085
+ var CssHighlightRules = function() {
1086
+
1087
+ var keywordMapper = this.createKeywordMapper({
1088
+ "support.function": supportFunction,
1089
+ "support.constant": supportConstant,
1090
+ "support.type": supportType,
1091
+ "support.constant.color": supportConstantColor,
1092
+ "support.constant.fonts": supportConstantFonts
1093
+ }, "text", true);
1094
+
1095
+ this.$rules = {
1096
+ "start" : [{
1097
+ token : "comment", // multi line comment
1098
+ regex : "\\/\\*",
1099
+ push : "comment"
1100
+ }, {
1101
+ token: "paren.lparen",
1102
+ regex: "\\{",
1103
+ push: "ruleset"
1104
+ }, {
1105
+ token: "string",
1106
+ regex: "@.*?{",
1107
+ push: "media"
1108
+ }, {
1109
+ token: "keyword",
1110
+ regex: "#[a-z0-9-_]+"
1111
+ }, {
1112
+ token: "variable",
1113
+ regex: "\\.[a-z0-9-_]+"
1114
+ }, {
1115
+ token: "string",
1116
+ regex: ":[a-z0-9-_]+"
1117
+ }, {
1118
+ token: "constant",
1119
+ regex: "[a-z0-9-_]+"
1120
+ }, {
1121
+ caseInsensitive: true
1122
+ }],
1123
+
1124
+ "media" : [{
1125
+ token : "comment", // multi line comment
1126
+ regex : "\\/\\*",
1127
+ push : "comment"
1128
+ }, {
1129
+ token: "paren.lparen",
1130
+ regex: "\\{",
1131
+ push: "ruleset"
1132
+ }, {
1133
+ token: "string",
1134
+ regex: "\\}",
1135
+ next: "pop"
1136
+ }, {
1137
+ token: "keyword",
1138
+ regex: "#[a-z0-9-_]+"
1139
+ }, {
1140
+ token: "variable",
1141
+ regex: "\\.[a-z0-9-_]+"
1142
+ }, {
1143
+ token: "string",
1144
+ regex: ":[a-z0-9-_]+"
1145
+ }, {
1146
+ token: "constant",
1147
+ regex: "[a-z0-9-_]+"
1148
+ }, {
1149
+ caseInsensitive: true
1150
+ }],
1151
+
1152
+ "comment" : [{
1153
+ token : "comment",
1154
+ regex : "\\*\\/",
1155
+ next : "pop"
1156
+ }, {
1157
+ defaultToken : "comment"
1158
+ }],
1159
+
1160
+ "ruleset" : [
1161
+ {
1162
+ token : "paren.rparen",
1163
+ regex : "\\}",
1164
+ next: "pop"
1165
+ }, {
1166
+ token : "comment", // multi line comment
1167
+ regex : "\\/\\*",
1168
+ push : "comment"
1169
+ }, {
1170
+ token : "string", // single line
1171
+ regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
1172
+ }, {
1173
+ token : "string", // single line
1174
+ regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
1175
+ }, {
1176
+ token : ["constant.numeric", "keyword"],
1177
+ 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|%)"
1178
+ }, {
1179
+ token : "constant.numeric",
1180
+ regex : numRe
1181
+ }, {
1182
+ token : "constant.numeric", // hex6 color
1183
+ regex : "#[a-f0-9]{6}"
1184
+ }, {
1185
+ token : "constant.numeric", // hex3 color
1186
+ regex : "#[a-f0-9]{3}"
1187
+ }, {
1188
+ token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
1189
+ regex : pseudoElements
1190
+ }, {
1191
+ token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
1192
+ regex : pseudoClasses
1193
+ }, {
1194
+ token : ["support.function", "string", "support.function"],
1195
+ regex : "(url\\()(.*)(\\))"
1196
+ }, {
1197
+ token : keywordMapper,
1198
+ regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
1199
+ }, {
1200
+ caseInsensitive: true
1201
+ }]
1202
+ };
1203
+
1204
+ this.normalizeRules();
1205
+ };
1206
+
1207
+ oop.inherits(CssHighlightRules, TextHighlightRules);
1208
+
1209
+ exports.CssHighlightRules = CssHighlightRules;
1210
+
1211
+ });
1212
+
1213
+ 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) {
1214
+
1215
+
1216
+ var oop = require("../../lib/oop");
1217
+ var Behaviour = require("../behaviour").Behaviour;
1218
+ var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
1219
+ var TokenIterator = require("../../token_iterator").TokenIterator;
1220
+
1221
+ var CssBehaviour = function () {
1222
+
1223
+ this.inherit(CstyleBehaviour);
1224
+
1225
+ this.add("colon", "insertion", function (state, action, editor, session, text) {
1226
+ if (text === ':') {
1227
+ var cursor = editor.getCursorPosition();
1228
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
1229
+ var token = iterator.getCurrentToken();
1230
+ if (token && token.value.match(/\s+/)) {
1231
+ token = iterator.stepBackward();
1232
+ }
1233
+ if (token && token.type === 'support.type') {
1234
+ var line = session.doc.getLine(cursor.row);
1235
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1236
+ if (rightChar === ':') {
1237
+ return {
1238
+ text: '',
1239
+ selection: [1, 1]
1240
+ }
1241
+ }
1242
+ if (!line.substring(cursor.column).match(/^\s*;/)) {
1243
+ return {
1244
+ text: ':;',
1245
+ selection: [1, 1]
1246
+ }
1247
+ }
1248
+ }
1249
+ }
1250
+ });
1251
+
1252
+ this.add("colon", "deletion", function (state, action, editor, session, range) {
1253
+ var selected = session.doc.getTextRange(range);
1254
+ if (!range.isMultiLine() && selected === ':') {
1255
+ var cursor = editor.getCursorPosition();
1256
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
1257
+ var token = iterator.getCurrentToken();
1258
+ if (token && token.value.match(/\s+/)) {
1259
+ token = iterator.stepBackward();
1260
+ }
1261
+ if (token && token.type === 'support.type') {
1262
+ var line = session.doc.getLine(range.start.row);
1263
+ var rightChar = line.substring(range.end.column, range.end.column + 1);
1264
+ if (rightChar === ';') {
1265
+ range.end.column ++;
1266
+ return range;
1267
+ }
1268
+ }
1269
+ }
1270
+ });
1271
+
1272
+ this.add("semicolon", "insertion", function (state, action, editor, session, text) {
1273
+ if (text === ';') {
1274
+ var cursor = editor.getCursorPosition();
1275
+ var line = session.doc.getLine(cursor.row);
1276
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1277
+ if (rightChar === ';') {
1278
+ return {
1279
+ text: '',
1280
+ selection: [1, 1]
1281
+ }
1282
+ }
1283
+ }
1284
+ });
1285
+
1286
+ }
1287
+ oop.inherits(CssBehaviour, CstyleBehaviour);
1288
+
1289
+ exports.CssBehaviour = CssBehaviour;
1290
+ });
1291
+
1292
+ define('ace/mode/twig_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/html_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
1293
+
1294
+
1295
+ var oop = require("../lib/oop");
1296
+ var lang = require("../lib/lang");
1297
+ var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
1298
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1299
+
1300
+ var TwigHighlightRules = function() {
1301
+ HtmlHighlightRules.call(this);
1302
+
1303
+ var tags = "autoescape|block|do|embed|extends|filter|flush|for|from|if|import|include|macro|sandbox|set|spaceless|use|verbatim";
1304
+ tags = tags + "|end" + tags.replace(/\|/g, "|end");
1305
+ var filters = "abs|batch|capitalize|convert_encoding|date|date_modify|default|e|escape|first|format|join|json_encode|keys|last|length|lower|merge|nl2br|number_format|raw|replace|reverse|slice|sort|split|striptags|title|trim|upper|url_encode";
1306
+ var functions = "attribute|constant|cycle|date|dump|parent|random|range|template_from_string";
1307
+ var tests = "constant|divisibleby|sameas|defined|empty|even|iterable|odd";
1308
+ var constants = "null|none|true|false";
1309
+ var operators = "b-and|b-xor|b-or|in|is|and|or|not"
1310
+
1311
+ var keywordMapper = this.createKeywordMapper({
1312
+ "keyword.control.twig": tags,
1313
+ "support.function.twig": [filters, functions, tests].join("|"),
1314
+ "keyword.operator.twig": operators,
1315
+ "constant.language.twig": constants
1316
+ }, "identifier");
1317
+ for (var rule in this.$rules) {
1318
+ this.$rules[rule].unshift({
1319
+ token : "variable.other.readwrite.local.twig",
1320
+ regex : "\\{\\{-?",
1321
+ push : "twig-start"
1322
+ }, {
1323
+ token : "meta.tag.twig",
1324
+ regex : "\\{%-?",
1325
+ push : "twig-start"
1326
+ }, {
1327
+ token : "comment.block.twig",
1328
+ regex : "\\{#-?",
1329
+ push : "twig-comment"
1330
+ });
1331
+ }
1332
+ this.$rules["twig-comment"] = [{
1333
+ token : "comment.block.twig",
1334
+ regex : ".*-?#\\}",
1335
+ next : "pop"
1336
+ }];
1337
+
1338
+ this.$rules["twig-start"] = [{
1339
+ token : "variable.other.readwrite.local.twig",
1340
+ regex : "-?\\}\\}",
1341
+ next : "pop"
1342
+ }, {
1343
+ token : "meta.tag.twig",
1344
+ regex : "-?%\\}",
1345
+ next : "pop"
1346
+ }, {
1347
+ token : "string",
1348
+ regex : "'",
1349
+ next : "twig-qstring"
1350
+ }, {
1351
+ token : "string",
1352
+ regex : '"',
1353
+ next : "twig-qqstring"
1354
+ }, {
1355
+ token : "constant.numeric", // hex
1356
+ regex : "0[xX][0-9a-fA-F]+\\b"
1357
+ }, {
1358
+ token : "constant.numeric", // float
1359
+ regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
1360
+ }, {
1361
+ token : "constant.language.boolean",
1362
+ regex : "(?:true|false)\\b"
1363
+ }, {
1364
+ token : keywordMapper,
1365
+ regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
1366
+ }, {
1367
+ token : "keyword.operator.assignment",
1368
+ regex : "=|~"
1369
+ }, {
1370
+ token : "keyword.operator.comparison",
1371
+ regex : "==|!=|<|>|>=|<=|==="
1372
+ }, {
1373
+ token : "keyword.operator.arithmetic",
1374
+ regex : "\\+|-|/|%|//|\\*|\\*\\*"
1375
+ }, {
1376
+ token : "keyword.operator.other",
1377
+ regex : "\\.\\.|\\|"
1378
+ }, {
1379
+ token : "punctuation.operator",
1380
+ regex : /\?|\:|\,|\;|\./
1381
+ }, {
1382
+ token : "paren.lparen",
1383
+ regex : /[\[\({]/
1384
+ }, {
1385
+ token : "paren.rparen",
1386
+ regex : /[\])}]/
1387
+ }, {
1388
+ token : "text",
1389
+ regex : "\\s+"
1390
+ } ];
1391
+
1392
+ this.$rules["twig-qqstring"] = [{
1393
+ token : "constant.language.escape",
1394
+ regex : /\\[\\"$#ntr]|#{[^"}]*}/
1395
+ }, {
1396
+ token : "string",
1397
+ regex : '"',
1398
+ next : "twig-start"
1399
+ }, {
1400
+ defaultToken : "string"
1401
+ }
1402
+ ];
1403
+
1404
+ this.$rules["twig-qstring"] = [{
1405
+ token : "constant.language.escape",
1406
+ regex : /\\[\\'ntr]}/
1407
+ }, {
1408
+ token : "string",
1409
+ regex : "'",
1410
+ next : "twig-start"
1411
+ }, {
1412
+ defaultToken : "string"
1413
+ }
1414
+ ];
1415
+
1416
+ this.normalizeRules();
1417
+ };
1418
+
1419
+ oop.inherits(TwigHighlightRules, TextHighlightRules);
1420
+
1421
+ exports.TwigHighlightRules = TwigHighlightRules;
1422
+ });
1423
+
1424
+ 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) {
1425
+
1426
+
1427
+ var oop = require("../lib/oop");
1428
+ var lang = require("../lib/lang");
1429
+ var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
1430
+ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
1431
+ var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
1432
+
1433
+ var tagMap = lang.createMap({
1434
+ a : 'anchor',
1435
+ button : 'form',
1436
+ form : 'form',
1437
+ img : 'image',
1438
+ input : 'form',
1439
+ label : 'form',
1440
+ option : 'form',
1441
+ script : 'script',
1442
+ select : 'form',
1443
+ textarea : 'form',
1444
+ style : 'style',
1445
+ table : 'table',
1446
+ tbody : 'table',
1447
+ td : 'table',
1448
+ tfoot : 'table',
1449
+ th : 'table',
1450
+ tr : 'table'
1451
+ });
1452
+
1453
+ var HtmlHighlightRules = function() {
1454
+ XmlHighlightRules.call(this);
1455
+
1456
+ this.addRules({
1457
+ attributes: [{
1458
+ include : "space"
1459
+ }, {
1460
+ token : "entity.other.attribute-name",
1461
+ regex : "[-_a-zA-Z0-9:]+"
1462
+ }, {
1463
+ token : "keyword.operator.separator",
1464
+ regex : "=",
1465
+ push : [{
1466
+ include: "space"
1467
+ }, {
1468
+ token : "string",
1469
+ regex : "[^<>='\"`\\s]+",
1470
+ next : "pop"
1471
+ }, {
1472
+ token : "empty",
1473
+ regex : "",
1474
+ next : "pop"
1475
+ }]
1476
+ }, {
1477
+ include : "string"
1478
+ }],
1479
+ tag: [{
1480
+ token : function(start, tag) {
1481
+ var group = tagMap[tag];
1482
+ return ["meta.tag.punctuation.begin",
1483
+ "meta.tag.name" + (group ? "." + group : "")];
1484
+ },
1485
+ regex : "(<)([-_a-zA-Z0-9:]+)",
1486
+ next: "start_tag_stuff"
1487
+ }, {
1488
+ token : function(start, tag) {
1489
+ var group = tagMap[tag];
1490
+ return ["meta.tag.punctuation.begin",
1491
+ "meta.tag.name" + (group ? "." + group : "")];
1492
+ },
1493
+ regex : "(</)([-_a-zA-Z0-9:]+)",
1494
+ next: "end_tag_stuff"
1495
+ }],
1496
+ start_tag_stuff: [
1497
+ {include : "attributes"},
1498
+ {token : "meta.tag.punctuation.end", regex : "/?>", next : "start"}
1499
+ ],
1500
+ end_tag_stuff: [
1501
+ {include : "space"},
1502
+ {token : "meta.tag.punctuation.end", regex : ">", next : "start"}
1503
+ ]
1504
+ });
1505
+
1506
+ this.embedTagRules(CssHighlightRules, "css-", "style");
1507
+ this.embedTagRules(JavaScriptHighlightRules, "js-", "script");
1508
+
1509
+ if (this.constructor === HtmlHighlightRules)
1510
+ this.normalizeRules();
1511
+ };
1512
+
1513
+ oop.inherits(HtmlHighlightRules, XmlHighlightRules);
1514
+
1515
+ exports.HtmlHighlightRules = HtmlHighlightRules;
1516
+ });
1517
+
1518
+ 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) {
1519
+
1520
+
1521
+ var oop = require("../lib/oop");
1522
+ var xmlUtil = require("./xml_util");
1523
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1524
+
1525
+ var XmlHighlightRules = function(normalize) {
1526
+ this.$rules = {
1527
+ start : [
1528
+ {token : "punctuation.string.begin", regex : "<\\!\\[CDATA\\[", next : "cdata"},
1529
+ {
1530
+ token : ["punctuation.instruction.begin", "keyword.instruction"],
1531
+ regex : "(<\\?)(xml)(?=[\\s])", next : "xml_declaration"
1532
+ },
1533
+ {
1534
+ token : ["punctuation.instruction.begin", "keyword.instruction"],
1535
+ regex : "(<\\?)([-_a-zA-Z0-9]+)", next : "instruction"
1536
+ },
1537
+ {token : "comment", regex : "<\\!--", next : "comment"},
1538
+ {
1539
+ token : ["punctuation.doctype.begin", "meta.tag.doctype"],
1540
+ regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype"
1541
+ },
1542
+ {include : "tag"},
1543
+ {include : "reference"}
1544
+ ],
1545
+
1546
+ xml_declaration : [
1547
+ {include : "attributes"},
1548
+ {include : "instruction"}
1549
+ ],
1550
+
1551
+ instruction : [
1552
+ {token : "punctuation.instruction.end", regex : "\\?>", next : "start"}
1553
+ ],
1554
+
1555
+ doctype : [
1556
+ {include : "space"},
1557
+ {include : "string"},
1558
+ {token : "punctuation.doctype.end", regex : ">", next : "start"},
1559
+ {token : "xml-pe", regex : "[-_a-zA-Z0-9:]+"},
1560
+ {token : "punctuation.begin", regex : "\\[", push : "declarations"}
1561
+ ],
1562
+
1563
+ declarations : [{
1564
+ token : "text",
1565
+ regex : "\\s+"
1566
+ }, {
1567
+ token: "punctuation.end",
1568
+ regex: "]",
1569
+ next: "pop"
1570
+ }, {
1571
+ token : ["punctuation.begin", "keyword"],
1572
+ regex : "(<\\!)([-_a-zA-Z0-9]+)",
1573
+ push : [{
1574
+ token : "text",
1575
+ regex : "\\s+"
1576
+ },
1577
+ {
1578
+ token : "punctuation.end",
1579
+ regex : ">",
1580
+ next : "pop"
1581
+ },
1582
+ {include : "string"}]
1583
+ }],
1584
+
1585
+ cdata : [
1586
+ {token : "string.end", regex : "\\]\\]>", next : "start"},
1587
+ {token : "text", regex : "\\s+"},
1588
+ {token : "text", regex : "(?:[^\\]]|\\](?!\\]>))+"}
1589
+ ],
1590
+
1591
+ comment : [
1592
+ {token : "comment", regex : "-->", next : "start"},
1593
+ {defaultToken : "comment"}
1594
+ ],
1595
+
1596
+ tag : [{
1597
+ token : ["meta.tag.punctuation.begin", "meta.tag.name"],
1598
+ regex : "(<)((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)",
1599
+ next: [
1600
+ {include : "attributes"},
1601
+ {token : "meta.tag.punctuation.end", regex : "/?>", next : "start"}
1602
+ ]
1603
+ }, {
1604
+ token : ["meta.tag.punctuation.begin", "meta.tag.name"],
1605
+ regex : "(</)((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)",
1606
+ next: [
1607
+ {include : "space"},
1608
+ {token : "meta.tag.punctuation.end", regex : ">", next : "start"}
1609
+ ]
1610
+ }],
1611
+
1612
+ space : [
1613
+ {token : "text", regex : "\\s+"}
1614
+ ],
1615
+
1616
+ reference : [{
1617
+ token : "constant.language.escape",
1618
+ regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
1619
+ }, {
1620
+ token : "text", regex : "&"
1621
+ }],
1622
+
1623
+ string: [{
1624
+ token : "string",
1625
+ regex : "'",
1626
+ push : "qstring_inner"
1627
+ }, {
1628
+ token : "string",
1629
+ regex : '"',
1630
+ push : "qqstring_inner"
1631
+ }],
1632
+
1633
+ qstring_inner: [
1634
+ {token : "string", regex: "'", next: "pop"},
1635
+ {include : "reference"},
1636
+ {defaultToken : "string"}
1637
+ ],
1638
+
1639
+ qqstring_inner: [
1640
+ {token : "string", regex: '"', next: "pop"},
1641
+ {include : "reference"},
1642
+ {defaultToken : "string"}
1643
+ ],
1644
+
1645
+ attributes: [{
1646
+ token : "entity.other.attribute-name",
1647
+ regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+"
1648
+ }, {
1649
+ token : "keyword.operator.separator",
1650
+ regex : "="
1651
+ }, {
1652
+ include : "space"
1653
+ }, {
1654
+ include : "string"
1655
+ }]
1656
+ };
1657
+
1658
+ if (this.constructor === XmlHighlightRules)
1659
+ this.normalizeRules();
1660
+ };
1661
+
1662
+
1663
+ (function() {
1664
+
1665
+ this.embedTagRules = function(HighlightRules, prefix, tag){
1666
+ this.$rules.tag.unshift({
1667
+ token : ["meta.tag.punctuation.begin", "meta.tag.name." + tag],
1668
+ regex : "(<)(" + tag + ")",
1669
+ next: [
1670
+ {include : "space"},
1671
+ {include : "attributes"},
1672
+ {token : "meta.tag.punctuation.end", regex : "/?>", next : prefix + "start"}
1673
+ ]
1674
+ });
1675
+
1676
+ this.$rules[tag + "-end"] = [
1677
+ {include : "space"},
1678
+ {token : "meta.tag.punctuation.end", regex : ">", next: "start",
1679
+ onMatch : function(value, currentState, stack) {
1680
+ stack.splice(0);
1681
+ return this.token;
1682
+ }}
1683
+ ]
1684
+
1685
+ this.embedRules(HighlightRules, prefix, [{
1686
+ token: ["meta.tag.punctuation.begin", "meta.tag.name." + tag],
1687
+ regex : "(</)(" + tag + ")",
1688
+ next: tag + "-end"
1689
+ }, {
1690
+ token: "string.begin",
1691
+ regex : "<\\!\\[CDATA\\["
1692
+ }, {
1693
+ token: "string.end",
1694
+ regex : "\\]\\]>"
1695
+ }]);
1696
+ };
1697
+
1698
+ }).call(TextHighlightRules.prototype);
1699
+
1700
+ oop.inherits(XmlHighlightRules, TextHighlightRules);
1701
+
1702
+ exports.XmlHighlightRules = XmlHighlightRules;
1703
+ });
1704
+
1705
+ define('ace/mode/xml_util', ['require', 'exports', 'module' ], function(require, exports, module) {
1706
+
1707
+
1708
+ function string(state) {
1709
+ return [{
1710
+ token : "string",
1711
+ regex : '"',
1712
+ next : state + "_qqstring"
1713
+ }, {
1714
+ token : "string",
1715
+ regex : "'",
1716
+ next : state + "_qstring"
1717
+ }];
1718
+ }
1719
+
1720
+ function multiLineString(quote, state) {
1721
+ return [
1722
+ {token : "string", regex : quote, next : state},
1723
+ {
1724
+ token : "constant.language.escape",
1725
+ regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
1726
+ },
1727
+ {defaultToken : "string"}
1728
+ ];
1729
+ }
1730
+
1731
+ exports.tag = function(states, name, nextState, tagMap) {
1732
+ states[name] = [{
1733
+ token : "text",
1734
+ regex : "\\s+"
1735
+ }, {
1736
+
1737
+ token : !tagMap ? "meta.tag.tag-name" : function(value) {
1738
+ if (tagMap[value])
1739
+ return "meta.tag.tag-name." + tagMap[value];
1740
+ else
1741
+ return "meta.tag.tag-name";
1742
+ },
1743
+ regex : "[-_a-zA-Z0-9:]+",
1744
+ next : name + "_embed_attribute_list"
1745
+ }, {
1746
+ token: "empty",
1747
+ regex: "",
1748
+ next : name + "_embed_attribute_list"
1749
+ }];
1750
+
1751
+ states[name + "_qstring"] = multiLineString("'", name + "_embed_attribute_list");
1752
+ states[name + "_qqstring"] = multiLineString("\"", name + "_embed_attribute_list");
1753
+
1754
+ states[name + "_embed_attribute_list"] = [{
1755
+ token : "meta.tag.r",
1756
+ regex : "/?>",
1757
+ next : nextState
1758
+ }, {
1759
+ token : "keyword.operator",
1760
+ regex : "="
1761
+ }, {
1762
+ token : "entity.other.attribute-name",
1763
+ regex : "[-_a-zA-Z0-9:]+"
1764
+ }, {
1765
+ token : "constant.numeric", // float
1766
+ regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
1767
+ }, {
1768
+ token : "text",
1769
+ regex : "\\s+"
1770
+ }].concat(string(name));
1771
+ };
1772
+
1773
+ });
1774
+
1775
+ 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) {
1776
+
1777
+
1778
+ var oop = require("../../lib/oop");
1779
+ var XmlBehaviour = require("../behaviour/xml").XmlBehaviour;
1780
+ var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
1781
+ var TokenIterator = require("../../token_iterator").TokenIterator;
1782
+ var voidElements = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr'];
1783
+
1784
+ function hasType(token, type) {
1785
+ var tokenTypes = token.type.split('.');
1786
+ return type.split('.').every(function(type){
1787
+ return (tokenTypes.indexOf(type) !== -1);
1788
+ });
1789
+ return hasType;
1790
+ }
1791
+
1792
+ var HtmlBehaviour = function () {
1793
+
1794
+ this.inherit(XmlBehaviour); // Get xml behaviour
1795
+
1796
+ this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
1797
+ if (text == '>') {
1798
+ var position = editor.getCursorPosition();
1799
+ var iterator = new TokenIterator(session, position.row, position.column);
1800
+ var token = iterator.getCurrentToken();
1801
+
1802
+ if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column)
1803
+ return;
1804
+ var atCursor = false;
1805
+ if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){
1806
+ do {
1807
+ token = iterator.stepBackward();
1808
+ } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text')));
1809
+ } else {
1810
+ atCursor = true;
1811
+ }
1812
+ if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) {
1813
+ return;
1814
+ }
1815
+ var element = token.value;
1816
+ if (atCursor){
1817
+ var element = element.substring(0, position.column - token.start);
1818
+ }
1819
+ if (voidElements.indexOf(element) !== -1){
1820
+ return;
1821
+ }
1822
+ return {
1823
+ text: '>' + '</' + element + '>',
1824
+ selection: [1, 1]
1825
+ }
1826
+ }
1827
+ });
1828
+ }
1829
+ oop.inherits(HtmlBehaviour, XmlBehaviour);
1830
+
1831
+ exports.HtmlBehaviour = HtmlBehaviour;
1832
+ });
1833
+
1834
+ 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) {
1835
+
1836
+
1837
+ var oop = require("../../lib/oop");
1838
+ var Behaviour = require("../behaviour").Behaviour;
1839
+ var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
1840
+ var TokenIterator = require("../../token_iterator").TokenIterator;
1841
+
1842
+ function hasType(token, type) {
1843
+ var tokenTypes = token.type.split('.');
1844
+ return type.split('.').every(function(type){
1845
+ return (tokenTypes.indexOf(type) !== -1);
1846
+ });
1847
+ return hasType;
1848
+ }
1849
+
1850
+ var XmlBehaviour = function () {
1851
+
1852
+ this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour
1853
+
1854
+ this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
1855
+ if (text == '>') {
1856
+ var position = editor.getCursorPosition();
1857
+ var iterator = new TokenIterator(session, position.row, position.column);
1858
+ var token = iterator.getCurrentToken();
1859
+
1860
+ if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column)
1861
+ return;
1862
+ var atCursor = false;
1863
+ if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){
1864
+ do {
1865
+ token = iterator.stepBackward();
1866
+ } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text')));
1867
+ } else {
1868
+ atCursor = true;
1869
+ }
1870
+ if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) {
1871
+ return;
1872
+ }
1873
+ var tag = token.value;
1874
+ if (atCursor){
1875
+ var tag = tag.substring(0, position.column - token.start);
1876
+ }
1877
+
1878
+ return {
1879
+ text: '>' + '</' + tag + '>',
1880
+ selection: [1, 1]
1881
+ }
1882
+ }
1883
+ });
1884
+
1885
+ this.add('autoindent', 'insertion', function (state, action, editor, session, text) {
1886
+ if (text == "\n") {
1887
+ var cursor = editor.getCursorPosition();
1888
+ var line = session.getLine(cursor.row);
1889
+ var rightChars = line.substring(cursor.column, cursor.column + 2);
1890
+ if (rightChars == '</') {
1891
+ var next_indent = this.$getIndent(line);
1892
+ var indent = next_indent + session.getTabString();
1893
+
1894
+ return {
1895
+ text: '\n' + indent + '\n' + next_indent,
1896
+ selection: [1, indent.length, 1, indent.length]
1897
+ }
1898
+ }
1899
+ }
1900
+ });
1901
+
1902
+ }
1903
+ oop.inherits(XmlBehaviour, Behaviour);
1904
+
1905
+ exports.XmlBehaviour = XmlBehaviour;
1906
+ });
1907
+
1908
+ 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) {
1909
+
1910
+
1911
+ var oop = require("../../lib/oop");
1912
+ var MixedFoldMode = require("./mixed").FoldMode;
1913
+ var XmlFoldMode = require("./xml").FoldMode;
1914
+ var CStyleFoldMode = require("./cstyle").FoldMode;
1915
+
1916
+ var FoldMode = exports.FoldMode = function() {
1917
+ MixedFoldMode.call(this, new XmlFoldMode({
1918
+ "area": 1,
1919
+ "base": 1,
1920
+ "br": 1,
1921
+ "col": 1,
1922
+ "command": 1,
1923
+ "embed": 1,
1924
+ "hr": 1,
1925
+ "img": 1,
1926
+ "input": 1,
1927
+ "keygen": 1,
1928
+ "link": 1,
1929
+ "meta": 1,
1930
+ "param": 1,
1931
+ "source": 1,
1932
+ "track": 1,
1933
+ "wbr": 1,
1934
+ "li": 1,
1935
+ "dt": 1,
1936
+ "dd": 1,
1937
+ "p": 1,
1938
+ "rt": 1,
1939
+ "rp": 1,
1940
+ "optgroup": 1,
1941
+ "option": 1,
1942
+ "colgroup": 1,
1943
+ "td": 1,
1944
+ "th": 1
1945
+ }), {
1946
+ "js-": new CStyleFoldMode(),
1947
+ "css-": new CStyleFoldMode()
1948
+ });
1949
+ };
1950
+
1951
+ oop.inherits(FoldMode, MixedFoldMode);
1952
+
1953
+ });
1954
+
1955
+ define('ace/mode/folding/mixed', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
1956
+
1957
+
1958
+ var oop = require("../../lib/oop");
1959
+ var BaseFoldMode = require("./fold_mode").FoldMode;
1960
+
1961
+ var FoldMode = exports.FoldMode = function(defaultMode, subModes) {
1962
+ this.defaultMode = defaultMode;
1963
+ this.subModes = subModes;
1964
+ };
1965
+ oop.inherits(FoldMode, BaseFoldMode);
1966
+
1967
+ (function() {
1968
+
1969
+
1970
+ this.$getMode = function(state) {
1971
+ if (typeof state != "string")
1972
+ state = state[0];
1973
+ for (var key in this.subModes) {
1974
+ if (state.indexOf(key) === 0)
1975
+ return this.subModes[key];
1976
+ }
1977
+ return null;
1978
+ };
1979
+
1980
+ this.$tryMode = function(state, session, foldStyle, row) {
1981
+ var mode = this.$getMode(state);
1982
+ return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
1983
+ };
1984
+
1985
+ this.getFoldWidget = function(session, foldStyle, row) {
1986
+ return (
1987
+ this.$tryMode(session.getState(row-1), session, foldStyle, row) ||
1988
+ this.$tryMode(session.getState(row), session, foldStyle, row) ||
1989
+ this.defaultMode.getFoldWidget(session, foldStyle, row)
1990
+ );
1991
+ };
1992
+
1993
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
1994
+ var mode = this.$getMode(session.getState(row-1));
1995
+
1996
+ if (!mode || !mode.getFoldWidget(session, foldStyle, row))
1997
+ mode = this.$getMode(session.getState(row));
1998
+
1999
+ if (!mode || !mode.getFoldWidget(session, foldStyle, row))
2000
+ mode = this.defaultMode;
2001
+
2002
+ return mode.getFoldWidgetRange(session, foldStyle, row);
2003
+ };
2004
+
2005
+ }).call(FoldMode.prototype);
2006
+
2007
+ });
2008
+
2009
+ 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) {
2010
+
2011
+
2012
+ var oop = require("../../lib/oop");
2013
+ var lang = require("../../lib/lang");
2014
+ var Range = require("../../range").Range;
2015
+ var BaseFoldMode = require("./fold_mode").FoldMode;
2016
+ var TokenIterator = require("../../token_iterator").TokenIterator;
2017
+
2018
+ var FoldMode = exports.FoldMode = function(voidElements) {
2019
+ BaseFoldMode.call(this);
2020
+ this.voidElements = voidElements || {};
2021
+ };
2022
+ oop.inherits(FoldMode, BaseFoldMode);
2023
+
2024
+ (function() {
2025
+
2026
+ this.getFoldWidget = function(session, foldStyle, row) {
2027
+ var tag = this._getFirstTagInLine(session, row);
2028
+
2029
+ if (tag.closing)
2030
+ return foldStyle == "markbeginend" ? "end" : "";
2031
+
2032
+ if (!tag.tagName || this.voidElements[tag.tagName.toLowerCase()])
2033
+ return "";
2034
+
2035
+ if (tag.selfClosing)
2036
+ return "";
2037
+
2038
+ if (tag.value.indexOf("/" + tag.tagName) !== -1)
2039
+ return "";
2040
+
2041
+ return "start";
2042
+ };
2043
+
2044
+ this._getFirstTagInLine = function(session, row) {
2045
+ var tokens = session.getTokens(row);
2046
+ var value = "";
2047
+ for (var i = 0; i < tokens.length; i++) {
2048
+ var token = tokens[i];
2049
+ if (token.type.lastIndexOf("meta.tag", 0) === 0)
2050
+ value += token.value;
2051
+ else
2052
+ value += lang.stringRepeat(" ", token.value.length);
2053
+ }
2054
+
2055
+ return this._parseTag(value);
2056
+ };
2057
+
2058
+ this.tagRe = /^(\s*)(<?(\/?)([-_a-zA-Z0-9:!]*)\s*(\/?)>?)/;
2059
+ this._parseTag = function(tag) {
2060
+
2061
+ var match = tag.match(this.tagRe);
2062
+ var column = 0;
2063
+
2064
+ return {
2065
+ value: tag,
2066
+ match: match ? match[2] : "",
2067
+ closing: match ? !!match[3] : false,
2068
+ selfClosing: match ? !!match[5] || match[2] == "/>" : false,
2069
+ tagName: match ? match[4] : "",
2070
+ column: match[1] ? column + match[1].length : column
2071
+ };
2072
+ };
2073
+ this._readTagForward = function(iterator) {
2074
+ var token = iterator.getCurrentToken();
2075
+ if (!token)
2076
+ return null;
2077
+
2078
+ var value = "";
2079
+ var start;
2080
+
2081
+ do {
2082
+ if (token.type.lastIndexOf("meta.tag", 0) === 0) {
2083
+ if (!start) {
2084
+ var start = {
2085
+ row: iterator.getCurrentTokenRow(),
2086
+ column: iterator.getCurrentTokenColumn()
2087
+ };
2088
+ }
2089
+ value += token.value;
2090
+ if (value.indexOf(">") !== -1) {
2091
+ var tag = this._parseTag(value);
2092
+ tag.start = start;
2093
+ tag.end = {
2094
+ row: iterator.getCurrentTokenRow(),
2095
+ column: iterator.getCurrentTokenColumn() + token.value.length
2096
+ };
2097
+ iterator.stepForward();
2098
+ return tag;
2099
+ }
2100
+ }
2101
+ } while(token = iterator.stepForward());
2102
+
2103
+ return null;
2104
+ };
2105
+
2106
+ this._readTagBackward = function(iterator) {
2107
+ var token = iterator.getCurrentToken();
2108
+ if (!token)
2109
+ return null;
2110
+
2111
+ var value = "";
2112
+ var end;
2113
+
2114
+ do {
2115
+ if (token.type.lastIndexOf("meta.tag", 0) === 0) {
2116
+ if (!end) {
2117
+ end = {
2118
+ row: iterator.getCurrentTokenRow(),
2119
+ column: iterator.getCurrentTokenColumn() + token.value.length
2120
+ };
2121
+ }
2122
+ value = token.value + value;
2123
+ if (value.indexOf("<") !== -1) {
2124
+ var tag = this._parseTag(value);
2125
+ tag.end = end;
2126
+ tag.start = {
2127
+ row: iterator.getCurrentTokenRow(),
2128
+ column: iterator.getCurrentTokenColumn()
2129
+ };
2130
+ iterator.stepBackward();
2131
+ return tag;
2132
+ }
2133
+ }
2134
+ } while(token = iterator.stepBackward());
2135
+
2136
+ return null;
2137
+ };
2138
+
2139
+ this._pop = function(stack, tag) {
2140
+ while (stack.length) {
2141
+
2142
+ var top = stack[stack.length-1];
2143
+ if (!tag || top.tagName == tag.tagName) {
2144
+ return stack.pop();
2145
+ }
2146
+ else if (this.voidElements[tag.tagName]) {
2147
+ return;
2148
+ }
2149
+ else if (this.voidElements[top.tagName]) {
2150
+ stack.pop();
2151
+ continue;
2152
+ } else {
2153
+ return null;
2154
+ }
2155
+ }
2156
+ };
2157
+
2158
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
2159
+ var firstTag = this._getFirstTagInLine(session, row);
2160
+
2161
+ if (!firstTag.match)
2162
+ return null;
2163
+
2164
+ var isBackward = firstTag.closing || firstTag.selfClosing;
2165
+ var stack = [];
2166
+ var tag;
2167
+
2168
+ if (!isBackward) {
2169
+ var iterator = new TokenIterator(session, row, firstTag.column);
2170
+ var start = {
2171
+ row: row,
2172
+ column: firstTag.column + firstTag.tagName.length + 2
2173
+ };
2174
+ while (tag = this._readTagForward(iterator)) {
2175
+ if (tag.selfClosing) {
2176
+ if (!stack.length) {
2177
+ tag.start.column += tag.tagName.length + 2;
2178
+ tag.end.column -= 2;
2179
+ return Range.fromPoints(tag.start, tag.end);
2180
+ } else
2181
+ continue;
2182
+ }
2183
+
2184
+ if (tag.closing) {
2185
+ this._pop(stack, tag);
2186
+ if (stack.length == 0)
2187
+ return Range.fromPoints(start, tag.start);
2188
+ }
2189
+ else {
2190
+ stack.push(tag)
2191
+ }
2192
+ }
2193
+ }
2194
+ else {
2195
+ var iterator = new TokenIterator(session, row, firstTag.column + firstTag.match.length);
2196
+ var end = {
2197
+ row: row,
2198
+ column: firstTag.column
2199
+ };
2200
+
2201
+ while (tag = this._readTagBackward(iterator)) {
2202
+ if (tag.selfClosing) {
2203
+ if (!stack.length) {
2204
+ tag.start.column += tag.tagName.length + 2;
2205
+ tag.end.column -= 2;
2206
+ return Range.fromPoints(tag.start, tag.end);
2207
+ } else
2208
+ continue;
2209
+ }
2210
+
2211
+ if (!tag.closing) {
2212
+ this._pop(stack, tag);
2213
+ if (stack.length == 0) {
2214
+ tag.start.column += tag.tagName.length + 2;
2215
+ return Range.fromPoints(tag.start, end);
2216
+ }
2217
+ }
2218
+ else {
2219
+ stack.push(tag)
2220
+ }
2221
+ }
2222
+ }
2223
+
2224
+ };
2225
+
2226
+ }).call(FoldMode.prototype);
2227
+
2228
+ });