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