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