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